diff --git a/polymer-perf/eduke32/Apple/include/ogg/config_types.h b/polymer-perf/eduke32/Apple/include/ogg/config_types.h deleted file mode 100644 index 496e900f2..000000000 --- a/polymer-perf/eduke32/Apple/include/ogg/config_types.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __CONFIG_TYPES_H__ -#define __CONFIG_TYPES_H__ - -/* these are filled in by configure */ -typedef int16_t ogg_int16_t; -typedef u_int16_t ogg_uint16_t; -typedef int32_t ogg_int32_t; -typedef u_int32_t ogg_uint32_t; -typedef int64_t ogg_int64_t; - -#endif diff --git a/polymer-perf/eduke32/Apple/include/ogg/ogg.h b/polymer-perf/eduke32/Apple/include/ogg/ogg.h deleted file mode 100644 index 9082679d9..000000000 --- a/polymer-perf/eduke32/Apple/include/ogg/ogg.h +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel libogg include - last mod: $Id: ogg.h 7188 2004-07-20 07:26:04Z xiphmont $ - - ********************************************************************/ -#ifndef _OGG_H -#define _OGG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct { - long endbyte; - int endbit; - - unsigned char *buffer; - unsigned char *ptr; - long storage; -} oggpack_buffer; - -/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ - -typedef struct { - unsigned char *header; - long header_len; - unsigned char *body; - long body_len; -} ogg_page; - -/* ogg_stream_state contains the current encode/decode state of a logical - Ogg bitstream **********************************************************/ - -typedef struct { - unsigned char *body_data; /* bytes from packet bodies */ - long body_storage; /* storage elements allocated */ - long body_fill; /* elements stored; fill mark */ - long body_returned; /* elements of fill returned */ - - - int *lacing_vals; /* The values that will go to the segment table */ - ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact - this way, but it is simple coupled to the - lacing fifo */ - long lacing_storage; - long lacing_fill; - long lacing_packet; - long lacing_returned; - - unsigned char header[282]; /* working space for header encode */ - int header_fill; - - int e_o_s; /* set when we have buffered the last packet in the - logical bitstream */ - int b_o_s; /* set after we've written the initial page - of a logical bitstream */ - long serialno; - long pageno; - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ - ogg_int64_t granulepos; - -} ogg_stream_state; - -/* ogg_packet is used to encapsulate the data and metadata belonging - to a single raw Ogg/Vorbis packet *************************************/ - -typedef struct { - unsigned char *packet; - long bytes; - long b_o_s; - long e_o_s; - - ogg_int64_t granulepos; - - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ -} ogg_packet; - -typedef struct { - unsigned char *data; - int storage; - int fill; - int returned; - - int unsynced; - int headerbytes; - int bodybytes; -} ogg_sync_state; - -/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ - -extern void oggpack_writeinit(oggpack_buffer *b); -extern void oggpack_writetrunc(oggpack_buffer *b,long bits); -extern void oggpack_writealign(oggpack_buffer *b); -extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); -extern void oggpack_reset(oggpack_buffer *b); -extern void oggpack_writeclear(oggpack_buffer *b); -extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); -extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); -extern long oggpack_look(oggpack_buffer *b,int bits); -extern long oggpack_look1(oggpack_buffer *b); -extern void oggpack_adv(oggpack_buffer *b,int bits); -extern void oggpack_adv1(oggpack_buffer *b); -extern long oggpack_read(oggpack_buffer *b,int bits); -extern long oggpack_read1(oggpack_buffer *b); -extern long oggpack_bytes(oggpack_buffer *b); -extern long oggpack_bits(oggpack_buffer *b); -extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); - -extern void oggpackB_writeinit(oggpack_buffer *b); -extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); -extern void oggpackB_writealign(oggpack_buffer *b); -extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); -extern void oggpackB_reset(oggpack_buffer *b); -extern void oggpackB_writeclear(oggpack_buffer *b); -extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); -extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits); -extern long oggpackB_look(oggpack_buffer *b,int bits); -extern long oggpackB_look1(oggpack_buffer *b); -extern void oggpackB_adv(oggpack_buffer *b,int bits); -extern void oggpackB_adv1(oggpack_buffer *b); -extern long oggpackB_read(oggpack_buffer *b,int bits); -extern long oggpackB_read1(oggpack_buffer *b); -extern long oggpackB_bytes(oggpack_buffer *b); -extern long oggpackB_bits(oggpack_buffer *b); -extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b); - -/* Ogg BITSTREAM PRIMITIVES: encoding **************************/ - -extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); -extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); - -/* Ogg BITSTREAM PRIMITIVES: decoding **************************/ - -extern int ogg_sync_init(ogg_sync_state *oy); -extern int ogg_sync_clear(ogg_sync_state *oy); -extern int ogg_sync_reset(ogg_sync_state *oy); -extern int ogg_sync_destroy(ogg_sync_state *oy); - -extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); -extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); -extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); -extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); -extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); -extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); - -/* Ogg BITSTREAM PRIMITIVES: general ***************************/ - -extern int ogg_stream_init(ogg_stream_state *os,int serialno); -extern int ogg_stream_clear(ogg_stream_state *os); -extern int ogg_stream_reset(ogg_stream_state *os); -extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); -extern int ogg_stream_destroy(ogg_stream_state *os); -extern int ogg_stream_eos(ogg_stream_state *os); - -extern void ogg_page_checksum_set(ogg_page *og); - -extern int ogg_page_version(ogg_page *og); -extern int ogg_page_continued(ogg_page *og); -extern int ogg_page_bos(ogg_page *og); -extern int ogg_page_eos(ogg_page *og); -extern ogg_int64_t ogg_page_granulepos(ogg_page *og); -extern int ogg_page_serialno(ogg_page *og); -extern long ogg_page_pageno(ogg_page *og); -extern int ogg_page_packets(ogg_page *og); - -extern void ogg_packet_clear(ogg_packet *op); - - -#ifdef __cplusplus -} -#endif - -#endif /* _OGG_H */ - - - - - - diff --git a/polymer-perf/eduke32/Apple/include/ogg/os_types.h b/polymer-perf/eduke32/Apple/include/ogg/os_types.h deleted file mode 100644 index 32dcb8bff..000000000 --- a/polymer-perf/eduke32/Apple/include/ogg/os_types.h +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $ - - ********************************************************************/ -#ifndef _OS_TYPES_H -#define _OS_TYPES_H - -/* make it easy on the folks that want to compile the libs with a - different malloc than stdlib */ -#define _ogg_malloc malloc -#define _ogg_calloc calloc -#define _ogg_realloc realloc -#define _ogg_free free - -#if defined(_WIN32) - -# if defined(__CYGWIN__) -# include <_G_config.h> - typedef _G_int64_t ogg_int64_t; - typedef _G_int32_t ogg_int32_t; - typedef _G_uint32_t ogg_uint32_t; - typedef _G_int16_t ogg_int16_t; - typedef _G_uint16_t ogg_uint16_t; -# elif defined(__MINGW32__) - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - typedef unsigned long long ogg_uint64_t; -# elif defined(__MWERKS__) - typedef long long ogg_int64_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; -# else - /* MSVC/Borland */ - typedef __int64 ogg_int64_t; - typedef __int32 ogg_int32_t; - typedef unsigned __int32 ogg_uint32_t; - typedef __int16 ogg_int16_t; - typedef unsigned __int16 ogg_uint16_t; -# endif - -#elif defined(__MACOS__) - -# include - typedef SInt16 ogg_int16_t; - typedef UInt16 ogg_uint16_t; - typedef SInt32 ogg_int32_t; - typedef UInt32 ogg_uint32_t; - typedef SInt64 ogg_int64_t; - -#elif defined(__MACOSX__) /* MacOS X Framework build */ - -# include - typedef int16_t ogg_int16_t; - typedef u_int16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef u_int32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - -#elif defined(__BEOS__) - - /* Be */ -# include - typedef int16_t ogg_int16_t; - typedef u_int16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef u_int32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - -#elif defined (__EMX__) - - /* OS/2 GCC */ - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - -#elif defined (DJGPP) - - /* DJGPP */ - typedef short ogg_int16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - -#elif defined(R5900) - - /* PS2 EE */ - typedef long ogg_int64_t; - typedef int ogg_int32_t; - typedef unsigned ogg_uint32_t; - typedef short ogg_int16_t; - -#elif defined(__SYMBIAN32__) - - /* Symbian GCC */ - typedef signed short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef signed int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long int ogg_int64_t; - -#else - -# include -# include - -#endif - -#endif /* _OS_TYPES_H */ diff --git a/polymer-perf/eduke32/Apple/include/vorbis/codec.h b/polymer-perf/eduke32/Apple/include/vorbis/codec.h deleted file mode 100644 index b23fe0af7..000000000 --- a/polymer-perf/eduke32/Apple/include/vorbis/codec.h +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - - ******************************************************************** - - function: libvorbis codec headers - last mod: $Id: codec.h 13293 2007-07-24 00:09:47Z xiphmont $ - - ********************************************************************/ - -#ifndef _vorbis_codec_h_ -#define _vorbis_codec_h_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include - -typedef struct vorbis_info{ - int version; - int channels; - long rate; - - /* The below bitrate declarations are *hints*. - Combinations of the three values carry the following implications: - - all three set to the same value: - implies a fixed rate bitstream - only nominal set: - implies a VBR stream that averages the nominal bitrate. No hard - upper/lower limit - upper and or lower set: - implies a VBR bitstream that obeys the bitrate limits. nominal - may also be set to give a nominal rate. - none set: - the coder does not care to speculate. - */ - - long bitrate_upper; - long bitrate_nominal; - long bitrate_lower; - long bitrate_window; - - void *codec_setup; -} vorbis_info; - -/* vorbis_dsp_state buffers the current vorbis audio - analysis/synthesis state. The DSP state belongs to a specific - logical bitstream ****************************************************/ -typedef struct vorbis_dsp_state{ - int analysisp; - vorbis_info *vi; - - float **pcm; - float **pcmret; - int pcm_storage; - int pcm_current; - int pcm_returned; - - int preextrapolate; - int eofflag; - - long lW; - long W; - long nW; - long centerW; - - ogg_int64_t granulepos; - ogg_int64_t sequence; - - ogg_int64_t glue_bits; - ogg_int64_t time_bits; - ogg_int64_t floor_bits; - ogg_int64_t res_bits; - - void *backend_state; -} vorbis_dsp_state; - -typedef struct vorbis_block{ - /* necessary stream state for linking to the framing abstraction */ - float **pcm; /* this is a pointer into local storage */ - oggpack_buffer opb; - - long lW; - long W; - long nW; - int pcmend; - int mode; - - int eofflag; - ogg_int64_t granulepos; - ogg_int64_t sequence; - vorbis_dsp_state *vd; /* For read-only access of configuration */ - - /* local storage to avoid remallocing; it's up to the mapping to - structure it */ - void *localstore; - long localtop; - long localalloc; - long totaluse; - struct alloc_chain *reap; - - /* bitmetrics for the frame */ - long glue_bits; - long time_bits; - long floor_bits; - long res_bits; - - void *internal; - -} vorbis_block; - -/* vorbis_block is a single block of data to be processed as part of -the analysis/synthesis stream; it belongs to a specific logical -bitstream, but is independant from other vorbis_blocks belonging to -that logical bitstream. *************************************************/ - -struct alloc_chain{ - void *ptr; - struct alloc_chain *next; -}; - -/* vorbis_info contains all the setup information specific to the - specific compression/decompression mode in progress (eg, - psychoacoustic settings, channel setup, options, codebook - etc). vorbis_info and substructures are in backends.h. -*********************************************************************/ - -/* the comments are not part of vorbis_info so that vorbis_info can be - static storage */ -typedef struct vorbis_comment{ - /* unlimited user comment fields. libvorbis writes 'libvorbis' - whatever vendor is set to in encode */ - char **user_comments; - int *comment_lengths; - int comments; - char *vendor; - -} vorbis_comment; - - -/* libvorbis encodes in two abstraction layers; first we perform DSP - and produce a packet (see docs/analysis.txt). The packet is then - coded into a framed OggSquish bitstream by the second layer (see - docs/framing.txt). Decode is the reverse process; we sync/frame - the bitstream and extract individual packets, then decode the - packet back into PCM audio. - - The extra framing/packetizing is used in streaming formats, such as - files. Over the net (such as with UDP), the framing and - packetization aren't necessary as they're provided by the transport - and the streaming layer is not used */ - -/* Vorbis PRIMITIVES: general ***************************************/ - -extern void vorbis_info_init(vorbis_info *vi); -extern void vorbis_info_clear(vorbis_info *vi); -extern int vorbis_info_blocksize(vorbis_info *vi,int zo); -extern void vorbis_comment_init(vorbis_comment *vc); -extern void vorbis_comment_add(vorbis_comment *vc, char *comment); -extern void vorbis_comment_add_tag(vorbis_comment *vc, - char *tag, char *contents); -extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count); -extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag); -extern void vorbis_comment_clear(vorbis_comment *vc); - -extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); -extern int vorbis_block_clear(vorbis_block *vb); -extern void vorbis_dsp_clear(vorbis_dsp_state *v); -extern double vorbis_granule_time(vorbis_dsp_state *v, - ogg_int64_t granulepos); - -/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ - -extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op); -extern int vorbis_analysis_headerout(vorbis_dsp_state *v, - vorbis_comment *vc, - ogg_packet *op, - ogg_packet *op_comm, - ogg_packet *op_code); -extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); - -extern int vorbis_bitrate_addblock(vorbis_block *vb); -extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, - ogg_packet *op); - -/* Vorbis PRIMITIVES: synthesis layer *******************************/ -extern int vorbis_synthesis_idheader(ogg_packet *op); -extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, - ogg_packet *op); - -extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_synthesis_restart(vorbis_dsp_state *v); -extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); -extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); - -extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag); -extern int vorbis_synthesis_halfrate_p(vorbis_info *v); - -/* Vorbis ERRORS and return codes ***********************************/ - -#define OV_FALSE -1 -#define OV_EOF -2 -#define OV_HOLE -3 - -#define OV_EREAD -128 -#define OV_EFAULT -129 -#define OV_EIMPL -130 -#define OV_EINVAL -131 -#define OV_ENOTVORBIS -132 -#define OV_EBADHEADER -133 -#define OV_EVERSION -134 -#define OV_ENOTAUDIO -135 -#define OV_EBADPACKET -136 -#define OV_EBADLINK -137 -#define OV_ENOSEEK -138 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/polymer-perf/eduke32/Apple/include/vorbis/vorbisenc.h b/polymer-perf/eduke32/Apple/include/vorbis/vorbisenc.h deleted file mode 100644 index 82797a496..000000000 --- a/polymer-perf/eduke32/Apple/include/vorbis/vorbisenc.h +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: vorbis encode-engine setup - last mod: $Id: vorbisenc.h 13293 2007-07-24 00:09:47Z xiphmont $ - - ********************************************************************/ - -#ifndef _OV_ENC_H_ -#define _OV_ENC_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "codec.h" - -extern int vorbis_encode_init(vorbis_info *vi, - long channels, - long rate, - - long max_bitrate, - long nominal_bitrate, - long min_bitrate); - -extern int vorbis_encode_setup_managed(vorbis_info *vi, - long channels, - long rate, - - long max_bitrate, - long nominal_bitrate, - long min_bitrate); - -extern int vorbis_encode_setup_vbr(vorbis_info *vi, - long channels, - long rate, - - float quality /* quality level from 0. (lo) to 1. (hi) */ - ); - -extern int vorbis_encode_init_vbr(vorbis_info *vi, - long channels, - long rate, - - float base_quality /* quality level from 0. (lo) to 1. (hi) */ - ); - -extern int vorbis_encode_setup_init(vorbis_info *vi); - -extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); - - /* deprecated rate management supported only for compatability */ -#define OV_ECTL_RATEMANAGE_GET 0x10 -#define OV_ECTL_RATEMANAGE_SET 0x11 -#define OV_ECTL_RATEMANAGE_AVG 0x12 -#define OV_ECTL_RATEMANAGE_HARD 0x13 - -struct ovectl_ratemanage_arg { - int management_active; - - long bitrate_hard_min; - long bitrate_hard_max; - double bitrate_hard_window; - - long bitrate_av_lo; - long bitrate_av_hi; - double bitrate_av_window; - double bitrate_av_window_center; -}; - - - /* new rate setup */ -#define OV_ECTL_RATEMANAGE2_GET 0x14 -#define OV_ECTL_RATEMANAGE2_SET 0x15 - -struct ovectl_ratemanage2_arg { - int management_active; - - long bitrate_limit_min_kbps; - long bitrate_limit_max_kbps; - long bitrate_limit_reservoir_bits; - double bitrate_limit_reservoir_bias; - - long bitrate_average_kbps; - double bitrate_average_damping; -}; - - - -#define OV_ECTL_LOWPASS_GET 0x20 -#define OV_ECTL_LOWPASS_SET 0x21 - -#define OV_ECTL_IBLOCK_GET 0x30 -#define OV_ECTL_IBLOCK_SET 0x31 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - - diff --git a/polymer-perf/eduke32/Apple/include/vorbis/vorbisfile.h b/polymer-perf/eduke32/Apple/include/vorbis/vorbisfile.h deleted file mode 100644 index 569b3f44a..000000000 --- a/polymer-perf/eduke32/Apple/include/vorbis/vorbisfile.h +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.h 13293 2007-07-24 00:09:47Z xiphmont $ - - ********************************************************************/ - -#ifndef _OV_FILE_H_ -#define _OV_FILE_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include -#include "codec.h" - -/* The function prototypes for the callbacks are basically the same as for - * the stdio functions fread, fseek, fclose, ftell. - * The one difference is that the FILE * arguments have been replaced with - * a void * - this is to be used as a pointer to whatever internal data these - * functions might need. In the stdio case, it's just a FILE * cast to a void * - * - * If you use other functions, check the docs for these functions and return - * the right values. For seek_func(), you *MUST* return -1 if the stream is - * unseekable - */ -typedef struct { - size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); - int (*seek_func) (void *datasource, ogg_int64_t offset, int whence); - int (*close_func) (void *datasource); - long (*tell_func) (void *datasource); -} ov_callbacks; - -/* a few sets of convenient callbacks, especially for use under - * Windows where ov_open_callbacks() should always be used instead of - * ov_open() to avoid problems with incompatable crt.o version linking - * issues. */ - -static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){ - if(f==NULL)return(-1); - return fseek(f,off,whence); -} - -static ov_callbacks OV_CALLBACKS_DEFAULT = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap, - (int (*)(void *)) fclose, - (long (*)(void *)) ftell -}; - -static ov_callbacks OV_CALLBACKS_NOCLOSE = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap, - (int (*)(void *)) NULL, - (long (*)(void *)) ftell -}; - -static ov_callbacks OV_CALLBACKS_STREAMONLY = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) NULL, - (int (*)(void *)) fclose, - (long (*)(void *)) NULL -}; - -static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) NULL, - (int (*)(void *)) NULL, - (long (*)(void *)) NULL -}; - -#define NOTOPEN 0 -#define PARTOPEN 1 -#define OPENED 2 -#define STREAMSET 3 -#define INITSET 4 - -typedef struct OggVorbis_File { - void *datasource; /* Pointer to a FILE *, etc. */ - int seekable; - ogg_int64_t offset; - ogg_int64_t end; - ogg_sync_state oy; - - /* If the FILE handle isn't seekable (eg, a pipe), only the current - stream appears */ - int links; - ogg_int64_t *offsets; - ogg_int64_t *dataoffsets; - long *serialnos; - ogg_int64_t *pcmlengths; /* overloaded to maintain binary - compatability; x2 size, stores both - beginning and end values */ - vorbis_info *vi; - vorbis_comment *vc; - - /* Decoding working state local storage */ - ogg_int64_t pcm_offset; - int ready_state; - long current_serialno; - int current_link; - - double bittrack; - double samptrack; - - ogg_stream_state os; /* take physical pages, weld into a logical - stream of packets */ - vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ - vorbis_block vb; /* local working space for packet->PCM decode */ - - ov_callbacks callbacks; - -} OggVorbis_File; - - -extern int ov_clear(OggVorbis_File *vf); -extern int ov_fopen(char *path,OggVorbis_File *vf); -extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); -extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); - -extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); -extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); -extern int ov_test_open(OggVorbis_File *vf); - -extern long ov_bitrate(OggVorbis_File *vf,int i); -extern long ov_bitrate_instant(OggVorbis_File *vf); -extern long ov_streams(OggVorbis_File *vf); -extern long ov_seekable(OggVorbis_File *vf); -extern long ov_serialnumber(OggVorbis_File *vf,int i); - -extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); -extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); -extern double ov_time_total(OggVorbis_File *vf,int i); - -extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page(OggVorbis_File *vf,double pos); - -extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek_lap(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos); - -extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf); -extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); -extern double ov_time_tell(OggVorbis_File *vf); - -extern vorbis_info *ov_info(OggVorbis_File *vf,int link); -extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); - -extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples, - int *bitstream); -extern long ov_read(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream); -extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2); - -extern int ov_halfrate(OggVorbis_File *vf,int flag); -extern int ov_halfrate_p(OggVorbis_File *vf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - - diff --git a/polymer-perf/eduke32/Apple/lib/libSDLmain.a b/polymer-perf/eduke32/Apple/lib/libSDLmain.a deleted file mode 100644 index cdb70ab16..000000000 Binary files a/polymer-perf/eduke32/Apple/lib/libSDLmain.a and /dev/null differ diff --git a/polymer-perf/eduke32/Apple/lib/libogg.a b/polymer-perf/eduke32/Apple/lib/libogg.a deleted file mode 100644 index c80168202..000000000 Binary files a/polymer-perf/eduke32/Apple/lib/libogg.a and /dev/null differ diff --git a/polymer-perf/eduke32/Apple/lib/libvorbis.a b/polymer-perf/eduke32/Apple/lib/libvorbis.a deleted file mode 100644 index 534eae131..000000000 Binary files a/polymer-perf/eduke32/Apple/lib/libvorbis.a and /dev/null differ diff --git a/polymer-perf/eduke32/Apple/lib/libvorbisenc.a b/polymer-perf/eduke32/Apple/lib/libvorbisenc.a deleted file mode 100644 index ec030df0a..000000000 Binary files a/polymer-perf/eduke32/Apple/lib/libvorbisenc.a and /dev/null differ diff --git a/polymer-perf/eduke32/Apple/lib/libvorbisfile.a b/polymer-perf/eduke32/Apple/lib/libvorbisfile.a deleted file mode 100644 index 0942ec1d7..000000000 Binary files a/polymer-perf/eduke32/Apple/lib/libvorbisfile.a and /dev/null differ diff --git a/polymer-perf/eduke32/ChangeLog b/polymer-perf/eduke32/ChangeLog deleted file mode 100644 index 9b5988ed5..000000000 --- a/polymer-perf/eduke32/ChangeLog +++ /dev/null @@ -1,84 +0,0 @@ -EDuke32: - -Added: activatecheat CON command to trick the game into thinking a specific cheat was typed in -Added: addlogvar console command to print the value of a gamevar -Added: althud to get/setuserdef to allow forcing the althud on or off -Added: ambient light level slider in video setup and r_ambientlight cvar -Added: a menu option and cvar to control crosshair size -Added: animtilerange to .def format to allow assigning animation flags to dummytiles -Added: basic Mac OSX support -Added: cmenu CON command and current_menu special gamevar to jump to a different menu index when a menu is being drawn -Added: code to automatically replace "SPACE" in quote 13 with "OPEN" -Added: color code support to minitext -Added: CON access to tsprite via new EVENT_ANIMATESPRITES event and gettspr/settspr commands -Added: crosshairscale to get/setuserdef to allow manipulation of the crosshair size -Added: display_bonus_screen to setuserdef to allow coders to force the bonus screen to display when using startlevel -Added: drag-and-drop support for maps, CONs, GRPs, et cetera -Added: experimental software-based 3D model visibility checking (r_modelocclusionchecking) -Added: extended control over console text display via osdeditpal/osdeditshade/osdhightile/osdpromptpal/osdpromptshade/osdtextmode/osdtextshade/osdtextpal cvars and a new menu option to switch console text between "nice" sprite-based rendering and "fast" internal text rendering -Added: gettimedate CON command to get the current month/day/year/time into gamevars -Added: htflags member to get/setactor to control the spritenoshade/spritenvg/spriteshadow flags -Added: line numbers to in-game CON errors thrown when attempting to operate on invalid data and improved error messages -Added: map listing printout to "map" console command when no map name is given -Added: menu option to control multiplayer death messages and cvar r_obituaries -Added: mod directory selection to startup and unified "configuration" and "game" tabs of startup window -Added: new alternate version of the small HUD (enabled by default) and a menu option to turn it off if so desired and several hud_* cvars to control it -Added: new brightness/contrast/gamma controls and new cvars vid_brightness, vid_contrast and vid_gamma -Added: new sound configuration menu which allows changing bitrate, sample size and voices in-game -Added: obituaries to get/setuserdef to allow forcing the multiplayer obituaries on or off -Added: r_downsize cvar and texture quality slider to video settings menu, defaults to medium and allows hightile textures without the nocompress flag to be scaled down to improve performance -Added: r_fullbrights cvar to control rendering fullbright pixels for 8-bit tiles in OpenGL -Added: savemapstate/loadmapstate/clearmapstate commands to manipulate map states and GAMEVAR_FLAG_NORESET (131072) to allow specific gamevars to be preserved when the map state is loaded -Added: scriptsize CON command to set the CON script size manually to avoid resizing the chunk of memory several times at startup with large CONs -Added: setdefname CON command to set the name of the definitions file to be loaded -Added: setgamepalette CON command to change between normal/water/slime/nightvision palettes manually -Added: support for changing the crosshair color via the crosshaircolor console command -Added: support for changing the window title of a mod via the setgamename command -Added: support for colored console text -Added: support for importing configuration data from duke3d.cfg when a config specified by command line or CON isn't found -Added: support for saving/loading the state of a map separately from savegames, enabling Hexen and Half-Life style map setups -Added: vsync menu option and cvar (r_swapinterval) -Changed: adjusted framerate counter averaging -Changed: improved detection of external IP address for multiplayer -Changed: improved multiplayer text line wrapping -Changed: improved startup time on Windows -Changed: increased max sound definitions to 2560 -Changed: modified ldist to return 0 instead of 1 when the points checked are the same, but changed CON divide-by-zero errors into soft errors -Changed: renamed binds.cfg to cfgname_binds.cfg, where cfgname is the name of the main configuration file in use -Changed: reworked HUD level stats display -Changed: updated user map menu -Changed: various fairly insignificant optimizations -Changed: various improvements to many other menus -Fixed: 8-bit fullscreen palette corruption bug -Fixed: autoloading from directories other than ~/.eduke32/autoload on Linux -Fixed: bounds checking for htg_t member used with getactor/setactor -Fixed: bug where a projectile's extra_rand wasn't applied with certain weapon flags -Fixed: bug where hitscan projectile trails would continue through walls after the projectile hit -Fixed: bug with console command history and added new "history" command to print out the current history -Fixed: console crash with TCs without tile 1141 -Fixed: gibs not assuming the palette of the actor which spawned them in all cases -Fixed: occasional crash when spawning a sprite with no owner -Fixed: out-of-sync bug with DeathMessages = 0 in cfg -Fixed: problems with definemodelframe and nonexistent models -Fixed: problem with devistator rocket timing which caused an unintentional nerf of the devistator's damage -Fixed: problem with eshoot returning -1 when firing RPGs -Fixed: problem with invalid gamearray definitions mangling further errors in the log -Fixed: problem with model rendering when using animation blending and added option to toggle it to the video menu -Fixed: problem with weapon up/down transition when using pipebombs with PIPEBOMB_CONTROL set to PIPEBOMB_TIMER -Fixed: random CON value corruption issue which occurred dependent on the memory addresses and size of the compiled CON code -Fixed: several situations in which invalid memory access occurred while using noclip -Fixed: text spacing problem with gametext - -Mapster32: - -Added: gradient background in tile selector info at bottom of screen to improve readability -Added: drag-and-drop support for maps, GRPs, et cetera -Changed: improved tile grouping support, tiles.cfg now controls the various Duke-specific actor and item related functions in 2D mode as well as 2D mode sprite colors -Changed: use underwater palette when in an underwater sector -Fixed: bug where wall coordinate editing didn't properly move both sides of a wall -Fixed: crash with previous/next map in dir shortcut keys when a .map file in the current directory is invalid -Fixed: issue in file selector where sometimes jumping to a map on the list by typing the first letter of its name would leave you at the wrong place in the map list -Fixed: possible crashes due to invalid memory access associated with the file selector -Fixed: problem where sometimes the tile selector would select the wrong tile -Fixed: problem where the tile group list wouldn't refresh after alt-tab - diff --git a/polymer-perf/eduke32/ChangeLog.html b/polymer-perf/eduke32/ChangeLog.html deleted file mode 100644 index 712b2627b..000000000 --- a/polymer-perf/eduke32/ChangeLog.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - ChangeLog for EDuke32 - - - - -

ChangeLog for EDuke32

-

1.4.0 beta 2, released July 18, 2006

- -

Core changes

-
    -
  • reworked/enhanced Polymost shading
  • -
  • cleaned up code to properly build without Polymost/OpenGL support
  • -
  • added widescreen support for Polymost
  • -
  • added support for toggling correct HUD model rendering on/off
  • -
  • removed broken support for linking OpenGL statically
  • -
  • added support for DDS textures (JF)
  • -
  • added support for dynamically loading GTK (JF)
  • -
-

Game changes

-
    -
  • new startup window (JF)
  • -
  • added support for using the mouse and a joystick simultaneously (JF)
  • -
  • fixed an issue preventing skill selection, bonus screen and episode ending animation sounds from playing
  • -
  • fixed a problem where the player was unable to exit some pools of water in some maps
  • -
  • made further adjustments to the weapon properties in order to more closely emulate Duke 1.5
  • -
  • fixed an issue where you could disable map exits in multiplayer, have all players quit, start a single player game and then have exits continue to kill you
  • -
-

Multiplayer changes

-
    -
  • fixed numerous minor bugs in the voting system
  • -
  • added a more noticeable message to indicate that the player hasn't voted yet in an active vote
  • -
  • added support for /me in text chat
  • -
  • increased size of player chat icon
  • -
  • added "nat-free" support from Adam Fazakerley
  • -
  • fixed inventory respawn bug
  • -
  • minor fixes to DukesterX 1.5 compatibility wrapper
  • -
-

CON changes

-
    -
  • reworked movement_lock member of the player struct to use bit flags
  • -
  • reworked findnearactor3d, findnearactor3dvar, findnearsprite3d, and findnearsprite3dvar
  • -
  • added findnearactorz, findnearactorzvar, findnearspritez, and findnearspritezvar
  • -
  • added WEAPON_FLAG_RESET (65536) to weapon system in order to properly emulate the chaingun and freezer
  • -
  • fixed "eshoot" and added "ezshoot"
  • -
  • reworked weapon system; note that your custom weapons may need adjustments to work again
  • -
  • updated sample enhance.con
  • -
- -


Please see JonoF's JFDuke3D release notes here for information on features JFDuke3D shares with EDuke32

- -
Richard "TerminX" Gobeille (terminx@gmail.com)
- - - diff --git a/polymer-perf/eduke32/GNU.TXT b/polymer-perf/eduke32/GNU.TXT deleted file mode 100644 index 358ef6fb3..000000000 --- a/polymer-perf/eduke32/GNU.TXT +++ /dev/null @@ -1,87 +0,0 @@ -GNU GENERAL PUBLIC LICENSE -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -Preamble -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - -a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. - -b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. - -c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - -a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - -b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - -c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) -The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. -If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - -END OF TERMS AND CONDITIONS diff --git a/polymer-perf/eduke32/MakeDistributions b/polymer-perf/eduke32/MakeDistributions deleted file mode 100644 index a30641076..000000000 --- a/polymer-perf/eduke32/MakeDistributions +++ /dev/null @@ -1,47 +0,0 @@ -# GNU Makefile to prepare source and binary distributions. -# make -f MakeDistributions [source|binary] - -SOURCEFILES=GNU.TXT buildlic.txt \ - Makefile Makefile.deps Makefile.msvc Makefile.watcom MakeDistributions \ - duke3d.def.sample SEHELP.HLP STHELP.HLP enhance.con.sample names.h - -BINARYFILES=mapster32.exe eduke32.exe GNU.TXT buildlic.txt \ - ChangeLog.html setup.exe duke3d.def.sample SEHELP.HLP STHELP.HLP \ - ChangeLog enhance.con.sample duke3d_w32.exe names.h - -.PHONY: source binary - -datenow=$(shell date +%Y%m%d) - -sourcedir=eduke32_src_$(datenow) -binarydir=eduke32_$(datenow) - -all: source binary - -source: - rm -rf $(sourcedir) $(sourcedir).zip - mkdir -p $(sourcedir) $(sourcedir)/eobj $(sourcedir)/obj - mkdir -p $(sourcedir)/eobj.nix $(sourcedir)/obj.nix - touch $(sourcedir)/eobj/keep.me $(sourcedir)/obj/keep.me - touch $(sourcedir)/eobj.nix/keep.me $(sourcedir)/obj.nix/keep.me - cp $(SOURCEFILES) $(sourcedir) - find . -name "*~" -exec rm -rf '{}' ';'; - find . -name "*.orig" -exec rm -rf '{}' ';'; - find . -name "*.rej" -exec rm -rf '{}' ';'; - find . -name "*.mine" -exec rm -rf '{}' ';'; - find . -name "*.c.r*" -exec rm -rf '{}' ';'; - find . -name "*.h.r*" -exec rm -rf '{}' ';'; - cp -R source rsrc $(sourcedir) - find $(sourcedir) | grep -i svn | xargs rm -rf - kzip -r $(sourcedir).zip $(sourcedir) - -binary: - make RELEASE=1 -# upx -9 mapster32.exe eduke32.exe duke3d_w32.exe setup.exe - rm -rf $(binarydir) - mkdir $(binarydir) -# mkdir $(binarydir) $(binarydir)/models - cp $(BINARYFILES) $(binarydir) -# cp models/* $(binarydir)/models - kzip -r $(binarydir).zip $(binarydir) - diff --git a/polymer-perf/eduke32/Makefile b/polymer-perf/eduke32/Makefile deleted file mode 100644 index 58df36edf..000000000 --- a/polymer-perf/eduke32/Makefile +++ /dev/null @@ -1,305 +0,0 @@ -# -# EDuke32 Makefile for GNU Make -# - -include Makefile.common - - -# SDK locations - adjust to match your setup -ifneq ($(DXROOT_OVERRIDE),) - DXROOT=$(DXROOT_OVERRIDE) -else - DXROOT=../sdk/dx - #DXROOT=c:/sdks/directx/dx8 -endif - - -# Build locations -SRC=source -RSRC=rsrc -ESRC=$(EROOT)/src -EINC=$(EROOT)/include -INC=$(SRC) -o=o -# ENETROOT=$(ESRC)/enet - -ifneq (0,$(RELEASE)) - # Debugging disabled - debug+= $(F_NO_STACK_PROTECTOR) -else - # Debugging enabled - ifneq (0,$(KRANDDEBUG)) - debug+= -fno-inline -fno-inline-functions -fno-inline-functions-called-once - endif -endif - -OURCFLAGS=$(BASECFLAGS) \ - -I$(INC) -I$(EINC) -I$(SRC)/jmact -I$(JAUDIOLIBDIR)/include -I$(ENETDIR)/include \ - $(ARCH) - -OURCXXFLAGS=$(BASECXXFLAGS) -NASMFLAGS=$(BASEASFLAGS) - - -JAUDIOLIBDIR=$(SRC)/jaudiolib -JAUDIOLIB=libjfaudiolib.a - -ENETDIR=$(SRC)/enet -ENETLIB=libenet.a - -include $(EROOT)/Makefile.shared - - - -ifeq ($(PLATFORM),WINDOWS) - OBJ=obj_win - EOBJ=eobj_win - LIBS+= $(L_SSP) -Wl,--enable-auto-import -else - LIBS+= -ldl -pthread - ifneq (0,$(PROFILER)) - LIBS+= -lprofiler - debug+= -pg - endif - OBJ=obj - EOBJ=eobj -endif - -JMACTOBJ=$(OBJ)/file_lib.$o \ - $(OBJ)/control.$o \ - $(OBJ)/keyboard.$o \ - $(OBJ)/mouse.$o \ - $(OBJ)/mathutil.$o \ - $(OBJ)/scriplib.$o \ - $(OBJ)/animlib.$o - -GAMEOBJS=$(OBJ)/game.$o \ - $(OBJ)/actors.$o \ - $(OBJ)/anim.$o \ - $(OBJ)/config.$o \ - $(OBJ)/demo.$o \ - $(OBJ)/gamedef.$o \ - $(OBJ)/gameexec.$o \ - $(OBJ)/gamevars.$o \ - $(OBJ)/global.$o \ - $(OBJ)/menus.$o \ - $(OBJ)/namesdyn.$o \ - $(OBJ)/net.$o \ - $(OBJ)/player.$o \ - $(OBJ)/premap.$o \ - $(OBJ)/savegame.$o \ - $(OBJ)/sector.$o \ - $(OBJ)/rts.$o \ - $(OBJ)/osdfuncs.$o \ - $(OBJ)/osdcmds.$o \ - $(OBJ)/grpscan.$o \ - $(OBJ)/sounds.$o \ - $(JMACTOBJ) - -EDITOROBJS=$(OBJ)/astub.$o \ - $(OBJ)/m32def.$o \ - $(OBJ)/m32exec.$o \ - $(OBJ)/m32vars.$o \ - $(OBJ)/mathutil.$o \ - $(OBJ)/sounds_mapster32.$o - -# PLATFORM SPECIFIC SETTINGS - -ifeq ($(PLATFORM),LINUX) - OURCFLAGS += -fno-pic - NASMFLAGS += -f elf - LIBS += -lvorbisfile -lvorbis -logg -endif - -ifeq ($(PLATFORM),DARWIN) - ifeq (1,$(SDL_FRAMEWORK)) - APPLE_INCLUDE_DIR=$(abspath Apple/include) - OURCFLAGS += -fno-pic -I$(APPLE_INCLUDE_DIR) -I/Library/Frameworks/SDL.framework/Headers \ - -I/Library/Frameworks/SDL_mixer.framework/Headers - LIBS += -read_only_relocs suppress -LApple/lib -lvorbisfile -lvorbis -logg -lm \ - -Wl,-framework,SDL -Wl,-framework,SDL_mixer Apple/lib/libSDLmain.a \ - -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \ - -Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \ - -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \ - -Wl,-framework,QuickTime -lm - # I like to have the SDLMain.m from the OSX SDL package to be in this dir: - LIBS += $(realpath SDLMain.m) - else - OURCFLAGS += -fno-pic -I$(SDLROOT)/include -I$(SDLROOT)/include/SDL - LIBS += -read_only_relocs suppress -lvorbisfile -lvorbis -logg -lm -lSDL_mixer \ - -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,OpenGL \ - -Wl,-framework,CoreMidi -Wl,-framework,AudioUnit \ - -Wl,-framework,AudioToolbox -Wl,-framework,IOKit -Wl,-framework,AGL \ - -Wl,-framework,QuickTime -lm - endif - NASMFLAGS += -f Mach-O -endif - -ifeq ($(PLATFORM),WINDOWS) - OURCFLAGS += -fno-pic -DUNDERSCORES -I$(DXROOT)/include - NASMFLAGS+= -DUNDERSCORES -f win32 - LIBS += -L$(JAUDIOLIBDIR)/third-party/mingw32/lib -lvorbisfile -lvorbis -logg -lwsock32 -lws2_32 -lwinmm -ldsound - GAMEOBJS+= $(OBJ)/gameres.$o $(OBJ)/winbits.$o $(OBJ)/startwin.game.$o $(OBJ)/music.$o $(OBJ)/midi.$o $(OBJ)/mpu401.$o - EDITOROBJS+= $(OBJ)/buildres.$o - JAUDIOLIB=libjfaudiolib_win32.a - ENETLIB=libenet_win32.a -else -# -lGLU to build with gluBuild2DMipmaps - ifeq ($(RENDERTYPE),SDL) - ifeq (0,$(SDL_FRAMEWORK)) - OURCFLAGS+= $(subst -Dmain=SDL_main,,$(shell $(SDLCONFIG) --cflags)) - LIBS+= -lSDL_mixer - else - OURCFLAGS += -DSDL_FRAMEWORK - endif - - ifeq (1,$(HAVE_GTK2)) - OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) - GAMEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o - EDITOROBJS+= $(OBJ)/editor_banner.$o - endif - - GAMEOBJS+= $(OBJ)/game_icon.$o $(OBJ)/sdlmusic.$o - EDITOROBJS+= $(OBJ)/build_icon.$o - endif -endif - - -OURCFLAGS+= $(BUILDCFLAGS) -OURCXXFLAGS+= $(BUILDCFLAGS) - -MISCLINKOPTS= -ifeq ($(PLATFORM),WINDOWS) - MISCLINKOPTS+= -Wl,--large-address-aware -endif -ifneq (0,$(KRANDDEBUG)) - MISCLINKOPTS+=-Wl,-Map=$@.memmap -endif -ifneq (0,$(PROFILER)) - MISCLINKOPTS+=-pg -endif - -ifeq ($(PRETTY_OUTPUT),1) -.SILENT: -endif -.PHONY: clean all engine $(EOBJ)/$(ENGINELIB) $(EOBJ)/$(EDITORLIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) - -# TARGETS - -all: notice eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) - -all: - $(BUILD_FINISHED) - @ls -l eduke32$(EXESUFFIX) - @ls -l mapster32$(EXESUFFIX) - -notice: - $(BUILD_STARTED) - -eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) - $(LINK_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(STDCPPLIB) $(MISCLINKOPTS); then $(LINK_OK); else $(LINK_FAILED); fi -ifeq (1,$(RELEASE)) - ifeq (0,$(DEBUGANYWAY)) - $(STRIP) eduke32$(EXESUFFIX) - endif -endif - -mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) - $(LINK_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(STDCPPLIB) $(MISCLINKOPTS); then $(LINK_OK); else $(LINK_FAILED); fi -ifeq (1,$(RELEASE)) - ifeq (0,$(DEBUGANYWAY)) - $(STRIP) mapster32$(EXESUFFIX) - endif -endif - -include Makefile.deps - -.PHONY: enginelib editorlib -enginelib editorlib: - -mkdir -p $(EOBJ) -ifeq ($(PRETTY_OUTPUT),1) - printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(EROOT)\033[0;35m \033[0m\n" -endif - $(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" $@ -#\ - DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\ - USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) PROFILER=$(PROFILER)\ - NOASM=$(NOASM) NEDMALLOC=$(NEDMALLOC) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) $@ -ifeq ($(PRETTY_OUTPUT),1) - printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n" -endif - -$(EOBJ)/$(ENGINELIB): enginelib -$(EOBJ)/$(EDITORLIB): editorlib -$(JAUDIOLIBDIR)/$(JAUDIOLIB): -ifeq ($(PRETTY_OUTPUT),1) - printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(JAUDIOLIBDIR)\033[0;35m \033[0m\n" -endif - $(MAKE) -C $(JAUDIOLIBDIR) #PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) DEBUGANYWAY=$(DEBUGANYWAY) -ifeq ($(PRETTY_OUTPUT),1) - printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n" -endif - -$(ENETDIR)/$(ENETLIB): -ifeq ($(PRETTY_OUTPUT),1) - printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(ENETDIR)\033[0;35m \033[0m\n" -endif - $(MAKE) -C $(ENETDIR) #PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) -ifeq ($(PRETTY_OUTPUT),1) - printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n" -endif - - -# RULES -$(OBJ)/%.$o: $(SRC)/%.nasm - $(COMPILE_STATUS) - $(AS) $(NASMFLAGS) $< -o $@ - -$(OBJ)/%.$o: $(SRC)/%.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/%.cpp - $(COMPILE_STATUS) - if $(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/jmact/%.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/misc/%.rc - $(COMPILE_STATUS) - if $(RC) -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC) -DPOLYMER=$(POLYMER); then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/util/%.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(RSRC)/%.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/game_banner.$o: $(RSRC)/game_banner.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -Wno-pointer-sign -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(RSRC)/game_banner.c: $(RSRC)/game.bmp - echo "#include " > $@ - gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@ -$(RSRC)/editor_banner.c: $(RSRC)/build.bmp - echo "#include " > $@ - gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@ - -# PHONIES - -clean: - -rm -f $(OBJ)/* eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) core* duke3d_w32$(EXESUFFIX) && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean - -veryclean: clean - -rm -f $(EOBJ)/* $(RSRC)/*banner* diff --git a/polymer-perf/eduke32/Makefile.common b/polymer-perf/eduke32/Makefile.common deleted file mode 100644 index 02f636251..000000000 --- a/polymer-perf/eduke32/Makefile.common +++ /dev/null @@ -1,101 +0,0 @@ - -## common definitions for Makefile, build/Makefile, source/enet/Makefile and -## source/jaudiolib/Makefile - -# Use colored output -PRETTY_OUTPUT ?= 1 - -# DirectX SDK location - if nonempty, overrides the DXROOTs of the individual -# Makefiles. Should be set to an absolute path since this Makefile is included -# at different directory levels -DXROOT_OVERRIDE:= - -# Engine options -# USE_OPENGL - enables basic OpenGL Polymost renderer -# POLYMER - enables fancy Polymer renderer -# NOASM - disables the use of inline assembly pragmas -# LINKED_GTK - enables compile-time linkage to GTK -# -POLYMER = 1 -USE_OPENGL = 1 -NOASM = 0 -LINKED_GTK = 0 -BUILD32_ON_64 = 0 -NEDMALLOC = 1 - -ifeq (0,$(USE_OPENGL)) - POLYMER = 0 -endif - - -# Debugging/Build options -# RELEASE - 1 = no debugging -# DEBUGANYWAY - 1 = include debug symbols even when generating release code -# KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system -# EFENCE - 1 = compile with Electric Fence for malloc() debugging -# OPTLEVEL - 0..3 = GCC optimization strategy -# -RELEASE?=1 -DEBUGANYWAY?=0 -KRANDDEBUG?=0 -EFENCE?=0 -OPTLEVEL?=2 -PROFILER?=0 -NOSOUND?=0 - -ifneq (0,$(KRANDDEBUG)) - RELEASE=0 -endif -ifneq (0,$(PROFILER)) - DEBUGANYWAY=1 -endif - - -# Tools -CC=gcc -CXX=g++ -AS=nasm -AR=ar -RC=windres -RANLIB=ranlib -STRIP=strip - -# compiler flags etc. -LIBS=-lm -ifneq (0,$(RELEASE)) - # Debugging disabled - debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) -else - # Debugging enabled - debug=-ggdb -O0 -DDEBUGGINGAIDS - ifeq ($(PLATFORM),LINUX) - LIBS+=-rdynamic - endif - ifneq (0,$(PROFILER)) - LIBS+= -lprofiler - debug+= -pg - endif - ifneq (0,$(KRANDDEBUG)) - debug+=-DKRANDDEBUG=1 - endif -endif -ifneq (0,$(DEBUGANYWAY)) - debug+=-ggdb -endif - -W_NO_UNUSED_RESULT := $(shell echo '' | $(CC) -E -Wno-unused-result - 2>/dev/null && echo -Wno-unused-result) -W_NO_UNUSED_RESULT := $(findstring -Wno-unused-result,$(W_NO_UNUSED_RESULT)) - -BASECFLAGS=$(debug) -W -Wall -Wimplicit -Werror-implicit-function-declaration \ - -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS -D_FORTIFY_SOURCE=2 \ - $(F_JUMP_TABLES) $(W_NO_UNUSED_RESULT) - -BASECXXFLAGS= -fno-exceptions -fno-rtti -BASEASFLAGS=-s #-g - - -# Misc. stuff that is constant between Makefiles -EROOT:=build - -# will be potentially overridden in build/Makefile.shared -EXESUFFIX= diff --git a/polymer-perf/eduke32/Makefile.deps b/polymer-perf/eduke32/Makefile.deps deleted file mode 100644 index 9abb7cd36..000000000 --- a/polymer-perf/eduke32/Makefile.deps +++ /dev/null @@ -1,67 +0,0 @@ -duke3d_h=$(EINC)/build.h $(EINC)/polymer.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/cache1d.h $(EINC)/baselayer.h $(SRC)/jmact/file_lib.h $(SRC)/jmact/keyboard.h $(SRC)/jmact/control.h $(INC)/gamedefs.h $(INC)/function.h $(INC)/config.h $(INC)/sounds.h $(INC)/rts.h $(INC)/_rts.h $(INC)/soundefs.h $(JAUDIOLIBDIR)/include/fx_man.h $(JAUDIOLIBDIR)/include/music.h $(INC)/namesdyn.h $(INC)/duke3d.h $(INC)/player.h $(INC)/sector.h $(INC)/game.h $(INC)/actors.h - -gamedef_h=$(SRC)/gamedef.h $(SRC)/gameexec.h $(SRC)/gamevars.h - -$(OBJ)/game.$o: $(SRC)/game.c $(SRC)/jmact/scriplib.h $(duke3d_h) $(INC)/osdfuncs.h $(INC)/osdcmds.h $(INC)/grpscan.h $(INC)/demo.h -$(OBJ)/actors.$o: $(SRC)/actors.c $(duke3d_h) -$(OBJ)/anim.$o: $(SRC)/anim.c $(duke3d_h) $(SRC)/jmact/animlib.h -$(OBJ)/demo.$o: $(SRC)/demo.c $(duke3d_h) -$(OBJ)/gamedef.$o: $(SRC)/gamedef.c $(duke3d_h) $(gamedef_h) -$(OBJ)/gameexec.$o: $(SRC)/gameexec.c $(SRC)/gamestructures.c $(duke3d_h) $(gamedef_h) -$(OBJ)/gamestructures.$o: $(SRC)/gamestructures.c $(duke3d_h) $(gamedef_h) -$(OBJ)/gamevars.$o: $(SRC)/gamevars.c $(SRC)/gamestructures.c $(duke3d_h) $(gamedef_h) -$(OBJ)/global.$o: $(SRC)/*.c $(SRC)/global.c $(duke3d_h) -$(OBJ)/mdump.$o: $(SRC)/mdump.cpp $(SRC)/mdump.h -$(OBJ)/menus.$o: $(SRC)/menus.c $(duke3d_h) $(SRC)/jmact/mouse.h -$(OBJ)/namesdyn.$o: $(SRC)/namesdyn.c $(duke3d_h) -$(OBJ)/net.$o: $(SRC)/net.c $(duke3d_h) -$(OBJ)/player.$o: $(SRC)/player.c $(duke3d_h) -$(OBJ)/premap.$o: $(SRC)/premap.c $(duke3d_h) $(EINC)/osd.h -$(OBJ)/savegame.$o: $(SRC)/savegame.c $(duke3d_h) -$(OBJ)/sector.$o: $(SRC)/sector.c $(duke3d_h) -$(OBJ)/sounds.$o: $(SRC)/sounds.c $(duke3d_h) -$(OBJ)/rts.$o: $(SRC)/rts.c $(duke3d_h) -$(OBJ)/config.$o: $(SRC)/config.c $(duke3d_h) $(SRC)/jmact/scriplib.h $(INC)/_functio.h -$(OBJ)/winbits.$o: $(SRC)/winbits.c -$(OBJ)/osdfuncs.$o: $(SRC)/names.h $(EINC)/build.h $(EINC)/osd.h -$(OBJ)/osdcmds.$o: $(SRC)/osdcmds.c $(INC)/osdcmds.h $(EINC)/osd.h $(duke3d_h) - -$(OBJ)/astub.$o: $(SRC)/astub.c $(SRC)/mapster32.h $(EINC)/build.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/editor.h - -$(OBJ)/game_icon.$o: $(RSRC)/game_icon.c -$(OBJ)/build_icon.$o: $(RSRC)/build_icon.c - -$(OBJ)/grpscan.$o: $(SRC)/grpscan.c $(EINC)/compat.h $(EINC)/baselayer.h $(EINC)/scriptfile.h $(EINC)/cache1d.h $(EINC)/crc32.h $(INC)/grpscan.h -$(OBJ)/gameres.$o: $(SRC)/misc/gameres.rc $(SRC)/startwin.game.h $(RSRC)/game.bmp $(RSRC)/game_icon.ico -$(OBJ)/buildres.$o: $(SRC)/misc/buildres.rc $(EINC)/startwin.editor.h $(RSRC)/build.bmp $(RSRC)/build_icon.ico -$(OBJ)/startwin.game.$o: $(SRC)/startwin.game.c $(duke3d_h) $(EINC)/build.h $(EINC)/winlayer.h $(EINC)/compat.h $(INC)/grpscan.h -$(OBJ)/startgtk.game.$o: $(SRC)/startgtk.game.c $(duke3d_h) $(EINC)/dynamicgtk.h $(EINC)/build.h $(EINC)/baselayer.h $(EINC)/compat.h - - -# jMACT objects -$(OBJ)/animlib.$o: $(SRC)/jmact/animlib.c $(SRC)/jmact/animlib.h $(EINC)/compat.h -$(OBJ)/file_lib.$o: $(SRC)/jmact/file_lib.c $(SRC)/jmact/file_lib.h -$(OBJ)/control.$o: $(SRC)/jmact/control.c $(SRC)/jmact/control.h $(SRC)/jmact/keyboard.h $(SRC)/jmact/mouse.h $(EINC)/baselayer.h -$(OBJ)/keyboard.$o: $(SRC)/jmact/keyboard.c $(SRC)/jmact/keyboard.h $(EINC)/compat.h $(EINC)/baselayer.h -$(OBJ)/mouse.$o: $(SRC)/jmact/mouse.c $(SRC)/jmact/mouse.h $(EINC)/baselayer.h -$(OBJ)/mathutil.$o: $(SRC)/jmact/mathutil.c -$(OBJ)/scriplib.$o: $(SRC)/jmact/scriplib.c $(SRC)/jmact/scriplib.h $(SRC)/jmact/_scrplib.h $(EINC)/compat.h - -# jAudioLib objects - -$(OBJ)/mv_mix.$o: $(SRC)/jaudiolib/mv_mix.nasm -$(OBJ)/mv_mix16.$o: $(SRC)/jaudiolib/mv_mix16.nasm -$(OBJ)/mvreverb.$o: $(SRC)/jaudiolib/mvreverb.nasm -$(OBJ)/mv_mix-c.$o: $(SRC)/jaudiolib/mv_mix-c.c -$(OBJ)/mvreverb-c.$o: $(SRC)/jaudiolib/mvreverb-c.c -$(OBJ)/pitch.$o: $(SRC)/jaudiolib/pitch.c $(SRC)/jaudiolib/pitch.h -$(OBJ)/multivoc.$o: $(SRC)/jaudiolib/multivoc.c $(SRC)/jaudiolib/linklist.h $(SRC)/jaudiolib/pitch.h $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/_multivc.h -$(OBJ)/fx_man.$o: $(SRC)/jaudiolib/fx_man.c $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/ll_man.h $(SRC)/jaudiolib/fx_man.h -$(OBJ)/dsoundout.$o: $(SRC)/jaudiolib/dsoundout.c $(SRC)/jaudiolib/dsoundout.h -$(OBJ)/openal.$o: $(SRC)/jaudiolib/openal.c $(SRC)/jaudiolib/openal.h -$(OBJ)/dsl.$o: $(SRC)/jaudiolib/dsl.c $(SRC)/jaudiolib/dsl.h $(EINC)/compat.h - -$(OBJ)/midi.$o: $(SRC)/midi.c $(SRC)/_midi.h $(SRC)/midi.h $(JAUDIOLIBDIR)/include/music.h -$(OBJ)/mpu401.$o: $(SRC)/mpu401.c $(SRC)/mpu401.h $(JAUDIOLIBDIR)/include/music.h -$(OBJ)/music.$o: $(SRC)/music.c $(SRC)/midi.h $(SRC)/mpu401.h $(JAUDIOLIBDIR)/include/music.h - diff --git a/polymer-perf/eduke32/Makefile.msvc b/polymer-perf/eduke32/Makefile.msvc deleted file mode 100644 index 36d15829a..000000000 --- a/polymer-perf/eduke32/Makefile.msvc +++ /dev/null @@ -1,186 +0,0 @@ -# EDuke32 Makefile for Microsoft NMake - -SRC=source -OBJ=obj_win -EROOT=build -EINC=$(EROOT)\include -EOBJ=eobj_win -INC=$(SRC) -RSRC=rsrc -o=obj - -JAUDIOLIBDIR=$(SRC)\jaudiolib -JAUDIOLIB=libjfaudiolib.lib - -ENETDIR=$(SRC)\enet -ENETLIB=libenet.lib - -ENGINELIB=engine.lib -EDITORLIB=build.lib - -# the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll -# this path should match build\Makefile.msvc -WDKROOT="H:\WinDDK\7600.16385.1" -DXROOT="H:\Microsoft DirectX SDK (February 2010)" - -!ifdef DEBUG -# debugging options -flags_cl= /Od /Zi -flags_link=/DEBUG -!else -# release options -flags_cl=/O2 /GL /arch:SSE /MP /I$(WDKROOT)\inc\crt -flags_link=/RELEASE /LTCG /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386 -!endif - -ENGINEOPTS=/DUSE_OPENGL /DPOLYMER - -CC=cl -AS=ml -LINK=link /nologo /opt:ref -MT=mt -CFLAGS= /MT /J /nologo $(flags_cl) \ - /I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \ - /W2 $(ENGINEOPTS) \ - /I$(DXROOT)\include /DRENDERTYPEWIN=1 - -LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib dxguid.lib comctl32.lib \ - vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib - -LIBS=/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /NODEFAULTLIB:libcmt.lib \ - /NODEFAULTLIB:libcmtd.lib $(LIBS) - -ASFLAGS=/nologo /coff /c -EXESUFFIX=.exe -!ifdef DEBUG -CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE" -LIBS=$(LIBS) msvcrtd.lib -!else -# comment msvcrt_winxp.obj if not using the WDK -LIBS=$(LIBS) msvcrt.lib msvcrt_winxp.obj -!endif - -JMACTOBJ=$(OBJ)\file_lib.$o \ - $(OBJ)\control.$o \ - $(OBJ)\keyboard.$o \ - $(OBJ)\mouse.$o \ - $(OBJ)\mathutil.$o \ - $(OBJ)\scriplib.$o - -AUDIOLIBOBJ=$(OBJ)\midi.$o $(OBJ)\music.$o $(OBJ)\mpu401.$o - -GAMEOBJS=$(OBJ)\game.$o \ - $(OBJ)\actors.$o \ - $(OBJ)\anim.$o \ - $(OBJ)\demo.$o \ - $(OBJ)\gamedef.$o \ - $(OBJ)\gameexec.$o \ - $(OBJ)\gamevars.$o \ - $(OBJ)\global.$o \ - $(OBJ)\menus.$o \ - $(OBJ)\namesdyn.$o \ - $(OBJ)\net.$o \ - $(OBJ)\player.$o \ - $(OBJ)\premap.$o \ - $(OBJ)\savegame.$o \ - $(OBJ)\sector.$o \ - $(OBJ)\rts.$o \ - $(OBJ)\config.$o \ - $(OBJ)\animlib.$o\ - $(OBJ)\osdfuncs.$o \ - $(OBJ)\osdcmds.$o \ - $(OBJ)\grpscan.$o \ - $(OBJ)\winbits.$o \ - $(OBJ)\gameres.res \ - $(OBJ)\startwin.game.$o \ - $(JMACTOBJ) \ - $(AUDIOLIBOBJ) \ - $(OBJ)\sounds.$o \ -!ifdef DEBUG - $(OBJ)\mdump.$o -!endif - -EDITOROBJS=$(OBJ)\astub.$o \ - $(OBJ)\mathutil.$o \ - $(OBJ)\m32def.$o \ - $(OBJ)\m32vars.$o \ - $(OBJ)\m32exec.$o \ - $(OBJ)\sounds_mapster32.$o \ - $(OBJ)\buildres.res \ - $(AUDIOLIB_FX) \ -!ifdef DEBUG - $(OBJ)\mdump.$o -!endif - - -# RULES -.SUFFIXES: .masm - -{$(SRC)\}.masm{$(OBJ)\}.$o: - $(AS) /c $(ASFLAGS) /Fo$@ $< - -{$(SRC)\jmact}.c{$(OBJ)\}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -{$(SRC)\util}.c{$(OBJ)\}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -{$(SRC)\}.c{$(OBJ)\}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -{$(SRC)\}.cpp{$(OBJ)\}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -{$(SRC)\misc}.rc{$(OBJ)\}.res: - $(RC) /i$(EINC)\ /i$(SRC)\ /DPOLYMER /fo$@ /r $< - - -# TARGETS -all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) # duke3d_w32$(EXESUFFIX); - -eduke32$(EXESUFFIX): $(GAMEOBJS) $(EOBJ)\$(ENGINELIB) $(JAUDIOLIBDIR)\$(JAUDIOLIB) $(ENETDIR)\$(ENETLIB) - $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib\x86 $(flags_link) /MAP $** $(LIBS) - $(MT) -manifest $(RSRC)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest - -mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)\$(ENGINELIB) $(EOBJ)\$(EDITORLIB) $(JAUDIOLIBDIR)\$(JAUDIOLIB) - $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib\x86 $(flags_link) /MAP $** $(LIBS) - $(MT) -manifest $(RSRC)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest - -!include Makefile.deps - -enginelib editorlib: AlwaysBuild - -mkdir $(EOBJ) - echo OBJ=$(MAKEDIR)\$(EOBJ)\ > $(EOBJ)\overrides.mak - echo CFLAGS=$(ENGINEOPTS) >> $(EOBJ)\overrides.mak - cd $(EROOT) - nmake /f Makefile.msvc "OVERRIDES=$(MAKEDIR)\$(EOBJ)\overrides.mak" $@ - cd $(MAKEDIR) - -jaudiolib: - cd $(JAUDIOLIBDIR) - nmake /f Makefile.msvc - cd $(MAKEDIR) - -enet: - cd $(ENETDIR) - nmake /f Makefile.msvc - cd $(MAKEDIR) - -AlwaysBuild: ; -$(EOBJ)\$(EDITORLIB): editorlib ; -$(EOBJ)\$(ENGINELIB): enginelib ; -$(JAUDIOLIBDIR)\$(JAUDIOLIB): jaudiolib ; -$(ENETDIR)\$(ENETLIB): enet ; - -# PHONIES -clean: - -del /Q $(OBJ)\* eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) duke3d_w32$(EXESUFFIX) \ - *.pdb *.map *.manifest - cd $(JAUDIOLIBDIR) - nmake /f Makefile.msvc clean - cd $(MAKEDIR)\$(ENETDIR) - nmake /f Makefile.msvc clean - cd $(MAKEDIR) - -veryclean: clean - -del /Q $(EOBJ)\* diff --git a/polymer-perf/eduke32/SEHELP.HLP b/polymer-perf/eduke32/SEHELP.HLP deleted file mode 100644 index c2f1130ec..000000000 --- a/polymer-perf/eduke32/SEHELP.HLP +++ /dev/null @@ -1,35 +0,0 @@ --Sector Effector Help- - - 0 : Rotating Sector - 1 : Pivot Sprite for SE 0 - 2 : Earthquake - 3 : Random Lights After Shot Out - 4 : Random Lights - 6 : Subway - 7 : Teleporter - 8 : Up Open Door Lights - 9 : Down Open Door Lights - 10 : Door Auto Close (Hitag = Delay) - 11 : Rotate Sector Door - 12 : Light Switch - 13 : C-9 Explosive - 14 : Subway Car - 15 : Slide Door (ST 25) - 16 : Rotate Reactor Sector - 17 : Elevator Transport (ST 15) - 18 : Incremental Sector Rise/Fall - 19 : Explosion Lowers Ceiling - 20 : Stretch (ST 27) - 21 : Drop Floor (ST 28) - 22 : Teeth Door Prong (ST 29) - 23 : One-Way Teleporter Destination - 24 : Conveyor Belt or Water Current - 25 : Engine Piston - 27 : Demo Camera - 28 : Lightning - 29 : Float (for Waves) - 30 : Two-Way Train (ST 31) - 31 : Floor Rise/Fall - 32 : Ceiling Rise/Fall - 33 : Earthquake Debris - 36 : Projectile Shooter diff --git a/polymer-perf/eduke32/STHELP.HLP b/polymer-perf/eduke32/STHELP.HLP deleted file mode 100644 index ce0384de8..000000000 --- a/polymer-perf/eduke32/STHELP.HLP +++ /dev/null @@ -1,25 +0,0 @@ --Sector Tags Help- - - 1 : Above Water (SE 7) - 2 : Underwater (SE 7) - 9 : Sliding Star Trek Doors - 15 : Elevator Transport (SE 17) - 16 : Elevator Platform Down - 17 : Elevator Platform Up - 18 : Elevator Down - 19 : Elevator Up - 20 : Ceiling Door - 21 : Floor Door - 22 : Splitting Door - 23 : Swinging Door - 25 : Sliding Door (SE 15) - 26 : Splitting Star Trek Door - 27 : Stretch (SE 20) - 28 : Drop Floor (SE 21) - 29 : Teeth Door Prong (SE 22) - 30 : Rotate and Rise Bridge - 31 : Two-Way Train (SE 30) - 10+++ : One-Time Sound - 32767 : Secret Room - 65534 : End Of Level with Message - 65535 : End Of Level diff --git a/polymer-perf/eduke32/backtrace.dll b/polymer-perf/eduke32/backtrace.dll deleted file mode 100644 index 0ff6d6187..000000000 Binary files a/polymer-perf/eduke32/backtrace.dll and /dev/null differ diff --git a/polymer-perf/eduke32/build/MakeDistributions b/polymer-perf/eduke32/build/MakeDistributions deleted file mode 100644 index 619e50a01..000000000 --- a/polymer-perf/eduke32/build/MakeDistributions +++ /dev/null @@ -1,48 +0,0 @@ -# GNU Makefile to prepare source and binary distributions. -# make -f MakeDistributions [source|binary] - -SOURCEFILES=buildlic.txt ChangeLog LICENSE \ - Makefile Makefile.deps Makefile.shared Makefile.msvc Makefile.watcom \ - MakeDistributions makegnu.bat makemsc.bat makew.bat NAMES.H README - -BINARYFILES=build.exe buildlic.txt ChangeLog fmod.dll \ - game.exe LICENSE NAMES.H neatsong.ogg README - -BINARYCHECKS=checkfmoddll checkneatsongogg - -.PHONY: source binary $(BINARYCHECKS) - -datenow=$(shell date +%Y%m%d) - -sourcedir=txbuild_src_$(datenow) -binarydir=txbuild_$(datenow) - -all: source binary - -source: - rm -rf $(sourcedir) $(sourcedir).zip - mkdir $(sourcedir) $(sourcedir)/obj.gnu $(sourcedir)/obj.watcom $(sourcedir)/obj.msc - touch $(sourcedir)/obj.gnu/keep.me $(sourcedir)/obj.watcom/keep.me $(sourcedir)/obj.msc/keep.me - cp $(SOURCEFILES) $(sourcedir) - find . -name "*~" -exec rm -rf '{}' ';'; - find . -name "*.orig" -exec rm -rf '{}' ';'; - find . -name "*.rej" -exec rm -rf '{}' ';'; - find . -name "*.mine" -exec rm -rf '{}' ';'; - find . -name "*.c.r*" -exec rm -rf '{}' ';'; - find . -name "*.h.r*" -exec rm -rf '{}' ';'; - cp -R src rsrc include devcpp testgame $(sourcedir) - find $(sourcedir) | grep -i svn | xargs rm -rf - rm -f $(sourcedir)/src/tmp/* - touch $(sourcedir)/src/tmp/keep.me - kzip -r $(sourcedir).zip $(sourcedir) - -binary: $(BINARYCHECKS) - make RELEASE=1 - upx --best build.exe game.exe - mkdir $(binarydir) - cp $(BINARYFILES) $(binarydir) - kzip -r $(binarydir).zip $(binarydir) - -# Binary checks -checkfmoddll: fmod.dll -checkneatsongogg: neatsong.ogg diff --git a/polymer-perf/eduke32/build/Makefile b/polymer-perf/eduke32/build/Makefile deleted file mode 100644 index 6799afdc7..000000000 --- a/polymer-perf/eduke32/build/Makefile +++ /dev/null @@ -1,264 +0,0 @@ -# -# Build Makefile for GNU Make -# - -# Notes: -# As of 6 July 2005, the engine should handle optimisations being enabled. -# If things seem to be going wrong, lower or disable optimisations, then -# try again. If things are still going wrong, call me. -# - -include ../Makefile.common - - -# SDK locations for Windows - adjust to match your setup -# -ifneq ($(DXROOT_OVERRIDE),) - DXROOT=$(DXROOT_OVERRIDE) -else - DXROOT=c:/sdks/directx/dx61 -endif -FMODROOTWIN=c:/sdks/fmodapi374win/api - -# Build locations - OBJ gets overridden to the game-specific objects dir -# -OBJ?=obj.gnu -SRC=src -RSRC=rsrc -INC=include - -# ENETROOT=$(SRC)/enet - -# Filename extensions - these won't need to change -# -o=o -res=o -asm=nasm - -# Debugging and release -# -ifneq ($(RELEASE),0) - # Debugging disabled - debug+= $(F_NO_STACK_PROTECTOR) -else - # Debugging enabled - debug+= -DNOSDLPARACHUTE - LIBS+= $(L_SSP) -Wl,--enable-auto-import -endif - -OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -I$(INC) $(ARCH) -OURCXXFLAGS=$(BASECXXFLAGS) -ASFLAGS=$(BASEASFLAGS) - -include Makefile.shared - - -UTILLIBS=-lpthread - -ENGINEOBJS= -ifeq (0,$(NOASM)) - ENGINEOBJS+= $(OBJ)/a.$o -endif - -ifneq ($(PLATFORM),WINDOWS) - LIBS+= -ldl -pthread -endif - - -ENGINEOBJS+= \ - $(OBJ)/a-c.$o \ - $(OBJ)/baselayer.$o \ - $(OBJ)/cache1d.$o \ - $(OBJ)/compat.$o \ - $(OBJ)/crc32.$o \ - $(OBJ)/defs.$o \ - $(OBJ)/engine.$o \ - $(OBJ)/polymost.$o \ - $(OBJ)/hightile.$o \ - $(OBJ)/textfont.$o \ - $(OBJ)/smalltextfont.$o \ - $(OBJ)/kplib.$o \ - $(OBJ)/quicklz.$o \ - $(OBJ)/md4.$o \ - $(OBJ)/osd.$o \ - $(OBJ)/pragmas.$o \ - $(OBJ)/scriptfile.$o \ - $(OBJ)/mutex.$o - -ifeq (1,$(USE_OPENGL)) - ENGINEOBJS+= $(OBJ)/mdsprite.$o - ENGINEOBJS+= $(OBJ)/glbuild.$o -endif - -ifeq (1,$(POLYMER)) - ENGINEOBJS+= $(OBJ)/polymer.$o -endif - -ifeq (1,$(NEDMALLOC)) - ENGINEOBJS+= $(OBJ)/nedmalloc.$o -endif - -EDITOROBJS=$(OBJ)/build.$o \ - $(OBJ)/config.$o - -# PLATFORM SPECIFIC SETTINGS - -ifeq ($(PLATFORM),LINUX) - ASFLAGS+= -f elf -endif -ifeq ($(PLATFORM),DARWIN) - ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o \ - $(OBJ)//osxbits.$o - ASFLAGS += -f Mach-O - OURCFLAGS += -fno-pic - TARGETOPTS += -DNOASM -endif -ifeq ($(PLATFORM),BSD) - ASFLAGS+= -f elf - OURCFLAGS+= -I/usr/X11R6/include -endif -ifeq ($(PLATFORM),WINDOWS) - OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc # -I$(ENETROOT)/include - LIBS+= -lwsock32 -lws2_32 -lwinmm #-L$(ENETROOT) - ASFLAGS+= -DUNDERSCORES -f win32 -endif -ifeq ($(PLATFORM),BEOS) - ASFLAGS+= -f elf - TARGETOPTS+= -DNOASM -endif -ifeq ($(PLATFORM),SYLLABLE) - ASFLAGS+= -f elf -endif - -ifeq ($(RENDERTYPE),SDL) - ENGINEOBJS+= $(OBJ)/sdlayer.$o - OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS)) - - ifeq (1,$(HAVE_GTK2)) - OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) - ENGINEOBJS+= $(OBJ)/gtkbits.$o - ifeq ($(LINKED_GTK),0) - ENGINEOBJS+= $(OBJ)/dynamicgtk.$o - endif - EDITOROBJS+= $(OBJ)/startgtk.editor.$o - endif -endif -ifeq ($(RENDERTYPE),WIN) - ENGINEOBJS+= $(OBJ)/winlayer.$o $(OBJ)/rawinput.$o - EDITOROBJS+= $(OBJ)/startwin.editor.$o -endif - -ifneq (0,$(EFENCE)) - LIBS+= -lefence - OURCFLAGS+= -DEFENCE -endif - -OURCFLAGS+= $(BUILDCFLAGS) - -.SILENT: -.PHONY: clean veryclean all utils enginelib editorlib - -# TARGETS - -UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) md2tool$(EXESUFFIX) - -# all: $(OBJ)/$(ENGINELIB) $(OBJ)/$(EDITORLIB) -utils: $(UTILS) - -enginelib: $(OBJ)/$(ENGINELIB) -$(OBJ)/$(ENGINELIB): $(ENGINEOBJS) - $(BUILD_ECHOFLAGS) - $(ARCHIVE_STATUS) - if $(AR) rc $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi - $(RANLIB) $@ - -editorlib: $(OBJ)/$(EDITORLIB) -$(OBJ)/$(EDITORLIB): $(EDITOROBJS) - $(BUILD_ECHOFLAGS) - $(ARCHIVE_STATUS) - if $(AR) rc $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi - $(RANLIB) $@ - -pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o - $(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^ - -kextract$(EXESUFFIX): $(OBJ)/kextract.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o - $(CC) -o $@ $^ $(UTILLIBS) -kgroup$(EXESUFFIX): $(OBJ)/kgroup.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o - $(CC) -o $@ $^ $(UTILLIBS) -transpal$(EXESUFFIX): $(OBJ)/transpal.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o - $(CC) -o $@ $^ $(UTILLIBS) -wad2art$(EXESUFFIX): $(OBJ)/wad2art.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o - $(CC) -o $@ $^ $(UTILLIBS) -wad2map$(EXESUFFIX): $(OBJ)/wad2map.$o $(OBJ)/pragmas.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o - $(CC) -o $@ $^ $(UTILLIBS) -md2tool$(EXESUFFIX): $(OBJ)/md2tool.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o - $(CC) -o $@ $^ $(UTILLIBS) -generateicon$(EXESUFFIX): $(OBJ)/generateicon.$o $(OBJ)/kplib.$o - $(CC) -o $@ $^ $(UTILLIBS) -cacheinfo$(EXESUFFIX): $(OBJ)/cacheinfo.$o $(OBJ)/compat.$o $(OBJ)/nedmalloc.$o - $(CC) -o $@ $^ $(UTILLIBS) -enumdisplay$(EXESUFFIX): src/misc/enumdisplay.c - $(CC) -g -Os -o $@ $^ $(UTILLIBS) -I$(DXROOT)/include -lgdi32 -mapdump$(EXESUFFIX): $(OBJ)/mapdump.$o - $(CC) -o $@ $^ $(UTILLIBS) - -# DEPENDENCIES -include Makefile.deps - -# RULES -$(OBJ)/%.$o: $(SRC)/%.nasm - $(COMPILE_STATUS) - if $(AS) $(ASFLAGS) $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/%.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/%.m - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/%.cpp - $(COMPILE_STATUS) - if $(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/%.cxx - $(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ - -$(OBJ)/%.$o: $(SRC)/misc/%.rc - $(COMPILE_STATUS) - if $(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC); then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(SRC)/util/%.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/%.$o: $(RSRC)/%.c - $(COMPILE_STATUS) - if $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c - echo "#include " > $@ - gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@ -$(RSRC)/editor_banner.c: $(RSRC)/build.bmp - echo "#include " > $@ - gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@ - -# PHONIES - -clean: - -rm -f $(OBJ)/* - -veryclean: clean - -rm -f $(ENGINELIB) $(EDITORLIB) $(UTILS) - -.PHONY: fixlineends -fixlineends: - for a in `find . -type f \( -name '*.c' -o -name '*.h' -o -name 'Makefile*' \) \! -path '*/.svn/*'`; do \ - echo Fixing $$a && tr -d "\015" < $$a > $$a.fix && mv $$a.fix $$a; \ - done - -# DO NOT DELETE - - diff --git a/polymer-perf/eduke32/build/Makefile.deps b/polymer-perf/eduke32/build/Makefile.deps deleted file mode 100644 index 15f0111de..000000000 --- a/polymer-perf/eduke32/build/Makefile.deps +++ /dev/null @@ -1,47 +0,0 @@ -# Build Engine dependencies -# -$(OBJ)/a-c.$o: $(SRC)/a-c.c $(INC)/a.h -$(OBJ)/a.$o: $(SRC)/a.$(asm) -$(OBJ)/baselayer.$o: $(SRC)/baselayer.c $(INC)/compat.h $(INC)/baselayer.h $(INC)/build.h $(INC)/osd.h -$(OBJ)/build.$o: $(SRC)/build.c $(INC)/build.h $(INC)/pragmas.h $(INC)/compat.h $(INC)/baselayer.h $(INC)/editor.h -$(OBJ)/cache1d.$o: $(SRC)/cache1d.c $(INC)/compat.h $(INC)/cache1d.h $(INC)/pragmas.h $(INC)/baselayer.h -$(OBJ)/compat.$o: $(SRC)/compat.c $(INC)/compat.h -$(OBJ)/config.$o: $(SRC)/config.c $(INC)/compat.h $(INC)/osd.h $(INC)/editor.h -$(OBJ)/crc32.$o: $(SRC)/crc32.c $(INC)/crc32.h -$(OBJ)/defs.$o: $(SRC)/defs.c $(INC)/build.h $(INC)/baselayer.h $(INC)/scriptfile.h $(INC)/compat.h -$(OBJ)/engine.$o: $(SRC)/engine.c $(INC)/compat.h $(INC)/build.h $(INC)/pragmas.h $(INC)/cache1d.h $(INC)/a.h $(INC)/osd.h $(INC)/baselayer.h $(SRC)/engine_priv.h $(INC)/polymost.h $(INC)/hightile.h $(INC)/mdsprite.h $(INC)/polymer.h -$(OBJ)/polymost.$o: $(SRC)/polymost.c $(INC)/md4.h $(INC)/quicklz.h $(INC)/lzwnew.h $(SRC)/engine_priv.h $(INC)/polymost.h $(INC)/hightile.h $(INC)/mdsprite.h -$(OBJ)/hightile.$o: $(SRC)/hightile.c $(INC)/kplib.h $(INC)/hightile.h -$(OBJ)/mdsprite.$o: $(SRC)/mdsprite.c $(SRC)/engine_priv.h $(INC)/polymost.h $(INC)/hightile.h $(INC)/mdsprite.h -$(OBJ)/textfont.$o: $(SRC)/textfont.c -$(OBJ)/smalltextfont.$o: $(SRC)/smalltextfont.c -$(OBJ)/glbuild.$o: $(SRC)/glbuild.c $(INC)/glbuild.h $(INC)/baselayer.h -$(OBJ)/kplib.$o: $(SRC)/kplib.c $(INC)/compat.h -$(OBJ)/quicklz.$o: $(SRC)/quicklz.c $(INC)/quicklz.h -$(OBJ)/lzwnew.$o: $(SRC)/lzwnew.c -$(OBJ)/md4.$o: $(SRC)/md4.c $(INC)/md4.h $(INC)/compat.h -$(OBJ)/osd.$o: $(SRC)/osd.c $(INC)/build.h $(INC)/osd.h $(INC)/compat.h $(INC)/baselayer.h -$(OBJ)/pragmas.$o: $(SRC)/pragmas.c $(INC)/compat.h -$(OBJ)/scriptfile.$o: $(SRC)/scriptfile.c $(INC)/scriptfile.h $(INC)/cache1d.h $(INC)/compat.h -$(OBJ)/sdlayer.$o: $(SRC)/sdlayer.c $(INC)/compat.h $(INC)/sdlayer.h $(INC)/baselayer.h $(INC)/cache1d.h $(INC)/pragmas.h $(INC)/a.h $(INC)/build.h $(INC)/osd.h $(INC)/glbuild.h -$(OBJ)/winlayer.$o: $(SRC)/winlayer.c $(INC)/compat.h $(INC)/winlayer.h $(INC)/baselayer.h $(INC)/pragmas.h $(INC)/build.h $(INC)/a.h $(INC)/osd.h $(INC)/dxdidf.h $(INC)/glbuild.h $(INC)/rawinput.h -$(OBJ)/gtkbits.$o: $(SRC)/gtkbits.c $(INC)/baselayer.h $(INC)/build.h $(INC)/dynamicgtk.h -$(OBJ)/dynamicgtk.$o: $(SRC)/dynamicgtk.c $(INC)/dynamicgtk.h -$(OBJ)/polymer.$o: $(SRC)/polymer.c $(INC)/polymer.h $(INC)/compat.h $(INC)/build.h $(INC)/glbuild.h $(INC)/osd.h $(INC)/pragmas.h $(INC)/mdsprite.h $(INC)/polymost.h -$(OBJ)/nedmalloc.$o: $(SRC)/nedmalloc.c $(INC)/nedmalloc.h $(INC)/malloc.c.h -$(OBJ)/mutex.$o: $(SRC)/mutex.c $(INC)/mutex.h -$(OBJ)/rawinput.$o: $(SRC)/rawinput.c $(INC)/rawinput.h - -$(OBJ)/buildres.$(res): $(SRC)/misc/buildres.rc $(INC)/startwin.editor.h -$(OBJ)/startwin.editor.$o: $(SRC)/startwin.editor.c $(INC)/build.h $(INC)/editor.h $(INC)/winlayer.h $(INC)/compat.h $(INC)/startwin.editor.h -$(OBJ)/startgtk.editor.$o: $(SRC)/startgtk.editor.c $(INC)/baselayer.h $(INC)/build.h $(INC)/editor.h $(INC)/compat.h - -$(OBJ)/build_icon.$o: $(RSRC)/build_icon.c - -$(OBJ)/kextract.$o: $(SRC)/util/kextract.c $(INC)/compat.h -$(OBJ)/kgroup.$o: $(SRC)/util/kgroup.c $(INC)/compat.h -$(OBJ)/transpal.$o: $(SRC)/util/transpal.c $(INC)/compat.h $(INC)/pragmas.h -$(OBJ)/wad2art.$o: $(SRC)/util/wad2art.c $(INC)/compat.h $(INC)/pragmas.h -$(OBJ)/wad2map.$o: $(SRC)/util/wad2map.c $(INC)/compat.h $(INC)/pragmas.h -$(OBJ)/generateicon.$o: $(SRC)/util/generateicon.c -$(OBJ)/cacheinfo.$o: $(SRC)/util/cacheinfo.c $(INC)/compat.h diff --git a/polymer-perf/eduke32/build/Makefile.msvc b/polymer-perf/eduke32/build/Makefile.msvc deleted file mode 100644 index d78bcbb10..000000000 --- a/polymer-perf/eduke32/build/Makefile.msvc +++ /dev/null @@ -1,156 +0,0 @@ -# Build Makefile for Microsoft NMake -!ifdef OVERRIDES -!include $(OVERRIDES) -!endif - -SRC=src -!ifndef OBJ -OBJ=obj.msc -!endif -INC=include\ # -!ifndef CFLAGS -CFLAGS=/DUSE_OPENGL /DPOLYMER # /DNEDMALLOC -!endif - -o=obj -res=res -asm=masm - -ENGINELIB=engine.lib -EDITORLIB=build.lib - -# this path should match eduke32\Makefile.msvc -WDKROOT="C:\WinDDK\7600.16385.1" - -# /D these to enable certain features of the port's compile process -# NOASM When defined, uses C instead of assembly code -!ifdef NOASM -TARGETOPTS=/DNOASM -!endif - -!ifdef DEBUG -# debugging options -flags_cl=/Od /Zi -flags_link=/DEBUG -flags_lib= -!else -# release options -flags_cl=/O2 /GL /arch:SSE /MP /I$(WDKROOT)\inc\crt -flags_link=/RELEASE /LTCG /LIBPATH:$(WDKROOT)\lib\Crt\i386 /LIBPATH:$(WDKROOT)\lib\wxp\i386 -flags_lib=/LTCG -!endif - -CC=cl -AS=ml -RC=rc -LINK=link /opt:ref /nologo -CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC) -ASFLAGS=/nologo /coff /c -EXESUFFIX=.exe -!ifdef DEBUG -CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE" -!endif - -ENGINEOBJS= \ -!ifdef NOASM - $(OBJ)\a-c.$o \ -!else - $(OBJ)\a.$o \ -!endif - $(OBJ)\baselayer.$o \ - $(OBJ)\cache1d.$o \ - $(OBJ)\compat.$o \ - $(OBJ)\crc32.$o \ - $(OBJ)\defs.$o \ - $(OBJ)\engine.$o \ - $(OBJ)\polymost.$o \ - $(OBJ)\hightile.$o \ - $(OBJ)\mdsprite.$o \ - $(OBJ)\textfont.$o \ - $(OBJ)\smalltextfont.$o \ - $(OBJ)\glbuild.$o \ - $(OBJ)\kplib.$o \ - $(OBJ)\quicklz.$o \ - $(OBJ)\lzwnew.$o \ - $(OBJ)\md4.$o \ - $(OBJ)\osd.$o \ - $(OBJ)\pragmas.$o \ - $(OBJ)\scriptfile.$o \ - $(OBJ)\winlayer.$o \ - $(OBJ)\polymer.$o \ - $(OBJ)\mutex.$o \ - $(OBJ)\rawinput.$o - -EDITOROBJS=$(OBJ)\build.$o \ - $(OBJ)\startwin.editor.$o \ - $(OBJ)\config.$o - -RENDERTYPE=WIN -LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib wsock32.lib comctl32.lib dxguid.lib -CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /W2 - -# RULES -.SUFFIXES: .masm - -{$(SRC)}.masm{$(OBJ)}.$o: - $(AS) /c $(ASFLAGS) /Fo$@ $< - -{$(SRC)\tmp}.c{$(OBJ)}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -{$(SRC)\util}.c{$(OBJ)}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -{$(SRC)\misc}.rc{$(OBJ)}.$(res): - $(RC) /i$(INC)\ /fo$@ /r $< - -{$(SRC)}.c{$(OBJ)}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -{$(SRC)}.cpp{$(OBJ)}.$o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -# TARGETS -UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) - -all: $(OBJ)/$(ENGINELIB) $(OBJ)/$(EDITORLIB); -utils: $(UTILS) ; - -enginelib: $(OBJ)\$(ENGINELIB) ; -$(OBJ)\$(ENGINELIB): $(ENGINEOBJS) - lib $(flags_lib) /out:$@ /nologo $** - -editorlib: $(OBJ)\$(EDITORLIB) ; -$(OBJ)\$(EDITORLIB): $(EDITOROBJS) - lib $(flags_lib) /out:$@ /nologo $** - -# the tools -kextract$(EXESUFFIX): $(OBJ)\kextract.$o $(OBJ)\compat.$o $(OBJ)\nedmalloc.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS) - $(MT) -manifest $@.manifest -outputresource:$@ - -kgroup$(EXESUFFIX): $(OBJ)\kgroup.$o $(OBJ)\compat.$o $(OBJ)\nedmalloc.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS) - $(MT) -manifest $@.manifest -outputresource:$@ - -transpal$(EXESUFFIX): $(OBJ)\transpal.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o $(OBJ)\nedmalloc.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS) - $(MT) -manifest $@.manifest -outputresource:$@ - -wad2map$(EXESUFFIX): $(OBJ)\wad2map.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o $(OBJ)\nedmalloc.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS) - $(MT) -manifest $@.manifest -outputresource:$@ - -wad2art$(EXESUFFIX): $(OBJ)\wad2art.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o $(OBJ)\nedmalloc.$o - $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** $(LIBS) - $(MT) -manifest $@.manifest -outputresource:$@ - -# DEPENDENCIES -!include Makefile.deps - -# PHONIES -clean: - -del /Q $(ENGINEOBJS) $(EDITOROBJS) $(OBJ)\kextract.$o $(OBJ)\kgroup.$o $(OBJ)\transpal.$o $(OBJ)\wad2map.$o $(OBJ)\wad2art.$o -veryclean: clean - -del /Q $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB) $(UTILS) *.map *.manifest *.pdb - diff --git a/polymer-perf/eduke32/build/Makefile.shared b/polymer-perf/eduke32/build/Makefile.shared deleted file mode 100644 index ae1348889..000000000 --- a/polymer-perf/eduke32/build/Makefile.shared +++ /dev/null @@ -1,232 +0,0 @@ -# Shared make information between Build engine and games - -ENGINELIB=libengine.a -EDITORLIB=libbuild.a - -SDLCONFIG = /usr/local/bin/sdl-configinvalid - -ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG)) - SDLROOT = /usr/local -else - SDLCONFIG = /usr/bin/sdl-config -endif - -SDL_FRAMEWORK = 0 - -# Overridden for OSes that don't have the cutdown stdc++ that is supc++ -STDCPPLIB=-lsupc++ -BUILDCFLAGS= - -# GCC version, for conditional selection of flags. -# This is easier than trying to squeeze it out of gcc --version: -GCC_MAJOR ?= 4 -ifeq (4,$(GCC_MAJOR)) - F_NO_STACK_PROTECTOR := -fno-stack-protector - # there are some link-time issues with stack protectors, so make it possible to override - F_STACK_PROTECTOR_ALL ?= -fstack-protector-all - F_JUMP_TABLES := -fjump-tables - M_TUNE_GENERIC := -mtune=generic - M_STACKREALIGN := -mstackrealign - L_SSP := -lssp -endif - - -ifndef ARCH - ifeq ($(findstring i686, $(shell uname -m)), i686) - ARCH=-march=pentium3 $(M_TUNE_GENERIC) -mmmx # -msse2 -mfpmath=sse,387 -malign-double $(M_STACKREALIGN) - else - ARCH= - endif -endif - -# Detect the platform if it wasn't explicitly given to us from -# the outside world. This allows cross-compilation by overriding -# CC and giving us PLATFORM specifically. -# -ifndef PLATFORM - uname=$(strip $(shell uname -s)) - PLATFORM=UNKNOWN - ifeq ($(findstring Linux,$(uname)),Linux) - PLATFORM=LINUX - endif - ifeq ($(findstring BSD,$(uname)),BSD) - PLATFORM=BSD - endif - ifeq ($(findstring MINGW,$(uname)),MINGW) - PLATFORM=WINDOWS - endif - ifeq ($(findstring Darwin,$(uname)),Darwin) - PLATFORM=DARWIN - endif - ifeq ($(findstring BeOS,$(uname)),BeOS) - PLATFORM=BEOS - endif - ifeq ($(findstring skyos,$(uname)),skyos) - PLATFORM=SKYOS - endif - ifeq ($(findstring QNX,$(uname)),QNX) - PLATFORM=QNX - endif - ifeq ($(findstring SunOS,$(uname)),SunOS) - PLATFORM=SUNOS - endif - ifeq ($(findstring syllable,$(uname)),syllable) - PLATFORM=SYLLABLE - endif -endif - -ifeq ($(PLATFORM),LINUX) - RENDERTYPE=SDL - BUILDCFLAGS+= -DHAVE_INTTYPES - GTKCOMPAT32=0 - - ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) - ifeq (1,$(BUILD32_ON_64)) - # On my 64bit Gentoo these are the 32bit emulation libs - LIBS+= -m32 -L/emul/linux/x86/usr/lib - BUILDCFLAGS+= -m32 - # Override WITHOUT_GTK=0 - GTKCOMPAT32=1 - else - override NOASM=1 - endif - endif -endif -ifeq ($(PLATFORM),DARWIN) - RENDERTYPE = SDL - BUILDCFLAGS += -DHAVE_INTTYPES - GTKCOMPAT32 = 0 - SDL_FRAMEWORK = 1 - # ASM won't work on PowerPC and currently throws errors on i386 too :-/ - override NOASM = 1 -endif -ifeq ($(PLATFORM),WINDOWS) - RENDERTYPE ?= WIN - BUILDCFLAGS+= -DHAVE_INTTYPES - EXESUFFIX=.exe - LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder -# STDCPPLIB=-lstdc++ -endif -ifeq ($(PLATFORM),BSD) - RENDERTYPE=SDL - BUILDCFLAGS+= -DHAVE_INTTYPES -endif -ifeq ($(PLATFORM),BEOS) - RENDERTYPE=SDL - STDCPPLIB=-lstdc++ -endif -ifeq ($(PLATFORM),SKYOS) - RENDERTYPE=SDL - EXESUFFIX=.app - override NOASM=1 - BUILDCFLAGS+= -DUNDERSCORES - SDLCONFIG= - SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl - LIBS+= -lSDL -lnet -endif -ifeq ($(PLATFORM),QNX) - RENDERTYPE=SDL - override USE_OPENGL=0 - override NOASM=1 - STDCPPLIB=-lstdc++ - LIBS+= -lsocket -endif -ifeq ($(PLATFORM),SUNOS) - RENDERTYPE=SDL - override USE_OPENGL=0 - override NOASM=1 - STDCPPLIB=-lstdc++ - LIBS+= -lsocket -lnsl -endif -ifeq ($(PLATFORM),SYLLABLE) - RENDERTYPE=SDL - override USE_OPENGL=0 - override NOASM=1 -endif - -ifeq ($(RENDERTYPE),SDL) - ifeq ($(SDL_FRAMEWORK),1) - LIBS += -Wl,-framework,SDL - SDLCONFIG_CFLAGS+= -I/Library/Frameworks/SDL.framework/Headers - else - ifneq ($(SDLCONFIG),) - LIBS+= $(shell $(SDLCONFIG) --libs) - SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags) - endif - endif - - ifeq (1,$(WITHOUT_GTK)) - HAVE_GTK2=0 - else - ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No)) - HAVE_GTK2=1 - # On my 64bit Gentoo box I have Cairo enabled which means the libs list includes - # -lpangocairo-1.0 and -lcairo, however the 32bit compatibility libraries don't - # include cairo, so we need to filter out those -l switches in order to link - ifneq ($(LINKED_GTK),0) - ifeq ($(GTKCOMPAT32),1) - LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g') - else - LIBS+= $(shell pkg-config --libs gtk+-2.0) - endif - endif - else - HAVE_GTK2=0 - endif - endif -else - ifeq ($(RENDERTYPE),WIN) - LIBS+= -mwindows -ldxguid - endif -endif - - -BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1 - -ifneq (0,$(USE_OPENGL)) - BUILDCFLAGS+= -DUSE_OPENGL -endif -ifneq (0,$(NOASM)) - BUILDCFLAGS+= -DNOASM -endif -ifneq (0,$(LINKED_GTK)) - BUILDCFLAGS+= -DLINKED_GTK -endif - -ifneq (0,$(POLYMER)) - ifneq (0,$(USE_OPENGL)) - BUILDCFLAGS+= -DPOLYMER - endif -endif - -ifneq (0,$(NEDMALLOC)) - BUILDCFLAGS+= -DNEDMALLOC -endif - -ifeq ($(PRETTY_OUTPUT),1) -BUILD_STARTED = printf "\033[K\033[1;36mBuild started using \"$(CC) $(OURCFLAGS)\"\033[0m\n" -BUILD_ECHOFLAGS = printf "\033[K\033[1;36mEnded compilation in this directory using \"$(CC) $(OURCFLAGS)\"\033[0m\n" -BUILD_FINISHED = printf "\033[K\033[1;36mBuild successful:\033[0m\n" -COMPILE_STATUS = printf "\033[K\033[0mBuilding object \033[1m$@\033[0m...\033[0m\r" -COMPILE_OK = printf "\033[K\033[0;32mBuilt object \033[1;32m$@\033[0;32m \033[0m\n" -COMPILE_FAILED = printf "\033[K\033[0;31mFailed building \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1 -ARCHIVE_STATUS = printf "\033[K\033[0mCreating library archive \033[1m$@\033[0m...\033[0m\r" -ARCHIVE_OK = printf "\033[K\033[0;32mCreated library archive \033[1;32m$@\033[0;32m \033[0m\n" -ARCHIVE_FAILED = printf "\033[K\033[0;31mFailed creating library archive \033[1;31m$@\033[0;31m from\033[0m \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1 -LINK_STATUS = printf "\033[K\033[0;0mLinking executable \033[1m$@\033[0;0m...\033[0m\r" -LINK_OK = printf "\033[K\033[0;32mLinked executable \033[1;32m$@\033[0;32m \033[0m\n" -LINK_FAILED = printf "\033[K\033[0;31mFailed linking executable \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1 -else -BUILD_STARTED = -BUILD_ECHOFLAGS= -BUILD_FINISHED = -COMPILE_STATUS = -COMPILE_OK = true -COMPILE_FAILED = false; exit 1 -ARCHIVE_STATUS = -ARCHIVE_OK = true -ARCHIVE_FAILED = false; exit 1 -LINK_STATUS = -LINK_OK = true -LINK_FAILED = false; exit 1 -endif diff --git a/polymer-perf/eduke32/build/buildlic.txt b/polymer-perf/eduke32/build/buildlic.txt deleted file mode 100644 index 3a3985bb6..000000000 --- a/polymer-perf/eduke32/build/buildlic.txt +++ /dev/null @@ -1,71 +0,0 @@ -BUILD SOURCE CODE LICENSE TERMS: 06/20/2000 - -[1] I give you permission to make modifications to my Build source and - distribute it, BUT: - -[2] Any derivative works based on my Build source may be distributed ONLY - through the INTERNET. - -[3] Distribution of any derivative works MUST be done completely FREE of - charge - no commercial exploitation whatsoever. - -[4] Anything you distribute which uses a part of my Build Engine source - code MUST include: - - [A] The following message somewhere in the archive: - - // "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman - // Ken Silverman's official web site: "http://www.advsys.net/ken" - // See the included license file "BUILDLIC.TXT" for license info. - - [B] This text file "BUILDLIC.TXT" along with it. - - [C] Any source files that you modify must include this message as well: - - // This file has been modified from Ken Silverman's original release - -[5] The use of the Build Engine for commercial purposes will require an - appropriate license arrangement with me. Contact information is - on my web site. - -[6] I take no responsibility for damage to your system. - -[7] Technical support: Before contacting me with questions, please read - and do ALL of the following! - - [A] Look through ALL of my text files. There are 7 of them (including this - one). I like to think that I wrote them for a reason. You will find - many of your answers in the history section of BUILD.TXT and - BUILD2.TXT (they're located inside SRC.ZIP). - - [B] If that doesn't satisfy you, then try going to: - - "http://www.advsys.net/ken/buildsrc" - - where I will maintain a Build Source Code FAQ (or perhaps I might - just provide a link to a good FAQ). - - [C] I am willing to respond to questions, but ONLY if they come at a rate - that I can handle. - - PLEASE TRY TO AVOID ASKING DUPLICATE QUESTIONS! - - As my line of defense, I will post my current policy about - answering Build source questions (right below the E-mail address - on my web site.) You can check there to see if I'm getting - overloaded with questions or not. - - If I'm too busy, it might say something like this: - - I'm too busy to answer Build source questions right now. - Sorry, but don't expect a reply from me any time soon. - - If I'm open for Build source questions, please state your question - clearly and don't include any unsolicited attachments unless - they're really small (like less than 50k). Assume that I have - a 28.8k modem. Also, don't leave out important details just - to make your question appear shorter - making me guess what - you're asking doesn't save me time! - ----------------------------------------------------------------------------- --Ken S. (official web site: http://www.advsys.net/ken) diff --git a/polymer-perf/eduke32/build/doc/build.txt b/polymer-perf/eduke32/build/doc/build.txt deleted file mode 100644 index 56aacdf48..000000000 --- a/polymer-perf/eduke32/build/doc/build.txt +++ /dev/null @@ -1,5081 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. - -BUILD engine Notes (8/14/95): - -BUILD programmed by Ken Silverman - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ GAME KEYS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - ESC = Quit - Mouse = Movement - Arrows = Movement - Lt. Enter = Single-player: Play back game. - Multi-player: View from other player's eyes. - Rt. Enter = Switch between 3D / 2D modes - Lt. +/- = Zoom in 2D mode - A/Z = Move up and down - Left-Ctrl = Shoot - 1/2 = Select weapon -Left-Shift = Run - T = Reset Timing (sets totalclock = 0) - V = Change visibility. In BUILD.H there is a visiblity variable. - It is initialized to 13. It can range from around 8 (darker) - to about 15 (lighter). - P = Change parallaxing sky mode. (0, 1, and 2 (Default = 2) - F12 = Screen capture (saves image as a *.BMP file, starting as file - name CAPTUR00.BMP and incrementing by 1 each time F12 is - pressed. - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ BUILD EDITOR INTRODUCTION: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - -There are 2 modes in the BUILD editor: - 3D EDIT MODE (Same as PLAY MODE but with a mouse cursor) - 2D EDIT MODE (The overhead map of the board with an arrow showing your - position and angle and a mouse cursor) - -It is essential that you use both editor modes: - - Use the 3D EDIT MODE to change the attributes of a sector, wall, or sprite - such as: - - Tile number - Tells which picture in the artwork file goes on the - object. Press V to change. - Shade - The shade of the object. Press -/+ to change. - Repeating - The "smooshiness" of a wall. Also for sprites. Press - keypad 2,4,6,8 to change. - Panning - The starting offset into the tile graphics. Press - Shift + keypad 2,4,6,8 to change. - Height - For ceilings, floors, and sprites. Press PGUP or PGDN - to change. - and there are a few other special attributes. - - Use the 2D EDIT MODE to add, delete, or change the shape of sectors. - - To switch between the two EDIT MODES, press the keypad enter key. - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ 3D EDIT MODE KEYS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - ESC = Quit -keypad ENTER = Flip to the 2D overhead editor - - Mouse = Move mouse cursor - Arrows = Move you in the appropriate directions - Caps Lock = There are 3 different Z coordinate modes in BUILD. - Mode 0: Game mode (default) - Mode 1: Height lock mode - Mode 2: Float mode - Press Caps Lock to switch between the 3 modes. - A and Z move up and down for all 3 modes. - - -Note: For the following keys, it is important to move the mouse cursor to -the right position before using them. Also, if you hold down the first mouse -button, then the item under the mouse cursor will be locked as the -highlighted object while the button is held down. This is useful for the -PGUP/DN keys, when different objects come into view even without moving your -coordinates or the mouse cursor. - There are 4 basic types of objects that can be worked with in this part -of the editor: WALLS, CEILINGS, FLOORS, and SPRITES. - - PGUP/DN = Raise or Lower a ceiling or floor. (If a wall is selected, - the ceiling of that sector will move) Also, if you did a - sector highlight in 2D EDIT MODE, you can raise / lower - multiple sectors at a time. -Ctrl-PGUP/DN = For sprites only, puts sprites exactly on the floor or exactly - on the ceiling. - - V = Tile selection - use arrow keys to move around. Press ENTER - to change the object to the highlighted piece of artwork, or - press ESC to cancel without changes made. - ALT-V = Height selection - works just like V, but this selects the - groudraw height map. - -2,4,6,8 (keypad) = Repeat values (smooshiness of the sizes of pixels) - - think of these keys as arrow keys controlling the bottom - right corner of the bitmap. Normally, this is used for walls - and sprites. If you select a floor or ceiling, all the walls - in that sector will be affected. Perhaps this can be used - to make sprites grow and shrink as they get healthy or hurt. -Shift + -2,4,6,8 (keypad) = Panning values (offset into the tile) - These keys are - useful when the you want a long wall to look continuous when - they normally would not look continuous. - / = Use this key to reset the panning values (if you're lost!) - 5 (keypad) = If you hold down this key down in addition to the 2,4,6,8 - keys (keypad),the values will align at multiples of 8. - .> = This key attempts to match up all the tiles along a wall. It - scans along the walls towards the right as long as the picture - number of the next wall is the same as the original picture - number. Note that some walls may not work right, especially - floor / ceiling steps. - - F = Flip an object. For sprites and walls, this flips the object - x-wise. For ceilings and floors, the objects are flipped in - 8 possible ways. Just keep pressing 'F' to go through - the 8 ways. - ALT-F = When you use relative alignment mode on ceiling and floor - textures, you can press Alt-F on the ceiling or floor to - choose a new wall to align to. It actually rotates the walls - of a sector by 1. - O = Wall orientation (whether it starts from the top or bottom) - Normally, walls are oriented from the top. For example, if - you hold down 2/8 on the keypad in 3D EDIT MODE, the wall - always starts from the top. Orientation works differently - for white lines and red lines, so if a wall doesn't look - right, just press 'O' anyway to see if it get fixed. - -COPY & PASTE - TAB = COPY. Copy the attibutes of the highlighted objects into a - temporary place. The attributes it remembers are: - tile, shade, x-repeat, y-repeat, and cstat values. - Left ENTER = PASTE. Paste the stored attributes over the highlighted - object. Whenever you press ENTER, the y-repeat values stay - the same, and the x-repeat values are adjusted so the pixels - of the bitmaps have a square-aspect ratio. -Ctrl+L.ENTER = Left ENTER with the ctrl key will paste the attribtues to - every wall in a loop (if a wall is highlighted). -Shft+L.ENTER = Left ENTER with the shift key also pressed copies the shade - only. -Ctrl+Shft+L.ENTER = Auto-shade a sector. First make any wall of the loop - as light as the lightest shade you want. Then make any other - wall of the loop as dark as the darkest shade you want. - Finally press Ctrl-Shift Enter on the wall that should be - lightest. Now the loop should be smoothly shaded. If it - is not smoothly shaded, you may need to insert more points - on the walls. - -SECTOR FLAGS: - - P = Make the ceiling of the given sector have a Parallaxing sky - or just a normal ceiling. - G = Make the floor of the given sector have a Groudraw - (floor with height mapping). I do not recommend using this - attribute very extensively yet. (See the H key for selecting - the height map) - E = An option for ceilings and floors. If for some reason, you - want a tile to be smooshed into the normal 64*64 area, press - E to unExpand the tile. Press E again, and the tile will be - expanded, so the pixel size is the same as the normal 64*64 - ceiling/floor. - R = Relative alignment - switch between relative alignment mode - and normal mode. Allows floor / ceiling textures to align - to the first 2 points of a sector. Textures will rotate/pan - with moving sectors properly. Notice that bit 6 of both - sector[].ceilingstat and sector[].floorstat are relative - alignment bits. - -WALL FLAGS: - - B = Make an invisible wall, such as a window, block you from - going through. Since the wall is invisible, you can also - highlight the ceiling right above the window or floor - right below the window. You can block either the front or - the back of the window. If you block the back only, you - will be able to go onto the window sill. - T = Press to make a maskable wall 50/50 transluscent. Press T - again to put the masked wall back to normal mode. - M = Make a maskable wall. Press in the same place you press 'B'. - The masking wall takes all its attributes from the front of - the wall, so it must have the same repeat, panning, and cstat - values as the walls above or below it (if you have a step). - The masking picture number is stored in overpicnum. Also, - the masking walls is also automatically added the the other - side of the wall, with the picture flipped. (see the 'F' - key descripte above) - Shift + M = Make a maskable wall just like 'M' described above, but only - on the front side. - - 1 = Make a 1-way wall. - 2 = Some walls have two different sections. One step on the - ceiling and one step on the floor. Normally they always - have the same attributes. It is possible though, to give - both the top and bottom different attributes by pressing 2 on - that wall. 2 simply makes the bottom wall's attributes - separately editable. Press 2 on either the top or bottom - wall. - O = Wall orientation (whether it starts from the top or bottom) - Normally, walls are oriented from the top. For example, if - you hold down 2/8 on the keypad in 3D EDIT MODE, the wall - always starts from the top. Orientation works differently - for white lines and red lines, so if a wall doesn't look - right, just press 'O' anyway to see if it get fixed. - H = Toggle hitscan pass through bit. Default is pass through. - -SPRITE FLAGS: - - B = When the mouse cursor is on a sprite, this makes a sprite - block you from walking through. Also makes the sprite - sensitive to hitscan. Sprites with the 'B' attribute will - appear pink in 2D EDIT MODE - T = Press to make a sprite 50/50 transluscent. Press T again - to put sprite back to normal mode. - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ 2D EDIT MODE KEYS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - ESC = Show a menu that says, "(N)ew, (L)oad, (S)ave, (Q)uit" - Press ESC again to cancel the menu. - keypad ENTER = Flip back to the 3D edit mode - - Mouse = Move mouse cursor - Left mouse button = If you hold down the left mouse button, you can drag - existing points. To drag multiple points you can use - the right shift key to first select a rectangular - region of points to highlight, then just drag any of - the highlighted points and the rest move with it. -Right mouse button = Moves the player's positions to the mouse cursor. - This is useful when you accidently get stuck somewhere - in the board, or when you need to edit some part of - a sector that is hard to access. - Right Shift = Select a bunch of points for use with dragging around. - Selects all points inside a box. (Use the left mouse - button to drag) - Ctrl+Right Shift = Select a bunch of points for use with dragging around. - Selects all points on a loop. (Use the left mouse - button to drag) - Right Alt = Select a bunch of sectors for either duplication or - dragging around. (see left mouse button for - dragging and the insert key for duplication). - - Arrows = Move player position in the appropriate directions. - The player will be clipped. To jump to a different part - of the board, use the right mouse button. - Space = Press the space bar when drawing new sectors. There - are several ways of drawing new sectors. The following - three ways of drawing sectors can all be done by only - using the space bar. The computer is smart enough to - decide which method you are using. - - 1. Drawing a FULL LOOP - that is, whenever the new - sector meets the old sector, draw over that line - again. In full loop mode the new sector must not - already be in another sector. The loop is done - when you press the space bar at the first point - again. - 2. SPLITTING a sector - press space bar to draw points - at which you want to split a sector. The computer - knows you are done splitting when you end at - another point that's on the edge of the sector you - are splitting. - 3. Drawing a sector COMPLETELY INSIDE another sector. - (for example, columns) To do this, just press space - bar at every point in the loop. The loop is done - when you press the space bar at the first point - again. - Backspace = When plotting points with the space bar, you can use - backspace to get rid of the last point plotted. You - can press the backspace to get rid of all the points - if you didn't want to start a sector at all. - - Insert = Inserts a new point at the midpoint of the highlighted - line. Then you can drag the point to wherever you like. - (If you insert on a red line, the point will be inserted - on both sides of the sector line.) - If a bunch of sectors are selected (see right ALT) then - instead of inserted points, the selected sector bunch - will be duplicated (stamped). Don't forget to drag - the selected sectors after stamping. - - Delete = Use this to delete sprites (blue circles). To delete - points of a sector border, don't press delete. Instead, - drag the point into one of its 2 neighbor points on the - sector. This is easist done if grid locking is on - (mouse cursor is pink). If 2 neighbor points are equal, - one will automatically be deleted. - Right Ctrl-Delete = This deletes the whole sector that the mouse cursor is - in. Note the right ctrl for protection. - (Note: to delete a point of a sector, just drag that point into the next - point and it will automatically be deleted. You should do this with - grid-locking on) - J = Use to join two neighboring sectors. Press J when mouse - cursor is over the first sector. Then press J again - when the mouse cursor is over the neighboring sector. - The attributes of the combined sector will be taken from - the first sector selected. - ALT-S = When you have a white loop inside a sector, you can - press ALT-S on it (highlight any of its lines) to turn - the whole loop red. - S = Places a sprite at the location under the mouse cursor. - A sprite looks like a blue circle in the overhead map. - - B = Blocks / unblocks you from going through a wall or - sprites. A blocked wall or sprite will appear pink - in 2D EDIT MODE. See the description for 'B' in - the 3D EDIT MODE section for more details. - - C = Turn a line into a circle defined by short line - segments. First press 'C' on a highlighted wall. Then - move the mouse to the right place and press '+' or '-' - if you want to change the number of points on the - circle. Press 'C' again to cancel the circle drawing or - press the Space bar to actually change the map. - +/- = Increase / Decrease the number of points on the circle. - - T = Type in a LO-tag for a sector. Move the mouse cursor to - the inside of a sector that you want to tag first. - ALT-T = Just like 'T' but for walls and sprites. - H = Type in a HI-tag for a sector. Move the mouse cursor to - the inside of a sector that you want to tag first. - ALT-H = Just like 'H' but for walls and sprites. - E = Change a sprite's status list number. - < and > = Changes angle of sprite. Move the mouse cursor to a - sprite first. You can hold down shift with the < and > - to get more precise angles. If you did a sector - highlight, then the selected sector will be rotated - instead. - CTRL-T = Turn tag boxes on/off. - - TAB = Move the mouse cursor to the inside of a sector that you - you want to see the attributes of. It will show them - at the bottom of the status bar. To clear it, press - TAB again at somewhere in the board that is not part - of any sector. This is a useful key for debugging. - ALT-TAB = Works just like TAB, but here, you can see the - attributes of highlighted walls or sprites. For red - lines, the side the mouse cursor is on the line affects - which line is highlighted, since red lines are actually - defined as 2 walls (1 wall for each sector). - - Scroll Lock = Set starting position (brown arrow) to your current - position (white arrow). - - A,Z = Zoom in and out. This is useful for choosing whether - you want to edit finely or not. - G = Change grid resolution. The grid resolution cycles - through this sequence: - (off, 1x, 2x, 4x (default), 8x, 16x) - L = Turns grid locking on or off. If the mouse cursor is - pink then grid locking is on. If it is white then - grid locking is off. There is no grid locking - if the grid is turned off. Also, grid locking will - lock to nearby points. - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ EDITART KEYS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - ---- Keys you will need to know if you want to select from a section of - a 320*200*256 picture file (.BMP and .PCX only) and put it into the BUILD - engine. - - U - Use this to import a section of a 320*200*256 .BMP, .PCX, or .GIF. - ³ Enter - Convert the image that is inside the rectangular selection - ³ rectangle to the BUILD palette. - ³ Space - Convert the image that is inside the rectangular selection - ³ rectangle without remapping the palette. - ³ P - If in the picture selecting screen (after pressing U and loading - ³ the picture), you press P, then the palette of BUILD can be - ÀÄÄ replaced by the palette of the displayed picture. - PGUP/PGDN - Select tile to edit (4096 tile maximum right now). - G - GOTO a tile by typing in the tile number. - S - Re-size tile. The X and Y sizes can be any unsigned short integer. - X ranges from 0 to 1024, and Y ranges from 0 to 240. - Delete - short cut key to set both the X and Y sizes to 0. - +,- Change the animation setting. (Default: NoAnm = 0.) - To change the animation type, press - when the value is 0. - Ex: If you want an object to have 4 tiles of animation, you can - animate it in 4 different sequences: (0 is the current tile) - NoAnm=4 sequence: 0,0,0,0,0,0,0,0,0,0,0,... (no animation) - Oscis=4 sequence: 0,1,2,3,2,1,0,1,2,3,2,... (oscillate) - AnmFD=4 sequence: 0,1,2,3,0,1,2,3,0,1,2,... (forwards) - AnmBK=4 sequence: 0,-1,-2,-3,0,-1,-2,-3,... (backwards) - A - Set the animation speed of the tile. Press + and - to change the - animation speed. There are 16 different animation speeds. The - animation speed set here set the speed for BUILD and your GAME also. - (Speed is proportional to (totalclock>>animspeed)) - ~' - This key (located just above the TAB key) allows you to center a - sprite. Simply use the arrow keys to get to the desired position. - N - Name a tile. Naming a tile simply changes the #define statement in - NAMES.H. You should include NAMES.H when compiling so you can easily - refer to sprites by name rather than by number. - O - Optimize the size of an individual piece of artwork. Use this for - tiles with invisible pixels on the sides. - V - View and select a tile to edit. - ³ Space - To swap 2 tiles simply press space bar on the first tile, - ³ then space bar on the second. - ³ 1,2,3 - To swap a group of tiles, press 1 on the first tile, - ³ press 2 to remember the region between where you pressed - ³ 1 and 2. Press 3 at the place to where you want to swap - ÀÄÄ all the tiles. -ALT+U- Re-grab artwork from original pictures according to the CAPFIL.TXT - file. If you press ALT-U in the main screen, everything will be - re-grabbed. If you press ALT-U in 'V' mode, then you should first - select the range by pressing '1' and '2' on the range boundaries. -ALT+R- Generate a Tile frequency report by scanning all maps in directory. - Use in 'V' mode only. -F12 - Screen capture (saves image as a *.BMP file, starting as file - name CAPTUR00.BMP and incrementing by 1 each time F12 is - pressed. - - ESC - Quit. - - - - ---- Extra features: (if you actually want to do the artwork in EDITART - or if you want to touch-up some imported art.) - - C - Change all pixels on the tile having the same color under the - graphics cursor to to selected color. - Arrows / Mouse - Move graphics cursor. - Shift + Arrows - Select color. (on bottom right corner of screen) - Space - Plot a pixel with the selected color. - T - Turn drawing trail on / off. - Tab - Select the color under the graphics cursor. - BACKSPACE - Set the color to color 255 (transparent color). - F - Floodfill a region with the current color and with the current - color as a boundary. - M,P - Use M to back up a tile into a temporary buffer in memory and P - to restore it. It may be wise to press M before a floodfill (F) - (because sometimes you miss encapsulating the region by 1 pixel, - and the whole picture gets killed, etc...) - J - Randomly plots dots of current color over any pixels having the - same color as the color under the tile cursor. - [ - Random antialias of colors in color band under graphics cursor. - ] - Non-random antialias of colors in color band under graphics cursor. - ; - 3-Dimentionalize an image. Makes colors in different rows of the - color bar either appear to stick out or stick in to the wall. - ' - 3-Dimentionalize the other way. - R - Rotate the tile in a specified direction. - - 1 - Mark the first corner of a rectangle for a copy/paste operation. - 2 - Mark the other corner of a rectangle for a copy/paste operation. - 3 - Paste the selected rectangle (Note: You must press 1 and 2 in that - order first before pressing 3. Pretty simple 1-2-3 for copy&paste) - - 4 - Flip the copied rectangular region x-wise. - 5 - Flip the copied rectangular region y-wise. - 6 - Swap the x and y coordinates of the copied rectangular region. - - ,.<> - Change the shade of the selected region. - \ - Move the cursor to the center or the tile. - | - Get the coordinates of the cursor. - -ÉÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍ» -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÈÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊͼ - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ IMPORTANT ENGINE FUNCTIONS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - -initengine(char vidoption, long xdim, long ydim) - Sets up interrupt vectors for keyboard, and initializes many variables - for the BUILD engine. You should call this once before any other - functions of the BUILD engine are used. - - vidoption can be anywhere from 0-6 - xdim,ydim can be any mode x resolution if vidoption = 0 - xdim,ydim can be any vesa resolution if vidoption = 1 - xdim,ydim must be 320*200 for any other mode. - (see graphics mode selection in my setup program) -uninitengine(); - Restores interrupt vectors for keyboard and timer, and frees - buffers. You should call this once at the end of the program - before quitting to dos. -loadboard(char *filename, long *posx, long *posy, long *posz, short *ang, short *cursectnum) - Loads the given board file into memory for the BUILD engine. - Returns -1 if file not found. If no extension is given, .MAP will - be appended to the filename. -saveboard(char *filename, long *posx, long *posy, long *posz, short *ang, short *cursectnum) - Saves the given board from memory inro the specified filename. - Returns -1 if unable to save. If no extension is given, .MAP will - be appended to the filename. -loadpics(char *filename); - Loads the given artwork file into memory for the BUILD engine. - Returns -1 if file not found. If no extension is given, .ART will - be appended to the filename. -setgamemode(); - This function sets the video mode to 320*200*256color graphics. - Since BUILD supports several different modes including mode x, - mode 13h, and other special modes, I don't expect you to write - any graphics output functions. (Soon I have all the necessary - functions) If for some reason, you use your own graphics mode, - you must call this function again before using the BUILD drawing - functions. - -drawrooms(long posx, long posy, long posz, short ang, long horiz, short cursectnum) - This function draws the 3D screen to the current drawing page, - which is not yet shown. This way, you can overwrite some things - over the 3D screen such as a gun. Be sure to call the drawmasks() - function soon after you call the drawrooms() function. To view - the screen, use the nextpage() function. The nextpage() function - should always be called sometime after each draw3dscreen() - function. -drawmasks(); - This function draws all the sprites and masked walls to the current - drawing page which is not yet shown. The reason I have the drawing - split up into these 2 routines is so you can animate just the - sprites that are about to be drawn instead of having to animate - all the sprites on the whole board. Drawrooms() prepares these - variables: spritex[], spritey[], spritepicnum[], thesprite[], - and spritesortcnt. Spritesortcnt is the number of sprites about - to be drawn to the page. To change the sprite's picnum, simply - modify the spritepicnum array If you want to change other parts - of the sprite structure, then you can use the thesprite array to - get an index to the actual sprite number. - -engineinput(); - This function allows the engine to adjust your position depending - on the status of the arrow keys, and other control keys. It - handles timing and clipping. -nextpage(); - After a screen is prepared, use this function to view the screen. - -draw2dscreen(long posxe, long posye, short ange, long zoome, - short gride) - Draws the 2d screen - this function is a direct replacement - for the drawrooms() and drawmasks() functions. Be sure - to call either qsetmode640350() or qsetmode640480() - first. When switching back to 3d mode, be sure to call - qsetmode320200(). - IMPORTANT NOTES: - 1. The overwritesprite function should only be called in - 3D mode. If you do this in 2D mode, junk will be - written to the 2D screen and a crash is possible. - 2. When you switch back to 3D mode, you should call the - permanentwritesprite functions to draw the status bar, - or whatever else you have to draw. - 3. You must call the nextpage() function in both 2D and - 3D modes. -qsetmode320200(); - Set to the game mode and load palette (320*200*256) -qsetmode640350(); - Set to the 2D map mode #1 (640*350*16) -qsetmode640480(); - Set to the 2D map mode #2 (640*480*16) - -doanimations(long numtics); - This function animates anything you use setanimation for (like doors). - You should call it for every frame. Pass the number of tics (lockspeed) - as a parameter to it to tell how much everything should animate. - -kenchaintimer(void (__interrupt __far *datimerchainaddress)(), - short dachainpersecond) - This function makes the engine's timerhandler chain to another timer - handler at any specified interrupt rate. This function forces IRQ0 to - point to my engine's timerhandler. Clockspeed and totalclock will - be fixed at counting 120 per second regardless of the chaining interrupt - rate. If you call this function with a NULL pointer, then the engine's - timerhandler will not chain anymore. - - Here's how you should structure your code if you use this function: - - main() - { - initengine(); - - musicon(); //Turn music on after engine - kenchaintimer(yourtimerhandleraddress,yourtimerrate); - //When IRQ0 goes off, it will now go to - //Ken's timer handler. Then, Ken's timer - (main loop) //handler will make yourtimerhandler - //interrupt yourtimerrate times per second - - kenchaintimer(0,0); //Stop chaining BEFORE music handler dies! - musicoff(); - - uninitengine(); - } - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ OTHER ENGINE FUNCTIONS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - -overwritesprite (long thex, long they, short tilenum, - signed char shade, char orientation, char dapalnum) - - Use this function to draw any sprites that must be drawn to the screen - for every single frame, such as a gun or a menu system. - - If Bit 0 of orientation = 0: (thex, they) is top-left corner - If Bit 0 of orientation = 1: (thex, they) is middle - If Bit 1 of orientation = 0: no relation to viewing window - If Bit 1 of orientation = 1: scale and clip to viewing window - If Bit 2 of orientation = 0: normal - If Bit 2 of orientation = 1: 50/50 transluscent! - If Bit 3 of orientation = 0: normal - If Bit 3 of orientation = 1: x-flipped - If Bit 4 of orientation = 0: normal - If Bit 4 of orientation = 1: y-flipped - - * If it works at full screen, simply set bit 1 of orientation - to 1, and it should automatically scale properly! - - Use this function to write sprites over the 3d view. For example, - you can make a menu system with this function. Be sure - that you call this function for every single frame after the 3d - view is drawn or else it will be flashed on for only 1 frame. - If you want x and y to be the top left corner, set the orientation - to 0. If you want x and y to be the middle of the sprite, set the - orientation to 1. The reason I included the orienation = 1 option - is so that if you want a sprite centered and the size of the tile - changes, you don't need to recompile and guess where the new top - left corner is. Oh yeah, and I forget to mention that if shade is - greater than 32, than overwritesprite does transluscence. (Try it - out!) This function will clip the sprite to the startumost and - startdmost arrays. Dapalnum refers to a palette lookup list - (normally 0). - -rotatesprite (long sx, long sy, long z, short a, short picnum, - signed char dashade, char dapalnum, char dastat, - long cx1, long cy1, long cx2, long cy2) - (sx, sy) is the center of the sprite to draw defined as - screen coordinates shifted up by 16. - (z) is the zoom. Normal zoom is 65536. - Ex: 131072 is zoomed in 2X and 32768 is zoomed out 2X. - (a) is the angle (0 is straight up) - (picnum) is the tile number - (dashade) is 0 normally but can be any standard shade up to 31 or 63. - (dapalnum) can be from 0-255. - if ((dastat&1) == 0) - no transluscence - if ((dastat&1) != 0) - transluscence - if ((dastat&2) == 0) - don't scale to setview's viewing window - if ((dastat&2) != 0) - scale to setview's viewing window (windowx1,etc.) - if ((dastat&4) == 0) - nuttin' special - if ((dastat&4) != 0) - y-flip image - if ((dastat&8) == 0) - clip to startumost/startdmost - if ((dastat&8) != 0) - don't clip to startumost/startdmost - if ((dastat&16) == 0) - use Editart center as point passed - if ((dastat&16) != 0) - force point passed to be top-left corner - if ((dastat&32) == 0) - nuttin' special - if ((dastat&32) != 0) - use reverse transluscence - if ((dastat&64) == 0) - masked drawing (check 255's) (slower) - if ((dastat&64) != 0) - draw everything (don't check 255's) (faster) - - Note: As a special case, if both ((dastat&2) != 0) and ((dastat&8) != 0) - then rotatesprite will scale to the full screen (0,0,xdim-1,ydim-1) - rather than setview's viewing window. (windowx1,windowy1,etc.) This - case is useful for status bars, etc. - - Ex: rotatesprite(160L<<16,100L<<16,65536,totalclock<<4, - DEMOSIGN,2,50L,50L,270L,150L); - This example will draw the DEMOSIGN tile in the center of the - screen and rotate about once per second. The sprite will only - get drawn inside the rectangle from (50,50) to (270,150) - -permanentwritesprite (long thex, long they, short tilenum, signed char shade, - long cx1, long cy1, long cx2, long cy2, char dapalnum) - - Added permanentwritesprite function for status bars or other - sections of the screen that will not be overwritten by the - engine. The format of this function is like overwritesprite - except that the x and y are always top left corner, no - orientation variable, and no translucence. - The 4 last parameters (cx1, cy1) - (cx2, cy2) define a - rectangular clipping window of where permanentwritesprite - can draw to. Dapalnum refers to a palette lookup list - (normally 0). - -printext(long x, long y, char buffer[42], short tilenum, char invisiblecol); - Use this function to print text anywhere on the screen from a font - that you can create in EDITART. Please see my example font in - TILES.ART to see how I lay out the user-defined font. X ranges - from 0-319. Y ranges from 0-199. The buffer is the string to - print. Tilenum specifies which font to use. Invisiblecol tells - printext what color to draw the transparent pixels. If - invisiblecol is 255 then the transpararent pixels are still - transparent. -printnum(long x, long y, long num, short tilenum, char invisiblecol); - Printnum is a function call that will print a long integer (num) - starting at top left corner x, y. Please look at the documentation - for printext, since internally, printnum simply prepares a buffer - and calls the printext function. - -setvmode(long videomode); - If you look at the top of GAME.C, you will see something like this: - #pragma aux setvmode =\... This is how you do in-line assembler in - WATCOM C. All this function is doing is setting the video mode. -showengineinfo(); - Use this function after setting to text mode to view some statics - about the engine, such as frame rate. -resettiming(); - Resets timing, such as setting totalclock = 0. Also resets other - timers. This is for use with the showengineinfo function above. - -ksqrt(long num); returns (long)square root - A square root function optimized for integers. Use this function - only if you want to. -krand() - This simply returns a random number. You can easily set the random - seed by externing the randomseed variable as a long. This is useful - for keeping the random seed the same on multiple computers when playing - multi-player mode. - -getangle(long xvect,long yvect); returns (short)angle; - Use this function call to determine the angle between two points. - For example, if you want a monster to shoot a bullet towards you, - you would get the bullet's angle this way: - sprite[bullet].ang = getangle(posx-sprite[monst].x,posy-sprite[monst].y); - -lastwall(short point); - Use this function as a reverse function of wall[].point2. In order - to save memory, my walls are only on a single linked list. - -rotatepoint(long xpivot, long ypivot, long x, long y, - short daang, long *x2, long *y2); - This function is a very convenient and fast math helper function. - Rotate points easily with this function without having to juggle your - cosines and sines. Simply pass it: - - Input: 1. Pivot point (xpivot,ypivot) - 2. Original point (x,y) - 3. Angle to rotate (0 = nothing, 512 = 90ø CW, etc.) - Output: 4. Rotated point (*x2,*y2) - -clipmove(long *x, long *y, long *z, short *sectnum, long xvect, long yvect, - long walldist, long ceildist, long flordist, char cliptype) - Moves any object (x, y, z) in any direction at any velocity and will - make sure the object will stay a certain distance from walls (walldist) - Pass the pointers of the starting position (x, y, z). Then - pass the starting position's sector number as a pointer also. - Also these values will be modified accordingly. Pass the - direction and velocity by using a vector (xvect, yvect). - If you don't fully understand these equations, please call me. - xvect = velocity * cos(angle) - yvect = velocity * sin(angle) - Walldist tells how close the object can get to a wall. I use - 128L as my default. If you increase walldist all of a sudden - for a certain object, the object might leak through a wall, so - don't do that! - If cliptype is 0, then the clipping is normal (Use 0 to clip you - and monsters). If the cliptype is 1, then the object is clipped to - the same things that hitscan is clipped to (use 1 for all bullets). - - Clipmove can either return 0 (touched nothing) - 32768+wallnum (wall first touched) - 49152+spritenum (sprite first touched) - -getzrange(long x, long y, long z, short sectnum, - long *ceilz, long *ceilhit, - long *florz, long *florhit, - long walldist, char cliptype) - - Use this in conjunction with clipmove. This function will keep the - player from falling off cliffs when you're too close to the edge. This - function finds the highest and lowest z coordinates that your clipping - BOX can get to. It must search for all sectors (and sprites) that go - into your clipping box. This method is better than using - sector[cursectnum].ceilingz and sector[cursectnum].floorz because this - searches the whole clipping box for objects, not just 1 point. - Pass x, y, z, sector normally. Walldist can be 128. Cliptype can be - 0, 1, or 2. (just like movesprite and clipmove) This function returns - the z extents in ceilz and florz. It will return the object hit in ceilhit - and florhit. - Ceilhit and florhit will also be either: - 16384+sector (sector first touched) or - 49152+spritenum (sprite first touched) - -updatesector(long x, long y, §num); - This function updates the sector number according to the x and y values - passed to it. Be careful when you use this function with sprites because - remember that the sprite's sector number should not be modified directly. - If you want to update a sprite's sector, I recomment using the setsprite - function described below. - -inside(long x, long y, short sectnum); - Tests to see whether the overhead point (x, y) is inside sector (sectnum) - Returns either 0 or 1, where 1 means it is inside, and 0 means it is not. - -copytilepiece(long tilenume1, long sourcex1, long sourcey1, - long xsiz, long ysiz, - long tilenume2, long destx1, long desty1) - - This function simply copies any section of a source tile - to any part of a destination tile. It will automatically - skip transparent pixels. It will wrap-around in the - source but not the destination. If for some reason - the destination tile gets removed from the cache, the - destination tile will be reset to original form. This - is why I had to add this second function: - -allocatepermanenttile(short tilenume, long xsiz, long ysiz) - This function allocates a place on the cache as permanent. - Right now, I reset the cache every time you call this - function so I would recommend calling this function - right after loadpics. - -makepalookup(long palnum, char *remapbuf, - signed char r, signed char g, signed char b, - char dastat) - This function allows different shirt colors for sprites. First prepare - remapbuf, which is a 256 byte buffer of chars which the colors to remap. - Palnum can be anywhere from 1-15. Since 0 is where the normal palette is - stored, it is a bad idea to call this function with palnum=0. - In BUILD.H notice I added a new variable, spritepal[MAXSPRITES]. - Usually the value of this is 0 for the default palette. But if you - change it to the palnum in the code between drawrooms() and drawmasks - then the sprite will be drawn with that remapped palette. The last 3 - parameters are the color that the palette fades to as you get further - away. This color is normally black (0,0,0). White would be (63,63,63). - if ((dastat&1) == 0) then makepalookup will allocate & deallocate - the memory block for use but will not waste the time creating a palookup - table (assuming you will create one yourself) - -copytilepiece(long walnume1, long x1, long y1, long xsiz, long ysiz, - long walnume2, long x2, long y2, char shadeoffs); - Copies section of tile 1 (walnume1) with top-left corner (x1,y1) and - rectangular size (xsiz, ysiz) to top-left corner (x2, y2) of tile 2 - (walnume). You can animate tiles with this function. For example, with - this function, you can make a slot machine like in Ken's Labyrinth or an - electronic sign with text sliding from right to left. - -loadtile(short tilenume); - This function will load the tile, tilenum, into the artwork cache. A - tile is not in the cache if (waloff[tilenum] == -1). If - (waloff[tilenum] >= 0) then it is in the cache, and you don't need to call - this function. - -precache(); - This function will go through the tilenums of all sectors, walls, and - sprites and call loadtile() on them. This function will not cache in some - tiles of animations since their tilenums may not all be in the structures. - -hitscan(long xstart, long ystart, long zstart, short startsectnum, - long vectorx, long vectory, long vectorz, - short *hitsect, short *hitwall, short *hitsprite, - long *hitx, long *hity, long *hitz); - - Pass the starting 3D position: - (xstart, ystart, zstart, startsectnum) - Then pass the 3D angle to shoot (defined as a 3D vector): - (vectorx, vectory, vectorz) - Then set up the return values for the object hit: - (hitsect, hitwall, hitsprite) - and the exact 3D point where the ray hits: - (hitx, hity, hitz) - - How to determine what was hit: - * Hitsect is always equal to the sector that was hit (always >= 0). - - * If the ray hits a sprite then: - hitsect = thesectornumber - hitsprite = thespritenumber - hitwall = -1 - - * If the ray hits a wall then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = thewallnumber - - * If the ray hits the ceiling of a sector then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = -1 - vectorz < 0 - (If vectorz < 0 then you're shooting upward which means - that you couldn't have hit a floor) - - * If the ray hits the floor of a sector then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = -1 - vectorz > 0 - (If vectorz > 0 then you're shooting downard which means - that you couldn't have hit a ceiling) - -neartag(long x, long y, long z, short sectnum, short ang, //Starting position & angle - short *neartagsector, //Returns near sector if sector[].tag != 0 - short *neartagwall, //Returns near wall if wall[].tag != 0 - short *neartagsprite, //Returns near sprite if sprite[].tag != 0 - long *neartaghitdist, //Returns actual distance to object (scale: 1024=largest grid size) - long neartagrange, //Choose maximum distance to scan (scale: 1024=largest grid size) - char tagsearch) //1-lotag only, 2-hitag only, 3-lotag&hitag - Neartag works sort of like hitscan, but is optimized to - scan only close objects and scan only objects with - tags != 0. Neartag is perfect for the first line of your space bar code. - It will tell you what door you want to open or what switch you want to - flip. - -cansee(long x1, long y1, long z1, short sectnum1, - long x2, long y2, long z2, short sectnum2); returns 0 or 1 - This function determines whether or not two 3D points can "see" each - other or not. All you do is pass it the coordinates of a 3D line defined - by two 3D points (with their respective sectors) The function will return - a 1 if the points can see each other or a 0 if there is something blocking - the two points from seeing each other. This is how I determine whether a - monster can see you or not. Try playing DOOM1.DAT to fully enjoy this - great function! - -setanimation(long *animptr, long thegoal, long thevel); - This is a function for your convenience that will animate a long - variable, such as sector[].floorz for platforms, or sector[].ceilingz - for doors. All you do is pass it the long pointer into memory, specifying - which long variable is to be animated; you also pass the goal (long value - to animate towards), and the velocity at which the variable is animated. - Velocity = 128 is a normal speed door. You may also modify the animation - arrays directly if you wish: - - The animation arrays are as follows: - long *animateptr[MAXANIMATES], animategoal[MAXANIMATES]; - long animatevel[MAXANIMATES], animatecnt; - -getanimationgoal(long animptr); - Check to see if a certain variable in memory is already being animated - by the engine. If so, an index into the animation arrays is returned, - else -1 is returned. This is function is useful when you are press - space bar near a door, and it is already animating, you simply want - to reverse its direction. - -dragpoint(short wallnum, long newx, long newy); - This function will drag a point in the exact same way a point is dragged - in 2D EDIT MODE using the left mouse button. Simply pass it which wall - to drag and then pass the new x and y coordinates for that point. - Please use this function because if you don't and try to drag points - yourself, I can guarantee that it won't work as well as mine and you - will get confused. Note: Every wall of course has 2 points. When you - pass a wall number to this function, you are actually passing 1 point, - the left side of the wall (given that you are in the sector of that wall) - Got it? - -nextsectorneighborz(short sectnum, long thez, short topbottom, short direction); - This function searches z-coordinates of neighboring sectors to find the - closest (next) ceiling starting at the given z-coordinate (thez). - For example, if you want to find the goal z-coordinate when opening a - door, you might want the door to stop at the next closest neighboring - ceiling z-coordinate. You can get the z-coordinate this way: - - newz = sector[nextsectorneighborz(sectnum,startz,-1,-1)].ceilingz - - topbottom (3rd parameter) -1 = search ceilings - 1 = search floors - direction (4th parameter) -1 = search upwards - 1 = search downwards - -screencapture(char *filename) - Capture the screen and save it as a .BMP file. I don't know why my - .BMP format isn't compatible with other programs. - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ SPRITE FUNCTIONS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - -insertsprite(short sectnum, short statnum); //returns (short)spritenum; - Whenever you insert a sprite, you must pass it the sector - number, and a status number (statnum). The status number can be any - number from 0 to MAXSTATUS-1. Insertsprite works like a memory - allocation function and returns the sprite number. - -deletesprite(short spritenum); - Deletes the sprite. - -changespritesect(short spritenum, short newsectnum); - Changes the sector of sprite (spritenum) to the - newsector (newsectnum). This function may become - internal to the engine in the movesprite function. But - this function is necessary since all the sectors have - their own doubly-linked lists of sprites. - -changespritestat(short spritenum, short newstatnum); - Changes the status of sprite (spritenum) to status - (newstatus). Newstatus can be any number from 0 to MAXSTATUS-1. - You can use this function to put a monster on a list of active sprites - when it first sees you. - -setsprite(short spritenum, long newx, long newy, long newz); - This function simply sets the sprite's position to a specified - coordinate (newx, newy, newz) without any checking to see - whether the position is valid or not. You could directly - modify the sprite[].x, sprite[].y, and sprite[].z values, but - if you use my function, the sprite is guaranteed to be in the - right sector. - -movesprite(short spritenum, long xchange, long ychange, long zchange, - long ceildist, long flordist, char cliptype, long numtics) - This function moves the sprite given by spritenum by the 3 - increments, xchange, ychange, and zchange. If cliptype is 0, then - the clipping is normal (Use 0 to clip you and monsters). If the - cliptype is 1, then the object is clipped to the same things that - hitscan is clipped to (use 1 for all bullets). - Movesprite can either return 0 (touched nothing) - 16384+sectnum (ceiling/floor first touched) - 32768+wallnum (wall first touched) - 49152+spritenum (sprite first touched) - -getspritescreencoord(short spritesortnum, long *scrx, long *scry) - This function returns the actual screen coordinates of a sprite. It - is useful for locking on to a target. Use this function between - drawrooms and drawmasks. Note that spritesortnum is the index into the - spritesortcnt arrays, NOT the normal sprite arrays. Scrx and scry are - actual screen coordinates ranging from 0-319 and 0-199 respectively. - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ MULTIPLAYER FUNCTIONS (multi.obj) ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - - initmultiplayers(char option[4], char option[5], char priority); - Call this right after initengine. Pass option[4] and option[5] - exactly the way I have it written here. (option[4] is the COM1-COM4, - network option and option[5] is the com speed selection option) - Priority can be used to decide who becomes master. Lower is more - towards the master. - - uninitmultiplayers(); - Call this right before uninitengine. - - sendlogon(); - Use this function after everything's initialized, but before you - go into the main game loop. Right after you call sendlogon(), you - should run a loop that will wait until a specified number of players. - Here's some example code: - - sendlogon(); - while (numplayers < waitplayers) - { - getpackets(); - } - screenpeek = myconnectindex; - - Getpackets reserves the packet header range from 200-255. If you - keep calling getpackets after sendlogon, the numplayers variable will - automatically be incremented when other people log on. - - sendlogoff(); - Call this before leaving, before uninitializing the multiplayer - code. - - sendpacket (short otherconnectindex, char *bufptr, short bufleng) - For COM(modem) communications, the otherconnectindex doesn't matter. - For network communcations, you can specify which computer to send - to by setting otherconnectindex to the proper index number. You - can also do a broadcast by setting otherconnectindex to -1. - Also pass the buffer and length parameters. - - short getpacket (short *otherconnectindex, char *bufptr) returns bufleng - When using getpacket, first check the value it returns. - If the value is 0, then the buffer length is 0 which means there - are no packets available. If the buffer length is greater than - 0, then use that value as the length of the buffer. Getpacket also - tells you what computer the message was received from - - (otherconnectindex). - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ DIGITIZED SOUND FUNCTIONS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -Note: If you want to write your own digitized sound driver, simply delete - these functions from GAME.C. - -initsb(); - Initializes the digitized sound routines. You need to call this - only once at the beginning of the program. Currently, the - sample rate is 11,025 Hz. - -wsay(char *filename, long freq, char volume); - Play the sound file at the given frequency and volume. If you - set freq = 4096, the sound will play at normal frequency (given - the sound was also recorded at 11025 Hz) To play the sound an - octave higher, for example, set freq = 8192. Volume ranges from - 0 (silent) to 255 (full volume). Ex: wsay("blowup.wav",4096L,255); - -uninitsb(); - Turns the speaker off, so sounds don't continue playing while - your back in DOS. - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ MUSIC FUNCTIONS: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -Note: If you want to write your own music driver, simply delete these - functions from GAME.C. The BUILD engine uses interrupt vector 0x8 (IRQ0) - and that may complicate things. If you like my music, perhaps I can send - you my MIDI sequencer program (It requires MPU-401, and TSENG-ET4000 SVGA, - but could be standardized if there's enough demand). - -loadmusic(char *filename); - Loads the given song into memory. Be sure INSTS.DAT is in the - current directory. If no extension is given, then .KSM will be - appended to the filename. You should use this function only when - the music is off. -musicon(); - Enable the playing of music. Use this only after loadmusic has - been called. -musicoff(); - Disable the playing of music. Be sure to call this before quitting - to DOS. - -ÉÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍËÍ» -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÌÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎÍÎ͹ -ÈÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊÍÊͼ - -ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -³ BUILD Revision History: ³ -ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -2/6/94 - Added this revision thing. - - Setup program. - - A faster new mode for standard VGAs called chain mode. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/8/94 - Fixed chain mode with groudraws. - - Added sector joining in 2D EDIT MODE - press J on first sector. - Then press J again on sector to join with. Attributes will be - taken from first sector. Possible bugs. - - Improved controls for slower computers. - - Made timer interrupt rate 120/second instead of 240/second. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/9/94 - Started to work on status bar in 2D EDIT MODE. - - Added special optimization for the Western Digitial (Paradise) - chipset just like with TSENG ET4000. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/10/94 - Added a door attribute to sectors. To make a sector a door, - press "D" on the ceiling of the sector in 3D EDIT MODE. For - the door to work, the ceiling of the door sector must be a - tiny bit lower than lowest neighboring ceiling. To open/close - the door, you may press the space bar. Note: Space Bar is also - used for copy and paste in 3D EDIT MODE. You may have to go - into game mode to test out the doors for now. - - Added a wall orientation attribute to walls. This attribute is - used especially in conjunction with doors. So far, you have - been working with walls that are start from the top. For - example, if you hold down 2/8 on the keypad in 3D EDIT MODE, - the wall always starts from the top. But for doors, you - sometimes need walls to start from the bottom. To do this, - press "O" (for orientation) on the wall, and it will now - start from the bottom. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/12/94 - Fixed some bugs for sprites. Sprites don't disappear anymore. - Now you will pick up all sprites when running over them. - Monsters will not stop shooting anymore. - - Made the sound blaster sounds have a 1-sound cache. That is, if - the same sound is to be played several times in a row, it will - only be loaded once. - - Added *.GIF format support to EDITART for 320*200 size images. - - Changed the PASTE key in 3D EDIT MODE from Space bar to Left - Enter because the Space bar conflicted with opening doors. - - Added music as an option in the setup program. To run the music, - you need INSTS.DAT and a song file with a .KSM extension. - - Split the editor from the game. - BUILD is now the map editor - you don't need BUILD.C anymore. - GAME is now the actual game that you will be programming. - I am giving you GAME.C to work with. Its code is simpler - than before because there are no more editing function - calls in it. - - Sprites move in a straight line now until they hit walls. When - they hit walls, they pick a new angle to travel in. - - Remember that tiny little guy with the "Al" on his shirt? - Next time you're in DOOM1.DAT, try shooting him. Then look - at the code in GAME.C. - - In EDITART, when you press, "u", you now select filenames with - the arrow keys and enter rather than having to type in - the exact filename. - - Board maps now have extension .MAP and artwork files now have - extension .ART to help distinguish between the different types - of files. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/22/94 - Fixed small bug with EDITART not loading right when names.h - existed with no names defined. - - You can now edit new boards by typing: - BUILD like "BUILD NEWBOARD" - - Added ALT-S in 2D EDIT Mode to change a whole white loop inside a - sector to a red loop. - - When viewing the tiles (pressing "v") you can now use PGUP/PGDN. - - Added a message bar in 2D EDIT Mode. - - Added TAB and L.ALT-TAB keys to view all the attributes of a - sector, wall, or sprite (see above documentation). - - Debugged and bullet-proofed ALT-S. - - Fixed a bug that doesn't allow you to drag points with number - greater than 1023. (There can actually be 4096 walls and 1024 - sectors, and 4096 sprites currently, an easy thing to increase) - - Changed overwritesprite function paramaters. If you are using it - in your c file, you must change it! Now it looks like this: - - overwritesprite (long x, long y, short tilenum, char shade, - char orientation); - - If orientation = 0: x and y are the top left corner. - If orientation = 1: x and y are the middle (like before). - - Added permanentwritesprite function for status bars or other - sections of the screen that will not be overwritten by the - engine. When using this function, you may want to modify the - STARTUMOST / STARTDMOST arrays. The format of this function is - like overwritesprite except that the x and y are always top - left corner, no orientation variable, and no translucence. - - permanentwritesprite (long x, long y, short tilenum, char shade); - - - Added an attribute to the printext and printnum functions. Please - change these function if you use them in your program. The - current formats are: - - printext(long x, long y, char buffer[42], short tilenum, - char invisiblecol) - printnum(long x, long y, long num, short tilenum, - char invisiblecol); - - Invisiblecol tells printext what color to draw the transparent - pixels. If invisiblecol is 255 then the transpararent pixels are - still transparent. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/26/94 - Completely reprogrammed EDITART. - IMPORTANT: PLEASE RUN CONVART.EXE ON ALL ARTWORK FILES! (If you have not - already). It will convert PICS.ART in the old format to - TILES.ART in the new format, so you may have to do some - renaming when converting artwork and also rename the loadpics - line in your C file. BUILD WILL NOT RUN UNLESS YOU DO THIS! - With the new artwork file, the tiles can now be any size from - 1*1 to 1024*240 and they no longer have to be powers of 2. - This feature allows parallaxing skies that are 1024 pixels wide - to cover all 360ø, or 320 pixel wide status bars. It can also - be used to display 320*200 title screens. - - When pressing 'U' in EDITART, you can now change directories - and the current loading directory will be remembered. - - When pressing 'U' in EDITART, you can press the mouse button to - readjust the size of the tile. - - When pressing 'U' in EDITART, press ENTER for an automatic - palette conversion or press SPACE BAR for no conversion. - - Walls that are Blocked ('B') in BUILD are now shown in pink. - If the wall does not show pink in your board, just press - 'B' twice to permanently fix it. - - Made smooshiness values easier to work with. Hold down 5 on the - keypad with 2/4/6/8 to align the walls to multiples of the - tile that is used. Also, when you do Tab and L.Enter for - Copy&Paste, the y-repeat values stay the same, and the - x-repeat values are adjusted so the pixels of the bitmaps - have a square-aspect ratio. - - Added masked walls. But since they don't quite work perfectly - yet, and they are extremely hard to edit now, so for now, just - enjoy the technologiy in DOOM1.MAP. Don't worry - you'll get - your hands on this soon! - - Fixed the "earthquake" effect on really high walls. The walls - will not move up and down, but the pixel fuzzyness bug is - still in there. - - Put door variables and tile information into BUILD.H for you to - play around with. - - Made walls, ceilings, and floors also work with the animation - attribute in EDITART. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/2/94 - Made power of 2 size tiles work with ceilings & floors. - - When using different size ceilings & floors, made an option in - 3D EDIT MODE. If you want a tile to be smooshed into the normal - 64*64 area, press 'E' to unExpand the tile. - - Groudraws now look more cubical than before. (But be careful of - crashing with them for now) - - IMPORTANT: Changed the Board format. If you tried running BUILD - before reading this, and it didn't work, shame on you! You - should always look at the history section of BUILD.TXT first! - Since from now on, I am writing Board/Art converters, I am - giving you CONVMAP.EXE to convert maps. You can type either: - C:\BUILD>convmap house.map - to convert an individual map or: - C:\BUILD>for %i in (*.map) do convmap %i - to convert all the maps in a directory. - - - IMPORTANT: Sprites are now on 2 different sets of doubly-linked - lists. The big advantage of this method is that when sprites - are deleted, there can be holes in the sprite list with - no slow down. Before I used to have linked lists for each - sector pointing to all the sprites in it. Well, I have updated - that and added more linked lists that tell whether sprites - are active or inactive (not a fun thing to progam) But not - to worry, you don't have to deal with changing the linked - lists, thanks to my very easy function calls. YOU WILL - HAVE TO CHANGE YOUR CODE TO SUPPORT THE NEW LINKED LISTS. - You should know how to search through each list. See BUILD.H - for a detailed description of how the linked lists work, and - see the top of this file for description of the new sprite - function calls. - - insertsprite(short sectnum, short statnum); - deletesprite(short spritenum); - changespritesect(short spritenum, short newsectnum); - changespritestat(short spritenum, short newstatnum); - - In your code, you will have to change the following: - firstsprite[spritenum] --> headspritesect[spritenum] - sprite[spritenum].point2 --> nextspritesect[spritenum] - - Also, you should change the part of your main loop that scans - through all the active sprites to look more like this: - - - i = headspritestat[1]; //head of active sprite list - while (i != -1) - { - nexti = nextspritestat[i]; //back up next sprite in case current - //one is deleted. - - //your code goes here (use i as the sprite number) - -spriteisdeletedskip: - i = nexti; //go to next sprite - } - - - - - Added tagging (naming) to any sector, sprite, or wall. That means - you can change a tag in the BUILD editor by pressing T with the - mouse cursor on the highlighted sector. And in GAME.C, you - can access the tag this way: - sector[sectnum].tag; - sprite[spritenum].tag; - wall[wallnum].tag; - Note: All 3 types of tags are long integers, but in BUILD.C - you can only make them short integers. I am planning to - let you use the upper 16 bits of the tag byte as use for - you only. (like permanently unreserved bits) - - Added serial link. But it doesn't work very well yet. You - may have to try going into GAME several times before it works. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/15/94 - Fixed maskable walls - now sort out with sprite better. Easier - to edit. Simply press 'M' at a place where a maskable wall - should be (like where you normally press 'B' for blocking) - - Can flip walls, masked walls, and sprites x-wise by pressing - 'F' in 3D EDIT MODE. Also, it is possible to save space in - sprite rotations, by flipping it x-wise by programming one of - the bits in sprite[].cstat. - - A few other minor things, but I forgot what they were. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/19/94 - Fixed one of the many crashing bugs. - For Duke Nukem III team: - CITY.MAP will not crash anymore with new version. The - reason it crashed was because in your TILES.ART, you had - either ANMFD:0, ANMBK:0, or OSCI:0. That caused a MOD 0 - in my animation routine. I bullet-proofed that. How about - fixing tiles #34, #112, or #114 in your TILES.ART. - - Wrote divide by zero handler. Now if there is a divide by zero, - BUILD goes back into text mode and fills the screen with - /0/0/0/0/..., then gives a DOS prompt. (In other words, you - don't have to type "MODE CO80" anymore for /0 crashes) - - Optimized routines in assembly for 486's using my great new - Intel 32-bit optimizing techniques book that dad got for me. - - Fixed ALT-S in BUILD so ANY white loop can be converted into a - red loop except for the 1 and only 1 outermost white loop. - - FINALLY! Splitsector bug is fixed! You can now split a very - complicated sector with tons of sectors inside it or with - plenty of sprites. Also sprites will not get deleted - spontaneously with split sector any more. - - Ctrl-Enter in 3D EDIT MODE is like the normal Enter paste key, - but Ctrl-Enter pastes the attributes to an entire loop of - walls (if a wall is highlighted). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/22/94 - Added doors that open left and right. See sector[].tag #9 in the top - of this file for details - also look at my board, NUKELAND.MAP, - in BUILD to see how to make this type of door. - - Increased the number of status lists. You may recall my active / - inactive sprite lists called headspritestat, prevspritestat, - and nextspritestat. Don't worry - you will NOT have to - change any of your code. The only thing I changed is now - you can have 1024 different lists of sprites rather than just - 2 lists if you want to use them. For example, you might want - to run through all the brown monsters on the board. Instead - of putting all different types of monsters on the active - list, it is faster to have a separate list just for brown - monsters. Use your imagination! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/31/94 - Fixed some palette problems with EDITART. Now when you press 'P' - in 'U' mode, the palette of all the existing tiles are - converted to the new palette. Also the text colors should - be similar colors on different palettes now. - - Changed bit 0 of sprite[].cstat to the hitscan checking / ignoring - bit. You should set this bit to 1 for monsters, 0 for - bullets, 0 for pick-upable objects like coins, and 1 for - objects like columns. Right now, (Since it's not in the - BUILD editor), you must set these bits in your code right - after you load the board. - - I did not document the neartagsector, neartagwall, and - neartagsprite very well, so if you don't know how to use - them alreay, please read on. These 3 variables are modified - by the engine every time you call draw3dscreen(). These - variables are usually -1. These variables will be >= 0 if - all of these cases are true: - 1. You are looking at a wall, sprite, or sector. - 2. You are close enough to the wall, sprite, or sector - to be able to use the action key with it. - 3. The tag of the wall, sprite, or sector is greater or - equal to 1. - As you can see, neartagsector makes a perfect variable for - detecting whether or not you are opening a door. You can - also use neartagwall for switches on walls. Also, you can - use neartagsprite for sprites that are switches. - - PROGRAMMERS: PLEASE MAKE THESE EASY CODE MODIFICATIONS: - I reversed the way variables are stored in BUILD.H. - Now the variables will be local to the ENGINE and externed - to GAME. Before they were local to GAME and externed to the - engine. All you have to do is this: - 1. You can remove the #define MAIN if you want to. - 2. Delete the externs declarations that I used to have - in the beginning of GAME.C, because I put them in - BUILD.H. I will try not to put externs in the GAME - in the future to save you the time of copying and - pasting code. Here is a list of externs I moved: - - EXTERN short neartagsector, neartagwall, neartagsprite; - EXTERN long *animateptr[MAXANIMATES], animategoal[MAXANIMATES]; - EXTERN long animatevel[MAXANIMATES], animatecnt; - EXTERN short tilesizx[MAXTILES], tilesizy[MAXTILES]; - EXTERN long numtiles, picanm[MAXTILES], waloff[MAXTILES]; - - Added a global parallaxing sky type variable. Now I have 3 - different types of parallaxing skies. Here they are: - - 0 - Totally flat parallaxing sky. - 1 - X-only stretching parallaxing sky (This is what DOOM uses). - 2 - X- and Y- stretching parallaxing sky. (This is what BUILD - uses by default) - A good place to set the parallaxing sky is right after you - call initengine(). - - Added local tile selection to the BUILD editor. This means - that when you press V on a sprite, you will see only the - sprites that are on the level so far. If you want to use - a sprite that is not already used on the current board, press - V again and you will be able to select from the huge list - that you are used to from before. The local tile list will - be sorted according to how much each tile is used on the - current board. Note that the local tile list will be - different depending where the mouse cursor was left when you - pressed V (or H). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/4/94 - Changed the way ART files work. YOU MUST READ THIS: - There are some two easy things that you must do 2 things before - you can use the new engine: - - 1. Type CONVART1.EXE to convert your ARTWORK to the new - format. (If I forgot to send this file to you, please call - and torture me.) Now, instead of everything being stored - in one huge file, TILES.ART, I am splitting the artwork into - several files each holding 256 tiles in it. This will allow - you to make infinitely large artwork files in EDITART. - - 2. In GAME.C, you must change the line, - loadpics("tiles.art"); - to: - loadpics("tiles000.art"); - All you have to give loadpics is the first filename of your - artwork, and the engine will automatically know how to - modify the 3 digits at the end and load all the artwork - files properly. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/5/94 - Fixed the "fuzzy" pixels on high walls. Now you make walls as - high as skyscrapers, and when you look at it up close, the - pixels will still look like perfect rectangles. Note: This - fix may require you to press 'O' in 3D EDIT MODE to put - your boards back to normal. - - When you pressed ENTER on weird-sized tiles, sometimes in the old - version the pixels would not be square aspect ratio. Now - when you press ENTER, they will be. - - You can now set the starting position in 2D EDIT MODE with the - Scroll Lock key. The starting position will look like a - brown arrow, and your current position will look like a - white arrow. Now you don't have to keep returning to start - when you save your board. - - Added some new things to the structures - guess what this means? - CONVMAP3! THE NEW OBJ'S and BUILD will NOT work until you - run CONVMAP3. (Please call if I forgot to give - you this file) - Notice that I added these things to the structures: - - sectortype: - bit 2 of ceilingstat&floorstat: - 1 = North/South panning, 0 = East/West panning - char ceilingpanning, floorpanning; - walltype: - bit 6 of cstat - 1 = Vertical panning, 0 = Horizontal panning - char panning; - short overpicnum; - spritetype: - char *extra; - - Now an explanation of each: - To the sector structure, I added the capability to pan - the floors and ceilings. Usually ceilingpanning and - floorpanning are set to 0. For example, a good way to make - an earthquake would be to randomly increment or decrement - to panning values. To allow you to pan the ceilings or - floors at any of the standard 90 degree angles, I made - bit 2 of sectortype's ceilingstat/floorstat byte choose - whether the ceilingpanning/floorpanning byte should move - the ceiling/floor North/South or East/West. - To the wall structure, I added panning also. Bit 6 - of cstat and the panning values work in the same as the - ceilings and floors. - To the sprite structure, I added only 1 variable. - The "extra" pointer is intended for your use only, so you - can have the sprite's structure extended if you so desire. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/6/94 - In 2D EDIT MODE, you can now press ESC to get a message in the - message bar that says this: - - (N)ew, (L)oad, (S)ave, (Q)uit - - And it all works too. (Press ESC to cancel) - Loading lets you select the file just like 'U' in EDITART. - - The old version of BUILD had the coordinate system all screwed - up in 2D EDIT MODE. I fixed this. Included with - CONVMAP3.EXE is a conversion utility that will make your - boards have the same orientation as in the older BUILD - editors. If you don't care if the whole map gets rotated - in the 2D editor, then press N. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/7/94 - Changed the way Orientation works ('O' in 3D EDIT MODE) - - Now, when you draw a normal door in BUILD, you do NOT have to - press 'O' everywhere to make the walls of the door move right. - Now, the default is that everything moves right. Here's a - detailed description of how the new orientation works: - - For white lines (no neighboring sector): - - orientation = 0 (default) means picture is aligned with - sector[].ceilingz. - orientation = 1 means picture aligned with sector[].floorz. - - For red lines (has a neighboring sector): - - orientation = 0 (default) means picture is aligned with - either the ceilingz or floorz of the next sector. - orientation = 1 means picture aligned with - sector[].ceilingz. - - Don't worry if you don't understand the detailed description. - Just know that it's better this way. I have included the - proper conversions in CONVMAP3.EXE. - - Added wall&ceiling x-panning keys to the 3D EDIT MODE. Press - the , or . keys to pan a wall or ceiling left or right. You - can hold down the 5 key on the keypad to align at every eighth - panning value. (Just like with 2,4,6,8). - - Made TAB&ENTER in 3D EDIT MODE also copy the CSTAT byte of - the wall's attributes. This means that attributes such as - the block attribute, 1-way wall attribute, orientation, - and x-flipping attribute are also copied & pasted. - - Added a new function, cansee. - - cansee(long x1, long y1, long z1, short sectnum1, - long x2, long y2, long z2, short sectnum2) - - All you do is pass it the coordinates of a 3D line - and the respective sectors of each point of the line. - The function will return a 1 if the points can see each - other or a 0 if there is something blocking the two points - from seeing each other. This is how I determine whether - a monster can see you or not. Try playing DOOM1.DAT with - digitized sound enabled to fully enjoy this great new - function! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/12/94 - Fixed HITSCAN function. Since it works a little differently - and the parameters are different, let me describe how the - new hitscan works: - - hitscan(long xstart, long ystart, long zstart, short startsectnum, - long vectorx, long vectory, long vectorz, - short *hitsect, short *hitwall, short *hitsprite, - long *hitx, long *hity, long *hitz); - - Pass the starting 3D position: - (xstart, ystart, zstart, startsectnum) - Then pass the 3D angle to shoot (defined as a 3D vector): - (vectorx, vectory, vectorz) - Then set up the return values for the object hit: - (hitsect, hitwall, hitsprite) - and the exact 3D point where the ray hits: - (hitx, hity, hitz) - - How to determine what was hit: - * Hitsect is always equal to the sector that was hit - (always >= 0). - - * If the ray hits a sprite then: - hitsect = thesectornumber - hitsprite = thespritenumber - hitwall = -1 - - * If the ray hits a wall then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = thewallnumber - - * If the ray hits the ceiling of a sector then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = -1 - vectorz < 0 - (If vectorz < 0 then you're shooting upward which means - that you couldn't have hit a floor) - - * If the ray hits the floor of a sector then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = -1 - vectorz > 0 - (If vectorz > 0 then you're shooting downard which means - that you couldn't have hit a ceiling) - - - Added a position window to the bottom of the menu in 2D EDIT - MODE. It shows the posx, posy, and ang variables. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/14/94 - Overwritesprite now clips to the startumost / startdmost arrays. - Now the only way to write to the status bar is with - the permanentwritesprite function. - - - ATTENTION PROGRAMMERS! I Split draw3dscreen() into 2 separate - function calls. - - old: draw3dscreen(); //Draws walls, ceilings, floors, p-skies - // groudraws, sprites, and masked walls. - - new: drawrooms(); //Draws walls, ceilings, floors, p-skies - // and groudraws. - drawmasks(); //Draws sprites and masked walls. - - The reason I split draw3dscreen was so you could manipulate only - the sprites that the engine is going to draw to the screen - before the sprites are actually drawn. - - - I think I may have fixed that darn sector line bug! Before, the - bug usually appeared when you were on a (red) sector line where - the ceiling and floor of the sector were very far from each - other. This overflowed some really high positive values into - the negative range and vice versa. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/18/94 - Wall clipping now works much better! (You can still VERY RARELY - sneak through walls, however) - ATTENTION PROGRAMMERS: - MOVESPRITE and CLIPMOVE have been changed. They now look - like this: - - clipmove (long *x, long *y, long *z, short *sectnum, - long xvect, long yvect, long walldist, - char cliptype); - - movesprite(short spritenum, - long xchange, long ychange, long zchange, - long walldist, char cliptype); - - To use the new clipmove: - Pass the pointers of the starting position (x, y, z). Then - pass the starting position's sector number as a pointer also. - Also these values will be modified accordingly. Pass the - direction and velocity by using a vector (xvect, yvect). - If you don't fully understand these equations, please call me. - xvect = velocity * cos(angle) - yvect = velocity * sin(angle) - Walldist tells how close the object can get to a wall. I use - 128L as my default. If you increase walldist all of a sudden - for a certain object, the object might leak through a wall, so - don't do that! - - To use the new movesprite: - Works like before, but you also pass walldist (How close the - sprite can get to a wall) - - - New function for sprites: - setsprite(short spritenum, long newx, long newy, long newz); - - This function simply sets the sprite's position to a specified - coordinate (newx, newy, newz) without any checking to see - whether the position is valid or not. You could directly - modify the sprite[].x, sprite[].y, and sprite[].z values, but - if you use my function, the sprite is guaranteed to be in the - right sector. - - - You can now change the angle in 2D EDIT MODE with the - < and > keys. Move the mouse cursor to a sprite first. - Hold down shift with the < and > to get more precise angles. - - You can now press 'B' on sprites in 3D EDIT MODE. This in effect - is xoring bit 0 of sprite[].cstat, which will not only be - sensitive to hitscan, but will also block you from walking - through the sprite. Sprites with the 'B' attribute will - appear pink in 2D EDIT MODE. - - You can now edit the Hi 16 bits of the tag in 2D EDIT MODE. - Just like T and ALT-T, you press H and ALT-H to edit the high - 16-bits. When a structure's attributes are displayed, the tag - will be displayed as 2 unsigned shorts. The first number - represents the hi 16 bits and the second number represents the - lo 16 bits. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/23/94 - Added 'G' in Editart to GOTO a tile by typing in the tile number. - - Changed the way masking walls work a little bit. Now the - masking walls use the picture wall[].overpicnum rather than - wall[].picnum. - - Made hitscan hit maskable walls. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/24/94 - Made palette.dat support any number of shades up to 64. There - is no change to the palette.dat format. The palette.dat - format is: - - First the palette (768 bytes) Values range from 0-63 - Then the lookup shades (256 * number_of_shades) The - shades are stored in groups of 256 bytes. - - - If you use Mark Dochtermann's palette program, then you can - convert his data files (such as palette.pal and colormap.lmp) - to my palette format, palette.dat, with my great Qbasic - program, PALMP.BAS. To run it, first copy the basic program - into the same directory as the 2 source palette files are in. - Then type: "QBASIC PALMP" and then press SHIFT+F5 (to run it). - - - Added a global variable, HORIZ. Horiz usually equals 100. - Modifying horiz will move the whole screen up / down. I - added 2 keys, +/- in my own game.c to demonstrate this. You - can use this variable for looking up and down if you want. - (Even though this is not "truly" looking up and down, if - you're lucky, you might be able to fake out some people!) - - - New Key in 3D EDIT MODE, the forward slash. Use / with the - tile panning keys (, and .) to flip the horizontal / vertical - orientation bits for walls, ceilings or floors. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/28/94 - NEW BOARD VERSION! You must run CONVMAP4.EXE on all your boards. - Here's what I changed in the structures: - - Sectors: - I got rid of: - char sector[].ceilingpanning, sector[].floorpanning; - sector[].ceilingstat/floorstat bit 2 zeroed out - and added: - char sector[].ceilingxpanning, sector[].ceilingypanning; - char sector[].floorgxpanning, sector[].floorypanning; - - Walls: - - I got rid of: - char wall[].panning; - wall[].cstat bit 6 zeroed out - and added: - char wall[].xpanning; - char wall[].ypanning; - - Sprites: - - I got rid of: - short sprite[].vel; - and added: - short sprite[].xvel; - short sprite[].yvel; - The reason I did this was so sprites could be moved in - different directions than sprite[].ang. Please make - use of both xvel and yvel. Here's the equation I would - use to convert from the old to new. For example: - - old: - sprite[i].vel = 256; - new: - sprite[i].xvel = (sintable[(sprite[i].ang+512)&2047]>>6); - sprite[i].yvel = (sintable[sprite[i].ang&2047]>>6); - - The reason I am shifting the sines right by 6 is becuase - my sintable ranges from -16384 to 16384. Dividing by - 64 gives a maximum range of -256 to 256. - - CONVMAP4.EXE also attempts to convert the masked walls so - overpicnum is the masked wall's picnum. - - - Changed 3D EDIT MODE panning keys: - Since panning is now all 4 directions, I got rid of the - , and . keys and put the keys on the keypad using 2,4,6,8. - Usually 2,4,6,8 are for x- and y-repeats, but if you hold - down either shift key, then they act as x- and y- panning - values. - The / key now resets the panning values to 0. - - - Please read the updated descriptions of how to make masking walls - in the 3D EDIT MODE KEYS in the top of build.txt. See - the 'M' and 'Shift + M' keys. - - - Also look at the top of this file for a description of dragpoint(), a - great new function that makes it easy to morph sectors. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/29/94 - Added some minor keys to 3D EDIT MODE. Alt. +/- change the - visibility variable. It ranges from 5 (darkest) to 17 - (lightest) and it starts at 13. - - - Made 1-way walls have more options. Now, for example, you can - make rectangular switches on walls. Please look at my - nukeland.map for an example of how to do switches. (The - switches are close to start - just go through the door and - bear left.) - - - For those who asked, here's how some sample bobbing code: - First, calculate the distance actually moved - because if you - are not moving then you shouldn't bob: - - CODE: - oposx = posx; oposy = posy; - clipmove(&posx,&posy,&posz,&cursectnum,xvect,yvect,128L); - dist = ksqrt((posx-oposx)*(posx-oposx)+(posy-oposy)*(posy-oposy)); - - Then modify the horizon value by multiplying the distance - actually moved by a sine wave. (default is horiz = 100). - - CODE: - horiz = 100 + ((dist*sintable[(totalclock<<5)&2047])>>19); - - - Remember that moving block in the slime in NUKELAND.MAP? It - works a lot better now. I am now modifying the floor panning - values to make the floor match up correctly with the block. - - - Fixed the screen capturing (F12) to save captures as PCX files. - This is for BUILD, GAME, and EDITART. - - - Fixed bug in EDITART when you press 'U' on a blank tile. It - should not crash any more. - - - Made Tab & Enter a little smarter in copying the right attributes - to different types of objects. - - - Added ceiling / floor 90ø rotation attributes. All 8 - rotations are possible. 3 bits have been added to both - the sector[].ceilingstat and sector[].floorstat flags. - If you look in BUILD.H, you will see the new flags - descriptions. You can use the 'F' key in 3D EDIT MODE on - a ceiling or floor to change the rotation. - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/30/94 - ATTENTION PROGRAMMERS: - I removed the function, getsector, and added a more expandable - function, updatesector. Also, updatesector is smart enough - to check to see if you are in the same sector OR neighboring - sectors first before going through every single sector. - Getsector used to go though all the sectors every time you - crossed a sector line. - - getsector(); (no arguments, returns nothing - REMOVED) - * used to make sure that CURSECTNUM matched up with - the right sector according to the POSX and POSY values. - updatesector(posx,posy,&cursectnum); - * the new way of writing getsector. You can do a - search&replace on your code. Be careful when you use this - function with sprites because remember that the sprite's - sector number should not be modified directly. For example, - you might want to code it this way: - - tempsectnum = sprite[i].sectnum; - updatesector(sprite[i].x,sprite[i].y,&tempsectnum); - if (tempsectnum != sprite[i].sectnum) - changespritesect(i,tempsectnum); - - Actually, I think the setsprite function is better for - updating a sprite's sector number. - - - Added swinging doors! Look at NUKELAND.MAP in my GAME.EXE for - an example. For swinging doors, I used a new math-helper - function, rotatepoint. - - rotatepoint(long xpivot, long ypivot, - long x, long y, - short deltaang, - long *x2, long *y2); - - Rotatepoint will rotate point(x,y) around point(xpivot,ypivot) - by the deltang value. The resultant point will be s - - - Fixed crashing bug in BUILD when a wall's tile doesn't exist. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/02/94 - I improved the pre-level check on the swinging doors, so now - you can have multiple doors in a sector that open any way. - This is how I do my double swinging doors (demonstrated in - NUKELAND.MAP) - - - I added a revolving door! See NUKELAND.MAP for an example. (The - revolving door is beyond the bouncing platforms in the slime - pit) - - - Fixed bug with joining sectors in 2D EDIT MODE. The sprites - don't get deleted any more. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/04/94 - Optimized the masked walls. - - - Cleaned up the sprite drawing code (and many bugs that that came - along with it.) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/05/94 - Made cylindrical walls with any number of points VERY easy to - make in BUILD. Here's how you do it: Highlight a wall and - press 'C' on it. Then move the mouse to the proper position - to make a nice circle. You can press '+' or '-' to change - the number of points on the circle. Press 'C' again to cancel - or press space bar to actually change the map. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/07/94 - Made a fully-operational subway! Look at subway.map. - - - Made a new type of door - a sliding door where the door doesn't - get "x-smooshed" when it is opened. (See description of - sector tag 16 & wall tag 6) - - - Also note that I my first subroutine in game.c! It is: - operatesector(short dasector) - All the door code is now in this function (with a few - exceptions, such as parts of the swinging doors and revolving - door) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/08/94 - Made EDITART and BUILD support different tile sizes in 'V' mode. - Here are the three possible sizes: - 0. 64*64 - 5*3 grid - views 15 tiles (old default) - 1. 32*32 - 10*6 grid - views 60 tiles (new default) - 2. 16*16 - 20*12 grid - views 240 tiles - Press the '*' and '/' keys in 'V' mode if you want to change - the grid resolution. - - - Added/fixed up a new key in 3D EDIT MODE, the dot key (. or >) - This key attempts to match up all the tiles along a wall. It - scans along the walls towards the right as long as the picture - number of the next wall is the same as the original picture - number. Note that some walls may not work right, especially - floor / ceiling steps. - - - Made 2D EDIT MODE default to this when inserting sprites: - 1. Sprite clipping = on for sprites taller than 32 pixels - 2. Sprite clipping = off for sprites shorter than 32 pixels. - - - Fixed sprite clipping with Z-coordinates -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/10/94 - Fixed some sprite dragging bugs - - - Made neartag? maximum sensing distance a global variable called - neartagdist. See build.h. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/11/94 - Added sector / groups of sectors selection. When selecting - sectors, hold down the right ALT key. It works just like - right shift. You must completely surround any sector you - wish to select. Once selected, you can drag the mess of - sectors with the mouse. This is great for separating sectors - from each other. - - - Added sector duplication. First select a bunch of sectors. Then - press the insert key. (with the select sectors flashing) Then - This duplication is like stamping. So, you must drag - the sector bunch somewhere else after stamping to see your - great accomplishments. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/12/94 - Added group-sector PGUP / PGDN. Here's a neat trick that will - let you move a whole section of a board up / down quickly. - First you select a bunch of sectors with the right ALT key in - 2D mode. Then flip to 3D mode and if you press PGUP / PGDN - on any of the highlighted sectors, the rest of the highlighted - sectors will move also. - - - Added group-sector rotation. Once you do a sector select (right - ALT), you can press the , or . keys to rotate the selected - sectors. Hold down the shift key with the keys to get fine - angle rotation (WARNING: You will get distortion with fine - angle rotation in this version) - - - Added sector count and wall count information at the bottom of - the 2D edit mode status bar. - - - Fixed some stupid bug that you probably wouldn't have found if - you made boards with BUILD for the rest of your life. - - - You can now press 'B' to block / unblock a wall or sprite in - 2D edit mode. - - - Made Ctrl-Shift Enter auto-shade a sector. First make any - wall of the loop as light as the lightest shade you want. - Then make any other wall of the loop as dark as the darkest - shade you want. Finally press Ctrl-Shift Enter on the wall - that should be lightest. Now the loop should be smoothly - shaded. If it is not smoothly shaded, you may need to insert - more points on the walls. - - - Fixed my .PCX format bug. My screen captures now load properly - in Deluxe programs. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/13/94 - Made my serial code in Game.c work better. I fixed the bullet - shooting and made all types of doors work. Unfortunately, you - still may have to run at slower COM speeds. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/14/94 - Fixed deadly bug with sector copy & sprites. - - - Added hitscan sensitivity bit. It is bit 6 (64) of wall[].cstat. - In 3D edit mode, you can press 'H' to toggle the bit. (H used - to be like 'V' for choosing height tile numbers for groudraws - - I change the 'H' key to Alt-V since I don't think anybody was - using it anyway) By default, hitscan CAN go through maskable - walls. If a hitscan is set to not go through a maskable wall, - The wall will appear BRIGHT pink in 2D edit mode. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/15/94 - Made more subroutines in game.c and moved documentation from the - end of game.c into this text file. Added some more comments - also. Game.c is so much easier to read now! The main loop is - less than 50 lines long! - - - Made some optimizations to my serial code now that everything - is in functions. - - - ATTENTION PROGRAMMERS: - I added one new paramater (cliptype) to both the movesprite - and clipmove functions. If the new parameter is a 0, then - the clipping is normal (Use 0 to clip you and monsters). - If the new parameter is a 1, then the object is clipped to - the same things that hitscan is clipped to (use 1 for all - bullets). - See the above documentation for a detailed description of the - parameters. (Remember that I moved the documentation from - GAME.C into the middle BUILD.TXT) - Finally, you can have sprites and bullets going where you - want them to go! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/18/94 - Added support for the Spaceplayer (6-degree of freedom Space ball) - Try out the SETUP program now. - - - Fixed some bugs with the 'E' key in 3D EDIT MODE. As long as both - dimensions of the tile are powers of 2, then the picture should - be visible. It should not be a solid color with a few weird - lines any more. - - - Fixed some bugs with the Z control in 3D EDIT MODE. In normal - operation, BUILD attempts to keep your Z constant even if - you cross sector lines. Then I added a special new mode that - locks your heightofffloor to a certain value. You Z will - change instantly if you cross sector lines. To use this mode, - press the Caps Lock key. Press Caps Lock key again for normal - operation. - - - ATTENTION PROGRAMMERS! I put all of engineinput into GAME.C - This means you have absolutely total control of the Z's. (The - only thing left is some key code I still have in my timer - handler) - - OK, now read carefully! Here's how to convert to the new OBJ's: - - 1. First of all, the Spaceball code is now also in game.c. - A. You will need to put this line in game.c: - include "spw_int.h" - B. And make sure to add spwint.obj your makefile. - 2. Heightoffceiling, heightofffloor, and gravity have been - removed from BUILD.H. If you still want to use them - then you should defined them as globals in your own code. - 3. You should go through every single key of my gameinput() - function in game.c and copy any code you want. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/23/94 - GREAT NEW STUFF! - - Be sure to check out GAME.EXE and try out these new keys! - - Rt. Enter = Switch between 3D / 2D modes - Lt. +/- = Zoom in 2D mode - - Added 2D map display with auto-mapping! The 2D maps use a - higher resolution 16-color mode. You have a choice of either - using a 640*350*16 screen or a 640*480*16 screen with a 144-high - status bar (remember that 640*480*16 cannot fit in 256K with 2 - screen pages so I have to cheat with a status bar). - - NEW FUNCTIONS: - - draw2dscreen(long posxe, long posye, short ange, long zoome, - short gride) - Draws the 2d screen - this function is a direct replacement - for the drawrooms() and drawmasks() functions. Be sure - to call either qsetmode640350() or qsetmode640480() - first. When switching back to 3d mode, be sure to call - qsetmode320200(). - - IMPORTANT NOTES: - 1. The overwritesprite function should only be called in - 3D mode. If you do this in 2D mode, junk will be - written to the 2D screen and a crash is possible. - 2. When you switch back to 3D mode, you should call the - permanentwritesprite functions to draw the status bar, - or whatever else you have to draw. - 3. You must call the nextpage() function in both 2D and - 3D modes. - - qsetmode320200(); - Set to the game mode and load palette (320*200*256) - qsetmode640350(); - Set to the 2D map mode #1 (640*350*16) - qsetmode640480(); - Set to the 2D map mode #2 (640*480*16) - - NEW VARIABLES (see description in build.h): - - EXTERN char show2dwall[MAXWALLS>>3]; - EXTERN char show2dsprite[MAXSPRITES>>3]; - EXTERN char automapping; - - - Added parallaxing floors! Works like the parallaxing skies, but - the other side. In 3D EDIT MODE, press P on ceiling for - parallaxing sky, or press P on floor for parallaxing floor. - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/24/94 - There is a new function that I forgot to document in the last - version. Oops! - - doanimations() is this function. - It's not really new, but I split it off of the - drawrooms/drawmasks functions. This function animates anything - that you use setanimation with. Please stick it in your code - somewhere after you draw the screen. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/26/94 - You can now do TRANSLUSCENT sprites! I am using bit 1 of - sprite[].cstat to detemine whether or not the sprite is - transluscent or not. In 3D EDIT MODE, you can press 'T' to - toggle the transluscence bit. - IMPORTANT: Transluscence WILL NOT WORK until you run my - TRANSPAL.EXE program. On the command line, simply type: - C:\BUILD>transpal [filename] - If you do not specify a filename, the default will be - palette.dat. If your palette.dat file is now around 40K long, - then you are ready for transluscence! - - - Added TRANSLUSCENCE to masked walls. See bit 7 of wall[].cstat. - Press 'T' on wall to toggle the transluscence bit. - - - In this BUILD update, I have collected many different palettes - for comparison purposes. Try running TRANSPAL.EXE on each of - them and see for yourself which palettes work the best with - transluscence! - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/29/94 - ATTENTION PROGRAMMERS: I completely rewrote the neartag code. - Here's what you have to do to convert your game.c files: - - 1. You should move the neartag variables that I used to - have in BUILD.H into your C code. - 2. You must call the neartag function yourself if you want - to see if you're near a tagged object. Neartag is NOT - automatically updated by the engine any more. - 3. I highly recommend that you put your neartag function - call at the first line in your space bar code. This way, - you can optimize the neartag calculations by only doing - them when you press the space bar. (Exception: For - ladders, I think you'll have to call neartag every single - frame) - - Here's a description of the new neartag function: - Neartag works sort of like hitscan, but is optimized to - scan only close objects and scan only objects with - tags != 0. - - neartag(long x, long y, long z, short sectnum, short ang, //Starting position & angle - short *neartagsector, //Returns near sector if sector[].tag != 0 - short *neartagwall, //Returns near wall if wall[].tag != 0 - short *neartagsprite, //Returns near sprite if sprite[].tag != 0 - long *neartaghitdist, //Returns actual distance to object (scale: 1024=largest grid size) - long neartagrange) //Choose maximum distance to scan (scale: 1024=largest grid size) - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/31/94 - Added a function to get a sprite's screen coordinates. I put - some sample code in my GAME in the analyzesprites function. - Simply hold down the CAPS LOCK key in my GAME.EXE, and the - screen will be centered around the sprite closest to the - center of the screen. - - Here's a new function in the engine I used to do this: - - getspritescreencoord(short spritesortnum, long *scrx, long *scry) - - Note that spritesortnum is the index into the spritesortcnt - arrays, NOT the normal sprite arrays. Scrx and scry are actual - screen coordinates ranging from 0-319 and 0-199 respectively. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/6/94 - Made EDITART support sprite centering and animation speed. - - Now when you press 'A' in EDITART, the animation speed is - actually saved to disk and runs the same speed in BUILD - and your GAME. Press + and - to change the animation speed. - There are 16 different animation speeds. - (Speed is proportional to (totalclock>>animspeed)) - - To center a sprite, press the weird ~` key (located just above - the TAB key). You will see some cross hairs. Simply use - the arrow keys to the desired position. - - For both the 'A' and ~` keys, you can press Enter to accept - the new values or ESC to cancel. - - - Added a variable to BUILD.H, lockclock. Lockclock is to - totalclock as lockspeed is to clockspeed. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/7/94 - Made 3 different Z coordinate modes in BUILD. - - Mode 0: Game mode (default) - Mode 1: Height lock mode - Mode 2: Float mode - - Press Caps Lock to switch between the 3 modes. - A and Z move up and down for all 3 modes. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/10/94 - Added a new function that should solve all your sound problems. - - kenchaintimer(void (__interrupt __far *datimerchainaddress)(), - short dachainpersecond) - - Please look at the IMPORTANT ENGINE FUNCTIONS section above for - a full description. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/20/94 - Got rid of the comsend / comgetchar functions. Replaced them - with sendpacket and getpacket. - - - Added network support. - - - Got rid of qsetmode320200(). Just replace it with setgamemode(). - The 2 are exactly the same. - - - Got rid of clockspeed variables. Just replace it with lockspeed. - - - Adjusted my z directions of shooting depending on the horizon. - You may want to readjust your code for this. - - - You now pass the number of tics as a long to doanimations. - doanimations(long numtics); - - - FIXED DEADLY BUG! This may have been causing bigtime crash-city - bugs! The problem was with show2dsprite and show2dwall. In - my engine.c I forgot that they were BIT arrays, not BYTE arrays. - When I initialized the arrays to 0, I initialized 8 times the - length, possibly overwriting your precious data! I initialize - these arrays in the initengine and loadboard functions. - - - ATTENTION PROGRAMMERS: In order to get rid of the posx, posy, - posz, ang, posz, and horiz variables from BUILD.H, I added some - parameters to a few functions. YOU MUST REWRITE YOUR CODE - TO SUPPORT THESE: - loadboard(char *filename, long *posx, long *posy, long *posz, - short *ang, short *cursectnum) - saveboard(char *filename, long *posx, long *posy, long *posz, - short *ang, short *cursectnum) - drawrooms(long posx, long posy, long posz, - short ang, long horiz, short *cursectnum) - - THESE VARIABLES SHOULD BE MOVED INTO GAME.C: - long posx, posy, posz, horiz; - short ang, cursectnum; - long hvel; -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/22/94 - ATTENTION PROGRAMMERS: Added 1 parameter to movesprite, the - number of tics (such as lockspeed). - - movesprite(short spritenum, long xchange, long ychange, - long zchange, long walldist, - char cliptype, long numtics) - - - ATTENTION PROGRAMMERS: At one time, I used to have 4 timing - variable in the engine. (totalclock, clockspeed, - lockclock, lockspeed). I got rid of all of them except - totalclock. If you want to use the other 3 variables, you - must simulate them yourself. Here's how you do it: - - Step 1. Define clockspeed, lockclock, and lockspeed as global - longs in your code. - - Step 2. Be sure to zero out all 3 variables just before - starting to play each level. (You could zero out - totalclock also.) - - Step 3. Right after every time you call the nextpage() - function, insert this code line for line: - - lockspeed = totalclock-lockclock; - lockclock += lockspeed; - clockspeed = lockspeed; - - You really don't need clockspeed if you have lockspeed. - You should replace all clockspeed's with lockspeed's. - Before, I had both because both totalclock and clockspeed used - to be incremented in the timer handler and could be changed - at any time. - - - I added my own optional random function, krand() which returns - a pseudo-random number as a long from 0 to 65535. Notice that - I put a randomseed variable in BUILD.H called randomseed. - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/24/94 - I just want to try to explain how all of my multiplayer code - works. Theory: Think of the whole program as 2 functions: - - Function 1. Draw the screen (could be 2D / 3D) - Function 2. Move things. (sprites, walls, sectors, and you!) - - My communications in GAME.C work on a MASTER/SLAVE - system where it would be nice if the faster computer was the - MASTER. (Right now, the first computer in is the MASTER). - The big trick to keeping everything in sync (and I do mean - everything- even moving platforms, revolving doors, & subways) - is to call function #2 with the exact same parameters as input - on all computers the same number of times and in the same - order. Now this might seem like a lot of information but it - really isn't! Let me explain the role of the MASTER and SLAVE: - - The MASTER's job: - 1. Read in own input changes - 2. Read in any slave player input changes - (getpackets function - reads in foreign vel, svel, - angvel, & the bits) - - 3. Just before calling the movethings function, send the - input to the movethings function: - A. Master's tic cnt (synctics) - B. Every player's velocities (syncvel, svel, angvel) - C. Every player's status bits (Space, Ctrl, Shift, etc.) - 4. Call the movethings function - 5. Draw screen - - The SLAVE's job: - 1. Read in own input changes - 2. Send own input changes to master. - 3. Read in all master movethings input parameters and - call movethings function for each packet. This may - mean calling the movethings function more than once - between calling the drawscreen functions. This is - waste, but it's the price you have to pay to keep - things in sync. - 4. Draw screen - - - You may ask how do monsters stay in sync even if you are - not sending any monster information over the line. The - answer to this is simple. - 1. You make sure that a random seed starts the same on - both computers. - 2. Only call the rand() or krand() function in the - movethings function. - - Before you try my demo, I wanted to say that, I have - ABSOLUTELY NO ERROR CORRECTION in my code at this point. It - is most certainly my next project. For serial link, I would - recommend a rate of about 14400 baud. In the future, I think - I can optimize the code enough to work at rates as low at 2400 - baud! Let me explain how well certain setups should work - without error correction: - Ken's guesses on how badly it will crash WITH NO ERROR - CORRECTION (Build the way it is now): - - 1. Serial link using 8250 chips - out of sync after 15 - seconds because a few bytes were missed. - 2. Serial link using 16550 chips - out of sync after 10 - minutes because 16550 chips have a 16 byte FIFO and - therefore don't lose bytes as often as the 8250. - 3. Modem - out of sync after less than 5 seconds. - 4. Network - out of sync after 1 minute. Networks love to - lose full packets here and there. - - I will be working on error correction for all of the above - situations. Any error correction techniques I use will be - internal to the engine and completely transparent to you (so - you can start coding now!) If the demo actually works multi- - player, then you may want to look at my GAME keys at the top - of this file again. There are some significant changes. - - * I replaced the old COM functions section at the top of - BUILD.TXT with a COMMUNICATIONS FUNCTIONS section. Please - look through it for descriptions of at least these 2 - functions: - - sendpacket(short otherconnectnum, char *bufptr, short bufleng) - getpacket(short *otherconnectnum, char *bufptr) - - * Another rule to keep in mind while testing: (as if there - aren't enough already) Always make sure you have the - same EXE's and MAP'S or else the games will get out of sync. - - * Connection numbers and Index numbers: - For networks, each computer has a given connection number. - Connection numbers range from 1 to 100. Player number 1 - might have connection number 5 and player number 2 might have - connection number 17. Since a player's connection number - can be anything between 1 and 100, I don't want you to - allocate 100 of every variable such as posx[100]. My - solution was to make index numbers. So in this case: - - connectnum[0] = 5; connectindex[5] = 0; - connectnum[1] = 17; connectindex[17] = 1; - - * Now I'll will describe some new variables at the top of GAME.C - - myconnectnum - connection number of your computer - myconnectindex - index number of your computer - masterconnectnum - connection number of the MASTER computer - screenpeek - index number of which player's eyes you are - looking through. - numplayers - if numplayers >= 2 then multiplayer mode is - enabled, else single player game. - - connecthead, connectpoint2[MAXPLAYERS] - These 2 variables - form a linked list of all the index numbers. - Here's some example code that traverses the list of - players: - - p = connecthead; - while (p != -1) - { - printf("Player index %d has connection number %d\n",p,connectnum[p]); - p = connectpoint2[p]; - } - - * These variables are used to record / playback a demo. (This - is like POSCAPT.DAT, but with everything in sync!) In my - GAME, i single player mode, I have it so if you press the - Left ENTER, then it will playback everything. These are - the only variables necessary to store a demo run: - - static long reccnt; //Number of frames - static short recsyncvel[16384]; //Vel for each frame - static short recsyncsvel[16384]; //Svel for each frame - static short recsyncangvel[16384]; //Angvel for each frame - static short recsyncbits[16384]; //Bits for each frame - static short recsynctics[16384]; //Tics for each frame - - * These variables are used for communications syncing: - - static short syncvel[MAXPLAYERS+1]; //Vel of each player - static short syncsvel[MAXPLAYERS+1]; //Svel of each player - static short syncangvel[MAXPLAYERS+1]; //Angvel of each player - static short syncbits[MAXPLAYERS+1]; //Bits for each player - static short synctics; //Number of tics of MASTER ONLY - - * Unless I suddenly make BUILD a 6-degree of freedom engine - tomorrow, this should be the most difficult update in a long - time! Good Luck in programming! I'm sure I left a lot of - things out, so I'll be expecting plenty of phone calls! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/27/94 - I scaled the vel, svel and angvel variabile down 1 bit so they - fit into a signed char. (Before they ranged from -256 to 256) - Now they range from (-128 to 127). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/28/94 - Optimized the size of my COM(modem)/network packets in game.c. - I made the tics into a char. I also use some new buffers called - osyncvel, osyncsvel, osyncangvel, and osyncbits. Now I send - extra byte with bit fields that tell whether I need to update - the syncvel, syncsvel, syncangvel, or syncbits variables. If - the bit field of the extra byte is off then I don't send the - byte(s) it represents. You can now play my GAME at 4800 baud. - - static signed char syncvel[MAXPLAYERS+1], osyncvel[MAXPLAYERS+1]; - static signed char syncsvel[MAXPLAYERS+1], osyncsvel[MAXPLAYERS+1]; - static signed char syncangvel[MAXPLAYERS+1], osyncangvel[MAXPLAYERS+1]; - static short syncbits[MAXPLAYERS+1], osyncbits[MAXPLAYERS+1]; - static unsigned char synctics; - - - There was an crashing error with transluscence palette on low - memory configurations. When you exit the BUILD editor, - you normally get some numbers like this. - Memory status: 788979(788979) bytes - If the first number (art memory cache size) was less than the - second number (art file size), then the whole art file did - not fit in memory. The reason for the crashing was because - loadpics() sucks all memory up to the size of the art file. - The 64K transluscent palette is malloc'd when you call the - setgamemode() function for the first time. The was no memory - left to allocate the palette. I fixed this by making the - transluscent palette take 64K of the art memory cache if - it could not malloc the 64K. - - - I programmed some error correction for the COM(modem). Here is - my new of Ken's guesses on how badly it will crash (assuming - that it will always crash eventually.) You will be seeing new - and better correction methods in the future. - - ERROR CORRECTION METHOD #1: - 1. Serial link using 8250 chips - out of sync after 5 minutes. - 2. Serial link using 16550 chips - out of sync after 10 minutes. - 3. Modem - out of sync after 3 minutes - try it! - 4. Network - out of sync after 1 minute. Networks love to - lose full packets here and there. (not changed) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/29/94 - Added some code to my GAME.C that will let you type in messages - and send them to all remote players. Press Tab (or T for - those people who play that other, very bad, game too much) - to start typing in a message. Press either Enter key to send - the message to the other player. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/30/94 - ATTENTION PROGRAMMERS: I changed the values that clipmove and - movesprite return! Here's how they work now: - If you did not hit anything, then they return 0. - Movesprite only: If the object hits a ceiling / floor - then movesprite returns 16384+(sectornum hit). - If the first object you hit before sliding was a wall, - then they return the 32768+(wallnum hit). - If the first object you hit before sliding was a sprite, - then they return the 49152+(spritenum hit). - - Be careful when adding these changes to your code since the - return value are sort of reversed: - - return values: º Hit nothing: ³ Hit something: - ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ - Old functions: º 1 ³ 0 - ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ×ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ- - º ³ 16384+sectnum (Movesprite only) - New functions: º 0 ³ or 32768+wallnum - º ³ or 49152+spritenum - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/1/94 - Made getangle always return an angle from 0 to 2047. Before I - forgot to and it 2047 and sometimes the angle was negative. - - - Made overwritesprite when using the centering option be sensitive - to the Editart centering tool. (The ~` key.) - - - Made Ctrl+Rt.Shift highlight points on a loop rather than points - inside a rectangle. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/2/94 - Added some neat features to my GAME.C to make multi-player mode - even more fun. I added a portable bowling ball/bomb-thrower. - kills instantly! (similar to rocket launcher) I also added - water fountains. If you hold the space bar down on them, - you slowly get more life. - - - O.K. I think I actually got the syncronization working perfectly - for COM(modem) play. I haven't had all day to test it out yet! - (Still no error correction with networks) - - Here are some steps in playing over the modem: - 1. Be sure that both people have the exact same version of - the EXEs, ART, and MAPs. - 2. Then go into SETUP and set the COM port to the com port - of your modem. Even though 9600 baud should work, I - would recommend going at 4800 baud because: - A. It works fine at 4800 baud so there is really - no need to go any faster. - B. Fewer errors over the modem so less time - spent re-sending packets. - 3. Then type: MODEM [mapname] (must be same mapname!) - This will bring you into my terminal program. You can - set the modem initialization string in MODEM.BAT by - changing the first command line option of the TERM - line. Please disable modem compression and - correction for least jerky play. Then connect with - the other modem using various methods, such as one - person typing ATA and the other typing ATD or one - person typing ATS0=1 and the other typing - ATDT(phone #). - 4. Wait through the beeps and buzzes until it says CONNECT - on the bottom window. - 5. If you can now chat with each other then things are - going well. When the first person presses ESC, both - computers will automatically quit to DOS and go right - into the GAME. - 6. Play! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/5/94 - Serial moder over COM(modem) should work perfectly now. - - - Added scaredfallz to BUILD.H. It is a global variable that - tells monsters what height is too high to fall through. You - can set cliptype parameter to 2 for movesprite and clipmove. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/6/94 - Fixed clipping bug that used to let you go through certain concave - corners. - - - Added new function which works well with clipmove. Ever notice - was when you're at the edge of a cliff and you go just a tiny - bit over, you fall, but shouldn't yet? Unlike what you have - been doing, this new function finds the highest and lowest z - coordinates that your clipping BOX can get to. It must search - for all sectors (and sprites) that go into your clipping box. - Currently, you were searching the z's at the center point only - by simply using the sector[].ceilingz and sector[].floorz - variables. - - getzrange(long x, long y, long z, short sectnum, - long *ceilz, long *florz, - long walldist, char cliptype) - - Pass x, y, z, sector normally. Walldist can be 128. Cliptype - can be 0, 1, or 2. (just like movesprite and clipmove) - This function returnes the 2 z maxes in ceilz and florz. - See GAME.C for an example. - - - Fixed bug with weird vertical lines in transluscent masked walls - in chain mode. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/10/94 - Made screen capture (F12) work in 2D modes also. It always - saves to a 256 color PCX file. - - - Made screen re-sizeable. Use this easy new function to re-size - the screen: - - setview(long scrx1, long scry1, long scrx2, long scry2); - - It is TOO easy to use. You simply pass is the Upper-left hand - corner and the bottom-right corner in screen coordinates of the - rectangular region you want the engine to draw to. The engine - automatically centers the horizon at the middle of the window and - scales everything properly. - - Notes: - - Since the engine does extra scaling calculations for - window sizes that are not 320 pixels wide, I do not - recommend making the default mode with a window size - just under 320 pixels wide since the engine can - actually run a little slower. (such as 312-319 - pixels wide) Keep them 320 wide. - - Feel free to modify the startumost / startdmost arrays - AFTER a setview call if you want weird window shapes. - Keep in mind that startumost[0] and startdmost[0] are - always refer to the left edge of the viewing window. - (NOT left edge of screen.) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/19/94 - Finally got around to writing the number-of-tiles-per-file - resizer. Simply type rsizeart. All instructions will be - displayed when running the program before the actual - conversion. - - - Fixed a few bugs in Editart. I hope I fixed those evil bugs that - rarely come by. I'm pretty sure I fixed the bug that made the - screen go blank in 'V' mode, and the bug where a few pixels - in the top left corners of tiles sometimes get overwritten. - - - Added a key in Build 2D edit mode. Press 'E' on a sprite to - change its status list number. - - - Fixed those lousy Editart subdirectory colors in 'U' for those - teams with great color palettes, but don't have my ugly shade - of pink. - - - Fixed bug with non-200 high P-skies. The p-skies are now (by - default) centered on the horizon no matter what the height is. - - - Added multiple size PCX and GIF support in Editart. You can now - load pictures up to 1024*256. (That's all that can fit in VGA - video memory) If you need to load a bigger picture than that, - it will be chopped off at the bottom, but will still load the - top piece. - - - I know that I have introduced some wonderful new bugs with the - sprite drawing. I know why they're happening, but I am - looking for a good solution so as to not make you change - any code. I will put another upload with these bugs fixed - soon. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/20/94 - Added TRUE ornamented walls. Right now the actual ornamentation - must be programmed by you with 2 simple functions: - - copytilepiece(long tilenume1, long sourcex1, long sourcey1, - long xsiz, long ysiz, - long tilenume2, long destx1, long desty1) - - * This function simply copies any section of a source tile - to any part of a destination tile. It will automatically - skip transparent pixels. It will wrap-around in the - source but not the destination. If for some reason - the destination tile gets removed from the cache, the - destination tile will be reset to original form. This - is why I had to add this second function: - - allocatepermanenttile(short tilenume, long xsiz, long ysiz) - - * This function allocates a place on the cache as permanent. - Right now, I reset the cache every time you call this - function so I would recommend calling this function - right after loadpics. - - I have an example of both of these functions in GAME.C. Try - playing GAME DOOM1.MAP and go into the secret room with - the pictures of Ken. Shoot some walls there. The pictures - with Ken and the Explosion over it were done with - copytilepiece and allocated permanently at tile 4095. A - good idea for allocating permanent tiles would be to start - at 4095 and decrement. You can also allocate a permanent - tile over the original tile itself. - - - Tile panning matching keys work a lot better. They now work - well with bottom steps. Also, it works well with matching - up windows. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/25/94 - A week ago, I uploaded a version of BUILD which unfortunately - had more bugs than the previous version. This upload should - have those bugs fixed - especially the sprite bugs. (I hope) - - - I think I may actually have the sprite feet behind stairs bug - working perfectly. - - - The engine should now be even faster the before last week. (A - week ago, I temporarily changed the parallaxing sky algorithm, - making the engine slower in those areas) - - - Added a variable, parallaxyoffs in BUILD.H. It defaults to 0. - If you set it to 100, then all parallaxing skies will be - properly moved 100 pixels higher. - - - Fixed some weird drawing bug related to parallaxing skies and - sprites. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/26/94 - Made sprite's sectors dependent on the z coordinates in the BUILD - editor. (Helpful if you use overlapping in your maps) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/29/94 - Made precache function. Simply call: - precache() (no parameters) - right after you call loadboard(?,?,...) and it will load - all tiles in the current board into the cache. Note that - animations of sprites after the first one will not be - precached. I have included my precacheing code at the - end of game.c for those interested in making the precaching - fancy. - - - Fixed bug in editart which made it sometimes save the art files - and names.h in the wrong directory (the last directory you - were in when you were in 'U' mode). You may want to search - your artwork directories to see if you were a victim of this - bug. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/30/94 - Made Ctrl-Enter paste parallaxing sky tiles to all neighboring - parallaxing sky areas also. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/31/94 - Fixed (most) crashing bugs - Doesn't even crash on the highest - skyscrapers now! Since I can never be SURE that the crashing - is gone, I need you to test it for me - compare the number - of times it crashes per second since the last version. It - should be much better. - - - Fixed sector line bug! Get close to a step, hold down Shift+Z - and the edges of the step will NOT jitter like before AND you - will not get random walls going through the screen. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/1/94 - Got rid of the OLD transluscent stuff from overwritesprite and - permanentwritesprite. (Before it used the 8K shading table - which didn't work very well) - - - Added new true 50/50 transluscence option to overwritesprite. - See bit 2 in the next comment. - - - Fixed overwritesprite so it works with different screen sizes. - You don't need to do any scaling calculations! Should be - compatible with old function. Added new bit 1 to orientation - parameter to determine whether or not the sprite should be - scaled and clipped to the viewing window. - - overwritesprite (long thex, long they, short tilenum, - signed char shade, char orientation) - - If Bit 0 of orientation = 0: (thex, they) is top-left corner - If Bit 0 of orientation = 1: (thex, they) is middle - If Bit 1 of orientation = 0: no relation to viewing window - If Bit 1 of orientation = 1: scale and clip to viewing window - If Bit 2 of orientation = 0: normal - If Bit 2 of orientation = 1: 50/50 transluscent! - - * If it works at full screen, simply set bit 1 of orientation - to 1, and it should automatically scale properly! - - - Made it so 2/4/6/8 keys in 3D EDIT MODE now only move the objects - 1 step rather than continuously, giving more control over the - repeat/panning values of things. - - - Made the / key not only reset the repeats of walls, but also for - sprites. It will set both repeats of the sprite to the default - size of 64. If you hold down shift with / on a sprite, it - will give the sprite a square aspect ratio by setting the - xrepeat to equal the yrepeat value. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/2/94 - Doubled the board size from: (0 to 65536, 0 to 65536) to - (-65536 to 65536, -65536 to 65536) Notice that the grid in - 2D EDIT MODE is much bigger than before. Since it is very easy - to double the maximum board size, just tell me if you need - a larger board. The only bad thing about allowing larger - boards is that the map designer is more likely to make some - sectors too large and cause overflow bugs. 32 bits can only - go so far you know! - - - I think I MAY have fixed a bug in BUILD that used to make it crash - when quitting. It had something to do with the vertical grid - lines in 2D EDIT MODE when zoomed way in around the upper left - corner of the map (I think). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/3/94 - Optimized Editart loading and saving. - - - Made 'V' screen in Editart 320*400 instead of 320*200. - - - Before I said I fixed the bug in EDITART where a few pixels in the - top left corners of tiles sometimes got overwritten. Well I - lied. This time I really fixed it. (I hope) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/7/94 - Made x&y repeats, x&y pannings easier to adjust. It now works - like the default keyboard handler. It moves once when you - first press the key. A little later, it starts to move fast. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/11/94 - Added great new sprite rotation function which works like - overwritesprite (like 2DRAW sprites) - - rotatesprite(long sx, long sy, long z, short a, short picnum) - - (sx, sy) is the center of the sprite to draw defined as - screen coordinates shifted up by 16. - (z) is the zoom. Normal size is 65536. - Ex: 131072 is zoomed in 2X and 32768 is zoomed out 2X. - (a) is the angle (0 is straight up) - (picnum) is the tile number - - Ex: rotatesprite(160L<<16,100L<<16,65536,lockclock<<4,DEMOSIGN); - This example will draw the DEMOSIGN tile in the center of the - screen and rotate about once per second. - - Rotatesprite clips to the same area as overwritesprite but does - not scale or do transluscence yet. - - - Please look at the new permanentwritesprite documentation at the - top of this file! - - - Network should now work again - It now works great on my network - with 3 players! It may possibly also work with 4 or 5 players - too, but I didn't feel like running between 2 rooms to test it! - I never thought the day would come when I would get NET, COM, - and MODEM all working respectably! - - - Changed setup program so you can select 2, 3, 4, or 5 players in - a network game. (The 5 is just to annoy people who like that - other lousy game) - - - ATTENTION BUILDERS! Added TILE MOVING to EDITART! For now, it - will only work WITHIN THE SAME ART FILE. Do the tile moving - all in 'V' mode. Here are the new keys in 'V' mode: - - To swap 2 tiles: - Simply press space bar on the first tile, then space - bar on the second. - To swap a group of tiles: - Press 1 on the first tile, press 2 to remember the region - between where you pressed 1 and 2. Press 3 at the - place to where you want to swap all the tiles. - - Don't forget that this is all SWAPPING, tiles will (should) - NOT be overwritten using these keys. - - - ATTENTION PROGRAMMERS! Added ceildist and flordist parameters to - both clipmove and movesprite. I always had them all set to - (4<<8) by default. - - clipmove(long *x, long *y, long *z, short *sectnum, - long xvect, long yvect, - long walldist, long ceildist, long flordist, - char cliptype) - - movesprite(short spritenum, long xchange, long ychange, long zchange, - long walldist, long ceildist, long flordist, - char cliptype, long numtics) - - - Moved some com/network code from the getpackets function in game - into the engine. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/15/94 - Fixed some network initialization code and it now works with 4 - players. (I tested it.) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/16/94 - Added different shirt color support. Here's how you do it: - - allocatespritepalookup(long palnum, char *remapbuf) - - See more documentation of allocatespritepalookup at the top of - this file. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/18/94 - I made it so you can redefine the keys in the setup program under - the input devices menu. - - - ATTENTION EVERYONE - for this new version, you MUST go into my - new SETUP program, and SAVE CHANGES AND QUIT once. The arrow - key code will not work if you don't do this! If you are - one of those people who actually read BUILD.TXT, give yourself - 1 point. I wonder who will get "caught" for not reading this! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/22/94 - Added pixel height and wall length information to 2D EDIT MODE - when you press Tab or Alt-Tab on a sector or wall. - - - Now show the actual number of sprites in 2D EDIT MODE. - - - Improved digitized sound routines. Just thought I'd mention it. - - - Added a "save As" feature to 2D EDIT MODE. - - - Now show all lo and hi tags in 2D EDIT MODE on the map itself! - Note that position of the sector tag's text is put at the - average point of all the points of the sector, so if you have - a weird shape tagged sector, the text might show up at an - inconvenient place. - - - You can turn the tag boxes on or off by pressing CTRL-T or by - zooming out. - - - ATTENTION EVERYONE - for the new BUILD.EXE and OBJ's, you will - need to copy my new TABLES.DAT over your old one. Also, you - must go into SETUP and SAVE&QUIT. I have split the TABLES.DAT - file into 2 separate files. They are: - - TABLES.DAT - 10880 bytes - sin tables, fonts, etc. - SETUP.DAT - 23 bytes - (6 options) + (17 custom keys) - - The SETUP.DAT file is the only file SETUP.EXE accesses now. - This means that from now on, if I want to add something to - TABLES.DAT, you won't have to go into the setup program and reset - the options again. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/24/94 - Relative alignment now fully works with ROTATION! Relative - alignment will allow ceilings and floors to align with the - first 2 points of a sector. This will relieve you of - programming special ceiling and floor panning code for moving - sectors. - In 3D EDIT MODE, simply press 'R' on a ceiling / floor to switch - between relative alignment mode and normal mode. Notice that - bit 6 of both sector[].ceilingstat and sector[].floorstat are - relative alignment bits. - I have an example of relative alignment in nukeland.map in the - high blue room off the main octagonal room. Also note that my - subways and dragsectors now use relative alignment for panning. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/25/94 - I added a new parameter to printext256 and printext16. I need - to document this stuff! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/27/94 - Made it so you can't shrink sprites so much you can't grab them - any more in 3D EDIT MODE. - - - Added (G)oto feature into Build 'V' mode. Simply press G, type - the tile number and it will go there. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/7/94 - Fixed relative alignment bugs I noticed. My subway.map won't - crash anymore and the relatively aligned ceilings and floors - should not pan crazily anymore when looking from a far - distance. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/9/94 - ATTENTION PROGRAMMERS: I added a new parameter to - overwritesprite. Dapalnum can be from 0-15 depending on - what palette lookup table is being used. Dapalnum is normally - 0. Overwritesprite now looks like this: - - overwritesprite (long thex, long they, short tilenum, - signed char shade, char orientation, char dapalnum) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/13/94 - ATTENTION PROGRAMMERS: I changed the last parameter of drawrooms - (sector number) to be passed as a value, NOT a pointer anymore. - - drawrooms(long daposx, long daposy, long daposz, - short daang, long dahoriz, short dacursectnum) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/15/94 - ATTENTION PROGRAMMERS: I took out the COM(modem)/network code - from my engine.obj and put it into a separate .obj called - multi.obj. (I also removed the sound from my engine and stuck - it in kdmeng.obj) Please include it in your makefile. Here is - a list of ALL of the variables and functions you will need to - know to program for multiple players: - - VARIABLES: (You should extern these in your game.c) - extern short numplayers, myconnectindex; - extern short connecthead, connectpoint2[MAXPLAYERS]; - extern long *lastpacket2clock; - - FUNCTIONS: - initmultiplayers(option[4],option[5]); - uninitmultiplayers(); - - sendlogon(); - sendlogoff(); - - sendpacket(connecthead,tempbuf,j); - sendpacket(-1,tempbuf,j); - leng = getpacket(&otherconnectindex,tempbuf); - - Please see detailed descriptions of these functions at the top - of this file. - - - Multiplayer code is now MUCH cleaner! - - - Please try my game on your networks again! My game now works - perfectly with 3 players on a network that used to crash at - the DOS4GW prompt just a week ago! My game needs only IPX, - no server to run. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/16/94 - ATTENTION PROGRAMMERS: CONVMAP5!!! YOU MUST RUN CONVMAP5 ON - ALL OF YOUR MAPS IF YOU WANT THEM TO WORK WITH THE NEW - BUILD.EXE OR OBJ'S! Following are the exact changes I made - to the new map format: - - * Added numextras - * Added sector[].ceilingpal - * Added sector[].floorpal - * Added sector[].visibility - * Split sector[].tag to sector[].lotag and sector[].hitag - * Added sector[].extra - * Expanded wall[].cstat to a short - * Split wall[].tag to wall[].lotag and wall[].hitag - * Added wall[].extra - * Split sprite[].tag to sprite[].lotag and sprite[].hitag - * Got rid of sprite[].extra (the void * mess) - * Added sprite[].extra - - The only thing programmers have to worry about when converting - are the tags. I split them into lo and hi tags. - (See BUILD.H for new structure formats) - - I got rid of the (void *)extra thing from the sprite - structure. I know I may have made some promises it - wouldn't change and it was for your use only, but what - can I say - it's not needed anymore (in other words, - if you're already using it, TOUGH LUCK). I have my - own, new, method for extending sector, wall, or - sprite structures. You will be able to extend any - structure as much as you want AND be able to edit it - all in the BUILD editor to be saved in the permanent - map format. Notice I added a (short)extra to all 3 - main structures. They default to -1. But if they - are >= 0 then they form a linked list out of the - extra structure. NOTE: THIS EXTRA STUFF IS NOT - PROGRAMMED YET! I'm just mentioning it becuase the - new map format has this extendability. I'll try to - get it done soon though. (9/21/94) - Actually just - ignore the fact that this paragraph ever existed. - I'm just keeping it here for history purposes. - - - Renamed my allocatespritepalookup function to makepalookup since - it now also applies to walls, ceilings, floors, p-skies and - masked walls. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/20/94 - Added rotated sprites. These new rotated sprites rotate in the - same way as masked walls. Sounds like a waste since the - engine already has masked walls? NOT AT ALL! With rotated - sprites, you can EASILY do TRUE ornamented walls FULLY inside - the BUILD editor with even MORE versatility than that other - game out there. For example, you can place the ornamentation - anywhere on the wall, with sizing control using 2,4,6,8 on the - keypad, and even ornament with transluscence! In 3D EDIT - MODE, simply press 'R' on a sprite to make it a rotated - sprite (Programmers see bit 4 of sprite[].cstat) - - - Fixed crashing bug with sector (Rt. ALT) copy/paste in 2D EDIT - MODE. - - - You can now copy groups of sectors from 1 map to another! Here's - how you do it: - - Step 1: Capture a bunch of sectors with the Rt. ALT selection - tool. - Step 2: With the sectors still highlighted, you can now load - another map and the highlighted sectors will - automatically be inserted into the new map. (They - will still be highlighted) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/21/94 - Fixed bug with cursectnum not always being right after loading - the board. I now check it and make sure it's right when - saving in BUILD now. - - - Added 'O' key in 2D/3D EDIT MODES. It will push a rotated sprite - backwards (using hitscan) into the first wall and - automatically adjust the angle to make the sprite appear - as if it was part of the wall. - - - You can now press 'S' to insert a sprite in 3D EDIT MODE. Press - 'S' on a ceiling or floor. - - - You can now press delete to delete a sprite in 3D EDIT MODE. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/22/94 - Programmed Nick & Peter's BUILD stub to their EXACT - specifications. See WSTUB.C for code & documentation. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/27/94 - Fixed Rt. Alt block copying nextsector1 pointer bug. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/29/94 - Added special bitmapped effect which I either call lava or - boiling slime. See my initlava and movelava functions - inside GAME.C. - - - I added a bit array call gotpic. The engine will set the - respective gotpic bit for each picnum drawn to the screen, - including ceilings, floors, walls, sprites, masked walls - - even overwritesprites, etc. This array is mainly for - making the game only calculate special bitmapped effects - when that certain picnum is on the screen. - - Note 1: The engine does NOT automatically clear the gotpic - bits for you. If you want to test gotpic for a certain - picnum, you should clear it if you want to test it again. - - Note 2: It is not necessary to use permanentwritesprite - for bitmapped special effects - after all, if you see it, - it MUST be in the cache. - - Added to BUILD.H: - EXTERN char gotpic[MAXTILES>>3]; - - Example code in GAME.C: - if ((gotpic[SLIME>>3]&(1<<(SLIME&7))) > 0) //test bit - { - gotpic[SLIME>>3] &= ~(1<<(SLIME&7)); //clear bit - - if (waloff[SLIME] != -1) //if in cache - movelava((char *)waloff[SLIME]); //calculate! - } - - - Added what some people call gamma correction. I think - brightness is a better description though. - - setbrightness(char brightness); - - Simply call this function where brightness ranges from - 0 to 4. Brightness defaults to 0. Levels 1-4 are all brighter - than 0. If you switch between 2D & 3D modes, the engine will - remember the current brightness level. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/30/94 - Added a few keys to fake a multiplayer game all on 1 computer. - In my game, press Insert to add a new player at the starting - position, and Delete to delete the last player. Press - scroll lock to get control of the other players. In the same - way Lt. Enter lets you view other players, Scroll lock will - let you control other players (single player game only) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/2/94 - Moved all doanimations code from engine into game.c. If you - are using the doanimations code, here's exactly what you - need to do to make it work with your code again: - - Step 1: Copy these 3 functions which you should find at - the end of my Game.c: - - doanimations(long numtics) - getanimationgoal(long animptr) - setanimation(long *animptr, long thegoal, long thevel) - - Step 2: Move these variables out of BUILD.H and into your - game.c: - - #define MAXANIMATES 512 - static long *animateptr[MAXANIMATES], animategoal[MAXANIMATES]; - static long animatevel[MAXANIMATES], animatecnt = 0; - - * If you copied my door code, you will probably have to convert - some parameters to longs. (oops!) - - - Got rid of printnum from the engine. It is an outdated function. - Use either printext256 or printext16 instead. - - - Added y-flipping for both normal and rotated sprites. (see bit - 3 of sprite[].cstat in BUILD.H. - - - Added y-flipping for walls. (see bit 8 of wall[].cstat in - BUILD.H. - - - Fixed bug with initialization of Master and Slave for - COM(Modem) only. If both computers went in at the same - time, it used to sometimes think both were Masters. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/4/94 - Alt-C in 3D EDIT MODE changes all picnums on the whole map - from the picnum in tab to the picnum under the mouse cursor. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/6/94 - Fixed y-flipping bug on walls and masked walls. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/16/94 - Fixed bug in editart that didn't convert the maps right after - swapping tiles. - - - Added excellent function to my multi.obj. - - long getoutputcirclesize(); - This function returns the number of bytes that have not - yet been copied. If there are still more than say, 16 bytes, - then you may be sending too many bytes per second. This can - happen if the frame rate of a computer is faster than the - speed of the serial mode (Ex: Try 2400 baud with a Pentium 90!) - this function will tell you how many bytes are left to copy - In other words, if getoutputcirclesize() < 16 then it is safe - to send a packet. If you already have serial mode working - all you have to do to update your code is to copy the lines - in my sync() function the deal with the getoutputcirclesize - function. Everything else in sync() and getpackets() is - pretty much the same. - - - Programmed some example code in my game that will allow players - to change masters and slaves during the game without losing - sync. Simply press 'M' in my multiplayer game, and that - computer will become the master! It is interesting how - the frame rate and controllability changes. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/31/94 - Added basic scripting to EDITART. Don't expect it to be - everything you ever dreamed of (yet). - - Scripts are saved in a file called CAPFIL.TXT. You can edit the - text file, but be careful not to screw it up too badly (such - as extra commas, spaces in weird places, etc.) since I am - parsing it in EDITART. - - Whenever you select a box in 'U' mode, a line will be appended to - the CAPFIL.TXT file. - - WRITING THE CAPFIL.TXT FILE: - In 'U' mode, you can press 'O' instead of ENTER to select a tile. - What 'O' does that is different from ENTER is that it takes - the center point of the highlighted rectangle, and searches - outward until a total rectangle of transparent pixels (255) - is reached. This is useful for grabbing sprites - not only - will you not have fine adjust to the exact borders of a - sprite now, but when you re-grab from the pcx's you can - change the size of the sprite freely. - - READING THE CAPFIL.TXT FILE: - There are 2 ways to re-grab from the CAPFIL.TXT file. If you - press ALT-U in the main screen, everything will be re-grabbed. - If you press ALT-U in 'V' mode, then you should first select - the range by pressing '1' and '2' on the range boundaries. - - Format of CAPFIL.TXT lines: - Tile #, Full path/file name, x1, y1, xsize, ysize - - Note: If xsize and ysize are 0, then that means you did - an 'O' grab and EDITART will search from point (x1, y1) - when you do a re-grab. - - Example CAPFIL.TXT file: - 31,D:\CAPTUR00.PCX,220,98,64,64 - 110,D:\CAPTUR00.PCX,49,72,0,0 - - The first line says that tile #31 is a 64*64 tile and the - second line says that tile #110 is unknown size tile (grabbed - with the 'O' key) - - Note: You can only do 1 grab per tile with my scripting system. - You may have done your parallaxing skies with several grabs. - If so then try to make the tile into 1 large PCX and do 1 - grab. (The largest grabbing size right now is 1024*256) - - ------------------------------------------------------------------- - - - Made Editart's screen capture (F12) save to PCX's the exact size - of the tile and not include the status bar at the bottom. It - will also save large tiles to large PCX's - Now it's easy and - lossless to extract a tile from Editart! - - - ATTENTION PROGRAMMES! Added 2 new parameters to getzrange for - returning the objects hit on top and bottom. - (sectors / sprites) See my updated documentation at the top - of this file. - - - Fixed clipping bugs with sprites near sector lines. (I hope) - - - Got 3D Red-Blue glasses mode working for all VGA cards. First - set the graphics mode to red-blue mode in the setup program. - The left eye is red and the right eye is blue. There are - 4 keys that let you adjust the 3D view: - [,] = Adjust width between eyes (3D width) - Shift [,] = Adjust width of parallax (2D width) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/1/94 - Guess what? I turned 19 today. Doesn't that just suck. Now, - if you play my build game on my birthday, all the extemely - evil and scary brown monsters will be replaced with super - happy fun dogs that throw smiley red jelly coconuts at you. - Also, my incredibly evil and scary music will be replaced - with super happy music. Actually this whole paragraph is - a joke (except for the birthday part). - - - Made centering work with rotated sprites. - - - Fix centering with x and y flipped sprites. - - - Rotated sprites now get chopped off by the ceiling or floor in - the same way normal sprites get chopped. Sprites do not get - chopped if there is a parallaxing sky / floor. - - - Made Shift + F12 is BUILD 2D mode inverse black and white. - - - If SETUP.DAT is not found then default options are loaded - instead of quitting to DOS. - - - ATTENTION PROGRAMMERS! Added 3 parameters to makepalookup that - allow you to do FOG effects. The first 2 parameters are the - same as before. The last 3 are the color that the palette - fades to as you get further away. Before, this color was - always black (0,0,0). White would be (63,63,63). - - makepalookup(long palnum, char *remapbuf, - char redvalue, char greenvalue, char bluevalue) - - - ATTENTION PROGRAMMERS! Moved 2 things into BUILD.H. Please - make sure to update it: - - #define MAXPALOOKUPS 256 - and - EXTERN char *palookup[MAXPALOOKUPS]; - - The palookup array is an array of pointers that point to the - first byte of each 8K palette lookup table. All 256 pointers - are initialized to NULL by initengine() except for palookup[0] - which is the default 8K palette. This will allow you to modify - the palette lookup table directly for non-snowy fading effects, - etc. Each palette lookup table has 32 shades. Each shade has - 256 bytes. Shade 0 is closest (actual palette brightness) and - shade 31 is farthest (dark usually). (256*32 = 8192 or 8K) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/3/94 - Now show white lines in 'V' mode of EDITART at ART file tile - boundaries. - - - Added Insert and Delete commands to EDITART! These Insert and - Delete keys WILL shift all tiles after the one being inserted - or deleted just like a regular text editor. To insert or - delete tiles, simply go the 'V' screen in EDITART and bang - away! Don't worry these keys are fully multi-tile file - compatible (unlike swapping right now). - You will notice that the white line boundaries that - I just added will actually move if you press Insert or Delete. - This changes the number of tiles per art file. But that's - ok. If the art files ever get too unbalanced, you can run - the RSIZEART.EXE utility to fix it. - Ken's lesson of the day: For the final release of your - games, you only need 1 art file. The reason I spent my time - programming multiple art files was because of EDITART. - Since EDITART need to READ & WRITE to the art files, it must - hold a whole art file in memory at a time. Since Build and - Game only READ the art files, a caching system can be made - and only 1 art file is necessary even for lo-memory systems. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/4/94 - ATTENTION MAP DESIGNERS! Added a long-awaited feature to BUILD - which I call "loop joining". Have you ever gotten this - frustrating message in 2D EDIT MODE before? - - "You can't split sector by connecting different loops." - - Well, you're not going to see it any more because I fixed - it! Yup. You can now split a sector along a line connecting - different loops of the sector. - - Try this - Convert the sector on the left to the sector - on the right: - - Split #1 Split #2 - ÚÄÄÄÄÄÄÄ¿ ÚÄÄÄÂÄÄÄ¿ ÚÄÄÄÂÄÄÄ¿ - ³ ÚÄÄÄ¿ ³ ³ ÚÄÁÄ¿ ³ ³ ÚÄÁÄ¿ ³ - ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ - ³ ÀÄÄÄÙ ³ ³ ÀÄÄÄÙ ³ ³ ÀÄÂÄÙ ³ - ÀÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÙ ÀÄÄÄÁÄÄÄÙ - (Given) (Half done) (Result) - (1 sector) (Still 1 sector) (2 sectors) - - Before the only was to do this was to delete all the - sectors and then redraw them again. - - I'm sure loop joining has its share of tricks, as most - BUILD functions do, so you may want to spend some time just - playing around with this new function. - - - Removed my own profiler stuff - Hline calculations, etc. code. - Watcom's sampler and profiler is much better anyway. - - - Fixed neartag divide by zero bug with walls (I hope). - Anyone calling neartag for every player per movethings? - I would try not to - How much is that unnoticable extra 0.02 - frames per second worth to you anyway? -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/9/94 - Added new array to BUILD.H called gotsector. It works a lot - like the gotpic array, but this array determines which sectors - were considered during the drawrooms function. Note that - gotsector, unlike gotpic IS cleared to 0 during every call - to drawrooms. - - - Fixed Editart 'U' mode mouse control bug. I typed too fast this - time. - - - Fixed Build split sector bug of accidently deleting sprites. It - should not delete any sprites when splitting sectors now. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/15/94 - ATTENTION PROGRAMMERS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - I moved ALL my timer code and arrow key code into GAME.C. - Here are the exact instructions that you need to follow to - upgrade your code to the new obj's: - - 1. From the end of my GAME.C, take the code from these 4 - functions: - - ---> inittimer(); - ---> uninittimer(); - ---> void __interrupt __far timerhandler(); - ---> keytimerstuff(); - - 2. After each initengine, call inittimer right AFTER: - - initengine(); - ---> inittimer(); - - After each uninitengine, call uninittimer right BEFORE: - - ---> uninittimer(); - uninitengine(); - - 3. You may need to include this (if not already included): - - ---> #include - - 4. Add these 2 lines to declare the timerhandler: - - ---> void (__interrupt __far *oldtimerhandler)(); - ---> void __interrupt __far timerhandler(void); - - 5. Since BUILD.H NO LONGER has vel, svel, and angvel, you - must add the following line to your game: - (These variables are modified inside keytimerstuff()) - - ---> static long vel, svel, angvel; - - 6. Let me list some variables that I recently removed from my - GAME. This may or may not affect you: - - oposx[], oposy[], oang[], etc.. - GONE! - lastpacket2clock - GONE! - lastsynctics - GONE! - drawscreen's smoothratio parameter & related code - GONE! - kenchaintimer - GONE! (Don't think anybody was using it - because it didn't solve sound compatibility problems) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/16/94 - Made swinging door clipping work MUCH better! It is much more - difficult to "sneak" through the door now. With the swinging - door clipping working much better, I made it possible to open - doors even if you are in the same sector as the door itself. - Now you won't have to stand back a certain distance to open - the doors. (It is much less annoying this way) Since neartag - does not normally scan cursectnum's sector tags, you will - need to check cursectnum's tags yourself (if you so desire) - - Example: (extracted from my GAME.C) - - neartag(posx[snum],posy[snum],posz[snum],cursectnum[snum], - ang[snum],&neartagsector,&neartagwall,&neartagsprite, - &neartaghitdist,1024L); - if (neartagsector == -1) //If no neartagsector found... - { - i = cursectnum[snum]; //Test current sector for tagging - if ((sector[i].lotag|sector[i].hitag) != 0) - neartagsector = i; //Cursectnum is the neartagsector! - } - - - Improved my gamma correction algorithm. Since it now uses a new - 1K at the end of my TABLES.DAT, be sure to update all your - TABLES.DAT files! My new gamma correction supports 16 levels - of brightness (0-15). You need not change any code in your - game if you already have gamma correction programmed. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/17/94 - Made swinging door clipping code work even better. The bug was: - it only tested the clipping if you were in the same sector as - the door. So I put this handy little function in GAME.C which - simply tests if 2 sectors are neighbors or not: - testneighborsectors(short sect1, short sect2) - Check it out! - - - Rewrote my clipinsidebox function. You probably don't use this - function, but if you copied my swinging door code, then you - will need to update this. Clipinsidebox is used for clipping - to determine whether a player or sprite is too close to a - wall. - - clipinsidebox(long x, long y, short wallnum, long walldist) - X and y are the position of the sprite or player. Wallnum - is the wall to test, and walldist is the fatness of the sprite - or player (same as clipmove). It returns a 1 if the sprite or - player's clipping square intersects the wall or 0 if not. - - Example - You can test all 4 walls of a swinging door and make - sure the door doesn't run you over: - - short swingwall[4]; //4 wall indeces of a swinging door - for (i=0;i<4;i++) - if (clipinsidebox(posx,posy,swingwall[i],128L) == 1) - { - //Swinging door swung into player, so move door back to - //its old position / inverse swinging direction. - - break; - } -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/22/94 - Made build posx, posy, posz, ang, cursectnum, and horiz variables - nonstatic. - - - Made hi-res screen capture work. - - - Fixed some of those evil view-clipping bugs with rotated sprites - on red sector lines. I think it should work with rotated - sprites on horizontal or vertical red lines. I'm not sure - about weird angled lines. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/23/94 - ATTENTION PROGRAMMERS: Made parallaxing skies tileable in any - equal size chunk where the chunk x size is a power of 2 - from 16-1024. You can now make a 2048 wide parallaxing sky - with 2 chunks of 1024 (gobble gobble). - - These lines were added to BUILD.H: - - #define MAXPSKYTILES 256 - EXTERN short pskyoff[MAXPSKYTILES], pskybits; - - pskyoff[MAXPSKYTILES] is an array of OFFSETS of each tile - from the picnum of the parallaxing sky. - - pskybits is NOT the actual number of tiles, but the - log (base 2) of the number of tiles. Look at this table: - - For 1 tile, pskybits = 0 - For 2 tiles, pskybits = 1 - For 4 tiles, pskybits = 2 - For 8 tiles, pskybits = 3 - For 16 tiles, pskybits = 4 - etc. - - - I know that most teams have a 1024 wide parallaxing sky that - wraps all the way around. Don't worry - this is the - default now. When initengine is called, the variables - default to this: - - pskyoff[0] = 0; - pskybits = 0; - - You may have used a 512 wide parallaxing sky (like in my game) - that repeated every 180 degrees. To make this work with - the new version, set these variables like this right after - initengine is called: - - pskyoff[0] = 0; - pskyoff[1] = 0; - pskybits = 1; - - Note that both pskyoff variables are 0 here. This will - make the parallaxing sky repeat. - - With the new tiling, you can save memory by making small - chuck sizes, such as 64 or 128, and repeating certain - sections. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/25/94 - Fixed some really stupid keyboard problem in Build. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/29/94 - Added FLOOR SPRITES!!! Here are some things that floor sprites - can do for you: - - * Make bridges and balconies - * Use them for ceiling and floor ornamentation - * Use them in place of a rotating sector - modifying 1 angle - is much faster than rotating tons of points. - * Weapon such as a spinning saw blade or, of course, a smiley - red jelly coconut. (?) - * How about a "walking" hole like in Ken's Labyrinth - * You could throw a footstep on the floor every time you make a - step. The steps would go away after awhile. Maybe if you - step in mud, the next 16 or so footsteps will be plotted. - * You could even fake radial shading with a transluscent floor - sprite. (Transluscent floor sprites not yet programmed) - - Just imagine all the great stuff you can do with floor - sprites combined with wall sprites! I can't wait to see what - you all come up with! - - ÚÄÄ To clear some confusion, and to shorten conversations, let - ³ me give official names to my 3 kinds of sprites: - ³ - ³ Normal stupid sprites - "FACE SPRITES" - ³ Rotated / masked wall sprites - "WALL SPRITES" - ³ New ceiling & floor sprites - "FLOOR SPRITES" - ³ - ³ Also let me clear up the 2 kinds of clipping: - ³ - ³ Clipping when moving something - "MOVEMENT CLIPPING" - ÀÄÄ Clipping when drawing something - "VIEW CLIPPING" - - To make a floor sprite in BUILD, simply press 'R' on any - sprite until it becomes a floor sprite. The xrepeat and - yrepeat values should work perfectly with floor sprites. - Floor sprites can be rotated at any of 2048 degrees, using - the sprite[].ang. Press < / > for course angle adjustment - or < / > with shift for fine angle adjustment. Also, you - can press 'F' on a floor sprite to flip it over like a - mirror. I am using another bit in sprite[].cstat to determine - the type of sprite. See the documentation in BUILD.H. - - Now for the bad news: - - * Floor sprite textures have similar restrictions as normal - ceilings and floors - both dimensions must be a power of 2. - This will most likely not change. - - And some known problems which I will have to fix: - * Transluscence doesn't work yet - * Sorting with other sprites - * View clipping with walls - * Doesn't work too well in hi-res mode - - See NUKELAND.MAP for some examples of floor sprites. I have both - a bridge and a balcony on the level. Please find them! - Remember that floor sprites don't work in mode x or hi-res - mode YET! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/30/94 - Made WALL SPRITE and FLOOR SPRITE correctly do movement clipping. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/1/94 - Made new map called BRIDGES.MAP. It is excellent! It has 3 - bridges all crossing each other. Enjoy! - - - For Editart, I added re-centering after delete and / to reset - centering while in centering mode. - - - Debugged more of the floor sprite stuff. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/2/94 - Made transluscence with floor sprites work. Check out my fake - radial shading under the lights of SUBWAY.MAP. - - - Optimized floor sprites in assembler. Transluscent floor sprites - are a bit slower than normal floor sprites. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/6/94 - Made a special 1-way mode for WALL and FLOOR sprites - (not FACE sprites). In BUILD 3D mode, you can press '1' on - a wall or floor sprite to make it only draw if you are on - 1 side of it. This method of back-face culling will not only - make non-masking objects with thickness draw twice as fast, - but will also make fewer drawing bugs due to sprite drawing - order. Try out my BRIDGES.MAP. There's a new section at the - top and it's not another "ugly Ken's face n' slime" room. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/8/94 - Editart and Build now capture with capt#### rather than captur## - allowing 10000 captured pictures. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/23/94 - Increased Maximum number of walls to 8192. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/28/94 - Made BUILD stub keys F5-F8 work in 3D mode also. See top - of BSTUB.C for full documentation of some new useful - variables that can be used inside the stub: - - extern long qsetmode; - extern short searchsector, searchwall, searchstat; - - In 3D mode, F5 and F6 do the exact same thing and F7 and F8 - do the exact same thing (you don't need the extra key to - distinguish between sectors, walls and sprites, since the - mouse cursor can only be on 1 of the 3 objects in 3D mode. - - Note: Since F5-F8 are called in 3D mode, you must be sure - NOT to use any 2D routines during those calls! This means - you will have to put the 3D/2D case check in all six - subroutines: - ExtShowSectorData, ExtShowWallData, ExtShowSpriteData, - ExtEditSectorData, ExtEditWallData, ExtEditSpriteData - - - KEN'S PROPOSAL (NOT YET DONE) I am thinking of making a new - (and maybe final) map format. But before I do it, I am going - to ask all of you for any suggestions on new fields to add to - my 3 big structures (sector, wall, sprite): - - Here are a few things already on my list to add: - - * char sprite[].clipdist - THIS IS FOR SURE - This will be a sprite's clipping distance. My default - walldist is 128. With this field, you will finally be - able to make a unique fatness for each sprite with no - clipping bugs. I will probably shift this field up 2-4 - bits to give it a range of more than just 0-255. - - * char wall[].pal, sprite[].pal - PRETTY SURE - It should have been this way the whole time. Currently - the wall's palookup number is sector[].floorpal. While - it may save some memory, It has too many limitations. - I can make my map converter automatically convert all - walls of a sector to equal the sector[].floorpal so - don't worry about that type of conversion. If I do - this, I can get rid of the spritepal[] hack. - - * I have decided that the sector[].extra, wall[].extra, and - sprite[].extra will remain in the structures as little - gifts for your use only. That's right! ALL YOURS! - ENJOY!!! - - * char sprite[].xoffset, sprite[].yoffset - NOT SURE YET - Some have asked for monster animations using the same - frame at 2 different times of an animation sequence having - different centers. - These will be signed chars. I'm not sure whether to - make these offsets as offsets to the centering information - from Editart or just make them the absolute offsets where - Editart's data is the default offset. I wonder if there's - a better way to do this without having to waste 8K. - - * Do I have your permission to remove nextsector2 and - nextwall2? Anybody using them? If so, can you use the - extra variable instead? This will save 16K since both - are shorts. (MAXWALLS*short + MAXWALLS*short = 16384) - They were originally intended for 2 stories - but it would be totally ridiculous for me even to think - about programming that now. Besides, you can use wall - and floor sprites to fake 2 story areas. KEN PROMISE: - I will fix those darn view-clipping bugs eventually! - - - Please send any comments/suggestions to my internet address - (kjs@lems.brown.edu) I will consider each suggestion - carefully, because everything you suggest now won't have - to be an ugly hack like spritepal[] later. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/1/95 - ÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÜ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛ - ÛÛ ÛÛ ÛÛ ÛÛÛÜ ÛÛ ÛÛ ÛÛ ÛÛÛÜÜÛÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ - ÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛÛ ÛÛÜ ÜÛÛ ÛÛßÛÛßÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛ - ÛÛ ÛÛ ÛÛ ÛÛ ßÛÛÛ ÛÛÛÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ - ÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛ ßÛÛ ßÛß ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛ ÛÛ - - CONVMAP6! Here is what I changed in the structures: - - * Added wall[].pal, sprite[].pal - * Added sprite[].clipdist - * Expanded sprite[].cstat to a short - * Added sprite[].xoffset, sprite[].yoffset - * Removed wall[].nextsector2, wall[].nextwall2 - * Renamed wall[].nextsector1 to just wall[].nextsector - * Renamed wall[].nextwall1 to just wall[].nextwall - * Scrapped numextras and extratype structure - Don't confuse - this with sector[].extra, wall[].extra, sprite[].extra - which ARE in map version 6. - - Probably the only change above that will affect programmers is - getting rid of the '1' in wall[].nextsector1&wall[].nextwall1. - All the following changes were possible because of the new - map format. - - - Got rid of the spritepal array in BUILD.H. With my grea - new map version 6, you can simply modify sprite[].pal! - - - Made all .pal fields editable in 3D EDIT MODE. Press ALT-P - and simply edit the number as you would in 2D mode. - - - Made sprite[].xoffset and sprite[].yoffset work as - offsets to the offsets that are already in EDITART. - Simple addition. They should work for all 3 types - of sprites. - - - Made BUILD Tab&Enter also copy tags&extra if copying similar - structures. Also fixed some other attributes when - copying between structure types. - - - Made sprites highlighted with Rt. Shift duplicate and stamp - when the insert key is pressed in 2D EDIT MODE. - - - Made sprite[].clipdist work as the FACE SPRITE'S clipping - fatness. NOTE: Sprite[].clipdist is shifted up 2 to - allow a range from 0-1020, so if the sprite[].clipdist - is set to 32, then the clipping radius is actually 128. - - - Removed the walldist parameter from movesprite. Movesprite - now just uses the sprite[spritenum].clipdist field of - whatever sprite is passed (shifted up 2). - - movesprite(short spritenum, long xchange, long ychange, - long zchange, long ceildist, long flordist, - char cliptype, long numtics) - - If you use clipmove or getzrange, you should check that you - are passing the correct walldist parameters. I'm saying - you may want to change some of the 128s to - (sprite[spritenum].clipdist<<2). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/3/95 - Made startumost[], startdmost[] into shorts. - - - Optimized and fixed gamma correction in Stereo Red-Blue mode. - - - Made weapons or anything using overwritesprite in Stereo Red-Blue - mode be at screen depth. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/4/95 - Not that anybody would care (except for some crazed mega-hackers) - but I am just mentioning the fact that I did this: - - animateoffs(short tilenum, short fakevar); - where fakevar is sectnum+0 - or wallnum+16384 - or spritenum+32768 - or 49152 (just ignore-it's for rotatesprite) - - Also: I changed one: "mov al, 0" instruction into an - "xor al, al", a net savings of - ONE LOUSY BYTE! Let's not get TOO - excited! (By the way, just kidding) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/5/95 - Fixed the sprite centering with x-flipped FACE SPRITES. - - - Found a bug with my swinging door clipping code. There are 2 - types of swinging doors, forwards (opens CCW) and - backwards (opens CW). The bug was that you could sneak - through a backwards door from the back side. Well, I fixed - it, so now I challenge you to sneak through my swinging doors - now! If you are using my swinging door code, please make - these changes which you should find in my new GAME.C: - - 1. Changed declaration at beginning of GAME.C: - static short swingwall[32][5]; - - 2. Added new line in prepareboard: - swingwall[swingcnt][4] = lastwall(swingwall[swingcnt][3]); - - 3. Modified some stuff in tagcode: - //swingangopendir is -1 if forwards, 1 is backwards - l = (swingangopendir[i] > 0); - for(k=l+3;k>=l;k--) - if... - - - Here are some more functions that have been in the engine for - a while, but I forgot to document... - precache, loadtile, lastwall, rotatepoint - They are now documented at the top of this file. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/6/95 - Optimized loading/saving of maps by using fewer read/write calls. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/14/95 - Fixed evil crashing bug that I accidently introduced in the - 1/3/95 version of Build. This crashing bug happened mostly - in tall rooms with lots of FACE SPRITES. It used to crash - very infrequently when you were standing almost exactly, but - NOT on the same x & y coordinates of a FACE SPRITE where the - z-distance was high. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/15/95 - Fixed up network code so now you can miss 4 packets in row safely - over the network rather than just 2. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/16/95 - Added strafe left / strafe right keys to my SETUP.DAT file and - char keys[19] array. If you actually use my keys array for - custom keys, here's what to do: I inserted the new strafing - keys at keys[12] & keys[13], so just add 2 to any keys with - an index >= 12. - - - Made the sprites in 2D EDIT MODE of Build highlight properly - again. - - - Added another parameter to permanentwritesprite, palookup number: - - permanentwritesprite(long thex, long they, short tilenum, - signed char shade, long cx1, long cy1, - long cx2, long cy2, char dapalnum); -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/17/95 - You can now select a bunch of sprites in 2D EDIT MODE with - Rt. shift, then go to 3D mode and change the z's of all the - highlighted sprites. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/20/95 - Made Tab&Enter in 3D EDIT MODE copy .pal also whenever .shade is - normally copied. Shift+Enter will now copy just - .pal and .shade. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/21/95 - Made Splitsector work with overlapping better. - - - In Editart 'U' mode, it now goes automatically to the PCX and - coordinates of a tile if it is already in capfil.txt. - - - In Editart, made capt????.PCX not get overwritten if they already - exist. - - - Fixed Build tab on masked walls. - - - Made zmode and kensplayerheight variables public in BUILD/BSTUB - so you can now compile BUILD to start out with your own - preferred settings. Kensplayerheight defaults to 32 and - zmode defaults to 0. You can over-ride these settings in - the new ExtInit function. - - - Made Editart tiles much easier to center by showing all tiles - in the center of the screen instead of at the top-left corner. - (Editart will not allow you to center tiles larger than - 320*200 right now) - - - Made 'O' (optimize) key in Editart automatically preserve - the centering information. - - - ATTENTION BSTUB PROGRAMMERS! Added ExtInit, ExtUnInit, and - ExtCheckKeys to BSTUB.C. Please just copy mine into your - current BSTUB. ExtInit and ExtUnInit are called only once. - ExtInit is called before loadpics() and after initengine(). - ExtCheckKeys() is called just before nextpage in both 2D - and 3D modes. In 3D mode, you must call editinput inside - ExtCheckKeys just like my example in BSTUB. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/24/95 - Fixed vertical line chained mode bug with permanentwritesprites. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/31/95 - Fixed parallaxing sky tiling bug. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/1/95 - Fixed network crashing bug when call interrupt 0x1c. You call - this interrupt when you chain to the old timer handler. Now - - - Rewrote multiplayer code in game.c a bit. Moved both sync() - and getpackets() into the main program. The master code and - single player game code are now the same. Slaves need to - drawscreen and send packets only when a packet is received - from the master. Got rid of fake sync[MAXPLAYERS] slot by - using a local sync buffers. Rewrote checkmasterslaveswitch(). - If you don't get what I did, it doesn't matter because you - already have working network code! - - - Added new key in EDITART 'V' mode. Press ALT-R to generate - a tile frequency report. It will scan all MAP files in the - same directory as the ART files. The frequency count will - show up as text in the top-left corner of the boxes in - 'V' mode. Press ALT-R again to turn off text. - - - Perfected NCOPY! Copies about 150K / second which is 10 times - faster than a 115200bps serial cable. Since NCOPY already - links with multi.obj, it should not be too difficult to make - joining work in the middle of a network game. Please wait - until I make some sample code for you! - Receiver types: NCOPY (Ex: "NCOPY") - Sender types: NCOPY [filespec] (Ex: "NCOPY *.ART") - - Ken's formula: - NCOPY + Loading&Saving GAMES = joining in middle - of network game! - - - Made a DOOM to BUILD converter. Right now it only converts - ceilings, floors, and walls now, and some of the wall - textures are screwed up. Just because I converted some - lousy stinkin' maps DOES NOT MEAN I AM GOING TO PROGRAM DOOM! - Unfortunately, the converter is programmed in QuickBasic right - now, it won't compile, and I didn't feel like putting up the - 7 MEG converted ART file up. When I convert it to C, I'll - upload it for all! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/7/95 - Fixed overwritesprite bugs with translucence in chained mode - and above top of screen. - - - Made bit 3 of overwritesprite x-flip the picture if set. - - - Optimized various parts of engine. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/8/95 - Fixed shading of all sprite types so they match perfectly with - their surroundings. Floor sprites now shade in the exact same - way as ceilings and floors. (Before, the whole floor sprite - had the same shade throughout) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/9/95 - Started on loading and saving game code so I could give some - sample code for joining network games, but none of it works - yet, so just ignore it for now! - - - Added frame rate in BSTUB.C. It averages the last 16 frames. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/16/95 - Added another bit to sprite[].cstat for y-centering control. If - bit 7 is set then the sprite's center will be the actual - center rather then at the default position which is at the - bottom of the sprite. If you use this centering bit, - you finally get "WYSIWYG" centering contol in EDITART. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/24/95 - Made floor sprites now support any x size by a power of 2 y size. - (That's better than before!) These are the same restrictions - on walls. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/25/95 - Got loading / saving code to work with my game. Press Ctrl-L to - load game and Ctrl-S to save game. Saved games are called - SAVE0000.GAME and are about 300K. Don't worry about the large - sizes of the saved game files since they can be easily - compressed to less than 50K. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/26/95 - I Finally made my multiplayer code run with fast frame rates AND - pefect controls on ALL computers of a multiplayer game. I am - now sending keystrokes of all computers at a constant rate of - 40 times per second. All computers interpolate between frames - to get screen frame rates of higher or lower than 40 fps - (even in single player mode). - - Here are the exact steps you will need to follow if you want to - update your code: - - 1. WHAT'S THE FAKETIMERHANDLER()? - - To send packets exactly 40 times a second, it would - sure be nice to send them right from the timer interrupt - handler. Too bad network packets just won't get sent - from the interrupt handler. (It may work from the - interrupt handler in Serial/Modem mode) So the solution - is to make a "fake" timer handler that must be called - at least 40 times a second even on the slowest computer. - Throughout my engine, I call faketimerhandler(). If you - have any slow parts in your game code, you may want to - called faketimerhandler() also. - Besides the very first few lines, the rest of the code - was taken directly from my old sync and getpackets - functions. - - 2. BYE BYE SYNCTICS! - - Now that all computers are calling movethings a - constant number of times a second, you don't need any - synctics variables anymore. You can convert all the - synctics variables to a define such as: - "#define TICSPERFRAME 3" - Doing this will guarantee that a game runs the same on - all speed computers. - - 3. FRAME INTERPOLATION (optional): - - static long ototalclock = 0, gotlastpacketclock = 0; - static long oposx[MAXPLAYERS], cposx[MAXPLAYERS]; - static long oposy[MAXPLAYERS], cposy[MAXPLAYERS]; - static long oposz[MAXPLAYERS], cposz[MAXPLAYERS]; - static long ohoriz[MAXPLAYERS], choriz[MAXPLAYERS]; - static long ozoom[MAXPLAYERS], czoom[MAXPLAYERS]; - static short oang[MAXPLAYERS], cang[MAXPLAYERS]; - - Add to prepareboard: - for(i=connecthead;i>=0;i=connectpoint2[i]) - { - oposx[i] = posx[i]; - oposy[i] = (etc.) - } - ototalclock = 0; - gotlastpacketclock = 0; - - Even though you may be getting more than 40fps, you will - only be seeing 40fps unless you interpolate between frames. - The oposx[], etc. variables back up the last posx[], etc. - variables so you can interpolate your actually drawing - position as some fraction between the two. This fraction - is smoothratio. - See beginning of drawscreen code. Here's where I actually - calculate the interpolated position to draw the screen. - - for(i=connecthead;i>=0;i=connectpoint2[i]) - { - cposx[i] = oposx[i]+mulscale(posx[i]-oposx[i],smoothratio,16); - cposy[i] = oposy[i]+mulscale(posy[i]-oposy[i],smoothratio,16); - cposz[i] = oposz[i]+mulscale(posz[i]-oposz[i],smoothratio,16); - choriz[i] = ohoriz[i]+mulscale(horiz[i]-ohoriz[i],smoothratio,16); - czoom[i] = ozoom[i]+mulscale(zoom[i]-ozoom[i],smoothratio,16); - cang[i] = oang[i]+mulscale(((ang[i]+1024-oang[i])&2047)-1024,smoothratio,16); - } - - Draw the screen using cposx[], etc. instead of posx[], etc. - - #pragma aux mulscale =\ - "imul ebx",\ - "shrd eax, edx, cl",\ - parm [eax][ebx][ecx]\ - modify [edx]\ - - It reads: eax = (eax*ebx)>>cl. Unlike C, this will - not overflow even if eax*ebx > 2^31, making full use of - the 64-bit result of the imul instruction. - - 4. MOVETHINGS FIFO: - - static long movefifoplc, movefifoend; - static signed char baksyncvel[64][MAXPLAYERS]; - static signed char baksyncsvel[64][MAXPLAYERS]; - static signed char baksyncangvel[64][MAXPLAYERS]; - static short baksyncbits[64][MAXPLAYERS]; - - Add to prepareboard: movefifoplc = 0; movefifoend = 0; - - It is bad to call movethings inside faketimerhandler - because you don't want things to move while you're drawing - the screen. To solve this, I made movethings just save - away the parameters it was called with using a circular - buffer, and when I'm actually ready to DO the movement code, - I call domovethings. - Rename movethings to domovethings and see my new - movethings. This code is all for the fifo. - - Put this line in movethings: - gotlastpacketclock = totalclock; - - At the top of domovethings, copy my code for loading off - of the fifo. Also set oposx[] = posx[], etc. here. - - 5. You may want to add a global variable that controls whether - you are in continuous packet sending mode or not. Only - in the main loop should ready2send be != 0. - static long ready2send = 0; - - 6. The new main loop can be as short as this, with no case - checking for masters and slaves. - - ready2send = 1; - while (keystatus[1] == 0) //Main loop starts here - { - //Actaully move everything here. - while (movefifoplc != movefifoend) domovethings(); - - //Second parameter is for frame interpolation, - //A fraction that ranges from 0-65536. - drawscreen(screenpeek,(totalclock-gotlastpacketclock)*(65536/TICSPERFRAME)); - } - ready2send = 0; -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/6/95 - New key in BUILD. Now when you use relative alignment mode on - ceiling and floor textures, you can press Alt-F on the ceiling - or floor to choose a new wall to align to. It actually - rotates the walls of a sector by 1. - - - Fixed screen capture PCX saving bug in both EDITART and BUILD. - - - Added a parameter to screencapture, a filename. - screencapture(char *filename) - Ex: screencapture("captxxxx.pcx"); - Please specify the full filename. Screencapture will modify - the 4 x's of the string to be a number starting at 0000. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/8/95 - Made my rotatesprite function use Editart centering information. - The center is the pivot point of rotation. - - - Added y-flipping to overwritesprite. See above documentation. - - - Added 2 new parameters to rotatesprite, shade and pal - - rotatesprite (long sx, long sy, long z, short a, - short picnum, signed char shade, char pal); - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/10/95 - Fixed sprite showing through closed sectors bug. - - - Made it possible to draw the overhead map in 3D mode by adding - a line drawing function in 3D mode called drawline256. It - draws a line clipped to the viewing rectangle last set in - setview(). Here are the parameters: - - drawline256(long x1, long y1, long x2, long y2, char col); - - Note: The coordinates are all shifted up 12. - Example: drawline256(0L,0L,319L<<12,199L<<12,31); -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/11/95 - Made drawline256 draw in a cleaner way, making use of the full - 12 bits of precision. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/14/95 - Optimized / cleaned up parts of hitscan, neartag, cansee. - Gee, I hope they all still work! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/18/95 - I'm back in RI! - - - Fixed recently added movesprite z parameter bug that may have - done strange things with monsters, such as stuck in sectors - I thought the following expression: !(cstat&128) - would be true if bit 7 was a 0, but I WAS WRONG! - Get this straight: - ! - logical NOT, returns 0 if != 0 else 1 (!2457=0, !0=1) - ~ - bitwise NOT, xor's it with 0xffffffff (~0x5f=0xa0) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/21/95 - Gave access to some more variables in BSTUB. - - - Made clipmove return a valid sector even if you're not between - its ceiling and floor. If you use overlapping sectors, - clipmove will find the sector closest to your z. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/28/95 - Optimized transluscence for masked walls and wall sprites. - - - Today is the day I declare my serial/modem error correction code - perfect! Sure, I may have bragged over and over again about - how perfect my correction method is each time, but this time - I mean it. This is ship-it quality error correction. The old - method had a few dark, evil, and ugly bugs that sometimes - totally screwed up bigtime. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/5/95 - Got Master/Slave switching to stay in sync again with new - multiplayer code. Right after the master sends a packet - where a switch is made, I disable the master from sending - any more packets by setting ready2send to 0. Ready2send - will be set back to 1 only after the actual switch in - checkmasterslaveswitch. Here's what I added to movethings: - - //Do this for Master/Slave switching - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) - if (syncbits[i]&512) ready2send = 0; -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/10/95 - Optimized continuous setview calls between 2 different window - sizes. - - - ATTENTION PROGRAMMERS: Moved movesprite code into game.c. It - no longer exists in the engine. It is a "cover-up" function - and it should be yours. - - - Added a circular keyboard buffer to my keyboard handler. It is - fully compatible with the keystatus arrays. Use this buffer - for typing in messages or cheat codes. If you do not use this - buffer (or you wrote your own interrupt handler), you will miss - keys and it is very annoying. - - I added these variables to build.h: - - #define KEYFIFOSIZ 64 - EXTERN volatile char keyfifo[KEYFIFOSIZ], - keyfifoplc, keyfifoend; - - Every time a key is pressed and released, I add 2 bytes to the - circular buffer. The first byte is the scan code. The second - byte is a 1 for key pressed or 0 for key released. You can - ignore the key releases if you wish. You must read 2 bytes at - a time from this buffer. - (scancode,keystat),(scancode,keystat),... - - Here's how you read the keyboard fifo: - while (keyfifoplc != keyfifoend) //More characters to read - { - ch = keyfifo[keyfifoplc]; - keystate = keyfifo[(keyfifoplc+1)&(KEYFIFOSIZ-1)]; - //Increment buffer pointer - keyfifoplc = ((keyfifoplc+2)&(KEYFIFOSIZ-1)); - - printf("Scancode: %d, status: %d\n",ch,keystate); - } - - The interrupt handler does the same as above but writes and - increments using keyfifoend as the index. - You can easily clear the buffer this way: - keyfifoplc = keyfifoend - - - Made clipmove/getzrange not clip on the back side of a 1-sided - wall/floor sprite. It makes the clipping a little faster - and seems to fix a few minor clipping bugs. Don't get too - excited. - - - Fixed getzrange's ceilz/florz mismatch with floor sprites against - normal ceilings and floors. - - - Made Build default to y-centered centering mode when sprites - are inserted (bit 7 of sprite[].cstat) - - - Fixed clipmove bugs with y-centered centering mode. - - - Made it so you don't get stuck sliding along multiple properly - aligned wall/floor sprites. - - - Please update to my new tables.dat. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/11/95 - Optimized parts of clipmove / getzrange. Is it faster? Did I - make more bugs? - - - Made the movesprite code in GAME.C now use getzrange. This - allows sprites to walk on floor sprites and bombs roll across - bridges. I will include the original movesprite code that - came from the engine in case you want to start with things - the way they used to be. - - - Made ornamentation in BUILD 3D mode much easier. Now you can - press 'S' to insert a sprite on walls (not just ceilings - and floors). When you insert a sprite on a wall, it will - automatically be set to a wall sprite at the wall's angle. - Also it will be 1-sided with blocking off (The optimal - options for a decorative sprite on a wall). - - - Added ALT-D to BUILD 3D mode. It lets you type in clipdist - for sprites. It works in the same way as ALT-P for palookup - changing. - -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/15/95 - Fixed return value bug in setanimation and cleaned up these 3 - functions: doanimations, getanimationgoal, setanimation. - Since they are now in game.c, you will need to copy them to - update. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/16/95 - Fixed hitscan not passing through loops bug. - - - Fixed hitscan so it hits wall and floor sprites in the right - places. - - - ATTENTION PROGRAMMERS!!! Made bit 8 of sprite[].cstat the - hitscan clipping bit. It works like the hitscan bit for walls. - Note that both the wall and sprite cstat variables now have - 2 separate bits for clipping, where: - 1 is for use with the clipmove/getzrange function and - 1 is for use with the hitscan function only. - Before, hitscan used to use 1 bit for all sprite clipping. - In your maps, the sprite hitscan bits are all zeros. That's bad! - To make things work like they used to, the sprite hitscan bit - must be set equal to the old sprite blocking bit. So I was nice - enough to make a program, FIXSPRBT.EXE, which will do just that. - - PLEASE RUN FIXSPRBT.EXE ON ALL YOUR MAPS. You don't HAVE to - run it on all your maps since the map format hasn't changed, but - it will save you annoying attribute setting time if you do. - - - Did a few things to make these blocking bits easier to edit: - Since H and ALT-H were already used, I made CTRL-H toggle the - hitscan bit for both walls and sprites in 2D mode. B toggles - the blocking bit. B also now sets the hitscan bit to its - default value when you press it. For sprites, the hitscan bit - default is equal to the clipmove bit. For walls, the hitscan - bit default is always 0. - - - Added new map mode! Check it out in my game. I now have 3 map - modes. Not that this really matters to you game programmers, but - this is how my game works: - dimensionmode[snum] == 1 3D MODE + junky line map - dimensionmode[snum] == 2 SUPER MAP! - dimensionmode[snum] == 3 3D MODE - - I added show2dsector to BUILD.H which controls which works - like the other show2d... bit arrays. It tells which sectors - to show. - EXTERN char show2dsector[MAXSECTORS>>3]; - - I rewrote parts of drawoverheadmap to accommodate this new - mode - so it would be nice if you updated to my new code. - - Added a new function that clears full screen to a specified - color: - clearview(0L); - - Oh and did I forget to mention the big function! Parameters - are the exact same my drawoverheadmap function: - drawmapview(cposx,cposy,czoom,cang); - - Note: The new map mode right now is slowed down bigtime by - the face sprites using the rotatesprite function. The - rotatesprite right now is using a worse than awful - algorithm. When I optimize rotatesprite, the frame rate - of the new map mode will fly! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/18/95 - Added default sprite cstat variable when you insert new sprites. - Set it to 0 if you hate the new centering mode in ExtInit - or 128 if you like the new centering mode. - Add this line to your Bstub if you wish: - extern short defaultspritecstat; - - - If a wall & sprite are same distance away using hitscan, hitscan - now chooses the sprite. - - - Optimized rotatesprite. - - - ATTENTION PROGRAMMERS: Added new paramater at end of - rotatesprite: A char where the first bit tells it to use - transluscence mode or not. - - rotatesprite(long sx, long sy, long z, short a, short picnum, - signed char dashade, char dapalnum, char dastat) - - if ((dastat&1) == 0) - no transluscence - if ((dastat&1) != 0) - transluscence - - - Cleaned up drawmapview further by making ALL floor sprite draw - with the texture in the right place and made the polygon - filling algorithm use higher screen coordinate precision. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/19/95 - Added parameter to makepalookup: - - makepalookup(long palnum, char *remapbuf, - signed char r, signed char g, signed char b, - char dastat) - - if ((dastat&1) == 0) then makepalookup will allocate & deallocate - the memory block for use but will not waste the time creating - a palookup table (assuming you will create one yourself) - if ((dastat&1) != 0) then makepalookup will allocate & deallocate - the memory block AND create a palookup table using the rgb - values you pass. - - - Made my ceiling&floor update the self-modified palookup pointers - when palookup[sector[].?pal] changes, not just when - sector[].?pal] changes. Watching for changing pointers rather - than changing indeces should solve the problem with screwy - palookup selection for ceilings&floors. Ignore what I said - before. You should now be able to change palookup pointers - freely. - - - Optimized relative alignment. It should be the same speed as - all other ceilings & floors now. - - - Warning: Since I added the new bit in sprite[].cstat, there are - now 9 bits in use. Make sure to treat it as a short. In my - code, I had some bugs where I did this: - sprite[].cstat &= (255-4); BAD! Cstat's a short! Please - check your code and make sure you clear the bits this way: - sprite[].cstat &= ~4; -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/21/95 - Fixed bug with flipping textures on ceilings & floors. In - BUIL0419.ZIP I had a bug whenever a ceiling or floor texture - had bit 4 set. It drew the texture backwards. Well, I - fixed it. Hope you didn't "Build" on this bug! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/22/95 - Fixed really really stupid hitscan returning sector < 0 bug. If - you were calling hitscan from the top-left triangular region - of the board it stupidly returned a -1 for the sector. Well, - I fixed it. - - - ATTENTION EVERYBODY!!! Moved setup.dat loading from the engine - into GAME.C and BSTUB.C. If you copy this code from game.c - into your game / bstub, they will work like it used to: - - ----- NEW GLOBAL VARIABLES: ----- - - #define NUMOPTIONS 8 - #define NUMKEYS 19 - static long chainxres[4] = {256,320,360,400}; - static long chainyres[11] = {200,240,256,270,300,350, - 360,400,480,512,540}; - static long vesares[7][2] = {320,200,640,400,640,480, - 800,600,1024,768, - 1280,1024,1600,1200}; - static char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0}; - static char keys[NUMKEYS] = - { - 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, - 0x1e,0x2c,0xd1,0xc9,0x47,0x49, - 0x9c,0x1c,0xd,0xc,0xf, - }; - - ----- Put this where you call initengine ----- - - long fil; - - if ((fil = open("setup.dat",O_BINARY|O_RDWR,S_IREAD)) != -1) - { - read(fil,&option[0],NUMOPTIONS); - read(fil,&keys[0],NUMKEYS); - close(fil); - } - if (option[3] != 0) moustat = initmouse(); - - switch(option[0]) - { - case 0: initengine(0,chainxres[option[6]&15],chainyres[option[6]>>4]); break; - case 1: initengine(1,vesares[option[6]&15][0],vesares[option[6]&15][1]); break; - case 2: initengine(2,320L,200L); break; - case 3: initengine(3,320L,200L); break; - case 4: initengine(4,320L,200L); break; - case 5: initengine(5,320L,200L); break; - case 6: initengine(6,320L,200L); break; - } - - ----- That's it! ----- - - Initengine now has 3 parameters: - initengine(char davidoption, long daxdim, long daydim) - See revised initengine description at the top of this file. - - Now that engine.c doesn't use setup.dat, you can use your - own setup program. - - Don't forget to update BSTUB! - - NOTE!!! While MY setup program allows you select many different - video modes, no new modes are supported yet in BUILD! - (It's on my list.) - - - - Fixed keyboard repeating. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/26/95 - Hi-res now works in all modes! The code I gave in the 4/22/95 - description is still perfectly valid, so please copy it if - you haven't already looked at it. Here are some important - new variables I put in BUILD.H: - - EXTERN char vidoption; - EXTERN long xdim, ydim, ylookup[MAXYDIM+1]; - - Vidoption is simply the first parameter you pass to - initengine. Xdim and Ydim are the screen sizes you pass to - initengine, such as 320*200 or 640*480. - Ylookup is a lookup table that works like this: - If (vidoption == 0) ylookup[i] = ((i*xdim)>>2); - if (vidoption != 0) ylookup[i] = i*xdim; - There is 1 exception: If you are using a chained mode which - can only fit only 1 viewing page, then the engine actually - does a screen-buffer mode and blits to the chained screen - so for this case, ylookup[i] = i*xdim. - - - Added bit to the dastat parameter of rotatesprite. - if ((dastat&2) != 0) - align to screen size so the gun or - whatever is always over the same relative spot of the screen. - Works like bit 2 of the flags parameter in overwritesprite. - - - Added pixel writing and reading that will work in all BUILD - graphics modes. They work just like you think they should. - - plotpixel(long x, long y, char col); - char getpixel(long x, long y); - - Please do not overuse these functions! They are NOT intended - for fast drawing! - - - Changed tables.dat so parallaxing skies at high resolutions - work accurately. - - - I made bit 15 of sprite[].cstat the invisible bit. If it is - set, then the sprite won't even be considered for sorting and - there is absolutely no speed loss due to its existence. It is - faster to use this bit then manually set thesprite[] to -1. - - Since drawrooms collects the list of sprites drawmasks is about - to sort, make sure the bit is set before drawrooms. If you use - frame interpolation, you usually want to tell drawmasks somehow - to not draw yourself. Before you used to use the - thesprite[] = -1 trick. Now you do it like this: - - sprite[i].cstat |= 0x8000; //Set invisible bit - drawrooms(posx,posy,etc.); - sprite[i].cstat &= ~0x8000; //Restore invisible bit - - - Fixed distance overflow bug (the one that showed garbage - textures if a wall was really far away). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/27/95 - Made an example board, MONWALK.MAP, where monsters walk along - a bridge with no railing, onto a sector, and even up and down - a stairway without falling off it. If you shoot a brown so - it's almost dead, it will turn transluscent. If it's - transluscent, it won't shoot bullets. It is much easier to - test the monsters' walking when they don't shoot! - - - Try my new and improved fake network player mode! Each fake - network player now gets their own window. Use insert and - delete to add or remove players. Use Scroll lock to switch - which window you control. If you have a Pentium, I would - recommend trying this out in 640*480 mode. - - - Noticed a bug with my movesprite code: - For clipmove, I was getting the z-coordinate right, but for - getzrange I forgot to subtract half the sprite's height if - the sprite was using the real centered centering mode. - - These lines set daz to the actual center of sprite i no matter - what centering mode is used: - - daz = sprite[i].z; - if ((sprite[i].cstat&128) == 0) - daz -= ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1); -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/28/95 - ATTENTION PROGRAMMERS! When a tile is not in the cache: - Before it used to be this: - - if (waloff[tilenum] == -1) loadtile(tilenum); - or - if (waloff[tilenum] < 0) loadtile(tilenum); - - Now it's this: - - if (waloff[tilenum] == 0) loadtile(tilenum); - - PLEASE MODIFY YOUR CODE IF YOU USE WALOFF! - - Windows can allocate memory with addresses so high, they - are negative. That makes the (waloff[tilenum] < 0) - method totally stupid and attempt to reload from disk - the tile constantly! I can think of 3 reasons why I - originally designed my system in this fashion: - mestupid, mestinx, and merottts. - - - Fixed visibility for different screen sizes. - - - ATTENTION PROGRAMMERS! Now multiply by visibility rather than - shift right by visiblity so you get a broader range of - visibility. If you want the visiblity to work like before, - use this conversion table: - - Old visibility New visibility - 8 -> 16384 - 9 -> 8192 - 10 -> 4096 - 11 -> 2048 - 12 -> 1024 - 13 -> 512 - 14 -> 256 - 15 -> 128 - - - Made Alt-F make the selected wall the first wall of a sector. - This is useful for quick relative alignment adjustments. - Alt-F for 2D and 3D modes may not work for sectors with loops - inside of them. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/1/95 - Optimized horizontal line setup code from 9 multiplies to - 7 multiplies. - - - Fixed dark vertical lines in parallaxing skies bug I recently - introduced. - - - Optimized horizontal line assembly code so it doesn't use the - awful SHLD instruction any more. This is a good speed - improvement for Pentiums only. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/2/95 - Added some code to my GAME.C which detects when a computer gets - out of sync in a multiplayer game. It's not as easy as you - may think with all the faketimerhandler and fifo crap. If - you want to put this code in your game, search all areas in - my code with the keyword "syncval". - - - Fixed palookup crashing bug. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/6/95 - Moved windowx1, windowy1, windowx2, windowy2 variables into - BUILD.H. They are the exact parameters you passed to the - last setview call. Please DO NOT modify them directly. - Use setview to modify them. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/10/95 - Fixed makepalookup bug when shading to non 0. - - - Fixed palookup pointer setting bug. - - - ATTENTION PROGRAMMERS! I made a new cacheing system which allows - any type of object to be allocated in my cache, such as - artwork tiles and sounds or whatever else you may want to - put on the cache. This may or may not affect you. If you - haven't been hacking into my code, then you shouldn't have to - change your code. The cacheing routines have been moved into - a separate module, cache1d.obj. If you link engine.obj, then - you must also link cache1d.obj. Please update your makefiles. - - For anybody who may want to re-write my cacheing system, here's - how it now works: (I have only 3 functions in cache1d.obj - right now, initcache, uninitcache, and allocache) - - Allocate a nice BIG buffer, like from 1MB-4MB and - call initcache(long cachestart, long cachesize) where - - cachestart = (long)(pointer to start of BIG buffer) - cachesize = length of BIG buffer - - Ex: initcache(FP_OFF(pic),cachesize); - - Loadpics calls this function for you so you don't normally - need to call it. - - call allocache(long ptr, long siz) whenever you need to - allocate a temporary buffer, where - - ptr = (long)(pointer to (4-byte pointer to thing))\ - siz = number of bytes - - Ex: if (waloff[tilenume] == 0) - allocache((long)&waloff[tilenume],walsiz[tilenume]); - - Allocache is totally tile independent. To allocate a sound - on the cache, you can call allocache. - - There are 3 functions in the engine which help manage the - cache for you: loadpics - calls initcache - loadtile - calls allocache - allocatepermanenttile - special function - that allocates permanent memory - from the cache. - - - Fixed clipmove crashing bug when passing a sectnum < 0. Whenever - you moved in BUILD and you weren't in a valid sector, memory - was getting trashed. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/12/95 - Added ExtPreCheckKeys(void) to BSTUB.C. It is called before - drawrooms / drawmasks in 3D mode, whereas ExtCheckKeys(void) - is called after drawrooms / drawmasks (and before nextpage). - - - Added bit to flags of rotatesprite to allow x-flipping. See - updated documentation. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/17/95 - Added aspect ratio for those weird modes like 320*400, etc. - You could call setaspect to properly adjust a mode that is - not exactly correct, or for special effect that stretch - the screen. - - In ENGINE.OBJ, I added a function, setaspect(long daaspect), - where you pass the Y/X aspect ratio scaled up 16 bits, so - 65536 would be normal. You don't need to call this if you - don't want to. By default, in setview, I call setaspect - with these parameters: - - setaspect(divscale16(ydim*320,xdim*200)); - (also written as:) - setaspect(((ydim*320)<<16)/(xdim*200)); - - Note that in 320*200 mode the value passed would be 65536 - which is a 1:1 aspect ratio. - - In BUILD.H, I added yxaspect and xyaspect. - - When you call setaspect(daaspect), - - yxaspect = daaspect; - xyaspect = (1<<32) / yxaspect; //reciprocal - and other internal variables, so DON'T MODIFY YXASPECT - AND XYASPECT DIRECTLY! - - Since drawmapview is also affect by the aspect ratio, you - will need to make sure drawoverheadmap is affected so - the map modes match up. Please look at and copy my updated - drawoverheadmap function into your GAME.C if you use it. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/18/95 - Revised caching system so it supports locking. - Here are the new parameters to allocache: - - allocache(long *bufptr, long bufsiz, char *lockptr) - *bufptr = pointer to 4-byte pointer to buffer - bufsiz = number of bytes to allocate - *lockptr = pointer to 1-byte locking char. 1=locked, 0=not - - And uninitcache works a little differently too: - Call uninitcache(0) to remove all UNLOCKED items or - Call uninitcache(1) to remove ALL items. - After calling uninitcache, you do not need to call - initcache to use the cache again. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/21/95 - Made changespritesect and changespritestat return 0 instead of -1 - when changing to same value. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/25/95 - Added relative visibility for sectors. In 3D EDIT MODE, use - ALT+(keyp.)+/- to change an individual sector's visibility. - Press Shift in addition for fine visibility changine. By - default you change it by 16. Press CTRL+ALT+(keyp.)+/- to - change the global visibility. The global visibility is not - saved in the map. - - - Can now delete many sectors at a time. Select sectors with the - rt. Alt. Then press Ctrl-delete on any highlighted sector to - delete all the highlighted sectors. - - - Fixed build sometimes not saving when quitting from 2D mode bug. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/27/95 - Fixed bugs in network work that should make it miss packets - much less often than before. - - - Fixed bug in ncopy so it shouldn't halt or crash anymore. - - - Added spritecstat[] the thesprite arrays. Please use my - thesprite arrays rather than modifying the sprite directly - since hitscan and clipmove use bits 4 and 8 of sprite[].cstat. - - - ATTENTION PROGRAMMERS: Added 1 parameter to neartag that will - allow you to search only lotags or only hitags. See updated - documentation above. - - neartag (long xs, long ys, long zs, short sectnum, short ange, - short *neartagsector, short *neartagwall, short *neartagsprite, - long *neartaghitdist, long neartagrange, char tagsearch) - - If tagsearch = 1, neartag searches lotag only - If tagsearch = 2, neartag searches hitag only - If tagsearch = 3, neartag searches lotag&hitag - - Neartag used to always search both lotag&hitag. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/30/95 - Added ExtAnalyzeSprites(void) to BSTUB and a spriteshade array - to BUILD.H. - - - Made circle drawing in 2D EDIT MODE work better at large sizes. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/5/95 - Added shareware / registered artwork version control to EDITART. - In 'V' mode, when you press ALT-R to get a report of tile - frequencies of tiles on all the maps in the current directory, - you can toggle the shareware/registered bit with the space bar. - This bit is saved in the top bit of the picanm bits so it is - stored permanently in the art file. Press ALT-D in this mode - to automatically delete all registered tiles. Please before - you do the deleting phase, copy all artwork to a temporary - directory!!! It is safe, however, the toggle the new bit in - the full version. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/7/95 - Made 3 main structures defined with typedef so struct prefix - is no longer needed with sectortype, walltype, and spritetype. - - - Added new function to engine: - - short sectorofwall(short dawall); - - It returns the sector of a given wall. It is well optimized - including sector[sector[].nextwall].nextsector if a red wall - and a binary search on the sector[].wallptr's if it is a - white wall. On average, sectorofwall should have to scan - through only 10 different sector indeces to find the right - sector (not 1024!). - - - ATTENTION PROGRAMMERS! Made all the separate thesprite arrays - into a single array of sprite structures call tsprite. See - BUILD.H!!! This means: - - spritepicnum[i] is now tsprite[i].picnum - spritex[i] is now tsprite[i].x - spritey[i] is now tsprite[i].y - spritez[i] is now tsprite[i].z - spriteshade[i] is now tsprite[i].shade - spritecstat[i] is now tsprite[i].cstat - spritepal[i] is now tsprite[i].pal - thesprite[i] is now tsprite[i].owner <<<============ - - Everything above is straight forward, except for thesprite, - which has been renamed to owner. - - All other tsprite parameters, such as .xrepeat, .yoffset, - etc. can also be modified without changing the real - sprite structure so the game won't out of sync. - - - Made tsprite[].statnum be a priority variable for sorting sprites - that are the exact same distance from you. I think higher - means more in front. - - - Made clipmove allow you to cross any red sector line when the z's - of the next sector are farther apart. This may solve clipping - bugs such as when you're in water. You may be able to remove - some work-arounds you may have programmed previously. - - - NEW FILE GROUPING SYSTEM!!! - My system will first search for the stand-alone file in the - directory. If it doesn't find it, then it will search for it - in the group file. If it still doesn't find it then -1 city. - Use KGROUP.EXE to create a grouped file from a lot of other - files. Type KGROUP [grouped filename][filespec][filespec][...] - For example this line will create the new grouped file, - stuff.dat, including all the following files specified: - kgroup stuff.dat *.art *.map tables.dat palette.dat - Feel free to make your own batch files. If there is demand, - I can make kgroup support appending, replacing, and extraction. - - Here is the file format of a grouped file: - ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - ³ 12 bytes - File grouping ID ³ - ³ 4 bytes - Number of files ³ - ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³For each file: (16 bytes per file) ³ - ³ 12 bytes - Filename with extension (13th byte would be a 0) ³ - ³ 4 bytes - Length of file ³ - ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ - ³ Pure, raw file data, ordered just like you think it would be ³ - ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ - There just couldn't be a simpler format. This format is so - hacker happy that when you view it in a hex editor, all the - filenames line up perfectly since they're multiples of 16. - Anybody who can't figure this out, of course, not only rots, - but is probably one of those really stupid people who would - actually "pay" to get the full version of a game. - - The engine currently supports grouping for: - *.ART, *.MAP, TABLES.DAT and PALETTE.DAT. If you want - to group your own files, you will have to use my loading - routines rather than the standard ones for those files. My - file routines are basically an extra layer around the standard - lo-level functions. Look at these 5 routines I currently - support: - - Welcome to the K-routines! - open -> kopen4load(char *filename) - read -> kread(long handle, void *buffer, long leng) - lseek -> klseek(long handle, long offset, long whence) - filelength -> kfilelength(long handle) - close -> kclose(long handle) - - Note that you only pass the filename to my kopen4load function. - - Here are 2 other routines that you MUST use, whether you like - my file grouping system or not: - - initgroupfile(char *groupfilename) - Call this with the name of your grouped file before - any possible file loading will the k-routines. Note that - tables.dat uses the k-routines and it is in initengine(). - Please don't give your grouped filename an extension that - starts with W, ends with D, and has a vowel in between. - And don't even bother to write your own file grouping - system because even if you do, people still have to write - their own new utilities to read the ART and MAP files. - - uninitgroupfile() - Call before quitting to DOS. - ------------------------------------------------------ - - ATTENTION PROGRAMMERS! Changed kopen4load from: - - kopen4load(char *filename) - to: - kopen4load(char *filename, char searchfirst) - - where: - if searchfirst = 0 then search stand alone first then group file - if searchfirst = 1 then search group file only -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/12/95 - Tracked down an OUT OF SYNC bug with my multiplayer code! - In my GAME.C, the way I had my sync arrays organized were - wrong. The problem was that if faketimerhandler was - called during domovethings, the sync arrays may have been - changed, getting the game out of sync. The solution is - to keep the sync arrays in domovethings totally separate - from the sync arrays in faketimerhandler. I split my sync - arrays into 2 separate arrays, sync and fsync, where fsync - and osync are for use BEFORE the FIFO only (such as - faketimerhandler and getpackets), and sync is used AFTER - the FIFO only (such as domovethings). PLEASE SPLIT YOUR - SYNC ARRAYS AS I DESCRIBED! - - - The OUT OF SYNC message doesn't flicker any more. See the - section of code in GAME.C where I set syncstat. - - - Fixed up a waitforeverybody function for network games which - waits for everybody to be at a certain part of the game. - Waitforeverybody also uses getpackets message number 5. - - - Added new clipping function that will push players away from - walls that are too close. It solves A LOT of movement - clipping problems. It can be pretty darn slow if it detects - that you're too close to a wall, so I'd recommend using it - only for players. - - pushmove (long *x, long *y, long *z, short *sectnum, - long walldist, long ceildist, long flordist, char cliptype) - - The parameters are exactly the same as clipmove but with no - xvect or yvect. Pushmove returns either a 0 or -1. If - it returns a -1, then that means that it could not push - the player away from the offending wall after 256 tries. - When this happens, then you should kill the player - instantly, because this only happens when the player is - getting smooshed. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/13/95 - Made clipinsidebox and clipinsideboxline return 0 if line doesn't - intersect box, 1 if line intersects box and center of box - is in front of line, or 2 if line intersects box and center - of box is behind line. - - - Cansee should now work properly with overlapping. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/19/95 - ATTENTION! Remove work-arounds!!! Found nasty getzrange bug. - Getzrange used to let you fall through red sector line cracks - when you were near more multiple red sector line sharing the - same 2 sectors. Sound familiar anybody? - - - Made pushmove return the sector of whatever x and y end up in. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/22/95 - I included cache1d.c renamed to cache1d.txt in this upload. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/26/95 - Made face and wall sprites of clipmove, getzrange, hitscan, and - neartag sensitive to the y-offset that you set in Editart. - - - Made one sprite sorting case work perfectly: where multiple - sprites have the same x and y location (and priority). The - sorting still doesn't work perfectly, but this one case can - solve many of the current sprite sorting bugs, such as - inserting a floor sprite of blood below a dead body. - - - Fixed some sprite drawing clipping bugs for wall and floor - sprites. Now, wall sprites and floor sprites should not - show through walls, ceilings, or floors when they're not - supposed to. Also, I fixed a case where wall sprites - disappeared when they happened to be between 2 white walls - that clipped it. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/27/95 - Fixed even more sprite drawing clipping bugs for wall sprites. - - - BONUS!!! Wall sprites now clip to white walls! (not red walls) - If you ornament a wall, make sure that neither endpoint of the - wall sprite is behind the wall or else it will get clipped. - Please run lookatme.map from my game.exe which demonstrates - some of the things you can do in build now without bugs. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/30/95 - Made drawline256 clip with startumost/startdmost. - - - Moved keyboard handler into GAME.C. Here's what you need to do - to use my keyboard handler (see my GAME.C): - - 1. Some global variables: - - #define KEYFIFOSIZ 64 - void (__interrupt __far *oldkeyhandler)(); - void __interrupt __far keyhandler(void); - volatile char keystatus[256], keyfifo[KEYFIFOSIZ]; - volatile char keyfifoplc, keyfifoend; - volatile char readch, oldreadch, extended, keytemp; - - 2. initkeys() - - 3. uninitkeys() - - 4. keyhandler() - - 5. Make sure to call initkeys and uninitkeys. A good place - would be next to where you call inittimer / uninittimer. - - I didn't put my keyboard handler into BSTUB since I am using - keystatus throughout build.obj. Besides I didn't want to anybody - too bad of a headache for one upload. - - - Did you know that screencapture inverses black and white if you - hold either shift key down? This option is useful for - printing out board maps. Since I don't own the keyboard - any more, I had to make screencapture take inverseit as the - second parameter. - - screencapture(char *filename, char inverseit); - - Ex: screencapture("captxxxx.pcx",keystatus[0x2a]|keystatus[0x36]); - - If (inverseit == 0) then nuttin' special - If (inverseit == 1) then super-reverso blacko-whiteo mode! - - I also had to move the stereo adjustment keys into game.c - Just search for the "stereo" keyword in GAME.C. It'll take - through all the necessary places. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/5/95 - Moved my keytimerstuff from my timerhandler into getinput. - (which is where it should be) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/10/95 - Added a loadtilelockmode variable to BUILD.H. It's a global - variable that makes future loadtile calls allocate their - buffers on the cache as unlocked (0-default) or locked (1). - I decided to make this a global variable rather than a - parameter to save some people from rewriting code. - - EXTERN char loadtilelockmode; - - - Made my 2D EDIT MODE space bar code clear out new sectors and - wall structures to 0. (except for the extras which are -1) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/20/95 - I forgot to documenent rotatesprite bit 3, which controls - whether or not the sprite will be clipped to the startumost - /startdmost arrays. If the bit is a 1, then the sprite will - not be clipped. This mode is useful for doing status bars - at variable resolutions. What you do is instead of calling - permanentwritesprite, you call rotatesprite with the scaling - bit and startumost/startdmost clipping bit off. For non - screen-buffer modes, be sure to call rotatesprite for each - page of the mode. Use the numpages variable in BUILD.H to - get the number of video pages used. - - - Added clipping box parameters to rotatesprite: Here is the - prototype now: - - rotatesprite (long sx, long sy, long z, short a, short picnum, - signed char dashade, char dapalnum, char dastat, - long cx1, long cy1, long cx2, long cy2) - - For your information, rotatesprite used to choose default - clipping box sizes using this code: - - if ((dastat&8) == 0) - { //0,0,xdim-1,ydim-1 - cx1 = windowx1; cy1 = windowy1; - cx2 = windowx2; cy2 = windowy2; - } - else - { - cx1 = 0; cy1 = 0; - cx2 = xdim-1; cy2 = ydim-1; - } - - Now both permanentwritesprite and overwrite can both be - replaced with rotatesprite which now does everything. - To replace permanentwritesprite, you must make sure to - draw to all the pages in numpages. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/27/95 - Fixed recently introduced build 3D mode bug when you press the - L.ENTER key on a blank map. Also made sectorofwall return -1 - if an invalid wall is passed to it. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/28/95 - Added a function to my game that shows only the local area of - the map by scanning through the nextsectors of walls and - setting the show2dsector, show2dwall, and show2dsprite - arrays properly. You should call this function any time - (show2dsector[cursectnum>>3] & (1<<(cursectnum&7))) == 0) - That means it's not showing the sector you're currently - in. You should also manipulate show2dsprite any time you - insert or warp a sprite. - - - You know the one thing in my engine that doesn't work in chained - mode? Well I fixed it! - - - Fixed a bug which made it print out of sync when it really - wasn't (This bug probably only affecting my game.) In - getsyncstat, I was calling updatecrc16() with things other - than chars, making it index invalid parts of the crctable - array. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/30/95 - Reduced some overhead memory: - * Removed walsiz[] array. (16K saved). If you ACTUALLY used - this array, you can multiply tilesizx[]*tilesizy[] instead. - * Made sqr table from longs to shorts with same precision. - * Removed tantable. (4K saved) - * Reduced internal constant, MAXWALLSB, from 4096 to 2048 - (96K saved). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/1/95 - Added another bit to rotatesprite for top-left corner mode and - made documentation of the stat bits more clear. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/3/95 - Fixed a bug with rotatesprite so it now scales perfectly to the - full screen view when enabling bits 2 and 8 of the stat field. - This means that with rotatesprite, you can easily get your - status bars, etc., to work at any resolution. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/4/95 - New Doom->Build update! You can now convert doors and lots of - other weird things. Fixed more conversion bugs. Sprites now - convert properly in doom-artwork mode. You can now convert - PWADS. - - - Added some wacky aspect ratio keys to 3D EDIT MODE of BUILD. - Use Rt.Ctrl Rt.Alt Lt.- or Rt.Ctrl Rt.Alt Lt.= to select. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/12/95 - Added parameter to initmultiplayers to allow who becomes - master at the start of a multiplayer game. - - - Added parallaxyscale variable to BUILD.H which control the ratio - at which the parallaxing skies scroll in relation to the - horizon. Default is 65536. With lower values, you don't - need as much artwork and can look higher, but I like 65536 - because it is the correct projection. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/13/95 - Had MAJOR bug with my searchmap function. If you use it, please - re-copy from my game.c -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/14/95 - Fixed some EVIL bugs with Rt.ALT sector copying. It shouldn't - screw up your maps anymore! And if you have maps that were - screwed up with it, you can try my new map correcting key, - L.Ctrl+L.Shift+L.Enter. This key will not affect an already - perfect map. However it can SOMETIMES clean up a map that - was screwed up. I take no responsibility if it screws up - your map even more, so please check them before saving! diff --git a/polymer-perf/eduke32/build/doc/build2.txt b/polymer-perf/eduke32/build/doc/build2.txt deleted file mode 100644 index c971377ba..000000000 --- a/polymer-perf/eduke32/build/doc/build2.txt +++ /dev/null @@ -1,1655 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. - -BUILD engine Notes (7/24/96): - -BUILD programmed by Ken Silverman - -BUILD.TXT CONTINUED... (BUILD.TXT WAS GETTING TOO BIG!!!) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/12/95 - Added parameter to initmultiplayers to allow who becomes - master at the start of a multiplayer game. - - - Added parallaxyscale variable to BUILD.H which control the ratio - at which the parallaxing skies scroll in relation to the - horizon. Default is 65536. With lower values, you don't - need as much artwork and can look higher, but I like 65536 - because it is the correct projection. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/13/95 - Had MAJOR bug with my searchmap function. If you use it, please - re-copy from my game.c -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/14/95 - Fixed some EVIL bugs with Rt.ALT sector copying. It shouldn't - screw up your maps anymore! And if you have maps that were - screwed up with it, you can try my new map correcting key, - L.Ctrl+L.Shift+L.Enter. This key will not affect an already - perfect map. However it can SOMETIMES clean up a map that - was screwed up. I take no responsibility if it screws up - your map even more, so please check them before saving! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/16/95 - Added error correction to mmulti.obj. Mmulti.obj is like - multi.obj but it is made to work with Mark's real mode - multiplayer driver that he calls COMMIT. - - - MMULTI.OBJ vs. MULTI.OBJ: - * initmultiplayers is the same, but the parameters are ignored - * uninitmultiplayers can be called but does nothing. - * sendlogon can be called but does nothing. - * sendlogoff sends packet 255 to everybody else. It does not - need to be called any more. - * sendpacket and getpacket are the same. - * connecthead, connectpoint2[], numplayers, myconnectindex - are the same. They can be externed just like before. - * getoutputcirclesize always returns 0. It is not needed. - * setsocket does nothing. The socket is now in commit.dat. - * crctable can still be externed. - * syncstate can still be externed but is not used. - * Do not use the option[4] variable. Initmultiplayers will - always return a valid number in numplayers from 1-16. - - - You can link mmulti.obj in place of multi.obj and use - commit.dat as the setup file for multiplayer options. - - There are 2 ways you can run your game through commit: - 1. Set the launch name (usually game.exe) in commit.dat - and type something like "commit map01 /asdf" - 2. Type "commit launch game map01 /asdf". This method - is easier if you want to use the debugger with commit - since you won't have to change commit.dat constantly. - Ex: "commit launch wd /tr=rsi game map01 /asdf" - - I have not tested mmulti.obj with my BUILD game yet because - I have been using 2DRAW as my test program. I may put up a - new version of mmulti.obj with better error correction for - extremely error-prone lines soon. - - - Kgroup can now accept a parameter as a filename with a list of - files to be put into the group file. - Ex: "kgroup @filelist.txt" -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/18/95 - Found a way to greatly reduce slave "hitching" on multiplayer - games for faketimerhandler style communications. It's pretty - simple. - - Step 1: In the beginning of faketimerhandler, change - - ototalclock = totalclock; - TO: - ototalclock += TICSPERFRAME; - - This makes the timing of the game more constant and to - never miss ticks. I should have done this in the first - place all along. - - Step 2: In getpackets, (for slaves only) count the number of - times movethings is called. Normally, movethings should - be called exactly once for every time getpackets is called - inside faketimerhandler. The hitching is because - movethings is called in a 0-2-0-2-0-2 cycle instead of the - standard 1-1-1-1-1-1 cycle. This happens because the - timers of the 2 computers are aligning in such a way that - the slave is receiving the master's packets at nearly the - same time as it calls getpackets. To correct the problem, - if movethings is called an even number of times, I randomly - add or subtract (TICSPERFRAME>>1) to ototalclock. Throw - this code at the end of getpackets: - - Beginning of getpackets: - movecnt = 0; - - Where slave receives buffer in getpackets, next to movethings: - movecnt++; - - End of getpackets: - if ((myconnectindex != connecthead) && ((movecnt&1) == 0)) - { - if (rand()&1) ototalclock += (TICSPERFRAME>>1); - else ototalclock -= (TICSPERFRAME>>1); - } - - - Found a way to interpolate anything using the doanimations - code for faketimerhandler style multiplayer games. It's not - as hard as I thought it would be (and it doesn't waste too - much memory!) To smooth out doanimations, since there's no - temporary variables that can be thrown away like with tsprite, - the current doanimations positions must be backed up at the - beginning of drawscreen and restored at the end of drawscreen. - If you want smooth up&down doors, do this: - - Global declaration: - static long oanimateval[MAXANIMATES]; - - Beginning of drawscreen: - for(i=animatecnt-1;i>=0;i--) - { - oanimateval[i] = *animateptr[i]; //Backup doanimations interpolation - - j = *animateptr[i]; - if (j < animategoal[i]) - j = min(j+animatevel[i]*(totalclock-gotlastpacketclock),animategoal[i]); - else - j = max(j-animatevel[i]*(totalclock-gotlastpacketclock),animategoal[i]); - - *animateptr[i] = j; - } - - End of drawscreen: - //Restore doanimations interpolation - for(i=animatecnt-1;i>=0;i--) *animateptr[i] = oanimateval[i]; -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/19/95 - Added global invisibility variable. Initengine sets it to 0 - by default. If you set global invisibility to 1, then - all sprites with the invisible bit set (sprite[].cstat&0x8000) - will be shown. This is useful for editing invisiblie sprites. - - - Made the hitscan blocking bit for sprites be the bit checked - when using cliptype 1 instead of the blocking bit. Before - I was accidently using the clipmove blocking bit on sprites - with cliptype 1. I should have done it this way in the first - place. I hope you haven't "built" around this bug too much! - Here's how everything works now: - - Clipmove blocking bits: - Which bits: - wall[].cstat & 1 - sprite[].cstat & 1 - Used in these cases: - clipmove when cliptype = 0 - getzrange when cliptype = 0 - - Hitscan blocking bits: - Which bits: - wall[].cstat & 64 - sprite[].cstat & 256 - Used in these cases: - clipmove when cliptype = 1 - getzrange when cliptype = 1 - hitscan always -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/20/95 - Reduced some overhead memory by combining 2 large internal - arrays which were used in different parts of the engine. - This is a total savings of about 90K. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/24/95 - Changed the way 'E' mode works on ceiling and floor textures. - 64*64 and 128*128 textures are the same as before so I think - this won't screw up your existing maps. (But I can never be - sure) Now, 'E' mode always smooshes the texture size by 2 for - any size texture. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/29/95 - ÜÛÛÛÛÛÛÜ ÛÛ ÜÛÛÛÛÛÛÜ ÜÛÛÛÛÛÛÜ ÜÛÛÛÛÛÛÜ ÜÛÛÛÛÛÛÜ ÛÛ ÛÛ ÛÛ - ÛÛ ÛÛ ÛÛß ßÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ - ßÛÛÛÛÛÛÜ ÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛÛß ÛÛÛÛÛÛ ßÛÛÛÛÛÛÜ ÛÛ ÛÛ ÛÛ - ÛÛ ÛÛ ÛÛÜ ÜÛÛ ÛÛ ÛÛ ÛÛ ßß ßß ßß - ßÛÛÛÛÛÛß ßÛÛÛÛÛÛÛ ßÛÛÛÛÛÛß ÛÛ ßÛÛÛÛÛÛß ßÛÛÛÛÛÛß ÛÛ ÛÛ ÛÛ - - New 3D EDIT MODE BUILD keys: - Press [ or ] on a ceiling or floor to change the slope. - Shift + [ or ] on a ceiling or floor to adjust finely. - Press / to reset a ceiling or floor to slope 0. - Use Alt-F in either 2D or 3D mode to change the slope's hinge. - - Sector fields used for slopes: - The useless groudraw fields, ceilingheinum and floorheinum, - are now being used as the slope value. They are treated - as signed shorts, where 0 is slope 0, of course. To enable - slope mode, you must also set bit 1 of the ceilingstat or - floorstat bits. - - Known bugs: - There are still a few bugs that I haven't gotten around to - fixing yet. They're not necessarily hard to fix - it's just - that there are a lot of little things that need to be updated - (on my part). - - - Hitscan does not hit slopes correctly. - - Rare divide overflow bug in my wallmost function only when - you're very close to a red sector line of a slope. - - Relative alignment for slopes not yet programmed. Relative - alignment for slopes will allow square aspect ratio for all - slopes of slopes. - - ALT-F code with passing loops would be nice. - - Visibility not implemented for slopes yet. - - Sometimes an annoying tiny wall is drawn at sector lines. - - Don't call me to tell me about these bugs. I know about them. - And if I didn't list your favorite bug of the day, it will - probably be brought up by the 2 internal teams now working - with BUILD. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/4/95 - Made ALT-F select any wall of a sector, even crossing loops. - In 3D mode, ALT-F now sets the selected wall directly to the - first wall. - - - Fixes related to slopes: - * Relative alignment now works. Use relative alignment on high - slopes if you don't like the way the texture is stretched - out. - * Flipping now works - * Panning now works - * Fixed seams for SOME (not all) slope borders - - - My wonderful divide overflow bugs in wallmost aren't quite as - rare as they used to be. Wait a minute - I thought I was - supposed to document bug fixes here! This is what you get - for wanting BUILD tonight. As soon as I fix these darn - divide bugs, I'll put up a new version. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/5/95 - Fixed all known divide overflow bugs related to wallmost. I - haven't gotten a divide overflow yet in the last few hours, - but that doesn't guarantee that you'll never get one. Take a - look at GROULAND. It has a cool new cylindrical tunnel. On - the other side of the level is my house in Rhode Island. - - Known bugs with slopes now: - - Hitscan does not hit slopes correctly. - - Visibility not implemented for slopes yet. - - Clipmove will not allow you to walk off high sloped cliffs. - - - Also, I noticed a rare sprite drawing clipping bug. I - don't know if this is new or not. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/7/95 - Fixed an exception 0xe bug by using tsprite[MAXSPRITESONSCREEN-2] - instead of tsprite[MAXSPRITESONSCREEN-1]. I don't understand - why this fixed it so I expect that it will come back to haunt - me. Oh happy day. :( - - - I forgot to document 2 new and useful functions in the engine: - - long getceilzofslope(short sectnum, long x, long y); and - long getflorzofslope(short sectnum, long x, long y); - - Returns the z coordinate of the ceiling/floor at that x, y - location. If the sector doesn't have a ceiling/floor slope - then it immediately returns the sector[].floorz or - sector[].ceilingz so it's not that slow. You may want to - check for slopes yourself ceilingstat&2/floorstat&2 if you - think the overhead of calling these functions are too slow. - - - Made clipmove use getceilzofslope and getflorzofslope when - checking for overlapping. - - - Cleaned up mirror code for non-chained modes a little bit. The - mirrors should no longer have a stay line on the right anymore - for these modes. - - - Added Chain-Buffer mode. See my new SETUP.EXE. Chain-Buffer - is a combination of the chain and screen buffer modes - a - buffered chain mode. This mode is faster than standard chain - mode when a lot of screen memory is being read, for example - when you use transluscence or mirrors. Also, Chain-Buffer - mode is cleaner than screen-buffer mode since you don't see - memory being copied to the screen. Unfortunately, in most - cases, Chain-Buffer is the slowest of all modes. Actually, - Chain-Buffer mode sucks. There is a use for this mode, - however! In the future, I may make some kind of chain mode - automatically switch into chain-buffer mode for extra speed - when there is a large area of transluscence, etc. - - ATTENTION PROGRAMMERS: Here is the new order of modes that - initengine accepts: - - 0 = Chain mode - 1 = Chain-Buffer mode - 2 = Screen-Buffer/VESA mode - 3 = TSENG mode - 4 = Paradise mode - 5 = S3 - 6 = Crystal Eyes mode - 7 = Red-Blue mode -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/9/95 - Fixed visibility for face sprites in high resolution modes. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/14/95 - Added a new bunch of graphics modes using the new VESA 2.0 linear - buffer. (I replaced the useless chain-buffer mode with VESA - 2.0 modes) See my new SETUP. Since most cards only support - VESA 1.2 right now, you will probably need a VESA 2.0 driver. - I have been using the UniVBE(tm) 5.1 from SciTech Software - (ftp: ftp.scitechsoft.com, www: http://www.scitechsoft.com) - Note that since I inserted the new modes between chained mode - and screen buffer mode, you will need to update your setup - program and fix your initengine calls. - - - Programmed a LRU/MRU-style cacheing system. It should be fully - compatible with the old cache1d except for the locking byte. - The locking byte would be better described as a priority byte. - Priority byte: - - 0 - non-cached memory, you NEVER set the byte to 0! - 1-199 - cached unlocked memory - 200-255 - cached locked memory - - When the cacheing system needs to remove a memory block, it - will try to remove the FEWEST number of SMALLEST blocks with - the LOWEST priority. - - Note: Never set the priority byte to a 0! Let the cacheing - system do that for you. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/15/95 - Optimized hitscan a little and made it work with slopes. - - - Made some internal things in the build editor work better with - sprites on slopes. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/16/95 - Note: Initengine now only does memory allocation for the - graphics modes. The ylookup table is calculated in - setgamemode since with VESA, I don't know certain - variables such as bytesperline until the mode is - actually set. - - - Cansee should now work with slopes properly. - - - Added a new function which is a combination of the - getceilzofslope and getflorzofslope functions. Whenever you - need both the ceiling and floor, it is more optimal to call - this function instead. The parameters are just like the other - functions except the ceiling and floor are returned through - pointers instead of a return value. - - getzsofslope(short sectnum, long x, long y, - long *ceilz, long *florz); - - - Fixed recently introduced hitscan divide overflow bug. - - - Fixed a sprite drawing clipping bug. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/17/95 - ATTENTION PROGRAMMERS: I moved the sprite shading code from - the engine into GAME/BSTUB. If you want sprites to shade - like they used to, be sure to copy the code I recently added - to the end of analyzesprites in GAME.C or ExtAnalyzeSprites - in BSTUB.C. - - - Added 2 new interesting functions to the engine to make moving - slope programming easier. These functions will align a slope - to a given (x, y, z) point. It will make the slope pass - through the point. The function will do nothing if the point - is collinear to the first wall of the sector. - - alignceilslope(short sectnum, long x, long y, long z); - and - alignflorslope(short sectnum, long x, long y, long z); -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/18/95 - Kgroup will now work with subdirectories. - - - ATTENTION PROGRAMMERS: I have not done this yet, but I am - planning on doing a new map version! Before I do it, I - want to give you a chance to give me any suggestions you may - have. The only changes I am planning on, besides re-arranging - the structures for better alignment is to give the slopes some - more bits precision. This may limit slopes to a maximum slope - of 4 (almost 76ø) which is still extremely high. Here are the - new structures that I am proposing: - - //40 bytes - typedef struct - { - long ceilingz, floorz; - unsigned short wallptr, wallnum; - short ceilingstat, floorstat; - short ceilingpicnum, ceilingheinum; - signed char ceilingshade; - char ceilingpal, ceilingxpanning, ceilingypanning; - short floorpicnum, floorheinum; - signed char floorshade; - char floorpal, floorxpanning, floorypanning; - char visibility, filler; - short lotag, hitag, extra; - } sectortype; - - //32 bytes - typedef struct - { - long x, y; - short point2, nextwall, nextsector, cstat; - short picnum, overpicnum; - signed char shade; - char pal, xrepeat, yrepeat, xpanning, ypanning; - short lotag, hitag, extra; - } walltype; - - //44 bytes - typedef struct - { - long x, y, z; - short cstat, picnum; - signed char shade; - char pal, clipdist, filler; - unsigned char xrepeat, yrepeat; - signed char xoffset, yoffset; - short sectnum, statnum; - short ang, owner, xvel, yvel, zvel; - short lotag, hitag, extra; - } spritetype; - - Note that I am adding 1 byte of filler to the sprite structure - (4K more) and 3 bytes of filler to the sector structure - (3K more). (If I'm a nice guy, one of those bytes may even - be use for fog. (DOH!)) - - - Fixed another wonderful hitscan divide bug. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/22/95 - Optimized slopes. On a 486-66 w/ local bus in VESA 2.0 320*200 - mode, a full screen slope was optimized from 24fps to 35fps! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/25/95 - Re-optimized some more assembly. - - - ATTENTION EVERYONE! CONVMAP7! You know what this means. Just - type "convmap7 *.map" and you'll be back in business. P.S. - enjoy the newly aligned structures! - - - ATTENTION PROGRAMMERS! New TRANSPAL! You can now use 2 levels - of transluscence by using just a single 64K transluscent - buffer, such as 33/67 and 67/33 transluscence. I changed the - format of palette.dat, so please run TRANSPAL before you try - running the game with the new OBJS! If you don't, the palette - tables will be screwed up. - - Old PALETTE.DAT: - 768 bytes - VGA palette - numshades*256 bytes - palookup[0] table - 32640 bytes- transluscent palette (smaller from symmetry) - - The way I used to get numshades (fun): - numshades = ((filelength-32640-768)>>8) - - New PALETTE.DAT: - 768 - VGA palette - 2 - numshades - numshades*256 - palookup[0] table - 65536 - transluscent table - - To keep things less confusing, could you all use a - transluscent constant >= 128. For example, I used 170 on - my PALETTE.DAT. - - - READ THIS! New bits added to things: - Bit 5 of rotatesprite, bit 9 of both sprite[].cstat - and bit 9 of wall[].cstat are now used for reverse - transluscence. - - - Added super-cool new feature to 2D EDIT MODE (that should have - been there from the start). Try inserting some points! - - - ATTENTION PROGRAMMERS! Removed overwritesprite. Use - rotatesprite instead. I don't want to support a function that - can totally be done with another better function. I will - eventually optimize rotatesprite for 90ø cases so it's even - faster than the current overwritesprite. If you're too lazy - to convert right now, then you can use this overwritesprite - stub function: - -overwritesprite (long thex, long they, short tilenum, - signed char shade, char stat, char dapalnum) -{ - rotatesprite(thex<<16,they<<16,65536L,(stat&8)<<7,tilenum,shade,dapalnum, - ((stat&1^1)<<4)+(stat&2)+((stat&4)>>2)+((stat&16)>>2)^((stat&8)>>1), - windowx1,windowy1,windowx2,windowy2); -} - - - Fixed the rotatesprite centerting bug in y-flipping mode. Oh - by the way, you know how I originally said the flipping bit - was x? Well, I screwed it up. It was actually y-flipping all - along. - - - This one's for hackers (N&P/Qs) In the engine, I call - getpalookup every time I need a pointer to a 256-byte - palookup table. One big limitation right now is that each - bunch of 256-byte tables has a limit of 64K because a shade - is being returned, not a 4-byte pointer. This means you - could have a maximum of 8 shades, with 8 fogs per palookup. - It's not as expandable as I originally intended since this is - a speed-critical function. It is called EVERY single time a - line is drawn - probably called 50 times more often than - faketimerhandler. - - #pragma aux bound32 =\ - "test eax, 0ffffffe0h",\ - "jz endit",\ - "cmp eax, 80000000h",\ - "sbb eax, eax",\ - "and eax, 31",\ - "endit:",\ - parm [eax]\ - - getpalookup(long davis, long dashade) - { - return(bound32(dashade+(davis>>8))); - } - - This is just a start. Eventually I hope to use some kind of - lookup table, such as: palookup = palptr[davis][dashade], - but I couldn't think of a good way to make the array small - enough for what people need. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/26/95 - Fixed drawmapview so it actually clips to the rectangular window - properly. It does not clip to startumost/startdmost so you - should call a rotatesprite to draw the status bar every frame - if it is not rectangular. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/30/95 - Fixed recently introduced mirror bug. - - - Fixed rotatesprite x-positioning bug in scale mode for weird - resolutions. - - - Fixed tilting for pure chained modes. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/2/95 - Changed setbrightness call: - - setbrightness(char dabrightness, char *dapal) - dabrightness is gamma level(0-15) - dapal is pointer to standard VGA 768 byte palette. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/3/95 - Fixed flicker in UNIVBE modes. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/6/95 - Added a global visibility variable to BUILD.H specific for - p-skies called parallaxvisibility. Now you can do lightning - effects without modifying the visibility for everything. - - - Really fixed the drawmapview window clipping this time. - - - Made my clearview function clip to the viewing window since it - is usually used just before the drawmapview function. - - - You can now use bit 6 (64) to tell rotatesprite whether or not - the tile has transparent regions or not. If there are no - transparent regions, then it would be faster to set this bit - because it doesn't have to check for color 255 at every pixel. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/11/95 - Back in RI! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/13/95 - Cleaned up setup program by having only 1 VESA menu for all - possible VESA modes. The engine will now auto-detect whether - or not your computer supports VESA 2.0. The screen buffer - menu now only supports 320*200. (I noticed that Mark's setup - program doesn't list 320*400 mode even though it is supported - by my game and UNIVBE. 320*400 is considered by some people - the next best mode after 320*200 and 640*480. You have my - permission to annoy him.) - - - I bought UNIVBE by credit card for $28! When you buy UNIVBE, - you don't have to struggle with beeps or date changing - and - it loads instantly. I try not to use TSR's whenever possible, - but I found that UNIVBE is worth wasting 8K. I don't think my - computer has ever crashed due to something related to UNIVBE. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/17/95 - Found an easy way to interpolate everything for faketimerhandler - in my game, including swinging doors, revolving doors, and - other moving sectors. My doanimations interpolation now uses - these functions instead. Check them out in my GAME: - - setinterpolation(long *posptr); //Call when door starts - stopinterpolation(long *posptr); //Call when door stops - updateinterpolations(); //Call at start of domovethings - dointerpolations() //Call at start of drawscreen - restoreinterpolations() //Call at end of drawscreen - - Call setinterpolation with a pointer to the long variable - being interpolated. If an object stops moving, you can - speed things up by calling stopinterpolation. For things - that always move, you can call setinterpolation in pre-map - and don't stopinterpolation for those things. Don't forget - to set numinterpolations to 0 in premap whenever changing - levels in the game. - - - Optimized lava. You can re-copy my code if you want. - - - Added auto screen-buffering mode for linear VESA modes. (In - case you didn't know, reading video memory can be 10 times - slower than reading non-video memory.) Auto-buffering - means that if the engine detects that more than 1/8th of the - screen has transluscence or mirrors, then it will switch into - a screen-buffering mode. Screen-buffer mode in linear VESA - not only will still have smooth page flipping, but will be - faster than standard screen buffer mode on some video cards - just because it's linear memory. (That's a good thing) - - - Optimized screen buffer modes so they copy only the viewing - window instead of the whole screen from non-video memory to - video memory. If a permanent sprite is written, as a special - case, it will copy the whole screen - but this doesn't affect - you. Me and my engine babble. - - - Moved the printext function out of the engine and into my game. - Use printext16/printext256 instead. - - - I tried removing chain mode twice and it didn't improve the frame - rates of the other modes at all. So it stays! If you don't - like it, then don't include it in your setup program. - - - Made allocatepermanenttile return 0 instead of -1 if something - bad happens. My GAME.C was crashing in windows with a memory - error because I was assuming all memory pointers were - positive. Please make sure your code will work if an - allocation function returns a negative pointer (Windows often - returns negative pointers). -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/19/95 - Tried to make pushmove work with face sprites, but it kept making - the player die too much. Also it presented some interesting - new problems, such as: You get pushed by your own bullets - that you just shot - and get this - if you don't temporarily - set yourself to non-blocking you kill yourself because you're - inside you're own sprite! So I have decided to comment out - this code for now. - - - Fixed hitscan bug with ceiling slopes. - - - ATTENTION PROGRAMMERS!!! PERMANENTWRITESPRITE was removed from - the engine and be put into my game as an emulated function. - If you still use permanentwritesprite, get the emulated - function out of my GAME.C. - - Drawing permanent areas is now easier than ever!!! Simply - call rotatesprite with bit 3 (&8) set or the - permanentwritesprite stub call, and the engine now - automatically takes care of copying the permanent region - to all necessary pages in the future. It even keeps track - of whether the call was before or after drawrooms! - I am using an internal fifo to back up the parameters for each - rotatesprite call. It can support up to 512 calls per - page right now. This number can get reached quicker than - you think, especially if you use fonts with shadows behind - each character. Permanentwritespritetile could also go - over the limit in hi-res modes since each tile is considered - a separate call. - I optimized out the case where an older rotatesprite region gets - completely covered by a newer rotatesprite region with bit 6 - (&64 for non-masking) set. Currently this has a few - limitations - such as the x, y, zoom, and ang must be the same - right now to knock out an older rotatesprite. - - - I corrected an off-by 1 error in my GAME.C for window size - calculations. I simply used more precision. Ex: - * changing (xdim>>1)-(screensize>>1) to ((xdim-screensize)>>1) - * using the scale function instead of a separate mul & div. - By the way, if you haven't already, please stick your screen - re-sizing code BEFORE drawrooms. It will make the screen - re-size update more responsively and you're less likely to get - drawing bugs. - - - Future plans for possible rotatesprite optimizations: - 1. Angle is 0, 512, 1024, 1536 - 2. Bit 6 (&64) is set for non-masking mode - 3. tilesizy[tilenum] is a power of 2 - 4. If coincidentally, x=34562, y=34682, and zoom=67275 -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/20/95 - Fixed vertical line shading bugs when looking at walls at harsh - angles. - - - Made masked walls clip to slopes properly. TRY IT! - (hope you didn't "BUILD" on this bug!) - - - Fixed overflow and precision bugs with extremely long walls. - I even got the chance to optimize out a multiply in the - wallmost clipping code! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/25/95 - Now absolutely everything in my game is being interpolated - for smooth play - including subways! No interpolation - disable variable exists any more. The setinterpolation - function is really easy to use. Try it! - - - Programmed VISIBILITY for slopes!!!!! On my P-100, the slopes - are almost as fast as they used to be. You can now start - adjusting the shades of slopes. - - - The shading lines on ceilings and floors now match to the shading - lines on walls. Before they didn't match. (oops). - - - - For those of you who want to program their own palette functions, - using my gamma correction lookup table, here's the code: - - extern char britable[16][64]; - - koutp(0x3c8,0); - for(i=0;i<768;i++) - koutp(0x3c9,britable[curbrightness][palette[i]]); - - If you use this code, don't bother calling setbrightness any - more. The only bad thing about programming this yourself - is that you lose support for red-blue glasses mode. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/26/95 - Added support for VESA 2.0 protected mode extensions. With the - protected mode extensions, the page-flipping is less likely to - flicker, if at all. This is because the retrace timing isn't - screwed up as badly as if it had to switch to real mode. - - - Fixed a weird buffer bug in my GAME.C. I was using tempbuf in - faketimerhandler/getpackets for sending packets. I was also - using tempbuf in many other places, such as my printext - function. Unfortunately, since rotatesprite is now called - for each character, faketimerhandler would sometimes get - called and the rest of the word got screwed up. Please make - sure you are not sharing any buffers in faketimerhandler / - getpackets with the rest of your code. - - - Fixed a bug for linear VESA modes. Now, the screen will update - properly when calling rotatesprite and nextpage for the first - time before any drawrooms calls. This used to not work right - at my "waiting for other players" code in this mode. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/27/95 - Did you notice I fixed some of the weird cases with slope drawing - in the last upload? I fixed things like when a ceiling of - one sector is partially below the floor of another, etc. - - - Fixed precision of shading lines on slopes. - - - Fixed visibility overflow when slopes are near horizons. This - means you won't see ugly bright pixels any more when you're - looking at a slope at an extremely sharp angle. - - - Fixed a bug in BUILD 3D EDIT MODE with slopes. Now when you - press '/' on a ceiling or floor slope, it stays straight - until you press [ or ] on it again. Before, sometimes the - ceiling would stupidly get sloped again if you pressed [ or ] - on the floor and vice versa. - - - Removed some unnecessary sounds from my game. This doesn't - really affect you people out there. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/30/95 - Fixed recently screwed up p-sky tiling. - - - Made Editart work with map version 7 for tile sorting and the - Alt-R command. Alt-R does not scan the heinum's of sectors - any more, and only adds in the overpicnum if a masked or - 1-way wall is actually defined on the map. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/31/95 - Fixed a bug with my slopalookup array. It was sometimes writing - up to 3 bytes after the end of the array. - - - Fixed recently screwed up p-sky tiling for real this time. - - - Permanentwritesprite is out of my game. Here it is just in case - I will need it again for future reference. - - permanentwritesprite (long thex, long they, short tilenum, - signed char shade, long cx1, long cy1, - long cx2, long cy2, char dapalnum) - { - rotatesprite(thex<<16,they<<16,65536L,0,tilenum,shade, - dapalnum,8+16,cx1,cy1,cx2,cy2); - } -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/1/95 - Guess what? I turned 20 today. This means I'm no longer a - teenage programming genius. Doesn't that just suck. If you - guys don't get a game out by the next time my age plus - plusses, I'm going to get really p-skied off and kill some - people. That would be bad. (When I say killing, I mean - virtual killing in the entertaining game of Ken-Build - in which a fun time is always had by all.) So put on your - happy fun smiles and work out all those rotatesprites, - fsyncsyncvel.bits, and interpolation fifos before it's - ototalclock! - - - Optimized the NON-MASKING cases of rotatesprite for - NON-(un)CHAINED modes. This means that low detail modes, - status bars, and permanent background tiles are now drawn - about as fast as they're ever going to be drawn! Try the - F5 key in my game to compare frame rates if you want. I have - not optimized guns and stuff yet. That's next on my list. - - - Made the engine call new internal functions, kmalloc and kfree, - instead of malloc or free. Unless you're a hacker and wrote - your own memory manager (like N&P/Qs) you can just ignore - this message. - void *kmalloc(size_t size) { return(malloc(size)); } - void kfree(void *buffer) { free(buffer); } - - - Supposedly fixed the new rotatesprite and linear vesa crashing - bugs. Since I'm not totally sure that I fixed the problems, - all I can do is hope that I don't get too many phone calls! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/4/95 - Did some neat optimizations that will make the drawing code - faster, especially in hi-res modes, but I'm sure nobody cares. - Instead I'm probably just going to get 10 totally different - bug report stories. So I'll be talking to you soon! - - - Fixed stupid bugs in cansee. If the 2 objects were in the same - place, sometimes it returned 1 even if it couldn't see you. - I made 2 fixes: - This one to fix overlapping: - - if ((xs == xe) && (ys == ye)) return(sects == secte); - - And I removed the early out return(1) optimization - I - put this after the big loop instead: - - for(i=danum-1;i>=0;i--) - if (clipsectorlist[i] == secte) return(1); -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/7/95 - Optimized the awful shld's out of my divscale's in pragmas.h. - You can update to the new pragmas.h if you actually use it. - - - Remember the lovely horizontal lines on top of face sprites. - Well you won't be seeing them any more. At least the case - I trapped works better than before. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/8/95 - Made krand generate better random seeds. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/9/95 - ATTENTION PROGRAMMERS! Moved part of stat bit 3 of rotatesprite - to bit 7. Have you noticed that your menu code was kind of - screwy in modes where numpages > 1? This is because I made - rotatesprite automatically copy to all pages whenever the - "don't clip to startmost's bit" (bit 3 or +8) was set in - the stat bit of rotatesprite. To give you more control, I - moved the auto copy to all pages bit to bit 7 and left bit 3 - as the don't clip to startmosts bit. If you want your code - to work the same as the last update of BUILD, simply go - through all your rotatesprite calls and add 128 in addition - to the stat bit whenever you were adding 8 before. See the - revised rotatesprite documentation: - -rotatesprite (long sx, long sy, long z, short a, short picnum, - signed char dashade, char dapalnum, char dastat, - long cx1, long cy1, long cx2, long cy2) - - (sx, sy) is the center of the sprite to draw defined as screen coordinates - shifted up by 16. In auto-scale mode, be sure that (sx, sy) is using - a 320*200 size screen even though the real resolution may be different. - (z) is the zoom. Normal zoom is 65536. > is zoomed in, < is zoomed out. - (a) is the angle (0 is straight up) - (picnum) is the tile number - (dashade) is shade number - (dapalnum) is the palookup number - - if ((dastat&1) != 0) - transluscence - if ((dastat&2) != 0) - auto-scale mode - Auto-scale mode will automatically scale from 320*200 resolution - coordinates to the clipping window passed (cx1, cy1, cx2, cy2). In - auto-scale mode, don't pre-scale the (sx, sy) coordinates. Simply pass - (sx, sy) as if the resolution was 320*200 even though it may be - different. This means that you shouldn't use xdim or ydim to get - (sx, sy). - if ((dastat&4) != 0) - y-flip image - if ((dastat&8) != 0) - don't clip to startumost/startdmost - if ((dastat&16) == 0) - use Editart center as point passed - if ((dastat&16) != 0) - force point passed to be top-left corner - if ((dastat&32) != 0) - use reverse transluscence - if ((dastat&64) == 0) - masked drawing (check 255's) (slower) - if ((dastat&64) != 0) - draw everything (don't check 255's) (faster) - if ((dastat&128) != 0) - automatically draws to all pages as they come - - (cx1, cy1, cx2, cy2) - The clipping window. These coordinates are never - scaled, not even in auto-scale mode. Usually you should pass them as - (windowx1,windowy1,windowx2,windowy2) for things scaled to the viewing - window or (0L,0L,xdim-1L,ydim-1L) for things scaled to full screen. - Probably the only time you wouldn't follow this rule is if you program - a non-scaled tiled background function. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -11/21/95 - Optimized cansee - before it was checking each red wall 2 times - as much as it needed to. Now it only checks the side facing - the first object passed to cansee. Since this optimization - is only 1 line, I don't think I messed anything up this time. - - - Made cansee not pass through 1-way walls. This means that the - order of points passed to cansee could give you different - results, but only for 1-way walls. - - - FIXED CRASHING AND PRECISION ON HIGH SLOPES!!! Try it for the - first time again! The bug was: In wallmost, if a slope's - line was getting clipped by both the top and bottom of the - screen, the x-intercept of the bottom was calculated wrong. - And if you were real lucky, if the x-intercept could have been - so wrong that a loop would happily overwrite random chunks of - memory. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/1/95 - In my GAME.C, made tilting zoom in smoothly as it rotates to - hide the ugly corners. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/4/95 - Made some more optimizations to rotatesprite - added more cases - for removing things from the permanent list early, such as: - any full screen rotatesprite with 64 knocks everything else - off the list, and any rotatesprites with zoom=65536,ang=0, - stat&64 will knock out anything totally under its rectangle. - These optimizations seemed to actually fix some bugs. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/10/95 - Well, well, well. It has now been 2 years since you know what - was released and Apogee still hasn't put out a (real) Build - game. Trivia of the year: Did you know that the first Build - game was originally scheduled to be released a month before - Doom was to be released? Maybe I should rename the "Build" - engine to the "ROTTT" engine because it's probably just going - to rot on my hard drive for another year until all the games - just get cancelled. PROVE ME WRONG! - - - Added selectable viewing angles - not locked at 90ø anymore! - Try playing around with the ( ) - = keys on the main keyboard - in my new BSTUB.C. See the example code in BSTUB for setaspect. - Use the setaspect function to control both the viewing range - angle and the y/x aspect ratio. - - setaspect(long daxrange, long daaspect) - - For a standard 90ø 320*200 screen, daxrange and daaspect are - 65536. For square aspect ratio at 320*400, set daaspect - to 131072. Since daxrange is actually zoom, you must - modify the aspect ratio inversely if you only want to - change the viewing angle. - - ATTENTION EVERYONE! To make parallaxing skies work with larger - than 90ø viewing ranges, I had to change some things around - in TABLES.DAT. Don't forget to update to the new one! The - new one is smaller because I removed a useless array. - - - Improved red-blue glasses mode by fixing some palette problems - and removing the overlap problem on the right side of the - screen. It still has some things wrong with it though. - - - Perfected screen tilting by using the new setaspect function. It - now tilts all 360ø smoothly with no zoom change and with no - ugly corners. This is possible only because you can now set - the viewing angle higher than 90ø. - - - Fixed a flicker bug with permanent rotatesprites in multi-page - modes. When rotatesprite was called because drawrooms in a - multipage mode, the rotatesprites were being called in the - wrong order from the fifo for the first page. Note that - before, the auto-knock out feature sometimes hid the problem. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/11/95 - Made EDITART work with the new TABLES.DAT. - - - Upgraded to Watcom 10.5. The engine is now about 1K larger, - and 0.0000001% faster. - - - Added some interesting compression routines to cache1d.obj, - dfread and dfwrite. These functions take the same parameters - as fread and fwrite respectively. These functions are useful - for loading/saving games or for recording demos. - - Note: Since these functions need to allocate 118K off of my LRU - cacheing system, you must not call them before - initcache(loadpics) is called. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/18/95 - Made rotatesprite use getpalookup to get the palette shade. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/31/95 - Cleaned up KGROUP.EXE and wrote a KEXTRACT.EXE utility. With - KEXTRACT, you can extract any files from a group file. - Note that in KGROUP, DOS handles the ? and * wildcards whereas - in KEXTRACT, I had to program the wildcards myself for finding - files inside the group file. The following combinations - should work: *.*, *.map, game.*, tiles???.art, *.k?? - - - NEW NETWORK METHODS! TRY MY GAME IN MULTIPLAYER MODE! MODEM! - - SUMMARY: Lag Time: ZERO! That's right Z.E.R.O. (0) - Smoothness: Perfect on ALL computers! - - My new network code builds upon everything you've already - programed with faketimerhandler, getpackets, movethings, and - domovethings, so you don't need to throw away any of that - great stuff. There are actually 2 totally separate things I - did to improve the multiplayer performance. First I added a - new network mode which sends packets in a different way (this - is way Doom actually does it) Then I found a way to reduce - lag-time to 0 with perfect smoothness. (Doom does NOT do - this, but G&S like it anyway for some reason.) I will first - describe the new network mode: - - ------------------------------------------------------------- - 1. First, let me describe the new network mode. Instead of - a master/slave system, every computer sends its own controls - to every other. You are currently using the master/slave - system which sends 2(n-1) packets per frame where n is the - number of players. My new network mode sends n(n-1) packets - per frame and treats every player evenly. See the chart - below of packets per frame: - - 2(n-1) method: n(n-1) method: - 2 players 2 2 - 3 players 4 6 - 4 players 6 12 - 5 players 8 20 (OUCH!) - 6 players 10 30 (OUCH!) - 7 players 12 42 (OUCH!) - 8 players 14 56 (OUCH!) - - - You may be asking why I am bothering you with this new - network method if it sends more packets then the old one? - I'll explain: With the old network method, slaves had to - wait for their packets to take 2 trips before they could move, - whereas with the new method the packets need to take only 1 - trip. Also with the new method the players are treated - evenly. For 2 players, the new network method is definitly - the mode of choice since it sends the same number of packets - AND the packets can be smaller since each computer only needs - to send its own controls to the other computer, not everyone's - controls (good for modem play). It's up to you what your - break even point is before you switch into the old network - method. I recommend: 1-4 New, 5+ Old. - Now let me explain how the new method REALLY works. Since - every computer must call the movement code in the same order - to stay in sync, all computers must wait until every packet - is received for that frame before it can actually go into - the movement code. You could say that all the computers are - half-slaves. Your computer should always be ahead of the - other computers. If you are player 0, the packets you - currently have might look like this: - - Chart for Player 0: - - Player 0 Player 1 Player 2 - Tic 0: GOTMINE------GOT--------GOT------> MOVE! - Tic 1: GOTMINE------GOT--------GOT------> MOVE! - Tic 2: GOTMINE--X WAITING... GOT CAN'T MOVE! - Tic 3: GOTMINE WAITING... WAITING... CAN'T MOVE! - Tic 4: GOTMINE WAITING... WAITING... CAN'T MOVE! - - As soon as player 0 receives player 1's next packet, - player 0 can call domovethings for tic 2. - One interesting complication of the new network method is - the timing. If for some reason player 0 sends packets faster - than player 1, then player 1 will have no lag and player 0 - will start with twice the normal lag which will increase - until bad things happen. See this chart: - - Player 0's side: | Player 1's side: - Player 0: Player 1: | Player 0: Player 1: - Tic 5: GOTMINE GOT (MOVE) | GOT GOTMINE (MOVE) - Tic 6: GOTMINE WAITING | GOT GOTMINE (MOVE) - Tic 7: GOTMINE WAITING | GOT GOTMINE (MOVE) - Tic 8: GOTMINE WAITING | GOT GOTMINE (MOVE) - Tic 9: GOTMINE WAITING | GOT GOTMINE (MOVE) - | GOT - | GOT - | GOT - - This can be corrected by sending a byte which tells the - other computer how many packets behind it is. You want the - other computer to be a little behind. Player 0's packet - delta in this case would be 4. Player 1's would be -3. - - Another interesting thing about this network method is - that a slave's packet cannot be skipped like in the - master/slave system. - - The actual code for everything described above is already - in my GAME.C and working perfectly. Go through the file - searching for the keyword, "networkmode". If it is non-zero, - that's the new mode. Look mainly at the section inside - faketimerhandler and case 17 of getpackets. - - (I've talked about "2(n-1)" and "n(n-1)" networking modes. - Believe it or not, it's possible to do a network mode as - low as an "n" mode. I haven't done it due to some - inherent problems. I'd be impressed if you can figure out - how this one works) - ------------------------------------------------------------- - 2. Now I'll type about the "KLAG-0 Technology" I promised you. - - The secret to life is, " - NO CARRIER - - Why do you have to wait for another computer to tell you - when to move when you already know where you want to go? - So I added a fake set of variables that simulate - where the player's x, y, z, and ang variables will be after - it does sync crap with other computers. I added a function - called fakedomovethings which is called in the same fashion - that domovethings would be called in a 1-player game. - Fakedomovethings modifies ONLY the fake x, y, z, and ang - variables. It is a shadow of the processinput function. It - only needs the parts of processinput that modify the position - of player[myconnectindex]. If it modifies real variables, - the game will get out of sync. - Sometimes the fake variables can get out of sync with the - real variables. This can happen if you walk into another - player or anything else that moves. This doesn't happen too - often though and when it does, there are things that you can - do to smooth out the jump to the right position. This brings - me to my other new function: fakedomovethingscorrect. - The easy way to correct the player's position in a smooth - way is to say something like: fakex += ((realx-fakex)>>3); - This would effectively move the player 1/8th of the way closer - to the real position. The problem with this method is that - the realx and fakex are not sampled at the same time, - therefore creating more error than isn't any. - So instead of comparing your fake position with where the - real position was a few tics ago, I chose to compare both - of them a few tics ago. FIFO time! To do this, I am keeping - a fifo of the new fake positions and comparing the positions - as the real positions come. Now that they're being compared - at the same tic, correction will only occur when you've truly - run into a moving object. - ------------------------------------------------------------- - I hope all this was as much fun for you to read as it was for - me to type. If you don't understand it, then I was probably - just trying to confuse you with all the possible word - combinations I could come up with that contain the letters in: - "fake", "sync", and "fifo". -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/6/96 - Made RT.SHIFT highlighting in build.obj not pick up non-existent - sprites in the selection rectangle. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/9/96 - Fixed a rare hitscan overflow bug for sectors that had a - ceiling&floor z-difference of more than 400000 z-units. - (About 20 stories tall) -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/15/96 - Changed something in rotatesprite so that status bars could be - clipped easily by using the clipping parameters. (I never - knew this didn't work until now) This change will only affect - your code if you were using bits 2+8 and the clipping window - was something other than the standard (0,0,xdim-1,ydim-1). - - - Improved fakedomovethingscorrect. Before when there was an - error, I was adding the difference into the current - position. This method conflicted with pushmove - where - sometimes it never fully corrected the position leaving you - stuck behind a wall. Now I make your position the position - it would have been if it had predicted the right position - several ticks ago. In other words, I set the my... variables - to the real, older position then call fakedomovethings for - every tic from the time of the real, older position up to - the current time. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/19/96 - Added snow reduction code to setpalette. It takes about 4 ms - to set a full palette. I write during the horizontal retrace - period to save time. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/23/96 - Added hack to loadboard to make it load a board only from the - group file if the last character of the filename is a 255. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -1/25/96 - Fixed a stupid bug in UNIVBE segmented modes so it doesn't - flicker anymore. Why didn't you guys tell me about this - sooner! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/1/96 - Optimized cansee according to Peter's suggestions. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/2/96 - Made setview calls not mess up the stereo vision variables. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/5/96 - ATTENTIONS ALL PROGRAMMERS!!! If you use use any VGA registers - (such as 0x3da, or 0x3c6 - 0x3c9), you will need to re-code - those sections of code. Please make your BSTUB's work with - this too! - - 1. If you use register 0x3da, limitrate, or qlimitrate, you - will need to do a special check to see whether or not the - video mode is VGA register compatible. If you do not - check this, then the computer may lock up because register - 0x3da simply doesn't change on certain video cards. - Unless you know the code won't be called in VESA mode, you - need to perform this check. Here's an example of how you - can do this check: - - Instead of calling limitrate (or your own 0x3da function): - limitrate(); - Do this: - //extern char vgacompatible; - if ((vidoption != 1) || (vgacompatible == 1)) limitrate(); - - 2. You must now use my function to set or get any palette - registers. This means that the keywords "3c7", "3c8", - and "3c9" should not even exist in your code. I really - didn't want to force you to use my palette functions, but - since VESA 2.0 supports non VGA compatible cards, you must - do it this way. If you use setbrightness for all of your - palette setting, then you can ignore this. Note that the - palette format here is VESA's palette format, which is - different than my other palette control functions. It's - 4 bytes and RGB are backwards. Here are the function - prototypes: - - VBE_setPalette(long palstart, long palnum, char *dapal); - VBE_getPalette(long palstart, long palnum, char *dapal); - palstart is the offset of the first palette to set - palnum is the number of the palette entries to set - dapal is a pointer to the palette buffer. The palette - buffer must be in this format: - char Blue, Green, Red, reserved; - I think this format stinks, but since VESA 2.0 uses - it, the code will run fastest if the buffer is not - copied. You can make your own cover up function if - you don't like this format. - - This example sets up a wasteful gray scale palette: - - char mypalette[1024]; - for(i=0;i<256;i++) - { - mypalette[i*4+0] = (i>>2); //Blue - mypalette[i*4+1] = (i>>2); //Green - mypalette[i*4+2] = (i>>2); //Red - mypalette[i*4+3] = 0; //reserved - } - VBE_setPalette(0,256,mypalette); -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/7/96 - Did some minor optimizations to functions that use cliptype. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/9/96 - ATTENTION PROGRAMMERS!!! There is no such thing as a cliptype - anymore! Instead you use clipmasks. Clipmasks are much better - because it gives you full control of which bits are used to - test whether or not a sprite or wall will block things. - - Let me refresh your memory on how cliptypes used to work: - For CLIPMOVE, PUSHMOVE, and GETZRANGE: - If (cliptype == 0) these bits were the blocking bits: - (wall[].cstat&1), (sprite[].cstat&1) - If (cliptype == 1) these bits were the blocking bits: - (wall[].cstat&64), (sprite[].cstat&256) - For HITSCAN, cliptype was not passed and assumed to be 1: - (wall[].cstat&64), (sprite[].cstat&256) - - Note that I added these 2 defines in BUILD.H: - #define CLIPMASK0 (((1L)<<16)+1L) - #define CLIPMASK1 (((256L)<<16)+64L) - - In order to make clipmasks work, I had to change the parameters - to these 4 important functions. CLIPMOVE, PUSHMOVE, GETZRANGE, - and HITSCAN. For CLIPMOVE, PUSHMOVE, and GETZRANGE, I simply - made the cliptype from a char to a long. For HITSCAN, I had to - add the clipmask parameter at the end. Here are the new function - prototypes: - -clipmove (long *x, long *y, long *z, short *sectnum, long xvect, long yvect, - long walldist, long ceildist, long flordist, unsigned long clipmask) - -pushmove (long *x, long *y, long *z, short *sectnum, - long walldist, long ceildist, long flordist, unsigned long clipmask) - -getzrange (long x, long y, long z, short sectnum, - long *ceilz, long *ceilhit, long *florz, long *florhit, - long walldist, unsigned long clipmask) - -hitscan (long xs, long ys, long zs, short sectnum, long vx, long vy, long vz, - short *hitsect, short *hitwall, short *hitsprite, - long *hitx, long *hity, long *hitz, unsigned long clipmask) - - You should convert your source code using these rules: - * For CLIPMOVE, PUSHMOVE, and GETZRANGE, look at the last - parameter. If it is a 0, then change it to say CLIPMASK0. - If it is a 1, then change it to say CLIPMASK1. - - * For HITSCAN, add a new parameter that says CLIPMASK1. - - * If you have your own movesprite function, then you will - need to make the cliptype parameter into a long variable. - - - If you want to set a range for hitscan, or optimize its - performance, you can now extern these 2 variables from - the engine. You can set them just before you call hitscan. - If you DO choose to screw around with these variables, then - you must set them before EVERY hitscan in your code. - I have them defaulting to a really high number, totally out - of range of the map, but not high enough for a subtraction - to overflow it. These variables are used in hitscan only - to compare whether the new hit is closer then the last one. - - long hitscangoalx = (1<<29)-1, hitscangoaly = (1<<29)-1; -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/13/96 - Fixed a bug in clipmove that showed up in the latest upload - related to sector searching. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/18/96 - Re-wrote waitforeverybody / case 250 of getpackets, so the slave - sends acknowledge packets in a better way. Before there was - a possibility of a slave sending an invalid acknowledge - packet if the last packet received was not 250. - - - ATTENTION PROGRAMMERS! Setgamemode now returns -1 if the mode - is invalid or 0 if it is valid. Since the engine no longer - quits to DOS from an invalid video mode, you must program the - -1 case or else the computer will probably lock up! -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -3/5/96 - Solved tile index corruption bug in EDITART. After looking at - the latest art files I have from you, It looks like SW has - this problem, but DUKE and BLOOD seem ok. Let me explain: - In Editart 'V' mode (with no tile report), when you use - INSERT or DELETE, it very quickly moves all tiles after the - cursor forward or back 1. With multiple art files, this - operation would be very slow, since I'd have to load and - save every art file after the current one. But I figured - out a way to still keep it fast - instead of reading and - writing all the later art files, I instead changed just the - headers that tell which tile indeces the art files start and - end with. This works nice when you have 1 big art file, or - only 1 person using EDITART to change stuff. - Unfortunately, some of you have been passing around - individual art files and this is where the problem comes in. - If either person used INSERT of DELETE in 'V' mode and passed - an individual art file to another person, the headers could - possibly conflict and cause strange lockups or crashes in - EDITART, BUILD, or GAME. - So I fixed the problem by making EDITART only change the - CURRENT art file. Insert mode will now delete the last - tile in the CURRENT art file, so be careful that the last - tile in the CURRENT art file is blank. Delete will now - insert a blank tile at the end of the CURRENT art file. - If your ART files are already corrupt, you can run - RSIZEART.EXE and agree on a number of tiles per file. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -4/27/96 - Fixed a bug where rotatesprite seemed to clip the tile - to the viewing window even though stat&8 (don't clip - to startumosts/startdmosts) was set. The problem was - actually related to an optimization in the VESA blitting - code that copies only the screen if it thinks nothing - was drawn outside of the viewing window. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/15/96 - I must have added a whole bunch of unnoticable optimizations - since the last time I typed stuff into this file, but since - I didn't keeping track of it, I couldn't tell you what they - were off hand. - - - I added support for the 'new' Crystal Eyes in such a way where - you don't have to mess with the timer. I use the real-time - clock (IRQ8) in order to avoid conflicts. Crystal Eyes mode - works only in VESA 2.0 modes with at least 4 pages. The nice - thing about this mode is that you can switch in and out of - it easily during the game. There are 2 very simple functions - and 3 variables you can extern. To use Crystal Eyes mode, - simply call initstereo(). Initstereo should be called after - setgamemode and the palette is loaded into the VGA. To - return back to normal mode, simply call uninitstereo(). - Here's what the code would look like: - - extern long stereomode, stereowidth, stereopixelwidth; - - if (KEYTOTOGGLESTEREOMODE) - { - KEYTOTOGGLESTEREOMODE = 0; - if (stereomode == 0) - initstereo(); - else - uninitstereo(); - } - - Notes: - * The following 2 variables can be changed any time, and - should always be >= 0. - - stereowidth: distance between left and right eyes - stereopixelwidth: parallax - pan offset in pixels between - left & right screens - - * initstereo automatically sets stereomode to nonzero and - uninitstereo automatically sets stereomode to 0. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/5/96 - Made cache1d.obj support up to 4 group files at the same time. - To use multiple group files, simply call initgroupfile again. - You need to uninitgroupfile only once. This is useful if - users want to add their own .ART, .VOC, or other files and - distribute it all in one file without telling people they - need to back up stuff. For example: - - Beginning of program: - initgroupfile("duke3d.grp"); - if (usergroupfile) - initgroupfile(usergroufile); - - End of program: - uninitgroupfile(); - - Here's the order cache1d will search for a file when - kopen4load is called. Remember that the second parameter - to kopen4load is the searchfirst parameter. If you set - this variable to non-zero, you can tell kopen4load to search - the main group file only. This is useful if invalid user - files are detected. - - if (searchfirst == 0) - { - 1. Look for it as a stand-alone file - 2. Look for it in the 4th group file (user group file) - 3. Look for it in the 3rd group file (user group file) - 4. Look for it in the 2nd group file (user group file) - } - 5. Look for it in the 1st groupfile ("duke3d.grp") - 6. If file still not found, return -1 - - - Fixed a stupid bug with choosing the side of a red line in BUILD - 2D edit mode. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -7/24/96 - Increased MAXTILES to 6144. Fixed some scrolling errors related - to MAXTILES in 'V' mode of EDITART and BUILD. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -8/20/96 - Made it possible to safely default to NORMAL mode 320*200 when - VESA is not supported or found. Check out the beginning of - my setup3dscreen function. It shows how you can offer the - player a choice of quitting to DOS or continuing in NORMAL - mode. It is very annoying when setting up multiplayer games - when the game always quits to DOS because somebody forgot - to load their VESA driver. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/6/96 - Moved internal function, setfirstwall, in BUILD.OBJ into - ENGINE.OBJ because it can be useful to game programmers. - This function sets the first wall of a sector to be the - wall index passed. This function is useful for setting - the hinge wall for slopes or relative alignment. (ALT-F - uses this function) Here's the function: - - setfirstwall(short sectnum, short newfirstwall) - - - Added a variable, clipmoveboxtracenum, to ENGINE.OBJ which can - be externed. As a special case, if you set it to 1 just - before calling clipmove, then clipmove will return when it - first hits a wall - in other words, the (x,y,z) that clipmove - returns will be before any sliding calculations occur. Be - sure to set clipmoveboxtracenum back to 3 after calling - clipmove. - - This is how it is defined in ENGINE.OBJ: - long clipmoveboxtracenum = 3; - - Example of calling clipmove with no sliding: - clipmoveboxtracenum = 1; - i = clipmove(...); - clipmoveboxtracenum = 3; -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -9/25/96 - Removed support for specially optimized TSENG, Paradise, and S3 - modes. If you want the engine to run as fast on these cards, - get Scitech Software's latest Vesa 2.0 driver. - - - ATTENTION PROGRAMMERS! Added video mode changing during the game. - I moved the option, xdim, and ydim parameters from initengine - into the setgamemode function. - - Here are the updated prototypes for the 2 functions: - initengine(); - setgamemode(char newvidoption, long newxdim, long newydim); - - You are free to call setgamemode as often as you like. If you - have very low memory, it's possible that the call will fail - and quit to DOS with one of those awful CACHE SPACE ALL LOCKED - UP messages. - - Note: When updating your code, be careful to not rely on - vidoption, xdim, of ydim being valid until your first - setgamemode call. If you're not careful with this, you may - get a divide by zero or something. I had a bug in my GAME.C - where I was calling setview between initengine and - setgamemode. I had to move setview after setgamemode. - - - Added function to the engine that returns all valid VESA modes. - - getvalidvesamodes(); - - This function prepares the list of valid VESA modes in these - new variables which I put in BUILD.H. This function needs to - only be called once, but it doesn't hurt to call it multiple - times since I have a flag that checks if it has already been - called. - - EXTERN long validmodecnt; - EXTERN short validmode[256]; - EXTERN long validmodexdim[256], validmodeydim[256]; - - validmodecnt - number of available 256 color VESA modes. - validmode[] - array of vesa mode numbers (640*480 is 0x101, etc.) - validmodexdim[] - array of x dimensions for each mode - validmodeydim[] - array of y dimensions for each mode - - In my GAME.C, I have code that cycles through all VESA modes - and screen buffer mode when you press F4. Search for the - keyword "//F4" to find it. - - Note: Be careful when you call setgamemode! Be sure that it - is not called inside any function of sub-function of - faketimerhandler because this would be in the middle of the - drawing code. Actually, the safest place to call setgamemode is - right after nextpage in your main drawing loop. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -12/13/96 - Fixed the nasty caching bug first found in the Plutonium version - of Duke3D. I was using copybuf when I should have been using - copybufbyte. - - - Made the '>' key in 3D EDIT MODE not lock up any more for - textures that have non power of 2 tilesizy's. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -2/12/97 - Optimized mirror code so it x-flips only the bounding rectangle - (x AND y). Actually calculates left & right boundaries instead - of using the horizontal line checking stuff which didn't really - work all the time anyway. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -5/22/97 - Frank noticed a divide overflow in clippoly when drawmapview was - in hi-res mode. -fixed by lowered precision from 16 to 12 - bits. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -6/2/97 - Added support for the Nuvision 3D-Spex stereo glasses. I renamed - initstereo to setstereo and got rid of uninitstereo. Here's - complete documentation for all of the new stereo glasses stuff: - - setstereo(0); //Set to default normal non-stereo mode - setstereo(1); //Use Stereographics Simuleyes (white line code) - setstereo(2); //Use Nuvision 3-D Spex stereo (uses LPT1) - - //You can extern these 2 variables from the engine to add - //your own stereo adjustment code - extern long stereowidth = 23040; - extern long stereopixelwidth = 28; - - It would be nice to allow the adjustment of these variables - inside the game, but if you're too lazy, it would be nice to - have some way of modifying it. - Please do not extern stereomode any more since I use it now - to uninit the old mode automatically. Use your own current - stereo mode variable. -ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ -10/4/97 - I have upgraded to Watcom 11.0. The only changes I had to make - in the engine were some "#pragma push" and "#pragma pop" - calls in BUILD.H since the default structure packing alignment - was moved from 1 to 8. The sector, wall, and sprite structures - are already aligned well and must remain the same for .MAP - files to remain compatible. - - - Increase MAXTILES for all utilities (EDITART,BUILD,GAME,etc.) to - 9216 for Xatrix. - - You may have some initial bugs with EDITART when you add new - tiles for the first time. I haven't touched the code in years - and I'm afraid if I did, I'd mess it up more. One bug I know - of is this: Let's say you have 256 tiles per art file, and - then you add 1 silly tile way up at picnum=8500. When you - save and quit, your directory may look like this: - - TILES000.ART - TILES001.ART - TILES002.ART - TILES029.ART - - When you load EDITART again, that 1 tile will not appear unless - you kind of mess with it and scroll around for a while. This - is because EDITART loads TILES###.ART files until 1 is not - found, meaning that it will stop when it doesn't find - TILES003.ART. There are probably some other nasty bugs like - this. To get around it, you could add 1 tile to the next file, - save and quit. Or you could use RSIZEART.EXE to make 1 huge - ART file, add 1 tile way up high (if you have enough memory), - and then run RSIZEART.EXE again to 256 tiles per file or - whatever you like. Remember that the ART files need to be split - in such a way that each individual .ART file must fit in - memory, or else EDITART will crash. - - - It's time I document how you can add voxels to the Build engine. - The code is not the cleanest, but at least it works. First - you must load each voxel into memory using the qloadkvx - function. You specify the filename of the .KVX file and an - index that you want to use to reference the voxel. You can - pack .KVX files in a .GRP file if you want. The index must - be in this range: 0 <= index < MAXVOXELS where MAXVOXELS is - currently 512. This index works sort of like a picnum, but I - have a totally separate array for these indeces so you don't - need to mess with your art file at all. Since qloadkvx - allocates memory off of my cacheing system, you must call it - after loadpics which allocates all memory. - - Function parameters: - void qloadkvx(long voxindex, char *filename) - - loadpics("tiles000.art"); - qloadkvx(0L,"voxel000.kvx"); - qloadkvx(1L,"voxel001.kvx"); - - Now to actually display the voxel, you need to set the - (sprite[?].cstat&48) to equal 48 like this: - sprite[?].cstat |= 48; - I have no special collision code for voxels. They are simply - treated as face sprites. - - If ((sprite[?].cstat&48) == 48) - You should set the sprite[?].picnum to equal the VOXEL - index of the voxel that you passed to qloadkvx. If you don't - do this you will see nothing. To handle this index remapping - it is a good idea to make some array like this: - short picnumtovox[MAXTILES]; - and save the array in some file (or in the .GRP file) - - Many other fields of the sprite structure also affect voxels, - such as: ang, shade, pal, xrepeat, yrepeat. - - Note: To view voxels in the Build editor, you will need to do - the same qloadkvx calls in your BSTUB.C. - - And now a warning: Voxels tend to draw the fastest when - they are tall and thin. For example, a telephone poll - would work just great. They slow down very quickly as - you add detail. This is why you don't see any large - voxels in SW and Blood. - - - Something you should know about this version of the engine: - Over the summer, I got a lot of pressure from GT to add - MMX support to the Build engine, so I bought a Pentium II. - I messed around with the code quite a bit and discovered - that MMX really didn't help at all. In fact, in some ways - it made the code slower. The problem is that the inner - loops of Build are already optimized really well. I have - found that MMX is useful only because it gives you extra - registers. Unfortunately, the Build loops don't need extra - registers since they aren't very complex. - Now there are 2 major differences between an old Pentium and - a Pentium II. A Pentium II is like a Pentium PRO with MMX. - So I tried to optimize Build for Pentium PRO's. I was - actually able to get about a 50% speed increase mostly due - to avoiding those awful partial stalls. But there are - SEVERAL catches: - - 1. First of all, you need to enable WRITE-COMBINING for - video memory to get all this extra speed. One popular - program which does this is FASTVID. You should be able - to find it easily on the net. If you do not enable - WRITE-COMBINING, the engine actually runs SLOWER than - the original version! Unfortunately, neither DOS nor - WINDOWS 95 enable WRITE-COMBINING by default, so you need to - load a driver. Even worse, if you're in WINDOWS 95, the - program which enables WRITE-COMBINING will crash because - you can only set the PPRO registers in Priviledge Level 0. - You can still enable WRITE-COMBINING in WINDOWS 95, but you - have to run the program in your AUTOEXEC.BAT file. I wish - you all good luck on getting the average user to be able - to accomplish this feat. Quake has the same problem. - You'll find the same thing in their documentation. - - 2. The second catch is that my code tries to auto-detect - whether you have a Pentium, Pentium MMX, Pentium PRO, of - Pentium II. Of course this means, that if you don't have - an Intel processor, it's possible that the auto-detect code - may crash. I haven't had the opportunity to test this - myself. And since I can never guarantee it will always work - I made a way for you to disable the new code altogether - should this happen. Here's how you disable the new code - in the Build engine: - - extern long dommxoverlay; //(from engine.obj) - - Before you first call initengine, set dommxoverlay = 0; - - The default is dommxoverlay = 1 and it will run the code. diff --git a/polymer-perf/eduke32/build/doc/buildinf.txt b/polymer-perf/eduke32/build/doc/buildinf.txt deleted file mode 100644 index 41a154e99..000000000 --- a/polymer-perf/eduke32/build/doc/buildinf.txt +++ /dev/null @@ -1,882 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. - -Build information to get you started: - -The first half of this file explains the .ART, .MAP, and PALETTE.DAT formats. -The second half has documentation about every BUILD engine function, what it - does, and what the parameters are. - --Ken S. - ------------------------------------------------------------------------------- -Documentation on Ken's .ART file format by Ken Silverman - - I am documenting my ART format to allow you to program your own custom -art utilites if you so desire. I am still planning on writing the script -system. - - All art files must have xxxxx###.ART. When loading an art file you -should keep trying to open new xxxxx###'s, incrementing the number, until -an art file is not found. - - -1. long artversion; - - The first 4 bytes in the art format are the version number. The current - current art version is now 1. If artversion is not 1 then either it's the - wrong art version or something is wrong. - -2. long numtiles; - - Numtiles is not really used anymore. I wouldn't trust it. Actually - when I originally planning art version 1 many months ago, I thought I - would need this variable, but it turned it is was unnecessary. To get - the number of tiles, you should search all art files, and check the - localtilestart and localtileend values for each file. - -3. long localtilestart; - - Localtilestart is the tile number of the first tile in this art file. - -4. long localtileend; - - Localtileend is the tile number of the last tile in this art file. - Note: Localtileend CAN be higher than the last used slot in an art - file. - - Example: If you chose 256 tiles per art file: - TILES000.ART -> localtilestart = 0, localtileend = 255 - TILES001.ART -> localtilestart = 256, localtileend = 511 - TILES002.ART -> localtilestart = 512, localtileend = 767 - TILES003.ART -> localtilestart = 768, localtileend = 1023 - -5. short tilesizx[localtileend-localtilestart+1]; - - This is an array of shorts of all the x dimensions of the tiles - in this art file. If you chose 256 tiles per art file then - [localtileend-localtilestart+1] should equal 256. - -6. short tilesizy[localtileend-localtilestart+1]; - - This is an array of shorts of all the y dimensions. - -7. long picanm[localtileend-localtilestart+1]; - - This array of longs stores a few attributes for each tile that you - can set inside EDITART. You probably won't be touching this array, but - I'll document it anyway. - - Bit: |31 24|23 16|15 8|7 0| - ----------------------------------------------------------------- - | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ----------------------------------------------------------------- - | Anim. | Signed char | Signed char | | Animate | - | Speed | Y-center | X-center | | number | - --------| offset | offset | |------------ - --------------------------------| ------------ - | Animate type:| - | 00 - NoAnm | - | 01 - Oscil | - | 10 - AnmFd | - | 11 - AnmBk | - ---------------- - You probably recognize these: - Animate speed - EDITART key: 'A', + and - to adjust - Signed char x&y offset - EDITART key: '`', Arrows to adjust - Animate number&type - EDITART key: +/- on keypad - -8. After the picanm's, the rest of the file is straight-forward rectangular - art data. You must go through the tilesizx and tilesizy arrays to find - where the artwork is actually stored in this file. - - Note: The tiles are stored in the opposite coordinate system than - the screen memory is stored. Example on a 4*4 file: - - Offsets: - ----------------- - | 0 | 4 | 8 |12 | - ----------------- - | 1 | 5 | 9 |13 | - ----------------- - | 2 | 6 |10 |14 | - ----------------- - | 3 | 7 |11 |15 | - ----------------- - - - ----------------------------------------------------------------------------- - If you wish to display the artwork, you will also need to load your -palette. To load the palette, simply read the first 768 bytes of your -palette.dat and write it directly to the video card - like this: - - Example: - long i, fil; - - fil = open("palette.dat",O_BINARY|O_RDWR,S_IREAD); - read(fil,&palette[0],768); - close(fil); - - outp(0x3c8,0); - for(i=0;i<768;i++) - outp(0x3c9,palette[i]); ------------------------------------------------------------------------------- - -Packet format for DUKE3D (specifically for network mode 1, n(n-1) mode): - -Example bunch of packets: -A B C D E F G H I J K L M N... O ---------------------------------------------------------------------- -d9 00 d9 11 01 00 - - - - - - - - - - 4f 16 31 -da 00 da 11 01 00 - - - - - - - - - - b2 b7 9d -db 00 db 11 01 00 - - - - - - - - - - b1 24 62 -dc 00 dc 11 01 00 - - - - - - - - - - ca 1d 58 -dd 00 dd 11 01 00 - - - - - - - - - - a9 94 14 -de 00 de 11 01 05 00 00 - - 03 00 - - - - c5 50 b9 -df 00 df 11 01 0f a1 ff fe 09 00 00 26 - - - e2 88 6f -e0 00 e0 11 01 04 - - - - fd ff - - - - 77 51 d7 -e1 00 e1 11 01 03 1f 00 ff 09 - - - - - - ac 14 b7 -e2 00 e2 11 01 0b 9c 00 fb 09 - - 24 - - - f8 6c 22 - -GAME sends fields D-N -MMULTI adds fields A-C and O for error correction. - -A: Packet count sending modulo 256 -B: Error state. Usually 0. To request a resend, bit 0 is set. In order - to catch up on networks, sending many packets is bad, so 2 packets - are sent in 1 IPX packet. To send 2 packets in 1 packet, bit 1 is set. - In special cases, this value may be different. -C: Packet count receiving modulo 256 - -D: Message header byte. These are all the possible values currently. You - are probably only interested in case 17. Note that fields E-N apply - to case 17 only. - 0: send movement info from master to slave (network mode 0 only) - 1: send movement info from slave to master (network mode 0 only) - 4: user-typed messages - 5: Re-start level with given parameters - 6: Send player name - 7: Play Remote Ridicule sound - 8: Re-start level with given parameters for a user map - 17: send movement info to everybody else (network mode 1 only) - 250: Wait for Everybody (Don't start until everybody's done loading) - 255: Player quit to DOS - -E: Timing byte used to calculate lag time. This prevents the 2 computer's - timers from drifting apart. - -F: Bits field byte. Fields G-M are sent only when certain bits - in this byte are set. - -G: X momentum update (2 bytes). Sent only if ((F&1) != 0) - -H: Y momentum update (2 bytes). Sent only if ((F&2) != 0) - -I: Angle momentum update (2 bytes). Sent only if ((F&4) != 0) - -J: The states of 8 different keys (1 byte). Sent only if ((F&8) != 0) -K: The states of 8 different keys (1 byte). Sent only if ((F&16) != 0) -L: The states of 8 different keys (1 byte). Sent only if ((F&32) != 0) -M: The states of 8 different keys (1 byte). Sent only if ((F&64) != 0) - -N: Sync checking byte. Useful for debugging programming errors. Can be a - variable number of bytes. Actual number of sync checking bytes is - calculated by length of the whole packet minus the rest of the bytes sent. - -O: CRC-16 - ------------------------------------------------------------------------------- -| @@@@@@@@@@@ @@@ @@@ @@@@@@@@@ @@@ @@@@@@@@@ | -| @@@@@@@@@@@@@ @@@ @@@ @@@@@@@@@ @@@ @@@@@@@@@@@ | -| @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@@@ | -| @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@ | -| @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ | -| @@@@@@@@@@@@@ @@@ @@@ @@@ @@@ @@@ @@@ | -| @@@@@@@@@@@@@ @@@ @@@ @@@ @@@ @@@ @@@ | -| @@@ @@@@ @@@ @@@ @@@ @@@ @@@ @@@ | -| @@@ @@@ @@@ @@@ @@@ @@@ @@@ @@@@ | -| @@@ @@@@ @@@@ @@@@ @@@ @@@ @@@ @@@@@ | -| @@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@ | -| @@@@@@@@@@@ @@@@@@@ @@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@ | -| | -| M A P F O R M A T ! | ------------------------------------------------------------------------------- - -Here is Ken's documentation on the COMPLETE BUILD map format: -BUILD engine and editor programmed completely by Ken Silverman - -Here's how you should read a BUILD map file: -{ - fil = open(???); - - //Load map version number (current version is 7L) - read(fil,&mapversion,4); - - //Load starting position - read(fil,posx,4); - read(fil,posy,4); - read(fil,posz,4); //Note: Z coordinates are all shifted up 4 - read(fil,ang,2); //All angles are from 0-2047, clockwise - read(fil,cursectnum,2); //Sector of starting point - - //Load all sectors (see sector structure described below) - read(fil,&numsectors,2); - read(fil,§or[0],sizeof(sectortype)*numsectors); - - //Load all walls (see wall structure described below) - read(fil,&numwalls,2); - read(fil,&wall[0],sizeof(walltype)*numwalls); - - //Load all sprites (see sprite structure described below) - read(fil,&numsprites,2); - read(fil,&sprite[0],sizeof(spritetype)*numsprites); - - close(fil); -} - - ------------------------------------------------------------- - | @@@@@@@ @@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@ @@@@@@@ | - | @@ @@ @@ @@ @@ @@ @@ @@@ @@ | - | @@@@@@@ @@@@@ @@ @@ @@ @@ @@@@@@@ @@@@@@@ | - | @@ @@ @@ @@ @@ @@ @@ @@@ @@ | - | @@@@@@@ @@@@@@@ @@@@@@@ @@ @@@@@@@ @@ @@ @@@@@@@ | - ------------------------------------------------------------- - - //sizeof(sectortype) = 40 -typedef struct -{ - short wallptr, wallnum; - long ceilingz, floorz; - short ceilingstat, floorstat; - short ceilingpicnum, ceilingheinum; - signed char ceilingshade; - char ceilingpal, ceilingxpanning, ceilingypanning; - short floorpicnum, floorheinum; - signed char floorshade; - char floorpal, floorxpanning, floorypanning; - char visibility, filler; - short lotag, hitag, extra; -} sectortype; -sectortype sector[1024]; - -wallptr - index to first wall of sector -wallnum - number of walls in sector -z's - z coordinate (height) of ceiling / floor at first point of sector -stat's - bit 0: 1 = parallaxing, 0 = not "P" - bit 1: 1 = sloped, 0 = not - bit 2: 1 = swap x&y, 0 = not "F" - bit 3: 1 = double smooshiness "E" - bit 4: 1 = x-flip "F" - bit 5: 1 = y-flip "F" - bit 6: 1 = Align texture to first wall of sector "R" - bits 7-15: reserved -picnum's - texture index into art file -heinum's - slope value (rise/run) (0-parallel to floor, 4096-45 degrees) -shade's - shade offset of ceiling/floor -pal's - palette lookup table number (0 - use standard colors) -panning's - used to align textures or to do texture panning -visibility - determines how fast an area changes shade relative to distance -filler - useless byte to make structure aligned -lotag, hitag, extra - These variables used by the game programmer only - - - ----------------------------------------------- - | @@ @@ @@@@@@@@ @@ @@ @@@@@@@ | - | @@ @@ @@ @@ @@ @@ @@ | - | @@ @@ @@ @@@@@@@@ @@ @@ @@@@@@@ | - | @@ @@@@ @@ @@ @@ @@ @@ @@ | - | @@@ @@@@ @@ @@ @@@@@@@ @@@@@@@ @@@@@@@ | - ----------------------------------------------| - - //sizeof(walltype) = 32 -typedef struct -{ - long x, y; - short point2, nextwall, nextsector, cstat; - short picnum, overpicnum; - signed char shade; - char pal, xrepeat, yrepeat, xpanning, ypanning; - short lotag, hitag, extra; -} walltype; -walltype wall[8192]; - -x, y: Coordinate of left side of wall, get right side from next wall's left side -point2: Index to next wall on the right (always in the same sector) -nextwall: Index to wall on other side of wall (-1 if there is no sector) -nextsector: Index to sector on other side of wall (-1 if there is no sector) -cstat: - bit 0: 1 = Blocking wall (use with clipmove, getzrange) "B" - bit 1: 1 = bottoms of invisible walls swapped, 0 = not "2" - bit 2: 1 = align picture on bottom (for doors), 0 = top "O" - bit 3: 1 = x-flipped, 0 = normal "F" - bit 4: 1 = masking wall, 0 = not "M" - bit 5: 1 = 1-way wall, 0 = not "1" - bit 6: 1 = Blocking wall (use with hitscan / cliptype 1) "H" - bit 7: 1 = Transluscence, 0 = not "T" - bit 8: 1 = y-flipped, 0 = normal "F" - bit 9: 1 = Transluscence reversing, 0 = normal "T" - bits 10-15: reserved -picnum - texture index into art file -overpicnum - texture index into art file for masked walls / 1-way walls -shade - shade offset of wall -pal - palette lookup table number (0 - use standard colors) -repeat's - used to change the size of pixels (stretch textures) -pannings - used to align textures or to do texture panning -lotag, hitag, extra - These variables used by the game programmer only - - ------------------------------------------------------------- - | @@@@@@@ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@ | - | @@ @@ @@ @@ @@@ @@ @@ @@ @@ | - | @@@@@@@ @@@@@@@ @@@@@@@ @@ @@ @@@@@ @@@@@@@ | - | @@ @@ @@ @@ @@ @@ @@ @@ | - | @@@@@@@ @@ @@ @@ @@@@@@ @@ @@@@@@@ @@@@@@@ | - ------------------------------------------------------------- - - //sizeof(spritetype) = 44 -typedef struct -{ - long x, y, z; - short cstat, picnum; - signed char shade; - char pal, clipdist, filler; - unsigned char xrepeat, yrepeat; - signed char xoffset, yoffset; - short sectnum, statnum; - short ang, owner, xvel, yvel, zvel; - short lotag, hitag, extra; -} spritetype; -spritetype sprite[4096]; -x, y, z - position of sprite - can be defined at center bottom or center -cstat: - bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B" - bit 1: 1 = transluscence, 0 = normal "T" - bit 2: 1 = x-flipped, 0 = normal "F" - bit 3: 1 = y-flipped, 0 = normal "F" - bits 5-4: 00 = FACE sprite (default) "R" - 01 = WALL sprite (like masked walls) - 10 = FLOOR sprite (parallel to ceilings&floors) - bit 6: 1 = 1-sided sprite, 0 = normal "1" - bit 7: 1 = Real centered centering, 0 = foot center "C" - bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H" - bit 9: 1 = Transluscence reversing, 0 = normal "T" - bits 10-14: reserved - bit 15: 1 = Invisible sprite, 0 = not invisible -picnum - texture index into art file -shade - shade offset of sprite -pal - palette lookup table number (0 - use standard colors) -clipdist - the size of the movement clipping square (face sprites only) -filler - useless byte to make structure aligned -repeat's - used to change the size of pixels (stretch textures) -offset's - used to center the animation of sprites -sectnum - current sector of sprite -statnum - current status of sprite (inactive/monster/bullet, etc.) - -ang - angle the sprite is facing -owner, xvel, yvel, zvel, lotag, hitag, extra - These variables used by the - game programmer only ------------------------------------------------------------------------------- - - - - ------------------------------------------------------------------------------ -| IMPORTANT ENGINE FUNCTIONS: | ------------------------------------------------------------------------------ - -initengine() - Initializes many variables for the BUILD engine. You should call this - once before any other functions of the BUILD engine are used. - -uninitengine(); - Frees buffers. You should call this once at the end of the program - before quitting to dos. - -loadboard(char *filename, long *posx, long *posy, long *posz, short *ang, short *cursectnum) -saveboard(char *filename, long *posx, long *posy, long *posz, short *ang, short *cursectnum) - Loads/saves the given board file from memory. Returns -1 if file not - found. If no extension is given, .MAP will be appended to the filename. - -loadpics(char *filename); - Loads the given artwork file into memory for the BUILD engine. - Returns -1 if file not found. If no extension is given, .ART will - be appended to the filename. - -loadtile(short tilenum) - Loads a given tile number from disk into memory if it is not already in - memory. This function calls allocache internally. A tile is not in the - cache if (waloff[tilenum] == 0) - ------------------------------------------------------------------------------ -| SCREEN STATUS FUNCTIONS: | ------------------------------------------------------------------------------ - -setgamemode(char vidoption, long xdim, long ydim); - This function sets the video mode to 320*200*256color graphics. - Since BUILD supports several different modes including mode x, - mode 13h, and other special modes, I don't expect you to write - any graphics output functions. (Soon I have all the necessary - functions) If for some reason, you use your own graphics mode, - you must call this function again before using the BUILD drawing - functions. - - vidoption can be anywhere from 0-6 - xdim,ydim can be any vesa resolution if vidoption = 1 - xdim,ydim must be 320*200 for any other mode. - (see graphics mode selection in my setup program) - -setview(long x1, long y1, long x2, long y2) - Sets the viewing window to a given rectangle of the screen. - Example: For full screen 320*200, call like this: setview(0L,0L,319L,199L); - -nextpage(); - This function flips to the next video page. After a screen is prepared, - use this function to view the screen. - ------------------------------------------------------------------------------ -| DRAWING FUNCTIONS: | ------------------------------------------------------------------------------ - -drawrooms(long posx, long posy, long posz, short ang, long horiz, short cursectnum) - This function draws the 3D screen to the current drawing page, - which is not yet shown. This way, you can overwrite some things - over the 3D screen such as a gun. Be sure to call the drawmasks() - function soon after you call the drawrooms() function. To view - the screen, use the nextpage() function. The nextpage() function - should always be called sometime after each draw3dscreen() - function. - -drawmasks(); - This function draws all the sprites and masked walls to the current - drawing page which is not yet shown. The reason I have the drawing - split up into these 2 routines is so you can animate just the - sprites that are about to be drawn instead of having to animate - all the sprites on the whole board. Drawrooms() prepares these - variables: spritex[], spritey[], spritepicnum[], thesprite[], - and spritesortcnt. Spritesortcnt is the number of sprites about - to be drawn to the page. To change the sprite's picnum, simply - modify the spritepicnum array If you want to change other parts - of the sprite structure, then you can use the thesprite array to - get an index to the actual sprite number. - -clearview(long col) - Clears the current video page to the given color - -clearallviews(long col) - Clears all video pages to the given color - -drawmapview (long x, long y, long zoom, short ang) - Draws the 2-D texturized map at the given position into the viewing window. - -rotatesprite (long sx, long sy, long z, short a, short picnum, - signed char dashade, char dapalnum, char dastat, - long cx1, long cy1, long cx2, long cy2) - (sx, sy) is the center of the sprite to draw defined as - screen coordinates shifted up by 16. - (z) is the zoom. Normal zoom is 65536. - Ex: 131072 is zoomed in 2X and 32768 is zoomed out 2X. - (a) is the angle (0 is straight up) - (picnum) is the tile number - (dashade) is 0 normally but can be any standard shade up to 31 or 63. - (dapalnum) can be from 0-255. - if ((dastat&1) == 0) - no transluscence - if ((dastat&1) != 0) - transluscence - if ((dastat&2) == 0) - don't scale to setview's viewing window - if ((dastat&2) != 0) - scale to setview's viewing window (windowx1,etc.) - if ((dastat&4) == 0) - nuttin' special - if ((dastat&4) != 0) - y-flip image - if ((dastat&8) == 0) - clip to startumost/startdmost - if ((dastat&8) != 0) - don't clip to startumost/startdmost - if ((dastat&16) == 0) - use Editart center as point passed - if ((dastat&16) != 0) - force point passed to be top-left corner - if ((dastat&32) == 0) - nuttin' special - if ((dastat&32) != 0) - use reverse transluscence - if ((dastat&64) == 0) - masked drawing (check 255's) (slower) - if ((dastat&64) != 0) - draw everything (don't check 255's) (faster) - if ((dastat&128) == 0) - nuttin' special - if ((dastat&128) != 0) - automatically draw to all video pages - - Note: As a special case, if both ((dastat&2) != 0) and ((dastat&8) != 0) - then rotatesprite will scale to the full screen (0,0,xdim-1,ydim-1) - rather than setview's viewing window. (windowx1,windowy1,etc.) This - case is useful for status bars, etc. - - Ex: rotatesprite(160L<<16,100L<<16,65536,totalclock<<4, - DEMOSIGN,2,50L,50L,270L,150L); - This example will draw the DEMOSIGN tile in the center of the - screen and rotate about once per second. The sprite will only - get drawn inside the rectangle from (50,50) to (270,150) - -drawline256(long x1, long y1, long x2, long y2, char col) - Draws a solid line from (x1,y1) to (x2,y2) with color (col) - For this function, screen coordinates are all shifted up 16 for precision. - -printext256(long xpos, long ypos, short col, short backcol, - char *message, char fontsize) - Draws a text message to the screen. - (xpos,ypos) - position of top left corner - col - color of text - backcol - background color, if -1, then background is transparent - message - text message - fontsize - 0 - 8*8 font - 1 - 4*6 font - ------------------------------------------------------------------------------ -| MOVEMENT COLLISION FUNCTIONS: | ------------------------------------------------------------------------------ - -clipmove(long *x, long *y, long *z, short *sectnum, long xvect, long yvect, - long walldist, long ceildist, long flordist, unsigned long cliptype) - Moves any object (x, y, z) in any direction at any velocity and will - make sure the object will stay a certain distance from walls (walldist) - Pass the pointers of the starting position (x, y, z). Then - pass the starting position's sector number as a pointer also. - Also these values will be modified accordingly. Pass the - direction and velocity by using a vector (xvect, yvect). - If you don't fully understand these equations, please call me. - xvect = velocity * cos(angle) - yvect = velocity * sin(angle) - Walldist tells how close the object can get to a wall. I use - 128L as my default. If you increase walldist all of a sudden - for a certain object, the object might leak through a wall, so - don't do that! - Cliptype is a mask that tells whether the object should be clipped - to or not. The lower 16 bits are anded with wall[].cstat and the higher - 16 bits are anded with sprite[].cstat. - - Clipmove can either return 0 (touched nothing) - 32768+wallnum (wall first touched) - 49152+spritenum (sprite first touched) - -pushmove (long *x, long *y, long *z, short *sectnum, - long walldist, long ceildist, long flordist, unsigned long cliptype) - This function makes sure a player or monster (defined by x, y, z, sectnum) - is not too close to a wall. If it is, then it attempts to push it away. - If after 256 tries, it is unable to push it away, it returns -1, in which - case the thing should gib. - -getzrange(long x, long y, long z, short sectnum, - long *ceilz, long *ceilhit, - long *florz, long *florhit, - long walldist, unsigned long cliptype) - - Use this in conjunction with clipmove. This function will keep the - player from falling off cliffs when you're too close to the edge. This - function finds the highest and lowest z coordinates that your clipping - BOX can get to. It must search for all sectors (and sprites) that go - into your clipping box. This method is better than using - sector[cursectnum].ceilingz and sector[cursectnum].floorz because this - searches the whole clipping box for objects, not just 1 point. - Pass x, y, z, sector normally. Walldist can be 128. Cliptype is - defined the same way as it is for clipmove. This function returns the - z extents in ceilz and florz. It will return the object hit in ceilhit - and florhit. Ceilhit and florhit will also be either: - 16384+sector (sector first touched) or - 49152+spritenum (sprite first touched) - -hitscan(long xstart, long ystart, long zstart, short startsectnum, - long vectorx, long vectory, long vectorz, - short *hitsect, short *hitwall, short *hitsprite, - long *hitx, long *hity, long *hitz); - - Pass the starting 3D position: - (xstart, ystart, zstart, startsectnum) - Then pass the 3D angle to shoot (defined as a 3D vector): - (vectorx, vectory, vectorz) - Then set up the return values for the object hit: - (hitsect, hitwall, hitsprite) - and the exact 3D point where the ray hits: - (hitx, hity, hitz) - - How to determine what was hit: - * Hitsect is always equal to the sector that was hit (always >= 0). - - * If the ray hits a sprite then: - hitsect = thesectornumber - hitsprite = thespritenumber - hitwall = -1 - - * If the ray hits a wall then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = thewallnumber - - * If the ray hits the ceiling of a sector then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = -1 - vectorz < 0 - (If vectorz < 0 then you're shooting upward which means - that you couldn't have hit a floor) - - * If the ray hits the floor of a sector then: - hitsect = thesectornumber - hitsprite = -1 - hitwall = -1 - vectorz > 0 - (If vectorz > 0 then you're shooting downard which means - that you couldn't have hit a ceiling) - -neartag(long x, long y, long z, short sectnum, short ang, //Starting position & angle - short *neartagsector, //Returns near sector if sector[].tag != 0 - short *neartagwall, //Returns near wall if wall[].tag != 0 - short *neartagsprite, //Returns near sprite if sprite[].tag != 0 - long *neartaghitdist, //Returns actual distance to object (scale: 1024=largest grid size) - long neartagrange, //Choose maximum distance to scan (scale: 1024=largest grid size) - char tagsearch) //1-lotag only, 2-hitag only, 3-lotag&hitag - Neartag works sort of like hitscan, but is optimized to - scan only close objects and scan only objects with - tags != 0. Neartag is perfect for the first line of your space bar code. - It will tell you what door you want to open or what switch you want to - flip. - -cansee(long x1, long y1, long z1, short sectnum1, - long x2, long y2, long z2, short sectnum2); returns 0 or 1 - This function determines whether or not two 3D points can "see" each - other or not. All you do is pass it the coordinates of a 3D line defined - by two 3D points (with their respective sectors) The function will return - a 1 if the points can see each other or a 0 if there is something blocking - the two points from seeing each other. This is how I determine whether a - monster can see you or not. Try playing DOOM1.DAT to fully enjoy this - great function! - -updatesector(long x, long y, §num); - This function updates the sector number according to the x and y values - passed to it. Be careful when you use this function with sprites because - remember that the sprite's sector number should not be modified directly. - If you want to update a sprite's sector, I recomment using the setsprite - function described below. - -inside(long x, long y, short sectnum); - Tests to see whether the overhead point (x, y) is inside sector (sectnum) - Returns either 0 or 1, where 1 means it is inside, and 0 means it is not. - -clipinsidebox(long x, long y, short wallnum, long walldist) - Returns TRUE only if the given line (wallnum) intersects the square with - center (x,y) and radius, walldist. - -dragpoint(short wallnum, long newx, long newy); - This function will drag a point in the exact same way a point is dragged - in 2D EDIT MODE using the left mouse button. Simply pass it which wall - to drag and then pass the new x and y coordinates for that point. - Please use this function because if you don't and try to drag points - yourself, I can guarantee that it won't work as well as mine and you - will get confused. Note: Every wall of course has 2 points. When you - pass a wall number to this function, you are actually passing 1 point, - the left side of the wall (given that you are in the sector of that wall) - Got it? - ------------------------------------------------------------------------------ -| MATH HELPER FUNCTIONS: | ------------------------------------------------------------------------------ - -krand() - Random number function - returns numbers from 0-65535 - -ksqrt(long num) - Returns the integer square root of the number. - -getangle(long xvect, long yvect) - Gets the angle of a vector (xvect,yvect) - These are 2048 possible angles starting from the right, going clockwise - -rotatepoint(long xpivot, long ypivot, long x, long y, - short daang, long *x2, long *y2); - This function is a very convenient and fast math helper function. - Rotate points easily with this function without having to juggle your - cosines and sines. Simply pass it: - - Input: 1. Pivot point (xpivot,ypivot) - 2. Original point (x,y) - 3. Angle to rotate (0 = nothing, 512 = 90ø CW, etc.) - Output: 4. Rotated point (*x2,*y2) - -lastwall(short point); - Use this function as a reverse function of wall[].point2. In order - to save memory, my walls are only on a single linked list. - -nextsectorneighborz(short sectnum, long thez, short topbottom, short direction) - This function is used to tell where elevators should stop. It searches - nearby sectors for the next closest ceilingz or floorz it should stop at. - sectnum - elevator sector - thez - current z to start search from - topbottom - search ceilingz's/floorz's only - direction - search upwards/downwards - -getceilzofslope(short sectnum, long x, long y) -getflorzofslope(short sectnum, long x, long y) -getzsofslope(short sectnum, long x, long y, long *ceilz, long *florz) - These 3 functions get the height of a ceiling and/or floor in a sector - at any (x,y) location. Use getzsofslope only if you need both the ceiling - and floor. - -alignceilslope(short sectnum, long x, long y, long z) -alignflorslope(short sectnum, long x, long y, long z) - Given a sector and assuming it's first wall is the pivot wall of the slope, - this function makes the slope pass through the x,y,z point. One use of - this function is used for sin-wave floors. - ------------------------------------------------------------------------------ -| SPRITE FUNCTIONS: | ------------------------------------------------------------------------------ - -insertsprite(short sectnum, short statnum); //returns (short)spritenum; - Whenever you insert a sprite, you must pass it the sector - number, and a status number (statnum). The status number can be any - number from 0 to MAXSTATUS-1. Insertsprite works like a memory - allocation function and returns the sprite number. - -deletesprite(short spritenum); - Deletes the sprite. - -changespritesect(short spritenum, short newsectnum); - Changes the sector of sprite (spritenum) to the - newsector (newsectnum). This function may become - internal to the engine in the movesprite function. But - this function is necessary since all the sectors have - their own doubly-linked lists of sprites. - -changespritestat(short spritenum, short newstatnum); - Changes the status of sprite (spritenum) to status - (newstatus). Newstatus can be any number from 0 to MAXSTATUS-1. - You can use this function to put a monster on a list of active sprites - when it first sees you. - -setsprite(short spritenum, long newx, long newy, long newz); - This function simply sets the sprite's position to a specified - coordinate (newx, newy, newz) without any checking to see - whether the position is valid or not. You could directly - modify the sprite[].x, sprite[].y, and sprite[].z values, but - if you use my function, the sprite is guaranteed to be in the - right sector. - ------------------------------------------------------------------------------ -| CACHE FUNCTIONS: | ------------------------------------------------------------------------------ -initcache(long dacachestart, long dacachesize) - First allocate a really large buffer (as large as possible), then pass off - the memory bufer the initcache - dacachestart: 32-bit offset in memory of start of cache - dacachesize: number of bytes that were allocated for the cache to use - -allocache (long *bufptr, long bufsiz, char *lockptr) - *bufptr = pointer to 4-byte pointer to buffer. This - allows allocache to remove previously allocated things - from the cache safely by setting the 4-byte pointer to 0. - bufsiz = number of bytes to allocate - *lockptr = pointer to locking char which tells whether - the region can be removed or not. If *lockptr = 0 then - the region is not locked else its locked. - ------------------------------------------------------------------------------ -| GROUP FILE FUNCTIONS: | ------------------------------------------------------------------------------ -initgroupfile(char *filename) - Tells the engine what the group file name is. - You should call this before any of the following group file functions. -uninitgroupfile() - Frees buffers. You should call this once at the end of the program - before quitting to dos. - -kopen4load(char *filename, char searchfirst) - Open a file. First tries to open a stand alone file. Then searches for - it in the group file. If searchfirst is nonzero, it will check the group - file only. - -kread(long handle, void *buffer, long leng) -klseek(long handle, long offset, long whence) -kfilelength(long handle) -kclose(long handle) - These 4 functions simply shadow the dos file functions - they - can do file I/O on the group file in addition to stand-along files. - ------------------------------------------------------------------------------ -| COMMUNICATIONS FUNCTIONS: | ------------------------------------------------------------------------------ - Much of the following code is to keep compatibity with older network code: - -initmultiplayers(char damultioption, char dacomrateoption, char dapriority) - The parameters are ignored - just pass 3 0's -uninitmultiplayers() Does nothing - -sendpacket(long other, char *bufptr, long messleng) - other - who to send the packet to - bufptr - pointer to message to send - messleng - length of message -short getpacket (short *other, char *bufptr) - returns the number of bytes of the packet received, 0 if no packet - other - who the packet was received from - bufptr - pointer to message that was received - -sendlogon() Does nothing -sendlogoff() - Sends a packet to everyone else where the - first byte is 255, and the - second byte is myconnectindex - -getoutputcirclesize() Does nothing - just a stub function, returns 0 -setsocket(short newsocket) Does nothing - -flushpackets() - Clears all packet buffers -genericmultifunction(long other, char *bufptr, long messleng, long command) - Passes a buffer to the commit driver. This command provides a gateway - for game programmer to access COMMIT directly. - ------------------------------------------------------------------------------ -| PALETTE FUNCTIONS: | ------------------------------------------------------------------------------ -VBE_setPalette(long start, long num, char *palettebuffer) -VBE_getPalette(long start, long num, char *palettebuffer) - Set (num) palette palette entries starting at (start) - palette entries are in a 4-byte format in this order: - 0: Blue (0-63) - 1: Green (0-63) - 2: Red (0-63) - 3: Reserved - -makepalookup(long palnum, char *remapbuf, - signed char r, signed char g, signed char b, - char dastat) - This function allows different shirt colors for sprites. First prepare - remapbuf, which is a 256 byte buffer of chars which the colors to remap. - Palnum can be anywhere from 1-15. Since 0 is where the normal palette is - stored, it is a bad idea to call this function with palnum=0. - In BUILD.H notice I added a new variable, spritepal[MAXSPRITES]. - Usually the value of this is 0 for the default palette. But if you - change it to the palnum in the code between drawrooms() and drawmasks - then the sprite will be drawn with that remapped palette. The last 3 - parameters are the color that the palette fades to as you get further - away. This color is normally black (0,0,0). White would be (63,63,63). - if ((dastat&1) == 0) then makepalookup will allocate & deallocate - the memory block for use but will not waste the time creating a palookup - table (assuming you will create one yourself) - -setbrightness(char gammalevel, char *dapal) - Use this function to adjust for gamma correction. - Gammalevel - ranges from 0-15, 0 is darkest, 15 brightest. Default: 0 - dapal: standard VGA palette (768 bytes) - ------------------------------------------------------------------------------- -| This document brought to you by: | -| | -| @@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@@@ @@@@@@ | -| @@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@@@@ @@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@ @@@@@@@@@@@ @@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@ @@@@@@@@@@@@ @@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@ @@@@@@@@@@@@@ @@@@@@ | -| @@@@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@ @@@@@@@ @@@@@@ | -| @@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@ @@@@@@@ @@@@@@ | -| @@@@@@@@@@@@ @@@@@@@@@@@@@@@ @@@@@@ @@@@@@@ @@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@ @@@@@@ @@@@@@@@@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@ @@@@@@ @@@@@@@@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@ @@@@@@ @@@@@@@@@@@ | -| @@@@@@ @@@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@ @@@@@@@@@@ | -| @@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@ @@@@@@@@@ | -| @@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@ @@@@@@ @@@@@@@@ | -| | -| Ken Silverman of East Greenwich, RI USA | ------------------------------------------------------------------------------- diff --git a/polymer-perf/eduke32/build/include/a.h b/polymer-perf/eduke32/build/include/a.h deleted file mode 100644 index df67486ff..000000000 --- a/polymer-perf/eduke32/build/include/a.h +++ /dev/null @@ -1,157 +0,0 @@ -// Assembly-language function wrappers for a.asm functions -// for the Build Engine -// by Jonathon Fowler (jonof@edgenetwk.com) - - -#ifndef __a_h__ -#define __a_h__ - -#include "compat.h" - -#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) - -#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__SYLLABLE__) -#define __cdecl -#endif - -extern int32_t __cdecl mmxoverlay(); -extern int32_t __cdecl sethlinesizes(int32_t,int32_t,int32_t); -extern int32_t __cdecl setpalookupaddress(char *); -extern int32_t __cdecl setuphlineasm4(int32_t,int32_t); -extern int32_t __cdecl hlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl rhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl setupqrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl qrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl setvlinebpl(int32_t); -extern int32_t __cdecl fixtransluscence(int32_t); -extern int32_t __cdecl prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl vlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl setuptvlineasm(int32_t); -extern int32_t __cdecl tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl setuptvlineasm2(int32_t,int32_t,int32_t); -extern int32_t __cdecl tvlineasm2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl mvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl setupvlineasm(int32_t); -extern int32_t __cdecl vlineasm4(int32_t,int32_t); -extern int32_t __cdecl setupmvlineasm(int32_t); -extern int32_t __cdecl mvlineasm4(int32_t,int32_t); -extern int32_t __cdecl setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl spritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl mspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl tsetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl tspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl mhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl mhlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl msethlineshift(int32_t,int32_t); -extern int32_t __cdecl thline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl thlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl tsethlineshift(int32_t,int32_t); -extern int32_t __cdecl setupslopevlin(int32_t,int32_t,int32_t); -extern int32_t __cdecl slopevlin(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t __cdecl settransnormal(); -extern int32_t __cdecl settransreverse(); -extern int32_t __cdecl setupdrawslab(int32_t,int32_t); -extern int32_t __cdecl drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern void __cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); - -#elif defined(_MSC_VER) && !defined(NOASM) // __GNUC__ && __i386__ - -extern int32_t _cdecl mmxoverlay(); -extern int32_t _cdecl sethlinesizes(int32_t,int32_t,int32_t); -extern int32_t _cdecl setpalookupaddress(char *); -extern int32_t _cdecl setuphlineasm4(int32_t,int32_t); -extern int32_t _cdecl hlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl setuprhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl rhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl setuprmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl rmhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl setupqrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl qrhlineasm4(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl setvlinebpl(int32_t); -extern int32_t _cdecl fixtransluscence(int32_t); -extern int32_t _cdecl prevlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl vlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl setuptvlineasm(int32_t); -extern int32_t _cdecl tvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl setuptvlineasm2(int32_t,int32_t,int32_t); -extern int32_t _cdecl tvlineasm2(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl mvlineasm1(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl setupvlineasm(int32_t); -extern int32_t _cdecl vlineasm4(int32_t,int32_t); -extern int32_t _cdecl setupmvlineasm(int32_t); -extern int32_t _cdecl mvlineasm4(int32_t,int32_t); -extern int32_t _cdecl setupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl spritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl msetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl mspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl tsetupspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl tspritevline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl mhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl mhlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl msethlineshift(int32_t,int32_t); -extern int32_t _cdecl thline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl thlineskipmodify(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl tsethlineshift(int32_t,int32_t); -extern int32_t _cdecl setupslopevlin(int32_t,int32_t,int32_t); -extern int32_t _cdecl slopevlin(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern int32_t _cdecl settransnormal(); -extern int32_t _cdecl settransreverse(); -extern int32_t _cdecl setupdrawslab(int32_t,int32_t); -extern int32_t _cdecl drawslab(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); -extern void _cdecl stretchhline(int32_t,int32_t,int32_t,int32_t,int32_t,int32_t); - -#else // _MSC_VER - -#define ENGINE_USING_A_C -#include - -void setvlinebpl(int32_t dabpl); -void fixtransluscence(intptr_t datransoff); -void settransnormal(void); -void settransreverse(void); - -void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc); -void setpalookupaddress(char *paladdr); -void setuphlineasm4(int32_t bxinc, int32_t byinc); -void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, uint32_t bx, intptr_t p); - -void setupslopevlin(int32_t logylogx, intptr_t bufplc, int32_t pinc); -void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by); - -void setupvlineasm(int32_t neglogy); -void vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); - -void setupmvlineasm(int32_t neglogy); -void mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); - -void setuptvlineasm(int32_t neglogy); -void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); - -void msethlineshift(int32_t logx, int32_t logy); -void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p); - -void tsethlineshift(int32_t logx, int32_t logy); -void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p); - -void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz); -void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p); - -void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz); -void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p); - -void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz); -void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p); - -void setupdrawslab (int32_t dabpl, intptr_t pal); -void drawslab (int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intptr_t p); -void stretchhline (intptr_t p0, int32_t u, int32_t cnt, int32_t uinc, intptr_t rptr, intptr_t p); - -void mmxoverlay(); - -#endif // else - -#endif // __a_h__ diff --git a/polymer-perf/eduke32/build/include/baselayer.h b/polymer-perf/eduke32/build/include/baselayer.h deleted file mode 100644 index 5e29c59e8..000000000 --- a/polymer-perf/eduke32/build/include/baselayer.h +++ /dev/null @@ -1,181 +0,0 @@ -// Base services interface declaration -// for the Build Engine -// by Jonathon Fowler (jonof@edgenetwk.com) - -#ifndef __baselayer_h__ -#define __baselayer_h__ - -#include "compat.h" -#include "osd.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define SYSTEM_POOL_SIZE (64 * 1048576) - -extern int32_t _buildargc; -extern const char **_buildargv; - -extern char quitevent, appactive; - -extern int32_t vsync; - -// NOTE: these are implemented in game-land so they may be overridden in game specific ways -extern int32_t startwin_open(void); -extern int32_t startwin_close(void); -extern int32_t startwin_puts(const char *); -extern int32_t startwin_settitle(const char *); -extern int32_t startwin_idle(void *); - -// video -extern int32_t r_usenewaspect, newaspect_enable; -extern uint32_t r_screenxy; -extern int32_t xres, yres, bpp, fullscreen, bytesperline, imageSize; -extern intptr_t frameplace; -extern char offscreenrendering; - -extern void (*baselayer_onvideomodechange)(int32_t); - -#ifdef USE_OPENGL -extern int32_t osdcmd_glinfo(const osdfuncparm_t *parm); - -struct glinfo_t { - const char *vendor; - const char *renderer; - const char *version; - const char *extensions; - - float maxanisotropy; - char bgra; - char clamptoedge; - char texcompr; - char texnpot; - char multisample; - char nvmultisamplehint; - char arbfp; - char depthtex; - char shadow; - char fbos; - char rect; - char multitex; - char envcombine; - char vbos; - char vsync; - char sm4; - char occlusionqueries; - char glsl; - char dumped; -}; - -extern struct glinfo_t glinfo; -extern void setvsync(int32_t sync); -#endif - -extern char inputdevices; - -// keys -#define KEYFIFOSIZ 64 -extern char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend; -extern char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend; -extern char scantoasc[128], remap[256], key_names[256][24]; -extern int32_t remapinit; - -extern int32_t defaultres[][2]; - -extern void SetKey(int32_t key, int32_t state); - -// mouse -extern volatile int32_t mousex, mousey, mouseb; - -// joystick -extern int32_t *joyaxis, *joyhat, joyb; -extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats; -extern int32_t joyaxespresent; - -extern int32_t qsetmode; - -int32_t initsystem(void); -void uninitsystem(void); - -extern int32_t flushlogwindow; -void initprintf(const char *, ...) ATTRIBUTE((format(printf,1,2))); -void debugprintf(const char *,...) ATTRIBUTE((format(printf,1,2))); - -int32_t handleevents(void); -extern void (*after_handleevents_hook)(void); -extern inline void idle(void); -extern inline void idle_waitevent(void); -extern inline void idle_waitevent_timeout(uint32_t timeout); - -extern void (*keypresscallback)(int32_t,int32_t); -extern void (*mousepresscallback)(int32_t,int32_t); -extern void (*joypresscallback)(int32_t,int32_t); - -int32_t initinput(void); -void uninitinput(void); -void releaseallbuttons(void); -void setkeypresscallback(void (*callback)(int32_t,int32_t)); -void setmousepresscallback(void (*callback)(int32_t,int32_t)); -void setjoypresscallback(void (*callback)(int32_t,int32_t)); -const char *getkeyname(int32_t num); -const char *getjoyname(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat -char *Bstrtolower(char *str); - -char bgetchar(void); -#define bkbhit() (keyasciififoplc != keyasciififoend) - -void bflushchars(void); - -int32_t initmouse(void); -void uninitmouse(void); -void grabmouse(char a); -void readmousexy(int32_t *x, int32_t *y); -void readmousebstatus(int32_t *b); -void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur); -void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur); - -int32_t inittimer(int32_t); -void uninittimer(void); -void sampletimer(void); -uint32_t getticks(void); -int32_t gettimerfreq(void); -void (*installusertimercallback(void (*callback)(void)))(void); - -int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced); -int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs); -void getvalidmodes(void); -void resetvideomode(void); - -void begindrawing(void); -void enddrawing(void); -void showframe(int32_t); - -int32_t setpalette(int32_t start, int32_t num); -//int32_t getpalette(int32_t start, int32_t num, char *dapal); -int32_t setgamma(void); -extern double vid_gamma, vid_contrast, vid_brightness; - -#define DEFAULT_GAMMA 1.0 -#define DEFAULT_CONTRAST 1.0 -#define DEFAULT_BRIGHTNESS 0.0 - -#define GAMMA_CALC (int32_t)(min(max((float)((vid_gamma-1.0)*10.0),0),15)) - -int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit - -int32_t wm_msgbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); -int32_t wm_ynbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); -void wm_setapptitle(char *name); - -// baselayer.c -int32_t baselayer_init(); - -void makeasmwriteable(void); - -#ifdef __cplusplus -} -#endif - -#endif // __baselayer_h__ - diff --git a/polymer-perf/eduke32/build/include/build.h b/polymer-perf/eduke32/build/include/build.h deleted file mode 100644 index 37a53cd9e..000000000 --- a/polymer-perf/eduke32/build/include/build.h +++ /dev/null @@ -1,755 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. -// -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - - -#ifndef __build_h__ -#define __build_h__ - -#include "compat.h" -#include "pragmas.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define MAXSECTORSV8 4096 -#define MAXWALLSV8 16384 -#define MAXSPRITESV8 16384 - -#define MAXSECTORSV7 1024 -#define MAXWALLSV7 8192 -#define MAXSPRITESV7 4096 - -#define MAXSECTORS MAXSECTORSV8 -#define MAXWALLS MAXWALLSV8 -#define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3)) -#define MAXSPRITES MAXSPRITESV8 - -// additional space beyond wall, in walltypes: -#define M32_FIXME_WALLS 512 -#define M32_FIXME_SECTORS 2 - -#define MAXTILES 15360 -#define MAXVOXELS 4096 -#define MAXSTATUS 1024 -#define MAXPLAYERS 16 -#define MAXXDIM 3072 -#define MAXYDIM 2304 -#define MAXBASEPALS 8 -#define MAXPALOOKUPS 256 -#define MAXPSKYTILES 256 -#define MAXSPRITESONSCREEN 4096 -#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites - -#define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals -#define DETAILPAL (MAXPALOOKUPS - 1) -#define GLOWPAL (MAXPALOOKUPS - 2) -#define SPECULARPAL (MAXPALOOKUPS - 3) -#define NORMALPAL (MAXPALOOKUPS - 4) - -#define TSPR_TEMP 99 -#define TSPR_MIRROR 100 - -#define PR_LIGHT_PRIO_MAX 0 -#define PR_LIGHT_PRIO_MAX_GAME 1 -#define PR_LIGHT_PRIO_HIGH 2 -#define PR_LIGHT_PRIO_HIGH_GAME 3 -#define PR_LIGHT_PRIO_LOW 4 -#define PR_LIGHT_PRIO_LOW_GAME 5 - -////////// yax defs ////////// -#define YAX_BIT 1024 -#define YAX_CEILING 0 -#define YAX_FLOOR 1 - -#define YAX_SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (§or[Sect].floor##Fld) : (§or[Sect].ceiling##Fld))) - -int16_t yax_getbunch(int16_t i, int16_t cf); -void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum); - - -#define CLIPMASK0 (((1L)<<16)+1L) -#define CLIPMASK1 (((256L)<<16)+64L) - -// max x/y val (= max editorgridextent in Mapster32) -#define BXY_MAX 524288 - - //Make all variables in BUILD.H defined in the ENGINE, - //and externed in GAME -#ifdef ENGINE -# define EXTERN -#else -# define EXTERN extern -#endif - -#pragma pack(push,1) - -//ceilingstat/floorstat: -// bit 0: 1 = parallaxing, 0 = not "P" -// bit 1: 1 = groudraw, 0 = not -// bit 2: 1 = swap x&y, 0 = not "F" -// bit 3: 1 = double smooshiness "E" -// bit 4: 1 = x-flip "F" -// bit 5: 1 = y-flip "F" -// bit 6: 1 = Align texture to first wall of sector "R" -// bits 7-8: "T" -// 00 = normal floors -// 01 = masked floors -// 10 = transluscent masked floors -// 11 = reverse transluscent masked floors -// bits 9-15: reserved - - //40 bytes -typedef struct -{ - int16_t wallptr, wallnum; - int32_t ceilingz, floorz; - int16_t ceilingstat, floorstat; - int16_t ceilingpicnum, ceilingheinum; - int8_t ceilingshade; - uint8_t ceilingpal, ceilingxpanning, ceilingypanning; - int16_t floorpicnum, floorheinum; - int8_t floorshade; - uint8_t floorpal, floorxpanning, floorypanning; - uint8_t visibility, filler; - int16_t lotag, hitag, extra; -} sectortype; - -//cstat: -// bit 0: 1 = Blocking wall (use with clipmove, getzrange) "B" -// bit 1: 1 = bottoms of invisible walls swapped, 0 = not "2" -// bit 2: 1 = align picture on bottom (for doors), 0 = top "O" -// bit 3: 1 = x-flipped, 0 = normal "F" -// bit 4: 1 = masking wall, 0 = not "M" -// bit 5: 1 = 1-way wall, 0 = not "1" -// bit 6: 1 = Blocking wall (use with hitscan / cliptype 1) "H" -// bit 7: 1 = Transluscence, 0 = not "T" -// bit 8: 1 = y-flipped, 0 = normal "F" -// bit 9: 1 = Transluscence reversing, 0 = normal "T" -// bits 10-15: reserved - - //32 bytes -typedef struct -{ - int32_t x, y; - int16_t point2, nextwall, nextsector, cstat; - int16_t picnum, overpicnum; - int8_t shade; - uint8_t pal, xrepeat, yrepeat, xpanning, ypanning; - int16_t lotag, hitag, extra; -} walltype; - -//cstat: -// bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B" -// bit 1: 1 = transluscence, 0 = normal "T" -// bit 2: 1 = x-flipped, 0 = normal "F" -// bit 3: 1 = y-flipped, 0 = normal "F" -// bits 5-4: 00 = FACE sprite (default) "R" -// 01 = WALL sprite (like masked walls) -// 10 = FLOOR sprite (parallel to ceilings&floors) -// bit 6: 1 = 1-sided sprite, 0 = normal "1" -// bit 7: 1 = Real centered centering, 0 = foot center "C" -// bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H" -// bit 9: 1 = Transluscence reversing, 0 = normal "T" -// bit 10: reserved (in use by a renderer hack) -// bit 11: 1 = determine shade based only on its own shade member (see CON's spritenoshade command) -// bit 12: reserved -// bit 13: 1 = does not cast shadow -// bit 14: 1 = invisible but casts shadow -// bit 15: 1 = Invisible sprite, 0 = not invisible - - //44 bytes -typedef struct -{ - int32_t x, y, z; - int16_t cstat, picnum; - int8_t shade; - uint8_t pal, clipdist, filler; - uint8_t xrepeat, yrepeat; - int8_t xoffset, yoffset; - int16_t sectnum, statnum; - int16_t ang, owner, xvel, yvel, zvel; - int16_t lotag, hitag, extra; -} spritetype; - -typedef struct { - uint32_t mdanimtims; - int16_t mdanimcur; - int16_t angoff, pitch, roll; - int32_t xoff, yoff, zoff; - uint8_t flags; - uint8_t xpanning, ypanning; - uint8_t filler; - float alpha; - spritetype *tspr; -} spriteext_t; - -typedef struct { - float smoothduration; - int16_t mdcurframe, mdoldframe; - int16_t mdsmooth; - uint8_t filler[2]; -} spritesmooth_t; - -#define SPREXT_NOTMD 1 -#define SPREXT_NOMDANIM 2 -#define SPREXT_AWAY1 4 -#define SPREXT_AWAY2 8 -#define SPREXT_TSPRACCESS 16 - -EXTERN spriteext_t *spriteext; -EXTERN spritesmooth_t *spritesmooth; -EXTERN int32_t guniqhudid; - -EXTERN sectortype *sector; -EXTERN walltype *wall; -EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt; -EXTERN int16_t thewall[MAXWALLSB]; -EXTERN spritetype *sprite; -EXTERN spritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; - -EXTERN int32_t spritesortcnt; -EXTERN spritetype *tsprite; - -EXTERN int32_t xdim, ydim, numpages; -EXTERN int32_t yxaspect, viewingrange; -EXTERN intptr_t ylookup[MAXYDIM+1]; - -#define MAXVALIDMODES 256 -EXTERN int32_t validmodecnt; -struct validmode_t { - int32_t xdim,ydim; - char bpp; - char fs; // bit 0 = fullscreen flag - char filler[2]; - int32_t extra; // internal use -}; -EXTERN struct validmode_t validmode[MAXVALIDMODES]; - -EXTERN int16_t numsectors, numwalls; -EXTERN char display_mirror; -EXTERN /*volatile*/ int32_t totalclock; -EXTERN int32_t numframes, randomseed; -EXTERN int16_t sintable[2048]; -EXTERN uint8_t palette[768]; -EXTERN int16_t numpalookups; -EXTERN char *palookup[MAXPALOOKUPS]; -EXTERN char parallaxtype, showinvisibility; -EXTERN int32_t parallaxyoffs, parallaxyscale; -EXTERN int32_t visibility, parallaxvisibility; - -EXTERN int32_t windowx1, windowy1, windowx2, windowy2; -EXTERN int16_t startumost[MAXXDIM], startdmost[MAXXDIM]; - -EXTERN int16_t pskyoff[MAXPSKYTILES], pskybits; - -EXTERN int16_t headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1]; -EXTERN int16_t prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES]; -EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES]; - -EXTERN int16_t tilesizx[MAXTILES], tilesizy[MAXTILES]; -EXTERN char picsiz[MAXTILES]; -EXTERN char walock[MAXTILES]; -EXTERN int32_t pow2long[32]; -EXTERN int32_t numtiles, picanm[MAXTILES]; -EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA - -EXTERN int32_t windowpos, windowx, windowy; - - //These variables are for auto-mapping with the draw2dscreen function. - //When you load a new board, these bits are all set to 0 - since - //you haven't mapped out anything yet. Note that these arrays are - //bit-mapped. - //If you want draw2dscreen() to show sprite #54 then you say: - // spritenum = 54; - // show2dsprite[spritenum>>3] |= (1<<(spritenum&7)); - //And if you want draw2dscreen() to not show sprite #54 then you say: - // spritenum = 54; - // show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7)); - //Automapping defaults to 0 (do nothing). If you set automapping to 1, - // then in 3D mode, the walls and sprites that you see will show up the - // next time you flip to 2D mode. - -EXTERN char show2dsector[(MAXSECTORS+7)>>3]; -EXTERN char show2dwall[(MAXWALLS+7)>>3]; -EXTERN char show2dsprite[(MAXSPRITES+7)>>3]; -EXTERN char automapping; - -EXTERN char gotpic[(MAXTILES+7)>>3]; -EXTERN char gotsector[(MAXSECTORS+7)>>3]; - -EXTERN char captureformat; -EXTERN char editorcolors[256]; - -EXTERN int32_t faketilesiz[MAXTILES]; -EXTERN char *faketiledata[MAXTILES]; - -EXTERN char spritecol2d[MAXTILES][2]; -extern char vgapal16[4*256]; - -extern char vgapalette[5*256]; -extern uint32_t drawlinepat; - -extern void faketimerhandler(void); - -extern char apptitle[256]; -typedef struct { - char r,g,b,f; -} palette_t; -extern palette_t curpalette[256], curpalettefaded[256], palfadergb; -extern char palfadedelta; - -extern int32_t dommxoverlay, novoxmips; - -extern float debug1, debug2; - -extern int32_t tiletovox[MAXTILES]; -extern int32_t usevoxels, voxscale[MAXVOXELS]; - -#ifdef USE_OPENGL -extern int32_t usemodels, usehightile; -extern int32_t rendmode; -#endif -EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES]; -EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES]; - -extern const char *engineerrstr; -extern char noclip; - -EXTERN int32_t editorzrange[2]; - -EXTERN int32_t myconnectindex, numplayers; -EXTERN int32_t connecthead, connectpoint2[MAXPLAYERS]; - -static inline int32_t getrendermode(void) -{ -#ifndef USE_OPENGL - return 0; -#else - return rendmode; -#endif -} - -/************************************************************************* -POSITION VARIABLES: - - POSX is your x - position ranging from 0 to 65535 - POSY is your y - position ranging from 0 to 65535 - (the length of a side of the grid in EDITBORD would be 1024) - POSZ is your z - position (height) ranging from 0 to 65535, 0 highest. - ANG is your angle ranging from 0 to 2047. Instead of 360 degrees, or - 2 * PI radians, I use 2048 different angles, so 90 degrees would - be 512 in my system. - -SPRITE VARIABLES: - - EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1]; - EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES]; - EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES]; - - Example: if the linked lists look like the following: - ???????????????? - Sector lists: Status lists: - ????????????????J - Sector0: 4, 5, 8 Status0: 2, 0, 8 - Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9 - Sector2: 3, 9 - ???????????????? - Notice that each number listed above is shown exactly once on both the - left and right side. This is because any sprite that exists must - be in some sector, and must have some kind of status that you define. - - -Coding example #1: - To go through all the sprites in sector 1, the code can look like this: - - sectnum = 1; - i = headspritesect[sectnum]; - while (i != -1) - { - nexti = nextspritesect[i]; - - //your code goes here - //ex: printf("Sprite %d is in sector %d\n",i,sectnum); - - i = nexti; - } - -Coding example #2: - To go through all sprites with status = 1, the code can look like this: - - statnum = 1; //status 1 - i = headspritestat[statnum]; - while (i != -1) - { - nexti = nextspritestat[i]; - - //your code goes here - //ex: printf("Sprite %d has a status of 1 (active)\n",i,statnum); - - i = nexti; - } - - insertsprite(short sectnum, short statnum); - deletesprite(short spritenum); - changespritesect(short spritenum, short newsectnum); - changespritestat(short spritenum, short newstatnum); - -TILE VARIABLES: - NUMTILES - the number of tiles found TILES.DAT. - TILESIZX[MAXTILES] - simply the x-dimension of the tile number. - TILESIZY[MAXTILES] - simply the y-dimension of the tile number. - WALOFF[MAXTILES] - the actual 32-bit offset pointing to the top-left - corner of the tile. - PICANM[MAXTILES] - flags for animating the tile. - -TIMING VARIABLES: - TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero. - From then on, it is incremented 120 times a second by 1. That - means that the number of seconds elapsed is totalclock / 120. - NUMFRAMES - The number of times the draw3dscreen function was called - since the engine was initialized. This helps to determine frame - rate. (Frame rate = numframes * 120 / totalclock.) - -OTHER VARIABLES: - - STARTUMOST[320] is an array of the highest y-coordinates on each column - that my engine is allowed to write to. You need to set it only - once. - STARTDMOST[320] is an array of the lowest y-coordinates on each column - that my engine is allowed to write to. You need to set it only - once. - SINTABLE[2048] is a sin table with 2048 angles rather than the - normal 360 angles for higher precision. Also since SINTABLE is in - all integers, the range is multiplied by 16383, so instead of the - normal -10)<<10); - if (klabs(xvect) > klabs(yvect)) - return ((radarang[640+scale(160,yvect,xvect)]>>6)+((xvect<0)<<10))&2047; - return ((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047; -} - -void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7))); -int32_t lastwall(int16_t point); -int32_t nextsectorneighborz(int16_t sectnum, int32_t thez, int16_t topbottom, int16_t direction); -int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day); -int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day); -void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(4,5))); -void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z); -void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z); -int32_t sectorofwall(int16_t theline); -int32_t sectorofwall_noquick(int16_t theline); -int32_t loopnumofsector(int16_t sectnum, int16_t wallnum); - -// int32_t insertsprite(int16_t sectnum, int16_t statnum); -// int32_t deletesprite(int16_t spritenum); - -// -// insertsprite -// - -int32_t insertspritesect(int16_t sectnum); -int32_t insertspritestat(int16_t statnum); -int32_t deletespritesect(int16_t deleteme); -int32_t deletespritestat(int16_t deleteme); - -int32_t lineintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz); - -int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz); - -static inline int32_t insertsprite(int16_t sectnum, int16_t statnum) -{ - insertspritestat(statnum); - return(insertspritesect(sectnum)); -} - -// -// deletesprite -// -static inline int32_t deletesprite(int16_t spritenum) -{ - deletespritestat(spritenum); - return(deletespritesect(spritenum)); -} - -int32_t changespritesect(int16_t spritenum, int16_t newsectnum); -int32_t changespritestat(int16_t spritenum, int16_t newstatnum); -int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2))); - -int32_t spriteheight(int16_t i, int32_t *basez); - -int32_t screencapture(const char *filename, char inverseit) ATTRIBUTE((nonnull(1))); - -int32_t getclosestcol(int32_t r, int32_t g, int32_t b); - -// PLAG: line utility functions -typedef struct s_equation { - float a, b, c; -} _equation; -typedef struct s_point2d { - float x, y; -} _point2d; -int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum); - -#define STATUS2DSIZ 144 -#define STATUS2DSIZ2 26 - -void qsetmode640350(void); -void qsetmode640480(void); -void qsetmodeany(int32_t,int32_t); -void clear2dscreen(void); -void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride); -void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) ATTRIBUTE((nonnull(1))); -int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col); -void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col); - -int32_t setrendermode(int32_t renderer); -int32_t getrendermode(void); - -#ifdef USE_OPENGL -void setrollangle(int32_t rolla); -#endif - -// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette -// how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield -// bit 0: opaque or masked (non-translucent) texture, using repeating -// bit 1: ignored -// bit 2: 33% translucence, using repeating -// bit 3: 67% translucence, using repeating -// bit 4: opaque or masked (non-translucent) texture, using clamping -// bit 5: ignored -// bit 6: 33% translucence, using clamping -// bit 7: 67% translucence, using clamping -// clamping is for sprites, repeating is for walls -void invalidatetile(int16_t tilenume, int32_t pal, int32_t how); - -int32_t animateoffs(int16_t tilenum, int16_t fakevar); - -void setpolymost2dview(void); // sets up GL for 2D drawing - -int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom); -void polymost_glreset(void); -void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype); - -#ifdef USE_OPENGL -extern int32_t glanisotropy; -extern int32_t glusetexcompr; -extern int32_t gltexfiltermode; -extern int32_t glredbluemode; -extern int32_t glusetexcache; -extern int32_t glmultisample, glnvmultisamplehint; -extern int32_t glwidescreen, glprojectionhacks; -extern int32_t gltexmaxsize; -void gltexapplyprops (void); -void invalidatecache(void); - -extern int32_t r_detailmapping; -extern int32_t r_glowmapping; -extern int32_t r_vertexarrays; -extern int32_t r_vbos; -extern int32_t r_vbocount; -extern int32_t r_animsmoothing; -extern int32_t r_parallaxskyclamping; -extern int32_t r_parallaxskypanning; -extern int32_t r_modelocclusionchecking; -extern int32_t r_fullbrights; -extern int32_t r_downsize; -extern int32_t r_downsizevar; -extern int32_t mdtims, omdtims; -extern int32_t glrendmode; -#endif - -void hicinit(void); -// effect bitset: 1 = greyscale, 2 = invert -void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect); -// flags bitset: 1 = don't compress -int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, char flags); -int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6]); -int32_t hicclearsubst(int32_t picnum, int32_t palnum); - -int32_t Ptile2tile(int32_t tile, int32_t pallet); -int32_t md_loadmodel(const char *fn); -int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags); -// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal); - -#ifdef USE_OPENGL -typedef struct -{ - // maps build tiles to particular animation frames of a model - int32_t modelid; - int32_t skinnum; - int32_t framenum; // calculate the number from the name when declaring - float smoothduration; - int32_t next; - char pal; -} tile2model_t; - -#define EXTRATILES MAXTILES - -EXTERN int32_t mdinited; -EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES]; - -static inline int32_t md_tilehasmodel(int32_t tilenume,int32_t pal) -{ - if (!mdinited) return -1; - return tile2model[Ptile2tile(tilenume,pal)].modelid; -} -#endif - -int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal); -int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fps, int32_t flags); -int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param, float specpower, float specfactor); -int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags, int32_t fov); -int32_t md_undefinetile(int32_t tile); -int32_t md_undefinemodel(int32_t modelid); - -int32_t loaddefinitionsfile(const char *fn); - -extern int32_t mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy -int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, int16_t *daang, int16_t *dacursectnum); - -// Hash functions - -typedef struct _hashitem // size is 12/24 bits. -{ - char *string; - int32_t key; - struct _hashitem *next; -} hashitem_t; - -typedef struct -{ - int32_t size; - hashitem_t **items; -} hashtable_t; - -void hash_init(hashtable_t *t); -void hash_free(hashtable_t *t); -int32_t hash_findcase(hashtable_t *t, const char *s); -int32_t hash_find(hashtable_t *t, const char *s); -void hash_add(hashtable_t *t, const char *s, int32_t key, int32_t replace); - -#ifdef POLYMER -# include "polymer.h" -#else -#ifdef USE_OPENGL -# include "polymost.h" -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif // __build_h__ diff --git a/polymer-perf/eduke32/build/include/cache1d.h b/polymer-perf/eduke32/build/include/cache1d.h deleted file mode 100644 index 7c764388b..000000000 --- a/polymer-perf/eduke32/build/include/cache1d.h +++ /dev/null @@ -1,73 +0,0 @@ -// cache1d.h - -#ifndef __cache1d_h__ -#define __cache1d_h__ - -#include "compat.h" -#include "mutex.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define MAXGROUPFILES 8 //Warning: Fix groupfil if this is changed -#define MAXOPENFILES 64 //Warning: Fix filehan if this is changed - -extern char filegrp[MAXOPENFILES]; - -void initcache(intptr_t dacachestart, int32_t dacachesize); -void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr); -void suckcache(intptr_t *suckptr); -void agecache(void); - -extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode) -int32_t addsearchpath(const char *p); -int32_t findfrompath(const char *fn, char **where); -int32_t openfrompath(const char *fn, int32_t flags, int32_t mode); -BFILE *fopenfrompath(const char *fn, const char *mode); - -int32_t initgroupfile(const char *filename); -void uninitsinglegroupfile(int32_t grphandle); -void uninitgroupfile(void); -int32_t kopen4load(const char *filename, char searchfirst); // searchfirst: 0 = anywhere, 1 = first group, 2 = any group -int32_t kread(int32_t handle, void *buffer, int32_t leng); -int32_t klseek(int32_t handle, int32_t offset, int32_t whence); -int32_t kfilelength(int32_t handle); -int32_t ktell(int32_t handle); -void kclose(int32_t handle); - -typedef struct { intptr_t *hand; int32_t leng; char *lock ; } cactype; - -enum { - CACHE1D_FIND_FILE = 1, - CACHE1D_FIND_DIR = 2, - CACHE1D_FIND_DRIVE = 4, - - CACHE1D_OPT_NOSTACK = 0x100, - - // the lower the number, the higher the priority - CACHE1D_SOURCE_DRIVE = 0, - CACHE1D_SOURCE_CURDIR = 1, - CACHE1D_SOURCE_PATH = 2, // + path stack depth - CACHE1D_SOURCE_ZIP = 0x7ffffffe, - CACHE1D_SOURCE_GRP = 0x7fffffff, -}; -typedef struct _CACHE1D_FIND_REC { - char *name; - int32_t type, source; - struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb; -} CACHE1D_FIND_REC; -void klistfree(CACHE1D_FIND_REC *rec); -CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int32_t type); - -int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil); -int32_t dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil); -void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil); -void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil); - -#ifdef __cplusplus -} -#endif - -#endif // __cache1d_h__ - diff --git a/polymer-perf/eduke32/build/include/compat.h b/polymer-perf/eduke32/build/include/compat.h deleted file mode 100644 index 680f2e4ad..000000000 --- a/polymer-perf/eduke32/build/include/compat.h +++ /dev/null @@ -1,573 +0,0 @@ -// Compatibility declarations for things which might not be present in -// certain build environments. It also levels the playing field caused -// by different platforms. - -#ifndef __compat_h__ -#define __compat_h__ - -# ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# include -# endif - -#ifndef UNREFERENCED_PARAMETER - #define UNREFERENCED_PARAMETER(x) x=x -#endif - -#define clamp(in, min, max) ((in) <= (min) ? (min) : (in) >= (max) ? (max) : (in)) - -#if defined __GNUC__ || defined __clang__ -# define ATTRIBUTE(attrlist) __attribute__(attrlist) -#else -# define ATTRIBUTE(attrlist) -#endif - -// This gives us access to 'intptr_t' and 'uintptr_t', which are -// abstractions to the size of a pointer on a given platform -// (ie, they're guaranteed to be the same size as a pointer) -#ifdef HAVE_INTTYPES -# include -#elif defined(_MSC_VER) -# include "msvc/inttypes.h" // from http://code.google.com/p/msinttypes/ -#endif - -#ifndef _MSC_VER -#if defined(__GNUC__) && defined(__i386__) -#ifndef __fastcall -#define __fastcall __attribute__((fastcall)) -#endif -#else -#define __fastcall -#endif -#endif - -#ifdef NEDMALLOC -#include "nedmalloc.h" -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#define WITHKPLIB - -// Define this to rewrite all 'B' versions to library functions. This -// is for platforms which give us a standard sort of C library so we -// link directly. Platforms like PalmOS which don't have a standard C -// library will need to wrap these functions with suitable emulations. -#define __compat_h_macrodef__ - -#ifdef __cplusplus -# include -# ifdef __compat_h_macrodef__ -# include -# include -# include -# include -# endif -#else -# include -# include -#endif - -#ifdef __compat_h_macrodef__ -# ifndef __cplusplus -# include -# include -# include -# include -# endif -# include -# include -# include -# include -# include -# if defined(_WIN32) -# include -# else -# include -# endif -#endif - -#ifdef EFENCE -# include -#endif - -#if defined(_MSC_VER) -# define inline __inline -# define longlong(x) x##i64 -static inline float nearbyintf(float x) -{ - uint32_t w1, w2; - __asm fnstcw w1 - w2 = w1 | 0x00000020; - __asm - { - fldcw w2 - fld x - frndint - fclex - fldcw w1 - } -} -#else -# define longlong(x) x##ll -#endif - -#ifndef NULL -# define NULL ((void *)0) -#endif - -#if defined(__linux) -# include -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define B_LITTLE_ENDIAN 1 -# define B_BIG_ENDIAN 0 -# elif __BYTE_ORDER == __BIG_ENDIAN -# define B_LITTLE_ENDIAN 0 -# define B_BIG_ENDIAN 1 -# endif -# define B_ENDIAN_C_INLINE 1 - -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# include -# if _BYTE_ORDER == _LITTLE_ENDIAN -# define B_LITTLE_ENDIAN 1 -# define B_BIG_ENDIAN 0 -# elif _BYTE_ORDER == _BIG_ENDIAN -# define B_LITTLE_ENDIAN 0 -# define B_BIG_ENDIAN 1 -# endif -# define B_SWAP64(x) __bswap64(x) -# define B_SWAP32(x) __bswap32(x) -# define B_SWAP16(x) __bswap16(x) - -#elif defined(__APPLE__) -# if defined(__LITTLE_ENDIAN__) -# define B_LITTLE_ENDIAN 1 -# define B_BIG_ENDIAN 0 -# elif defined(__BIG_ENDIAN__) -# define B_LITTLE_ENDIAN 0 -# define B_BIG_ENDIAN 1 -# endif -# include -# define B_SWAP64(x) OSSwapConstInt64(x) -# define B_SWAP32(x) OSSwapConstInt32(x) -# define B_SWAP16(x) OSSwapConstInt16(x) - -#elif defined(__BEOS__) -# include -# if LITTLE_ENDIAN != 0 -# define B_LITTLE_ENDIAN 1 -# define B_BIG_ENDIAN 0 -# elif BIG_ENDIAN != 0 -# define B_LITTLE_ENDIAN 0 -# define B_BIG_ENDIAN 1 -# endif -# define B_ENDIAN_C_INLINE 1 - -#elif defined(__QNX__) -# if defined __LITTLEENDIAN__ -# define B_LITTLE_ENDIAN 1 -# define B_BIG_ENDIAN 0 -# elif defined __BIGENDIAN__ -# define B_LITTLE_ENDIAN 0 -# define B_BIG_ENDIAN 1 -# endif -# define B_ENDIAN_C_INLINE 1 - -#elif defined(__sun) -# if defined _LITTLE_ENDIAN -# define B_LITTLE_ENDIAN 1 -# define B_BIG_ENDIAN 0 -# elif defined _BIG_ENDIAN -# define B_LITTLE_ENDIAN 0 -# define B_BIG_ENDIAN 1 -# endif -# define B_ENDIAN_C_INLINE 1 - -#elif defined(_WIN32) || defined(SKYOS) || defined(__SYLLABLE__) -# define B_LITTLE_ENDIAN 1 -# define B_BIG_ENDIAN 0 -# define B_ENDIAN_C_INLINE 1 -#endif - -#if !defined(B_LITTLE_ENDIAN) || !defined(B_BIG_ENDIAN) -# error Unknown endianness -#endif - -#ifdef __cplusplus - -# ifndef SCREWED_UP_CPP -// using namespace std; -# endif - -extern "C" { -#endif - -#if defined B_ENDIAN_X86_INLINE -# if defined(_MSC_VER) - // inline asm using bswap/xchg -# elif defined(__GNUC__) - // inline asm using bswap/xchg -# endif -#elif defined B_ENDIAN_C_INLINE -static inline uint16_t B_SWAP16(uint16_t s) { return (s>>8)|(s<<8); } -static inline uint32_t B_SWAP32(uint32_t l) { return ((l>>8)&0xff00)|((l&0xff00)<<8)|(l<<24)|(l>>24); } -static inline uint64_t B_SWAP64(uint64_t l) { return (l>>56)|((l>>40)&0xff00)|((l>>24)&0xff0000)|((l>>8)&0xff000000)|((l&255)<<56)|((l&0xff00)<<40)|((l&0xff0000)<<24)|((l&0xff000000)<<8); } -#endif - -#if defined(USE_MSC_PRAGMAS) -static inline void ftol(float f, int32_t *a) -{ - _asm - { - mov eax, a - fld f - fistp dword ptr [eax] - } -} - -static inline void dtol(double d, int32_t *a) -{ - _asm - { - mov eax, a - fld d - fistp dword ptr [eax] - } -} -#elif defined(USE_GCC_PRAGMAS) - -static inline void ftol(float f, int32_t *a) -{ - __asm__ __volatile__( -#if 0 //(__GNUC__ >= 3) - "flds %1; fistpl %0;" -#else - "flds %1; fistpl (%0);" -#endif - : "=r"(a) : "m"(f) : "memory","cc"); -} - -static inline void dtol(double d, int32_t *a) -{ - __asm__ __volatile__( -#if 0 //(__GNUC__ >= 3) - "fldl %1; fistpl %0;" -#else - "fldl %1; fistpl (%0);" -#endif - : "=r"(a) : "m"(d) : "memory","cc"); -} - -#else -static inline void ftol(float f, int32_t *a) -{ - *a = (int32_t)f; -} - -static inline void dtol(double d, int32_t *a) -{ - *a = (int32_t)d; -} -#endif - -#if B_LITTLE_ENDIAN == 1 -# define B_LITTLE64(x) (x) -# define B_BIG64(x) B_SWAP64(x) -# define B_LITTLE32(x) (x) -# define B_BIG32(x) B_SWAP32(x) -# define B_LITTLE16(x) (x) -# define B_BIG16(x) B_SWAP16(x) -#elif B_BIG_ENDIAN == 1 -# define B_LITTLE64(x) B_SWAP64(x) -# define B_BIG64(x) (x) -# define B_LITTLE32(x) B_SWAP32(x) -# define B_BIG32(x) (x) -# define B_LITTLE16(x) B_SWAP16(x) -# define B_BIG16(x) (x) -#endif - -#ifndef FP_OFF -# define FP_OFF(__p) ((uintptr_t)(__p)) -#endif - -#ifdef __compat_h_macrodef__ - -# ifndef O_BINARY -# define O_BINARY 0 -# endif -# ifndef O_TEXT -# define O_TEXT 0 -# endif - -# ifndef F_OK -# define F_OK 0 -# endif - -# define BO_BINARY O_BINARY -# define BO_TEXT O_TEXT -# define BO_RDONLY O_RDONLY -# define BO_WRONLY O_WRONLY -# define BO_RDWR O_RDWR -# define BO_APPEND O_APPEND -# define BO_CREAT O_CREAT -# define BO_TRUNC O_TRUNC -# define BS_IRGRP S_IRGRP -# define BS_IWGRP S_IWGRP -# define BS_IEXEC S_IEXEC -# define BS_IWRITE S_IWRITE -# define BS_IREAD S_IREAD -# define BS_IFIFO S_IFIFO -# define BS_IFCHR S_IFCHR -# define BS_IFBLK S_IFBLK -# define BS_IFDIR S_IFDIR -# define BS_IFREG S_IFREG -# define BSEEK_SET SEEK_SET -# define BSEEK_CUR SEEK_CUR -# define BSEEK_END SEEK_END -#else -# define BO_BINARY 0 -# define BO_TEXT 1 -# define BO_RDONLY 2 -# define BO_WRONLY 4 -# define BO_RDWR 6 -# define BO_APPEND 8 -# define BO_CREAT 16 -# define BO_TRUNC 32 -# define BS_IRGRP 0 -# define BS_IWGRP 0 -# define BS_IEXEC 1 -# define BS_IWRITE 2 -# define BS_IREAD 4 -# define BS_IFIFO 0x1000 -# define BS_IFCHR 0x2000 -# define BS_IFBLK 0x3000 -# define BS_IFDIR 0x4000 -# define BS_IFREG 0x8000 -# define BSEEK_SET 0 -# define BSEEK_CUR 1 -# define BSEEK_END 2 -#endif - -#ifdef UNDERSCORES -# define ASMSYM(x) "_" x -#else -# define ASMSYM(x) x -#endif - -#ifndef min -# define min(a,b) ( ((a) < (b)) ? (a) : (b) ) -#endif - -#ifndef max -# define max(a,b) ( ((a) > (b)) ? (a) : (b) ) -#endif - - -#define BMAX_PATH 256 - - -struct Bdirent { - uint16_t namlen; - char *name; - uint32_t mode; - uint32_t size; - uint32_t mtime; -}; -typedef void BDIR; - -BDIR* Bopendir(const char *name); -struct Bdirent* Breaddir(BDIR *dir); -int32_t Bclosedir(BDIR *dir); - - -#ifdef __compat_h_macrodef__ - typedef FILE BFILE; -# define bsize_t size_t -# define bssize_t ssize_t -#else - typedef void BFILE; - typedef uint32_t bsize_t; - typedef int32_t bssize_t; -#endif - - -#ifdef __compat_h_macrodef__ -# define Brand rand -# define Balloca alloca -#ifdef NEDMALLOC -# define Bmalloc nedmalloc -# define Bcalloc nedcalloc -# define Brealloc nedrealloc -# define Bfree nedfree -# define Bstrdup nedstrdup -# define Bmemalign nedmemalign -#else -# define Bmalloc malloc -# define Bcalloc calloc -# define Brealloc realloc -# define Bfree free -# define Bstrdup strdup -# define Bmemalign memalign -#endif -# define Bopen open -# define Bclose close -# define Bwrite write -# define Bread read -# define Blseek lseek -# if defined(__GNUC__) -# define Btell(h) lseek(h,0,SEEK_CUR) -# else -# define Btell tell -# endif -# define Bstat stat -# define Bfopen fopen -# define Bfclose fclose -# define Bfeof feof -# define Bfgetc fgetc -# define Brewind rewind -# define Bfgets fgets -# define Bfputc fputc -# define Bfputs fputs -# define Bfread fread -# define Bfwrite fwrite -# define Bfprintf fprintf -# define Bstrcpy strcpy -# define Bstrncpy strncpy -# define Bstrcmp strcmp -# define Bstrncmp strncmp -# if defined(_MSC_VER) -# define Bstrcasecmp _stricmp -# define Bstrncasecmp _strnicmp -# else -# if defined(__QNX__) -# define Bstrcasecmp stricmp -# define Bstrncasecmp strnicmp -# else -# define Bstrcasecmp strcasecmp -# define Bstrncasecmp strncasecmp -# endif -# endif -# if defined(_WIN32) -# define Bstrlwr strlwr -# define Bstrupr strupr -# define Bmkdir(s,x) mkdir(s) -# else -# define Bmkdir mkdir -# endif -# define Bstrcat strcat -# define Bstrncat strncat -# define Bstrlen strlen -# define Bstrchr strchr -# define Bstrrchr strrchr -# define Batoi atoi -# define Batol atol -# define Bstrtol strtol -# define Bstrtoul strtoul -# define Bstrtod strtod -# define Bstrstr strstr -# define Btoupper toupper -# define Btolower tolower -# define Bmemcpy memcpy -# define Bmemmove memmove -# define Bmemchr memchr -# define Bmemset memset -# define Bmemcmp memcmp -# define Bprintf printf -# define Bsprintf sprintf -# ifdef _MSC_VER -# define Bsnprintf _snprintf -# define Bvsnprintf _vsnprintf -# else -# define Bsnprintf snprintf -# define Bvsnprintf vsnprintf -# endif -# define Bvfprintf vfprintf -# define Bgetcwd getcwd -# define Bgetenv getenv -# define Btime() time(NULL) - -#else - -int32_t Brand(void); -void *Bmalloc(bsize_t size); -void Bfree(void *ptr); -int32_t Bopen(const char *pathname, int32_t flags, unsigned mode); -int32_t Bclose(int32_t fd); -bssize_t Bwrite(int32_t fd, const void *buf, bsize_t count); -bssize_t Bread(int32_t fd, void *buf, bsize_t count); -int32_t Blseek(int32_t fildes, int32_t offset, int32_t whence); -BFILE *Bfopen(const char *path, const char *mode); -int32_t Bfclose(BFILE *stream); -int32_t Bfeof(BFILE *stream); -int32_t Bfgetc(BFILE *stream); -void Brewind(BFILE *stream); -char *Bfgets(char *s, int32_t size, BFILE *stream); -int32_t Bfputc(int32_t c, BFILE *stream); -int32_t Bfputs(const char *s, BFILE *stream); -bsize_t Bfread(void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream); -bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream); -char *Bstrdup(const char *s); -char *Bstrcpy(char *dest, const char *src); -char *Bstrncpy(char *dest, const char *src, bsize_t n); -int32_t Bstrcmp(const char *s1, const char *s2); -int32_t Bstrncmp(const char *s1, const char *s2, bsize_t n); -int32_t Bstrcasecmp(const char *s1, const char *s2); -int32_t Bstrncasecmp(const char *s1, const char *s2, bsize_t n); -char *Bstrcat(char *dest, const char *src); -char *Bstrncat(char *dest, const char *src, bsize_t n); -bsize_t Bstrlen(const char *s); -char *Bstrchr(const char *s, int32_t c); -char *Bstrrchr(const char *s, int32_t c); -int32_t Batoi(const char *nptr); -int32_t Batol(const char *nptr); -int32_t Bstrtol(const char *nptr, char **endptr, int32_t base); -uint32_t Bstrtoul(const char *nptr, char **endptr, int32_t base); -void *Bmemcpy(void *dest, const void *src, bsize_t n); -void *Bmemmove(void *dest, const void *src, bsize_t n); -void *Bmemchr(const void *s, int32_t c, bsize_t n); -void *Bmemset(void *s, int32_t c, bsize_t n); -int32_t Bmemcmp(const void *s1, const void *s2, bsize_t n); -int32_t Bprintf(const char *format, ...) ATTRIBUTE((format(printf,1,2))); -int32_t Bsprintf(char *str, const char *format, ...) ATTRIBUTE((format(printf,2,3))); -int32_t Bsnprintf(char *str, bsize_t size, const char *format, ...) ATTRIBUTE((format(printf,3,4))); -int32_t Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap); -char *Bgetcwd(char *buf, bsize_t size); -char *Bgetenv(const char *name); -#endif - -char *Bgethomedir(void); -char *Bgetsupportdir(int32_t global); -uint32_t Bgetsysmemsize(void); -int32_t Bcorrectfilename(char *filename, int32_t removefn); -int32_t Bcanonicalisefilename(char *filename, int32_t removefn); -char *Bgetsystemdrives(void); -int32_t Bfilelength(int32_t fd); -char *Bstrtoken(char *s, const char *delim, char **ptrptr, int32_t chop); -int32_t Bwildmatch (const char *i, const char *j); - -#if !defined(_WIN32) -char *Bstrlwr(char *); -char *Bstrupr(char *); -#endif - -#ifdef __cplusplus -} -#endif - -// timer defs for profiling function chunks the simple way -#define EDUKE32_TMRDEF int32_t t[20], ti=0; const char *tmrstr=__func__; fprintf(stderr,"%s\n",tmrstr); t[ti++]=getticks(); -#define EDUKE32_TMRTIC t[ti++]=getticks() -#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii> 8); - *crcvar = crc; -} - -static inline uint32_t crc32finish(uint32_t *crcvar) -{ - *crcvar = *crcvar ^ 0xffffffffl; - return *crcvar; -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/polymer-perf/eduke32/build/include/dxdidf.h b/polymer-perf/eduke32/build/include/dxdidf.h deleted file mode 100644 index be29e6218..000000000 --- a/polymer-perf/eduke32/build/include/dxdidf.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __dxdidf_h__ -#define __dxdidf_h__ - -// Joystick - -static DIOBJECTDATAFORMAT c_dfDIJoystick_odf[] = { - { &GUID_XAxis, 0, 0x80FFFF03, 0x00000100 }, - { &GUID_YAxis, 4, 0x80FFFF03, 0x00000100 }, - { &GUID_ZAxis, 8, 0x80FFFF03, 0x00000100 }, - { &GUID_RxAxis, 12, 0x80FFFF03, 0x00000100 }, - { &GUID_RyAxis, 16, 0x80FFFF03, 0x00000100 }, - { &GUID_RzAxis, 20, 0x80FFFF03, 0x00000100 }, - { &GUID_Slider, 24, 0x80FFFF03, 0x00000100 }, - { &GUID_Slider, 28, 0x80FFFF03, 0x00000100 }, - { &GUID_POV, 32, 0x80FFFF10, 0x00000000 }, - { &GUID_POV, 36, 0x80FFFF10, 0x00000000 }, - { &GUID_POV, 40, 0x80FFFF10, 0x00000000 }, - { &GUID_POV, 44, 0x80FFFF10, 0x00000000 }, - { NULL, 48, 0x80FFFF0C, 0x00000000 }, - { NULL, 49, 0x80FFFF0C, 0x00000000 }, - { NULL, 50, 0x80FFFF0C, 0x00000000 }, - { NULL, 51, 0x80FFFF0C, 0x00000000 }, - { NULL, 52, 0x80FFFF0C, 0x00000000 }, - { NULL, 53, 0x80FFFF0C, 0x00000000 }, - { NULL, 54, 0x80FFFF0C, 0x00000000 }, - { NULL, 55, 0x80FFFF0C, 0x00000000 }, - { NULL, 56, 0x80FFFF0C, 0x00000000 }, - { NULL, 57, 0x80FFFF0C, 0x00000000 }, - { NULL, 58, 0x80FFFF0C, 0x00000000 }, - { NULL, 59, 0x80FFFF0C, 0x00000000 }, - { NULL, 60, 0x80FFFF0C, 0x00000000 }, - { NULL, 61, 0x80FFFF0C, 0x00000000 }, - { NULL, 62, 0x80FFFF0C, 0x00000000 }, - { NULL, 63, 0x80FFFF0C, 0x00000000 }, - { NULL, 64, 0x80FFFF0C, 0x00000000 }, - { NULL, 65, 0x80FFFF0C, 0x00000000 }, - { NULL, 66, 0x80FFFF0C, 0x00000000 }, - { NULL, 67, 0x80FFFF0C, 0x00000000 }, - { NULL, 68, 0x80FFFF0C, 0x00000000 }, - { NULL, 69, 0x80FFFF0C, 0x00000000 }, - { NULL, 70, 0x80FFFF0C, 0x00000000 }, - { NULL, 71, 0x80FFFF0C, 0x00000000 }, - { NULL, 72, 0x80FFFF0C, 0x00000000 }, - { NULL, 73, 0x80FFFF0C, 0x00000000 }, - { NULL, 74, 0x80FFFF0C, 0x00000000 }, - { NULL, 75, 0x80FFFF0C, 0x00000000 }, - { NULL, 76, 0x80FFFF0C, 0x00000000 }, - { NULL, 77, 0x80FFFF0C, 0x00000000 }, - { NULL, 78, 0x80FFFF0C, 0x00000000 }, - { NULL, 79, 0x80FFFF0C, 0x00000000 } -}; - -const DIDATAFORMAT c_dfDIJoystick = { 24, 16, 0x00000001, 80, 44, c_dfDIJoystick_odf }; - -#endif // __dxdidf_h__ diff --git a/polymer-perf/eduke32/build/include/dynamicgtk.h b/polymer-perf/eduke32/build/include/dynamicgtk.h deleted file mode 100644 index fd9ab1f8c..000000000 --- a/polymer-perf/eduke32/build/include/dynamicgtk.h +++ /dev/null @@ -1,629 +0,0 @@ -#ifndef __dynamicgtk_h__ -#define __dynamicgtk_h__ - -#include -#include -#include -#include - -#include "compat.h" - -#if !GTK_CHECK_VERSION(2,4,0) -#error You need at least 2.4.0 version of GTK+ -#endif - -#if !defined(LINKED_GTK) - -#ifndef G_GNUC_NULL_TERMINATED -/* this is a glib-2.8.x thing: */ -#define G_GNUC_NULL_TERMINATED -#endif - -struct _dynamicgtksyms { - - // glib.h -void (*g_free) (gpointer mem); - // gobject.h -gpointer (*g_object_get_data) (GObject *object, - const gchar *key); -void (*g_object_set_data) (GObject *object, - const gchar *key, - gpointer data); -void (*g_object_set_data_full) (GObject *object, - const gchar *key, - gpointer data, - GDestroyNotify destroy); -void (*g_object_unref) (gpointer object); - - // gsignal.h -gulong (*g_signal_connect_data) (gpointer instance, - const gchar *detailed_signal, - GCallback c_handler, - gpointer data, - GClosureNotify destroy_data, - GConnectFlags connect_flags); -guint (*g_signal_handlers_block_matched) (gpointer instance, - GSignalMatchType mask, - guint signal_id, - GQuark detail, - GClosure *closure, - gpointer func, - gpointer data); -guint (*g_signal_handlers_unblock_matched) (gpointer instance, - GSignalMatchType mask, - guint signal_id, - GQuark detail, - GClosure *closure, - gpointer func, - gpointer data); - - // gtype.h -GTypeInstance* (*g_type_check_instance_cast) (GTypeInstance *instance, - GType iface_type); - - // gdk-pixdata.h -GdkPixbuf* (*gdk_pixbuf_from_pixdata) (const GdkPixdata *pixdata, - gboolean copy_pixels, - GError **error); - - // gdk-pixbuf-core.h -GdkPixbuf *(*gdk_pixbuf_new_from_data) (const guchar *data, - GdkColorspace colorspace, - gboolean has_alpha, - int32_t bits_per_sample, - int32_t width, int32_t height, - int32_t rowstride, - GdkPixbufDestroyNotify destroy_fn, - gpointer destroy_fn_data); - - // gtkaccelgroup.h -GtkAccelGroup* (*gtk_accel_group_new) (void); - - // gtkalignment.h -GtkWidget* (*gtk_alignment_new) (gfloat xalign, - gfloat yalign, - gfloat xscale, - gfloat yscale); - - // gtkbox.h -GType (*gtk_box_get_type) (void) G_GNUC_CONST; -void (*gtk_box_pack_start) (GtkBox *box, - GtkWidget *child, - gboolean expand, - gboolean fill, - guint padding); - - // gtkbbox.h -GType (*gtk_button_box_get_type) (void) G_GNUC_CONST; -void (*gtk_button_box_set_layout) (GtkButtonBox *widget, - GtkButtonBoxStyle layout_style); - - // gtkbutton.h -GtkWidget* (*gtk_button_new) (void); - - // gtkcelllayout.h -GType (*gtk_cell_layout_get_type) (void) G_GNUC_CONST; -void (*gtk_cell_layout_pack_start) (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - gboolean expand); -void (*gtk_cell_layout_set_attributes) (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - ...) G_GNUC_NULL_TERMINATED; - - // gtkcellrenderertext.h -GtkCellRenderer *(*gtk_cell_renderer_text_new) (void); - - // gtkcheckbutton.h -GtkWidget* (*gtk_check_button_new_with_mnemonic) (const gchar *label); - - // gtkcombobox.h -gint (*gtk_combo_box_get_active) (GtkComboBox *combo_box); -gboolean (*gtk_combo_box_get_active_iter) (GtkComboBox *combo_box, - GtkTreeIter *iter); -gchar (*gtk_combo_box_get_active_text) (GtkComboBox *combo_box); -GtkTreeModel *(*gtk_combo_box_get_model) (GtkComboBox *combo_box); -GType (*gtk_combo_box_get_type) (void) G_GNUC_CONST; -GtkWidget *(*gtk_combo_box_new_text) (void); -GtkWidget *(*gtk_combo_box_new_with_model) (GtkTreeModel *model); -void (*gtk_combo_box_set_active) (GtkComboBox *combo_box, - gint index_); -void (*gtk_combo_box_set_active_iter) (GtkComboBox *combo_box, - GtkTreeIter *iter); - - // gtkcontainer.h -void (*gtk_container_add) (GtkContainer *container, - GtkWidget *widget); -void (*gtk_container_foreach) (GtkContainer *container, - GtkCallback callback, - gpointer callback_data); -GType (*gtk_container_get_type) (void) G_GNUC_CONST; -void (*gtk_container_set_border_width) (GtkContainer *container, - guint border_width); - - // gtkdialog.h -GType (*gtk_dialog_get_type) (void) G_GNUC_CONST; -gint (*gtk_dialog_run) (GtkDialog *dialog); - - // gtkhbox.h -GtkWidget* (*gtk_hbox_new) (gboolean homogeneous, - gint spacing); - - // gtkhbbox.h -GtkWidget* (*gtk_hbutton_box_new) (void); - - // gtkimage.h -GtkWidget* (*gtk_image_new_from_pixbuf) (GdkPixbuf *pixbuf); -GtkWidget* (*gtk_image_new_from_stock) (const gchar *stock_id, - GtkIconSize size); - - // gtkmain.h -gboolean (*gtk_init_check) (int32_t *argc, - char ***argv); - - // gtklabel.h -GType (*gtk_label_get_type) (void) G_GNUC_CONST; -GtkWidget* (*gtk_label_new) (const gchar *str); -GtkWidget* (*gtk_label_new_with_mnemonic) (const gchar *str); -void (*gtk_label_set_mnemonic_widget) (GtkLabel *label, - GtkWidget *widget); - - // gtkliststore.h -void (*gtk_list_store_append) (GtkListStore *list_store, - GtkTreeIter *iter); -void (*gtk_list_store_clear) (GtkListStore *list_store); -GType (*gtk_list_store_get_type) (void) G_GNUC_CONST; -GtkListStore *(*gtk_list_store_new) (gint n_columns, - ...); -void (*gtk_list_store_set) (GtkListStore *list_store, - GtkTreeIter *iter, - ...); - - // gtkmain.h -void (*gtk_main) (void); -gboolean (*gtk_main_iteration_do) (gboolean blocking); -void (*gtk_main_quit) (void); - - // gtkmessagedialog.h -GtkWidget* (*gtk_message_dialog_new) (GtkWindow *parent, - GtkDialogFlags flags, - GtkMessageType type, - GtkButtonsType buttons, - const gchar *message_format, - ...) G_GNUC_PRINTF (5, 6); - - // gtkmisc.h -GType (*gtk_misc_get_type) (void) G_GNUC_CONST; -void (*gtk_misc_set_alignment) (GtkMisc *misc, - gfloat xalign, - gfloat yalign); - - // gtknotebook.h -GtkWidget* (*gtk_notebook_get_nth_page) (GtkNotebook *notebook, - gint page_num); -GType (*gtk_notebook_get_type) (void) G_GNUC_CONST; -GtkWidget * (*gtk_notebook_new) (void); -void (*gtk_notebook_set_current_page) (GtkNotebook *notebook, - gint page_num); -void (*gtk_notebook_set_tab_label) (GtkNotebook *notebook, - GtkWidget *child, - GtkWidget *tab_label); - - // gtkobject.h -GtkType (*gtk_object_get_type) (void) G_GNUC_CONST; - - // gtkscrolledwindow.h -GType (*gtk_scrolled_window_get_type) (void) G_GNUC_CONST; -GtkWidget* (*gtk_scrolled_window_new) (GtkAdjustment *hadjustment, - GtkAdjustment *vadjustment); -void (*gtk_scrolled_window_set_policy) (GtkScrolledWindow *scrolled_window, - GtkPolicyType hscrollbar_policy, - GtkPolicyType vscrollbar_policy); -void (*gtk_scrolled_window_set_shadow_type) (GtkScrolledWindow *scrolled_window, - GtkShadowType type); - // gtktable.h -GType (*gtk_table_get_type) (void) G_GNUC_CONST; -GtkWidget* (*gtk_table_new) (guint rows, - guint columns, - gboolean homogeneous); -void (*gtk_table_attach) (GtkTable *table, - GtkWidget *child, - guint left_attach, - guint right_attach, - guint top_attach, - guint bottom_attach, - GtkAttachOptions xoptions, - GtkAttachOptions yoptions, - guint xpadding, - guint ypadding); - - - // gtktextbuffer.h -gboolean (*gtk_text_buffer_backspace) (GtkTextBuffer *buffer, - GtkTextIter *iter, - gboolean interactive, - gboolean default_editable); -GtkTextMark *(*gtk_text_buffer_create_mark) (GtkTextBuffer *buffer, - const gchar *mark_name, - const GtkTextIter *where, - gboolean left_gravity); -void (*gtk_text_buffer_delete_mark) (GtkTextBuffer *buffer, - GtkTextMark *mark); -void (*gtk_text_buffer_get_end_iter) (GtkTextBuffer *buffer, - GtkTextIter *iter); -void (*gtk_text_buffer_insert) (GtkTextBuffer *buffer, - GtkTextIter *iter, - const gchar *text, - gint len); - - // gtktextiter.h - // FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0) - // around these three, or should I not care? -gboolean (*gtk_text_iter_backward_cursor_position) (GtkTextIter *iter); -gboolean (*gtk_text_iter_equal) (const GtkTextIter *lhs, - const GtkTextIter *rhs); -gboolean (*gtk_text_buffer_delete_interactive) (GtkTextBuffer *buffer, - GtkTextIter *start_iter, - GtkTextIter *end_iter, - gboolean default_editable); - - // gtktextview.h -GtkTextBuffer *(*gtk_text_view_get_buffer) (GtkTextView *text_view); -GType (*gtk_text_view_get_type) (void) G_GNUC_CONST; -GtkWidget * (*gtk_text_view_new) (void); -void (*gtk_text_view_scroll_to_mark) (GtkTextView *text_view, - GtkTextMark *mark, - gdouble within_margin, - gboolean use_align, - gdouble xalign, - gdouble yalign); -void (*gtk_text_view_set_cursor_visible) (GtkTextView *text_view, - gboolean setting); -void (*gtk_text_view_set_editable) (GtkTextView *text_view, - gboolean setting); -void (*gtk_text_view_set_left_margin) (GtkTextView *text_view, - gint left_margin); -void (*gtk_text_view_set_right_margin) (GtkTextView *text_view, - gint right_margin); -void (*gtk_text_view_set_wrap_mode) (GtkTextView *text_view, - GtkWrapMode wrap_mode); - - // gtktogglebutton.h -gboolean (*gtk_toggle_button_get_active) (GtkToggleButton *toggle_button); -GType (*gtk_toggle_button_get_type) (void) G_GNUC_CONST; -void (*gtk_toggle_button_set_active) (GtkToggleButton *toggle_button, - gboolean is_active); - - // gtktreemodel.h -void (*gtk_tree_model_get) (GtkTreeModel *tree_model, - GtkTreeIter *iter, - ...); -gboolean (*gtk_tree_model_get_iter) (GtkTreeModel *tree_model, - GtkTreeIter *iter, - GtkTreePath *path); -GtkTreePath * (*gtk_tree_model_get_path) (GtkTreeModel *tree_model, - GtkTreeIter *iter); -GType (*gtk_tree_model_get_type) (void) G_GNUC_CONST; -gint *(*gtk_tree_path_get_indices) (GtkTreePath *path); -GtkTreePath *(*gtk_tree_path_new_from_indices) (gint first_index, - ...); - // gtktreeselection.h -gboolean (*gtk_tree_selection_get_selected) (GtkTreeSelection *selection, - GtkTreeModel **model, - GtkTreeIter *iter); -void (*gtk_tree_selection_select_iter) (GtkTreeSelection *selection, - GtkTreeIter *iter); -GType (*gtk_tree_selection_get_type) (void) G_GNUC_CONST; - -void (*gtk_tree_selection_set_mode) (GtkTreeSelection *selection, - GtkSelectionMode type); - - // gtktreesortable.h -GType (*gtk_tree_sortable_get_type) (void) G_GNUC_CONST; - -void (*gtk_tree_sortable_set_sort_column_id) (GtkTreeSortable *sortable, - gint sort_column_id, - GtkSortType order); -void (*gtk_tree_sortable_set_sort_func) (GtkTreeSortable *sortable, - gint sort_column_id, - GtkTreeIterCompareFunc sort_func, - gpointer user_data, - GtkDestroyNotify destroy); - - // gtktreeview.h -GType (*gtk_tree_view_get_type) (void) G_GNUC_CONST; -GtkWidget *(*gtk_tree_view_new_with_model) (GtkTreeModel *model); - -GtkTreeModel *(*gtk_tree_view_get_model) (GtkTreeView *tree_view); - -GtkTreeSelection *(*gtk_tree_view_get_selection) (GtkTreeView *tree_view); -gint (*gtk_tree_view_append_column) (GtkTreeView *tree_view, - GtkTreeViewColumn *column); -void (*gtk_tree_view_set_enable_search) (GtkTreeView *tree_view, - gboolean enable_search); -void (*gtk_tree_view_set_headers_visible) (GtkTreeView *tree_view, - gboolean headers_visible); - - // gtktreeviewcolumn.h -GtkTreeViewColumn *(*gtk_tree_view_column_new_with_attributes) (const gchar *title, - GtkCellRenderer *cell, - ...) G_GNUC_NULL_TERMINATED; -void (*gtk_tree_view_column_set_expand) (GtkTreeViewColumn *tree_column, - gboolean expand); -void (*gtk_tree_view_column_set_min_width) (GtkTreeViewColumn *tree_column, - gint min_width); - - - // gtkvbox.h -GtkWidget* (*gtk_vbox_new) (gboolean homogeneous, - gint spacing); - - // gtkwidget.h -void (*gtk_widget_add_accelerator) (GtkWidget *widget, - const gchar *accel_signal, - GtkAccelGroup *accel_group, - guint accel_key, - GdkModifierType accel_mods, - GtkAccelFlags accel_flags); -void (*gtk_widget_destroy) (GtkWidget *widget); -GtkWidget* (*gtk_widget_ref) (GtkWidget *widget); -void (*gtk_widget_set_sensitive) (GtkWidget *widget, - gboolean sensitive); -void (*gtk_widget_set_size_request) (GtkWidget *widget, - gint width, - gint height); -void (*gtk_widget_show_all) (GtkWidget *widget); -void (*gtk_widget_unref) (GtkWidget *widget); - - // gtkwindow.h -void (*gtk_window_add_accel_group) (GtkWindow *window, - GtkAccelGroup *accel_group); -GType (*gtk_window_get_type) (void) G_GNUC_CONST; -GtkWidget* (*gtk_window_new) (GtkWindowType type); -void (*gtk_window_set_default_icon) (GdkPixbuf *icon); -void (*gtk_window_set_position) (GtkWindow *window, - GtkWindowPosition position); -void (*gtk_window_set_resizable) (GtkWindow *window, - gboolean resizable); -void (*gtk_window_set_title) (GtkWindow *window, - const gchar *title); -void (*gtk_window_set_type_hint) (GtkWindow *window, - GdkWindowTypeHint hint); -void (*gtk_window_set_default) (GtkWindow *window, - GtkWidget *default_widget); - - // gunicode.h -gint (*g_utf8_collate) (const gchar *str1, - const gchar *str2); - -}; -extern struct _dynamicgtksyms dynamicgtksyms; - -int32_t dynamicgtk_init(void); -void dynamicgtk_uninit(void); - -#ifndef __dynamicgtkfoo__ - -// glib.h -#define g_free dynamicgtksyms.g_free - -// gobject.h -#define g_object_get_data dynamicgtksyms.g_object_get_data -#define g_object_set_data dynamicgtksyms.g_object_set_data -#define g_object_set_data_full dynamicgtksyms.g_object_set_data_full -#define g_object_unref dynamicgtksyms.g_object_unref - -// gsignal.h -#define g_signal_connect_data dynamicgtksyms.g_signal_connect_data -#define g_signal_handlers_block_matched dynamicgtksyms.g_signal_handlers_block_matched -#define g_signal_handlers_unblock_matched dynamicgtksyms.g_signal_handlers_unblock_matched - -// gtype.h -#define g_type_check_instance_cast dynamicgtksyms.g_type_check_instance_cast - -// gdk-pixdata.h -#define gdk_pixbuf_from_pixdata dynamicgtksyms.gdk_pixbuf_from_pixdata - -// gdk-pixbuf-core.h -#define gdk_pixbuf_new_from_data dynamicgtksyms.gdk_pixbuf_new_from_data - -// gtkaccelgroup.h -#define gtk_accel_group_new dynamicgtksyms.gtk_accel_group_new - -// gtkalignment.h -#define gtk_alignment_new dynamicgtksyms.gtk_alignment_new - -// gtkbox.h -#define gtk_box_get_type dynamicgtksyms.gtk_box_get_type -#define gtk_box_pack_start dynamicgtksyms.gtk_box_pack_start - -// gtkbbox.h -#define gtk_button_box_get_type dynamicgtksyms.gtk_button_box_get_type -#define gtk_button_box_set_layout dynamicgtksyms.gtk_button_box_set_layout - -// gtkbutton.h -#define gtk_button_new dynamicgtksyms.gtk_button_new - -// gtkcelllayout.h -#define gtk_cell_layout_get_type dynamicgtksyms.gtk_cell_layout_get_type -#define gtk_cell_layout_pack_start dynamicgtksyms.gtk_cell_layout_pack_start -#define gtk_cell_layout_set_attributes dynamicgtksyms.gtk_cell_layout_set_attributes - -// gtkcellrenderertext.h -#define gtk_cell_renderer_text_new dynamicgtksyms.gtk_cell_renderer_text_new - -// gtkcheckbutton.h -#define gtk_check_button_new_with_mnemonic dynamicgtksyms.gtk_check_button_new_with_mnemonic - -// gtkcombobox.h -#define gtk_combo_box_get_active dynamicgtksyms.gtk_combo_box_get_active -#define gtk_combo_box_get_active_iter dynamicgtksyms.gtk_combo_box_get_active_iter -#define gtk_combo_box_get_active_text dynamicgtksyms.gtk_combo_box_get_active_text -#define gtk_combo_box_get_model dynamicgtksyms.gtk_combo_box_get_model -#define gtk_combo_box_get_type dynamicgtksyms.gtk_combo_box_get_type -#define gtk_combo_box_new_text dynamicgtksyms.gtk_combo_box_new_text -#define gtk_combo_box_new_with_model dynamicgtksyms.gtk_combo_box_new_with_model -#define gtk_combo_box_set_active dynamicgtksyms.gtk_combo_box_set_active -#define gtk_combo_box_set_active_iter dynamicgtksyms.gtk_combo_box_set_active_iter - -// gtkcontainer.h -#define gtk_container_add dynamicgtksyms.gtk_container_add -#define gtk_container_foreach dynamicgtksyms.gtk_container_foreach -#define gtk_container_get_type dynamicgtksyms.gtk_container_get_type -#define gtk_container_set_border_width dynamicgtksyms.gtk_container_set_border_width - -// gtkdialog.h -#define gtk_dialog_get_type dynamicgtksyms.gtk_dialog_get_type -#define gtk_dialog_run dynamicgtksyms.gtk_dialog_run - -// gtkhbox.h -#define gtk_hbox_new dynamicgtksyms.gtk_hbox_new - -// gtkhbbox.h -#define gtk_hbutton_box_new dynamicgtksyms.gtk_hbutton_box_new - -// gtkimage.h -#define gtk_image_new_from_pixbuf dynamicgtksyms.gtk_image_new_from_pixbuf -#define gtk_image_new_from_stock dynamicgtksyms.gtk_image_new_from_stock - -// gtkmain.h -#define gtk_init_check dynamicgtksyms.gtk_init_check - -// gtklabel.h -#define gtk_label_get_type dynamicgtksyms.gtk_label_get_type -#define gtk_label_new dynamicgtksyms.gtk_label_new -#define gtk_label_new_with_mnemonic dynamicgtksyms.gtk_label_new_with_mnemonic -#define gtk_label_set_mnemonic_widget dynamicgtksyms.gtk_label_set_mnemonic_widget - -// gtkliststore.h -#define gtk_list_store_append dynamicgtksyms.gtk_list_store_append -#define gtk_list_store_clear dynamicgtksyms.gtk_list_store_clear -#define gtk_list_store_get_type dynamicgtksyms.gtk_list_store_get_type -#define gtk_list_store_new dynamicgtksyms.gtk_list_store_new -#define gtk_list_store_set dynamicgtksyms.gtk_list_store_set - -// gtkmain.h -#define gtk_main dynamicgtksyms.gtk_main -#define gtk_main_iteration_do dynamicgtksyms.gtk_main_iteration_do -#define gtk_main_quit dynamicgtksyms.gtk_main_quit - -// gtkmessagedialog.h -#define gtk_message_dialog_new dynamicgtksyms.gtk_message_dialog_new - -// gtkmisc.h -#define gtk_misc_get_type dynamicgtksyms.gtk_misc_get_type -#define gtk_misc_set_alignment dynamicgtksyms.gtk_misc_set_alignment - -// gtknotebook.h -#define gtk_notebook_get_nth_page dynamicgtksyms.gtk_notebook_get_nth_page -#define gtk_notebook_get_type dynamicgtksyms.gtk_notebook_get_type -#define gtk_notebook_new dynamicgtksyms.gtk_notebook_new -#define gtk_notebook_set_current_page dynamicgtksyms.gtk_notebook_set_current_page -#define gtk_notebook_set_tab_label dynamicgtksyms.gtk_notebook_set_tab_label - -// gtkobject.h -#define gtk_object_get_type dynamicgtksyms.gtk_object_get_type - -// gtkscrolledwindow.h -#define gtk_scrolled_window_get_type dynamicgtksyms.gtk_scrolled_window_get_type -#define gtk_scrolled_window_new dynamicgtksyms.gtk_scrolled_window_new -#define gtk_scrolled_window_set_policy dynamicgtksyms.gtk_scrolled_window_set_policy -#define gtk_scrolled_window_set_shadow_type dynamicgtksyms.gtk_scrolled_window_set_shadow_type - -// gtktable.h -#define gtk_table_get_type dynamicgtksyms.gtk_table_get_type -#define gtk_table_new dynamicgtksyms.gtk_table_new -#define gtk_table_attach dynamicgtksyms.gtk_table_attach - -// gtktextbuffer.h -#define gtk_text_buffer_backspace dynamicgtksyms.gtk_text_buffer_backspace -#define gtk_text_buffer_create_mark dynamicgtksyms.gtk_text_buffer_create_mark -#define gtk_text_buffer_delete_mark dynamicgtksyms.gtk_text_buffer_delete_mark -#define gtk_text_buffer_get_end_iter dynamicgtksyms.gtk_text_buffer_get_end_iter -#define gtk_text_buffer_insert dynamicgtksyms.gtk_text_buffer_insert - -// gtktextiter.h -#define gtk_text_iter_backward_cursor_position dynamicgtksyms.gtk_text_iter_backward_cursor_position -#define gtk_text_iter_equal dynamicgtksyms.gtk_text_iter_equal -#define gtk_text_buffer_delete_interactive dynamicgtksyms.gtk_text_buffer_delete_interactive - -// gtktextview.h -#define gtk_text_view_get_buffer dynamicgtksyms.gtk_text_view_get_buffer -#define gtk_text_view_get_type dynamicgtksyms.gtk_text_view_get_type -#define gtk_text_view_new dynamicgtksyms.gtk_text_view_new -#define gtk_text_view_scroll_to_mark dynamicgtksyms.gtk_text_view_scroll_to_mark -#define gtk_text_view_set_cursor_visible dynamicgtksyms.gtk_text_view_set_cursor_visible -#define gtk_text_view_set_editable dynamicgtksyms.gtk_text_view_set_editable -#define gtk_text_view_set_left_margin dynamicgtksyms.gtk_text_view_set_left_margin -#define gtk_text_view_set_right_margin dynamicgtksyms.gtk_text_view_set_right_margin -#define gtk_text_view_set_wrap_mode dynamicgtksyms.gtk_text_view_set_wrap_mode - -// gtktogglebutton.h -#define gtk_toggle_button_get_active dynamicgtksyms.gtk_toggle_button_get_active -#define gtk_toggle_button_get_type dynamicgtksyms.gtk_toggle_button_get_type -#define gtk_toggle_button_set_active dynamicgtksyms.gtk_toggle_button_set_active - -// gtktreemodel.h -#define gtk_tree_model_get dynamicgtksyms.gtk_tree_model_get -#define gtk_tree_model_get_iter dynamicgtksyms.gtk_tree_model_get_iter -#define gtk_tree_model_get_path dynamicgtksyms.gtk_tree_model_get_path -#define gtk_tree_model_get_type dynamicgtksyms.gtk_tree_model_get_type -#define gtk_tree_path_get_indices dynamicgtksyms.gtk_tree_path_get_indices -#define gtk_tree_path_new_from_indices dynamicgtksyms.gtk_tree_path_new_from_indices - -// gtktreeselection.h -#define gtk_tree_selection_get_selected dynamicgtksyms.gtk_tree_selection_get_selected -#define gtk_tree_selection_select_iter dynamicgtksyms.gtk_tree_selection_select_iter -#define gtk_tree_selection_set_mode dynamicgtksyms.gtk_tree_selection_set_mode - -// gtktreesortable.h -#define gtk_tree_sortable_get_type dynamicgtksyms.gtk_tree_sortable_get_type -#define gtk_tree_sortable_set_sort_column_id dynamicgtksyms.gtk_tree_sortable_set_sort_column_id -#define gtk_tree_sortable_set_sort_func dynamicgtksyms.gtk_tree_sortable_set_sort_func - -// gtktreeview.h -#define gtk_tree_view_append_column dynamicgtksyms.gtk_tree_view_append_column -#define gtk_tree_view_get_model dynamicgtksyms.gtk_tree_view_get_model -#define gtk_tree_view_get_selection dynamicgtksyms.gtk_tree_view_get_selection -#define gtk_tree_view_get_type dynamicgtksyms.gtk_tree_view_get_type -#define gtk_tree_view_new_with_model dynamicgtksyms.gtk_tree_view_new_with_model -#define gtk_tree_view_set_enable_search dynamicgtksyms.gtk_tree_view_set_enable_search -#define gtk_tree_view_set_headers_visible dynamicgtksyms.gtk_tree_view_set_headers_visible - -// gtktreeviewcolumn.h -#define gtk_tree_view_column_new_with_attributes dynamicgtksyms.gtk_tree_view_column_new_with_attributes -#define gtk_tree_view_column_set_expand dynamicgtksyms.gtk_tree_view_column_set_expand -#define gtk_tree_view_column_set_min_width dynamicgtksyms.gtk_tree_view_column_set_min_width - - -// gtkvbox.h -#define gtk_vbox_new dynamicgtksyms.gtk_vbox_new - -// gtkwidget.h -#define gtk_widget_add_accelerator dynamicgtksyms.gtk_widget_add_accelerator -#define gtk_widget_destroy dynamicgtksyms.gtk_widget_destroy -#define gtk_widget_ref dynamicgtksyms.gtk_widget_ref -#define gtk_widget_set_sensitive dynamicgtksyms.gtk_widget_set_sensitive -#define gtk_widget_set_size_request dynamicgtksyms.gtk_widget_set_size_request -#define gtk_widget_show_all dynamicgtksyms.gtk_widget_show_all -#define gtk_widget_unref dynamicgtksyms.gtk_widget_unref - -// gtkwindow.h -#define gtk_window_add_accel_group dynamicgtksyms.gtk_window_add_accel_group -#define gtk_window_get_type dynamicgtksyms.gtk_window_get_type -#define gtk_window_new dynamicgtksyms.gtk_window_new -#define gtk_window_set_default_icon dynamicgtksyms.gtk_window_set_default_icon -#define gtk_window_set_position dynamicgtksyms.gtk_window_set_position -#define gtk_window_set_resizable dynamicgtksyms.gtk_window_set_resizable -#define gtk_window_set_title dynamicgtksyms.gtk_window_set_title -#define gtk_window_set_type_hint dynamicgtksyms.gtk_window_set_type_hint -#define gtk_window_set_default dynamicgtksyms.gtk_window_set_default - -// gunicode.h -#define g_utf8_collate dynamicgtksyms.g_utf8_collate - -#endif /* __dynamicgtkfoo__ */ - -#endif /* LINKED_GTK */ - -#endif /* __dynamicgtk_h__ */ - diff --git a/polymer-perf/eduke32/build/include/editor.h b/polymer-perf/eduke32/build/include/editor.h deleted file mode 100644 index c9658b804..000000000 --- a/polymer-perf/eduke32/build/include/editor.h +++ /dev/null @@ -1,229 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. - -#ifndef __editor_h__ -#define __editor_h__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define VERSION "2.0.0devel" - -// Build keys -#define BK_MOVEFORWARD 0 -#define BK_MOVEBACKWARD 1 -#define BK_TURNLEFT 2 -#define BK_TURNRIGHT 3 -#define BK_RUN 4 -#define BK_STRAFE 5 -#define BK_SHOOT 6 -#define BK_OPEN 7 -#define BK_MOVEUP 8 -#define BK_MOVEDOWN 9 -#define BK_LOOKUP 10 -#define BK_LOOKDOWN 11 -#define BK_STRAFELEFT 12 -#define BK_STRAFERIGHT 13 -#define BK_MODE2D_3D 14 -#define BK_PLAYERVIEW 15 -#define BK_ZOOMIN 16 -#define BK_ZOOMOUT 17 -#define BK_MESSAGE 18 -#define BK_CONSOLE 19 -#define NUMBUILDKEYS 20 - -extern int32_t qsetmode; -extern int16_t searchsector, searchwall, searchstat; -extern int16_t searchbottomwall; -extern int32_t zmode, kensplayerheight, zlock; - -#define DEFAULT_SPRITE_CSTAT 0 -//extern int16_t defaultspritecstat; - -extern int32_t temppicnum, tempcstat, templotag, temphitag, tempextra; -extern uint32_t temppal, tempvis, tempxrepeat, tempyrepeat; -extern int32_t tempshade, tempxvel, tempyvel, tempzvel; -extern char somethingintab; - -extern uint8_t buildkeys[NUMBUILDKEYS]; - -extern double vid_gamma_3d, vid_contrast_3d, vid_brightness_3d; - -extern int32_t ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup; -extern int32_t unrealedlook, quickmapcycling; -extern int32_t pk_turnaccel,pk_turndecel,pk_uedaccel; -extern int32_t revertCTRL,scrollamount; -extern int32_t autosave; -extern int32_t mlook; -extern int16_t prefixtiles[16]; - -extern char program_origcwd[BMAX_PATH]; -extern char *mapster32_fullpath; -extern char *testplay_addparam; -extern const char *g_namesFileName; - -extern int32_t m32_osd_tryscript; -extern int32_t showheightindicators; -extern int32_t showambiencesounds; - -// editor side view -extern int32_t m32_sideview; -extern int32_t m32_sideelev; -extern int16_t m32_sideang; -extern int32_t m32_sidecos, m32_sidesin; -extern int32_t m32_swcnt; -extern int16_t *m32_wallsprite; -extern int8_t sideview_reversehrot; -extern inline int32_t scalescreeny(int32_t sy); -extern void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) ATTRIBUTE((nonnull)); -//extern void invscreencoords(int32_t *dx, int32_t *dy, int32_t sx, int32_t sy, int32_t zoome); -extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull)); -extern inline int32_t getscreenvdisp(int32_t bz, int32_t zoome); -extern void setup_sideview_sincos(void); -extern void m32_setkeyfilter(int32_t on); - -extern int32_t wallength(int16_t i); -extern void fixrepeats(int16_t i); -extern void fixxrepeat(int16_t i, uint32_t lenrepquot); - -extern int32_t ExtInit(void); -extern int32_t ExtPreInit(int32_t argc,const char **argv); -extern void ExtUnInit(void); -extern void ExtPreCheckKeys(void); -extern void ExtAnalyzeSprites(void); -extern void ExtCheckKeys(void); -extern void ExtPreLoadMap(void); -extern void ExtLoadMap(const char *mapname); -extern void ExtPreSaveMap(void); -extern void ExtSaveMap(const char *mapname); -extern const char *ExtGetSectorCaption(int16_t sectnum); -extern const char *ExtGetWallCaption(int16_t wallnum); -extern const char *ExtGetSpriteCaption(int16_t spritenum); -extern void ExtShowSectorData(int16_t sectnum); -extern void ExtShowWallData(int16_t wallnum); -extern void ExtShowSpriteData(int16_t spritenum); -extern void ExtEditSectorData(int16_t sectnum); -extern void ExtEditWallData(int16_t wallnum); -extern void ExtEditSpriteData(int16_t spritenum); -extern const char *ExtGetSectorType(int32_t lotag); - -extern int32_t LoadBoard(const char *filename, uint32_t flags); -extern const char *SaveBoard(const char *fn, uint32_t flags); - -#define CORRUPT_SECTOR (1<<17) -#define CORRUPT_WALL (1<<18) -#define CORRUPT_SPRITE (1<<19) -#define CORRUPT_MASK (CORRUPT_SECTOR|CORRUPT_WALL|CORRUPT_SPRITE) -#define MAXCORRUPTTHINGS 64 -extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS]; -extern int32_t autocorruptcheck; -extern int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing); - -extern void showsectordata(int16_t sectnum, int16_t small); -extern void showwalldata(int16_t wallnum, int16_t small); -extern void showspritedata(int16_t spritenum, int16_t small); - -extern void drawsmallabel(const char *text, char col, char backcol, int32_t dax, int32_t day, int32_t daz); - -extern int32_t circlewall; - -int32_t loadsetup(const char *fn); // from config.c -int32_t writesetup(const char *fn); // from config.c - -void editinput(void); -void clearmidstatbar16(void); - -int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t)); -#define getnumber256(namestart, num, maxnumber, sign) _getnumber256(namestart, num, maxnumber, sign, NULL) -int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t)); -#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL) -void printmessage256(int32_t x, int32_t y, const char *name); -void message(const char *fmt, ...) ATTRIBUTE((format(printf,1,2))); - -// currently only for 3d mode -const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen); - -// like snprintf, but pads the output buffer with 'fill' at the end -//int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...); -void _printmessage16(const char *fmt, ...) ATTRIBUTE((format(printf,1,2))); - -extern int32_t lastpm16time; -#define printmessage16(fmt, ...) lastpm16time = totalclock, _printmessage16(fmt, ## __VA_ARGS__) - -extern char lastpm16buf[156]; - -void DoSpriteOrnament(int32_t i); - -void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y); -int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point); -void update_highlight(); -void update_highlightsector(); - -int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom, - int32_t x, int32_t y, int16_t sectnum); -void correct_sprite_yoffset(int32_t i); - -extern uint8_t hlsectorbitmap[MAXSECTORS>>3]; - -#ifdef _WIN32 -#define DEFAULT_GAME_EXEC "eduke32.exe" -#define DEFAULT_GAME_LOCAL_EXEC "eduke32.exe" -#else -#define DEFAULT_GAME_EXEC "eduke32" -#define DEFAULT_GAME_LOCAL_EXEC "./eduke32" -#endif - -void test_map(int32_t mode); - - -#define NEXTWALL(i) (wall[wall[i].nextwall]) -#define POINT2(i) (wall[wall[i].point2]) -#define SPRITESEC(j) (sector[sprite[j].sectnum]) - -#define CLEARLINES2D(Startline, Numlines, Color) clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color)) - -#define SCRIPTHISTSIZ 32 // should be the same as OSD_HISTORYDEPTH for maximum win, should be a power of two -extern const char *scripthist[SCRIPTHISTSIZ]; -extern int32_t scripthistend; - -//////////////////// Aiming //////////////////// -#define SEARCH_WALL 0 -#define SEARCH_CEILING 1 -#define SEARCH_FLOOR 2 -#define SEARCH_SPRITE 3 -#define SEARCH_MASKWALL 4 - -#define ASSERT_AIMING (searchstat>=0 && searchstat<=4) - -#define AIMING_AT_WALL (searchstat==0) -#define AIMING_AT_CEILING (searchstat==1) -#define AIMING_AT_FLOOR (searchstat==2) -#define AIMING_AT_SPRITE (searchstat==3) -#define AIMING_AT_MASKWALL (searchstat==4) - -#define AIMING_AT_WALL_OR_MASK (AIMING_AT_WALL || AIMING_AT_MASKWALL) -#define AIMING_AT_CEILING_OR_FLOOR (AIMING_AT_CEILING || AIMING_AT_FLOOR) - -#ifdef __cplusplus -} -#endif - -// showdebug is now used as a general informational on-screen display -#define M32_SHOWDEBUG - -// this should be only used if there's no dependency on endwall after the loop. -// of course, users of this macro should know that it modifies startwall and endwall. -#define WALLS_OF_SECTOR(Sect, Itervar) \ - startwall=sector[(Sect)].wallptr, endwall=startwall+sector[(Sect)].wallnum, Itervar=startwall; \ - Itervar < endwall; \ - Itervar++ - -#define BTAG_MAX 65535 -#define BZ_MAX 8388608 - - -#endif diff --git a/polymer-perf/eduke32/build/include/glbuild.h b/polymer-perf/eduke32/build/include/glbuild.h deleted file mode 100644 index 911c956b8..000000000 --- a/polymer-perf/eduke32/build/include/glbuild.h +++ /dev/null @@ -1,328 +0,0 @@ -#ifdef USE_OPENGL - -#ifdef RENDERTYPEWIN -#define WIN32_LEAN_AND_MEAN -#include -#endif - -#if defined(__APPLE__) -# include -# include -#else -# include -# include -#endif - -// get this header from http://oss.sgi.com/projects/ogl-sample/registry/ -// if you are missing it -//#include -#if defined(__APPLE__) -# include -#else -# include "glext.h" -#endif - -#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT -#error You should get an updated copy of glext.h from http://oss.sgi.com/projects/ogl-sample/registry/ -#endif - -#ifndef APIENTRY -# define APIENTRY -#endif - -# ifdef _WIN32 -# define PR_CALLBACK __stdcall -# else -# define PR_CALLBACK -# endif - -// those defines are somehow missing from glext.h -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 - -#define GL_TEXTURE_RECTANGLE 0x84F5 - -extern void (APIENTRY * bglClearColor)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); -extern void (APIENTRY * bglClear)( GLbitfield mask ); -extern void (APIENTRY * bglColorMask)( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); -extern void (APIENTRY * bglAlphaFunc)( GLenum func, GLclampf ref ); -extern void (APIENTRY * bglBlendFunc)( GLenum sfactor, GLenum dfactor ); -extern void (APIENTRY * bglCullFace)( GLenum mode ); -extern void (APIENTRY * bglFrontFace)( GLenum mode ); -extern void (APIENTRY * bglPolygonOffset)( GLfloat factor, GLfloat units ); -extern void (APIENTRY * bglPolygonMode)( GLenum face, GLenum mode ); -extern void (APIENTRY * bglEnable)( GLenum cap ); -extern void (APIENTRY * bglDisable)( GLenum cap ); -extern void (APIENTRY * bglGetDoublev)( GLenum pname, GLdouble *params ); -extern void (APIENTRY * bglGetFloatv)( GLenum pname, GLfloat *params ); -extern void (APIENTRY * bglGetIntegerv)( GLenum pname, GLint *params ); -extern void (APIENTRY * bglPushAttrib)( GLbitfield mask ); -extern void (APIENTRY * bglPopAttrib)( void ); -extern GLenum (APIENTRY * bglGetError)( void ); -extern const GLubyte* (APIENTRY * bglGetString)( GLenum name ); -extern void (APIENTRY * bglHint)( GLenum target, GLenum mode ); -extern void (APIENTRY * bglDrawBuffer)(GLenum mode); -extern void (APIENTRY * bglReadBuffer)(GLenum mode); -extern void (APIENTRY * bglScissor)(GLint x, GLint y, GLsizei width, GLsizei height); -extern void (APIENTRY * bglClipPlane)(GLenum plane, const GLdouble *equation); - -// Depth -extern void (APIENTRY * bglDepthFunc)( GLenum func ); -extern void (APIENTRY * bglDepthMask)( GLboolean flag ); -extern void (APIENTRY * bglDepthRange)( GLclampd near_val, GLclampd far_val ); - -// Matrix -extern void (APIENTRY * bglMatrixMode)( GLenum mode ); -extern void (APIENTRY * bglOrtho)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ); -extern void (APIENTRY * bglFrustum)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ); -extern void (APIENTRY * bglViewport)( GLint x, GLint y, GLsizei width, GLsizei height ); -extern void (APIENTRY * bglPushMatrix)( void ); -extern void (APIENTRY * bglPopMatrix)( void ); -extern void (APIENTRY * bglLoadIdentity)( void ); -extern void (APIENTRY * bglLoadMatrixf)( const GLfloat *m ); -extern void (APIENTRY * bglLoadMatrixd)( const GLdouble *m ); -extern void (APIENTRY * bglMultMatrixf)( const GLfloat *m ); -extern void (APIENTRY * bglMultMatrixd)( const GLdouble *m ); -extern void (APIENTRY * bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -extern void (APIENTRY * bglScalef)(GLfloat x, GLfloat y, GLfloat z); -extern void (APIENTRY * bglTranslatef)(GLfloat x, GLfloat y, GLfloat z); - -// Drawing -extern void (APIENTRY * bglBegin)( GLenum mode ); -extern void (APIENTRY * bglEnd)( void ); -extern void (APIENTRY * bglVertex2f)( GLfloat x, GLfloat y ); -extern void (APIENTRY * bglVertex2i)( GLint x, GLint y ); -extern void (APIENTRY * bglVertex3f)( GLfloat x, GLfloat y, GLfloat z ); -extern void (APIENTRY * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z ); -extern void (APIENTRY * bglVertex3fv)( const GLfloat *v ); -extern void (APIENTRY * bglVertex3dv)( const GLdouble *v ); -extern void (APIENTRY * bglColor4f)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); -extern void (APIENTRY * bglColor4ub)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); -extern void (APIENTRY * bglTexCoord2d)( GLdouble s, GLdouble t ); -extern void (APIENTRY * bglTexCoord2f)( GLfloat s, GLfloat t ); -extern void (APIENTRY * bglTexCoord2i)( GLint s, GLint t ); -extern void (APIENTRY * bglNormal3f)( GLfloat x, GLfloat y, GLfloat z ); - -// Lighting -extern void (APIENTRY * bglShadeModel)( GLenum mode ); -extern void (APIENTRY * bglLightfv)( GLenum light, GLenum pname, const GLfloat * params ); - -// Raster funcs -extern void (APIENTRY * bglReadPixels)( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ); -extern void (APIENTRY * bglRasterPos4i)( GLint x, GLint y, GLint z, GLint w ); -extern void (APIENTRY * bglDrawPixels)( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); - -// Texture mapping -extern void (APIENTRY * bglTexEnvf)( GLenum target, GLenum pname, GLfloat param ); -extern void (APIENTRY * bglGenTextures)( GLsizei n, GLuint *textures ); // 1.1 -extern void (APIENTRY * bglDeleteTextures)( GLsizei n, const GLuint *textures); // 1.1 -extern void (APIENTRY * bglBindTexture)( GLenum target, GLuint texture ); // 1.1 -extern void (APIENTRY * bglTexImage2D)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); -extern void (APIENTRY * bglTexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -extern void (APIENTRY * bglCopyTexImage2D)( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); -extern void (APIENTRY * bglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -extern void (APIENTRY * bglTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1 -extern void (APIENTRY * bglTexParameterf)( GLenum target, GLenum pname, GLfloat param ); -extern void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param ); -extern void (APIENTRY * bglGetTexLevelParameteriv)( GLenum target, GLint level, GLenum pname, GLint *params ); -extern void (APIENTRY * bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -extern void (APIENTRY * bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *); -extern void (APIENTRY * bglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params); - -// Fog -extern void (APIENTRY * bglFogf)( GLenum pname, GLfloat param ); -extern void (APIENTRY * bglFogi)( GLenum pname, GLint param ); -extern void (APIENTRY * bglFogfv)( GLenum pname, const GLfloat *params ); - -// Display Lists -extern void (APIENTRY * bglNewList)(GLuint list, GLenum mode); -extern void (APIENTRY * bglEndList)(void); -extern void (APIENTRY * bglCallList)(GLuint list); -extern void (APIENTRY * bglDeleteLists)(GLuint list, GLsizei range); - -// Vertex Arrays -extern void (APIENTRY * bglEnableClientState)(GLenum cap); -extern void (APIENTRY * bglDisableClientState)(GLenum cap); -extern void (APIENTRY * bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -extern void (APIENTRY * bglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); -extern void (APIENTRY * bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -extern void (APIENTRY * bglDrawArrays)(GLenum mode, GLint first, GLsizei count); -extern void (APIENTRY * bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); - -// Stencil Buffer -extern void (APIENTRY * bglClearStencil)(GLint s); -extern void (APIENTRY * bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); -extern void (APIENTRY * bglStencilFunc)(GLenum func, GLint ref, GLuint mask); - -// GPU Programs -extern void (APIENTRY * bglGenProgramsARB)(GLsizei, GLuint *); -extern void (APIENTRY * bglBindProgramARB)(GLenum, GLuint); -extern void (APIENTRY * bglProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *); -extern void (APIENTRY * bglDeleteProgramsARB)(GLsizei n, const GLuint *programs); - -// Multitexturing -extern void (APIENTRY * bglActiveTextureARB)(GLenum texture); -extern void (APIENTRY * bglClientActiveTextureARB)(GLenum texture); -extern void (APIENTRY * bglMultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t ); -extern void (APIENTRY * bglMultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t ); - -// Frame Buffer Objects -extern void (APIENTRY * bglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers); -extern void (APIENTRY * bglBindFramebufferEXT)(GLenum target, GLuint framebuffer); -extern void (APIENTRY * bglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -extern GLenum (APIENTRY * bglCheckFramebufferStatusEXT)(GLenum target); -extern void (APIENTRY * bglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers); - -// Vertex Buffer Objects -extern void (APIENTRY * bglGenBuffersARB)(GLsizei n, GLuint * buffers); -extern void (APIENTRY * bglBindBufferARB)(GLenum target, GLuint buffer); -extern void (APIENTRY * bglDeleteBuffersARB)(GLsizei n, const GLuint * buffers); -extern void (APIENTRY * bglBufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); -extern void (APIENTRY * bglBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); -extern void* (APIENTRY * bglMapBufferARB)(GLenum target, GLenum access); -extern GLboolean (APIENTRY * bglUnmapBufferARB)(GLenum target); - -// Occlusion queries -extern void (APIENTRY * bglGenQueriesARB)(GLsizei n, GLuint *ids); -extern void (APIENTRY * bglDeleteQueriesARB)(GLsizei n, const GLuint *ids); -extern GLboolean (APIENTRY * bglIsQueryARB)(GLuint id); -extern void (APIENTRY * bglBeginQueryARB)(GLenum target, GLuint id); -extern void (APIENTRY * bglEndQueryARB)(GLenum target); -extern void (APIENTRY * bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params); -extern void (APIENTRY * bglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params); -extern void (APIENTRY * bglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params); - -// Shader Objects -extern void (APIENTRY * bglDeleteObjectARB)(GLhandleARB); -extern GLhandleARB (APIENTRY * bglGetHandleARB)(GLenum); -extern void (APIENTRY * bglDetachObjectARB)(GLhandleARB, GLhandleARB); -extern GLhandleARB (APIENTRY * bglCreateShaderObjectARB)(GLenum); -extern void (APIENTRY * bglShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); -extern void (APIENTRY * bglCompileShaderARB)(GLhandleARB); -extern GLhandleARB (APIENTRY * bglCreateProgramObjectARB)(void); -extern void (APIENTRY * bglAttachObjectARB)(GLhandleARB, GLhandleARB); -extern void (APIENTRY * bglLinkProgramARB)(GLhandleARB); -extern void (APIENTRY * bglUseProgramObjectARB)(GLhandleARB); -extern void (APIENTRY * bglValidateProgramARB)(GLhandleARB); -extern void (APIENTRY * bglUniform1fARB)(GLint, GLfloat); -extern void (APIENTRY * bglUniform2fARB)(GLint, GLfloat, GLfloat); -extern void (APIENTRY * bglUniform3fARB)(GLint, GLfloat, GLfloat, GLfloat); -extern void (APIENTRY * bglUniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat); -extern void (APIENTRY * bglUniform1iARB)(GLint, GLint); -extern void (APIENTRY * bglUniform2iARB)(GLint, GLint, GLint); -extern void (APIENTRY * bglUniform3iARB)(GLint, GLint, GLint, GLint); -extern void (APIENTRY * bglUniform4iARB)(GLint, GLint, GLint, GLint, GLint); -extern void (APIENTRY * bglUniform1fvARB)(GLint, GLsizei, const GLfloat *); -extern void (APIENTRY * bglUniform2fvARB)(GLint, GLsizei, const GLfloat *); -extern void (APIENTRY * bglUniform3fvARB)(GLint, GLsizei, const GLfloat *); -extern void (APIENTRY * bglUniform4fvARB)(GLint, GLsizei, const GLfloat *); -extern void (APIENTRY * bglUniform1ivARB)(GLint, GLsizei, const GLint *); -extern void (APIENTRY * bglUniform2ivARB)(GLint, GLsizei, const GLint *); -extern void (APIENTRY * bglUniform3ivARB)(GLint, GLsizei, const GLint *); -extern void (APIENTRY * bglUniform4ivARB)(GLint, GLsizei, const GLint *); -extern void (APIENTRY * bglUniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *); -extern void (APIENTRY * bglUniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *); -extern void (APIENTRY * bglUniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *); -extern void (APIENTRY * bglGetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *); -extern void (APIENTRY * bglGetObjectParameterivARB)(GLhandleARB, GLenum, GLint *); -extern void (APIENTRY * bglGetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -extern void (APIENTRY * bglGetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); -extern GLint (APIENTRY * bglGetUniformLocationARB)(GLhandleARB, const GLcharARB *); -extern void (APIENTRY * bglGetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -extern void (APIENTRY * bglGetUniformfvARB)(GLhandleARB, GLint, GLfloat *); -extern void (APIENTRY * bglGetUniformivARB)(GLhandleARB, GLint, GLint *); -extern void (APIENTRY * bglGetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *); - -// Vertex Shaders -extern void (APIENTRY * bglVertexAttrib1dARB)(GLuint, GLdouble); -extern void (APIENTRY * bglVertexAttrib1dvARB)(GLuint, const GLdouble *); -extern void (APIENTRY * bglVertexAttrib1fARB)(GLuint, GLfloat); -extern void (APIENTRY * bglVertexAttrib1fvARB)(GLuint, const GLfloat *); -extern void (APIENTRY * bglVertexAttrib1sARB)(GLuint, GLshort); -extern void (APIENTRY * bglVertexAttrib1svARB)(GLuint, const GLshort *); -extern void (APIENTRY * bglVertexAttrib2dARB)(GLuint, GLdouble, GLdouble); -extern void (APIENTRY * bglVertexAttrib2dvARB)(GLuint, const GLdouble *); -extern void (APIENTRY * bglVertexAttrib2fARB)(GLuint, GLfloat, GLfloat); -extern void (APIENTRY * bglVertexAttrib2fvARB)(GLuint, const GLfloat *); -extern void (APIENTRY * bglVertexAttrib2sARB)(GLuint, GLshort, GLshort); -extern void (APIENTRY * bglVertexAttrib2svARB)(GLuint, const GLshort *); -extern void (APIENTRY * bglVertexAttrib3dARB)(GLuint, GLdouble, GLdouble, GLdouble); -extern void (APIENTRY * bglVertexAttrib3dvARB)(GLuint, const GLdouble *); -extern void (APIENTRY * bglVertexAttrib3fARB)(GLuint, GLfloat, GLfloat, GLfloat); -extern void (APIENTRY * bglVertexAttrib3fvARB)(GLuint, const GLfloat *); -extern void (APIENTRY * bglVertexAttrib3sARB)(GLuint, GLshort, GLshort, GLshort); -extern void (APIENTRY * bglVertexAttrib3svARB)(GLuint, const GLshort *); -extern void (APIENTRY * bglVertexAttrib4NbvARB)(GLuint, const GLbyte *); -extern void (APIENTRY * bglVertexAttrib4NivARB)(GLuint, const GLint *); -extern void (APIENTRY * bglVertexAttrib4NsvARB)(GLuint, const GLshort *); -extern void (APIENTRY * bglVertexAttrib4NubARB)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -extern void (APIENTRY * bglVertexAttrib4NubvARB)(GLuint, const GLubyte *); -extern void (APIENTRY * bglVertexAttrib4NuivARB)(GLuint, const GLuint *); -extern void (APIENTRY * bglVertexAttrib4NusvARB)(GLuint, const GLushort *); -extern void (APIENTRY * bglVertexAttrib4bvARB)(GLuint, const GLbyte *); -extern void (APIENTRY * bglVertexAttrib4dARB)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -extern void (APIENTRY * bglVertexAttrib4dvARB)(GLuint, const GLdouble *); -extern void (APIENTRY * bglVertexAttrib4fARB)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -extern void (APIENTRY * bglVertexAttrib4fvARB)(GLuint, const GLfloat *); -extern void (APIENTRY * bglVertexAttrib4ivARB)(GLuint, const GLint *); -extern void (APIENTRY * bglVertexAttrib4sARB)(GLuint, GLshort, GLshort, GLshort, GLshort); -extern void (APIENTRY * bglVertexAttrib4svARB)(GLuint, const GLshort *); -extern void (APIENTRY * bglVertexAttrib4ubvARB)(GLuint, const GLubyte *); -extern void (APIENTRY * bglVertexAttrib4uivARB)(GLuint, const GLuint *); -extern void (APIENTRY * bglVertexAttrib4usvARB)(GLuint, const GLushort *); -extern void (APIENTRY * bglVertexAttribPointerARB)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -extern void (APIENTRY * bglEnableVertexAttribArrayARB)(GLuint); -extern void (APIENTRY * bglDisableVertexAttribArrayARB)(GLuint); -extern void (APIENTRY * bglGetVertexAttribdvARB)(GLuint, GLenum, GLdouble *); -extern void (APIENTRY * bglGetVertexAttribfvARB)(GLuint, GLenum, GLfloat *); -extern void (APIENTRY * bglGetVertexAttribivARB)(GLuint, GLenum, GLint *); -extern void (APIENTRY * bglGetVertexAttribPointervARB)(GLuint, GLenum, GLvoid* *); -extern void (APIENTRY * bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *); -extern void (APIENTRY * bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -extern GLint (APIENTRY * bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *); - -// GLU -extern void (APIENTRY * bgluTessBeginContour) (GLUtesselator* tess); -extern void (APIENTRY * bgluTessBeginPolygon) (GLUtesselator* tess, GLvoid* data); -extern void (APIENTRY * bgluTessCallback) (GLUtesselator* tess, GLenum which, void (PR_CALLBACK CallBackFunc)()); -extern void (APIENTRY * bgluTessEndContour) (GLUtesselator* tess); -extern void (APIENTRY * bgluTessEndPolygon) (GLUtesselator* tess); -extern void (APIENTRY * bgluTessNormal) (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); -extern void (APIENTRY * bgluTessProperty) (GLUtesselator* tess, GLenum which, GLdouble data); -extern void (APIENTRY * bgluTessVertex) (GLUtesselator* tess, GLdouble *location, GLvoid* data); -extern GLUtesselator* (APIENTRY * bgluNewTess) (void); - -extern void (APIENTRY * bgluPerspective) (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); - -extern const GLubyte * (APIENTRY * bgluErrorString) (GLenum error); - -extern GLint (APIENTRY * bgluProject)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ); -extern GLint (APIENTRY * bgluUnProject)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble* objX, GLdouble* objY, GLdouble* objZ); - -#ifdef RENDERTYPEWIN -// Windows -extern HGLRC (WINAPI * bwglCreateContext)(HDC); -extern BOOL (WINAPI * bwglDeleteContext)(HGLRC); -extern PROC (WINAPI * bwglGetProcAddress)(LPCSTR); -extern BOOL (WINAPI * bwglMakeCurrent)(HDC,HGLRC); - -extern BOOL (WINAPI * bwglSwapBuffers)(HDC); -extern int32_t (WINAPI * bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR*); -extern int32_t (WINAPI * bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR); -extern int32_t (WINAPI * bwglGetPixelFormat)(HDC); -extern BOOL (WINAPI * bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*); -extern BOOL (WINAPI * bwglSwapIntervalEXT)(int32_t); -#endif - -#endif //USE_OPENGL - -extern char *gldriver; - -int32_t loadgldriver(const char *driver); -int32_t loadglextensions(void); -int32_t unloadgldriver(void); - -int32_t loadglulibrary(const char *driver); -int32_t unloadglulibrary(void); diff --git a/polymer-perf/eduke32/build/include/glext.h b/polymer-perf/eduke32/build/include/glext.h deleted file mode 100644 index 2b22714c3..000000000 --- a/polymer-perf/eduke32/build/include/glext.h +++ /dev/null @@ -1,7271 +0,0 @@ -#ifndef __glext_h_ -#define __glext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2007 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif -#ifndef GLAPI -#define GLAPI extern -#endif - -/*************************************************************/ - -/* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated 2008/03/24 */ -/* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 40 - -#ifndef GL_VERSION_1_2 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_RESCALE_NORMAL 0x803A -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#endif - -#ifndef GL_ARB_imaging -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_FUNC_ADD 0x8006 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BLEND_EQUATION 0x8009 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 -#define GL_CONVOLUTION_BORDER_MODE 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS 0x8015 -#define GL_REDUCE 0x8016 -#define GL_CONVOLUTION_FORMAT 0x8017 -#define GL_CONVOLUTION_WIDTH 0x8018 -#define GL_CONVOLUTION_HEIGHT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 -#define GL_HISTOGRAM_WIDTH 0x8026 -#define GL_HISTOGRAM_FORMAT 0x8027 -#define GL_HISTOGRAM_RED_SIZE 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C -#define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E -#define GL_MINMAX_FORMAT 0x802F -#define GL_MINMAX_SINK 0x8030 -#define GL_TABLE_TOO_LARGE 0x8031 -#define GL_COLOR_MATRIX 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 -#define GL_COLOR_TABLE_SCALE 0x80D6 -#define GL_COLOR_TABLE_BIAS 0x80D7 -#define GL_COLOR_TABLE_FORMAT 0x80D8 -#define GL_COLOR_TABLE_WIDTH 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF -#define GL_CONSTANT_BORDER 0x8151 -#define GL_REPLICATE_BORDER 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR 0x8154 -#endif - -#ifndef GL_VERSION_1_3 -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#endif - -#ifndef GL_VERSION_1_4 -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#endif - -#ifndef GL_VERSION_1_5 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE -#define GL_FOG_COORD GL_FOG_COORDINATE -#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE -#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE -#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE -#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER -#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING -#define GL_SRC0_RGB GL_SOURCE0_RGB -#define GL_SRC1_RGB GL_SOURCE1_RGB -#define GL_SRC2_RGB GL_SOURCE2_RGB -#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA -#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA -#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA -#endif - -#ifndef GL_VERSION_2_0 -#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_COORDS 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#endif - -#ifndef GL_VERSION_2_1 -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_SLUMINANCE_ALPHA 0x8C44 -#define GL_SLUMINANCE8_ALPHA8 0x8C45 -#define GL_SLUMINANCE 0x8C46 -#define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#define GL_COMPRESSED_SLUMINANCE 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B -#endif - -#ifndef GL_ARB_multitexture -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 -#endif - -#ifndef GL_ARB_multisample -#define GL_MULTISAMPLE_ARB 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F -#define GL_SAMPLE_COVERAGE_ARB 0x80A0 -#define GL_SAMPLE_BUFFERS_ARB 0x80A8 -#define GL_SAMPLES_ARB 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB -#define GL_MULTISAMPLE_BIT_ARB 0x20000000 -#endif - -#ifndef GL_ARB_texture_env_add -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_NORMAL_MAP_ARB 0x8511 -#define GL_REFLECTION_MAP_ARB 0x8512 -#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C -#endif - -#ifndef GL_ARB_texture_compression -#define GL_COMPRESSED_ALPHA_ARB 0x84E9 -#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB -#define GL_COMPRESSED_INTENSITY_ARB 0x84EC -#define GL_COMPRESSED_RGB_ARB 0x84ED -#define GL_COMPRESSED_RGBA_ARB 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 -#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_CLAMP_TO_BORDER_ARB 0x812D -#endif - -#ifndef GL_ARB_point_parameters -#define GL_POINT_SIZE_MIN_ARB 0x8126 -#define GL_POINT_SIZE_MAX_ARB 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 -#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 -#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 -#define GL_VERTEX_BLEND_ARB 0x86A7 -#define GL_CURRENT_WEIGHT_ARB 0x86A8 -#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 -#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA -#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB -#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC -#define GL_WEIGHT_ARRAY_ARB 0x86AD -#define GL_MODELVIEW0_ARB 0x1700 -#define GL_MODELVIEW1_ARB 0x850A -#define GL_MODELVIEW2_ARB 0x8722 -#define GL_MODELVIEW3_ARB 0x8723 -#define GL_MODELVIEW4_ARB 0x8724 -#define GL_MODELVIEW5_ARB 0x8725 -#define GL_MODELVIEW6_ARB 0x8726 -#define GL_MODELVIEW7_ARB 0x8727 -#define GL_MODELVIEW8_ARB 0x8728 -#define GL_MODELVIEW9_ARB 0x8729 -#define GL_MODELVIEW10_ARB 0x872A -#define GL_MODELVIEW11_ARB 0x872B -#define GL_MODELVIEW12_ARB 0x872C -#define GL_MODELVIEW13_ARB 0x872D -#define GL_MODELVIEW14_ARB 0x872E -#define GL_MODELVIEW15_ARB 0x872F -#define GL_MODELVIEW16_ARB 0x8730 -#define GL_MODELVIEW17_ARB 0x8731 -#define GL_MODELVIEW18_ARB 0x8732 -#define GL_MODELVIEW19_ARB 0x8733 -#define GL_MODELVIEW20_ARB 0x8734 -#define GL_MODELVIEW21_ARB 0x8735 -#define GL_MODELVIEW22_ARB 0x8736 -#define GL_MODELVIEW23_ARB 0x8737 -#define GL_MODELVIEW24_ARB 0x8738 -#define GL_MODELVIEW25_ARB 0x8739 -#define GL_MODELVIEW26_ARB 0x873A -#define GL_MODELVIEW27_ARB 0x873B -#define GL_MODELVIEW28_ARB 0x873C -#define GL_MODELVIEW29_ARB 0x873D -#define GL_MODELVIEW30_ARB 0x873E -#define GL_MODELVIEW31_ARB 0x873F -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_MATRIX_PALETTE_ARB 0x8840 -#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 -#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 -#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 -#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 -#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 -#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 -#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 -#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 -#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_COMBINE_ARB 0x8570 -#define GL_COMBINE_RGB_ARB 0x8571 -#define GL_COMBINE_ALPHA_ARB 0x8572 -#define GL_SOURCE0_RGB_ARB 0x8580 -#define GL_SOURCE1_RGB_ARB 0x8581 -#define GL_SOURCE2_RGB_ARB 0x8582 -#define GL_SOURCE0_ALPHA_ARB 0x8588 -#define GL_SOURCE1_ALPHA_ARB 0x8589 -#define GL_SOURCE2_ALPHA_ARB 0x858A -#define GL_OPERAND0_RGB_ARB 0x8590 -#define GL_OPERAND1_RGB_ARB 0x8591 -#define GL_OPERAND2_RGB_ARB 0x8592 -#define GL_OPERAND0_ALPHA_ARB 0x8598 -#define GL_OPERAND1_ALPHA_ARB 0x8599 -#define GL_OPERAND2_ALPHA_ARB 0x859A -#define GL_RGB_SCALE_ARB 0x8573 -#define GL_ADD_SIGNED_ARB 0x8574 -#define GL_INTERPOLATE_ARB 0x8575 -#define GL_SUBTRACT_ARB 0x84E7 -#define GL_CONSTANT_ARB 0x8576 -#define GL_PRIMARY_COLOR_ARB 0x8577 -#define GL_PREVIOUS_ARB 0x8578 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_DOT3_RGB_ARB 0x86AE -#define GL_DOT3_RGBA_ARB 0x86AF -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_ARB 0x8370 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_DEPTH_COMPONENT16_ARB 0x81A5 -#define GL_DEPTH_COMPONENT24_ARB 0x81A6 -#define GL_DEPTH_COMPONENT32_ARB 0x81A7 -#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A -#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B -#endif - -#ifndef GL_ARB_shadow -#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C -#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D -#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF -#endif - -#ifndef GL_ARB_window_pos -#endif - -#ifndef GL_ARB_vertex_program -#define GL_COLOR_SUM_ARB 0x8458 -#define GL_VERTEX_PROGRAM_ARB 0x8620 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 -#define GL_PROGRAM_LENGTH_ARB 0x8627 -#define GL_PROGRAM_STRING_ARB 0x8628 -#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E -#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F -#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 -#define GL_CURRENT_MATRIX_ARB 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 -#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B -#define GL_PROGRAM_BINDING_ARB 0x8677 -#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A -#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -#define GL_PROGRAM_FORMAT_ARB 0x8876 -#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 -#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 -#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 -#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 -#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 -#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 -#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 -#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 -#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 -#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 -#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA -#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB -#define GL_PROGRAM_ATTRIBS_ARB 0x88AC -#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD -#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE -#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF -#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 -#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 -#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 -#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 -#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 -#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 -#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 -#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 -#define GL_MATRIX0_ARB 0x88C0 -#define GL_MATRIX1_ARB 0x88C1 -#define GL_MATRIX2_ARB 0x88C2 -#define GL_MATRIX3_ARB 0x88C3 -#define GL_MATRIX4_ARB 0x88C4 -#define GL_MATRIX5_ARB 0x88C5 -#define GL_MATRIX6_ARB 0x88C6 -#define GL_MATRIX7_ARB 0x88C7 -#define GL_MATRIX8_ARB 0x88C8 -#define GL_MATRIX9_ARB 0x88C9 -#define GL_MATRIX10_ARB 0x88CA -#define GL_MATRIX11_ARB 0x88CB -#define GL_MATRIX12_ARB 0x88CC -#define GL_MATRIX13_ARB 0x88CD -#define GL_MATRIX14_ARB 0x88CE -#define GL_MATRIX15_ARB 0x88CF -#define GL_MATRIX16_ARB 0x88D0 -#define GL_MATRIX17_ARB 0x88D1 -#define GL_MATRIX18_ARB 0x88D2 -#define GL_MATRIX19_ARB 0x88D3 -#define GL_MATRIX20_ARB 0x88D4 -#define GL_MATRIX21_ARB 0x88D5 -#define GL_MATRIX22_ARB 0x88D6 -#define GL_MATRIX23_ARB 0x88D7 -#define GL_MATRIX24_ARB 0x88D8 -#define GL_MATRIX25_ARB 0x88D9 -#define GL_MATRIX26_ARB 0x88DA -#define GL_MATRIX27_ARB 0x88DB -#define GL_MATRIX28_ARB 0x88DC -#define GL_MATRIX29_ARB 0x88DD -#define GL_MATRIX30_ARB 0x88DE -#define GL_MATRIX31_ARB 0x88DF -#endif - -#ifndef GL_ARB_fragment_program -#define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 -#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 -#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 -#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 -#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 -#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A -#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B -#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C -#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D -#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E -#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F -#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_BUFFER_SIZE_ARB 0x8764 -#define GL_BUFFER_USAGE_ARB 0x8765 -#define GL_ARRAY_BUFFER_ARB 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 -#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F -#define GL_READ_ONLY_ARB 0x88B8 -#define GL_WRITE_ONLY_ARB 0x88B9 -#define GL_READ_WRITE_ARB 0x88BA -#define GL_BUFFER_ACCESS_ARB 0x88BB -#define GL_BUFFER_MAPPED_ARB 0x88BC -#define GL_BUFFER_MAP_POINTER_ARB 0x88BD -#define GL_STREAM_DRAW_ARB 0x88E0 -#define GL_STREAM_READ_ARB 0x88E1 -#define GL_STREAM_COPY_ARB 0x88E2 -#define GL_STATIC_DRAW_ARB 0x88E4 -#define GL_STATIC_READ_ARB 0x88E5 -#define GL_STATIC_COPY_ARB 0x88E6 -#define GL_DYNAMIC_DRAW_ARB 0x88E8 -#define GL_DYNAMIC_READ_ARB 0x88E9 -#define GL_DYNAMIC_COPY_ARB 0x88EA -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_QUERY_COUNTER_BITS_ARB 0x8864 -#define GL_CURRENT_QUERY_ARB 0x8865 -#define GL_QUERY_RESULT_ARB 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 -#define GL_SAMPLES_PASSED_ARB 0x8914 -#endif - -#ifndef GL_ARB_shader_objects -#define GL_PROGRAM_OBJECT_ARB 0x8B40 -#define GL_SHADER_OBJECT_ARB 0x8B48 -#define GL_OBJECT_TYPE_ARB 0x8B4E -#define GL_OBJECT_SUBTYPE_ARB 0x8B4F -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_INT_VEC2_ARB 0x8B53 -#define GL_INT_VEC3_ARB 0x8B54 -#define GL_INT_VEC4_ARB 0x8B55 -#define GL_BOOL_ARB 0x8B56 -#define GL_BOOL_VEC2_ARB 0x8B57 -#define GL_BOOL_VEC3_ARB 0x8B58 -#define GL_BOOL_VEC4_ARB 0x8B59 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#define GL_SAMPLER_1D_ARB 0x8B5D -#define GL_SAMPLER_2D_ARB 0x8B5E -#define GL_SAMPLER_3D_ARB 0x8B5F -#define GL_SAMPLER_CUBE_ARB 0x8B60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 -#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_VERTEX_SHADER_ARB 0x8B31 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A -#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D -#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 -#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_FRAGMENT_SHADER_ARB 0x8B30 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#endif - -#ifndef GL_ARB_point_sprite -#define GL_POINT_SPRITE_ARB 0x8861 -#define GL_COORD_REPLACE_ARB 0x8862 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 -#define GL_DRAW_BUFFER0_ARB 0x8825 -#define GL_DRAW_BUFFER1_ARB 0x8826 -#define GL_DRAW_BUFFER2_ARB 0x8827 -#define GL_DRAW_BUFFER3_ARB 0x8828 -#define GL_DRAW_BUFFER4_ARB 0x8829 -#define GL_DRAW_BUFFER5_ARB 0x882A -#define GL_DRAW_BUFFER6_ARB 0x882B -#define GL_DRAW_BUFFER7_ARB 0x882C -#define GL_DRAW_BUFFER8_ARB 0x882D -#define GL_DRAW_BUFFER9_ARB 0x882E -#define GL_DRAW_BUFFER10_ARB 0x882F -#define GL_DRAW_BUFFER11_ARB 0x8830 -#define GL_DRAW_BUFFER12_ARB 0x8831 -#define GL_DRAW_BUFFER13_ARB 0x8832 -#define GL_DRAW_BUFFER14_ARB 0x8833 -#define GL_DRAW_BUFFER15_ARB 0x8834 -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B -#define GL_CLAMP_READ_COLOR_ARB 0x891C -#define GL_FIXED_ONLY_ARB 0x891D -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_HALF_FLOAT_ARB 0x140B -#endif - -#ifndef GL_ARB_texture_float -#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 -#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 -#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 -#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 -#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 -#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 -#define GL_RGBA32F_ARB 0x8814 -#define GL_RGB32F_ARB 0x8815 -#define GL_ALPHA32F_ARB 0x8816 -#define GL_INTENSITY32F_ARB 0x8817 -#define GL_LUMINANCE32F_ARB 0x8818 -#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 -#define GL_RGBA16F_ARB 0x881A -#define GL_RGB16F_ARB 0x881B -#define GL_ALPHA16F_ARB 0x881C -#define GL_INTENSITY16F_ARB 0x881D -#define GL_LUMINANCE16F_ARB 0x881E -#define GL_LUMINANCE_ALPHA16F_ARB 0x881F -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF -#endif - -#ifndef GL_EXT_abgr -#define GL_ABGR_EXT 0x8000 -#endif - -#ifndef GL_EXT_blend_color -#define GL_CONSTANT_COLOR_EXT 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 -#define GL_CONSTANT_ALPHA_EXT 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 -#define GL_BLEND_COLOR_EXT 0x8005 -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_POLYGON_OFFSET_EXT 0x8037 -#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 -#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 -#endif - -#ifndef GL_EXT_texture -#define GL_ALPHA4_EXT 0x803B -#define GL_ALPHA8_EXT 0x803C -#define GL_ALPHA12_EXT 0x803D -#define GL_ALPHA16_EXT 0x803E -#define GL_LUMINANCE4_EXT 0x803F -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE12_EXT 0x8041 -#define GL_LUMINANCE16_EXT 0x8042 -#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 -#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 -#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 -#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 -#define GL_INTENSITY_EXT 0x8049 -#define GL_INTENSITY4_EXT 0x804A -#define GL_INTENSITY8_EXT 0x804B -#define GL_INTENSITY12_EXT 0x804C -#define GL_INTENSITY16_EXT 0x804D -#define GL_RGB2_EXT 0x804E -#define GL_RGB4_EXT 0x804F -#define GL_RGB5_EXT 0x8050 -#define GL_RGB8_EXT 0x8051 -#define GL_RGB10_EXT 0x8052 -#define GL_RGB12_EXT 0x8053 -#define GL_RGB16_EXT 0x8054 -#define GL_RGBA2_EXT 0x8055 -#define GL_RGBA4_EXT 0x8056 -#define GL_RGB5_A1_EXT 0x8057 -#define GL_RGBA8_EXT 0x8058 -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGBA12_EXT 0x805A -#define GL_RGBA16_EXT 0x805B -#define GL_TEXTURE_RED_SIZE_EXT 0x805C -#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D -#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E -#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 -#define GL_REPLACE_EXT 0x8062 -#define GL_PROXY_TEXTURE_1D_EXT 0x8063 -#define GL_PROXY_TEXTURE_2D_EXT 0x8064 -#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 -#endif - -#ifndef GL_EXT_texture3D -#define GL_PACK_SKIP_IMAGES_EXT 0x806B -#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C -#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D -#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E -#define GL_TEXTURE_3D_EXT 0x806F -#define GL_PROXY_TEXTURE_3D_EXT 0x8070 -#define GL_TEXTURE_DEPTH_EXT 0x8071 -#define GL_TEXTURE_WRAP_R_EXT 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_FILTER4_SGIS 0x8146 -#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 -#endif - -#ifndef GL_EXT_subtexture -#endif - -#ifndef GL_EXT_copy_texture -#endif - -#ifndef GL_EXT_histogram -#define GL_HISTOGRAM_EXT 0x8024 -#define GL_PROXY_HISTOGRAM_EXT 0x8025 -#define GL_HISTOGRAM_WIDTH_EXT 0x8026 -#define GL_HISTOGRAM_FORMAT_EXT 0x8027 -#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A -#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B -#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C -#define GL_HISTOGRAM_SINK_EXT 0x802D -#define GL_MINMAX_EXT 0x802E -#define GL_MINMAX_FORMAT_EXT 0x802F -#define GL_MINMAX_SINK_EXT 0x8030 -#define GL_TABLE_TOO_LARGE_EXT 0x8031 -#endif - -#ifndef GL_EXT_convolution -#define GL_CONVOLUTION_1D_EXT 0x8010 -#define GL_CONVOLUTION_2D_EXT 0x8011 -#define GL_SEPARABLE_2D_EXT 0x8012 -#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 -#define GL_REDUCE_EXT 0x8016 -#define GL_CONVOLUTION_FORMAT_EXT 0x8017 -#define GL_CONVOLUTION_WIDTH_EXT 0x8018 -#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A -#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B -#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C -#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D -#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E -#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F -#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 -#endif - -#ifndef GL_SGI_color_matrix -#define GL_COLOR_MATRIX_SGI 0x80B1 -#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 -#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 -#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB -#endif - -#ifndef GL_SGI_color_table -#define GL_COLOR_TABLE_SGI 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 -#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 -#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 -#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 -#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 -#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_PIXEL_TEXTURE_SGIS 0x8353 -#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 -#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 -#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_PIXEL_TEX_GEN_SGIX 0x8139 -#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B -#endif - -#ifndef GL_SGIS_texture4D -#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 -#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 -#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 -#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 -#define GL_TEXTURE_4D_SGIS 0x8134 -#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 -#define GL_TEXTURE_4DSIZE_SGIS 0x8136 -#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 -#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 -#define GL_TEXTURE_4D_BINDING_SGIS 0x814F -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC -#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD -#endif - -#ifndef GL_EXT_cmyka -#define GL_CMYK_EXT 0x800C -#define GL_CMYKA_EXT 0x800D -#define GL_PACK_CMYK_HINT_EXT 0x800E -#define GL_UNPACK_CMYK_HINT_EXT 0x800F -#endif - -#ifndef GL_EXT_texture_object -#define GL_TEXTURE_PRIORITY_EXT 0x8066 -#define GL_TEXTURE_RESIDENT_EXT 0x8067 -#define GL_TEXTURE_1D_BINDING_EXT 0x8068 -#define GL_TEXTURE_2D_BINDING_EXT 0x8069 -#define GL_TEXTURE_3D_BINDING_EXT 0x806A -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 -#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 -#define GL_LINEAR_DETAIL_SGIS 0x8097 -#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 -#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 -#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A -#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B -#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_LINEAR_SHARPEN_SGIS 0x80AD -#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE -#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF -#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_TEXTURE_MIN_LOD_SGIS 0x813A -#define GL_TEXTURE_MAX_LOD_SGIS 0x813B -#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C -#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D -#endif - -#ifndef GL_SGIS_multisample -#define GL_MULTISAMPLE_SGIS 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F -#define GL_SAMPLE_MASK_SGIS 0x80A0 -#define GL_1PASS_SGIS 0x80A1 -#define GL_2PASS_0_SGIS 0x80A2 -#define GL_2PASS_1_SGIS 0x80A3 -#define GL_4PASS_0_SGIS 0x80A4 -#define GL_4PASS_1_SGIS 0x80A5 -#define GL_4PASS_2_SGIS 0x80A6 -#define GL_4PASS_3_SGIS 0x80A7 -#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 -#define GL_SAMPLES_SGIS 0x80A9 -#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA -#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB -#define GL_SAMPLE_PATTERN_SGIS 0x80AC -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_RESCALE_NORMAL_EXT 0x803A -#endif - -#ifndef GL_EXT_vertex_array -#define GL_VERTEX_ARRAY_EXT 0x8074 -#define GL_NORMAL_ARRAY_EXT 0x8075 -#define GL_COLOR_ARRAY_EXT 0x8076 -#define GL_INDEX_ARRAY_EXT 0x8077 -#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 -#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A -#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B -#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C -#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D -#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E -#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F -#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 -#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 -#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 -#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 -#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 -#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 -#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 -#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 -#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A -#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B -#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C -#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D -#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E -#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F -#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 -#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 -#endif - -#ifndef GL_EXT_misc_attribute -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_GENERATE_MIPMAP_SGIS 0x8191 -#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 -#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 -#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 -#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 -#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 -#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 -#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 -#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 -#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 -#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D -#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E -#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F -#endif - -#ifndef GL_SGIX_shadow -#define GL_TEXTURE_COMPARE_SGIX 0x819A -#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B -#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C -#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_CLAMP_TO_EDGE_SGIS 0x812F -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_CLAMP_TO_BORDER_SGIS 0x812D -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_BLEND_EQUATION_EXT 0x8009 -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_FUNC_SUBTRACT_EXT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B -#endif - -#ifndef GL_EXT_blend_logic_op -#endif - -#ifndef GL_SGIX_interlace -#define GL_INTERLACE_SGIX 0x8094 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E -#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F -#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 -#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 -#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 -#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 -#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 -#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 -#endif - -#ifndef GL_SGIS_texture_select -#define GL_DUAL_ALPHA4_SGIS 0x8110 -#define GL_DUAL_ALPHA8_SGIS 0x8111 -#define GL_DUAL_ALPHA12_SGIS 0x8112 -#define GL_DUAL_ALPHA16_SGIS 0x8113 -#define GL_DUAL_LUMINANCE4_SGIS 0x8114 -#define GL_DUAL_LUMINANCE8_SGIS 0x8115 -#define GL_DUAL_LUMINANCE12_SGIS 0x8116 -#define GL_DUAL_LUMINANCE16_SGIS 0x8117 -#define GL_DUAL_INTENSITY4_SGIS 0x8118 -#define GL_DUAL_INTENSITY8_SGIS 0x8119 -#define GL_DUAL_INTENSITY12_SGIS 0x811A -#define GL_DUAL_INTENSITY16_SGIS 0x811B -#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C -#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D -#define GL_QUAD_ALPHA4_SGIS 0x811E -#define GL_QUAD_ALPHA8_SGIS 0x811F -#define GL_QUAD_LUMINANCE4_SGIS 0x8120 -#define GL_QUAD_LUMINANCE8_SGIS 0x8121 -#define GL_QUAD_INTENSITY4_SGIS 0x8122 -#define GL_QUAD_INTENSITY8_SGIS 0x8123 -#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 -#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SPRITE_SGIX 0x8148 -#define GL_SPRITE_MODE_SGIX 0x8149 -#define GL_SPRITE_AXIS_SGIX 0x814A -#define GL_SPRITE_TRANSLATION_SGIX 0x814B -#define GL_SPRITE_AXIAL_SGIX 0x814C -#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D -#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E -#endif - -#ifndef GL_EXT_point_parameters -#define GL_POINT_SIZE_MIN_EXT 0x8126 -#define GL_POINT_SIZE_MAX_EXT 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 -#define GL_DISTANCE_ATTENUATION_EXT 0x8129 -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_POINT_SIZE_MIN_SGIS 0x8126 -#define GL_POINT_SIZE_MAX_SGIS 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 -#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 -#endif - -#ifndef GL_SGIX_instruments -#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 -#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 -#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A -#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B -#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C -#endif - -#ifndef GL_SGIX_framezoom -#define GL_FRAMEZOOM_SGIX 0x818B -#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C -#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#endif - -#ifndef GL_FfdMaskSGIX -#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 -#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 -#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 -#define GL_DEFORMATIONS_MASK_SGIX 0x8196 -#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_REFERENCE_PLANE_SGIX 0x817D -#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E -#endif - -#ifndef GL_SGIX_flush_raster -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 -#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 -#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_FOG_FUNC_SGIS 0x812A -#define GL_FOG_FUNC_POINTS_SGIS 0x812B -#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_FOG_OFFSET_SGIX 0x8198 -#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 -#endif - -#ifndef GL_HP_image_transform -#define GL_IMAGE_SCALE_X_HP 0x8155 -#define GL_IMAGE_SCALE_Y_HP 0x8156 -#define GL_IMAGE_TRANSLATE_X_HP 0x8157 -#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 -#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 -#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A -#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B -#define GL_IMAGE_MAG_FILTER_HP 0x815C -#define GL_IMAGE_MIN_FILTER_HP 0x815D -#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E -#define GL_CUBIC_HP 0x815F -#define GL_AVERAGE_HP 0x8160 -#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 -#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 -#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_IGNORE_BORDER_HP 0x8150 -#define GL_CONSTANT_BORDER_HP 0x8151 -#define GL_REPLICATE_BORDER_HP 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 -#endif - -#ifndef GL_INGR_palette_buffer -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE -#endif - -#ifndef GL_EXT_color_subtable -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_VERTEX_DATA_HINT_PGI 0x1A22A -#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B -#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C -#define GL_MAX_VERTEX_HINT_PGI 0x1A22D -#define GL_COLOR3_BIT_PGI 0x00010000 -#define GL_COLOR4_BIT_PGI 0x00020000 -#define GL_EDGEFLAG_BIT_PGI 0x00040000 -#define GL_INDEX_BIT_PGI 0x00080000 -#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 -#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 -#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 -#define GL_MAT_EMISSION_BIT_PGI 0x00800000 -#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 -#define GL_MAT_SHININESS_BIT_PGI 0x02000000 -#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 -#define GL_NORMAL_BIT_PGI 0x08000000 -#define GL_TEXCOORD1_BIT_PGI 0x10000000 -#define GL_TEXCOORD2_BIT_PGI 0x20000000 -#define GL_TEXCOORD3_BIT_PGI 0x40000000 -#define GL_TEXCOORD4_BIT_PGI 0x80000000 -#define GL_VERTEX23_BIT_PGI 0x00000004 -#define GL_VERTEX4_BIT_PGI 0x00000008 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 -#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD -#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE -#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 -#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 -#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 -#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C -#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D -#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E -#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F -#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 -#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 -#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 -#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 -#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 -#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 -#define GL_CLIP_NEAR_HINT_PGI 0x1A220 -#define GL_CLIP_FAR_HINT_PGI 0x1A221 -#define GL_WIDE_LINE_HINT_PGI 0x1A222 -#define GL_BACK_NORMALS_HINT_PGI 0x1A223 -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_COLOR_INDEX1_EXT 0x80E2 -#define GL_COLOR_INDEX2_EXT 0x80E3 -#define GL_COLOR_INDEX4_EXT 0x80E4 -#define GL_COLOR_INDEX8_EXT 0x80E5 -#define GL_COLOR_INDEX12_EXT 0x80E6 -#define GL_COLOR_INDEX16_EXT 0x80E7 -#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_LIST_PRIORITY_SGIX 0x8182 -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_IR_INSTRUMENT1_SGIX 0x817F -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E -#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F -#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SHADOW_AMBIENT_SGIX 0x80BF -#endif - -#ifndef GL_EXT_index_texture -#endif - -#ifndef GL_EXT_index_material -#define GL_INDEX_MATERIAL_EXT 0x81B8 -#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 -#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA -#endif - -#ifndef GL_EXT_index_func -#define GL_INDEX_TEST_EXT 0x81B5 -#define GL_INDEX_TEST_FUNC_EXT 0x81B6 -#define GL_INDEX_TEST_REF_EXT 0x81B7 -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_IUI_V2F_EXT 0x81AD -#define GL_IUI_V3F_EXT 0x81AE -#define GL_IUI_N3F_V2F_EXT 0x81AF -#define GL_IUI_N3F_V3F_EXT 0x81B0 -#define GL_T2F_IUI_V2F_EXT 0x81B1 -#define GL_T2F_IUI_V3F_EXT 0x81B2 -#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 -#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 -#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_CULL_VERTEX_EXT 0x81AA -#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB -#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_YCRCB_422_SGIX 0x81BB -#define GL_YCRCB_444_SGIX 0x81BC -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 -#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 -#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 -#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 -#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 -#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 -#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 -#define GL_LIGHT_ENV_MODE_SGIX 0x8407 -#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 -#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 -#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A -#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B -#define GL_FRAGMENT_LIGHT0_SGIX 0x840C -#define GL_FRAGMENT_LIGHT1_SGIX 0x840D -#define GL_FRAGMENT_LIGHT2_SGIX 0x840E -#define GL_FRAGMENT_LIGHT3_SGIX 0x840F -#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 -#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 -#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 -#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 -#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 -#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 -#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 -#endif - -#ifndef GL_WIN_phong_shading -#define GL_PHONG_WIN 0x80EA -#define GL_PHONG_HINT_WIN 0x80EB -#endif - -#ifndef GL_WIN_specular_fog -#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC -#endif - -#ifndef GL_EXT_light_texture -#define GL_FRAGMENT_MATERIAL_EXT 0x8349 -#define GL_FRAGMENT_NORMAL_EXT 0x834A -#define GL_FRAGMENT_COLOR_EXT 0x834C -#define GL_ATTENUATION_EXT 0x834D -#define GL_SHADOW_ATTENUATION_EXT 0x834E -#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F -#define GL_TEXTURE_LIGHT_EXT 0x8350 -#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 -#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 -/* reuse GL_FRAGMENT_DEPTH_EXT */ -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_ALPHA_MIN_SGIX 0x8320 -#define GL_ALPHA_MAX_SGIX 0x8321 -#endif - -#ifndef GL_SGIX_impact_pixel_texture -#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 -#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 -#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 -#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 -#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 -#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 -#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A -#endif - -#ifndef GL_EXT_bgra -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 -#endif - -#ifndef GL_SGIX_async -#define GL_ASYNC_MARKER_SGIX 0x8329 -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C -#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D -#define GL_ASYNC_READ_PIXELS_SGIX 0x835E -#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F -#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 -#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_ASYNC_HISTOGRAM_SGIX 0x832C -#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D -#endif - -#ifndef GL_INTEL_texture_scissor -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 -#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 -#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 -#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 -#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 -#endif - -#ifndef GL_HP_occlusion_test -#define GL_OCCLUSION_TEST_HP 0x8165 -#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 -#define GL_PIXEL_MAG_FILTER_EXT 0x8331 -#define GL_PIXEL_MIN_FILTER_EXT 0x8332 -#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 -#define GL_CUBIC_EXT 0x8334 -#define GL_AVERAGE_EXT 0x8335 -#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 -#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 -#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 -#define GL_SINGLE_COLOR_EXT 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA -#endif - -#ifndef GL_EXT_secondary_color -#define GL_COLOR_SUM_EXT 0x8458 -#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D -#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_PERTURB_EXT 0x85AE -#define GL_TEXTURE_NORMAL_EXT 0x85AF -#endif - -#ifndef GL_EXT_multi_draw_arrays -#endif - -#ifndef GL_EXT_fog_coord -#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 -#define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 -#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 -#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_SCREEN_COORDINATES_REND 0x8490 -#define GL_INVERTED_SCREEN_W_REND 0x8491 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_TANGENT_ARRAY_EXT 0x8439 -#define GL_BINORMAL_ARRAY_EXT 0x843A -#define GL_CURRENT_TANGENT_EXT 0x843B -#define GL_CURRENT_BINORMAL_EXT 0x843C -#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E -#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F -#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 -#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 -#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 -#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 -#define GL_MAP1_TANGENT_EXT 0x8444 -#define GL_MAP2_TANGENT_EXT 0x8445 -#define GL_MAP1_BINORMAL_EXT 0x8446 -#define GL_MAP2_BINORMAL_EXT 0x8447 -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_COMBINE_EXT 0x8570 -#define GL_COMBINE_RGB_EXT 0x8571 -#define GL_COMBINE_ALPHA_EXT 0x8572 -#define GL_RGB_SCALE_EXT 0x8573 -#define GL_ADD_SIGNED_EXT 0x8574 -#define GL_INTERPOLATE_EXT 0x8575 -#define GL_CONSTANT_EXT 0x8576 -#define GL_PRIMARY_COLOR_EXT 0x8577 -#define GL_PREVIOUS_EXT 0x8578 -#define GL_SOURCE0_RGB_EXT 0x8580 -#define GL_SOURCE1_RGB_EXT 0x8581 -#define GL_SOURCE2_RGB_EXT 0x8582 -#define GL_SOURCE0_ALPHA_EXT 0x8588 -#define GL_SOURCE1_ALPHA_EXT 0x8589 -#define GL_SOURCE2_ALPHA_EXT 0x858A -#define GL_OPERAND0_RGB_EXT 0x8590 -#define GL_OPERAND1_RGB_EXT 0x8591 -#define GL_OPERAND2_RGB_EXT 0x8592 -#define GL_OPERAND0_ALPHA_EXT 0x8598 -#define GL_OPERAND1_ALPHA_EXT 0x8599 -#define GL_OPERAND2_ALPHA_EXT 0x859A -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_TRANSFORM_HINT_APPLE 0x85B1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_FOG_SCALE_SGIX 0x81FC -#define GL_FOG_SCALE_VALUE_SGIX 0x81FD -#endif - -#ifndef GL_SUNX_constant_data -#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 -#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 -#endif - -#ifndef GL_SUN_global_alpha -#define GL_GLOBAL_ALPHA_SUN 0x81D9 -#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA -#endif - -#ifndef GL_SUN_triangle_list -#define GL_RESTART_SUN 0x0001 -#define GL_REPLACE_MIDDLE_SUN 0x0002 -#define GL_REPLACE_OLDEST_SUN 0x0003 -#define GL_TRIANGLE_LIST_SUN 0x81D7 -#define GL_REPLACEMENT_CODE_SUN 0x81D8 -#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 -#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 -#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 -#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 -#define GL_R1UI_V3F_SUN 0x85C4 -#define GL_R1UI_C4UB_V3F_SUN 0x85C5 -#define GL_R1UI_C3F_V3F_SUN 0x85C6 -#define GL_R1UI_N3F_V3F_SUN 0x85C7 -#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 -#define GL_R1UI_T2F_V3F_SUN 0x85C9 -#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA -#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB -#endif - -#ifndef GL_SUN_vertex -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_BLEND_DST_RGB_EXT 0x80C8 -#define GL_BLEND_SRC_RGB_EXT 0x80C9 -#define GL_BLEND_DST_ALPHA_EXT 0x80CA -#define GL_BLEND_SRC_ALPHA_EXT 0x80CB -#endif - -#ifndef GL_INGR_color_clamp -#define GL_RED_MIN_CLAMP_INGR 0x8560 -#define GL_GREEN_MIN_CLAMP_INGR 0x8561 -#define GL_BLUE_MIN_CLAMP_INGR 0x8562 -#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 -#define GL_RED_MAX_CLAMP_INGR 0x8564 -#define GL_GREEN_MAX_CLAMP_INGR 0x8565 -#define GL_BLUE_MAX_CLAMP_INGR 0x8566 -#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INTERLACE_READ_INGR 0x8568 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_INCR_WRAP_EXT 0x8507 -#define GL_DECR_WRAP_EXT 0x8508 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_422_EXT 0x80CC -#define GL_422_REV_EXT 0x80CD -#define GL_422_AVERAGE_EXT 0x80CE -#define GL_422_REV_AVERAGE_EXT 0x80CF -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NORMAL_MAP_NV 0x8511 -#define GL_REFLECTION_MAP_NV 0x8512 -#endif - -#ifndef GL_EXT_texture_cube_map -#define GL_NORMAL_MAP_EXT 0x8511 -#define GL_REFLECTION_MAP_EXT 0x8512 -#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_WRAP_BORDER_SUN 0x81D4 -#endif - -#ifndef GL_EXT_texture_env_add -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD -#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 -#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH -#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 -#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX -#define GL_MODELVIEW1_MATRIX_EXT 0x8506 -#define GL_VERTEX_WEIGHTING_EXT 0x8509 -#define GL_MODELVIEW0_EXT GL_MODELVIEW -#define GL_MODELVIEW1_EXT 0x850A -#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B -#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C -#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D -#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E -#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F -#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_MAX_SHININESS_NV 0x8504 -#define GL_MAX_SPOT_EXPONENT_NV 0x8505 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_NV 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E -#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F -#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 -#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 -#endif - -#ifndef GL_NV_register_combiners -#define GL_REGISTER_COMBINERS_NV 0x8522 -#define GL_VARIABLE_A_NV 0x8523 -#define GL_VARIABLE_B_NV 0x8524 -#define GL_VARIABLE_C_NV 0x8525 -#define GL_VARIABLE_D_NV 0x8526 -#define GL_VARIABLE_E_NV 0x8527 -#define GL_VARIABLE_F_NV 0x8528 -#define GL_VARIABLE_G_NV 0x8529 -#define GL_CONSTANT_COLOR0_NV 0x852A -#define GL_CONSTANT_COLOR1_NV 0x852B -#define GL_PRIMARY_COLOR_NV 0x852C -#define GL_SECONDARY_COLOR_NV 0x852D -#define GL_SPARE0_NV 0x852E -#define GL_SPARE1_NV 0x852F -#define GL_DISCARD_NV 0x8530 -#define GL_E_TIMES_F_NV 0x8531 -#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 -#define GL_UNSIGNED_IDENTITY_NV 0x8536 -#define GL_UNSIGNED_INVERT_NV 0x8537 -#define GL_EXPAND_NORMAL_NV 0x8538 -#define GL_EXPAND_NEGATE_NV 0x8539 -#define GL_HALF_BIAS_NORMAL_NV 0x853A -#define GL_HALF_BIAS_NEGATE_NV 0x853B -#define GL_SIGNED_IDENTITY_NV 0x853C -#define GL_SIGNED_NEGATE_NV 0x853D -#define GL_SCALE_BY_TWO_NV 0x853E -#define GL_SCALE_BY_FOUR_NV 0x853F -#define GL_SCALE_BY_ONE_HALF_NV 0x8540 -#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 -#define GL_COMBINER_INPUT_NV 0x8542 -#define GL_COMBINER_MAPPING_NV 0x8543 -#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 -#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 -#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 -#define GL_COMBINER_MUX_SUM_NV 0x8547 -#define GL_COMBINER_SCALE_NV 0x8548 -#define GL_COMBINER_BIAS_NV 0x8549 -#define GL_COMBINER_AB_OUTPUT_NV 0x854A -#define GL_COMBINER_CD_OUTPUT_NV 0x854B -#define GL_COMBINER_SUM_OUTPUT_NV 0x854C -#define GL_MAX_GENERAL_COMBINERS_NV 0x854D -#define GL_NUM_GENERAL_COMBINERS_NV 0x854E -#define GL_COLOR_SUM_CLAMP_NV 0x854F -#define GL_COMBINER0_NV 0x8550 -#define GL_COMBINER1_NV 0x8551 -#define GL_COMBINER2_NV 0x8552 -#define GL_COMBINER3_NV 0x8553 -#define GL_COMBINER4_NV 0x8554 -#define GL_COMBINER5_NV 0x8555 -#define GL_COMBINER6_NV 0x8556 -#define GL_COMBINER7_NV 0x8557 -/* reuse GL_TEXTURE0_ARB */ -/* reuse GL_TEXTURE1_ARB */ -/* reuse GL_ZERO */ -/* reuse GL_NONE */ -/* reuse GL_FOG */ -#endif - -#ifndef GL_NV_fog_distance -#define GL_FOG_DISTANCE_MODE_NV 0x855A -#define GL_EYE_RADIAL_NV 0x855B -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C -/* reuse GL_EYE_PLANE */ -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_EMBOSS_LIGHT_NV 0x855D -#define GL_EMBOSS_CONSTANT_NV 0x855E -#define GL_EMBOSS_MAP_NV 0x855F -#endif - -#ifndef GL_NV_blend_square -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_COMBINE4_NV 0x8503 -#define GL_SOURCE3_RGB_NV 0x8583 -#define GL_SOURCE3_ALPHA_NV 0x858B -#define GL_OPERAND3_RGB_NV 0x8593 -#define GL_OPERAND3_ALPHA_NV 0x859B -#endif - -#ifndef GL_MESA_resize_buffers -#endif - -#ifndef GL_MESA_window_pos -#endif - -#ifndef GL_EXT_texture_compression_s3tc -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_CULL_VERTEX_IBM 103050 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_VERTEX_ARRAY_LIST_IBM 103070 -#define GL_NORMAL_ARRAY_LIST_IBM 103071 -#define GL_COLOR_ARRAY_LIST_IBM 103072 -#define GL_INDEX_ARRAY_LIST_IBM 103073 -#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 -#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 -#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 -#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 -#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 -#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 -#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 -#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 -#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 -#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 -#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 -#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 -#endif - -#ifndef GL_SGIX_subsample -#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 -#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 -#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 -#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 -#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_YCRCB_SGIX 0x8318 -#define GL_YCRCBA_SGIX 0x8319 -#endif - -#ifndef GL_SGI_depth_pass_instrument -#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 -#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 -#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 -#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_MULTISAMPLE_3DFX 0x86B2 -#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 -#define GL_SAMPLES_3DFX 0x86B4 -#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 -#endif - -#ifndef GL_3DFX_tbuffer -#endif - -#ifndef GL_EXT_multisample -#define GL_MULTISAMPLE_EXT 0x809D -#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F -#define GL_SAMPLE_MASK_EXT 0x80A0 -#define GL_1PASS_EXT 0x80A1 -#define GL_2PASS_0_EXT 0x80A2 -#define GL_2PASS_1_EXT 0x80A3 -#define GL_4PASS_0_EXT 0x80A4 -#define GL_4PASS_1_EXT 0x80A5 -#define GL_4PASS_2_EXT 0x80A6 -#define GL_4PASS_3_EXT 0x80A7 -#define GL_SAMPLE_BUFFERS_EXT 0x80A8 -#define GL_SAMPLES_EXT 0x80A9 -#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA -#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB -#define GL_SAMPLE_PATTERN_EXT 0x80AC -#define GL_MULTISAMPLE_BIT_EXT 0x20000000 -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_VERTEX_PRECLIP_SGIX 0x83EE -#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_CONVOLUTION_HINT_SGIX 0x8316 -#endif - -#ifndef GL_SGIX_resample -#define GL_PACK_RESAMPLE_SGIX 0x842C -#define GL_UNPACK_RESAMPLE_SGIX 0x842D -#define GL_RESAMPLE_REPLICATE_SGIX 0x842E -#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F -#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 -#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 -#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 -#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 -#define GL_EYE_POINT_SGIS 0x81F4 -#define GL_OBJECT_POINT_SGIS 0x81F5 -#define GL_EYE_LINE_SGIS 0x81F6 -#define GL_OBJECT_LINE_SGIS 0x81F7 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_DOT3_RGB_EXT 0x8740 -#define GL_DOT3_RGBA_EXT 0x8741 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_MIRROR_CLAMP_ATI 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 -#endif - -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -#ifndef GL_IBM_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_IBM 0x8370 -#endif - -#ifndef GL_NV_evaluators -#define GL_EVAL_2D_NV 0x86C0 -#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 -#define GL_MAP_TESSELLATION_NV 0x86C2 -#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 -#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 -#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 -#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 -#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 -#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 -#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 -#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA -#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB -#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC -#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD -#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE -#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF -#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 -#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 -#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 -#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 -#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 -#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 -#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 -#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_DEPTH_STENCIL_NV 0x84F9 -#define GL_UNSIGNED_INT_24_8_NV 0x84FA -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_PER_STAGE_CONSTANTS_NV 0x8535 -#endif - -#ifndef GL_NV_texture_compression_vtc -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_TEXTURE_RECTANGLE_NV 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 -#endif - -#ifndef GL_NV_texture_shader -#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C -#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D -#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E -#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 -#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA -#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB -#define GL_DSDT_MAG_INTENSITY_NV 0x86DC -#define GL_SHADER_CONSISTENT_NV 0x86DD -#define GL_TEXTURE_SHADER_NV 0x86DE -#define GL_SHADER_OPERATION_NV 0x86DF -#define GL_CULL_MODES_NV 0x86E0 -#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 -#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 -#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 -#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV -#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV -#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV -#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 -#define GL_CONST_EYE_NV 0x86E5 -#define GL_PASS_THROUGH_NV 0x86E6 -#define GL_CULL_FRAGMENT_NV 0x86E7 -#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 -#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 -#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA -#define GL_DOT_PRODUCT_NV 0x86EC -#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED -#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE -#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 -#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 -#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 -#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 -#define GL_HILO_NV 0x86F4 -#define GL_DSDT_NV 0x86F5 -#define GL_DSDT_MAG_NV 0x86F6 -#define GL_DSDT_MAG_VIB_NV 0x86F7 -#define GL_HILO16_NV 0x86F8 -#define GL_SIGNED_HILO_NV 0x86F9 -#define GL_SIGNED_HILO16_NV 0x86FA -#define GL_SIGNED_RGBA_NV 0x86FB -#define GL_SIGNED_RGBA8_NV 0x86FC -#define GL_SIGNED_RGB_NV 0x86FE -#define GL_SIGNED_RGB8_NV 0x86FF -#define GL_SIGNED_LUMINANCE_NV 0x8701 -#define GL_SIGNED_LUMINANCE8_NV 0x8702 -#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 -#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 -#define GL_SIGNED_ALPHA_NV 0x8705 -#define GL_SIGNED_ALPHA8_NV 0x8706 -#define GL_SIGNED_INTENSITY_NV 0x8707 -#define GL_SIGNED_INTENSITY8_NV 0x8708 -#define GL_DSDT8_NV 0x8709 -#define GL_DSDT8_MAG8_NV 0x870A -#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B -#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C -#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D -#define GL_HI_SCALE_NV 0x870E -#define GL_LO_SCALE_NV 0x870F -#define GL_DS_SCALE_NV 0x8710 -#define GL_DT_SCALE_NV 0x8711 -#define GL_MAGNITUDE_SCALE_NV 0x8712 -#define GL_VIBRANCE_SCALE_NV 0x8713 -#define GL_HI_BIAS_NV 0x8714 -#define GL_LO_BIAS_NV 0x8715 -#define GL_DS_BIAS_NV 0x8716 -#define GL_DT_BIAS_NV 0x8717 -#define GL_MAGNITUDE_BIAS_NV 0x8718 -#define GL_VIBRANCE_BIAS_NV 0x8719 -#define GL_TEXTURE_BORDER_VALUES_NV 0x871A -#define GL_TEXTURE_HI_SIZE_NV 0x871B -#define GL_TEXTURE_LO_SIZE_NV 0x871C -#define GL_TEXTURE_DS_SIZE_NV 0x871D -#define GL_TEXTURE_DT_SIZE_NV 0x871E -#define GL_TEXTURE_MAG_SIZE_NV 0x871F -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 -#endif - -#ifndef GL_NV_vertex_program -#define GL_VERTEX_PROGRAM_NV 0x8620 -#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 -#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 -#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 -#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 -#define GL_CURRENT_ATTRIB_NV 0x8626 -#define GL_PROGRAM_LENGTH_NV 0x8627 -#define GL_PROGRAM_STRING_NV 0x8628 -#define GL_MODELVIEW_PROJECTION_NV 0x8629 -#define GL_IDENTITY_NV 0x862A -#define GL_INVERSE_NV 0x862B -#define GL_TRANSPOSE_NV 0x862C -#define GL_INVERSE_TRANSPOSE_NV 0x862D -#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E -#define GL_MAX_TRACK_MATRICES_NV 0x862F -#define GL_MATRIX0_NV 0x8630 -#define GL_MATRIX1_NV 0x8631 -#define GL_MATRIX2_NV 0x8632 -#define GL_MATRIX3_NV 0x8633 -#define GL_MATRIX4_NV 0x8634 -#define GL_MATRIX5_NV 0x8635 -#define GL_MATRIX6_NV 0x8636 -#define GL_MATRIX7_NV 0x8637 -#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 -#define GL_CURRENT_MATRIX_NV 0x8641 -#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 -#define GL_PROGRAM_PARAMETER_NV 0x8644 -#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 -#define GL_PROGRAM_TARGET_NV 0x8646 -#define GL_PROGRAM_RESIDENT_NV 0x8647 -#define GL_TRACK_MATRIX_NV 0x8648 -#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 -#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A -#define GL_PROGRAM_ERROR_POSITION_NV 0x864B -#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 -#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 -#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 -#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 -#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 -#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 -#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 -#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 -#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 -#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 -#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A -#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B -#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C -#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D -#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E -#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F -#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 -#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 -#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 -#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 -#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 -#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 -#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 -#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 -#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 -#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 -#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A -#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B -#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C -#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D -#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E -#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F -#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 -#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 -#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 -#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 -#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 -#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 -#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 -#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 -#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 -#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 -#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A -#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B -#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C -#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D -#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E -#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 -#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A -#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SCALEBIAS_HINT_SGIX 0x8322 -#endif - -#ifndef GL_OML_interlace -#define GL_INTERLACE_OML 0x8980 -#define GL_INTERLACE_READ_OML 0x8981 -#endif - -#ifndef GL_OML_subsample -#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 -#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 -#endif - -#ifndef GL_OML_resample -#define GL_PACK_RESAMPLE_OML 0x8984 -#define GL_UNPACK_RESAMPLE_OML 0x8985 -#define GL_RESAMPLE_REPLICATE_OML 0x8986 -#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 -#define GL_RESAMPLE_AVERAGE_OML 0x8988 -#define GL_RESAMPLE_DECIMATE_OML 0x8989 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E -#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_BUMP_ROT_MATRIX_ATI 0x8775 -#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 -#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 -#define GL_BUMP_TEX_UNITS_ATI 0x8778 -#define GL_DUDV_ATI 0x8779 -#define GL_DU8DV8_ATI 0x877A -#define GL_BUMP_ENVMAP_ATI 0x877B -#define GL_BUMP_TARGET_ATI 0x877C -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_FRAGMENT_SHADER_ATI 0x8920 -#define GL_REG_0_ATI 0x8921 -#define GL_REG_1_ATI 0x8922 -#define GL_REG_2_ATI 0x8923 -#define GL_REG_3_ATI 0x8924 -#define GL_REG_4_ATI 0x8925 -#define GL_REG_5_ATI 0x8926 -#define GL_REG_6_ATI 0x8927 -#define GL_REG_7_ATI 0x8928 -#define GL_REG_8_ATI 0x8929 -#define GL_REG_9_ATI 0x892A -#define GL_REG_10_ATI 0x892B -#define GL_REG_11_ATI 0x892C -#define GL_REG_12_ATI 0x892D -#define GL_REG_13_ATI 0x892E -#define GL_REG_14_ATI 0x892F -#define GL_REG_15_ATI 0x8930 -#define GL_REG_16_ATI 0x8931 -#define GL_REG_17_ATI 0x8932 -#define GL_REG_18_ATI 0x8933 -#define GL_REG_19_ATI 0x8934 -#define GL_REG_20_ATI 0x8935 -#define GL_REG_21_ATI 0x8936 -#define GL_REG_22_ATI 0x8937 -#define GL_REG_23_ATI 0x8938 -#define GL_REG_24_ATI 0x8939 -#define GL_REG_25_ATI 0x893A -#define GL_REG_26_ATI 0x893B -#define GL_REG_27_ATI 0x893C -#define GL_REG_28_ATI 0x893D -#define GL_REG_29_ATI 0x893E -#define GL_REG_30_ATI 0x893F -#define GL_REG_31_ATI 0x8940 -#define GL_CON_0_ATI 0x8941 -#define GL_CON_1_ATI 0x8942 -#define GL_CON_2_ATI 0x8943 -#define GL_CON_3_ATI 0x8944 -#define GL_CON_4_ATI 0x8945 -#define GL_CON_5_ATI 0x8946 -#define GL_CON_6_ATI 0x8947 -#define GL_CON_7_ATI 0x8948 -#define GL_CON_8_ATI 0x8949 -#define GL_CON_9_ATI 0x894A -#define GL_CON_10_ATI 0x894B -#define GL_CON_11_ATI 0x894C -#define GL_CON_12_ATI 0x894D -#define GL_CON_13_ATI 0x894E -#define GL_CON_14_ATI 0x894F -#define GL_CON_15_ATI 0x8950 -#define GL_CON_16_ATI 0x8951 -#define GL_CON_17_ATI 0x8952 -#define GL_CON_18_ATI 0x8953 -#define GL_CON_19_ATI 0x8954 -#define GL_CON_20_ATI 0x8955 -#define GL_CON_21_ATI 0x8956 -#define GL_CON_22_ATI 0x8957 -#define GL_CON_23_ATI 0x8958 -#define GL_CON_24_ATI 0x8959 -#define GL_CON_25_ATI 0x895A -#define GL_CON_26_ATI 0x895B -#define GL_CON_27_ATI 0x895C -#define GL_CON_28_ATI 0x895D -#define GL_CON_29_ATI 0x895E -#define GL_CON_30_ATI 0x895F -#define GL_CON_31_ATI 0x8960 -#define GL_MOV_ATI 0x8961 -#define GL_ADD_ATI 0x8963 -#define GL_MUL_ATI 0x8964 -#define GL_SUB_ATI 0x8965 -#define GL_DOT3_ATI 0x8966 -#define GL_DOT4_ATI 0x8967 -#define GL_MAD_ATI 0x8968 -#define GL_LERP_ATI 0x8969 -#define GL_CND_ATI 0x896A -#define GL_CND0_ATI 0x896B -#define GL_DOT2_ADD_ATI 0x896C -#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D -#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E -#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F -#define GL_NUM_PASSES_ATI 0x8970 -#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 -#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 -#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 -#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 -#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 -#define GL_SWIZZLE_STR_ATI 0x8976 -#define GL_SWIZZLE_STQ_ATI 0x8977 -#define GL_SWIZZLE_STR_DR_ATI 0x8978 -#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 -#define GL_SWIZZLE_STRQ_ATI 0x897A -#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B -#define GL_RED_BIT_ATI 0x00000001 -#define GL_GREEN_BIT_ATI 0x00000002 -#define GL_BLUE_BIT_ATI 0x00000004 -#define GL_2X_BIT_ATI 0x00000001 -#define GL_4X_BIT_ATI 0x00000002 -#define GL_8X_BIT_ATI 0x00000004 -#define GL_HALF_BIT_ATI 0x00000008 -#define GL_QUARTER_BIT_ATI 0x00000010 -#define GL_EIGHTH_BIT_ATI 0x00000020 -#define GL_SATURATE_BIT_ATI 0x00000040 -#define GL_COMP_BIT_ATI 0x00000002 -#define GL_NEGATE_BIT_ATI 0x00000004 -#define GL_BIAS_BIT_ATI 0x00000008 -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_PN_TRIANGLES_ATI 0x87F0 -#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 -#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 -#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 -#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 -#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 -#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 -#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 -#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_STATIC_ATI 0x8760 -#define GL_DYNAMIC_ATI 0x8761 -#define GL_PRESERVE_ATI 0x8762 -#define GL_DISCARD_ATI 0x8763 -#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 -#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 -#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 -#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_VERTEX_SHADER_EXT 0x8780 -#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 -#define GL_OP_INDEX_EXT 0x8782 -#define GL_OP_NEGATE_EXT 0x8783 -#define GL_OP_DOT3_EXT 0x8784 -#define GL_OP_DOT4_EXT 0x8785 -#define GL_OP_MUL_EXT 0x8786 -#define GL_OP_ADD_EXT 0x8787 -#define GL_OP_MADD_EXT 0x8788 -#define GL_OP_FRAC_EXT 0x8789 -#define GL_OP_MAX_EXT 0x878A -#define GL_OP_MIN_EXT 0x878B -#define GL_OP_SET_GE_EXT 0x878C -#define GL_OP_SET_LT_EXT 0x878D -#define GL_OP_CLAMP_EXT 0x878E -#define GL_OP_FLOOR_EXT 0x878F -#define GL_OP_ROUND_EXT 0x8790 -#define GL_OP_EXP_BASE_2_EXT 0x8791 -#define GL_OP_LOG_BASE_2_EXT 0x8792 -#define GL_OP_POWER_EXT 0x8793 -#define GL_OP_RECIP_EXT 0x8794 -#define GL_OP_RECIP_SQRT_EXT 0x8795 -#define GL_OP_SUB_EXT 0x8796 -#define GL_OP_CROSS_PRODUCT_EXT 0x8797 -#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 -#define GL_OP_MOV_EXT 0x8799 -#define GL_OUTPUT_VERTEX_EXT 0x879A -#define GL_OUTPUT_COLOR0_EXT 0x879B -#define GL_OUTPUT_COLOR1_EXT 0x879C -#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D -#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E -#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F -#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 -#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 -#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 -#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 -#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 -#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 -#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 -#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 -#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 -#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 -#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA -#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB -#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC -#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD -#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE -#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF -#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 -#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 -#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 -#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 -#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 -#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 -#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 -#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 -#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 -#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 -#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA -#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB -#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC -#define GL_OUTPUT_FOG_EXT 0x87BD -#define GL_SCALAR_EXT 0x87BE -#define GL_VECTOR_EXT 0x87BF -#define GL_MATRIX_EXT 0x87C0 -#define GL_VARIANT_EXT 0x87C1 -#define GL_INVARIANT_EXT 0x87C2 -#define GL_LOCAL_CONSTANT_EXT 0x87C3 -#define GL_LOCAL_EXT 0x87C4 -#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 -#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 -#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 -#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 -#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD -#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE -#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF -#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 -#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 -#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 -#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 -#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 -#define GL_X_EXT 0x87D5 -#define GL_Y_EXT 0x87D6 -#define GL_Z_EXT 0x87D7 -#define GL_W_EXT 0x87D8 -#define GL_NEGATIVE_X_EXT 0x87D9 -#define GL_NEGATIVE_Y_EXT 0x87DA -#define GL_NEGATIVE_Z_EXT 0x87DB -#define GL_NEGATIVE_W_EXT 0x87DC -#define GL_ZERO_EXT 0x87DD -#define GL_ONE_EXT 0x87DE -#define GL_NEGATIVE_ONE_EXT 0x87DF -#define GL_NORMALIZED_RANGE_EXT 0x87E0 -#define GL_FULL_RANGE_EXT 0x87E1 -#define GL_CURRENT_VERTEX_EXT 0x87E2 -#define GL_MVP_MATRIX_EXT 0x87E3 -#define GL_VARIANT_VALUE_EXT 0x87E4 -#define GL_VARIANT_DATATYPE_EXT 0x87E5 -#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 -#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 -#define GL_VARIANT_ARRAY_EXT 0x87E8 -#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 -#define GL_INVARIANT_VALUE_EXT 0x87EA -#define GL_INVARIANT_DATATYPE_EXT 0x87EB -#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC -#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_MAX_VERTEX_STREAMS_ATI 0x876B -#define GL_VERTEX_STREAM0_ATI 0x876C -#define GL_VERTEX_STREAM1_ATI 0x876D -#define GL_VERTEX_STREAM2_ATI 0x876E -#define GL_VERTEX_STREAM3_ATI 0x876F -#define GL_VERTEX_STREAM4_ATI 0x8770 -#define GL_VERTEX_STREAM5_ATI 0x8771 -#define GL_VERTEX_STREAM6_ATI 0x8772 -#define GL_VERTEX_STREAM7_ATI 0x8773 -#define GL_VERTEX_SOURCE_ATI 0x8774 -#endif - -#ifndef GL_ATI_element_array -#define GL_ELEMENT_ARRAY_ATI 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A -#endif - -#ifndef GL_SUN_mesh_array -#define GL_QUAD_MESH_SUN 0x8614 -#define GL_TRIANGLE_MESH_SUN 0x8615 -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SLICE_ACCUM_SUN 0x85CC -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_DEPTH_CLAMP_NV 0x864F -#endif - -#ifndef GL_NV_occlusion_query -#define GL_PIXEL_COUNTER_BITS_NV 0x8864 -#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 -#define GL_PIXEL_COUNT_NV 0x8866 -#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 -#endif - -#ifndef GL_NV_point_sprite -#define GL_POINT_SPRITE_NV 0x8861 -#define GL_COORD_REPLACE_NV 0x8862 -#define GL_POINT_SPRITE_R_MODE_NV 0x8863 -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 -#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 -#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 -#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 -#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 -#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 -#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 -#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 -#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A -#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B -#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C -#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D -#define GL_HILO8_NV 0x885E -#define GL_SIGNED_HILO8_NV 0x885F -#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 -#endif - -#ifndef GL_NV_vertex_program1_1 -#endif - -#ifndef GL_EXT_shadow_funcs -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 -#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 -#endif - -#ifndef GL_APPLE_element_array -#define GL_ELEMENT_ARRAY_APPLE 0x8768 -#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 -#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A -#endif - -#ifndef GL_APPLE_fence -#define GL_DRAW_PIXELS_APPLE 0x8A0A -#define GL_FENCE_APPLE 0x8A0B -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D -#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E -#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F -#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 -#define GL_STORAGE_CACHED_APPLE 0x85BE -#define GL_STORAGE_SHARED_APPLE 0x85BF -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_YCBCR_422_APPLE 0x85B9 -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -#ifndef GL_S3_s3tc -#define GL_RGB_S3TC 0x83A0 -#define GL_RGB4_S3TC 0x83A1 -#define GL_RGBA_S3TC 0x83A2 -#define GL_RGBA4_S3TC 0x83A3 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 -#define GL_DRAW_BUFFER0_ATI 0x8825 -#define GL_DRAW_BUFFER1_ATI 0x8826 -#define GL_DRAW_BUFFER2_ATI 0x8827 -#define GL_DRAW_BUFFER3_ATI 0x8828 -#define GL_DRAW_BUFFER4_ATI 0x8829 -#define GL_DRAW_BUFFER5_ATI 0x882A -#define GL_DRAW_BUFFER6_ATI 0x882B -#define GL_DRAW_BUFFER7_ATI 0x882C -#define GL_DRAW_BUFFER8_ATI 0x882D -#define GL_DRAW_BUFFER9_ATI 0x882E -#define GL_DRAW_BUFFER10_ATI 0x882F -#define GL_DRAW_BUFFER11_ATI 0x8830 -#define GL_DRAW_BUFFER12_ATI 0x8831 -#define GL_DRAW_BUFFER13_ATI 0x8832 -#define GL_DRAW_BUFFER14_ATI 0x8833 -#define GL_DRAW_BUFFER15_ATI 0x8834 -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 -#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_MODULATE_ADD_ATI 0x8744 -#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 -#define GL_MODULATE_SUBTRACT_ATI 0x8746 -#endif - -#ifndef GL_ATI_texture_float -#define GL_RGBA_FLOAT32_ATI 0x8814 -#define GL_RGB_FLOAT32_ATI 0x8815 -#define GL_ALPHA_FLOAT32_ATI 0x8816 -#define GL_INTENSITY_FLOAT32_ATI 0x8817 -#define GL_LUMINANCE_FLOAT32_ATI 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 -#define GL_RGBA_FLOAT16_ATI 0x881A -#define GL_RGB_FLOAT16_ATI 0x881B -#define GL_ALPHA_FLOAT16_ATI 0x881C -#define GL_INTENSITY_FLOAT16_ATI 0x881D -#define GL_LUMINANCE_FLOAT16_ATI 0x881E -#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F -#endif - -#ifndef GL_NV_float_buffer -#define GL_FLOAT_R_NV 0x8880 -#define GL_FLOAT_RG_NV 0x8881 -#define GL_FLOAT_RGB_NV 0x8882 -#define GL_FLOAT_RGBA_NV 0x8883 -#define GL_FLOAT_R16_NV 0x8884 -#define GL_FLOAT_R32_NV 0x8885 -#define GL_FLOAT_RG16_NV 0x8886 -#define GL_FLOAT_RG32_NV 0x8887 -#define GL_FLOAT_RGB16_NV 0x8888 -#define GL_FLOAT_RGB32_NV 0x8889 -#define GL_FLOAT_RGBA16_NV 0x888A -#define GL_FLOAT_RGBA32_NV 0x888B -#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C -#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D -#define GL_FLOAT_RGBA_MODE_NV 0x888E -#endif - -#ifndef GL_NV_fragment_program -#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 -#define GL_FRAGMENT_PROGRAM_NV 0x8870 -#define GL_MAX_TEXTURE_COORDS_NV 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 -#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 -#define GL_PROGRAM_ERROR_STRING_NV 0x8874 -#endif - -#ifndef GL_NV_half_float -#define GL_HALF_FLOAT_NV 0x140B -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 -#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 -#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A -#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B -#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C -#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D -#endif - -#ifndef GL_NV_primitive_restart -#define GL_PRIMITIVE_RESTART_NV 0x8558 -#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F -#endif - -#ifndef GL_NV_vertex_program2 -#endif - -#ifndef GL_ATI_map_object_buffer -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_STENCIL_BACK_FUNC_ATI 0x8800 -#define GL_STENCIL_BACK_FAIL_ATI 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#endif - -#ifndef GL_OES_read_format -#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 -#define GL_DEPTH_BOUNDS_EXT 0x8891 -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_MIRROR_CLAMP_EXT 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 -#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION -#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D -#endif - -#ifndef GL_MESA_pack_invert -#define GL_PACK_INVERT_MESA 0x8758 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB -#define GL_YCBCR_MESA 0x8757 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB -#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF -#endif - -#ifndef GL_NV_fragment_program_option -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 -#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 -#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 -#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 -#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 -#endif - -#ifndef GL_NV_vertex_program2_option -/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ -/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ -#endif - -#ifndef GL_NV_vertex_program3 -/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 -#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 -#define GL_STENCIL_INDEX1_EXT 0x8D46 -#define GL_STENCIL_INDEX4_EXT 0x8D47 -#define GL_STENCIL_INDEX8_EXT 0x8D48 -#define GL_STENCIL_INDEX16_EXT 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 -#endif - -#ifndef GL_GREMEDY_string_marker -#endif - -#ifndef GL_EXT_packed_depth_stencil -#define GL_DEPTH_STENCIL_EXT 0x84F9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84FA -#define GL_DEPTH24_STENCIL8_EXT 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 -#endif - -#ifndef GL_EXT_stencil_clear_tag -#define GL_STENCIL_TAG_BITS_EXT 0x88F2 -#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 -#endif - -#ifndef GL_EXT_texture_sRGB -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB8_EXT 0x8C41 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 -#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 -#define GL_SLUMINANCE_EXT 0x8C46 -#define GL_SLUMINANCE8_EXT 0x8C47 -#define GL_COMPRESSED_SRGB_EXT 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 -#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B -#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F -#endif - -#ifndef GL_EXT_framebuffer_blit -#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT -#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA -#endif - -#ifndef GL_EXT_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -#endif - -#ifndef GL_MESAX_texture_stack -#define GL_TEXTURE_1D_STACK_MESAX 0x8759 -#define GL_TEXTURE_2D_STACK_MESAX 0x875A -#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B -#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C -#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D -#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E -#endif - -#ifndef GL_EXT_timer_query -#define GL_TIME_ELAPSED_EXT 0x88BF -#endif - -#ifndef GL_EXT_gpu_program_parameters -#endif - -#ifndef GL_APPLE_flush_buffer_range -#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 -#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 -#endif - -#ifndef GL_NV_gpu_program4 -#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 -#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 -#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 -#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 -#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 -#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 -#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 -#endif - -#ifndef GL_NV_geometry_program4 -#define GL_LINES_ADJACENCY_EXT 0x000A -#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B -#define GL_TRIANGLES_ADJACENCY_EXT 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D -#define GL_GEOMETRY_PROGRAM_NV 0x8C26 -#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 -#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 -#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA -#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB -#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 -#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 -#endif - -#ifndef GL_EXT_geometry_shader4 -#define GL_GEOMETRY_SHADER_EXT 0x8DD9 -/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */ -/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */ -/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */ -/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */ -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD -#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE -#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 -/* reuse GL_LINES_ADJACENCY_EXT */ -/* reuse GL_LINE_STRIP_ADJACENCY_EXT */ -/* reuse GL_TRIANGLES_ADJACENCY_EXT */ -/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */ -/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */ -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ -/* reuse GL_PROGRAM_POINT_SIZE_EXT */ -#endif - -#ifndef GL_NV_vertex_program4 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD -#endif - -#ifndef GL_EXT_gpu_shader4 -#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 -#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 -#define GL_SAMPLER_BUFFER_EXT 0x8DC2 -#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 -#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 -#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 -#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 -#define GL_INT_SAMPLER_1D_EXT 0x8DC9 -#define GL_INT_SAMPLER_2D_EXT 0x8DCA -#define GL_INT_SAMPLER_3D_EXT 0x8DCB -#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC -#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD -#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF -#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 -#endif - -#ifndef GL_EXT_draw_instanced -#endif - -#ifndef GL_EXT_packed_float -#define GL_R11F_G11F_B10F_EXT 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B -#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C -#endif - -#ifndef GL_EXT_texture_array -#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 -#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D -#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF -#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E -/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ -#endif - -#ifndef GL_EXT_texture_buffer_object -#define GL_TEXTURE_BUFFER_EXT 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E -#endif - -#ifndef GL_EXT_texture_compression_latc -#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 -#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 -#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 -#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 -#endif - -#ifndef GL_EXT_texture_compression_rgtc -#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC -#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD -#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE -#endif - -#ifndef GL_EXT_texture_shared_exponent -#define GL_RGB9_E5_EXT 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E -#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F -#endif - -#ifndef GL_NV_depth_buffer_float -#define GL_DEPTH_COMPONENT32F_NV 0x8DAB -#define GL_DEPTH32F_STENCIL8_NV 0x8DAC -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD -#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF -#endif - -#ifndef GL_NV_fragment_program4 -#endif - -#ifndef GL_NV_framebuffer_multisample_coverage -#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB -#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 -#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 -#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 -#endif - -#ifndef GL_EXT_framebuffer_sRGB -#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 -#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA -#endif - -#ifndef GL_NV_geometry_shader4 -#endif - -#ifndef GL_NV_parameter_buffer_object -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 -#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 -#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 -#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 -#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 -#endif - -#ifndef GL_EXT_draw_buffers2 -#endif - -#ifndef GL_NV_transform_feedback -#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 -#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 -#define GL_TEXTURE_COORD_NV 0x8C79 -#define GL_CLIP_DISTANCE_NV 0x8C7A -#define GL_VERTEX_ID_NV 0x8C7B -#define GL_PRIMITIVE_ID_NV 0x8C7C -#define GL_GENERIC_ATTRIB_NV 0x8C7D -#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 -#define GL_ACTIVE_VARYINGS_NV 0x8C81 -#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 -#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 -#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 -#define GL_PRIMITIVES_GENERATED_NV 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 -#define GL_RASTERIZER_DISCARD_NV 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B -#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C -#define GL_SEPARATE_ATTRIBS_NV 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F -#endif - -#ifndef GL_EXT_bindable_uniform -#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 -#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 -#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 -#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED -#define GL_UNIFORM_BUFFER_EXT 0x8DEE -#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF -#endif - -#ifndef GL_EXT_texture_integer -#define GL_RGBA32UI_EXT 0x8D70 -#define GL_RGB32UI_EXT 0x8D71 -#define GL_ALPHA32UI_EXT 0x8D72 -#define GL_INTENSITY32UI_EXT 0x8D73 -#define GL_LUMINANCE32UI_EXT 0x8D74 -#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 -#define GL_RGBA16UI_EXT 0x8D76 -#define GL_RGB16UI_EXT 0x8D77 -#define GL_ALPHA16UI_EXT 0x8D78 -#define GL_INTENSITY16UI_EXT 0x8D79 -#define GL_LUMINANCE16UI_EXT 0x8D7A -#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B -#define GL_RGBA8UI_EXT 0x8D7C -#define GL_RGB8UI_EXT 0x8D7D -#define GL_ALPHA8UI_EXT 0x8D7E -#define GL_INTENSITY8UI_EXT 0x8D7F -#define GL_LUMINANCE8UI_EXT 0x8D80 -#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 -#define GL_RGBA32I_EXT 0x8D82 -#define GL_RGB32I_EXT 0x8D83 -#define GL_ALPHA32I_EXT 0x8D84 -#define GL_INTENSITY32I_EXT 0x8D85 -#define GL_LUMINANCE32I_EXT 0x8D86 -#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 -#define GL_RGBA16I_EXT 0x8D88 -#define GL_RGB16I_EXT 0x8D89 -#define GL_ALPHA16I_EXT 0x8D8A -#define GL_INTENSITY16I_EXT 0x8D8B -#define GL_LUMINANCE16I_EXT 0x8D8C -#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D -#define GL_RGBA8I_EXT 0x8D8E -#define GL_RGB8I_EXT 0x8D8F -#define GL_ALPHA8I_EXT 0x8D90 -#define GL_INTENSITY8I_EXT 0x8D91 -#define GL_LUMINANCE8I_EXT 0x8D92 -#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 -#define GL_RED_INTEGER_EXT 0x8D94 -#define GL_GREEN_INTEGER_EXT 0x8D95 -#define GL_BLUE_INTEGER_EXT 0x8D96 -#define GL_ALPHA_INTEGER_EXT 0x8D97 -#define GL_RGB_INTEGER_EXT 0x8D98 -#define GL_RGBA_INTEGER_EXT 0x8D99 -#define GL_BGR_INTEGER_EXT 0x8D9A -#define GL_BGRA_INTEGER_EXT 0x8D9B -#define GL_LUMINANCE_INTEGER_EXT 0x8D9C -#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D -#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E -#endif - -#ifndef GL_GREMEDY_frame_terminator -#endif - - -/*************************************************************/ - -#include -#ifndef GL_VERSION_2_0 -/* GL type for program/shader text */ -typedef char GLchar; /* native character */ -#endif - -#ifndef GL_VERSION_1_5 -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -#endif - -#ifndef GL_ARB_vertex_buffer_object -/* GL types for handling large vertex buffer objects */ -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -#endif - -#ifndef GL_ARB_shader_objects -/* GL types for handling shader object handles and program/shader text */ -typedef char GLcharARB; /* native character */ -typedef unsigned int GLhandleARB; /* shader object handle */ -#endif - -/* GL types for "half" precision (s10e5) float data in host memory */ -#ifndef GL_ARB_half_float_pixel -typedef unsigned short GLhalfARB; -#endif - -#ifndef GL_NV_half_float -typedef unsigned short GLhalfNV; -#endif - -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) -#include -#if defined(__STDC__) -#if defined(__arch64__) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -#include /* Fallback option */ -#endif -#endif - -#ifndef GL_EXT_timer_query -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64EXT; -#endif - -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); -GLAPI void APIENTRY glBlendEquation (GLenum); -GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); -GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); -GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); -GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); -GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); -GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); -GLAPI void APIENTRY glResetHistogram (GLenum); -GLAPI void APIENTRY glResetMinmax (GLenum); -GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTexture (GLenum); -GLAPI void APIENTRY glClientActiveTexture (GLenum); -GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); -GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); -GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); -GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); -GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); -GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); -GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); -GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); -GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); -GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); -GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glFogCoordf (GLfloat); -GLAPI void APIENTRY glFogCoordfv (const GLfloat *); -GLAPI void APIENTRY glFogCoordd (GLdouble); -GLAPI void APIENTRY glFogCoorddv (const GLdouble *); -GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); -GLAPI void APIENTRY glPointParameteri (GLenum, GLint); -GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); -GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); -GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); -GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); -GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); -GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); -GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); -GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); -GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); -GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); -GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); -GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); -GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); -GLAPI void APIENTRY glWindowPos2i (GLint, GLint); -GLAPI void APIENTRY glWindowPos2iv (const GLint *); -GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2sv (const GLshort *); -GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); -GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); -GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3iv (const GLint *); -GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3sv (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); -#endif - -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsQuery (GLuint); -GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); -GLAPI void APIENTRY glEndQuery (GLenum); -GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); -GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); -GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsBuffer (GLuint); -GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); -GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); -GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); -GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); -GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); -GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); -GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); -GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); -GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); -GLAPI void APIENTRY glAttachShader (GLuint, GLuint); -GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); -GLAPI void APIENTRY glCompileShader (GLuint); -GLAPI GLuint APIENTRY glCreateProgram (void); -GLAPI GLuint APIENTRY glCreateShader (GLenum); -GLAPI void APIENTRY glDeleteProgram (GLuint); -GLAPI void APIENTRY glDeleteShader (GLuint); -GLAPI void APIENTRY glDetachShader (GLuint, GLuint); -GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); -GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); -GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); -GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); -GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); -GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); -GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); -GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); -GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgram (GLuint); -GLAPI GLboolean APIENTRY glIsShader (GLuint); -GLAPI void APIENTRY glLinkProgram (GLuint); -GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); -GLAPI void APIENTRY glUseProgram (GLuint); -GLAPI void APIENTRY glUniform1f (GLint, GLfloat); -GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform1i (GLint, GLint); -GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); -GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glValidateProgram (GLuint); -GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniformMatrix2x3fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3x2fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix2x4fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4x2fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3x4fv (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4x3fv (GLint, GLsizei, GLboolean, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif - -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveTextureARB (GLenum); -GLAPI void APIENTRY glClientActiveTextureARB (GLenum); -GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); -GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); -GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); -GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); -GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); -GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); -GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); -GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); -GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); -#endif - -#ifndef GL_ARB_transpose_matrix -#define GL_ARB_transpose_matrix 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); -GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); -GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); -GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); -#endif - -#ifndef GL_ARB_multisample -#define GL_ARB_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); -#endif - -#ifndef GL_ARB_texture_env_add -#define GL_ARB_texture_env_add 1 -#endif - -#ifndef GL_ARB_texture_cube_map -#define GL_ARB_texture_cube_map 1 -#endif - -#ifndef GL_ARB_texture_compression -#define GL_ARB_texture_compression 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_ARB_texture_border_clamp -#define GL_ARB_texture_border_clamp 1 -#endif - -#ifndef GL_ARB_point_parameters -#define GL_ARB_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_ARB_vertex_blend -#define GL_ARB_vertex_blend 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); -GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); -GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); -GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); -GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); -GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); -GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); -GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); -GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexBlendARB (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); -typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); -typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); -typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); -typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); -typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); -typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); -typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); -#endif - -#ifndef GL_ARB_matrix_palette -#define GL_ARB_matrix_palette 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); -GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); -GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); -GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); -GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); -typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); -typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_ARB_texture_env_combine -#define GL_ARB_texture_env_combine 1 -#endif - -#ifndef GL_ARB_texture_env_crossbar -#define GL_ARB_texture_env_crossbar 1 -#endif - -#ifndef GL_ARB_texture_env_dot3 -#define GL_ARB_texture_env_dot3 1 -#endif - -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_ARB_texture_mirrored_repeat 1 -#endif - -#ifndef GL_ARB_depth_texture -#define GL_ARB_depth_texture 1 -#endif - -#ifndef GL_ARB_shadow -#define GL_ARB_shadow 1 -#endif - -#ifndef GL_ARB_shadow_ambient -#define GL_ARB_shadow_ambient 1 -#endif - -#ifndef GL_ARB_window_pos -#define GL_ARB_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); -GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); -GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); -GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); -GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); -GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); -GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); -GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); -GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); -#endif - -#ifndef GL_ARB_vertex_program -#define GL_ARB_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); -GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); -GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); -GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); -GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); -GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); -GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); -GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); -GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); -typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); -typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); -#endif - -#ifndef GL_ARB_fragment_program -#define GL_ARB_fragment_program 1 -/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ -#endif - -#ifndef GL_ARB_vertex_buffer_object -#define GL_ARB_vertex_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); -GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); -GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); -GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); -GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); -GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); -GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); -GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); -typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); -#endif - -#ifndef GL_ARB_occlusion_query -#define GL_ARB_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); -GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); -GLAPI void APIENTRY glEndQueryARB (GLenum); -GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); -typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_ARB_shader_objects -#define GL_ARB_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); -GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); -GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); -GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); -GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); -GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); -GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); -GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); -GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); -GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); -GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); -GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); -GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glUniform1iARB (GLint, GLint); -GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); -GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); -GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); -GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); -GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); -GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); -GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); -GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); -GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); -GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); -typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); -typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); -typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); -typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); -typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); -typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); -typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); -typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); -typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -#endif - -#ifndef GL_ARB_vertex_shader -#define GL_ARB_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); -GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -#endif - -#ifndef GL_ARB_fragment_shader -#define GL_ARB_fragment_shader 1 -#endif - -#ifndef GL_ARB_shading_language_100 -#define GL_ARB_shading_language_100 1 -#endif - -#ifndef GL_ARB_texture_non_power_of_two -#define GL_ARB_texture_non_power_of_two 1 -#endif - -#ifndef GL_ARB_point_sprite -#define GL_ARB_point_sprite 1 -#endif - -#ifndef GL_ARB_fragment_program_shadow -#define GL_ARB_fragment_program_shadow 1 -#endif - -#ifndef GL_ARB_draw_buffers -#define GL_ARB_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ARB_texture_rectangle -#define GL_ARB_texture_rectangle 1 -#endif - -#ifndef GL_ARB_color_buffer_float -#define GL_ARB_color_buffer_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); -#endif - -#ifndef GL_ARB_half_float_pixel -#define GL_ARB_half_float_pixel 1 -#endif - -#ifndef GL_ARB_texture_float -#define GL_ARB_texture_float 1 -#endif - -#ifndef GL_ARB_pixel_buffer_object -#define GL_ARB_pixel_buffer_object 1 -#endif - -#ifndef GL_EXT_abgr -#define GL_EXT_abgr 1 -#endif - -#ifndef GL_EXT_blend_color -#define GL_EXT_blend_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -#endif - -#ifndef GL_EXT_polygon_offset -#define GL_EXT_polygon_offset 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); -#endif - -#ifndef GL_EXT_texture -#define GL_EXT_texture 1 -#endif - -#ifndef GL_EXT_texture3D -#define GL_EXT_texture3D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGIS_texture_filter4 -#define GL_SGIS_texture_filter4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); -typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); -#endif - -#ifndef GL_EXT_subtexture -#define GL_EXT_subtexture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_EXT_copy_texture -#define GL_EXT_copy_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); -GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_EXT_histogram -#define GL_EXT_histogram 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); -GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); -GLAPI void APIENTRY glResetHistogramEXT (GLenum); -GLAPI void APIENTRY glResetMinmaxEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); -typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); -#endif - -#ifndef GL_EXT_convolution -#define GL_EXT_convolution 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); -GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); -GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); -typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); -typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); -#endif - -#ifndef GL_SGI_color_matrix -#define GL_SGI_color_matrix 1 -#endif - -#ifndef GL_SGI_color_table -#define GL_SGI_color_table 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); -GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); -#endif - -#ifndef GL_SGIX_pixel_texture -#define GL_SGIX_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); -#endif - -#ifndef GL_SGIS_pixel_texture -#define GL_SGIS_pixel_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); -GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); -GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); -GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); -GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); -GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIS_texture4D -#define GL_SGIS_texture4D 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); -#endif - -#ifndef GL_SGI_texture_color_table -#define GL_SGI_texture_color_table 1 -#endif - -#ifndef GL_EXT_cmyka -#define GL_EXT_cmyka 1 -#endif - -#ifndef GL_EXT_texture_object -#define GL_EXT_texture_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); -GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); -GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); -typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); -typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); -typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); -#endif - -#ifndef GL_SGIS_detail_texture -#define GL_SGIS_detail_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_SGIS_sharpen_texture -#define GL_SGIS_sharpen_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); -#endif - -#ifndef GL_EXT_packed_pixels -#define GL_EXT_packed_pixels 1 -#endif - -#ifndef GL_SGIS_texture_lod -#define GL_SGIS_texture_lod 1 -#endif - -#ifndef GL_SGIS_multisample -#define GL_SGIS_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); -GLAPI void APIENTRY glSamplePatternSGIS (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); -#endif - -#ifndef GL_EXT_rescale_normal -#define GL_EXT_rescale_normal 1 -#endif - -#ifndef GL_EXT_vertex_array -#define GL_EXT_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glArrayElementEXT (GLint); -GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); -GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); -GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); -GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); -typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); -typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); -typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_misc_attribute -#define GL_EXT_misc_attribute 1 -#endif - -#ifndef GL_SGIS_generate_mipmap -#define GL_SGIS_generate_mipmap 1 -#endif - -#ifndef GL_SGIX_clipmap -#define GL_SGIX_clipmap 1 -#endif - -#ifndef GL_SGIX_shadow -#define GL_SGIX_shadow 1 -#endif - -#ifndef GL_SGIS_texture_edge_clamp -#define GL_SGIS_texture_edge_clamp 1 -#endif - -#ifndef GL_SGIS_texture_border_clamp -#define GL_SGIS_texture_border_clamp 1 -#endif - -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_blend_subtract -#define GL_EXT_blend_subtract 1 -#endif - -#ifndef GL_EXT_blend_logic_op -#define GL_EXT_blend_logic_op 1 -#endif - -#ifndef GL_SGIX_interlace -#define GL_SGIX_interlace 1 -#endif - -#ifndef GL_SGIX_pixel_tiles -#define GL_SGIX_pixel_tiles 1 -#endif - -#ifndef GL_SGIX_texture_select -#define GL_SGIX_texture_select 1 -#endif - -#ifndef GL_SGIX_sprite -#define GL_SGIX_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); -GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); -GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); -GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_texture_multi_buffer -#define GL_SGIX_texture_multi_buffer 1 -#endif - -#ifndef GL_EXT_point_parameters -#define GL_EXT_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIS_point_parameters -#define GL_SGIS_point_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); -GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_SGIX_instruments -#define GL_SGIX_instruments 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); -GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); -GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); -GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); -GLAPI void APIENTRY glStartInstrumentsSGIX (void); -GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); -typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); -typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); -typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); -typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); -#endif - -#ifndef GL_SGIX_texture_scale_bias -#define GL_SGIX_texture_scale_bias 1 -#endif - -#ifndef GL_SGIX_framezoom -#define GL_SGIX_framezoom 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameZoomSGIX (GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); -#endif - -#ifndef GL_SGIX_tag_sample_buffer -#define GL_SGIX_tag_sample_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTagSampleBufferSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_polynomial_ffd -#define GL_SGIX_polynomial_ffd 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); -GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); -GLAPI void APIENTRY glDeformSGIX (GLbitfield); -GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); -typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); -typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); -typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); -#endif - -#ifndef GL_SGIX_reference_plane -#define GL_SGIX_reference_plane 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); -#endif - -#ifndef GL_SGIX_flush_raster -#define GL_SGIX_flush_raster 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushRasterSGIX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); -#endif - -#ifndef GL_SGIX_depth_texture -#define GL_SGIX_depth_texture 1 -#endif - -#ifndef GL_SGIS_fog_function -#define GL_SGIS_fog_function 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); -GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); -typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); -#endif - -#ifndef GL_SGIX_fog_offset -#define GL_SGIX_fog_offset 1 -#endif - -#ifndef GL_HP_image_transform -#define GL_HP_image_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); -GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_HP_convolution_border_modes -#define GL_HP_convolution_border_modes 1 -#endif - -#ifndef GL_SGIX_texture_add_env -#define GL_SGIX_texture_add_env 1 -#endif - -#ifndef GL_EXT_color_subtable -#define GL_EXT_color_subtable 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif - -#ifndef GL_PGI_vertex_hints -#define GL_PGI_vertex_hints 1 -#endif - -#ifndef GL_PGI_misc_hints -#define GL_PGI_misc_hints 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glHintPGI (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); -#endif - -#ifndef GL_EXT_paletted_texture -#define GL_EXT_paletted_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); -GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); -GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_EXT_clip_volume_hint -#define GL_EXT_clip_volume_hint 1 -#endif - -#ifndef GL_SGIX_list_priority -#define GL_SGIX_list_priority 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); -GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); -GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); -GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); -#endif - -#ifndef GL_SGIX_ir_instrument1 -#define GL_SGIX_ir_instrument1 1 -#endif - -#ifndef GL_SGIX_calligraphic_fragment -#define GL_SGIX_calligraphic_fragment 1 -#endif - -#ifndef GL_SGIX_texture_lod_bias -#define GL_SGIX_texture_lod_bias 1 -#endif - -#ifndef GL_SGIX_shadow_ambient -#define GL_SGIX_shadow_ambient 1 -#endif - -#ifndef GL_EXT_index_texture -#define GL_EXT_index_texture 1 -#endif - -#ifndef GL_EXT_index_material -#define GL_EXT_index_material 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_EXT_index_func -#define GL_EXT_index_func 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); -#endif - -#ifndef GL_EXT_index_array_formats -#define GL_EXT_index_array_formats 1 -#endif - -#ifndef GL_EXT_compiled_vertex_array -#define GL_EXT_compiled_vertex_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); -GLAPI void APIENTRY glUnlockArraysEXT (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); -#endif - -#ifndef GL_EXT_cull_vertex -#define GL_EXT_cull_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); -GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); -#endif - -#ifndef GL_SGIX_ycrcb -#define GL_SGIX_ycrcb 1 -#endif - -#ifndef GL_SGIX_fragment_lighting -#define GL_SGIX_fragment_lighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); -GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); -GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); -GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); -GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); -GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); -GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_IBM_rasterpos_clip -#define GL_IBM_rasterpos_clip 1 -#endif - -#ifndef GL_HP_texture_lighting -#define GL_HP_texture_lighting 1 -#endif - -#ifndef GL_EXT_draw_range_elements -#define GL_EXT_draw_range_elements 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -#endif - -#ifndef GL_WIN_phong_shading -#define GL_WIN_phong_shading 1 -#endif - -#ifndef GL_WIN_specular_fog -#define GL_WIN_specular_fog 1 -#endif - -#ifndef GL_EXT_light_texture -#define GL_EXT_light_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glApplyTextureEXT (GLenum); -GLAPI void APIENTRY glTextureLightEXT (GLenum); -GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); -typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); -#endif - -#ifndef GL_SGIX_blend_alpha_minmax -#define GL_SGIX_blend_alpha_minmax 1 -#endif - -#ifndef GL_EXT_bgra -#define GL_EXT_bgra 1 -#endif - -#ifndef GL_SGIX_async -#define GL_SGIX_async 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); -GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); -GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); -GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); -GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); -GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); -typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); -typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); -typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); -typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); -typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); -#endif - -#ifndef GL_SGIX_async_pixel -#define GL_SGIX_async_pixel 1 -#endif - -#ifndef GL_SGIX_async_histogram -#define GL_SGIX_async_histogram 1 -#endif - -#ifndef GL_INTEL_parallel_arrays -#define GL_INTEL_parallel_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); -GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); -GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); -GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); -#endif - -#ifndef GL_HP_occlusion_test -#define GL_HP_occlusion_test 1 -#endif - -#ifndef GL_EXT_pixel_transform -#define GL_EXT_pixel_transform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); -GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); -GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); -#endif - -#ifndef GL_EXT_pixel_transform_color_table -#define GL_EXT_pixel_transform_color_table 1 -#endif - -#ifndef GL_EXT_shared_texture_palette -#define GL_EXT_shared_texture_palette 1 -#endif - -#ifndef GL_EXT_separate_specular_color -#define GL_EXT_separate_specular_color 1 -#endif - -#ifndef GL_EXT_secondary_color -#define GL_EXT_secondary_color 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); -GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); -GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); -GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); -GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); -GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); -GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); -GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); -GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); -GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_perturb_normal -#define GL_EXT_texture_perturb_normal 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureNormalEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); -#endif - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif - -#ifndef GL_EXT_fog_coord -#define GL_EXT_fog_coord 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFogCoordfEXT (GLfloat); -GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); -GLAPI void APIENTRY glFogCoorddEXT (GLdouble); -GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); -GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); -typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); -typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); -typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_REND_screen_coordinates -#define GL_REND_screen_coordinates 1 -#endif - -#ifndef GL_EXT_coordinate_frame -#define GL_EXT_coordinate_frame 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); -GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); -GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); -GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glTangent3ivEXT (const GLint *); -GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glTangent3svEXT (const GLshort *); -GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); -GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); -GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); -GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); -GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); -GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); -GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); -typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); -typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); -typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); -typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); -typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); -typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); -typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); -typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); -typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); -typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); -typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_EXT_texture_env_combine -#define GL_EXT_texture_env_combine 1 -#endif - -#ifndef GL_APPLE_specular_vector -#define GL_APPLE_specular_vector 1 -#endif - -#ifndef GL_APPLE_transform_hint -#define GL_APPLE_transform_hint 1 -#endif - -#ifndef GL_SGIX_fog_scale -#define GL_SGIX_fog_scale 1 -#endif - -#ifndef GL_SUNX_constant_data -#define GL_SUNX_constant_data 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFinishTextureSUNX (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); -#endif - -#ifndef GL_SUN_global_alpha -#define GL_SUN_global_alpha 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); -GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); -GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); -GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); -GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); -GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); -GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); -GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); -typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); -#endif - -#ifndef GL_SUN_triangle_list -#define GL_SUN_triangle_list 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); -GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); -GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); -GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); -GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); -GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); -GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); -#endif - -#ifndef GL_SUN_vertex -#define GL_SUN_vertex 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); -#endif - -#ifndef GL_EXT_blend_func_separate -#define GL_EXT_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_blend_func_separate -#define GL_INGR_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -#endif - -#ifndef GL_INGR_color_clamp -#define GL_INGR_color_clamp 1 -#endif - -#ifndef GL_INGR_interlace_read -#define GL_INGR_interlace_read 1 -#endif - -#ifndef GL_EXT_stencil_wrap -#define GL_EXT_stencil_wrap 1 -#endif - -#ifndef GL_EXT_422_pixels -#define GL_EXT_422_pixels 1 -#endif - -#ifndef GL_NV_texgen_reflection -#define GL_NV_texgen_reflection 1 -#endif - -#ifndef GL_SUN_convolution_border_modes -#define GL_SUN_convolution_border_modes 1 -#endif - -#ifndef GL_EXT_texture_env_add -#define GL_EXT_texture_env_add 1 -#endif - -#ifndef GL_EXT_texture_lod_bias -#define GL_EXT_texture_lod_bias 1 -#endif - -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#endif - -#ifndef GL_EXT_vertex_weighting -#define GL_EXT_vertex_weighting 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); -GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); -GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -#ifndef GL_NV_light_max_exponent -#define GL_NV_light_max_exponent 1 -#endif - -#ifndef GL_NV_vertex_array_range -#define GL_NV_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); -GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); -#endif - -#ifndef GL_NV_register_combiners -#define GL_NV_register_combiners 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); -GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); -GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); -GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); -GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); -GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); -typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); -#endif - -#ifndef GL_NV_fog_distance -#define GL_NV_fog_distance 1 -#endif - -#ifndef GL_NV_texgen_emboss -#define GL_NV_texgen_emboss 1 -#endif - -#ifndef GL_NV_blend_square -#define GL_NV_blend_square 1 -#endif - -#ifndef GL_NV_texture_env_combine4 -#define GL_NV_texture_env_combine4 1 -#endif - -#ifndef GL_MESA_resize_buffers -#define GL_MESA_resize_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glResizeBuffersMESA (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); -#endif - -#ifndef GL_MESA_window_pos -#define GL_MESA_window_pos 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); -GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); -GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); -GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); -GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); -GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); -GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); -GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); -typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); -typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); -#endif - -#ifndef GL_IBM_cull_vertex -#define GL_IBM_cull_vertex 1 -#endif - -#ifndef GL_IBM_multimode_draw_arrays -#define GL_IBM_multimode_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); -GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); -typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); -#endif - -#ifndef GL_IBM_vertex_array_lists -#define GL_IBM_vertex_array_lists 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); -GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); -#endif - -#ifndef GL_SGIX_subsample -#define GL_SGIX_subsample 1 -#endif - -#ifndef GL_SGIX_ycrcba -#define GL_SGIX_ycrcba 1 -#endif - -#ifndef GL_SGIX_ycrcb_subsample -#define GL_SGIX_ycrcb_subsample 1 -#endif - -#ifndef GL_SGIX_depth_pass_instrument -#define GL_SGIX_depth_pass_instrument 1 -#endif - -#ifndef GL_3DFX_texture_compression_FXT1 -#define GL_3DFX_texture_compression_FXT1 1 -#endif - -#ifndef GL_3DFX_multisample -#define GL_3DFX_multisample 1 -#endif - -#ifndef GL_3DFX_tbuffer -#define GL_3DFX_tbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTbufferMask3DFX (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); -#endif - -#ifndef GL_EXT_multisample -#define GL_EXT_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); -GLAPI void APIENTRY glSamplePatternEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); -typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); -#endif - -#ifndef GL_SGIX_vertex_preclip -#define GL_SGIX_vertex_preclip 1 -#endif - -#ifndef GL_SGIX_convolution_accuracy -#define GL_SGIX_convolution_accuracy 1 -#endif - -#ifndef GL_SGIX_resample -#define GL_SGIX_resample 1 -#endif - -#ifndef GL_SGIS_point_line_texgen -#define GL_SGIS_point_line_texgen 1 -#endif - -#ifndef GL_SGIS_texture_color_mask -#define GL_SGIS_texture_color_mask 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -#endif - -#ifndef GL_SGIX_igloo_interface -#define GL_SGIX_igloo_interface 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); -#endif - -#ifndef GL_EXT_texture_env_dot3 -#define GL_EXT_texture_env_dot3 1 -#endif - -#ifndef GL_ATI_texture_mirror_once -#define GL_ATI_texture_mirror_once 1 -#endif - -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); -GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); -GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glFinishFenceNV (GLuint); -GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#endif - -#ifndef GL_NV_evaluators -#define GL_NV_evaluators 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); -GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); -GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); -typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); -#endif - -#ifndef GL_NV_packed_depth_stencil -#define GL_NV_packed_depth_stencil 1 -#endif - -#ifndef GL_NV_register_combiners2 -#define GL_NV_register_combiners2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); -GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); -#endif - -#ifndef GL_NV_texture_compression_vtc -#define GL_NV_texture_compression_vtc 1 -#endif - -#ifndef GL_NV_texture_rectangle -#define GL_NV_texture_rectangle 1 -#endif - -#ifndef GL_NV_texture_shader -#define GL_NV_texture_shader 1 -#endif - -#ifndef GL_NV_texture_shader2 -#define GL_NV_texture_shader2 1 -#endif - -#ifndef GL_NV_vertex_array_range2 -#define GL_NV_vertex_array_range2 1 -#endif - -#ifndef GL_NV_vertex_program -#define GL_NV_vertex_program 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); -GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); -GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); -GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); -GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); -GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); -GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); -GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); -GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); -GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); -GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); -GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); -GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); -GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); -GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); -GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); -GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); -GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); -GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); -GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); -GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); -typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); -typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); -typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); -typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); -typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); -typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); -typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); -#endif - -#ifndef GL_SGIX_texture_coordinate_clamp -#define GL_SGIX_texture_coordinate_clamp 1 -#endif - -#ifndef GL_SGIX_scalebias_hint -#define GL_SGIX_scalebias_hint 1 -#endif - -#ifndef GL_OML_interlace -#define GL_OML_interlace 1 -#endif - -#ifndef GL_OML_subsample -#define GL_OML_subsample 1 -#endif - -#ifndef GL_OML_resample -#define GL_OML_resample 1 -#endif - -#ifndef GL_NV_copy_depth_to_color -#define GL_NV_copy_depth_to_color 1 -#endif - -#ifndef GL_ATI_envmap_bumpmap -#define GL_ATI_envmap_bumpmap 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); -GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); -GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); -typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); -typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); -#endif - -#ifndef GL_ATI_fragment_shader -#define GL_ATI_fragment_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); -GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); -GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); -GLAPI void APIENTRY glBeginFragmentShaderATI (void); -GLAPI void APIENTRY glEndFragmentShaderATI (void); -GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); -GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); -GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); -typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); -typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); -typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); -typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); -typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); -#endif - -#ifndef GL_ATI_pn_triangles -#define GL_ATI_pn_triangles 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); -GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_vertex_array_object -#define GL_ATI_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); -GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); -GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); -GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); -GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); -GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); -typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); -#endif - -#ifndef GL_EXT_vertex_shader -#define GL_EXT_vertex_shader 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginVertexShaderEXT (void); -GLAPI void APIENTRY glEndVertexShaderEXT (void); -GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); -GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); -GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); -GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); -GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); -GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); -GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); -GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); -GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); -GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); -GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); -GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); -GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); -GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); -GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); -GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); -GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); -GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); -GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); -GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); -GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); -GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); -GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); -GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); -GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); -GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); -typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); -typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); -typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); -typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); -typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); -typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); -typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); -typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); -typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); -typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); -typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); -typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); -typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); -typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); -typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); -typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); -typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); -typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); -typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); -typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); -typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); -typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); -typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); -typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); -#endif - -#ifndef GL_ATI_vertex_streams -#define GL_ATI_vertex_streams 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); -GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); -GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); -GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); -GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); -GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); -GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); -GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); -GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); -GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); -GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); -GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); -GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); -GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); -GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); -GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); -typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); -typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); -typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); -#endif - -#ifndef GL_ATI_element_array -#define GL_ATI_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); -GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); -GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); -#endif - -#ifndef GL_SUN_mesh_array -#define GL_SUN_mesh_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); -#endif - -#ifndef GL_SUN_slice_accum -#define GL_SUN_slice_accum 1 -#endif - -#ifndef GL_NV_multisample_filter_hint -#define GL_NV_multisample_filter_hint 1 -#endif - -#ifndef GL_NV_depth_clamp -#define GL_NV_depth_clamp 1 -#endif - -#ifndef GL_NV_occlusion_query -#define GL_NV_occlusion_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); -GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); -GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); -GLAPI void APIENTRY glEndOcclusionQueryNV (void); -GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); -typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); -typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -#ifndef GL_NV_point_sprite -#define GL_NV_point_sprite 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); -GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_NV_texture_shader3 -#define GL_NV_texture_shader3 1 -#endif - -#ifndef GL_NV_vertex_program1_1 -#define GL_NV_vertex_program1_1 1 -#endif - -#ifndef GL_EXT_shadow_funcs -#define GL_EXT_shadow_funcs 1 -#endif - -#ifndef GL_EXT_stencil_two_side -#define GL_EXT_stencil_two_side 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); -#endif - -#ifndef GL_ATI_text_fragment_shader -#define GL_ATI_text_fragment_shader 1 -#endif - -#ifndef GL_APPLE_client_storage -#define GL_APPLE_client_storage 1 -#endif - -#ifndef GL_APPLE_element_array -#define GL_APPLE_element_array 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); -GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); -GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); -GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); -GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); -#endif - -#ifndef GL_APPLE_fence -#define GL_APPLE_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); -GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); -GLAPI void APIENTRY glSetFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); -GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); -GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); -GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); -typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); -typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); -typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); -typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); -typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); -#endif - -#ifndef GL_APPLE_vertex_array_object -#define GL_APPLE_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); -GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, GLuint *); -GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); -#endif - -#ifndef GL_APPLE_vertex_array_range -#define GL_APPLE_vertex_array_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); -GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); -GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); -#endif - -#ifndef GL_APPLE_ycbcr_422 -#define GL_APPLE_ycbcr_422 1 -#endif - -#ifndef GL_S3_s3tc -#define GL_S3_s3tc 1 -#endif - -#ifndef GL_ATI_draw_buffers -#define GL_ATI_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); -#endif - -#ifndef GL_ATI_pixel_format_float -#define GL_ATI_pixel_format_float 1 -/* This is really a WGL extension, but defines some associated GL enums. - * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. - */ -#endif - -#ifndef GL_ATI_texture_env_combine3 -#define GL_ATI_texture_env_combine3 1 -#endif - -#ifndef GL_ATI_texture_float -#define GL_ATI_texture_float 1 -#endif - -#ifndef GL_NV_float_buffer -#define GL_NV_float_buffer 1 -#endif - -#ifndef GL_NV_fragment_program -#define GL_NV_fragment_program 1 -/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); -GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); -GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); -GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); -GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); -GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); -typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); -#endif - -#ifndef GL_NV_half_float -#define GL_NV_half_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); -GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); -GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); -GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); -GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); -GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); -GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); -GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); -typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); -typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); -typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); -typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); -typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); -typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); -typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); -typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); -typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); -typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); -typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); -typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); -#endif - -#ifndef GL_NV_pixel_data_range -#define GL_NV_pixel_data_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); -GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); -typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); -#endif - -#ifndef GL_NV_primitive_restart -#define GL_NV_primitive_restart 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPrimitiveRestartNV (void); -GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); -#endif - -#ifndef GL_NV_texture_expand_normal -#define GL_NV_texture_expand_normal 1 -#endif - -#ifndef GL_NV_vertex_program2 -#define GL_NV_vertex_program2 1 -#endif - -#ifndef GL_ATI_map_object_buffer -#define GL_ATI_map_object_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); -GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); -#endif - -#ifndef GL_ATI_separate_stencil -#define GL_ATI_separate_stencil 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); -GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -#endif - -#ifndef GL_ATI_vertex_attrib_array_object -#define GL_ATI_vertex_attrib_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); -GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); -GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); -#endif - -#ifndef GL_OES_read_format -#define GL_OES_read_format 1 -#endif - -#ifndef GL_EXT_depth_bounds_test -#define GL_EXT_depth_bounds_test 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); -#endif - -#ifndef GL_EXT_texture_mirror_clamp -#define GL_EXT_texture_mirror_clamp 1 -#endif - -#ifndef GL_EXT_blend_equation_separate -#define GL_EXT_blend_equation_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); -#endif - -#ifndef GL_MESA_pack_invert -#define GL_MESA_pack_invert 1 -#endif - -#ifndef GL_MESA_ycbcr_texture -#define GL_MESA_ycbcr_texture 1 -#endif - -#ifndef GL_EXT_pixel_buffer_object -#define GL_EXT_pixel_buffer_object 1 -#endif - -#ifndef GL_NV_fragment_program_option -#define GL_NV_fragment_program_option 1 -#endif - -#ifndef GL_NV_fragment_program2 -#define GL_NV_fragment_program2 1 -#endif - -#ifndef GL_NV_vertex_program2_option -#define GL_NV_vertex_program2_option 1 -#endif - -#ifndef GL_NV_vertex_program3 -#define GL_NV_vertex_program3 1 -#endif - -#ifndef GL_EXT_framebuffer_object -#define GL_EXT_framebuffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); -GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); -GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); -GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); -GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); -GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); -GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); -GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); -GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); -GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); -GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); -GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); -GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); -GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); -#endif - -#ifndef GL_GREMEDY_string_marker -#define GL_GREMEDY_string_marker 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); -#endif - -#ifndef GL_EXT_packed_depth_stencil -#define GL_EXT_packed_depth_stencil 1 -#endif - -#ifndef GL_EXT_stencil_clear_tag -#define GL_EXT_stencil_clear_tag 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glStencilClearTagEXT (GLsizei, GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag); -#endif - -#ifndef GL_EXT_texture_sRGB -#define GL_EXT_texture_sRGB 1 -#endif - -#ifndef GL_EXT_framebuffer_blit -#define GL_EXT_framebuffer_blit 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlitFramebufferEXT (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif - -#ifndef GL_EXT_framebuffer_multisample -#define GL_EXT_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -#ifndef GL_MESAX_texture_stack -#define GL_MESAX_texture_stack 1 -#endif - -#ifndef GL_EXT_timer_query -#define GL_EXT_timer_query 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint, GLenum, GLint64EXT *); -GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint, GLenum, GLuint64EXT *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params); -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params); -#endif - -#ifndef GL_EXT_gpu_program_parameters -#define GL_EXT_gpu_program_parameters 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); -#endif - -#ifndef GL_APPLE_flush_buffer_range -#define GL_APPLE_flush_buffer_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum, GLenum, GLint); -GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum, GLintptr, GLsizeiptr); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); -#endif - -#ifndef GL_NV_gpu_program4 -#define GL_NV_gpu_program4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum, GLuint, const GLint *); -GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *); -GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum, GLuint, const GLuint *); -GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *); -GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum, GLuint, const GLint *); -GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *); -GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum, GLuint, const GLuint *); -GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *); -GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum, GLuint, GLint *); -GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum, GLuint, GLuint *); -GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum, GLuint, GLint *); -GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum, GLuint, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); -typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); -#endif - -#ifndef GL_NV_geometry_program4 -#define GL_NV_geometry_program4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramVertexLimitNV (GLenum, GLint); -GLAPI void APIENTRY glFramebufferTextureEXT (GLenum, GLenum, GLuint, GLint); -GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum, GLenum, GLuint, GLint, GLint); -GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum, GLenum, GLuint, GLint, GLenum); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); -#endif - -#ifndef GL_EXT_geometry_shader4 -#define GL_EXT_geometry_shader4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramParameteriEXT (GLuint, GLenum, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -#endif - -#ifndef GL_NV_vertex_program4 -#define GL_NV_vertex_program4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint, GLint); -GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint, GLint, GLint); -GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint, GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint, GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint, const GLint *); -GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint, const GLuint *); -GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint, const GLbyte *); -GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint, const GLshort *); -GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint, const GLubyte *); -GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint, const GLushort *); -GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint, GLint, GLenum, GLsizei, const GLvoid *); -GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint, GLenum, GLint *); -GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint, GLenum, GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); -#endif - -#ifndef GL_EXT_gpu_shader4 -#define GL_EXT_gpu_shader4 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetUniformuivEXT (GLuint, GLint, GLuint *); -GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint, GLuint, const GLchar *); -GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint, const GLchar *); -GLAPI void APIENTRY glUniform1uiEXT (GLint, GLuint); -GLAPI void APIENTRY glUniform2uiEXT (GLint, GLuint, GLuint); -GLAPI void APIENTRY glUniform3uiEXT (GLint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glUniform4uiEXT (GLint, GLuint, GLuint, GLuint, GLuint); -GLAPI void APIENTRY glUniform1uivEXT (GLint, GLsizei, const GLuint *); -GLAPI void APIENTRY glUniform2uivEXT (GLint, GLsizei, const GLuint *); -GLAPI void APIENTRY glUniform3uivEXT (GLint, GLsizei, const GLuint *); -GLAPI void APIENTRY glUniform4uivEXT (GLint, GLsizei, const GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); -typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); -typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); -#endif - -#ifndef GL_EXT_draw_instanced -#define GL_EXT_draw_instanced 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum, GLint, GLsizei, GLsizei); -GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif - -#ifndef GL_EXT_packed_float -#define GL_EXT_packed_float 1 -#endif - -#ifndef GL_EXT_texture_array -#define GL_EXT_texture_array 1 -#endif - -#ifndef GL_EXT_texture_buffer_object -#define GL_EXT_texture_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexBufferEXT (GLenum, GLenum, GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); -#endif - -#ifndef GL_EXT_texture_compression_latc -#define GL_EXT_texture_compression_latc 1 -#endif - -#ifndef GL_EXT_texture_compression_rgtc -#define GL_EXT_texture_compression_rgtc 1 -#endif - -#ifndef GL_EXT_texture_shared_exponent -#define GL_EXT_texture_shared_exponent 1 -#endif - -#ifndef GL_NV_depth_buffer_float -#define GL_NV_depth_buffer_float 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDepthRangedNV (GLdouble, GLdouble); -GLAPI void APIENTRY glClearDepthdNV (GLdouble); -GLAPI void APIENTRY glDepthBoundsdNV (GLdouble, GLdouble); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); -typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); -typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); -#endif - -#ifndef GL_NV_fragment_program4 -#define GL_NV_fragment_program4 1 -#endif - -#ifndef GL_NV_framebuffer_multisample_coverage -#define GL_NV_framebuffer_multisample_coverage 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -#ifndef GL_EXT_framebuffer_sRGB -#define GL_EXT_framebuffer_sRGB 1 -#endif - -#ifndef GL_NV_geometry_shader4 -#define GL_NV_geometry_shader4 1 -#endif - -#ifndef GL_NV_parameter_buffer_object -#define GL_NV_parameter_buffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum, GLuint, GLuint, GLsizei, const GLfloat *); -GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum, GLuint, GLuint, GLsizei, const GLint *); -GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum, GLuint, GLuint, GLsizei, const GLuint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); -typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); -#endif - -#ifndef GL_EXT_draw_buffers2 -#define GL_EXT_draw_buffers2 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); -GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum, GLuint, GLboolean *); -GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum, GLuint, GLint *); -GLAPI void APIENTRY glEnableIndexedEXT (GLenum, GLuint); -GLAPI void APIENTRY glDisableIndexedEXT (GLenum, GLuint); -GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum, GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); -typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); -typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); -typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); -typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); -#endif - -#ifndef GL_NV_transform_feedback -#define GL_NV_transform_feedback 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum); -GLAPI void APIENTRY glEndTransformFeedbackNV (void); -GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint, const GLint *, GLenum); -GLAPI void APIENTRY glBindBufferRangeNV (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); -GLAPI void APIENTRY glBindBufferOffsetNV (GLenum, GLuint, GLuint, GLintptr); -GLAPI void APIENTRY glBindBufferBaseNV (GLenum, GLuint, GLuint); -GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint, GLsizei, const GLint *, GLenum); -GLAPI void APIENTRY glActiveVaryingNV (GLuint, const GLchar *); -GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint, const GLchar *); -GLAPI void APIENTRY glGetActiveVaryingNV (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); -GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint, GLuint, GLint *); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); -typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); -typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); -typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); -typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); -#endif - -#ifndef GL_EXT_bindable_uniform -#define GL_EXT_bindable_uniform 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glUniformBufferEXT (GLuint, GLint, GLuint); -GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint, GLint); -GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint, GLint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); -typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); -typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); -#endif - -#ifndef GL_EXT_texture_integer -#define GL_EXT_texture_integer 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexParameterIivEXT (GLenum, GLenum, const GLint *); -GLAPI void APIENTRY glTexParameterIuivEXT (GLenum, GLenum, const GLuint *); -GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum, GLenum, GLint *); -GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum, GLenum, GLuint *); -GLAPI void APIENTRY glClearColorIiEXT (GLint, GLint, GLint, GLint); -GLAPI void APIENTRY glClearColorIuiEXT (GLuint, GLuint, GLuint, GLuint); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); -typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); -#endif - -#ifndef GL_GREMEDY_frame_terminator -#define GL_GREMEDY_frame_terminator 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glFrameTerminatorGREMEDY (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void); -#endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/polymer-perf/eduke32/build/include/gtkbits.h b/polymer-perf/eduke32/build/include/gtkbits.h deleted file mode 100644 index 57fae76bb..000000000 --- a/polymer-perf/eduke32/build/include/gtkbits.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __gtkbits_h__ -#define __gtkbits_h__ - -extern void gtkbuild_init(int32_t *argc, char ***argv); -extern void gtkbuild_exit(int32_t r); -extern int32_t gtkbuild_msgbox(char *name, char *msg); -extern int32_t gtkbuild_ynbox(char *name, char *msg); - -#endif diff --git a/polymer-perf/eduke32/build/include/hightile.h b/polymer-perf/eduke32/build/include/hightile.h deleted file mode 100644 index ff0f57a0c..000000000 --- a/polymer-perf/eduke32/build/include/hightile.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef HIGHTILE_PRIV_H -#define HIGHTILE_PRIV_H - -struct hicskybox_t { - int ignore; - char *face[6]; -}; - -typedef struct hicreplc_t { - struct hicreplc_t *next; - char palnum, ignore, flags, filler; - char *filename; - float alphacut, xscale, yscale, specpower, specfactor; - struct hicskybox_t *skybox; -} hicreplctyp; - -extern palette_t hictinting[MAXPALOOKUPS]; -extern hicreplctyp *hicreplc[MAXTILES]; -extern char hicfirstinit; - -typedef struct texcachehead_t -{ - char magic[4]; // 'PMST', was 'Polymost' - int xdim, ydim; // of image, unpadded - int flags; // 1 = !2^x, 2 = has alpha, 4 = lzw compressed - int quality; // r_downsize at the time the cache was written -} texcacheheader; - -typedef struct texcachepic_t -{ - int size; - int format; - int xdim, ydim; // of mipmap (possibly padded) - int border, depth; -} texcachepicture; - -hicreplctyp * hicfindsubst(int picnum, int palnum, int skybox); -#define HICEFFECTMASK (1|2|4|8) - -#endif diff --git a/polymer-perf/eduke32/build/include/kplib.h b/polymer-perf/eduke32/build/include/kplib.h deleted file mode 100644 index 531cd55ed..000000000 --- a/polymer-perf/eduke32/build/include/kplib.h +++ /dev/null @@ -1,21 +0,0 @@ - //High-level (easy) picture loading function: -extern void kpzload (const char *, intptr_t *, int32_t *, int32_t *, int32_t *); - //Low-level PNG/JPG functions: -extern void kpgetdim (const char *, int32_t, int32_t *, int32_t *); -extern int32_t kprender (const char *, int32_t, intptr_t, int32_t, int32_t, int32_t, int32_t, int32_t); - - //ZIP functions: -extern int32_t kzaddstack (const char *); -extern void kzuninit (); -extern int32_t kzopen (const char *); -extern int32_t kzread (void *, int32_t); -extern int32_t kzfilelength (); -extern int32_t kzseek (int32_t, int32_t); -extern int32_t kztell (); -extern int32_t kzgetc (); -extern int32_t kzeof (); -extern void kzclose (); - -extern void kzfindfilestart (const char *); //pass wildcard string -extern int32_t kzfindfile (char *); //you alloc buf, returns 1:found,0:~found - diff --git a/polymer-perf/eduke32/build/include/lzwnew.h b/polymer-perf/eduke32/build/include/lzwnew.h deleted file mode 100644 index 30a0c8b9f..000000000 --- a/polymer-perf/eduke32/build/include/lzwnew.h +++ /dev/null @@ -1,2 +0,0 @@ -int32_t lzwcompress (char *ucompbuf, int32_t ucompleng, char *compbuf); -int32_t lzwuncompress (char *compbuf, int32_t compleng, char *ucompbuf, int32_t ucompleng); diff --git a/polymer-perf/eduke32/build/include/m32script.h b/polymer-perf/eduke32/build/include/m32script.h deleted file mode 100644 index 37d02a49d..000000000 --- a/polymer-perf/eduke32/build/include/m32script.h +++ /dev/null @@ -1,296 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment -Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements) -Copyright (C) 2004, 2007 - EDuke32 developers - -This file is part of EDuke32 - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef _m32script_h_ -#define _m32script_h_ - -#include "compat.h" -#include "baselayer.h" -#include "build.h" -#include "editor.h" - -#define MAXQUOTES 2048 -#define MAXQUOTELEN 128 - -// Some misc #defines -//#define NO 0 -//#define YES 1 - -typedef int32_t instype; -typedef int32_t ofstype; - -extern char *ScriptQuotes[MAXQUOTES+1], *ScriptQuoteRedefinitions[MAXQUOTES+1]; -extern int32_t g_numQuoteRedefinitions; - -//extern int16_t neartagsector, neartagwall, neartagsprite; -//extern int32_t neartaghitdist; - -extern int32_t VM_Execute(int32_t once); -extern void VM_OnEvent(register int32_t iEventID, register int32_t iActor); - -extern void VM_ScriptInfo(void); -extern void VM_Disasm(ofstype beg, int32_t size); - -extern int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags); -extern int32_t Gv_NewArray(const char *pszLabel, void *arrayptr, intptr_t asize, uint32_t dwFlags); -extern void Gv_Init(void); - -extern int32_t __fastcall Gv_GetVarX(register int32_t id); -extern void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue); -extern int32_t __fastcall Gv_GetVarN(register int32_t id); // 'N' for "no side-effects"... vars and locals only! - -extern void SetGAMEPalette(void); -extern void SetWATERPalette(void); -extern void SetSLIMEPalette(void); -extern void SetBOSS1Palette(void); - -extern int32_t *constants, constants_allocsize; -extern int32_t g_numSavedConstants; - -extern instype *script ,*insptr; -extern int32_t *labelval; -extern uint8_t *labeltype; -extern int32_t g_numLabels, g_numDefaultLabels; -extern int32_t g_scriptSize; -extern char *label; -//extern int32_t label_allocsize; - -extern hashtable_t h_labels; - -#define MAXLABELLEN 32 - -//extern uint8_t waterpal[768],slimepal[768],titlepal[768],drealms[768],endingpal[768],animpal[768]; -//extern char currentboardfilename[BMAVM_PATH]; - - -enum GameEvent_t { - EVENT_ENTER3DMODE, - EVENT_ANALYZESPRITES, - EVENT_INSERTSPRITE2D, - EVENT_INSERTSPRITE3D, - EVENT_DRAW2DSCREEN, - EVENT_KEYS2D, - EVENT_KEYS3D, - EVENT_PREKEYS2D, - EVENT_PREKEYS3D, - MAXEVENTS -}; - -extern ofstype aEventOffsets[MAXEVENTS]; -extern int32_t aEventSizes[MAXEVENTS]; -extern uint8_t aEventEnabled[MAXEVENTS]; -extern uint16_t aEventNumLocals[MAXEVENTS]; - - -enum GamevarFlags_t { - MAXGAMEVARS = 1024, // must be a power of two between 256 and 4096, inclusive - LOG2MAXGV = 10, - MAXVARLABEL = MAXLABELLEN, //26, - - GAMEVAR_PERBLOCK = 0x00000001, // per-block (state, event, or top-level) variable - GAMEVAR_USER_MASK = GAMEVAR_PERBLOCK, - - GAMEVAR_RESET = 0x00000008, // marks var for to default - GAMEVAR_DEFAULT = 0x00000100, // allow override - - GAMEVAR_SYSTEM = 0x00000800, // cannot change mode flags...(only default value) - GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed) - - GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t - GAMEVAR_FLOATPTR = 0x00004000, // plValues is a pointer to a float - GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short - GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char - GAMEVAR_PTR_MASK = GAMEVAR_INTPTR|GAMEVAR_FLOATPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR, - -// GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state - GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars -}; - -enum GamearrayFlags_t { - MAXGAMEARRAYS = (MAXGAMEVARS>>2), // must be lower than MAXGAMEVARS - MAXARRAYLABEL = MAXVARLABEL, - - GAMEARRAY_READONLY = 0x00001000, - - GAMEARRAY_NORMAL = 0, - GAMEARRAY_OFCHAR = 0x00000001, - GAMEARRAY_OFSHORT = 0x00000002, - GAMEARRAY_OFINT = 0x00000004, - GAMEARRAY_TYPE_MASK = GAMEARRAY_OFCHAR|GAMEARRAY_OFSHORT|GAMEARRAY_OFINT, - - GAMEARRAY_VARSIZE = 0x00000020, - - GAMEARRAY_RESET = 0x00000008, -/// GAMEARRAY_NORESET = 0x00000001, -}; - -typedef struct { - union { - intptr_t lValue; // pointer when (dwFlags & GAMEVAR_*PTR) - int32_t *plValues; // array of values when (dwFlags & GAMEVAR_PERBLOCK) - } val; - intptr_t lDefault; - char *szLabel; - uint32_t dwFlags; -} gamevar_t; - -typedef struct { - char *szLabel; - void *vals; // array of values, type determined by (dwFlags & GAMEARRAY_TYPEMASK) - uint32_t dwFlags; - int32_t size; // id to size gamevar when (dwFlags & GAMEARRAY_VARSIZE) -} gamearray_t; - -extern gamevar_t aGameVars[MAXGAMEVARS]; -extern gamearray_t aGameArrays[MAXGAMEARRAYS]; -extern int32_t g_gameVarCount, g_systemVarCount; -extern int32_t g_gameArrayCount, g_systemArrayCount; - -extern uint32_t m32_drawlinepat; - - -extern int32_t g_iReturnVar; -extern int32_t m32_sortvar1, m32_sortvar2; -extern int32_t m32_script_expertmode; // if true, make read-only vars writable - -//extern int32_t g_numRealPalettes; -//extern int32_t g_scriptDebug; - -extern int32_t g_numQuoteRedefinitions; - -extern hashtable_t h_gamevars; -extern hashtable_t h_arrays; -//extern hashtable_t h_keywords; -extern hashtable_t h_gamefuncs; - - -extern int16_t asksave; - -extern vec3_t pos; -extern int16_t ang; -extern int32_t horiz; -extern int16_t cursectnum; -extern int32_t searchx, searchy; -/* -extern int16_t searchstat; -extern int16_t searchwall; -extern int16_t searchsector; -extern int16_t searchbottomwall; -*/ -extern int16_t pointhighlight; -extern int16_t linehighlight; -extern int16_t highlightcnt; -extern int16_t highlightsectorcnt; -/* -extern int32_t temppicnum; -extern int32_t tempcstat; -extern int32_t templotag; -extern int32_t temphitag; -extern int32_t tempextra; -extern int32_t tempshade; -extern uint32_t temppal; -extern uint32_t tempvis; -extern uint32_t tempxrepeat; -extern uint32_t tempyrepeat; -*/ -extern int32_t startposx; -extern int32_t startposy; -extern int32_t startposz; -extern int16_t startang; -extern int16_t startsectnum; - -extern int32_t mousxplc; -extern int32_t mousyplc; - -extern int16_t highlight[]; -extern int16_t highlightsector[]; - -extern int32_t numsprites; - -extern int32_t zoom; -extern int32_t halfxdim16, midydim16; - - -// gamevar bytecode format: - -// FEDC|BA98|7654|3210|FEDC|BA98|7654|3120 -// | .. .... .... gamevar ID -// | . constant bit (checked first) / get-payload-var bit for array or struct -// | . negate bit -// | . array bit \___\ if both set: -// | . struct bit / / local var -// .... .... .... ....| optional payload - - - -#define M32_FLAG_CONSTANT (MAXGAMEVARS) -#define M32_FLAG_NEGATE (MAXGAMEVARS<<1) - -#define M32_FLAG_VAR (0) -#define M32_FLAG_ARRAY (MAXGAMEVARS<<2) -#define M32_FLAG_STRUCT (MAXGAMEVARS<<3) -#define M32_FLAG_LOCAL (M32_FLAG_ARRAY|M32_FLAG_STRUCT) -#define M32_VARTYPE_MASK (M32_FLAG_ARRAY|M32_FLAG_STRUCT) - -#define M32_FLAG_CONSTANTINDEX M32_FLAG_CONSTANT -// if set, fetch index for array or struct array from 16 high bits as a constant (otherwise: gamevar) - -#define M32_BITS_MASK (0x0000ffff-(MAXGAMEVARS-1)) - -// IDs of special vars -#define M32_SPRITE_VAR_ID 0 -#define M32_SECTOR_VAR_ID 1 -#define M32_WALL_VAR_ID 2 -#define M32_TSPRITE_VAR_ID 3 - -#define M32_THISACTOR_VAR_ID 4 -#define M32_RETURN_VAR_ID 5 -#define M32_LOTAG_VAR_ID 6 -#define M32_HITAG_VAR_ID 7 -#define M32_TEXTURE_VAR_ID 8 - -#define M32_LOCAL_ARRAY_ID 0 - -#define M32_PRINTERROR(Text, ...) OSD_Printf(OSD_ERROR "Line %d, %s: " Text "\n", g_errorLineNum, keyw[g_tw], ## __VA_ARGS__) - - -// how local gamevars are allocated: - -// uncomment if variable-length arrays are available -//#define M32_LOCALS_VARARRAY - -// uncomment if alloca() is available -//#define M32_LOCALS_ALLOCA - -// if neither is there, use a constant number of them -#define M32_LOCALS_FIXEDNUM 64 - -#if defined M32_LOCALS_VARARRAY || defined M32_LOCALS_ALLOCA -# define M32_MAX_LOCALS MAXGAMEVARS -#else -# define M32_MAX_LOCALS M32_LOCALS_FIXEDNUM -#endif - - -#endif diff --git a/polymer-perf/eduke32/build/include/malloc.c.h b/polymer-perf/eduke32/build/include/malloc.c.h deleted file mode 100644 index 4a1bb7adb..000000000 --- a/polymer-perf/eduke32/build/include/malloc.c.h +++ /dev/null @@ -1,5871 +0,0 @@ -/* - This is a version (aka dlmalloc) of malloc/free/realloc written by - Doug Lea and released to the public domain, as explained at - http://creativecommons.org/licenses/publicdomain. Send questions, - comments, complaints, performance data, etc to dl@cs.oswego.edu - -* Version 2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee) - - Note: There may be an updated version of this malloc obtainable at - ftp://gee.cs.oswego.edu/pub/misc/malloc.c - Check before installing! - -* Quickstart - - This library is all in one file to simplify the most common usage: - ftp it, compile it (-O3), and link it into another program. All of - the compile-time options default to reasonable values for use on - most platforms. You might later want to step through various - compile-time and dynamic tuning options. - - For convenience, an include file for code using this malloc is at: - ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.4.h - You don't really need this .h file unless you call functions not - defined in your system include files. The .h file contains only the - excerpts from this file needed for using this malloc on ANSI C/C++ - systems, so long as you haven't changed compile-time options about - naming and tuning parameters. If you do, then you can create your - own malloc.h that does include all settings by cutting at the point - indicated below. Note that you may already by default be using a C - library containing a malloc that is based on some version of this - malloc (for example in linux). You might still want to use the one - in this file to customize settings or to avoid overheads associated - with library versions. - -* Vital statistics: - - Supported pointer/size_t representation: 4 or 8 bytes - size_t MUST be an unsigned type of the same width as - pointers. (If you are using an ancient system that declares - size_t as a signed type, or need it to be a different width - than pointers, you can use a previous release of this malloc - (e.g. 2.7.2) supporting these.) - - Alignment: 8 bytes (default) - This suffices for nearly all current machines and C compilers. - However, you can define MALLOC_ALIGNMENT to be wider than this - if necessary (up to 128bytes), at the expense of using more space. - - Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes) - 8 or 16 bytes (if 8byte sizes) - Each malloced chunk has a hidden word of overhead holding size - and status information, and additional cross-check word - if FOOTERS is defined. - - Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead) - 8-byte ptrs: 32 bytes (including overhead) - - Even a request for zero bytes (i.e., malloc(0)) returns a - pointer to something of the minimum allocatable size. - The maximum overhead wastage (i.e., number of extra bytes - allocated than were requested in malloc) is less than or equal - to the minimum size, except for requests >= mmap_threshold that - are serviced via mmap(), where the worst case wastage is about - 32 bytes plus the remainder from a system page (the minimal - mmap unit); typically 4096 or 8192 bytes. - - Security: static-safe; optionally more or less - The "security" of malloc refers to the ability of malicious - code to accentuate the effects of errors (for example, freeing - space that is not currently malloc'ed or overwriting past the - ends of chunks) in code that calls malloc. This malloc - guarantees not to modify any memory locations below the base of - heap, i.e., static variables, even in the presence of usage - errors. The routines additionally detect most improper frees - and reallocs. All this holds as long as the static bookkeeping - for malloc itself is not corrupted by some other means. This - is only one aspect of security -- these checks do not, and - cannot, detect all possible programming errors. - - If FOOTERS is defined nonzero, then each allocated chunk - carries an additional check word to verify that it was malloced - from its space. These check words are the same within each - execution of a program using malloc, but differ across - executions, so externally crafted fake chunks cannot be - freed. This improves security by rejecting frees/reallocs that - could corrupt heap memory, in addition to the checks preventing - writes to statics that are always on. This may further improve - security at the expense of time and space overhead. (Note that - FOOTERS may also be worth using with MSPACES.) - - By default detected errors cause the program to abort (calling - "abort()"). You can override this to instead proceed past - errors by defining PROCEED_ON_ERROR. In this case, a bad free - has no effect, and a malloc that encounters a bad address - caused by user overwrites will ignore the bad address by - dropping pointers and indices to all known memory. This may - be appropriate for programs that should continue if at all - possible in the face of programming errors, although they may - run out of memory because dropped memory is never reclaimed. - - If you don't like either of these options, you can define - CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if if you are sure that your program using malloc has - no errors or vulnerabilities, you can define INSECURE to 1, - which might (or might not) provide a small performance improvement. - - Thread-safety: NOT thread-safe unless USE_LOCKS defined - When USE_LOCKS is defined, each public call to malloc, free, - etc is surrounded with either a pthread mutex or a win32 - spinlock (depending on WIN32). This is not especially fast, and - can be a major bottleneck. It is designed only to provide - minimal protection in concurrent environments, and to provide a - basis for extensions. If you are using malloc in a concurrent - program, consider instead using nedmalloc - (http://www.nedprod.com/programs/portable/nedmalloc/) or - ptmalloc (See http://www.malloc.de), which are derived - from versions of this malloc. - - System requirements: Any combination of MORECORE and/or MMAP/MUNMAP - This malloc can use unix sbrk or any emulation (invoked using - the CALL_MORECORE macro) and/or mmap/munmap or any emulation - (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system - memory. On most unix systems, it tends to work best if both - MORECORE and MMAP are enabled. On Win32, it uses emulations - based on VirtualAlloc. It also uses common C library functions - like memset. - - Compliance: I believe it is compliant with the Single Unix Specification - (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably - others as well. - -* Overview of algorithms - - This is not the fastest, most space-conserving, most portable, or - most tunable malloc ever written. However it is among the fastest - while also being among the most space-conserving, portable and - tunable. Consistent balance across these factors results in a good - general-purpose allocator for malloc-intensive programs. - - In most ways, this malloc is a best-fit allocator. Generally, it - chooses the best-fitting existing chunk for a request, with ties - broken in approximately least-recently-used order. (This strategy - normally maintains low fragmentation.) However, for requests less - than 256bytes, it deviates from best-fit when there is not an - exactly fitting available chunk by preferring to use space adjacent - to that used for the previous small request, as well as by breaking - ties in approximately most-recently-used order. (These enhance - locality of series of small allocations.) And for very large requests - (>= 256Kb by default), it relies on system memory mapping - facilities, if supported. (This helps avoid carrying around and - possibly fragmenting memory used only for large chunks.) - - All operations (except malloc_stats and mallinfo) have execution - times that are bounded by a constant factor of the number of bits in - a size_t, not counting any clearing in calloc or copying in realloc, - or actions surrounding MORECORE and MMAP that have times - proportional to the number of non-contiguous regions returned by - system allocation routines, which is often just 1. In real-time - applications, you can optionally suppress segment traversals using - NO_SEGMENT_TRAVERSAL, which assures bounded execution even when - system allocators return non-contiguous spaces, at the typical - expense of carrying around more memory and increased fragmentation. - - The implementation is not very modular and seriously overuses - macros. Perhaps someday all C compilers will do as good a job - inlining modular code as can now be done by brute-force expansion, - but now, enough of them seem not to. - - Some compilers issue a lot of warnings about code that is - dead/unreachable only on some platforms, and also about intentional - uses of negation on unsigned types. All known cases of each can be - ignored. - - For a longer but out of date high-level description, see - http://gee.cs.oswego.edu/dl/html/malloc.html - -* MSPACES - If MSPACES is defined, then in addition to malloc, free, etc., - this file also defines mspace_malloc, mspace_free, etc. These - are versions of malloc routines that take an "mspace" argument - obtained using create_mspace, to control all internal bookkeeping. - If ONLY_MSPACES is defined, only these versions are compiled. - So if you would like to use this allocator for only some allocations, - and your system malloc for others, you can compile with - ONLY_MSPACES and then do something like... - static mspace mymspace = create_mspace(0,0); // for example - #define mymalloc(bytes) mspace_malloc(mymspace, bytes) - - (Note: If you only need one instance of an mspace, you can instead - use "USE_DL_PREFIX" to relabel the global malloc.) - - You can similarly create thread-local allocators by storing - mspaces as thread-locals. For example: - static __thread mspace tlms = 0; - void* tlmalloc(size_t bytes) { - if (tlms == 0) tlms = create_mspace(0, 0); - return mspace_malloc(tlms, bytes); - } - void tlfree(void* mem) { mspace_free(tlms, mem); } - - Unless FOOTERS is defined, each mspace is completely independent. - You cannot allocate from one and free to another (although - conformance is only weakly checked, so usage errors are not always - caught). If FOOTERS is defined, then each chunk carries around a tag - indicating its originating mspace, and frees are directed to their - originating spaces. - - ------------------------- Compile-time options --------------------------- - -Be careful in setting #define values for numerical constants of type -size_t. On some systems, literal values are not automatically extended -to size_t precision unless they are explicitly casted. You can also -use the symbolic values MAX_SIZE_T, SIZE_T_ONE, etc below. - -WIN32 default: defined if _WIN32 defined - Defining WIN32 sets up defaults for MS environment and compilers. - Otherwise defaults are for unix. Beware that there seem to be some - cases where this malloc might not be a pure drop-in replacement for - Win32 malloc: Random-looking failures from Win32 GDI API's (eg; - SetDIBits()) may be due to bugs in some video driver implementations - when pixel buffers are malloc()ed, and the region spans more than - one VirtualAlloc()ed region. Because dlmalloc uses a small (64Kb) - default granularity, pixel buffers may straddle virtual allocation - regions more often than when using the Microsoft allocator. You can - avoid this by using VirtualAlloc() and VirtualFree() for all pixel - buffers rather than using malloc(). If this is not possible, - recompile this malloc with a larger DEFAULT_GRANULARITY. - -MALLOC_ALIGNMENT default: (size_t)8 - Controls the minimum alignment for malloc'ed chunks. It must be a - power of two and at least 8, even on machines for which smaller - alignments would suffice. It may be defined as larger than this - though. Note however that code and data structures are optimized for - the case of 8-byte alignment. - -MSPACES default: 0 (false) - If true, compile in support for independent allocation spaces. - This is only supported if HAVE_MMAP is true. - -ONLY_MSPACES default: 0 (false) - If true, only compile in mspace versions, not regular versions. - -USE_LOCKS default: 0 (false) - Causes each call to each public routine to be surrounded with - pthread or WIN32 mutex lock/unlock. (If set true, this can be - overridden on a per-mspace basis for mspace versions.) If set to a - non-zero value other than 1, locks are used, but their - implementation is left out, so lock functions must be supplied manually, - as described below. - -USE_SPIN_LOCKS default: 1 iff USE_LOCKS and on x86 using gcc or MSC - If true, uses custom spin locks for locking. This is currently - supported only for x86 platforms using gcc or recent MS compilers. - Otherwise, posix locks or win32 critical sections are used. - -FOOTERS default: 0 - If true, provide extra checking and dispatching by placing - information in the footers of allocated chunks. This adds - space and time overhead. - -INSECURE default: 0 - If true, omit checks for usage errors and heap space overwrites. - -USE_DL_PREFIX default: NOT defined - Causes compiler to prefix all public routines with the string 'dl'. - This can be useful when you only want to use this malloc in one part - of a program, using your regular system malloc elsewhere. - -ABORT default: defined as abort() - Defines how to abort on failed checks. On most systems, a failed - check cannot die with an "assert" or even print an informative - message, because the underlying print routines in turn call malloc, - which will fail again. Generally, the best policy is to simply call - abort(). It's not very useful to do more than this because many - errors due to overwriting will show up as address faults (null, odd - addresses etc) rather than malloc-triggered checks, so will also - abort. Also, most compilers know that abort() does not return, so - can better optimize code conditionally calling it. - -PROCEED_ON_ERROR default: defined as 0 (false) - Controls whether detected bad addresses cause them to bypassed - rather than aborting. If set, detected bad arguments to free and - realloc are ignored. And all bookkeeping information is zeroed out - upon a detected overwrite of freed heap space, thus losing the - ability to ever return it from malloc again, but enabling the - application to proceed. If PROCEED_ON_ERROR is defined, the - static variable malloc_corruption_error_count is compiled in - and can be examined to see if errors have occurred. This option - generates slower code than the default abort policy. - -DEBUG default: NOT defined - The DEBUG setting is mainly intended for people trying to modify - this code or diagnose problems when porting to new platforms. - However, it may also be able to better isolate user errors than just - using runtime checks. The assertions in the check routines spell - out in more detail the assumptions and invariants underlying the - algorithms. The checking is fairly extensive, and will slow down - execution noticeably. Calling malloc_stats or mallinfo with DEBUG - set will attempt to check every non-mmapped allocated and free chunk - in the course of computing the summaries. - -ABORT_ON_ASSERT_FAILURE default: defined as 1 (true) - Debugging assertion failures can be nearly impossible if your - version of the assert macro causes malloc to be called, which will - lead to a cascade of further failures, blowing the runtime stack. - ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(), - which will usually make debugging easier. - -MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32 - The action to take before "return 0" when malloc fails to be able to - return memory because there is none available. - -HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES - True if this system supports sbrk or an emulation of it. - -MORECORE default: sbrk - The name of the sbrk-style system routine to call to obtain more - memory. See below for guidance on writing custom MORECORE - functions. The type of the argument to sbrk/MORECORE varies across - systems. It cannot be size_t, because it supports negative - arguments, so it is normally the signed type of the same width as - size_t (sometimes declared as "intptr_t"). It doesn't much matter - though. Internally, we only call it with arguments less than half - the max value of a size_t, which should work across all reasonable - possibilities, although sometimes generating compiler warnings. - -MORECORE_CONTIGUOUS default: 1 (true) if HAVE_MORECORE - If true, take advantage of fact that consecutive calls to MORECORE - with positive arguments always return contiguous increasing - addresses. This is true of unix sbrk. It does not hurt too much to - set it true anyway, since malloc copes with non-contiguities. - Setting it false when definitely non-contiguous saves time - and possibly wasted space it would take to discover this though. - -MORECORE_CANNOT_TRIM default: NOT defined - True if MORECORE cannot release space back to the system when given - negative arguments. This is generally necessary only if you are - using a hand-crafted MORECORE function that cannot handle negative - arguments. - -NO_SEGMENT_TRAVERSAL default: 0 - If non-zero, suppresses traversals of memory segments - returned by either MORECORE or CALL_MMAP. This disables - merging of segments that are contiguous, and selectively - releasing them to the OS if unused, but bounds execution times. - -HAVE_MMAP default: 1 (true) - True if this system supports mmap or an emulation of it. If so, and - HAVE_MORECORE is not true, MMAP is used for all system - allocation. If set and HAVE_MORECORE is true as well, MMAP is - primarily used to directly allocate very large blocks. It is also - used as a backup strategy in cases where MORECORE fails to provide - space from system. Note: A single call to MUNMAP is assumed to be - able to unmap memory that may have be allocated using multiple calls - to MMAP, so long as they are adjacent. - -HAVE_MREMAP default: 1 on linux, else 0 - If true realloc() uses mremap() to re-allocate large blocks and - extend or shrink allocation spaces. - -MMAP_CLEARS default: 1 except on WINCE. - True if mmap clears memory so calloc doesn't need to. This is true - for standard unix mmap using /dev/zero and on WIN32 except for WINCE. - -USE_BUILTIN_FFS default: 0 (i.e., not used) - Causes malloc to use the builtin ffs() function to compute indices. - Some compilers may recognize and intrinsify ffs to be faster than the - supplied C version. Also, the case of x86 using gcc is special-cased - to an asm instruction, so is already as fast as it can be, and so - this setting has no effect. Similarly for Win32 under recent MS compilers. - (On most x86s, the asm version is only slightly faster than the C version.) - -malloc_getpagesize default: derive from system includes, or 4096. - The system page size. To the extent possible, this malloc manages - memory from the system in page-size units. This may be (and - usually is) a function rather than a constant. This is ignored - if WIN32, where page size is determined using getSystemInfo during - initialization. This may be several megabytes if ENABLE_LARGE_PAGES - is enabled. - -ENABLE_LARGE_PAGES default: NOT defined - Causes the system page size to be the value of GetLargePageMinimum() - if that function is available (Windows Server 2003/Vista or later). - This allows the use of large page entries in the MMU which can - significantly improve performance in large working set applications - as TLB cache load is reduced by a factor of three. Note that enabling - this option is equal to locking the process' memory in current - implementations of Windows and requires the SE_LOCK_MEMORY_PRIVILEGE - to be held by the process in order to succeed. - -USE_DEV_RANDOM default: 0 (i.e., not used) - Causes malloc to use /dev/random to initialize secure magic seed for - stamping footers. Otherwise, the current time is used. - -NO_MALLINFO default: 0 - If defined, don't compile "mallinfo". This can be a simple way - of dealing with mismatches between system declarations and - those in this file. - -MALLINFO_FIELD_TYPE default: size_t - The type of the fields in the mallinfo struct. This was originally - defined as "int" in SVID etc, but is more usefully defined as - size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set - -REALLOC_ZERO_BYTES_FREES default: not defined - This should be set if a call to realloc with zero bytes should - be the same as a call to free. Some people think it should. Otherwise, - since this malloc returns a unique pointer for malloc(0), so does - realloc(p, 0). - -LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H -LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H -LACKS_STDLIB_H default: NOT defined unless on WIN32 - Define these if your system does not have these header files. - You might need to manually insert some of the declarations they provide. - -DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS, - system_info.dwAllocationGranularity in WIN32, - GetLargePageMinimum() if ENABLE_LARGE_PAGES, - otherwise 64K. - Also settable using mallopt(M_GRANULARITY, x) - The unit for allocating and deallocating memory from the system. On - most systems with contiguous MORECORE, there is no reason to - make this more than a page. However, systems with MMAP tend to - either require or encourage larger granularities. You can increase - this value to prevent system allocation functions to be called so - often, especially if they are slow. The value must be at least one - page and must be a power of two. Setting to 0 causes initialization - to either page size or win32 region size. (Note: In previous - versions of malloc, the equivalent of this option was called - "TOP_PAD") - -DEFAULT_GRANULARITY_ALIGNED default: undefined (which means page size) - Whether to enforce alignment when allocating and deallocating memory - from the system i.e. the base address of all allocations will be - aligned to DEFAULT_GRANULARITY if it is set. Note that enabling this carries - some overhead as multiple calls must now be made when probing for a valid - aligned value, however it does greatly ease the checking for whether - a given memory pointer was allocated by this allocator rather than - some other. - -DEFAULT_TRIM_THRESHOLD default: 2MB - Also settable using mallopt(M_TRIM_THRESHOLD, x) - The maximum amount of unused top-most memory to keep before - releasing via malloc_trim in free(). Automatic trimming is mainly - useful in long-lived programs using contiguous MORECORE. Because - trimming via sbrk can be slow on some systems, and can sometimes be - wasteful (in cases where programs immediately afterward allocate - more large chunks) the value should be high enough so that your - overall system performance would improve by releasing this much - memory. As a rough guide, you might set to a value close to the - average size of a process (program) running on your system. - Releasing this much memory would allow such a process to run in - memory. Generally, it is worth tuning trim thresholds when a - program undergoes phases where several large chunks are allocated - and released in ways that can reuse each other's storage, perhaps - mixed with phases where there are no such chunks at all. The trim - value must be greater than page size to have any useful effect. To - disable trimming completely, you can set to MAX_SIZE_T. Note that the trick - some people use of mallocing a huge space and then freeing it at - program startup, in an attempt to reserve system memory, doesn't - have the intended effect under automatic trimming, since that memory - will immediately be returned to the system. - -DEFAULT_MMAP_THRESHOLD default: 256K - Also settable using mallopt(M_MMAP_THRESHOLD, x) - The request size threshold for using MMAP to directly service a - request. Requests of at least this size that cannot be allocated - using already-existing space will be serviced via mmap. (If enough - normal freed space already exists it is used instead.) Using mmap - segregates relatively large chunks of memory so that they can be - individually obtained and released from the host system. A request - serviced through mmap is never reused by any other request (at least - not directly; the system may just so happen to remap successive - requests to the same locations). Segregating space in this way has - the benefits that: Mmapped space can always be individually released - back to the system, which helps keep the system level memory demands - of a long-lived program low. Also, mapped memory doesn't become - `locked' between other chunks, as can happen with normally allocated - chunks, which means that even trimming via malloc_trim would not - release them. However, it has the disadvantage that the space - cannot be reclaimed, consolidated, and then used to service later - requests, as happens with normal chunks. The advantages of mmap - nearly always outweigh disadvantages for "large" chunks, but the - value of "large" may vary across systems. The default is an - empirically derived value that works well in most systems. You can - disable mmap by setting to MAX_SIZE_T. - -MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP - The number of consolidated frees between checks to release - unused segments when freeing. When using non-contiguous segments, - especially with multiple mspaces, checking only for topmost space - doesn't always suffice to trigger trimming. To compensate for this, - free() will, with a period of MAX_RELEASE_CHECK_RATE (or the - current number of segments, if greater) try to release unused - segments to the OS when freeing chunks that result in - consolidation. The best value for this parameter is a compromise - between slowing down frees with relatively costly checks that - rarely trigger versus holding on to unused memory. To effectively - disable, set to MAX_SIZE_T. This may lead to a very slight speed - improvement at the expense of carrying around more memory. -*/ - -/* Version identifier to allow people to support multiple versions */ -#ifndef DLMALLOC_VERSION -#define DLMALLOC_VERSION 20804 -#endif /* DLMALLOC_VERSION */ - -#ifndef WIN32 -#ifdef _WIN32 -#define WIN32 1 -#endif /* _WIN32 */ -#ifdef _WIN32_WCE -#define LACKS_FCNTL_H -#define WIN32 1 -#endif /* _WIN32_WCE */ -#endif /* WIN32 */ -#ifdef WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#include -#define HAVE_MMAP 1 -#define HAVE_MORECORE 0 -#define LACKS_UNISTD_H -#define LACKS_SYS_PARAM_H -#define LACKS_SYS_MMAN_H -#define LACKS_STRING_H -#define LACKS_STRINGS_H -#define LACKS_SYS_TYPES_H -#define LACKS_ERRNO_H -#ifndef MALLOC_FAILURE_ACTION -#define MALLOC_FAILURE_ACTION -#endif /* MALLOC_FAILURE_ACTION */ -#ifdef _WIN32_WCE /* WINCE reportedly does not clear */ -#define MMAP_CLEARS 0 -#else -#define MMAP_CLEARS 1 -#endif /* _WIN32_WCE */ -#endif /* WIN32 */ - -#if defined(DARWIN) || defined(_DARWIN) -/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ -#ifndef HAVE_MORECORE -#define HAVE_MORECORE 0 -#define HAVE_MMAP 1 -/* OSX allocators provide 16 byte alignment */ -#ifndef MALLOC_ALIGNMENT -#define MALLOC_ALIGNMENT ((size_t)16U) -#endif -#endif /* HAVE_MORECORE */ -#endif /* DARWIN */ - -#ifndef LACKS_SYS_TYPES_H -#include /* For size_t */ -#endif /* LACKS_SYS_TYPES_H */ - -#if (defined(__GNUC__) && ((defined(__i386__) || defined(__x86_64__)))) || (defined(_MSC_VER) && _MSC_VER>=1310) -#define SPIN_LOCKS_AVAILABLE 1 -#else -#define SPIN_LOCKS_AVAILABLE 0 -#endif - -/* The maximum possible size_t value has all bits set */ -#define MAX_SIZE_T (~(size_t)0) - -#ifndef ONLY_MSPACES -#define ONLY_MSPACES 0 /* define to a value */ -#else -#define ONLY_MSPACES 1 -#endif /* ONLY_MSPACES */ -#ifndef MSPACES -#if ONLY_MSPACES -#define MSPACES 1 -#else /* ONLY_MSPACES */ -#define MSPACES 0 -#endif /* ONLY_MSPACES */ -#endif /* MSPACES */ -#ifndef MALLOC_ALIGNMENT -#define MALLOC_ALIGNMENT ((size_t)8U) -#endif /* MALLOC_ALIGNMENT */ -#ifndef FOOTERS -#define FOOTERS 0 -#endif /* FOOTERS */ -#ifndef ABORT -#define ABORT abort() -#endif /* ABORT */ -#ifndef ABORT_ON_ASSERT_FAILURE -#define ABORT_ON_ASSERT_FAILURE 1 -#endif /* ABORT_ON_ASSERT_FAILURE */ -#ifndef PROCEED_ON_ERROR -#define PROCEED_ON_ERROR 0 -#endif /* PROCEED_ON_ERROR */ -#ifndef USE_LOCKS -#define USE_LOCKS 0 -#endif /* USE_LOCKS */ -#ifndef USE_SPIN_LOCKS -#if USE_LOCKS && SPIN_LOCKS_AVAILABLE -#define USE_SPIN_LOCKS 1 -#else -#define USE_SPIN_LOCKS 0 -#endif /* USE_LOCKS && SPIN_LOCKS_AVAILABLE. */ -#endif /* USE_SPIN_LOCKS */ -#ifndef INSECURE -#define INSECURE 0 -#endif /* INSECURE */ -#ifndef HAVE_MMAP -#define HAVE_MMAP 1 -#endif /* HAVE_MMAP */ -#ifndef MMAP_CLEARS -#define MMAP_CLEARS 1 -#endif /* MMAP_CLEARS */ -#ifndef HAVE_MREMAP -#ifdef linux -#define HAVE_MREMAP 1 -#else /* linux */ -#define HAVE_MREMAP 0 -#endif /* linux */ -#endif /* HAVE_MREMAP */ -#ifndef MALLOC_FAILURE_ACTION -#define MALLOC_FAILURE_ACTION errno = ENOMEM; -#endif /* MALLOC_FAILURE_ACTION */ -#ifndef HAVE_MORECORE -#if ONLY_MSPACES -#define HAVE_MORECORE 0 -#else /* ONLY_MSPACES */ -#define HAVE_MORECORE 1 -#endif /* ONLY_MSPACES */ -#endif /* HAVE_MORECORE */ -#if !HAVE_MORECORE -#define MORECORE_CONTIGUOUS 0 -#else /* !HAVE_MORECORE */ -#define MORECORE_DEFAULT sbrk -#ifndef MORECORE_CONTIGUOUS -#define MORECORE_CONTIGUOUS 1 -#endif /* MORECORE_CONTIGUOUS */ -#endif /* HAVE_MORECORE */ -#ifndef DEFAULT_GRANULARITY -#if (MORECORE_CONTIGUOUS || defined(WIN32)) -#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ -#else /* MORECORE_CONTIGUOUS */ -#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) -#endif /* MORECORE_CONTIGUOUS */ -#endif /* DEFAULT_GRANULARITY */ -#ifndef DEFAULT_TRIM_THRESHOLD -#ifndef MORECORE_CANNOT_TRIM -#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) -#else /* MORECORE_CANNOT_TRIM */ -#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T -#endif /* MORECORE_CANNOT_TRIM */ -#endif /* DEFAULT_TRIM_THRESHOLD */ -#ifndef DEFAULT_MMAP_THRESHOLD -#if HAVE_MMAP -#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) -#else /* HAVE_MMAP */ -#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T -#endif /* HAVE_MMAP */ -#endif /* DEFAULT_MMAP_THRESHOLD */ -#ifndef MAX_RELEASE_CHECK_RATE -#if HAVE_MMAP -#define MAX_RELEASE_CHECK_RATE 4095 -#else -#define MAX_RELEASE_CHECK_RATE MAX_SIZE_T -#endif /* HAVE_MMAP */ -#endif /* MAX_RELEASE_CHECK_RATE */ -#ifndef USE_BUILTIN_FFS -#define USE_BUILTIN_FFS 0 -#endif /* USE_BUILTIN_FFS */ -#ifndef USE_DEV_RANDOM -#define USE_DEV_RANDOM 0 -#endif /* USE_DEV_RANDOM */ -#ifndef NO_MALLINFO -#define NO_MALLINFO 0 -#endif /* NO_MALLINFO */ -#ifndef MALLINFO_FIELD_TYPE -#define MALLINFO_FIELD_TYPE size_t -#endif /* MALLINFO_FIELD_TYPE */ -#ifndef NO_SEGMENT_TRAVERSAL -#define NO_SEGMENT_TRAVERSAL 0 -#endif /* NO_SEGMENT_TRAVERSAL */ - -/* - mallopt tuning options. SVID/XPG defines four standard parameter - numbers for mallopt, normally defined in malloc.h. None of these - are used in this malloc, so setting them has no effect. But this - malloc does support the following options. -*/ - -#define M_TRIM_THRESHOLD (-1) -#define M_GRANULARITY (-2) -#define M_MMAP_THRESHOLD (-3) - -/* ------------------------ Mallinfo declarations ------------------------ */ - -#if !NO_MALLINFO -/* - This version of malloc supports the standard SVID/XPG mallinfo - routine that returns a struct containing usage properties and - statistics. It should work on any system that has a - /usr/include/malloc.h defining struct mallinfo. The main - declaration needed is the mallinfo struct that is returned (by-copy) - by mallinfo(). The malloinfo struct contains a bunch of fields that - are not even meaningful in this version of malloc. These fields are - are instead filled by mallinfo() with other numbers that might be of - interest. - - HAVE_USR_INCLUDE_MALLOC_H should be set if you have a - /usr/include/malloc.h file that includes a declaration of struct - mallinfo. If so, it is included; else a compliant version is - declared below. These must be precisely the same for mallinfo() to - work. The original SVID version of this struct, defined on most - systems with mallinfo, declares all fields as ints. But some others - define as unsigned long. If your system defines the fields using a - type of different width than listed here, you MUST #include your - system version and #define HAVE_USR_INCLUDE_MALLOC_H. -*/ - -/* #define HAVE_USR_INCLUDE_MALLOC_H */ - -#ifdef HAVE_USR_INCLUDE_MALLOC_H -#include "/usr/include/malloc.h" -#else /* HAVE_USR_INCLUDE_MALLOC_H */ -#ifndef STRUCT_MALLINFO_DECLARED -#define STRUCT_MALLINFO_DECLARED 1 -struct mallinfo { - MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ - MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ - MALLINFO_FIELD_TYPE smblks; /* always 0 */ - MALLINFO_FIELD_TYPE hblks; /* always 0 */ - MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ - MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ - MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ - MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ - MALLINFO_FIELD_TYPE fordblks; /* total free space */ - MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ -}; -#endif /* STRUCT_MALLINFO_DECLARED */ -#endif /* HAVE_USR_INCLUDE_MALLOC_H */ -#endif /* NO_MALLINFO */ - -/* - Try to persuade compilers to inline. The most critical functions for - inlining are defined as macros, so these aren't used for them. -*/ - -#ifndef FORCEINLINE - #if defined(__GNUC__) -#define FORCEINLINE __inline __attribute__ ((always_inline)) - #elif defined(_MSC_VER) - #define FORCEINLINE __forceinline - #endif -#endif -#ifndef NOINLINE - #if defined(__GNUC__) - #define NOINLINE __attribute__ ((noinline)) - #elif defined(_MSC_VER) - #define NOINLINE __declspec(noinline) - #else - #define NOINLINE - #endif -#endif - -#ifdef __cplusplus -extern "C" { -#ifndef FORCEINLINE - #define FORCEINLINE inline -#endif -#endif /* __cplusplus */ -#ifndef FORCEINLINE - #define FORCEINLINE -#endif - -#if !ONLY_MSPACES - -/* ------------------- Declarations of public routines ------------------- */ - -#ifndef USE_DL_PREFIX -#define dlcalloc calloc -#define dlfree free -#define dlmalloc malloc -#define dlmemalign memalign -#define dlrealloc realloc -#define dlvalloc valloc -#define dlpvalloc pvalloc -#define dlmallinfo mallinfo -#define dlmallopt mallopt -#define dlmalloc_trim malloc_trim -#define dlmalloc_stats malloc_stats -#define dlmalloc_usable_size malloc_usable_size -#define dlmalloc_footprint malloc_footprint -#define dlmalloc_max_footprint malloc_max_footprint -#define dlindependent_calloc independent_calloc -#define dlindependent_comalloc independent_comalloc -#endif /* USE_DL_PREFIX */ - - -/* - malloc(size_t n) - Returns a pointer to a newly allocated chunk of at least n bytes, or - null if no space is available, in which case errno is set to ENOMEM - on ANSI C systems. - - If n is zero, malloc returns a minimum-sized chunk. (The minimum - size is 16 bytes on most 32bit systems, and 32 bytes on 64bit - systems.) Note that size_t is an unsigned type, so calls with - arguments that would be negative if signed are interpreted as - requests for huge amounts of space, which will often fail. The - maximum supported value of n differs across systems, but is in all - cases less than the maximum representable value of a size_t. -*/ -void* dlmalloc(size_t); - -/* - free(void* p) - Releases the chunk of memory pointed to by p, that had been previously - allocated using malloc or a related routine such as realloc. - It has no effect if p is null. If p was not malloced or already - freed, free(p) will by default cause the current program to abort. -*/ -void dlfree(void*); - -/* - calloc(size_t n_elements, size_t element_size); - Returns a pointer to n_elements * element_size bytes, with all locations - set to zero. -*/ -void* dlcalloc(size_t, size_t); - -/* - realloc(void* p, size_t n) - Returns a pointer to a chunk of size n that contains the same data - as does chunk p up to the minimum of (n, p's size) bytes, or null - if no space is available. - - The returned pointer may or may not be the same as p. The algorithm - prefers extending p in most cases when possible, otherwise it - employs the equivalent of a malloc-copy-free sequence. - - If p is null, realloc is equivalent to malloc. - - If space is not available, realloc returns null, errno is set (if on - ANSI) and p is NOT freed. - - if n is for fewer bytes than already held by p, the newly unused - space is lopped off and freed if possible. realloc with a size - argument of zero (re)allocates a minimum-sized chunk. - - The old unix realloc convention of allowing the last-free'd chunk - to be used as an argument to realloc is not supported. -*/ - -void* dlrealloc(void*, size_t); - -/* - memalign(size_t alignment, size_t n); - Returns a pointer to a newly allocated chunk of n bytes, aligned - in accord with the alignment argument. - - The alignment argument should be a power of two. If the argument is - not a power of two, the nearest greater power is used. - 8-byte alignment is guaranteed by normal malloc calls, so don't - bother calling memalign with an argument of 8 or less. - - Overreliance on memalign is a sure way to fragment space. -*/ -void* dlmemalign(size_t, size_t); - -/* - valloc(size_t n); - Equivalent to memalign(pagesize, n), where pagesize is the page - size of the system. If the pagesize is unknown, 4096 is used. -*/ -void* dlvalloc(size_t); - -/* - mallopt(int parameter_number, int parameter_value) - Sets tunable parameters The format is to provide a - (parameter-number, parameter-value) pair. mallopt then sets the - corresponding parameter to the argument value if it can (i.e., so - long as the value is meaningful), and returns 1 if successful else - 0. To workaround the fact that mallopt is specified to use int, - not size_t parameters, the value -1 is specially treated as the - maximum unsigned size_t value. - - SVID/XPG/ANSI defines four standard param numbers for mallopt, - normally defined in malloc.h. None of these are use in this malloc, - so setting them has no effect. But this malloc also supports other - options in mallopt. See below for details. Briefly, supported - parameters are as follows (listed defaults are for "typical" - configurations). - - Symbol param # default allowed param values - M_TRIM_THRESHOLD -1 2*1024*1024 any (-1 disables) - M_GRANULARITY -2 page size any power of 2 >= page size - M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) -*/ -int dlmallopt(int, int); - -/* - malloc_footprint(); - Returns the number of bytes obtained from the system. The total - number of bytes allocated by malloc, realloc etc., is less than this - value. Unlike mallinfo, this function returns only a precomputed - result, so can be called frequently to monitor memory consumption. - Even if locks are otherwise defined, this function does not use them, - so results might not be up to date. -*/ -size_t dlmalloc_footprint(void); - -/* - malloc_max_footprint(); - Returns the maximum number of bytes obtained from the system. This - value will be greater than current footprint if deallocated space - has been reclaimed by the system. The peak number of bytes allocated - by malloc, realloc etc., is less than this value. Unlike mallinfo, - this function returns only a precomputed result, so can be called - frequently to monitor memory consumption. Even if locks are - otherwise defined, this function does not use them, so results might - not be up to date. -*/ -size_t dlmalloc_max_footprint(void); - -#if !NO_MALLINFO -/* - mallinfo() - Returns (by copy) a struct containing various summary statistics: - - arena: current total non-mmapped bytes allocated from system - ordblks: the number of free chunks - smblks: always zero. - hblks: current number of mmapped regions - hblkhd: total bytes held in mmapped regions - usmblks: the maximum total allocated space. This will be greater - than current total if trimming has occurred. - fsmblks: always zero - uordblks: current total allocated space (normal or mmapped) - fordblks: total free space - keepcost: the maximum number of bytes that could ideally be released - back to system via malloc_trim. ("ideally" means that - it ignores page restrictions etc.) - - Because these fields are ints, but internal bookkeeping may - be kept as longs, the reported values may wrap around zero and - thus be inaccurate. -*/ -struct mallinfo dlmallinfo(void); -#endif /* NO_MALLINFO */ - -/* - independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); - - independent_calloc is similar to calloc, but instead of returning a - single cleared space, it returns an array of pointers to n_elements - independent elements that can hold contents of size elem_size, each - of which starts out cleared, and can be independently freed, - realloc'ed etc. The elements are guaranteed to be adjacently - allocated (this is not guaranteed to occur with multiple callocs or - mallocs), which may also improve cache locality in some - applications. - - The "chunks" argument is optional (i.e., may be null, which is - probably the most typical usage). If it is null, the returned array - is itself dynamically allocated and should also be freed when it is - no longer needed. Otherwise, the chunks array must be of at least - n_elements in length. It is filled in with the pointers to the - chunks. - - In either case, independent_calloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and "chunks" - is null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use regular calloc and assign pointers into this - space to represent elements. (In this case though, you cannot - independently free elements.) - - independent_calloc simplifies and speeds up implementations of many - kinds of pools. It may also be useful when constructing large data - structures that initially have a fixed number of fixed-sized nodes, - but the number is not known at compile time, and some of the nodes - may later need to be freed. For example: - - struct Node { int item; struct Node* next; }; - - struct Node* build_list() { - struct Node** pool; - int n = read_number_of_nodes_needed(); - if (n <= 0) return 0; - pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); - if (pool == 0) die(); - // organize into a linked list... - struct Node* first = pool[0]; - for (i = 0; i < n-1; ++i) - pool[i]->next = pool[i+1]; - free(pool); // Can now free the array (or not, if it is needed later) - return first; - } -*/ -void** dlindependent_calloc(size_t, size_t, void**); - -/* - independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); - - independent_comalloc allocates, all at once, a set of n_elements - chunks with sizes indicated in the "sizes" array. It returns - an array of pointers to these elements, each of which can be - independently freed, realloc'ed etc. The elements are guaranteed to - be adjacently allocated (this is not guaranteed to occur with - multiple callocs or mallocs), which may also improve cache locality - in some applications. - - The "chunks" argument is optional (i.e., may be null). If it is null - the returned array is itself dynamically allocated and should also - be freed when it is no longer needed. Otherwise, the chunks array - must be of at least n_elements in length. It is filled in with the - pointers to the chunks. - - In either case, independent_comalloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and chunks is - null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use a single regular malloc, and assign pointers at - particular offsets in the aggregate space. (In this case though, you - cannot independently free elements.) - - independent_comallac differs from independent_calloc in that each - element may have a different size, and also that it does not - automatically clear elements. - - independent_comalloc can be used to speed up allocation in cases - where several structs or objects must always be allocated at the - same time. For example: - - struct Head { ... } - struct Foot { ... } - - void send_message(char* msg) { - int msglen = strlen(msg); - size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; - void* chunks[3]; - if (independent_comalloc(3, sizes, chunks) == 0) - die(); - struct Head* head = (struct Head*)(chunks[0]); - char* body = (char*)(chunks[1]); - struct Foot* foot = (struct Foot*)(chunks[2]); - // ... - } - - In general though, independent_comalloc is worth using only for - larger values of n_elements. For small values, you probably won't - detect enough difference from series of malloc calls to bother. - - Overuse of independent_comalloc can increase overall memory usage, - since it cannot reuse existing noncontiguous small chunks that - might be available for some of the elements. -*/ -void** dlindependent_comalloc(size_t, size_t*, void**); - - -/* - pvalloc(size_t n); - Equivalent to valloc(minimum-page-that-holds(n)), that is, - round up n to nearest pagesize. - */ -void* dlpvalloc(size_t); - -/* - malloc_trim(size_t pad); - - If possible, gives memory back to the system (via negative arguments - to sbrk) if there is unused memory at the `high' end of the malloc - pool or in unused MMAP segments. You can call this after freeing - large blocks of memory to potentially reduce the system-level memory - requirements of a program. However, it cannot guarantee to reduce - memory. Under some allocation patterns, some large free blocks of - memory will be locked between two used chunks, so they cannot be - given back to the system. - - The `pad' argument to malloc_trim represents the amount of free - trailing space to leave untrimmed. If this argument is zero, only - the minimum amount of memory to maintain internal data structures - will be left. Non-zero arguments can be supplied to maintain enough - trailing space to service future expected allocations without having - to re-obtain memory from the system. - - Malloc_trim returns 1 if it actually released any memory, else 0. -*/ -int dlmalloc_trim(size_t); - -/* - malloc_stats(); - Prints on stderr the amount of space obtained from the system (both - via sbrk and mmap), the maximum amount (which may be more than - current if malloc_trim and/or munmap got called), and the current - number of bytes allocated via malloc (or realloc, etc) but not yet - freed. Note that this is the number of bytes allocated, not the - number requested. It will be larger than the number requested - because of alignment and bookkeeping overhead. Because it includes - alignment wastage as being in use, this figure may be greater than - zero even when no user-level chunks are allocated. - - The reported current and maximum system memory can be inaccurate if - a program makes other calls to system memory allocation functions - (normally sbrk) outside of malloc. - - malloc_stats prints only the most commonly interesting statistics. - More information can be obtained by calling mallinfo. -*/ -void dlmalloc_stats(void); - -#endif /* ONLY_MSPACES */ - -/* - malloc_usable_size(void* p); - - Returns the number of bytes you can actually use in - an allocated chunk, which may be more than you requested (although - often not) due to alignment and minimum size constraints. - You can use this many bytes without worrying about - overwriting other allocated objects. This is not a particularly great - programming practice. malloc_usable_size can be more useful in - debugging and assertions, for example: - - p = malloc(n); - assert(malloc_usable_size(p) >= 256); -*/ -size_t dlmalloc_usable_size(void*); - - -#if MSPACES - -/* - mspace is an opaque type representing an independent - region of space that supports mspace_malloc, etc. -*/ -typedef void* mspace; - -/* - create_mspace creates and returns a new independent space with the - given initial capacity, or, if 0, the default granularity size. It - returns null if there is no system memory available to create the - space. If argument locked is non-zero, the space uses a separate - lock to control access. The capacity of the space will grow - dynamically as needed to service mspace_malloc requests. You can - control the sizes of incremental increases of this space by - compiling with a different DEFAULT_GRANULARITY or dynamically - setting with mallopt(M_GRANULARITY, value). -*/ -mspace create_mspace(size_t capacity, int locked); - -/* - destroy_mspace destroys the given space, and attempts to return all - of its memory back to the system, returning the total number of - bytes freed. After destruction, the results of access to all memory - used by the space become undefined. -*/ -size_t destroy_mspace(mspace msp); - -/* - create_mspace_with_base uses the memory supplied as the initial base - of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this - space is used for bookkeeping, so the capacity must be at least this - large. (Otherwise 0 is returned.) When this initial space is - exhausted, additional memory will be obtained from the system. - Destroying this space will deallocate all additionally allocated - space (if possible) but not the initial base. -*/ -mspace create_mspace_with_base(void* base, size_t capacity, int locked); - -/* - mspace_track_large_chunks controls whether requests for large chunks - are allocated in their own untracked mmapped regions, separate from - others in this mspace. By default large chunks are not tracked, - which reduces fragmentation. However, such chunks are not - necessarily released to the system upon destroy_mspace. Enabling - tracking by setting to true may increase fragmentation, but avoids - leakage when relying on destroy_mspace to release all memory - allocated using this space. The function returns the previous - setting. -*/ -int mspace_track_large_chunks(mspace msp, int enable); - - -/* - mspace_malloc behaves as malloc, but operates within - the given space. -*/ -void* mspace_malloc(mspace msp, size_t bytes); - -/* - mspace_free behaves as free, but operates within - the given space. - - If compiled with FOOTERS==1, mspace_free is not actually needed. - free may be called instead of mspace_free because freed chunks from - any space are handled by their originating spaces. -*/ -void mspace_free(mspace msp, void* mem); - -/* - mspace_realloc behaves as realloc, but operates within - the given space. - - If compiled with FOOTERS==1, mspace_realloc is not actually - needed. realloc may be called instead of mspace_realloc because - realloced chunks from any space are handled by their originating - spaces. -*/ -void* mspace_realloc(mspace msp, void* mem, size_t newsize); - -/* - mspace_calloc behaves as calloc, but operates within - the given space. -*/ -void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); - -/* - mspace_memalign behaves as memalign, but operates within - the given space. -*/ -void* mspace_memalign(mspace msp, size_t alignment, size_t bytes); - -/* - mspace_independent_calloc behaves as independent_calloc, but - operates within the given space. -*/ -void** mspace_independent_calloc(mspace msp, size_t n_elements, - size_t elem_size, void* chunks[]); - -/* - mspace_independent_comalloc behaves as independent_comalloc, but - operates within the given space. -*/ -void** mspace_independent_comalloc(mspace msp, size_t n_elements, - size_t sizes[], void* chunks[]); - -/* - mspace_footprint() returns the number of bytes obtained from the - system for this space. -*/ -size_t mspace_footprint(mspace msp); - -/* - mspace_max_footprint() returns the peak number of bytes obtained from the - system for this space. -*/ -size_t mspace_max_footprint(mspace msp); - - -#if !NO_MALLINFO -/* - mspace_mallinfo behaves as mallinfo, but reports properties of - the given space. -*/ -struct mallinfo mspace_mallinfo(mspace msp); -#endif /* NO_MALLINFO */ - -/* - malloc_usable_size(void* p) behaves the same as malloc_usable_size; -*/ - size_t mspace_usable_size(void* mem); - -/* - mspace_malloc_stats behaves as malloc_stats, but reports - properties of the given space. -*/ -void mspace_malloc_stats(mspace msp); - -/* - mspace_trim behaves as malloc_trim, but - operates within the given space. -*/ -int mspace_trim(mspace msp, size_t pad); - -/* - An alias for mallopt. -*/ -int mspace_mallopt(int, int); - -#endif /* MSPACES */ - -#ifdef __cplusplus -} /* end of extern "C" */ -#endif /* __cplusplus */ - -/* - ======================================================================== - To make a fully customizable malloc.h header file, cut everything - above this line, put into file malloc.h, edit to suit, and #include it - on the next line, as well as in programs that use this malloc. - ======================================================================== -*/ - -/* #include "malloc.h" */ - -/*------------------------------ internal #includes ---------------------- */ - -#if defined(WIN32) && defined(_MSC_VER) -#pragma warning( disable : 4146 ) /* no "unsigned" warnings */ -#endif /* WIN32 */ - -#include /* for printing in malloc_stats */ - -#ifndef LACKS_ERRNO_H -#include /* for MALLOC_FAILURE_ACTION */ -#endif /* LACKS_ERRNO_H */ -#if FOOTERS || DEBUG -#include /* for magic initialization */ -#endif /* FOOTERS */ -#ifndef LACKS_STDLIB_H -#include /* for abort() */ -#endif /* LACKS_STDLIB_H */ -#ifdef DEBUG -#if ABORT_ON_ASSERT_FAILURE -#undef assert -#define assert(x) if(!(x)) ABORT -#else /* ABORT_ON_ASSERT_FAILURE */ -#include -#endif /* ABORT_ON_ASSERT_FAILURE */ -#else /* DEBUG */ -#ifndef assert -#define assert(x) -#endif -#define DEBUG 0 -#endif /* DEBUG */ -#ifndef LACKS_STRING_H -#include /* for memset etc */ -#endif /* LACKS_STRING_H */ -#if USE_BUILTIN_FFS -#ifndef LACKS_STRINGS_H -#include /* for ffs */ -#endif /* LACKS_STRINGS_H */ -#endif /* USE_BUILTIN_FFS */ -#if HAVE_MMAP -#ifndef LACKS_SYS_MMAN_H -/* On some versions of linux, mremap decl in mman.h needs __USE_GNU set */ -#if (defined(linux) && !defined(__USE_GNU)) -#define __USE_GNU 1 -#include /* for mmap */ -#undef __USE_GNU -#else -#include /* for mmap */ -#endif /* linux */ -#endif /* LACKS_SYS_MMAN_H */ -#ifndef LACKS_FCNTL_H -#include -#endif /* LACKS_FCNTL_H */ -#endif /* HAVE_MMAP */ -#ifndef LACKS_UNISTD_H -#include /* for sbrk, sysconf */ -#else /* LACKS_UNISTD_H */ -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) -extern void* sbrk(ptrdiff_t); -#endif /* FreeBSD etc */ -#endif /* LACKS_UNISTD_H */ - -/* Declarations for locking */ -#if USE_LOCKS -#ifndef WIN32 -#include -#if defined (__SVR4) && defined (__sun) /* solaris */ -#include -#endif /* solaris */ -#else -#ifndef _M_AMD64 -/* These are already defined on AMD64 builds */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -#ifndef __MINGW32__ -LONG __cdecl _InterlockedCompareExchange(LONG volatile *Dest, LONG Exchange, LONG Comp); -LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value); -#endif -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* _M_AMD64 */ -#ifndef __MINGW32__ -#pragma intrinsic (_InterlockedCompareExchange) -#pragma intrinsic (_InterlockedExchange) -#else - /* --[ start GCC compatibility ]---------------------------------------------- - * Compatibility header for GCC -- GCC equivalents of intrinsic - * Microsoft Visual C++ functions. Originally developed for the ReactOS - * () and TinyKrnl () - * projects. - * - * Copyright (c) 2006 KJK::Hyperion - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - /*** Atomic operations ***/ - #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 - #define _ReadWriteBarrier() __sync_synchronize() - #else - static __inline__ __attribute__((always_inline)) long __sync_lock_test_and_set(volatile long * const Target, const long Value) - { - long res; - __asm__ __volatile__("xchg%z0 %2, %0" : "=g" (*(Target)), "=r" (res) : "1" (Value)); - return res; - } - static void __inline__ __attribute__((always_inline)) _MemoryBarrier(void) - { - __asm__ __volatile__("" : : : "memory"); - } - #define _ReadWriteBarrier() _MemoryBarrier() - #endif - /* BUGBUG: GCC only supports full barriers */ - static __inline__ __attribute__((always_inline)) long _InterlockedExchange(volatile long * const Target, const long Value) - { - /* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */ - _ReadWriteBarrier(); - return __sync_lock_test_and_set(Target, Value); - } - /* --[ end GCC compatibility ]---------------------------------------------- */ -#endif -#define interlockedcompareexchange _InterlockedCompareExchange -#define interlockedexchange _InterlockedExchange -#endif /* Win32 */ -#endif /* USE_LOCKS */ - -/* Declarations for bit scanning on win32 */ -#if defined(_MSC_VER) && _MSC_VER>=1300 -#ifndef BitScanForward /* Try to avoid pulling in WinNT.h */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -unsigned char _BitScanForward(unsigned long *index, unsigned long mask); -unsigned char _BitScanReverse(unsigned long *index, unsigned long mask); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) -#endif /* BitScanForward */ -#endif /* defined(_MSC_VER) && _MSC_VER>=1300 */ - -#ifndef WIN32 -#ifndef malloc_getpagesize -# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ -# ifndef _SC_PAGE_SIZE -# define _SC_PAGE_SIZE _SC_PAGESIZE -# endif -# endif -# ifdef _SC_PAGE_SIZE -# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) -# else -# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) - extern size_t getpagesize(); -# define malloc_getpagesize getpagesize() -# else -# ifdef WIN32 /* use supplied emulation of getpagesize */ -# define malloc_getpagesize getpagesize() -# else -# ifndef LACKS_SYS_PARAM_H -# include -# endif -# ifdef EXEC_PAGESIZE -# define malloc_getpagesize EXEC_PAGESIZE -# else -# ifdef NBPG -# ifndef CLSIZE -# define malloc_getpagesize NBPG -# else -# define malloc_getpagesize (NBPG * CLSIZE) -# endif -# else -# ifdef NBPC -# define malloc_getpagesize NBPC -# else -# ifdef PAGESIZE -# define malloc_getpagesize PAGESIZE -# else /* just guess */ -# define malloc_getpagesize ((size_t)4096U) -# endif -# endif -# endif -# endif -# endif -# endif -# endif -#endif -#endif - - - -/* ------------------- size_t and alignment properties -------------------- */ - -/* The byte and bit size of a size_t */ -#define SIZE_T_SIZE (sizeof(size_t)) -#define SIZE_T_BITSIZE (sizeof(size_t) << 3) - -/* Some constants coerced to size_t */ -/* Annoying but necessary to avoid errors on some platforms */ -#define SIZE_T_ZERO ((size_t)0) -#define SIZE_T_ONE ((size_t)1) -#define SIZE_T_TWO ((size_t)2) -#define SIZE_T_FOUR ((size_t)4) -#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) -#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) -#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) -#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) - -/* The bit mask value corresponding to MALLOC_ALIGNMENT */ -#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) - -/* True if address a has acceptable alignment */ -#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) - -/* the number of bytes to offset an address to align it */ -#define align_offset(A)\ - ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ - ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) - -/* - malloc_params holds global properties, including those that can be - dynamically set using mallopt. There is a single instance, mparams, - initialized in init_mparams. Note that the non-zeroness of "magic" - also serves as an initialization flag. -*/ -typedef unsigned int flag_t; -struct malloc_params { - volatile size_t magic; - size_t page_size; - size_t granularity; - size_t mmap_threshold; - size_t trim_threshold; - flag_t default_mflags; -}; - -static struct malloc_params mparams; - -/* Ensure mparams initialized */ -#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams()) - -/* -------------------------- MMAP preliminaries ------------------------- */ - -/* - If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and - checks to fail so compiler optimizer can delete code rather than - using so many "#if"s. -*/ - - -/* MORECORE and MMAP must return MFAIL on failure */ -#define MFAIL ((void*)(MAX_SIZE_T)) -#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ - -#if HAVE_MMAP - -#ifndef WIN32 -#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -#define MAP_ANONYMOUS MAP_ANON -#endif /* MAP_ANON */ -#ifdef DEFAULT_GRANULARITY_ALIGNED -#define MMAP_IMPL mmap_aligned -static void* lastAlignedmmap; /* Used as a hint */ -static void* mmap_aligned(void *start, size_t length, int prot, int flags, int fd, off_t offset) { - void* baseaddress = 0; - void* ptr = 0; - if(!start) { - baseaddress = lastAlignedmmap; - for(;;) { - if(baseaddress) flags|=MAP_FIXED; - ptr = mmap(baseaddress, length, prot, flags, fd, offset); - if(!ptr) - baseaddress = (void*)((size_t)baseaddress + mparams.granularity); - else if((size_t)ptr & (mparams.granularity - SIZE_T_ONE)) { - munmap(ptr, length); - baseaddress = (void*)(((size_t)ptr + mparams.granularity) & ~(mparams.granularity - SIZE_T_ONE)); - } - else break; - } - } - else ptr = mmap(start, length, prot, flags, fd, offset); - if(ptr) lastAlignedmmap = (void*)((size_t) ptr + mparams.granularity); - return ptr; -} -#else -#define MMAP_IMPL mmap -#endif /* DEFAULT_GRANULARITY_ALIGNED */ -#define MUNMAP_DEFAULT(a, s) munmap((a), (s)) -#define MMAP_PROT (PROT_READ|PROT_WRITE) -#ifdef MAP_ANONYMOUS -#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) -#define MMAP_DEFAULT(s) MMAP_IMPL(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) -#else /* MAP_ANONYMOUS */ -/* - Nearly all versions of mmap support MAP_ANONYMOUS, so the following - is unlikely to be needed, but is supplied just in case. -*/ -#define MMAP_FLAGS (MAP_PRIVATE) -static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ -#define MMAP_DEFAULT(s) ((dev_zero_fd < 0) ? \ - (dev_zero_fd = open("/dev/zero", O_RDWR), \ - MMAP_IMPL(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ - MMAP_IMPL(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) -#endif /* MAP_ANONYMOUS */ - -#define DIRECT_MMAP_DEFAULT(s) MMAP_DEFAULT(s) - -#else /* WIN32 */ - -/* Win32 MMAP via VirtualAlloc */ -#ifdef DEFAULT_GRANULARITY_ALIGNED -static void* lastWin32mmap; /* Used as a hint */ -#endif /* DEFAULT_GRANULARITY_ALIGNED */ -#ifdef ENABLE_LARGE_PAGES -int largepagesavailable = 1; -#ifndef MEM_LARGE_PAGES - #define MEM_LARGE_PAGES 0x20000000 -#endif -#endif /* ENABLE_LARGE_PAGES */ -static FORCEINLINE void* win32mmap(size_t size) { - void* baseaddress = 0; - void* ptr = 0; -#ifdef ENABLE_LARGE_PAGES - /* Note that large pages are *always* allocated on a large page boundary. - If however granularity is small then don't waste a kernel call if size - isn't around the size of a large page */ - if(largepagesavailable && size >= 1*1024*1024) { - ptr = VirtualAlloc(baseaddress, size, MEM_RESERVE|MEM_COMMIT|MEM_LARGE_PAGES, PAGE_READWRITE); - if(!ptr && ERROR_PRIVILEGE_NOT_HELD==GetLastError()) largepagesavailable=0; - } -#endif - if(!ptr) { -#ifdef DEFAULT_GRANULARITY_ALIGNED - /* We try to avoid overhead by speculatively reserving at aligned - addresses until we succeed */ - baseaddress = lastWin32mmap; - for(;;) { - void* reserveaddr = VirtualAlloc(baseaddress, size, MEM_RESERVE, PAGE_READWRITE); - if(!reserveaddr) - baseaddress = (void*)((size_t)baseaddress + mparams.granularity); - else if((size_t)reserveaddr & (mparams.granularity - SIZE_T_ONE)) { - VirtualFree(reserveaddr, 0, MEM_RELEASE); - baseaddress = (void*)(((size_t)reserveaddr + mparams.granularity) & ~(mparams.granularity - SIZE_T_ONE)); - } - else break; - } -#endif - if(!ptr) ptr = VirtualAlloc(baseaddress, size, baseaddress ? MEM_COMMIT : MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); -#if DEBUG - if(lastWin32mmap && ptr!=lastWin32mmap) printf("Non-contiguous VirtualAlloc between %p and %p\n", ptr, lastWin32mmap); -#endif -#ifdef DEFAULT_GRANULARITY_ALIGNED - if(ptr) lastWin32mmap = (void*)((size_t) ptr + mparams.granularity); -#endif - } -#if DEBUG -#ifdef ENABLE_LARGE_PAGES - printf("VirtualAlloc returns %p size %u. LargePagesAvailable=%d\n", ptr, size, largepagesavailable); -#else - printf("VirtualAlloc returns %p size %u\n", ptr, size); -#endif -#endif - return (ptr != 0)? ptr: MFAIL; -} - -/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ -static FORCEINLINE void* win32direct_mmap(size_t size) { - void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, - PAGE_READWRITE); - return (ptr != 0)? ptr: MFAIL; -} - -/* This function supports releasing coalesed segments */ -static FORCEINLINE int win32munmap(void* ptr, size_t size) { - MEMORY_BASIC_INFORMATION minfo; - char* cptr = (char*)ptr; - while (size) { - if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0) - return -1; - if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr || - minfo.State != MEM_COMMIT || minfo.RegionSize > size) - return -1; - if (VirtualFree(cptr, 0, MEM_RELEASE) == 0) - return -1; - cptr += minfo.RegionSize; - size -= minfo.RegionSize; - } - return 0; -} - -#define MMAP_DEFAULT(s) win32mmap(s) -#define MUNMAP_DEFAULT(a, s) win32munmap((a), (s)) -#define DIRECT_MMAP_DEFAULT(s) win32direct_mmap(s) -#endif /* WIN32 */ -#endif /* HAVE_MMAP */ - -#if HAVE_MREMAP -#ifndef WIN32 -#define MREMAP_DEFAULT(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv)) -#endif /* WIN32 */ -#endif /* HAVE_MREMAP */ - - -/** - * Define CALL_MORECORE - */ -#if HAVE_MORECORE - #ifdef MORECORE - #define CALL_MORECORE(S) MORECORE(S) - #else /* MORECORE */ - #define CALL_MORECORE(S) MORECORE_DEFAULT(S) - #endif /* MORECORE */ -#else /* HAVE_MORECORE */ - #define CALL_MORECORE(S) MFAIL -#endif /* HAVE_MORECORE */ - -/** - * Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP - */ -#if HAVE_MMAP - #define USE_MMAP_BIT (SIZE_T_ONE) - - #ifdef MMAP - #define CALL_MMAP(s) MMAP(s) - #else /* MMAP */ - #define CALL_MMAP(s) MMAP_DEFAULT(s) - #endif /* MMAP */ - #ifdef MUNMAP - #define CALL_MUNMAP(a, s) MUNMAP((a), (s)) - #else /* MUNMAP */ - #define CALL_MUNMAP(a, s) MUNMAP_DEFAULT((a), (s)) - #endif /* MUNMAP */ - #ifdef DIRECT_MMAP - #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s) - #else /* DIRECT_MMAP */ - #define CALL_DIRECT_MMAP(s) DIRECT_MMAP_DEFAULT(s) - #endif /* DIRECT_MMAP */ -#else /* HAVE_MMAP */ - #define USE_MMAP_BIT (SIZE_T_ZERO) - - #define MMAP(s) MFAIL - #define MUNMAP(a, s) (-1) - #define DIRECT_MMAP(s) MFAIL - #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s) - #define CALL_MMAP(s) MMAP(s) - #define CALL_MUNMAP(a, s) MUNMAP((a), (s)) -#endif /* HAVE_MMAP */ - -/** - * Define CALL_MREMAP - */ -#if HAVE_MMAP && HAVE_MREMAP - #ifdef MREMAP - #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP((addr), (osz), (nsz), (mv)) - #else /* MREMAP */ - #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP_DEFAULT((addr), (osz), (nsz), (mv)) - #endif /* MREMAP */ -#else /* HAVE_MMAP && HAVE_MREMAP */ - #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL -#endif /* HAVE_MMAP && HAVE_MREMAP */ - -/* mstate bit set if continguous morecore disabled or failed */ -#define USE_NONCONTIGUOUS_BIT (4U) - -/* segment bit set in create_mspace_with_base */ -#define EXTERN_BIT (8U) - - -/* --------------------------- Lock preliminaries ------------------------ */ - -/* - When locks are defined, there is one global lock, plus - one per-mspace lock. - - The global lock_ensures that mparams.magic and other unique - mparams values are initialized only once. It also protects - sequences of calls to MORECORE. In many cases sys_alloc requires - two calls, that should not be interleaved with calls by other - threads. This does not protect against direct calls to MORECORE - by other threads not using this lock, so there is still code to - cope the best we can on interference. - - Per-mspace locks surround calls to malloc, free, etc. To enable use - in layered extensions, per-mspace locks are reentrant. - - Because lock-protected regions generally have bounded times, it is - OK to use the supplied simple spinlocks in the custom versions for - x86. Spinlocks are likely to improve performance for lightly - contended applications, but worsen performance under heavy - contention. - - If USE_LOCKS is > 1, the definitions of lock routines here are - bypassed, in which case you will need to define the type MLOCK_T, - and at least INITIAL_LOCK, ACQUIRE_LOCK, RELEASE_LOCK and possibly - TRY_LOCK (which is not used in this malloc, but commonly needed in - extensions.) You must also declare a - static MLOCK_T malloc_global_mutex = { initialization values };. - -*/ - -#if USE_LOCKS == 1 - -#if USE_SPIN_LOCKS && SPIN_LOCKS_AVAILABLE -#ifndef WIN32 - -/* Custom pthread-style spin locks on x86 and x64 for gcc */ -struct pthread_mlock_t { - volatile unsigned int l; - char cachelinepadding[64]; - unsigned int c; - pthread_t threadid; -}; -#define MLOCK_T struct pthread_mlock_t -#define CURRENT_THREAD pthread_self() -#define INITIAL_LOCK(sl) ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0) -#define ACQUIRE_LOCK(sl) pthread_acquire_lock(sl) -#define RELEASE_LOCK(sl) pthread_release_lock(sl) -#define TRY_LOCK(sl) pthread_try_lock(sl) -#define SPINS_PER_YIELD 63 - -static MLOCK_T malloc_global_mutex = { 0, "", 0, 0}; - -static FORCEINLINE int pthread_acquire_lock (MLOCK_T *sl) { - int spins = 0; - volatile unsigned int* lp = &sl->l; - for (;;) { - if (*lp != 0) { - if (sl->threadid == CURRENT_THREAD) { - ++sl->c; - return 0; - } - } - else { - /* place args to cmpxchgl in locals to evade oddities in some gccs */ - int cmp = 0; - int val = 1; - int ret; - __asm__ __volatile__ ("lock; cmpxchgl %1, %2" - : "=a" (ret) - : "r" (val), "m" (*(lp)), "0"(cmp) - : "memory", "cc"); - if (!ret) { - assert(!sl->threadid); - sl->threadid = CURRENT_THREAD; - sl->c = 1; - return 0; - } - } - if ((++spins & SPINS_PER_YIELD) == 0) { -#if defined (__SVR4) && defined (__sun) /* solaris */ - thr_yield(); -#else -#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) - sched_yield(); -#else /* no-op yield on unknown systems */ - ; -#endif /* __linux__ || __FreeBSD__ || __APPLE__ */ -#endif /* solaris */ - } - } -} - -static FORCEINLINE void pthread_release_lock (MLOCK_T *sl) { - volatile unsigned int* lp = &sl->l; - assert(*lp != 0); - assert(sl->threadid == CURRENT_THREAD); - if (--sl->c == 0) { - sl->threadid = 0; - int prev = 0; - int ret; - __asm__ __volatile__ ("lock; xchgl %0, %1" - : "=r" (ret) - : "m" (*(lp)), "0"(prev) - : "memory"); - } -} - -static FORCEINLINE int pthread_try_lock (MLOCK_T *sl) { - volatile unsigned int* lp = &sl->l; - if (*lp != 0) { - if (sl->threadid == CURRENT_THREAD) { - ++sl->c; - return 1; - } - } - else { - int cmp = 0; - int val = 1; - int ret; - __asm__ __volatile__ ("lock; cmpxchgl %1, %2" - : "=a" (ret) - : "r" (val), "m" (*(lp)), "0"(cmp) - : "memory", "cc"); - if (!ret) { - assert(!sl->threadid); - sl->threadid = CURRENT_THREAD; - sl->c = 1; - return 1; - } - } - return 0; -} - - -#else /* WIN32 */ -/* Custom win32-style spin locks on x86 and x64 for MSC */ -struct win32_mlock_t { - volatile long l; - char cachelinepadding[64]; - unsigned int c; - long threadid; -}; - -#define MLOCK_T struct win32_mlock_t -#define CURRENT_THREAD ((long)GetCurrentThreadId()) -#define INITIAL_LOCK(sl) ((sl)->threadid = 0, (sl)->l = (sl)->c = 0, 0) -#define ACQUIRE_LOCK(sl) win32_acquire_lock(sl) -#define RELEASE_LOCK(sl) win32_release_lock(sl) -#define TRY_LOCK(sl) win32_try_lock(sl) -#define SPINS_PER_YIELD 63 - -static MLOCK_T malloc_global_mutex = { 0, "", 0, 0}; - -static FORCEINLINE int win32_acquire_lock (MLOCK_T *sl) { - int spins = 0; - for (;;) { - if (sl->l != 0) { - if (sl->threadid == CURRENT_THREAD) { - ++sl->c; - return 0; - } - } - else { - if (!interlockedexchange(&sl->l, 1)) { - assert(!sl->threadid); - sl->threadid = CURRENT_THREAD; - sl->c = 1; - return 0; - } - } - if ((++spins & SPINS_PER_YIELD) == 0) - SleepEx(0, FALSE); - } -} - -static FORCEINLINE void win32_release_lock (MLOCK_T *sl) { - assert(sl->threadid == CURRENT_THREAD); - assert(sl->l != 0); - if (--sl->c == 0) { - sl->threadid = 0; - interlockedexchange (&sl->l, 0); - } -} - -static FORCEINLINE int win32_try_lock (MLOCK_T *sl) { - if (sl->l != 0) { - if (sl->threadid == CURRENT_THREAD) { - ++sl->c; - return 1; - } - } - else { - if (!interlockedexchange(&sl->l, 1)){ - assert(!sl->threadid); - sl->threadid = CURRENT_THREAD; - sl->c = 1; - return 1; - } - } - return 0; -} - -#endif /* WIN32 */ -#else /* USE_SPIN_LOCKS */ - -#ifndef WIN32 -/* pthreads-based locks */ - -#define MLOCK_T pthread_mutex_t -#define CURRENT_THREAD pthread_self() -#define INITIAL_LOCK(sl) pthread_init_lock(sl) -#define ACQUIRE_LOCK(sl) pthread_mutex_lock(sl) -#define RELEASE_LOCK(sl) pthread_mutex_unlock(sl) -#define TRY_LOCK(sl) (!pthread_mutex_trylock(sl)) - -static MLOCK_T malloc_global_mutex = PTHREAD_MUTEX_INITIALIZER; - -/* Cope with old-style linux recursive lock initialization by adding */ -/* skipped internal declaration from pthread.h */ -#ifdef linux -#ifndef PTHREAD_MUTEX_RECURSIVE -extern int pthread_mutexattr_setkind_np __P ((pthread_mutexattr_t *__attr, - int __kind)); -#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP -#define pthread_mutexattr_settype(x,y) pthread_mutexattr_setkind_np(x,y) -#endif -#endif - -static int pthread_init_lock (MLOCK_T *sl) { - pthread_mutexattr_t attr; - if (pthread_mutexattr_init(&attr)) return 1; - if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) return 1; - if (pthread_mutex_init(sl, &attr)) return 1; - if (pthread_mutexattr_destroy(&attr)) return 1; - return 0; -} - -#else /* WIN32 */ -/* Win32 critical sections */ -#define MLOCK_T CRITICAL_SECTION -#define CURRENT_THREAD GetCurrentThreadId() -#define INITIAL_LOCK(s) (!InitializeCriticalSectionAndSpinCount((s), 0x80000000|4000)) -#define ACQUIRE_LOCK(s) (EnterCriticalSection(sl), 0) -#define RELEASE_LOCK(s) LeaveCriticalSection(sl) -#define TRY_LOCK(s) TryEnterCriticalSection(sl) -#define NEED_GLOBAL_LOCK_INIT - -static MLOCK_T malloc_global_mutex; -static volatile long malloc_global_mutex_status; - -/* Use spin loop to initialize global lock */ -static void init_malloc_global_mutex() { - for (;;) { - long stat = malloc_global_mutex_status; - if (stat > 0) - return; - /* transition to < 0 while initializing, then to > 0) */ - if (stat == 0 && - interlockedcompareexchange(&malloc_global_mutex_status, -1, 0) == 0) { - InitializeCriticalSection(&malloc_global_mutex); - interlockedexchange(&malloc_global_mutex_status,1); - return; - } - SleepEx(0, FALSE); - } -} - -#endif /* WIN32 */ -#endif /* USE_SPIN_LOCKS */ -#endif /* USE_LOCKS == 1 */ - -/* ----------------------- User-defined locks ------------------------ */ - -#if USE_LOCKS > 1 -/* Define your own lock implementation here */ -/* #define INITIAL_LOCK(sl) ... */ -/* #define ACQUIRE_LOCK(sl) ... */ -/* #define RELEASE_LOCK(sl) ... */ -/* #define TRY_LOCK(sl) ... */ -/* static MLOCK_T malloc_global_mutex = ... */ -#endif /* USE_LOCKS > 1 */ - -/* ----------------------- Lock-based state ------------------------ */ - -#if USE_LOCKS -#define USE_LOCK_BIT (2U) -#else /* USE_LOCKS */ -#define USE_LOCK_BIT (0U) -#define INITIAL_LOCK(l) -#endif /* USE_LOCKS */ - -#if USE_LOCKS -#ifndef ACQUIRE_MALLOC_GLOBAL_LOCK -#define ACQUIRE_MALLOC_GLOBAL_LOCK() ACQUIRE_LOCK(&malloc_global_mutex); -#endif -#ifndef RELEASE_MALLOC_GLOBAL_LOCK -#define RELEASE_MALLOC_GLOBAL_LOCK() RELEASE_LOCK(&malloc_global_mutex); -#endif -#else /* USE_LOCKS */ -#define ACQUIRE_MALLOC_GLOBAL_LOCK() -#define RELEASE_MALLOC_GLOBAL_LOCK() -#endif /* USE_LOCKS */ - - -/* ----------------------- Chunk representations ------------------------ */ - -/* - (The following includes lightly edited explanations by Colin Plumb.) - - The malloc_chunk declaration below is misleading (but accurate and - necessary). It declares a "view" into memory allowing access to - necessary fields at known offsets from a given base. - - Chunks of memory are maintained using a `boundary tag' method as - originally described by Knuth. (See the paper by Paul Wilson - ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such - techniques.) Sizes of free chunks are stored both in the front of - each chunk and at the end. This makes consolidating fragmented - chunks into bigger chunks fast. The head fields also hold bits - representing whether chunks are free or in use. - - Here are some pictures to make it clearer. They are "exploded" to - show that the state of a chunk can be thought of as extending from - the high 31 bits of the head field of its header through the - prev_foot and PINUSE_BIT bit of the following chunk header. - - A chunk that's in use looks like: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk (if P = 0) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| - | Size of this chunk 1| +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - +- -+ - | | - +- -+ - | : - +- size - sizeof(size_t) available payload bytes -+ - : | - chunk-> +- -+ - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| - | Size of next chunk (may or may not be in use) | +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - And if it's free, it looks like this: - - chunk-> +- -+ - | User payload (must be in use, or we would have merged!) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| - | Size of this chunk 0| +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Next pointer | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Prev pointer | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | : - +- size - sizeof(struct chunk) unused bytes -+ - : | - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of this chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| - | Size of next chunk (must be in use, or we would have merged)| +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | : - +- User payload -+ - : | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |0| - +-+ - Note that since we always merge adjacent free chunks, the chunks - adjacent to a free chunk must be in use. - - Given a pointer to a chunk (which can be derived trivially from the - payload pointer) we can, in O(1) time, find out whether the adjacent - chunks are free, and if so, unlink them from the lists that they - are on and merge them with the current chunk. - - Chunks always begin on even word boundaries, so the mem portion - (which is returned to the user) is also on an even word boundary, and - thus at least double-word aligned. - - The P (PINUSE_BIT) bit, stored in the unused low-order bit of the - chunk size (which is always a multiple of two words), is an in-use - bit for the *previous* chunk. If that bit is *clear*, then the - word before the current chunk size contains the previous chunk - size, and can be used to find the front of the previous chunk. - The very first chunk allocated always has this bit set, preventing - access to non-existent (or non-owned) memory. If pinuse is set for - any given chunk, then you CANNOT determine the size of the - previous chunk, and might even get a memory addressing fault when - trying to do so. - - The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of - the chunk size redundantly records whether the current chunk is - inuse (unless the chunk is mmapped). This redundancy enables usage - checks within free and realloc, and reduces indirection when freeing - and consolidating chunks. - - Each freshly allocated chunk must have both cinuse and pinuse set. - That is, each allocated chunk borders either a previously allocated - and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the the `lowest' part of any - found chunk. Further, no free chunk physically borders another one, - so each free chunk is known to be preceded and followed by either - inuse chunks or the ends of memory. - - Note that the `foot' of the current chunk is actually represented - as the prev_foot of the NEXT chunk. This makes it easier to - deal with alignments etc but can be very confusing when trying - to extend or adapt this code. - - The exceptions to all this are - - 1. The special chunk `top' is the top-most available chunk (i.e., - the one bordering the end of available memory). It is treated - specially. Top is never included in any bin, is used only if - no other chunk is available, and is released back to the - system if it is very large (see M_TRIM_THRESHOLD). In effect, - the top chunk is treated as larger (and thus less well - fitting) than any other available chunk. The top chunk - doesn't update its trailing size field since there is no next - contiguous chunk that would have to index off it. However, - space is still allocated for it (TOP_FOOT_SIZE) to enable - separation or merging when space is extended. - - 3. Chunks allocated via mmap, have both cinuse and pinuse bits - cleared in their head fields. Because they are allocated - one-by-one, each must carry its own prev_foot field, which is - also used to hold the offset this chunk has within its mmapped - region, which is needed to preserve alignment. Each mmapped - chunk is trailed by the first two fields of a fake next-chunk - for sake of usage checks. - -*/ - -struct malloc_chunk { - size_t prev_foot; /* Size of previous chunk (if free). */ - size_t head; /* Size and inuse bits. */ - struct malloc_chunk* fd; /* double links -- used only if free. */ - struct malloc_chunk* bk; -}; - -typedef struct malloc_chunk mchunk; -typedef struct malloc_chunk* mchunkptr; -typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ -typedef unsigned int bindex_t; /* Described below */ -typedef unsigned int binmap_t; /* Described below */ - -/* ------------------- Chunks sizes and alignments ----------------------- */ - -#define MCHUNK_SIZE (sizeof(mchunk)) - -#if FOOTERS -#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) -#else /* FOOTERS */ -#define CHUNK_OVERHEAD (SIZE_T_SIZE) -#endif /* FOOTERS */ - -/* MMapped chunks need a second word of overhead ... */ -#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) -/* ... and additional padding for fake next-chunk at foot */ -#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) - -/* The smallest size we can malloc is an aligned minimal chunk */ -#define MIN_CHUNK_SIZE\ - ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) - -/* conversion from malloc headers to user pointers, and back */ -#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) -#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) -/* chunk associated with aligned address A */ -#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) - -/* Bounds on request (not chunk) sizes. */ -#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) -#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) - -/* pad request bytes into a usable size */ -#define pad_request(req) \ - (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) - -/* pad request, checking for minimum (but not maximum) */ -#define request2size(req) \ - (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) - - -/* ------------------ Operations on head and foot fields ----------------- */ - -/* - The head field of a chunk is or'ed with PINUSE_BIT when previous - adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in - use, unless mmapped, in which case both bits are cleared. - - FLAG4_BIT is not used by this malloc, but might be useful in extensions. -*/ - -#define PINUSE_BIT (SIZE_T_ONE) -#define CINUSE_BIT (SIZE_T_TWO) -#define FLAG4_BIT (SIZE_T_FOUR) -#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) -#define FLAG_BITS (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT) - -/* Head value for fenceposts */ -#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) - -/* extraction of fields from head words */ -#define cinuse(p) ((p)->head & CINUSE_BIT) -#define pinuse(p) ((p)->head & PINUSE_BIT) -#define is_inuse(p) (((p)->head & INUSE_BITS) != PINUSE_BIT) -#define is_mmapped(p) (((p)->head & INUSE_BITS) == 0) - -#define chunksize(p) ((p)->head & ~(FLAG_BITS)) - -#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) - -/* Treat space at ptr +/- offset as a chunk */ -#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) -#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) - -/* Ptr to next or previous physical malloc_chunk. */ -#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS))) -#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) - -/* extract next chunk's pinuse bit */ -#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) - -/* Get/set size at footer */ -#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) -#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) - -/* Set size, pinuse bit, and foot */ -#define set_size_and_pinuse_of_free_chunk(p, s)\ - ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) - -/* Set size, pinuse bit, foot, and clear next pinuse */ -#define set_free_with_pinuse(p, s, n)\ - (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) - -/* Get the internal overhead associated with chunk p */ -#define overhead_for(p)\ - (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) - -/* Return true if malloced space is not necessarily cleared */ -#if MMAP_CLEARS -#define calloc_must_clear(p) (!is_mmapped(p)) -#else /* MMAP_CLEARS */ -#define calloc_must_clear(p) (1) -#endif /* MMAP_CLEARS */ - -/* ---------------------- Overlaid data structures ----------------------- */ - -/* - When chunks are not in use, they are treated as nodes of either - lists or trees. - - "Small" chunks are stored in circular doubly-linked lists, and look - like this: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `head:' | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Forward pointer to next chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Back pointer to previous chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Unused space (may be 0 bytes long) . - . . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `foot:' | Size of chunk, in bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - Larger chunks are kept in a form of bitwise digital trees (aka - tries) keyed on chunksizes. Because malloc_tree_chunks are only for - free chunks greater than 256 bytes, their size doesn't impose any - constraints on user chunk sizes. Each node looks like: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `head:' | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Forward pointer to next chunk of same size | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Back pointer to previous chunk of same size | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Pointer to left child (child[0]) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Pointer to right child (child[1]) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Pointer to parent | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | bin index of this chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Unused space . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `foot:' | Size of chunk, in bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - Each tree holding treenodes is a tree of unique chunk sizes. Chunks - of the same size are arranged in a circularly-linked list, with only - the oldest chunk (the next to be used, in our FIFO ordering) - actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size an an existing node - is inserted, it is linked off the existing node using pointers that - work in the same way as fd/bk pointers of small chunks. - - Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is is divided in half at each - tree level, with the chunks in the smaller half of the range (0x100 - <= x < 0x140 for the top nose) in the left subtree and the larger - half (0x140 <= x < 0x180) in the right subtree. This is, of course, - done by inspecting individual bits. - - Using these rules, each node's left subtree contains all smaller - sizes than its right subtree. However, the node at the root of each - subtree has no particular ordering relationship to either. (The - dividing line between the subtree sizes is based on trie relation.) - If we remove the last chunk of a given size from the interior of the - tree, we need to replace it with a leaf node. The tree ordering - rules permit a node to be replaced by any leaf below it. - - The smallest chunk in a tree (a common operation in a best-fit - allocator) can be found by walking a path to the leftmost leaf in - the tree. Unlike a usual binary tree, where we follow left child - pointers until we reach a null, here we follow the right child - pointer any time the left one is null, until we reach a leaf with - both child pointers null. The smallest chunk in the tree will be - somewhere along that path. - - The worst case number of steps to add, find, or remove a node is - bounded by the number of bits differentiating chunks within - bins. Under current bin calculations, this ranges from 6 up to 21 - (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case - is of course much better. -*/ - -struct malloc_tree_chunk { - /* The first four fields must be compatible with malloc_chunk */ - size_t prev_foot; - size_t head; - struct malloc_tree_chunk* fd; - struct malloc_tree_chunk* bk; - - struct malloc_tree_chunk* child[2]; - struct malloc_tree_chunk* parent; - bindex_t index; -}; - -typedef struct malloc_tree_chunk tchunk; -typedef struct malloc_tree_chunk* tchunkptr; -typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */ - -/* A little helper macro for trees */ -#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) - -/* ----------------------------- Segments -------------------------------- */ - -/* - Each malloc space may include non-contiguous segments, held in a - list headed by an embedded malloc_segment record representing the - top-most space. Segments also include flags holding properties of - the space. Large chunks that are directly allocated by mmap are not - included in this list. They are instead independently created and - destroyed without otherwise keeping track of them. - - Segment management mainly comes into play for spaces allocated by - MMAP. Any call to MMAP might or might not return memory that is - adjacent to an existing segment. MORECORE normally contiguously - extends the current space, so this space is almost always adjacent, - which is simpler and faster to deal with. (This is why MORECORE is - used preferentially to MMAP when both are available -- see - sys_alloc.) When allocating using MMAP, we don't use any of the - hinting mechanisms (inconsistently) supported in various - implementations of unix mmap, or distinguish reserving from - committing memory. Instead, we just ask for space, and exploit - contiguity when we get it. It is probably possible to do - better than this on some systems, but no general scheme seems - to be significantly better. - - Management entails a simpler variant of the consolidation scheme - used for chunks to reduce fragmentation -- new adjacent memory is - normally prepended or appended to an existing segment. However, - there are limitations compared to chunk consolidation that mostly - reflect the fact that segment processing is relatively infrequent - (occurring only when getting memory from system) and that we - don't expect to have huge numbers of segments: - - * Segments are not indexed, so traversal requires linear scans. (It - would be possible to index these, but is not worth the extra - overhead and complexity for most programs on most platforms.) - * New segments are only appended to old ones when holding top-most - memory; if they cannot be prepended to others, they are held in - different segments. - - Except for the top-most segment of an mstate, each segment record - is kept at the tail of its segment. Segments are added by pushing - segment records onto the list headed by &mstate.seg for the - containing mstate. - - Segment flags control allocation/merge/deallocation policies: - * If EXTERN_BIT set, then we did not allocate this segment, - and so should not try to deallocate or merge with others. - (This currently holds only for the initial segment passed - into create_mspace_with_base.) - * If USE_MMAP_BIT set, the segment may be merged with - other surrounding mmapped segments and trimmed/de-allocated - using munmap. - * If neither bit is set, then the segment was obtained using - MORECORE so can be merged with surrounding MORECORE'd segments - and deallocated/trimmed using MORECORE with negative arguments. -*/ - -struct malloc_segment { - char* base; /* base address */ - size_t size; /* allocated size */ - struct malloc_segment* next; /* ptr to next segment */ - flag_t sflags; /* mmap and extern flag */ -}; - -#define is_mmapped_segment(S) ((S)->sflags & USE_MMAP_BIT) -#define is_extern_segment(S) ((S)->sflags & EXTERN_BIT) - -typedef struct malloc_segment msegment; -typedef struct malloc_segment* msegmentptr; - -/* ---------------------------- malloc_state ----------------------------- */ - -/* - A malloc_state holds all of the bookkeeping for a space. - The main fields are: - - Top - The topmost chunk of the currently active segment. Its size is - cached in topsize. The actual size of topmost space is - topsize+TOP_FOOT_SIZE, which includes space reserved for adding - fenceposts and segment records if necessary when getting more - space from the system. The size at which to autotrim top is - cached from mparams in trim_check, except that it is disabled if - an autotrim fails. - - Designated victim (dv) - This is the preferred chunk for servicing small requests that - don't have exact fits. It is normally the chunk split off most - recently to service another small request. Its size is cached in - dvsize. The link fields of this chunk are not maintained since it - is not kept in a bin. - - SmallBins - An array of bin headers for free chunks. These bins hold chunks - with sizes less than MIN_LARGE_SIZE bytes. Each bin contains - chunks of all the same size, spaced 8 bytes apart. To simplify - use in double-linked lists, each bin header acts as a malloc_chunk - pointing to the real first node, if it exists (else pointing to - itself). This avoids special-casing for headers. But to avoid - waste, we allocate only the fd/bk pointers of bins, and then use - repositioning tricks to treat these as the fields of a chunk. - - TreeBins - Treebins are pointers to the roots of trees holding a range of - sizes. There are 2 equally spaced treebins for each power of two - from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything - larger. - - Bin maps - There is one bit map for small bins ("smallmap") and one for - treebins ("treemap). Each bin sets its bit when non-empty, and - clears the bit when empty. Bit operations are then used to avoid - bin-by-bin searching -- nearly all "search" is done without ever - looking at bins that won't be selected. The bit maps - conservatively use 32 bits per map word, even if on 64bit system. - For a good description of some of the bit-based techniques used - here, see Henry S. Warren Jr's book "Hacker's Delight" (and - supplement at http://hackersdelight.org/). Many of these are - intended to reduce the branchiness of paths through malloc etc, as - well as to reduce the number of memory locations read or written. - - Segments - A list of segments headed by an embedded malloc_segment record - representing the initial space. - - Address check support - The least_addr field is the least address ever obtained from - MORECORE or MMAP. Attempted frees and reallocs of any address less - than this are trapped (unless INSECURE is defined). - - Magic tag - A cross-check field that should always hold same value as mparams.magic. - - Flags - Bits recording whether to use MMAP, locks, or contiguous MORECORE - - Statistics - Each space keeps track of current and maximum system memory - obtained via MORECORE or MMAP. - - Trim support - Fields holding the amount of unused topmost memory that should trigger - timming, and a counter to force periodic scanning to release unused - non-topmost segments. - - Locking - If USE_LOCKS is defined, the "mutex" lock is acquired and released - around every public call using this mspace. - - Extension support - A void* pointer and a size_t field that can be used to help implement - extensions to this malloc. -*/ - -/* Bin types, widths and sizes */ -#define NSMALLBINS (32U) -#define NTREEBINS (32U) -#define SMALLBIN_SHIFT (3U) -#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) -#define TREEBIN_SHIFT (8U) -#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) -#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) -#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) - -struct malloc_state { - binmap_t smallmap; - binmap_t treemap; - size_t dvsize; - size_t topsize; - char* least_addr; - mchunkptr dv; - mchunkptr top; - size_t trim_check; - size_t release_checks; - size_t magic; - mchunkptr smallbins[(NSMALLBINS+1)*2]; - tbinptr treebins[NTREEBINS]; - size_t footprint; - size_t max_footprint; - flag_t mflags; - msegment seg; -#if USE_LOCKS - MLOCK_T mutex; /* locate lock among fields that rarely change */ -#endif /* USE_LOCKS */ - void* extp; /* Unused but available for extensions */ - size_t exts; -}; - -typedef struct malloc_state* mstate; - -/* ------------- Global malloc_state and malloc_params ------------------- */ - -#if !ONLY_MSPACES - -/* The global malloc_state used for all non-"mspace" calls */ -static struct malloc_state _gm_; -#define gm (&_gm_) -#define is_global(M) ((M) == &_gm_) - -#endif /* !ONLY_MSPACES */ - -#define is_initialized(M) ((M)->top != 0) - -/* -------------------------- system alloc setup ------------------------- */ - -/* Operations on mflags */ - -#define use_lock(M) ((M)->mflags & USE_LOCK_BIT) -#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) -#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) - -#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT) -#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) -#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) - -#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) -#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) - -#define set_lock(M,L)\ - ((M)->mflags = (L)?\ - ((M)->mflags | USE_LOCK_BIT) :\ - ((M)->mflags & ~USE_LOCK_BIT)) - -/* page-align a size */ -#define page_align(S)\ - (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE)) - -/* granularity-align a size */ -#define granularity_align(S)\ - (((S) + (mparams.granularity - SIZE_T_ONE))\ - & ~(mparams.granularity - SIZE_T_ONE)) - - -/* For mmap, use granularity alignment on windows, else page-align */ -#ifdef WIN32 -#define mmap_align(S) granularity_align(S) -#else -#define mmap_align(S) page_align(S) -#endif - -/* For sys_alloc, enough padding to ensure can malloc request on success */ -#define SYS_ALLOC_PADDING (TOP_FOOT_SIZE + MALLOC_ALIGNMENT) - -#define is_page_aligned(S)\ - (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) -#define is_granularity_aligned(S)\ - (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) - -/* True if segment S holds address A */ -#define segment_holds(S, A)\ - ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) - -/* Return segment holding given address */ -static msegmentptr segment_holding(mstate m, char* addr) { - msegmentptr sp = &m->seg; - for (;;) { - if (addr >= sp->base && addr < sp->base + sp->size) - return sp; - if ((sp = sp->next) == 0) - return 0; - } -} - -/* Return true if segment contains a segment link */ -static int has_segment_link(mstate m, msegmentptr ss) { - msegmentptr sp = &m->seg; - for (;;) { - if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size) - return 1; - if ((sp = sp->next) == 0) - return 0; - } -} - -#ifndef MORECORE_CANNOT_TRIM -#define should_trim(M,s) ((s) > (M)->trim_check) -#else /* MORECORE_CANNOT_TRIM */ -#define should_trim(M,s) (0) -#endif /* MORECORE_CANNOT_TRIM */ - -/* - TOP_FOOT_SIZE is padding at the end of a segment, including space - that may be needed to place segment records and fenceposts when new - noncontiguous segments are added. -*/ -#define TOP_FOOT_SIZE\ - (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) - - -/* ------------------------------- Hooks -------------------------------- */ - -/* - PREACTION should be defined to return 0 on success, and nonzero on - failure. If you are not using locking, you can redefine these to do - anything you like. -*/ - -#if USE_LOCKS - -#define PREACTION(M) ((use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) -#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } -#else /* USE_LOCKS */ - -#ifndef PREACTION -#define PREACTION(M) (0) -#endif /* PREACTION */ - -#ifndef POSTACTION -#define POSTACTION(M) -#endif /* POSTACTION */ - -#endif /* USE_LOCKS */ - -/* - CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses. - USAGE_ERROR_ACTION is triggered on detected bad frees and - reallocs. The argument p is an address that might have triggered the - fault. It is ignored by the two predefined actions, but might be - useful in custom actions that try to help diagnose errors. -*/ - -#if PROCEED_ON_ERROR - -/* A count of the number of corruption errors causing resets */ -int malloc_corruption_error_count; - -/* default corruption action */ -static void reset_on_error(mstate m); - -#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m) -#define USAGE_ERROR_ACTION(m, p) - -#else /* PROCEED_ON_ERROR */ - -#ifndef CORRUPTION_ERROR_ACTION -#define CORRUPTION_ERROR_ACTION(m) ABORT -#endif /* CORRUPTION_ERROR_ACTION */ - -#ifndef USAGE_ERROR_ACTION -#define USAGE_ERROR_ACTION(m,p) ABORT -#endif /* USAGE_ERROR_ACTION */ - -#endif /* PROCEED_ON_ERROR */ - -/* -------------------------- Debugging setup ---------------------------- */ - -#if ! DEBUG - -#define check_free_chunk(M,P) -#define check_inuse_chunk(M,P) -#define check_malloced_chunk(M,P,N) -#define check_mmapped_chunk(M,P) -#define check_malloc_state(M) -#define check_top_chunk(M,P) - -#else /* DEBUG */ -#define check_free_chunk(M,P) do_check_free_chunk(M,P) -#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P) -#define check_top_chunk(M,P) do_check_top_chunk(M,P) -#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N) -#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P) -#define check_malloc_state(M) do_check_malloc_state(M) - -static void do_check_any_chunk(mstate m, mchunkptr p); -static void do_check_top_chunk(mstate m, mchunkptr p); -static void do_check_mmapped_chunk(mstate m, mchunkptr p); -static void do_check_inuse_chunk(mstate m, mchunkptr p); -static void do_check_free_chunk(mstate m, mchunkptr p); -static void do_check_malloced_chunk(mstate m, void* mem, size_t s); -static void do_check_tree(mstate m, tchunkptr t); -static void do_check_treebin(mstate m, bindex_t i); -static void do_check_smallbin(mstate m, bindex_t i); -static void do_check_malloc_state(mstate m); -static int bin_find(mstate m, mchunkptr x); -static size_t traverse_and_check(mstate m); -#endif /* DEBUG */ - -/* ---------------------------- Indexing Bins ---------------------------- */ - -#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) -#define small_index(s) (bindex_t)((s) >> SMALLBIN_SHIFT) -#define small_index2size(i) ((i) << SMALLBIN_SHIFT) -#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) - -/* addressing by index. See above about smallbin repositioning */ -#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) -#define treebin_at(M,i) (&((M)->treebins[i])) - -/* assign tree index for size S to variable I. Use x86 asm if possible */ -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -#define compute_tree_index(S, I)\ -{\ - unsigned int X = S >> TREEBIN_SHIFT;\ - if (X == 0)\ - I = 0;\ - else if (X > 0xFFFF)\ - I = NTREEBINS-1;\ - else {\ - unsigned int K;\ - __asm__("bsrl\t%1, %0\n\t" : "=r" (K) : "g" (X));\ - I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ - }\ -} - -#elif defined (__INTEL_COMPILER) -#define compute_tree_index(S, I)\ -{\ - size_t X = S >> TREEBIN_SHIFT;\ - if (X == 0)\ - I = 0;\ - else if (X > 0xFFFF)\ - I = NTREEBINS-1;\ - else {\ - unsigned int K = _bit_scan_reverse (X); \ - I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ - }\ -} - -#elif defined(_MSC_VER) && _MSC_VER>=1300 -#define compute_tree_index(S, I)\ -{\ - size_t X = S >> TREEBIN_SHIFT;\ - if (X == 0)\ - I = 0;\ - else if (X > 0xFFFF)\ - I = NTREEBINS-1;\ - else {\ - unsigned int K;\ - _BitScanReverse((DWORD *) &K, (DWORD) X);\ - I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ - }\ -} - -#else /* GNUC */ -#define compute_tree_index(S, I)\ -{\ - size_t X = S >> TREEBIN_SHIFT;\ - if (X == 0)\ - I = 0;\ - else if (X > 0xFFFF)\ - I = NTREEBINS-1;\ - else {\ - unsigned int Y = (unsigned int)X;\ - unsigned int N = ((Y - 0x100) >> 16) & 8;\ - unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ - N += K;\ - N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ - K = 14 - N + ((Y <<= K) >> 15);\ - I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ - }\ -} -#endif /* GNUC */ - -/* Bit representing maximum resolved size in a treebin at i */ -#define bit_for_tree_index(i) \ - (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) - -/* Shift placing maximum resolved bit in a treebin at i as sign bit */ -#define leftshift_for_tree_index(i) \ - ((i == NTREEBINS-1)? 0 : \ - ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) - -/* The size of the smallest chunk held in bin with index i */ -#define minsize_for_tree_index(i) \ - ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ - (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) - - -/* ------------------------ Operations on bin maps ----------------------- */ - -/* bit corresponding to given index */ -#define idx2bit(i) ((binmap_t)(1) << (i)) - -/* Mark/Clear bits with given index */ -#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) -#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i)) -#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i)) - -#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i)) -#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i)) -#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i)) - -/* isolate the least set bit of a bitmap */ -#define least_bit(x) ((x) & -(x)) - -/* mask with all bits to left of least bit of x on */ -#define left_bits(x) ((x<<1) | -(x<<1)) - -/* mask with all bits to left of or equal to least bit of x on */ -#define same_or_left_bits(x) ((x) | -(x)) - -/* index corresponding to given bit. Use x86 asm if possible */ - -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -#define compute_bit2idx(X, I)\ -{\ - unsigned int J;\ - __asm__("bsfl\t%1, %0\n\t" : "=r" (J) : "g" (X));\ - I = (bindex_t)J;\ -} - -#elif defined (__INTEL_COMPILER) -#define compute_bit2idx(X, I)\ -{\ - unsigned int J;\ - J = _bit_scan_forward (X); \ - I = (bindex_t)J;\ -} - -#elif defined(_MSC_VER) && _MSC_VER>=1300 -#define compute_bit2idx(X, I)\ -{\ - unsigned int J;\ - _BitScanForward((DWORD *) &J, X);\ - I = (bindex_t)J;\ -} - -#elif USE_BUILTIN_FFS -#define compute_bit2idx(X, I) I = ffs(X)-1 - -#else -#define compute_bit2idx(X, I)\ -{\ - unsigned int Y = X - 1;\ - unsigned int K = Y >> (16-4) & 16;\ - unsigned int N = K; Y >>= K;\ - N += K = Y >> (8-3) & 8; Y >>= K;\ - N += K = Y >> (4-2) & 4; Y >>= K;\ - N += K = Y >> (2-1) & 2; Y >>= K;\ - N += K = Y >> (1-0) & 1; Y >>= K;\ - I = (bindex_t)(N + Y);\ -} -#endif /* GNUC */ - - -/* ----------------------- Runtime Check Support ------------------------- */ - -/* - For security, the main invariant is that malloc/free/etc never - writes to a static address other than malloc_state, unless static - malloc_state itself has been corrupted, which cannot occur via - malloc (because of these checks). In essence this means that we - believe all pointers, sizes, maps etc held in malloc_state, but - check all of those linked or offsetted from other embedded data - structures. These checks are interspersed with main code in a way - that tends to minimize their run-time cost. - - When FOOTERS is defined, in addition to range checking, we also - verify footer fields of inuse chunks, which can be used guarantee - that the mstate controlling malloc/free is intact. This is a - streamlined version of the approach described by William Robertson - et al in "Run-time Detection of Heap-based Overflows" LISA'03 - http://www.usenix.org/events/lisa03/tech/robertson.html The footer - of an inuse chunk holds the xor of its mstate and a random seed, - that is checked upon calls to free() and realloc(). This is - (probablistically) unguessable from outside the program, but can be - computed by any code successfully malloc'ing any chunk, so does not - itself provide protection against code that has already broken - security through some other means. Unlike Robertson et al, we - always dynamically check addresses of all offset chunks (previous, - next, etc). This turns out to be cheaper than relying on hashes. -*/ - -#if !INSECURE -/* Check if address a is at least as high as any from MORECORE or MMAP */ -#define ok_address(M, a) ((char*)(a) >= (M)->least_addr) -/* Check if address of next chunk n is higher than base chunk p */ -#define ok_next(p, n) ((char*)(p) < (char*)(n)) -/* Check if p has inuse status */ -#define ok_inuse(p) is_inuse(p) -/* Check if p has its pinuse bit on */ -#define ok_pinuse(p) pinuse(p) - -#else /* !INSECURE */ -#define ok_address(M, a) (1) -#define ok_next(b, n) (1) -#define ok_inuse(p) (1) -#define ok_pinuse(p) (1) -#endif /* !INSECURE */ - -#if (FOOTERS && !INSECURE) -/* Check if (alleged) mstate m has expected magic field */ -#define ok_magic(M) ((M)->magic == mparams.magic) -#else /* (FOOTERS && !INSECURE) */ -#define ok_magic(M) (1) -#endif /* (FOOTERS && !INSECURE) */ - - -/* In gcc, use __builtin_expect to minimize impact of checks */ -#if !INSECURE -#if defined(__GNUC__) && __GNUC__ >= 3 -#define RTCHECK(e) __builtin_expect(e, 1) -#else /* GNUC */ -#define RTCHECK(e) (e) -#endif /* GNUC */ -#else /* !INSECURE */ -#define RTCHECK(e) (1) -#endif /* !INSECURE */ - -/* macros to set up inuse chunks with or without footers */ - -#if !FOOTERS - -#define mark_inuse_foot(M,p,s) - -/* Macros for setting head/foot of non-mmapped chunks */ - -/* Set cinuse bit and pinuse bit of next chunk */ -#define set_inuse(M,p,s)\ - ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ - ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) - -/* Set cinuse and pinuse of this chunk and pinuse of next chunk */ -#define set_inuse_and_pinuse(M,p,s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ - ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) - -/* Set size, cinuse and pinuse bit of this chunk */ -#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) - -#else /* FOOTERS */ - -/* Set foot of inuse chunk to be xor of mstate and seed */ -#define mark_inuse_foot(M,p,s)\ - (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic)) - -#define get_mstate_for(p)\ - ((mstate)(((mchunkptr)((char*)(p) +\ - (chunksize(p))))->prev_foot ^ mparams.magic)) - -#define set_inuse(M,p,s)\ - ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ - (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \ - mark_inuse_foot(M,p,s)) - -#define set_inuse_and_pinuse(M,p,s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ - (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\ - mark_inuse_foot(M,p,s)) - -#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ - mark_inuse_foot(M, p, s)) - -#endif /* !FOOTERS */ - -/* ---------------------------- setting mparams -------------------------- */ - -#if defined(ENABLE_LARGE_PAGES) && defined(WIN32) -typedef size_t (WINAPI *GetLargePageMinimum_t)(void); -#endif - -/* Initialize mparams */ -static int init_mparams(void) { -#ifdef NEED_GLOBAL_LOCK_INIT - if (malloc_global_mutex_status <= 0) - init_malloc_global_mutex(); -#endif - - ACQUIRE_MALLOC_GLOBAL_LOCK(); - if (mparams.magic == 0) { - size_t magic; - size_t psize; - size_t gsize; - -#ifndef WIN32 - psize = malloc_getpagesize; - gsize = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : psize); -#else /* WIN32 */ - { - SYSTEM_INFO system_info; - GetSystemInfo(&system_info); - psize = system_info.dwPageSize; - gsize = ((DEFAULT_GRANULARITY != 0)? - DEFAULT_GRANULARITY : system_info.dwAllocationGranularity); -#ifdef ENABLE_LARGE_PAGES - { - GetLargePageMinimum_t GetLargePageMinimum_ = (GetLargePageMinimum_t) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetLargePageMinimum"); - if(GetLargePageMinimum_) { - size_t largepagesize = GetLargePageMinimum_(); - if(largepagesize) { - psize = largepagesize; - gsize = ((DEFAULT_GRANULARITY != 0)? - DEFAULT_GRANULARITY : largepagesize); - if(gsize < largepagesize) gsize = largepagesize; - } - } - } -#endif - } -#endif /* WIN32 */ - - /* Sanity-check configuration: - size_t must be unsigned and as wide as pointer type. - ints must be at least 4 bytes. - alignment must be at least 8. - Alignment, min chunk size, and page size must all be powers of 2. - */ - if ((sizeof(size_t) != sizeof(char*)) || - (MAX_SIZE_T < MIN_CHUNK_SIZE) || - (sizeof(int) < 4) || - (MALLOC_ALIGNMENT < (size_t)8U) || - ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) || - ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) || - ((gsize & (gsize-SIZE_T_ONE)) != 0) || - ((psize & (psize-SIZE_T_ONE)) != 0)) - ABORT; - - mparams.granularity = gsize; - mparams.page_size = psize; - mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD; - mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD; -#if MORECORE_CONTIGUOUS - mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT; -#else /* MORECORE_CONTIGUOUS */ - mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT; -#endif /* MORECORE_CONTIGUOUS */ - -#if !ONLY_MSPACES - /* Set up lock for main malloc area */ - gm->mflags = mparams.default_mflags; - INITIAL_LOCK(&gm->mutex); -#endif - - { -#if USE_DEV_RANDOM - int fd; - unsigned char buf[sizeof(size_t)]; - /* Try to use /dev/urandom, else fall back on using time */ - if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && - read(fd, buf, sizeof(buf)) == sizeof(buf)) { - magic = *((size_t *) buf); - close(fd); - } - else -#endif /* USE_DEV_RANDOM */ -#ifdef WIN32 - magic = (size_t)(GetTickCount() ^ (size_t)0x55555555U); -#else - magic = (size_t)(time(0) ^ (size_t)0x55555555U); -#endif - magic |= (size_t)8U; /* ensure nonzero */ - magic &= ~(size_t)7U; /* improve chances of fault for bad values */ - mparams.magic = magic; - } - } - - RELEASE_MALLOC_GLOBAL_LOCK(); - return 1; -} - -/* support for mallopt */ -static int change_mparam(int param_number, int value) { - size_t val; - ensure_initialization(); - val = (value == -1)? MAX_SIZE_T : (size_t)value; - switch(param_number) { - case M_TRIM_THRESHOLD: - mparams.trim_threshold = val; - return 1; - case M_GRANULARITY: - if (val >= mparams.page_size && ((val & (val-1)) == 0)) { - mparams.granularity = val; - return 1; - } - else - return 0; - case M_MMAP_THRESHOLD: - mparams.mmap_threshold = val; - return 1; - default: - return 0; - } -} - -#if DEBUG -/* ------------------------- Debugging Support --------------------------- */ - -/* Check properties of any chunk, whether free, inuse, mmapped etc */ -static void do_check_any_chunk(mstate m, mchunkptr p) { - assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); - assert(ok_address(m, p)); -} - -/* Check properties of top chunk */ -static void do_check_top_chunk(mstate m, mchunkptr p) { - msegmentptr sp = segment_holding(m, (char*)p); - size_t sz = p->head & ~INUSE_BITS; /* third-lowest bit can be set! */ - assert(sp != 0); - assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); - assert(ok_address(m, p)); - assert(sz == m->topsize); - assert(sz > 0); - assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE); - assert(pinuse(p)); - assert(!pinuse(chunk_plus_offset(p, sz))); -} - -/* Check properties of (inuse) mmapped chunks */ -static void do_check_mmapped_chunk(mstate m, mchunkptr p) { - size_t sz = chunksize(p); - size_t len = (sz + (p->prev_foot) + MMAP_FOOT_PAD); - assert(is_mmapped(p)); - assert(use_mmap(m)); - assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); - assert(ok_address(m, p)); - assert(!is_small(sz)); - assert((len & (mparams.page_size-SIZE_T_ONE)) == 0); - assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD); - assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0); -} - -/* Check properties of inuse chunks */ -static void do_check_inuse_chunk(mstate m, mchunkptr p) { - do_check_any_chunk(m, p); - assert(is_inuse(p)); - assert(next_pinuse(p)); - /* If not pinuse and not mmapped, previous chunk has OK offset */ - assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p); - if (is_mmapped(p)) - do_check_mmapped_chunk(m, p); -} - -/* Check properties of free chunks */ -static void do_check_free_chunk(mstate m, mchunkptr p) { - size_t sz = chunksize(p); - mchunkptr next = chunk_plus_offset(p, sz); - do_check_any_chunk(m, p); - assert(!is_inuse(p)); - assert(!next_pinuse(p)); - assert (!is_mmapped(p)); - if (p != m->dv && p != m->top) { - if (sz >= MIN_CHUNK_SIZE) { - assert((sz & CHUNK_ALIGN_MASK) == 0); - assert(is_aligned(chunk2mem(p))); - assert(next->prev_foot == sz); - assert(pinuse(p)); - assert (next == m->top || is_inuse(next)); - assert(p->fd->bk == p); - assert(p->bk->fd == p); - } - else /* markers are always of size SIZE_T_SIZE */ - assert(sz == SIZE_T_SIZE); - } -} - -/* Check properties of malloced chunks at the point they are malloced */ -static void do_check_malloced_chunk(mstate m, void* mem, size_t s) { - if (mem != 0) { - mchunkptr p = mem2chunk(mem); - size_t sz = p->head & ~INUSE_BITS; - do_check_inuse_chunk(m, p); - assert((sz & CHUNK_ALIGN_MASK) == 0); - assert(sz >= MIN_CHUNK_SIZE); - assert(sz >= s); - /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */ - assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE)); - } -} - -/* Check a tree and its subtrees. */ -static void do_check_tree(mstate m, tchunkptr t) { - tchunkptr head = 0; - tchunkptr u = t; - bindex_t tindex = t->index; - size_t tsize = chunksize(t); - bindex_t idx; - compute_tree_index(tsize, idx); - assert(tindex == idx); - assert(tsize >= MIN_LARGE_SIZE); - assert(tsize >= minsize_for_tree_index(idx)); - assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1)))); - - do { /* traverse through chain of same-sized nodes */ - do_check_any_chunk(m, ((mchunkptr)u)); - assert(u->index == tindex); - assert(chunksize(u) == tsize); - assert(!is_inuse(u)); - assert(!next_pinuse(u)); - assert(u->fd->bk == u); - assert(u->bk->fd == u); - if (u->parent == 0) { - assert(u->child[0] == 0); - assert(u->child[1] == 0); - } - else { - assert(head == 0); /* only one node on chain has parent */ - head = u; - assert(u->parent != u); - assert (u->parent->child[0] == u || - u->parent->child[1] == u || - *((tbinptr*)(u->parent)) == u); - if (u->child[0] != 0) { - assert(u->child[0]->parent == u); - assert(u->child[0] != u); - do_check_tree(m, u->child[0]); - } - if (u->child[1] != 0) { - assert(u->child[1]->parent == u); - assert(u->child[1] != u); - do_check_tree(m, u->child[1]); - } - if (u->child[0] != 0 && u->child[1] != 0) { - assert(chunksize(u->child[0]) < chunksize(u->child[1])); - } - } - u = u->fd; - } while (u != t); - assert(head != 0); -} - -/* Check all the chunks in a treebin. */ -static void do_check_treebin(mstate m, bindex_t i) { - tbinptr* tb = treebin_at(m, i); - tchunkptr t = *tb; - int empty = (m->treemap & (1U << i)) == 0; - if (t == 0) - assert(empty); - if (!empty) - do_check_tree(m, t); -} - -/* Check all the chunks in a smallbin. */ -static void do_check_smallbin(mstate m, bindex_t i) { - sbinptr b = smallbin_at(m, i); - mchunkptr p = b->bk; - unsigned int empty = (m->smallmap & (1U << i)) == 0; - if (p == b) - assert(empty); - if (!empty) { - for (; p != b; p = p->bk) { - size_t size = chunksize(p); - mchunkptr q; - /* each chunk claims to be free */ - do_check_free_chunk(m, p); - /* chunk belongs in bin */ - assert(small_index(size) == i); - assert(p->bk == b || chunksize(p->bk) == chunksize(p)); - /* chunk is followed by an inuse chunk */ - q = next_chunk(p); - if (q->head != FENCEPOST_HEAD) - do_check_inuse_chunk(m, q); - } - } -} - -/* Find x in a bin. Used in other check functions. */ -static int bin_find(mstate m, mchunkptr x) { - size_t size = chunksize(x); - if (is_small(size)) { - bindex_t sidx = small_index(size); - sbinptr b = smallbin_at(m, sidx); - if (smallmap_is_marked(m, sidx)) { - mchunkptr p = b; - do { - if (p == x) - return 1; - } while ((p = p->fd) != b); - } - } - else { - bindex_t tidx; - compute_tree_index(size, tidx); - if (treemap_is_marked(m, tidx)) { - tchunkptr t = *treebin_at(m, tidx); - size_t sizebits = size << leftshift_for_tree_index(tidx); - while (t != 0 && chunksize(t) != size) { - t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; - sizebits <<= 1; - } - if (t != 0) { - tchunkptr u = t; - do { - if (u == (tchunkptr)x) - return 1; - } while ((u = u->fd) != t); - } - } - } - return 0; -} - -/* Traverse each chunk and check it; return total */ -static size_t traverse_and_check(mstate m) { - size_t sum = 0; - if (is_initialized(m)) { - msegmentptr s = &m->seg; - sum += m->topsize + TOP_FOOT_SIZE; - while (s != 0) { - mchunkptr q = align_as_chunk(s->base); - mchunkptr lastq = 0; - assert(pinuse(q)); - while (segment_holds(s, q) && - q != m->top && q->head != FENCEPOST_HEAD) { - sum += chunksize(q); - if (is_inuse(q)) { - assert(!bin_find(m, q)); - do_check_inuse_chunk(m, q); - } - else { - assert(q == m->dv || bin_find(m, q)); - assert(lastq == 0 || is_inuse(lastq)); /* Not 2 consecutive free */ - do_check_free_chunk(m, q); - } - lastq = q; - q = next_chunk(q); - } - s = s->next; - } - } - return sum; -} - -/* Check all properties of malloc_state. */ -static void do_check_malloc_state(mstate m) { - bindex_t i; - size_t total; - /* check bins */ - for (i = 0; i < NSMALLBINS; ++i) - do_check_smallbin(m, i); - for (i = 0; i < NTREEBINS; ++i) - do_check_treebin(m, i); - - if (m->dvsize != 0) { /* check dv chunk */ - do_check_any_chunk(m, m->dv); - assert(m->dvsize == chunksize(m->dv)); - assert(m->dvsize >= MIN_CHUNK_SIZE); - assert(bin_find(m, m->dv) == 0); - } - - if (m->top != 0) { /* check top chunk */ - do_check_top_chunk(m, m->top); - /*assert(m->topsize == chunksize(m->top)); redundant */ - assert(m->topsize > 0); - assert(bin_find(m, m->top) == 0); - } - - total = traverse_and_check(m); - assert(total <= m->footprint); - assert(m->footprint <= m->max_footprint); -} -#endif /* DEBUG */ - -/* ----------------------------- statistics ------------------------------ */ - -#if !NO_MALLINFO -static struct mallinfo internal_mallinfo(mstate m) { - struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - ensure_initialization(); - if (!PREACTION(m)) { - check_malloc_state(m); - if (is_initialized(m)) { - size_t nfree = SIZE_T_ONE; /* top always free */ - size_t mfree = m->topsize + TOP_FOOT_SIZE; - size_t sum = mfree; - msegmentptr s = &m->seg; - while (s != 0) { - mchunkptr q = align_as_chunk(s->base); - while (segment_holds(s, q) && - q != m->top && q->head != FENCEPOST_HEAD) { - size_t sz = chunksize(q); - sum += sz; - if (!is_inuse(q)) { - mfree += sz; - ++nfree; - } - q = next_chunk(q); - } - s = s->next; - } - - nm.arena = sum; - nm.ordblks = nfree; - nm.hblkhd = m->footprint - sum; - nm.usmblks = m->max_footprint; - nm.uordblks = m->footprint - mfree; - nm.fordblks = mfree; - nm.keepcost = m->topsize; - } - - POSTACTION(m); - } - return nm; -} -#endif /* !NO_MALLINFO */ - -static void internal_malloc_stats(mstate m) { - ensure_initialization(); - if (!PREACTION(m)) { - size_t maxfp = 0; - size_t fp = 0; - size_t used = 0; - check_malloc_state(m); - if (is_initialized(m)) { - msegmentptr s = &m->seg; - maxfp = m->max_footprint; - fp = m->footprint; - used = fp - (m->topsize + TOP_FOOT_SIZE); - - while (s != 0) { - mchunkptr q = align_as_chunk(s->base); - while (segment_holds(s, q) && - q != m->top && q->head != FENCEPOST_HEAD) { - if (!is_inuse(q)) - used -= chunksize(q); - q = next_chunk(q); - } - s = s->next; - } - } - - fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); - fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); - fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); - - POSTACTION(m); - } -} - -/* ----------------------- Operations on smallbins ----------------------- */ - -/* - Various forms of linking and unlinking are defined as macros. Even - the ones for trees, which are very long but have very short typical - paths. This is ugly but reduces reliance on inlining support of - compilers. -*/ - -/* Link a free chunk into a smallbin */ -#define insert_small_chunk(M, P, S) {\ - bindex_t I = small_index(S);\ - mchunkptr B = smallbin_at(M, I);\ - mchunkptr F = B;\ - assert(S >= MIN_CHUNK_SIZE);\ - if (!smallmap_is_marked(M, I))\ - mark_smallmap(M, I);\ - else if (RTCHECK(ok_address(M, B->fd)))\ - F = B->fd;\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - B->fd = P;\ - F->bk = P;\ - P->fd = F;\ - P->bk = B;\ -} - -/* Unlink a chunk from a smallbin */ -#define unlink_small_chunk(M, P, S) {\ - mchunkptr F = P->fd;\ - mchunkptr B = P->bk;\ - bindex_t I = small_index(S);\ - assert(P != B);\ - assert(P != F);\ - assert(chunksize(P) == small_index2size(I));\ - if (F == B)\ - clear_smallmap(M, I);\ - else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\ - (B == smallbin_at(M,I) || ok_address(M, B)))) {\ - F->bk = B;\ - B->fd = F;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ -} - -/* Unlink the first chunk from a smallbin */ -#define unlink_first_small_chunk(M, B, P, I) {\ - mchunkptr F = P->fd;\ - assert(P != B);\ - assert(P != F);\ - assert(chunksize(P) == small_index2size(I));\ - if (B == F)\ - clear_smallmap(M, I);\ - else if (RTCHECK(ok_address(M, F))) {\ - B->fd = F;\ - F->bk = B;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ -} - - - -/* Replace dv node, binning the old one */ -/* Used only when dvsize known to be small */ -#define replace_dv(M, P, S) {\ - size_t DVS = M->dvsize;\ - if (DVS != 0) {\ - mchunkptr DV = M->dv;\ - assert(is_small(DVS));\ - insert_small_chunk(M, DV, DVS);\ - }\ - M->dvsize = S;\ - M->dv = P;\ -} - -/* ------------------------- Operations on trees ------------------------- */ - -/* Insert chunk into tree */ -#define insert_large_chunk(M, X, S) {\ - tbinptr* H;\ - bindex_t I;\ - compute_tree_index(S, I);\ - H = treebin_at(M, I);\ - X->index = I;\ - X->child[0] = X->child[1] = 0;\ - if (!treemap_is_marked(M, I)) {\ - mark_treemap(M, I);\ - *H = X;\ - X->parent = (tchunkptr)H;\ - X->fd = X->bk = X;\ - }\ - else {\ - tchunkptr T = *H;\ - size_t K = S << leftshift_for_tree_index(I);\ - for (;;) {\ - if (chunksize(T) != S) {\ - tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\ - K <<= 1;\ - if (*C != 0)\ - T = *C;\ - else if (RTCHECK(ok_address(M, C))) {\ - *C = X;\ - X->parent = T;\ - X->fd = X->bk = X;\ - break;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - break;\ - }\ - }\ - else {\ - tchunkptr F = T->fd;\ - if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\ - T->fd = F->bk = X;\ - X->fd = F;\ - X->bk = T;\ - X->parent = 0;\ - break;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - break;\ - }\ - }\ - }\ - }\ -} - -/* - Unlink steps: - - 1. If x is a chained node, unlink it from its same-sized fd/bk links - and choose its bk node as its replacement. - 2. If x was the last node of its size, but not a leaf node, it must - be replaced with a leaf node (not merely one with an open left or - right), to make sure that lefts and rights of descendents - correspond properly to bit masks. We use the rightmost descendent - of x. We could use any other leaf, but this is easy to locate and - tends to counteract removal of leftmosts elsewhere, and so keeps - paths shorter than minimally guaranteed. This doesn't loop much - because on average a node in a tree is near the bottom. - 3. If x is the base of a chain (i.e., has parent links) relink - x's parent and children to x's replacement (or null if none). -*/ - -#define unlink_large_chunk(M, X) {\ - tchunkptr XP = X->parent;\ - tchunkptr R;\ - if (X->bk != X) {\ - tchunkptr F = X->fd;\ - R = X->bk;\ - if (RTCHECK(ok_address(M, F))) {\ - F->bk = R;\ - R->fd = F;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ - else {\ - tchunkptr* RP;\ - if (((R = *(RP = &(X->child[1]))) != 0) ||\ - ((R = *(RP = &(X->child[0]))) != 0)) {\ - tchunkptr* CP;\ - while ((*(CP = &(R->child[1])) != 0) ||\ - (*(CP = &(R->child[0])) != 0)) {\ - R = *(RP = CP);\ - }\ - if (RTCHECK(ok_address(M, RP)))\ - *RP = 0;\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ - }\ - if (XP != 0) {\ - tbinptr* H = treebin_at(M, X->index);\ - if (X == *H) {\ - if ((*H = R) == 0) \ - clear_treemap(M, X->index);\ - }\ - else if (RTCHECK(ok_address(M, XP))) {\ - if (XP->child[0] == X) \ - XP->child[0] = R;\ - else \ - XP->child[1] = R;\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - if (R != 0) {\ - if (RTCHECK(ok_address(M, R))) {\ - tchunkptr C0, C1;\ - R->parent = XP;\ - if ((C0 = X->child[0]) != 0) {\ - if (RTCHECK(ok_address(M, C0))) {\ - R->child[0] = C0;\ - C0->parent = R;\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - if ((C1 = X->child[1]) != 0) {\ - if (RTCHECK(ok_address(M, C1))) {\ - R->child[1] = C1;\ - C1->parent = R;\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ -} - -/* Relays to large vs small bin operations */ - -#define insert_chunk(M, P, S)\ - if (is_small(S)) insert_small_chunk(M, P, S)\ - else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } - -#define unlink_chunk(M, P, S)\ - if (is_small(S)) unlink_small_chunk(M, P, S)\ - else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } - - -/* Relays to internal calls to malloc/free from realloc, memalign etc */ - -#if ONLY_MSPACES -#define internal_malloc(m, b) mspace_malloc(m, b) -#define internal_free(m, mem) mspace_free(m,mem); -#else /* ONLY_MSPACES */ -#if MSPACES -#define internal_malloc(m, b)\ - (m == gm)? dlmalloc(b) : mspace_malloc(m, b) -#define internal_free(m, mem)\ - if (m == gm) dlfree(mem); else mspace_free(m,mem); -#else /* MSPACES */ -#define internal_malloc(m, b) dlmalloc(b) -#define internal_free(m, mem) dlfree(mem) -#endif /* MSPACES */ -#endif /* ONLY_MSPACES */ - -/* ----------------------- Direct-mmapping chunks ----------------------- */ - -/* - Directly mmapped chunks are set up with an offset to the start of - the mmapped region stored in the prev_foot field of the chunk. This - allows reconstruction of the required argument to MUNMAP when freed, - and also allows adjustment of the returned chunk to meet alignment - requirements (especially in memalign). -*/ - -/* Malloc using mmap */ -static void* mmap_alloc(mstate m, size_t nb) { - size_t mmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); - if (mmsize > nb) { /* Check for wrap around 0 */ - char* mm = (char*)(CALL_DIRECT_MMAP(mmsize)); - if (mm != CMFAIL) { - size_t offset = align_offset(chunk2mem(mm)); - size_t psize = mmsize - offset - MMAP_FOOT_PAD; - mchunkptr p = (mchunkptr)(mm + offset); - p->prev_foot = offset; - p->head = psize; - mark_inuse_foot(m, p, psize); - chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD; - chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0; - - if (m->least_addr == 0 || mm < m->least_addr) - m->least_addr = mm; - if ((m->footprint += mmsize) > m->max_footprint) - m->max_footprint = m->footprint; - assert(is_aligned(chunk2mem(p))); - check_mmapped_chunk(m, p); - return chunk2mem(p); - } - } - return 0; -} - -/* Realloc using mmap */ -static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) { - size_t oldsize = chunksize(oldp); - if (is_small(nb)) /* Can't shrink mmap regions below small size */ - return 0; - /* Keep old chunk if big enough but not too big */ - if (oldsize >= nb + SIZE_T_SIZE && - (oldsize - nb) <= (mparams.granularity << 1)) - return oldp; - else { - size_t offset = oldp->prev_foot; - size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD; - size_t newmmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); - char* cp = (char*)CALL_MREMAP((char*)oldp - offset, - oldmmsize, newmmsize, 1); - if (cp != CMFAIL) { - mchunkptr newp = (mchunkptr)(cp + offset); - size_t psize = newmmsize - offset - MMAP_FOOT_PAD; - newp->head = psize; - mark_inuse_foot(m, newp, psize); - chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD; - chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0; - - if (cp < m->least_addr) - m->least_addr = cp; - if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint) - m->max_footprint = m->footprint; - check_mmapped_chunk(m, newp); - return newp; - } - } - return 0; -} - -/* -------------------------- mspace management -------------------------- */ - -/* Initialize top chunk and its size */ -static void init_top(mstate m, mchunkptr p, size_t psize) { - /* Ensure alignment */ - size_t offset = align_offset(chunk2mem(p)); - p = (mchunkptr)((char*)p + offset); - psize -= offset; - - m->top = p; - m->topsize = psize; - p->head = psize | PINUSE_BIT; - /* set size of fake trailing chunk holding overhead space only once */ - chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE; - m->trim_check = mparams.trim_threshold; /* reset on each update */ -} - -/* Initialize bins for a new mstate that is otherwise zeroed out */ -static void init_bins(mstate m) { - /* Establish circular links for smallbins */ - bindex_t i; - for (i = 0; i < NSMALLBINS; ++i) { - sbinptr bin = smallbin_at(m,i); - bin->fd = bin->bk = bin; - } -} - -#if PROCEED_ON_ERROR - -/* default corruption action */ -static void reset_on_error(mstate m) { - int i; - ++malloc_corruption_error_count; - /* Reinitialize fields to forget about all memory */ - m->smallbins = m->treebins = 0; - m->dvsize = m->topsize = 0; - m->seg.base = 0; - m->seg.size = 0; - m->seg.next = 0; - m->top = m->dv = 0; - for (i = 0; i < NTREEBINS; ++i) - *treebin_at(m, i) = 0; - init_bins(m); -} -#endif /* PROCEED_ON_ERROR */ - -/* Allocate chunk and prepend remainder with chunk in successor base. */ -static void* prepend_alloc(mstate m, char* newbase, char* oldbase, - size_t nb) { - mchunkptr p = align_as_chunk(newbase); - mchunkptr oldfirst = align_as_chunk(oldbase); - size_t psize = (char*)oldfirst - (char*)p; - mchunkptr q = chunk_plus_offset(p, nb); - size_t qsize = psize - nb; - set_size_and_pinuse_of_inuse_chunk(m, p, nb); - - assert((char*)oldfirst > (char*)q); - assert(pinuse(oldfirst)); - assert(qsize >= MIN_CHUNK_SIZE); - - /* consolidate remainder with first chunk of old base */ - if (oldfirst == m->top) { - size_t tsize = m->topsize += qsize; - m->top = q; - q->head = tsize | PINUSE_BIT; - check_top_chunk(m, q); - } - else if (oldfirst == m->dv) { - size_t dsize = m->dvsize += qsize; - m->dv = q; - set_size_and_pinuse_of_free_chunk(q, dsize); - } - else { - if (!is_inuse(oldfirst)) { - size_t nsize = chunksize(oldfirst); - unlink_chunk(m, oldfirst, nsize); - oldfirst = chunk_plus_offset(oldfirst, nsize); - qsize += nsize; - } - set_free_with_pinuse(q, qsize, oldfirst); - insert_chunk(m, q, qsize); - check_free_chunk(m, q); - } - - check_malloced_chunk(m, chunk2mem(p), nb); - return chunk2mem(p); -} - -/* Add a segment to hold a new noncontiguous region */ -static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { - /* Determine locations and sizes of segment, fenceposts, old top */ - char* old_top = (char*)m->top; - msegmentptr oldsp = segment_holding(m, old_top); - char* old_end = oldsp->base + oldsp->size; - size_t ssize = pad_request(sizeof(struct malloc_segment)); - char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK); - size_t offset = align_offset(chunk2mem(rawsp)); - char* asp = rawsp + offset; - char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp; - mchunkptr sp = (mchunkptr)csp; - msegmentptr ss = (msegmentptr)(chunk2mem(sp)); - mchunkptr tnext = chunk_plus_offset(sp, ssize); - mchunkptr p = tnext; - int nfences = 0; - - /* reset top to new space */ - init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); - - /* Set up segment record */ - assert(is_aligned(ss)); - set_size_and_pinuse_of_inuse_chunk(m, sp, ssize); - *ss = m->seg; /* Push current record */ - m->seg.base = tbase; - m->seg.size = tsize; - m->seg.sflags = mmapped; - m->seg.next = ss; - - /* Insert trailing fenceposts */ - for (;;) { - mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); - p->head = FENCEPOST_HEAD; - ++nfences; - if ((char*)(&(nextp->head)) < old_end) - p = nextp; - else - break; - } - assert(nfences >= 2); - - /* Insert the rest of old top into a bin as an ordinary free chunk */ - if (csp != old_top) { - mchunkptr q = (mchunkptr)old_top; - size_t psize = csp - old_top; - mchunkptr tn = chunk_plus_offset(q, psize); - set_free_with_pinuse(q, psize, tn); - insert_chunk(m, q, psize); - } - - check_top_chunk(m, m->top); -} - -/* -------------------------- System allocation -------------------------- */ - -/* Get memory from system using MORECORE or MMAP */ -static void* sys_alloc(mstate m, size_t nb) { - char* tbase = CMFAIL; - size_t tsize = 0; - flag_t mmap_flag = 0; - - ensure_initialization(); - - /* Directly map large chunks, but only if already initialized */ - if (use_mmap(m) && nb >= mparams.mmap_threshold && m->topsize != 0) { - void* mem = mmap_alloc(m, nb); - if (mem != 0) - return mem; - } - - /* - Try getting memory in any of three ways (in most-preferred to - least-preferred order): - 1. A call to MORECORE that can normally contiguously extend memory. - (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - or main space is mmapped or a previous contiguous call failed) - 2. A call to MMAP new space (disabled if not HAVE_MMAP). - Note that under the default settings, if MORECORE is unable to - fulfill a request, and HAVE_MMAP is true, then mmap is - used as a noncontiguous system allocator. This is a useful backup - strategy for systems with holes in address spaces -- in this case - sbrk cannot contiguously expand the heap, but mmap may be able to - find space. - 3. A call to MORECORE that cannot usually contiguously extend memory. - (disabled if not HAVE_MORECORE) - - In all cases, we need to request enough bytes from system to ensure - we can malloc nb bytes upon success, so pad with enough space for - top_foot, plus alignment-pad to make sure we don't lose bytes if - not on boundary, and round this up to a granularity unit. - */ - - if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) { - char* br = CMFAIL; - msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top); - size_t asize = 0; - ACQUIRE_MALLOC_GLOBAL_LOCK(); - - if (ss == 0) { /* First time through or recovery */ - char* base = (char*)CALL_MORECORE(0); - if (base != CMFAIL) { - asize = granularity_align(nb + SYS_ALLOC_PADDING); - /* Adjust to end on a page boundary */ - if (!is_page_aligned(base)) - asize += (page_align((size_t)base) - (size_t)base); - /* Can't call MORECORE if size is negative when treated as signed */ - if (asize < HALF_MAX_SIZE_T && - (br = (char*)(CALL_MORECORE(asize))) == base) { - tbase = base; - tsize = asize; - } - } - } - else { - /* Subtract out existing available top space from MORECORE request. */ - asize = granularity_align(nb - m->topsize + SYS_ALLOC_PADDING); - /* Use mem here only if it did continuously extend old space */ - if (asize < HALF_MAX_SIZE_T && - (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) { - tbase = br; - tsize = asize; - } - } - - if (tbase == CMFAIL) { /* Cope with partial failure */ - if (br != CMFAIL) { /* Try to use/extend the space we did get */ - if (asize < HALF_MAX_SIZE_T && - asize < nb + SYS_ALLOC_PADDING) { - size_t esize = granularity_align(nb + SYS_ALLOC_PADDING - asize); - if (esize < HALF_MAX_SIZE_T) { - char* end = (char*)CALL_MORECORE(esize); - if (end != CMFAIL) - asize += esize; - else { /* Can't use; try to release */ - (void) CALL_MORECORE(-asize); - br = CMFAIL; - } - } - } - } - if (br != CMFAIL) { /* Use the space we did get */ - tbase = br; - tsize = asize; - } - else - disable_contiguous(m); /* Don't try contiguous path in the future */ - } - - RELEASE_MALLOC_GLOBAL_LOCK(); - } - - if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */ - size_t rsize = granularity_align(nb + SYS_ALLOC_PADDING); - if (rsize > nb) { /* Fail if wraps around zero */ - char* mp = (char*)(CALL_MMAP(rsize)); - if (mp != CMFAIL) { - tbase = mp; - tsize = rsize; - mmap_flag = USE_MMAP_BIT; - } - } - } - - if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */ - size_t asize = granularity_align(nb + SYS_ALLOC_PADDING); - if (asize < HALF_MAX_SIZE_T) { - char* br = CMFAIL; - char* end = CMFAIL; - ACQUIRE_MALLOC_GLOBAL_LOCK(); - br = (char*)(CALL_MORECORE(asize)); - end = (char*)(CALL_MORECORE(0)); - RELEASE_MALLOC_GLOBAL_LOCK(); - if (br != CMFAIL && end != CMFAIL && br < end) { - size_t ssize = end - br; - if (ssize > nb + TOP_FOOT_SIZE) { - tbase = br; - tsize = ssize; - } - } - } - } - - if (tbase != CMFAIL) { - - if ((m->footprint += tsize) > m->max_footprint) - m->max_footprint = m->footprint; - - if (!is_initialized(m)) { /* first-time initialization */ - if (m->least_addr == 0 || tbase < m->least_addr) - m->least_addr = tbase; - m->seg.base = tbase; - m->seg.size = tsize; - m->seg.sflags = mmap_flag; - m->magic = mparams.magic; - m->release_checks = MAX_RELEASE_CHECK_RATE; - init_bins(m); -#if !ONLY_MSPACES - if (is_global(m)) - init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); - else -#endif - { - /* Offset top by embedded malloc_state */ - mchunkptr mn = next_chunk(mem2chunk(m)); - init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE); - } - } - - else { - /* Try to merge with an existing segment */ - msegmentptr sp = &m->seg; - /* Only consider most recent segment if traversal suppressed */ - while (sp != 0 && tbase != sp->base + sp->size) - sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next; - if (sp != 0 && - !is_extern_segment(sp) && - (sp->sflags & USE_MMAP_BIT) == mmap_flag && - segment_holds(sp, m->top)) { /* append */ - sp->size += tsize; - init_top(m, m->top, m->topsize + tsize); - } - else { - if (tbase < m->least_addr) - m->least_addr = tbase; - sp = &m->seg; - while (sp != 0 && sp->base != tbase + tsize) - sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next; - if (sp != 0 && - !is_extern_segment(sp) && - (sp->sflags & USE_MMAP_BIT) == mmap_flag) { - char* oldbase = sp->base; - sp->base = tbase; - sp->size += tsize; - return prepend_alloc(m, tbase, oldbase, nb); - } - else - add_segment(m, tbase, tsize, mmap_flag); - } - } - - if (nb < m->topsize) { /* Allocate from new or extended top space */ - size_t rsize = m->topsize -= nb; - mchunkptr p = m->top; - mchunkptr r = m->top = chunk_plus_offset(p, nb); - r->head = rsize | PINUSE_BIT; - set_size_and_pinuse_of_inuse_chunk(m, p, nb); - check_top_chunk(m, m->top); - check_malloced_chunk(m, chunk2mem(p), nb); - return chunk2mem(p); - } - } - - MALLOC_FAILURE_ACTION; - return 0; -} - -/* ----------------------- system deallocation -------------------------- */ - -/* Unmap and unlink any mmapped segments that don't contain used chunks */ -static size_t release_unused_segments(mstate m) { - size_t released = 0; - int nsegs = 0; - msegmentptr pred = &m->seg; - msegmentptr sp = pred->next; - while (sp != 0) { - char* base = sp->base; - size_t size = sp->size; - msegmentptr next = sp->next; - ++nsegs; - if (is_mmapped_segment(sp) && !is_extern_segment(sp)) { - mchunkptr p = align_as_chunk(base); - size_t psize = chunksize(p); - /* Can unmap if first chunk holds entire segment and not pinned */ - if (!is_inuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) { - tchunkptr tp = (tchunkptr)p; - assert(segment_holds(sp, (char*)sp)); - if (p == m->dv) { - m->dv = 0; - m->dvsize = 0; - } - else { - unlink_large_chunk(m, tp); - } - if (CALL_MUNMAP(base, size) == 0) { - released += size; - m->footprint -= size; - /* unlink obsoleted record */ - sp = pred; - sp->next = next; - } - else { /* back out if cannot unmap */ - insert_large_chunk(m, tp, psize); - } - } - } - if (NO_SEGMENT_TRAVERSAL) /* scan only first segment */ - break; - pred = sp; - sp = next; - } - /* Reset check counter */ - m->release_checks = ((nsegs > MAX_RELEASE_CHECK_RATE)? - nsegs : MAX_RELEASE_CHECK_RATE); - return released; -} - -static int sys_trim(mstate m, size_t pad) { - size_t released = 0; - ensure_initialization(); - if (pad < MAX_REQUEST && is_initialized(m)) { - pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */ - - if (m->topsize > pad) { - /* Shrink top space in granularity-size units, keeping at least one */ - size_t unit = mparams.granularity; - size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - - SIZE_T_ONE) * unit; - msegmentptr sp = segment_holding(m, (char*)m->top); - - if (!is_extern_segment(sp)) { - if (is_mmapped_segment(sp)) { - if (HAVE_MMAP && - sp->size >= extra && - !has_segment_link(m, sp)) { /* can't shrink if pinned */ - size_t newsize = sp->size - extra; - /* Prefer mremap, fall back to munmap */ - if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || - (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { - released = extra; - } - } - } - else if (HAVE_MORECORE) { - if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */ - extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit; - ACQUIRE_MALLOC_GLOBAL_LOCK(); - { - /* Make sure end of memory is where we last set it. */ - char* old_br = (char*)(CALL_MORECORE(0)); - if (old_br == sp->base + sp->size) { - char* rel_br = (char*)(CALL_MORECORE(-extra)); - char* new_br = (char*)(CALL_MORECORE(0)); - if (rel_br != CMFAIL && new_br < old_br) - released = old_br - new_br; - } - } - RELEASE_MALLOC_GLOBAL_LOCK(); - } - } - - if (released != 0) { - sp->size -= released; - m->footprint -= released; - init_top(m, m->top, m->topsize - released); - check_top_chunk(m, m->top); - } - } - - /* Unmap any unused mmapped segments */ - if (HAVE_MMAP) - released += release_unused_segments(m); - - /* On failure, disable autotrim to avoid repeated failed future calls */ - if (released == 0 && m->topsize > m->trim_check) - m->trim_check = MAX_SIZE_T; - } - - return (released != 0)? 1 : 0; -} - - -/* ---------------------------- malloc support --------------------------- */ - -/* allocate a large request from the best fitting chunk in a treebin */ -static void* tmalloc_large(mstate m, size_t nb) { - tchunkptr v = 0; - size_t rsize = -nb; /* Unsigned negation */ - tchunkptr t; - bindex_t idx; - compute_tree_index(nb, idx); - if ((t = *treebin_at(m, idx)) != 0) { - /* Traverse tree for this bin looking for node with size == nb */ - size_t sizebits = nb << leftshift_for_tree_index(idx); - tchunkptr rst = 0; /* The deepest untaken right subtree */ - for (;;) { - tchunkptr rt; - size_t trem = chunksize(t) - nb; - if (trem < rsize) { - v = t; - if ((rsize = trem) == 0) - break; - } - rt = t->child[1]; - t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; - if (rt != 0 && rt != t) - rst = rt; - if (t == 0) { - t = rst; /* set t to least subtree holding sizes > nb */ - break; - } - sizebits <<= 1; - } - } - if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */ - binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap; - if (leftbits != 0) { - bindex_t i; - binmap_t leastbit = least_bit(leftbits); - compute_bit2idx(leastbit, i); - t = *treebin_at(m, i); - } - } - - while (t != 0) { /* find smallest of tree or subtree */ - size_t trem = chunksize(t) - nb; - if (trem < rsize) { - rsize = trem; - v = t; - } - t = leftmost_child(t); - } - - /* If dv is a better fit, return 0 so malloc will use it */ - if (v != 0 && rsize < (size_t)(m->dvsize - nb)) { - if (RTCHECK(ok_address(m, v))) { /* split */ - mchunkptr r = chunk_plus_offset(v, nb); - assert(chunksize(v) == rsize + nb); - if (RTCHECK(ok_next(v, r))) { - unlink_large_chunk(m, v); - if (rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(m, v, (rsize + nb)); - else { - set_size_and_pinuse_of_inuse_chunk(m, v, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - insert_chunk(m, r, rsize); - } - return chunk2mem(v); - } - } - CORRUPTION_ERROR_ACTION(m); - } - return 0; -} - -/* allocate a small request from the best fitting chunk in a treebin */ -static void* tmalloc_small(mstate m, size_t nb) { - tchunkptr t, v; - size_t rsize; - bindex_t i; - binmap_t leastbit = least_bit(m->treemap); - compute_bit2idx(leastbit, i); - v = t = *treebin_at(m, i); - rsize = chunksize(t) - nb; - - while ((t = leftmost_child(t)) != 0) { - size_t trem = chunksize(t) - nb; - if (trem < rsize) { - rsize = trem; - v = t; - } - } - - if (RTCHECK(ok_address(m, v))) { - mchunkptr r = chunk_plus_offset(v, nb); - assert(chunksize(v) == rsize + nb); - if (RTCHECK(ok_next(v, r))) { - unlink_large_chunk(m, v); - if (rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(m, v, (rsize + nb)); - else { - set_size_and_pinuse_of_inuse_chunk(m, v, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - replace_dv(m, r, rsize); - } - return chunk2mem(v); - } - } - - CORRUPTION_ERROR_ACTION(m); - return 0; -} - -/* --------------------------- realloc support --------------------------- */ - -static void* internal_realloc(mstate m, void* oldmem, size_t bytes) { - if (bytes >= MAX_REQUEST) { - MALLOC_FAILURE_ACTION; - return 0; - } - if (!PREACTION(m)) { - mchunkptr oldp = mem2chunk(oldmem); - size_t oldsize = chunksize(oldp); - mchunkptr next = chunk_plus_offset(oldp, oldsize); - mchunkptr newp = 0; - void* extra = 0; - - /* Try to either shrink or extend into top. Else malloc-copy-free */ - - if (RTCHECK(ok_address(m, oldp) && ok_inuse(oldp) && - ok_next(oldp, next) && ok_pinuse(next))) { - size_t nb = request2size(bytes); - if (is_mmapped(oldp)) - newp = mmap_resize(m, oldp, nb); - else if (oldsize >= nb) { /* already big enough */ - size_t rsize = oldsize - nb; - newp = oldp; - if (rsize >= MIN_CHUNK_SIZE) { - mchunkptr remainder = chunk_plus_offset(newp, nb); - set_inuse(m, newp, nb); - set_inuse_and_pinuse(m, remainder, rsize); - extra = chunk2mem(remainder); - } - } - else if (next == m->top && oldsize + m->topsize > nb) { - /* Expand into top */ - size_t newsize = oldsize + m->topsize; - size_t newtopsize = newsize - nb; - mchunkptr newtop = chunk_plus_offset(oldp, nb); - set_inuse(m, oldp, nb); - newtop->head = newtopsize |PINUSE_BIT; - m->top = newtop; - m->topsize = newtopsize; - newp = oldp; - } - } - else { - USAGE_ERROR_ACTION(m, oldmem); - POSTACTION(m); - return 0; - } -#if DEBUG - if (newp != 0) { - check_inuse_chunk(m, newp); /* Check requires lock */ - } -#endif - - POSTACTION(m); - - if (newp != 0) { - if (extra != 0) { - internal_free(m, extra); - } - return chunk2mem(newp); - } - else { - void* newmem = internal_malloc(m, bytes); - if (newmem != 0) { - size_t oc = oldsize - overhead_for(oldp); - memcpy(newmem, oldmem, (oc < bytes)? oc : bytes); - internal_free(m, oldmem); - } - return newmem; - } - } - return 0; -} - -/* --------------------------- memalign support -------------------------- */ - -static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { - if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */ - return internal_malloc(m, bytes); - if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */ - alignment = MIN_CHUNK_SIZE; - if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */ - size_t a = MALLOC_ALIGNMENT << 1; - while (a < alignment) a <<= 1; - alignment = a; - } - - if (bytes >= MAX_REQUEST - alignment) { - if (m != 0) { /* Test isn't needed but avoids compiler warning */ - MALLOC_FAILURE_ACTION; - } - } - else { - size_t nb = request2size(bytes); - size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD; - char* mem = (char*)internal_malloc(m, req); - if (mem != 0) { - void* leader = 0; - void* trailer = 0; - mchunkptr p = mem2chunk(mem); - - if (PREACTION(m)) return 0; - if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */ - /* - Find an aligned spot inside chunk. Since we need to give - back leading space in a chunk of at least MIN_CHUNK_SIZE, if - the first calculation places us at a spot with less than - MIN_CHUNK_SIZE leader, we can move to the next aligned spot. - We've allocated enough total room so that this is always - possible. - */ - char* br = (char*)mem2chunk((size_t)(((size_t)(mem + - alignment - - SIZE_T_ONE)) & - -alignment)); - char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)? - br : br+alignment; - mchunkptr newp = (mchunkptr)pos; - size_t leadsize = pos - (char*)(p); - size_t newsize = chunksize(p) - leadsize; - - if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */ - newp->prev_foot = p->prev_foot + leadsize; - newp->head = newsize; - } - else { /* Otherwise, give back leader, use the rest */ - set_inuse(m, newp, newsize); - set_inuse(m, p, leadsize); - leader = chunk2mem(p); - } - p = newp; - } - - /* Give back spare room at the end */ - if (!is_mmapped(p)) { - size_t size = chunksize(p); - if (size > nb + MIN_CHUNK_SIZE) { - size_t remainder_size = size - nb; - mchunkptr remainder = chunk_plus_offset(p, nb); - set_inuse(m, p, nb); - set_inuse(m, remainder, remainder_size); - trailer = chunk2mem(remainder); - } - } - - assert (chunksize(p) >= nb); - assert((((size_t)(chunk2mem(p))) % alignment) == 0); - check_inuse_chunk(m, p); - POSTACTION(m); - if (leader != 0) { - internal_free(m, leader); - } - if (trailer != 0) { - internal_free(m, trailer); - } - return chunk2mem(p); - } - } - return 0; -} - -/* ------------------------ comalloc/coalloc support --------------------- */ - -static void** ialloc(mstate m, - size_t n_elements, - size_t* sizes, - int opts, - void* chunks[]) { - /* - This provides common support for independent_X routines, handling - all of the combinations that can result. - - The opts arg has: - bit 0 set if all elements are same size (using sizes[0]) - bit 1 set if elements should be zeroed - */ - - size_t element_size; /* chunksize of each element, if all same */ - size_t contents_size; /* total size of elements */ - size_t array_size; /* request size of pointer array */ - void* mem; /* malloced aggregate space */ - mchunkptr p; /* corresponding chunk */ - size_t remainder_size; /* remaining bytes while splitting */ - void** marray; /* either "chunks" or malloced ptr array */ - mchunkptr array_chunk; /* chunk for malloced ptr array */ - flag_t was_enabled; /* to disable mmap */ - size_t size; - size_t i; - - ensure_initialization(); - /* compute array length, if needed */ - if (chunks != 0) { - if (n_elements == 0) - return chunks; /* nothing to do */ - marray = chunks; - array_size = 0; - } - else { - /* if empty req, must still return chunk representing empty array */ - if (n_elements == 0) - return (void**)internal_malloc(m, 0); - marray = 0; - array_size = request2size(n_elements * (sizeof(void*))); - } - - /* compute total element size */ - if (opts & 0x1) { /* all-same-size */ - element_size = request2size(*sizes); - contents_size = n_elements * element_size; - } - else { /* add up all the sizes */ - element_size = 0; - contents_size = 0; - for (i = 0; i != n_elements; ++i) - contents_size += request2size(sizes[i]); - } - - size = contents_size + array_size; - - /* - Allocate the aggregate chunk. First disable direct-mmapping so - malloc won't use it, since we would not be able to later - free/realloc space internal to a segregated mmap region. - */ - was_enabled = use_mmap(m); - disable_mmap(m); - mem = internal_malloc(m, size - CHUNK_OVERHEAD); - if (was_enabled) - enable_mmap(m); - if (mem == 0) - return 0; - - if (PREACTION(m)) return 0; - p = mem2chunk(mem); - remainder_size = chunksize(p); - - assert(!is_mmapped(p)); - - if (opts & 0x2) { /* optionally clear the elements */ - memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size); - } - - /* If not provided, allocate the pointer array as final part of chunk */ - if (marray == 0) { - size_t array_chunk_size; - array_chunk = chunk_plus_offset(p, contents_size); - array_chunk_size = remainder_size - contents_size; - marray = (void**) (chunk2mem(array_chunk)); - set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size); - remainder_size = contents_size; - } - - /* split out elements */ - for (i = 0; ; ++i) { - marray[i] = chunk2mem(p); - if (i != n_elements-1) { - if (element_size != 0) - size = element_size; - else - size = request2size(sizes[i]); - remainder_size -= size; - set_size_and_pinuse_of_inuse_chunk(m, p, size); - p = chunk_plus_offset(p, size); - } - else { /* the final element absorbs any overallocation slop */ - set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size); - break; - } - } - -#if DEBUG - if (marray != chunks) { - /* final element must have exactly exhausted chunk */ - if (element_size != 0) { - assert(remainder_size == element_size); - } - else { - assert(remainder_size == request2size(sizes[i])); - } - check_inuse_chunk(m, mem2chunk(marray)); - } - for (i = 0; i != n_elements; ++i) - check_inuse_chunk(m, mem2chunk(marray[i])); - -#endif /* DEBUG */ - - POSTACTION(m); - return marray; -} - - -/* -------------------------- public routines ---------------------------- */ - -#if !ONLY_MSPACES - -void* dlmalloc(size_t bytes) { - /* - Basic algorithm: - If a small request (< 256 bytes minus per-chunk overhead): - 1. If one exists, use a remainderless chunk in associated smallbin. - (Remainderless means that there are too few excess bytes to - represent as a chunk.) - 2. If it is big enough, use the dv chunk, which is normally the - chunk adjacent to the one used for the most recent small request. - 3. If one exists, split the smallest available chunk in a bin, - saving remainder in dv. - 4. If it is big enough, use the top chunk. - 5. If available, get memory from system and use it - Otherwise, for a large request: - 1. Find the smallest available binned chunk that fits, and use it - if it is better fitting than dv chunk, splitting if necessary. - 2. If better fitting than any binned chunk, use the dv chunk. - 3. If it is big enough, use the top chunk. - 4. If request size >= mmap threshold, try to directly mmap this chunk. - 5. If available, get memory from system and use it - - The ugly goto's here ensure that postaction occurs along all paths. - */ - -#if USE_LOCKS - ensure_initialization(); /* initialize in sys_alloc if not using locks */ -#endif - - if (!PREACTION(gm)) { - void* mem; - size_t nb; - if (bytes <= MAX_SMALL_REQUEST) { - bindex_t idx; - binmap_t smallbits; - nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); - idx = small_index(nb); - smallbits = gm->smallmap >> idx; - - if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ - mchunkptr b, p; - idx += ~smallbits & 1; /* Uses next bin if idx empty */ - b = smallbin_at(gm, idx); - p = b->fd; - assert(chunksize(p) == small_index2size(idx)); - unlink_first_small_chunk(gm, b, p, idx); - set_inuse_and_pinuse(gm, p, small_index2size(idx)); - mem = chunk2mem(p); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - else if (nb > gm->dvsize) { - if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ - mchunkptr b, p, r; - size_t rsize; - bindex_t i; - binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); - binmap_t leastbit = least_bit(leftbits); - compute_bit2idx(leastbit, i); - b = smallbin_at(gm, i); - p = b->fd; - assert(chunksize(p) == small_index2size(i)); - unlink_first_small_chunk(gm, b, p, i); - rsize = small_index2size(i) - nb; - /* Fit here cannot be remainderless if 4byte sizes */ - if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(gm, p, small_index2size(i)); - else { - set_size_and_pinuse_of_inuse_chunk(gm, p, nb); - r = chunk_plus_offset(p, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - replace_dv(gm, r, rsize); - } - mem = chunk2mem(p); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) { - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - } - } - else if (bytes >= MAX_REQUEST) - nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ - else { - nb = pad_request(bytes); - if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) { - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - } - - if (nb <= gm->dvsize) { - size_t rsize = gm->dvsize - nb; - mchunkptr p = gm->dv; - if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ - mchunkptr r = gm->dv = chunk_plus_offset(p, nb); - gm->dvsize = rsize; - set_size_and_pinuse_of_free_chunk(r, rsize); - set_size_and_pinuse_of_inuse_chunk(gm, p, nb); - } - else { /* exhaust dv */ - size_t dvs = gm->dvsize; - gm->dvsize = 0; - gm->dv = 0; - set_inuse_and_pinuse(gm, p, dvs); - } - mem = chunk2mem(p); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - else if (nb < gm->topsize) { /* Split top */ - size_t rsize = gm->topsize -= nb; - mchunkptr p = gm->top; - mchunkptr r = gm->top = chunk_plus_offset(p, nb); - r->head = rsize | PINUSE_BIT; - set_size_and_pinuse_of_inuse_chunk(gm, p, nb); - mem = chunk2mem(p); - check_top_chunk(gm, gm->top); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - mem = sys_alloc(gm, nb); - - postaction: - POSTACTION(gm); - return mem; - } - - return 0; -} - -void dlfree(void* mem) { - /* - Consolidate freed chunks with preceeding or succeeding bordering - free chunks, if they exist, and then place in a bin. Intermixed - with special cases for top, dv, mmapped chunks, and usage errors. - */ - - if (mem != 0) { - mchunkptr p = mem2chunk(mem); -#if FOOTERS - mstate fm = get_mstate_for(p); - if (!ok_magic(fm)) { - USAGE_ERROR_ACTION(fm, p); - return; - } -#else /* FOOTERS */ -#define fm gm -#endif /* FOOTERS */ - if (!PREACTION(fm)) { - check_inuse_chunk(fm, p); - if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) { - size_t psize = chunksize(p); - mchunkptr next = chunk_plus_offset(p, psize); - if (!pinuse(p)) { - size_t prevsize = p->prev_foot; - if (is_mmapped(p)) { - psize += prevsize + MMAP_FOOT_PAD; - if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) - fm->footprint -= psize; - goto postaction; - } - else { - mchunkptr prev = chunk_minus_offset(p, prevsize); - psize += prevsize; - p = prev; - if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ - if (p != fm->dv) { - unlink_chunk(fm, p, prevsize); - } - else if ((next->head & INUSE_BITS) == INUSE_BITS) { - fm->dvsize = psize; - set_free_with_pinuse(p, psize, next); - goto postaction; - } - } - else - goto erroraction; - } - } - - if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { - if (!cinuse(next)) { /* consolidate forward */ - if (next == fm->top) { - size_t tsize = fm->topsize += psize; - fm->top = p; - p->head = tsize | PINUSE_BIT; - if (p == fm->dv) { - fm->dv = 0; - fm->dvsize = 0; - } - if (should_trim(fm, tsize)) - sys_trim(fm, 0); - goto postaction; - } - else if (next == fm->dv) { - size_t dsize = fm->dvsize += psize; - fm->dv = p; - set_size_and_pinuse_of_free_chunk(p, dsize); - goto postaction; - } - else { - size_t nsize = chunksize(next); - psize += nsize; - unlink_chunk(fm, next, nsize); - set_size_and_pinuse_of_free_chunk(p, psize); - if (p == fm->dv) { - fm->dvsize = psize; - goto postaction; - } - } - } - else - set_free_with_pinuse(p, psize, next); - - if (is_small(psize)) { - insert_small_chunk(fm, p, psize); - check_free_chunk(fm, p); - } - else { - tchunkptr tp = (tchunkptr)p; - insert_large_chunk(fm, tp, psize); - check_free_chunk(fm, p); - if (--fm->release_checks == 0) - release_unused_segments(fm); - } - goto postaction; - } - } - erroraction: - USAGE_ERROR_ACTION(fm, p); - postaction: - POSTACTION(fm); - } - } -#if !FOOTERS -#undef fm -#endif /* FOOTERS */ -} - -void* dlcalloc(size_t n_elements, size_t elem_size) { - void* mem; - size_t req = 0; - if (n_elements != 0) { - req = n_elements * elem_size; - if (((n_elements | elem_size) & ~(size_t)0xffff) && - (req / n_elements != elem_size)) - req = MAX_SIZE_T; /* force downstream failure on overflow */ - } - mem = dlmalloc(req); - if (mem != 0 && calloc_must_clear(mem2chunk(mem))) - memset(mem, 0, req); - return mem; -} - -void* dlrealloc(void* oldmem, size_t bytes) { - if (oldmem == 0) - return dlmalloc(bytes); -#ifdef REALLOC_ZERO_BYTES_FREES - if (bytes == 0) { - dlfree(oldmem); - return 0; - } -#endif /* REALLOC_ZERO_BYTES_FREES */ - else { -#if ! FOOTERS - mstate m = gm; -#else /* FOOTERS */ - mstate m = get_mstate_for(mem2chunk(oldmem)); - if (!ok_magic(m)) { - USAGE_ERROR_ACTION(m, oldmem); - return 0; - } -#endif /* FOOTERS */ - return internal_realloc(m, oldmem, bytes); - } -} - -void* dlmemalign(size_t alignment, size_t bytes) { - return internal_memalign(gm, alignment, bytes); -} - -void** dlindependent_calloc(size_t n_elements, size_t elem_size, - void* chunks[]) { - size_t sz = elem_size; /* serves as 1-element array */ - return ialloc(gm, n_elements, &sz, 3, chunks); -} - -void** dlindependent_comalloc(size_t n_elements, size_t sizes[], - void* chunks[]) { - return ialloc(gm, n_elements, sizes, 0, chunks); -} - -void* dlvalloc(size_t bytes) { - size_t pagesz; - ensure_initialization(); - pagesz = mparams.page_size; - return dlmemalign(pagesz, bytes); -} - -void* dlpvalloc(size_t bytes) { - size_t pagesz; - ensure_initialization(); - pagesz = mparams.page_size; - return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); -} - -int dlmalloc_trim(size_t pad) { - int result = 0; - ensure_initialization(); - if (!PREACTION(gm)) { - result = sys_trim(gm, pad); - POSTACTION(gm); - } - return result; -} - -size_t dlmalloc_footprint(void) { - return gm->footprint; -} - -size_t dlmalloc_max_footprint(void) { - return gm->max_footprint; -} - -#if !NO_MALLINFO -struct mallinfo dlmallinfo(void) { - return internal_mallinfo(gm); -} -#endif /* NO_MALLINFO */ - -void dlmalloc_stats() { - internal_malloc_stats(gm); -} - -int dlmallopt(int param_number, int value) { - return change_mparam(param_number, value); -} - -#endif /* !ONLY_MSPACES */ - -size_t dlmalloc_usable_size(void* mem) { - if (mem != 0) { - mchunkptr p = mem2chunk(mem); - if (is_inuse(p)) - return chunksize(p) - overhead_for(p); - } - return 0; -} - -/* ----------------------------- user mspaces ---------------------------- */ - -#if MSPACES - -static mstate init_user_mstate(char* tbase, size_t tsize) { - size_t msize = pad_request(sizeof(struct malloc_state)); - mchunkptr mn; - mchunkptr msp = align_as_chunk(tbase); - mstate m = (mstate)(chunk2mem(msp)); - memset(m, 0, msize); - INITIAL_LOCK(&m->mutex); - msp->head = (msize|INUSE_BITS); - m->seg.base = m->least_addr = tbase; - m->seg.size = m->footprint = m->max_footprint = tsize; - m->magic = mparams.magic; - m->release_checks = MAX_RELEASE_CHECK_RATE; - m->mflags = mparams.default_mflags; - m->extp = 0; - m->exts = 0; - disable_contiguous(m); - init_bins(m); - mn = next_chunk(mem2chunk(m)); - init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE); - check_top_chunk(m, m->top); - return m; -} - -mspace create_mspace(size_t capacity, int locked) { - mstate m = 0; - size_t msize; - ensure_initialization(); - msize = pad_request(sizeof(struct malloc_state)); - if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { - size_t rs = ((capacity == 0)? mparams.granularity : - (capacity + TOP_FOOT_SIZE + msize)); - size_t tsize = granularity_align(rs); - char* tbase = (char*)(CALL_MMAP(tsize)); - if (tbase != CMFAIL) { - m = init_user_mstate(tbase, tsize); - m->seg.sflags = USE_MMAP_BIT; - set_lock(m, locked); - } - } - return (mspace)m; -} - -mspace create_mspace_with_base(void* base, size_t capacity, int locked) { - mstate m = 0; - size_t msize; - ensure_initialization(); - msize = pad_request(sizeof(struct malloc_state)); - if (capacity > msize + TOP_FOOT_SIZE && - capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { - m = init_user_mstate((char*)base, capacity); - m->seg.sflags = EXTERN_BIT; - set_lock(m, locked); - } - return (mspace)m; -} - -int mspace_track_large_chunks(mspace msp, int enable) { - int ret = 0; - mstate ms = (mstate)msp; - if (!PREACTION(ms)) { - if (!use_mmap(ms)) - ret = 1; - if (!enable) - enable_mmap(ms); - else - disable_mmap(ms); - POSTACTION(ms); - } - return ret; -} - -size_t destroy_mspace(mspace msp) { - size_t freed = 0; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - msegmentptr sp = &ms->seg; - while (sp != 0) { - char* base = sp->base; - size_t size = sp->size; - flag_t flag = sp->sflags; - sp = sp->next; - if ((flag & USE_MMAP_BIT) && !(flag & EXTERN_BIT) && - CALL_MUNMAP(base, size) == 0) - freed += size; - } - } - else { - USAGE_ERROR_ACTION(ms,ms); - } - return freed; -} - -/* - mspace versions of routines are near-clones of the global - versions. This is not so nice but better than the alternatives. -*/ - - -void* mspace_malloc(mspace msp, size_t bytes) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - if (!PREACTION(ms)) { - void* mem; - size_t nb; - if (bytes <= MAX_SMALL_REQUEST) { - bindex_t idx; - binmap_t smallbits; - nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); - idx = small_index(nb); - smallbits = ms->smallmap >> idx; - - if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ - mchunkptr b, p; - idx += ~smallbits & 1; /* Uses next bin if idx empty */ - b = smallbin_at(ms, idx); - p = b->fd; - assert(chunksize(p) == small_index2size(idx)); - unlink_first_small_chunk(ms, b, p, idx); - set_inuse_and_pinuse(ms, p, small_index2size(idx)); - mem = chunk2mem(p); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - else if (nb > ms->dvsize) { - if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ - mchunkptr b, p, r; - size_t rsize; - bindex_t i; - binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); - binmap_t leastbit = least_bit(leftbits); - compute_bit2idx(leastbit, i); - b = smallbin_at(ms, i); - p = b->fd; - assert(chunksize(p) == small_index2size(i)); - unlink_first_small_chunk(ms, b, p, i); - rsize = small_index2size(i) - nb; - /* Fit here cannot be remainderless if 4byte sizes */ - if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(ms, p, small_index2size(i)); - else { - set_size_and_pinuse_of_inuse_chunk(ms, p, nb); - r = chunk_plus_offset(p, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - replace_dv(ms, r, rsize); - } - mem = chunk2mem(p); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) { - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - } - } - else if (bytes >= MAX_REQUEST) - nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ - else { - nb = pad_request(bytes); - if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) { - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - } - - if (nb <= ms->dvsize) { - size_t rsize = ms->dvsize - nb; - mchunkptr p = ms->dv; - if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ - mchunkptr r = ms->dv = chunk_plus_offset(p, nb); - ms->dvsize = rsize; - set_size_and_pinuse_of_free_chunk(r, rsize); - set_size_and_pinuse_of_inuse_chunk(ms, p, nb); - } - else { /* exhaust dv */ - size_t dvs = ms->dvsize; - ms->dvsize = 0; - ms->dv = 0; - set_inuse_and_pinuse(ms, p, dvs); - } - mem = chunk2mem(p); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - else if (nb < ms->topsize) { /* Split top */ - size_t rsize = ms->topsize -= nb; - mchunkptr p = ms->top; - mchunkptr r = ms->top = chunk_plus_offset(p, nb); - r->head = rsize | PINUSE_BIT; - set_size_and_pinuse_of_inuse_chunk(ms, p, nb); - mem = chunk2mem(p); - check_top_chunk(ms, ms->top); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - mem = sys_alloc(ms, nb); - - postaction: - POSTACTION(ms); - return mem; - } - - return 0; -} - -void mspace_free(mspace msp, void* mem) { - if (mem != 0) { - mchunkptr p = mem2chunk(mem); -#if FOOTERS - mstate fm = get_mstate_for(p); - msp = msp; /* placate people compiling -Wunused */ -#else /* FOOTERS */ - mstate fm = (mstate)msp; -#endif /* FOOTERS */ - if (!ok_magic(fm)) { - USAGE_ERROR_ACTION(fm, p); - return; - } - if (!PREACTION(fm)) { - check_inuse_chunk(fm, p); - if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) { - size_t psize = chunksize(p); - mchunkptr next = chunk_plus_offset(p, psize); - if (!pinuse(p)) { - size_t prevsize = p->prev_foot; - if (is_mmapped(p)) { - psize += prevsize + MMAP_FOOT_PAD; - if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) - fm->footprint -= psize; - goto postaction; - } - else { - mchunkptr prev = chunk_minus_offset(p, prevsize); - psize += prevsize; - p = prev; - if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ - if (p != fm->dv) { - unlink_chunk(fm, p, prevsize); - } - else if ((next->head & INUSE_BITS) == INUSE_BITS) { - fm->dvsize = psize; - set_free_with_pinuse(p, psize, next); - goto postaction; - } - } - else - goto erroraction; - } - } - - if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { - if (!cinuse(next)) { /* consolidate forward */ - if (next == fm->top) { - size_t tsize = fm->topsize += psize; - fm->top = p; - p->head = tsize | PINUSE_BIT; - if (p == fm->dv) { - fm->dv = 0; - fm->dvsize = 0; - } - if (should_trim(fm, tsize)) - sys_trim(fm, 0); - goto postaction; - } - else if (next == fm->dv) { - size_t dsize = fm->dvsize += psize; - fm->dv = p; - set_size_and_pinuse_of_free_chunk(p, dsize); - goto postaction; - } - else { - size_t nsize = chunksize(next); - psize += nsize; - unlink_chunk(fm, next, nsize); - set_size_and_pinuse_of_free_chunk(p, psize); - if (p == fm->dv) { - fm->dvsize = psize; - goto postaction; - } - } - } - else - set_free_with_pinuse(p, psize, next); - - if (is_small(psize)) { - insert_small_chunk(fm, p, psize); - check_free_chunk(fm, p); - } - else { - tchunkptr tp = (tchunkptr)p; - insert_large_chunk(fm, tp, psize); - check_free_chunk(fm, p); - if (--fm->release_checks == 0) - release_unused_segments(fm); - } - goto postaction; - } - } - erroraction: - USAGE_ERROR_ACTION(fm, p); - postaction: - POSTACTION(fm); - } - } -} - -void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) { - void* mem; - size_t req = 0; - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - if (n_elements != 0) { - req = n_elements * elem_size; - if (((n_elements | elem_size) & ~(size_t)0xffff) && - (req / n_elements != elem_size)) - req = MAX_SIZE_T; /* force downstream failure on overflow */ - } - mem = internal_malloc(ms, req); - if (mem != 0 && calloc_must_clear(mem2chunk(mem))) - memset(mem, 0, req); - return mem; -} - -void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) { - if (oldmem == 0) - return mspace_malloc(msp, bytes); -#ifdef REALLOC_ZERO_BYTES_FREES - if (bytes == 0) { - mspace_free(msp, oldmem); - return 0; - } -#endif /* REALLOC_ZERO_BYTES_FREES */ - else { -#if FOOTERS - mchunkptr p = mem2chunk(oldmem); - mstate ms = get_mstate_for(p); -#else /* FOOTERS */ - mstate ms = (mstate)msp; -#endif /* FOOTERS */ - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return internal_realloc(ms, oldmem, bytes); - } -} - -void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return internal_memalign(ms, alignment, bytes); -} - -void** mspace_independent_calloc(mspace msp, size_t n_elements, - size_t elem_size, void* chunks[]) { - size_t sz = elem_size; /* serves as 1-element array */ - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return ialloc(ms, n_elements, &sz, 3, chunks); -} - -void** mspace_independent_comalloc(mspace msp, size_t n_elements, - size_t sizes[], void* chunks[]) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return ialloc(ms, n_elements, sizes, 0, chunks); -} - -int mspace_trim(mspace msp, size_t pad) { - int result = 0; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - if (!PREACTION(ms)) { - result = sys_trim(ms, pad); - POSTACTION(ms); - } - } - else { - USAGE_ERROR_ACTION(ms,ms); - } - return result; -} - -void mspace_malloc_stats(mspace msp) { - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - internal_malloc_stats(ms); - } - else { - USAGE_ERROR_ACTION(ms,ms); - } -} - -size_t mspace_footprint(mspace msp) { - size_t result = 0; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - result = ms->footprint; - } - else { - USAGE_ERROR_ACTION(ms,ms); - } - return result; -} - - -size_t mspace_max_footprint(mspace msp) { - size_t result = 0; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - result = ms->max_footprint; - } - else { - USAGE_ERROR_ACTION(ms,ms); - } - return result; -} - - -#if !NO_MALLINFO -struct mallinfo mspace_mallinfo(mspace msp) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - } - return internal_mallinfo(ms); -} -#endif /* NO_MALLINFO */ - -size_t mspace_usable_size(void* mem) { - if (mem != 0) { - mchunkptr p = mem2chunk(mem); - if (is_inuse(p)) - return chunksize(p) - overhead_for(p); - } - return 0; -} - -int mspace_mallopt(int param_number, int value) { - return change_mparam(param_number, value); -} - -#endif /* MSPACES */ - - -/* -------------------- Alternative MORECORE functions ------------------- */ - -/* - Guidelines for creating a custom version of MORECORE: - - * For best performance, MORECORE should allocate in multiples of pagesize. - * MORECORE may allocate more memory than requested. (Or even less, - but this will usually result in a malloc failure.) - * MORECORE must not allocate memory when given argument zero, but - instead return one past the end address of memory from previous - nonzero call. - * For best performance, consecutive calls to MORECORE with positive - arguments should return increasing addresses, indicating that - space has been contiguously extended. - * Even though consecutive calls to MORECORE need not return contiguous - addresses, it must be OK for malloc'ed chunks to span multiple - regions in those cases where they do happen to be contiguous. - * MORECORE need not handle negative arguments -- it may instead - just return MFAIL when given negative arguments. - Negative arguments are always multiples of pagesize. MORECORE - must not misinterpret negative args as large positive unsigned - args. You can suppress all such calls from even occurring by defining - MORECORE_CANNOT_TRIM, - - As an example alternative MORECORE, here is a custom allocator - kindly contributed for pre-OSX macOS. It uses virtually but not - necessarily physically contiguous non-paged memory (locked in, - present and won't get swapped out). You can use it by uncommenting - this section, adding some #includes, and setting up the appropriate - defines above: - - #define MORECORE osMoreCore - - There is also a shutdown routine that should somehow be called for - cleanup upon program exit. - - #define MAX_POOL_ENTRIES 100 - #define MINIMUM_MORECORE_SIZE (64 * 1024U) - static int next_os_pool; - void *our_os_pools[MAX_POOL_ENTRIES]; - - void *osMoreCore(int size) - { - void *ptr = 0; - static void *sbrk_top = 0; - - if (size > 0) - { - if (size < MINIMUM_MORECORE_SIZE) - size = MINIMUM_MORECORE_SIZE; - if (CurrentExecutionLevel() == kTaskLevel) - ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); - if (ptr == 0) - { - return (void *) MFAIL; - } - // save ptrs so they can be freed during cleanup - our_os_pools[next_os_pool] = ptr; - next_os_pool++; - ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); - sbrk_top = (char *) ptr + size; - return ptr; - } - else if (size < 0) - { - // we don't currently support shrink behavior - return (void *) MFAIL; - } - else - { - return sbrk_top; - } - } - - // cleanup any allocated memory pools - // called as last thing before shutting down driver - - void osCleanupMem(void) - { - void **ptr; - - for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) - if (*ptr) - { - PoolDeallocate(*ptr); - *ptr = 0; - } - } - -*/ - - -/* ----------------------------------------------------------------------- -History: - V2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee) - * Use zeros instead of prev foot for is_mmapped - * Add mspace_track_large_chunks; thanks to Jean Brouwers - * Fix set_inuse in internal_realloc; thanks to Jean Brouwers - * Fix insufficient sys_alloc padding when using 16byte alignment - * Fix bad error check in mspace_footprint - * Adaptations for ptmalloc; thanks to Wolfram Gloger. - * Reentrant spin locks; thanks to Earl Chew and others - * Win32 improvements; thanks to Niall Douglas and Earl Chew - * Add NO_SEGMENT_TRAVERSAL and MAX_RELEASE_CHECK_RATE options - * Extension hook in malloc_state - * Various small adjustments to reduce warnings on some compilers - * Various configuration extensions/changes for more platforms. Thanks - to all who contributed these. - - V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee) - * Add max_footprint functions - * Ensure all appropriate literals are size_t - * Fix conditional compilation problem for some #define settings - * Avoid concatenating segments with the one provided - in create_mspace_with_base - * Rename some variables to avoid compiler shadowing warnings - * Use explicit lock initialization. - * Better handling of sbrk interference. - * Simplify and fix segment insertion, trimming and mspace_destroy - * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x - * Thanks especially to Dennis Flanagan for help on these. - - V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee) - * Fix memalign brace error. - - V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee) - * Fix improper #endif nesting in C++ - * Add explicit casts needed for C++ - - V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee) - * Use trees for large bins - * Support mspaces - * Use segments to unify sbrk-based and mmap-based system allocation, - removing need for emulation on most platforms without sbrk. - * Default safety checks - * Optional footer checks. Thanks to William Robertson for the idea. - * Internal code refactoring - * Incorporate suggestions and platform-specific changes. - Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas, - Aaron Bachmann, Emery Berger, and others. - * Speed up non-fastbin processing enough to remove fastbins. - * Remove useless cfree() to avoid conflicts with other apps. - * Remove internal memcpy, memset. Compilers handle builtins better. - * Remove some options that no one ever used and rename others. - - V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) - * Fix malloc_state bitmap array misdeclaration - - V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee) - * Allow tuning of FIRST_SORTED_BIN_SIZE - * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte. - * Better detection and support for non-contiguousness of MORECORE. - Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger - * Bypass most of malloc if no frees. Thanks To Emery Berger. - * Fix freeing of old top non-contiguous chunk im sysmalloc. - * Raised default trim and map thresholds to 256K. - * Fix mmap-related #defines. Thanks to Lubos Lunak. - * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield. - * Branch-free bin calculation - * Default trim and mmap thresholds now 256K. - - V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) - * Introduce independent_comalloc and independent_calloc. - Thanks to Michael Pachos for motivation and help. - * Make optional .h file available - * Allow > 2GB requests on 32bit systems. - * new WIN32 sbrk, mmap, munmap, lock code from . - Thanks also to Andreas Mueller , - and Anonymous. - * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for - helping test this.) - * memalign: check alignment arg - * realloc: don't try to shift chunks backwards, since this - leads to more fragmentation in some programs and doesn't - seem to help in any others. - * Collect all cases in malloc requiring system memory into sysmalloc - * Use mmap as backup to sbrk - * Place all internal state in malloc_state - * Introduce fastbins (although similar to 2.5.1) - * Many minor tunings and cosmetic improvements - * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK - * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS - Thanks to Tony E. Bennett and others. - * Include errno.h to support default failure action. - - V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) - * return null for negative arguments - * Added Several WIN32 cleanups from Martin C. Fong - * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' - (e.g. WIN32 platforms) - * Cleanup header file inclusion for WIN32 platforms - * Cleanup code to avoid Microsoft Visual C++ compiler complaints - * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing - memory allocation routines - * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) - * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to - usage of 'assert' in non-WIN32 code - * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to - avoid infinite loop - * Always call 'fREe()' rather than 'free()' - - V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) - * Fixed ordering problem with boundary-stamping - - V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) - * Added pvalloc, as recommended by H.J. Liu - * Added 64bit pointer support mainly from Wolfram Gloger - * Added anonymously donated WIN32 sbrk emulation - * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen - * malloc_extend_top: fix mask error that caused wastage after - foreign sbrks - * Add linux mremap support code from HJ Liu - - V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) - * Integrated most documentation with the code. - * Add support for mmap, with help from - Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Use last_remainder in more cases. - * Pack bins using idea from colin@nyx10.cs.du.edu - * Use ordered bins instead of best-fit threshhold - * Eliminate block-local decls to simplify tracing and debugging. - * Support another case of realloc via move into top - * Fix error occuring when initial sbrk_base not word-aligned. - * Rely on page size for units instead of SBRK_UNIT to - avoid surprises about sbrk alignment conventions. - * Add mallinfo, mallopt. Thanks to Raymond Nijssen - (raymond@es.ele.tue.nl) for the suggestion. - * Add `pad' argument to malloc_trim and top_pad mallopt parameter. - * More precautions for cases where other routines call sbrk, - courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Added macros etc., allowing use in linux libc from - H.J. Lu (hjl@gnu.ai.mit.edu) - * Inverted this history list - - V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) - * Re-tuned and fixed to behave more nicely with V2.6.0 changes. - * Removed all preallocation code since under current scheme - the work required to undo bad preallocations exceeds - the work saved in good cases for most test programs. - * No longer use return list or unconsolidated bins since - no scheme using them consistently outperforms those that don't - given above changes. - * Use best fit for very large chunks to prevent some worst-cases. - * Added some support for debugging - - V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) - * Removed footers when chunks are in use. Thanks to - Paul Wilson (wilson@cs.texas.edu) for the suggestion. - - V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) - * Added malloc_trim, with help from Wolfram Gloger - (wmglo@Dent.MED.Uni-Muenchen.DE). - - V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) - - V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) - * realloc: try to expand in both directions - * malloc: swap order of clean-bin strategy; - * realloc: only conditionally expand backwards - * Try not to scavenge used bins - * Use bin counts as a guide to preallocation - * Occasionally bin return list chunks in first scan - * Add a few optimizations from colin@nyx10.cs.du.edu - - V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) - * faster bin computation & slightly different binning - * merged all consolidations to one part of malloc proper - (eliminating old malloc_find_space & malloc_clean_bin) - * Scan 2 returns chunks (not just 1) - * Propagate failure in realloc if malloc returns 0 - * Add stuff to allow compilation on non-ANSI compilers - from kpv@research.att.com - - V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) - * removed potential for odd address access in prev_chunk - * removed dependency on getpagesize.h - * misc cosmetics and a bit more internal documentation - * anticosmetics: mangled names in macros to evade debugger strangeness - * tested on sparc, hp-700, dec-mips, rs6000 - with gcc & native cc (hp, dec only) allowing - Detlefs & Zorn comparison study (in SIGPLAN Notices.) - - Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) - * Based loosely on libg++-1.2X malloc. (It retains some of the overall - structure of old version, but most details differ.) - -*/ - diff --git a/polymer-perf/eduke32/build/include/md4.h b/polymer-perf/eduke32/build/include/md4.h deleted file mode 100644 index fdb23b4f7..000000000 --- a/polymer-perf/eduke32/build/include/md4.h +++ /dev/null @@ -1,38 +0,0 @@ -/* MD4.H - header file for MD4C.C - Modified from original version published in RFC1320 by - Jonathon Fowler (jonof@edgenetwork.org) - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD4 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD4 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -/* MD4 context. */ -typedef struct { - unsigned int state[4]; /* state (ABCD) */ - unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} MD4_CTX; - -void md4once(unsigned char *block, unsigned int len, unsigned char digest[16]); -void md4init(MD4_CTX *); -void md4block(MD4_CTX *, unsigned char *, unsigned int); -void md4finish(unsigned char [16], MD4_CTX *); diff --git a/polymer-perf/eduke32/build/include/mdsprite.h b/polymer-perf/eduke32/build/include/mdsprite.h deleted file mode 100644 index 22638bec3..000000000 --- a/polymer-perf/eduke32/build/include/mdsprite.h +++ /dev/null @@ -1,248 +0,0 @@ -#ifndef _mdsprite_h_ -# define _mdsprite_h_ - -#include "hightile.h" - -#ifdef __POWERPC__ -#define SHIFTMOD32(a) ((a)&31) -#else -#define SHIFTMOD32(a) (a) -#endif - -typedef struct -{ - int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int32_t shadeoff; - float scale, bscale, zadd; - GLuint *texid; // skins - int32_t flags; -} mdmodel_t; - -typedef struct _mdanim_t -{ - int32_t startframe, endframe; - int32_t fpssc, flags; - struct _mdanim_t *next; -} mdanim_t; -#define MDANIM_LOOP 0 -#define MDANIM_ONESHOT 1 - -typedef struct _mdskinmap_t -{ - uint8_t palette, filler[3]; // Build palette number - int32_t skinnum, surfnum; // Skin identifier, surface number - char *fn; // Skin filename - GLuint texid[HICEFFECTMASK+1]; // OpenGL texture numbers for effect variations - struct _mdskinmap_t *next; - float param, specpower, specfactor; -} mdskinmap_t; - - -//This MD2 code is based on the source code from David Henry (tfc_duke(at)hotmail.com) -// Was at http://tfc.duke.free.fr/us/tutorials/models/md2.htm -// Available from http://web.archive.org/web/20030816010242/http://tfc.duke.free.fr/us/tutorials/models/md2.htm -// Now at http://tfc.duke.free.fr/coding/md2.html (in French) -//He probably wouldn't recognize it if he looked at it though :) -typedef struct { float x, y, z; } point3d; - -typedef struct -{ - int32_t id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8 - int32_t numskins, numverts, numuv, numtris, numglcmds, numframes; - int32_t ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each) -} md2head_t; - -typedef struct { uint8_t v[3], ni; } md2vert_t; //compressed vertex coords (x,y,z) -typedef struct -{ - point3d mul, add; //scale&translation vector - char name[16]; //frame name - md2vert_t verts[1]; //first vertex of this frame -} md2frame_t; - -typedef struct { int16_t u, v; } md2uv_t; -typedef struct -{ - uint16_t v[3]; - uint16_t u[3]; -} md2tri_t; - -typedef struct -{ - //WARNING: This top block is a union between md2model&md3model: Make sure it matches! - int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int32_t shadeoff; - float scale, bscale, zadd; - GLuint *texid; // texture ids for base skin if no mappings defined - int32_t flags; - - int32_t numframes, cframe, nframe, fpssc, usesalpha; - float oldtime, curtime, interpol; - mdanim_t *animations; - mdskinmap_t *skinmap; - int32_t numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified, - - //MD2 specific stuff: - int32_t numverts, numglcmds, framebytes, *glcmds; - char *frames; - char *basepath; // pointer to string of base path - char *skinfn; // pointer to first of numskins 64-char strings - md2uv_t *uv; - md2tri_t* tris; -} md2model_t; - - -typedef struct { char nam[64]; int32_t i; } md3shader_t; //ascz path of shader, shader index -typedef struct { int32_t i[3]; } md3tri_t; //indices of tri -typedef struct { float u, v; } md3uv_t; -typedef struct { int16_t x, y, z; uint8_t nlat, nlng; } md3xyzn_t; //xyz are [10:6] ints - -typedef struct -{ - point3d min, max, cen; //bounding box&origin - float r; //radius of bounding sphere - char nam[16]; //ascz frame name -} md3frame_t; - -typedef struct -{ - char nam[64]; //ascz tag name - point3d p, x, y, z; //tag object pos&orient -} md3tag_t; - -typedef struct -{ - int32_t id; //IDP3(0x33806873) - char nam[64]; //ascz surface name - int32_t flags; //? - int32_t numframes, numshaders, numverts, numtris; //numframes same as md3head,max shade=~256,vert=~4096,tri=~8192 - int32_t ofstris; - int32_t ofsshaders; - int32_t ofsuv; - int32_t ofsxyzn; - int32_t ofsend; - // DO NOT read directly to this structure - // the following block is NOT in the file format - // be sure to use the SIZEOF_MD3SURF_T macro - md3tri_t *tris; - md3shader_t *shaders; - md3uv_t *uv; - md3xyzn_t *xyzn; - float *geometry; -} md3surf_t; - -#define SIZEOF_MD3SURF_T (11*sizeof(int32_t) + 64*sizeof(char)) - -typedef struct -{ - int32_t id, vers; //id=IDP3(0x33806873), vers=15 - char nam[64]; //ascz path in PK3 - int32_t flags; //? - int32_t numframes, numtags, numsurfs, numskins; //max=~1024,~16,~32,numskins=artifact of MD2; use shader field instead - int32_t ofsframes; - int32_t ofstags; - int32_t ofssurfs; - int32_t eof; - // DO NOT read directly to this structure - // the following block is NOT in the file format - // be sure to use the SIZEOF_MD3HEAD_T macro - md3frame_t *frames; - md3tag_t *tags; - md3surf_t *surfs; -} md3head_t; - -#define SIZEOF_MD3HEAD_T (sizeof(md3head_t)-3*sizeof(void*)) - -typedef struct -{ - //WARNING: This top block is a union between md2model&md3model: Make sure it matches! - int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int32_t shadeoff; - float scale, bscale, zadd; - uint32_t *texid; // texture ids for base skin if no mappings defined - int32_t flags; - - int32_t numframes, cframe, nframe, fpssc, usesalpha; - float oldtime, curtime, interpol; - mdanim_t *animations; - mdskinmap_t *skinmap; - int32_t numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified, - - //MD3 specific - md3head_t head; - point3d *muladdframes; - uint16_t *indexes; - uint16_t *vindexes; - float *maxdepths; - GLuint* vbos; - // polymer VBO names after that, allocated per surface - GLuint* indices; - GLuint* texcoords; - GLuint* geometry; -} md3model_t; - -#define VOXBORDWIDTH 1 //use 0 to save memory, but has texture artifacts; 1 looks better... -#define VOXUSECHAR 0 -#if (VOXUSECHAR != 0) -typedef struct { uint8_t x, y, z, u, v; } vert_t; -#else -typedef struct { uint16_t x, y, z, u, v; } vert_t; -#endif -typedef struct { vert_t v[4]; } voxrect_t; -typedef struct -{ - //WARNING: This top block is a union of md2model,md3model,voxmodel: Make sure it matches! - int32_t mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure! - int32_t shadeoff; - float scale, bscale, zadd; - uint32_t *texid; // skins for palettes - int32_t flags; - - //VOX specific stuff: - voxrect_t *quad; int32_t qcnt, qfacind[7]; - int32_t *mytex, mytexx, mytexy; - int32_t xsiz, ysiz, zsiz; - float xpiv, ypiv, zpiv; - int32_t is8bit; -} voxmodel_t; - -/* -typedef struct -{ - // maps build tiles to particular animation frames of a model - int32_t modelid; - int32_t skinnum; - int32_t framenum; // calculate the number from the name when declaring - float smoothduration; - int32_t next; - char pal; -} tile2model_t; - -#define EXTRATILES MAXTILES -EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES]; -*/ - -EXTERN mdmodel_t **models; - -void updateanimation(md2model_t *m, spritetype *tspr); -int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf); -void mdinit(void); -void freeallmodels(void); -void clearskins(void); -int32_t mddraw(spritetype *tspr); - -typedef struct { float xadd, yadd, zadd; int16_t angadd, flags, fov; } hudtyp; - -EXTERN hudtyp hudmem[2][MAXTILES]; - -EXTERN int32_t mdpause; -EXTERN int32_t nummodelsalloced, nextmodelid; -EXTERN voxmodel_t *voxmodels[MAXVOXELS]; - -void voxfree(voxmodel_t *m); -voxmodel_t *voxload(const char *filnam); -int32_t voxdraw(voxmodel_t *m, spritetype *tspr); - -int md3postload_polymer(md3model_t* m); - -#endif // !_mdsprite_h_ diff --git a/polymer-perf/eduke32/build/include/msvc/inttypes.h b/polymer-perf/eduke32/build/include/msvc/inttypes.h deleted file mode 100644 index 4b3828a21..000000000 --- a/polymer-perf/eduke32/build/include/msvc/inttypes.h +++ /dev/null @@ -1,305 +0,0 @@ -// ISO C9x compliant inttypes.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_INTTYPES_H_ // [ -#define _MSC_INTTYPES_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include "stdint.h" - -// 7.8 Format conversion of integer types - -typedef struct { - intmax_t quot; - intmax_t rem; -} imaxdiv_t; - -// 7.8.1 Macros for format specifiers - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 - -// The fprintf macros for signed integers are: -#define PRId8 "d" -#define PRIi8 "i" -#define PRIdLEAST8 "d" -#define PRIiLEAST8 "i" -#define PRIdFAST8 "d" -#define PRIiFAST8 "i" - -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIdLEAST16 "hd" -#define PRIiLEAST16 "hi" -#define PRIdFAST16 "hd" -#define PRIiFAST16 "hi" - -#define PRId32 "I32d" -#define PRIi32 "I32i" -#define PRIdLEAST32 "I32d" -#define PRIiLEAST32 "I32i" -#define PRIdFAST32 "I32d" -#define PRIiFAST32 "I32i" - -#define PRId64 "I64d" -#define PRIi64 "I64i" -#define PRIdLEAST64 "I64d" -#define PRIiLEAST64 "I64i" -#define PRIdFAST64 "I64d" -#define PRIiFAST64 "I64i" - -#define PRIdMAX "I64d" -#define PRIiMAX "I64i" - -#define PRIdPTR "Id" -#define PRIiPTR "Ii" - -// The fprintf macros for unsigned integers are: -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRIoLEAST8 "o" -#define PRIuLEAST8 "u" -#define PRIxLEAST8 "x" -#define PRIXLEAST8 "X" -#define PRIoFAST8 "o" -#define PRIuFAST8 "u" -#define PRIxFAST8 "x" -#define PRIXFAST8 "X" - -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" -#define PRIoLEAST16 "ho" -#define PRIuLEAST16 "hu" -#define PRIxLEAST16 "hx" -#define PRIXLEAST16 "hX" -#define PRIoFAST16 "ho" -#define PRIuFAST16 "hu" -#define PRIxFAST16 "hx" -#define PRIXFAST16 "hX" - -#define PRIo32 "I32o" -#define PRIu32 "I32u" -#define PRIx32 "I32x" -#define PRIX32 "I32X" -#define PRIoLEAST32 "I32o" -#define PRIuLEAST32 "I32u" -#define PRIxLEAST32 "I32x" -#define PRIXLEAST32 "I32X" -#define PRIoFAST32 "I32o" -#define PRIuFAST32 "I32u" -#define PRIxFAST32 "I32x" -#define PRIXFAST32 "I32X" - -#define PRIo64 "I64o" -#define PRIu64 "I64u" -#define PRIx64 "I64x" -#define PRIX64 "I64X" -#define PRIoLEAST64 "I64o" -#define PRIuLEAST64 "I64u" -#define PRIxLEAST64 "I64x" -#define PRIXLEAST64 "I64X" -#define PRIoFAST64 "I64o" -#define PRIuFAST64 "I64u" -#define PRIxFAST64 "I64x" -#define PRIXFAST64 "I64X" - -#define PRIoMAX "I64o" -#define PRIuMAX "I64u" -#define PRIxMAX "I64x" -#define PRIXMAX "I64X" - -#define PRIoPTR "Io" -#define PRIuPTR "Iu" -#define PRIxPTR "Ix" -#define PRIXPTR "IX" - -// The fscanf macros for signed integers are: -#define SCNd8 "d" -#define SCNi8 "i" -#define SCNdLEAST8 "d" -#define SCNiLEAST8 "i" -#define SCNdFAST8 "d" -#define SCNiFAST8 "i" - -#define SCNd16 "hd" -#define SCNi16 "hi" -#define SCNdLEAST16 "hd" -#define SCNiLEAST16 "hi" -#define SCNdFAST16 "hd" -#define SCNiFAST16 "hi" - -#define SCNd32 "ld" -#define SCNi32 "li" -#define SCNdLEAST32 "ld" -#define SCNiLEAST32 "li" -#define SCNdFAST32 "ld" -#define SCNiFAST32 "li" - -#define SCNd64 "I64d" -#define SCNi64 "I64i" -#define SCNdLEAST64 "I64d" -#define SCNiLEAST64 "I64i" -#define SCNdFAST64 "I64d" -#define SCNiFAST64 "I64i" - -#define SCNdMAX "I64d" -#define SCNiMAX "I64i" - -#ifdef _WIN64 // [ -# define SCNdPTR "I64d" -# define SCNiPTR "I64i" -#else // _WIN64 ][ -# define SCNdPTR "ld" -# define SCNiPTR "li" -#endif // _WIN64 ] - -// The fscanf macros for unsigned integers are: -#define SCNo8 "o" -#define SCNu8 "u" -#define SCNx8 "x" -#define SCNX8 "X" -#define SCNoLEAST8 "o" -#define SCNuLEAST8 "u" -#define SCNxLEAST8 "x" -#define SCNXLEAST8 "X" -#define SCNoFAST8 "o" -#define SCNuFAST8 "u" -#define SCNxFAST8 "x" -#define SCNXFAST8 "X" - -#define SCNo16 "ho" -#define SCNu16 "hu" -#define SCNx16 "hx" -#define SCNX16 "hX" -#define SCNoLEAST16 "ho" -#define SCNuLEAST16 "hu" -#define SCNxLEAST16 "hx" -#define SCNXLEAST16 "hX" -#define SCNoFAST16 "ho" -#define SCNuFAST16 "hu" -#define SCNxFAST16 "hx" -#define SCNXFAST16 "hX" - -#define SCNo32 "lo" -#define SCNu32 "lu" -#define SCNx32 "lx" -#define SCNX32 "lX" -#define SCNoLEAST32 "lo" -#define SCNuLEAST32 "lu" -#define SCNxLEAST32 "lx" -#define SCNXLEAST32 "lX" -#define SCNoFAST32 "lo" -#define SCNuFAST32 "lu" -#define SCNxFAST32 "lx" -#define SCNXFAST32 "lX" - -#define SCNo64 "I64o" -#define SCNu64 "I64u" -#define SCNx64 "I64x" -#define SCNX64 "I64X" -#define SCNoLEAST64 "I64o" -#define SCNuLEAST64 "I64u" -#define SCNxLEAST64 "I64x" -#define SCNXLEAST64 "I64X" -#define SCNoFAST64 "I64o" -#define SCNuFAST64 "I64u" -#define SCNxFAST64 "I64x" -#define SCNXFAST64 "I64X" - -#define SCNoMAX "I64o" -#define SCNuMAX "I64u" -#define SCNxMAX "I64x" -#define SCNXMAX "I64X" - -#ifdef _WIN64 // [ -# define SCNoPTR "I64o" -# define SCNuPTR "I64u" -# define SCNxPTR "I64x" -# define SCNXPTR "I64X" -#else // _WIN64 ][ -# define SCNoPTR "lo" -# define SCNuPTR "lu" -# define SCNxPTR "lx" -# define SCNXPTR "lX" -#endif // _WIN64 ] - -#endif // __STDC_FORMAT_MACROS ] - -// 7.8.2 Functions for greatest-width integer types - -// 7.8.2.1 The imaxabs function -#define imaxabs _abs64 - -// 7.8.2.2 The imaxdiv function - -// This is modified version of div() function from Microsoft's div.c found -// in %MSVC.NET%\crt\src\div.c -#ifdef STATIC_IMAXDIV // [ -static -#else // STATIC_IMAXDIV ][ -_inline -#endif // STATIC_IMAXDIV ] -imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -{ - imaxdiv_t result; - - result.quot = numer / denom; - result.rem = numer % denom; - - if (numer < 0 && result.rem > 0) { - // did division wrong; must fix up - ++result.quot; - result.rem -= denom; - } - - return result; -} - -// 7.8.2.3 The strtoimax and strtoumax functions -#define strtoimax _strtoi64 -#define strtoumax _strtoui64 - -// 7.8.2.4 The wcstoimax and wcstoumax functions -#define wcstoimax _wcstoi64 -#define wcstoumax _wcstoui64 - - -#endif // _MSC_INTTYPES_H_ ] diff --git a/polymer-perf/eduke32/build/include/msvc/stdint.h b/polymer-perf/eduke32/build/include/msvc/stdint.h deleted file mode 100644 index d02608a59..000000000 --- a/polymer-perf/eduke32/build/include/msvc/stdint.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/polymer-perf/eduke32/build/include/mutex.h b/polymer-perf/eduke32/build/include/mutex.h deleted file mode 100644 index e927361c7..000000000 --- a/polymer-perf/eduke32/build/include/mutex.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __mutex_h__ -#define __mutex_h__ - -#if defined(_WIN32) -#include -#include -#else -#include -#endif - -#if defined(_WIN32) -typedef HANDLE mutex_t; -#else -typedef pthread_mutex_t mutex_t; -#endif - -extern int32_t mutex_init(mutex_t *mutex); -extern int32_t mutex_lock(mutex_t *mutex); -extern int32_t mutex_unlock(mutex_t *mutex); - -#endif diff --git a/polymer-perf/eduke32/build/include/nedmalloc.h b/polymer-perf/eduke32/build/include/nedmalloc.h deleted file mode 100644 index 4ea9d93ff..000000000 --- a/polymer-perf/eduke32/build/include/nedmalloc.h +++ /dev/null @@ -1,302 +0,0 @@ -/* nedalloc, an alternative malloc implementation for multiple threads without -lock contention based on dlmalloc v2.8.3. (C) 2005-2009 Niall Douglas - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - -#ifndef NEDMALLOC_H -#define NEDMALLOC_H - - -/* See malloc.c.h for what each function does. - -REPLACE_SYSTEM_ALLOCATOR on POSIX causes nedalloc's functions to be called -malloc, free etc. instead of nedmalloc, nedfree etc. You may or may not want -this. On Windows it causes nedmalloc to patch all loaded DLLs and binaries -to replace usage of the system allocator. - -NO_NED_NAMESPACE prevents the functions from being defined in the nedalloc -namespace when in C++ (uses the global namespace instead). - -NEDMALLOCEXTSPEC can be defined to be __declspec(dllexport) or -__attribute__ ((visibility("default"))) or whatever you like. It defaults -to extern unless NEDMALLOC_DLL_EXPORTS is set as it would be when building -nedmalloc.dll. - -USE_LOCKS can be 2 if you want to define your own MLOCK_T, INITIAL_LOCK, -ACQUIRE_LOCK, RELEASE_LOCK, TRY_LOCK, IS_LOCKED and NULL_LOCK_INITIALIZER. - -NEDMALLOC_DEBUG can be defined to cause DEBUG to be set differently for nedmalloc -than for the rest of the build. Remember to set NDEBUG to disable all assertion -checking too. - -USE_MAGIC_HEADERS causes nedalloc to allocate an extra three sizeof(size_t) -to each block. nedpfree() and nedprealloc() can then automagically know when -to free a system allocated block. Enabling this typically adds 20-50% to -application memory usage. - -ENABLE_TOLERANT_NEDMALLOC is automatically turned on if REPLACE_SYSTEM_ALLOCATOR -is set or the Windows DLL is being built. This causes nedmalloc to detect when a -system allocator block is passed to it and to handle it appropriately. Note that -without USE_MAGIC_HEADERS there is a very tiny chance that nedmalloc will segfault -on non-Windows builds (it uses Win32 SEH to trap segfaults on Windows and there -is no comparable system on POSIX). - -USE_ALLOCATOR can be one of these settings (it defaults to 1): - 0: System allocator (nedmalloc now simply acts as a threadcache). - WARNING: Intended for DEBUG USE ONLY - not all functions work correctly. - 1: dlmalloc - -ENABLE_LARGE_PAGES enables support for requesting memory from the system in large -(typically >=2Mb) pages if the host OS supports this. These occupy just a single -TLB entry and can significantly improve performance in large working set applications. - -ENABLE_FAST_HEAP_DETECTION enables special logic to detect blocks allocated -by the system heap. This avoids 1.5%-2% overhead when checking for non-nedmalloc -blocks, but it assumes that the NT and glibc heaps function in a very specific -fashion which may not hold true across OS upgrades. -*/ - -#include /* for size_t */ - -#define USE_ALLOCATOR 1 -#define USE_MAGIC_HEADERS 1 -#define MAXTHREADSINPOOL 2 -#define FINEGRAINEDBINS 1 -#define ENABLE_LARGE_PAGES 1 -#define ENABLE_FAST_HEAP_DETECTION 1 -#define NDEBUG 1 -#define THREADCACHEMAX 4194304 -#define THREADCACHEMAXBINS ((22-4)*2) - -#ifndef NEDMALLOCEXTSPEC - #ifdef NEDMALLOC_DLL_EXPORTS - #ifdef WIN32 - #define NEDMALLOCEXTSPEC extern __declspec(dllexport) - #elif defined(__GNUC__) - #define NEDMALLOCEXTSPEC extern __attribute__ ((visibility("default"))) - #endif - #ifndef ENABLE_TOLERANT_NEDMALLOC - #define ENABLE_TOLERANT_NEDMALLOC 1 - #endif - #else - #define NEDMALLOCEXTSPEC extern - #endif -#endif - -#if __STDC_VERSION__ >= 199901L /* C99 or better */ - #define RESTRICT restrict -#else - #if defined(_MSC_VER) && _MSC_VER>=1400 - #define RESTRICT __restrict - #endif - #ifdef __GNUC__ - #define RESTRICT __restrict - #endif -#endif -#ifndef RESTRICT - #define RESTRICT -#endif - -#if defined(_MSC_VER) && _MSC_VER>=1400 - #define NEDMALLOCPTRATTR __declspec(restrict) - #define NEDMALLOCNOALIASATTR __declspec(noalias) -#endif -#ifdef __GNUC__ - #define NEDMALLOCPTRATTR __attribute__ ((malloc)) -#endif -#ifndef NEDMALLOCPTRATTR - #define NEDMALLOCPTRATTR -#endif -#ifndef NEDMALLOCNOALIASATTR - #define NEDMALLOCNOALIASATTR -#endif - -#ifndef USE_MAGIC_HEADERS - #define USE_MAGIC_HEADERS 0 -#endif - -#ifndef USE_ALLOCATOR - #define USE_ALLOCATOR 1 /* dlmalloc */ -#endif - -#if !USE_ALLOCATOR && !USE_MAGIC_HEADERS -#error If you are using the system allocator then you MUST use magic headers -#endif - -#ifdef REPLACE_SYSTEM_ALLOCATOR - #if USE_ALLOCATOR==0 - #error Cannot combine using the system allocator with replacing the system allocator - #endif - #ifndef ENABLE_TOLERANT_NEDMALLOC - #define ENABLE_TOLERANT_NEDMALLOC 1 - #endif - #ifndef WIN32 /* We have a dedicated patcher for Windows */ - #define nedmalloc malloc - #define nedcalloc calloc - #define nedrealloc realloc - #define nedfree free - #define nedmemalign memalign - #define nedmallinfo mallinfo - #define nedmallopt mallopt - #define nedmalloc_trim malloc_trim - #define nedmalloc_stats malloc_stats - #define nedmalloc_footprint malloc_footprint - #define nedindependent_calloc independent_calloc - #define nedindependent_comalloc independent_comalloc - #ifdef _MSC_VER - #define nedblksize _msize - #endif - #endif -#endif - -#if defined(__cplusplus) -extern "C" { -#endif -struct nedmallinfo { - size_t arena; /* non-mmapped space allocated from system */ - size_t ordblks; /* number of free chunks */ - size_t smblks; /* always 0 */ - size_t hblks; /* always 0 */ - size_t hblkhd; /* space in mmapped regions */ - size_t usmblks; /* maximum total allocated space */ - size_t fsmblks; /* always 0 */ - size_t uordblks; /* total allocated space */ - size_t fordblks; /* total free space */ - size_t keepcost; /* releasable (via malloc_trim) space */ -}; -#if defined(__cplusplus) -} -#endif - -#if defined(__cplusplus) - #if !defined(NO_NED_NAMESPACE) -namespace nedalloc { - #else -extern "C" { - #endif - #define THROWSPEC throw() -#else - #define THROWSPEC -#endif - -/* These are the global functions */ - -/* Gets the usable size of an allocated block. Note this will always be bigger than what was -asked for due to rounding etc. Optionally returns 1 in isforeign if the block came from the -system allocator - note that there is a small (>0.01%) but real chance of segfault on non-Windows -systems when passing non-nedmalloc blocks if you don't use USE_MAGIC_HEADERS. -*/ -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR size_t nedblksize(int *RESTRICT isforeign, void *RESTRICT mem) THROWSPEC; - -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void nedsetvalue(void *v) THROWSPEC; - -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmalloc(size_t size) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedcalloc(size_t no, size_t size) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedrealloc(void *mem, size_t size) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void nedfree(void *mem) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedmemalign(size_t alignment, size_t bytes) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR struct nedmallinfo nedmallinfo(void) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR int nedmallopt(int parno, int value) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR void* nedmalloc_internals(size_t *granularity, size_t *magic) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR int nedmalloc_trim(size_t pad) THROWSPEC; -NEDMALLOCEXTSPEC void nedmalloc_stats(void) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR size_t nedmalloc_footprint(void) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC; - -/* Destroys the system memory pool used by the functions above. -Useful for when you have nedmalloc in a DLL you're about to unload. -If you call ANY nedmalloc functions after calling this you will -get a fatal exception! -*/ -NEDMALLOCEXTSPEC void neddestroysyspool() THROWSPEC; - -/* These are the pool functions */ -struct nedpool_t; -typedef struct nedpool_t nedpool; - -/* Creates a memory pool for use with the nedp* functions below. -Capacity is how much to allocate immediately (if you know you'll be allocating a lot -of memory very soon) which you can leave at zero. Threads specifies how many threads -will *normally* be accessing the pool concurrently. Setting this to zero means it -extends on demand, but be careful of this as it can rapidly consume system resources -where bursts of concurrent threads use a pool at once. -*/ -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR nedpool *nedcreatepool(size_t capacity, int threads) THROWSPEC; - -/* Destroys a memory pool previously created by nedcreatepool(). -*/ -NEDMALLOCEXTSPEC void neddestroypool(nedpool *p) THROWSPEC; - -/* Returns a zero terminated snapshot of threadpools existing at the time of call. Call -nedfree() on the returned list when you are done. Returns zero if there is only the -system pool in existence. -*/ -NEDMALLOCEXTSPEC nedpool **nedpoollist() THROWSPEC; - -/* Sets a value to be associated with a pool. You can retrieve this value by passing -any memory block allocated from that pool. -*/ -NEDMALLOCEXTSPEC void nedpsetvalue(nedpool *p, void *v) THROWSPEC; - -/* Gets a previously set value using nedpsetvalue() or zero if memory is unknown. -Optionally can also retrieve pool. You can detect an unknown block by the return -being zero and *p being unmodifed. -*/ -NEDMALLOCEXTSPEC void *nedgetvalue(nedpool **p, void *mem) THROWSPEC; - -/* Trims the thread cache for the calling thread, returning any existing cache -data to the central pool. Remember to ALWAYS call with zero if you used the -system pool. Setting disable to non-zero replicates neddisablethreadcache(). -*/ -NEDMALLOCEXTSPEC void nedtrimthreadcache(nedpool *p, int disable) THROWSPEC; - -/* Disables the thread cache for the calling thread, returning any existing cache -data to the central pool. Remember to ALWAYS call with zero if you used the -system pool. -*/ -NEDMALLOCEXTSPEC void neddisablethreadcache(nedpool *p) THROWSPEC; - - -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpmalloc(nedpool *p, size_t size) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpcalloc(nedpool *p, size_t no, size_t size) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedprealloc(nedpool *p, void *mem, size_t size) THROWSPEC; -NEDMALLOCEXTSPEC void nedpfree(nedpool *p, void *mem) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void * nedpmemalign(nedpool *p, size_t alignment, size_t bytes) THROWSPEC; -NEDMALLOCEXTSPEC struct nedmallinfo nedpmallinfo(nedpool *p) THROWSPEC; -NEDMALLOCEXTSPEC int nedpmallopt(nedpool *p, int parno, int value) THROWSPEC; -NEDMALLOCEXTSPEC int nedpmalloc_trim(nedpool *p, size_t pad) THROWSPEC; -NEDMALLOCEXTSPEC void nedpmalloc_stats(nedpool *p) THROWSPEC; -NEDMALLOCEXTSPEC size_t nedpmalloc_footprint(nedpool *p) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void **nedpindependent_calloc(nedpool *p, size_t elemsno, size_t elemsize, void **chunks) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **chunks) THROWSPEC; -NEDMALLOCEXTSPEC NEDMALLOCPTRATTR char * nedstrdup(const char *str) THROWSPEC; - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polymer-perf/eduke32/build/include/osd.h b/polymer-perf/eduke32/build/include/osd.h deleted file mode 100644 index cebb319a5..000000000 --- a/polymer-perf/eduke32/build/include/osd.h +++ /dev/null @@ -1,201 +0,0 @@ -// On-screen display (ie. console) -// for the Build Engine -// by Jonathon Fowler (jonof@edgenetwk.com) - -#ifndef __osd_h__ -#define __osd_h__ - - -typedef struct { - int32_t numparms; - const char *name; - const char **parms; - const char *raw; -} osdfuncparm_t; - -typedef struct _symbol -{ - const char *name; - struct _symbol *next; - - const char *help; - int32_t (*func)(const osdfuncparm_t *); -} symbol_t; - -symbol_t *symbols; - -const char *OSD_StripColors(char *out, const char *in); - -enum cvartype_t -{ - CVAR_FLOAT = 0x00000001, - CVAR_INT = 0x00000002, - CVAR_UINT = 0x00000004, - CVAR_BOOL = 0x00000008, - CVAR_STRING = 0x00000010, - CVAR_DOUBLE = 0x00000020, - CVAR_NOMULTI = 0x00000040, - CVAR_MULTI = 0x00000080, - CVAR_NOSAVE = 0x00000100, - CVAR_FUNCPTR = 0x00000200, -}; - -typedef struct -{ - const char *name; - const char *helpstr; - void *var; - int32_t type; // see cvartype_t - int32_t min; - int32_t max; // for string, is the length -} cvar_t; - -typedef struct -{ - char *name; - char *helpstr; - void *var; - int32_t type; // see cvartype_t - int32_t min; - int32_t max; // for string, is the length - - // everything before this point needs to match cvar_t - - // default value for cvar, assigned when var is registered - union - { - int32_t i; - uint32_t uint; - float f; - double d; - } dval; -} osdcvar_t; - -enum osdflags_t -{ - OSD_INITIALIZED = 0x00000001, - OSD_DRAW = 0x00000002, - OSD_CAPTURE = 0x00000004, - OSD_OVERTYPE = 0x00000008, - OSD_SHIFT = 0x00000010, - OSD_CTRL = 0x00000020, - OSD_CAPS = 0x00000040 -}; - -#define OSD_ALIAS (void *)0x1337 -#define OSD_UNALIASED (void *)0xDEAD - -#define OSDCMD_OK 0 -#define OSDCMD_SHOWHELP 1 - -int32_t OSD_ParsingScript(void); - -int32_t OSD_OSDKey(void); -int32_t OSD_GetTextMode(void); -void OSD_SetTextMode(int32_t mode); - -int32_t OSD_Exec(const char *szScript); - -char *OSD_GetFmt(char *ptr); -char *OSD_GetTextPtr(void); -char *OSD_GetFmtPtr(void); - -int32_t OSD_GetCols(void); -int32_t OSD_IsMoving(void); - -// initializes things -void OSD_Init(void); - -// sets the file to echo output to -void OSD_SetLogFile(char *fn); - -// sets the functions the OSD will call to interrogate the environment -void OSD_SetFunctions( - void (*drawchar)(int32_t,int32_t,char,int32_t,int32_t), - void (*drawstr)(int32_t,int32_t,char*,int32_t,int32_t,int32_t), - void (*drawcursor)(int32_t,int32_t,int32_t,int32_t), - int32_t (*colwidth)(int32_t), - int32_t (*rowheight)(int32_t), - void (*clearbg)(int32_t,int32_t), - int32_t (*gettime)(void), - void (*onshow)(int32_t) - ); - -// sets the parameters for presenting the text -void OSD_SetParameters( - int32_t promptshade, int32_t promptpal, - int32_t editshade, int32_t editpal, - int32_t textshade, int32_t textpal - ); - -// sets the scancode for the key which activates the onscreen display -void OSD_CaptureKey(int32_t sc); - -// handles keyboard input when capturing input. returns 0 if key was handled -// or the scancode if it should be handled by the game. -int32_t OSD_HandleScanCode(int32_t sc, int32_t press); -int32_t OSD_HandleChar(char ch); - -// handles the readjustment when screen resolution changes -void OSD_ResizeDisplay(int32_t w,int32_t h); - -// captures and frees osd input -void OSD_CaptureInput(int32_t cap); - -// sets the console version string -void OSD_SetVersion(const char *version, int32_t shade, int32_t pal); - -// shows or hides the onscreen display -void OSD_ShowDisplay(int32_t onf); - -// draw the osd to the screen -void OSD_Draw(void); - -// just like printf -void OSD_Printf(const char *fmt, ...) ATTRIBUTE((format(printf,1,2))); - -// executes buffered commands -void OSD_DispatchQueued(void); - -// executes a string -int32_t OSD_Dispatch(const char *cmd); - -// registers a function -// name = name of the function -// help = a short help string -// func = the entry point to the function -int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)(const osdfuncparm_t*)); - -int32_t osdcmd_cvar_set(const osdfuncparm_t *parm); -int32_t OSD_RegisterCvar(const cvar_t *cvar); -void OSD_WriteCvars(FILE *fp); - -// these correspond to the Duke palettes, so they shouldn't really be here -// ...but I don't care - -#define OSDTEXT_BLUE "^00" -#define OSDTEXT_GOLD "^07" -#define OSDTEXT_DARKRED "^10" -#define OSDTEXT_GREEN "^11" -#define OSDTEXT_GRAY "^12" -#define OSDTEXT_DARKGRAY "^13" -#define OSDTEXT_DARKGREEN "^14" -#define OSDTEXT_BROWN "^15" -#define OSDTEXT_DARKBLUE "^16" -#define OSDTEXT_RED "^21" -#define OSDTEXT_YELLOW "^23" - -#define OSDTEXT_BRIGHT "^S0" - -#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT -#define TEXTSIZE 32768 - -#define OSD_EDITLENGTH 511 -#define OSD_HISTORYDEPTH 32 - -extern char osdhistorybuf[OSD_HISTORYDEPTH][OSD_EDITLENGTH+1]; // history strings -extern int32_t osdhistorysize; // number of entries in history -extern int32_t osdhistorytotal; // number of total history entries - -#endif // __osd_h__ - diff --git a/polymer-perf/eduke32/build/include/osxbits.h b/polymer-perf/eduke32/build/include/osxbits.h deleted file mode 100644 index 42f35bdce..000000000 --- a/polymer-perf/eduke32/build/include/osxbits.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __osxbits_h__ -#define __osxbits_h__ -#include - -int32_t osx_msgbox(char *name, char *msg); -int32_t osx_ynbox(char *name, char *msg); - -#endif \ No newline at end of file diff --git a/polymer-perf/eduke32/build/include/osxmain.h b/polymer-perf/eduke32/build/include/osxmain.h deleted file mode 100644 index 4683df57a..000000000 --- a/polymer-perf/eduke32/build/include/osxmain.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SDLMain.m - main entry point for our Cocoa-ized SDL app - Initial Version: Darrell Walisser - Non-NIB-Code & other changes: Max Horn - - Feel free to customize this file to suit your needs -*/ - -#import - -@interface SDLMain : NSObject -@end diff --git a/polymer-perf/eduke32/build/include/polymer.h b/polymer-perf/eduke32/build/include/polymer.h deleted file mode 100644 index cdc5efd68..000000000 --- a/polymer-perf/eduke32/build/include/polymer.h +++ /dev/null @@ -1,506 +0,0 @@ -// here lies the GREAT JUSTICE RENDERER -// TODO : -// - CORE STUFF -// o there's also the texture alignment problem Hunter reported (san andreas fault) -// o RTT portals (water) -// o clip mirrors/portals to their planes -// o merge mirrors/portals from the same plane -// - SPRITES -// o sprite panning -// - SKIES -// o skyview -// - MDSPRITES -// o need full translation and rotation support from CON to attach to game world or tags -// -// the renderer should hopefully be pretty solid after all that -// the rest will be a bliss :) - -#ifndef _polymer_h_ -# define _polymer_h_ - -# include "compat.h" -# include "baselayer.h" -# include "build.h" -# include "glbuild.h" -# include "osd.h" -# include "hightile.h" -# include "mdsprite.h" -# include "polymost.h" -# include "pragmas.h" -# include - -// CVARS -extern int32_t pr_lighting; -extern int32_t pr_normalmapping; -extern int32_t pr_specularmapping; -extern int32_t pr_shadows; -extern int32_t pr_shadowcount; -extern int32_t pr_shadowdetail; -extern int32_t pr_shadowfiltering; -extern int32_t pr_maxlightpasses; -extern int32_t pr_maxlightpriority; -extern int32_t pr_fov; -extern float pr_customaspect; -extern int32_t pr_billboardingmode; -extern int32_t pr_verbosity; -extern int32_t pr_wireframe; -extern int32_t pr_vbos; -extern int32_t pr_gpusmoothing; -extern int32_t pr_overrideparallax; -extern float pr_parallaxscale; -extern float pr_parallaxbias; -extern int32_t pr_overridespecular; -extern float pr_specularpower; -extern float pr_specularfactor; -extern int32_t pr_highpalookups; -extern int32_t pr_overridehud; -extern float pr_hudxadd; -extern float pr_hudyadd; -extern float pr_hudzadd; -extern int32_t pr_hudangadd; -extern int32_t pr_hudfov; -extern float pr_overridemodelscale; -extern int32_t pr_ati_fboworkaround; -extern int32_t pr_ati_nodepthoffset; -#ifdef __APPLE__ -extern int32_t pr_ati_textureformat_one; -#endif - -extern int32_t r_pr_maxlightpasses; - -// MATERIAL -typedef enum { - PR_BIT_HEADER, // must be first - PR_BIT_ANIM_INTERPOLATION, - PR_BIT_LIGHTING_PASS, - PR_BIT_NORMAL_MAP, - PR_BIT_DIFFUSE_MAP, - PR_BIT_DIFFUSE_DETAIL_MAP, - PR_BIT_DIFFUSE_MODULATION, - PR_BIT_DIFFUSE_MAP2, - PR_BIT_HIGHPALOOKUP_MAP, - PR_BIT_SPECULAR_MAP, - PR_BIT_SPECULAR_MATERIAL, - PR_BIT_MIRROR_MAP, - PR_BIT_FOG, - PR_BIT_GLOW_MAP, - PR_BIT_PROJECTION_MAP, - PR_BIT_SHADOW_MAP, - PR_BIT_LIGHT_MAP, - PR_BIT_SPOT_LIGHT, - PR_BIT_POINT_LIGHT, - PR_BIT_FOOTER, // must be just before last - PR_BIT_COUNT // must be last -} prbittype; - -typedef struct s_prmaterial { - // PR_BIT_ANIM_INTERPOLATION - GLfloat frameprogress; - GLfloat* nextframedata; - // PR_BIT_NORMAL_MAP - GLuint normalmap; - GLfloat normalbias[2]; - GLfloat* tbn; - // PR_BIT_DIFFUSE_MAP - GLuint diffusemap; - GLfloat diffusescale[2]; - // PR_BIT_HIGHPALOOKUP_MAP - GLuint highpalookupmap; - // PR_BIT_DIFFUSE_DETAIL_MAP - GLuint detailmap; - GLfloat detailscale[2]; - // PR_BIT_DIFFUSE_MODULATION - GLubyte diffusemodulation[4]; - // PR_BIT_SPECULAR_MAP - GLuint specmap; - // PR_BIT_SPECULAR_MATERIAL - GLfloat specmaterial[2]; - // PR_BIT_MIRROR_MAP - GLuint mirrormap; - // PR_BIT_GLOW_MAP - GLuint glowmap; - // PR_BIT_SHADOW_MAP - GLboolean mdspritespace; -} _prmaterial; - -typedef struct s_prrograminfo { - GLhandleARB handle; - // PR_BIT_ANIM_INTERPOLATION - GLint attrib_nextFrameData; - GLint attrib_nextFrameNormal; - GLint uniform_frameProgress; - // PR_BIT_NORMAL_MAP - GLint attrib_T; - GLint attrib_B; - GLint attrib_N; - GLint uniform_eyePosition; - GLint uniform_normalMap; - GLint uniform_normalBias; - // PR_BIT_DIFFUSE_MAP - GLint uniform_diffuseMap; - GLint uniform_diffuseScale; - // PR_BIT_HIGHPALOOKUP_MAP - GLuint uniform_highPalookupMap; - // PR_BIT_DIFFUSE_DETAIL_MAP - GLint uniform_detailMap; - GLint uniform_detailScale; - // PR_BIT_SPECULAR_MAP - GLint uniform_specMap; - // PR_BIT_SPECULAR_MATERIAL - GLint uniform_specMaterial; - // PR_BIT_MIRROR_MAP - GLint uniform_mirrorMap; - // PR_BIT_GLOW_MAP - GLint uniform_glowMap; - // PR_BIT_PROJECTION_MAP - GLint uniform_shadowProjMatrix; - // PR_BIT_SHADOW_MAP - GLint uniform_shadowMap; - // PR_BIT_LIGHT_MAP - GLint uniform_lightMap; - // PR_BIT_SPOT_LIGHT - GLint uniform_spotDir; - GLint uniform_spotRadius; -} _prprograminfo; - -#define PR_INFO_LOG_BUFFER_SIZE 8192 - -// Think about changing highPal[Scale|Bias] in the program bit if you change this -#define PR_HIGHPALOOKUP_BIT_DEPTH 6 -#define PR_HIGHPALOOKUP_DIM (1 << PR_HIGHPALOOKUP_BIT_DEPTH) -#define PR_HIGHPALOOKUP_DATA_SIZE (4 * PR_HIGHPALOOKUP_DIM * \ - PR_HIGHPALOOKUP_DIM * \ - PR_HIGHPALOOKUP_DIM) - -typedef struct s_prprogrambit { - int32_t bit; - char* vert_def; - char* vert_prog; - char* frag_def; - char* frag_prog; -} _prprogrambit; - -#include "prlights.h" - -// RENDER TARGETS -typedef struct s_prrt { - GLenum target; - GLuint color; - GLuint z; - GLuint fbo; - int32_t xdim, ydim; -} _prrt; - -// BUILD DATA -typedef struct s_prplane { - // geometry - GLfloat* buffer; - int32_t vertcount; - GLuint vbo; - // attributes - GLfloat tbn[3][3]; - GLfloat plane[4]; - _prmaterial material; - // elements - GLushort* indices; - int32_t indicescount; - GLuint ivbo; - // lights - int16_t lights[PR_MAXLIGHTS]; - uint16_t lightcount; -} _prplane; - -typedef struct s_prsector { - // polymer data - GLdouble* verts; - _prplane floor; - _prplane ceil; - int16_t curindice; - int32_t indicescount; - int32_t oldindicescount; - // stuff - float wallsproffset; - float floorsproffset; - // build sector data - int32_t ceilingz, floorz; - int16_t ceilingstat, floorstat; - int16_t ceilingpicnum, ceilingheinum; - int8_t ceilingshade; - char ceilingpal, ceilingxpanning, ceilingypanning; - int16_t floorpicnum, floorheinum; - int8_t floorshade; - char floorpal, floorxpanning, floorypanning; - - struct { - int32_t empty : 1; - int32_t uptodate : 1; - int32_t invalidtex : 1; - } flags; - uint32_t invalidid; -} _prsector; - -typedef struct s_prwall { - _prplane wall; - _prplane over; - _prplane mask; - // stuff - GLfloat* bigportal; - GLfloat* cap; - GLuint stuffvbo; - // build wall data - int16_t cstat, nwallcstat; - int16_t picnum, overpicnum, nwallpicnum; - int8_t shade; - char pal, xrepeat, yrepeat, xpanning, ypanning; - char nwallxpanning, nwallypanning; - int8_t nwallshade; - - char underover; - uint32_t invalidid; - struct { - int32_t empty : 1; - int32_t uptodate : 1; - int32_t invalidtex : 1; - } flags; -} _prwall; - -typedef struct s_prsprite { - _prplane plane; - uint32_t crc; -} _prsprite; - -typedef struct s_prmirror { - _prplane *plane; - int16_t sectnum; - int16_t wallnum; -} _prmirror; - -typedef struct s_prhighpalookup { - char *data; - GLuint map; -} _prhighpalookup; - -typedef void (*animatespritesptr)(int32_t, int32_t, int32_t, int32_t); - -typedef struct s_pranimatespritesinfo { - animatespritesptr animatesprites; - int32_t x, y, a, smoothratio; -} _pranimatespritesinfo; - -// EXTERNAL FUNCTIONS -int32_t polymer_init(void); -void polymer_uninit(void); -void polymer_setaspect(int32_t); -void polymer_glinit(void); -void polymer_resetlights(void); -void polymer_loadboard(void); -void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum); -void polymer_drawmasks(void); -void polymer_editorpick(void); -void polymer_inb4rotatesprite(int16_t tilenum, char pal, int8_t shade); -void polymer_postrotatesprite(void); -void polymer_drawmaskwall(int32_t damaskwallcnt); -void polymer_drawsprite(int32_t snum); -void polymer_setanimatesprites(animatespritesptr animatesprites, int32_t x, int32_t y, int32_t a, int32_t smoothratio); -int16_t polymer_addlight(_prlight* light); -void polymer_deletelight(int16_t lighti); -void polymer_invalidatelights(void); -void polymer_texinvalidate(void); -void polymer_definehighpalookup(char basepalnum, char palnum, char *fn); - -# ifdef POLYMER_C - -// CORE -static void polymer_displayrooms(int16_t sectnum); -static void polymer_drawplane(_prplane* plane); -static inline void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane); -static void polymer_animatesprites(void); -static void polymer_freeboard(void); -// SECTORS -static int32_t polymer_initsector(int16_t sectnum); -static int32_t polymer_updatesector(int16_t sectnum); -void PR_CALLBACK polymer_tesserror(GLenum error); -void PR_CALLBACK polymer_tessedgeflag(GLenum error); -void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector); -static int32_t polymer_buildfloor(int16_t sectnum); -static void polymer_drawsector(int16_t sectnum); -// WALLS -static int32_t polymer_initwall(int16_t wallnum); -static void polymer_updatewall(int16_t wallnum); -static void polymer_drawwall(int16_t sectnum, int16_t wallnum); -// HSR -static void polymer_computeplane(_prplane* p); -static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out); -static inline void polymer_transformpoint(const float* inpos, float* pos, float* matrix); -static inline void polymer_normalize(float* vec); -static inline void polymer_pokesector(int16_t sectnum); -static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projection, float* frustum); -static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum); -static inline void polymer_scansprites(int16_t sectnum, spritetype* tsprite, int32_t* spritesortcnt); -static inline void polymer_updatesprite(int32_t snum); -// SKIES -static void polymer_getsky(void); -static void polymer_drawsky(int16_t tilenum, char palnum, int8_t shade); -static void polymer_initartsky(void); -static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shade); -static void polymer_drawartskyquad(int32_t p1, int32_t p2, GLfloat height); -static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shade); -// MDSPRITES -static void polymer_drawmdsprite(spritetype *tspr); -static void polymer_loadmodelvbos(md3model_t* m); -// MATERIALS -static void polymer_getscratchmaterial(_prmaterial* material); -static void polymer_getbuildmaterial(_prmaterial* material, int16_t tilenum, char pal, int8_t shade, int32_t cmeth); -static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, int lightcount); -static void polymer_unbindmaterial(int32_t programbits); -static void polymer_compileprogram(int32_t programbits); -// LIGHTS -static void polymer_removelight(int16_t lighti); -static void polymer_updatelights(void); -static inline void polymer_resetplanelights(_prplane* plane); -static void polymer_addplanelight(_prplane* plane, int16_t lighti); -static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti); -static int32_t polymer_planeinlight(_prplane* plane, _prlight* light); -static void polymer_invalidateplanelights(_prplane* plane); -static void polymer_invalidatesectorlights(int16_t sectnum); -static void polymer_processspotlight(_prlight* light); -static inline void polymer_culllight(int16_t lighti); -static void polymer_prepareshadows(void); -// RENDER TARGETS -static void polymer_initrendertargets(int32_t count); - -// the following from gle/vvector.h - -/* ========================================================== */ -/* determinant of matrix - * - * Computes determinant of matrix m, returning d - */ - -#define DETERMINANT_3X3(d,m) \ -{ \ - d = m[0][0] * (m[1][1]*m[2][2] - m[1][2] * m[2][1]); \ - d -= m[0][1] * (m[1][0]*m[2][2] - m[1][2] * m[2][0]); \ - d += m[0][2] * (m[1][0]*m[2][1] - m[1][1] * m[2][0]); \ -} - -/* ========================================================== */ -/* i,j,th cofactor of a 4x4 matrix - * - */ - -#define COFACTOR_4X4_IJ(fac,m,i,j) \ -{ \ - int ii[4], jj[4], k; \ - \ - /* compute which row, columnt to skip */ \ - for (k=0; k 239) ? (float)(gvisibility*((vis-240+f)/(klabs(vis-256)))) : - (float)(gvisibility*(vis+16+f)); - - fogresult = clamp(f, 0.001f, 100.f); - - Bmemcpy(fogcol, &fogtable[pal<<2], sizeof(fogcol)); -} - - -#endif - -#endif diff --git a/polymer-perf/eduke32/build/include/pragmas.h b/polymer-perf/eduke32/build/include/pragmas.h deleted file mode 100644 index 6625401c7..000000000 --- a/polymer-perf/eduke32/build/include/pragmas.h +++ /dev/null @@ -1,1909 +0,0 @@ -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - - -#ifndef __pragmas_h__ -#define __pragmas_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -extern int32_t dmval; - -// break the C version of divscale out from the others -// because asm version overflows in drawmapview() - -#define qw(x) ((int64_t)(x)) // quadword cast -#define dw(x) ((int32_t)(x)) // doubleword cast -#define by(x) ((uint8_t)(x)) // byte cast - -#define _scaler(a) \ - static inline int32_t divscale##a(int32_t eax, int32_t ebx) \ -{ \ - return dw((qw(eax) << a) / qw(ebx)); \ -} \ - -_scaler(1) _scaler(2) _scaler(3) _scaler(4) -_scaler(5) _scaler(6) _scaler(7) _scaler(8) -_scaler(9) _scaler(10) _scaler(11) _scaler(12) -_scaler(13) _scaler(14) _scaler(15) _scaler(16) -_scaler(17) _scaler(18) _scaler(19) _scaler(20) -_scaler(21) _scaler(22) _scaler(23) _scaler(24) -_scaler(25) _scaler(26) _scaler(27) _scaler(28) -_scaler(29) _scaler(30) _scaler(31) _scaler(32) - -static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw((qw(eax) << by(ecx)) / qw(ebx)); } - -#undef qw -#undef dw -#undef by -#undef _scaler - -#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) - -// -// GCC Inline Assembler version -// - -//{{{ - -#ifndef UNDERSCORES -#define _DMVAL "dmval" -#else -#define _DMVAL "_dmval" -#endif - - -// maybe one day I'll make these into macros -int32_t boundmulscale(int32_t a, int32_t b, int32_t c); -void clearbufbyte(void *D, int32_t c, int32_t a); -void copybufbyte(void *S, void *D, int32_t c); -void copybufreverse(void *S, void *D, int32_t c); - - -#ifdef NO_GCC_BUILTINS -#define sqr(a) \ - ({ int32_t __a=(a); \ - __asm__ __volatile__ ("imull %0, %0" \ - : "=q" (__a) \ - : "0" (__a) \ - : "cc"); \ - __a; }) -#else -#define sqr(a) __builtin_sqr(a) -#endif - -#define scale(a,d,c) \ - ({ int32_t __a=(a), __d=(d), __c=(c); \ - __asm__ __volatile__ ("imull %%edx; idivl %%ecx" \ - : "=a" (__a), "=d" (__d) \ - : "0" (__a), "1" (__d), "c" (__c) : "cc"); \ - __a; }) - -#define mulscale(a,d,c) \ - ({ int32_t __a=(a), __d=(d), __c=(c); \ - __asm__ __volatile__ ("imull %%edx; shrdl %%cl, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d), "c" (__c) : "cc"); \ - __a; }) -#define mulscale1(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $1, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale2(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $2, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale3(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $3, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale4(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $4, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale5(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $5, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale6(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $6, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale7(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $7, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale8(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $8, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale9(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $9, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale10(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $10, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale11(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $11, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale12(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $12, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale13(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $13, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale14(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $14, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale15(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $15, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale16(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $16, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale17(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $17, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale18(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $18, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale19(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $19, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale20(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $20, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale21(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $21, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale22(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $22, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale23(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $23, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale24(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $24, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale25(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $25, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale26(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $26, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale27(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $27, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale28(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $28, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale29(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $29, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale30(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $30, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale31(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx; shrdl $31, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __a; }) -#define mulscale32(a,d) \ - ({ int32_t __a=(a), __d=(d); \ - __asm__ __volatile__ ("imull %%edx" \ - : "=a" (__a), "=d" (__d) \ - : "a" (__a), "d" (__d) : "cc"); \ - __d; }) - -#define dmulscale(a,d,S,D,c) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D), __c=(c); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl %%cl, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D), "c" (__c) : "ebx", "cc"); \ - __a; }) -#define dmulscale1(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $1, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale2(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $2, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale3(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $3, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale4(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $4, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale5(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $5, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale6(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $6, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale7(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $7, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale8(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $8, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale9(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $9, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale10(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $10, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale11(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $11, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale12(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $12, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale13(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $13, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale14(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $14, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale15(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $15, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale16(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $16, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale17(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $17, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale18(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $18, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale19(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $19, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale20(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $20, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale21(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $21, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale22(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $22, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale23(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $23, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale24(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $24, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale25(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $25, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale26(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $26, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale27(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $27, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale28(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $28, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale29(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $29, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale30(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $30, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale31(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx; shrdl $31, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __a; }) -#define dmulscale32(a,d,S,D) \ - ({ int32_t __a=(a), __d=(d), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; movl %%eax, %%ebx; movl %%esi, %%eax; movl %%edx, %%esi; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%esi, %%edx" \ - : "=a" (__a), "=d" (__d), "=S" (__S) \ - : "a" (__a), "d" (__d), "S" (__S), "D" (__D) : "ebx", "cc"); \ - __d; }) - -#define tmulscale1(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $1, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale2(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $2, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale3(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $3, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale4(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $4, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale5(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $5, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale6(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $6, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale7(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $7, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale8(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $8, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale9(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $9, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale10(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $10, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale11(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $11, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale12(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $12, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale13(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $13, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale14(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $14, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale15(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $15, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale16(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $16, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale17(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $17, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale18(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $18, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale19(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $19, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale20(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $20, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale21(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $21, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale22(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $22, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale23(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $23, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale24(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $24, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale25(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $25, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale26(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $26, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale27(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $27, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale28(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $28, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale29(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $29, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale30(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $30, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale31(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx; shrdl $31, %%edx, %%eax" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __a; }) -#define tmulscale32(a,d,b,c,S,D) \ - ({ int32_t __a=(a), __d=(d), __b=(b), __c=(c), __S=(S), __D=(D); \ - __asm__ __volatile__ ("imull %%edx; xchgl %%ebx, %%eax; xchgl %%ecx, %%edx; " \ - "imull %%edx; addl %%eax, %%ebx; adcl %%edx, %%ecx; movl %%esi, %%eax; " \ - "imull %%edi; addl %%ebx, %%eax; adcl %%ecx, %%edx" \ - : "=a" (__a), "=d" (__d), "=b" (__b), "=c" (__c) \ - : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ - __d; }) - -#if 0 -#define divscale(a,b,c) \ - ({ int32_t __a=(a), __b=(b), __c=(c); \ - __asm__ __volatile__ ("movl %%eax, %%edx; shll %%cl, %%eax; negb %%cl; sarl %%cl, %%edx; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "c" (__c), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale1(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("addl %%eax, %%eax; sbbl %%edx, %%edx; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale2(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $30, %%edx; leal (,%%eax,4), %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale3(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $29, %%edx; leal (,%%eax,8), %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale4(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $28, %%edx; shll $4, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale5(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $27, %%edx; shll $5, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale6(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $26, %%edx; shll $6, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale7(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $25, %%edx; shll $7, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale8(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $24, %%edx; shll $8, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale9(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $23, %%edx; shll $9, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale10(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $22, %%edx; shll $10, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale11(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $21, %%edx; shll $11, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale12(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $20, %%edx; shll $12, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale13(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $19, %%edx; shll $13, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale14(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $18, %%edx; shll $14, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale15(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $17, %%edx; shll $15, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale16(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $16, %%edx; shll $16, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale17(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $15, %%edx; shll $17, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale18(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $14, %%edx; shll $18, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale19(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $13, %%edx; shll $19, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale20(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $12, %%edx; shll $20, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale21(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $11, %%edx; shll $21, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale22(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $10, %%edx; shll $22, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale23(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $9, %%edx; shll $23, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale24(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $8, %%edx; shll $24, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale25(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $7, %%edx; shll $25, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale26(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $6, %%edx; shll $26, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale27(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $5, %%edx; shll $27, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale28(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $4, %%edx; shll $28, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale29(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $3, %%edx; shll $29, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale30(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $2, %%edx; shll $30, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale31(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("movl %%eax, %%edx; sarl $1, %%edx; shll $31, %%eax; idivl %%ebx" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "edx", "cc"); \ - __a; }) -#define divscale32(d,b) \ - ({ int32_t __d=(d), __b=(b), __r; \ - __asm__ __volatile__ ("xorl %%eax, %%eax; idivl %%ebx" \ - : "=a" (__r), "=d" (__d) : "d" (__d), "b" (__b) : "cc"); \ - __r; }) -#endif -#define readpixel(D) \ - ({ void *__D=(D); int32_t __a; \ - __asm__ __volatile__ ("movb (%%edi), %%al" \ - : "=a" (__a): "D" (__D) : "cc"); \ - __a; }) -#define drawpixel(D,a) \ - ({ void *__D=(D); int32_t __a=(a); \ - __asm__ __volatile__ ("movb %%al, (%%edi)" \ - : : "D" (__D), "a" (__a) : "memory", "cc"); \ - 0; }) -#define drawpixels(D,a) \ - ({ void *__D=(D); int32_t __a=(a); \ - __asm__ __volatile__ ("movw %%ax, (%%edi)" \ - : : "D" (__D), "a" (__a) : "memory", "cc"); \ - 0; }) -#define drawpixelses(D,a) \ - ({ void *__D=(D); int32_t __a=(a); \ - __asm__ __volatile__ ("movl %%eax, (%%edi)" \ - : : "D" (__D), "a" (__a) : "memory", "cc"); \ - 0; }) -#define clearbuf(D,c,a) \ - ({ void *__D=(D); int32_t __c=(c), __a=(a); \ - __asm__ __volatile__ ("rep; stosl" \ - : "=&D" (__D), "=&c" (__c) : "0" (__D), "1" (__c), "a" (__a) : "memory", "cc"); \ - 0; }) -#define copybuf(S,D,c) \ - ({ void *__S=(S), *__D=(D); int32_t __c=(c); \ - __asm__ __volatile__ ("rep; movsl" \ - : "=&S" (__S), "=&D" (__D), "=&c" (__c) : "0" (__S), "1" (__D), "2" (__c) : "memory", "cc"); \ - 0; }) - -#define mul3(a) \ - ({ int32_t __a=(a), __r; \ - __asm__ __volatile__ ("lea (%1,%1,2), %0" \ - : "=r" (__r) : "0" (__a) : "cc"); \ - __r; }) -#define mul5(a) \ - ({ int32_t __a=(a), __r; \ - __asm__ __volatile__ ("lea (%1,%1,4), %0" \ - : "=r" (__r) : "0" (__a) : "cc"); \ - __r; }) -#define mul9(a) \ - ({ int32_t __a=(a), __r; \ - __asm__ __volatile__ ("lea (%1,%1,8), %0" \ - : "=r" (__r) : "0" (__a) : "cc"); \ - __r; }) - -//returns eax/ebx, dmval = eax%edx; -#define divmod(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("xorl %%edx, %%edx; divl %%ebx; movl %%edx, "_DMVAL \ - : "+a" (__a) : "b" (__b) : "edx", "memory", "cc"); \ - __a; }) -//returns eax%ebx, dmval = eax/edx; -#define moddiv(a,b) \ - ({ int32_t __a=(a), __b=(b), __d; \ - __asm__ __volatile__ ("xorl %%edx, %%edx; divl %%ebx; movl %%eax, "_DMVAL \ - : "=d" (__d) : "a" (__a), "b" (__b) : "eax", "memory", "cc"); \ - __d; }) - -#define klabs(a) \ - ({ int32_t __a=(a); \ - __asm__ __volatile__ ("testl %%eax, %%eax; jns 0f; negl %%eax; 0:" \ - : "=a" (__a) : "a" (__a) : "cc"); \ - __a; }) -#define ksgn(b) \ - ({ int32_t __b=(b), __r; \ - __asm__ __volatile__ ("addl %%ebx, %%ebx; sbbl %%eax, %%eax; cmpl %%ebx, %%eax; adcb $0, %%al" \ - : "=a" (__r) : "b" (__b) : "cc"); \ - __r; }) - -#define umin(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("subl %%ebx, %%eax; sbbl %%ecx, %%ecx; andl %%ecx, %%eax; addl %%ebx, %%eax" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "ecx", "cc"); \ - __a; }) -#define umax(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("subl %%ebx, %%eax; sbbl %%ecx, %%ecx; xorl $0xffffffff, %%ecx; andl %%ecx, %%eax; addl %%ebx, %%eax" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "ecx", "cc"); \ - __a; }) - -#define kmin(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("cmpl %%ebx, %%eax; jl 0f; movl %%ebx, %%eax; 0:" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "cc"); \ - __a; }) -#define kmax(a,b) \ - ({ int32_t __a=(a), __b=(b); \ - __asm__ __volatile__ ("cmpl %%ebx, %%eax; jg 0f; movl %%ebx, %%eax; 0:" \ - : "=a" (__a) : "a" (__a), "b" (__b) : "cc"); \ - __a; }) - -#define swapchar(a,b) \ - ({ void *__a=(a), *__b=(b); \ - __asm__ __volatile__ ("movb (%%eax), %%cl; movb (%%ebx), %%ch; movb %%cl, (%%ebx); movb %%ch, (%%eax)" \ - : : "a" (__a), "b" (__b) : "ecx", "memory", "cc"); \ - 0; }) -#define swapshort(a,b) \ - ({ void *__a=(a), *__b=(b); \ - __asm__ __volatile__ ("movw (%%eax), %%cx; movw (%%ebx), %%dx; movw %%cx, (%%ebx); movw %%dx, (%%eax)" \ - : : "a" (__a), "b" (__b) : "ecx", "edx", "memory", "cc"); \ - 0; }) -#define swaplong(a,b) \ - ({ void *__a=(a), *__b=(b); \ - __asm__ __volatile__ ("movl (%%eax), %%ecx; movl (%%ebx), %%edx; movl %%ecx, (%%ebx); movl %%edx, (%%eax)" \ - : : "a" (__a), "b" (__b) : "ecx", "edx", "memory", "cc"); \ - 0; }) -#define swapbuf4(a,b,c) \ - ({ void *__a=(a), *__b=(b); int32_t __c=(c); \ - __asm__ __volatile__ ("0: movl (%%eax), %%esi; movl (%%ebx), %%edi; movl %%esi, (%%ebx); " \ - "movl %%edi, (%%eax); addl $4, %%eax; addl $4, %%ebx; decl %%ecx; jnz 0b" \ - : : "a" (__a), "b" (__b), "c" (__c) : "esi", "edi", "memory", "cc"); \ - 0; }) -#define swap64bit(a,b) \ - ({ void *__a=(a), *__b=(b); \ - __asm__ __volatile__ ("movl (%%eax), %%ecx; movl (%%ebx), %%edx; movl %%ecx, (%%ebx); " \ - "movl 4(%%eax), %%ecx; movl %%edx, (%%eax); movl 4(%%ebx), %%edx; " \ - "movl %%ecx, 4(%%ebx); movl %%edx, 4(%%eax)" \ - : : "a" (__a), "b" (__b) : "ecx", "edx", "memory", "cc"); \ - 0; }) - -//swapchar2(ptr1,ptr2,xsiz); is the same as: -//swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz); -#define swapchar2(a,b,S) \ - ({ void *__a=(a), *__b=(b); int32_t __S=(S); \ - __asm__ __volatile__ ("addl %%ebx, %%esi; movw (%%eax), %%cx; movb (%%ebx), %%dl; " \ - "movb %%cl, (%%ebx); movb (%%esi), %%dh; movb %%ch, (%%esi); " \ - "movw %%dx, (%%eax)" \ - : "=S" (__S) : "a" (__a), "b" (__b), "S" (__S) : "ecx", "edx", "memory", "cc"); \ - 0; }) - - -#define qinterpolatedown16(a,c,d,S) \ - ({ void *__a=(void*)(a); int32_t __c=(c), __d=(d), __S=(S); \ - __asm__ __volatile__ ("movl %%ecx, %%ebx; shrl $1, %%ecx; jz 1f; " \ - "0: leal (%%edx,%%esi,), %%edi; sarl $16, %%edx; movl %%edx, (%%eax); " \ - "leal (%%edi,%%esi,), %%edx; sarl $16, %%edi; movl %%edi, 4(%%eax); " \ - "addl $8, %%eax; decl %%ecx; jnz 0b; testl $1, %%ebx; jz 2f; " \ - "1: sarl $16, %%edx; movl %%edx, (%%eax); 2:" \ - : "=a" (__a), "=c" (__c), "=d" (__d) : "a" (__a), "c" (__c), "d" (__d), "S" (__S) \ - : "ebx", "edi", "memory", "cc"); \ - 0; }) - -#define qinterpolatedown16short(a,c,d,S) \ - ({ void *__a=(void*)(a); int32_t __c=(c), __d=(d), __S=(S); \ - __asm__ __volatile__ ("testl %%ecx, %%ecx; jz 3f; testb $2, %%al; jz 0f; movl %%edx, %%ebx; " \ - "sarl $16, %%ebx; movw %%bx, (%%eax); addl %%esi, %%edx; addl $2, %%eax; " \ - "decl %%ecx; jz 3f; " \ - "0: subl $2, %%ecx; jc 2f; " \ - "1: movl %%edx, %%ebx; addl %%esi, %%edx; sarl $16, %%ebx; movl %%edx, %%edi; " \ - "andl $0xffff0000, %%edi; addl %%esi, %%edx; addl %%edi, %%ebx; " \ - "movl %%ebx, (%%eax); addl $4, %%eax; subl $2, %%ecx; jnc 1b; testb $1, %%cl; " \ - "jz 3f; " \ - "2: movl %%edx, %%ebx; sarl $16, %%ebx; movw %%bx, (%%eax); 3:" \ - : "=a" (__a), "=c" (__c), "=d" (__d) : "a" (__a), "c" (__c), "d" (__d), "S" (__S) \ - : "ebx", "edi", "memory", "cc"); \ - 0; }) - - -//}}} - -#elif defined(_MSC_VER) && !defined(NOASM) // __GNUC__ - -// -// Microsoft C inline assembler -// - -//{{{ -static __inline int32_t sqr(int32_t a) -{ - _asm { - mov eax, a - imul eax, eax - } -} - -static __inline int32_t scale(int32_t a, int32_t d, int32_t c) -{ - _asm { - mov eax, a - imul d - idiv c - } -} - -static __inline int32_t mulscale(int32_t a, int32_t d, int32_t c) -{ - _asm { - mov ecx, c - mov eax, a - imul d - shrd eax, edx, cl - } -} - -#define MULSCALE(x) \ -static __inline int32_t mulscale##x (int32_t a, int32_t d) \ -{ \ - _asm mov eax, a \ - _asm imul d \ - _asm shrd eax, edx, x \ -} - -MULSCALE(1) MULSCALE(2) MULSCALE(3) MULSCALE(4) -MULSCALE(5) MULSCALE(6) MULSCALE(7) MULSCALE(8) -MULSCALE(9) MULSCALE(10) MULSCALE(11) MULSCALE(12) -MULSCALE(13) MULSCALE(14) MULSCALE(15) MULSCALE(16) -MULSCALE(17) MULSCALE(18) MULSCALE(19) MULSCALE(20) -MULSCALE(21) MULSCALE(22) MULSCALE(23) MULSCALE(24) -MULSCALE(25) MULSCALE(26) MULSCALE(27) MULSCALE(28) -MULSCALE(29) MULSCALE(30) MULSCALE(31) -#undef MULSCALE -static __inline int32_t mulscale32(int32_t a, int32_t d) -{ - _asm { - mov eax, a - imul d - mov eax, edx - } -} - -static __inline int32_t dmulscale(int32_t a, int32_t d, int32_t S, int32_t D, int32_t c) -{ - _asm { - mov ecx, c - mov eax, a - imul d - mov ebx, eax - mov eax, S - mov esi, edx - imul D - add eax, ebx - adc edx, esi - shrd eax, edx, cl - } -} - -#define DMULSCALE(x) \ -static __inline int32_t dmulscale##x (int32_t a, int32_t d, int32_t S, int32_t D) \ -{ \ - _asm mov eax, a \ - _asm imul d \ - _asm mov ebx, eax \ - _asm mov eax, S \ - _asm mov esi, edx \ - _asm imul D \ - _asm add eax, ebx \ - _asm adc edx, esi \ - _asm shrd eax, edx, x \ -} - -DMULSCALE(1) DMULSCALE(2) DMULSCALE(3) DMULSCALE(4) -DMULSCALE(5) DMULSCALE(6) DMULSCALE(7) DMULSCALE(8) -DMULSCALE(9) DMULSCALE(10) DMULSCALE(11) DMULSCALE(12) -DMULSCALE(13) DMULSCALE(14) DMULSCALE(15) DMULSCALE(16) -DMULSCALE(17) DMULSCALE(18) DMULSCALE(19) DMULSCALE(20) -DMULSCALE(21) DMULSCALE(22) DMULSCALE(23) DMULSCALE(24) -DMULSCALE(25) DMULSCALE(26) DMULSCALE(27) DMULSCALE(28) -DMULSCALE(29) DMULSCALE(30) DMULSCALE(31) -#undef DMULSCALE -static __inline int32_t dmulscale32(int32_t a, int32_t d, int32_t S, int32_t D) -{ - _asm { - mov eax, a - imul d - mov ebx, eax - mov eax, S - mov esi, edx - imul D - add eax, ebx - adc edx, esi - mov eax, edx - } -} - -#define TMULSCALE(x) \ -static __inline int32_t tmulscale##x (int32_t a, int32_t d, int32_t b, int32_t c, int32_t S, int32_t D) \ -{ \ - _asm mov eax, a \ - _asm mov ebx, b \ - _asm imul d \ - _asm xchg eax, ebx \ - _asm mov ecx, c \ - _asm xchg edx, ecx \ - _asm imul edx \ - _asm add ebx, eax \ - _asm adc ecx, edx \ - _asm mov eax, S \ - _asm imul D \ - _asm add eax, ebx \ - _asm adc edx, ecx \ - _asm shrd eax, edx, x \ -} - -TMULSCALE(1) TMULSCALE(2) TMULSCALE(3) TMULSCALE(4) -TMULSCALE(5) TMULSCALE(6) TMULSCALE(7) TMULSCALE(8) -TMULSCALE(9) TMULSCALE(10) TMULSCALE(11) TMULSCALE(12) -TMULSCALE(13) TMULSCALE(14) TMULSCALE(15) TMULSCALE(16) -TMULSCALE(17) TMULSCALE(18) TMULSCALE(19) TMULSCALE(20) -TMULSCALE(21) TMULSCALE(22) TMULSCALE(23) TMULSCALE(24) -TMULSCALE(25) TMULSCALE(26) TMULSCALE(27) TMULSCALE(28) -TMULSCALE(29) TMULSCALE(30) TMULSCALE(31) -#undef TMULSCALE -static __inline int32_t tmulscale32(int32_t a, int32_t d, int32_t b, int32_t c, int32_t S, int32_t D) -{ - _asm { - mov eax, a - mov ebx, b - imul d - xchg eax, ebx - mov ecx, c - xchg edx, ecx - imul edx - add ebx, eax - adc ecx, edx - mov eax, S - imul D - add eax, ebx - adc edx, ecx - mov eax, edx - } -} - -static __inline int32_t boundmulscale(int32_t a, int32_t b, int32_t c) -{ - _asm { - mov eax, a - mov ecx, c - imul b - mov ebx, edx - shrd eax, edx, cl - sar edx, cl - xor edx, eax - js checkit - xor edx, eax - jz skipboundit - cmp edx, 0xffffffff - je skipboundit - checkit: - mov eax, ebx - sar eax, 31 - xor eax, 0x7fffffff - skipboundit: - } -} -#if 0 -static __inline int32_t divscale(int32_t a, int32_t b, int32_t c) -{ - _asm { - mov eax, a - mov ecx, c - mov edx, eax - shl eax, cl - neg cl - sar edx, cl - idiv b - } -} - -static __inline int32_t divscale1(int32_t a, int32_t b) -{ - _asm { - mov eax, a - add eax, eax - sbb edx, edx - idiv b - } -} - -static __inline int32_t divscale2(int32_t a, int32_t b) -{ - _asm { - mov eax, a - mov edx, eax - sar edx, 30 - lea eax, [eax*4] - idiv b - } -} - -static __inline int32_t divscale3(int32_t a, int32_t b) -{ - _asm { - mov eax, a - mov edx, eax - sar edx, 29 - lea eax, [eax*8] - idiv b - } -} - -#define DIVSCALE(x,y) \ -static __inline int32_t divscale##y(int32_t a, int32_t b) \ -{ \ - _asm mov eax, a \ - _asm mov edx, eax \ - _asm sar edx, x \ - _asm shl eax, y \ - _asm idiv b \ -} - -DIVSCALE(28,4) DIVSCALE(27,5) DIVSCALE(26,6) DIVSCALE(25,7) -DIVSCALE(24,8) DIVSCALE(23,9) DIVSCALE(22,10) DIVSCALE(21,11) -DIVSCALE(20,12) DIVSCALE(19,13) DIVSCALE(18,14) DIVSCALE(17,15) -DIVSCALE(16,16) DIVSCALE(15,17) DIVSCALE(14,18) DIVSCALE(13,19) -DIVSCALE(12,20) DIVSCALE(11,21) DIVSCALE(10,22) DIVSCALE(9,23) -DIVSCALE(8,24) DIVSCALE(7,25) DIVSCALE(6,26) DIVSCALE(5,27) -DIVSCALE(4,28) DIVSCALE(3,29) DIVSCALE(2,30) DIVSCALE(1,31) - -static __inline int32_t divscale32(int32_t d, int32_t b) -{ - _asm { - mov edx, d - xor eax, eax - idiv b - } -} -#endif -static __inline char readpixel(void *d) -{ - _asm { - mov edx, d - mov al, byte ptr [edx] - } -} - -static __inline void drawpixel(void *d, char a) -{ - _asm { - mov edx, d - mov al, a - mov byte ptr [edx], al - } -} - -static __inline void drawpixels(void *d, int16_t a) -{ - _asm { - mov edx, d - mov ax, a - mov word ptr [edx], ax - } -} - -static __inline void drawpixelses(void *d, int32_t a) -{ - _asm { - mov edx, d - mov eax, a - mov dword ptr [edx], eax - } -} - -static __inline void clearbuf(void *d, int32_t c, int32_t a) -{ - _asm { - mov edi, d - mov ecx, c - mov eax, a - rep stosd - } -} - -static __inline void clearbufbyte(void *d, int32_t c, int32_t a) -{ - _asm { - mov edi, d - mov ecx, c - mov eax, a - cmp ecx, 4 - jae longcopy - test cl, 1 - jz preskip - stosb - preskip: - shr ecx, 1 - rep stosw - jmp endit - longcopy: - test edi, 1 - jz skip1 - stosb - dec ecx - skip1: - test edi, 2 - jz skip2 - stosw - sub ecx, 2 - skip2: - mov ebx, ecx - shr ecx, 2 - rep stosd - test bl, 2 - jz skip3 - stosw - skip3: - test bl, 1 - jz endit - stosb - endit: - } -} - -static __inline void copybuf(void *s, void *d, int32_t c) -{ - _asm { - mov esi, s - mov edi, d - mov ecx, c - rep movsd - } -} - -static __inline void copybufbyte(void *s, void *d, int32_t c) -{ - _asm { - mov esi, s - mov edi, d - mov ecx, c - cmp ecx, 4 - jae longcopy - test cl, 1 - jz preskip - movsb - preskip: - shr ecx, 1 - rep movsw - jmp endit - longcopy: - test edi, 1 - jz skip1 - movsb - dec ecx - skip1: - test edi, 2 - jz skip2 - movsw - sub ecx, 2 - skip2: - mov ebx, ecx - shr ecx, 2 - rep movsd - test bl, 2 - jz skip3 - movsw - skip3: - test bl, 1 - jz endit - movsb - endit: - } -} - -static __inline void copybufreverse(void *s, void *d, int32_t c) -{ - _asm { - mov esi, s - mov edi, d - mov ecx, c - shr ecx, 1 - jnc skipit1 - mov al, byte ptr [esi] - dec esi - mov byte ptr [edi], al - inc edi - skipit1: - shr ecx, 1 - jnc skipit2 - mov ax, word ptr [esi-1] - sub esi, 2 - ror ax, 8 - mov word ptr [edi], ax - add edi, 2 - skipit2: - test ecx, ecx - jz endloop - begloop: - mov eax, dword ptr [esi-3] - sub esi, 4 - bswap eax - mov dword ptr [edi], eax - add edi, 4 - dec ecx - jnz begloop - endloop: - } -} - -static __inline void qinterpolatedown16(int32_t a, int32_t c, int32_t d, int32_t s) -{ - _asm { - mov eax, a - mov ecx, c - mov edx, d - mov esi, s - mov ebx, ecx - shr ecx, 1 - jz skipbegcalc - begqcalc: - lea edi, [edx+esi] - sar edx, 16 - mov dword ptr [eax], edx - lea edx, [edi+esi] - sar edi, 16 - mov dword ptr [eax+4], edi - add eax, 8 - dec ecx - jnz begqcalc - test ebx, 1 - jz skipbegqcalc2 - skipbegcalc: - sar edx, 16 - mov dword ptr [eax], edx - skipbegqcalc2: - } -} - -static __inline void qinterpolatedown16short(int32_t a, int32_t c, int32_t d, int32_t s) -{ - _asm { - mov eax, a - mov ecx, c - mov edx, d - mov esi, s - test ecx, ecx - jz endit - test al, 2 - jz skipalignit - mov ebx, edx - sar ebx, 16 - mov word ptr [eax], bx - add edx, esi - add eax, 2 - dec ecx - jz endit - skipalignit: - sub ecx, 2 - jc finishit - begqcalc: - mov ebx, edx - add edx, esi - sar ebx, 16 - mov edi, edx - and edi, 0ffff0000h - add edx, esi - add ebx, edi - mov dword ptr [eax], ebx - add eax, 4 - sub ecx, 2 - jnc begqcalc - test cl, 1 - jz endit - finishit: - mov ebx, edx - sar ebx, 16 - mov word ptr [eax], bx - endit: - } -} - -static __inline int32_t mul3(int32_t a) -{ - _asm { - mov eax, a - lea eax, [eax+eax*2] - } -} - -static __inline int32_t mul5(int32_t a) -{ - _asm { - mov eax, a - lea eax, [eax+eax*4] - } -} - -static __inline int32_t mul9(int32_t a) -{ - _asm { - mov eax, a - lea eax, [eax+eax*8] - } -} - - //returns eax/ebx, dmval = eax%edx; -static __inline int32_t divmod(int32_t a, int32_t b) -{ - _asm { - mov eax, a - xor edx, edx - div b - mov dmval, edx - } -} - - //returns eax%ebx, dmval = eax/edx; -static __inline int32_t moddiv(int32_t a, int32_t b) -{ - _asm { - mov eax, a - xor edx, edx - div b - mov dmval, eax - mov eax, edx - } -} - -static __inline int32_t klabs(int32_t a) -{ - _asm { - mov eax, a - test eax, eax - jns skipnegate - neg eax - skipnegate: - } -} - -static __inline int32_t ksgn(int32_t b) -{ - _asm { - mov ebx, b - add ebx, ebx - sbb eax, eax - cmp eax, ebx - adc al, 0 - } -} - - //eax = (unsigned min)umin(eax,ebx) -static __inline int32_t umin(int32_t a, int32_t b) -{ - _asm { - mov eax, a - sub eax, b - sbb ecx, ecx - and eax, ecx - add eax, b - } -} - - //eax = (unsigned max)umax(eax,ebx) -static __inline int32_t umax(int32_t a, int32_t b) -{ - _asm { - mov eax, a - sub eax, b - sbb ecx, ecx - xor ecx, 0xffffffff - and eax, ecx - add eax, b - } -} - -static __inline int32_t kmin(int32_t a, int32_t b) -{ - _asm { - mov eax, a - mov ebx, b - cmp eax, ebx - jl skipit - mov eax, ebx - skipit: - } -} - -static __inline int32_t kmax(int32_t a, int32_t b) -{ - _asm { - mov eax, a - mov ebx, b - cmp eax, ebx - jg skipit - mov eax, ebx - skipit: - } -} - -static __inline void swapchar(void *a, void *b) -{ - _asm { - mov eax, a - mov ebx, b - mov cl, [eax] - mov ch, [ebx] - mov [ebx], cl - mov [eax], ch - } -} - -static __inline void swapshort(void *a, void *b) -{ - _asm { - mov eax, a - mov ebx, b - mov cx, [eax] - mov dx, [ebx] - mov [ebx], cx - mov [eax], dx - } -} - -static __inline void swaplong(void *a, void *b) -{ - _asm { - mov eax, a - mov ebx, b - mov ecx, [eax] - mov edx, [ebx] - mov [ebx], ecx - mov [eax], edx - } -} - -static __inline void swapbuf4(void *a, void *b, int32_t c) -{ - _asm { - mov eax, a - mov ebx, b - mov ecx, c - begswap: - mov esi, [eax] - mov edi, [ebx] - mov [ebx], esi - mov [eax], edi - add eax, 4 - add ebx, 4 - dec ecx - jnz short begswap - } -} - -static __inline void swap64bit(void *a, void *b) -{ - _asm { - mov eax, a - mov ebx, b - mov ecx, [eax] - mov edx, [ebx] - mov [ebx], ecx - mov ecx, [eax+4] - mov [eax], edx - mov edx, [ebx+4] - mov [ebx+4], ecx - mov [eax+4], edx - } -} - - //swapchar2(ptr1,ptr2,xsiz); is the same as: - //swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz); -static __inline void swapchar2(void *a, void *b, int32_t s) -{ - _asm { - mov eax, a - mov ebx, b - mov esi, s - add esi, ebx - mov cx, [eax] - mov dl, [ebx] - mov [ebx], cl - mov dh, [esi] - mov [esi], ch - mov [eax], dx - } -} -//}}} - -#else // _MSC_VER - -// -// Generic C -// - -#define qw(x) ((int64_t)(x)) // quadword cast -#define dw(x) ((int32_t)(x)) // doubleword cast -#define wo(x) ((int16_t)(x)) // word cast -#define by(x) ((uint8_t)(x)) // byte cast - -#define _scaler(a) \ -static inline int32_t mulscale##a(int32_t eax, int32_t edx) \ -{ \ - return dw((qw(eax) * qw(edx)) >> a); \ -} \ -\ -static inline int32_t dmulscale##a(int32_t eax, int32_t edx, int32_t esi, int32_t edi) \ -{ \ - return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> a); \ -} \ -\ -static inline int32_t tmulscale##a(int32_t eax, int32_t edx, int32_t ebx, int32_t ecx, int32_t esi, int32_t edi) \ -{ \ - return dw(((qw(eax) * qw(edx)) + (qw(ebx) * qw(ecx)) + (qw(esi) * qw(edi))) >> a); \ -} \ - -_scaler(1) _scaler(2) _scaler(3) _scaler(4) -_scaler(5) _scaler(6) _scaler(7) _scaler(8) -_scaler(9) _scaler(10) _scaler(11) _scaler(12) -_scaler(13) _scaler(14) _scaler(15) _scaler(16) -_scaler(17) _scaler(18) _scaler(19) _scaler(20) -_scaler(21) _scaler(22) _scaler(23) _scaler(24) -_scaler(25) _scaler(26) _scaler(27) _scaler(28) -_scaler(29) _scaler(30) _scaler(31) _scaler(32) - -static inline void swapchar(void* a, void* b) { char t = *((char*)b); *((char*)b) = *((char*)a); *((char*)a) = t; } -static inline void swapchar2(void* a, void* b, int32_t s) { swapchar(a,b); swapchar((char*)a+1,(char*)b+s); } -static inline void swapshort(void* a, void* b) { int16_t t = *((int16_t*)b); *((int16_t*)b) = *((int16_t*)a); *((int16_t*)a) = t; } -static inline void swaplong(void* a, void* b) { int32_t t = *((int32_t*)b); *((int32_t*)b) = *((int32_t*)a); *((int32_t*)a) = t; } -static inline void swap64bit(void* a, void* b) { int64_t t = *((int64_t*)b); *((int64_t*)b) = *((int64_t*)a); *((int64_t*)a) = t; } - -static inline char readpixel(void* s) { return (*((char*)(s))); } -static inline void drawpixel(void* s, char a) { *((char*)(s)) = a; } -static inline void drawpixels(void* s, int16_t a) { *((int16_t*)(s)) = a; } -static inline void drawpixelses(void* s, int32_t a) { *((int32_t*)(s)) = a; } - -static inline int32_t mul3(int32_t a) { return (a<<1)+a; } -static inline int32_t mul5(int32_t a) { return (a<<2)+a; } -static inline int32_t mul9(int32_t a) { return (a<<3)+a; } - -static inline int32_t divmod(int32_t a, int32_t b) { uint32_t _a=(uint32_t)a, _b=(uint32_t)b; dmval = _a%_b; return _a/_b; } -static inline int32_t moddiv(int32_t a, int32_t b) { uint32_t _a=(uint32_t)a, _b=(uint32_t)b; dmval = _a/_b; return _a%_b; } - -static inline int32_t klabs(int32_t a) { if (a < 0) return -a; return a; } -static inline int32_t ksgn(int32_t a) { if (a > 0) return 1; if (a < 0) return -1; return 0; } - -static inline int32_t umin(int32_t a, int32_t b) { if ((uint32_t)a < (uint32_t)b) return a; return b; } -static inline int32_t umax(int32_t a, int32_t b) { if ((uint32_t)a < (uint32_t)b) return b; return a; } -static inline int32_t kmin(int32_t a, int32_t b) { if ((int32_t)a < (int32_t)b) return a; return b; } -static inline int32_t kmax(int32_t a, int32_t b) { if ((int32_t)a < (int32_t)b) return b; return a; } - -static inline int32_t sqr(int32_t eax) { return (eax) * (eax); } -static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) / qw(ecx)); } -static inline int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) >> by(ecx)); } -static inline int32_t dmulscale(int32_t eax, int32_t edx, int32_t esi, int32_t edi, int32_t ecx) { return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> by(ecx)); } - -static inline int32_t boundmulscale(int32_t a, int32_t d, int32_t c) -{ // courtesy of Ken - int64_t p; - p = (((int64_t)a)*((int64_t)d))>>c; - if (p >= INT_MAX) p = INT_MAX; - if (p < INT_MIN) p = INT_MIN; - return((int32_t)p); -} - -#undef qw -#undef dw -#undef wo -#undef by -#undef _scaler - -void qinterpolatedown16 (intptr_t bufptr, int32_t num, int32_t val, int32_t add); -void qinterpolatedown16short (intptr_t bufptr, int32_t num, int32_t val, int32_t add); - -void clearbuf(void* d, int32_t c, int32_t a); -void copybuf(void* s, void* d, int32_t c); -void swapbuf4(void* a, void* b, int32_t c); - -void clearbufbyte(void *D, int32_t c, int32_t a); -void copybufbyte(void *S, void *D, int32_t c); -void copybufreverse(void *S, void *D, int32_t c); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif // __pragmas_h__ - diff --git a/polymer-perf/eduke32/build/include/prlights.h b/polymer-perf/eduke32/build/include/prlights.h deleted file mode 100644 index 03a7c52d0..000000000 --- a/polymer-perf/eduke32/build/include/prlights.h +++ /dev/null @@ -1,40 +0,0 @@ -// LIGHTS -#ifndef _prlight_h_ -# define _prlight_h_ - -#define PR_MAXLIGHTS 1024 -#define SHADOW_DEPTH_OFFSET 30 -#define PR_MAXLIGHTPRIORITY 6 - -typedef struct s_prplanelist { - struct s_prplane* plane; - struct s_prplanelist* n; -} _prplanelist; - -#pragma pack(push,1) -typedef struct s_prlight { - int32_t x, y, z, horiz, range; - int16_t angle, faderadius, radius, sector; - uint8_t color[3], priority; - int8_t minshade, maxshade; - int16_t tilenum; - // internal members - float proj[16]; - float transform[16]; - float frustum[5 * 4]; - int32_t rtindex; - struct { - int32_t active : 1; - int32_t invalidate : 1; - int32_t isinview : 1; - } flags; - uint32_t lightmap; - _prplanelist* planelist; - int32_t planecount; -} _prlight; - -extern _prlight prlights[PR_MAXLIGHTS]; -extern int32_t lightcount; -#pragma pack(pop) - -#endif diff --git a/polymer-perf/eduke32/build/include/quicklz.h b/polymer-perf/eduke32/build/include/quicklz.h deleted file mode 100644 index dd20d4b57..000000000 --- a/polymer-perf/eduke32/build/include/quicklz.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef QLZ_HEADER -#define QLZ_HEADER - -// Fast data compression library -// Copyright (C) 2006-2009 Lasse Mikkel Reinhold -// lar@quicklz.com -// -// QuickLZ can be used for free under the GPL-1 or GPL-2 license (where anything -// released into public must be open source) or under a commercial license if such -// has been acquired (see http://www.quicklz.com/order.html). The commercial license -// does not cover derived or ported versions created by third parties under GPL. - -// You can edit following user settings. Data must be decompressed with the same -// setting of QLZ_COMPRESSION_LEVEL and QLZ_STREAMING_BUFFER as it was compressed -// (see manual). If QLZ_STREAMING_BUFFER > 0, scratch buffers must be initially -// zeroed out (see manual). First #ifndef makes it possible to define settings from -// the outside like the compiler command line. - -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION - -// 1.5.0 BETA 2 - -#ifndef QLZ_COMPRESSION_LEVEL - //#define QLZ_COMPRESSION_LEVEL 1 - #define QLZ_COMPRESSION_LEVEL 2 - //#define QLZ_COMPRESSION_LEVEL 3 - - #define QLZ_STREAMING_BUFFER 0 - //#define QLZ_STREAMING_BUFFER 100000 - //#define QLZ_STREAMING_BUFFER 1000000 - - //#define QLZ_MEMORY_SAFE -#endif - -#define QLZ_VERSION_MAJOR 1 -#define QLZ_VERSION_MINOR 5 -#define QLZ_VERSION_REVISION 0 - -// Using size_t, memset() and memcpy() -#include - -// Verify compression level -#if QLZ_COMPRESSION_LEVEL != 1 && QLZ_COMPRESSION_LEVEL != 2 && QLZ_COMPRESSION_LEVEL != 3 -#error QLZ_COMPRESSION_LEVEL must be 1, 2 or 3 -#endif - -typedef unsigned int ui32; -typedef unsigned short int ui16; - -// Decrease QLZ_POINTERS for level 3 to increase compression speed. Do not touch any other values! -#if QLZ_COMPRESSION_LEVEL == 1 -#define QLZ_POINTERS 1 -#define QLZ_HASH_VALUES 4096 -#elif QLZ_COMPRESSION_LEVEL == 2 -#define QLZ_POINTERS 4 -#define QLZ_HASH_VALUES 2048 -#elif QLZ_COMPRESSION_LEVEL == 3 -#define QLZ_POINTERS 16 -#define QLZ_HASH_VALUES 4096 -#endif - -// Detect if pointer size is 64-bit. It's not fatal if some 64-bit target is not detected because this is only for adding an optional 64-bit optimization. -#if defined _LP64 || defined __LP64__ || defined __64BIT__ || _ADDR64 || defined _WIN64 || defined __arch64__ || __WORDSIZE == 64 || (defined __sparc && defined __sparcv9) || defined __x86_64 || defined __amd64 || defined __x86_64__ || defined _M_X64 || defined _M_IA64 || defined __ia64 || defined __IA64__ - #define QLZ_PTR_64 -#endif - -// hash entry -typedef struct -{ -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 cache; -#if defined QLZ_PTR_64 && QLZ_STREAMING_BUFFER == 0 - unsigned int offset; -#else - const unsigned char *offset; -#endif -#else - const unsigned char *offset[QLZ_POINTERS]; -#endif - -} qlz_hash_compress; - -typedef struct -{ -#if QLZ_COMPRESSION_LEVEL == 1 - const unsigned char *offset; -#else - const unsigned char *offset[QLZ_POINTERS]; -#endif -} qlz_hash_decompress; - - -// states -typedef struct -{ - #if QLZ_STREAMING_BUFFER > 0 - unsigned char stream_buffer[QLZ_STREAMING_BUFFER]; - #endif - size_t stream_counter; - qlz_hash_compress hash[QLZ_HASH_VALUES]; - unsigned char hash_counter[QLZ_HASH_VALUES]; -} qlz_state_compress; - - -#if QLZ_COMPRESSION_LEVEL == 1 || QLZ_COMPRESSION_LEVEL == 2 - typedef struct - { -#if QLZ_STREAMING_BUFFER > 0 - unsigned char stream_buffer[QLZ_STREAMING_BUFFER]; -#endif - qlz_hash_decompress hash[QLZ_HASH_VALUES]; - unsigned char hash_counter[QLZ_HASH_VALUES]; - size_t stream_counter; - } qlz_state_decompress; -#elif QLZ_COMPRESSION_LEVEL == 3 - typedef struct - { -#if QLZ_STREAMING_BUFFER > 0 - unsigned char stream_buffer[QLZ_STREAMING_BUFFER]; -#endif - qlz_hash_decompress hash[QLZ_HASH_VALUES]; - size_t stream_counter; - } qlz_state_decompress; -#endif - - -#if defined (__cplusplus) -extern "C" { -#endif - -// Public functions of QuickLZ -size_t qlz_size_decompressed(const char *source); -size_t qlz_size_compressed(const char *source); -size_t qlz_compress(const void *source, char *destination, size_t size, qlz_state_compress *state); -size_t qlz_decompress(const char *source, void *destination, qlz_state_decompress *state); -int qlz_get_setting(int setting); - -extern qlz_state_compress *state_compress; -extern qlz_state_decompress *state_decompress; - -#if defined (__cplusplus) -} -#endif - -#endif - diff --git a/polymer-perf/eduke32/build/include/rawinput.h b/polymer-perf/eduke32/build/include/rawinput.h deleted file mode 100644 index b0c6678d7..000000000 --- a/polymer-perf/eduke32/build/include/rawinput.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef rawinput_h__ -#define rawinput_h__ - -#include "compat.h" - -void RI_PollDevices(BOOL loop); -void RI_ProcessMessage(MSG *msg); -BOOL RI_CaptureInput(BOOL grab, HWND target); - -#ifndef VK_LBUTTON -#define VK_LBUTTON 0x01 -#endif -#ifndef VK_RBUTTON -#define VK_RBUTTON 0x02 -#endif -#ifndef VK_CANCEL -#define VK_CANCEL 0x03 -#endif -#ifndef VK_MBUTTON -#define VK_MBUTTON 0x04 /* NOT contiguous with L & RBUTTON */ -#endif - -#endif // rawinput_h__ - diff --git a/polymer-perf/eduke32/build/include/scancodes.h b/polymer-perf/eduke32/build/include/scancodes.h deleted file mode 100644 index 28760d96b..000000000 --- a/polymer-perf/eduke32/build/include/scancodes.h +++ /dev/null @@ -1,123 +0,0 @@ - -#define sc_None 0 -#define sc_Bad 0xff -#define sc_Comma 0x33 -#define sc_Period 0x34 -#define sc_Return 0x1c -#define sc_Enter sc_Return -#define sc_Escape 0x01 -#define sc_Space 0x39 -#define sc_BackSpace 0x0e -#define sc_Tab 0x0f -#define sc_LeftAlt 0x38 -#define sc_LeftControl 0x1d -#define sc_CapsLock 0x3a -#define sc_LeftShift 0x2a -#define sc_RightShift 0x36 -#define sc_F1 0x3b -#define sc_F2 0x3c -#define sc_F3 0x3d -#define sc_F4 0x3e -#define sc_F5 0x3f -#define sc_F6 0x40 -#define sc_F7 0x41 -#define sc_F8 0x42 -#define sc_F9 0x43 -#define sc_F10 0x44 -#define sc_F11 0x57 -#define sc_F12 0x58 -#define sc_Kpad_Star 0x37 -#define sc_Pause 0x59 -#define sc_ScrollLock 0x46 -#define sc_NumLock 0x45 -#define sc_Slash 0x35 -#define sc_SemiColon 0x27 -#define sc_Quote 0x28 -#define sc_Tilde 0x29 -#define sc_BackSlash 0x2b - -#define sc_OpenBracket 0x1a -#define sc_CloseBracket 0x1b - -#define sc_1 0x02 -#define sc_2 0x03 -#define sc_3 0x04 -#define sc_4 0x05 -#define sc_5 0x06 -#define sc_6 0x07 -#define sc_7 0x08 -#define sc_8 0x09 -#define sc_9 0x0a -#define sc_0 0x0b -#define sc_Minus 0x0c -#define sc_Equals 0x0d -#define sc_Plus 0x0d - -#define sc_kpad_1 0x4f -#define sc_kpad_2 0x50 -#define sc_kpad_3 0x51 -#define sc_kpad_4 0x4b -#define sc_kpad_5 0x4c -#define sc_kpad_6 0x4d -#define sc_kpad_7 0x47 -#define sc_kpad_8 0x48 -#define sc_kpad_9 0x49 -#define sc_kpad_0 0x52 -#define sc_kpad_Minus 0x4a -#define sc_kpad_Plus 0x4e -#define sc_kpad_Period 0x53 - -#define sc_A 0x1e -#define sc_B 0x30 -#define sc_C 0x2e -#define sc_D 0x20 -#define sc_E 0x12 -#define sc_F 0x21 -#define sc_G 0x22 -#define sc_H 0x23 -#define sc_I 0x17 -#define sc_J 0x24 -#define sc_K 0x25 -#define sc_L 0x26 -#define sc_M 0x32 -#define sc_N 0x31 -#define sc_O 0x18 -#define sc_P 0x19 -#define sc_Q 0x10 -#define sc_R 0x13 -#define sc_S 0x1f -#define sc_T 0x14 -#define sc_U 0x16 -#define sc_V 0x2f -#define sc_W 0x11 -#define sc_X 0x2d -#define sc_Y 0x15 -#define sc_Z 0x2c - -// Extended scan codes - -#define sc_UpArrow 0xc8 //0x5a -#define sc_DownArrow 0xd0 //0x6a -#define sc_LeftArrow 0xcb //0x6b -#define sc_RightArrow 0xcd //0x6c -#define sc_Insert 0xd2 //0x5e -#define sc_Delete 0xd3 //0x5f -#define sc_Home 0xc7 //0x61 -#define sc_End 0xcf //0x62 -#define sc_PgUp 0xc9 //0x63 -#define sc_PgDn 0xd1 //0x64 -#define sc_RightAlt 0xb8 //0x65 -#define sc_RightControl 0x9d //0x66 -#define sc_kpad_Slash 0xb5 //0x67 -#define sc_kpad_Enter 0x9c //0x68 -#define sc_PrintScreen 0xb7 //0x69 -#define sc_LastScanCode 0x6e - -// Ascii scan codes - -#define asc_Enter 13 -#define asc_Escape 27 -#define asc_BackSpace 8 -#define asc_Tab 9 -#define asc_Space 32 - diff --git a/polymer-perf/eduke32/build/include/scriptfile.h b/polymer-perf/eduke32/build/include/scriptfile.h deleted file mode 100644 index a19531a9a..000000000 --- a/polymer-perf/eduke32/build/include/scriptfile.h +++ /dev/null @@ -1,27 +0,0 @@ -typedef struct { - char *textbuf; - uint32_t textlength; - char *ltextptr; // pointer to start of the last token fetched (use this for line numbers) - char *textptr; - char *eof; - char *filename; - int32_t linenum; - int32_t *lineoffs; -} scriptfile; - -char *scriptfile_gettoken(scriptfile *sf); -int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num); -int32_t scriptfile_getdouble(scriptfile *sf, double *num); -int32_t scriptfile_getstring(scriptfile *sf, char **st); -int32_t scriptfile_getsymbol(scriptfile *sf, int32_t *num); -int32_t scriptfile_getlinum(scriptfile *sf, char *ptr); -int32_t scriptfile_getbraces(scriptfile *sf, char **braceend); - -scriptfile *scriptfile_fromfile(const char *fn); -scriptfile *scriptfile_fromstring(const char *string); -void scriptfile_close(scriptfile *sf); -int32_t scriptfile_eof(scriptfile *sf); - -int32_t scriptfile_getsymbolvalue(char *name, int32_t *val); -int32_t scriptfile_addsymbolvalue(char *name, int32_t val); -void scriptfile_clearsymbols(void); diff --git a/polymer-perf/eduke32/build/include/sdl_inc.h b/polymer-perf/eduke32/build/include/sdl_inc.h deleted file mode 100644 index 267703358..000000000 --- a/polymer-perf/eduke32/build/include/sdl_inc.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __SDL_INC_H -#define __SDL_INC_H - -#if defined(SDL_FRAMEWORK) -# include -#else -# include "SDL.h" -#endif - -/* ================================================================= -Minimum required SDL versions: -=================================================================== */ - -#define SDL_MIN_X 1 -#define SDL_MIN_Y 2 -#define SDL_MIN_Z 10 - -#define SDL_REQUIREDVERSION (SDL_VERSIONNUM(SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z)) - -#define SDL_MIXER_MIN_X 1 -#define SDL_MIXER_MIN_Y 2 -#define SDL_MIXER_MIN_Z 7 -#define MIX_REQUIREDVERSION (SDL_VERSIONNUM(SDL_MIXER_MIN_X,SDL_MIXER_MIN_Y,SDL_MIXER_MIN_Z)) - -#if !(SDL_VERSION_ATLEAST(SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z)) -#error SDL version found is too old -#endif - -#if defined(_NEED_SDLMIXER) -# if defined(SDL_FRAMEWORK) -# include -# else -# include "SDL_mixer.h" -# endif -/* starting with 1.2.1, SDL_mixer provides MIX_xxx version - macros. the new SDL_MIXER_xxx version macros start with - 1.2.6 but they keep backwards compatibility. 1.2.0 does - not even have any version macros, so let's reject it */ -#if !defined(MIX_MAJOR_VERSION) || !defined(MIX_MINOR_VERSION) || !defined(MIX_PATCHLEVEL) -#error SDL_mixer version found is too old -#endif -#ifndef MIX_COMPILEDVERSION -#define MIX_COMPILEDVERSION (SDL_VERSIONNUM(MIX_MAJOR_VERSION,MIX_MINOR_VERSION,MIX_PATCHLEVEL)) -#endif -#if MIX_COMPILEDVERSION < MIX_REQUIREDVERSION -#error SDL_mixer version found is too old -#endif /* end of bad version error */ -#endif /* end of SDL_mixer checks */ - -#endif /* __SDL_INC_H */ - diff --git a/polymer-perf/eduke32/build/include/sdlayer.h b/polymer-perf/eduke32/build/include/sdlayer.h deleted file mode 100644 index ab19ff2a3..000000000 --- a/polymer-perf/eduke32/build/include/sdlayer.h +++ /dev/null @@ -1,21 +0,0 @@ -// SDL interface layer -// for the Build Engine -// by Jonathon Fowler (jonof@edgenetwk.com) - -#ifndef __build_interface_layer__ -#define __build_interface_layer__ SDL - -#include "baselayer.h" - -struct sdlappicon { - int32_t width,height; - uint32_t *pixels; - uint8_t *mask; -}; - -#else -#if (__build_interface_layer__ != SDL) -#error "Already using the " __build_interface_layer__ ". Can't now use SDL." -#endif -#endif // __build_interface_layer__ - diff --git a/polymer-perf/eduke32/build/include/startwin.editor.h b/polymer-perf/eduke32/build/include/startwin.editor.h deleted file mode 100644 index c0fff2210..000000000 --- a/polymer-perf/eduke32/build/include/startwin.editor.h +++ /dev/null @@ -1,19 +0,0 @@ -// resource ids -#define WIN_STARTWIN 1000 -#define WIN_STARTWINPAGE_CONFIG 2000 -#define WIN_STARTWIN_BITMAP 100 // banner bitmap -#define WIN_STARTWIN_TABCTL 101 -#define WIN_STARTWIN_CANCEL IDCANCEL -#define WIN_STARTWIN_START IDOK - -#define WIN_STARTWIN_MESSAGES 104 // output list box - -#define RSRC_ICON 100 -#define RSRC_BMP 200 - -// config page -#define IDCFULLSCREEN 100 -#define IDC2DVMODE 101 -#define IDC3DVMODE 102 -#define IDCALWAYSSHOW 103 - diff --git a/polymer-perf/eduke32/build/include/winlayer.h b/polymer-perf/eduke32/build/include/winlayer.h deleted file mode 100644 index ce0937db8..000000000 --- a/polymer-perf/eduke32/build/include/winlayer.h +++ /dev/null @@ -1,28 +0,0 @@ -// Windows DIB/DirectDraw interface layer -// for the Build Engine -// by Jonathon Fowler (jonof@edgenetwk.com) - -#ifndef __build_interface_layer__ -#define __build_interface_layer__ WIN - -extern int32_t backgroundidle; // set to 1 to tell winlayer to go to idle priority when inactive -extern uint32_t maxrefreshfreq; - -extern int32_t glusecds; - -extern char di_disabled; - -int32_t win_gethwnd(void); -int32_t win_gethinstance(void); - -void win_allowtaskswitching(int32_t onf); -int32_t win_checkinstance(void); - -#include "baselayer.h" - -#else -#if (__build_interface_layer__ != WIN) -#error "Already using the " __build_interface_layer__ ". Can't now use Windows." -#endif -#endif // __build_interface_layer__ - diff --git a/polymer-perf/eduke32/build/obj.gnu/keep.me b/polymer-perf/eduke32/build/obj.gnu/keep.me deleted file mode 100644 index e69de29bb..000000000 diff --git a/polymer-perf/eduke32/build/obj.msc/keep.me b/polymer-perf/eduke32/build/obj.msc/keep.me deleted file mode 100644 index e69de29bb..000000000 diff --git a/polymer-perf/eduke32/build/rsrc/build.bmp b/polymer-perf/eduke32/build/rsrc/build.bmp deleted file mode 100644 index 6800c5365..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/build.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/build/rsrc/build.xcf b/polymer-perf/eduke32/build/rsrc/build.xcf deleted file mode 100644 index a1ddd6d4e..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/build.xcf and /dev/null differ diff --git a/polymer-perf/eduke32/build/rsrc/build_icon.bmp b/polymer-perf/eduke32/build/rsrc/build_icon.bmp deleted file mode 100644 index 0244f3f79..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/build_icon.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/build/rsrc/build_icon.c b/polymer-perf/eduke32/build/rsrc/build_icon.c deleted file mode 100644 index f08f95938..000000000 --- a/polymer-perf/eduke32/build/rsrc/build_icon.c +++ /dev/null @@ -1,192 +0,0 @@ -#include "sdlayer.h" - -static unsigned int sdlappicon_pixels[] = { - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff654848, 0xffad8484, - 0xffb18888, 0xffbb8f8f, 0xff936d6d, 0xff130303, 0xff987373, 0xff936d6d, - 0xff100000, 0xff815f5f, 0xffaa8181, 0xff362020, 0xffa98080, 0xff5c3f3f, - 0xff715252, 0xffb78b8b, 0xff130202, 0xff100000, 0xff2f1a1a, 0xffa07a7a, - 0xffb78c8c, 0xffbd9090, 0xff856262, 0xff140303, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff432a2a, 0xff825f5f, 0xff190808, 0xff4c3131, 0xffd5a2a2, 0xff2c1717, - 0xff7e5b5b, 0xff543939, 0xff100000, 0xff674848, 0xff6e4f4f, 0xff100000, - 0xffb58989, 0xff1c0a0a, 0xff513535, 0xff7f5d5d, 0xff100000, 0xff100000, - 0xff100000, 0xffa97f7f, 0xff271414, 0xff220f0f, 0xffbb8d8d, 0xff442b2b, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff432a2a, 0xffba8e8e, 0xffb88d8d, 0xffc19494, - 0xff987171, 0xff110101, 0xff7e5b5b, 0xff533939, 0xff100000, 0xff694949, - 0xff6e4f4f, 0xff100000, 0xffb08585, 0xff1c0a0a, 0xff513535, 0xff7b5a5a, - 0xff100000, 0xff100000, 0xff100000, 0xffa67c7c, 0xff261212, 0xff100000, - 0xff956e6e, 0xff704f4f, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff4c3232, 0xff896565, - 0xff261212, 0xff503535, 0xffd4a2a2, 0xff351e1e, 0xff755454, 0xff835f5f, - 0xff261111, 0xff936c6c, 0xff715050, 0xff160505, 0xffb28686, 0xff241111, - 0xff573a3a, 0xff836060, 0xff251111, 0xff674949, 0xff140303, 0xffa77e7e, - 0xff392222, 0xff3a2222, 0xffbf9191, 0xff3b2424, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff725252, 0xffb78a8a, 0xffc19292, 0xffba8c8c, 0xff866161, 0xff110101, - 0xff2c1818, 0xffb28585, 0xffc49393, 0xffab8080, 0xff261313, 0xff3f2727, - 0xffb18686, 0xff644545, 0xff7c5a5a, 0xffb98c8c, 0xffc09191, 0xffba8c8c, - 0xff341e1e, 0xffa77e7e, 0xffbf9090, 0xffba8d8d, 0xff745353, 0xff110101, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff272159, 0xff383793, 0xff3e3da3, 0xff2e286b, - 0xff2e296e, 0xff2a2157, 0xff100001, 0xff37358e, 0xff140611, 0xff353286, - 0xff3d3ca0, 0xff3f3c9f, 0xff180a1a, 0xff323080, 0xff353285, 0xff261e51, - 0xff322c75, 0xff100000, 0xff322e7b, 0xff1f153a, 0xff333284, 0xff3b3a9d, - 0xff403fa8, 0xff13040b, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff2e296d, 0xff251c4b, - 0xff1a0d25, 0xff110104, 0xff353284, 0xff5453db, 0xff1a0d22, 0xff3e3da6, - 0xff231a47, 0xff332f7d, 0xff150714, 0xff2c225b, 0xff1f1333, 0xff2b2461, - 0xff281f54, 0xff2a235d, 0xff5454df, 0xff251a44, 0xff38358f, 0xff211841, - 0xff332f7e, 0xff1c0f29, 0xff140611, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff2f296f, 0xff3e3ca0, 0xff332e7d, 0xff100000, 0xff363287, 0xff2d2667, - 0xff3f3ca0, 0xff4746bc, 0xff241b4a, 0xff2a235f, 0xff1e1436, 0xff3d3b9e, - 0xff1f1231, 0xff2a225d, 0xff271f52, 0xff2a2461, 0xff30296e, 0xff4441af, - 0xff4443b2, 0xff231944, 0xff3e3ea5, 0xff3c3998, 0xff1a0e25, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff302a73, 0xff2e2768, 0xff241b48, 0xff1e1232, - 0xff39358f, 0xff190d24, 0xff35307f, 0xff5150d4, 0xff22173f, 0xff4746b9, - 0xff2a2159, 0xff4947bd, 0xff261d4d, 0xff35307f, 0xff352f7d, 0xff2d2667, - 0xff261c4c, 0xff292158, 0xff5555df, 0xff231a47, 0xff38358f, 0xff251b49, - 0xff261c4c, 0xff110205, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff221842, 0xff2f286c, - 0xff2f286b, 0xff221840, 0xff383b78, 0xff292c43, 0xff2a2c43, 0xff4650a1, - 0xff252633, 0xff424a92, 0xff4650a3, 0xff3d4587, 0xff252634, 0xff404990, - 0xff40498f, 0xff363c6e, 0xff2f3458, 0xff252633, 0xff4851a4, 0xff1a0e26, - 0xff2d2666, 0xff2f286b, 0xff2e276a, 0xff110206, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff446281, 0xff527ea5, - 0xff4f799e, 0xff537fa6, 0xff517ca3, 0xff5a88b3, 0xff45698a, 0xff537fa7, - 0xff4e779b, 0xff5480a8, 0xff5581a9, 0xff5683ac, 0xff5987b1, 0xff5887b0, - 0xff547fa7, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff241d34, 0xff251f3c, 0xff1c101d, 0xff14080c, - 0xff4d5c85, 0xff546a96, 0xff4b5f87, 0xff36475f, 0xff5b6f86, 0xff507096, - 0xff405683, 0xff394d6e, 0xff51657c, 0xff556f92, 0xff405785, 0xff394e72, - 0xff435d86, 0xff466094, 0xff466095, 0xff261c33, 0xff211b3a, 0xff221d3b, - 0xff150913, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff170b1a, 0xff505cb1, 0xff363d88, - 0xff241e3f, 0xff31305e, 0xff45498c, 0xff424381, 0xff3c3c7e, 0xff2a295d, - 0xff6b72a4, 0xff2c2d76, 0xff2e2f7e, 0xff252565, 0xff6771a5, 0xff2c2d78, - 0xff2f3180, 0xff292970, 0xff424999, 0xff313188, 0xff2d2d7b, 0xff414a9c, - 0xff343490, 0xff2f2e7f, 0xff150b1c, 0xff100000, 0xff100103, 0xff150714, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff32305e, - 0xff3a3f98, 0xff394095, 0xff1e163c, 0xff3f3c77, 0xff323388, 0xff434991, - 0xff303082, 0xff39438f, 0xff313385, 0xff323481, 0xff3e4598, 0xff2d2e7d, - 0xff454ba0, 0xff2c2c7a, 0xff3b429e, 0xff2c2c79, 0xff4249ac, 0xff323289, - 0xff191532, 0xff4c51a2, 0xff393998, 0xff211e48, 0xff100104, 0xff100000, - 0xff180b1f, 0xff251c4a, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff4751a7, 0xff3b3b9e, 0xff424ea6, 0xff1f173f, 0xff3e4293, - 0xff363694, 0xff3b4598, 0xff353592, 0xff424793, 0xff373796, 0xff3b3f8f, - 0xff393a9b, 0xff393a89, 0xff4244a1, 0xff2d2f7a, 0xff27225c, 0xff272460, - 0xff4a50b1, 0xff3e3ea5, 0xff383b95, 0xff4b53c0, 0xff4343ae, 0xff3a3c98, - 0xff100206, 0xff100000, 0xff2a225b, 0xff1d112e, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff1a0e22, 0xff545bc6, 0xff3e42a0, 0xff464db5, - 0xff231b47, 0xff4f58b7, 0xff3e3ea3, 0xff4e53ab, 0xff393998, 0xff4045a8, - 0xff4040a7, 0xff3d4798, 0xff4141ab, 0xff3d459a, 0xff4242ad, 0xff3a4094, - 0xff4444b0, 0xff3c439c, 0xff4445b1, 0xff2d2c76, 0xff1d1736, 0xff4c54bf, - 0xff36358e, 0xff11030a, 0xff0f0000, 0xff100000, 0xff4547ab, 0xff1b0f29, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff3a3671, 0xff494bb6, - 0xff4c52a4, 0xff5052b1, 0xff2b2663, 0xff4b52c0, 0xff4445b1, 0xff4344af, - 0xff2d2a70, 0xff4d58be, 0xff3e3ea2, 0xff4149a6, 0xff4040a7, 0xff464da6, - 0xff4444b1, 0xff454ca2, 0xff4444b0, 0xff414ca1, 0xff4444b3, 0xff343585, - 0xff323473, 0xff4a4cc3, 0xff3f45a1, 0xff1e182d, 0xff100000, 0xff190e26, - 0xff758bf0, 0xff21173f, 0xff100000, 0xff100000, 0xff100000, 0xff100001, - 0xff5052af, 0xff4545b8, 0xff4e51bd, 0xff4444b4, 0xff36378f, 0xff525ac3, - 0xff333284, 0xff12050e, 0xff170915, 0xff4c52c6, 0xff4343b2, 0xff5053c2, - 0xff3a3a9c, 0xff4045aa, 0xff4848be, 0xff484abf, 0xff4242b0, 0xff3f45a6, - 0xff4545b7, 0xff4343b2, 0xff474cab, 0xff4545b9, 0xff4646bd, 0xff1f1a45, - 0xff160918, 0xff5e65c0, 0xffc4d6f6, 0xff4244a4, 0xff100103, 0xff100000, - 0xff100000, 0xff1a0e23, 0xff575cd5, 0xff4140aa, 0xff34307b, 0xff4949c3, - 0xff3d439f, 0xff4b4ec4, 0xff2b2666, 0xff100000, 0xff13040a, 0xff313279, - 0xff3f3fa9, 0xff3e41a5, 0xff333681, 0xff333183, 0xff4041ad, 0xff4248ae, - 0xff4751b6, 0xff5467ca, 0xff556bcc, 0xff5870d1, 0xff7385d6, 0xff7b87d3, - 0xff9096d5, 0xff969fd7, 0xffb6bef0, 0xffebeff9, 0xfffafafa, 0xffadc5f7, - 0xff5567c8, 0xff2e2768, 0xff100000, 0xff373872, 0xff5154d4, 0xff332e7a, - 0xff33326d, 0xff4d4dcf, 0xff474fa7, 0xff4444b4, 0xff2d2761, 0xff2a2751, - 0xff3a4186, 0xff4b52bb, 0xff535ed5, 0xff5762df, 0xff5666e6, 0xff5a66ef, - 0xff5b6bee, 0xff5b73d9, 0xff5062b6, 0xff444f9c, 0xff3d4685, 0xff373b71, - 0xff373769, 0xff433b67, 0xff433c66, 0xff433e70, 0xff7179d1, 0xffccd9f6, - 0xffd1dbf4, 0xff6166bd, 0xff201639, 0xff110205, 0xff100001, 0xff525abb, - 0xff5050d7, 0xff231a45, 0xff3c3a63, 0xff3d3da4, 0xff3e46a1, 0xff404ba1, - 0xff3f47a2, 0xff3f42a7, 0xff4545b7, 0xff4c4ccb, 0xff5050d7, 0xff4e4fd1, - 0xff393792, 0xff251c4d, 0xff160a1b, 0xff100103, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff1a0f29, 0xff6d87f4, 0xff5b67d8, 0xff150712, 0xff100000, 0xff100000, - 0xff1c1227, 0xff5b66de, 0xff4646bf, 0xff261f4e, 0xff3c4389, 0xff3c4599, - 0xff2f317c, 0xff2d2d7a, 0xff303081, 0xff34348f, 0xff383898, 0xff3b3b9e, - 0xff2a2a64, 0xff150817, 0xff0f0000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100103, 0xff5863e1, 0xff2e286a, 0xff100000, - 0xff100000, 0xff100000, 0xff38386d, 0xff4143aa, 0xff3f499e, 0xff374089, - 0xff2b2b73, 0xff2b2b75, 0xff2a2a73, 0xff2b2b74, 0xff2d2d7b, 0xff303081, - 0xff2c2e75, 0xff150f1c, 0xff0f0000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff4c4bc6, - 0xff150815, 0xff100000, 0xff100000, 0xff100000, 0xff3a438e, 0xff353f84, - 0xff262766, 0xff262665, 0xff262666, 0xff272769, 0xff272769, 0xff28286d, - 0xff292970, 0xff272769, 0xff120a0f, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100001, 0xff3a358f, 0xff0f0000, 0xff100000, 0xff100000, 0xff100000, - 0xff170e10, 0xff16060e, 0xff13050e, 0xff19060e, 0xff19070e, 0xff110103, - 0xff100002, 0xff100002, 0xff100002, 0xff100001, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff13050e, 0xff28215b, 0xff100000, 0xff100000, - 0xff100000, 0xff100000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, - 0xff000000, 0xff000000, 0xff000000, 0xff000000,}; - -static unsigned char sdlappicon_mask[] = { - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255,}; - -struct sdlappicon sdlappicon = { - 32,32, // width,height - sdlappicon_pixels, - sdlappicon_mask -}; diff --git a/polymer-perf/eduke32/build/rsrc/build_icon.ico b/polymer-perf/eduke32/build/rsrc/build_icon.ico deleted file mode 100644 index d585cc156..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/build_icon.ico and /dev/null differ diff --git a/polymer-perf/eduke32/build/rsrc/editor_banner.c b/polymer-perf/eduke32/build/rsrc/editor_banner.c deleted file mode 100644 index 017374033..000000000 --- a/polymer-perf/eduke32/build/rsrc/editor_banner.c +++ /dev/null @@ -1,2260 +0,0 @@ -#include -/* GdkPixbuf RGB C-Source image dump */ - -const GdkPixdata startbanner_pixdata = { - 0x47646b50, /* Pixbuf magic: 'GdkP' */ - 24 + 76160, /* header length + pixel_data length */ - 0x1010001, /* pixdata_type */ - 272, /* rowstride */ - 90, /* width */ - 280, /* height */ - /* pixel_data: */ - "\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\2" - "\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\0\"M\4\37M\4\37M\0\"M" - "\4\37M\4\37M\0\"M\0\"M\4\37M\0\"M\0#O\0#O\0$P\0#O\0$P\0$P\14#Q\0%Q\0" - "$P\0$P\14#Q\0%Q\14#Q\0%Q\14#Q\14#Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\2'T\2'T" - "\2'T\14#Q\2'T\2'T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X" - "\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\0\0\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\15@s\15@s\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\24" - "Cw\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\32G{\32" - "G{\32G{\34H|\32G{\32G{\35I}\35I}\35I}\35I}\34H|\20L\177\20L\177\20L\177" - "\35I}\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202" - "\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P" - "\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\0\0\2\36E\2\36E\2\36E\2\36E" - "\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5" - "\40H\5\40H\5\40H\5\40H\0\"M\4\37M\4\37M\4\37M\4\37M\4\37M\0\"M\0\"M\0" - "#O\0\"M\14#Q\0$P\0$P\0$P\0#O\14#Q\0%Q\0$P\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\14" - "#Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2" - "'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12" - "+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\17At\15@s\17" - "At\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30" - "Ey\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\34H|\34H|\34H|\32G{\35I}\35I}\35" - "I}\20L\177\35I}\35I}\20L\177\20L\177\20L\177\22M\200\22M\200\22M\200" - "\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\27P" - "\203\27P\203\27P\203\27P\203\35I}\27P\203\27P\203\27P\203\27P\203\33" - "Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205" - "\33Q\205\33Q\205\0\0\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H" - "\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\0\"M\4\37M\0\"M\4\37" - "M\4\37M\4\37M\0\"M\4\37M\4\37M\0\"M\0#O\0\"M\0#O\0#O\0#O\0$P\0$P\0$P" - "\0%Q\14#Q\0$P\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\14" - "#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X" - "\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,ZK\312\363K\312\363\13,Z\13,Z\13,Z\0\0" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23" - "Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\24Cw\30Ey\30" - "Ey\30Ey\32G{\32G{\32G{\34H|\34H|\34H|\35I}\35I}\35I}\35I}\34H|\20L\177" - "\20L\177\35I}\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202" - "\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P" - "\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33" - "Q\205\0\0\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40" - "H\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\0\"M\4\37M\4\37M\4\37M\4\37M\0" - "\"M\0\"M\4\37M\0\"M\14#Q\0\"M\0$P\0$P\0$P\0$P\0$P\14#Q\0$P\14#Q\0$P\0" - "%Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2" - "'T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X" - "\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,ZK\312\363K\312\363\13,Z\13,Z\13,Z\0\0\11>q\11>" - "q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15" - "@s\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23" - "Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\34" - "H|\32G{\20L\177\34H|\32G{\35I}\35I}\35I}\34H|\20L\177\20L\177\20L\177" - "\35I}\22M\200\22M\200\24N\201\24N\201\24N\201\26O\202\26O\202\26O\202" - "\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P" - "\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33" - "Q\205\0\0\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40" - "H\5\40H\5\40H\4\37M\4\37M\0\"M\4\37M\4\37M\4\37M\4\37M\0\"M\0\"M\4\37" - "M\0\"M\0\"M\0#O\0\"M\0$P\0$P\0#O\0$P\0%Q\0$P\14#Q\0$P\14#Q\0%Q\0%Q\14" - "#Q\14#Q\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2" - "'T\2'T\10*X\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12" - "+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\13,ZK\312\363K\312\363\13,Z\13,Z\13,Z\0\0\11>q\11>q\11>" - "q\11>q\11>q\11>q\11>q\11>q\15@s\11>q\11>q\15@s\15@s\15@s\15@s\15@s\17" - "At\15@s\15@s\17At\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24" - "Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34H|\34H|\32" - "G{\34H|\20L\177\35I}\35I}\34H|\35I}\20L\177\20L\177\35I}\20L\177\22M" - "\200\22M\200\24N\201\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202" - "\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P" - "\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33" - "Q\205\0\0\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\4\37" - "M\0\"M\4\37M\4\37M\4\37M\4\37M\4\37M\4\37M\0\"M\0\"M\4\37M\0\"M\0\"M" - "\0\"M\14#Q\0#O\0$P\0$P\0#O\0$P\0$P\0%Q\14#Q\0$P\0%Q\0%Q\14#Q\0%Q\14#" - "Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12" - "+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,ZK\312\363K\312\363\13,Z\13,Z\13,Z\0\0\11>q\11>q\11>q\11>" - "q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\15@s\15@s\15@s\15@s\17" - "At\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24" - "Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34H|\34H|\32G{\34H|\35" - "I}\35I}\34H|\35I}\35I}\20L\177\35I}\20L\177\20L\177\22M\200\22M\200\24" - "N\201\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203" - "\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0" - "\0\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\0\"M\4\37M\4\37M\4" - "\37M\0\"M\4\37M\4\37M\4\37M\4\37M\0\"M\4\37M\0\"M\0\"M\0\"M\0#O\0$P\0" - "$P\0$P\0$P\0$P\0$P\0%Q\0$P\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\14#Q\14#Q\14#Q" - "\14#Q\0%Q\14#Q\0%Q\14#Q\2'T\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12" - "+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15" - "-[\15-[K\312\363K\312\363\15-[\15-[\15-[\0\0\11>q\11>q\11>q\11>q\15@" - "s\15@s\15@s\15@s\15@s\15@s\15@s\15@s\15@s\15@s\15@s\17At\17At\17At\23" - "Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\24" - "Cw\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\34H|\34H|\34H|\32G{\34H|\35I}\35I}\35" - "I}\35I}\35I}\20L\177\35I}\35I}\22M\200\22M\200\22M\200\24N\201\24N\201" - "\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P" - "\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0\0\5" - "\40H\5\40H\5\40H\5\40H\4\37M\4\37M\4\37M\4\37M\0\"M\4\37M\4\37M\4\37" - "M\5\40H\4\37M\0\"M\0\"M\4\37M\0\"M\0#O\0\"M\0#O\0#O\0$P\0#O\0$P\0$P\14" - "#Q\0%Q\0%Q\14#Q\0$P\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\14#Q\0%Q\14#" - "Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\2'T\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[K" - "\312\363K\312\363\15-[\15-[\15-[\0\0\15@s\15@s\15@s\15@s\15@s\15@s\15" - "@s\15@s\15@s\15@s\15@s\15@s\15@s\17At\17At\17At\23Bv\23Bv\23Bv\23Bv\23" - "Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30" - "Ey\30Ey\32G{\30Ey\34H|\34H|\34H|\34H|\35I}\35I}\35I}\35I}\35I}\35I}\20" - "L\177\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\35I}\26O\202\26" - "O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0\0\0\"M\4" - "\37M\4\37M\4\37M\4\37M\0\"M\4\37M\0\"M\4\37M\4\37M\4\37M\0\"M\4\37M\0" - "\"M\4\37M\0\"M\0\"M\0\"M\0#O\0\"M\14#Q\0#O\0$P\0$P\14#Q\0$P\0%Q\14#Q" - "\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\2'" - "T\2'T\14#Q\2'T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[K\312\363" - "K\312\363\15-[\15-[\15-[\0\0\15@s\15@s\15@s\15@s\15@s\15@s\15@s\15@s" - "\15@s\15@s\15@s\17At\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23" - "Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32" - "G{\30Ey\34H|\32G{\34H|\34H|\35I}\35I}\34H|\35I}\20L\177\20L\177\35I}" - "\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O" - "\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0" - "\0\0\"M\4\37M\5\40H\4\37M\4\37M\0\"M\4\37M\0\"M\4\37M\0\"M\0\"M\0\"M" - "\4\37M\0\"M\0#O\0\"M\0\"M\0#O\0$P\0#O\0$P\0#O\14#Q\14#Q\0$P\0%Q\0$P\0" - "%Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2" - "'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12" - "+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[K\312\363" - "K\312\363\15-[\15-[\15-[\0\0\15@s\15@s\15@s\15@s\15@s\15@s\15@s\15@s" - "\23Bv\17At\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24" - "Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\34" - "H|\34H|\34H|\34H|\20L\177\35I}\35I}\35I}\34H|\20L\177\20L\177\20L\177" - "\20L\177\22M\200\22M\200\22M\200\24N\201\26O\202\26O\202\26O\202\26O" - "\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33" - "Q\205\0\0\4\37M\4\37M\0\"M\4\37M\0\"M\4\37M\0\"M\0\"M\0\"M\4\37M\0\"" - "M\0#O\0#O\0\"M\0\"M\0\"M\0$P\0#O\0$P\0$P\0$P\14#Q\0%Q\14#Q\0%Q\0%Q\14" - "#Q\0%Q\0%Q\0%Q\14#Q\14#Q\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2" - "'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12" - "+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[K" - "\312\363K\312\363\15-[\15-[\15-[\0\0\15@s\15@s\15@s\15@s\15@s\17At\17" - "At\17At\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24" - "Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34" - "H|\34H|\34H|\34H|\35I}\34H|\35I}\35I}\35I}\20L\177\20L\177\35I}\22M\200" - "\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O" - "\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33" - "Q\205\0\0\4\37M\4\37M\0\"M\4\37M\4\37M\4\37M\0\"M\0\"M\0#O\14#Q\0\"M" - "\0\"M\0\"M\0\"M\0\"M\0$P\0$P\0$P\0#O\0$P\0$P\0%Q\14#Q\0%Q\0%Q\0%Q\0%" - "Q\0%Q\0%Q\14#Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\2'T\14#Q\2'T\14#Q\2'T\2" - "'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+" - "Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[K\312\363K\312\363\15-[\15-[\15-[\0\0\15@s\17At\17At\17At\17At\17A" - "t\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24" - "Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\34" - "H|\34H|\20L\177\34H|\34H|\35I}\35I}\35I}\20L\177\20L\177\20L\177\35I" - "}\22M\200\35I}\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202" - "\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\34R" - "\206\34R\206\34R\206\34R\206\34R\206\34R\206K\312\363K\312\363\33Q\205" - "\33Q\205\33Q\205\0\0\0\"M\0\"M\4\37M\0\"M\4\37M\0\"M\0\"M\0\"M\14#Q\0" - "\"M\0$P\0#O\0$P\0#O\0$P\0$P\0$P\14#Q\0$P\0%Q\0$P\0%Q\14#Q\0%Q\14#Q\0" - "%Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T" - "\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y" - "\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\15-[\15-[\15-[" - "\15-[\15-[K\312\363K\312\363\15-[\15-[\15-[\0\0\17At\17At\17At\23Bv\23" - "Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24" - "Cw\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\20L\177" - "\34H|\34H|\34H|\34H|\20L\177\35I}\35I}\35I}\35I}\20L\177\20L\177\35I" - "}\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\35I}\26O\202" - "\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\34R" - "\206\34R\206\34R\206\34R\206\34R\206\34R\206\34R\206K\312\363K\312\363" - "\33Q\205\33Q\205\33Q\205\0\0\4\37M\0\"M\14#Q\0\"M\14#Q\0\"M\0\"M\0\"" - "M\0#O\0$P\0#O\0$P\0#O\0#O\0$P\14#Q\14#Q\14#Q\0$P\14#Q\0$P\0%Q\0%Q\0%" - "Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'" - "T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12" - "+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17" - ".\\\15-[\15-[\15-[K\312\363K\312\363\15-[\15-[\15-[\0\0\23Bv\23Bv\23" - "Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\23Bv\23Bv\24Cw\23Bv\24Cw\24Cw\24" - "Cw\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\34" - "H|\34H|\34H|\34H|\34H|\35I}\20L\177\35I}\35I}\20L\177\35I}\20L\177\20" - "L\177\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202" - "\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\34R\206\34R\206\34R\206\34R\206\34R\206\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\34R\206\34R\206" - "K\312\363K\312\363\34R\206\33Q\205\33Q\205\0\0\0\"M\0\"M\0#O\0\"M\0\"" - "M\0$P\0#O\0$P\0#O\0$P\0#O\0#O\0#O\14#Q\0$P\14#Q\0$P\14#Q\0$P\0%Q\14#" - "Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\2'T\2'T\2" - "'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12" - "+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[K\312\363K\312\363\15-[\15-[\15" - "-[\0\0\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24" - "Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32" - "G{\30Ey\34H|\34H|\34H|\32G{\34H|\35I}\20L\177\35I}\20L\177\35I}\20L\177" - "\35I}\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202" - "\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\34R\206\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\34R\206\34R\206\34R\206K\312\363K\312\363\34R\206\33Q\205\33Q\205\0" - "\0\0\"M\0\"M\0\"M\0\"M\0$P\0$P\0$P\0$P\0$P\0#O\0$P\0%Q\14#Q\0$P\14#Q" - "\0$P\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%" - "Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[K" - "\312\363K\312\363\15-[\15-[\15-[\0\0\23Bv\23Bv\24Cw\23Bv\23Bv\23Bv\23" - "Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30" - "Ey\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34H|\34H|\34H|\34H|\35I}\34H|\35I}\34" - "H|\35I}\20L\177\20L\177\20L\177\20L\177\22M\200\35I}\24N\201\24N\201" - "\24N\201\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P" - "\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\34R\206K\312\363K\312" - "\363\34R\206\33Q\205\33Q\205\0\0\0$P\0#O\0#O\0$P\0$P\0#O\0$P\0$P\0$P" - "\0$P\14#Q\0%Q\14#Q\0%Q\14#Q\0$P\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\0" - "%Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\K\312\363K\312\363\15-[\15-[\15-[\0\0\23" - "Bv\23Bv\24Cw\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24" - "Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\34H|\32G{\34" - "H|\32G{\35I}\35I}\35I}\35I}\20L\177\20L\177\35I}\20L\177\35I}\22M\200" - "\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P" - "\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R" - "\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207K\312\363K\312\363\34R\206\33Q\205\33Q\205\0\0\0" - "$P\0#O\0$P\0#O\5\40H\0$P\0%Q\14#Q\0$P\0%Q\14#Q\0%Q\0$P\14#Q\0%Q\0%Q\0" - "%Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\2'T" - "\2'T\14#Q\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15" - "-[K\312\363K\312\363\15-[\15-[\15-[\0\0\23Bv\23Bv\23Bv\23Bv\23Bv\24C" - "w\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\24Cw\30Ey\30Ey\30Ey\30" - "Ey\30Ey\30Ey\32G{\30Ey\34H|\20L\177\34H|\34H|\34H|\35I}\35I}\35I}\34" - "H|\20L\177\20L\177\35I}\20L\177\22M\200\22M\200\24N\201\24N\201\24N\201" - "\26O\202\26O\202\26O\202\35I}\27P\203\27P\203\27P\203\27P\203\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\34R\206\34R\206" - "K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0\0\0$P\0$P\0$P\0#O\14#Q\0" - "%Q\14#Q\0%Q\14#Q\0$P\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\14" - "#Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T" - "\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13," - "Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[K\312\363K\312\363" - "\15-[\15-[\15-[\0\0\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24C" - "w\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\32" - "G{\34H|\32G{\34H|\35I}\35I}\35I}\20L\177\35I}\20L\177\20L\177\20L\177" - "\22M\200\35I}\22M\200\22M\200\24N\201\26O\202\26O\202\26O\202\26O\202" - "\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\34R\206\34R\206K\312\363K\312" - "\363\33Q\205\33Q\205\33Q\205\0\0\14#Q\14#Q\0$P\14#Q\14#Q\0$P\14#Q\0$" - "P\14#Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\14#Q\14#Q\14#Q\0%Q\0%Q\14#Q\0%Q" - "\14#Q\0%Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*" - "X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17." - "\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[K\312\363K\312\363\15-" - "[\15-[\15-[\0\0\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24" - "Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\34H|\32G{\34H|\32" - "G{\20L\177\35I}\20L\177\35I}\35I}\35I}\20L\177\20L\177\20L\177\20L\177" - "\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O" - "\202\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R" - "\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\34R\206\34R\206\33Q\205K\312\363" - "K\312\363\33Q\205\33Q\205\33Q\205\0\0\0$P\14#Q\0%Q\0$P\14#Q\0$P\14#Q" - "\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\0" - "%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[K\312\363K\312\363\15-" - "[\15-[\13,Z\0\0\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\24" - "Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\34H|\32G{\34H|\32" - "G{\35I}\35I}\20L\177\35I}\20L\177\20L\177\20L\177\20L\177\35I}\22M\200" - "\35I}\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203" - "\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\34R\206\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\34R\206\33Q\205\33Q\205\33Q\205K\312\363K\312" - "\363\33Q\205\33Q\205\33Q\205\0\0\14#Q\14#Q\0$P\0%Q\0$P\0$P\14#Q\0%Q\0" - "%Q\0%Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\0%Q\0%Q\0%Q\0%Q\2'" - "T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*" - "X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[K\312\363K\312\363\15-[\13," - "Z\13,Z\0\0\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\24Cw\30Ey\30" - "Ey\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34H|\20L\177\34H|\32G{\20L\177\32G{" - "\20L\177\35I}\34H|\35I}\20L\177\20L\177\20L\177\20L\177\22M\200\22M\200" - "\22M\200\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P" - "\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\34R\206\34R\206\34R\206\33Q\205\33Q\205" - "K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0\0\14#Q\14#Q\0$P\14#Q\0%" - "Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\14#Q\14#Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#" - "Q\0%Q\0%Q\0%Q\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13" - ",Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15-[K\312\363" - "K\312\363\13,Z\13,Z\13,Z\0\0\24Cw\24Cw\24Cw\30Ey\24Cw\24Cw\30Ey\24Cw" - "\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\32G{\34H|\34H|\34H|\20" - "L\177\35I}\35I}\35I}\20L\177\35I}\20L\177\20L\177\20L\177\35I}\22M\200" - "\35I}\22M\200\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203" - "\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\34R\206\34R\206\33Q\205\33Q\205\33Q" - "\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0\0\14#Q\0%Q\0" - "%Q\14#Q\0%Q\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\14#Q\14#Q\14#Q\0" - "%Q\14#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[K\312\363K\312\363\13,Z\13,Z\13,Z\0\0\30Ey\24Cw\24Cw\30Ey\30Ey\30E" - "y\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34H|\34H|\32G{\34" - "H|\20L\177\35I}\35I}\35I}\35I}\35I}\35I}\20L\177\20L\177\35I}\35I}\22" - "M\200\22M\200\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203" - "\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\34R\206\34R\206\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\27P\203\0\0\0" - "%Q\14#Q\0%Q\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\14#Q\14#Q\0%Q\14#Q\0" - "%Q\0%Q\14#Q\0%Q\14#Q\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\13,ZK\312\363K\312\363\13,Z\12+Y\12+Y\0\0\30Ey\30Ey\24Cw\30E" - "y\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\32G{\32G{\34H|\34H|\34" - "H|\34H|\34H|\35I}\34H|\35I}\35I}\35I}\35I}\20L\177\20L\177\22M\200\35" - "I}\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\27P\203\27" - "P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\34R\206\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\27P\203\27" - "P\203\0\0\14#Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\14#Q\14#Q\14#Q\0%Q\14#Q\14" - "#Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X" - "\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\13,Z\13,Z\13,ZK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\30E" - "y\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\32G{\34H|\20" - "L\177\32G{\32G{\34H|\34H|\35I}\20L\177\35I}\35I}\35I}\20L\177\20L\177" - "\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O" - "\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\34R\206\34R\206" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205K\312" - "\363K\312\363\27P\203\27P\203\26O\202\0\0\0%Q\0%Q\14#Q\14#Q\0%Q\0%Q\14" - "#Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2" - "'T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y" - "\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\15-[\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,ZK\312\363K\312" - "\363\12+Y\12+Y\10*X\0\0\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{" - "\30Ey\32G{\32G{\34H|\32G{\34H|\32G{\34H|\35I}\35I}\35I}\35I}\35I}\20" - "L\177\20L\177\20L\177\20L\177\22M\200\22M\200\22M\200\35I}\24N\201\26" - "O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\34R\206\34R\206\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205K\312\363K\312\363\27P\203\26O\202\26O\202\0\0\14" - "#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q" - "\0%Q\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13" - ",Z\13,Z\12+YK\312\363K\312\363\10*X\10*X\10*X\0\0\30Ey\30Ey\30Ey\30E" - "y\30Ey\30Ey\30Ey\32G{\30Ey\32G{\34H|\34H|\32G{\20L\177\34H|\34H|\20L" - "\177\35I}\34H|\35I}\35I}\20L\177\20L\177\20L\177\20L\177\22M\200\22M" - "\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203" - "\27P\203\27P\203\27P\203\27P\203\33Q\205\27P\203\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\34R\206" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\34R\206\34R\206\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203K\312\363" - "K\312\363\26O\202\26O\202\26O\202\0\0\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#" - "Q\14#Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'" - "T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+" - "Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-" - "[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+YK\312\363K\312" - "\363\10*X\10*X\10*X\0\0\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\30Ey" - "\34H|\34H|\34H|\32G{\32G{\34H|\34H|\35I}\34H|\35I}\20L\177\20L\177\20" - "L\177\35I}\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202\26" - "O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\34R\206\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\27P\203\27P\203\27P\203K\312\363K\312\363\26O\202\24N\201\24N\201" - "\0\0\14#Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\0" - "%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X" - "\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13" - ",Z\12+Y\12+Y\12+Y\10*XK\312\363K\312\363\10*X\10*X\10*X\0\0\30Ey\30E" - "y\30Ey\30Ey\30Ey\32G{\30Ey\30Ey\32G{\34H|\32G{\20L\177\34H|\34H|\34H" - "|\35I}\35I}\20L\177\35I}\20L\177\35I}\20L\177\20L\177\22M\200\35I}\22" - "M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203" - "\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\34R\206\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\34R\206\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P\203\26O\202\26O\202" - "K\312\363K\312\363\24N\201\22M\200\22M\200\0\0\14#Q\0%Q\14#Q\14#Q\0%" - "Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2" - "'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12" - "+Y\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15" - "-[\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\10*X\10*X\10*XK\312\363K\312" - "\363\2'T\10*X\2'T\0\0\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\32G{\34H|\34" - "H|\32G{\34H|\34H|\20L\177\35I}\20L\177\35I}\35I}\20L\177\20L\177\20L" - "\177\35I}\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26" - "O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205" - "\33Q\205\33Q\205\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R" - "\206\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\34R\206\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P" - "\203\27P\203\26O\202\26O\202\26O\202K\312\363K\312\363\22M\200\20L\177" - "\35I}\0\0\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\2" - "'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*" - "X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15" - "-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\12" - "+Y\10*X\10*X\10*X\10*XK\312\363K\312\363\2'T\2'T\2'T\0\0\30Ey\30Ey\32" - "G{\30Ey\32G{\32G{\34H|\32G{\34H|\34H|\34H|\32G{\35I}\35I}\34H|\35I}\35" - "I}\35I}\35I}\20L\177\20L\177\22M\200\35I}\22M\200\24N\201\24N\201\26" - "O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\34R\206\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P" - "\203\27P\203\27P\203\26O\202\26O\202\26O\202\24N\201\24N\201K\312\363" - "K\312\363\35I}\20L\177\35I}\0\0\14#Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0" - "%Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\" - "\17.\\\15-[\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\12" - "+Y\12+Y\12+Y\10*X\10*X\10*X\10*X\10*X\10*XK\312\363K\312\363\2'T\2'T" - "\2'T\0\0\30Ey\32G{\32G{\32G{\32G{\32G{\34H|\20L\177\32G{\34H|\34H|\35" - "I}\20L\177\35I}\35I}\35I}\20L\177\20L\177\20L\177\20L\177\35I}\22M\200" - "\22M\200\24N\201\35I}\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203" - "\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\27P\203\27P\203\27P\203\26O\202\26O\202\26O\202\26O\202" - "\24N\201\22M\200\22M\200K\312\363K\312\363\35I}\35I}\35I}\0\0\0%Q\0%" - "Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\14#Q\2'T\2'T\2'" - "T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+" - "Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13" - ",Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\10*X\10*X\10*X\10*X\10*X\10*X\2'T\2" - "'TK\312\363K\312\363\14#Q\2'T\0%Q\0\0\30Ey\30Ey\32G{\32G{\34H|\34H|\34" - "H|\32G{\34H|\34H|\20L\177\35I}\35I}\35I}\35I}\20L\177\35I}\20L\177\20" - "L\177\35I}\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26" - "O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\34R" - "\206\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P\203\26O\202\26O\202\26O" - "\202\26O\202\24N\201\22M\200\35I}\20L\177\20L\177K\312\363K\312\363\35" - "I}\34H|\20L\177\0\0\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\2'T\2" - "'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\17" - ".\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15-" - "[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\12+Y\10*X\10*X\10*X\14" - "#Q\10*X\10*X\2'T\2'T\2'TK\312\363K\312\363\0%Q\14#Q\0%Q\0\0\30Ey\32G" - "{\32G{\32G{\34H|\34H|\32G{\20L\177\34H|\34H|\35I}\35I}\35I}\35I}\35I" - "}\35I}\20L\177\35I}\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\26" - "O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206\34R\206\36S\207\36S\207" - "\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\36S" - "\207\34R\206\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P\203\26O" - "\202\26O\202\26O\202\24N\201\22M\200\22M\200\35I}\20L\177\20L\177\35" - "I}K\312\363K\312\363\32G{\34H|\32G{\0\0\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%" - "Q\0%Q\0%Q\2'T\2'T\14#Q\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\17.\\\17.\\" - "\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[" - "\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\10*X\10" - "*X\10*X\10*X\10*X\10*X\2'T\2'T\2'T\2'T\2'TK\312\363K\312\363\14#Q\0%" - "Q\0%Q\0\0\30Ey\32G{\20L\177\34H|\34H|\20L\177\34H|\34H|\32G{\34H|\35" - "I}\35I}\34H|\35I}\20L\177\20L\177\20L\177\35I}\22M\200\35I}\22M\200\24" - "N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203" - "\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\34R\206" - "\34R\206\34R\206\36S\207\36S\207\36S\207\36S\207\36S\207\36S\207\34R" - "\206\34R\206\34R\206\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P" - "\203\26O\202\26O\202\26O\202\26O\202\24N\201\22M\200\22M\200\35I}\20" - "L\177\20L\177\35I}\35I}K\312\363K\312\363\32G{\30Ey\30Ey\0\0\0%Q\14#" - "Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\17.\\\17.\\\17.\\\17.\\\17.\\\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\10*X\10" - "*X\10*X\10*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\2'T\0%QK\312\363K\312\363" - "\14#Q\0%Q\0%Q\0\0\32G{\30Ey\34H|\32G{\34H|\20L\177\34H|\34H|\34H|\35" - "I}\35I}\35I}\35I}\20L\177\35I}\20L\177\20L\177\20L\177\35I}\22M\200\24" - "N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203" - "\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\34R\206\34R\206\34R\206\34R\206\34R\206\34R\206\34R\206\34R\206\34R" - "\206\34R\206\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\35I}\26O\202" - "\26O\202\26O\202\26O\202\24N\201\22M\200\22M\200\20L\177\20L\177\35I" - "}\35I}\35I}\32G{\34H|K\312\363K\312\363\30Ey\30Ey\30Ey\0\0\14#Q\0%Q\0" - "%Q\0%Q\0%Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\10*X\10*" - "X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\14#Q\0%Q\14#QK\312\363K\312\363\0%Q" - "\0%Q\14#Q\0\0\32G{\34H|\32G{\34H|\32G{\34H|\20L\177\35I}\20L\177\35I" - "}\35I}\35I}\35I}\20L\177\35I}\20L\177\20L\177\22M\200\22M\200\22M\200" - "\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P" - "\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\34R\206\34R\206\34R\206\34R\206\34R\206\34R\206\34R\206\34R\206" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\27P\203\33Q\205\33Q\205\27P\203\27P\203\27P\203\26O\202\26O\202" - "\26O\202\26O\202\24N\201\22M\200\35I}\20L\177\20L\177\20L\177\35I}\20" - "L\177\34H|\34H|\32G{\32G{K\312\363K\312\363\30Ey\24Cw\24Cw\0\0\14#Q\0" - "%Q\14#Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'" - "T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\12+Y\10*X\10*X\10*X\10*X\10" - "*X\10*X\2'T\2'T\2'T\2'T\2'T\0%Q\0%Q\0%Q\0%Q\0%QK\312\363K\312\363\14" - "#Q\14#Q\0#O\0\0\32G{\34H|\34H|\34H|\34H|\34H|\34H|\35I}\34H|\35I}\35" - "I}\35I}\20L\177\35I}\20L\177\20L\177\22M\200\22M\200\22M\200\24N\201" - "\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P" - "\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\27P\203\27P\203\27P\203\26O\202\26O\202\26O\202" - "\24N\201\24N\201\22M\200\22M\200\35I}\20L\177\35I}\35I}\35I}\32G{\34" - "H|\30Ey\30Ey\30EyK\312\363K\312\363\24Cw\24Cw\24Cw\0\0\0%Q\0%Q\0%Q\14" - "#Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\2'T\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\12+Y\12+Y\12+Y\10*X\10*X\10*X\10*X\10*X\10*X\10*X\2'T\2" - "'T\2'T\2'T\2'T\14#Q\0%Q\14#Q\14#Q\14#Q\0%QK\312\363K\312\363\0%Q\0$P" - "\0$P\0\0\34H|\34H|\20L\177\34H|\34H|\34H|\34H|\35I}\20L\177\35I}\35I" - "}\34H|\20L\177\20L\177\35I}\20L\177\22M\200\22M\200\24N\201\24N\201\26" - "O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203" - "\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\27P\203\27P\203\27P\203\26O\202\26O\202\26O\202\24N\201\24N\201\22M" - "\200\22M\200\35I}\35I}\35I}\35I}\35I}\32G{\34H|\32G{\32G{\30Ey\24Cw\24" - "CwK\312\363K\312\363\23Bv\23Bv\23Bv\0\0\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\2'" - "T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\14#Q\10*X\10*X\10*X" - "\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12" - "+Y\12+Y\10*X\10*X\10*X\10*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\14#Q\0%Q\0" - "%Q\0%Q\0%Q\14#Q\0%Q\0%Q\0$PK\312\363K\312\363\0$P\0\"M\4\37M\0\0\34H" - "|\20L\177\34H|\32G{\34H|\20L\177\35I}\35I}\34H|\35I}\35I}\20L\177\20" - "L\177\20L\177\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202" - "\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\35I}\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P\203" - "\27P\203\26O\202\26O\202\35I}\24N\201\22M\200\22M\200\20L\177\20L\177" - "\35I}\35I}\34H|\34H|\32G{\34H|\30Ey\30Ey\30Ey\30Ey\24Cw\24CwK\312\363" - "K\312\363\23Bv\23Bv\17At\0\0\0%Q\0%Q\0%Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T" - "\14#Q\2'T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12" - "+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\12+Y\10*X\10*X\10" - "*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\2'T\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\0%Q\0" - "%Q\0%Q\14#QK\312\363K\312\363\0#O\0\"M\4\37M\0\0\32G{\34H|\34H|\20L\177" - "\34H|\20L\177\35I}\35I}\34H|\35I}\35I}\35I}\20L\177\20L\177\22M\200\22" - "M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202" - "\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\27P\203\27P\203\27P\203\27P\203\26O\202\26O\202\26O\202\24N" - "\201\22M\200\22M\200\20L\177\20L\177\20L\177\35I}\35I}\32G{\34H|\34H" - "|\32G{\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23BvK\312\363K\312\363\17At\15@" - "s\15@s\0\0\0%Q\0%Q\14#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2" - "'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12" - "+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\12+Y\12+Y\12+Y\12+Y\10*X\10*X\10*X\10*X\10*X\10*X\2'T\2'T\2'" - "T\2'T\2'T\2'T\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\0$P\14#Q\0#O\0\"MK\312\363" - "K\312\363\0\"M\4\37M\5\40H\0\0\34H|\32G{\34H|\32G{\32G{\35I}\34H|\35" - "I}\35I}\35I}\20L\177\20L\177\20L\177\20L\177\22M\200\22M\200\24N\201" - "\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P" - "\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P" - "\203\27P\203\26O\202\26O\202\26O\202\24N\201\24N\201\22M\200\22M\200" - "\35I}\20L\177\35I}\35I}\35I}\32G{\34H|\30Ey\30Ey\30Ey\30Ey\30Ey\24Cw" - "\24Cw\23Bv\23Bv\23BvK\312\363K\312\363\15@s\11>q\11>q\0\0\0%Q\14#Q\0" - "%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\14#Q\10*X\10" - "*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\15" - "-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\12+Y\10" - "*X\10*X\10*X\10*X\10*X\10*X\2'T\2'T\2'T\2'T\14#Q\2'T\14#Q\0%Q\0%Q\14" - "#Q\14#Q\0%Q\0%Q\14#Q\0$P\0#O\0#O\0\"M\0\"MK\312\363K\312\363\4\37M\5" - "\40H\0\"M\0\0\34H|\34H|\32G{\32G{\35I}\20L\177\35I}\20L\177\35I}\20L" - "\177\20L\177\20L\177\35I}\20L\177\22M\200\22M\200\24N\201\24N\201\26" - "O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\35I}\27P\203\27" - "P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\27P\203\27P\203\27P\203\27P\203\26O\202\26O\202\26O" - "\202\35I}\24N\201\35I}\22M\200\20L\177\20L\177\35I}\35I}\35I}\34H|\34" - "H|\34H|\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15@sK\312\363" - "K\312\363\11>q\11>q\11>q\0\0\0%Q\14#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'" - "T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12" - "+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\15-[\15" - "-[\15-[\15-[\15-[\15-[\15-[\15-[\15-[\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\12+Y\12+Y\12+Y\12+Y\10*X\10*X\10*X\10*X\10*X\10*X\10*X\2'T\2" - "'T\14#Q\2'T\2'T\0%Q\0%Q\14#Q\14#Q\14#Q\14#Q\0%Q\0$P\0%Q\14#Q\0#O\0\"" - "M\0\"M\0\"M\4\37MK\312\363K\312\363\5\40H\2\36E\5\40H\0\0\32G{\34H|\34" - "H|\20L\177\35I}\35I}\35I}\34H|\35I}\20L\177\20L\177\20L\177\20L\177\22" - "M\200\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202" - "\26O\202\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P\203\27P\203" - "\27P\203\26O\202\26O\202\26O\202\26O\202\24N\201\22M\200\22M\200\20L" - "\177\20L\177\20L\177\35I}\35I}\34H|\32G{\34H|\32G{\30Ey\30Ey\24Cw\24" - "Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\17At\15@sK\312\363K\312\363\11>q\11" - ">q\6=p\0\0\0%Q\0%Q\0%Q\0%Q\2'T\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10" - "*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+Y\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\12+Y\12+Y\12+Y\12+Y\10" - "*X\10*X\10*X\10*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\2'T\0%Q\0%Q\0%Q\0%Q\0" - "%Q\14#Q\0%Q\0$P\0%Q\0$P\0#O\0$P\0\"M\4\37M\4\37M\4\37M\5\40HK\312\363" - "K\312\363\5\40H\2\36E\2\36E\0\0\32G{\34H|\32G{\34H|\35I}\35I}\35I}\34" - "H|\34H|\20L\177\35I}\20L\177\20L\177\22M\200\22M\200\24N\201\24N\201" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P" - "\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\27P\203\27P\203\27P\203\27P\203\26O\202\26O\202\35I}\26O\202\24N\201" - "\24N\201\22M\200\22M\200\20L\177\20L\177\35I}\35I}\35I}\20L\177\34H|" - "\30Ey\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\11" - ">q\11>qK\312\363K\312\363\6=p\4q\11>q\11>qK\312\363K\312\363\4q\11>q\11>q\11>q\6=pK\312" - "\363K\312\363\2" - "\0\0\34H|\32G{\35I}\35I}\35I}\35I}\20L\177\20L\177\35I}\20L\177\20L\177" - "\22M\200\22M\200\22M\200\35I}\24N\201\26O\202\26O\202\26O\202\26O\202" - "\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203\27P" - "\203\27P\203\27P\203\27P\203\26O\202\26O\202\26O\202\26O\202\26O\202" - "\24N\201\35I}\22M\200\20L\177\35I}\20L\177\34H|\35I}\35I}\32G{\34H|\30" - "Ey\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\17At\15@s\15@s\11>q\11" - ">q\11>q\11>q\11>q\6=p\6=pK\312\363K\312\363\0:l\2\10\32=\11\33>\0\0\32G{\34H|\35I}\35I}\35I}\35I}\20L" - "\177\20L\177\35I}\20L\177\20L\177\22M\200\22M\200\35I}\24N\201\24N\201" - "\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P" - "\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\27P\203\27P\203\27P\203\27P\203\27P\203\26O\202\26O\202\26O\202" - "\35I}\26O\202\24N\201\24N\201\22M\200\22M\200\20L\177\20L\177\35I}\20" - "L\177\35I}\32G{\32G{\32G{\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23" - "Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\6=p\6=p\4K\312\363K\312\363\11\33>\10\32=\0" - "\34C\0\0\34H|\34H|\34H|\34H|\35I}\35I}\35I}\35I}\20L\177\20L\177\22M" - "\200\35I}\22M\200\24N\201\24N\201\24N\201\26O\202\26O\202\26O\202\26" - "O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\26O\202\26O\202\26O\202\26O\202\26O\202\24N\201\24N\201\22M\200\22M" - "\200\20L\177\20L\177\35I}\35I}\35I}\34H|\32G{\32G{\30Ey\30Ey\30Ey\24" - "Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\6" - "=p\6=p\2q\11>q\11>q\11>q\6=p\4\0\34C\10\32=\11\33>K\312\363K\312\363\10\32=\0\32:\0\32:\0\0" - "\34H|\34H|\20L\177\35I}\35I}\35I}\20L\177\20L\177\35I}\20L\177\22M\200" - "\22M\200\24N\201\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O" - "\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P" - "\203\27P\203\27P\203\27P\203\27P\203\26O\202\26O\202\26O\202\26O\202" - "\26O\202\24N\201\24N\201\22M\200\22M\200\22M\200\35I}\20L\177\35I}\34" - "H|\35I}\32G{\34H|\32G{\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23" - "Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\6=p\4\11\33>\10\32=K\312" - "\363K\312\363\0\32:\10\32=\5\30:\0\0\34H|\34H|\35I}\35I}\35I}\20L\177" - "\20L\177\20L\177\35I}\22M\200\22M\200\22M\200\24N\201\24N\201\24N\201" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P" - "\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\26O\202\26O" - "\202\26O\202\26O\202\26O\202\24N\201\24N\201\22M\200\22M\200\22M\200" - "\20L\177\20L\177\20L\177\20L\177\35I}\34H|\32G{\34H|\32G{\30Ey\30Ey\30" - "Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\6" - "=p\4\10\32=\11\33>\0\34C\10\32=\10\32=K\312\363K\312\363\0\32:\5" - "\30:\5\30:\0\0\34H|\35I}\35I}\35I}\35I}\20L\177\35I}\20L\177\35I}\22" - "M\200\22M\200\24N\201\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202" - "\26O\202\26O\202\26O\202\27P\203\35I}\27P\203\27P\203\27P\203\27P\203" - "\27P\203\27P\203\35I}\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\27P\203\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N\201\24N" - "\201\22M\200\22M\200\20L\177\20L\177\35I}\35I}\35I}\35I}\34H|\32G{\34" - "H|\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\11" - ">q\11>q\11>q\11>q\6=p\4\0\34C\11\33>\10\32=\0\32:\10\32=\10\32=\10\32=\0\32" - ":K\312\363K\312\363\5\30:\5\30:\0\32:\0\0\35I}\34H|\35I}\35I}\20L\177" - "\35I}\20L\177\35I}\22M\200\22M\200\35I}\24N\201\24N\201\26O\202\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P" - "\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\27P\203\27P\203\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\35I}\24N\201\22M\200\35I}\22M\200\20L\177\35I}\35I}\20L\177\35I" - "}\34H|\34H|\34H|\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17" - "At\15@s\15@s\11>q\376\377\374\376\377\374\376\377\374^\203\243\6=p\6" - "=p\2\0\34C\0\32:\10\32=\11\33>\10\32=\10\32=\10\32=\0\32:\0\32:K" - "\312\363K\312\363\5\31""6\0\32:\0\32:\0\0\35I}\20L\177\35I}\35I}\20L" - "\177\35I}\20L\177\20L\177\22M\200\35I}\22M\200\24N\201\24N\201\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N" - "\201\24N\201\22M\200\22M\200\22M\200\20L\177\35I}\20L\177\20L\177\35" - "I}\34H|\34H|\32G{\32G{\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\23Bv\23Bv\23Bv\23" - "Bv\17At\15@s\15@s\11>q\11>q\326\336\347\376\377\374\376\377\3745_\211" - "\2\0\34C\0\34C\0\32:\0\32:\10\32=\10\32=\10\32=\0\32:" - "\0\32:\5\30:\5\30:K\312\363K\312\363\0\32:\0\32:\5\31""6\0\0\34H|\35" - "I}\34H|\35I}\35I}\20L\177\35I}\20L\177\22M\200\22M\200\22M\200\24N\201" - "\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\35I}\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26" - "O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N\201" - "\24N\201\22M\200\22M\200\35I}\20L\177\20L\177\35I}\35I}\35I}\34H|\34" - "H|\20L\177\34H|\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17" - "At\15@s\15@s\11>q\11>q\11>q\11>q\36Ky\331\342\352\376\377\374\363\370" - "\373`|\235\0:l\0:l\0:l\21""9f\17""8e\17""8e\17""8e\17""8e\13""6c\10""4" - "a\10""4a\10""4aK\312\363K\312\363\10""4a\6""3`\4""3_\0\0\2'T\2'T\2'T" - "\2'T\2'T\2'T\2'T\10*X\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*" - "X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\14" - "#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0#O\0$P\0\"M\0\"M\0\"M" - "\4\37M\0\"M\5\40H\5\40H\2\36E\2\36E\213\232\255\235\251\266\367\375\377" - "\376\377\374\376\377\374\325\332\334\235\251\266\216\232\247\215\230" - "\245\215\230\245\210\227\252\215\230\245\215\230\245\215\230\245\5\30" - ":\5\30:\5\30:K\312\363K\312\363\0\32:\5\31""6\5\31""6\0\0\35I}\20L\177" - "\35I}\20L\177\20L\177\20L\177\35I}\22M\200\22M\200\22M\200\24N\201\24" - "N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N\201\24N\201" - "\22M\200\22M\200\22M\200\35I}\20L\177\20L\177\35I}\34H|\35I}\34H|\32" - "G{\34H|\30Ey\32G{\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15" - "@s\15@s\11>q\11>q\11>q\11>q\6=p\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\10""4a\10" - "4a\10""4aK\312\363K\312\363\11""6]\6""3`\6""3`\0\0\2'T\2'T\2'T\2'T\2" - "'T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X" - "\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\2'T\10*X\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\14#Q\0%" - "Q\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\0$P\14#Q\0$P\0#O\0\"M\4\37M\4\37M\4\37M" - "\5\40H\0\"M\2\36E\5\40H\2\36E\2\36E\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\5\30" - ":\0\32:\0\32:K\312\363K\312\363\5\31""6\0\32:\5\31""6\0\0\34H|\35I}\35" - "I}\20L\177\20L\177\35I}\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201" - "\26O\202\26O\202\26O\202\26O\202\35I}\26O\202\26O\202\26O\202\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\26O\202\26O\202\26O\202\24N\201\24N\201\24N\201\22M\200\22M\200" - "\20L\177\35I}\35I}\35I}\35I}\35I}\34H|\32G{\34H|\34H|\32G{\30Ey\30Ey" - "\30Ey\30Ey\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11" - ">q\11>q\6=p\4q\11>q\11>q\11>q\6=" - "p\6=p\4\10\32=\0\32:\10\32=\10\32=\0\32:\0\32:\10" - "\32=\5\30:\5\30:\5\30:\0\32:\0\32:\0\32:\5\31""6K\312\363K\312\363\5" - "\31""6\5\31""6\4\30""5\0\0\34H|\20L\177\20L\177\20L\177\20L\177\20L\177" - "\22M\200\22M\200\22M\200\24N\201\24N\201\24N\201\26O\202\26O\202\26O" - "\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N\201\24N\201\24N" - "\201\22M\200\22M\200\22M\200\35I}\20L\177\35I}\35I}\20L\177\35I}\35I" - "}\34H|\20L\177\34H|\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23B" - "v\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\6=p\6=p\2\0\34" - "C\0\32:\11\33>6Kk\235\251\266\333\340\343\362\367\371\362\367\371\326" - "\336\347\235\251\2669Id\0\32:\0\32:\0\32:\5\31""6\5\31""6\5\31""6K\312" - "\363K\312\363\5\31""6\4\30""5\4\30""5\0\0\35I}\20L\177\35I}\20L\177\20" - "L\177\22M\200\22M\200\22M\200\22M\200\24N\201\24N\201\24N\201\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N\201\24N\201\24N\201" - "\24N\201\22M\200\22M\200\20L\177\20L\177\20L\177\20L\177\34H|\35I}\35" - "I}\34H|\32G{\34H|\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23" - "Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6=p\4\10\32=\205\224" - "\247\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\210\224\241" - "\0\32:\5\31""6\5\31""6\5\31""6K\312\363K\312\363\4\30""5\4\30""5\4\30" - "5\0\0\35I}\20L\177\20L\177\20L\177\22M\200\22M\200\22M\200\35I}\24N\201" - "\24N\201\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N\201" - "\24N\201\24N\201\24N\201\22M\200\22M\200\20L\177\35I}\20L\177\20L\177" - "\34H|\35I}\35I}\34H|\34H|\32G{\32G{\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24" - "Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\6=p\4q\11>q\11>q\11>q\6=p\4\0\34C\0\34C\0\32:\10\32=\10\32=\353\360" - "\363\376\377\374\376\377\374M_u\0\32:\5\30:\5\30:\5\30:\0\32:\0\32:M" - "_u\376\377\374\376\377\374\354\362\364\5\31""6\5\31""6\5\31""6K\312\363" - "K\312\363\4\30""5\4\30""5\4\30""5\0\0\20L\177\35I}\20L\177\22M\200\22" - "M\200\22M\200\22M\200\22M\200\24N\201\24N\201\24N\201\24N\201\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\24N" - "\201\35I}\24N\201\24N\201\22M\200\35I}\22M\200\22M\200\20L\177\35I}\20" - "L\177\35I}\20L\177\35I}\35I}\20L\177\34H|\34H|\32G{\30Ey\30Ey\30Ey\24" - "Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\11" - ">q\6=p\6=p\2q\11>q\11>q\11>q\6=p\4\0\34C\0\32:\10\32=\10\32=\10\32=\10\32=\215\230" - "\245\376\377\374\376\377\374\376\377\374\370\372\367\267\277\307\222" - "\236\253\222\236\253\267\277\307\370\372\367\376\377\374\376\377\374" - "\376\377\374\215\230\245\5\31""6\0\32:\5\31""6K\312\363K\312\363\5\31" - "6\5\31""6\0\32:\0\0\20L\177\20L\177\35I}\22M\200\22M\200\24N\201\24N" - "\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201" - "\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\22M\200\22M\200\35I" - "}\22M\200\20L\177\20L\177\20L\177\20L\177\35I}\35I}\35I}\35I}\32G{\34" - "H|\34H|\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\17" - "At\15@s\15@s\15@s\11>q\11>q\11>q\6=p\6=p\4\0\34C\10\32=\10\32" - "=\0\34C\10\32=\10\32=\0\32:\0\32:\201\220\242\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\206\222\237\5\31""6\5\31""6\5\31""6\5\31" - "6K\312\363K\312\363\5\31""6\5\31""6\5\31""6\0\0\20L\177\20L\177\22M\200" - "\22M\200\22M\200\24N\201\24N\201\24N\201\35I}\24N\201\24N\201\24N\201" - "\24N\201\24N\201\24N\201\24N\201\35I}\24N\201\24N\201\24N\201\22M\200" - "\22M\200\22M\200\22M\200\35I}\20L\177\20L\177\20L\177\35I}\20L\177\34" - "H|\35I}\34H|\32G{\34H|\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\24" - "Cw\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\6=p\6=p\4\11\33>\10\32=\10\32=\10\32=\0\32:\0\32:\10\32=\5\30:\0\32:9" - "Id\235\251\266\333\340\343\363\370\373\370\372\367\333\340\343\235\251" - "\2668K`\5\31""6\5\31""6\5\31""6\5\31""6\5\31""6\5\31""6K\312\363K\312" - "\363\5\31""6\5\31""6\5\31""6\0\0\22M\200\22M\200\22M\200\22M\200\35I" - "}\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24" - "N\201\24N\201\24N\201\24N\201\22M\200\22M\200\22M\200\35I}\22M\200\35" - "I}\20L\177\20L\177\20L\177\20L\177\20L\177\35I}\35I}\32G{\34H|\32G{\30" - "Ey\32G{\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15" - "@s\11>q\11>q\11>q\11>q\11>q\6=p\4\10\32=\11\33>\0\34C\10\32=\0\32:\0\32:\0\32:\10\32=\5" - "\30:\5\30:\5\30:\5\30:\0\32:\5\31""6\0\32:\0\32:\5\31""6\5\31""6\5\31" - "6\5\31""6\5\31""6\5\31""6\5\31""6\5\31""6\5\31""6K\312\363K\312\363\5" - "\31""6\5\31""6\5\31""6\0\0\22M\200\22M\200\22M\200\22M\200\24N\201\24" - "N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201" - "\24N\201\24N\201\22M\200\22M\200\22M\200\22M\200\35I}\20L\177\20L\177" - "\20L\177\20L\177\34H|\35I}\34H|\35I}\20L\177\34H|\34H|\32G{\30Ey\30E" - "y\24Cw\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\15" - "@s\11>q\11>q\11>q\4\10\32=\11\33>\0\32:\10\32=\0\34C\10\32=\10\32" - "=\0\32:\0\32:\5\30:\376\377\374\376\377\374\376\377\374%6P\0\32:\0\32" - ":\5\31""6\0\32:\5\31""6\5\31""6%6P\376\377\374\376\377\374\376\377\374" - "\5\31""6\5\31""6\5\31""6K\312\363K\312\363\5\31""6\0\32:\5\31""6\0\0" - "\22M\200\22M\200\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N" - "\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\22M\200\22M\200" - "\35I}\22M\200\35I}\20L\177\20L\177\20L\177\20L\177\20L\177\35I}\20L\177" - "\34H|\32G{\34H|\32G{\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23" - "Bv\23Bv\17At\17At\15@s\15@s\11>q\11>q\11>q\11>q\6=p\6=p\4\10" - "\32=\11\33>\0\34C\10\32=\0\34C\0\32:\0\32:\0\32:\5\30:\5\30:\376\377" - "\374\376\377\374\376\377\374%6P\5\31""6\0\32:\0\32:\0\32:\0\32:\5\31" - "6;Nc\376\377\374\376\377\374\376\377\374\5\31""6\0\32:\0\32:K\312\363" - "K\312\363\0\32:\5\31""6\0\32:\0\0\22M\200\22M\200\24N\201\24N\201\24" - "N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201" - "\24N\201\22M\200\22M\200\35I}\22M\200\20L\177\20L\177\20L\177\20L\177" - "\20L\177\35I}\34H|\35I}\20L\177\34H|\32G{\34H|\32G{\30Ey\30Ey\30Ey\24" - "Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11" - ">q\6=p\6=p\4\0\34C\11\33>\0\32:\11\33>\0\34C\10\32=\10\32=\0\32:\0\32" - ":\215\230\245\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\343\350\353\0\32:\5\31""6\0\32:K\312\363K\312\363\5\30:\5\30:\5\30:" - "\0\0\22M\200\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201" - "\35I}\24N\201\24N\201\24N\201\22M\200\22M\200\22M\200\22M\200\22M\200" - "\20L\177\20L\177\20L\177\20L\177\35I}\35I}\35I}\20L\177\34H|\32G{\34" - "H|\20L\177\32G{\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17" - "At\15@s\15@s\17At\11>q\11>q\11>q\11>q\6=p\4\0\34C\11\33>\10" - "\32=\0\32:\11\33>\10\32=\0\34C\10\32=\0\32:\10\32=\0\32:\215\230\245" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\370\372\3675Mg\0\32:\5\31" - "6\0\32:K\312\363K\312\363\5\30:\5\30:\5\30:\0\0\24N\201\24N\201\24N\201" - "\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\22M" - "\200\22M\200\35I}\22M\200\22M\200\20L\177\20L\177\35I}\20L\177\34H|\35" - "I}\35I}\35I}\34H|\20L\177\34H|\32G{\32G{\30Ey\30Ey\30Ey\30Ey\24Cw\24" - "Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\6=p\6" - "=p\4" - "\11\33>\0\32:\11\33>\10\32=\10\32=\10\32=\0\32:\10\32=\0\32:\0\32:\5" - "\30:\5\30:\5\30:\5\30:\376\377\374\376\377\374\376\377\374%6P\0\32:\4" - "\30""5\0\32:\5\31""6\0\32:\0\32:\0\32:\5\31""6\0\32:\5\31""6\0\32:\5" - "\30:\0\32:K\312\363K\312\363\5\30:\0\32:\10\32=\0\0\24N\201\24N\201\24" - "N\201\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\22M\200\22M\200" - "\35I}\22M\200\22M\200\22M\200\20L\177\20L\177\20L\177\20L\177\20L\177" - "\35I}\34H|\35I}\34H|\32G{\34H|\30Ey\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24" - "Cw\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6=p\6" - "=p\4\10\32=\11\33>\10\32=\10\32=\10\32=\0\34C\0\32:\0\32:\0\32:\5" - "\30:\5\30:\5\30:\5\30:\5\30:\5\30:\5\30:\5\30:\0\32:\0\32:\0\32:\5\31" - "6\0\32:\5\31""6\0\32:\0\32:\0\32:\5\30:\5\30:\5\30:\5\30:\5\30:K\312" - "\363K\312\363\0\32:\10\32=\0\34C\0\0\24N\201\24N\201\24N\201\24N\201" - "\24N\201\24N\201\24N\201\24N\201\24N\201\22M\200\22M\200\22M\200\22M" - "\200\35I}\20L\177\20L\177\20L\177\20L\177\20L\177\35I}\35I}\35I}\20L" - "\177\34H|\34H|\30Ey\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23B" - "v\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6=p\4\0\34C\10\32=\10\32=\0\32:\0\32:\10\32=\10\32=\214\227\244\214\227" - "\244\214\227\244\30'F\5\30:\214\227\244\214\227\244\214\227\244\214\227" - "\244\214\227\244\214\227\244\214\227\244\214\227\244\214\227\244\214" - "\227\244\214\227\244\214\227\244\214\227\244\214\227\244\5\30:\0\32:" - "\10\32=K\312\363K\312\363\10\32=\10\32=\0\34C\0\0\35I}\24N\201\24N\201" - "\24N\201\24N\201\24N\201\24N\201\24N\201\22M\200\22M\200\22M\200\22M" - "\200\35I}\20L\177\20L\177\20L\177\20L\177\35I}\35I}\35I}\35I}\34H|\20" - "L\177\34H|\30Ey\32G{\30Ey\30Ey\24Cw\30Ey\24Cw\24Cw\23Bv\23Bv\24Cw\23" - "Bv\17At\15@s\15@s\11>q\15@s\11>q\11>q\11>q\6=p\6=p\4\10" - "\32=\11\33>\10\32=\0\34C\10\32=\10\32=\10\32=\0\32:\0\32:\0\32:\10\32" - "=\376\377\374\376\377\374\376\377\374\37""6U\5\30:\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\0\32:\10\32=\10\32=K\312\363K\312\363\10\32=\0\32:\11\33" - ">\0\0\24N\201\24N\201\24N\201\24N\201\24N\201\24N\201\22M\200\22M\200" - "\22M\200\22M\200\35I}\20L\177\20L\177\20L\177\20L\177\35I}\35I}\35I}" - "\35I}\34H|\34H|\32G{\34H|\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\24" - "Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6=p\4\11\33>\10\32=\10\32=\0\34C\10\32=\0\34C\10\32=\10\32=" - "\10\32=\0\32:\10\32=\0\32:\376\377\374\376\377\374\376\377\374\37""6" - "U\5\30:\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\0\32:\10\32=\0\34CK\312\363K\312" - "\363\0\32:\0\32:\0\34C\0\0\24N\201\24N\201\24N\201\24N\201\24N\201\24" - "N\201\22M\200\22M\200\35I}\22M\200\20L\177\20L\177\20L\177\35I}\20L\177" - "\35I}\20L\177\35I}\35I}\32G{\34H|\34H|\30Ey\30Ey\30Ey\30Ey\24Cw\30Ey" - "\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\11" - ">q\6=p\4\0\34C\0\34C\0\0\24N\201" - "\24N\201\24N\201\24N\201\24N\201\24N\201\22M\200\22M\200\22M\200\22M" - "\200\35I}\20L\177\35I}\20L\177\35I}\34H|\35I}\35I}\34H|\34H|\34H|\30" - "Ey\30Ey\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15" - "@s\11>q\11>q\11>q\11>q\11>q\6=p\6=p\4\10\32=\10\32" - "=\10\32=\0\34C\10\32=\10\32=\10\32=\10\32=\0\32:\0\32:\10\32=\0\32:\0" - "\32:\5\30:\5\30:\5\30:\5\30:\5\30:\5\30:\0\32:\0\32:\10\32=\0\32:\10" - "\32=\10\32=\0\32:\10\32=\10\32=\10\32=\10\32=\0\32:\11\33>\0\32:K\312" - "\363K\312\363\0\34C\0\35D\0\35D\0\0\24N\201\24N\201\24N\201\24N\201\24" - "N\201\22M\200\22M\200\22M\200\22M\200\35I}\20L\177\20L\177\20L\177\35" - "I}\35I}\35I}\35I}\34H|\32G{\34H|\30Ey\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24" - "Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6" - "=p\6=p\4\0\32:\10\32=\0\34C\10\32" - "=\0\34C\10\32=\10\32=\10\32=\0\32:\0\32:\10\32=\10\32=\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\10\32=\11\33>\0\34CK\312\363K\312\363\0\35D\2\36E\2\36E\0\0" - "\24N\201\24N\201\24N\201\22M\200\22M\200\22M\200\22M\200\22M\200\20L" - "\177\20L\177\35I}\20L\177\35I}\35I}\35I}\34H|\34H|\32G{\34H|\30Ey\30" - "Ey\30Ey\30Ey\24Cw\30Ey\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15" - "@s\11>q\15@s\11>q\11>q\11>q\6=p\6=p\4\0\32:\11" - "\33>\11\33>\10\32=\0\34C\10\32=\10\32=\10\32=\0\32:\10\32=\10\32=\0\32" - ":\10\32=\0\32:\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\0\34C\11\33>\0\35DK\312\363K\312" - "\363\2\36E\2\36E\5\40H\0\0\24N\201\24N\201\24N\201\22M\200\22M\200\22" - "M\200\22M\200\20L\177\20L\177\20L\177\20L\177\35I}\20L\177\35I}\35I}" - "\20L\177\34H|\20L\177\30Ey\30Ey\30Ey\30Ey\24Cw\30Ey\24Cw\24Cw\23Bv\23" - "Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6=p\4q\11>q\0\0\10*X\10*X\10*X\10" - "*X\2'T\10*X\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\0%Q\0%Q\0%Q\0%Q\0%Q\0%Q\14" - "#Q\0%Q\0%Q\14#Q\0$P\0%Q\0$P\0#O\0\"M\0\"M\4\37M\4\37M\0\"M\4\37M\5\40" - "H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\11\33>\0\34C" - "\0\34C\11\33>\11\33>\11\33>\10\32=\10\32=\10\32=\0\34C\10\32=\10\32=" - "\10\32=\0\32:\10\32=\10\32=\0\32:\10\32=\0\32:\10\32=\0\32:\0\32:\0\32" - ":\0\32:\10\32=Pcy\370\372\367\367\375\377\200\217\241*\77_\5\40H\5!C" - "-Cb\201\220\242\370\372\367\367\375\377w\206\231\0\34C\0\35D\0\35D\0" - "\35DK\312\363K\312\363\5\40H\2\36E\2\36E\0\0\24N\201\24N\201\24N\201" - "\22M\200\22M\200\22M\200\20L\177\20L\177\20L\177\20L\177\34H|\35I}\35" - "I}\35I}\32G{\34H|\34H|\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23" - "Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=" - "p\2q\11>q\11>q\0\0\10*X\10*" - "X\10*X\10*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\2'T\2'T\0%Q\0%Q\14#Q\0%Q\0" - "%Q\14#Q\14#Q\14#Q\0%Q\0$P\0%Q\0$P\0$P\0\"M\0\"M\0\"M\4\37M\4\37M\0\"" - "M\4\37M\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0" - "\35D\0\34C\0\34C\0\34C\10\32=\0\32:\0\32:\11\33>\0\32:\10\32=\10\32=" - "\10\32=\10\32=\10\32=\0\34C\0\32:\10\32=\10\32=\0\32:\10\32=\10\32=\0" - "\32:\10\32=\10\32=\0\34C\247\262\300\376\377\374\376\377\374*\77_\10" - "\32=\11\33>\11\33>\10\32=\0\32:\0\34C*\77_\376\377\374\376\377\374\275" - "\305\315\0\35D\2\36E\2\36EK\312\363K\312\363\2\36E\5\40H\5\40H\0\0\24" - "N\201\24N\201\22M\200\22M\200\22M\200\20L\177\20L\177\35I}\20L\177\34" - "H|\35I}\35I}\35I}\20L\177\32G{\34H|\32G{\30Ey\30Ey\30Ey\30Ey\24Cw\24" - "Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11" - ">q\6=p\6=p\4q\11>q\15@s\0\0" - "\10*X\10*X\10*X\2'T\10*X\2'T\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\0%Q\0%Q\14" - "#Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\0$P\0%Q\0$P\0#O\0\"M\14#Q\0\"M\0\"M\4\37" - "M\4\37M\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0" - "\35D\0\34C\0\34C\0\34C\11\33>\10\32=\0\32:\10\32=\0\32:\10\32=\0\34C" - "\10\32=\10\32=\10\32=\10\32=\10\32=\10\32=\0\34C\10\32=\0\34C\10\32=" - "\10\32=\0\34C\10\32=\10\32=\10\32=\365\372\375\376\377\374\376\377\374" - "\307\317\330\30""0N\0\32:\11\33>\11\33>\0\34C\30""0N\307\317\330\376" - "\377\374\376\377\374\370\372\367\2\36E\2\36E\2\36EK\312\363K\312\363" - "\5\40H\0\"M\4\37M\0\0\24N\201\22M\200\22M\200\22M\200\22M\200\35I}\20" - "L\177\35I}\35I}\35I}\35I}\35I}\20L\177\34H|\32G{\32G{\32G{\30Ey\30Ey" - "\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\17At\17At\15@s\15@s\11>q\11" - ">q\11>q\11>q\11>q\11>q\6=p\4q\11>qK\312\363K\312\363\15@s\15" - "@s\15@s\0\0\10*X\10*X\10*X\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\14#Q\0" - "%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0$P\14#Q\0#O\0#O\0\"M\0#O\4\37M\4\37" - "M\4\37M\4\37M\5\40H\5\40H\5\40H\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\0" - "\35D\0\35D\0\35D\0\34C\11\33>\0\34C\11\33>\0\32:\11\33>\0\32:\10\32=" - "\0\32:\10\32=\10\32=\10\32=\10\32=\10\32=\10\32=\0\34C\10\32=\10\32=" - "\0\34C\10\32=\0\34C\0\34C\10\32=\10\32=\10\32=\205\224\247\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\210" - "\227\252\2\36E\2\36E\2\36EK\312\363K\312\363\4\37M\4\37M\4\37M\0\0\22" - "M\200\22M\200\22M\200\22M\200\20L\177\20L\177\20L\177\35I}\35I}\35I}" - "\35I}\34H|\34H|\32G{\32G{\30Ey\30Ey\30Ey\24Cw\30Ey\24Cw\24Cw\23Bv\23" - "Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6" - "=p\4q\11" - ">q\11>qK\312\363K\312\363\15@s\17At\23Bv\0\0\10*X\2'T\10*X\10*X\2'T\2" - "'T\2'T\2'T\14#Q\2'T\2'T\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\0%Q\0$P\14" - "#Q\0$P\0$P\14#Q\0\"M\0\"M\0\"M\4\37M\4\37M\5\40H\5\40H\5\40H\5\40H\2" - "\36E\5\40H\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\11\33>\0\34C\0\34C\0\34" - "C\0\32:\11\33>\0\32:\10\32=\0\32:\11\33>\10\32=\0\34C\10\32=\10\32=\0" - "\34C\10\32=\0\34C\10\32=\10\32=\0\34C\10\32=\10\32=\10\32=\11\33>\0\32" - ":\10\32=\11\33>\34""4R\307\317\330\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\307\317" - "\330\33""9]\2\36E\2\36E\5\40H\5\40HK\312\363K\312\363\4\37M\0\"M\0\"" - "M\0\0\22M\200\22M\200\22M\200\20L\177\20L\177\35I}\20L\177\34H|\35I}" - "\35I}\32G{\34H|\34H|\32G{\30Ey\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23" - "Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\6=p\6" - "=p\6=p\4q\11>q\11>q\11>q\15@sK\312\363K\312\363\23Bv\23Bv\23Bv\0\0\2" - "'T\10*X\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\14" - "#Q\0%Q\0%Q\14#Q\0$P\0$P\0$P\0$P\0\"M\4\37M\0\"M\0\"M\4\37M\5\40H\5\40" - "H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\11\33>" - "\0\34C\0\34C\0\34C\0\34C\0\32:\11\33>\11\33>\10\32=\0\32:\10\32=\11\33" - ">\0\32:\10\32=\10\32=\0\34C\0\34C\10\32=\10\32=\10\32=\0\32:\10\32=\10" - "\32=\10\32=\11\33>\0\32:\0\32:\10\32=\0\34C\0\34C\0\34C\0\34C\0\35D\0" - "\35D\0\35D\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\4\37MK\312" - "\363K\312\363\14#Q\0$P\0$P\0\0\22M\200\22M\200\22M\200\35I}\20L\177\20" - "L\177\35I}\20L\177\35I}\32G{\34H|\34H|\34H|\32G{\30Ey\30Ey\30Ey\30Ey" - "\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11" - ">q\11>q\11>q\11>q\6=p\6=p\4q\11>q\11>q\11>q\15@s\15@s\15@s" - "K\312\363K\312\363\23Bv\23Bv\24Cw\0\0\10*X\2'T\2'T\2'T\2'T\2'T\2'T\2" - "'T\2'T\0%Q\0%Q\14#Q\0%Q\14#Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\0#O\0#O\0$P" - "\0\"M\0#O\4\37M\4\37M\0\"M\5\40H\5\40H\5\40H\2\36E\5\40H\2\36E\5\40H" - "\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\11\33>\0\34C\0\34C\11\33>\0\34C" - "\11\33>\10\32=\11\33>\10\32=\0\32:\11\33>\0\32:\10\32=\10\32=\11\33>" - "\11\33>\0\32:\10\32=\11\33>\10\32=\0\32:\10\32=\0\32:\10\32=\11\33>\0" - "\34C\11\33>\0\34C\11\33>\0\34C\0\35D\0\35D\0\35D\2\36E\2\36E\2\36E\2" - "\36E\2\36E\5\40H\5\40H\4\37M\4\37M\4\37M\0\"MK\312\363K\312\363\0$P\14" - "#Q\14#Q\0\0\22M\200\20L\177\35I}\20L\177\20L\177\35I}\35I}\20L\177\35" - "I}\32G{\34H|\32G{\32G{\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23" - "Bv\23Bv\17At\15@s\15@s\15@s\11>q\15@s\11>q\11>q\11>q\11>q\6=p\4q\6=p\11>q\11>q%P\177\313\327\345\320\331\341\313\327\345\15@s" - "\17At\23BvK\312\363K\312\363\23Bv\24Cw\24Cw\0\0\10*X\2'T\2'T\2'T\2'T" - "\14#Q\2'T\2'T\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\0$P\14#Q\0" - "$P\0$P\0\"M\14#Q\0\"M\0\"M\4\37M\4\37M\5\40H\5\40H\2\36E\2\36E\5\40H" - "\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\11\33>\0\34C\0\34C\0\34C\0" - "\34C\11\33>\11\33>\10\32=\11\33>\10\32=\0\32:\11\33>\10\32=\11\33>\11" - "\33>\10\32=\0\32:\11\33>\10\32=\0\32:\11\33>\10\32=\0\32:\0\32:\376\377" - "\374\376\377\374\376\377\374\"9X\11\33>\0\35D\0\35D\376\377\374\376\377" - "\374\376\377\374\37<`\2\36E\2\36E\5\40H\37<`\376\377\374\376\377\374" - "\376\377\374\0\"M\14#Q\0#OK\312\363K\312\363\0$P\0%Q\14#Q\0\0\20L\177" - "\20L\177\20L\177\20L\177\34H|\35I}\35I}\35I}\32G{\34H|\34H|\30Ey\30E" - "y\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15" - "@s\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\4q\11>q\11>q\40W\204\376\377\374\376\377\374\376\377" - "\374\23Bv\23Bv\23BvK\312\363K\312\363\24Cw\24Cw\30Ey\0\0\2'T\2'T\2'T" - "\2'T\2'T\2'T\2'T\14#Q\0%Q\0%Q\14#Q\14#Q\14#Q\14#Q\14#Q\0%Q\0%Q\0$P\0" - "$P\0$P\0$P\0#O\0\"M\4\37M\0\"M\4\37M\4\37M\5\40H\5\40H\5\40H\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0\34C\0\34C\0\34" - "C\0\34C\0\34C\0\34C\0\32:\10\32=\0\32:\10\32=\10\32=\0\32:\11\33>\10" - "\32=\0\32:\11\33>\10\32=\0\32:\11\33>\10\32=\11\33>\0\34C\0\34C\11\33" - ">\376\377\374\376\377\374\376\377\374\37""6U\0\35D\0\35D\2\36E\376\377" - "\374\376\377\374\376\377\374\37<`\2\36E\5\40H\5\40H(q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\4q\11>q\11>q\40W\204\376\377\374\376\377\374\376" - "\377\374\23Bv\23Bv\23BvK\312\363K\312\363\24Cw\30Ey\30Ey\0\0\2'T\2'T" - "\2'T\14#Q\2'T\2'T\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\14#Q\14#Q\0%Q\0%Q\14#Q\0" - "$P\0$P\0$P\0\"M\0#O\0\"M\0\"M\4\37M\4\37M\5\40H\5\40H\5\40H\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0\34C\0\34C\0" - "\34C\0\34C\0\34C\0\34C\11\33>\10\32=\11\33>\11\33>\0\32:\11\33>\0\32" - ":\0\32:\0\32:\11\33>\0\32:\10\32=\0\34C\0\34C\0\34C\0\34C\0\34C\11\33" - ">\376\377\374\376\377\374\376\377\374(q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\4q\376\377\374\376\377" - "\374\376\377\374\40W\204\11>q\15@s\15@s\40W\204\376\377\374\376\377\374" - "\376\377\374\23Bv\24Cw\24CwK\312\363K\312\363\24Cw\30Ey\32G{\0\0\2'T" - "\2'T\2'T\2'T\2'T\2'T\0%Q\0%Q\0%Q\14#Q\14#Q\14#Q\0%Q\0%Q\0%Q\0$P\14#Q" - "\0$P\0#O\14#Q\0\"M\0\"M\0\"M\4\37M\4\37M\4\37M\5\40H\5\40H\2\36E\5\40" - "H\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0\34C\0" - "\34C\0\34C\0\34C\11\33>\0\34C\0\34C\11\33>\10\32=\10\32=\0\32:\0\32:" - "\0\32:\10\32=\0\32:\0\34C\0\34C\0\34C\0\34C\0\34C\0\34C\0\34C\0\35D\0" - "\35D\376\377\374\376\377\374\376\377\374\"9X\2\36E\2\36E\2\36E\376\377" - "\374\376\377\374\376\377\374(q\11>q\11" - ">q\11>q\11>q\11>q\6=p\6=p\4\0\34C\0\34C\0\34" - "C\0\34C\0\34C\11\33>\0\34C\11\33>\0\34C\11\33>\0\34C\0\34C\11\33>\0\34" - "C\0\35D\0\35D\0\35D\0\35D\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\0$P\0%Q\14#QK\312\363K\312\363\0" - "%Q\0%Q\0%Q\0\0\20L\177\34H|\35I}\35I}\34H|\32G{\34H|\30Ey\32G{\30Ey\30" - "Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\4\0\34C\0\34C\0\34C\0\34C\0\34C\0\34C\11\33>\0\34C\0\34C\0\34C\11\33" - ">\0\34C\11\33>\0\35D\0\35D\0\35D\0\35D\2\36E\2\36E\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\0%Q\14#" - "Q\0%QK\312\363K\312\363\0%Q\0%Q\2'T\0\0\20L\177\35I}\35I}\32G{\34H|\32" - "G{\32G{\30Ey\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17" - "At\15@s\15@s\15@s\11>q\15@s\11>q\11>q\11>q\11>q\11>q\6=p\6=p\4\0\34C\0\34C\0\34C\0\34C\11\33>\0\34" - "C\11\33>\0\34C\0\34C\0\34C\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\2\36E" - "\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\4\37M\4\37M\4\37M\0" - "\"M\0\"M\0\"M\0#O\0#O\0$P\0$P\0$P\0%Q\0%Q\0%Q\0%QK\312\363K\312\363\14" - "#Q\2'T\2'T\0\0\34H|\35I}\34H|\34H|\34H|\34H|\32G{\30Ey\30Ey\30Ey\24C" - "w\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\17At\17At\15@s\15@s\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\15" - "@s\15@s\15@s\15@s\17At\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\30" - "Ey\34H|K\312\363K\312\363\35I}\35I}\35I}\0\0\2'T\2'T\14#Q\0%Q\14#Q\14" - "#Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\14#Q\0#O\0$P\0\"M\0#O\0\"M\4\37M\4\37" - "M\4\37M\4\37M\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2" - "\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0\35D\0\34C\0\34C\11\33>\0\34" - "C\0\34C\0\34C\11\33>\0\34C\0\34C\0\34C\0\34C\0\34C\0\34C\0\35D\0\35D" - "\0\35D\0\35D\0\35D\0\35D\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2" - "\36E\5\40H\5\40H\5\40H\0\"M\4\37M\4\37M\0\"M\14#Q\0\"M\0$P\0$P\0%Q\0" - "$P\14#Q\0%Q\14#Q\14#Q\14#Q\0%QK\312\363K\312\363\2'T\2'T\2'T\0\0\20L" - "\177\35I}\34H|\32G{\34H|\32G{\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23B" - "v\23Bv\23Bv\23Bv\17At\17At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\17At\23Bv" - "\23Bv\24Cw\23Bv\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\32G{\34H|\32G{K\312\363" - "K\312\363\35I}\20L\177\20L\177\0\0\2'T\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\14#" - "Q\0%Q\0%Q\0%Q\14#Q\0$P\0$P\5\40H\0\"M\0\"M\0\"M\4\37M\4\37M\4\37M\5\40" - "H\5\40H\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\34C\0\34C\11\33>\11\33>\0" - "\34C\0\34C\0\34C\0\34C\0\34C\11\33>\0\35D\0\35D\0\35D\0\35D\0\35D\0\35" - "D\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\5\40H\0" - "\"M\4\37M\4\37M\4\37M\0\"M\0#O\0\"M\0$P\14#Q\0%Q\0$P\0%Q\0%Q\14#Q\0%" - "Q\0%Q\0%Q\14#QK\312\363K\312\363\2'T\2'T\2'T\0\0\35I}\34H|\20L\177\34" - "H|\32G{\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17" - "At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\4q\11>q\11>q\11>q" - "\11>q\11>q\11>q\15@s\15@s\15@s\17At\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24" - "Cw\30Ey\30Ey\30Ey\32G{\20L\177\34H|\35I}K\312\363K\312\363\20L\177\20" - "L\177\22M\200\0\0\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\0$P" - "\0$P\0#O\0#O\0\"M\4\37M\4\37M\4\37M\4\37M\4\37M\5\40H\5\40H\5\40H\2\36" - "E\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0" - "\35D\0\35D\0\35D\0\35D\0\34C\11\33>\0\34C\11\33>\0\34C\0\34C\11\33>\0" - "\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\2\36E\2\36E\2\36E\2\36E\2\36" - "E\5\40H\5\40H\2\36E\2\36E\5\40H\5\40H\5\40H\4\37M\0\"M\4\37M\0\"M\0\"" - "M\0\"M\0$P\0#O\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\14#Q\0%Q\0%Q\14#Q\2'TK\312\363" - "K\312\363\2'T\2'T\10*X\0\0\34H|\32G{\34H|\30Ey\30Ey\30Ey\30Ey\30Ey\24" - "Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\17At\23" - "Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\32G{\34H|\32G{\34H|\35" - "I}\35I}K\312\363K\312\363\20L\177\22M\200\22M\200\0\0\14#Q\0%Q\0%Q\0" - "%Q\14#Q\14#Q\14#Q\0%Q\0$P\0%Q\0$P\0#O\5\40H\0\"M\0\"M\0\"M\0\"M\4\37" - "M\4\37M\4\37M\5\40H\5\40H\0\"M\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35" - "D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0" - "\35D\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\2\36E\5\40H\5\40H\5\40" - "H\0\"M\4\37M\0\"M\0\"M\0\"M\14#Q\0$P\0#O\0$P\0$P\14#Q\0%Q\0%Q\0%Q\14" - "#Q\14#Q\0%Q\0%Q\2'T\2'T\2'TK\312\363K\312\363\2'T\10*X\10*X\0\0\34H|" - "\34H|\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23" - "Bv\17At\15@s\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6" - "=p\4q\11>q\11>q\11>q" - "\11>q\11>q\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24" - "Cw\24Cw\30Ey\30Ey\30Ey\32G{\20L\177\34H|\35I}\34H|\20L\177K\312\363K" - "\312\363\22M\200\22M\200\24N\201\0\0\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\14" - "#Q\0%Q\14#Q\0$P\0$P\14#Q\0\"M\0\"M\4\37M\4\37M\0\"M\4\37M\5\40H\5\40" - "H\5\40H\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\0" - "\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35" - "D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\5\40H\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\0\"M\0\"M" - "\14#Q\0\"M\0$P\0#O\14#Q\0%Q\0$P\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T" - "\2'T\2'TK\312\363K\312\363\2'T\10*X\10*X\0\0\32G{\32G{\30Ey\30Ey\30E" - "y\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\15" - "@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15" - "@s\17At\17At\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\32G{\32" - "G{\34H|\32G{\35I}\34H|\35I}\35I}K\312\363K\312\363\22M\200\24N\201\35" - "I}\0\0\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\0$P\0$P\0$P\0#O\0#O\0\"M\0" - "\"M\4\37M\4\37M\0\"M\5\40H\5\40H\5\40H\2\36E\2\36E\5\40H\2\36E\5\40H" - "\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0" - "\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\5" - "\40H\5\40H\0\"M\4\37M\0\"M\0\"M\14#Q\0\"M\0$P\0$P\0$P\14#Q\0$P\0%Q\14" - "#Q\14#Q\0%Q\14#Q\0%Q\14#Q\2'T\14#Q\2'T\2'T\2'TK\312\363K\312\363\10*" - "X\10*X\10*X\0\0\32G{\30Ey\30Ey\30Ey\30Ey\24Cw\24Cw\24Cw\23Bv\23Bv\23" - "Bv\23Bv\23Bv\17At\15@s\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\6=p\6=p\6=p\4q\11>q\11>q\11" - ">q\11>q\11>q\11>q\15@s\15@s\220\253\302\220\253\302\220\253\302\220\253" - "\302\220\253\302\230\253\304\221\254\303\230\253\304\221\254\303\221" - "\254\303\222\255\304\222\255\304\222\255\304\222\255\304\230\253\304" - "\222\255\304\230\253\304\223\256\305\223\256\305\34H|\20L\177\35I}K\312" - "\363K\312\363\24N\201\26O\202\26O\202\0\0\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0" - "$P\0$P\0#O\0$P\0#O\0\"M\4\37M\4\37M\0\"M\4\37M\4\37M\5\40H\0\"M\5\40" - "H\5\40H\5\40H\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\0" - "\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35" - "D\0\35D\0\35D\0\35D\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\0\"M\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\2'T\2'T\10*XK\312\363K\312\363\10*X\10*X\10*X\0\0\30Ey\30Ey\30E" - "y\24Cw\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\15" - "@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s" - "\15@s\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\20L\177\35I}\22M\200K\312\363K\312\363\26" - "O\202\26O\202\26O\202\0\0\14#Q\14#Q\0%Q\0%Q\0%Q\0$P\0%Q\0$P\0#O\0$P\14" - "#Q\0\"M\4\37M\4\37M\0\"M\4\37M\5\40H\5\40H\5\40H\5\40H\2\36E\2\36E\2" - "\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35" - "D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\0\35D\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\5\40" - "H\5\40H\5\40H\0\"M\4\37M\4\37M\0\"M\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\2'T\2'T\10*" - "XK\312\363K\312\363\10*X\10*X\10*X\0\0\30Ey\30Ey\24Cw\24Cw\24Cw\24Cw" - "\23Bv\23Bv\24Cw\23Bv\23Bv\17At\15@s\15@s\15@s\15@s\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\4q\11>q" - "\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\17At\17At\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\35I}\22M\200\22M\200K\312\363K\312\363\26O\202\26O\202\26O\202" - "\0\0\0%Q\0%Q\0%Q\0%Q\0$P\0$P\0#O\0$P\0#O\0\"M\4\37M\0\"M\0\"M\4\37M\0" - "\"M\4\37M\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0\35D\0" - "\35D\0\35D\0\35D\0\35D\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\4\37M\4\37M\0\"M\4" - "\37M\0\"M\0\"M\0\"M\14#Q\0$P\0$P\0$P\0$POk\214\363\370\373\367\375\377" - "\204\230\257,Gl\10*X\12+Y,Gl\205\224\247\367\375\377\367\375\377x\213" - "\243\2'T\2'T\10*X\10*XK\312\363K\312\363\10*X\10*X\10*X\0\0\30Ey\24C" - "w\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\15@s\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\17At\23" - "Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw3e\224\365\372\375\376\377\374y\231\265" - "\30Ey\30Ey\34H|\32G{\34H|\35I}r\227\267\376\377\374\376\377\374c\207" - "\250\22M\200\22M\200\24N\201K\312\363K\312\363\26O\202\26O\202\27P\203" - "\0\0\0%Q\14#Q\0$P\0%Q\0$P\0#O\0$P\0\"M\0\"M\0\"M\4\37M\4\37M\4\37M\4" - "\37M\5\40H\5\40H\0\"M\5\40H\5\40H\2\36E\2\36E\5\40H\5\40H\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\0\35D\0\35D\0\35D\0\35D\0" - "\35D\0\35D\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40" - "H\2\36E\5\40H\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\4\37M\0\"M\4\37M\4" - "\37M\0\"M\0#O\0\"M\0$P\0#O\14#Q\14#Q\14#Q\252\265\303\376\377\374\376" - "\377\374,Gl\14#Q\0%Q\0%Q\14#Q\2'T\2'T.In\376\377\374\376\377\374\274" - "\310\326\2'T\10*X\10*XK\312\363K\312\363\10*X\10*X\12+Y\0\0\24Cw\24C" - "w\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\15@s\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\4q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\17At\23Bv\23" - "Bv\24Cw\23Bv\23Bv\24Cw\24Cw\24Cw\354\362\364\376\377\374\376\377\374" - "Ks\237\32G{\34H|\32G{\34H|\20L\177\34H|Tv\234\376\377\374\376\377\374" - "\354\362\364\22M\200\24N\201\24N\201K\312\363K\312\363\26O\202\26O\202" - "\27P\203\0\0\0$P\14#Q\0$P\0%Q\0$P\0$P\0\"M\0\"M\4\37M\4\37M\4\37M\0\"" - "M\4\37M\5\40H\5\40H\5\40H\5\40H\2\36E\2\36E\5\40H\2\36E\5\40H\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\5\40H\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\0\"M\4\37M\4\37" - "M\4\37M\0\"M\0\"M\0$P\0#O\0#O\14#Q\0%Q\14#Q\14#Q\365\372\375\376\377" - "\374\376\377\374\312\322\333\34""8a\14#Q\0%Q\2'T\2'T\37:d\312\322\333" - "\376\377\374\376\377\374\365\372\375\10*X\10*X\10*XK\312\363K\312\363" - "\10*X\12+Y\12+Y\0\0\24Cw\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17At\15@" - "s\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=" - "p\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15" - "@s\15@s\15@s\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\30Ey\333\344" - "\354\376\377\374\376\377\374\376\377\374\363\370\373\274\310\326\225" - "\260\307\225\260\307\274\310\326\364\371\374\376\377\374\376\377\374" - "\376\377\374\336\347\357\22M\200\35I}\26O\202K\312\363K\312\363\26O\202" - "\27P\203\27P\203\0\0\0%Q\14#Q\0#O\0#O\0$P\14#Q\0\"M\0\"M\4\37M\4\37M" - "\4\37M\0\"M\4\37M\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\4\37M\4\37M\4\37M\4" - "\37M\0\"M\0\"M\0\"M\0$P\0#O\0$P\0$P\14#Q\14#Q\0%Q\0%Q\210\227\252\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\213\232\255\10*X\10*X\10*XK\312\363K\312\363\10*X\12+Y\12+Y\0\0" - "\24Cw\24Cw\23Bv\23Bv\23Bv\23Bv\23Bv\17At\17At\15@s\15@s\15@s\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\4q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\23Bv\23Bv\23" - "Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\27P\203\333\344\354\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\336\347\357\"V\212\24N\201" - "\26O\202\26O\202K\312\363K\312\363\26O\202\27P\203\27P\203\0\0\0%Q\0" - "$P\0$P\0$P\0\"M\0#O\4\37M\4\37M\4\37M\4\37M\4\37M\5\40H\5\40H\5\40H\5" - "\40H\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40" - "H\5\40H\5\40H\5\40H\4\37M\4\37M\4\37M\4\37M\4\37M\0\"M\0#O\0\"M\0$P\0" - "#O\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\14#Q\37:d\303\314\324\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\307\317\330&@k\10*X\10*X\10*X\10*XK\312\363K\312\363\10*X\12" - "+Y\12+Y\0\0\23Bv\23Bv\24Cw\23Bv\23Bv\23Bv\17At\15@s\15@s\15@s\15@s\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6" - "=p\4q\11" - ">q\11>q\11>q\11>q\11>q\15@s\11>q\11>q\11>q\15@s\15@s\15@s\17At\17At\23" - "Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\35I}X" - "\203\250\263\303\326\341\352\362\365\372\375\365\372\375\343\350\353" - "\264\304\327o\206\243\24N\201\22M\200\24N\201\24N\201\26O\202\26O\202" - "K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\0$P\0$P\0\"M\0\"M\0\"" - "M\4\37M\0\"M\0\"M\4\37M\4\37M\5\40H\5\40H\5\40H\5\40H\5\40H\2\36E\2\36" - "E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\4" - "\37M\4\37M\0\"M\4\37M\4\37M\0\"M\0#O\0$P\0#O\0#O\14#Q\0%Q\0$P\0%Q\0%" - "Q\0%Q\14#Q\14#Q\14#Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10" - "*X\10*X\10*X\10*XK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\23Bv\23Bv\23B" - "v\23Bv\17At\17At\15@s\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\15@s\15@s\15@s\15@s\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24" - "Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\32G{\34H|\32G{\34H|\35I}\35I}\34H|\35" - "I}\20L\177\20L\177\22M\200\22M\200\22M\200\24N\201\26O\202\26O\202\26" - "O\202K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\0$P\0\"M\14#Q\0\"" - "M\0\"M\4\37M\0\"M\4\37M\4\37M\4\37M\5\40H\5\40H\5\40H\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\0" - "\"M\4\37M\4\37M\4\37M\4\37M\0\"M\0\"M\0$P\0#O\0$P\0$P\14#Q\0$P\0%Q\14" - "#Q\0%Q\14#Q\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\10*X" - "\10*X\10*X\10*X\10*X\10*XK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\23Bv\23" - "Bv\23Bv\17At\15@s\15@s\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\24Cw\24" - "Cw\24Cw\24Cw\230\253\304\222\255\304\222\255\304\222\255\304\230\253" - "\304\230\253\304\230\253\304\230\253\304\230\253\304\230\253\304\223" - "\256\305\223\256\305\224\257\306\224\257\306\224\257\306\224\257\306" - "\224\257\306\225\260\307\225\260\307\26O\202\26O\202\26O\202K\312\363" - "K\312\363\27P\203\27P\203\27P\203\0\0\0$P\14#Q\0\"M\0\"M\0\"M\4\37M\4" - "\37M\4\37M\5\40H\5\40H\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\5\40H\2\36" - "E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\0\"M\0" - "\"M\0\"M\0#O\0\"M\0\"M\0$P\0$P\0$P\0$P\14#Q\0%Q\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\10*X\10*X\10*XK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\23Bv\23Bv\17At\17" - "At\15@s\15@s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6" - "=p\6=p\6=p\6=p\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@" - "s\15@s\17At\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24" - "Cw\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\26O\202\26O\202\26O\202K\312\363K\312\363\27" - "P\203\27P\203\27P\203\0\0\0\"M\4\37M\0\"M\4\37M\0\"M\4\37M\4\37M\5\40" - "H\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2" - "\36E\5\40H\5\40H\5\40H\5\40H\4\37M\0\"M\4\37M\4\37M\0\"M\4\37M\14#Q\0" - "\"M\0$P\0#O\0$P\0$P\14#Q\0$P\0%Q\0%Q\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\10*X\10" - "*X\10*XK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\23Bv\17At\23Bv\15@s\15@" - "s\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=" - "p\6=p\6=p\6=p\6=p\6=p\4q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15" - "@s\15@s\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\26O\202\26O\202\26O\202K\312\363K\312\363\27P\203" - "\27P\203\27P\203\0\0\0\"M\4\37M\4\37M\4\37M\4\37M\0\"M\5\40H\5\40H\5" - "\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40" - "H\5\40H\5\40H\5\40H\4\37M\4\37M\0\"M\4\37M\4\37M\0\"M\0\"M\0#O\0\"M\0" - "$P\0$P\0$P\14#Q\14#Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\2'T" - "\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*XK\312" - "\363K\312\363\12+Y\12+Y\12+Y\0\0\17At\15@s\15@s\15@s\15@s\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6" - "=p\6=p\4q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\17At\17At\23Bv\23" - "Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\34" - "H|\34H|\32G{\35I}\35I}\35I}\20L\177\20L\177\20L\177\20L\177\22M\200\35" - "I}\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202K\312\363K" - "\312\363\27P\203\27P\203\27P\203\0\0\0\"M\4\37M\4\37M\4\37M\4\37M\5\40" - "H\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5" - "\40H\5\40H\5\40H\5\40H\0\"M\4\37M\0\"M\0\"M\4\37M\4\37M\4\37M\0\"M\0" - "#O\0#O\0#O\0#O\14#Q\0%Q\0%Q\14#Q\14#Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\2" - "'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*XK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\15@s\15@s\15@s\15@s\11>" - "q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6" - "=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\17" - "At\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30" - "Ey\32G{\20L\177\34H|\34H|\35I}\35I}\35I}\35I}\20L\177\20L\177\20L\177" - "\22M\200\22M\200\22M\200\24N\201\26O\202\26O\202\26O\202\26O\202\26O" - "\202\26O\202K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\0\"M\4\37" - "M\4\37M\5\40H\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2" - "\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\0\"M\4\37" - "M\0\"M\14#Q\0\"M\0#O\0$P\0$P\0$P\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\14#Q" - "\217\236\261\217\236\261\217\236\261\27""5]\0%Q\217\236\261\217\236\261" - "\217\236\261\217\236\261\217\236\261\217\236\261\217\236\261\217\236" - "\261\217\236\261\217\236\261\217\236\261\220\240\262\220\240\262\220" - "\240\262\10*X\10*X\10*XK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\15@s\15" - "@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6" - "=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6" - "=p\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15" - "@s\15@s\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30" - "Ey\30Ey\30Ey\376\377\374\376\377\374\376\377\374-`\217\35I}\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\26O\202\26O\202\26O\202K\312\363K\312\363\27P\203" - "\27P\203\27P\203\0\0\4\37M\4\37M\5\40H\5\40H\5\40H\0\"M\2\36E\2\36E\2" - "\36E\2\36E\5\40H\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40" - "H\4\37M\4\37M\4\37M\4\37M\0\"M\4\37M\0\"M\0\"M\14#Q\0#O\0#O\14#Q\0%Q" - "\0$P\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\376\377\374\376\377\374\376\377\374&@k" - "\2'T\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\10*X\10*X\10*XK\312\363K\312\363" - "\12+Y\12+Y\12+Y\0\0\15@s\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>" - "q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p" - "\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24" - "Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\376\377\374\376\377\374\376" - "\377\374-`\217\34H|\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\26O\202\26O\202\26O" - "\202K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\0\"M\5\40H\5\40H\5" - "\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40" - "H\5\40H\5\40H\5\40H\5\40H\0\"M\4\37M\4\37M\4\37M\0\"M\0\"M\0#O\0\"M\0" - "#O\5\40H\0$P\14#Q\0$P\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\14#Q\0%Q\376\377\374" - "\376\377\374\376\377\374(q\11>q\11>q\11>q\11>" - "q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p" - "\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\17At\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23" - "Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\32G{\34H|\32" - "G{\34H|\20L\177\35I}\35I}\34H|\35I}\20L\177\20L\177\20L\177\22M\200\22" - "M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202" - "\26O\202\26O\202K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\5\40H" - "\5\40H\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2" - "\36E\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\4\37M\0\"M\0\"M\0\"M\0" - "\"M\0\"M\0#O\0#O\0$P\0$P\14#Q\0$P\0%Q\14#Q\14#Q\0%Q\14#Q\14#Q\0%Q\14" - "#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\12+YK\312\363K\312\363\12+Y\12+Y\12+Y\0\0" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6" - "=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>" - "q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\17" - "At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30" - "Ey\30Ey\30Ey\32G{\34H|\32G{\34H|\35I}\20L\177\35I}\35I}\35I}\20L\177" - "\20L\177\20L\177\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O" - "\202\26O\202\26O\202\26O\202\26O\202\27P\203K\312\363K\312\363\27P\203" - "\27P\203\27P\203\0\0\5\40H\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H" - "\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\4" - "\37M\0\"M\0\"M\4\37M\0#O\0\"M\0\"M\0$P\0#O\14#Q\0%Q\14#Q\0%Q\0%Q\14#" - "Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\10" - "*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*XK\312\363" - "K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6" - "=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24" - "Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\34H|\32G{\34H|\35I}\35I}\34" - "H|\35I}\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\26O\202\26O\202\26O\202K\312\363" - "K\312\363\27P\203\27P\203\27P\203\0\0\5\40H\5\40H\2\36E\5\40H\2\36E\2" - "\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\5" - "\40H\2\36E\2\36E\2\36E\2\36E\2\36E\0\"M\5\40H\5\40H\5\40H\5\40H\4\37" - "M\4\37M\4\37M\4\37M\4\37M\0\"M\0\"M\14#Q\0#O\0#O\0$P\0$P\14#Q\0%Q\0%" - "Q\0%Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\2'T\14#Q\2'T\2'T\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\10*X\10*X\10*XK\312\363K\312\363\12+Y\12+Y\12" - "+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6" - "=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\17At\17" - "At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30" - "Ey\32G{\30Ey\32G{\34H|\34H|\35I}\35I}\35I}\35I}\20L\177\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\26O\202\26O\202\26O\202K\312\363K\312\363\27P\203\27" - "P\203\27P\203\0\0\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\5\40H\2\36" - "E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\2\36E\5\40H\2\36" - "E\2\36E\5\40H\5\40H\5\40H\5\40H\0\"M\4\37M\4\37M\4\37M\4\37M\4\37M\0" - "\"M\0\"M\0\"M\5\40H\0$P\0$P\0%Q\0$P\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0" - "%Q\14#Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T\2'T\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\10*X\10*X\10*XK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6" - "=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23" - "Bv\23Bv\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\32G{\30Ey\34H|\32G{\34" - "H|\32G{\35I}\35I}\35I}\35I}\20L\177\224\257\306\224\257\306\224\257\306" - "\224\257\306\230\253\304\224\257\306\230\253\304\233\267\316\310\324" - "\342\367\375\377\376\377\374\376\377\374\246\276\317\225\260\307\26O" - "\202\26O\202\26O\202K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\2" - "\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5" - "\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40" - "H\5\40H\4\37M\0\"M\4\37M\4\37M\4\37M\4\37M\0\"M\14#Q\0\"M\0\"M\0$P\0" - "$P\0$P\14#Q\0%Q\0$P\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\2" - "'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X1Lq\337\344" - "\347\376\377\374\325\332\334\13""6c\10*X\10*X\10*XK\312\363K\312\363" - "\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6" - "=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\23" - "Bv\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30" - "Ey\30Ey\30Ey\32G{\34H|\32G{\34H|\20L\177\35I}\35I}\35I}\34H|\20L\177" - "\20L\177\20L\177\35I}\22M\200\22M\200\22M\200\24N\201\24N\201\24N\201" - "\26O\202\26O\202_\200\247\376\377\374\376\377\374\215\250\277\26O\202" - "\26O\202\27P\203K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\2\36E" - "\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40" - "H\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\4" - "\37M\4\37M\4\37M\4\37M\4\37M\4\37M\0\"M\14#Q\0\"M\0#O\0$P\0#O\0%Q\14" - "#Q\0$P\0$P\0%Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\2'T\14#Q\2" - "'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X/Jo\376" - "\377\374\376\377\374\320\331\341\10*X\12+Y\12+YK\312\363K\312\363\12" - "+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6" - "=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\17At\17" - "At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30" - "Ey\30Ey\30Ey\34H|\32G{\34H|\32G{\35I}\35I}\35I}\35I}\35I}\20L\177\20" - "L\177\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\24N\201\26O\202" - "\26O\202\26O\202\202\231\266\376\377\374\376\377\374\363\370\373\26O" - "\202\27P\203\27P\203K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\2" - "\36E\5\40H\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5" - "\40H\2\36E\2\36E\5\40H\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\0\"" - "M\4\37M\4\37M\4\37M\4\37M\0\"M\4\37M\0\"M\0#O\0$P\0#O\0$P\0$P\14#Q\0" - "%Q\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\14#Q" - "\2'T\2'T\2'T\2'T\217\236\261\221\244\274\217\236\261\221\244\274\217" - "\236\261\217\236\261\217\236\261\222\242\264\232\251\274\303\314\324" - "\376\377\374\376\377\374\376\377\374\364\371\374\10*X\12+Y\12+YK\312" - "\363K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>q\6=p\6=p\6=" - "p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15" - "@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30" - "Ey\30Ey\30Ey\30Ey\32G{\34H|\32G{\34H|\34H|\34H|\34H|\35I}\35I}\35I}\35" - "I}\20L\177\20L\177\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\330\341\351\26O\202\27P\203\27P" - "\203K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\2\36E\2\36E\2\36E" - "\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2" - "\36E\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40" - "H\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\0\"M\4\37M\0\"M\4\37" - "M\0\"M\4\37M\0\"M\0\"M\14#Q\0#O\0$P\14#Q\0%Q\0%Q\0$P\14#Q\0%Q\0%Q\14" - "#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374|\217\247\10*X\12+Y\12+YK\312\363K\312\363\12+Y\12+Y\12+" - "Y\0\0\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=" - "p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\24Cw\23" - "Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\20" - "L\177\34H|\34H|\34H|\35I}\35I}\35I}\35I}\35I}\20L\177\35I}\20L\177\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\303\317\335\36S\207\26O\202\27P\203\27P\203K\312\363K\312\363\27" - "P\203\27P\203\27P\203\0\0\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5" - "\40H\4\37M\4\37M\4\37M\4\37M\4\37M\0\"M\0\"M\0\"M\14#Q\0\"M\0#O\0$P\0" - "$P\0$P\14#Q\0$P\0$P\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q" - "\2'T\2'T\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\367" - "\375\377\353\360\363\275\305\315e|\231\13,Z\10*X\12+Y\12+Y\12+YK\312" - "\363K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p" - "\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\17At\15@s\15@s\15@s\17At\17" - "At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30" - "Ey\30Ey\32G{\30Ey\32G{\34H|\34H|\34H|\34H|\35I}\35I}\35I}\20L\177\35" - "I}\20L\177\20L\177\35I}\22M\200\22M\200\24N\201\24N\201\24N\201\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\27P" - "\203\27P\203\27P\203K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2" - "\36E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\0\"M\4\37M\4\37M\0\"M" - "\0\"M\0\"M\0\"M\14#Q\0#O\0$P\0#O\0$P\0%Q\0$P\14#Q\0$P\14#Q\0%Q\14#Q\14" - "#Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\10*X\2'" - "T\10*X\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\12+Y\12+Y\12+YK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>" - "q\11>q\11>q\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\6=p\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15" - "@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24" - "Cw\30Ey\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\20L\177\34H|\32G{\34H|\34H|\35" - "I}\20L\177\35I}\34H|\20L\177\20L\177\20L\177\20L\177\20L\177\22M\200" - "\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\35I}\26O\202\26O\202" - "\26O\202\26O\202\26O\202\26O\202\26O\202\27P\203\27P\203\27P\203K\312" - "\363K\312\363\27P\203\27P\203\27P\203\0\0\2\36E\2\36E\2\36E\2\36E\2\36" - "E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5" - "\40H\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5\40" - "H\5\40H\4\37M\4\37M\4\37M\4\37M\4\37M\0\"M\4\37M\0\"M\0#O\0$P\0#O\0$" - "P\0$P\14#Q\0$P\0$P\0$P\0%Q\14#Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\0%" - "Q\2'T\14#Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12+Y\12+YK\312\363" - "K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\6=p\6=p\6=p\6=p\6=p" - "\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23" - "Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30" - "Ey\32G{\32G{\32G{\34H|\34H|\32G{\35I}\35I}\35I}\34H|\20L\177\35I}\20" - "L\177\20L\177\22M\200\22M\200\22M\200\22M\200\24N\201\24N\201\26O\202" - "\26O\202\33Q\205\177\237\272\331\342\352\366\373\376\357\364\367\303" - "\317\335_\200\247\26O\202\27P\203\27P\203\27P\203\27P\203K\312\363K\312" - "\363\27P\203\27P\203\27P\203\0\0\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E" - "\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\2" - "\36E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5\40H\0\"M\4\37" - "M\4\37M\0\"M\4\37M\4\37M\0\"M\14#Q\0\"M\0\"M\0\"M\0$P\0#O\0#O\0$P\0$" - "P\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\2'T\14#Q\2" - "'T\2'T\2'T\2'T\2'T\2'T\2'T\27""5]\204\230\257\333\340\343\370\372\367" - "\353\360\363\242\261\305#=g\15-[\270\303\321\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374o\206\243\12+Y\12+Y\12" - "+Y\12+YK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>" - "q\6=p\6=p\6=p\6=p\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\17At\17" - "At\23Bv\23Bv\23Bv\24Cw\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30" - "Ey\30Ey\30Ey\32G{\32G{\34H|\34H|\34H|\32G{\35I}\35I}\35I}\34H|\20L\177" - "\20L\177\20L\177\20L\177\24N\201\276\312\330\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\333\344\354\202\242\276\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\366\373\3763e\224\27P\203\27P\203\27P\203K\312\363K\312\363" - "\27P\203\27P\203\27P\203\0\0\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36" - "E\5\40H\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2" - "\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\0\"M\0\"M\4\37M\4\37M" - "\4\37M\0\"M\4\37M\0\"M\14#Q\0\"M\0#O\0$P\0$P\0$P\0$P\14#Q\0%Q\14#Q\0" - "%Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'" - "T\2'T\2'T\2'TRj\205\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\367\375\377\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\204\230\257\12+Y\12+Y\12+YK\312\363K\312\363\12+Y\12+Y\12+Y\0\0" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15" - "@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24" - "Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\20L\177\34H|\34H|\20L\177" - "\34H|\34H|\35I}\35I}\35I}\35I}\20L\177\20L\177\35I}\35I}\246\276\317" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\300\314\332\231" - "\264\313\313\327\345\376\377\374\376\377\374\376\377\374\310\324\342" - "\27P\203\27P\203\27P\203K\312\363K\312\363\27P\203\27P\203\27P\203\0" - "\0\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H" - "\2\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5" - "\40H\0\"M\5\40H\0\"M\4\37M\4\37M\0\"M\4\37M\0\"M\4\37M\0\"M\0\"M\14#" - "Q\0#O\0$P\0#O\0$P\0$P\0$P\14#Q\0%Q\14#Q\0%Q\0%Q\14#Q\14#Q\0%Q\0%Q\0%" - "Q\0%Q\0%Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\320\331\341\376" - "\377\374\376\377\374\365\372\375\247\262\300\242\261\305\370\372\367" - "\376\377\374\376\377\374\376\377\374\204\230\257\10*X\10*X\12+Y\242\261" - "\305\376\377\374\376\377\374\350\355\360\12+Y\12+Y\12+YK\312\363K\312" - "\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\15@s\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23" - "Bv\23Bv\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34" - "H|\32G{\34H|\34H|\34H|\35I}\20L\177\35I}\35I}\35I}\20L\177\35I}\22M\200" - "\22M\200\357\364\367\376\377\374\376\377\374y\231\265\24N\201\26O\202" - "r\227\267\376\377\374\376\377\374\376\377\374-`\217\26O\202\27P\203\27" - "P\203Tv\234\376\377\374\376\377\374\366\373\376\27P\203\27P\203\27P\203" - "K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\2\36E\2\36E\5\40H\2\36" - "E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2" - "\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\0\"M\4\37M\4\37M\4\37" - "M\4\37M\4\37M\0\"M\0\"M\14#Q\0\"M\0\"M\0\"M\0$P\0#O\0%Q\14#Q\0$P\14#" - "Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\0%Q\0%Q\14#Q\2'T\2'T\2'T" - "\2'T\2'T\2'T\2'T\2'T\2'T\10*X\372\374\371\376\377\374\376\377\374#Gp" - "\10*X\10*X/Jo\376\377\374\376\377\374\376\377\374\13,Z\10*X\12+Y\12+" - "Y,Ep\376\377\374\376\377\374\376\377\374\12+Y\12+Y\12+YK\312\363K\312" - "\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\15@s\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23" - "Bv\24Cw\24Cw\24Cw\24Cw\30Ey\24Cw\30Ey\30Ey\30Ey\30Ey\32G{\32G{\34H|\32" - "G{\20L\177\34H|\35I}\35I}\34H|\35I}\20L\177\20L\177\20L\177\35I}\22M" - "\200\22M\200\22M\200\376\377\374\376\377\374\376\377\3743e\224\26O\202" - "\26O\2023e\224\376\377\374\376\377\374\376\377\374\26O\202\27P\203\27" - "P\203\27P\2033e\224\376\377\374\376\377\374\376\377\374\27P\203\27P\203" - "\27P\203K\312\363K\312\363\27P\203\27P\203\27P\203\0\0\2\36E\5\40H\2" - "\36E\2\36E\2\36E\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\2\36" - "E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\0\"M\4\37M\4\37M\4" - "\37M\4\37M\4\37M\0\"M\4\37M\0\"M\0\"M\0$P\0#O\0$P\0#O\14#Q\0%Q\14#Q\14" - "#Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\14#Q\0%Q\0%Q\0%Q\0%Q\0%Q\2'T\14#Q\2'T\2" - "'T\2'T\2'T\2'T\2'T\2'T\10*X\2'T\10*X\376\377\374\376\377\374\376\377" - "\374,Ep\10*X\10*X\"Fo\376\377\374\376\377\374\376\377\374\12+Y\12+Y\12" - "+Y\12+Y,Ep\376\377\374\376\377\374\376\377\374\12+Y\12+Y\12+YK\312\363" - "K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q" - "\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15" - "@s\15@s\15@s\15@s\15@s\15@s\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24" - "Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\32G{\32G{\34H|\34" - "H|\32G{\34H|\35I}\35I}\35I}\34H|\20L\177\20L\177\35I}\20L\177\20L\177" - "\22M\200\22M\200\22M\200\376\377\374\376\377\374\376\377\374\242\271" - "\313\225\260\307\225\260\307\242\271\313\376\377\374\376\377\374\376" - "\377\374\225\260\307\225\260\307\225\260\307\235\261\311\242\271\313" - "\376\377\374\376\377\374\376\377\374\27P\203\27P\203\27P\203K\312\363" - "K\312\363\35I}\27P\203\27P\203\0\0\5\40H\2\36E\2\36E\2\36E\2\36E\5\40" - "H\2\36E\5\40H\2\36E\2\36E\2\36E\5\40H\2\36E\2\36E\5\40H\5\40H\5\40H\5" - "\40H\5\40H\5\40H\5\40H\4\37M\0\"M\4\37M\4\37M\4\37M\0\"M\4\37M\0\"M\14" - "#Q\0\"M\0#O\0$P\0$P\0#O\14#Q\0$P\0%Q\14#Q\0%Q\14#Q\14#Q\0%Q\14#Q\14#" - "Q\14#Q\14#Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T" - "\10*X\2'T\10*X\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\12+Y\12+Y\12+YK\312\363K\312\363\12+Y\12+Y\12" - "+Y\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\15@s\17At\17" - "At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30" - "Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\32G{\34H|\32G{\34H|\35I}\35I}\35I}\35" - "I}\20L\177\35I}\20L\177\35I}\22M\200\22M\200\22M\200\24N\201\24N\201" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\27P\203\27P\203\27P\203K\312\363K\312\363\27P\203\27P\203" - "\27P\203\0\0\5\40H\2\36E\5\40H\2\36E\2\36E\5\40H\2\36E\5\40H\2\36E\2" - "\36E\2\36E\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\0\"" - "M\4\37M\0\"M\4\37M\4\37M\0\"M\0\"M\0#O\0\"M\0\"M\5\40H\0$P\0#O\0$P\0" - "%Q\0$P\14#Q\0$P\0%Q\0%Q\0%Q\14#Q\14#Q\14#Q\14#Q\14#Q\0%Q\0%Q\14#Q\0%" - "Q\2'T\2'T\2'T\2'T\14#Q\2'T\2'T\2'T\10*X\2'T\10*X\10*X\10*X\10*X\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\12+Y\12+Y\12+YK\312\363K\312\363\12+Y\12+Y\12+Y\0\0\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\15@s\15@s\15@s\15@s\15@s\15@s\17At\17At\17At\23Bv\23Bv\23Bv\24" - "Cw\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32" - "G{\34H|\32G{\34H|\34H|\32G{\35I}\35I}\35I}\35I}\20L\177\20L\177\20L\177" - "\20L\177\22M\200\22M\200\22M\200\24N\201\24N\201\24N\201\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\33Q\205\33Q\205\33Q\205K\312\363K\312\363\33Q\205\33Q\205\33Q\205\0" - "\0\2\36E\2\36E\5\40H\2\36E\5\40H\2\36E\5\40H\2\36E\2\36E\5\40H\5\40H" - "\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\4\37M\4\37M\4\37M\4\37M\0\"M\4\37" - "M\0\"M\0\"M\0\"M\14#Q\0\"M\0#O\0$P\0#O\0$P\0$P\0$P\0%Q\14#Q\14#Q\14#" - "Q\0%Q\0%Q\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\0%Q\14#Q\0%Q\2'T\14#Q\2'T\2'T\2'" - "T\2'T\2'T\2'T\10*X\10*X\2'T\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10" - "*X\10*X\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\0\0\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\17At\15" - "@s\15@s\15@s\17At\17At\17At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24" - "Cw\24Cw\24Cw\30Ey\30Ey\30Ey\30Ey\30Ey\30Ey\32G{\30Ey\34H|\20L\177\34" - "H|\34H|\35I}\35I}\35I}\34H|\35I}\20L\177\20L\177\20L\177\20L\177\35I" - "}\22M\200\22M\200\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26" - "O\202\26O\202\26O\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\27P\203\27P\203\27P\203\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\0\0\2\36E\2\36E" - "\5\40H\2\36E\2\36E\5\40H\2\36E\5\40H\5\40H\5\40H\5\40H\5\40H\5\40H\5" - "\40H\5\40H\0\"M\4\37M\0\"M\4\37M\4\37M\4\37M\4\37M\4\37M\0\"M\0#O\0\"" - "M\0\"M\0$P\0$P\0#O\0#O\14#Q\0%Q\14#Q\0$P\14#Q\0%Q\0%Q\0%Q\14#Q\0%Q\14" - "#Q\14#Q\0%Q\0%Q\14#Q\0%Q\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\2'T\10*X\10" - "*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\10*X\12+Y\12+Y\12" - "+Y\12+Y\12+Y\12+Y\12+Y\12+Y\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13,Z\13" - ",Z\13,Z\13,Z\13,Z\13,Z\0\0\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11>q\11" - ">q\11>q\11>q\11>q\11>q\11>q\15@s\15@s\15@s\15@s\15@s\15@s\15@s\17At\17" - "At\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\23Bv\24Cw\24Cw\24Cw\24Cw\24Cw\24Cw\30" - "Ey\24Cw\30Ey\30Ey\30Ey\30Ey\32G{\34H|\32G{\34H|\20L\177\35I}\35I}\20" - "L\177\35I}\34H|\20L\177\20L\177\20L\177\35I}\22M\200\22M\200\22M\200" - "\24N\201\24N\201\26O\202\26O\202\26O\202\26O\202\26O\202\26O\202\26O" - "\202\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203\27P\203" - "\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q" - "\205\33Q\205\33Q\205\33Q\205\33Q\205\33Q\205\0\0", -}; - - diff --git a/polymer-perf/eduke32/build/rsrc/game.bmp b/polymer-perf/eduke32/build/rsrc/game.bmp deleted file mode 100644 index 1b00a3ad0..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/game.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/build/rsrc/game.xcf b/polymer-perf/eduke32/build/rsrc/game.xcf deleted file mode 100644 index fadc54b2d..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/game.xcf and /dev/null differ diff --git a/polymer-perf/eduke32/build/rsrc/game_banner.c b/polymer-perf/eduke32/build/rsrc/game_banner.c deleted file mode 100644 index 61313e983..000000000 --- a/polymer-perf/eduke32/build/rsrc/game_banner.c +++ /dev/null @@ -1,2685 +0,0 @@ -#include - -/* GdkPixbuf RGB C-Source image dump */ - -const GdkPixdata startbanner_pixdata = { - 0x47646b50, /* Pixbuf magic: 'GdkP' */ - 24 + 76160, /* header length + pixel_data length */ - 0x1010001, /* pixdata_type */ - 272, /* rowstride */ - 90, /* width */ - 280, /* height */ - /* pixel_data: */ - "\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\30""1\1\25" - "0\10\30""1\1\25""0\10\30""1\1\30""1\1\23""3\3\27""1\12\23""3\3\23""3" - "\3\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3" - "\30""1\1\23""3\3\27""1\12\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25" - "5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\31""9\13\32" - "8\2\32""8\2\27""8\11\34:\5\34:\5\27""8\11\34:\5\27=\7\27=\7\27=\7\27" - "=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32" - "\77\12\32\77\12\36B\5\32\77\12\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5" - "\33A\14\36B\5\33A\14\33A\14\0\0.W\23.W\23.W\23.W\23.W\23.W\23.W\23""2" - "Z\15.W\23.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""0" - "Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24""2Z\15-\\\16-\\\16""0Y\24-\\\16-\\\16""3[\16/^\20""3[\16/^\20/^" - "\20/^\20""3[\16""0_\21""3[\16""0_\21""0_\21""0_\21""2a\23""2a\23""2a" - "\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""7" - "e\17""7e\17""7e\17""7e\17""9g\21""7f\30""4j\23""4j\23""9g\21""4j\23""5" - "k\24""4j\23""9g\21""5k\24""9g\21""5k\24""4j\23""5k\24""9g\21""4j\23""5" - "k\24""5k\24""5k\24""6l\25""9g\21""5k\24""5k\24""5k\24""5k\24""6l\25""9" - "g\21\0\0\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\25" - "0\10\30""1\1\25""0\10\25""0\10\23""3\3\23""3\3\27""1\12\23""3\3\27""1" - "\12\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\30" - "1\1\23""3\3\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25" - "5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\32" - "8\2\32""8\2\27""8\11\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\27=\7" - "\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32" - "\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36" - "B\5\33A\14\36B\5\33A\14\0\0.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23." - "W\23""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""2" - "Z\15""2Z\15""3[\16-\\\16""3[\16""0Y\24/^\20/^\20""3[\16/^\20/^\20/^\20" - "3[\16""0_\21""0_\21""3[\16""0_\21""3[\16""2a\23""2a\23""2a\23""2a\23" - "3b\24""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""5d\26""5d\26""5d\26" - "7e\17""5d\26""9g\21""9g\21""9g\21""4j\23""4j\23""4j\23""9g\21""4j\23" - "9g\21""4j\23""9g\21""5k\24""9g\21""5k\24""9g\21""4j\23""9g\21""5k\24" - "9g\21""6l\25""9g\21""5k\24""5k\24\202\320q\202\320q9g\21""6l\25""9g\21" - "\0\0\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10\25""0" - "\10\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3" - "\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\27" - "1\12\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\31""9\13\31""9\13\32" - "8\2\27""8\11\34:\5\31""9\13\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\35;\6" - "\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5" - "\202\320q\202\320q\33A\14\36B\5\33A\14\0\0.W\23.W\23.W\23""2Z\15.W\23" - "0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24" - "0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24" - "2Z\15""2Z\15""2Z\15""0Y\24-\\\16-\\\16""0Y\24/^\20/^\20/^\20/^\20""3" - "[\16/^\20/^\20""3[\16""3[\16""0_\21""3[\16""0_\21""2a\23""2a\23""2a\23" - "2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17" - "5d\26""5d\26""7e\17""5d\26""9g\21""7f\30""4j\23""4j\23""4j\23""9g\21" - "4j\23""9g\21""9g\21""4j\23""9g\21""5k\24""9g\21""5k\24""9g\21""6l\25" - "9g\21""5k\24""9g\21""5k\24""6l\25""9g\21""6l\25""5k\24\202\320q\202\320" - "q5k\24""6l\25""5k\24\0\0\30""1\1\25""0\10\30""1\1\23""3\3\27""1\12\23" - "3\3\23""3\3\27""1\12\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3" - "\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\30""1\1\23" - "3\3\30""1\1\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\32""8\2\32""8\2\31""9" - "\13\34:\5\27""8\11\31""9\13\34:\5\31""9\13\27=\7\27=\7\27=\7\30>\10\30" - ">\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36" - "B\5\33A\14\202\320q\202\320q\36B\5\33A\14\36B\5\0\0.W\23""0Y\24""2Z\15" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15" - "0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24" - "0Y\24""2Z\15""0Y\24-\\\16-\\\16""3[\16-\\\16""3[\16/^\20/^\20""3[\16" - "/^\20/^\20""3[\16""3[\16""0_\21""0_\21""3[\16""0_\21""0_\21""2a\23""2" - "a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5" - "d\26""7e\17""7e\17""7e\17""9g\21""7f\30""9g\21""4j\23""4j\23""4j\23""9" - "g\21""4j\23""9g\21""4j\23""4j\23""4j\23""9g\21""5k\24""9g\21""9g\21""5" - "k\24""9g\21""5k\24""9g\21""5k\24""9g\21""5k\24""9g\21""6l\25""5k\24""5" - "k\24\202\320q\202\320q9g\21""6l\25""6l\25\0\0\27""1\12\30""1\1\23""3" - "\3\23""3\3\30""1\1\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\27""1\12\23" - "3\3\23""3\3\30""1\1\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12" - "\23""3\3\27""1\12\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25" - "5\6\25""5\6\27""7\10\27""7\10\25""5\6\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32" - "8\2\32""8\2\32""8\2\34:\5\27""8\11\34:\5\34:\5\27=\7\27=\7\27=\7\27=" - "\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33" - "A\14\36B\5\33A\14\36B\5\202\320q\202\320q\33A\14\33A\14\36B\5\0\0""0" - "Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0" - "Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24""2Z\15""0Y\24-\\\16-\\\16-\\\16-\\\16""3[\16""3[\16" - "/^\20/^\20/^\20/^\20""3[\16""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21" - "2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""7e\17""5d\26" - "5d\26""7e\17""5d\26""5d\26""7e\17""9g\21""9g\21""7f\30""5k\24""9g\21" - "9g\21""9g\21""4j\23""9g\21""4j\23""9g\21""4j\23""9g\21""5k\24""9g\21" - "4j\23""9g\21""6l\25""5k\24""6l\25""5k\24""6l\25""5k\24""9g\21""5k\24" - "9g\21""6l\25""5k\24\202\320q\202\320q5k\24""9g\21""5k\24\0\0\23""3\3" - "\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\23" - "3\3\27""1\12\30""1\1\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\30""1\1" - "\23""3\3\27""1\12\23""3\3\24""4\5\24""4\5\30""1\1\25""5\6\25""5\6\25" - "5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32" - "8\2\31""9\13\32""8\2\31""9\13\34:\5\34:\5\34:\5\34:\5\27=\7\27=\7\27" - "=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32" - "\77\12\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\36" - "B\5\33A\14\33A\14\36B\5\33A\14\36B\5\202\320q\202\320q\36B\5\33A\14\36" - "B\5\0\0""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24" - "0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24" - "0Y\24""0Y\24""2Z\15""0Y\24-\\\16-\\\16-\\\16-\\\16""0Y\24/^\20""3[\16" - "/^\20/^\20""3[\16""3[\16""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0" - "_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""7e\17""5" - "d\26""7e\17""5d\26""5d\26""5d\26""7e\17""7f\30""9g\21""7f\30""9g\21""5" - "k\24""9g\21""4j\23""9g\21""4j\23""4j\23""9g\21""4j\23""4j\23""5k\24""6" - "l\25""9g\21""5k\24""5k\24""9g\21""6l\25""5k\24""9g\21""9g\21""5k\24""9" - "g\21""6l\25""9g\21""5k\24""5k\24\202\320q\202\320q5k\24""9g\21""5k\24" - "\0\0\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3" - "\27""1\12\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\27" - "1\12\23""3\3\30""1\1\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6" - "\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9" - "\13\32""8\2\31""9\13\32""8\2\27""8\11\34:\5\27""8\11\34:\5\34:\5\27=" - "\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\36" - "B\5\32\77\12\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33" - "A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\202\320q\202\320" - "q\36B\5\33A\14\36B\5\0\0""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2" - "Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0" - "Y\24""0Y\24""2Z\15""2Z\15""0Y\24""3[\16-\\\16-\\\16-\\\16""3[\16-\\\16" - "3[\16/^\20""3[\16/^\20/^\20/^\20""0_\21""0_\21""3[\16""0_\21""3[\16""0" - "_\21""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""7" - "e\17""5d\26""7e\17""7e\17""7e\17""7e\17""7e\17""7f\30""9g\21""4j\23""9" - "g\21""5k\24""9g\21""5k\24""4j\23""9g\21""5k\24""4j\23""9g\21""4j\23""9" - "g\21""6l\25""9g\21""5k\24""9g\21""6l\25""5k\24""9g\21""5k\24""5k\24""5" - "k\24""9g\21""5k\24""6l\25""9g\21""5k\24""9g\21\202\320q\202\320q5k\24" - "5k\24""9g\21\0\0\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\23" - "3\3\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3" - "\23""3\3\27""1\12\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25" - "5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31" - "9\13\32""8\2\31""9\13\32""8\2\31""9\13\34:\5\27""8\11\34:\5\27=\7\27" - "=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5" - "\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14" - "\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5\33A\14\33A\14\202\320q" - "\202\320q\33A\14\33A\14\36B\5\0\0""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24" - "2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24" - "0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15-\\\16-\\\16-\\\16""0Y\24/^\20" - "3[\16/^\20""3[\16/^\20""3[\16""3[\16""0_\21""0_\21""0_\21""0_\21""0_" - "\21""3[\16""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3" - "b\24""7e\17""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""9g\21""9g\21""5" - "k\24""9g\21""9g\21""4j\23""5k\24""4j\23""5k\24""9g\21""9g\21""4j\23""9" - "g\21""6l\25""5k\24""6l\25""6l\25""9g\21""6l\25""9g\21""6l\25""9g\21""6" - "l\25""9g\21""5k\24""9g\21""5k\24""6l\25""5k\24""9g\21""5k\24\202\320" - "q\202\320q9g\21""5k\24""5k\24\0\0\27""1\12\30""1\1\23""3\3\23""3\3\23" - "3\3\27""1\12\23""3\3\27""1\12\30""1\1\23""3\3\23""3\3\27""1\12\23""3" - "\3\23""3\3\30""1\1\24""4\5\24""4\5\24""4\5\24""4\5\24""4\5\30""1\1\25" - "5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\31""9\13\32""8\2\31""9\13\32""8\2\27""8\11\34:\5\34:\5\27""8\11" - "\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\36B\5\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12" - "\32\77\12\32\77\12\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A" - "\14\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33" - "A\14\33A\14\202\320q\202\320q\33A\14\36B\5\33A\14\0\0""0Y\24""0Y\24""0" - "Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0" - "Y\24""2Z\15""2Z\15""0Y\24""0Y\24""2Z\15""2Z\15-\\\16-\\\16""3[\16-\\" - "\16/^\20""3[\16/^\20""3[\16/^\20""3[\16/^\20""0_\21""3[\16""0_\21""0" - "_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3" - "b\24""3b\24""5d\26""5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""9g\21""9" - "g\21""4j\23""5k\24""9g\21""5k\24""9g\21""4j\23""9g\21""9g\21""5k\24""9" - "g\21""5k\24""9g\21""5k\24""9g\21""6l\25""9g\21""6l\25""5k\24""6l\25""9" - "g\21""9g\21""9g\21""6l\25""9g\21""9g\21""9g\21""9g\21""5k\24""9g\21""5" - "k\24""9g\21\202\320q\202\320q9g\21""5k\24""9g\21\0\0\27""1\12\23""3\3" - "\27""1\12\23""3\3\30""1\1\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3\23" - "3\3\23""3\3\27""1\12\24""4\5\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6" - "\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\31""9\13\32""8\2\31""9\13\32""8\2\31""9\13\34:\5\34:\5\34" - ":\5\31""9\13\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77" - "\12\36B\5\32\77\12\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33" - "A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\33" - "A\14\33A\14\36B\5\33A\14\202\320q\202\320q\33A\14\36B\5\33A\14\0\0""0" - "Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2" - "Z\15""0Y\24""2Z\15""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15-\\\16""3[\16-\\" - "\16/^\20/^\20/^\20""3[\16/^\20""3[\16/^\20""3[\16""0_\21""0_\21""0_\21" - "0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24" - "3b\24""3b\24""5d\26""5d\26""5d\26""5d\26""7e\17""5d\26""7e\17""9g\21" - "4j\23""4j\23""4j\23""9g\21""5k\24""9g\21""5k\24""4j\23""4j\23""5k\24" - "4j\23""5k\24""9g\21""5k\24""9g\21""5k\24""6l\25""9g\21""6l\25""9g\21" - "5k\24""9g\21""6l\25""9g\21""5k\24""5k\24""9g\21""5k\24""5k\24""9g\21" - "9g\21""5k\24""6l\25\202\320q\202\320q5k\24""6l\25""9g\21\0\0\23""3\3" - "\23""3\3\27""1\12\23""3\3\30""1\1\30""1\1\27""1\12\23""3\3\23""3\3\30" - "1\1\23""3\3\24""4\5\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25" - "5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32" - "8\2\31""9\13\31""9\13\31""9\13\32""8\2\34:\5\34:\5\31""9\13\34:\5\34" - ":\5\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\36B\5\32" - "\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5\36" - "B\5\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\33A\14\33A\14\33A" - "\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14" - "\36B\5\33A\14\202\320q\202\320q\33A\14\36B\5\33A\14\0\0""2Z\15""0Y\24" - "0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24" - "2Z\15""0Y\24""0Y\24-\\\16""3[\16-\\\16""0Y\24/^\20""3[\16/^\20/^\20/" - "^\20/^\20""3[\16/^\20/^\20""0_\21""0_\21""3[\16""0_\21""0_\21""0_\21" - "2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26" - "5d\26""7e\17""7e\17""7e\17""5d\26""9g\21""9g\21""9g\21""4j\23""5k\24" - "9g\21""5k\24""5k\24""9g\21""5k\24""9g\21""4j\23""6l\25""5k\24""9g\21" - "5k\24""9g\21""6l\25""5k\24""5k\24""9g\21""5k\24""9g\21""5k\24""6l\25" - "9g\21""6l\25""9g\21""6l\25""6l\25""9g\21""5k\24""6l\25""9g\21""6l\25" - "6l\25\202\320q\202\320q9g\21""6l\25""5k\24\0\0\23""3\3\30""1\1\27""1" - "\12\23""3\3\30""1\1\27""1\12\23""3\3\23""3\3\24""4\5\24""4\5\24""4\5" - "\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\31" - "9\13\31""9\13\34:\5\27""8\11\34:\5\27""8\11\34:\5\27=\7\27=\7\27=\7\27" - "=\7\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5" - "\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36" - "B\5\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14" - "\36B\5\36B\5\202\320q\202\320q\33A\14\33A\14\36B\5\0\0""2Z\15""0Y\24" - "0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""2Z\15""0Y\24" - "-\\\16""3[\16-\\\16-\\\16-\\\16-\\\16""3[\16""3[\16/^\20""3[\16/^\20" - "/^\20""3[\16/^\20""3[\16""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""2" - "a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5" - "d\26""7e\17""7e\17""5d\26""7e\17""9g\21""7f\30""4j\23""9g\21""4j\23""4" - "j\23""5k\24""9g\21""9g\21""5k\24""9g\21""4j\23""9g\21""5k\24""9g\21""5" - "k\24""6l\25""9g\21""6l\25""5k\24""9g\21""5k\24""5k\24""9g\21""6l\25""6" - "l\25""5k\24""5k\24""6l\25@m\30""6l\25""6l\25""6l\25""6l\25@m\30""6l\25" - "6l\25\202\320q\202\320q9g\21""9g\21""5k\24\0\0\23""3\3\23""3\3\27""1" - "\12\23""3\3\30""1\1\24""4\5\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6\25" - "5\6\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\31""9\13\31""9\13\32" - "8\2\34:\5\34:\5\31""9\13\34:\5\34:\5\27=\7\27=\7\27=\7\30>\10\30>\10" - "\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\33A\14\33A\14\33A\14" - "\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33" - "A\14\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\33A\14\33A\14\36B\5\36B\5" - "\33A\14\202\320q\202\320q\33A\14\33A\14\36B\5\0\0""0Y\24""0Y\24""0Y\24" - "0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15-\\\16-\\\16""3[\16""3[\16""3" - "[\16-\\\16-\\\16/^\20/^\20""3[\16/^\20""3[\16/^\20""3[\16/^\20/^\20/" - "^\20""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2" - "a\23""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""5d\26""7e\17""7e\17""7" - "e\17""9g\21""7f\30""4j\23""9g\21""4j\23""9g\21""9g\21""4j\23""4j\23""9" - "g\21""4j\23""9g\21""9g\21""6l\25""5k\24""5k\24""5k\24""9g\21""6l\25""9" - "g\21""5k\24""5k\24""5k\24""5k\24""5k\24""9g\21""6l\25""9g\21""6l\25""9" - "g\21""6l\25""6l\25@m\30""6l\25""6l\25""6l\25""6l\25@m\30""6l\25\202\320" - "q\202\320q9g\21""5k\24""5k\24\0\0\23""3\3\24""4\5\24""4\5\24""4\5\24" - "4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6\25" - "5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\32""8\2\31""9\13\31""9\13\32""8\2\31""9\13\34:\5\34:\5" - "\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32" - "\77\12\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\33" - "A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5\36B\5" - "\33A\14\36B\5\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\202\320q" - "\202\320q\36B\5\33A\14\36B\5\0\0""0Y\24""2Z\15""2Z\15""0Y\24""2Z\15""2" - "Z\15""0Y\24""0Y\24-\\\16""3[\16-\\\16""3[\16""0Y\24-\\\16""3[\16/^\20" - "/^\20/^\20""3[\16/^\20/^\20/^\20""3[\16""0_\21""3[\16""0_\21""0_\21""0" - "_\21""3[\16""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3" - "b\24""3b\24""5d\26""7e\17""5d\26""5d\26""5d\26""7e\17""9g\21""9g\21""5" - "k\24""9g\21""5k\24""9g\21""4j\23""9g\21""5k\24""9g\21""4j\23""9g\21""6" - "l\25""9g\21""5k\24""9g\21""5k\24""6l\25""6l\25""9g\21""9g\21""6l\25""9" - "g\21""5k\24""9g\21""5k\24""6l\25""6l\25""6l\25@m\30@m\30""6l\25@m\30" - "6l\25""6l\25""6l\25""6l\25""6l\25""6l\25""6l\25\202\320q\202\320q@m\30" - "6l\25""5k\24\0\0\24""4\5\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5" - "\6\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\31" - "9\13\32""8\2\31""9\13\32""8\2\34:\5\34:\5\34:\5\31""9\13\27=\7\27=\7" - "\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\36B\5\32\77\12\32\77\12" - "\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\33A\14\33A" - "\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14" - "\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\36B\5\33A\14" - "\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\202\320q\202\320q\36B\5\36B" - "\5\33A\14\0\0""2Z\15""0Y\24""2Z\15""0Y\24-\\\16""3[\16-\\\16-\\\16""3" - "[\16-\\\16""0Y\24-\\\16/^\20/^\20/^\20""3[\16/^\20""3[\16/^\20""3[\16" - "/^\20""0_\21""0_\21""3[\16""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23" - "2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""7e\17" - "5d\26""5d\26""7e\17""7e\17""7f\30""9g\21""4j\23""9g\21""5k\24""9g\21" - "5k\24""4j\23""4j\23""9g\21""4j\23""5k\24""9g\21""5k\24""9g\21""5k\24" - "9g\21""5k\24""6l\25""9g\21""6l\25""6l\25""9g\21""9g\21""6l\25@m\30""6" - "l\25""6l\25""6l\25@m\30""6l\25@m\30@m\30""6l\25""6l\25""6l\25""6l\25" - "6l\25@m\30""6l\25""6l\25\202\320q\202\320q6l\25""6l\25""9g\21\0\0\24" - "4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6\25" - "5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\32""8\2\31""9\13\31""9\13\31""9\13\32""8\2\34:\5\34:\5" - "\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32" - "\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33" - "A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5\33A\14\33A\14\36B" - "\5\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\36" - "B\5\33A\14\202\320q\202\320q\33A\14\36B\5\33A\14\0\0""3[\16""0Y\24""3" - "[\16-\\\16-\\\16-\\\16-\\\16-\\\16""0Y\24-\\\16/^\20/^\20/^\20""3[\16" - "/^\20/^\20""3[\16/^\20/^\20""0_\21""0_\21""0_\21""0_\21""0_\21""3[\16" - "0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24" - "3b\24""5d\26""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""9g\21""7f\30" - "4j\23""5k\24""9g\21""4j\23""9g\21""5k\24""4j\23""9g\21""4j\23""9g\21" - "5k\24""6l\25""5k\24""9g\21""6l\25""9g\21""5k\24""6l\25""9g\21""5k\24" - "6l\25""9g\21@m\30@m\30""6l\25""6l\25""6l\25@m\30""6l\25""6l\25""6l\25" - "@m\30""6l\25""6l\25@m\30""6l\25""6l\25""6l\25@m\30""6l\25\202\320q\202" - "\320q6l\25""5k\24""9g\21\0\0\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6" - "\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\31" - "9\13\32""8\2\31""9\13\34:\5\34:\5\27""8\11\34:\5\27=\7\27=\7\27=\7\27" - "=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\33A\14\33A" - "\14\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5" - "\36B\5\36B\5\36B\5\36B\5\33A\14\33A\14\36B\5\36B\5\33A\14\33A\14\36B" - "\5\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\202\320q\202\320" - "q\33A\14\33A\14\33A\14\0\0""0Y\24-\\\16""3[\16-\\\16-\\\16-\\\16-\\\16" - "/^\20""3[\16/^\20""3[\16/^\20""3[\16/^\20/^\20""0Y\24/^\20/^\20""0_\21" - "0_\21""0_\21""0_\21""3[\16""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23" - "2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17""5d\26""5d\26" - "7e\17""5d\26""9g\21""9g\21""9g\21""9g\21""5k\24""5k\24""9g\21""5k\24" - "9g\21""4j\23""9g\21""5k\24""5k\24""9g\21""5k\24""9g\21""5k\24""9g\21" - "6l\25""9g\21""9g\21""6l\25""6l\25""9g\21""6l\25""6l\25@m\30""6l\25""6" - "l\25@m\30""6l\25@m\30""6l\25""6l\25""6l\25""6l\25""6l\25""6l\25@m\30" - "6l\25""6l\25""6l\25@m\30""6l\25\202\320q\202\320q6l\25""9g\21""5k\24" - "\0\0\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\31""9\13\32""8\2\32""8\2\31""9\13\32""8\2\27""8\11\34:" - "\5\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14" - "\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\33" - "A\14\36B\5\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5" - "\36B\5\36B\5\33A\14\36B\5\33A\14\202\320q\202\320q\36B\5\33A\14\33A\14" - "\0\0-\\\16-\\\16""3[\16-\\\16""3[\16/^\20/^\20""3[\16/^\20""3[\16/^\20" - "/^\20""3[\16/^\20/^\20""3[\16""0_\21""0_\21""0_\21""0_\21""3[\16""0_" - "\21""0_\21""3[\16""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3" - "b\24""3b\24""5d\26""5d\26""7e\17""5d\26""5d\26""7e\17""7f\30""7f\30""9" - "g\21""5k\24""9g\21""4j\23""9g\21""4j\23""9g\21""4j\23""9g\21""9g\21""6" - "l\25""9g\21""9g\21""6l\25""5k\24""9g\21""9g\21""9g\21""5k\24""9g\21""5" - "k\24""6l\25@m\30""6l\25@m\30""6l\25""6l\25""6l\25""6l\25@m\30""6l\25" - "@m\30""6l\25@m\30""6l\25@m\30""6l\25""6l\25@m\30""6l\25@m\30""6l\25""6" - "l\25""6l\25\202\320q\202\320q5k\24""9g\21""5k\24\0\0\25""5\6\25""5\6" - "\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\31""9\13\32" - "8\2\31""9\13\27""8\11\31""9\13\34:\5\34:\5\31""9\13\34:\5\27=\7\27=\7" - "\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\33A\14\36B\5\33" - "A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A" - "\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\36" - "B\5\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36" - "B\5\202\320q\202\320q\36B\5\33A\14\33A\14\0\0""3[\16-\\\16-\\\16""3[" - "\16/^\20/^\20/^\20/^\20/^\20/^\20""3[\16/^\20""3[\16/^\20""0_\21""0_" - "\21""0_\21""0_\21""0_\21""3[\16""0_\21""0_\21""0_\21""2a\23""2a\23""2" - "a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""7" - "e\17""5d\26""7e\17""7e\17""9g\21""4j\23""9g\21""4j\23""4j\23""5k\24""4" - "j\23""9g\21""5k\24""9g\21""4j\23""9g\21""6l\25""5k\24""5k\24""5k\24""6" - "l\25""9g\21""6l\25""9g\21""5k\24""9g\21""6l\25""6l\25""6l\25""6l\25@" - "m\30""6l\25@m\30""6l\25@m\30""6l\25""6l\25@m\30""6l\25""6l\25""6l\25" - "6l\25@m\30""6l\25""6l\25""6l\25@m\30""6l\25""6l\25@m\30\202\320q\202" - "\320q5k\24""5k\24""5k\24\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\32""8\2\31""9\13\32""8\2\32""8\2\32""8\2\31""9\13\34:\5" - "\34:\5\34:\5\27""8\11\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32" - "\77\12\32\77\12\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14" - "\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5\36" - "B\5\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5" - "\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\202\320q\202\320q\36B\5" - "\33A\14\36B\5\0\0/^\20/^\20""3[\16/^\20/^\20""3[\16/^\20/^\20/^\20/^" - "\20/^\20/^\20""3[\16""0_\21""0_\21""3[\16""0_\21""3[\16""0_\21""3[\16" - "0_\21""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24" - "3b\24""5d\26""5d\26""5d\26""5d\26""5d\26""7e\17""7f\30""9g\21""9g\21" - "9g\21""5k\24""9g\21""4j\23""4j\23""9g\21""9g\21""5k\24""9g\21""6l\25" - "9g\21""9g\21""5k\24""6l\25""9g\21""6l\25""9g\21""6l\25""9g\21@m\30""6" - "l\25@m\30""6l\25""6l\25""6l\25@m\30@m\30""6l\25""6l\25""6l\25@m\30""6" - "l\25@m\30""6l\25""6l\25@m\30""6l\25""6l\25""6l\25@m\30@m\30""6l\25@m" - "\30""6l\25""5k\24\202\320q\202\320q5k\24""9g\21""5k\24\0\0\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\32""8\2\31""9\13\32""8\2\31""9\13\32""8\2\34:" - "\5\31""9\13\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36" - "B\5\32\77\12\32\77\12\36B\5\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5" - "\33A\14\33A\14\33A\14\36B\5\36B\5\36B\5\33A\14\36B\5\36B\5\33A\14\36" - "B\5\36B\5\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\36" - "B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\33A\14\36B\5\202\320" - "q\202\320q\36B\5\33A\14\33A\14\0\0/^\20/^\20""3[\16""3[\16/^\20""3[\16" - "/^\20/^\20/^\20/^\20""0Y\24/^\20""0_\21""0_\21""0_\21""0_\21""0_\21""3" - "[\16""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3" - "b\24""3b\24""5d\26""5d\26""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""9" - "g\21""9g\21""9g\21""4j\23""4j\23""9g\21""4j\23""4j\23""9g\21""5k\24""5" - "k\24""9g\21""6l\25""9g\21""6l\25""9g\21""5k\24""9g\21""9g\21""5k\24""6" - "l\25""6l\25""6l\25@m\30""6l\25@m\30""6l\25@m\30@m\30""6l\25""6l\25@m" - "\30@m\30""6l\25@m\30""6l\25@m\30""6l\25@m\30""6l\25@m\30""6l\25""6l\25" - "@m\30""6l\25""5k\24""9g\21""5k\24\202\320q\202\320q5k\24""9g\21""5k\24" - "\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\32""8\2\32""8\2\32""8\2\32""8\2\32""8" - "\2\34:\5\31""9\13\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\30>\10\30>\10\30" - ">\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5" - "\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14" - "\36B\5\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\36B\5\33A\14" - "\36B\5\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\36B" - "\5\33A\14\202\320q\202\320q\33A\14\33A\14\33A\14\0\0/^\20/^\20""3[\16" - "/^\20""3[\16/^\20/^\20""3[\16/^\20""3[\16""0_\21""0_\21""0_\21""3[\16" - "0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a\23""2a\23" - "3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""5d\26""5d\26""7e\17" - "5d\26""9g\21""9g\21""5k\24""4j\23""9g\21""5k\24""9g\21""5k\24""9g\21" - "4j\23""9g\21""6l\25""5k\24""5k\24""5k\24""6l\25""5k\24""5k\24""9g\21" - "9g\21""9g\21""9g\21""6l\25""6l\25@m\30@m\30""6l\25""6l\25@m\30""6l\25" - "6l\25@m\30""6l\25@m\30""6l\25@m\30""6l\25@m\30""6l\25@m\30""6l\25""6" - "l\25@m\30""6l\25@m\30@m\30""6l\25""6l\25""5k\24""9g\21\202\320q\202\320" - "q9g\21""5k\24""9g\21\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\31""9\13\31" - "9\13\32""8\2\32""8\2\34:\5\34:\5\34:\5\34:\5\27""8\11\27=\7\27=\7\27" - "=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32" - "\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\33A\14\36B\5\33A\14" - "\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\36" - "B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\36" - "B\5\36B\5\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36" - "B\5\33A\14\33A\14\36B\5\33A\14\202\320q\202\320q\33A\14\36B\5\33A\14" - "\0\0/^\20/^\20/^\20/^\20/^\20""3[\16/^\20""3[\16""0_\21""0_\21""0_\21" - "0_\21""3[\16""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23" - "2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""7e\17" - "5d\26""5d\26""7e\17""9g\21""5k\24""4j\23""4j\23""5k\24""9g\21""4j\23" - "5k\24""9g\21""9g\21""6l\25""9g\21""6l\25""6l\25""9g\21""5k\24""9g\21" - "6l\25""5k\24""9g\21""5k\24@m\30""6l\25@m\30""6l\25""6l\25""6l\25""6l" - "\25@m\30""6l\25""6l\25""6l\25@m\30@m\30""6l\25""6l\25@m\30@m\30""6l\25" - "6l\25@m\30""6l\25""6l\25""6l\25@m\30""6l\25@m\30""5k\24""9g\21""6l\25" - "5k\24\202\320q\202\320q6l\25""6l\25""9g\21\0\0\27""7\10\27""7\10\27""7" - "\10\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\31" - "9\13\32""8\2\31""9\13\34:\5\27""8\11\34:\5\31""9\13\34:\5\27=\7\27=\7" - "\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\36B\5\32\77\12\36" - "B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\33A\14" - "\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5\33" - "A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5" - "\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\36B\5\33A\14\33A\14\36B" - "\5\36B\5\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\202\320q\202\320q\33" - "A\14\33A\14\36B\5\0\0/^\20/^\20""3[\16/^\20/^\20/^\20""0_\21""0_\21""0" - "_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2" - "a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""5" - "d\26""7e\17""5d\26""7e\17""5d\26""9g\21""9g\21""5k\24""9g\21""5k\24""4" - "j\23""9g\21""4j\23""4j\23""5k\24""9g\21""5k\24""9g\21""5k\24""6l\25""6" - "l\25""5k\24""6l\25""5k\24""9g\21""5k\24@m\30""6l\25""6l\25""6l\25""6" - "l\25@m\30""6l\25""6l\25@m\30""6l\25""6l\25@m\30""6l\25@m\30""6l\25@m" - "\30""6l\25@m\30@m\30""6l\25""6l\25""6l\25""6l\25@m\30""6l\25""9g\21""6" - "l\25""9g\21""5k\24""9g\21""5k\24\202\320q\202\320q5k\24""9g\21""4j\23" - "\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32" - "8\2\31""9\13\31""9\13\32""8\2\31""9\13\34:\5\34:\5\31""9\13\31""9\13" - "\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77" - "\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36" - "B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5" - "\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\36B" - "\5\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\33A" - "\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14" - "\202\320q\202\320q\36B\5\32\77\12\32\77\12\0\0/^\20/^\20/^\20/^\20""0" - "_\21""3[\16""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""2" - "a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3" - "b\24""7e\17""5d\26""5d\26""7e\17""5d\26""7e\17""7f\30""9g\21""4j\23""9" - "g\21""4j\23""4j\23""4j\23""9g\21""4j\23""5k\24""5k\24""5k\24""9g\21""9" - "g\21""5k\24""6l\25""9g\21""6l\25""9g\21""5k\24""9g\21@m\30""6l\25""6" - "l\25@m\30""6l\25""6l\25@m\30@m\30""6l\25""6l\25@m\30@m\30@m\30""6l\25" - "6l\25""6l\25@m\30@m\30""6l\25""6l\25@m\30""6l\25@m\30""6l\25""6l\25""6" - "l\25""9g\21""6l\25""9g\21""5k\24""9g\21""9g\21""9g\21\202\320q\202\320" - "q5k\24""9g\21""5k\24\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\32""8\2\32""8\2\32""8\2\32""8\2\31""9\13\31""9\13\31""9\13\34:\5" - "\34:\5\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77" - "\12\36B\5\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14" - "\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\36B\5\36B\5\36B" - "\5\33A\14\36B\5\36B\5\36B\5\36B\5\33A\14\33A\14\36B\5\36B\5\33A\14\36" - "B\5\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5" - "\33A\14\33A\14\33A\14\202\320q\202\320q\36B\5\32\77\12\32\77\12\0\0/" - "^\20/^\20""0_\21""3[\16""0_\21""0_\21""0_\21""3[\16""0_\21""3[\16""0" - "_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3" - "b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""7e\17""7e\17""5d\26""9" - "g\21""7f\30""5k\24""9g\21""4j\23""9g\21""5k\24""4j\23""5k\24""5k\24""4" - "j\23""6l\25""9g\21""9g\21""6l\25""9g\21""6l\25""9g\21""5k\24""9g\21""5" - "k\24""9g\21""6l\25""6l\25@m\30@m\30""6l\25""6l\25""6l\25@m\30@m\30""6" - "l\25""6l\25""6l\25@m\30@m\30""6l\25""6l\25""6l\25@m\30""6l\25@m\30""6" - "l\25@m\30""6l\25@m\30""6l\25""6l\25""9g\21""5k\24""6l\25""5k\24""9g\21" - "5k\24""9g\21\202\320q\202\320q4j\23""4j\23""5k\24\0\0\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\32""8\2\31""9\13\32""8\2\32""8\2\32""8\2\31""9" - "\13\34:\5\31""9\13\34:\5\34:\5\27""8\11\27=\7\27=\7\27=\7\30>\10\30>" - "\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\36" - "B\5\32\77\12\32\77\12\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33" - "A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5\36B\5\36B\5" - "\33A\14\36B\5\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14" - "\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\36B\5\33A\14\33A\14\33A" - "\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\202\320q\202\320q\32\77\12" - "\36B\5\32\77\12\0\0""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21" - "3[\16""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a\23" - "3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""5d\26""7e\17" - "5d\26""7e\17""7f\30""9g\21""9g\21""4j\23""4j\23""5k\24""9g\21""5k\24" - "9g\21""4j\23""4j\23""6l\25""5k\24""9g\21""5k\24""5k\24""6l\25""9g\21" - "9g\21""5k\24""9g\21""5k\24""6l\25@m\30""6l\25@m\30@m\30""6l\25""6l\25" - "@m\30""6l\25@m\30""6l\25""6l\25""6l\25@m\30""6l\25@m\30""6l\25""6l\25" - "6l\25""6l\25""6l\25@m\30@m\30""6l\25@m\30""5k\24""6l\25""9g\21""9g\21" - "6l\25""9g\21""6l\25""5k\24""5k\24\202\320q\202\320q5k\24""4j\23""4j\23" - "\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\32""8\2\31""9\13\32" - "8\2\32""8\2\31""9\13\34:\5\27""8\11\34:\5\27""8\11\27=\7\27=\7\27=\7" - "\27=\7\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77" - "\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\33A\14\36B\5\33A\14\33A\14" - "\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\36B\5\36" - "B\5\36B\5\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\36" - "B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\36B\5\33A\14" - "\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\202" - "\320q\202\320q\32\77\12\32\77\12\36B\5\0\0""0_\21""0_\21""0_\21""0_\21" - "0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23" - "2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26" - "5d\26""7e\17""5d\26""9g\21""7f\30""4j\23""5k\24""9g\21""5k\24""4j\23" - "9g\21""4j\23""9g\21""4j\23""5k\24""5k\24""9g\21""5k\24""9g\21""5k\24" - "9g\21""5k\24""6l\25""9g\21""5k\24@m\30""6l\25@m\30""6l\25@m\30""6l\25" - "@m\30""6l\25@m\30""6l\25@m\30""6l\25@m\30""6l\25""6l\25""6l\25@m\30""6" - "l\25""6l\25""6l\25""6l\25""6l\25@m\30""6l\25@m\30""5k\24""9g\21""9g\21" - "5k\24""6l\25""9g\21""5k\24""9g\21""5k\24""9g\21""4j\23\202\320q\202\320" - "q9g\21""9g\21""4j\23\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\31""9\13\32""8" - "\2\32""8\2\32""8\2\31""9\13\34:\5\34:\5\34:\5\34:\5\34:\5\27=\7\27=\7" - "\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\36B\5\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\36B\5\33A\14\33A\14" - "\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\33" - "A\14\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\36B\5\36" - "B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14" - "\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\32" - "\77\12\36B\5\202\320q\202\320q\32\77\12\32\77\12\32\77\12\0\0""3[\16" - "0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23" - "2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26" - "5d\26""7e\17""5d\26""7e\17""5d\26""7e\17""9g\21""9g\21""4j\23""9g\21" - "5k\24""9g\21""4j\23""9g\21""4j\23""5k\24""9g\21""6l\25""6l\25""9g\21" - "5k\24""9g\21""6l\25""9g\21""5k\24""5k\24""9g\21""5k\24@m\30""6l\25""6" - "l\25""6l\25""6l\25""6l\25@m\30""6l\25""6l\25@m\30""6l\25@m\30""6l\25" - "@m\30""6l\25@m\30""6l\25""6l\25""6l\25@m\30""6l\25""6l\25@m\30""6l\25" - "5k\24""9g\21""9g\21""6l\25""5k\24""5k\24""6l\25""5k\24""9g\21""4j\23" - "4j\23""5k\24\202\320q\202\320q9g\21""9g\21""7f\30\0\0\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31" - "9\13\32""8\2\32""8\2\32""8\2\31""9\13\32""8\2\34:\5\31""9\13\34:\5\31" - "9\13\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5" - "\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36" - "B\5\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14" - "\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33" - "A\14\36B\5\33A\14\32\77\12\32\77\12\32\77\12\32\77\12\202\320q\202\320" - "q\32\77\12\32\77\12\30>\10\0\0""0_\21""0_\21""3[\16""0_\21""0_\21""0" - "_\21""0_\21""3[\16""2a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3" - "b\24""3b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""7" - "e\17""9g\21""9g\21""9g\21""4j\23""9g\21""4j\23""9g\21""9g\21""4j\23""9" - "g\21""4j\23""6l\25""5k\24""9g\21""5k\24""9g\21""5k\24""9g\21""6l\25""9" - "g\21""5k\24""6l\25@m\30""6l\25""6l\25""6l\25""6l\25""6l\25""6l\25""6" - "l\25""6l\25@m\30""6l\25@m\30""6l\25@m\30""6l\25""6l\25""6l\25""6l\25" - "@m\30""6l\25@m\30""6l\25""9g\21""5k\24""9g\21""9g\21""6l\25""5k\24""6" - "l\25""9g\21""6l\25""5k\24""9g\21""4j\23""9g\21""5k\24""4j\23\202\320" - "q\202\320q9g\21""5d\26""7e\17\0\0\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\31""9\13\32""8\2\32""8\2" - "\31""9\13\32""8\2\34:\5\34:\5\31""9\13\34:\5\34:\5\27=\7\27=\7\27=\7" - "\27=\7\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77" - "\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\33A\14\36B\5\33A\14\33" - "A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B" - "\5\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\36B\5\36B\5\33A\14" - "\36B\5\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\36B\5\33A\14\33A\14" - "\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\32\77\12" - "\36B\5\32\77\12\32\77\12\36B\5\202\320q\202\320q\35;\6\30>\10\27=\7\0" - "\0""3[\16""0_\21""0_\21""0_\21""3[\16""0_\21""0_\21""2a\23""2a\23""2" - "a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5" - "d\26""5d\26""7e\17""7e\17""7e\17""5d\26""9g\21""9g\21""9g\21""9g\21""4" - "j\23""4j\23""4j\23""5k\24""9g\21""9g\21""5k\24""9g\21""9g\21""5k\24""9" - "g\21""9g\21""5k\24""9g\21""9g\21""5k\24""5k\24@m\30""6l\25@m\30@m\30" - "6l\25""6l\25""6l\25""6l\25""6l\25""6l\25@m\30""6l\25""6l\25""6l\25@m" - "\30""6l\25@m\30""6l\25@m\30@m\30""6l\25""6l\25""9g\21""9g\21""5k\24""5" - "k\24""9g\21""5k\24""6l\25""9g\21""5k\24""9g\21""5k\24""4j\23""9g\21""5" - "k\24""9g\21""5k\24""4j\23\202\320q\202\320q7e\17""5d\26""7e\17\0\0\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\31" - "9\13\32""8\2\31""9\13\32""8\2\31""9\13\34:\5\34:\5\34:\5\34:\5\27""8" - "\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\36B\5\33A\14\33" - "A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\36" - "B\5\36B\5\36B\5\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33" - "A\14\33A\14\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\36B\5\36B\5\33A\14\33" - "A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\202\320q\202\320" - "q\27=\7\27=\7\27=\7\0\0""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2" - "a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3" - "b\24""3b\24""7e\17""5d\26""5d\26""7e\17""5d\26""7e\17""7f\30""9g\21""5" - "k\24""4j\23""9g\21""5k\24""4j\23""9g\21""5k\24""5k\24""4j\23""9g\21""5" - "k\24""9g\21""6l\25""5k\24""9g\21""9g\21""5k\24""9g\21""6l\25""5k\24@" - "m\30@m\30""6l\25@m\30""6l\25""6l\25""6l\25@m\30""6l\25""6l\25""6l\25" - "6l\25""6l\25@m\30""6l\25""6l\25@m\30@m\30@m\30""6l\25""5k\24""9g\21""9" - "g\21""5k\24""5k\24""6l\25""9g\21""5k\24""5k\24""6l\25""4j\23""9g\21""4" - "j\23""9g\21""4j\23""9g\21""9g\21""9g\21""9g\21\202\320q\202\320q7e\17" - "5d\26""3b\24\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2" - "\31""9\13\32""8\2\32""8\2\31""9\13\31""9\13\32""8\2\34:\5\34:\5\31""9" - "\13\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32" - "\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5" - "\32\77\12\32\77\12\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33" - "A\14\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\36B\5\33A\14\33A\14\36B\5" - "\36B\5\36B\5\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\36B\5\36B\5\36B" - "\5\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\33A\14\36B\5" - "\33A\14\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\30>\10\202\320q\202\320q\27=\7\34:\5\31""9\13\0\0""3[\16" - "0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a\23""2a\23" - "3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""5d\26""5d\26" - "5d\26""7e\17""7f\30""7f\30""4j\23""4j\23""4j\23""9g\21""4j\23""5k\24" - "9g\21""5k\24""4j\23""6l\25""9g\21""6l\25""9g\21""6l\25""9g\21""5k\24" - "9g\21""5k\24""9g\21""5k\24""9g\21@m\30""6l\25@m\30""6l\25""6l\25""6l" - "\25@m\30@m\30""6l\25""6l\25""6l\25""6l\25@m\30@m\30""6l\25@m\30""6l\25" - "9g\21""6l\25""9g\21""9g\21""5k\24""9g\21""5k\24""6l\25""9g\21""5k\24" - "5k\24""9g\21""4j\23""9g\21""5k\24""5k\24""9g\21""9g\21""9g\21""9g\21" - "5d\26""7e\17\202\320q\202\320q3b\24""3b\24""3b\24\0\0\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\32""8\2\31""9\13\32""8\2\32""8\2\32""8" - "\2\31""9\13\34:\5\31""9\13\31""9\13\27""8\11\34:\5\27=\7\27=\7\27=\7" - "\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12" - "\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\33A\14\36B" - "\5\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5" - "\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\33A\14\36B" - "\5\36B\5\36B\5\33A\14\36B\5\36B\5\36B\5\33A\14\33A\14\33A\14\33A\14\33" - "A\14\36B\5\33A\14\33A\14\36B\5\33A\14\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\27=\7\202\320q" - "\202\320q\27""8\11\34:\5\31""9\13\0\0""3[\16""0_\21""0_\21""0_\21""2" - "a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3" - "b\24""5d\26""7e\17""5d\26""5d\26""5d\26""7e\17""5d\26""7f\30""9g\21""9" - "g\21""9g\21""4j\23""9g\21""5k\24""9g\21""4j\23""9g\21""4j\23""9g\21""5" - "k\24""5k\24""6l\25""5k\24""9g\21""9g\21""6l\25""6l\25""9g\21""5k\24""6" - "l\25""5k\24@m\30""6l\25@m\30""6l\25""6l\25""6l\25@m\30""6l\25@m\30""6" - "l\25""6l\25@m\30""6l\25@m\30""6l\25""6l\25""9g\21""6l\25""9g\21""5k\24" - "9g\21""9g\21""5k\24""6l\25""9g\21""5k\24""9g\21""4j\23""9g\21""5k\24" - "4j\23""4j\23""9g\21""5k\24""9g\21""7e\17""5d\26""5d\26""5d\26\202\320" - "q\202\320q3b\24""2a\23""2a\23\0\0\27""7\10\27""7\10\27""7\10\32""8\2" - "\31""9\13\31""9\13\32""8\2\32""8\2\31""9\13\31""9\13\34:\5\34:\5\27""8" - "\11\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\32\77\12\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\33A\14\33" - "A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\36B\5\33A\14\36B\5\33" - "A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5" - "\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14" - "\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\30>\10" - "\30>\10\27=\7\27=\7\27=\7\202\320q\202\320q\32""8\2\31""9\13\31""9\13" - "\0\0""3[\16""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a\23""2a\23""2" - "a\23""3b\24""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""7e\17""5d\26""5" - "d\26""5d\26""7e\17""7f\30""9g\21""4j\23""9g\21""5k\24""9g\21""5k\24""9" - "g\21""5k\24""9g\21""9g\21""5k\24""6l\25""5k\24""9g\21""5k\24""6l\25""9" - "g\21""5k\24""6l\25""5k\24""5k\24""9g\21""5k\24@m\30@m\30""6l\25""6l\25" - "@m\30""6l\25""6l\25""6l\25@m\30""6l\25@m\30""6l\25""6l\25@m\30""5k\24" - "6l\25""9g\21""9g\21""6l\25""9g\21""5k\24""9g\21""5k\24""5k\24""5k\24" - "9g\21""5k\24""4j\23""9g\21""4j\23""4j\23""9g\21""9g\21""7e\17""5d\26" - "7e\17""5d\26""5d\26""3b\24\202\320q\202\320q2a\23""2a\23""0_\21\0\0\27" - "7\10\27""7\10\27""7\10\31""9\13\32""8\2\31""9\13\32""8\2\32""8\2\31""9" - "\13\34:\5\34:\5\27""8\11\34:\5\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7" - "\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\33A\14\36B\5\33A" - "\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14" - "\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B" - "\5\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14" - "\36B\5\33A\14\33A\14\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5" - "\32\77\12\32\77\12\32\77\12\30>\10\27=\7\27=\7\27=\7\34:\5\27""8\11\202" - "\320q\202\320q\31""9\13\27""7\10\27""7\10\0\0""0_\21""0_\21""2a\23""2" - "a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3" - "b\24""5d\26""5d\26""5d\26""7e\17""7e\17""5d\26""7e\17""7f\30""9g\21""9" - "g\21""5k\24""4j\23""5k\24""9g\21""4j\23""9g\21""5k\24""9g\21""6l\25""9" - "g\21""5k\24""5k\24""9g\21""5k\24""5k\24""9g\21""6l\25""9g\21""6l\25""5" - "k\24""6l\25""9g\21""6l\25""6l\25""6l\25""6l\25""6l\25""6l\25@m\30""6" - "l\25""6l\25@m\30""6l\25@m\30""5k\24""9g\21""5k\24""6l\25""9g\21""6l\25" - "9g\21""6l\25""6l\25""5k\24""9g\21""9g\21""4j\23""9g\21""5k\24""9g\21" - "4j\23""4j\23""9g\21""9g\21""7e\17""7e\17""7e\17""5d\26""3b\24""3b\24" - "3b\24\202\320q\202\320q0_\21""0_\21""0_\21\0\0\27""7\10\27""7\10\32""8" - "\2\32""8\2\31""9\13\32""8\2\31""9\13\31""9\13\34:\5\34:\5\27""8\11\34" - ":\5\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12" - "\32\77\12\32\77\12\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36" - "B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14" - "\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\36" - "B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\32\77\12\32" - "\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\30>\10\30>\10" - "\27=\7\27=\7\34:\5\34:\5\31""9\13\32""8\2\202\320q\202\320q\27""7\10" - "\27""7\10\27""7\10\0\0""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2a" - "\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5" - "d\26""5d\26""5d\26""5d\26""9g\21""7f\30""4j\23""9g\21""4j\23""4j\23""9" - "g\21""9g\21""4j\23""4j\23""5k\24""6l\25""9g\21""6l\25""6l\25""9g\21""5" - "k\24""6l\25""9g\21""6l\25""5k\24""6l\25""6l\25""5k\24""5k\24""5k\24""6" - "l\25""6l\25@m\30""6l\25""6l\25""6l\25""6l\25@m\30""6l\25@m\30""5k\24" - "6l\25""9g\21""5k\24""5k\24""6l\25""5k\24""6l\25""9g\21""5k\24""6l\25" - "5k\24""9g\21""4j\23""9g\21""4j\23""5k\24""9g\21""5k\24""9g\21""5d\26" - "7e\17""5d\26""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23\202\320q\202\320" - "q0_\21""0_\21/^\20\0\0\27""7\10\32""8\2\32""8\2\31""9\13\32""8\2\32""8" - "\2\32""8\2\31""9\13\34:\5\34:\5\31""9\13\34:\5\27""8\11\27=\7\27=\7\27" - "=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\36B\5\32\77\12\36B\5" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\36B\5\33A\14\36B\5\33" - "A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\36B" - "\5\33A\14\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\36B\5\33" - "A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14" - "\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\30>\10\30>\10\27=\7\27=\7\27""8\11\34:\5\34:\5\31""9\13\32""8\2\31" - "9\13\202\320q\202\320q\27""7\10\27""7\10\27""7\10\0\0""0_\21""2a\23""2" - "a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""3" - "b\24""5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""7e\17""7f\30""9g\21""4" - "j\23""5k\24""4j\23""9g\21""4j\23""4j\23""5k\24""9g\21""4j\23""5k\24""6" - "l\25""9g\21""9g\21""6l\25""5k\24""6l\25""9g\21""5k\24""9g\21""5k\24""6" - "l\25""5k\24""9g\21""5k\24""6l\25@m\30@m\30""6l\25""6l\25@m\30@m\30""6" - "l\25""9g\21""5k\24""9g\21""5k\24""9g\21""6l\25""9g\21""6l\25""5k\24""9" - "g\21""5k\24""9g\21""4j\23""5k\24""9g\21""5k\24""9g\21""4j\23""4j\23""7" - "f\30""7e\17""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""2a\23""2a\23""2" - "a\23""0_\21\202\320q\202\320q/^\20""3[\16/^\20\0\0\27""7\10\32""8\2\31" - "9\13\32""8\2\31""9\13\31""9\13\32""8\2\34:\5\34:\5\31""9\13\27""8\11" - "\34:\5\27=\7\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12" - "\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36" - "B\5\32\77\12\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33" - "A\14\33A\14\36B\5\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33A" - "\14\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36" - "B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\32\77\12\36B\5\32\77\12\36" - "B\5\32\77\12\36B\5\32\77\12\32\77\12\30>\10\27=\7\27=\7\27=\7\34:\5\31" - "9\13\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\202\320q\202\320q\27" - "7\10\27""7\10\25""5\6\0\0""2a\23""2a\23""2a\23""2a\23""2a\23""2a\23""2" - "a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5d\26""7" - "e\17""7e\17""7e\17""7f\30""9g\21""9g\21""5k\24""4j\23""4j\23""9g\21""5" - "k\24""5k\24""9g\21""4j\23""5k\24""9g\21""6l\25""5k\24""9g\21""9g\21""5" - "k\24""5k\24""6l\25""9g\21""5k\24""5k\24""9g\21""6l\25""9g\21""5k\24""9" - "g\21""5k\24""9g\21""6l\25""9g\21""6l\25""9g\21""6l\25""9g\21""6l\25""9" - "g\21""5k\24""5k\24""5k\24""5k\24""9g\21""5k\24""5k\24""5k\24""9g\21""5" - "k\24""4j\23""9g\21""5k\24""4j\23""9g\21""9g\21""5d\26""5d\26""7e\17""5" - "d\26""3b\24""3b\24""3b\24""2a\23""2a\23""0_\21""0_\21""3[\16\202\320" - "q\202\320q/^\20/^\20""0Y\24\0\0\32""8\2\31""9\13\32""8\2\31""9\13\32" - "8\2\31""9\13\32""8\2\31""9\13\34:\5\34:\5\27""8\11\34:\5\27=\7\27=\7" - "\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12" - "\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\33A\14\33A" - "\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5" - "\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14" - "\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\33A\14\36" - "B\5\33A\14\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\30>\10\30>\10\27=\7\27=\7\31""9\13\27""8\11\34:\5\31""9\13\32" - "8\2\27""7\10\27""7\10\27""7\10\27""7\10\202\320q\202\320q\27""7\10\25" - "5\6\25""5\6\0\0""2a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b" - "\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17""5d\26""5d\26""7" - "e\17""9g\21""7f\30""9g\21""4j\23""9g\21""4j\23""4j\23""4j\23""4j\23""9" - "g\21""5k\24""9g\21""9g\21""9g\21""6l\25""9g\21""9g\21""6l\25""9g\21""6" - "l\25""9g\21""6l\25""5k\24""6l\25""9g\21""6l\25""9g\21""6l\25""6l\25""9" - "g\21""5k\24""9g\21""5k\24""9g\21""6l\25""5k\24""9g\21""9g\21""6l\25""9" - "g\21""6l\25""6l\25""9g\21""5k\24""5k\24""9g\21""5k\24""4j\23""4j\23""4" - "j\23""9g\21""9g\21""7f\30""7e\17""5d\26""7e\17""7e\17""3b\24""3b\24""3" - "b\24""2a\23""2a\23""2a\23""0_\21""0_\21/^\20""3[\16\202\320q\202\320" - "q3[\16-\\\16""2Z\15\0\0\31""9\13\31""9\13\32""8\2\31""9\13\32""8\2\31" - "9\13\34:\5\34:\5\34:\5\34:\5\31""9\13\27=\7\27=\7\27=\7\27=\7\30>\10" - "\30>\10\30>\10\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12" - "\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\33A\14\33A\14\33A\14\33A\14" - "\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\33A\14\33A\14\36" - "B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A" - "\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\32\77\12\36" - "B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\30>\10\30>\10\27=\7\27" - "=\7\34:\5\34:\5\27""8\11\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\202\320q\202\320q\25""5\6\24""4\5\27""1\12\0\0" - "2a\23""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24" - "3b\24""5d\26""5d\26""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""9g\21" - "4j\23""5k\24""4j\23""5k\24""9g\21""4j\23""9g\21""4j\23""9g\21""5k\24" - "9g\21""9g\21""9g\21""9g\21""6l\25""6l\25""9g\21""5k\24""5k\24""5k\24" - "5k\24""9g\21""5k\24""9g\21""5k\24""9g\21""6l\25""9g\21""6l\25""9g\21" - "6l\25""9g\21""5k\24""9g\21""9g\21""5k\24""6l\25""9g\21""6l\25""5k\24" - "9g\21""9g\21""5k\24""9g\21""5k\24""4j\23""4j\23""9g\21""9g\21""5d\26" - "7e\17""5d\26""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""3[\16" - "0_\21""3[\16/^\20""3[\16/^\20\202\320q\202\320q2Z\15""0Y\24""0Y\24\0" - "\0\32""8\2\32""8\2\31""9\13\32""8\2\32""8\2\34:\5\34:\5\31""9\13\34:" - "\5\34:\5\27""8\11\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14" - "\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33" - "A\14\36B\5\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\36" - "B\5\33A\14\33A\14\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36" - "B\5\32\77\12\32\77\12\30>\10\30>\10\27=\7\27=\7\27=\7\34:\5\27""8\11" - "\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\202\320q\202\320q\24""4\5\23""3\3\23""3\3\0\0""2a" - "\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""3" - "b\24""7e\17""5d\26""5d\26""7e\17""7e\17""5d\26""9g\21""9g\21""4j\23""9" - "g\21""4j\23""9g\21""4j\23""5k\24""9g\21""5k\24""4j\23""9g\21""5k\24""5" - "k\24""9g\21""5k\24""6l\25""9g\21""6l\25""9g\21""6l\25""9g\21""5k\24""9" - "g\21""5k\24""5k\24""9g\21""5k\24""6l\25""9g\21""6l\25""6l\25""9g\21""9" - "g\21""9g\21""6l\25""5k\24""9g\21""5k\24""6l\25""9g\21""5k\24""5k\24""4" - "j\23""9g\21""9g\21""5k\24""9g\21""4j\23""9g\21""5d\26""5d\26""5d\26""5" - "d\26""5d\26""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21/" - "^\20/^\20""3[\16/^\20-\\\16\202\320q\202\320q0Y\24""2Z\15""0Y\24\0\0" - "\32""8\2\32""8\2\31""9\13\32""8\2\32""8\2\34:\5\34:\5\31""9\13\34:\5" - "\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12" - "\36B\5\32\77\12\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14" - "\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33" - "A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A" - "\14\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12" - "\32\77\12\30>\10\27=\7\27=\7\27=\7\31""9\13\34:\5\27""8\11\32""8\2\31" - "9\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\24""4\5\202\320q\202\320q\27""1\12\23""3\3\27""1\12\0\0""2a\23""2" - "a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""5" - "d\26""5d\26""5d\26""7e\17""5d\26""9g\21""9g\21""9g\21""4j\23""9g\21""4" - "j\23""5k\24""5k\24""9g\21""4j\23""4j\23""5k\24""9g\21""6l\25""9g\21""9" - "g\21""5k\24""9g\21""6l\25""5k\24""6l\25""9g\21""6l\25""6l\25""5k\24""9" - "g\21""6l\25""9g\21""5k\24""6l\25""9g\21""5k\24""5k\24""6l\25""9g\21""5" - "k\24""5k\24""9g\21""6l\25""9g\21""5k\24""9g\21""4j\23""9g\21""5k\24""9" - "g\21""9g\21""4j\23""9g\21""9g\21""7e\17""7e\17""7e\17""5d\26""3b\24""3" - "b\24""3b\24""2a\23""2a\23""0_\21""0_\21""0_\21""3[\16/^\20/^\20/^\20" - "-\\\16""0Y\24""0Y\24\202\320q\202\320q0Y\24""0Y\24""0Y\24\0\0\32""8\2" - "\31""9\13\32""8\2\32""8\2\34:\5\34:\5\31""9\13\34:\5\34:\5\27=\7\27=" - "\7\27=\7\27=\7\27=\7\30>\10\30>\10\36B\5\32\77\12\36B\5\32\77\12\32\77" - "\12\36B\5\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\33A\14\36" - "B\5\33A\14\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\36B" - "\5\33A\14\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5" - "\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\30>\10\30>\10\27=\7\27" - "=\7\31""9\13\27""8\11\34:\5\27""8\11\32""8\2\32""8\2\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\23""3\3" - "\202\320q\202\320q\30""1\1\23""3\3\27""1\12\0\0""2a\23""2a\23""2a\23" - "2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""7e\17" - "5d\26""7e\17""5d\26""9g\21""9g\21""5k\24""4j\23""4j\23""5k\24""4j\23" - "4j\23""4j\23""9g\21""5k\24""9g\21""5k\24""5k\24""9g\21""6l\25""9g\21" - "5k\24""9g\21""5k\24""9g\21""6l\25""6l\25""5k\24""5k\24""9g\21""6l\25" - "5k\24""9g\21""5k\24""9g\21""6l\25""5k\24""6l\25""9g\21""6l\25""9g\21" - "6l\25""9g\21""4j\23""4j\23""5k\24""9g\21""9g\21""9g\21""4j\23""9g\21" - "9g\21""5d\26""7e\17""5d\26""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23" - "2a\23""0_\21""0_\21""3[\16""3[\16/^\20/^\20""3[\16""0Y\24""2Z\15""2Z" - "\15""0Y\24\202\320q\202\320q0Y\24""0Y\24.W\23\0\0\32""8\2\31""9\13\32" - "8\2\32""8\2\31""9\13\34:\5\34:\5\34:\5\31""9\13\27=\7\27=\7\27=\7\27" - "=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36" - "B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\33A\14\33" - "A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5" - "\33A\14\36B\5\36B\5\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\33A\14\33" - "A\14\33A\14\33A\14\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\30>\10\30>\10\27=\7\27=\7\27""8\11\34:\5" - "\27""8\11\32""8\2\31""9\13\31""9\13\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\23""3\3\23""3" - "\3\202\320q\202\320q\30""1\1\30""1\1\25""0\10\0\0""2a\23""2a\23""2a\23" - "2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""5d\26" - "7e\17""5d\26""7e\17""9g\21""7f\30""4j\23""4j\23""9g\21""5k\24""9g\21" - "5k\24""4j\23""5k\24""9g\21""6l\25""6l\25""5k\24""9g\21""5k\24""9g\21" - "5k\24""5k\24""5k\24""5k\24""5k\24""6l\25""5k\24""9g\21""5k\24""5k\24" - "5k\24""9g\21""6l\25""9g\21""5k\24""6l\25""9g\21""5k\24""9g\21""6l\25" - "9g\21""9g\21""4j\23""9g\21""4j\23""9g\21""9g\21""4j\23""9g\21""7e\17" - "5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21" - "0_\21""0_\21""3[\16/^\20""3[\16""3[\16-\\\16-\\\16""0Y\24""0Y\24""2Z" - "\15""0Y\24\202\320q\202\320q.W\23.W\23-V\22\0\0\32""8\2\31""9\13\32""8" - "\2\32""8\2\34:\5\27""8\11\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\30" - ">\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\33A\14\36B\5\33A\14\36B\5" - "\33A\14\33A\14\33A\14\36B\5\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36" - "B\5\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\30>\10\30>\10\27=\7\27=\7\27=\7\34:\5\31""9\13\32""8\2\31" - "9\13\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\25""5\6\25""5\6\24""4\5\30""1\1\23""3\3\23""3\3\23""3\3\202\320" - "q\202\320q\25""0\10\25""0\10\25""0\10\0\0""2a\23""2a\23""2a\23""2a\23" - "3b\24""3b\24""3b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5d\26""5d\26" - "7e\17""9g\21""7f\30""4j\23""5k\24""9g\21""4j\23""9g\21""4j\23""5k\24" - "9g\21""4j\23""9g\21""6l\25""5k\24""6l\25""6l\25""9g\21""5k\24""9g\21" - "5k\24""6l\25""9g\21""6l\25""9g\21""5k\24""5k\24""5k\24""5k\24""9g\21" - "5k\24""9g\21""5k\24""9g\21""5k\24""9g\21""6l\25""9g\21""9g\21""4j\23" - "9g\21""9g\21""4j\23""9g\21""4j\23""7f\30""9g\21""5d\26""7e\17""5d\26" - "5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""3[\16""0_\21""0_\21""0_\21" - "/^\20""3[\16/^\20""0Y\24""3[\16""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""2" - "Z\15\202\320q\202\320q-V\22-V\22-V\22\0\0\32""8\2\31""9\13\32""8\2\27" - "8\11\34:\5\34:\5\27""8\11\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10" - "\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36" - "B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\33A\14\36B\5\36B\5\33A" - "\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14" - "\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\30>\10\30>\10\27=\7\27=\7\27""8\11\34:\5\27""8\11\32""8\2\32""8" - "\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\25""5\6\24""4\5\30""1\1\30""1\1\23""3\3\23""3\3\27""1\12\30""1\1" - "\202\320q\202\320q\25""0\10\25""0\10\25/\7\0\0""2a\23""2a\23""2a\23""3" - "b\24""3b\24""3b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5d\26""5d\26""7" - "e\17""7e\17""7f\30""9g\21""5k\24""4j\23""9g\21""4j\23""9g\21""4j\23""5" - "k\24""9g\21""4j\23""9g\21""5k\24""9g\21""5k\24""6l\25""9g\21""6l\25""5" - "k\24""9g\21""5k\24""9g\21""6l\25""9g\21""9g\21""5k\24""6l\25""9g\21""5" - "k\24""9g\21""5k\24""9g\21""5k\24""9g\21""9g\21""5k\24""9g\21""9g\21""4" - "j\23""9g\21""4j\23""9g\21""9g\21""9g\21""5d\26""7e\17""7e\17""5d\26""3" - "b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""3[\16/^\20/^\20" - "3[\16-\\\16""3[\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15.W\23.W\23" - "\202\320q\202\320q-V\22""0R\16*T\16\0\0\31""9\13\31""9\13\32""8\2\34" - ":\5\34:\5\27""8\11\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>" - "\10\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12" - "\36B\5\32\77\12\32\77\12\36B\5\32\77\12\33A\14\36B\5\33A\14\33A\14\36" - "B\5\33A\14\33A\14\36B\5\33A\14\33A\14\33A\14\33A\14\33A\14\36B\5\33A" - "\14\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\32\77\12\32\77\12\36B\5\32" - "\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>" - "\10\27=\7\27=\7\34:\5\34:\5\31""9\13\32""8\2\31""9\13\32""8\2\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5" - "\24""4\5\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3\30""1\1\30""1\1\202" - "\320q\202\320q\25/\7\25/\7\25/\7\0\0""2a\23""2a\23""2a\23""3b\24""3b" - "\24""3b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""9" - "g\21""9g\21""9g\21""9g\21""4j\23""4j\23""4j\23""4j\23""5k\24""4j\23""9" - "g\21""5k\24""9g\21""5k\24""6l\25""9g\21""5k\24""6l\25""9g\21""6l\25""9" - "g\21""5k\24""9g\21""5k\24""9g\21""6l\25""6l\25""9g\21""9g\21""5k\24""9" - "g\21""5k\24""9g\21""4j\23""9g\21""9g\21""5k\24""4j\23""9g\21""5k\24""4" - "j\23""9g\21""9g\21""7e\17""5d\26""5d\26""7e\17""3b\24""3b\24""3b\24""2" - "a\23""2a\23""2a\23""3[\16""0_\21""0_\21""3[\16/^\20/^\20/^\20""3[\16" - "-\\\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23-V\22\202\320" - "q\202\320q*T\16""0R\16*T\16\0\0\31""9\13\32""8\2\27""8\11\34:\5\34:\5" - "\34:\5\31""9\13\27=\7\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32" - "\77\12\32\77\12\32\77\12\36B\5\36B\5\33A\14\33A\14\36B\5\33A\14\36B\5" - "\33A\14\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\33" - "A\14\33A\14\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77" - "\12\32\77\12\32\77\12\36B\5\32\77\12\30>\10\30>\10\27=\7\27=\7\27=\7" - "\27""8\11\34:\5\32""8\2\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\27""1\12\23""3" - "\3\27""1\12\23""3\3\23""3\3\25""0\10\30""1\1\25""0\10\25""0\10\202\320" - "q\202\320q\25/\7\25/\7\25/\7\0\0""2a\23""2a\23""3b\24""3b\24""3b\24""3" - "b\24""3b\24""5d\26""7e\17""5d\26""5d\26""5d\26""5d\26""7e\17""7f\30""9" - "g\21""4j\23""4j\23""5k\24""9g\21""4j\23""4j\23""5k\24""9g\21""4j\23""4" - "j\23""5k\24""5k\24""6l\25""9g\21""6l\25""9g\21""6l\25""5k\24""9g\21""5" - "k\24""5k\24""6l\25""9g\21""9g\21""5k\24""5k\24""9g\21""5k\24""9g\21""5" - "k\24""5k\24""9g\21""9g\21""5k\24""4j\23""5k\24""9g\21""9g\21""9g\21""5" - "d\26""5d\26""5d\26""7e\17""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""3" - "[\16""0_\21""0_\21/^\20/^\20/^\20/^\20""3[\16-\\\16""2Z\15""0Y\24""0" - "Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23.W\23-V\22-V\22\202\320q\202\320q" - "*T\16*T\16*T\16\0\0\32""8\2\31""9\13\34:\5\34:\5\27""8\11\34:\5\34:\5" - "\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\36B\5" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32" - "\77\12\36B\5\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\33" - "A\14\33A\14\36B\5\33A\14\33A\14\33A\14\36B\5\33A\14\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12" - "\32\77\12\30>\10\30>\10\27=\7\27=\7\27=\7\34:\5\34:\5\34:\5\32""8\2\32" - "8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\25""5\6\24""4\5\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12\25""0\10" - "\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\202\320q\202\320q\25/\7\24" - ".\5\24.\5\0\0""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""5d\26" - "7e\17""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""7f\30""4j\23""9g\21" - "5k\24""9g\21""5k\24""4j\23""4j\23""4j\23""9g\21""5k\24""4j\23""5k\24" - "5k\24""6l\25""9g\21""6l\25""9g\21""5k\24""9g\21""5k\24""9g\21""6l\25" - "6l\25""9g\21""5k\24""6l\25""9g\21""4j\23""5k\24""9g\21""5k\24""9g\21" - "5k\24""9g\21""9g\21""5k\24""9g\21""9g\21""7e\17""7e\17""5d\26""5d\26" - "3b\24""3b\24""3b\24""2a\23""2a\23""0_\21""3[\16""0_\21/^\20""3[\16/^" - "\20""3[\16-\\\16-\\\16""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24.W\23" - ".W\23.W\23-V\22-V\22*T\16*T\16\202\320q\202\320q*T\16*T\16*T\16\0\0\32" - "8\2\31""9\13\34:\5\34:\5\27""8\11\34:\5\27=\7\27=\7\27=\7\27=\7\27=\7" - "\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5" - "\33A\14\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\33A\14\36B\5\33" - "A\14\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\27" - "=\7\27=\7\27""8\11\34:\5\31""9\13\32""8\2\32""8\2\32""8\2\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24" - "4\5\23""3\3\30""1\1\23""3\3\27""1\12\23""3\3\30""1\1\25""0\10\25""0\10" - "\25""0\10\25/\7\25/\7\25/\7\202\320q\202\320q\24.\5\24.\5\24.\5\0\0""2" - "a\23""2a\23""3b\24""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""5d\26""7" - "e\17""5d\26""7e\17""7f\30""9g\21""9g\21""9g\21""9g\21""4j\23""5k\24""9" - "g\21""4j\23""4j\23""9g\21""5k\24""9g\21""4j\23""5k\24""6l\25""9g\21""6" - "l\25""5k\24""5k\24""9g\21""6l\25""6l\25""9g\21""5k\24""4j\23""9g\21""4" - "j\23""9g\21""4j\23""5k\24""4j\23""9g\21""4j\23""9g\21""5k\24""9g\21""9" - "g\21""9g\21""7e\17""7e\17""5d\26""5d\26""3b\24""3b\24""3b\24""2a\23""2" - "a\23""2a\23""0_\21""3[\16""0_\21""3[\16/^\20/^\20""3[\16-\\\16""2Z\15" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24.W\23.W\23-V\22-V\22*T\16*T\16" - "*T\16*T\16\202\320q\202\320q*T\16*T\16*T\16\0\0\32""8\2\31""9\13\34:" - "\5\34:\5\34:\5\31""9\13\34:\5\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10" - "\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\33A\14\33" - "A\14\36B\5\33A\14\36B\5\33A\14\33A\14\33A\14\32\77\12\36B\5\32\77\12" - "\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36" - "B\5\32\77\12\32\77\12\30>\10\30>\10\27=\7\27=\7\31""9\13\34:\5\34:\5" - "\31""9\13\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\23""3\3\30""1\1\23""3\3" - "\27""1\12\23""3\3\25""0\10\30""1\1\25""0\10\25""0\10\25/\7\25/\7\25/" - "\7\25/\7\25/\7\202\320q\202\320q\24.\5\24.\5\23,\3\0\0""2a\23""2a\23" - "3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17""5d\26""5d\26""7e\17" - "5d\26""9g\21""7f\30""4j\23""9g\21""4j\23""9g\21""5k\24""4j\23""9g\21" - "4j\23""4j\23""9g\21""4j\23""4j\23""5k\24""4j\23""9g\21""5k\24""6l\25" - "9g\21""6l\25""9g\21""5k\24""9g\21""9g\21""5k\24""9g\21""4j\23""5k\24" - "9g\21""4j\23""5k\24""4j\23""4j\23""4j\23""9g\21""9g\21""7e\17""5d\26" - "5d\26""5d\26""7e\17""3b\24""3b\24""3b\24""2a\23""2a\23""0_\21""3[\16" - "0_\21""0_\21/^\20""3[\16/^\20-\\\16""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24" - "0Y\24""0Y\24""0Y\24.W\23.W\23-V\22-V\22*T\16*T\16*T\16""0R\16*T\16\202" - "\320q\202\320q*T\16*T\16*N\22\0\0\31""9\13\32""8\2\31""9\13\34:\5\34" - ":\5\31""9\13\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32" - "\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12" - "\32\77\12\30>\10\30>\10\27=\7\27=\7\27=\7\34:\5\34:\5\31""9\13\32""8" - "\2\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\25""5\6\25""5\6\24""4\5\24""4\5\30""1\1\23""3\3\27""1\12\23""3\3" - "\27""1\12\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7" - "\24.\5\24.\5\202\320q\202\320q\24.\5\23,\3\23,\3\0\0""2a\23""2a\23""3" - "b\24""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17""5d\26""5d\26""7e\17""9" - "g\21""7f\30""9g\21""4j\23""9g\21""5k\24""9g\21""9g\21""5k\24""9g\21""5" - "k\24""9g\21""5k\24""4j\23""5k\24""9g\21""5k\24""4j\23""9g\21""4j\23""4" - "j\23""5k\24""9g\21""5k\24""4j\23""4j\23""9g\21""4j\23""4j\23""5k\24""9" - "g\21""4j\23""9g\21""4j\23""9g\21""9g\21""5d\26""7e\17""7e\17""7e\17""5" - "d\26""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""3[\16/" - "^\20/^\20/^\20""3[\16-\\\16-\\\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24" - "0Y\24.W\23.W\23-V\22-V\22*T\16""0R\16*T\16*T\16""0R\16*T\16*T\16\202" - "\320q\202\320q(R\14*N\22.P\14\0\0\31""9\13\34:\5\34:\5\31""9\13\34:\5" - "\27""8\11\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\36" - "B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\30>\10" - "\30>\10\30>\10\27=\7\27=\7\34:\5\31""9\13\34:\5\31""9\13\32""8\2\31""9" - "\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\25""5\6\24""4\5\27""1\12\27""1\12\23""3\3\23""3\3\27""1\12\30""1" - "\1\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\24.\5\24" - ".\5\24.\5\202\320q\202\320q\23,\3\17+\10\23,\3\0\0""2a\23""3b\24""3b" - "\24""3b\24""3b\24""5d\26""5d\26""5d\26""7e\17""7e\17""7e\17""5d\26""9" - "g\21""7f\30""9g\21""9g\21""4j\23""5k\24""4j\23""9g\21""4j\23""9g\21""9" - "g\21""4j\23""5k\24""9g\21""4j\23""9g\21""9g\21""4j\23""9g\21""4j\23""5" - "k\24""9g\21""9g\21""4j\23""9g\21""4j\23""4j\23""5k\24""9g\21""4j\23""5" - "k\24""9g\21""9g\21""7f\30""7e\17""5d\26""7e\17""5d\26""5d\26""5d\26""3" - "b\24""3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21""0_\21""3[\16""3" - "[\16/^\20-\\\16""3[\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15.W\23" - ".W\23-V\22-V\22-V\22""0R\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16\202" - "\320q\202\320q*N\22.P\14.P\14\0\0\32""8\2\31""9\13\27""8\11\34:\5\34" - ":\5\35;\6\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36" - "B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\30>\10\30>\10" - "\30>\10\27=\7\27=\7\27=\7\31""9\13\34:\5\34:\5\31""9\13\32""8\2\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25" - "5\6\24""4\5\27""1\12\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\25""0\10" - "\30""1\1\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5" - "\24.\5\24.\5\202\320q\202\320q\23,\3\23,\3\17+\10\0\0""2a\23""3b\24""3" - "b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""9g\21""9" - "g\21""9g\21""9g\21""9g\21""5k\24""4j\23""5k\24""9g\21""4j\23""5k\24""9" - "g\21""4j\23""4j\23""5k\24""9g\21""5k\24""9g\21""9g\21""4j\23""4j\23""9" - "g\21""5k\24""9g\21""9g\21""5k\24""9g\21""4j\23""9g\21""5k\24""9g\21""4" - "j\23""9g\21""7f\30""7e\17""5d\26""5d\26""5d\26""7e\17""3b\24""3b\24""3" - "b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""3[\16/^\20/^\20""0Y\24" - "3[\16""2Z\15""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24.W\23.W\23-V\22" - "-V\22*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*N\22\202\320q\202" - "\320q.P\14*N\22.P\14\0\0\27""8\11\34:\5\27""8\11\34:\5\31""9\13\27=\7" - "\27=\7\27=\7\30>\10\30>\10\30>\10\30>\10\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5" - "\32\77\12\32\77\12\32\77\12\30>\10\30>\10\27=\7\27=\7\27=\7\34:\5\34" - ":\5\27""8\11\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\23""3\3\30""1" - "\1\23""3\3\23""3\3\23""3\3\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10" - "\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\17+\10\23,\3\202\320" - "q\202\320q\23,\3\23,\3\23,\3\0\0""3b\24""3b\24""3b\24""3b\24""5d\26""7" - "e\17""5d\26""7e\17""7e\17""7e\17""5d\26""9g\21""7f\30""4j\23""4j\23""9" - "g\21""9g\21""5k\24""9g\21""4j\23""4j\23""5k\24""9g\21""4j\23""4j\23""4" - "j\23""9g\21""4j\23""9g\21""5k\24""4j\23""9g\21""4j\23""5k\24""9g\21""5" - "k\24""9g\21""5k\24""9g\21""4j\23""5k\24""7f\30""9g\21""5d\26""5d\26""7" - "e\17""5d\26""7e\17""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0" - "_\21""0_\21""3[\16/^\20/^\20""3[\16-\\\16-\\\16""0Y\24""0Y\24""2Z\15" - "0Y\24""0Y\24""2Z\15.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16(R\14.P\14*N\22\202\320q\202\320q.P\14*N\22.P\14\0\0\34" - ":\5\34:\5\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\30>\10\30" - ">\10\30>\10\27=\7\27=\7\27=\7\34:\5\34:\5\32""8\2\31""9\13\32""8\2\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\27""7\10\25""5\6\25" - "5\6\24""4\5\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12\30""1\1\25""0\10" - "\30""1\1\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5" - "\24.\5\24.\5\23,\3\23,\3\23,\3\202\320q\202\320q\17+\10\23,\3\23,\3\0" - "\0""3b\24""3b\24""3b\24""3b\24""5d\26""7e\17""5d\26""5d\26""7e\17""5" - "d\26""7e\17""9g\21""7f\30""4j\23""9g\21""4j\23""5k\24""9g\21""4j\23""9" - "g\21""5k\24""9g\21""5k\24""9g\21""5k\24""9g\21""5k\24""4j\23""4j\23""9" - "g\21""9g\21""9g\21""5k\24""9g\21""4j\23""9g\21""5k\24""9g\21""4j\23""9" - "g\21""9g\21""5d\26""7e\17""7e\17""5d\26""7e\17""5d\26""3b\24""3b\24""3" - "b\24""2a\23""2a\23""0_\21""0_\21""3[\16/^\20/^\20""3[\16/^\20-\\\16""0" - "Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24.W\23.W\23-V\22" - "-V\22*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16(R\14.P\14.P\14*N\22" - "\202\320q\202\320q.P\14.P\14.P\14\0\0\34:\5\31""9\13\34:\5\31""9\13\27" - "=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12" - "\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32" - "\77\12\32\77\12\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\31""9\13\34:\5" - "\34:\5\32""8\2\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\23""3\3\23""3\3\27""1" - "\12\30""1\1\23""3\3\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25/\7" - "\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\17+\10\23" - ",\3\202\320q\202\320q\23,\3\23,\3\23,\3\0\0""3b\24""3b\24""3b\24""3b" - "\24""7e\17""5d\26""7e\17""5d\26""7e\17""7e\17""5d\26""9g\21""7f\30""4" - "j\23""4j\23""5k\24""9g\21""5k\24""9g\21""4j\23""5k\24""9g\21""4j\23""9" - "g\21""5k\24""9g\21""5k\24""9g\21""5k\24""9g\21""5k\24""9g\21""9g\21""5" - "k\24""4j\23""9g\21""4j\23""9g\21""9g\21""5d\26""7e\17""5d\26""5d\26""5" - "d\26""7e\17""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0" - "_\21""0_\21/^\20/^\20""3[\16-\\\16""3[\16""0Y\24""0Y\24""2Z\15""0Y\24" - "0Y\24""0Y\24.W\23.W\23.W\23-V\22-V\22*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*N\22.P\14.P\14.P\14.P\14\202\320q\202\320q*N\22*N\22*" - "N\22\0\0\34:\5\34:\5\34:\5\31""9\13\27=\7\27=\7\27=\7\30>\10\30>\10\30" - ">\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77" - "\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\36B\5\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\27=\7\27=\7\27" - "=\7\34:\5\34:\5\27""8\11\32""8\2\32""8\2\31""9\13\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4" - "\5\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12\30""1\1\30""1\1\25""0\10" - "\25""0\10\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3" - "\17+\10\23,\3\23,\3\17+\10\23,\3\202\320q\202\320q\23,\3\17+\10\23,\3" - "\0\0""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""7e\17""7e\17""7e\17""7" - "e\17""9g\21""7f\30""9g\21""9g\21""4j\23""5k\24""9g\21""5k\24""9g\21""5" - "k\24""5k\24""9g\21""4j\23""9g\21""4j\23""9g\21""4j\23""4j\23""5k\24""9" - "g\21""5k\24""9g\21""4j\23""9g\21""4j\23""9g\21""9g\21""7e\17""5d\26""5" - "d\26""7e\17""5d\26""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""3" - "[\16""0_\21""3[\16""0_\21""3[\16/^\20/^\20/^\20""3[\16-\\\16""2Z\15""0" - "Y\24""0Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23-V\22-V\22""0R\16*T\16*T\16" - "*T\16""0R\16*T\16*T\16*T\16*T\16(R\14.P\14.P\14*N\22.P\14.P\14*N\22\202" - "\320q\202\320q*N\22*N\22*N\22\0\0\34:\5\34:\5\31""9\13\27=\7\27=\7\27" - "=\7\27=\7\30>\10\30>\10\35;\6\32\77\12\32\77\12\32\77\12\32\77\12\36" - "B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12" - "\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\36B\5\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\27=\7\27" - "=\7\27=\7\27""8\11\34:\5\34:\5\34:\5\27""8\11\32""8\2\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25" - "5\6\24""4\5\27""1\12\23""3\3\23""3\3\23""3\3\27""1\12\30""1\1\25""0\10" - "\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5" - "\24.\5\23,\3\17+\10\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\202\320q\202" - "\320q\17+\10\23,\3\17+\10\0\0""3b\24""3b\24""7e\17""5d\26""5d\26""7e" - "\17""5d\26""7e\17""5d\26""7e\17""9g\21""9g\21""5k\24""4j\23""5k\24""9" - "g\21""9g\21""5k\24""4j\23""5k\24""9g\21""9g\21""5k\24""4j\23""4j\23""9" - "g\21""4j\23""5k\24""4j\23""9g\21""4j\23""5k\24""4j\23""7f\30""9g\21""9" - "g\21""7e\17""7e\17""5d\26""7e\17""7e\17""3b\24""3b\24""3b\24""3b\24""2" - "a\23""2a\23""2a\23""0_\21""0_\21""0_\21""3[\16/^\20/^\20/^\20-\\\16-" - "\\\16""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24.W\23.W\23-V\22" - "-V\22*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*N\22.P\14*N\22." - "P\14.P\14*N\22.P\14*N\22\202\320q\202\320q*N\22*N\22*N\22\0\0\34:\5\27" - "8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32" - "\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30" - ">\10\30>\10\27=\7\27=\7\27=\7\34:\5\34:\5\27""8\11\32""8\2\32""8\2\31" - "9\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\25""5\6\24""4\5\24""4\5\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\30" - "1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24" - ".\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\17+\10\23,\3\23" - ",\3\202\320q\202\320q\17+\10\23,\3\17+\10\0\0""3b\24""3b\24""5d\26""5" - "d\26""7e\17""5d\26""5d\26""7e\17""5d\26""9g\21""7f\30""9g\21""9g\21""4" - "j\23""9g\21""5k\24""4j\23""9g\21""5k\24""9g\21""9g\21""4j\23""4j\23""5" - "k\24""4j\23""9g\21""9g\21""4j\23""5k\24""9g\21""4j\23""9g\21""9g\21""7" - "f\30""7e\17""7e\17""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""3b\24""2" - "a\23""2a\23""2a\23""0_\21""0_\21""0_\21/^\20""3[\16/^\20/^\20/^\20""3" - "[\16""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15.W\23.W\23-V\22" - "-V\22-V\22*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16(R\14*N\22.P\14*" - "N\22.P\14.P\14*N\22.P\14*N\22.P\14\202\320q\202\320q*N\22*N\22*N\22\0" - "\0\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12" - "\36B\5\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77" - "\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10" - "\30>\10\27=\7\27=\7\27=\7\34:\5\31""9\13\34:\5\31""9\13\32""8\2\32""8" - "\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\25""5\6\24""4\5\24""4\5\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3" - "\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7" - "\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23" - ",\3\23,\3\23,\3\23,\3\202\320q\202\320q\17+\10\17+\10\17+\10\0\0""3b" - "\24""5d\26""5d\26""5d\26""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""7" - "f\30""9g\21""9g\21""5k\24""4j\23""5k\24""9g\21""9g\21""4j\23""4j\23""4" - "j\23""4j\23""9g\21""4j\23""5k\24""9g\21""4j\23""9g\21""4j\23""9g\21""7" - "f\30""9g\21""7e\17""5d\26""7e\17""7e\17""5d\26""7e\17""3b\24""3b\24""3" - "b\24""3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21/^\20/^\20""3[\16" - "3[\16-\\\16""3[\16""2Z\15""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24." - "W\23.W\23-V\22-V\22*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*N\22" - "(R\14.P\14.P\14*N\22*N\22.P\14*N\22.P\14*N\22*N\22\202\320q\202\320q" - "*N\22*N\22*N\22\0\0\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10" - "\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77" - "\12\32\77\12\32\77\12\36B\5\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>" - "\10\27=\7\27=\7\27=\7\34:\5\31""9\13\34:\5\27""8\11\32""8\2\31""9\13" - "\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\25""5\6\24""4\5\30""1\1\24""4\5\27""1\12\23""3\3\30""1\1\23""3\3" - "\27""1\12\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/" - "\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\17+\10\23,\3\23,\3" - "\23,\3\23,\3\23,\3\17+\10\17+\10\17+\10\202\320q\202\320q\17+\10\17+" - "\10\17+\10\0\0""3b\24""5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""7e\17" - "5d\26""9g\21""9g\21""9g\21""9g\21""4j\23""9g\21""4j\23""4j\23""9g\21" - "5k\24""4j\23""5k\24""9g\21""4j\23""4j\23""9g\21""4j\23""5k\24""9g\21" - "9g\21""9g\21""9g\21""7e\17""5d\26""5d\26""5d\26""5d\26""5d\26""3b\24" - "3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21/^\20/^\20""3[" - "\16/^\20""3[\16-\\\16""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24" - ".W\23.W\23.W\23-V\22-V\22*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16*N\22.P\14*N\22.P\14.P\14*N\22.P\14*N\22*N\22*N\22*N\22*N\22\202" - "\320q\202\320q*N\22*N\22*N\22\0\0\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10" - "\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\30>\10\30>" - "\10\30>\10\30>\10\27=\7\27=\7\27=\7\27""8\11\34:\5\34:\5\31""9\13\32" - "8\2\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\25""5\6\25""5\6\24""4\5\23""3\3\23""3\3\23""3\3\23""3\3" - "\23""3\3\27""1\12\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25" - "/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3" - "\23,\3\23,\3\17+\10\23,\3\23,\3\17+\10\17+\10\17+\10\202\320q\202\320" - "q\17+\10\17+\10\17+\10\0\0""7e\17""5d\26""5d\26""5d\26""7e\17""7e\17" - "5d\26""5d\26""9g\21""7f\30""9g\21""9g\21""5k\24""9g\21""4j\23""5k\24" - "9g\21""4j\23""4j\23""5k\24""9g\21""5k\24""5k\24""9g\21""5k\24""9g\21" - "9g\21""9g\21""9g\21""7e\17""5d\26""5d\26""7e\17""5d\26""5d\26""3b\24" - "3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""3[\16""0_\21" - "0Y\24""3[\16/^\20-\\\16-\\\16""2Z\15""2Z\15""2Z\15""0Y\24""0Y\24""2Z" - "\15""0Y\24.W\23.W\23-V\22-V\22-V\22*T\16""0R\16*T\16*T\16*T\16*T\16*" - "T\16*T\16(R\14.P\14*N\22.P\14.P\14*N\22.P\14.P\14*N\22.P\14*N\22*N\22" - "*N\22*N\22\202\320q\202\320q*N\22*N\22*N\22\0\0\27=\7\27=\7\27=\7\27" - "=\7\30>\10\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\36" - "B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12" - "\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30" - ">\10\30>\10\27=\7\27=\7\27=\7\34:\5\31""9\13\34:\5\34:\5\32""8\2\27""8" - "\11\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\25""5\6\25""5\6\24""4\5\23""3\3\23""3\3\27""1\12\23""3" - "\3\23""3\3\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25" - "/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3" - "\23,\3\23,\3\17+\10\23,\3\17+\10\17+\10\17+\10\23,\3\17+\10\202\320q" - "\202\320q\23,\3\17+\10\17+\10\0\0""5d\26""7e\17""5d\26""7e\17""7e\17" - "5d\26""7e\17""5d\26""9g\21""9g\21""9g\21""7f\30""4j\23""4j\23""4j\23" - "4j\23""9g\21""9g\21""5k\24""5k\24""9g\21""4j\23""9g\21""9g\21""7f\30" - "9g\21""9g\21""7e\17""5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""3b\24" - "3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21""3[\16""3[\16" - "/^\20/^\20""3[\16-\\\16""3[\16""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2" - "Z\15""0Y\24.W\23.W\23-V\22-V\22*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T" - "\16*T\16*T\16*N\22.P\14*N\22.P\14.P\14.P\14*N\22.P\14.P\14*N\22*N\22" - "*N\22*N\22*N\22\202\320q\202\320q*N\22*N\22*N\22\0\0\27=\7\27=\7\27=" - "\7\30>\10\30>\10\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30" - ">\10\27=\7\27=\7\27=\7\27=\7\34:\5\31""9\13\34:\5\34:\5\32""8\2\31""9" - "\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\25""5\6\25""5\6\24""4\5\24""4\5\27""1\12\23""3\3\23""3\3\23""3\3" - "\23""3\3\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/" - "\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3" - "\23,\3\23,\3\23,\3\23,\3\17+\10\17+\10\17+\10\17+\10\23,\3\17+\10\202" - "\320q\202\320q\17+\10\23,\3\17+\10\0\0""5d\26""7e\17""5d\26""7e\17""5" - "d\26""7e\17""7e\17""7e\17""9g\21""9g\21""9g\21""7f\30""4j\23""9g\21""4" - "j\23""5k\24""9g\21""4j\23""4j\23""5k\24""9g\21""9g\21""7f\30""9g\21""9" - "g\21""7e\17""5d\26""7e\17""7e\17""5d\26""7e\17""5d\26""3b\24""3b\24""3" - "b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""0_\21""3[\16/" - "^\20""3[\16/^\20-\\\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y" - "\24.W\23.W\23.W\23-V\22-V\22*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16(R\14.P\14.P\14*N\22.P\14*N\22.P\14*N\22.P\14*N\22.P\14*N\22*N\22" - "*N\22*N\22*N\22\202\320q\202\320q*N\22*N\22*N\22\0\0\27=\7\27=\7\30>" - "\10\30>\10\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\30>\10\27=" - "\7\27=\7\27=\7\34:\5\31""9\13\34:\5\34:\5\31""9\13\32""8\2\31""9\13\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\24""4\5\24""4\5\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3\30""1\1" - "\25""0\10\30""1\1\25""0\10\30""1\1\25/\7\25/\7\25/\7\25/\7\25/\7\24." - "\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3" - "\23,\3\23,\3\23,\3\17+\10\17+\10\17+\10\17+\10\17+\10\23,\3\202\320q" - "\202\320q\17+\10\17+\10\17+\10\0\0""5d\26""5d\26""7e\17""5d\26""7e\17" - "5d\26""7e\17""9g\21""9g\21""9g\21""7f\30""9g\21""4j\23""9g\21""9g\21" - "5k\24""4j\23""9g\21""9g\21""7f\30""9g\21""9g\21""9g\21""5d\26""7e\17" - "7e\17""7e\17""5d\26""7e\17""5d\26""3b\24""3b\24""3b\24""3b\24""2a\23" - "2a\23""2a\23""2a\23""0_\21""0_\21""3[\16/^\20""3[\16/^\20""0Y\24""3[" - "\16""2Z\15""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15.W\23.W\23" - "-V\22-V\22-V\22*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16.P\14*" - "N\22.P\14*N\22.P\14*N\22.P\14*N\22.P\14*N\22.P\14*N\22*N\22*N\22*N\22" - "*N\22*N\22\202\320q\202\320q*N\22*N\22*N\22\0\0\27=\7\27=\7\30>\10\30" - ">\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=" - "\7\27""8\11\34:\5\31""9\13\34:\5\31""9\13\32""8\2\32""8\2\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\24" - "4\5\24""4\5\23""3\3\27""1\12\30""1\1\23""3\3\30""1\1\30""1\1\25""0\10" - "\30""1\1\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5" - "\24.\5\24.\5\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23" - ",\3\23,\3\17+\10\17+\10\17+\10\17+\10\17+\10\23,\3\17+\10\202\320q\202" - "\320q\23,\3\17+\10\23,\3\0\0""5d\26""5d\26""5d\26""7e\17""7e\17""7f\30" - "9g\21""9g\21""9g\21""7f\30""9g\21""9g\21""7f\30""9g\21""9g\21""9g\21" - "7f\30""9g\21""7f\30""9g\21""9g\21""7e\17""7e\17""5d\26""7e\17""5d\26" - "5d\26""5d\26""5d\26""3b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23" - "3[\16""0_\21""0_\21""0_\21""3[\16/^\20""3[\16/^\20""3[\16""0Y\24""2Z" - "\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24.W\23.W\23-V\22-V\22-V\22" - "*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16(R\14(R\14.P\14*N\22." - "P\14*N\22*N\22.P\14*N\22.P\14*N\22*N\22*N\22*N\22*N\22*N\22*N\22*N\22" - "\202\320q\202\320q*N\22*N\22*N\22\0\0\27=\7\27=\7\30>\10\30>\10\30>\10" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30" - ">\10\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\34:\5\34:\5" - "\34:\5\27""8\11\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4\5" - "\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3\25""0\10\30""1\1\25""0\10\25" - "0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\23" - ",\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\17+\10\17" - "+\10\23,\3\17+\10\17+\10\17+\10\23,\3\17+\10\23,\3\202\320q\202\320q" - "\17+\10\17+\10\23,\3\0\0""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""7" - "f\30""9g\21""7f\30""9g\21""9g\21""9g\21""7f\30""9g\21""9g\21""9g\21""7" - "f\30""9g\21""9g\21""9g\21""7e\17""5d\26""5d\26""7e\17""7e\17""5d\26""5" - "d\26""5d\26""3b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0" - "_\21""0_\21""0_\21/^\20/^\20""3[\16/^\20-\\\16""3[\16""2Z\15""2Z\15""0" - "Y\24""0Y\24""2Z\15""2Z\15""0Y\24.W\23.W\23-V\22-V\22*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16*T\16*T\16*T\16(R\14*N\22.P\14*N\22.P\14*N\22.P\14" - "*N\22.P\14.P\14.P\14*N\22*N\22*N\22*N\22*N\22*N\22*N\22*N\22\202\320" - "q\202\320q*N\22*N\22*N\22\0\0\27=\7\30>\10\30>\10\30>\10\30>\10\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30" - ">\10\30>\10\35;\6\27=\7\27=\7\27=\7\34:\5\31""9\13\34:\5\34:\5\31""9" - "\13\32""8\2\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4\5\23""3\3\23""3\3" - "\23""3\3\23""3\3\23""3\3\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10" - "\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23" - ",\3\23,\3\23,\3\17+\10\23,\3\23,\3\17+\10\23,\3\23,\3\17+\10\17+\10\17" - "+\10\23,\3\17+\10\17+\10\23,\3\17+\10\17+\10\202\320q\202\320q\17+\10" - "\17+\10\23,\3\0\0""5d\26""7e\17""5d\26""7e\17""5d\26""9g\21""7f\30""9" - "g\21""9g\21""9g\21""7f\30""9g\21""9g\21""7f\30""7f\30""9g\21""9g\21""7" - "e\17""5d\26""7e\17""5d\26""7e\17""7e\17""5d\26""5d\26""5d\26""5d\26""3" - "b\24""3b\24""3b\24""2a\23""2a\23""2a\23""3[\16""0_\21""0_\21""0_\21""3" - "[\16/^\20/^\20""3[\16-\\\16-\\\16""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15" - "0Y\24""2Z\15""0Y\24.W\23.W\23-V\22-V\22*T\16""0R\16*T\16""0R\16*T\16" - "*T\16*T\16*T\16*T\16*T\16(R\14*N\22.P\14.P\14.P\14.P\14*N\22.P\14.P\14" - "*N\22.P\14.P\14*N\22*N\22*N\22*N\22*N\22*N\22*N\22*N\22\202\320q\202" - "\320q*N\22*N\22*N\22\0\0\30>\10\30>\10\30>\10\30>\10\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\30>\10\27=\7\27=" - "\7\27=\7\27=\7\27=\7\31""9\13\34:\5\34:\5\34:\5\32""8\2\31""9\13\32""8" - "\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\25""5\6\25""5\6\24""4\5\27""1\12\23""3\3\27""1\12\23""3\3\23""3" - "\3\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25" - "/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\17+\10\23," - "\3\17+\10\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3\17+\10\17+\10\17" - "+\10\23,\3\17+\10\17+\10\23,\3\17+\10\202\320q\202\320q\17+\10\17+\10" - "\23,\3\0\0""5d\26""7e\17""7e\17""5d\26""7f\30""9g\21""7f\30""9g\21""9" - "g\21""9g\21""7f\30""9g\21""9g\21""9g\21""7f\30""9g\21""7e\17""7e\17""7" - "e\17""7e\17""7e\17""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""3b\24""3" - "b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""3[\16/^\20""3[\16/^\20" - "/^\20-\\\16-\\\16""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15.W" - "\23.W\23.W\23-V\22-V\22*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16(R\14(R\14*N\22.P\14*N\22.P\14*N\22.P\14*N\22.P\14.P\14*N\22*N\22" - "*N\22*N\22*N\22*N\22*N\22*N\22*N\22*N\22\202\320q\202\320q*N\22*N\22" - "*N\22\0\0\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\30" - ">\10\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\31""9\13\34" - ":\5\34:\5\34:\5\32""8\2\31""9\13\32""8\2\32""8\2\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24" - "4\5\27""1\12\23""3\3\30""1\1\23""3\3\23""3\3\30""1\1\30""1\1\30""1\1" - "\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24" - ".\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3" - "\23,\3\17+\10\23,\3\23,\3\17+\10\17+\10\17+\10\17+\10\23,\3\17+\10\17" - "+\10\17+\10\202\320q\202\320q\17+\10\23,\3\23,\3\0\0""7e\17""7e\17""9" - "g\21""7f\30""9g\21""7f\30""9g\21""9g\21""9g\21""9g\21""7f\30""9g\21""9" - "g\21""7f\30""9g\21""5d\26""7e\17""5d\26""7e\17""7e\17""5d\26""5d\26""5" - "d\26""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""2a\23""0_\21""0" - "_\21""0_\21""0_\21/^\20/^\20""0Y\24/^\20-\\\16-\\\16""2Z\15""0Y\24""0" - "Y\24""0Y\24""0Y\24""0Y\24""2Z\15.W\23.W\23-V\22-V\22-V\22*T\16*T\16""0" - "R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16.P\14*N\22.P\14*N\22.P\14.P\14" - ".P\14.P\14*N\22.P\14*N\22.P\14*N\22.P\14*N\22*N\22*N\22*N\22*N\22*N\22" - "*N\22*N\22\202\320q\202\320q*N\22.P\14.P\14\0\0\30>\10\30>\10\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\30>\10\27" - "=\7\35;\6\27=\7\27=\7\34:\5\34:\5\34:\5\34:\5\31""9\13\32""8\2\31""9" - "\13\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\25""5\6\25""5\6\24""4\5\24""4\5\27""1\12\23""3\3\23""3\3\27""1\12" - "\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7" - "\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23" - ",\3\23,\3\17+\10\23,\3\17+\10\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\17" - "+\10\17+\10\17+\10\17+\10\23,\3\17+\10\23,\3\23,\3\202\320q\202\320q" - "\23,\3\23,\3\23,\3\0\0""7e\17""7e\17""9g\21""7f\30""9g\21""9g\21""9g" - "\21""9g\21""9g\21""7f\30""9g\21""9g\21""9g\21""7f\30""7e\17""5d\26""5" - "d\26""7e\17""5d\26""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""3b\24""2" - "a\23""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21""0_\21""3[\16/^\20""3" - "[\16/^\20""3[\16-\\\16""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y" - "\24.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16" - "*T\16*T\16(R\14*N\22.P\14*N\22.P\14*N\22.P\14*N\22.P\14.P\14.P\14*N\22" - "*N\22*N\22.P\14*N\22*N\22*N\22*N\22.P\14*N\22.P\14*N\22\202\320q\202" - "\320q*N\22.P\14*N\22\0\0\30>\10\30>\10\36B\5\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>" - "\10\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\27""8\11\31""9" - "\13\34:\5\34:\5\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\24""4" - "\5\23""3\3\23""3\3\23""3\3\30""1\1\27""1\12\30""1\1\30""1\1\25""0\10" - "\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24" - ".\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3" - "\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23" - ",\3\17+\10\23,\3\202\320q\202\320q\23,\3\17+\10\23,\3\0\0""7e\17""7f" - "\30""9g\21""9g\21""9g\21""9g\21""9g\21""9g\21""7f\30""9g\21""7f\30""9" - "g\21""7e\17""7e\17""5d\26""7e\17""5d\26""5d\26""5d\26""5d\26""5d\26""3" - "b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""2a\23""0_\21""0_\21""0" - "_\21/^\20/^\20""3[\16/^\20-\\\16-\\\16""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24""2Z\15""0Y\24""0Y\24.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16(R\14(R\14.P\14*N\22.P\14*N\22.P\14.P\14" - "*N\22.P\14*N\22.P\14*N\22.P\14*N\22.P\14.P\14*N\22.P\14.P\14*N\22*N\22" - ".P\14.P\14\202\320q\202\320q.P\14.P\14*N\22\0\0\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\30>\10\30>\10\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7" - "\27=\7\31""9\13\34:\5\31""9\13\34:\5\32""8\2\31""9\13\32""8\2\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5" - "\6\25""5\6\24""4\5\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12" - "\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7" - "\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23" - ",\3\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\17+" - "\10\23,\3\17+\10\23,\3\17+\10\23,\3\23,\3\17+\10\23,\3\202\320q\202\320" - "q\23,\3\23,\3\23,\3\0\0""7f\30""9g\21""9g\21""9g\21""9g\21""9g\21""9" - "g\21""7f\30""9g\21""9g\21""9g\21""5d\26""7e\17""5d\26""5d\26""7e\17""5" - "d\26""5d\26""7e\17""5d\26""3b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2" - "a\23""0_\21""0_\21""0_\21""3[\16""0_\21/^\20""3[\16/^\20-\\\16-\\\16" - "-\\\16""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23-V\22" - "-V\22-V\22*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16(R\14.P\14" - ".P\14*N\22.P\14*N\22.P\14.P\14.P\14*N\22.P\14*N\22.P\14.P\14*N\22.P\14" - "*N\22.P\14.P\14*N\22.P\14.P\14*N\22.P\14.P\14\202\320q\202\320q*N\22" - ".P\14.P\14\0\0\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\30>\10\30>" - "\10\27=\7\27=\7\27=\7\27=\7\27=\7\34:\5\34:\5\27""8\11\34:\5\31""9\13" - "\32""8\2\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\27""1\12\23""3\3\27""1\12" - "\23""3\3\27""1\12\23""3\3\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10" - "\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\23" - ",\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3\23," - "\3\23,\3\17+\10\23,\3\17+\10\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23" - ",\3\23,\3\17+\10\202\320q\202\320q\23,\3\23,\3\23,\3\0\0""7f\30""9g\21" - "9g\21""9g\21""9g\21""9g\21""7f\30""9g\21""9g\21""5d\26""7e\17""5d\26" - "5d\26""5d\26""7e\17""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""3b\24" - "3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""0_\21""0_\21""3[\16" - "/^\20/^\20/^\20""0Y\24-\\\16""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24" - "0Y\24.W\23.W\23-V\22-V\22-V\22""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16*N\22.P\14*N\22.P\14.P\14*N\22.P\14.P\14*N\22.P\14" - ".P\14*N\22.P\14.P\14.P\14.P\14.P\14*N\22.P\14.P\14.P\14.P\14*N\22.P\14" - ".P\14\202\320q\202\320q*N\22*N\22.P\14\0\0\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10" - "\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\34:\5\34:\5\34:\5\34:\5" - "\31""9\13\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5\23""3\3" - "\27""1\12\23""3\3\23""3\3\23""3\3\30""1\1\30""1\1\25""0\10\30""1\1\25" - "0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24" - ".\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\17+\10\23" - ",\3\17+\10\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\17" - "+\10\23,\3\17+\10\23,\3\23,\3\17+\10\202\320q\202\320q\23,\3\23,\3\24" - ".\5\0\0""9g\21""9g\21""9g\21""9g\21""9g\21""9g\21""7f\30""9g\21""9g\21" - "7e\17""7e\17""5d\26""5d\26""7e\17""5d\26""5d\26""5d\26""5d\26""3b\24" - "3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""0_\21" - "/^\20/^\20""3[\16/^\20-\\\16-\\\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24" - "2Z\15""0Y\24""0Y\24.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T\16""0R\16*T" - "\16*T\16*T\16*T\16*T\16*T\16*T\16(R\14.P\14.P\14.P\14\242\261\230\236" - "\262\222\242\261\230\235\261\220\235\261\220\235\261\220\235\261\220" - "\235\261\220\242\261\230\236\262\222\242\261\230\236\262\222\242\261" - "\230\236\262\222\235\261\220\242\261\230\235\261\220\236\262\222\235" - "\261\220.P\14*N\22.P\14\202\320q\202\320q*N\22*T\16*T\16\0\0\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10" - "\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\34:\5\34:\5\27""8" - "\11\34:\5\31""9\13\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5" - "\23""3\3\23""3\3\30""1\1\30""1\1\23""3\3\23""3\3\25""0\10\30""1\1\25" - "0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24." - "\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\17+\10\23,\3\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\17+\10\23,\3\17+\10\202\320q\202\320q\24.\5\24.\5\24.\5\0\0""7f" - "\30""9g\21""9g\21""7f\30""9g\21""9g\21""9g\21""7f\30""7e\17""5d\26""7" - "e\17""5d\26""7e\17""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""3b\24""3" - "b\24""2a\23""2a\23""2a\23""3[\16""0_\21""0_\21""0_\21""3[\16/^\20/^\20" - "/^\20-\\\16-\\\16""3[\16""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0" - "Y\24.W\23.W\23-V\22-V\22-V\22*T\16""0R\16*T\16""0R\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16(R\14*N\22.P\14.P\14\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - ".P\14.P\14.P\14\202\320q\202\320q*T\16*T\16*T\16\0\0\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\30" - ">\10\27=\7\27=\7\27=\7\27=\7\27=\7\34:\5\27""8\11\34:\5\34:\5\31""9\13" - "\32""8\2\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\23""3\3\23""3\3\30" - "1\1\23""3\3\23""3\3\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24" - ".\5\23,\3\23,\3\23,\3\23,\3\17+\10\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\23,\3\23,\3" - "\17+\10\202\320q\202\320q\24.\5\24.\5\24.\5\0\0""9g\21""7f\30""9g\21" - "7f\30""9g\21""9g\21""7e\17""7e\17""5d\26""7e\17""5d\26""5d\26""5d\26" - "5d\26""5d\26""7e\17""3b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23" - "3[\16""0_\21""0_\21""0_\21""3[\16/^\20/^\20/^\20""3[\16-\\\16""0Y\24" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24.W\23.W\23-V\22-V\22-" - "V\22*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*N\22" - "(R\14*N\22.P\14.P\14\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374*N\22(R\14*T\16\202\320q" - "\202\320q*T\16*T\16*T\16\0\0\32\77\12\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\30>\10\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27" - "=\7\34:\5\34:\5\34:\5\31""9\13\32""8\2\32""8\2\31""9\13\32""8\2\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\24""4\5\24""4\5\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\27""1\12" - "\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3" - "\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3[mP\367\371\366\372" - "\374\371\214\227\2067M+\27""1\12\27""1\12""7M+\214\227\206\372\374\371" - "\373\375\372\177\216v\23,\3\23,\3\24.\5\24.\5\202\320q\202\320q\24.\5" - "\24.\5\25/\7\0\0""9g\21""7f\30""7f\30""9g\21""9g\21""9g\21""7e\17""7" - "e\17""5d\26""7e\17""5d\26""5d\26""5d\26""7e\17""5d\26""3b\24""3b\24""3" - "b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""3[\16""0_\21/^\20/^\20" - "/^\20/^\20-\\\16""3[\16""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24.W\23.W\23-V\22-V\22-V\22*T\16*T\16""0R\16*T\16""0R\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*N\22(R\14*N\22.P\14.P\14*N\22.P\14" - ".P\14*N\22*N\22Po7\370\372\367\376\377\374\215\236y*N\22.P\14.P\14.P" - "\14*N\22.P\14\215\236y\376\377\374\376\377\374t\211^*T\16*T\16*T\16\202" - "\320q\202\320q*T\16*T\16""0R\16\0\0\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27" - "=\7\31""9\13\34:\5\31""9\13\34:\5\31""9\13\32""8\2\31""9\13\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\25""5\6\25""5\6\24""4\5\30""1\1\23""3\3\27""1\12\23""3\3\23""3\3" - "\23""3\3\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25" - "/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\23,\3\253\271" - "\255\376\377\374\376\377\3747M+\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3" - "8N,\376\377\374\376\377\374\302\311\276\24.\5\24.\5\24.\5\202\320q\202" - "\320q\25/\7\25/\7\25/\7\0\0""7f\30""9g\21""7f\30""9g\21""9g\21""9g\21" - "7e\17""7e\17""5d\26""7e\17""7e\17""5d\26""7e\17""5d\26""3b\24""3b\24" - "3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21""0_\21/^\20/^" - "\20""3[\16/^\20""3[\16-\\\16""3[\16""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15" - "0Y\24""2Z\15.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T\16""0R\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*N\22(R\14*N\22*N\22.P\14.P\14" - "*N\22.P\14.P\14*N\22\360\362\357\376\377\374\376\377\374b|K*N\22.P\14" - ".P\14.P\14.P\14(R\14b|K\376\377\374\376\377\374\361\363\360*T\16*T\16" - "*T\16\202\320q\202\320q*T\16*T\16*T\16\0\0\32\77\12\32\77\12\32\77\12" - "\32\77\12\36B\5\32\77\12\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7" - "\27""8\11\34:\5\34:\5\31""9\13\31""9\13\32""8\2\31""9\13\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\25""5\6\24""4\5\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3" - "\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/" - "\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3\17+\10\23,\3\370\372" - "\367\376\377\374\376\377\374\315\324\311(>\35\23,\3\23,\3\17+\10\23," - "\3(>\35\321\327\314\376\377\374\376\377\374\370\372\367\24.\5\24.\5\24" - ".\5\202\320q\202\320q\25/\7\25/\7\25/\7\0\0""9g\21""9g\21""7f\30""9g" - "\21""9g\21""7e\17""7e\17""5d\26""7e\17""7e\17""5d\26""5d\26""5d\26""3" - "b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""3[\16""0_\21""0_\21""3" - "[\16/^\20""3[\16/^\20/^\20-\\\16-\\\16""2Z\15""2Z\15""2Z\15""0Y\24""0" - "Y\24""2Z\15""0Y\24""2Z\15.W\23.W\23.W\23-V\22-V\22-V\22*T\16""0R\16*" - "T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16.P\14*N\22(R" - "\14*N\22.P\14.P\14*N\22.P\14*N\22.P\14.P\14\341\347\334\376\377\374\376" - "\377\374\376\377\374\366\370\364\277\313\270\245\264\233\245\264\233" - "\277\313\270\367\371\366\376\377\374\376\377\374\376\377\374\341\347" - "\334*T\16*T\16*T\16\202\320q\202\320q*T\16""0R\16-V\22\0\0\32\77\12\32" - "\77\12\32\77\12\32\77\12\30>\10\30>\10\30>\10\30>\10\30>\10\27=\7\27" - "=\7\27=\7\34:\5\27""8\11\34:\5\34:\5\31""9\13\32""8\2\31""9\13\32""8" - "\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\25""5\6\24""4\5\24""4\5\27""1\12\23""3\3\30""1\1\23""3\3\23""3\3" - "\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\23" - ",\3\221\234\213\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\221\234\213\24.\5\25/\7\25/\7\202\320q\202\320q" - "\25/\7\25""0\10\25""0\10\0\0""9g\21""9g\21""9g\21""5d\26""7e\17""7e\17" - "5d\26""7e\17""5d\26""5d\26""7e\17""5d\26""3b\24""3b\24""3b\24""3b\24" - "2a\23""2a\23""2a\23""3[\16""0_\21""0_\21""0_\21""3[\16/^\20""3[\16/^" - "\20-\\\16-\\\16""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z" - "\15.W\23.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T\16""0R\16*T\16""0R\16*" - "T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16(R\14*N\22(R\14*N\22.P\14.P\14" - ".P\14.P\14*N\22.P\14*N\22""6Y\35\341\347\334\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\341\347\3349\\\37*T\16*T\16*T\16\202\320" - "q\202\320q*T\16-V\22-V\22\0\0\32\77\12\32\77\12\32\77\12\30>\10\30>\10" - "\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\27=\7\34:\5\27""8\11\34:\5\32" - "8\2\32""8\2\32""8\2\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\23""3\3\30""1" - "\1\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\30""1\1\25""0\10\25""0\10" - "\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24" - ".\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\23,\3\23,\3\23,\3\23,\3\23,\3" - "\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\17+\10+A\40\307\316\303\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\313\321\3061E\36\25/\7\25/\7\25/\7\25/\7\202\320" - "q\202\320q\25""0\10\25""0\10\25""0\10\0\0""9g\21""9g\21""7f\30""7e\17" - "7e\17""5d\26""7e\17""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""3b\24" - "3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21""0_\21""3[\16/^\20/^" - "\20""3[\16-\\\16""0Y\24-\\\16""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y" - "\24""2Z\15.W\23.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16(R\14.P\14*N\22.P\14*N\22" - ".P\14.P\14.P\14*N\22*N\22.P\14(R\14(R\14*N\22m\212^\270\303\261\344\353" - "\340\370\372\367\370\372\367\345\354\341\267\307\255m\212^0R\16""0R\16" - "*T\16*T\16*T\16*T\16\202\320q\202\320q-V\22.W\23.W\23\0\0\32\77\12\32" - "\77\12\32\77\12\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\27=\7\31" - "9\13\34:\5\34:\5\31""9\13\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5" - "\6\24""4\5\24""4\5\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3" - "\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\17+\10\23,\3\23,\3\23,\3\23,\3\23" - ",\3\23,\3\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\202\320q\202\320q\25""0\10\30""1\1\30" - "1\1\0\0""9g\21""9g\21""7f\30""5d\26""7e\17""5d\26""5d\26""5d\26""5d\26" - "5d\26""3b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""3[\16""0_\21" - "0_\21""3[\16/^\20/^\20/^\20""3[\16-\\\16-\\\16""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24""2Z\15""0Y\24.W\23.W\23.W\23-V\22-V\22-V\22*T\16*" - "T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0" - "R\16*T\16*T\16(R\14(R\14.P\14(R\14*N\22(R\14(R\14.P\14(R\14(R\14.P\14" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*" - "T\16*T\16-V\22\202\320q\202\320q.W\23.W\23""0Y\24\0\0\32\77\12\32\77" - "\12\32\77\12\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\34:\5\34:\5" - "\27""8\11\32""8\2\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\24""4\5\24""4\5" - "\24""4\5\30""1\1\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\30""1\1\30" - "1\1\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24" - ".\5\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\23,\3\24.\5\24.\5" - "\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25""0\10\25""0\10\202\320q\202\320q\30""1\1\23""3\3\23" - "3\3\0\0""9g\21""9g\21""5d\26""7e\17""5d\26""5d\26""5d\26""7e\17""5d\26" - "3b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21" - "3[\16""0_\21""3[\16""3[\16""3[\16""0Y\24-\\\16""3[\16""2Z\15""0Y\24""0" - "Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15.W\23.W\23-V\22-V\22-V\22*T\16" - "*T\16*T\16""0R\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16(R\14(R\14(R\14\236\262\222\236\262\222" - "\236\262\222\242\261\230\236\262\222\242\261\230\236\262\222\242\261" - "\230\236\262\222\242\261\230\236\262\222\236\262\222\236\262\222\237" - "\263\223\237\263\223\237\263\223\237\263\223\237\263\223\237\263\223" - "-V\22-V\22-V\22\202\320q\202\320q2Z\15""0Y\24""2Z\15\0\0\32\77\12\30" - ">\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\27=\7\34:\5\27""8\11\34:" - "\5\34:\5\32""8\2\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\30""1\1" - "\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\25""0\10\25""0\10\30" - "1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\24.\5\24.\5\24.\5\24.\5\24.\5\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\25""0\10\25""0\10" - "\30""1\1\202\320q\202\320q\23""3\3\27""1\12\23""3\3\0\0""9g\21""7e\17" - "7e\17""7e\17""5d\26""7e\17""5d\26""7e\17""3b\24""3b\24""3b\24""3b\24" - "2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""0_\21""0_\21/^\20""3[\16/^" - "\20""3[\16-\\\16""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2" - "Z\15""0Y\24.W\23.W\23.W\23-V\22-V\22-V\22*T\16*T\16""0R\16*T\16*T\16" - "0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374-V\22.W\23.W\23\202\320q" - "\202\320q0Y\24""0Y\24""0Y\24\0\0\32\77\12\30>\10\30>\10\35;\6\27=\7\27" - "=\7\27=\7\27=\7\27""8\11\34:\5\27""8\11\34:\5\31""9\13\32""8\2\31""9" - "\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\25""5\6\24""4\5\24""4\5\24""4\5\23""3\3\23""3\3\23""3\3\23""3\3" - "\23""3\3\23""3\3\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10" - "\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5" - "\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24" - ".\5\24.\5\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\30""1\1\25""0\10\25""0\10\202\320q\202" - "\320q\23""3\3\23""3\3\30""1\1\0\0""7e\17""7e\17""5d\26""7e\17""5d\26" - "5d\26""5d\26""3b\24""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21" - "0_\21""0_\21""0_\21""3[\16/^\20""3[\16/^\20-\\\16-\\\16""2Z\15""2Z\15" - "0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24.W\23.W\23.W\23-V\22-" - "V\22-V\22""0R\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374.W\23.W\23""0Y\24\202\320q\202\320q0Y\24""2Z\15""2" - "Z\15\0\0\30>\10\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\34:\5\27""8\11" - "\31""9\13\34:\5\32""8\2\27""8\11\32""8\2\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4" - "\5\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\25""0\10\30" - "1\1\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24" - ".\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\24.\5\24.\5\24.\5\24.\5\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25""0\10" - "\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\23""3\3\23""3\3\202\320q" - "\202\320q\30""1\1\24""4\5\24""4\5\0\0""7e\17""7e\17""7e\17""5d\26""5" - "d\26""7e\17""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""3" - "[\16""0_\21""0_\21""0_\21/^\20/^\20/^\20""0Y\24-\\\16-\\\16""2Z\15""0" - "Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15.W\23.W\23.W\23-V\22-V" - "\22-V\22-V\22*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16""0R\16*T\16" - "*T\16-V\22-V\22.W\23.W\23.W\23""0Y\24""0Y\24""2Z\15\202\320q\202\320" - "q2Z\15""0Y\24-\\\16\0\0\30>\10\30>\10\30>\10\27=\7\27=\7\27=\7\31""9" - "\13\34:\5\34:\5\34:\5\31""9\13\31""9\13\31""9\13\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\25" - "5\6\24""4\5\30""1\1\23""3\3\27""1\12\23""3\3\23""3\3\30""1\1\23""3\3" - "\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24" - ".\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\24.\5\24.\5\24.\5\24.\5\24.\5\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\23""3\3\23""3" - "\3\23""3\3\202\320q\202\320q\24""4\5\25""5\6\25""5\6\0\0""7e\17""5d\26" - "7e\17""7e\17""5d\26""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23" - "2a\23""0_\21""3[\16""0_\21""0_\21/^\20/^\20/^\20""3[\16""3[\16-\\\16" - "2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24.W\23.W\23.W\23" - ".W\23-V\22-V\22-V\22*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*" - "T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16""0R\16*T\16""0R" - "\16*T\16-V\22-V\22-V\22""2Z\15.W\23""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15" - "\202\320q\202\320q-\\\16-\\\16/^\20\0\0\30>\10\30>\10\27=\7\27=\7\27" - "=\7\27""8\11\34:\5\34:\5\31""9\13\32""8\2\32""8\2\31""9\13\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25" - "5\6\25""5\6\24""4\5\24""4\5\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3" - "\23""3\3\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24" - ".\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\24.\5\24.\5\226\240\217\226\240\217\226\240\217#>\27\25/\7\226\240\217" - "\226\240\217\226\240\217\226\240\217\226\240\217\226\240\217\227\241" - "\220\227\241\220\227\241\220\227\241\220\227\241\220\230\242\221\225" - "\245\214\230\242\221\23""3\3\30""1\1\23""3\3\202\320q\202\320q\25""5" - "\6\27""7\10\27""7\10\0\0""5d\26""5d\26""7e\17""5d\26""5d\26""3b\24""3" - "b\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""3[\16/" - "^\20/^\20""3[\16/^\20-\\\16""3[\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24" - "2Z\15""0Y\24""2Z\15""0Y\24.W\23.W\23.W\23-V\22-V\22-V\22*T\16*T\16*T" - "\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16\376\377\374\376\377" - "\374\376\377\374Po7*T\16\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\3740Y\24""0Y\24" - "2Z\15\202\320q\202\320q-\\\16/^\20/^\20\0\0\30>\10\27=\7\27=\7\27=\7" - "\27=\7\27""8\11\34:\5\34:\5\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5" - "\6\25""5\6\24""4\5\24""4\5\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\30" - "1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25/" - "\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5" - "\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24" - ".\5\24.\5\24.\5\376\377\374\376\377\374\376\377\3744H\"\25/\7\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\23""3\3\24""4\5\24""4\5\202\320q\202\320q\27" - "7\10\27""7\10\25""5\6\0\0""5d\26""5d\26""5d\26""5d\26""3b\24""3b\24""3" - "b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""3[\16""0_\21/^\20""3" - "[\16/^\20""3[\16-\\\16-\\\16""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24" - "0Y\24""2Z\15""0Y\24.W\23.W\23.W\23-V\22-V\22-V\22-V\22*T\16*T\16*T\16" - "0R\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16\376\377\374\376\377" - "\374\376\377\374Fj,*T\16\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\3742Z\15""0Y\24" - "-\\\16\202\320q\202\320q3[\16""3[\16""0_\21\0\0\27=\7\27=\7\27=\7\27" - "=\7\34:\5\31""9\13\34:\5\31""9\13\32""8\2\31""9\13\31""9\13\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5" - "\6\25""5\6\24""4\5\24""4\5\30""1\1\27""1\12\23""3\3\23""3\3\27""1\12" - "\23""3\3\27""1\12\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24" - ".\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5" - "\24.\5\24.\5\25/\7\25/\7\376\377\374\376\377\374\376\377\3744H\"\25/" - "\7\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\24""4\5\25""5\6\25""5\6\202\320q\202" - "\320q\27""7\10\27""7\10\27""7\10\0\0""7e\17""5d\26""5d\26""3b\24""3b" - "\24""3b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21/^\20/^\20" - "0Y\24/^\20""3[\16/^\20""0Y\24-\\\16""2Z\15""2Z\15""0Y\24""0Y\24""2Z\15" - "0Y\24""0Y\24""0Y\24.W\23.W\23.W\23-V\22-V\22-V\22-V\22*T\16""0R\16*T" - "\16*T\16""0R\16*T\16""0R\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16""0R\16-V\22-V\22-V\22.W\23.W\23.W\23""2Z\15""0Y\24" - "0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15-\\\16-\\\16\202\320q\202\320" - "q3[\16""0_\21""0_\21\0\0\27=\7\27=\7\27=\7\27""8\11\34:\5\27""8\11\31" - "9\13\32""8\2\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4\5\23""3" - "\3\27""1\12\23""3\3\23""3\3\30""1\1\27""1\12\23""3\3\25""0\10\30""1\1" - "\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24" - ".\5\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25""0\10\25""0\10\25""0\10\30""1\1\30" - "1\1\25""0\10\30""1\1\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12\24""4" - "\5\24""4\5\24""4\5\25""5\6\27""7\10\202\320q\202\320q\27""7\10\27""7" - "\10\27""7\10\0\0""5d\26""5d\26""7e\17""3b\24""3b\24""3b\24""2a\23""2" - "a\23""2a\23""0_\21""0_\21""3[\16/^\20/^\20""3[\16/^\20/^\20""3[\16-\\" - "\16-\\\16""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24.W\23.W\23.W\23-V\22-V\22-V\22-V\22*T\16*T\16*T\16""0R\16*T\16*T" - "\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16""0R\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16-V\22" - "-V\22-V\22.W\23.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0" - "Y\24""0Y\24""2Z\15""3[\16/^\20/^\20\202\320q\202\320q3[\16""3[\16""0" - "_\21\0\0\27=\7\27=\7\34:\5\34:\5\34:\5\31""9\13\32""8\2\32""8\2\32""8" - "\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\25""5\6\25""5\6\24""4\5\24""4\5\23""3\3\27""1\12\23""3\3\23""3\3" - "\23""3\3\27""1\12\23""3\3\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\24.\5\24.\5\24.\5\24.\5\24.\5\24.\5\24" - ".\5\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25""0\10\30""1\1\23""3\3" - "\30""1\1\23""3\3\27""1\12\23""3\3\23""3\3\24""4\5\25""5\6\25""5\6\27" - "7\10\27""7\10\27""7\10\202\320q\202\320q\27""7\10\27""7\10\32""8\2\0" - "\0""7e\17""5d\26""3b\24""3b\24""3b\24""2a\23""2a\23""2a\23""2a\23""0" - "_\21""3[\16""0_\21/^\20""3[\16""3[\16""3[\16/^\20-\\\16""0Y\24""2Z\15" - "2Z\15""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15.W\23.W\23.W\23" - "-V\22-V\22-V\22-V\22*T\16""0R\16*T\16*T\16*T\16""0R\16*T\16""0R\16*T" - "\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16""0" - "R\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16""0R\16-V\22-V\22-V\22\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374/^\20/^\20/^\20\202\320q\202\320q0_\21""2a\23" - "2a\23\0\0\27=\7\34:\5\27""8\11\34:\5\34:\5\32""8\2\31""9\13\32""8\2\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25" - "5\6\25""5\6\24""4\5\24""4\5\23""3\3\30""1\1\23""3\3\30""1\1\23""3\3\23" - "3\3\27""1\12\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\30""1\1\25""0" - "\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25""0\10\25""0\10\25" - "0\10\25""0\10\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\27""7\10\27""7\10\27""7" - "\10\202\320q\202\320q\27""7\10\31""9\13\32""8\2\0\0""5d\26""3b\24""3" - "b\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""0_\21""0_\21""3[\16/" - "^\20/^\20""3[\16/^\20-\\\16-\\\16""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15" - "0Y\24""2Z\15""0Y\24""0Y\24.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22""0" - "R\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16""0R\16*T\16*T\16*T\16""0R\16" - "*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16" - "*T\16""0R\16-V\22-V\22-V\22-V\22.W\23\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "3[\16/^\20""0_\21\202\320q\202\320q2a\23""2a\23""3b\24\0\0\27=\7\34:" - "\5\27""8\11\34:\5\31""9\13\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\25""5\6" - "\24""4\5\24""4\5\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\27""1" - "\12\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25""0\10\25""0\10\25""0\10\25""0\10\30""1" - "\1\30""1\1\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\27""7\10\27""7\10\27""7\10\202" - "\320q\202\320q\32""8\2\32""8\2\31""9\13\0\0""3b\24""3b\24""3b\24""2a" - "\23""2a\23""2a\23""0_\21""3[\16""0_\21""0_\21""0_\21/^\20""3[\16/^\20" - "/^\20-\\\16""3[\16""2Z\15""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""2Z\15""2" - "Z\15""0Y\24.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22*T\16*T\16*T\16*T" - "\16*T\16""0R\16*T\16""0R\16*T\16*T\16*T\16*T\16""0R\16*T\16""0R\16*T" - "\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16-V\22-V\22" - "-V\22-V\22.W\23.W\23.W\23\240\264\224\240\264\224\240\264\224\240\264" - "\224\240\264\224\240\264\224\240\264\224\247\273\233\313\326\304\373" - "\375\372\376\377\374\376\377\374\263\303\251\242\266\226/^\20""0_\21" - "0_\21\202\320q\202\320q2a\23""3b\24""3b\24\0\0\34:\5\34:\5\31""9\13\32" - "8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4\5\24""4\5\23""3" - "\3\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\25""0\10\30""1\1\30" - "1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\30""1\1\30""1\1\23""3" - "\3\30""1\1\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\24""4\5\24""4\5:U" - ",\341\344\340\376\377\374\327\336\323&\77\23\27""7\10\27""7\10\27""7" - "\10\202\320q\202\320q\31""9\13\34:\5\34:\5\0\0""3b\24""3b\24""2a\23""2" - "a\23""2a\23""2a\23""0_\21""0_\21""0_\21""0_\21""3[\16/^\20/^\20/^\20" - "-\\\16""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24" - "2Z\15""0Y\24.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22*T\16*T\16*T\16*" - "T\16*T\16""0R\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16" - "*T\16*T\16""0R\16*T\16*T\16*T\16*T\16""0R\16*T\16-V\22-V\22-V\22-V\22" - ".W\23.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24" - "0Y\24""2Z\15-\\\16-\\\16m\217[\376\377\374\376\377\374\236\257\2123[" - "\16""0_\21""2a\23\202\320q\202\320q3b\24""3b\24""7e\17\0\0\34:\5\34:" - "\5\31""9\13\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4\5\24""4" - "\5\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\30""1\1\30" - "1\1\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25""0\10\25""0\10\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\30""1" - "\1\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3\24""4\5\24" - "4\5\25""5\6\25""5\6\27""7\10:U,\376\377\374\376\377\374\324\332\317\27" - "7\10\27""7\10\32""8\2\202\320q\202\320q\34:\5\31""9\13\27=\7\0\0""3b" - "\24""3b\24""2a\23""2a\23""2a\23""0_\21""0_\21""3[\16""0_\21/^\20""3[" - "\16/^\20/^\20""3[\16-\\\16""0Y\24""2Z\15""2Z\15""0Y\24""2Z\15""2Z\15" - "0Y\24""2Z\15""0Y\24.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22" - "*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16" - "0R\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16-V\22-V\22-V\22-" - "V\22-V\22.W\23.W\23.W\23""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2" - "Z\15""2Z\15""2Z\15""3[\16-\\\16/^\20""3[\16\222\253\204\376\377\374\376" - "\377\374\366\370\3640_\21""2a\23""2a\23\202\320q\202\320q3b\24""5d\26" - "5d\26\0\0\34:\5\31""9\13\32""8\2\31""9\13\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5" - "\6\24""4\5\24""4\5\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\30" - "1\1\25""0\10\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10" - "\30""1\1\30""1\1\30""1\1\30""1\1\23""3\3\27""1\12\230\242\221\230\242" - "\221\225\245\214\230\242\221\230\242\221\230\242\221\225\245\214\230" - "\242\221\243\256\234\310\317\304\376\377\374\376\377\374\376\377\374" - "\367\371\366\31""9\13\32""8\2\31""9\13\202\320q\202\320q\27""8\11\27" - "=\7\27=\7\0\0""3b\24""2a\23""2a\23""2a\23""0_\21""3[\16""0_\21""0_\21" - "3[\16""3[\16/^\20/^\20""3[\16-\\\16-\\\16""0Y\24""2Z\15""2Z\15""0Y\24" - "2Z\15""0Y\24""2Z\15""0Y\24""2Z\15.W\23.W\23.W\23.W\23-V\22-V\22-V\22" - "-V\22-V\22*T\16*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16-V\22-V\22-V" - "\22-V\22-V\22.W\23.W\23.W\23.W\23""2Z\15""0Y\24""0Y\24""0Y\24\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\336\344\3312a\23""2a\23""3b\24\202\320q\202\320q5d\26""5" - "d\26""7e\17\0\0\32""8\2\31""9\13\32""8\2\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\25""5\6\24""4" - "\5\24""4\5\27""1\12\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\23" - "3\3\30""1\1\25""0\10\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0" - "\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1" - "\1\25""0\10\23""3\3\23""3\3\30""1\1\23""3\3\27""1\12\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\207\226~\32""8\2\31""9\13\34:\5\202\320q\202\320q\27=\7\30>\10\30" - ">\10\0\0""2a\23""2a\23""2a\23""0_\21""0_\21""3[\16""0_\21/^\20""3[\16" - "/^\20/^\20-\\\16""3[\16-\\\16""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y" - "\24""0Y\24""2Z\15""0Y\24.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22" - "-V\22*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16-V\22-V\22-V\22-V\22.W" - "\23.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\311\324\3025d\26""2a\23""3b\24""3b\24\202\320q\202\320q5d\26""7e\17" - "7e\17\0\0\27""8\11\32""8\2\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\25""5\6\24""4\5\24""4" - "\5\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12\30" - "1\1\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25""0\10\30""1\1\23""3" - "\3\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\373\375\372\355\357\353\302\311\276q\204f\35;\6\32""8\2" - "\27""8\11\34:\5\31""9\13\202\320q\202\320q\30>\10\30>\10\32\77\12\0\0" - "2a\23""2a\23""0_\21""0_\21""3[\16""0_\21""3[\16/^\20""3[\16/^\20-\\\16" - "3[\16-\\\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0" - "Y\24""0Y\24.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22*T\16""0" - "R\16*T\16*T\16*T\16""0R\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16" - "*T\16*T\16*T\16*T\16-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""3[\16" - "-\\\16/^\20""3[\16/^\20""3[\16/^\20""0_\21""0_\21""0_\21""2a\23""2a\23" - "3b\24""3b\24""5d\26\202\320q\202\320q7e\17""5d\26""9g\21\0\0\31""9\13" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\25""5\6\25""5\6\24""4\5\24""4\5\23""3\3\27""1\12\30""1\1" - "\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\25""0\10\25""0\10\30""1\1\30" - "1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\23""3\3\23""3\3\30""1" - "\1\23""3\3\23""3\3\30""1\1\23""3\3\24""4\5\24""4\5\25""5\6\25""5\6\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31" - "9\13\32""8\2\31""9\13\34:\5\34:\5\27=\7\202\320q\202\320q\30>\10\32\77" - "\12\32\77\12\0\0""2a\23""0_\21""0_\21""0_\21""0_\21/^\20/^\20/^\20""3" - "[\16-\\\16-\\\16-\\\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y" - "\24""2Z\15""0Y\24""2Z\15.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22" - "-V\22*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16" - "*T\16*T\16""0R\16*T\16""0R\16-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23" - ".W\23.W\23""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2" - "Z\15""0Y\24-\\\16-\\\16/^\20/^\20""3[\16""3[\16""3[\16""0_\21""0_\21" - "0_\21""2a\23""2a\23""3b\24""3b\24""3b\24""7e\17\202\320q\202\320q7e\17" - "9g\21""9g\21\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\25""5\6\24""4\5\23""3\3\23" - "3\3\23""3\3\23""3\3\27""1\12\30""1\1\23""3\3\23""3\3\25""0\10\30""1\1" - "\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\30""1\1\30""1\1\30""1\1\30""1\1\30""1\1\27""1\12" - "\23""3\3\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3\24""4\5\24""4\5\25" - "5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\32""8\2\31""9\13\34:\5\27""8\11\34:\5\27=\7\27=\7\202\320" - "q\202\320q\32\77\12\32\77\12\32\77\12\0\0""0_\21""0_\21""3[\16""0_\21" - "/^\20/^\20""3[\16/^\20""0Y\24-\\\16-\\\16""0Y\24""2Z\15""0Y\24""2Z\15" - "0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24.W\23.W\23.W\23.W\23.W\23-V\22" - "-V\22-V\22-V\22-V\22*T\16*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16""0R\16*T\16*T\16-V\22-V\22-V\22-V\22-V\22-V\22-V" - "\22.W\23.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0" - "Y\24""2Z\15""0Y\24""2Z\15""3[\16/^\20""3[\16/^\20""3[\16""4c\25\221\252" - "\202\336\344\331\371\373\370\361\363\360\316\327\277p\217V3b\24""3b\24" - "3b\24""5d\26""7e\17\202\320q\202\320q9g\21""5k\24""4j\23\0\0\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5" - "\6\25""5\6\24""4\5\24""4\5\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3" - "\23""3\3\27""1\12\23""3\3\23""3\3\25""0\10\30""1\1\25""0\10\30""1\1\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25/\7\25/\7\25/\7\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1" - "\1\30""1\1\30""1\1\25""0\10\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3" - "\27""1\12\23""3\3\30""1\1\33;\15\216\235\205\331\343\336\371\373\370" - "\356\360\355\252\265\2434H\"\31""9\13\270\306\271\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374|\217p\34:\5\27=" - "\7\27=\7\30>\10\202\320q\202\320q\32\77\12\32\77\12\36B\5\0\0""0_\21" - "3[\16""0_\21""3[\16/^\20""3[\16/^\20-\\\16""3[\16""3[\16""2Z\15""0Y\24" - "0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24.W\23.W\23.W\23" - ".W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22""0R\16*T\16*T\16*T\16*T\16*" - "T\16*T\16*T\16*T\16*T\16""0R\16*T\16""0R\16*T\16-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""2Z\15" - "0Y\24""0Y\24""0Y\24""3[\16\305\320\276\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\341\347\334\221\252\202\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\371\373\370Nw15d\26""7e\17""7e\17\202\320q\202\320q4j\23""9g\21""4j" - "\23\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10" - "\25""5\6\25""5\6\25""5\6\24""4\5\23""3\3\30""1\1\23""3\3\27""1\12\23" - "3\3\27""1\12\23""3\3\23""3\3\27""1\12\30""1\1\25""0\10\30""1\1\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7" - "\25/\7\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10" - "\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\27""1\12\23""3\3\23""3\3\27" - "1\12\23""3\3\23""3\3\23""3\3\24""4\5]pS\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\373\375\372\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\212\240\206\27=\7\27=\7\30>\10\202\320q\202" - "\320q\32\77\12\32\77\12\32\77\12\0\0""3[\16/^\20/^\20""3[\16/^\20""3" - "[\16-\\\16-\\\16""0Y\24""2Z\15""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22*T\16*T\16*T\16*T\16*T\16*T\16""0R\16*T\16*T\16*" - "T\16-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""2Z\15\263\303" - "\251\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\311\321\271" - "\247\273\233\321\334\312\376\377\374\376\377\374\376\377\374\316\331" - "\3077e\17""7e\17""7e\17\202\320q\202\320q5k\24""9g\21""5k\24\0\0\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5\6\25""5\6\25""5" - "\6\24""4\5\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3" - "\27""1\12\27""1\12\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25/\7" - "\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\30" - "1\1\25""0\10\30""1\1\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12" - "\23""3\3\23""3\3\24""4\5\24""4\5\341\344\340\376\377\374\376\377\374" - "\371\373\370\252\265\243\252\265\243\370\372\367\376\377\374\376\377" - "\374\376\377\374\216\235\205\31""9\13\32""8\2\31""9\13\252\265\243\376" - "\377\374\376\377\374\352\354\351\30>\10\30>\10\30>\10\202\320q\202\320" - "q\36B\5\32\77\12\36B\5\0\0""0_\21""3[\16/^\20""3[\16""3[\16-\\\16""3" - "[\16""3[\16""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22*T\16""0R\16*T\16*T\16*T\16*T\16*T\16*T\16-V\22-V\22-" - "V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23""2Z\15""0Y\24" - "2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15\361\363" - "\360\376\377\374\376\377\374\213\241u3[\16/^\20\203\240s\376\377\374" - "\376\377\374\376\377\374Jt.2a\23""2a\23""3b\24b\207G\376\377\374\376" - "\377\374\371\373\3707e\17""5d\26""7f\30\202\320q\202\320q5k\24""9g\21" - "5k\24\0\0\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\25""5\6\25""5" - "\6\24""4\5\24""4\5\24""4\5\27""1\12\23""3\3\23""3\3\23""3\3\30""1\1\23" - "3\3\27""1\12\23""3\3\25""0\10\25""0\10\30""1\1\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25/\7\25/\7\25/\7\25/\7\25/\7\25/\7\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25" - "0\10\30""1\1\25""0\10\23""3\3\30""1\1\23""3\3\30""1\1\23""3\3\30""1\1" - "\23""3\3\23""3\3\23""3\3\24""4\5\24""4\5\25""5\6\373\375\372\376\377" - "\374\376\377\374:U,\27""7\10\27""7\10:U,\376\377\374\376\377\374\376" - "\377\374\35;\6\31""9\13\34:\5\34:\5""8S*\376\377\374\376\377\374\376" - "\377\374\30>\10\30>\10\32\77\12\202\320q\202\320q\32\77\12\32\77\12\36" - "B\5\0\0/^\20/^\20/^\20""3[\16-\\\16""0Y\24-\\\16""0Y\24""2Z\15""0Y\24" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23.W\23" - ".W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22""0R\16*T\16*" - "T\16*T\16*T\16-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23" - ".W\23.W\23.W\23.W\23""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24" - "2Z\15""0Y\24""2Z\15""0Y\24-\\\16\376\377\374\376\377\374\376\377\374" - "Mq23[\16""0_\21Jt.\376\377\374\376\377\374\376\377\3742a\23""2a\23""3" - "b\24""3b\24Nw1\376\377\374\376\377\374\376\377\3747e\17""7f\30""9g\21" - "\202\320q\202\320q5k\24""9g\21""5k\24\0\0\27""7\10\27""7\10\27""7\10" - "\27""7\10\25""5\6\25""5\6\24""4\5\24""4\5\30""1\1\27""1\12\23""3\3\27" - "1\12\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12\30""1\1\25""0\10\25""0" - "\10\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\30""1\1\25""0\10\25""0\10\30""1\1\30""1\1\23""3" - "\3\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\23""3\3\24" - "4\5\25""5\6\25""5\6\25""5\6\376\377\374\376\377\374\376\377\3744O'\27" - "7\10\27""7\10""5P(\376\377\374\376\377\374\376\377\374\32""8\2\34:\5" - "\34:\5\34:\5""5U%\376\377\374\376\377\374\376\377\374\30>\10\32\77\12" - "\32\77\12\202\320q\202\320q\36B\5\32\77\12\36B\5\0\0""3[\16/^\20/^\20" - "0Y\24-\\\16-\\\16""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24.W\23.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23""2Z\15""0Y\24" - "2Z\15""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15""3[\16-\\\16""3" - "[\16\376\377\374\376\377\374\376\377\374\261\276\237\242\266\226\242" - "\266\226\261\276\237\376\377\374\376\377\374\376\377\374\244\270\230" - "\247\271\223\244\270\230\247\271\223\255\302\241\376\377\374\376\377" - "\374\376\377\3745d\26""7f\30""5k\24\202\320q\202\320q4j\23""4j\23""5" - "k\24\0\0\27""7\10\27""7\10\25""5\6\25""5\6\25""5\6\24""4\5\24""4\5\23" - "3\3\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12" - "\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25""0\10\30" - "1\1\25""0\10\30""1\1\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3" - "\23""3\3\23""3\3\23""3\3\24""4\5\25""5\6\25""5\6\25""5\6\27""7\10\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\32\77\12\32\77\12\32\77\12\202\320q\202\320q\36B\5\32\77\12" - "\36B\5\0\0""0Y\24/^\20""3[\16-\\\16""3[\16""2Z\15""2Z\15""2Z\15""2Z\15" - "0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23.W\23.W\23." - "W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23" - ".W\23""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15" - "2Z\15""0Y\24-\\\16""3[\16-\\\16/^\20\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\3747f\30""5k\24""9g\21\202" - "\320q\202\320q5k\24""4j\23""9g\21\0\0\27""7\10\25""5\6\25""5\6\25""5" - "\6\24""4\5\24""4\5\30""1\1\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\30" - "1\1\23""3\3\27""1\12\23""3\3\30""1\1\25""0\10\25""0\10\30""1\1\30""1" - "\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30" - "1\1\25""0\10\30""1\1\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3" - "\23""3\3\23""3\3\23""3\3\30""1\1\24""4\5\24""4\5\24""4\5\25""5\6\25""5" - "\6\27""7\10\27""7\10\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\32\77\12\36B\5\32\77\12\202\320q\202" - "\320q\36B\5\32\77\12\32\77\12\0\0-\\\16-\\\16""3[\16""2Z\15""0Y\24""2" - "Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24." - "W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23" - ".W\23.W\23.W\23.W\23.W\23""2Z\15""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2" - "Z\15""0Y\24""2Z\15""2Z\15""2Z\15""0Y\24-\\\16""3[\16/^\20""3[\16\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\3747f\30""4j\23""9g\21\202\320q\202\320q9g\21""9g\21""9g\21\0\0" - "\25""5\6\25""5\6\24""4\5\24""4\5\24""4\5\27""1\12\23""3\3\27""1\12\30" - "1\1\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\25""0\10\30""1\1\25""0\10" - "\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\30""1\1\30""1\1\23""3\3" - "\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\24""4\5\24" - "4\5\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\32""8\2\31""9\13\34:" - "\5\34:\5\27""8\11\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\32" - "\77\12\32\77\12\202\320q\202\320q\32\77\12\32\77\12\32\77\12\0\0-\\\16" - "2Z\15""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24" - "0Y\24""0Y\24.W\23.W\23.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-" - "V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22.W\23""2Z\15.W\23.W\23.W\23""2Z\15""0Y\24""2Z\15""0Y\24" - "0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15-\\\16""0Y\24-\\\16""3" - "[\16/^\20/^\20""3[\16/^\20""3[\16""0_\21""3[\16""0_\21""2a\23""2a\23" - "2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17""7e\17""5d\26" - "9g\21""4j\23""5k\24""9g\21\202\320q\202\320q4j\23""9g\21""5k\24\0\0\25" - "5\6\24""4\5\24""4\5\24""4\5\23""3\3\23""3\3\27""1\12\30""1\1\23""3\3" - "\23""3\3\27""1\12\23""3\3\23""3\3\25""0\10\30""1\1\30""1\1\30""1\1\30" - "1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30" - "1\1\30""1\1\30""1\1\30""1\1\30""1\1\30""1\1\23""3\3\23""3\3\23""3\3\27" - "1\12\30""1\1\23""3\3\23""3\3\27""1\12\24""4\5\24""4\5\25""5\6\25""5\6" - "\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\31""9\13\31""9\13\32""8\2\27""8\11\34:\5\31""9" - "\13\27=\7\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5" - "\32\77\12\202\320q\202\320q\32\77\12\32\77\12\36B\5\0\0-\\\16""0Y\24" - "2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24" - "2Z\15.W\23""2Z\15.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-" - "V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - ".W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""0" - "Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24-\\\16""3[\16/^\20""3[" - "\16/^\20""3[\16""3[\16""0_\21""3[\16""0_\21""0_\21""2a\23""2a\23""2a" - "\23""2a\23""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17""7e\17""7e\17""7" - "f\30""9g\21""9g\21""5k\24""9g\21\202\320q\202\320q4j\23""9g\21""5k\24" - "\0\0\25""5\6\24""4\5\24""4\5\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3" - "\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\25""0\10\30""1\1\30""1\1\25" - "0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\25" - "0\10\25""0\10\30""1\1\25""0\10\25""0\10\23""3\3\30""1\1\23""3\3\23""3" - "\3\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\24""4\5\24""4\5\24""4\5\25" - "5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\32""8\2\27""8\11q\204f\304\313\300\356\360\355" - "\373\375\372\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\32\77\12\32\77\12\36B\5\202" - "\320q\202\320q\36B\5\32\77\12\32\77\12\0\0""0Y\24""2Z\15""0Y\24""0Y\24" - "0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15.W\23.W\23.W\23" - ".W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23" - ".W\23""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24" - "0Y\24""2Z\15""2Z\15""3[\16-\\\16/^\20""3[\16/^\20""0Y\24""3[\16""0_\21" - "3[\16""0_\21""0_\21""2a\23""5d\26\311\321\271\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\3749g\21""5k\24""4j" - "\23\202\320q\202\320q4j\23""9g\21""4j\23\0\0\24""4\5\27""1\12\23""3\3" - "\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\23""3\3\30""1\1\23""3\3\30" - "1\1\25""0\10\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\27""1" - "\12\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3" - "\27""1\12\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\210" - "\227\177\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\32\77\12\32\77\12\36B\5\202\320q\202\320" - "q\32\77\12\32\77\12\36B\5\0\0""2Z\15""0Y\24""2Z\15""2Z\15""0Y\24""0Y" - "\24""0Y\24""2Z\15""0Y\24""0Y\24.W\23.W\23.W\23.W\23.W\23.W\23.W\23-V" - "\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""0" - "Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""3" - "[\16-\\\16-\\\16/^\20/^\20/^\20/^\20""3[\16""0_\21""3[\16""0_\21""3[" - "\16""2a\23""2a\23\336\344\331\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\3744j\23""9g\21""4j\23\202" - "\320q\202\320q9g\21""4j\23""4j\23\0\0\23""3\3\30""1\1\23""3\3\23""3\3" - "\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\25""0\10\30""1\1\25" - "0\10\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30" - "1\1\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\27""1\12\23""3\3\30""1" - "\1\23""3\3\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3\24""4\5" - "\24""4\5\24""4\5\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\367\371" - "\366\376\377\374\376\377\374\376\377\374\306\315\302\236\261\235\236" - "\261\235\230\247\216\231\250\217\231\250\217\231\250\217\231\250\217" - "\232\251\220\231\250\217\32\77\12\32\77\12\32\77\12\202\320q\202\320" - "q\32\77\12\32\77\12\32\77\12\0\0""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0" - "Y\24""0Y\24""0Y\24""2Z\15""0Y\24.W\23.W\23""2Z\15.W\23.W\23.W\23-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""2Z\15""0Y" - "\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""2" - "Z\15""0Y\24-\\\16/^\20""3[\16/^\20/^\20/^\20""3[\16""0_\21""0_\21""0" - "_\21""0_\21""2a\23""2a\23\366\370\364\376\377\374\376\377\374\222\253" - "\2045d\26""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""7f\30""4j\23""9" - "g\21""5k\24""9g\21""4j\23\202\320q\202\320q9g\21""4j\23""9g\21\0\0\27" - "1\12\23""3\3\30""1\1\23""3\3\23""3\3\27""1\12\27""1\12\23""3\3\23""3" - "\3\25""0\10\30""1\1\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\30""1\1\25""0\10\25""0\10\30""1\1\30""1\1\30""1\1\25""0" - "\10\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3\27""1\12\27""1\12\23""3" - "\3\30""1\1\30""1\1\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32" - "8\2\32""8\2\31""9\13\321\327\314\376\377\374\376\377\374\10\30>\10\32\77\12\32\77\12\32\77\12\36B\5\32\77" - "\12\32\77\12\32\77\12\202\320q\202\320q\32\77\12\32\77\12\32\77\12\0" - "\0""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24.W\23.W\23" - ".W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23" - ".W\23.W\23.W\23""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y" - "\24""0Y\24""2Z\15""0Y\24-\\\16-\\\16""0Y\24/^\20""3[\16/^\20""3[\16/" - "^\20""0_\21""3[\16""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23\227\260" - "\210\376\377\374\376\377\374r\224`5d\26""5d\26""5d\26""5d\26""7e\17""5" - "d\26""9g\21""9g\21""4j\23""4j\23""9g\21""5k\24""9g\21\202\320q\202\320" - "q5k\24""9g\21""5k\24\0\0\27""1\12\23""3\3\23""3\3\27""1\12\23""3\3\27" - "1\12\23""3\3\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\30""1\1\25""0" - "\10\30""1\1\25""0\10\23""3\3\30""1\1\23""3\3\27""1\12\23""3\3\23""3\3" - "\27""1\12\23""3\3\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25" - "5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\32""8\2\32""8\2\31""9\13\31""9\13\"B\24\327\336\323\376" - "\377\374\345\347\344@[2\27=\7\27=\7\30>\10\30>\10\32\77\12\32\77\12\32" - "\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\202\320q\202\320" - "q\32\77\12\36B\5\32\77\12\0\0""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y" - "\24""0Y\24.W\23.W\23.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - ".W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24-\\\16/^" - "\20""3[\16/^\20/^\20""3[\16""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23" - "2a\23""2a\23""3b\24\244\270\230\266\304\244\376\377\374\376\377\374\373" - "\375\372\316\331\307\254\300\237\244\270\230\242\273\223\247\271\223" - "\247\271\223\243\274\224\247\271\223\243\274\2244j\23""9g\21""9g\21\202" - "\320q\202\320q9g\21""4j\23""4j\23\0\0\23""3\3\30""1\1\27""1\12\23""3" - "\3\23""3\3\27""1\12\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\30""1\1" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\30""1\1\30""1" - "\1\30""1\1\30""1\1\27""1\12\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3" - "\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12\24""4\5\24""4\5\24""4\5\25" - "5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\31""9\13\34:\5\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\36B\5\32\77\12\32\77\12\202\320q\202\320q\32" - "\77\12\32\77\12\36B\5\0\0""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24." - "W\23.W\23.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23" - ".W\23.W\23.W\23""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z" - "\15""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""3[\16/^\20/^\20" - "/^\20""3[\16/^\20""0_\21""3[\16""0_\21""0_\21""3[\16""2a\23""2a\23""2" - "a\23""2a\23""3b\24\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\3744j\23""5k\24""9g\21\202" - "\320q\202\320q5k\24""9g\21""4j\23\0\0\27""1\12\23""3\3\30""1\1\23""3" - "\3\27""1\12\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10" - "\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\30""1\1\30""1" - "\1\30""1\1\27""1\12\23""3\3\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3" - "\23""3\3\30""1\1\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5" - "\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\32""8\2\31""9\13\32""8\2\31""9\13\34:\5\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\32\77\12\36B\5\32\77\12\202\320q\202\320q\32" - "\77\12\32\77\12\32\77\12\0\0""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24.W\23" - ".W\23.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23" - ".W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z" - "\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""3[\16-\\\16/^\20/^\20""3[\16" - "/^\20/^\20""3[\16""0_\21""0_\21""3[\16""0_\21""2a\23""2a\23""2a\23""2" - "a\23""3b\24""3b\24\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\3744j\23""5k\24""9g\21\202" - "\320q\202\320q4j\23""9g\21""5k\24\0\0\23""3\3\23""3\3\23""3\3\27""1\12" - "\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\25""0" - "\10\23""3\3\23""3\3\30""1\1\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3\27" - "1\12\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\31""9\13\32""8\2\32""8\2\34:\5\34:\5\31""9\13\34:\5\27=" - "\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\202\320q\202\320" - "q\36B\5\32\77\12\32\77\12\0\0""0Y\24""2Z\15""0Y\24.W\23.W\23.W\23.W\23" - ".W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24" - "2Z\15""2Z\15""0Y\24""0Y\24""3[\16-\\\16/^\20/^\20/^\20""3[\16/^\20/^" - "\20""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""3b\24""3" - "b\24""3b\24""3b\24""7e\17""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21""9" - "g\21""4j\23""9g\21""9g\21""5k\24""5k\24""9g\21""4j\23""9g\21\202\320" - "q\202\320q4j\23""5k\24""4j\23\0\0\23""3\3\30""1\1\30""1\1\25""0\10\30" - "1\1\25""0\10\30""1\1\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25" - "0\10\30""1\1\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\23""3\3\27""1\12" - "\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\30""1\1\27""1\12\23""3\3\23" - "3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31""9" - "\13\32""8\2\32""8\2\31""9\13\31""9\13\34:\5\34:\5\27""8\11\27=\7\27=" - "\7\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\32\77\12\36B\5\32\77\12\36B\5\32\77\12\202\320q\202\320q\32\77\12" - "\32\77\12\36B\5\0\0""2Z\15""0Y\24.W\23.W\23.W\23.W\23.W\23.W\23.W\23" - ".W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24" - "0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""2Z\15" - "2Z\15""0Y\24-\\\16""0Y\24/^\20/^\20""3[\16/^\20""3[\16/^\20/^\20""0_" - "\21""0_\21""0_\21""3[\16""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3" - "b\24""5d\26""5d\26""7e\17""5d\26W\201:\210\245w\231\262\213\247\271\223" - "Cr$5k\24""4j\23""4j\23""9g\21""5k\24""5k\24""4j\23""4j\23\202\320q\202" - "\320q9g\21""4j\23""5k\24\0\0\23""3\3\23""3\3\30""1\1\25""0\10\30""1\1" - "\30""1\1\30""1\1\25""0\10\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25" - "0\10\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\27""1\12\23""3\3\23""3" - "\3\30""1\1\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\30""1\1\24""4\5\24" - "4\5\24""4\5\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\31" - "9\13\32""8\2\31""9\13\34:\5\27""8\11\34:\5\34:\5\27=\7\27=\7C^5\313\321" - "\306\376\377\374\376\377\374\376\377\374\376\377\3747W(r\212e\376\377" - "\374\376\377\374\341\347\334\33A\14\32\77\12\36B\5\32\77\12\202\320q" - "\202\320q\32\77\12\32\77\12\36B\5\0\0""0Y\24.W\23.W\23.W\23.W\23.W\23" - ".W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23""2" - "Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24-\\\16""3[\16-\\\16""3[\16/^\20""3[\16/^\20""3[\16" - "/^\20""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""3b\24" - "3b\24""3b\24""3b\24""3b\24""5d\26c\210H\366\370\364\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374Nw1Cr$\364\367\363\376\377\374" - "\376\377\374h\214L4j\23""5k\24""9g\21\202\320q\202\320q9g\21""4j\23""9" - "g\21\0\0\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\30""1\1\25" - "0\10\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\30""1" - "\1\25""0\10\23""3\3\23""3\3\27""1\12\30""1\1\27""1\12\23""3\3\23""3\3" - "\23""3\3\23""3\3\27""1\12\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25" - "5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\31""9\13\32""8\2\31""9\13\32""8\2\27""8\11\34" - ":\5\27""8\11\34:\5\34:\5'E\20\350\352\347\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\3747W(\32\77\12\262\275\253" - "\376\377\374\376\377\374\217\245\213\36B\5\32\77\12\32\77\12\202\320" - "q\202\320q\32\77\12\36B\5\32\77\12\0\0.W\23.W\23.W\23.W\23.W\23.W\23" - ".W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""2" - "Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24""2" - "Z\15""0Y\24""0Y\24-\\\16-\\\16-\\\16""3[\16/^\20""3[\16/^\20/^\20/^\20" - "0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24" - "3b\24""3b\24""5d\26\221\247{\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374N}/9g\21\210\243p\376\377" - "\374\376\377\374\316\327\2779g\21""4j\23""9g\21\202\320q\202\320q5k\24" - "5k\24""4j\23\0\0\30""1\1\25""0\10\30""1\1\30""1\1\30""1\1\25""0\10\30" - "1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\30""1\1\25""0" - "\10\25""0\10\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3\27""1\12\30""1" - "\1\23""3\3\23""3\3\23""3\3\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25" - "5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\31""9\13\32""8\2\31""9\13\32""8\2\32""8\2\34:" - "\5\27""8\11\34:\5\34:\5\27=\7\310\317\304\376\377\374\376\377\374\324" - "\332\3173S$\376\377\374\376\377\374\376\377\3747W(\36B\5Ok@\376\377\374" - "\376\377\374\347\351\346\36B\5\32\77\12\32\77\12\202\320q\202\320q\32" - "\77\12\36B\5\32\77\12\0\0.W\23.W\23.W\23.W\23.W\23.W\23.W\23-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23" - ".W\23.W\23.W\23.W\23.W\23.W\23""2Z\15.W\23""0Y\24""0Y\24""2Z\15""0Y\24" - "0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15" - "3[\16-\\\16-\\\16""3[\16/^\20""3[\16/^\20/^\20/^\20""0_\21""0_\21""0" - "_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""5" - "d\26""5d\26\360\362\357\376\377\374\376\377\374s\222Y7e\17\376\377\374" - "\376\377\374\376\377\374V\17794j\23V\1779\376\377\374\376\377\374\370" - "\372\3675k\24""9g\21""5k\24\202\320q\202\320q9g\21""5k\24""9g\21\0\0" - "\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\25""0\10\25" - "0\10\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\23""3\3\23""3\3\23""3\3" - "\23""3\3\30""1\1\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\30""1\1\24""4" - "\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\31""9\13\32""8\2\32""8\2\31""9\13\34:\5\27""8\11\34:\5\34:\5\27=" - "\7\27=\7\372\374\371\376\377\374\376\377\3749Y)\32\77\12\376\377\374" - "\376\377\374\376\377\3747W(\32\77\12\77_/\376\377\374\376\377\374\371" - "\373\370\32\77\12\32\77\12\36B\5\202\320q\202\320q\32\77\12\32\77\12" - "\32\77\12\0\0.W\23.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23" - ".W\23.W\23.W\23.W\23""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15" - "0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15""2Z\15""0Y\24-\\\16-\\\16""3" - "[\16/^\20/^\20/^\20""3[\16""3[\16""0_\21""0_\21""0_\21""0_\21""3[\16" - "2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26" - "5d\26\361\363\360\376\377\374\376\377\374d\211I9g\21\376\377\374\376" - "\377\374\376\377\374N}/4j\23|\234b\376\377\374\376\377\374\355\357\353" - "5k\24""9g\21""4j\23\202\320q\202\320q5k\24""9g\21""5k\24\0\0\30""1\1" - "\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\30""1" - "\1\30""1\1\25""0\10\30""1\1\25""0\10\27""1\12\23""3\3\27""1\12\23""3" - "\3\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\30""1\1\24" - "4\5\24""4\5\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\31" - "9\13\32""8\2\27""8\11\32""8\2\34:\5\31""9\13\27""8\11\34:\5\27=\7\27" - "=\7\27=\7\321\327\314\376\377\374\376\377\374\236\261\235\32\77\12\376" - "\377\374\376\377\374\376\377\3747V\40\40E\20\324\332\317\376\377\374" - "\376\377\374\313\321\306\36B\5\32\77\12\32\77\12\202\320q\202\320q\32" - "\77\12\32\77\12\32\77\12\0\0.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23" - ".W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24" - "0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""3[\16" - "0Y\24-\\\16/^\20/^\20""3[\16/^\20""3[\16/^\20""0_\21""0_\21""0_\21""0" - "_\21""2a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""7" - "e\17""5d\26""5d\26\240\271\221\376\377\374\376\377\374\376\377\374\261" - "\306\245\376\377\374\376\377\374\376\377\374\240\271\221\341\347\334" - "\376\377\374\376\377\374\376\377\374\233\264\2155k\24""4j\23""9g\21\202" - "\320q\202\320q4j\23""9g\21""4j\23\0\0\30""1\1\30""1\1\30""1\1\25""0\10" - "\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\25" - "0\10\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\25""0" - "\10\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3" - "\27""1\12\23""3\3\23""3\3\27""1\12\24""4\5\24""4\5\24""4\5\25""5\6\25" - "5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\31""9\13\31""9\13\31" - "9\13\34:\5\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7""9Y)\373\375\372\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\372\374\3717V\40\32" - "\77\12\32\77\12\32\77\12\202\320q\202\320q\32\77\12\32\77\12\32\77\12" - "\0\0.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23" - "0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24" - "0Y\24""2Z\15""2Z\15""0Y\24""3[\16-\\\16-\\\16""3[\16/^\20""0Y\24""3[" - "\16/^\20/^\20""0_\21""0_\21""0_\21""3[\16""0_\21""0_\21""2a\23""2a\23" - "2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""7e\17""5d\26" - "5d\26\231\262\213\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\232\261\2049g\21""9g\21""4j\23""9g\21\202\320q\202\320q5k\24""9g\21" - "9g\21\0\0\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1\1\30""1\1\25""0" - "\10\30""1\1\30""1\1\25""0\10\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3" - "\30""1\1\23""3\3\30""1\1\23""3\3\30""1\1\23""3\3\23""3\3\24""4\5\30""1" - "\1\24""4\5\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8" - "\2\32""8\2\31""9\13\32""8\2\27""8\11\34:\5\27""8\11\34:\5\27=\7\27=\7" - "\27=\7\27=\7\27=\7\30>\10\32\77\12\234\253\222\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\234\253\222\36B\5\32\77\12\32\77\12\36B\5\32\77\12\202\320q\202" - "\320q\36B\5\32\77\12\32\77\12\0\0.W\23.W\23.W\23.W\23-V\22-V\22-V\22" - "-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22.W\23.W\23.W\23.W\23" - ".W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""2" - "Z\15""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""2Z\15-\\\16""0Y\24-\\" - "\16""3[\16""3[\16/^\20/^\20""3[\16/^\20""0_\21""0_\21""0_\21""0_\21""0" - "_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""5" - "d\26""7e\17""5d\26""5d\26""5d\26""5d\26""7e\17""9g\21c\210H\264\310\247" - "\345\354\341\372\374\371\372\374\371\345\354\341\266\304\244`\214J5k" - "\24""4j\23""4j\23""5k\24""9g\21""4j\23\202\320q\202\320q4j\23""5k\24" - "9g\21\0\0\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10" - "\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\30""1" - "\1\30""1\1\25""0\10\23""3\3\23""3\3\30""1\1\23""3\3\27""1\12\23""3\3" - "\27""1\12\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\24""4\5\24""4\5\25" - "5\6\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\32" - "8\2\31""9\13\32""8\2\31""9\13\34:\5\31""9\13\34:\5\27""8\11\27=\7\27" - "=\7\35;\6\27=\7\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12Nj\77" - "\32\77\12\36B\5\32\77\12\202\320q\202\320q\32\77\12\36B\5\32\77\12\0" - "\0.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-V\22-" - "V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23""2Z\15.W\23""0Y\24""0Y\24" - "2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24" - "2Z\15""2Z\15""2Z\15-\\\16""3[\16-\\\16/^\20""3[\16/^\20""3[\16/^\20/" - "^\20/^\20""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2" - "a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26p\217V5d\26""5d\26""7e" - "\17""5d\26""7e\17""9g\21""9g\21""9g\21""5k\24""9g\21""5k\24""9g\21""4" - "j\23""9g\21""4j\23c\210H\363\365\3629g\21""4j\23""4j\23\202\320q\202" - "\320q9g\21""5k\24""9g\21\0\0\30""1\1\25""0\10\30""1\1\25""0\10\25""0" - "\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\25" - "0\10\25""0\10\30""1\1\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\30""1" - "\1\30""1\1\25""0\10\30""1\1\27""1\12\23""3\3\27""1\12\23""3\3\30""1\1" - "\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\23""3\3\30""1\1\24""4\5\24""4" - "\5\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8" - "\2\31""9\13\31""9\13\32""8\2\31""9\13\27""8\11\34:\5\34:\5\34:\5\27=" - "\7\27=\7\367\371\366QpJ\30>\10\30>\10\30>\10\32\77\12\32\77\12\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12Ef" - "5\360\362\357\376\377\374\32\77\12\32\77\12\36B\5\202\320q\202\320q\32" - "\77\12\32\77\12\32\77\12\0\0.W\23.W\23.W\23""2Z\15-V\22-V\22-V\22-V\22" - "-V\22-V\22-V\22.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23" - ".W\23""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15" - "0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15-\\\16""3[\16""0Y\24/^\20""3" - "[\16/^\20""0Y\24""3[\16/^\20""0_\21""0_\21""0_\21""0_\21""0_\21""0_\21" - "2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""7e\17" - "5d\26\376\377\374\367\371\366d\211I7e\17""5d\26""7f\30""9g\21""9g\21" - "5k\24""9g\21""5k\24""9g\21""5k\24""9g\21[\205>\363\362\351\376\377\374" - "\376\377\3749g\21""5k\24""4j\23\202\320q\202\320q4j\23""5k\24""4j\23" - "\0\0\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10\25""0\10\25""0" - "\10\25""0\10\25""0\10\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\30""1" - "\1\25""0\10\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1" - "\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\23""3\3\27""1\12\23""3\3\27" - "1\12\23""3\3\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\31""9\13\32""8\2\34:" - "\5\27""8\11\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\376\377\374\376\377\374" - "\363\365\362Lh=\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12" - "\32\77\12\32\77\12\32\77\12\77_/\355\357\353\376\377\374\376\377\374" - "\376\377\374\32\77\12\36B\5\32\77\12\202\320q\202\320q\36B\5\32\77\12" - "\36B\5\0\0.W\23.W\23.W\23.W\23.W\23-V\22-V\22-V\22-V\22.W\23.W\23.W\23" - ".W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""2Z\15""0Y" - "\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2" - "Z\15""2Z\15""0Y\24""3[\16""3[\16-\\\16""3[\16/^\20""3[\16/^\20""3[\16" - "3[\16""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23" - "2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""5d\26\376\377" - "\374\376\377\374\376\377\374\364\367\363b\207G9g\21""7f\30""5k\24""9" - "g\21""9g\21""4j\23""9g\21V\1779\355\357\353\376\377\374\376\377\374\376" - "\377\374\376\377\3745k\24""4j\23""4j\23\202\320q\202\320q9g\21""5k\24" - "5k\24\0\0\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1" - "\25""0\10\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10\25""0\10" - "\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\23""3\3\27""1\12\23""3\3\23" - "3\3\23""3\3\23""3\3\27""1\12\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3" - "\27""1\12\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\32""8\2\31""9\13\32""8\2\31""9\13\34:\5\34:\5" - "\27""8\11\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\363\365\362\376\377\374" - "\376\377\374\376\377\374\360\362\357C^5\32\77\12\32\77\12\32\77\12\32" - "\77\12\36B\5;[+\337\351\344\376\377\374\376\377\374\376\377\374\376\377" - "\374\270\303\261\36B\5\32\77\12\36B\5\202\320q\202\320q\32\77\12\32\77" - "\12\36B\5\0\0.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23""2Z\15.W\23.W\23" - ".W\23.W\23.W\23.W\23.W\23""2Z\15.W\23.W\23.W\23""0Y\24""0Y\24""0Y\24" - "0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24" - "0Y\24""2Z\15""0Y\24-\\\16""3[\16-\\\16/^\20/^\20""3[\16/^\20/^\20""3" - "[\16/^\20""3[\16""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""2" - "a\23""3b\24""3b\24""3b\24""3b\24""7e\17""5d\26""5d\26""7e\17""7e\17h" - "\214L\370\372\367\376\377\374\376\377\374\376\377\374\360\362\357Y\203" - "<9g\21""4j\23""9g\21T{/\347\356\343\376\377\374\376\377\374\376\377\374" - "\376\377\374\303\323\271@m\30""9g\21""5k\24""4j\23\202\320q\202\320q" - "4j\23""9g\21""4j\23\0\0\25""0\10\30""1\1\25""0\10\30""1\1\30""1\1\25" - "0\10\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\25""0\10\30""1\1\30""1" - "\1\30""1\1\25""0\10\30""1\1\25""0\10\30""1\1\27""1\12\23""3\3\23""3\3" - "\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3\23""3\3\27""1\12\23""3\3\23" - "3\3\30""1\1\23""3\3\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\32""8\2\32""8\2\31""9\13\32""8\2\34:\5\34:\5\34" - ":\5\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10YpL\367\371\366" - "\376\377\374\376\377\374\376\377\374\355\357\353\77_/\32\77\12""7V\40" - "\337\351\344\376\377\374\376\377\374\376\377\374\376\377\374\277\313" - "\270\40E\20\32\77\12\36B\5\32\77\12\32\77\12\202\320q\202\320q\32\77" - "\12\32\77\12\36B\5\0\0.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23." - "W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24""2Z\15""0" - "Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24""2Z\15-\\\16-\\\16""3[\16/^\20/^\20""3[\16/^\20/^" - "\20/^\20""0_\21""0_\21""0_\21""0_\21""0_\21""3[\16""2a\23""2a\23""2a" - "\23""2a\23""3b\24""3b\24""3b\24""3b\24""7e\17""7e\17""5d\26""7e\17""7" - "e\17""5d\26""7e\17""7e\17s\222Y\371\373\370\376\377\374\376\377\374\376" - "\377\374\352\361\346j\217N\344\353\340\376\377\374\376\377\374\376\377" - "\374\376\377\374\313\326\304@m\30""9g\21""5k\24""9g\21""4j\23""4j\23" - "\202\320q\202\320q4j\23""9g\21""4j\23\0\0\30""1\1\30""1\1\25""0\10\30" - "1\1\30""1\1\25""0\10\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\30""1\1" - "\25""0\10\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\23""3\3\23" - "3\3\23""3\3\23""3\3\30""1\1\30""1\1\23""3\3\30""1\1\23""3\3\23""3\3\23" - "3\3\23""3\3\24""4\5\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\32""8\2\31""9\13\31""9" - "\13\34:\5\31""9\13\34:\5\31""9\13\27=\7\27=\7\27=\7\27=\7\30>\10\30>" - "\10\35;\6\32\77\12\32\77\12d{V\372\374\371\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\304\322\305\"H\22\32\77\12\36B\5\32\77\12\32\77\12\36B\5\32\77\12\202" - "\320q\202\320q\32\77\12\32\77\12\36B\5\0\0.W\23.W\23.W\23.W\23.W\23." - "W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24" - "0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15" - "0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""3[\16-\\\16""3[\16-\\\16""3[\16/^" - "\20/^\20/^\20/^\20""3[\16""0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2" - "a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5" - "d\26""7e\17""7e\17""7e\17""5d\26""7e\17""9g\21""7f\30""4j\23|\234b\373" - "\375\372\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\321\334\312Cr$4j\23""9g\21""4j\23""5k\24""9g\21""4j\23""9" - "g\21\202\320q\202\320q4j\23""4j\23""9g\21\0\0\30""1\1\25""0\10\30""1" - "\1\30""1\1\30""1\1\30""1\1\30""1\1\30""1\1\25""0\10\30""1\1\30""1\1\30" - "1\1\25""0\10\30""1\1\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12\23""3" - "\3\23""3\3\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\23""3\3\23""3\3\23" - "3\3\27""1\12\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\31""9\13\32""8\2\32""8\2\32""8\2\34:\5" - "\27""8\11\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30" - ">\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12m\204_\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\321\327\314'E\20\32\77\12" - "\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\202\320" - "q\202\320q\32\77\12\32\77\12\36B\5\0\0.W\23.W\23.W\23.W\23.W\23.W\23" - ".W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23""0Y\24""0Y\24""2Z\15""0" - "Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0" - "Y\24""2Z\15""0Y\24""0Y\24-\\\16-\\\16-\\\16/^\20/^\20""0Y\24/^\20/^\20" - "/^\20/^\20/^\20""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a" - "\23""2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""7e\17""5d\26""5" - "d\26""7e\17""7e\17""5d\26\247\271\223\247\271\223\247\271\223\243\274" - "\224\243\274\224\243\274\224\341\347\334\376\377\374\376\377\374\376" - "\377\374\376\377\374\261\306\245\243\274\224\247\271\223\243\274\224" - "\247\271\223\243\274\224\243\274\2244j\23""9g\21""4j\23\202\320q\202" - "\320q9g\21""4j\23""4j\23\0\0\25""0\10\25""0\10\30""1\1\30""1\1\30""1" - "\1\25""0\10\30""1\1\25""0\10\25""0\10\30""1\1\30""1\1\25""0\10\25""0" - "\10\30""1\1\30""1\1\23""3\3\23""3\3\23""3\3\30""1\1\23""3\3\27""1\12" - "\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12\24""4\5\24" - "4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10\27""7\10\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\32""8\2\32""8\2\31""9\13\32""8\2\27""8\11\34:\5\34:\5\31" - "9\13\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77\12\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\32\77\12\32\77\12\32\77\12\202\320q\202\320q\32\77\12\36B\5" - "\32\77\12\0\0.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23.W\23" - ".W\23.W\23""2Z\15""0Y\24""2Z\15""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0" - "Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""2Z\15-\\\16""3" - "[\16-\\\16-\\\16""3[\16/^\20""3[\16/^\20/^\20/^\20/^\20""0_\21""0_\21" - "0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24" - "3b\24""3b\24""5d\26""7e\17""5d\26""7e\17""7e\17""5d\26""5d\26""9g\21" - "7f\30\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\3749g\21""4j\23""9g\21\202\320q\202\320q9g\21""4j\23""9" - "g\21\0\0\25""0\10\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\30""1\1" - "\25""0\10\30""1\1\30""1\1\30""1\1\30""1\1\27""1\12\23""3\3\23""3\3\23" - "3\3\23""3\3\23""3\3\27""1\12\23""3\3\30""1\1\23""3\3\27""1\12\30""1\1" - "\23""3\3\23""3\3\23""3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5" - "\6\25""5\6\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\32""8\2\32""8\2\31""9" - "\13\32""8\2\31""9\13\34:\5\27""8\11\34:\5\27""8\11\27=\7\27=\7\27=\7" - "\30>\10\35;\6\30>\10\30>\10\32\77\12\32\77\12\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\32\77\12\36" - "B\5\32\77\12\202\320q\202\320q\32\77\12\36B\5\32\77\12\0\0.W\23.W\23" - ".W\23.W\23.W\23.W\23.W\23.W\23""2Z\15.W\23""2Z\15""0Y\24""0Y\24""0Y\24" - "2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24" - "2Z\15""0Y\24""0Y\24""2Z\15""0Y\24-\\\16""3[\16-\\\16""3[\16/^\20""3[" - "\16/^\20/^\20/^\20/^\20""3[\16""0_\21""0_\21""0_\21""3[\16""0_\21""2" - "a\23""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24""3b\24""5d\26""5" - "d\26""5d\26""5d\26""7e\17""7e\17""5d\26""9g\21""9g\21""9g\21\376\377" - "\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376" - "\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374" - "\376\377\374\376\377\374\376\377\374\376\377\374\376\377\374\376\377" - "\3749g\21""5k\24""6l\25\202\320q\202\320q5k\24""6l\25""9g\21\0\0\30""1" - "\1\30""1\1\25""0\10\30""1\1\25""0\10\25""0\10\25""0\10\30""1\1\30""1" - "\1\30""1\1\23""3\3\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\27""1\12" - "\23""3\3\23""3\3\30""1\1\23""3\3\27""1\12\23""3\3\27""1\12\23""3\3\23" - "3\3\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10" - "\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7" - "\10\27""7\10\27""7\10\31""9\13\32""8\2\31""9\13\31""9\13\32""8\2\34:" - "\5\27""8\11\34:\5\27""8\11\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>" - "\10\30>\10\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B" - "\5\32\77\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77" - "\12\36B\5\32\77\12\36B\5\33A\14\36B\5\33A\14\33A\14\36B\5\33A\14\36B" - "\5\33A\14\33A\14\36B\5\33A\14\0\0.W\23.W\23.W\23.W\23.W\23.W\23.W\23" - "2Z\15""0Y\24""0Y\24""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24" - "0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""2Z\15" - "2Z\15-\\\16-\\\16""0Y\24-\\\16/^\20""3[\16/^\20/^\20/^\20/^\20""0_\21" - "0_\21""0_\21""0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24" - "3b\24""3b\24""3b\24""3b\24""5d\26""5d\26""5d\26""5d\26""5d\26""7e\17" - "5d\26""9g\21""9g\21""4j\23""9g\21""4j\23""9g\21""5k\24""4j\23""4j\23" - "9g\21""4j\23""9g\21""4j\23""5k\24""9g\21""5k\24""9g\21""5k\24""6l\25" - "9g\21""5k\24""6l\25""9g\21""6l\25""6l\25""5k\24""5k\24""9g\21""6l\25" - "5k\24\0\0\30""1\1\25""0\10\25""0\10\25""0\10\25""0\10\25""0\10\30""1" - "\1\23""3\3\30""1\1\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\23""3\3\30" - "1\1\23""3\3\27""1\12\23""3\3\23""3\3\23""3\3\23""3\3\27""1\12\23""3\3" - "\24""4\5\24""4\5\24""4\5\25""5\6\25""5\6\25""5\6\25""5\6\27""7\10\27" - "7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27""7\10\27" - "7\10\27""7\10\27""7\10\32""8\2\32""8\2\31""9\13\32""8\2\34:\5\27""8\11" - "\34:\5\34:\5\34:\5\27=\7\27=\7\27=\7\27=\7\30>\10\30>\10\30>\10\32\77" - "\12\32\77\12\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\32\77\12\36B\5" - "\32\77\12\36B\5\32\77\12\32\77\12\32\77\12\36B\5\32\77\12\36B\5\32\77" - "\12\36B\5\33A\14\36B\5\33A\14\36B\5\33A\14\36B\5\36B\5\33A\14\36B\5\33" - "A\14\33A\14\36B\5\0\0.W\23.W\23.W\23.W\23.W\23.W\23""2Z\15""0Y\24""0" - "Y\24""0Y\24""0Y\24""2Z\15""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0Y\24""0" - "Y\24""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15""0Y\24""2Z\15""3[\16-\\\16-\\" - "\16""3[\16/^\20""3[\16/^\20/^\20/^\20""3[\16/^\20""3[\16""0_\21""0_\21" - "0_\21""0_\21""0_\21""2a\23""2a\23""2a\23""2a\23""3b\24""3b\24""3b\24" - "3b\24""3b\24""5d\26""5d\26""5d\26""5d\26""5d\26""7e\17""5d\26""9g\21" - "7f\30""4j\23""9g\21""4j\23""5k\24""9g\21""5k\24""4j\23""9g\21""4j\23" - "4j\23""9g\21""5k\24""5k\24""4j\23""4j\23""6l\25""9g\21""5k\24""5k\24" - "5k\24""5k\24""9g\21""6l\25""5k\24""9g\21""5k\24""9g\21""9g\21""5k\24" - "\0\0", -}; - - diff --git a/polymer-perf/eduke32/build/rsrc/game_icon.bmp b/polymer-perf/eduke32/build/rsrc/game_icon.bmp deleted file mode 100644 index b921dcd03..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/game_icon.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/build/rsrc/game_icon.c b/polymer-perf/eduke32/build/rsrc/game_icon.c deleted file mode 100644 index 82d833ac8..000000000 --- a/polymer-perf/eduke32/build/rsrc/game_icon.c +++ /dev/null @@ -1,192 +0,0 @@ -#include "sdlayer.h" - -static unsigned int sdlappicon_pixels[] = { - 0xff415f7a, 0xff364a5c, 0xff364a5c, 0xff607486, 0xff667a8c, 0xff667a8c, - 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, - 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, - 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, - 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff607486, 0xff364a5c, - 0xff364a5c, 0xff415f7a, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff334d66, - 0xff334d66, 0xff747474, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff747474, 0xff334d66, 0xff334d66, 0xff364a5c, - 0xff364a5c, 0xff334d66, 0xff334d66, 0xff747474, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff747474, 0xff334d66, - 0xff334d66, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff5c5c5c, - 0xff404040, 0xff808080, 0xff646464, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff646464, 0xff7c7c7c, 0xff404040, - 0xff5c5c5c, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, - 0xff202020, 0xff6c6c6c, 0xff686868, 0xff808080, 0xff686868, 0xff808080, - 0xff808080, 0xff808080, 0xff6c6c6c, 0xff6a6a6a, 0xff727272, 0xff6c6c6c, - 0xff6c6c6c, 0xff767676, 0xff626262, 0xff6c6c6c, 0xff808080, 0xff6c6c6c, - 0xff686868, 0xff747474, 0xff808080, 0xff808080, 0xff808080, 0xff707070, - 0xff787878, 0xff686868, 0xff6c6c6c, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080, - 0xff686868, 0xff808080, 0xff808080, 0xff808080, 0xff6c6c6c, 0xff6a6a6a, - 0xff727272, 0xff6a6a6a, 0xff6a6a6a, 0xff808080, 0xff6c6c6c, 0xff6c6c6c, - 0xff808080, 0xff6c6c6c, 0xff7c7c7c, 0xff6c6c6c, 0xff808080, 0xff808080, - 0xff808080, 0xff707070, 0xff787878, 0xff808080, 0xff747474, 0xff202020, - 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, - 0xff808080, 0xff808080, 0xff686868, 0xff808080, 0xff808080, 0xff808080, - 0xff767676, 0xff6c6c6c, 0xff7c7c7c, 0xff707070, 0xff707070, 0xff767676, - 0xff6c6c6c, 0xff767676, 0xff6c6c6c, 0xff767676, 0xff6c6c6c, 0xff7e7e7e, - 0xff808080, 0xff808080, 0xff808080, 0xff707070, 0xff787878, 0xff808080, - 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, - 0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff646464, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff646464, - 0xff787878, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080, - 0xff686868, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff707070, 0xff787878, 0xff808080, 0xff747474, 0xff202020, - 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, - 0xff808080, 0xff808080, 0xff686868, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff707070, 0xff787878, 0xff808080, - 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, - 0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff686868, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff707070, - 0xff787878, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080, - 0xff646464, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff646464, 0xff787878, 0xff808080, 0xff747474, 0xff202020, - 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, - 0xff808080, 0xff808080, 0xff686868, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff707070, 0xff787878, 0xff808080, - 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, - 0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff686868, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff707070, - 0xff787878, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080, - 0xff686868, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff707070, 0xff787878, 0xff808080, 0xff747474, 0xff202020, - 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474, - 0xff808080, 0xff808080, 0xff6c6c6c, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, - 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff787878, 0xff808080, - 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, - 0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff202020, 0xff202020, 0xff666666, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, - 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff666666, 0xff202020, - 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff3c3c3c, - 0xff666666, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, - 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, - 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, - 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff666666, - 0xff3c3c3c, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff302424, 0xff3e3e3e, - 0xff484848, 0xff444444, 0xff444444, 0xff464646, 0xff4c4c4c, 0xff484848, - 0xff484848, 0xff4a4a4a, 0xff4c4c4c, 0xff4c4c4c, 0xff4c4c4c, 0xff4c4c4c, - 0xff4a4a4a, 0xff404040, 0xff343434, 0xff343434, 0xff343434, 0xff343434, - 0xff2c2c2c, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, - 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff3c3c3c, 0xff727272, 0xff707070, 0xff565656, 0xff505050, 0xff525252, - 0xff6a6a6a, 0xff787878, 0xff767676, 0xff747474, 0xff7a7a7a, 0xff7c7c7c, - 0xff787878, 0xff787878, 0xff7a7a7a, 0xff727272, 0xff505050, 0xff484848, - 0xff484848, 0xff484848, 0xff464646, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202020, 0xff444444, 0xff6c6c6c, 0xff6c6c6c, 0xff303030, - 0xff202020, 0xff202020, 0xff545454, 0xff787878, 0xff747474, 0xff747474, - 0xff787878, 0xff7c7c7c, 0xff808080, 0xff808080, 0xff7a7a7a, 0xff747474, - 0xff505050, 0xff484848, 0xff484848, 0xff484848, 0xff484848, 0xff202020, - 0xff202020, 0xff364a5c, 0xff364a5c, 0xff282828, 0xff606060, 0xff686868, - 0xff747474, 0xff4e4e4e, 0xff565656, 0xff202020, 0xff444444, 0xff686868, - 0xff6c6c6c, 0xff303030, 0xff202020, 0xff202020, 0xff545454, 0xff767676, - 0xff767676, 0xff767676, 0xff7c7c7c, 0xff787878, 0xff7c7c7c, 0xff7c7c7c, - 0xff7e7e7e, 0xff767676, 0xff505050, 0xff484848, 0xff484848, 0xff484848, - 0xff484848, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff606060, - 0xffa8a8a8, 0xff7e7e7e, 0xffa8a8a8, 0xff6c6c6c, 0xff7c7c7c, 0xff202020, - 0xff444444, 0xff6a6a6a, 0xff6c6c6c, 0xff303030, 0xff202020, 0xff202020, - 0xff545454, 0xff747474, 0xff787878, 0xff787878, 0xff7e7e7e, 0xff7c7c7c, - 0xff787878, 0xff787878, 0xff828282, 0xff7c7c7c, 0xff505050, 0xff484848, - 0xff484848, 0xff484848, 0xff484848, 0xff202020, 0xff202020, 0xff364a5c, - 0xff364a5c, 0xff7c7c7c, 0xff808080, 0xff404040, 0xffa8a8a8, 0xffa0a0a0, - 0xff7c7c7c, 0xff202020, 0xff464646, 0xff767676, 0xff727272, 0xff303030, - 0xff202020, 0xff202020, 0xff545454, 0xff767676, 0xff7a7a7a, 0xff787878, - 0xff7e7e7e, 0xff7c7c7c, 0xff787878, 0xff7c7c7c, 0xff8c8c8c, 0xff7e7e7e, - 0xff505050, 0xff484848, 0xff484848, 0xff484848, 0xff484848, 0xff222222, - 0xff25303a, 0xff364a5c, 0xff364a5c, 0xff606060, 0xffa8a8a8, 0xff7e7e7e, - 0xffa8a8a8, 0xff6c6c6c, 0xff7c7c7c, 0xff202020, 0xff484848, 0xff787878, - 0xff727272, 0xff303030, 0xff202020, 0xff202020, 0xff585858, 0xff808080, - 0xff808080, 0xff808080, 0xff888888, 0xff868686, 0xff7e7e7e, 0xff7a7a7a, - 0xff848484, 0xff747474, 0xff505050, 0xff484848, 0xff484848, 0xff484848, - 0xff484848, 0xff252b30, 0xff2a4054, 0xff385168, 0xff3a5874, 0xff282c30, - 0xff606060, 0xff686868, 0xff747474, 0xff4e4e4e, 0xff565656, 0xff202020, - 0xff484848, 0xff787878, 0xff707070, 0xff303030, 0xff202020, 0xff202020, - 0xff585858, 0xff7c7c7c, 0xff7a7a7a, 0xff787878, 0xff828282, 0xff808080, - 0xff808080, 0xff7c7c7c, 0xff828282, 0xff747474, 0xff505050, 0xff484848, - 0xff484848, 0xff484848, 0xff484848, 0xff242424, 0xff26394c, 0xff364a5c, - 0xff4c7498, 0xff334d66, 0xff202428, 0xff202020, 0xff202020, 0xff202020, - 0xff202020, 0xff202428, 0xff4c5660, 0xff747474, 0xff707070, 0xff585858, - 0xff585858, 0xff5c5c5c, 0xff747474, 0xff7c7c7c, 0xff707070, 0xff787878, - 0xff7c7c7c, 0xff787878, 0xff7c7c7c, 0xff868686, 0xff828282, 0xff787878, - 0xff505050, 0xff484848, 0xff484848, 0xff484848, 0xff464646, 0xff202020, - 0xff202020, 0xff364a5c, 0xff4c7498, 0xff4c7498, 0xff3a5874, 0xff364a5c, - 0xff364a5c, 0xff364a5c, 0xff364a5c, 0xff3a5874, 0xff55738e, 0xff5a6e80, - 0xff5e7284, 0xff5e7284, 0xff64788a, 0xff687c8e, 0xff6c8092, 0xff667a8c, - 0xff627688, 0xff627688, 0xff627688, 0xff627688, 0xff64788a, 0xff6a7e90, - 0xff667a8c, 0xff627688, 0xff4e6274, 0xff4a5e70, 0xff4a5e70, 0xff4a5e70, - 0xff44586a, 0xff364a5c, 0xff364a5c, 0xff415f7a,}; - -static unsigned char sdlappicon_mask[] = { - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255,}; - -struct sdlappicon sdlappicon = { - 32,32, // width,height - sdlappicon_pixels, - sdlappicon_mask -}; diff --git a/polymer-perf/eduke32/build/rsrc/game_icon.ico b/polymer-perf/eduke32/build/rsrc/game_icon.ico deleted file mode 100644 index b6868267f..000000000 Binary files a/polymer-perf/eduke32/build/rsrc/game_icon.ico and /dev/null differ diff --git a/polymer-perf/eduke32/build/src/StartupWinController.editor.m b/polymer-perf/eduke32/build/src/StartupWinController.editor.m deleted file mode 100644 index 9723b8cb2..000000000 --- a/polymer-perf/eduke32/build/src/StartupWinController.editor.m +++ /dev/null @@ -1,189 +0,0 @@ -#import - -#include "baselayer.h" - -@interface StartupWinController : NSWindowController -{ - IBOutlet NSButton *alwaysShowButton; - IBOutlet NSButton *fullscreenButton; - IBOutlet NSTextView *messagesView; - IBOutlet NSTabView *tabView; - IBOutlet NSComboBox *videoModeCbox; - - IBOutlet NSButton *cancelButton; - IBOutlet NSButton *startButton; -} - -- (IBAction)alwaysShowClicked:(id)sender; -- (IBAction)fullscreenClicked:(id)sender; - -- (IBAction)cancel:(id)sender; -- (IBAction)start:(id)sender; - -- (void)setupRunMode; -- (void)setupMessagesMode; -- (void)putsMessage:(NSString *)str; -- (void)setTitle:(NSString *)str; -@end - -@implementation StartupWinController - -- (IBAction)alwaysShowClicked:(id)sender -{ -} - -- (IBAction)fullscreenClicked:(id)sender -{ - // XXX: recalculate the video modes list to take into account the fullscreen status -} - -- (IBAction)cancel:(id)sender -{ - [NSApp abortModal]; -} - -- (IBAction)start:(id)sender -{ - // XXX: write the states of the form controls to their respective homes - [NSApp stopModal]; -} - -- (void)setupRunMode -{ - // XXX: populate the lists and set everything up to represent the current options - - // enable all the controls on the Configuration page - NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; - NSControl *control; - while (control = [enumerator nextObject]) - [control setEnabled:true]; - - [cancelButton setEnabled:true]; - [startButton setEnabled:true]; - - [tabView selectTabViewItemAtIndex:0]; -} - -- (void)setupMessagesMode -{ - [tabView selectTabViewItemAtIndex:1]; - - // disable all the controls on the Configuration page except "always show", so the - // user can enable it if they want to while waiting for something else to happen - NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; - NSControl *control; - while (control = [enumerator nextObject]) { - if (control == alwaysShowButton) continue; - [control setEnabled:false]; - } - - [cancelButton setEnabled:false]; - [startButton setEnabled:false]; -} - -- (void)putsMessage:(NSString *)str -{ - NSRange end; - NSTextStorage *text = [messagesView textStorage]; - BOOL shouldAutoScroll; - - shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect])); - - end.location = [text length]; - end.length = 0; - - [text beginEditing]; - [messagesView replaceCharactersInRange:end withString:str]; - [text endEditing]; - - if (shouldAutoScroll) { - end.location = [text length]; - end.length = 0; - [messagesView scrollRangeToVisible:end]; - } -} - -- (void)setTitle:(NSString *)str -{ - [[self window] setTitle:str]; -} - -@end - -static StartupWinController *startwin = nil; - -int startwin_open(void) -{ - if (startwin != nil) return 1; - - startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.editor"]; - if (startwin == nil) return -1; - - [startwin showWindow:nil]; - [startwin setupMessagesMode]; - - return 0; -} - -int startwin_close(void) -{ - if (startwin == nil) return 1; - - [startwin close]; - startwin = nil; - - return 0; -} - -int startwin_puts(const char *s) -{ - NSString *ns; - - if (!s) return -1; - if (startwin == nil) return 1; - - ns = [[NSString alloc] initWithCString:s]; - [startwin putsMessage:ns]; - [ns release]; - - return 0; -} - -int startwin_settitle(const char *s) -{ - NSString *ns; - - if (!s) return -1; - if (startwin == nil) return 1; - - ns = [[NSString alloc] initWithCString:s]; - [startwin setTitle:ns]; - [ns release]; - - return 0; -} - -int startwin_idle(void *v) -{ - if (startwin) [[startwin window] displayIfNeeded]; - return 0; -} - -int startwin_run(void) -{ - int retval; - - if (startwin == nil) return 0; - - [startwin setupRunMode]; - - switch ([NSApp runModalForWindow:[startwin window]]) { - case NSRunStoppedResponse: retval = 1; break; - case NSRunAbortedResponse: retval = 0; break; - default: retval = -1; - } - - [startwin setupMessagesMode]; - - return retval; -} diff --git a/polymer-perf/eduke32/build/src/a-c.c b/polymer-perf/eduke32/build/src/a-c.c deleted file mode 100644 index 505088bf3..000000000 --- a/polymer-perf/eduke32/build/src/a-c.c +++ /dev/null @@ -1,299 +0,0 @@ -// A.ASM replacement using C -// Mainly by Ken Silverman, with things melded with my port by -// Jonathon Fowler (jonof@edgenetwork.org) -// -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. - -#include "a.h" - -#ifdef ENGINE_USING_A_C - -int32_t krecip(int32_t num); // from engine.c - -#define BITSOFPRECISION 3 -#define BITSOFPRECISIONPOW 8 - -extern intptr_t asm1, asm2, asm3, asm4; -extern int32_t fpuasm, globalx3, globaly3; -extern void *reciptable; - -static int32_t bpl, transmode = 0; -static int32_t glogx, glogy, gbxinc, gbyinc, gpinc; -static char *gbuf, *gpal, *ghlinepal, *gtrans; - -//Global variable functions -void setvlinebpl(int32_t dabpl) { bpl = dabpl; } -void fixtransluscence(intptr_t datransoff) { gtrans = (char *)datransoff; } -void settransnormal(void) { transmode = 0; } -void settransreverse(void) { transmode = 1; } - - -//Ceiling/floor horizontal line functions -void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc) -{ glogx = logx; glogy = logy; gbuf = (char *)bufplc; } -void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; } -void setuphlineasm4(int32_t bxinc, int32_t byinc) { gbxinc = bxinc; gbyinc = byinc; } -void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, uint32_t bx, intptr_t p) -{ - char *palptr; - - palptr = (char *)&ghlinepal[paloffs]; - if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; } - for (; cnt>=0; cnt--) - { - *((char *)p) = palptr[gbuf[((bx>>(32-glogx))<>(32-glogy))]]; - bx -= gbxinc; - by -= gbyinc; - p--; - } -} - - -//Sloped ceiling/floor vertical line functions -void setupslopevlin(int32_t logylogx, intptr_t bufplc, int32_t pinc) -{ - glogx = (logylogx&255); glogy = (logylogx>>8); - gbuf = (char *)bufplc; gpinc = pinc; -} -void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by) -{ - intptr_t *slopalptr; - int32_t bz, bzinc; - uint32_t u, v; - - bz = asm3; bzinc = (asm1>>3); - slopalptr = (intptr_t *)slopaloffs; - for (; cnt>0; cnt--) - { - i = krecip(bz>>6); bz += bzinc; - u = bx+globalx3*i; - v = by+globaly3*i; - (*(char *)p) = *(char *)(((intptr_t)slopalptr[0])+gbuf[((u>>(32-glogx))<>(32-glogy))]); - slopalptr--; - p += gpinc; - } -} - - -//Wall,face sprite/wall sprite vertical line functions -void setupvlineasm(int32_t neglogy) { glogy = neglogy; } -void vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) -{ - gbuf = (char *)bufplc; - gpal = (char *)paloffs; - for (; cnt>=0; cnt--) - { - *((char *)p) = gpal[gbuf[vplc>>glogy]]; - p += bpl; - vplc += vinc; - } -} - -void setupmvlineasm(int32_t neglogy) { glogy = neglogy; } -void mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) -{ - char ch; - - gbuf = (char *)bufplc; - gpal = (char *)paloffs; - for (; cnt>=0; cnt--) - { - ch = gbuf[vplc>>glogy]; if (ch != 255) *((char *)p) = gpal[ch]; - p += bpl; - vplc += vinc; - } -} - -void setuptvlineasm(int32_t neglogy) { glogy = neglogy; } -void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) -{ - char ch; - - gbuf = (char *)bufplc; - gpal = (char *)paloffs; - if (transmode) - { - for (; cnt>=0; cnt--) - { - ch = gbuf[vplc>>glogy]; - if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)]; - p += bpl; - vplc += vinc; - } - } - else - { - for (; cnt>=0; cnt--) - { - ch = gbuf[vplc>>glogy]; - if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]]; - p += bpl; - vplc += vinc; - } - } -} - -//Floor sprite horizontal line functions -void msethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; } -void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p) -{ - char ch; - - gbuf = (char *)bufplc; - gpal = (char *)asm3; - for (cntup16>>=16; cntup16>0; cntup16--) - { - ch = gbuf[((bx>>(32-glogx))<>(32-glogy))]; - if (ch != 255) *((char *)p) = gpal[ch]; - bx += asm1; - by += asm2; - p++; - } -} - -void tsethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; } -void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p) -{ - char ch; - - gbuf = (char *)bufplc; - gpal = (char *)asm3; - if (transmode) - { - for (cntup16>>=16; cntup16>0; cntup16--) - { - ch = gbuf[((bx>>(32-glogx))<>(32-glogy))]; - if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)]; - bx += asm1; - by += asm2; - p++; - } - } - else - { - for (cntup16>>=16; cntup16>0; cntup16--) - { - ch = gbuf[((bx>>(32-glogx))<>(32-glogy))]; - if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]]; - bx += asm1; - by += asm2; - p++; - } - } -} - - -//Rotatesprite vertical line functions -void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz) -{ - gpal = (char *)paloffs; - gbxinc = bxinc; - gbyinc = byinc; - glogy = ysiz; -} -void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p) -{ - gbuf = (char *)bufplc; - for (; cnt>1; cnt--) - { - (*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]]; - bx += gbxinc; - by += gbyinc; - p += bpl; - } -} - -//Rotatesprite vertical line functions -void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz) -{ - gpal = (char *)paloffs; - gbxinc = bxinc; - gbyinc = byinc; - glogy = ysiz; -} -void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p) -{ - char ch; - - gbuf = (char *)bufplc; - for (; cnt>1; cnt--) - { - ch = gbuf[(bx>>16)*glogy+(by>>16)]; - if (ch != 255)(*(char *)p) = gpal[ch]; - bx += gbxinc; - by += gbyinc; - p += bpl; - } -} - -void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz) -{ - gpal = (char *)paloffs; - gbxinc = bxinc; - gbyinc = byinc; - glogy = ysiz; -} -void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p) -{ - char ch; - - gbuf = (char *)bufplc; - if (transmode) - { - for (; cnt>1; cnt--) - { - ch = gbuf[(bx>>16)*glogy+(by>>16)]; - if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)]; - bx += gbxinc; - by += gbyinc; - p += bpl; - } - } - else - { - for (; cnt>1; cnt--) - { - ch = gbuf[(bx>>16)*glogy+(by>>16)]; - if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]]; - bx += gbxinc; - by += gbyinc; - p += bpl; - } - } -} - -void setupdrawslab(int32_t dabpl, intptr_t pal) -{ bpl = dabpl; gpal = (char *)pal; } - -void drawslab(int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intptr_t p) -{ - int32_t x; - - while (dy > 0) - { - for (x=0; x>16)+vptr))]; - p += bpl; v += vi; dy--; - } -} - -void stretchhline(intptr_t p0, int32_t u, int32_t cnt, int32_t uinc, intptr_t rptr, intptr_t p) -{ - p0 = p-(cnt<<2); - do - { - p--; - *(char *)p = *(char *)((u>>16)+rptr); u -= uinc; - } - while (p > p0); -} - - -void mmxoverlay() { } - -#endif -/* - * vim:ts=4: - */ - diff --git a/polymer-perf/eduke32/build/src/a.masm b/polymer-perf/eduke32/build/src/a.masm deleted file mode 100644 index d2fdfbda7..000000000 --- a/polymer-perf/eduke32/build/src/a.masm +++ /dev/null @@ -1,2668 +0,0 @@ -; "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -; Ken Silverman's official web site: "http://www.advsys.net/ken" -; See the included license file "BUILDLIC.TXT" for license info. - -.586P -;.8087 -;include mmx.inc ;Include this if using < WATCOM 11.0 WASM - -;Warning: IN THIS FILE, ALL SEGMENTS ARE REMOVED. THIS MEANS THAT DS:[] -;MUST BE ADDED FOR ALL SELF-MODIFIES FOR MASM TO WORK. -; -;WASM PROBLEMS: -; 1. Requires all scaled registers (*1,*2,*4,*8) to be last thing on line -; 2. Using 'DATA' is nice for self-mod. code, but WDIS only works with 'CODE' -; -;MASM PROBLEMS: -; 1. Requires DS: to be written out for self-modifying code to work -; 2. Doesn't encode short jumps automatically like WASM -; 3. Stupidly adds wait prefix to ffree's - -EXTRN _asm1 : dword -EXTRN _asm2 : dword -EXTRN _asm3 : dword -EXTRN _asm4 : dword -EXTRN _reciptable : near -EXTRN _fpuasm : dword -EXTRN _globalx3 : dword -EXTRN _globaly3 : dword -EXTRN _ylookup : near - -EXTRN _vplce : near -EXTRN _vince : near -EXTRN _palookupoffse : near -EXTRN _bufplce : near - -EXTRN _ebpbak : dword -EXTRN _espbak : dword - -EXTRN _pow2char : near -EXTRN _pow2long : near - - -; Some macros to help make cdecl calling easier to manage -CDECLBEGIN MACRO noi:=<0> - IF noi GE 2 - push ebx - ENDIF - IF noi GE 3 - push ecx - ENDIF - IF noi GE 4 - push edx - ENDIF - IF noi GE 5 - push esi - ENDIF - IF noi GE 6 - push edi - ENDIF -ENDM - -CDECLEND MACRO noi:=<0> - IF noi GE 6 - pop edi - ENDIF - IF noi GE 5 - pop esi - ENDIF - IF noi GE 4 - pop edx - ENDIF - IF noi GE 3 - pop ecx - ENDIF - IF noi GE 2 - pop ebx - ENDIF -ENDM - -CDECLPARAM MACRO registername:REQ,paramnumber:REQ,offsetted:REQ -; mov registername, dword ptr [esp + (paramnumber*4+16)] - mov registername, dword ptr [esp + ((paramnumber+offsetted)*4+4)] -ENDM - -CDECLBEGINSET MACRO numparams:REQ - CDECLBEGIN numparams - -% _offsetted = numparams - 1 - - IF numparams GE 1 - CDECLPARAM eax,0,%_offsetted - ENDIF - IF numparams GE 2 - CDECLPARAM ebx,1,%_offsetted - ENDIF - IF numparams GE 3 - CDECLPARAM ecx,2,%_offsetted - ENDIF - IF numparams GE 4 - CDECLPARAM edx,3,%_offsetted - ENDIF - IF numparams GE 5 - CDECLPARAM esi,4,%_offsetted - ENDIF - IF numparams GE 6 - CDECLPARAM edi,5,%_offsetted - ENDIF -ENDM - -CDECLENDSET MACRO numparams:REQ - CDECLEND numparams -ENDM - -code segment 'CODE' PUBLIC USE32 -ASSUME cs:CODE,ds:CODE -PUBLIC _dep_begin -_dep_begin: - -ALIGN 16 -PUBLIC _sethlinesizes -_sethlinesizes: -CDECLBEGINSET 3 - - mov byte ptr [machxbits1+2], al - mov byte ptr [machxbits2+2], al - mov byte ptr [machxbits3+2], al - neg al - mov byte ptr [hxsiz1+2], al - mov byte ptr [hxsiz2+2], al - mov byte ptr [hxsiz3+2], al - mov byte ptr [hxsiz4+2], al - mov byte ptr [machnegxbits1+2], al - - mov byte ptr [hysiz1+3], bl - mov byte ptr [hysiz2+3], bl - mov byte ptr [hysiz3+3], bl - mov byte ptr [hysiz4+3], bl - mov byte ptr [hmach3a+2], bl - mov byte ptr [hmach3b+2], bl - mov byte ptr [hmach3c+2], bl - mov byte ptr [hmach3d+2], bl - - mov dword ptr [hoffs1+2], ecx - mov dword ptr [hoffs2+2], ecx - mov dword ptr [hoffs3+2], ecx - mov dword ptr [hoffs4+2], ecx - mov dword ptr [hoffs5+2], ecx - mov dword ptr [hoffs6+2], ecx - mov dword ptr [hoffs7+2], ecx - mov dword ptr [hoffs8+2], ecx - - push edx ;JBF - mov edx, -1 - mov cl, al - sub cl, bl - shr edx, cl - mov dword ptr [hmach2a+1], edx - mov dword ptr [hmach2b+1], edx - mov dword ptr [hmach2c+1], edx - mov dword ptr [hmach2d+1], edx - pop edx ;JBF - -CDECLENDSET 3 - ret - -ALIGN 16 -PUBLIC _prosethlinesizes -_prosethlinesizes: -CDECLBEGINSET 3 - - mov dword ptr [prohbuf-4], ecx - neg eax - mov ecx, eax - sub eax, ebx - mov byte ptr [prohshru-1], al ;bl = 32-al-bl - mov eax, -1 - shr eax, cl - mov ecx, ebx - shl eax, cl - mov dword ptr [prohand-4], eax ;((-1>>(-oal))<>(32-xbits) adc al, 88h 1 1/2 - ;bufplc mov cl, byte ptr [edx+88888888h] 1 1/2 - ;paloffs&255 mov bl, byte ptr [ecx+88888888h] 1 1/2 -ALIGN 16 -PUBLIC _hlineasm4 -_hlineasm4: -CDECLBEGINSET 6 - - push ebp - - lea ebp, [eax+1] - - cmp ebp, 8 - jle shorthline - - test edi, 1 - jnz short skipthe1byte - - mov eax, esi -hxsiz1: shr eax, 26 -hysiz1: shld eax, edx, 6 -hoffs1: mov cl, byte ptr [eax+88888888h] -pal1: mov bl, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - mov byte ptr [edi], bl - dec edi - dec ebp - -skipthe1byte: - test edi, 2 - jnz short skipthe2byte - - mov eax, esi -hxsiz2: shr eax, 26 -hysiz2: shld eax, edx, 6 -hoffs2: mov cl, byte ptr [eax+88888888h] -pal2: mov bh, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - - mov eax, esi -hxsiz3: shr eax, 26 -hysiz3: shld eax, edx, 6 -hoffs3: mov cl, byte ptr [eax+88888888h] -pal3: mov bl, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - mov word ptr [edi-1], bx - sub edi, 2 - sub ebp, 2 - -skipthe2byte: - - mov eax, esi -machxbits1: shl esi, 6 ;xbits -machnegxbits1: shr eax, 32-6 ;32-xbits - mov dl, al - - inc edi - - add ebx, ebx - mov eax, edx - jc beginhline64 - - mov eax, _asm1 -machxbits2: rol eax, 6 ;xbits - mov dword ptr [hmach4a+2], eax - mov dword ptr [hmach4b+2], eax - mov dword ptr [hmach4c+2], eax - mov dword ptr [hmach4d+2], eax - mov ebx, eax - mov eax, _asm2 - mov al, bl - mov dword ptr [hmach1a+2], eax - mov dword ptr [hmach1b+2], eax - mov dword ptr [hmach1c+2], eax - mov dword ptr [hmach1d+2], eax - - mov eax, edx - jmp beginhline64 -ALIGN 16 -prebeginhline64: - mov dword ptr [edi], ebx -beginhline64: - -hmach3a: rol eax, 6 -hmach2a: and eax, 00008888h -hmach4a: sub esi, 88888888h -hmach1a: sbb edx, 88888888h - sub edi, 4 -hoffs4: mov cl, byte ptr [eax+88888888h] - mov eax, edx - -hmach3b: rol eax, 6 -hmach2b: and eax, 00008888h -hmach4b: sub esi, 88888888h -hmach1b: sbb edx, 88888888h -pal4: mov bh, byte ptr [ecx+88888888h] -hoffs5: mov cl, byte ptr [eax+88888888h] - mov eax, edx - -hmach3c: rol eax, 6 -pal5: mov bl, byte ptr [ecx+88888888h] -hmach2c: and eax, 00008888h - shl ebx, 16 -hmach4c: sub esi, 88888888h -hmach1c: sbb edx, 88888888h -hoffs6: mov cl, byte ptr [eax+88888888h] - - mov eax, edx - ;( - -hmach3d: rol eax, 6 -hmach2d: and eax, 00008888h -hmach4d: sub esi, 88888888h -hmach1d: sbb edx, 88888888h -pal6: mov bh, byte ptr [ecx+88888888h] -hoffs7: mov cl, byte ptr [eax+88888888h] - mov eax, edx - sub ebp, 4 - nop -pal7: mov bl, byte ptr [ecx+88888888h] - jnc prebeginhline64 -skipthe4byte: - - test ebp, 2 - jz skipdrawthe2 - rol ebx, 16 - mov word ptr [edi+2], bx - sub edi, 2 -skipdrawthe2: - test ebp, 1 - jz skipdrawthe1 - shr ebx, 24 - mov byte ptr [edi+3], bl -skipdrawthe1: - - pop ebp -CDECLENDSET 6 - ret - -shorthline: - test ebp, ebp - jz endshorthline -begshorthline: - mov eax, esi -hxsiz4: shr eax, 26 -hysiz4: shld eax, edx, 6 -hoffs8: mov cl, byte ptr [eax+88888888h] -pal8: mov bl, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - mov byte ptr [edi], bl - dec edi - dec ebp - jnz begshorthline -endshorthline: - pop ebp -CDECLENDSET 6 - ret - - - ;eax: 00000000 00000000 00000000 temp---- - ;ebx: 00000000 00000000 00000000 temp---- - ;ecx: UUUUUUuu uuuuuuuu uuuuuuuu uuuuuuuu - ;edx: VVVVVVvv vvvvvvvv vvvvvvvv vvvvvvvv - ;esi: cnt----- -------- -------- -------- - ;edi: vid----- -------- -------- -------- - ;ebp: paloffs- -------- -------- -------- - ;esp: ???????? ???????? ???????? ???????? -ALIGN 16 -PUBLIC _prohlineasm4 -_prohlineasm4: -CDECLBEGINSET 6 - - push ebp - - lea ebp, [ecx+88888888h] -prohpala: - mov ecx, esi - lea esi, [eax+1] - sub edi, esi - -prohbeg: - mov eax, ecx - shr eax, 20 -prohshru: - mov ebx, edx - shr ebx, 26 -prohshrv: - and eax, 88888888h -prohand: - movzx eax, byte ptr [eax+ebx+88888888h] -prohbuf: - mov al, [eax+ebp] - sub ecx, _asm1 - sub edx, _asm2 - mov [edi+esi], al - dec esi - jnz prohbeg - - pop ebp -CDECLENDSET 6 - ret - - - -ALIGN 16 -PUBLIC _setupvlineasm -_setupvlineasm: -CDECLBEGINSET 1 - ;First 2 lines for VLINEASM1, rest for VLINEASM4 - mov byte ptr [premach3a+2], al - mov byte ptr [mach3a+2], al - - push ecx - mov byte ptr [machvsh1+2], al ;32-shy - mov byte ptr [machvsh3+2], al ;32-shy - mov byte ptr [machvsh5+2], al ;32-shy - mov byte ptr [machvsh6+2], al ;32-shy - mov ah, al - sub ah, 16 - mov byte ptr [machvsh8+2], ah ;16-shy - neg al - mov byte ptr [machvsh7+2], al ;shy - mov byte ptr [machvsh9+2], al ;shy - mov byte ptr [machvsh10+2], al ;shy - mov byte ptr [machvsh11+2], al ;shy - mov byte ptr [machvsh12+2], al ;shy - mov cl, al - mov eax, 1 - shl eax, cl - dec eax - mov dword ptr [machvsh2+2], eax ;(1<>sh) - ;vplc3 = (ebp<<(32-sh))+((edx&65535)<<(16-sh)) -machvsh5: shl esi, 88h ;32-sh - mov eax, edx -machvsh6: shl ebp, 88h ;32-sh - and edx, 0000ffffh -machvsh7: shr eax, 88h ;sh - add esi, eax -machvsh8: shl edx, 88h ;16-sh - add ebp, edx - mov dword ptr _vplce[12], esi - mov dword ptr _vplce[4], ebp - - pop ebp - -CDECLEND 6 - ret - - ;eax: -------temp1------- - ;ebx: -------temp2------- - ;ecx: ylo4 --------- - ;edx: ylo2 --------- - ;esi: yhi1 yhi2 - ;edi: ---videoplc/cnt---- - ;ebp: yhi3 yhi4 - ;esp: -ALIGN 16 -PUBLIC _provlineasm4 -_provlineasm4: -CDECLBEGIN 6 -CDECLPARAM ecx,0,5 -CDECLPARAM edi,1,5 - - push ebp - - mov eax, dword ptr _ylookup[ecx*4] - add eax, edi - mov dword ptr [promachvline4end1+2], eax - inc eax - mov dword ptr [promachvline4end2+2], eax - inc eax - mov dword ptr [promachvline4end3+2], eax - inc eax - mov dword ptr [promachvline4end4+2], eax - sub eax, 3 - sub edi, eax - - mov eax, dword ptr _bufplce[0] - mov ebx, dword ptr _bufplce[4] - mov ecx, dword ptr _bufplce[8] - mov edx, dword ptr _bufplce[12] - mov dword ptr [promachvbuf1+3], ecx - mov dword ptr [promachvbuf2+3], edx - mov dword ptr [promachvbuf3+3], eax - mov dword ptr [promachvbuf4+3], ebx - - mov eax, dword ptr _palookupoffse[0] - mov ebx, dword ptr _palookupoffse[4] - mov ecx, dword ptr _palookupoffse[8] - mov edx, dword ptr _palookupoffse[12] - mov dword ptr [promachvpal1+2], ecx - mov dword ptr [promachvpal2+2], edx - mov dword ptr [promachvpal3+2], eax - mov dword ptr [promachvpal4+2], ebx - - ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - ;edx: ³v3lo ³v1lo ³ - ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄ´ - ;esi: ³v2hi v2lo ³ v3hi³ - ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ´ - ;ebp: ³v0hi v0lo ³ v1hi³ - ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÙ - - mov ebp, dword ptr _vince[0] - mov ebx, dword ptr _vince[4] - mov esi, dword ptr _vince[8] - mov eax, dword ptr _vince[12] - and esi, 0fffffe00h - and ebp, 0fffffe00h -promachvsh9: rol eax, 88h ;sh -promachvsh10: rol ebx, 88h ;sh - mov edx, eax - mov ecx, ebx - shr ecx, 16 - and edx, 0ffff0000h - add edx, ecx - and eax, 000001ffh - and ebx, 000001ffh - add esi, eax - add ebp, ebx - ; - mov eax, edx - and eax, 0ffff0000h - mov dword ptr [promachvinc1+2], eax - mov dword ptr [promachvinc2+2], esi - shl edx, 16 - mov dword ptr [promachvinc3+2], edx - mov dword ptr [promachvinc5+2], ebp - - mov ebp, dword ptr _vplce[0] - mov ebx, dword ptr _vplce[4] - mov esi, dword ptr _vplce[8] - mov eax, dword ptr _vplce[12] - and esi, 0fffffe00h - and ebp, 0fffffe00h -promachvsh11: rol eax, 88h ;sh -promachvsh12: rol ebx, 88h ;sh - mov edx, eax - mov ecx, ebx - shr ecx, 16 - and edx, 0ffff0000h - add edx, ecx - and eax, 000001ffh - and ebx, 000001ffh - add esi, eax - add ebp, ebx - - mov eax, esi - mov ecx, edx - shl ecx, 16 - jmp short probeginvlineasm4 -ALIGN 16 - nop - nop - nop -probeginvlineasm4: -promachvsh1: shr eax, 88h ;32-sh - mov ebx, esi -promachvsh2: and ebx, 00000088h ;(1<>sh) - ;vplc3 = (ebp<<(32-sh))+((edx&65535)<<(16-sh)) -promachvsh5: shl esi, 88h ;32-sh - mov eax, edx -promachvsh6: shl ebp, 88h ;32-sh - and edx, 0000ffffh -promachvsh7: shr eax, 88h ;sh - add esi, eax -promachvsh8: shl edx, 88h ;16-sh - add ebp, edx - mov dword ptr _vplce[12], esi - mov dword ptr _vplce[4], ebp - - pop ebp - -CDECLEND 6 - ret - - -ALIGN 16 -PUBLIC _mvlineasm4 -_mvlineasm4: -CDECLBEGIN 6 -CDECLPARAM ecx,0,5 -CDECLPARAM edi,1,5 - - push ebp - - mov eax, dword ptr _bufplce[0] - mov ebx, dword ptr _bufplce[4] - mov dword ptr [machmv1+2], eax - mov dword ptr [machmv4+2], ebx - mov eax, dword ptr _bufplce[8] - mov ebx, dword ptr _bufplce[12] - mov dword ptr [machmv7+2], eax - mov dword ptr [machmv10+2], ebx - - mov eax, dword ptr _palookupoffse[0] - mov ebx, dword ptr _palookupoffse[4] - mov dword ptr [machmv2+2], eax - mov dword ptr [machmv5+2], ebx - mov eax, dword ptr _palookupoffse[8] - mov ebx, dword ptr _palookupoffse[12] - mov dword ptr [machmv8+2], eax - mov dword ptr [machmv11+2], ebx - - mov eax, dword ptr _vince[0] ;vince - mov ebx, dword ptr _vince[4] - xor al, al - xor bl, bl - mov dword ptr [machmv3+2], eax - mov dword ptr [machmv6+2], ebx - mov eax, dword ptr _vince[8] - mov ebx, dword ptr _vince[12] - mov dword ptr [machmv9+2], eax - mov dword ptr [machmv12+2], ebx - - mov ebx, ecx - mov ecx, dword ptr _vplce[0] - mov edx, dword ptr _vplce[4] - mov esi, dword ptr _vplce[8] - mov ebp, dword ptr _vplce[12] - mov cl, bl - inc cl - inc bh - mov byte ptr _asm3[0], bh -fixchain2ma: sub edi, 320 - - jmp short beginmvlineasm4 -ALIGN 16 -beginmvlineasm4: - dec cl - jz endmvlineasm4 -beginmvlineasm42: - mov eax, ebp - mov ebx, esi -machmv16: shr eax, 32 -machmv15: shr ebx, 32 -machmv12: add ebp, 88888888h ;vince[3] -machmv9: add esi, 88888888h ;vince[2] -machmv10: mov al, byte ptr [eax+88888888h] ;bufplce[3] -machmv7: mov bl, byte ptr [ebx+88888888h] ;bufplce[2] - cmp al, 255 - adc dl, dl - cmp bl, 255 - adc dl, dl -machmv8: mov bl, byte ptr [ebx+88888888h] ;palookupoffs[2] -machmv11: mov bh, byte ptr [eax+88888888h] ;palookupoffs[3] - - mov eax, edx -machmv14: shr eax, 32 - shl ebx, 16 -machmv4: mov al, byte ptr [eax+88888888h] ;bufplce[1] - cmp al, 255 - adc dl, dl -machmv6: add edx, 88888888h ;vince[1] -machmv5: mov bh, byte ptr [eax+88888888h] ;palookupoffs[1] - - mov eax, ecx -machmv13: shr eax, 32 -machmv3: add ecx, 88888888h ;vince[0] -machmv1: mov al, byte ptr [eax+88888888h] ;bufplce[0] - cmp al, 255 - adc dl, dl -machmv2: mov bl, byte ptr [eax+88888888h] ;palookupoffs[0] - - shl dl, 4 - xor eax, eax -fixchain2mb: add edi, 320 - mov al, dl - add eax, offset mvcase0 - jmp eax ;16 byte cases - -ALIGN 16 -endmvlineasm4: - dec byte ptr _asm3[0] - jnz beginmvlineasm42 - - mov dword ptr _vplce[0], ecx - mov dword ptr _vplce[4], edx - mov dword ptr _vplce[8], esi - mov dword ptr _vplce[12], ebp - pop ebp -CDECLEND 6 - ret - - ;5,7,8,8,11,13,12,14,11,13,14,14,12,14,15,7 -ALIGN 16 -mvcase0: - jmp beginmvlineasm4 -ALIGN 16 -mvcase1: - mov byte ptr [edi], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase2: - mov byte ptr [edi+1], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase3: - mov word ptr [edi], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase4: - shr ebx, 16 - mov byte ptr [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase5: - mov byte ptr [edi], bl - shr ebx, 16 - mov byte ptr [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 - mvcase6: - shr ebx, 8 - mov word ptr [edi+1], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase7: - mov word ptr [edi], bx - shr ebx, 16 - mov byte ptr [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase8: - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase9: - mov byte ptr [edi], bl - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase10: - mov byte ptr [edi+1], bh - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase11: - mov word ptr [edi], bx - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase12: - shr ebx, 16 - mov word ptr [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase13: - mov byte ptr [edi], bl - shr ebx, 16 - mov word ptr [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase14: - mov byte ptr [edi+1], bh - shr ebx, 16 - mov word ptr [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase15: - mov dword ptr [edi], ebx - jmp beginmvlineasm4 - -ALIGN 16 -PUBLIC _setupspritevline -_setupspritevline: -CDECLBEGINSET 6 - - mov dword ptr [spal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword ptr [smach1+2], eax - mov dword ptr [smach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword ptr [smach2+2], eax - add eax, edx - mov dword ptr [smach5+2], eax - - mov dword ptr [smach3+2], ecx ;yinc's - -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _spritevline -_spritevline: -CDECLBEGINSET 6 - jmp short _spritevline_start - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p -prestartsvline: -smach1: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -smach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -startsvline: -spal: mov al, [eax+88888888h] ;palookup - mov byte ptr [edi], al -fixchain1s: add edi, 320 - -_spritevline_start: -smach3: add edx, 88888888h ;dayinc - dec ecx - ja short prestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short endsvline -smach4: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -smach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short startsvline -endsvline: -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _msetupspritevline -_msetupspritevline: -CDECLBEGINSET 6 - - mov dword ptr [mspal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword ptr [msmach1+2], eax - mov dword ptr [msmach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword ptr [msmach2+2], eax - add eax, edx - mov dword ptr [msmach5+2], eax - - mov dword ptr [msmach3+2], ecx ;yinc's - -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _mspritevline -_mspritevline: -CDECLBEGINSET 6 - jmp short _mspritevline_start - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p -mprestartsvline: -msmach1: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -msmach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -mstartsvline: - cmp al, 255 - je short mskipsvline -mspal: mov al, [eax+88888888h] ;palookup - mov byte ptr [edi], al -mskipsvline: -mfixchain1s: add edi, 320 - -_mspritevline_start: -msmach3: add edx, 88888888h ;dayinc - dec ecx - ja short mprestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short mendsvline -msmach4: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -msmach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short mstartsvline -mendsvline: -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _tsetupspritevline -_tsetupspritevline: -CDECLBEGINSET 6 - mov dword ptr [tspal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword ptr [tsmach1+2], eax - mov dword ptr [tsmach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword ptr [tsmach2+2], eax - add eax, edx - mov dword ptr [tsmach5+2], eax - - mov dword ptr [tsmach3+2], ecx ;yinc's -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _tspritevline -_tspritevline: -CDECLBEGINSET 6 - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p - push ebp - mov ebp, ebx - xor ebx, ebx - jmp tenterspritevline -ALIGN 16 -tprestartsvline: -tsmach1: add ebp, 88888888h ;xincshl16 - mov al, byte ptr [esi] -tsmach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -tstartsvline: - cmp al, 255 - je short tskipsvline -transrev2: - mov bh, byte ptr [edi] -transrev3: -tspal: mov bl, [eax+88888888h] ;palookup -tmach4: mov al, byte ptr [ebx+88888888h] ;_transluc - mov byte ptr [edi], al -tskipsvline: -tfixchain1s: add edi, 320 - -tenterspritevline: -tsmach3: add edx, 88888888h ;dayinc - dec ecx - ja short tprestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short tendsvline -tsmach4: add ebp, 88888888h ;xincshl16 - mov al, byte ptr [esi] -tsmach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short tstartsvline -tendsvline: - pop ebp -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _msethlineshift -_msethlineshift: -CDECLBEGINSET 2 - neg al - mov byte ptr [msh1d+2], al - mov byte ptr [msh2d+3], bl - mov byte ptr [msh3d+2], al - mov byte ptr [msh4d+3], bl - mov byte ptr [msh5d+2], al - mov byte ptr [msh6d+3], bl -CDECLENDSET 2 - ret - -ALIGN 16 -PUBLIC _mhline -_mhline: -CDECLBEGINSET 6 - ;_asm1 = bxinc - ;_asm2 = byinc - ;_asm3 = shadeoffs - ;eax = picoffs - ;ebx = bx - ;ecx = cnt - ;edx = ? - ;esi = by - ;edi = p - - mov dword ptr [mmach1d+2], eax - mov dword ptr [mmach5d+2], eax - mov dword ptr [mmach9d+2], eax - mov eax, _asm3 - mov dword ptr [mmach2d+2], eax - mov dword ptr [mmach2da+2], eax - mov dword ptr [mmach2db+2], eax - mov dword ptr [mmach6d+2], eax - mov dword ptr [mmach10d+2], eax - mov eax, _asm1 - mov dword ptr [mmach3d+2], eax - mov dword ptr [mmach7d+2], eax - mov eax, _asm2 - mov dword ptr [mmach4d+2], eax - mov dword ptr [mmach8d+2], eax - jmp short _mhlineskipmodify_nosetup - -ALIGN 16 -PUBLIC _mhlineskipmodify -_mhlineskipmodify: -CDECLBEGINSET 6 -_mhlineskipmodify_nosetup: - - push ebp - - xor eax, eax - mov ebp, ebx - - test ecx, 00010000h - jnz short mbeghline - -msh1d: shr ebx, 26 -msh2d: shld ebx, esi, 6 - add ebp, _asm1 -mmach9d: mov al, byte ptr [ebx+88888888h] ;picoffs - add esi, _asm2 - cmp al, 255 - je mskip5 - - mmach10d: mov cl, byte ptr [eax+88888888h] ;shadeoffs - mov byte ptr [edi], cl -mskip5: - inc edi - sub ecx, 65536 - jc mendhline - jmp short mbeghline - -ALIGN 16 -mpreprebeghline: ;1st only - mov al, cl -mmach2d: mov al, byte ptr [eax+88888888h] ;shadeoffs - mov byte ptr [edi], al - -mprebeghline: - add edi, 2 - sub ecx, 131072 - jc short mendhline -mbeghline: -mmach3d: lea ebx, [ebp+88888888h] ;bxinc -msh3d: shr ebp, 26 -msh4d: shld ebp, esi, 6 -mmach4d: add esi, 88888888h ;byinc -mmach1d: mov cl, byte ptr [ebp+88888888h] ;picoffs -mmach7d: lea ebp, [ebx+88888888h] ;bxinc - -msh5d: shr ebx, 26 -msh6d: shld ebx, esi, 6 -mmach8d: add esi, 88888888h ;byinc -mmach5d: mov ch, byte ptr [ebx+88888888h] ;picoffs - - cmp cl, 255 - je short mskip1 - cmp ch, 255 - je short mpreprebeghline - - mov al, cl ;BOTH -mmach2da: mov bl, byte ptr [eax+88888888h] ;shadeoffs - mov al, ch -mmach2db: mov bh, byte ptr [eax+88888888h] ;shadeoffs - mov word ptr [edi], bx - add edi, 2 - sub ecx, 131072 - jnc short mbeghline - jmp mendhline -mskip1: ;2nd only - cmp ch, 255 - je short mprebeghline - - mov al, ch -mmach6d: mov al, byte ptr [eax+88888888h] ;shadeoffs - mov byte ptr [edi+1], al - add edi, 2 - sub ecx, 131072 - jnc short mbeghline -mendhline: - - pop ebp -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _tsethlineshift -_tsethlineshift: -CDECLBEGINSET 2 - neg al - mov byte ptr [tsh1d+2], al - mov byte ptr [tsh2d+3], bl - mov byte ptr [tsh3d+2], al - mov byte ptr [tsh4d+3], bl - mov byte ptr [tsh5d+2], al - mov byte ptr [tsh6d+3], bl -CDECLENDSET 2 - ret - -ALIGN 16 -PUBLIC _thline -_thline: -CDECLBEGINSET 6 - ;_asm1 = bxinc - ;_asm2 = byinc - ;_asm3 = shadeoffs - ;eax = picoffs - ;ebx = bx - ;ecx = cnt - ;edx = ? - ;esi = by - ;edi = p - - mov dword ptr [tmach1d+2], eax - mov dword ptr [tmach5d+2], eax - mov dword ptr [tmach9d+2], eax - mov eax, _asm3 - mov dword ptr [tmach2d+2], eax - mov dword ptr [tmach6d+2], eax - mov dword ptr [tmach10d+2], eax - mov eax, _asm1 - mov dword ptr [tmach3d+2], eax - mov dword ptr [tmach7d+2], eax - mov eax, _asm2 - mov dword ptr [tmach4d+2], eax - mov dword ptr [tmach8d+2], eax - jmp short _thlineskipmodify_nosetup - -ALIGN 16 -PUBLIC _thlineskipmodify -_thlineskipmodify: -CDECLBEGINSET 6 -_thlineskipmodify_nosetup: - - push ebp - - xor eax, eax - xor edx, edx - mov ebp, ebx - - test ecx, 00010000h - jnz short tbeghline - -tsh1d: shr ebx, 26 -tsh2d: shld ebx, esi, 6 - add ebp, _asm1 -tmach9d: mov al, byte ptr [ebx+88888888h] ;picoffs - add esi, _asm2 - cmp al, 255 - je tskip5 - -transrev4: -tmach10d: mov dl, byte ptr [eax+88888888h] ;shadeoffs -transrev5: - mov dh, byte ptr [edi] -tmach1: mov al, byte ptr [edx+88888888h] ;_transluc - mov byte ptr [edi], al -tskip5: - inc edi - sub ecx, 65536 - jc tendhline - jmp short tbeghline - -ALIGN 16 -tprebeghline: - add edi, 2 - sub ecx, 131072 - jc short tendhline -tbeghline: -tmach3d: lea ebx, [ebp+88888888h] ;bxinc -tsh3d: shr ebp, 26 -tsh4d: shld ebp, esi, 6 -tmach4d: add esi, 88888888h ;byinc -tmach1d: mov cl, byte ptr [ebp+88888888h] ;picoffs -tmach7d: lea ebp, [ebx+88888888h] ;bxinc - -tsh5d: shr ebx, 26 -tsh6d: shld ebx, esi, 6 -tmach8d: add esi, 88888888h ;byinc -tmach5d: mov ch, byte ptr [ebx+88888888h] ;picoffs - - cmp cx, 0ffffh - je short tprebeghline - - mov bx, word ptr [edi] - - cmp cl, 255 - je short tskip1 - mov al, cl -transrev6: -tmach2d: mov dl, byte ptr [eax+88888888h] ;shadeoffs -transrev7: - mov dh, bl -tmach2: mov al, byte ptr [edx+88888888h] ;_transluc - mov byte ptr [edi], al - - cmp ch, 255 - je short tskip2 -tskip1: - mov al, ch -transrev8: -tmach6d: mov dl, byte ptr [eax+88888888h] ;shadeoffs -transrev9: - mov dh, bh -tmach3: mov al, byte ptr [edx+88888888h] ;_transluc - mov byte ptr [edi+1], al -tskip2: - - add edi, 2 - sub ecx, 131072 - jnc tbeghline -tendhline: - - pop ebp -CDECLENDSET 6 - ret - - - ;eax=shiftval, ebx=palookup1, ecx=palookup2 -ALIGN 16 -PUBLIC _setuptvlineasm2 -_setuptvlineasm2: -CDECLBEGINSET 3 - mov byte ptr [tran2shra+2], al - mov byte ptr [tran2shrb+2], al - mov dword ptr [tran2pala+2], ebx - mov dword ptr [tran2palb+2], ecx - mov dword ptr [tran2palc+2], ebx - mov dword ptr [tran2pald+2], ecx -CDECLENDSET 3 - ret - - ;Pass: eax=vplc2, ebx=vinc1, ecx=bufplc1, edx=bufplc2, esi=vplc1, edi=p - ; _asm1=vinc2, _asm2=pend - ;Return: _asm1=vplc1, _asm2=vplc2 -ALIGN 16 -PUBLIC _tvlineasm2 -_tvlineasm2: -CDECLBEGINSET 6 - - push ebp - - mov ebp, eax - - mov dword ptr [tran2inca+2], ebx - mov eax, _asm1 - mov dword ptr [tran2incb+2], eax - - mov dword ptr [tran2bufa+2], ecx ;bufplc1 - mov dword ptr [tran2bufb+2], edx ;bufplc2 - - mov eax, _asm2 - sub edi, eax - mov dword ptr [tran2edia+3], eax - mov dword ptr [tran2edic+2], eax - inc eax - mov dword ptr [tran2edie+2], eax -fixchaint2a: sub eax, 320 - mov dword ptr [tran2edif+2], eax - dec eax - mov dword ptr [tran2edib+3], eax - mov dword ptr [tran2edid+2], eax - - xor ecx, ecx - xor edx, edx - jmp short begintvline2 - - ;eax 0000000000 temp temp - ;ebx 0000000000 odat2 odat1 - ;ecx 0000000000000000 ndat1 - ;edx 0000000000000000 ndat2 - ;esi vplc1 - ;edi videoplc-------------- - ;ebp vplc2 - -ALIGN 16 - ;LEFT ONLY -skipdraw2: -transrev10: -tran2edic: mov ah, byte ptr [edi+88888888h] ;getpixel -transrev11: -tran2palc: mov al, byte ptr [ecx+88888888h] ;palookup1 -fixchaint2d: add edi, 320 -tran2trac: mov bl, byte ptr [eax+88888888h] ;_transluc -tran2edid: mov byte ptr [edi+88888888h-320], bl ;drawpixel - jnc short begintvline2 - jmp endtvline2 - -skipdraw1: - cmp dl, 255 - jne short skipdraw3 -fixchaint2b: add edi, 320 - jc short endtvline2 - -begintvline2: - mov eax, esi -tran2shra: shr eax, 88h ;globalshift - mov ebx, ebp -tran2shrb: shr ebx, 88h ;globalshift -tran2inca: add esi, 88888888h ;vinc1 -tran2incb: add ebp, 88888888h ;vinc2 -tran2bufa: mov cl, byte ptr [eax+88888888h] ;bufplc1 - cmp cl, 255 -tran2bufb: mov dl, byte ptr [ebx+88888888h] ;bufplc2 - je short skipdraw1 - cmp dl, 255 - je short skipdraw2 - - ;mov ax The transluscent reverse of both! - ;mov bl, ah - ;mov ah - ;mov bh - - ;BOTH -transrev12: -tran2edia: mov bx, word ptr [edi+88888888h] ;getpixels -transrev13: - mov ah, bl -transrev14: -tran2pala: mov al, byte ptr [ecx+88888888h] ;palookup1 -transrev15: -tran2palb: mov bl, byte ptr [edx+88888888h] ;palookup2 -fixchaint2c: add edi, 320 -tran2traa: mov al, byte ptr [eax+88888888h] ;_transluc -tran2trab: mov ah, byte ptr [ebx+88888888h] ;_transluc -tran2edib: mov word ptr [edi+88888888h-320], ax ;drawpixels - jnc short begintvline2 - jmp short endtvline2 - - ;RIGHT ONLY -skipdraw3: -transrev16: -tran2edie: mov ah, byte ptr [edi+88888889h] ;getpixel -transrev17: -tran2pald: mov al, byte ptr [edx+88888888h] ;palookup2 -fixchaint2e: add edi, 320 -tran2trad: mov bl, byte ptr [eax+88888888h] ;_transluc -tran2edif: mov byte ptr [edi+88888889h-320], bl ;drawpixel - jnc short begintvline2 - -endtvline2: - mov _asm1, esi - mov _asm2, ebp - - pop ebp - -CDECLENDSET 6 - ret - - -BITSOFPRECISION equ 3 -BITSOFPRECISIONPOW equ 8 - -;Double-texture mapping with palette lookup -;eax: ylo1------------|----dat|----dat -;ebx: ylo2--------------------|----cnt -;ecx: 000000000000000000000000|---temp -;edx: xhi1-xlo1---------------|---yhi1 -;esi: xhi2-xlo2---------------|---yhi2 -;edi: ------------------------videopos -;ebp: ----------------------------temp - -ALIGN 16 -PUBLIC _setupslopevlin2 -_setupslopevlin2: -CDECLBEGINSET 6 - - mov dword ptr [slop3+2], edx ;ptr - mov dword ptr [slop7+2], edx ;ptr - mov dword ptr [slop4+2], esi ;tptr - mov dword ptr [slop8+2], esi ;tptr - mov byte ptr [slop2+2], ah ;ybits - mov byte ptr [slop6+2], ah ;ybits - mov dword ptr [slop9+2], edi ;pinc - - mov edx, 1 - mov cl, al - add cl, ah - shl edx, cl - dec edx - mov cl, ah - ror edx, cl - - mov dword ptr [slop1+2], edx ;ybits...xbits - mov dword ptr [slop5+2], edx ;ybits...xbits - -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _slopevlin2 -_slopevlin2: -CDECLBEGINSET 6 - - push ebp - xor ecx, ecx - -slopevlin2begin: - mov ebp, edx -slop1: and ebp, 88000088h ;ybits...xbits -slop2: rol ebp, 6 ;ybits - add eax, _asm1 ;xinc1<>(32-xbits)) -slop3: mov cl, byte ptr [ebp+88888888h] ;bufplc - - mov ebp, esi -slop4: mov al, byte ptr [ecx+88888888h] ;paloffs -slop5: and ebp, 88000088h ;ybits...xbits -slop6: rol ebp, 6 ;ybits - add ebx, _asm3 ;xinc2<>(32-xbits)) -slop8: mov ah, byte ptr [ecx+88888888h] ;paloffs - - dec bl - mov word ptr [edi], ax -slop9: lea edi, [edi+88888888h] ;pinc - jnz short slopevlin2begin - - pop ebp - mov eax, edi - -CDECLENDSET 6 - ret - - -ALIGN 16 -PUBLIC _setupslopevlin -_setupslopevlin: -CDECLBEGINSET 3 - - mov dword ptr [slopmach3+3], ebx ;ptr - mov dword ptr [slopmach5+2], ecx ;pinc - neg ecx - mov dword ptr [slopmach6+2], ecx ;-pinc - - mov edx, 1 - mov cl, al - shl edx, cl - dec edx - mov cl, ah - shl edx, cl - mov dword ptr [slopmach7+2], edx - - neg ah - mov byte ptr [slopmach2+2], ah - - sub ah, al - mov byte ptr [slopmach1+2], ah - - fild dword ptr _asm1 - fstp dword ptr _asm2 - -CDECLENDSET 3 - ret - -ALIGN 16 -PUBLIC _slopevlin -_slopevlin: -CDECLBEGINSET 6 - - mov _ebpbak, ebp - mov _espbak, esp - - sub ecx, esp - mov dword ptr [slopmach4+3], ecx - - fild dword ptr _asm3 -slopmach6: lea ebp, [eax+88888888h] - fadd dword ptr _asm2 - - mov _asm1, ebx - shl ebx, 3 - - mov eax, _globalx3 - mov ecx, _globaly3 - imul eax, ebx - imul ecx, ebx - add esi, eax - add edi, ecx - - mov ebx, edx - jmp short bigslopeloop -ALIGN 16 -bigslopeloop: - fst dword ptr _fpuasm - - mov eax, _fpuasm - add eax, eax - sbb edx, edx - mov ecx, eax - shr ecx, 24 - and eax, 00ffe000h - shr eax, 11 - sub cl, 2 - mov eax, dword ptr _reciptable[eax] - shr eax, cl - xor eax, edx - mov edx, _asm1 - mov ecx, _globalx3 - mov _asm1, eax - sub eax, edx - mov edx, _globaly3 - imul ecx, eax - imul eax, edx - - fadd dword ptr _asm2 - - cmp ebx, BITSOFPRECISIONPOW - mov _asm4, ebx - mov cl, bl - jl short slopeskipmin - mov cl, BITSOFPRECISIONPOW -slopeskipmin: - -;eax: yinc............. -;ebx: 0 0 0 ? -;ecx: xinc......... cnt -;edx: ? -;esi: xplc............. -;edi: yplc............. -;ebp: videopos - - mov ebx, esi - mov edx, edi - -beginnerslopeloop: -slopmach1: shr ebx, 20 - add esi, ecx -slopmach2: shr edx, 26 -slopmach7: and ebx, 88888888h - add edi, eax -slopmach5: add ebp, 88888888h ;pinc -slopmach3: mov dl, byte ptr [ebx+edx+88888888h] ;ptr -slopmach4: mov ebx, dword ptr [esp+88888888h] - sub esp, 4 - dec cl - mov al, byte ptr [ebx+edx] ;tptr - mov ebx, esi - mov [ebp], al - mov edx, edi - jnz short beginnerslopeloop - - mov ebx, _asm4 - sub ebx, BITSOFPRECISIONPOW - jg bigslopeloop - - ffree st(0) - - mov esp, _espbak - mov ebp, _ebpbak - -CDECLENDSET 6 - ret - - -ALIGN 16 -PUBLIC _setuprhlineasm4 -_setuprhlineasm4: -CDECLBEGINSET 6 - - mov dword ptr [rmach1a+2], eax - mov dword ptr [rmach1b+2], eax - mov dword ptr [rmach1c+2], eax - mov dword ptr [rmach1d+2], eax - mov dword ptr [rmach1e+2], eax - - mov dword ptr [rmach2a+2], ebx - mov dword ptr [rmach2b+2], ebx - mov dword ptr [rmach2c+2], ebx - mov dword ptr [rmach2d+2], ebx - mov dword ptr [rmach2e+2], ebx - - mov dword ptr [rmach3a+2], ecx - mov dword ptr [rmach3b+2], ecx - mov dword ptr [rmach3c+2], ecx - mov dword ptr [rmach3d+2], ecx - mov dword ptr [rmach3e+2], ecx - - mov dword ptr [rmach4a+2], edx - mov dword ptr [rmach4b+2], edx - mov dword ptr [rmach4c+2], edx - mov dword ptr [rmach4d+2], edx - mov dword ptr [rmach4e+2], edx - - mov dword ptr [rmach5a+2], esi - mov dword ptr [rmach5b+2], esi - mov dword ptr [rmach5c+2], esi - mov dword ptr [rmach5d+2], esi - mov dword ptr [rmach5e+2], esi - -CDECLENDSET 6 - ret - - ;Non power of 2, non masking, with palookup method #1 (6 clock cycles) - ;eax: dat dat dat dat - ;ebx: bufplc - ;ecx: 0 dat - ;edx: xlo - ;esi: ylo - ;edi: videopos/cnt - ;ebp: tempvar - ;esp: -ALIGN 16 -PUBLIC _rhlineasm4 -_rhlineasm4: -CDECLBEGINSET 6 - - push ebp - - cmp eax, 0 - jle endrhline - - lea ebp, [edi-4] - sub ebp, eax - mov dword ptr [rmach6a+2], ebp - add ebp, 3 - mov dword ptr [rmach6b+2], ebp - mov edi, eax - test edi, 3 - jz short begrhline - jmp short startrhline1 - -ALIGN 16 -startrhline1: - mov cl, byte ptr [ebx] ;bufplc -rmach1e: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2e: sub esi, 88888888h ;ylo -rmach3e: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach4e: mov al, byte ptr [ecx+88888888h] ;palookup -rmach5e: and ebp, 88888888h ;tilesizy -rmach6b: mov byte ptr [edi+88888888h], al ;vidcntoffs - sub ebx, ebp - dec edi - test edi, 3 - jnz short startrhline1 - test edi, edi - jz endrhline - -begrhline: - mov cl, byte ptr [ebx] ;bufplc -rmach1a: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2a: sub esi, 88888888h ;ylo -rmach3a: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5a: and ebp, 88888888h ;tilesizy - sub ebx, ebp - -rmach1b: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach4a: mov ah, byte ptr [ecx+88888888h] ;palookup - mov cl, byte ptr [ebx] ;bufplc -rmach2b: sub esi, 88888888h ;ylo -rmach3b: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5b: and ebp, 88888888h ;tilesizy -rmach4b: mov al, byte ptr [ecx+88888888h] ;palookup - sub ebx, ebp - - shl eax, 16 - - mov cl, byte ptr [ebx] ;bufplc -rmach1c: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2c: sub esi, 88888888h ;ylo -rmach3c: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5c: and ebp, 88888888h ;tilesizy - sub ebx, ebp - -rmach1d: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach4c: mov ah, byte ptr [ecx+88888888h] ;palookup - mov cl, byte ptr [ebx] ;bufplc -rmach2d: sub esi, 88888888h ;ylo -rmach3d: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5d: and ebp, 88888888h ;tilesizy -rmach4d: mov al, byte ptr [ecx+88888888h] ;palookup - sub ebx, ebp - -rmach6a: mov dword ptr [edi+88888888h], eax ;vidcntoffs - sub edi, 4 - jnz begrhline -endrhline: - pop ebp - -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _setuprmhlineasm4 -_setuprmhlineasm4: -CDECLBEGINSET 6 - mov dword ptr [rmmach1+2], eax - mov dword ptr [rmmach2+2], ebx - mov dword ptr [rmmach3+2], ecx - mov dword ptr [rmmach4+2], edx - mov dword ptr [rmmach5+2], esi -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _rmhlineasm4 -_rmhlineasm4: -CDECLBEGINSET 6 - - push ebp - - cmp eax, 0 - jle short endrmhline - - lea ebp, [edi-1] - sub ebp, eax - mov dword ptr [rmmach6+2], ebp - mov edi, eax - jmp short begrmhline - -ALIGN 16 -begrmhline: - mov cl, byte ptr [ebx] ;bufplc -rmmach1: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmmach2: sub esi, 88888888h ;ylo -rmmach3: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmmach5: and ebp, 88888888h ;tilesizy - cmp cl, 255 - je short rmskip -rmmach4: mov al, byte ptr [ecx+88888888h] ;palookup -rmmach6: mov byte ptr [edi+88888888h], al ;vidcntoffs -rmskip: - sub ebx, ebp - dec edi - jnz short begrmhline -endrmhline: - pop ebp - -CDECLENDSET 6 - ret - -ALIGN 16 -PUBLIC _setupqrhlineasm4 -_setupqrhlineasm4: -CDECLBEGINSET 6 - - mov dword ptr [qrmach2e+2], ebx - mov dword ptr [qrmach3e+2], ecx - xor edi, edi - sub edi, ecx - mov dword ptr [qrmach7a+2], edi - mov dword ptr [qrmach7b+2], edi - - add ebx, ebx - adc ecx, ecx - mov dword ptr [qrmach2a+2], ebx - mov dword ptr [qrmach2b+2], ebx - mov dword ptr [qrmach3a+2], ecx - mov dword ptr [qrmach3b+2], ecx - - mov dword ptr [qrmach4a+2], edx - mov dword ptr [qrmach4b+2], edx - mov dword ptr [qrmach4c+2], edx - mov dword ptr [qrmach4d+2], edx - mov dword ptr [qrmach4e+2], edx - -CDECLENDSET 6 - ret - - ;Non power of 2, non masking, with palookup method (FASTER BUT NO SBB'S) - ;eax: dat dat dat dat - ;ebx: bufplc - ;ecx: 0 dat - ;edx: 0 dat - ;esi: ylo - ;edi: videopos/cnt - ;ebp: ? - ;esp: -ALIGN 16 -PUBLIC _qrhlineasm4 ;4 pixels in 9 cycles! 2.25 cycles/pixel -_qrhlineasm4: -CDECLBEGINSET 6 - - push ebp - - cmp eax, 0 - jle endqrhline - - mov ebp, eax - test ebp, 3 - jz short skipqrhline1 - jmp short startqrhline1 - -ALIGN 16 -startqrhline1: - mov cl, byte ptr [ebx] ;bufplc - dec edi -qrmach2e: sub esi, 88888888h ;ylo - dec ebp -qrmach3e: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4e: mov al, byte ptr [ecx+88888888h] ;palookup - mov byte ptr [edi], al ;vidcntoffs - test ebp, 3 - jnz short startqrhline1 - test ebp, ebp - jz short endqrhline - -skipqrhline1: - mov cl, byte ptr [ebx] ;bufplc - jmp short begqrhline -ALIGN 16 -begqrhline: -qrmach7a: mov dl, byte ptr [ebx+88888888h] ;bufplc -qrmach2a: sub esi, 88888888h ;ylo -qrmach3a: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4a: mov ah, byte ptr [ecx+88888888h] ;palookup -qrmach4b: mov al, byte ptr [edx+88888888h] ;palookup - sub edi, 4 - shl eax, 16 - mov cl, byte ptr [ebx] ;bufplc -qrmach7b: mov dl, byte ptr [ebx+88888888h] ;bufplc -qrmach2b: sub esi, 88888888h ;ylo -qrmach3b: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4c: mov ah, byte ptr [ecx+88888888h] ;palookup -qrmach4d: mov al, byte ptr [edx+88888888h] ;palookup - mov cl, byte ptr [ebx] ;bufplc - mov dword ptr [edi], eax - sub ebp, 4 - jnz short begqrhline - -endqrhline: - pop ebp - -CDECLENDSET 6 - ret - - -PUBLIC _setupdrawslab -_setupdrawslab: -CDECLBEGINSET 2 - - mov dword ptr [voxbpl1+2], eax - mov dword ptr [voxbpl2+2], eax - mov dword ptr [voxbpl3+2], eax - mov dword ptr [voxbpl4+2], eax - mov dword ptr [voxbpl5+2], eax - mov dword ptr [voxbpl6+2], eax - mov dword ptr [voxbpl7+2], eax - mov dword ptr [voxbpl8+2], eax - - mov dword ptr [voxpal1+2], ebx - mov dword ptr [voxpal2+2], ebx - mov dword ptr [voxpal3+2], ebx - mov dword ptr [voxpal4+2], ebx - mov dword ptr [voxpal5+2], ebx - mov dword ptr [voxpal6+2], ebx - mov dword ptr [voxpal7+2], ebx - mov dword ptr [voxpal8+2], ebx - -CDECLENDSET 2 - ret - -ALIGN 16 -PUBLIC _drawslab -_drawslab: -CDECLBEGINSET 6 - - push ebp - cmp eax, 2 - je voxbegdraw2 - ja voxskip2 - xor eax, eax -voxbegdraw1: - mov ebp, ebx - shr ebp, 16 - add ebx, edx - dec ecx - mov al, byte ptr [esi+ebp] -voxpal1: mov al, byte ptr [eax+88888888h] - mov byte ptr [edi], al -voxbpl1: lea edi, [edi+88888888h] - jnz voxbegdraw1 - pop ebp - -CDECLENDSET 6 - ret - -voxbegdraw2: - mov ebp, ebx - shr ebp, 16 - add ebx, edx - xor eax, eax - dec ecx - mov al, byte ptr [esi+ebp] -voxpal2: mov al, byte ptr [eax+88888888h] - mov ah, al - mov word ptr [edi], ax -voxbpl2: lea edi, [edi+88888888h] - jnz voxbegdraw2 - pop ebp - -CDECLENDSET 6 - ret - -voxskip2: - cmp eax, 4 - jne voxskip4 - xor eax, eax -voxbegdraw4: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal3: mov al, byte ptr [eax+88888888h] - mov ah, al - shl eax, 8 - mov al, ah - shl eax, 8 - mov al, ah - mov dword ptr [edi], eax -voxbpl3: add edi, 88888888h - dec ecx - jnz voxbegdraw4 - pop ebp - -CDECLENDSET 6 - ret - -voxskip4: - add eax, edi - - test edi, 1 - jz voxskipslab1 - cmp edi, eax - je voxskipslab1 - - push eax - push ebx - push ecx - push edi -voxbegslab1: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal4: mov al, byte ptr [eax+88888888h] - mov byte ptr [edi], al -voxbpl4: add edi, 88888888h - dec ecx - jnz voxbegslab1 - pop edi - pop ecx - pop ebx - pop eax - inc edi - -voxskipslab1: - push eax - test edi, 2 - jz voxskipslab2 - dec eax - cmp edi, eax - jge voxskipslab2 - - push ebx - push ecx - push edi -voxbegslab2: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal5: mov al, byte ptr [eax+88888888h] - mov ah, al - mov word ptr [edi], ax -voxbpl5: add edi, 88888888h - dec ecx - jnz voxbegslab2 - pop edi - pop ecx - pop ebx - add edi, 2 - -voxskipslab2: - mov eax, [esp] - - sub eax, 3 - cmp edi, eax - jge voxskipslab3 - -voxprebegslab3: - push ebx - push ecx - push edi -voxbegslab3: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal6: mov al, byte ptr [eax+88888888h] - mov ah, al - shl eax, 8 - mov al, ah - shl eax, 8 - mov al, ah - mov dword ptr [edi], eax -voxbpl6: add edi, 88888888h - dec ecx - jnz voxbegslab3 - pop edi - pop ecx - pop ebx - add edi, 4 - - mov eax, [esp] - - sub eax, 3 - cmp edi, eax - jl voxprebegslab3 - -voxskipslab3: - mov eax, [esp] - - dec eax - cmp edi, eax - jge voxskipslab4 - - push ebx - push ecx - push edi -voxbegslab4: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal7: mov al, byte ptr [eax+88888888h] - mov ah, al - mov word ptr [edi], ax -voxbpl7: add edi, 88888888h - dec ecx - jnz voxbegslab4 - pop edi - pop ecx - pop ebx - add edi, 2 - -voxskipslab4: - pop eax - - cmp edi, eax - je voxskipslab5 - -voxbegslab5: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal8: mov al, byte ptr [eax+88888888h] - mov byte ptr [edi], al -voxbpl8: add edi, 88888888h - dec ecx - jnz voxbegslab5 - -voxskipslab5: - pop ebp - -CDECLENDSET 6 - ret - -;modify: loinc -;eax: | dat | dat | dat | dat | -;ebx: | loplc1 | -;ecx: | loplc2 | cnthi | cntlo | -;edx: |--------|--------|--------| hiplc1 | -;esi: |--------|--------|--------| hiplc2 | -;edi: |--------|--------|--------| vidplc | -;ebp: |--------|--------|--------| hiinc | - -PUBLIC _stretchhline -_stretchhline: -CDECLBEGINSET 6 - - push ebp - - mov eax, ebx - shl ebx, 16 - sar eax, 16 - and ecx, 0000ffffh - or ecx, ebx - - add esi, eax - mov eax, edx - mov edx, esi - - mov ebp, eax - shl eax, 16 - sar ebp, 16 - - add ecx, eax - adc esi, ebp - - add eax, eax - adc ebp, ebp - mov dword ptr [loinc1+2], eax - mov dword ptr [loinc2+2], eax - mov dword ptr [loinc3+2], eax - mov dword ptr [loinc4+2], eax - - inc ch - - jmp begloop - -begloop: - mov al, [edx] -loinc1: sub ebx, 88888888h - sbb edx, ebp - mov ah, [esi] -loinc2: sub ecx, 88888888h - sbb esi, ebp - sub edi, 4 - shl eax, 16 -loinc3: sub ebx, 88888888h - mov al, [edx] - sbb edx, ebp - mov ah, [esi] -loinc4: sub ecx, 88888888h - sbb esi, ebp - mov [edi], eax - dec cl - jnz begloop - dec ch - jnz begloop - - pop ebp - -CDECLENDSET 6 - ret - - -PUBLIC _mmxoverlay -_mmxoverlay: - push ebx ;JBF - push ecx ;JBF - push edx ;JBF - - pushfd ;Check if CPUID is available - pop eax - mov ebx, eax - xor eax, 00200000h - push eax - popfd - pushfd - pop eax - cmp eax, ebx - je pentium - xor eax, eax - dw 0a20fh - test eax, eax - jz pentium - mov eax, 1 - dw 0a20fh - and eax, 00000f00h - test edx, 00800000h ;Check if MMX is available - jz nommx - cmp eax, 00000600h ;Check if P6 Family or not - jae pentiumii - jmp pentiummmx -nommx: - cmp eax, 00000600h ;Check if P6 Family or not - jae pentiumpro -pentium: - - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM II Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiumii: - ;Hline overlay (MMX doens't help) - mov byte ptr [_sethlinesizes], 0e9h - mov dword ptr [_sethlinesizes+1], (offset _prosethlinesizes)-(offset _sethlinesizes)-5 - mov byte ptr [_setpalookupaddress], 0e9h - mov dword ptr [_setpalookupaddress+1], (offset _prosetpalookupaddress)-(offset _setpalookupaddress)-5 - mov byte ptr [_setuphlineasm4], 0c3h ;ret (no code required) - mov byte ptr [_hlineasm4], 0e9h - mov dword ptr [_hlineasm4+1], (offset _prohlineasm4)-(offset _hlineasm4)-5 - - ;Vline overlay - mov byte ptr [_setupvlineasm], 0e9h - mov dword ptr [_setupvlineasm+1], (offset _prosetupvlineasm)-(offset _setupvlineasm)-5 - mov byte ptr [_vlineasm4], 0e9h - mov dword ptr [_vlineasm4+1], (offset _provlineasm4)-(offset _vlineasm4)-5 - - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM MMX Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiummmx: - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM PRO Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiumpro: - ;Hline overlay (MMX doens't help) - mov byte ptr [_sethlinesizes], 0e9h - mov dword ptr [_sethlinesizes+1], (offset _prosethlinesizes)-(offset _sethlinesizes)-5 - mov byte ptr [_setpalookupaddress], 0e9h - mov dword ptr [_setpalookupaddress+1], (offset _prosetpalookupaddress)-(offset _setpalookupaddress)-5 - mov byte ptr [_setuphlineasm4], 0c3h ;ret (no code required) - mov byte ptr [_hlineasm4], 0e9h - mov dword ptr [_hlineasm4+1], (offset _prohlineasm4)-(offset _hlineasm4)-5 - - ;Vline overlay - mov byte ptr [_setupvlineasm], 0e9h - mov dword ptr [_setupvlineasm+1], (offset _prosetupvlineasm)-(offset _setupvlineasm)-5 - mov byte ptr [_vlineasm4], 0e9h - mov dword ptr [_vlineasm4+1], (offset _provlineasm4)-(offset _vlineasm4)-5 - - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -PUBLIC _dep_end -_dep_end: -code ends -END diff --git a/polymer-perf/eduke32/build/src/a.nasm b/polymer-perf/eduke32/build/src/a.nasm deleted file mode 100644 index 7faa3f2e2..000000000 --- a/polymer-perf/eduke32/build/src/a.nasm +++ /dev/null @@ -1,2758 +0,0 @@ -; "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -; Ken Silverman's official web site: "http://www.advsys.net/ken" -; See the included license file "BUILDLIC.TXT" for license info. -; -; This file has been modified from Ken Silverman's original release -; by Jonathon Fowler (jonof@edgenetwk.com) - -;CPU 586 - -SECTION .text - -%ifdef UNDERSCORES -%define asm1 _asm1 -%define asm2 _asm2 -%define asm3 _asm3 -%define asm4 _asm4 -%define reciptable _reciptable -%define fpuasm _fpuasm -%define globalx3 _globalx3 -%define globaly3 _globaly3 -%define ylookup _ylookup -%define vplce _vplce -%define vince _vince -%define palookupoffse _palookupoffse -%define bufplce _bufplce -%define ebpbak _ebpbak -%define espbak _espbak -%define pow2char _pow2char -%define pow2long _pow2long - -%define sethlinesizes _sethlinesizes -%define prosethlinesizes _prosethlinesizes -%define setvlinebpl _setvlinebpl -%define setpalookupaddress _setpalookupaddress -%define prosetpalookupaddress _prosetpalookupaddress -%define setuphlineasm4 _setuphlineasm4 -%define hlineasm4 _hlineasm4 -%define prohlineasm4 _prohlineasm4 -%define prosetuphlineasm4 _prosetupvlineasm -%define setupmvlineasm _setupmvlineasm -%define setuptvlineasm _setuptvlineasm -%define prevlineasm1 _prevlineasm1 -%define vlineasm1 _vlineasm1 -%define mvlineasm1 _mvlineasm1 -%define fixtransluscence _fixtransluscence -%define settransnormal _settransnormal -%define settransreverse _settransreverse -%define tvlineasm1 _tvlineasm1 -%define vlineasm4 _vlineasm4 -%define provlineasm4 _provlineasm4 -%define setupvlineasm _setupvlineasm -%define mvlineasm4 _mvlineasm4 -%define setupspritevline _setupspritevline -%define spritevline _spritevline -%define msetupspritevline _msetupspritevline -%define mspritevline _mspritevline -%define tsetupspritevline _tsetupspritevline -%define tspritevline _tspritevline -%define msethlineshift _msethlineshift -%define mhline _mhline -%define mhlineskipmodify _mhlineskipmodify -%define tsethlineshift _tsethlineshift -%define thline _thline -%define thlineskipmodify _thlineskipmodify -%define setuptvlineasm2 _setuptvlineasm2 -%define tvlineasm2 _tvlineasm2 -%define setupslopevlin2 _setupslopevlin2 -%define slopevlin2 _slopevlin2 -%define setupslopevlin _setupslopevlin -%define slopevlin _slopevlin -%define setuprhlineasm4 _setuprhlineasm4 -%define rhlineasm4 _rhlineasm4 -%define setuprmhlineasm4 _setuprmhlineasm4 -%define rmhlineasm4 _rmhlineasm4 -%define setupqrhlineasm4 _setupqrhlineasm4 -%define qrhlineasm4 _qrhlineasm4 -%define setupdrawslab _setupdrawslab -%define drawslab _drawslab -%define stretchhline _stretchhline -%define mmxoverlay _mmxoverlay - -%define dep_begin _dep_begin -%define dep_end _dep_end -%endif - -; Some macros to help make cdecl calling easier to manage -%macro CDECLBEGIN 1 -%if %1 >= 2 - push ebx -%endif -%if %1 >= 3 - push ecx -%endif -%if %1 >= 4 - push edx -%endif -%if %1 >= 5 - push esi -%endif -%if %1 >= 6 - push edi -%endif -%endmacro - -%macro CDECLEND 1 -%if %1 >= 6 - pop edi -%endif -%if %1 >= 5 - pop esi -%endif -%if %1 >= 4 - pop edx -%endif -%if %1 >= 3 - pop ecx -%endif -%if %1 >= 2 - pop ebx -%endif -%endmacro - -%macro CDECLPARAM 3 -; mov %1, dword [esp + (%2*4+16)] - mov %1, dword [esp + ((%2+%3)*4+4)] -%endmacro - -%macro CDECLBEGINSET 1 - CDECLBEGIN %1 - -%assign _offsetted %1-1 - -%if %1 >= 1 - CDECLPARAM eax,0,_offsetted -%endif -%if %1 >= 2 - CDECLPARAM ebx,1,_offsetted -%endif -%if %1 >= 3 - CDECLPARAM ecx,2,_offsetted -%endif -%if %1 >= 4 - CDECLPARAM edx,3,_offsetted -%endif -%if %1 >= 5 - CDECLPARAM esi,4,_offsetted -%endif -%if %1 >= 6 - CDECLPARAM edi,5,_offsetted -%endif -%endmacro - -%macro CDECLENDSET 1 - CDECLEND %1 -%endmacro - - - EXTERN asm1 - EXTERN asm2 - EXTERN asm3 - EXTERN asm4 - EXTERN reciptable - EXTERN fpuasm - EXTERN globalx3 - EXTERN globaly3 - EXTERN ylookup - - EXTERN vplce - EXTERN vince - EXTERN palookupoffse - EXTERN bufplce - - EXTERN ebpbak - EXTERN espbak - - EXTERN pow2char - EXTERN pow2long - - GLOBAL sethlinesizes - GLOBAL prosethlinesizes - GLOBAL setvlinebpl - GLOBAL setpalookupaddress - GLOBAL prosetpalookupaddress - GLOBAL setuphlineasm4 - GLOBAL hlineasm4 - GLOBAL prohlineasm4 - GLOBAL prosetupvlineasm - GLOBAL setupmvlineasm - GLOBAL setuptvlineasm - GLOBAL prevlineasm1 - GLOBAL vlineasm1 - GLOBAL mvlineasm1 ;Masked vline - GLOBAL fixtransluscence - GLOBAL settransnormal - GLOBAL settransreverse - GLOBAL tvlineasm1 ;Masked & transluscent vline - GLOBAL vlineasm4 - GLOBAL provlineasm4 - GLOBAL setupvlineasm - GLOBAL mvlineasm4 - GLOBAL setupspritevline - GLOBAL spritevline - GLOBAL msetupspritevline - GLOBAL mspritevline - GLOBAL tsetupspritevline - GLOBAL tspritevline - GLOBAL msethlineshift - GLOBAL mhline - GLOBAL mhlineskipmodify - GLOBAL tsethlineshift - GLOBAL thline - GLOBAL thlineskipmodify - GLOBAL setuptvlineasm2 - GLOBAL tvlineasm2 - GLOBAL setupslopevlin2 - GLOBAL slopevlin2 - GLOBAL setupslopevlin - GLOBAL slopevlin - GLOBAL setuprhlineasm4 - GLOBAL rhlineasm4 - GLOBAL setuprmhlineasm4 - GLOBAL rmhlineasm4 - GLOBAL setupqrhlineasm4 - GLOBAL qrhlineasm4 ;4 pixels in 9 cycles! 2.25 cycles/pixel - GLOBAL setupdrawslab - GLOBAL drawslab - GLOBAL stretchhline - GLOBAL mmxoverlay - - GLOBAL dep_begin - GLOBAL dep_end - -dep_begin: - - ALIGN 16 -sethlinesizes: -CDECLBEGINSET 3 - - mov byte [machxbits1+2], al - mov byte [machxbits2+2], al - mov byte [machxbits3+2], al - neg al - mov byte [hxsiz1+2], al - mov byte [hxsiz2+2], al - mov byte [hxsiz3+2], al - mov byte [hxsiz4+2], al - mov byte [machnegxbits1+2], al - - mov byte [hysiz1+3], bl - mov byte [hysiz2+3], bl - mov byte [hysiz3+3], bl - mov byte [hysiz4+3], bl - mov byte [hmach3a+2], bl - mov byte [hmach3b+2], bl - mov byte [hmach3c+2], bl - mov byte [hmach3d+2], bl - - mov dword [hoffs1+2], ecx - mov dword [hoffs2+2], ecx - mov dword [hoffs3+2], ecx - mov dword [hoffs4+2], ecx - mov dword [hoffs5+2], ecx - mov dword [hoffs6+2], ecx - mov dword [hoffs7+2], ecx - mov dword [hoffs8+2], ecx - - push edx ;JBF - mov edx, -1 - mov cl, al - sub cl, bl - shr edx, cl - mov dword [hmach2a+1], edx - mov dword [hmach2b+1], edx - mov dword [hmach2c+1], edx - mov dword [hmach2d+1], edx - pop edx ;JBF - -CDECLENDSET 3 - ret - - - ALIGN 16 -prosethlinesizes: -CDECLBEGINSET 3 - - mov dword [prohbuf-4], ecx - neg eax - mov ecx, eax - sub eax, ebx - mov byte [prohshru-1], al ;bl = 32-al-bl - mov eax, -1 - shr eax, cl - mov ecx, ebx - shl eax, cl - mov dword [prohand-4], eax ;((-1>>(-oal))<>(32-xbits) adc al, 88h 1 1/2 - ;bufplc mov cl, byte [edx+88888888h] 1 1/2 - ;paloffs&255 mov bl, byte [ecx+88888888h] 1 1/2 - ALIGN 16 -hlineasm4: -CDECLBEGINSET 6 - - push ebp - - lea ebp, [eax+1] - - cmp ebp, 8 - jle near shorthline - - test edi, 1 - jnz short skipthe1byte - - mov eax, esi -hxsiz1: shr eax, 26 -hysiz1: shld eax, edx, 6 -hoffs1: mov cl, byte [eax+88888888h] -pal1: mov bl, byte [ecx+88888888h] - sub esi, dword [asm1] - sub edx, dword [asm2] - mov byte [edi], bl - dec edi - dec ebp - -skipthe1byte: - test edi, 2 - jnz short skipthe2byte - - mov eax, esi -hxsiz2: shr eax, 26 -hysiz2: shld eax, edx, 6 -hoffs2: mov cl, byte [eax+88888888h] -pal2: mov bh, byte [ecx+88888888h] - sub esi, dword [asm1] - sub edx, dword [asm2] - - mov eax, esi -hxsiz3: shr eax, 26 -hysiz3: shld eax, edx, 6 -hoffs3: mov cl, byte [eax+88888888h] -pal3: mov bl, byte [ecx+88888888h] - sub esi, dword [asm1] - sub edx, dword [asm2] - mov word [edi-1], bx - sub edi, 2 - sub ebp, 2 - -skipthe2byte: - - mov eax, esi -machxbits1: shl esi, 6 ;xbits -machnegxbits1: shr eax, 32-6 ;32-xbits - mov dl, al - - inc edi - - add ebx, ebx - mov eax, edx - jc beginhline64 - - mov eax, dword [asm1] -machxbits2: rol eax, 6 ;xbits - mov dword [hmach4a+2], eax - mov dword [hmach4b+2], eax - mov dword [hmach4c+2], eax - mov dword [hmach4d+2], eax - mov ebx, eax - mov eax, dword [asm2] - mov al, bl - mov dword [hmach1a+2], eax - mov dword [hmach1b+2], eax - mov dword [hmach1c+2], eax - mov dword [hmach1d+2], eax - - mov eax, edx - jmp beginhline64 -ALIGN 16 -prebeginhline64: - mov dword [edi], ebx -beginhline64: - -hmach3a: rol eax, 6 -hmach2a: and eax, 00008888h -hmach4a: sub esi, 88888888h -hmach1a: sbb edx, 88888888h - sub edi, 4 -hoffs4: mov cl, byte [eax+88888888h] - mov eax, edx - -hmach3b: rol eax, 6 -hmach2b: and eax, 00008888h -hmach4b: sub esi, 88888888h -hmach1b: sbb edx, 88888888h -pal4: mov bh, byte [ecx+88888888h] -hoffs5: mov cl, byte [eax+88888888h] - mov eax, edx - -hmach3c: rol eax, 6 -pal5: mov bl, byte [ecx+88888888h] -hmach2c: and eax, 00008888h - shl ebx, 16 -hmach4c: sub esi, 88888888h -hmach1c: sbb edx, 88888888h -hoffs6: mov cl, byte [eax+88888888h] - - mov eax, edx - ;( - -hmach3d: rol eax, 6 -hmach2d: and eax, 00008888h -hmach4d: sub esi, 88888888h -hmach1d: sbb edx, 88888888h -pal6: mov bh, byte [ecx+88888888h] -hoffs7: mov cl, byte [eax+88888888h] - mov eax, edx - sub ebp, 4 - nop -pal7: mov bl, byte [ecx+88888888h] - jnc near prebeginhline64 -skipthe4byte: - - test ebp, 2 - jz skipdrawthe2 - rol ebx, 16 - mov word [edi+2], bx - sub edi, 2 -skipdrawthe2: - test ebp, 1 - jz skipdrawthe1 - shr ebx, 24 - mov byte [edi+3], bl -skipdrawthe1: - - pop ebp -CDECLENDSET 6 - ret - -shorthline: - test ebp, ebp - jz endshorthline -begshorthline: - mov eax, esi -hxsiz4: shr eax, 26 -hysiz4: shld eax, edx, 6 -hoffs8: mov cl, byte [eax+88888888h] -pal8: mov bl, byte [ecx+88888888h] - sub esi, dword [asm1] - sub edx, dword [asm2] - mov byte [edi], bl - dec edi - dec ebp - jnz near begshorthline -endshorthline: - pop ebp -CDECLENDSET 6 - ret - - - ;eax: 00000000 00000000 00000000 temp---- - ;ebx: 00000000 00000000 00000000 temp---- - ;ecx: UUUUUUuu uuuuuuuu uuuuuuuu uuuuuuuu - ;edx: VVVVVVvv vvvvvvvv vvvvvvvv vvvvvvvv - ;esi: cnt----- -------- -------- -------- - ;edi: vid----- -------- -------- -------- - ;ebp: paloffs- -------- -------- -------- - ;esp: ???????? ???????? ???????? ???????? - ALIGN 16 -prohlineasm4: -CDECLBEGINSET 6 - - push ebp - - lea ebp, [ecx+88888888h] -prohpala: - mov ecx, esi - lea esi, [eax+1] - sub edi, esi - -prohbeg: - mov eax, ecx - shr eax, 20 -prohshru: - mov ebx, edx - shr ebx, 26 -prohshrv: - and eax, 88888888h -prohand: - movzx eax, byte [eax+ebx+88888888h] -prohbuf: - mov al, [eax+ebp] - sub ecx, dword [asm1] - sub edx, dword [asm2] - mov [edi+esi], al - dec esi - jnz prohbeg - - pop ebp -CDECLENDSET 6 - ret - - - - ALIGN 16 -setupvlineasm: -CDECLBEGINSET 1 - ;First 2 lines for VLINEASM1, rest for VLINEASM4 - mov byte [premach3a+2], al - mov byte [mach3a+2], al - - push ecx - mov byte [machvsh1+2], al ;32-shy - mov byte [machvsh3+2], al ;32-shy - mov byte [machvsh5+2], al ;32-shy - mov byte [machvsh6+2], al ;32-shy - mov ah, al - sub ah, 16 - mov byte [machvsh8+2], ah ;16-shy - neg al - mov byte [machvsh7+2], al ;shy - mov byte [machvsh9+2], al ;shy - mov byte [machvsh10+2], al ;shy - mov byte [machvsh11+2], al ;shy - mov byte [machvsh12+2], al ;shy - mov cl, al - mov eax, 1 - shl eax, cl - dec eax - mov dword [machvsh2+2], eax ;(1<>sh) - ;vplc3 = (ebp<<(32-sh))+((edx&65535)<<(16-sh)) -machvsh5: shl esi, 88h ;32-sh - mov eax, edx -machvsh6: shl ebp, 88h ;32-sh - and edx, 0000ffffh -machvsh7: shr eax, 88h ;sh - add esi, eax -machvsh8: shl edx, 88h ;16-sh - add ebp, edx - mov dword [vplce+12], esi - mov dword [vplce+4], ebp - - pop ebp -CDECLEND 6 - ret - - ;eax: -------temp1------- - ;ebx: -------temp2------- - ;ecx: ylo4 --------- - ;edx: ylo2 --------- - ;esi: yhi1 yhi2 - ;edi: ---videoplc/cnt---- - ;ebp: yhi3 yhi4 - ;esp: - ALIGN 16 -provlineasm4: -CDECLBEGIN 6 -CDECLPARAM ecx,0,5 -CDECLPARAM edi,1,5 - push ebp - - mov eax, dword [ylookup+ecx*4] - add eax, edi - mov dword [promachvline4end1+2], eax - inc eax - mov dword [promachvline4end2+2], eax - inc eax - mov dword [promachvline4end3+2], eax - inc eax - mov dword [promachvline4end4+2], eax - sub eax, 3 - sub edi, eax - - mov eax, dword [bufplce] - mov ebx, dword [bufplce+4] - mov ecx, dword [bufplce+8] - mov edx, dword [bufplce+12] - mov dword [promachvbuf1+3], ecx - mov dword [promachvbuf2+3], edx - mov dword [promachvbuf3+3], eax - mov dword [promachvbuf4+3], ebx - - mov eax, dword [palookupoffse] - mov ebx, dword [palookupoffse+4] - mov ecx, dword [palookupoffse+8] - mov edx, dword [palookupoffse+12] - mov dword [promachvpal1+2], ecx - mov dword [promachvpal2+2], edx - mov dword [promachvpal3+2], eax - mov dword [promachvpal4+2], ebx - - ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - ;edx: ³v3lo ³v1lo ³ - ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄ´ - ;esi: ³v2hi v2lo ³ v3hi³ - ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ´ - ;ebp: ³v0hi v0lo ³ v1hi³ - ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÙ - - mov ebp, dword [vince] - mov ebx, dword [vince+4] - mov esi, dword [vince+8] - mov eax, dword [vince+12] - and esi, 0fffffe00h - and ebp, 0fffffe00h -promachvsh9: rol eax, 88h ;sh -promachvsh10: rol ebx, 88h ;sh - mov edx, eax - mov ecx, ebx - shr ecx, 16 - and edx, 0ffff0000h - add edx, ecx - and eax, 000001ffh - and ebx, 000001ffh - add esi, eax - add ebp, ebx - ; - mov eax, edx - and eax, 0ffff0000h - mov dword [promachvinc1+2], eax - mov dword [promachvinc2+2], esi - shl edx, 16 - mov dword [promachvinc3+2], edx - mov dword [promachvinc5+2], ebp - - mov ebp, dword [vplce] - mov ebx, dword [vplce+4] - mov esi, dword [vplce+8] - mov eax, dword [vplce+12] - and esi, 0fffffe00h - and ebp, 0fffffe00h -promachvsh11: rol eax, 88h ;sh -promachvsh12: rol ebx, 88h ;sh - mov edx, eax - mov ecx, ebx - shr ecx, 16 - and edx, 0ffff0000h - add edx, ecx - and eax, 000001ffh - and ebx, 000001ffh - add esi, eax - add ebp, ebx - - mov eax, esi - mov ecx, edx - shl ecx, 16 - jmp short probeginvlineasm4 -ALIGN 16 - nop - nop - nop -probeginvlineasm4: -promachvsh1: shr eax, 88h ;32-sh - mov ebx, esi -promachvsh2: and ebx, 00000088h ;(1<>sh) - ;vplc3 = (ebp<<(32-sh))+((edx&65535)<<(16-sh)) -promachvsh5: shl esi, 88h ;32-sh - mov eax, edx -promachvsh6: shl ebp, 88h ;32-sh - and edx, 0000ffffh -promachvsh7: shr eax, 88h ;sh - add esi, eax -promachvsh8: shl edx, 88h ;16-sh - add ebp, edx - mov dword [vplce+12], esi - mov dword [vplce+4], ebp - - pop ebp -CDECLEND 6 - ret - - - ALIGN 16 -mvlineasm4: -CDECLBEGIN 6 -CDECLPARAM ecx,0,5 -CDECLPARAM edi,1,5 - - push ebp - - mov eax, dword [bufplce] - mov ebx, dword [bufplce+4] - mov dword [machmv1+2], eax - mov dword [machmv4+2], ebx - mov eax, dword [bufplce+8] - mov ebx, dword [bufplce+12] - mov dword [machmv7+2], eax - mov dword [machmv10+2], ebx - - mov eax, dword [palookupoffse] - mov ebx, dword [palookupoffse+4] - mov dword [machmv2+2], eax - mov dword [machmv5+2], ebx - mov eax, dword [palookupoffse+8] - mov ebx, dword [palookupoffse+12] - mov dword [machmv8+2], eax - mov dword [machmv11+2], ebx - - mov eax, dword [vince] - mov ebx, dword [vince+4] - xor al, al - xor bl, bl - mov dword [machmv3+2], eax - mov dword [machmv6+2], ebx - mov eax, dword [vince+8] - mov ebx, dword [vince+12] - mov dword [machmv9+2], eax - mov dword [machmv12+2], ebx - - mov ebx, ecx - mov ecx, dword [vplce] - mov edx, dword [vplce+4] - mov esi, dword [vplce+8] - mov ebp, dword [vplce+12] - mov cl, bl - inc cl - inc bh - mov byte [asm3], bh -fixchain2ma: sub edi, 320 - - jmp short beginmvlineasm4 -ALIGN 16 -beginmvlineasm4: - dec cl - jz near endmvlineasm4 -beginmvlineasm42: - mov eax, ebp - mov ebx, esi -machmv16: shr eax, 32 -machmv15: shr ebx, 32 -machmv12: add ebp, 88888888h ;vince[3] -machmv9: add esi, 88888888h ;vince[2] -machmv10: mov al, byte [eax+88888888h] ;bufplce[3] -machmv7: mov bl, byte [ebx+88888888h] ;bufplce[2] - cmp al, 255 - adc dl, dl - cmp bl, 255 - adc dl, dl -machmv8: mov bl, byte [ebx+88888888h] ;palookupoffs[2] -machmv11: mov bh, byte [eax+88888888h] ;palookupoffs[3] - - mov eax, edx -machmv14: shr eax, 32 - shl ebx, 16 -machmv4: mov al, byte [eax+88888888h] ;bufplce[1] - cmp al, 255 - adc dl, dl -machmv6: add edx, 88888888h ;vince[1] -machmv5: mov bh, byte [eax+88888888h] ;palookupoffs[1] - - mov eax, ecx -machmv13: shr eax, 32 -machmv3: add ecx, 88888888h ;vince[0] -machmv1: mov al, byte [eax+88888888h] ;bufplce[0] - cmp al, 255 - adc dl, dl -machmv2: mov bl, byte [eax+88888888h] ;palookupoffs[0] - - shl dl, 4 - xor eax, eax -fixchain2mb: add edi, 320 - mov al, dl - add eax, mvcase0 - jmp eax ;16 byte cases - -ALIGN 16 -endmvlineasm4: - dec byte [asm3] - jnz near beginmvlineasm42 ;near - - mov dword [vplce], ecx - mov dword [vplce+4], edx - mov dword [vplce+8], esi - mov dword [vplce+12], ebp - pop ebp -CDECLEND 6 - ret - - ;5,7,8,8,11,13,12,14,11,13,14,14,12,14,15,7 -ALIGN 16 -mvcase0: - jmp beginmvlineasm4 -ALIGN 16 -mvcase1: - mov byte [edi], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase2: - mov byte [edi+1], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase3: - mov word [edi], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase4: - shr ebx, 16 - mov byte [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase5: - mov byte [edi], bl - shr ebx, 16 - mov byte [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 - mvcase6: - shr ebx, 8 - mov word [edi+1], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase7: - mov word [edi], bx - shr ebx, 16 - mov byte [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase8: - shr ebx, 16 - mov byte [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase9: - mov byte [edi], bl - shr ebx, 16 - mov byte [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase10: - mov byte [edi+1], bh - shr ebx, 16 - mov byte [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase11: - mov word [edi], bx - shr ebx, 16 - mov byte [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase12: - shr ebx, 16 - mov word [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase13: - mov byte [edi], bl - shr ebx, 16 - mov word [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase14: - mov byte [edi+1], bh - shr ebx, 16 - mov word [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase15: - mov dword [edi], ebx - jmp beginmvlineasm4 - - - ALIGN 16 -setupspritevline: -CDECLBEGINSET 6 - - mov dword [spal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword [smach1+2], eax - mov dword [smach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword [smach2+2], eax - add eax, edx - mov dword [smach5+2], eax - - mov dword [smach3+2], ecx ;yinc's - -CDECLENDSET 6 - ret - - - ALIGN 16 -spritevline: -CDECLBEGINSET 6 - jmp short spritevline_start - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p -prestartsvline: -smach1: add ebx, 88888888h ;xincshl16 - mov al, byte [esi] -smach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -startsvline: -spal: mov al, [eax+88888888h] ;palookup - mov byte [edi], al -fixchain1s: add edi, 320 - -spritevline_start: -smach3: add edx, 88888888h ;dayinc - dec ecx - ja short prestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short endsvline -smach4: add ebx, 88888888h ;xincshl16 - mov al, byte [esi] -smach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short startsvline -endsvline: -CDECLENDSET 6 - ret - - - ALIGN 16 -msetupspritevline: -CDECLBEGINSET 6 - - mov dword [mspal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword [msmach1+2], eax - mov dword [msmach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword [msmach2+2], eax - add eax, edx - mov dword [msmach5+2], eax - - mov dword [msmach3+2], ecx ;yinc's - -CDECLENDSET 6 - ret - - - ALIGN 16 -mspritevline: -CDECLBEGINSET 6 - jmp short mspritevline_start - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p -mprestartsvline: -msmach1: add ebx, 88888888h ;xincshl16 - mov al, byte [esi] -msmach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -mstartsvline: - cmp al, 255 - je short mskipsvline -mspal: mov al, [eax+88888888h] ;palookup - mov byte [edi], al -mskipsvline: -mfixchain1s: add edi, 320 - -mspritevline_start: -msmach3: add edx, 88888888h ;dayinc - dec ecx - ja short mprestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short mendsvline -msmach4: add ebx, 88888888h ;xincshl16 - mov al, byte [esi] -msmach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short mstartsvline -mendsvline: -CDECLENDSET 6 - ret - - - ALIGN 16 -tsetupspritevline: -CDECLBEGINSET 6 - mov dword [tspal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword [tsmach1+2], eax - mov dword [tsmach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword [tsmach2+2], eax - add eax, edx - mov dword [tsmach5+2], eax - - mov dword [tsmach3+2], ecx ;yinc's -CDECLENDSET 6 - ret - - - ALIGN 16 -tspritevline: -CDECLBEGINSET 6 - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p - push ebp - mov ebp, ebx - xor ebx, ebx - jmp tenterspritevline -ALIGN 16 -tprestartsvline: -tsmach1: add ebp, 88888888h ;xincshl16 - mov al, byte [esi] -tsmach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -tstartsvline: - cmp al, 255 - je short tskipsvline -transrev2: - mov bh, byte [edi] -transrev3: -tspal: mov bl, [eax+88888888h] ;palookup -tmach4: mov al, byte [ebx+88888888h] ;_transluc - mov byte [edi], al -tskipsvline: -tfixchain1s: add edi, 320 - -tenterspritevline: -tsmach3: add edx, 88888888h ;dayinc - dec ecx - ja short tprestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short tendsvline -tsmach4: add ebp, 88888888h ;xincshl16 - mov al, byte [esi] -tsmach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short tstartsvline -tendsvline: - pop ebp -CDECLENDSET 6 - ret - - - ALIGN 16 -msethlineshift: -CDECLBEGINSET 2 - neg al - mov byte [msh1d+2], al - mov byte [msh2d+3], bl - mov byte [msh3d+2], al - mov byte [msh4d+3], bl - mov byte [msh5d+2], al - mov byte [msh6d+3], bl -CDECLENDSET 2 - ret - - - ALIGN 16 -mhline: -CDECLBEGINSET 6 - ;asm1 = bxinc - ;asm2 = byinc - ;asm3 = shadeoffs - ;eax = picoffs - ;ebx = bx - ;ecx = cnt - ;edx = ? - ;esi = by - ;edi = p - - mov dword [mmach1d+2], eax - mov dword [mmach5d+2], eax - mov dword [mmach9d+2], eax - mov eax, dword [asm3] - mov dword [mmach2d+2], eax - mov dword [mmach2da+2], eax - mov dword [mmach2db+2], eax - mov dword [mmach6d+2], eax - mov dword [mmach10d+2], eax - mov eax, dword [asm1] - mov dword [mmach3d+2], eax - mov dword [mmach7d+2], eax - mov eax, dword [asm2] - mov dword [mmach4d+2], eax - mov dword [mmach8d+2], eax - jmp short mhlineskipmodify_nosetup - - - ALIGN 16 -mhlineskipmodify: -CDECLBEGINSET 6 -mhlineskipmodify_nosetup: - - push ebp - - xor eax, eax - mov ebp, ebx - - test ecx, 00010000h - jnz short mbeghline - -msh1d: shr ebx, 26 -msh2d: shld ebx, esi, 6 - add ebp, dword [asm1] -mmach9d: mov al, byte [ebx+88888888h] ;picoffs - add esi, dword [asm2] - cmp al, 255 - je mskip5 - -mmach10d: mov cl, byte [eax+88888888h] ;shadeoffs - mov byte [edi], cl -mskip5: - inc edi - sub ecx, 65536 - jc near mendhline - jmp short mbeghline - -ALIGN 16 -mpreprebeghline: ;1st only - mov al, cl -mmach2d: mov al, byte [eax+88888888h] ;shadeoffs - mov byte [edi], al - -mprebeghline: - add edi, 2 - sub ecx, 131072 - jc near mendhline -mbeghline: -mmach3d: lea ebx, [ebp+88888888h] ;bxinc -msh3d: shr ebp, 26 -msh4d: shld ebp, esi, 6 -mmach4d: add esi, 88888888h ;byinc -mmach1d: mov cl, byte [ebp+88888888h] ;picoffs -mmach7d: lea ebp, [ebx+88888888h] ;bxinc - -msh5d: shr ebx, 26 -msh6d: shld ebx, esi, 6 -mmach8d: add esi, 88888888h ;byinc -mmach5d: mov ch, byte [ebx+88888888h] ;picoffs - - cmp cl, 255 - je short mskip1 - cmp ch, 255 - je short mpreprebeghline - - mov al, cl ;BOTH -mmach2da: mov bl, byte [eax+88888888h] ;shadeoffs - mov al, ch -mmach2db: mov bh, byte [eax+88888888h] ;shadeoffs - mov word [edi], bx - add edi, 2 - sub ecx, 131072 - jnc short mbeghline - jmp mendhline -mskip1: ;2nd only - cmp ch, 255 - je short mprebeghline - - mov al, ch -mmach6d: mov al, byte [eax+88888888h] ;shadeoffs - mov byte [edi+1], al - add edi, 2 - sub ecx, 131072 - jnc short mbeghline -mendhline: - - pop ebp -CDECLENDSET 6 - ret - - - ALIGN 16 -tsethlineshift: -CDECLBEGINSET 2 - neg al - mov byte [tsh1d+2], al - mov byte [tsh2d+3], bl - mov byte [tsh3d+2], al - mov byte [tsh4d+3], bl - mov byte [tsh5d+2], al - mov byte [tsh6d+3], bl -CDECLENDSET 2 - ret - - - ALIGN 16 -thline: -CDECLBEGINSET 6 - ;asm1 = bxinc - ;asm2 = byinc - ;asm3 = shadeoffs - ;eax = picoffs - ;ebx = bx - ;ecx = cnt - ;edx = ? - ;esi = by - ;edi = p - - mov dword [tmach1d+2], eax - mov dword [tmach5d+2], eax - mov dword [tmach9d+2], eax - mov eax, dword [asm3] - mov dword [tmach2d+2], eax - mov dword [tmach6d+2], eax - mov dword [tmach10d+2], eax - mov eax, dword [asm1] - mov dword [tmach3d+2], eax - mov dword [tmach7d+2], eax - mov eax, dword [asm2] - mov dword [tmach4d+2], eax - mov dword [tmach8d+2], eax - jmp thlineskipmodify_nosetup - - - ALIGN 16 -thlineskipmodify: -CDECLBEGINSET 6 -thlineskipmodify_nosetup: - - push ebp - - xor eax, eax - xor edx, edx - mov ebp, ebx - - test ecx, 00010000h - jnz short tbeghline - -tsh1d: shr ebx, 26 -tsh2d: shld ebx, esi, 6 - add ebp, dword [asm1] -tmach9d: mov al, byte [ebx+88888888h] ;picoffs - add esi, dword [asm2] - cmp al, 255 - je tskip5 - -transrev4: -tmach10d: mov dl, byte [eax+88888888h] ;shadeoffs -transrev5: - mov dh, byte [edi] -tmach1: mov al, byte [edx+88888888h] ;_transluc - mov byte [edi], al -tskip5: - inc edi - sub ecx, 65536 - jc near tendhline - jmp short tbeghline - -ALIGN 16 -tprebeghline: - add edi, 2 - sub ecx, 131072 - jc short tendhline -tbeghline: -tmach3d: lea ebx, [ebp+88888888h] ;bxinc -tsh3d: shr ebp, 26 -tsh4d: shld ebp, esi, 6 -tmach4d: add esi, 88888888h ;byinc -tmach1d: mov cl, byte [ebp+88888888h] ;picoffs -tmach7d: lea ebp, [ebx+88888888h] ;bxinc - -tsh5d: shr ebx, 26 -tsh6d: shld ebx, esi, 6 -tmach8d: add esi, 88888888h ;byinc -tmach5d: mov ch, byte [ebx+88888888h] ;picoffs - - cmp cx, 0ffffh - je short tprebeghline - - mov bx, word [edi] - - cmp cl, 255 - je short tskip1 - mov al, cl -transrev6: -tmach2d: mov dl, byte [eax+88888888h] ;shadeoffs -transrev7: - mov dh, bl -tmach2: mov al, byte [edx+88888888h] ;_transluc - mov byte [edi], al - - cmp ch, 255 - je short tskip2 -tskip1: - mov al, ch -transrev8: -tmach6d: mov dl, byte [eax+88888888h] ;shadeoffs -transrev9: - mov dh, bh -tmach3: mov al, byte [edx+88888888h] ;_transluc - mov byte [edi+1], al -tskip2: - - add edi, 2 - sub ecx, 131072 - jnc tbeghline -tendhline: - - pop ebp -CDECLENDSET 6 - ret - - - ;eax=shiftval, ebx=palookup1, ecx=palookup2 - ALIGN 16 -setuptvlineasm2: -CDECLBEGINSET 3 - mov byte [tran2shra+2], al - mov byte [tran2shrb+2], al - mov dword [tran2pala+2], ebx - mov dword [tran2palb+2], ecx - mov dword [tran2palc+2], ebx - mov dword [tran2pald+2], ecx -CDECLENDSET 3 - ret - - ;Pass: eax=vplc2, ebx=vinc1, ecx=bufplc1, edx=bufplc2, esi=vplc1, edi=p - ; asm1=vinc2, asm2=pend - ;Return: asm1=vplc1, asm2=vplc2 - ALIGN 16 -tvlineasm2: -CDECLBEGINSET 6 - - push ebp - - mov ebp, eax - - mov dword [tran2inca+2], ebx - mov eax, dword [asm1] - mov dword [tran2incb+2], eax - - mov dword [tran2bufa+2], ecx ;bufplc1 - mov dword [tran2bufb+2], edx ;bufplc2 - - mov eax, dword [asm2] - sub edi, eax - mov dword [tran2edia+3], eax - mov dword [tran2edic+2], eax - inc eax - mov dword [tran2edie+2], eax -fixchaint2a: sub eax, 320 - mov dword [tran2edif+2], eax - dec eax - mov dword [tran2edib+3], eax - mov dword [tran2edid+2], eax - - xor ecx, ecx - xor edx, edx - jmp short begintvline2 - - ;eax 0000000000 temp temp - ;ebx 0000000000 odat2 odat1 - ;ecx 0000000000000000 ndat1 - ;edx 0000000000000000 ndat2 - ;esi vplc1 - ;edi videoplc-------------- - ;ebp vplc2 - -ALIGN 16 - ;LEFT ONLY -skipdraw2: -transrev10: -tran2edic: mov ah, byte [edi+88888888h] ;getpixel -transrev11: -tran2palc: mov al, byte [ecx+88888888h] ;palookup1 -fixchaint2d: add edi, 320 -tran2trac: mov bl, byte [eax+88888888h] ;_transluc -tran2edid: mov byte [edi+88888888h-320], bl ;drawpixel - jnc short begintvline2 - jmp endtvline2 - -skipdraw1: - cmp dl, 255 - jne short skipdraw3 -fixchaint2b: add edi, 320 - jc short endtvline2 - -begintvline2: - mov eax, esi -tran2shra: shr eax, 88h ;globalshift - mov ebx, ebp -tran2shrb: shr ebx, 88h ;globalshift -tran2inca: add esi, 88888888h ;vinc1 -tran2incb: add ebp, 88888888h ;vinc2 -tran2bufa: mov cl, byte [eax+88888888h] ;bufplc1 - cmp cl, 255 -tran2bufb: mov dl, byte [ebx+88888888h] ;bufplc2 - je short skipdraw1 - cmp dl, 255 - je short skipdraw2 - - ;mov ax The transluscent reverse of both! - ;mov bl, ah - ;mov ah - ;mov bh - - ;BOTH -transrev12: -tran2edia: mov bx, word [edi+88888888h] ;getpixels -transrev13: - mov ah, bl -transrev14: -tran2pala: mov al, byte [ecx+88888888h] ;palookup1 -transrev15: -tran2palb: mov bl, byte [edx+88888888h] ;palookup2 -fixchaint2c: add edi, 320 -tran2traa: mov al, byte [eax+88888888h] ;_transluc -tran2trab: mov ah, byte [ebx+88888888h] ;_transluc -tran2edib: mov word [edi+88888888h-320], ax ;drawpixels - jnc short begintvline2 - jmp short endtvline2 - - ;RIGHT ONLY -skipdraw3: -transrev16: -tran2edie: mov ah, byte [edi+88888889h] ;getpixel -transrev17: -tran2pald: mov al, byte [edx+88888888h] ;palookup2 -fixchaint2e: add edi, 320 -tran2trad: mov bl, byte [eax+88888888h] ;_transluc -tran2edif: mov byte [edi+88888889h-320], bl ;drawpixel - jnc short begintvline2 - -endtvline2: - mov dword [asm1], esi - mov dword [asm2], ebp - - pop ebp -CDECLENDSET 6 - ret - - -BITSOFPRECISION equ 3 -BITSOFPRECISIONPOW equ 8 - -;Double-texture mapping with palette lookup -;eax: ylo1------------|----dat|----dat -;ebx: ylo2--------------------|----cnt -;ecx: 000000000000000000000000|---temp -;edx: xhi1-xlo1---------------|---yhi1 -;esi: xhi2-xlo2---------------|---yhi2 -;edi: ------------------------videopos -;ebp: ----------------------------temp - - ALIGN 16 -setupslopevlin2: -CDECLBEGINSET 6 - - mov dword [slop3+2], edx ;ptr - mov dword [slop7+2], edx ;ptr - mov dword [slop4+2], esi ;tptr - mov dword [slop8+2], esi ;tptr - mov byte [slop2+2], ah ;ybits - mov byte [slop6+2], ah ;ybits - mov dword [slop9+2], edi ;pinc - - mov edx, 1 - mov cl, al - add cl, ah - shl edx, cl - dec edx - mov cl, ah - ror edx, cl - - mov dword [slop1+2], edx ;ybits...xbits - mov dword [slop5+2], edx ;ybits...xbits - -CDECLENDSET 6 - ret - - ALIGN 16 -slopevlin2: -CDECLBEGINSET 6 - - push ebp - xor ecx, ecx - -slopevlin2begin: - mov ebp, edx -slop1: and ebp, 88000088h ;ybits...xbits -slop2: rol ebp, 6 ;ybits - add eax, dword [asm1] ;xinc1<>(32-xbits)) -slop3: mov cl, byte [ebp+88888888h] ;bufplc - - mov ebp, esi -slop4: mov al, byte [ecx+88888888h] ;paloffs -slop5: and ebp, 88000088h ;ybits...xbits -slop6: rol ebp, 6 ;ybits - add ebx, dword [asm3] ;xinc2<>(32-xbits)) -slop8: mov ah, byte [ecx+88888888h] ;paloffs - - dec bl - mov word [edi], ax -slop9: lea edi, [edi+88888888h] ;pinc - jnz short slopevlin2begin - - pop ebp - mov eax, edi - -CDECLENDSET 6 - ret - - - ALIGN 16 -setupslopevlin: -CDECLBEGINSET 3 - - mov dword [slopmach3+3], ebx ;ptr - mov dword [slopmach5+2], ecx ;pinc - neg ecx - mov dword [slopmach6+2], ecx ;-pinc - - mov edx, 1 - mov cl, al - shl edx, cl - dec edx - mov cl, ah - shl edx, cl - mov dword [slopmach7+2], edx - - neg ah - mov byte [slopmach2+2], ah - - sub ah, al - mov byte [slopmach1+2], ah - - fild dword [asm1] - fstp dword [asm2] - -CDECLENDSET 3 - ret - - - ALIGN 16 -slopevlin: -CDECLBEGINSET 6 - - mov dword [ebpbak], ebp - mov dword [espbak], esp - - sub ecx, esp - mov dword [slopmach4+3], ecx - - fild dword [asm3] -slopmach6: lea ebp, [eax+88888888h] - fadd dword [asm2] - - mov dword [asm1], ebx - shl ebx, 3 - - mov eax, dword [globalx3] - mov ecx, dword [globaly3] - imul eax, ebx - imul ecx, ebx - add esi, eax - add edi, ecx - - mov ebx, edx - jmp short bigslopeloop -ALIGN 16 -bigslopeloop: - fst dword [fpuasm] - - mov eax, dword [fpuasm] - add eax, eax - sbb edx, edx - mov ecx, eax - shr ecx, 24 - and eax, 00ffe000h - shr eax, 11 - sub cl, 2 - mov eax, dword [reciptable+eax] - shr eax, cl - xor eax, edx - mov edx, dword [asm1] - mov ecx, dword [globalx3] - mov dword [asm1], eax - sub eax, edx - mov edx, dword [globaly3] - imul ecx, eax - imul eax, edx - - fadd dword [asm2] - - cmp ebx, BITSOFPRECISIONPOW - mov dword [asm4], ebx - mov cl, bl - jl short slopeskipmin - mov cl, BITSOFPRECISIONPOW -slopeskipmin: - -;eax: yinc............. -;ebx: 0 0 0 ? -;ecx: xinc......... cnt -;edx: ? -;esi: xplc............. -;edi: yplc............. -;ebp: videopos - - mov ebx, esi - mov edx, edi - -beginnerslopeloop: -slopmach1: shr ebx, 20 - add esi, ecx -slopmach2: shr edx, 26 -slopmach7: and ebx, 88888888h - add edi, eax -slopmach5: add ebp, 88888888h ;pinc -slopmach3: mov dl, byte [ebx+edx+88888888h] ;ptr -slopmach4: mov ebx, dword [esp+88888888h] - sub esp, 4 - dec cl - mov al, byte [ebx+edx] ;tptr - mov ebx, esi - mov [ebp], al - mov edx, edi - jnz short beginnerslopeloop - - mov ebx, dword [asm4] - sub ebx, BITSOFPRECISIONPOW - jg near bigslopeloop - - ffree st0 - - mov esp, dword [espbak] - mov ebp, dword [ebpbak] - -CDECLENDSET 6 - ret - - - ALIGN 16 -setuprhlineasm4: -CDECLBEGINSET 6 - - mov dword [rmach1a+2], eax - mov dword [rmach1b+2], eax - mov dword [rmach1c+2], eax - mov dword [rmach1d+2], eax - mov dword [rmach1e+2], eax - - mov dword [rmach2a+2], ebx - mov dword [rmach2b+2], ebx - mov dword [rmach2c+2], ebx - mov dword [rmach2d+2], ebx - mov dword [rmach2e+2], ebx - - mov dword [rmach3a+2], ecx - mov dword [rmach3b+2], ecx - mov dword [rmach3c+2], ecx - mov dword [rmach3d+2], ecx - mov dword [rmach3e+2], ecx - - mov dword [rmach4a+2], edx - mov dword [rmach4b+2], edx - mov dword [rmach4c+2], edx - mov dword [rmach4d+2], edx - mov dword [rmach4e+2], edx - - mov dword [rmach5a+2], esi - mov dword [rmach5b+2], esi - mov dword [rmach5c+2], esi - mov dword [rmach5d+2], esi - mov dword [rmach5e+2], esi - -CDECLENDSET 6 - ret - - ;Non power of 2, non masking, with palookup method #1 (6 clock cycles) - ;eax: dat dat dat dat - ;ebx: bufplc - ;ecx: 0 dat - ;edx: xlo - ;esi: ylo - ;edi: videopos/cnt - ;ebp: tempvar - ;esp: - ALIGN 16 -rhlineasm4: -CDECLBEGINSET 6 - - push ebp - - cmp eax, 0 - jle near endrhline - - lea ebp, [edi-4] - sub ebp, eax - mov dword [rmach6a+2], ebp - add ebp, 3 - mov dword [rmach6b+2], ebp - mov edi, eax - test edi, 3 - jz short begrhline - jmp short startrhline1 - -ALIGN 16 -startrhline1: - mov cl, byte [ebx] ;bufplc -rmach1e: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2e: sub esi, 88888888h ;ylo -rmach3e: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach4e: mov al, byte [ecx+88888888h] ;palookup -rmach5e: and ebp, 88888888h ;tilesizy -rmach6b: mov byte [edi+88888888h], al ;vidcntoffs - sub ebx, ebp - dec edi - test edi, 3 - jnz short startrhline1 - test edi, edi - jz near endrhline - -begrhline: - mov cl, byte [ebx] ;bufplc -rmach1a: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2a: sub esi, 88888888h ;ylo -rmach3a: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5a: and ebp, 88888888h ;tilesizy - sub ebx, ebp - -rmach1b: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach4a: mov ah, byte [ecx+88888888h] ;palookup - mov cl, byte [ebx] ;bufplc -rmach2b: sub esi, 88888888h ;ylo -rmach3b: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5b: and ebp, 88888888h ;tilesizy -rmach4b: mov al, byte [ecx+88888888h] ;palookup - sub ebx, ebp - - shl eax, 16 - - mov cl, byte [ebx] ;bufplc -rmach1c: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2c: sub esi, 88888888h ;ylo -rmach3c: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5c: and ebp, 88888888h ;tilesizy - sub ebx, ebp - -rmach1d: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach4c: mov ah, byte [ecx+88888888h] ;palookup - mov cl, byte [ebx] ;bufplc -rmach2d: sub esi, 88888888h ;ylo -rmach3d: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5d: and ebp, 88888888h ;tilesizy -rmach4d: mov al, byte [ecx+88888888h] ;palookup - sub ebx, ebp - -rmach6a: mov dword [edi+88888888h], eax ;vidcntoffs - sub edi, 4 - jnz near begrhline -endrhline: - pop ebp - -CDECLENDSET 6 - ret - - - ALIGN 16 -setuprmhlineasm4: -CDECLBEGINSET 6 - mov dword [rmmach1+2], eax - mov dword [rmmach2+2], ebx - mov dword [rmmach3+2], ecx - mov dword [rmmach4+2], edx - mov dword [rmmach5+2], esi -CDECLENDSET 6 - ret - - - ALIGN 16 -rmhlineasm4: -CDECLBEGINSET 6 - - push ebp - - cmp eax, 0 - jle short endrmhline - - lea ebp, [edi-1] - sub ebp, eax - mov dword [rmmach6+2], ebp - mov edi, eax - jmp short begrmhline - -ALIGN 16 -begrmhline: - mov cl, byte [ebx] ;bufplc -rmmach1: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmmach2: sub esi, 88888888h ;ylo -rmmach3: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmmach5: and ebp, 88888888h ;tilesizy - cmp cl, 255 - je short rmskip -rmmach4: mov al, byte [ecx+88888888h] ;palookup -rmmach6: mov byte [edi+88888888h], al ;vidcntoffs -rmskip: - sub ebx, ebp - dec edi - jnz short begrmhline -endrmhline: - pop ebp - -CDECLENDSET 6 - ret - - - ALIGN 16 -setupqrhlineasm4: -CDECLBEGINSET 6 - - mov dword [qrmach2e+2], ebx - mov dword [qrmach3e+2], ecx - xor edi, edi - sub edi, ecx - mov dword [qrmach7a+2], edi - mov dword [qrmach7b+2], edi - - add ebx, ebx - adc ecx, ecx - mov dword [qrmach2a+2], ebx - mov dword [qrmach2b+2], ebx - mov dword [qrmach3a+2], ecx - mov dword [qrmach3b+2], ecx - - mov dword [qrmach4a+2], edx - mov dword [qrmach4b+2], edx - mov dword [qrmach4c+2], edx - mov dword [qrmach4d+2], edx - mov dword [qrmach4e+2], edx - -CDECLENDSET 6 - ret - - ;Non power of 2, non masking, with palookup method (FASTER BUT NO SBB'S) - ;eax: dat dat dat dat - ;ebx: bufplc - ;ecx: 0 dat - ;edx: 0 dat - ;esi: ylo - ;edi: videopos/cnt - ;ebp: ? - ;esp: - ALIGN 16 -qrhlineasm4: -CDECLBEGINSET 6 - - push ebp - - cmp eax, 0 - jle near endqrhline - - mov ebp, eax - test ebp, 3 - jz short skipqrhline1 - jmp short startqrhline1 - -ALIGN 16 -startqrhline1: - mov cl, byte [ebx] ;bufplc - dec edi -qrmach2e: sub esi, 88888888h ;ylo - dec ebp -qrmach3e: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4e: mov al, byte [ecx+88888888h] ;palookup - mov byte [edi], al ;vidcntoffs - test ebp, 3 - jnz short startqrhline1 - test ebp, ebp - jz short endqrhline - -skipqrhline1: - mov cl, byte [ebx] ;bufplc - jmp short begqrhline -ALIGN 16 -begqrhline: -qrmach7a: mov dl, byte [ebx+88888888h] ;bufplc -qrmach2a: sub esi, 88888888h ;ylo -qrmach3a: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4a: mov ah, byte [ecx+88888888h] ;palookup -qrmach4b: mov al, byte [edx+88888888h] ;palookup - sub edi, 4 - shl eax, 16 - mov cl, byte [ebx] ;bufplc -qrmach7b: mov dl, byte [ebx+88888888h] ;bufplc -qrmach2b: sub esi, 88888888h ;ylo -qrmach3b: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4c: mov ah, byte [ecx+88888888h] ;palookup -qrmach4d: mov al, byte [edx+88888888h] ;palookup - mov cl, byte [ebx] ;bufplc - mov dword [edi], eax - sub ebp, 4 - jnz short begqrhline - -endqrhline: - pop ebp - -CDECLENDSET 6 - ret - - -setupdrawslab: -CDECLBEGINSET 2 - - mov dword [voxbpl1+2], eax - mov dword [voxbpl2+2], eax - mov dword [voxbpl3+2], eax - mov dword [voxbpl4+2], eax - mov dword [voxbpl5+2], eax - mov dword [voxbpl6+2], eax - mov dword [voxbpl7+2], eax - mov dword [voxbpl8+2], eax - - mov dword [voxpal1+2], ebx - mov dword [voxpal2+2], ebx - mov dword [voxpal3+2], ebx - mov dword [voxpal4+2], ebx - mov dword [voxpal5+2], ebx - mov dword [voxpal6+2], ebx - mov dword [voxpal7+2], ebx - mov dword [voxpal8+2], ebx - -CDECLENDSET 2 - ret - - - ALIGN 16 -drawslab: -CDECLBEGINSET 6 - - push ebp - cmp eax, 2 - je near voxbegdraw2 - ja near voxskip2 - xor eax, eax -voxbegdraw1: - mov ebp, ebx - shr ebp, 16 - add ebx, edx - dec ecx - mov al, byte [esi+ebp] -voxpal1: mov al, byte [eax+88888888h] - mov byte [edi], al -voxbpl1: lea edi, [edi+88888888h] - jnz near voxbegdraw1 - pop ebp - -CDECLENDSET 6 - ret - -voxbegdraw2: - mov ebp, ebx - shr ebp, 16 - add ebx, edx - xor eax, eax - dec ecx - mov al, byte [esi+ebp] -voxpal2: mov al, byte [eax+88888888h] - mov ah, al - mov word [edi], ax -voxbpl2: lea edi, [edi+88888888h] - jnz near voxbegdraw2 - pop ebp - -CDECLENDSET 6 - ret - -voxskip2: - cmp eax, 4 - jne near voxskip4 - xor eax, eax -voxbegdraw4: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte [esi+ebp] -voxpal3: mov al, byte [eax+88888888h] - mov ah, al - shl eax, 8 - mov al, ah - shl eax, 8 - mov al, ah - mov dword [edi], eax -voxbpl3: add edi, 88888888h - dec ecx - jnz near voxbegdraw4 - pop ebp - -CDECLENDSET 6 - ret - -voxskip4: - add eax, edi - - test edi, 1 - jz near voxskipslab1 - cmp edi, eax - je near voxskipslab1 - - push eax - push ebx - push ecx - push edi -voxbegslab1: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte [esi+ebp] -voxpal4: mov al, byte [eax+88888888h] - mov byte [edi], al -voxbpl4: add edi, 88888888h - dec ecx - jnz near voxbegslab1 - pop edi - pop ecx - pop ebx - pop eax - inc edi - -voxskipslab1: - push eax - test edi, 2 - jz near voxskipslab2 - dec eax - cmp edi, eax - jge near voxskipslab2 - - push ebx - push ecx - push edi -voxbegslab2: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte [esi+ebp] -voxpal5: mov al, byte [eax+88888888h] - mov ah, al - mov word [edi], ax -voxbpl5: add edi, 88888888h - dec ecx - jnz near voxbegslab2 - pop edi - pop ecx - pop ebx - add edi, 2 - -voxskipslab2: - mov eax, dword [esp] - - sub eax, 3 - cmp edi, eax - jge near voxskipslab3 - -voxprebegslab3: - push ebx - push ecx - push edi -voxbegslab3: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte [esi+ebp] -voxpal6: mov al, byte [eax+88888888h] - mov ah, al - shl eax, 8 - mov al, ah - shl eax, 8 - mov al, ah - mov dword [edi], eax -voxbpl6: add edi, 88888888h - dec ecx - jnz near voxbegslab3 - pop edi - pop ecx - pop ebx - add edi, 4 - - mov eax, dword [esp] - - sub eax, 3 - cmp edi, eax - jl near voxprebegslab3 - -voxskipslab3: - mov eax, dword [esp] - - dec eax - cmp edi, eax - jge near voxskipslab4 - - push ebx - push ecx - push edi -voxbegslab4: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte [esi+ebp] -voxpal7: mov al, byte [eax+88888888h] - mov ah, al - mov word [edi], ax -voxbpl7: add edi, 88888888h - dec ecx - jnz near voxbegslab4 - pop edi - pop ecx - pop ebx - add edi, 2 - -voxskipslab4: - pop eax - - cmp edi, eax - je near voxskipslab5 - -voxbegslab5: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte [esi+ebp] -voxpal8: mov al, byte [eax+88888888h] - mov byte [edi], al -voxbpl8: add edi, 88888888h - dec ecx - jnz near voxbegslab5 - -voxskipslab5: - pop ebp - -CDECLENDSET 6 - ret - -;modify: loinc -;eax: | dat | dat | dat | dat | -;ebx: | loplc1 | -;ecx: | loplc2 | cnthi | cntlo | -;edx: |--------|--------|--------| hiplc1 | -;esi: |--------|--------|--------| hiplc2 | -;edi: |--------|--------|--------| vidplc | -;ebp: |--------|--------|--------| hiinc | - -stretchhline: -CDECLBEGINSET 6 - - push ebp - - mov eax, ebx - shl ebx, 16 - sar eax, 16 - and ecx, 0000ffffh - or ecx, ebx - - add esi, eax - mov eax, edx - mov edx, esi - - mov ebp, eax - shl eax, 16 - sar ebp, 16 - - add ecx, eax - adc esi, ebp - - add eax, eax - adc ebp, ebp - mov dword [loinc1+2], eax - mov dword [loinc2+2], eax - mov dword [loinc3+2], eax - mov dword [loinc4+2], eax - - inc ch - - jmp begloop - -begloop: - mov al, [edx] -loinc1: sub ebx, 88888888h - sbb edx, ebp - mov ah, [esi] -loinc2: sub ecx, 88888888h - sbb esi, ebp - sub edi, 4 - shl eax, 16 -loinc3: sub ebx, 88888888h - mov al, [edx] - sbb edx, ebp - mov ah, [esi] -loinc4: sub ecx, 88888888h - sbb esi, ebp - mov [edi], eax - dec cl - jnz begloop - dec ch - jnz begloop - - pop ebp - -CDECLENDSET 6 - ret - - -mmxoverlay: - push ebx ;JBF - push ecx ;JBF - push edx ;JBF - - pushfd ;Check if CPUID is available - pop eax - mov ebx, eax - xor eax, 00200000h - push eax - popfd - pushfd - pop eax - cmp eax, ebx - je pentium - xor eax, eax - dw 0a20fh - test eax, eax - jz pentium - mov eax, 1 - dw 0a20fh - and eax, 00000f00h - test edx, 00800000h ;Check if MMX is available - jz nommx - cmp eax, 00000600h ;Check if P6 Family or not - jae pentiumii - jmp pentiummmx -nommx: - cmp eax, 00000600h ;Check if P6 Family or not - jae pentiumpro -pentium: - - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM II Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiumii: - ;Hline overlay (MMX doens't help) - mov byte [sethlinesizes], 0xe9 - mov dword [sethlinesizes+1], (prosethlinesizes-sethlinesizes-5) - mov byte [setpalookupaddress], 0xe9 - mov dword [setpalookupaddress+1], (prosetpalookupaddress-setpalookupaddress-5) - mov byte [setuphlineasm4], 0xc3 ;ret (no code required) - mov byte [hlineasm4], 0xe9 - mov dword [hlineasm4+1], (prohlineasm4-hlineasm4-5) - - ;Vline overlay - mov byte [setupvlineasm], 0xe9 - mov dword [setupvlineasm+1], (prosetupvlineasm-setupvlineasm-5) - mov byte [vlineasm4], 0xe9 - mov dword [vlineasm4+1], (provlineasm4-vlineasm4-5) - - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM MMX Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiummmx: - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM PRO Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiumpro: - ;Hline overlay (MMX doens't help) - mov byte [sethlinesizes], 0xe9 - mov dword [sethlinesizes+1], (prosethlinesizes-sethlinesizes-5) - mov byte [setpalookupaddress], 0xe9 - mov dword [setpalookupaddress+1], (prosetpalookupaddress-setpalookupaddress-5) - mov byte [setuphlineasm4], 0xc3 ;ret (no code required) - mov byte [hlineasm4], 0xe9 - mov dword [hlineasm4+1], (prohlineasm4-hlineasm4-5) - - ;Vline overlay - mov byte [setupvlineasm], 0xe9 - mov dword [setupvlineasm+1], (prosetupvlineasm-setupvlineasm-5) - mov byte [vlineasm4], 0xe9 - mov dword [vlineasm4+1], (provlineasm4-vlineasm4-5) - - pop edx ;JBF - pop ecx ;JBF - pop ebx ;JBF - ret - -dep_end: diff --git a/polymer-perf/eduke32/build/src/a.wasm b/polymer-perf/eduke32/build/src/a.wasm deleted file mode 100644 index 504c84c1b..000000000 --- a/polymer-perf/eduke32/build/src/a.wasm +++ /dev/null @@ -1,2425 +0,0 @@ -; "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -; Ken Silverman's official web site: "http://www.advsys.net/ken" -; See the included license file "BUILDLIC.TXT" for license info. - -.586P -.8087 -;include mmx.inc ;Include this if using < WATCOM 11.0 WASM - -;Warning: IN THIS FILE, ALL SEGMENTS ARE REMOVED. THIS MEANS THAT DS:[] -;MUST BE ADDED FOR ALL SELF-MODIFIES FOR MASM TO WORK. -; -;WASM PROBLEMS: -; 1. Requires all scaled registers (*1,*2,*4,*8) to be last thing on line -; 2. Using 'DATA' is nice for self-mod. code, but WDIS only works with 'CODE' -; -;MASM PROBLEMS: -; 1. Requires DS: to be written out for self-modifying code to work -; 2. Doesn't encode short jumps automatically like WASM -; 3. Stupidly adds wait prefix to ffree's - -EXTRN _asm1 : dword -EXTRN _asm2 : dword -EXTRN _asm3 : dword -EXTRN _asm4 : dword -EXTRN _reciptable : near -EXTRN _fpuasm : dword -EXTRN _globalx3 : dword -EXTRN _globaly3 : dword -EXTRN _ylookup : near - -EXTRN _vplce : near -EXTRN _vince : near -EXTRN _palookupoffse : near -EXTRN _bufplce : near - -EXTRN _ebpbak : dword -EXTRN _espbak : dword - -EXTRN _pow2char : near -EXTRN _pow2long : near - -CODE SEGMENT PUBLIC USE32 'CODE' -ASSUME cs:CODE,ds:CODE - -PUBLIC _dep_begin -_dep_begin: - -ALIGN 16 -PUBLIC sethlinesizes_ -sethlinesizes_: - mov byte ptr [machxbits1+2], al - mov byte ptr [machxbits2+2], al - mov byte ptr [machxbits3+2], al - neg al - mov byte ptr [hxsiz1+2], al - mov byte ptr [hxsiz2+2], al - mov byte ptr [hxsiz3+2], al - mov byte ptr [hxsiz4+2], al - mov byte ptr [machnegxbits1+2], al - - mov byte ptr [hysiz1+3], bl - mov byte ptr [hysiz2+3], bl - mov byte ptr [hysiz3+3], bl - mov byte ptr [hysiz4+3], bl - mov byte ptr [hmach3a+2], bl - mov byte ptr [hmach3b+2], bl - mov byte ptr [hmach3c+2], bl - mov byte ptr [hmach3d+2], bl - - mov dword ptr [hoffs1+2], ecx - mov dword ptr [hoffs2+2], ecx - mov dword ptr [hoffs3+2], ecx - mov dword ptr [hoffs4+2], ecx - mov dword ptr [hoffs5+2], ecx - mov dword ptr [hoffs6+2], ecx - mov dword ptr [hoffs7+2], ecx - mov dword ptr [hoffs8+2], ecx - - mov edx, -1 - mov cl, al - sub cl, bl - shr edx, cl - mov dword ptr [hmach2a+1], edx - mov dword ptr [hmach2b+1], edx - mov dword ptr [hmach2c+1], edx - mov dword ptr [hmach2d+1], edx - - ret - -ALIGN 16 -PUBLIC prosethlinesizes_ -prosethlinesizes_: - mov dword ptr [prohbuf-4], ecx - neg eax - mov ecx, eax - sub eax, ebx - mov byte ptr [prohshru-1], al ;bl = 32-al-bl - mov eax, -1 - shr eax, cl - mov ecx, ebx - shl eax, cl - mov dword ptr [prohand-4], eax ;((-1>>(-oal))<>(32-xbits) adc al, 88h 1 1/2 - ;bufplc mov cl, byte ptr [edx+88888888h] 1 1/2 - ;paloffs&255 mov bl, byte ptr [ecx+88888888h] 1 1/2 -ALIGN 16 -PUBLIC hlineasm4_ -hlineasm4_: - push ebp - - lea ebp, [eax+1] - - cmp ebp, 8 - jle shorthline - - test edi, 1 - jnz short skipthe1byte - - mov eax, esi -hxsiz1: shr eax, 26 -hysiz1: shld eax, edx, 6 -hoffs1: mov cl, byte ptr [eax+88888888h] -pal1: mov bl, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - mov byte ptr [edi], bl - dec edi - dec ebp - -skipthe1byte: - test edi, 2 - jnz short skipthe2byte - - mov eax, esi -hxsiz2: shr eax, 26 -hysiz2: shld eax, edx, 6 -hoffs2: mov cl, byte ptr [eax+88888888h] -pal2: mov bh, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - - mov eax, esi -hxsiz3: shr eax, 26 -hysiz3: shld eax, edx, 6 -hoffs3: mov cl, byte ptr [eax+88888888h] -pal3: mov bl, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - mov word ptr [edi-1], bx - sub edi, 2 - sub ebp, 2 - -skipthe2byte: - - mov eax, esi -machxbits1: shl esi, 6 ;xbits -machnegxbits1: shr eax, 32-6 ;32-xbits - mov dl, al - - inc edi - - add ebx, ebx - mov eax, edx - jc beginhline64 - - mov eax, _asm1 -machxbits2: rol eax, 6 ;xbits - mov dword ptr [hmach4a+2], eax - mov dword ptr [hmach4b+2], eax - mov dword ptr [hmach4c+2], eax - mov dword ptr [hmach4d+2], eax - mov ebx, eax - mov eax, _asm2 - mov al, bl - mov dword ptr [hmach1a+2], eax - mov dword ptr [hmach1b+2], eax - mov dword ptr [hmach1c+2], eax - mov dword ptr [hmach1d+2], eax - - mov eax, edx - jmp beginhline64 -ALIGN 16 -prebeginhline64: - mov dword ptr [edi], ebx -beginhline64: - -hmach3a: rol eax, 6 -hmach2a: and eax, 00008888h -hmach4a: sub esi, 88888888h -hmach1a: sbb edx, 88888888h - sub edi, 4 -hoffs4: mov cl, byte ptr [eax+88888888h] - mov eax, edx - -hmach3b: rol eax, 6 -hmach2b: and eax, 00008888h -hmach4b: sub esi, 88888888h -hmach1b: sbb edx, 88888888h -pal4: mov bh, byte ptr [ecx+88888888h] -hoffs5: mov cl, byte ptr [eax+88888888h] - mov eax, edx - -hmach3c: rol eax, 6 -pal5: mov bl, byte ptr [ecx+88888888h] -hmach2c: and eax, 00008888h - shl ebx, 16 -hmach4c: sub esi, 88888888h -hmach1c: sbb edx, 88888888h -hoffs6: mov cl, byte ptr [eax+88888888h] - - mov eax, edx - ;( - -hmach3d: rol eax, 6 -hmach2d: and eax, 00008888h -hmach4d: sub esi, 88888888h -hmach1d: sbb edx, 88888888h -pal6: mov bh, byte ptr [ecx+88888888h] -hoffs7: mov cl, byte ptr [eax+88888888h] - mov eax, edx - sub ebp, 4 - nop -pal7: mov bl, byte ptr [ecx+88888888h] - jnc prebeginhline64 -skipthe4byte: - - test ebp, 2 - jz skipdrawthe2 - rol ebx, 16 - mov word ptr [edi+2], bx - sub edi, 2 -skipdrawthe2: - test ebp, 1 - jz skipdrawthe1 - shr ebx, 24 - mov byte ptr [edi+3], bl -skipdrawthe1: - - pop ebp - ret - -shorthline: - test ebp, ebp - jz endshorthline -begshorthline: - mov eax, esi -hxsiz4: shr eax, 26 -hysiz4: shld eax, edx, 6 -hoffs8: mov cl, byte ptr [eax+88888888h] -pal8: mov bl, byte ptr [ecx+88888888h] - sub esi, _asm1 - sub edx, _asm2 - mov byte ptr [edi], bl - dec edi - dec ebp - jnz begshorthline -endshorthline: - pop ebp - ret - - - ;eax: 00000000 00000000 00000000 temp---- - ;ebx: 00000000 00000000 00000000 temp---- - ;ecx: UUUUUUuu uuuuuuuu uuuuuuuu uuuuuuuu - ;edx: VVVVVVvv vvvvvvvv vvvvvvvv vvvvvvvv - ;esi: cnt----- -------- -------- -------- - ;edi: vid----- -------- -------- -------- - ;ebp: paloffs- -------- -------- -------- - ;esp: ???????? ???????? ???????? ???????? -ALIGN 16 -PUBLIC prohlineasm4_ -prohlineasm4_: - push ebp - - lea ebp, [ecx+88888888h] -prohpala: - mov ecx, esi - lea esi, [eax+1] - sub edi, esi - -prohbeg: - mov eax, ecx - shr eax, 20 -prohshru: - mov ebx, edx - shr ebx, 26 -prohshrv: - and eax, 88888888h -prohand: - movzx eax, byte ptr [eax+ebx+88888888h] -prohbuf: - mov al, [eax+ebp] - sub ecx, _asm1 - sub edx, _asm2 - mov [edi+esi], al - dec esi - jnz prohbeg - - pop ebp - ret - - - -ALIGN 16 -PUBLIC setupvlineasm_ -setupvlineasm_: - ;First 2 lines for VLINEASM1, rest for VLINEASM4 - mov byte ptr [premach3a+2], al - mov byte ptr [mach3a+2], al - - push ecx - mov byte ptr [machvsh1+2], al ;32-shy - mov byte ptr [machvsh3+2], al ;32-shy - mov byte ptr [machvsh5+2], al ;32-shy - mov byte ptr [machvsh6+2], al ;32-shy - mov ah, al - sub ah, 16 - mov byte ptr [machvsh8+2], ah ;16-shy - neg al - mov byte ptr [machvsh7+2], al ;shy - mov byte ptr [machvsh9+2], al ;shy - mov byte ptr [machvsh10+2], al ;shy - mov byte ptr [machvsh11+2], al ;shy - mov byte ptr [machvsh12+2], al ;shy - mov cl, al - mov eax, 1 - shl eax, cl - dec eax - mov dword ptr [machvsh2+2], eax ;(1<>sh) - ;vplc3 = (ebp<<(32-sh))+((edx&65535)<<(16-sh)) -machvsh5: shl esi, 88h ;32-sh - mov eax, edx -machvsh6: shl ebp, 88h ;32-sh - and edx, 0000ffffh -machvsh7: shr eax, 88h ;sh - add esi, eax -machvsh8: shl edx, 88h ;16-sh - add ebp, edx - mov dword ptr _vplce[12], esi - mov dword ptr _vplce[4], ebp - - pop ebp - ret - - ;eax: -------temp1------- - ;ebx: -------temp2------- - ;ecx: ylo4 --------- - ;edx: ylo2 --------- - ;esi: yhi1 yhi2 - ;edi: ---videoplc/cnt---- - ;ebp: yhi3 yhi4 - ;esp: -ALIGN 16 -PUBLIC provlineasm4_ -provlineasm4_: - push ebp - - mov eax, dword ptr _ylookup[ecx*4] - add eax, edi - mov dword ptr [promachvline4end1+2], eax - inc eax - mov dword ptr [promachvline4end2+2], eax - inc eax - mov dword ptr [promachvline4end3+2], eax - inc eax - mov dword ptr [promachvline4end4+2], eax - sub eax, 3 - sub edi, eax - - mov eax, dword ptr _bufplce[0] - mov ebx, dword ptr _bufplce[4] - mov ecx, dword ptr _bufplce[8] - mov edx, dword ptr _bufplce[12] - mov dword ptr [promachvbuf1+3], ecx - mov dword ptr [promachvbuf2+3], edx - mov dword ptr [promachvbuf3+3], eax - mov dword ptr [promachvbuf4+3], ebx - - mov eax, dword ptr _palookupoffse[0] - mov ebx, dword ptr _palookupoffse[4] - mov ecx, dword ptr _palookupoffse[8] - mov edx, dword ptr _palookupoffse[12] - mov dword ptr [promachvpal1+2], ecx - mov dword ptr [promachvpal2+2], edx - mov dword ptr [promachvpal3+2], eax - mov dword ptr [promachvpal4+2], ebx - - ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - ;edx: ³v3lo ³v1lo ³ - ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄ´ - ;esi: ³v2hi v2lo ³ v3hi³ - ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ´ - ;ebp: ³v0hi v0lo ³ v1hi³ - ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÙ - - mov ebp, dword ptr _vince[0] - mov ebx, dword ptr _vince[4] - mov esi, dword ptr _vince[8] - mov eax, dword ptr _vince[12] - and esi, 0fffffe00h - and ebp, 0fffffe00h -promachvsh9: rol eax, 88h ;sh -promachvsh10: rol ebx, 88h ;sh - mov edx, eax - mov ecx, ebx - shr ecx, 16 - and edx, 0ffff0000h - add edx, ecx - and eax, 000001ffh - and ebx, 000001ffh - add esi, eax - add ebp, ebx - ; - mov eax, edx - and eax, 0ffff0000h - mov dword ptr [promachvinc1+2], eax - mov dword ptr [promachvinc2+2], esi - shl edx, 16 - mov dword ptr [promachvinc3+2], edx - mov dword ptr [promachvinc5+2], ebp - - mov ebp, dword ptr _vplce[0] - mov ebx, dword ptr _vplce[4] - mov esi, dword ptr _vplce[8] - mov eax, dword ptr _vplce[12] - and esi, 0fffffe00h - and ebp, 0fffffe00h -promachvsh11: rol eax, 88h ;sh -promachvsh12: rol ebx, 88h ;sh - mov edx, eax - mov ecx, ebx - shr ecx, 16 - and edx, 0ffff0000h - add edx, ecx - and eax, 000001ffh - and ebx, 000001ffh - add esi, eax - add ebp, ebx - - mov eax, esi - mov ecx, edx - shl ecx, 16 - jmp short probeginvlineasm4 -ALIGN 16 - nop - nop - nop -probeginvlineasm4: -promachvsh1: shr eax, 88h ;32-sh - mov ebx, esi -promachvsh2: and ebx, 00000088h ;(1<>sh) - ;vplc3 = (ebp<<(32-sh))+((edx&65535)<<(16-sh)) -promachvsh5: shl esi, 88h ;32-sh - mov eax, edx -promachvsh6: shl ebp, 88h ;32-sh - and edx, 0000ffffh -promachvsh7: shr eax, 88h ;sh - add esi, eax -promachvsh8: shl edx, 88h ;16-sh - add ebp, edx - mov dword ptr _vplce[12], esi - mov dword ptr _vplce[4], ebp - - pop ebp - ret - - -ALIGN 16 -PUBLIC mvlineasm4_ -mvlineasm4_: - push ebp - - mov eax, dword ptr _bufplce[0] - mov ebx, dword ptr _bufplce[4] - mov dword ptr [machmv1+2], eax - mov dword ptr [machmv4+2], ebx - mov eax, dword ptr _bufplce[8] - mov ebx, dword ptr _bufplce[12] - mov dword ptr [machmv7+2], eax - mov dword ptr [machmv10+2], ebx - - mov eax, dword ptr _palookupoffse[0] - mov ebx, dword ptr _palookupoffse[4] - mov dword ptr [machmv2+2], eax - mov dword ptr [machmv5+2], ebx - mov eax, dword ptr _palookupoffse[8] - mov ebx, dword ptr _palookupoffse[12] - mov dword ptr [machmv8+2], eax - mov dword ptr [machmv11+2], ebx - - mov eax, dword ptr _vince[0] ;vince - mov ebx, dword ptr _vince[4] - xor al, al - xor bl, bl - mov dword ptr [machmv3+2], eax - mov dword ptr [machmv6+2], ebx - mov eax, dword ptr _vince[8] - mov ebx, dword ptr _vince[12] - mov dword ptr [machmv9+2], eax - mov dword ptr [machmv12+2], ebx - - mov ebx, ecx - mov ecx, dword ptr _vplce[0] - mov edx, dword ptr _vplce[4] - mov esi, dword ptr _vplce[8] - mov ebp, dword ptr _vplce[12] - mov cl, bl - inc cl - inc bh - mov byte ptr _asm3[0], bh -fixchain2ma: sub edi, 320 - - jmp short beginmvlineasm4 -ALIGN 16 -beginmvlineasm4: - dec cl - jz endmvlineasm4 -beginmvlineasm42: - mov eax, ebp - mov ebx, esi -machmv16: shr eax, 32 -machmv15: shr ebx, 32 -machmv12: add ebp, 88888888h ;vince[3] -machmv9: add esi, 88888888h ;vince[2] -machmv10: mov al, byte ptr [eax+88888888h] ;bufplce[3] -machmv7: mov bl, byte ptr [ebx+88888888h] ;bufplce[2] - cmp al, 255 - adc dl, dl - cmp bl, 255 - adc dl, dl -machmv8: mov bl, byte ptr [ebx+88888888h] ;palookupoffs[2] -machmv11: mov bh, byte ptr [eax+88888888h] ;palookupoffs[3] - - mov eax, edx -machmv14: shr eax, 32 - shl ebx, 16 -machmv4: mov al, byte ptr [eax+88888888h] ;bufplce[1] - cmp al, 255 - adc dl, dl -machmv6: add edx, 88888888h ;vince[1] -machmv5: mov bh, byte ptr [eax+88888888h] ;palookupoffs[1] - - mov eax, ecx -machmv13: shr eax, 32 -machmv3: add ecx, 88888888h ;vince[0] -machmv1: mov al, byte ptr [eax+88888888h] ;bufplce[0] - cmp al, 255 - adc dl, dl -machmv2: mov bl, byte ptr [eax+88888888h] ;palookupoffs[0] - - shl dl, 4 - xor eax, eax -fixchain2mb: add edi, 320 - mov al, dl - add eax, offset mvcase0 - jmp eax ;16 byte cases - -ALIGN 16 -endmvlineasm4: - dec byte ptr _asm3[0] - jnz beginmvlineasm42 - - mov dword ptr _vplce[0], ecx - mov dword ptr _vplce[4], edx - mov dword ptr _vplce[8], esi - mov dword ptr _vplce[12], ebp - pop ebp - ret - - ;5,7,8,8,11,13,12,14,11,13,14,14,12,14,15,7 -ALIGN 16 -mvcase0: - jmp beginmvlineasm4 -ALIGN 16 -mvcase1: - mov byte ptr [edi], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase2: - mov byte ptr [edi+1], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase3: - mov word ptr [edi], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase4: - shr ebx, 16 - mov byte ptr [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase5: - mov byte ptr [edi], bl - shr ebx, 16 - mov byte ptr [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 - mvcase6: - shr ebx, 8 - mov word ptr [edi+1], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase7: - mov word ptr [edi], bx - shr ebx, 16 - mov byte ptr [edi+2], bl - jmp beginmvlineasm4 -ALIGN 16 -mvcase8: - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase9: - mov byte ptr [edi], bl - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase10: - mov byte ptr [edi+1], bh - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase11: - mov word ptr [edi], bx - shr ebx, 16 - mov byte ptr [edi+3], bh - jmp beginmvlineasm4 -ALIGN 16 -mvcase12: - shr ebx, 16 - mov word ptr [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase13: - mov byte ptr [edi], bl - shr ebx, 16 - mov word ptr [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase14: - mov byte ptr [edi+1], bh - shr ebx, 16 - mov word ptr [edi+2], bx - jmp beginmvlineasm4 -ALIGN 16 -mvcase15: - mov dword ptr [edi], ebx - jmp beginmvlineasm4 - -ALIGN 16 -PUBLIC setupspritevline_ -setupspritevline_: - mov dword ptr [spal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword ptr [smach1+2], eax - mov dword ptr [smach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword ptr [smach2+2], eax - add eax, edx - mov dword ptr [smach5+2], eax - - mov dword ptr [smach3+2], ecx ;yinc's - ret - -ALIGN 16 -PUBLIC spritevline_ - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p -prestartsvline: -smach1: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -smach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -startsvline: -spal: mov al, [eax+88888888h] ;palookup - mov byte ptr [edi], al -fixchain1s: add edi, 320 - -spritevline_: -smach3: add edx, 88888888h ;dayinc - dec ecx - ja short prestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short endsvline -smach4: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -smach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short startsvline -endsvline: - ret - -ALIGN 16 -PUBLIC msetupspritevline_ -msetupspritevline_: - mov dword ptr [mspal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword ptr [msmach1+2], eax - mov dword ptr [msmach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword ptr [msmach2+2], eax - add eax, edx - mov dword ptr [msmach5+2], eax - - mov dword ptr [msmach3+2], ecx ;yinc's - ret - -ALIGN 16 -PUBLIC mspritevline_ - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p -mprestartsvline: -msmach1: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -msmach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -mstartsvline: - cmp al, 255 - je short mskipsvline -mspal: mov al, [eax+88888888h] ;palookup - mov byte ptr [edi], al -mskipsvline: -mfixchain1s: add edi, 320 - -mspritevline_: -msmach3: add edx, 88888888h ;dayinc - dec ecx - ja short mprestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short mendsvline -msmach4: add ebx, 88888888h ;xincshl16 - mov al, byte ptr [esi] -msmach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short mstartsvline -mendsvline: - ret - -ALIGN 16 -PUBLIC tsetupspritevline_ -tsetupspritevline_: - mov dword ptr [tspal+2], eax - - mov eax, esi ;xinc's - shl eax, 16 - mov dword ptr [tsmach1+2], eax - mov dword ptr [tsmach4+2], eax - mov eax, esi - sar eax, 16 - add eax, ebx ;watch out with ebx - it's passed - mov dword ptr [tsmach2+2], eax - add eax, edx - mov dword ptr [tsmach5+2], eax - - mov dword ptr [tsmach3+2], ecx ;yinc's - ret - -ALIGN 16 -PUBLIC tspritevline_ -tspritevline_: - ;eax = 0, ebx = x, ecx = cnt, edx = y, esi = yplc, edi = p - push ebp - mov ebp, ebx - xor ebx, ebx - jmp tenterspritevline -ALIGN 16 -tprestartsvline: -tsmach1: add ebp, 88888888h ;xincshl16 - mov al, byte ptr [esi] -tsmach2: adc esi, 88888888h ;xincshr16+yalwaysinc - -tstartsvline: - cmp al, 255 - je short tskipsvline -transrev2: - mov bh, byte ptr [edi] -transrev3: -tspal: mov bl, [eax+88888888h] ;palookup -tmach4: mov al, byte ptr [ebx+88888888h] ;_transluc - mov byte ptr [edi], al -tskipsvline: -tfixchain1s: add edi, 320 - -tenterspritevline: -tsmach3: add edx, 88888888h ;dayinc - dec ecx - ja short tprestartsvline ;jump if (no carry (add)) and (not zero (dec))! - jz short tendsvline -tsmach4: add ebp, 88888888h ;xincshl16 - mov al, byte ptr [esi] -tsmach5: adc esi, 88888888h ;xincshr16+yalwaysinc+daydime - jmp short tstartsvline -tendsvline: - pop ebp - ret - -ALIGN 16 -PUBLIC msethlineshift_ -msethlineshift_: - neg al - mov byte ptr [msh1d+2], al - mov byte ptr [msh2d+3], bl - mov byte ptr [msh3d+2], al - mov byte ptr [msh4d+3], bl - mov byte ptr [msh5d+2], al - mov byte ptr [msh6d+3], bl - ret - -ALIGN 16 -PUBLIC mhline_ -mhline_: - ;_asm1 = bxinc - ;_asm2 = byinc - ;_asm3 = shadeoffs - ;eax = picoffs - ;ebx = bx - ;ecx = cnt - ;edx = ? - ;esi = by - ;edi = p - - mov dword ptr [mmach1d+2], eax - mov dword ptr [mmach5d+2], eax - mov dword ptr [mmach9d+2], eax - mov eax, _asm3 - mov dword ptr [mmach2d+2], eax - mov dword ptr [mmach2da+2], eax - mov dword ptr [mmach2db+2], eax - mov dword ptr [mmach6d+2], eax - mov dword ptr [mmach10d+2], eax - mov eax, _asm1 - mov dword ptr [mmach3d+2], eax - mov dword ptr [mmach7d+2], eax - mov eax, _asm2 - mov dword ptr [mmach4d+2], eax - mov dword ptr [mmach8d+2], eax - jmp short mhlineskipmodify_ - -ALIGN 16 -PUBLIC mhlineskipmodify_ -mhlineskipmodify_: - - push ebp - - xor eax, eax - mov ebp, ebx - - test ecx, 00010000h - jnz short mbeghline - -msh1d: shr ebx, 26 -msh2d: shld ebx, esi, 6 - add ebp, _asm1 -mmach9d: mov al, byte ptr [ebx+88888888h] ;picoffs - add esi, _asm2 - cmp al, 255 - je mskip5 - - mmach10d: mov cl, byte ptr [eax+88888888h] ;shadeoffs - mov byte ptr [edi], cl -mskip5: - inc edi - sub ecx, 65536 - jc mendhline - jmp short mbeghline - -ALIGN 16 -mpreprebeghline: ;1st only - mov al, cl -mmach2d: mov al, byte ptr [eax+88888888h] ;shadeoffs - mov byte ptr [edi], al - -mprebeghline: - add edi, 2 - sub ecx, 131072 - jc short mendhline -mbeghline: -mmach3d: lea ebx, [ebp+88888888h] ;bxinc -msh3d: shr ebp, 26 -msh4d: shld ebp, esi, 6 -mmach4d: add esi, 88888888h ;byinc -mmach1d: mov cl, byte ptr [ebp+88888888h] ;picoffs -mmach7d: lea ebp, [ebx+88888888h] ;bxinc - -msh5d: shr ebx, 26 -msh6d: shld ebx, esi, 6 -mmach8d: add esi, 88888888h ;byinc -mmach5d: mov ch, byte ptr [ebx+88888888h] ;picoffs - - cmp cl, 255 - je short mskip1 - cmp ch, 255 - je short mpreprebeghline - - mov al, cl ;BOTH -mmach2da: mov bl, byte ptr [eax+88888888h] ;shadeoffs - mov al, ch -mmach2db: mov bh, byte ptr [eax+88888888h] ;shadeoffs - mov word ptr [edi], bx - add edi, 2 - sub ecx, 131072 - jnc short mbeghline - jmp mendhline -mskip1: ;2nd only - cmp ch, 255 - je short mprebeghline - - mov al, ch -mmach6d: mov al, byte ptr [eax+88888888h] ;shadeoffs - mov byte ptr [edi+1], al - add edi, 2 - sub ecx, 131072 - jnc short mbeghline -mendhline: - - pop ebp - ret - -ALIGN 16 -PUBLIC tsethlineshift_ -tsethlineshift_: - neg al - mov byte ptr [tsh1d+2], al - mov byte ptr [tsh2d+3], bl - mov byte ptr [tsh3d+2], al - mov byte ptr [tsh4d+3], bl - mov byte ptr [tsh5d+2], al - mov byte ptr [tsh6d+3], bl - ret - -ALIGN 16 -PUBLIC thline_ -thline_: - ;_asm1 = bxinc - ;_asm2 = byinc - ;_asm3 = shadeoffs - ;eax = picoffs - ;ebx = bx - ;ecx = cnt - ;edx = ? - ;esi = by - ;edi = p - - mov dword ptr [tmach1d+2], eax - mov dword ptr [tmach5d+2], eax - mov dword ptr [tmach9d+2], eax - mov eax, _asm3 - mov dword ptr [tmach2d+2], eax - mov dword ptr [tmach6d+2], eax - mov dword ptr [tmach10d+2], eax - mov eax, _asm1 - mov dword ptr [tmach3d+2], eax - mov dword ptr [tmach7d+2], eax - mov eax, _asm2 - mov dword ptr [tmach4d+2], eax - mov dword ptr [tmach8d+2], eax - jmp thlineskipmodify_ - -ALIGN 16 -PUBLIC thlineskipmodify_ -thlineskipmodify_: - - push ebp - - xor eax, eax - xor edx, edx - mov ebp, ebx - - test ecx, 00010000h - jnz short tbeghline - -tsh1d: shr ebx, 26 -tsh2d: shld ebx, esi, 6 - add ebp, _asm1 -tmach9d: mov al, byte ptr [ebx+88888888h] ;picoffs - add esi, _asm2 - cmp al, 255 - je tskip5 - -transrev4: -tmach10d: mov dl, byte ptr [eax+88888888h] ;shadeoffs -transrev5: - mov dh, byte ptr [edi] -tmach1: mov al, byte ptr [edx+88888888h] ;_transluc - mov byte ptr [edi], al -tskip5: - inc edi - sub ecx, 65536 - jc tendhline - jmp short tbeghline - -ALIGN 16 -tprebeghline: - add edi, 2 - sub ecx, 131072 - jc short tendhline -tbeghline: -tmach3d: lea ebx, [ebp+88888888h] ;bxinc -tsh3d: shr ebp, 26 -tsh4d: shld ebp, esi, 6 -tmach4d: add esi, 88888888h ;byinc -tmach1d: mov cl, byte ptr [ebp+88888888h] ;picoffs -tmach7d: lea ebp, [ebx+88888888h] ;bxinc - -tsh5d: shr ebx, 26 -tsh6d: shld ebx, esi, 6 -tmach8d: add esi, 88888888h ;byinc -tmach5d: mov ch, byte ptr [ebx+88888888h] ;picoffs - - cmp cx, 0ffffh - je short tprebeghline - - mov bx, word ptr [edi] - - cmp cl, 255 - je short tskip1 - mov al, cl -transrev6: -tmach2d: mov dl, byte ptr [eax+88888888h] ;shadeoffs -transrev7: - mov dh, bl -tmach2: mov al, byte ptr [edx+88888888h] ;_transluc - mov byte ptr [edi], al - - cmp ch, 255 - je short tskip2 -tskip1: - mov al, ch -transrev8: -tmach6d: mov dl, byte ptr [eax+88888888h] ;shadeoffs -transrev9: - mov dh, bh -tmach3: mov al, byte ptr [edx+88888888h] ;_transluc - mov byte ptr [edi+1], al -tskip2: - - add edi, 2 - sub ecx, 131072 - jnc tbeghline -tendhline: - - pop ebp - ret - - - ;eax=shiftval, ebx=palookup1, ecx=palookup2 -ALIGN 16 -PUBLIC setuptvlineasm2_ -setuptvlineasm2_: - mov byte ptr [tran2shra+2], al - mov byte ptr [tran2shrb+2], al - mov dword ptr [tran2pala+2], ebx - mov dword ptr [tran2palb+2], ecx - mov dword ptr [tran2palc+2], ebx - mov dword ptr [tran2pald+2], ecx - ret - - ;Pass: eax=vplc2, ebx=vinc1, ecx=bufplc1, edx=bufplc2, esi=vplc1, edi=p - ; _asm1=vinc2, _asm2=pend - ;Return: _asm1=vplc1, _asm2=vplc2 -ALIGN 16 -PUBLIC tvlineasm2_ -tvlineasm2_: - push ebp - - mov ebp, eax - - mov dword ptr [tran2inca+2], ebx - mov eax, _asm1 - mov dword ptr [tran2incb+2], eax - - mov dword ptr [tran2bufa+2], ecx ;bufplc1 - mov dword ptr [tran2bufb+2], edx ;bufplc2 - - mov eax, _asm2 - sub edi, eax - mov dword ptr [tran2edia+3], eax - mov dword ptr [tran2edic+2], eax - inc eax - mov dword ptr [tran2edie+2], eax -fixchaint2a: sub eax, 320 - mov dword ptr [tran2edif+2], eax - dec eax - mov dword ptr [tran2edib+3], eax - mov dword ptr [tran2edid+2], eax - - xor ecx, ecx - xor edx, edx - jmp short begintvline2 - - ;eax 0000000000 temp temp - ;ebx 0000000000 odat2 odat1 - ;ecx 0000000000000000 ndat1 - ;edx 0000000000000000 ndat2 - ;esi vplc1 - ;edi videoplc-------------- - ;ebp vplc2 - -ALIGN 16 - ;LEFT ONLY -skipdraw2: -transrev10: -tran2edic: mov ah, byte ptr [edi+88888888h] ;getpixel -transrev11: -tran2palc: mov al, byte ptr [ecx+88888888h] ;palookup1 -fixchaint2d: add edi, 320 -tran2trac: mov bl, byte ptr [eax+88888888h] ;_transluc -tran2edid: mov byte ptr [edi+88888888h-320], bl ;drawpixel - jnc short begintvline2 - jmp endtvline2 - -skipdraw1: - cmp dl, 255 - jne short skipdraw3 -fixchaint2b: add edi, 320 - jc short endtvline2 - -begintvline2: - mov eax, esi -tran2shra: shr eax, 88h ;globalshift - mov ebx, ebp -tran2shrb: shr ebx, 88h ;globalshift -tran2inca: add esi, 88888888h ;vinc1 -tran2incb: add ebp, 88888888h ;vinc2 -tran2bufa: mov cl, byte ptr [eax+88888888h] ;bufplc1 - cmp cl, 255 -tran2bufb: mov dl, byte ptr [ebx+88888888h] ;bufplc2 - je short skipdraw1 - cmp dl, 255 - je short skipdraw2 - - ;mov ax The transluscent reverse of both! - ;mov bl, ah - ;mov ah - ;mov bh - - ;BOTH -transrev12: -tran2edia: mov bx, word ptr [edi+88888888h] ;getpixels -transrev13: - mov ah, bl -transrev14: -tran2pala: mov al, byte ptr [ecx+88888888h] ;palookup1 -transrev15: -tran2palb: mov bl, byte ptr [edx+88888888h] ;palookup2 -fixchaint2c: add edi, 320 -tran2traa: mov al, byte ptr [eax+88888888h] ;_transluc -tran2trab: mov ah, byte ptr [ebx+88888888h] ;_transluc -tran2edib: mov word ptr [edi+88888888h-320], ax ;drawpixels - jnc short begintvline2 - jmp short endtvline2 - - ;RIGHT ONLY -skipdraw3: -transrev16: -tran2edie: mov ah, byte ptr [edi+88888889h] ;getpixel -transrev17: -tran2pald: mov al, byte ptr [edx+88888888h] ;palookup2 -fixchaint2e: add edi, 320 -tran2trad: mov bl, byte ptr [eax+88888888h] ;_transluc -tran2edif: mov byte ptr [edi+88888889h-320], bl ;drawpixel - jnc short begintvline2 - -endtvline2: - mov _asm1, esi - mov _asm2, ebp - - pop ebp - ret - - -BITSOFPRECISION equ 3 -BITSOFPRECISIONPOW equ 8 - -;Double-texture mapping with palette lookup -;eax: ylo1------------|----dat|----dat -;ebx: ylo2--------------------|----cnt -;ecx: 000000000000000000000000|---temp -;edx: xhi1-xlo1---------------|---yhi1 -;esi: xhi2-xlo2---------------|---yhi2 -;edi: ------------------------videopos -;ebp: ----------------------------temp - -ALIGN 16 -PUBLIC setupslopevlin2_ -setupslopevlin2_: - mov dword ptr [slop3+2], edx ;ptr - mov dword ptr [slop7+2], edx ;ptr - mov dword ptr [slop4+2], esi ;tptr - mov dword ptr [slop8+2], esi ;tptr - mov byte ptr [slop2+2], ah ;ybits - mov byte ptr [slop6+2], ah ;ybits - mov dword ptr [slop9+2], edi ;pinc - - mov edx, 1 - mov cl, al - add cl, ah - shl edx, cl - dec edx - mov cl, ah - ror edx, cl - - mov dword ptr [slop1+2], edx ;ybits...xbits - mov dword ptr [slop5+2], edx ;ybits...xbits - - ret - -ALIGN 16 -PUBLIC slopevlin2_ -slopevlin2_: - push ebp - xor ecx, ecx - -slopevlin2begin: - mov ebp, edx -slop1: and ebp, 88000088h ;ybits...xbits -slop2: rol ebp, 6 ;ybits - add eax, _asm1 ;xinc1<>(32-xbits)) -slop3: mov cl, byte ptr [ebp+88888888h] ;bufplc - - mov ebp, esi -slop4: mov al, byte ptr [ecx+88888888h] ;paloffs -slop5: and ebp, 88000088h ;ybits...xbits -slop6: rol ebp, 6 ;ybits - add ebx, _asm3 ;xinc2<>(32-xbits)) -slop8: mov ah, byte ptr [ecx+88888888h] ;paloffs - - dec bl - mov word ptr [edi], ax -slop9: lea edi, [edi+88888888h] ;pinc - jnz short slopevlin2begin - - pop ebp - mov eax, edi - ret - - -ALIGN 16 -PUBLIC setupslopevlin_ -setupslopevlin_: - mov dword ptr [slopmach3+3], ebx ;ptr - mov dword ptr [slopmach5+2], ecx ;pinc - neg ecx - mov dword ptr [slopmach6+2], ecx ;-pinc - - mov edx, 1 - mov cl, al - shl edx, cl - dec edx - mov cl, ah - shl edx, cl - mov dword ptr [slopmach7+2], edx - - neg ah - mov byte ptr [slopmach2+2], ah - - sub ah, al - mov byte ptr [slopmach1+2], ah - - fild dword ptr _asm1 - fstp dword ptr _asm2 - ret - -ALIGN 16 -PUBLIC slopevlin_ -slopevlin_: - mov _ebpbak, ebp - mov _espbak, esp - - sub ecx, esp - mov dword ptr [slopmach4+3], ecx - - fild dword ptr _asm3 -slopmach6: lea ebp, [eax+88888888h] - fadd dword ptr _asm2 - - mov _asm1, ebx - shl ebx, 3 - - mov eax, _globalx3 - mov ecx, _globaly3 - imul eax, ebx - imul ecx, ebx - add esi, eax - add edi, ecx - - mov ebx, edx - jmp short bigslopeloop -ALIGN 16 -bigslopeloop: - fst dword ptr _fpuasm - - mov eax, _fpuasm - add eax, eax - sbb edx, edx - mov ecx, eax - shr ecx, 24 - and eax, 00ffe000h - shr eax, 11 - sub cl, 2 - mov eax, dword ptr _reciptable[eax] - shr eax, cl - xor eax, edx - mov edx, _asm1 - mov ecx, _globalx3 - mov _asm1, eax - sub eax, edx - mov edx, _globaly3 - imul ecx, eax - imul eax, edx - - fadd dword ptr _asm2 - - cmp ebx, BITSOFPRECISIONPOW - mov _asm4, ebx - mov cl, bl - jl short slopeskipmin - mov cl, BITSOFPRECISIONPOW -slopeskipmin: - -;eax: yinc............. -;ebx: 0 0 0 ? -;ecx: xinc......... cnt -;edx: ? -;esi: xplc............. -;edi: yplc............. -;ebp: videopos - - mov ebx, esi - mov edx, edi - -beginnerslopeloop: -slopmach1: shr ebx, 20 - add esi, ecx -slopmach2: shr edx, 26 -slopmach7: and ebx, 88888888h - add edi, eax -slopmach5: add ebp, 88888888h ;pinc -slopmach3: mov dl, byte ptr [ebx+edx+88888888h] ;ptr -slopmach4: mov ebx, dword ptr [esp+88888888h] - sub esp, 4 - dec cl - mov al, byte ptr [ebx+edx] ;tptr - mov ebx, esi - mov [ebp], al - mov edx, edi - jnz short beginnerslopeloop - - mov ebx, _asm4 - sub ebx, BITSOFPRECISIONPOW - jg bigslopeloop - - ffree st(0) - - mov esp, _espbak - mov ebp, _ebpbak - ret - - -ALIGN 16 -PUBLIC setuprhlineasm4_ -setuprhlineasm4_: - mov dword ptr [rmach1a+2], eax - mov dword ptr [rmach1b+2], eax - mov dword ptr [rmach1c+2], eax - mov dword ptr [rmach1d+2], eax - mov dword ptr [rmach1e+2], eax - - mov dword ptr [rmach2a+2], ebx - mov dword ptr [rmach2b+2], ebx - mov dword ptr [rmach2c+2], ebx - mov dword ptr [rmach2d+2], ebx - mov dword ptr [rmach2e+2], ebx - - mov dword ptr [rmach3a+2], ecx - mov dword ptr [rmach3b+2], ecx - mov dword ptr [rmach3c+2], ecx - mov dword ptr [rmach3d+2], ecx - mov dword ptr [rmach3e+2], ecx - - mov dword ptr [rmach4a+2], edx - mov dword ptr [rmach4b+2], edx - mov dword ptr [rmach4c+2], edx - mov dword ptr [rmach4d+2], edx - mov dword ptr [rmach4e+2], edx - - mov dword ptr [rmach5a+2], esi - mov dword ptr [rmach5b+2], esi - mov dword ptr [rmach5c+2], esi - mov dword ptr [rmach5d+2], esi - mov dword ptr [rmach5e+2], esi - ret - - ;Non power of 2, non masking, with palookup method #1 (6 clock cycles) - ;eax: dat dat dat dat - ;ebx: bufplc - ;ecx: 0 dat - ;edx: xlo - ;esi: ylo - ;edi: videopos/cnt - ;ebp: tempvar - ;esp: -ALIGN 16 -PUBLIC rhlineasm4_ -rhlineasm4_: - push ebp - - cmp eax, 0 - jle endrhline - - lea ebp, [edi-4] - sub ebp, eax - mov dword ptr [rmach6a+2], ebp - add ebp, 3 - mov dword ptr [rmach6b+2], ebp - mov edi, eax - test edi, 3 - jz short begrhline - jmp short startrhline1 - -ALIGN 16 -startrhline1: - mov cl, byte ptr [ebx] ;bufplc -rmach1e: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2e: sub esi, 88888888h ;ylo -rmach3e: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach4e: mov al, byte ptr [ecx+88888888h] ;palookup -rmach5e: and ebp, 88888888h ;tilesizy -rmach6b: mov byte ptr [edi+88888888h], al ;vidcntoffs - sub ebx, ebp - dec edi - test edi, 3 - jnz short startrhline1 - test edi, edi - jz endrhline - -begrhline: - mov cl, byte ptr [ebx] ;bufplc -rmach1a: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2a: sub esi, 88888888h ;ylo -rmach3a: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5a: and ebp, 88888888h ;tilesizy - sub ebx, ebp - -rmach1b: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach4a: mov ah, byte ptr [ecx+88888888h] ;palookup - mov cl, byte ptr [ebx] ;bufplc -rmach2b: sub esi, 88888888h ;ylo -rmach3b: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5b: and ebp, 88888888h ;tilesizy -rmach4b: mov al, byte ptr [ecx+88888888h] ;palookup - sub ebx, ebp - - shl eax, 16 - - mov cl, byte ptr [ebx] ;bufplc -rmach1c: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach2c: sub esi, 88888888h ;ylo -rmach3c: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5c: and ebp, 88888888h ;tilesizy - sub ebx, ebp - -rmach1d: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmach4c: mov ah, byte ptr [ecx+88888888h] ;palookup - mov cl, byte ptr [ebx] ;bufplc -rmach2d: sub esi, 88888888h ;ylo -rmach3d: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmach5d: and ebp, 88888888h ;tilesizy -rmach4d: mov al, byte ptr [ecx+88888888h] ;palookup - sub ebx, ebp - -rmach6a: mov dword ptr [edi+88888888h], eax ;vidcntoffs - sub edi, 4 - jnz begrhline -endrhline: - pop ebp - ret - -ALIGN 16 -PUBLIC setuprmhlineasm4_ -setuprmhlineasm4_: - mov dword ptr [rmmach1+2], eax - mov dword ptr [rmmach2+2], ebx - mov dword ptr [rmmach3+2], ecx - mov dword ptr [rmmach4+2], edx - mov dword ptr [rmmach5+2], esi - ret - -ALIGN 16 -PUBLIC rmhlineasm4_ -rmhlineasm4_: - push ebp - - cmp eax, 0 - jle short endrmhline - - lea ebp, [edi-1] - sub ebp, eax - mov dword ptr [rmmach6+2], ebp - mov edi, eax - jmp short begrmhline - -ALIGN 16 -begrmhline: - mov cl, byte ptr [ebx] ;bufplc -rmmach1: sub edx, 88888888h ;xlo - sbb ebp, ebp -rmmach2: sub esi, 88888888h ;ylo -rmmach3: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -rmmach5: and ebp, 88888888h ;tilesizy - cmp cl, 255 - je short rmskip -rmmach4: mov al, byte ptr [ecx+88888888h] ;palookup -rmmach6: mov byte ptr [edi+88888888h], al ;vidcntoffs -rmskip: - sub ebx, ebp - dec edi - jnz short begrmhline -endrmhline: - pop ebp - ret - -ALIGN 16 -PUBLIC setupqrhlineasm4_ -setupqrhlineasm4_: - mov dword ptr [qrmach2e+2], ebx - mov dword ptr [qrmach3e+2], ecx - xor edi, edi - sub edi, ecx - mov dword ptr [qrmach7a+2], edi - mov dword ptr [qrmach7b+2], edi - - add ebx, ebx - adc ecx, ecx - mov dword ptr [qrmach2a+2], ebx - mov dword ptr [qrmach2b+2], ebx - mov dword ptr [qrmach3a+2], ecx - mov dword ptr [qrmach3b+2], ecx - - mov dword ptr [qrmach4a+2], edx - mov dword ptr [qrmach4b+2], edx - mov dword ptr [qrmach4c+2], edx - mov dword ptr [qrmach4d+2], edx - mov dword ptr [qrmach4e+2], edx - ret - - ;Non power of 2, non masking, with palookup method (FASTER BUT NO SBB'S) - ;eax: dat dat dat dat - ;ebx: bufplc - ;ecx: 0 dat - ;edx: 0 dat - ;esi: ylo - ;edi: videopos/cnt - ;ebp: ? - ;esp: -ALIGN 16 -PUBLIC qrhlineasm4_ ;4 pixels in 9 cycles! 2.25 cycles/pixel -qrhlineasm4_: - push ebp - - cmp eax, 0 - jle endqrhline - - mov ebp, eax - test ebp, 3 - jz short skipqrhline1 - jmp short startqrhline1 - -ALIGN 16 -startqrhline1: - mov cl, byte ptr [ebx] ;bufplc - dec edi -qrmach2e: sub esi, 88888888h ;ylo - dec ebp -qrmach3e: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4e: mov al, byte ptr [ecx+88888888h] ;palookup - mov byte ptr [edi], al ;vidcntoffs - test ebp, 3 - jnz short startqrhline1 - test ebp, ebp - jz short endqrhline - -skipqrhline1: - mov cl, byte ptr [ebx] ;bufplc - jmp short begqrhline -ALIGN 16 -begqrhline: -qrmach7a: mov dl, byte ptr [ebx+88888888h] ;bufplc -qrmach2a: sub esi, 88888888h ;ylo -qrmach3a: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4a: mov ah, byte ptr [ecx+88888888h] ;palookup -qrmach4b: mov al, byte ptr [edx+88888888h] ;palookup - sub edi, 4 - shl eax, 16 - mov cl, byte ptr [ebx] ;bufplc -qrmach7b: mov dl, byte ptr [ebx+88888888h] ;bufplc -qrmach2b: sub esi, 88888888h ;ylo -qrmach3b: sbb ebx, 88888888h ;xhi*tilesizy + yhi+ycarry -qrmach4c: mov ah, byte ptr [ecx+88888888h] ;palookup -qrmach4d: mov al, byte ptr [edx+88888888h] ;palookup - mov cl, byte ptr [ebx] ;bufplc - mov dword ptr [edi], eax - sub ebp, 4 - jnz short begqrhline - -endqrhline: - pop ebp - ret - - -PUBLIC setupdrawslab_ -setupdrawslab_: - mov dword ptr [voxbpl1+2], eax - mov dword ptr [voxbpl2+2], eax - mov dword ptr [voxbpl3+2], eax - mov dword ptr [voxbpl4+2], eax - mov dword ptr [voxbpl5+2], eax - mov dword ptr [voxbpl6+2], eax - mov dword ptr [voxbpl7+2], eax - mov dword ptr [voxbpl8+2], eax - - mov dword ptr [voxpal1+2], ebx - mov dword ptr [voxpal2+2], ebx - mov dword ptr [voxpal3+2], ebx - mov dword ptr [voxpal4+2], ebx - mov dword ptr [voxpal5+2], ebx - mov dword ptr [voxpal6+2], ebx - mov dword ptr [voxpal7+2], ebx - mov dword ptr [voxpal8+2], ebx - ret - -ALIGN 16 -PUBLIC drawslab_ -drawslab_: - push ebp - cmp eax, 2 - je voxbegdraw2 - ja voxskip2 - xor eax, eax -voxbegdraw1: - mov ebp, ebx - shr ebp, 16 - add ebx, edx - dec ecx - mov al, byte ptr [esi+ebp] -voxpal1: mov al, byte ptr [eax+88888888h] - mov byte ptr [edi], al -voxbpl1: lea edi, [edi+88888888h] - jnz voxbegdraw1 - pop ebp - ret - -voxbegdraw2: - mov ebp, ebx - shr ebp, 16 - add ebx, edx - xor eax, eax - dec ecx - mov al, byte ptr [esi+ebp] -voxpal2: mov al, byte ptr [eax+88888888h] - mov ah, al - mov word ptr [edi], ax -voxbpl2: lea edi, [edi+88888888h] - jnz voxbegdraw2 - pop ebp - ret - -voxskip2: - cmp eax, 4 - jne voxskip4 - xor eax, eax -voxbegdraw4: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal3: mov al, byte ptr [eax+88888888h] - mov ah, al - shl eax, 8 - mov al, ah - shl eax, 8 - mov al, ah - mov dword ptr [edi], eax -voxbpl3: add edi, 88888888h - dec ecx - jnz voxbegdraw4 - pop ebp - ret - -voxskip4: - add eax, edi - - test edi, 1 - jz voxskipslab1 - cmp edi, eax - je voxskipslab1 - - push eax - push ebx - push ecx - push edi -voxbegslab1: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal4: mov al, byte ptr [eax+88888888h] - mov byte ptr [edi], al -voxbpl4: add edi, 88888888h - dec ecx - jnz voxbegslab1 - pop edi - pop ecx - pop ebx - pop eax - inc edi - -voxskipslab1: - push eax - test edi, 2 - jz voxskipslab2 - dec eax - cmp edi, eax - jge voxskipslab2 - - push ebx - push ecx - push edi -voxbegslab2: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal5: mov al, byte ptr [eax+88888888h] - mov ah, al - mov word ptr [edi], ax -voxbpl5: add edi, 88888888h - dec ecx - jnz voxbegslab2 - pop edi - pop ecx - pop ebx - add edi, 2 - -voxskipslab2: - mov eax, [esp] - - sub eax, 3 - cmp edi, eax - jge voxskipslab3 - -voxprebegslab3: - push ebx - push ecx - push edi -voxbegslab3: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal6: mov al, byte ptr [eax+88888888h] - mov ah, al - shl eax, 8 - mov al, ah - shl eax, 8 - mov al, ah - mov dword ptr [edi], eax -voxbpl6: add edi, 88888888h - dec ecx - jnz voxbegslab3 - pop edi - pop ecx - pop ebx - add edi, 4 - - mov eax, [esp] - - sub eax, 3 - cmp edi, eax - jl voxprebegslab3 - -voxskipslab3: - mov eax, [esp] - - dec eax - cmp edi, eax - jge voxskipslab4 - - push ebx - push ecx - push edi -voxbegslab4: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal7: mov al, byte ptr [eax+88888888h] - mov ah, al - mov word ptr [edi], ax -voxbpl7: add edi, 88888888h - dec ecx - jnz voxbegslab4 - pop edi - pop ecx - pop ebx - add edi, 2 - -voxskipslab4: - pop eax - - cmp edi, eax - je voxskipslab5 - -voxbegslab5: - mov ebp, ebx - add ebx, edx - shr ebp, 16 - xor eax, eax - mov al, byte ptr [esi+ebp] -voxpal8: mov al, byte ptr [eax+88888888h] - mov byte ptr [edi], al -voxbpl8: add edi, 88888888h - dec ecx - jnz voxbegslab5 - -voxskipslab5: - pop ebp - ret - -;modify: loinc -;eax: | dat | dat | dat | dat | -;ebx: | loplc1 | -;ecx: | loplc2 | cnthi | cntlo | -;edx: |--------|--------|--------| hiplc1 | -;esi: |--------|--------|--------| hiplc2 | -;edi: |--------|--------|--------| vidplc | -;ebp: |--------|--------|--------| hiinc | - -PUBLIC stretchhline_ -stretchhline_: - push ebp - - mov eax, ebx - shl ebx, 16 - sar eax, 16 - and ecx, 0000ffffh - or ecx, ebx - - add esi, eax - mov eax, edx - mov edx, esi - - mov ebp, eax - shl eax, 16 - sar ebp, 16 - - add ecx, eax - adc esi, ebp - - add eax, eax - adc ebp, ebp - mov dword ptr [loinc1+2], eax - mov dword ptr [loinc2+2], eax - mov dword ptr [loinc3+2], eax - mov dword ptr [loinc4+2], eax - - inc ch - - jmp begloop - -begloop: - mov al, [edx] -loinc1: sub ebx, 88888888h - sbb edx, ebp - mov ah, [esi] -loinc2: sub ecx, 88888888h - sbb esi, ebp - sub edi, 4 - shl eax, 16 -loinc3: sub ebx, 88888888h - mov al, [edx] - sbb edx, ebp - mov ah, [esi] -loinc4: sub ecx, 88888888h - sbb esi, ebp - mov [edi], eax - dec cl - jnz begloop - dec ch - jnz begloop - - pop ebp - ret - - -PUBLIC mmxoverlay_ -mmxoverlay_: - pushfd ;Check if CPUID is available - pop eax - mov ebx, eax - xor eax, 00200000h - push eax - popfd - pushfd - pop eax - cmp eax, ebx - je pentium - xor eax, eax - dw 0a20fh - test eax, eax - jz pentium - mov eax, 1 - dw 0a20fh - and eax, 00000f00h - test edx, 00800000h ;Check if MMX is available - jz nommx - cmp eax, 00000600h ;Check if P6 Family or not - jae pentiumii - jmp pentiummmx -nommx: - cmp eax, 00000600h ;Check if P6 Family or not - jae pentiumpro -pentium: - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM II Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiumii: - ;Hline overlay (MMX doens't help) - mov byte ptr [sethlinesizes_], 0xe9 - mov dword ptr [sethlinesizes_+1], (offset prosethlinesizes_)-(offset sethlinesizes_)-5 - mov byte ptr [setpalookupaddress_], 0xe9 - mov dword ptr [setpalookupaddress_+1], (offset prosetpalookupaddress_)-(offset setpalookupaddress_)-5 - mov byte ptr [setuphlineasm4_], 0xc3 ;ret (no code required) - mov byte ptr [hlineasm4_], 0xe9 - mov dword ptr [hlineasm4_+1], (offset prohlineasm4_)-(offset hlineasm4_)-5 - - ;Vline overlay - mov byte ptr [setupvlineasm_], 0xe9 - mov dword ptr [setupvlineasm_+1], (offset prosetupvlineasm_)-(offset setupvlineasm_)-5 - mov byte ptr [vlineasm4_], 0xe9 - mov dword ptr [vlineasm4_+1], (offset provlineasm4_)-(offset vlineasm4_)-5 - - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM MMX Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiummmx: - ret - -;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -;³ PENTIUM PRO Overlays ³ -;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -pentiumpro: - ;Hline overlay (MMX doens't help) - mov byte ptr [sethlinesizes_], 0xe9 - mov dword ptr [sethlinesizes_+1], (offset prosethlinesizes_)-(offset sethlinesizes_)-5 - mov byte ptr [setpalookupaddress_], 0xe9 - mov dword ptr [setpalookupaddress_+1], (offset prosetpalookupaddress_)-(offset setpalookupaddress_)-5 - mov byte ptr [setuphlineasm4_], 0xc3 ;ret (no code required) - mov byte ptr [hlineasm4_], 0xe9 - mov dword ptr [hlineasm4_+1], (offset prohlineasm4_)-(offset hlineasm4_)-5 - - ;Vline overlay - mov byte ptr [setupvlineasm_], 0xe9 - mov dword ptr [setupvlineasm_+1], (offset prosetupvlineasm_)-(offset setupvlineasm_)-5 - mov byte ptr [vlineasm4_], 0xe9 - mov dword ptr [vlineasm4_+1], (offset provlineasm4_)-(offset vlineasm4_)-5 - - ret - -PUBLIC _dep_end -_dep_end: -CODE ENDS -END diff --git a/polymer-perf/eduke32/build/src/baselayer.c b/polymer-perf/eduke32/build/src/baselayer.c deleted file mode 100644 index f7c5d30c5..000000000 --- a/polymer-perf/eduke32/build/src/baselayer.c +++ /dev/null @@ -1,365 +0,0 @@ -#include "compat.h" -#include "osd.h" -#include "build.h" -#include "baselayer.h" - -#ifdef RENDERTYPEWIN -#include "winlayer.h" -#endif - -#include "polymost.h" - -// input -char inputdevices=0; -char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend; -char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend; -char remap[256]; -int32_t remapinit=0; -char key_names[256][24]; -volatile int32_t mousex=0,mousey=0,mouseb=0; -int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL; -char joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0; -int32_t joyaxespresent=0; - -void(*keypresscallback)(int32_t,int32_t) = 0; -void(*mousepresscallback)(int32_t,int32_t) = 0; -void(*joypresscallback)(int32_t,int32_t) = 0; -void (*after_handleevents_hook)(void) = 0; - -extern int16_t brightness; - -// -// set{key|mouse|joy}presscallback() -- sets a callback which gets notified when keys are pressed -// -void setkeypresscallback(void (*callback)(int32_t, int32_t)) { keypresscallback = callback; } -void setmousepresscallback(void (*callback)(int32_t, int32_t)) { mousepresscallback = callback; } -void setjoypresscallback(void (*callback)(int32_t, int32_t)) { joypresscallback = callback; } - -char scantoasc[128] = -{ - 0,0,'1','2','3','4','5','6','7','8','9','0','-','=',0,0, - 'q','w','e','r','t','y','u','i','o','p','[',']',0,0,'a','s', - 'd','f','g','h','j','k','l',';',39,'`',0,92,'z','x','c','v', - 'b','n','m',',','.','/',0,'*',0,32,0,0,0,0,0,0, - 0,0,0,0,0,0,0,'7','8','9','-','4','5','6','+','1', - '2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -}; - -int32_t defaultres[][2] = -{ - {1920, 1440}, {1920, 1200}, {1920, 1080}, {1600, 1200}, {1600, 900}, {1366, 768}, {1280, 1024}, - {1280, 960}, {1152, 864}, {1024, 768}, {1024, 600}, {800, 600}, {640, 480}, {640, 400}, - {512, 384}, {480, 360}, {400, 300}, {320, 240}, {320, 200}, {0, 0} -}; - - -void SetKey(int32_t key, int32_t state) -{ - keystatus[remap[key]] = state; - - if (state) - { - keyfifo[keyfifoend] = remap[key]; - keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state; - keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1)); - } -} - -// -// bgetchar, bflushchars -- character-based input functions -// -char bgetchar(void) -{ - if (keyasciififoplc == keyasciififoend) - return 0; - - { - char c = keyasciififo[keyasciififoplc]; - keyasciififoplc = ((keyasciififoplc+1)&(KEYFIFOSIZ-1)); - return c; - } -} - -void bflushchars(void) -{ - Bmemset(&keyasciififo,0,sizeof(keyasciififo)); - keyasciififoplc = keyasciififoend = 0; -} - -const char *getkeyname(int32_t num) -{ - return ((unsigned)num >= 256) ? NULL : key_names[num]; -} - -#ifdef USE_OPENGL -struct glinfo_t glinfo = -{ - "Unknown", // vendor - "Unknown", // renderer - "0.0.0", // version - "", // extensions - - 1.0, // max anisotropy - 0, // brga texture format - 0, // clamp-to-edge support - 0, // texture compression - 0, // non-power-of-two textures - 0, // multisampling - 0, // nvidia multisampling hint - 0, // ARBfp - 0, // depth textures - 0, // shadow comparison - 0, // Frame Buffer Objects - 0, // rectangle textures - 0, // multitexturing - 0, // env_combine - 0, // Vertex Buffer Objects - 0, // VSync support - 0, // Shader Model 4 support - 0, // Occlusion Queries - 0, // GLSL - 0, // GL info dumped -}; -#endif - -char *Bstrtolower(char *str) -{ - if (!str) return NULL; - - { - int32_t i = 0, len = Bstrlen(str); - - if (len <= 0) return str; - - do - { - *(str+i) = Btolower(*(str+i)); - i++; - } - while (--len); - } - - return str; -} - -int32_t flushlogwindow = 1; - -static void onvideomodechange(int32_t newmode) { UNREFERENCED_PARAMETER(newmode); } -void (*baselayer_onvideomodechange)(int32_t) = onvideomodechange; - -#ifdef USE_OPENGL -static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm) -{ - int32_t m; - char *p; - - const char *modestrs[] = - { - "classic software", "", - "", "polygonal OpenGL", "great justice (Polymer)" - }; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - m = Bstrtol(parm->parms[0], &p, 10); - - if (m < 0 || m > 4) return OSDCMD_SHOWHELP; - - setrendermode(m); - OSD_Printf("Rendering method changed to %s\n", modestrs[ getrendermode()]); - - return OSDCMD_OK; -} -#if defined(USE_OPENGL) -#ifdef DEBUGGINGAIDS -static int32_t osdcmd_hicsetpalettetint(const osdfuncparm_t *parm) -{ - int32_t pal, cols[3], eff; - - if (parm->numparms != 5) return OSDCMD_SHOWHELP; - - pal = Batol(parm->parms[0]); - cols[0] = Batol(parm->parms[1]); - cols[1] = Batol(parm->parms[2]); - cols[2] = Batol(parm->parms[3]); - eff = Batol(parm->parms[4]); - - hicsetpalettetint(pal,cols[0],cols[1],cols[2],eff); - - return OSDCMD_OK; -} -#endif - -int32_t osdcmd_glinfo(const osdfuncparm_t *parm) -{ - char *s,*t,*u,i; - - UNREFERENCED_PARAMETER(parm); - - if (bpp == 8) - { - initprintf("glinfo: Not in OpenGL mode.\n"); - return OSDCMD_OK; - } - - initprintf("OpenGL Information:\n" - " Version: %s\n" - " Vendor: %s\n" - " Renderer: %s\n", - glinfo.version, - glinfo.vendor, - glinfo.renderer); - - if (!glinfo.dumped) - return OSDCMD_OK; - - initprintf(" Maximum anisotropy: %.1f%s\n" - " BGRA textures: %s\n" - " Non-power-of-2 textures: %s\n" - " Texure compression: %s\n" - " Clamp-to-edge: %s\n" - " Multisampling: %s\n" - " Nvidia multisample hint: %s\n" - " ARBfp fragment programs: %s\n" - " Depth textures: %s\n" - " Shadow textures: %s\n" - " Frame Buffer Objects: %s\n" - " Rectangle textures: %s\n" - " Multitexturing: %s\n" - " env_combine: %s\n" - " Vertex Buffer Objects: %s\n" - " Shader Model 4: %s\n" - " Occlusion queries: %s\n" - " GLSL: %s\n" - " Extensions:\n", - glinfo.maxanisotropy, glinfo.maxanisotropy>1.0?"":" (no anisotropic filtering)", - glinfo.bgra ? "supported": "not supported", - glinfo.texnpot ? "supported": "not supported", - glinfo.texcompr ? "supported": "not supported", - glinfo.clamptoedge ? "supported": "not supported", - glinfo.multisample ? "supported": "not supported", - glinfo.nvmultisamplehint ? "supported": "not supported", - glinfo.arbfp ? "supported": "not supported", - glinfo.depthtex ? "supported": "not supported", - glinfo.shadow ? "supported": "not supported", - glinfo.fbos ? "supported": "not supported", - glinfo.rect ? "supported": "not supported", - glinfo.multitex ? "supported": "not supported", - glinfo.envcombine ? "supported": "not supported", - glinfo.vbos ? "supported": "not supported", - glinfo.sm4 ? "supported": "not supported", - glinfo.occlusionqueries ? "supported": "not supported", - glinfo.glsl ? "supported": "not supported" - ); - - s = Bstrdup(glinfo.extensions); - if (!s) initprintf("%s", glinfo.extensions); - else - { - i = 0; t = u = s; - while (*t) - { - if (*t == ' ') - { - if (i&1) - { - *t = 0; - initprintf(" %s\n",u); - u = t+1; - } - i++; - } - t++; - } - if (i&1) initprintf(" %s\n",u); - Bfree(s); - } - - return OSDCMD_OK; -} -#endif -#endif - -static int32_t osdcmd_cvar_set_baselayer(const osdfuncparm_t *parm) -{ - int32_t r = osdcmd_cvar_set(parm); - - if (r != OSDCMD_OK) return r; - - /* - if (!Bstrcasecmp(parm->name, "r_scrcaptureformat")) - { - const char *fmts[] = {"TGA", "PCX"}; - if (showval) { OSD_Printf("r_scrcaptureformat is %s\n", fmts[captureformat]); } - else - { - int32_t j; - for (j=0; j<2; j++) - if (!Bstrcasecmp(parm->parms[0], fmts[j])) break; - if (j == 2) return OSDCMD_SHOWHELP; - captureformat = j; - } - return OSDCMD_OK; - } - else */ - - if (!Bstrcasecmp(parm->name, "vid_gamma") || !Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast")) - { - setbrightness(GAMMA_CALC,0,0); - - return r; - } - - return r; -} - -int32_t baselayer_init(void) -{ - uint32_t i; - - cvar_t cvars_engine[] = - { - { "r_usenewaspect","r_usenewaspect: enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 }, - { "r_screenaspect","r_screenaspect: if using the new aspect code and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",(void *) &r_screenxy, CVAR_UINT, 100, 9999 }, - { "r_novoxmips","r_novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 }, - { "r_voxels","r_voxels: enable/disable automatic sprite->voxel rendering",(void *) &usevoxels, CVAR_BOOL, 0, 1 }, - /* { "r_scrcaptureformat","r_scrcaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars, CVAR_FUNCPTR, 0, 0 },*/ - { "vid_gamma","vid_gamma : adjusts gamma ramp",(void *) &vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, - { "vid_contrast","vid_contrast : adjusts gamma ramp",(void *) &vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, - { "vid_brightness","vid_brightness : adjusts gamma ramp",(void *) &vid_brightness, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 }, - { "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 }, - { "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 }, - }; - - for (i=0; i: sets the engine's rendering mode.\n" - "Mode numbers are:\n" - " 0 - Classic Build software\n" -#ifdef USE_OPENGL - " 3 - Polygonal OpenGL\n" - " 4 - Great justice renderer (Polymer)\n" -#endif - , - osdfunc_setrendermode); -#ifdef USE_OPENGL -# ifdef DEBUGGINGAIDS - OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint); -# endif - OSD_RegisterFunction("glinfo","glinfo: shows OpenGL information about the current OpenGL mode",osdcmd_glinfo); -#endif - polymost_initosdfuncs(); -#endif - - return 0; -} - diff --git a/polymer-perf/eduke32/build/src/build.c b/polymer-perf/eduke32/build/src/build.c deleted file mode 100644 index 6a7b85376..000000000 --- a/polymer-perf/eduke32/build/src/build.c +++ /dev/null @@ -1,7597 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. -// -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - -#include "build.h" -#include "compat.h" -#include "pragmas.h" -#include "osd.h" -#include "cache1d.h" -#include "editor.h" - -#include "baselayer.h" -#ifdef RENDERTYPEWIN -#include "winlayer.h" -#endif - -#include "m32script.h" - -#define TIMERINTSPERSECOND 120 - -#define updatecrc16(crc,dat) (crc = (((crc<<8)&65535)^crctable[((((uint16_t)crc)>>8)&65535)^dat])) -static int32_t crctable[256]; -static char kensig[64]; - -extern const char *ExtGetVer(void); -extern int32_t ExtInit(void); -extern int32_t ExtPreInit(int32_t argc,const char **argv); -extern void ExtUnInit(void); -extern void ExtPreCheckKeys(void); -extern void ExtAnalyzeSprites(void); -extern void ExtCheckKeys(void); -extern void ExtLoadMap(const char *mapname); -extern void ExtSaveMap(const char *mapname); -extern const char *ExtGetSectorCaption(int16_t sectnum); -extern const char *ExtGetWallCaption(int16_t wallnum); -extern const char *ExtGetSpriteCaption(int16_t spritenum); -extern void ExtShowSectorData(int16_t sectnum); -extern void ExtShowWallData(int16_t wallnum); -extern void ExtShowSpriteData(int16_t spritenum); -extern void ExtEditSectorData(int16_t sectnum); -extern void ExtEditWallData(int16_t wallnum); -extern void ExtEditSpriteData(int16_t spritenum); -extern const char *ExtGetSectorType(int32_t lotag); - -extern char spritecol2d[MAXTILES][2]; - -char noclip=0; - -int32_t vel, svel, angvel; - -// 0 1 2 3 4 5 6 7 -// up, down, left, right, lshift, rctrl, lctrl, space -// 8 9 10 11 12 13 -// a, z, pgdn, pgup, [,], [.] -// 14 15 16 17 18 19 -// kpenter, enter, =, -, tab, ` -uint8_t buildkeys[NUMBUILDKEYS] = -{ - 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, - 0x1e,0x2c,0xd1,0xc9,0x33,0x34, - 0x9c,0x1c,0xd,0xc,0xf,0x29 -}; - -vec3_t pos; -int32_t horiz = 100; -static int32_t mousexsurp = 0, mouseysurp = 0; -int16_t ang, cursectnum; -int32_t hvel; - -int32_t grponlymode = 0; -extern int32_t editorgridextent; // in engine.c -extern double msens; -int32_t graphicsmode = 0; -extern int32_t xyaspect; -extern int32_t totalclocklock; - -int32_t synctics = 0, lockclock = 0; - -// those ones save the respective 3d video vars while in 2d mode -// so that exiting from mapster32 in 2d mode saves the correct ones -double vid_gamma_3d=-1, vid_contrast_3d=-1, vid_brightness_3d=-1; - -extern char vgacompatible; - -extern char picsiz[MAXTILES]; -extern int32_t startposx, startposy, startposz; -extern int16_t startang, startsectnum; -extern int32_t ydim16, halfxdim16, midydim16; -extern intptr_t frameplace; -int32_t xdim2d = 640, ydim2d = 480, xdimgame = 640, ydimgame = 480, bppgame = 8; -int32_t forcesetup = 1; - -extern int32_t cachesize, artsize; - -static int16_t oldmousebstatus = 0; -char game_executable[BMAX_PATH] = DEFAULT_GAME_LOCAL_EXEC; -int32_t zlock = 0x7fffffff, zmode = 0, whitecol, kensplayerheight = 32; -//int16_t defaultspritecstat = 0; - -int16_t localartfreq[MAXTILES]; -int16_t localartlookup[MAXTILES], localartlookupnum; - -char tempbuf[4096]; - -char names[MAXTILES][25]; -const char *g_namesFileName = "NAMES.H"; - -int16_t asksave = 0; -extern int16_t editstatus, searchit; -extern int32_t searchx, searchy; //search input -extern int16_t searchsector, searchwall, searchstat; //search output -int32_t osearchx, osearchy; //old search input - -extern int16_t pointhighlight, linehighlight, highlightcnt; -int32_t grid = 3, autogrid = 0, gridlock = 1, showtags = 1; -int32_t zoom = 768, gettilezoom = 1; -int32_t lastpm16time = 0; - -int32_t numsprites; -extern int32_t mapversion; - -int16_t highlight[MAXWALLS+MAXSPRITES]; -int16_t highlightsector[MAXSECTORS], highlightsectorcnt = -1; -extern char textfont[128][8]; - -char pskysearch[MAXSECTORS]; - -int32_t temppicnum, tempcstat, templotag, temphitag, tempextra; -uint32_t temppal, tempvis, tempxrepeat, tempyrepeat; -int32_t tempshade, tempxvel, tempyvel, tempzvel; -char somethingintab = 255; - -int32_t mlook = 0,mskip=0; -int32_t revertCTRL=0,scrollamount=3; -int32_t unrealedlook=1, quickmapcycling=1; //PK - -char program_origcwd[BMAX_PATH]; -char *mapster32_fullpath; -char *testplay_addparam = 0; - -static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH]; - -static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL; -static int32_t numdirs=0, numfiles=0; -static int32_t currentlist=0; - -//static int32_t repeatcountx, repeatcounty; - -static int32_t fillist[640]; - -static int32_t mousx, mousy; -int16_t prefixtiles[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; -uint8_t hlsectorbitmap[MAXSECTORS>>3]; // show2dsector is already taken... - -static uint8_t visited[MAXWALLS>>3]; // used for AlignWalls and trace_loop - -typedef struct -{ - int16_t numsectors, numwalls, numsprites; - sectortype *sector; - walltype *wall; - spritetype *sprite; -} mapinfofull_t; - -static int32_t backup_highlighted_map(mapinfofull_t *mapinfo); -static int32_t restore_highlighted_map(mapinfofull_t *mapinfo); - -/* -static char scantoasc[128] = -{ - 0,0,'1','2','3','4','5','6','7','8','9','0','-','=',0,0, - 'q','w','e','r','t','y','u','i','o','p','[',']',0,0,'a','s', - 'd','f','g','h','j','k','l',';',39,'`',0,92,'z','x','c','v', - 'b','n','m',',','.','/',0,'*',0,32,0,0,0,0,0,0, - 0,0,0,0,0,0,0,'7','8','9','-','4','5','6','+','1', - '2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -}; -static char scantoascwithshift[128] = -{ - 0,0,'!','@','#','$','%','^','&','*','(',')','_','+',0,0, - 'Q','W','E','R','T','Y','U','I','O','P','{','}',0,0,'A','S', - 'D','F','G','H','J','K','L',':',34,'~',0,'|','Z','X','C','V', - 'B','N','M','<','>','?',0,'*',0,32,0,0,0,0,0,0, - 0,0,0,0,0,0,0,'7','8','9','-','4','5','6','+','1', - '2','3','0','.',0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -}; -*/ - -#define eitherALT (keystatus[0x38]|keystatus[0xb8]) -#define eitherCTRL (keystatus[0x1d]|keystatus[0x9d]) -#define eitherSHIFT (keystatus[0x2a]|keystatus[0x36]) - -#define DOWN_BK(BuildKey) (keystatus[buildkeys[BK_##BuildKey]]) - -int32_t pk_turnaccel=16; -int32_t pk_turndecel=12; -int32_t pk_uedaccel=3; - -int8_t sideview_reversehrot = 0; - -char lastpm16buf[156]; - -//static int32_t checksectorpointer_warn = 0; - -char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck); -static int32_t adjustmark(int32_t *xplc, int32_t *yplc, int16_t danumwalls); -static void locktogrid(int32_t *dax, int32_t *day); -static int32_t checkautoinsert(int32_t dax, int32_t day, int16_t danumwalls); -void keytimerstuff(void); -static int32_t clockdir(int16_t wallstart); -static void flipwalls(int16_t numwalls, int16_t newnumwalls); -static void insertpoint(int16_t linehighlight, int32_t dax, int32_t day); -static void deletepoint(int16_t point); -static int32_t deletesector(int16_t sucksect); -void fixrepeats(int16_t i); -static int16_t loopinside(int32_t x, int32_t y, int16_t startwall); -int32_t fillsector(int16_t sectnum, char fillcolor); -static int16_t whitelinescan(int16_t dalinehighlight); -void printcoords16(int32_t posxe, int32_t posye, int16_t ange); -static void copysector(int16_t soursector, int16_t destsector, int16_t deststartwall, char copystat, const int16_t *oldtonewsect); -int32_t drawtilescreen(int32_t pictopleft, int32_t picbox); -void overheadeditor(void); -static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line); -void fixspritesectors(void); -static int32_t movewalls(int32_t start, int32_t offs); -int32_t loadnames(const char *namesfile); -void updatenumsprites(void); -static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny); -static void initcrc(void); -void AutoAlignWalls(int32_t nWall0, int32_t ply); -int32_t gettile(int32_t tilenum); - -static int32_t menuselect(void); -static int32_t menuselect_auto(int32_t); //PK - -static int32_t insert_sprite_common(int32_t sucksect, int32_t dax, int32_t day); -static void correct_ornamented_sprite(int32_t i, int32_t hitw); - -static int32_t getfilenames(const char *path, const char *kind); -static void clearfilenames(void); -void loadmhk(int32_t domessage); -extern int32_t map_revision; -extern int32_t map_undoredo(int32_t dir); -extern void map_undoredo_free(void); - -void clearkeys(void) { Bmemset(keystatus,0,sizeof(keystatus)); } - -static inline void bclamp(int32_t *x, int32_t mi, int32_t ma) -{ - if (*x>ma) *x=ma; - if (*xnumparms) - { - case 1: // bpp switch - tmp = Batol(parm->parms[0]); - if (tmp==8 || tmp==16 || tmp==32) - newbpp = tmp; - break; - case 4: // fs, res, bpp switch - newfullscreen = (Batol(parm->parms[3]) != 0); - case 3: // res & bpp switch - tmp = Batol(parm->parms[2]); - if (tmp==8 || tmp==16 || tmp==32) - newbpp = tmp; - case 2: // res switch - newx = Batol(parm->parms[0]); - newy = Batol(parm->parms[1]); - break; - default: - return OSDCMD_SHOWHELP; - } - - if (qsetmode != 200) - { - qsetmodeany(newx,newy); - xdim2d = xdim; - ydim2d = ydim; - - begindrawing(); //{{{ - - CLEARLINES2D(0, ydim16, 0); - - ydim16 = ydim; -// drawline16(0,ydim-STATUS2DSIZ,xdim-1,ydim-STATUS2DSIZ,editorcolors[1]); - /* drawline16(0,ydim-1,xdim-1,ydim-1,1); - drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,1); - drawline16(xdim-1,ydim-STATUS2DSIZ,xdim-1,ydim-1,1); - drawline16(0,ydim-STATUS2DSIZ+24,xdim-1,ydim-STATUS2DSIZ+24,1); - drawline16(192-24,ydim-STATUS2DSIZ,192-24,ydim-STATUS2DSIZ+24,1); - drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1); - drawline16(256,ydim-1-20,256,ydim-1,1); */ - ydim16 = ydim-STATUS2DSIZ2; - enddrawing(); //}}} - return OSDCMD_OK; - } - - if (setgamemode(newfullscreen,newx,newy,newbpp)) - OSD_Printf("vidmode: Mode change failed!\n"); - - xdimgame = newx; - ydimgame = newy; - bppgame = newbpp; - fullscreen = newfullscreen; - - return OSDCMD_OK; -} -#endif - -extern int32_t startwin_run(void); - -extern char *defsfilename; // set in bstub.c - - -#ifdef M32_SHOWDEBUG -char m32_debugstr[64][128]; -int32_t m32_numdebuglines=0; - -static void M32_drawdebug(void) -{ - int i; - int x=4, y=8; - -#if 0 - { - static char tstr[128]; - Bsprintf(tstr, "searchstat=%d, searchsector=%d, searchwall=%d (%d), asksave=%d", - searchstat, searchsector, searchwall, searchbottomwall, asksave); - printext256(x,y,whitecol,0,tstr,xdimgame>640?0:1); - } -#endif - if (m32_numdebuglines>0) - { - begindrawing(); - for (i=0; i640?0:1); - } - enddrawing(); - } - m32_numdebuglines=0; -} -#endif - -int32_t app_main(int32_t argc, const char **argv) -{ - char quitflag, cmdsetup = 0; - int32_t i, j, k; - - pathsearchmode = 1; // unrestrict findfrompath so that full access to the filesystem can be had - -#ifdef USE_OPENGL - OSD_RegisterFunction("restartvid","restartvid: reinitialize the video mode",osdcmd_restartvid); - OSD_RegisterFunction("vidmode","vidmode : immediately change the video mode",osdcmd_vidmode); -#endif - - wm_setapptitle("Mapster32"); - - editstatus = 1; - newaspect_enable = 1; - - if ((i = ExtPreInit(argc,argv)) < 0) return -1; - -#ifdef RENDERTYPEWIN - backgroundidle = 1; -#endif - - boardfilename[0] = 0; - for (i=1; i k) { k = j; whitecol = i; } - } - - k = clipmapinfo_load("_clipshape0.map"); - if (k>0) - initprintf("There was an error loading the sprite clipping map (status %d).\n", k); - - if (LoadBoard(boardfilename, 1)) - { - initspritelists(); - pos.x = 32768; - pos.y = 32768; - pos.z = 0; - ang = 1536; - numsectors = 0; - numwalls = 0; - cursectnum = -1; - } - - totalclock = 0; - - updatesector(pos.x,pos.y,&cursectnum); - - if (cursectnum == -1) - { - vid_gamma_3d = vid_gamma; - vid_brightness_3d = vid_brightness; - vid_contrast_3d = vid_contrast; - - vid_gamma = vid_contrast = 1.0; - vid_brightness = 0.0; - - setbrightness(0,0,0); - if (setgamemode(fullscreen, xdim2d, ydim2d, 8) < 0) - { - ExtUnInit(); - uninitengine(); - Bprintf("%d * %d not supported in this graphics mode\n",xdim2d,ydim2d); - exit(0); - } - - // executed once per init, but after setgamemode so that OSD has the right width - OSD_Exec("m32_autoexec.cfg"); - - overheadeditor(); - keystatus[buildkeys[BK_MODE2D_3D]] = 0; - - vid_gamma = vid_gamma_3d; - vid_contrast = vid_contrast_3d; - vid_brightness = vid_brightness_3d; - - vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; - - setbrightness(GAMMA_CALC,0,0); - } - else - { - if (setgamemode(fullscreen, xdimgame, ydimgame, bppgame) < 0) - { - ExtUnInit(); - uninitengine(); - Bprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); - exit(0); - } - - // executed once per init, but after setgamemode so that OSD has the right width - OSD_Exec("m32_autoexec.cfg"); - - setbrightness(GAMMA_CALC,0,0); - } - -CANCEL: - quitflag = 0; - while (quitflag == 0) - { - if (handleevents()) - { - if (quitevent) - { - keystatus[1] = 1; - quitevent = 0; - } - } - - OSD_DispatchQueued(); - - ExtPreCheckKeys(); - - nextpage(); - synctics = totalclock-lockclock; - lockclock += synctics; - - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif - -#ifdef M32_SHOWDEBUG - if (searchstat>=0 && (searchwall<0 || searchsector<0)) - { - Bsprintf(m32_debugstr[m32_numdebuglines++], "inconsistent search variables!"); - searchstat = -1; - } - - M32_drawdebug(); -#endif - ExtCheckKeys(); - - - if (keystatus[1]) - { - keystatus[1] = 0; - - printext256(0,0,whitecol,0,"Are you sure you want to quit?",0); - - showframe(1); - synctics = totalclock-lockclock; - lockclock += synctics; - - while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]) == 0) - { - idle_waitevent(); - if (handleevents()) - { - if (quitevent) - { - quitflag = 1; - break; - } - } - - if (keystatus[0x15]||keystatus[0x1c]) // Y or ENTER - { - keystatus[0x15] = 0; - keystatus[0x1c] = 0; - quitflag = 1; break; - } - } - while (keystatus[1]) - { - keystatus[1] = 0; - quitevent = 0; - goto CANCEL; - } - } - } - - if (asksave) - { - i = CheckMapCorruption(4, 0); - - printext256(0,8,whitecol,0,i<4?"Save changes?":"Map is heavily corrupt. Save changes?",0); - showframe(1); - - while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0) - { - idle_waitevent(); - if (handleevents()) { if (quitevent) break; } // like saying no - - if (keystatus[0x15] || keystatus[0x1c]) // Y or ENTER - { - keystatus[0x15] = keystatus[0x1c] = 0; - - SaveBoard(NULL, 0); - - break; - } - } - while (keystatus[1]||keystatus[0x2e]) - { - keystatus[1] = keystatus[0x2e] = 0; - quitevent = 0; - goto CANCEL; - } - } - - - clearfilenames(); - ExtUnInit(); - uninitengine(); - - Bprintf("Memory status: %d(%d) bytes\n",cachesize,artsize); - Bprintf("%s\n",kensig); - return(0); -} - -/* -void showmouse(void) -{ - int32_t i; - - for (i=1;i<=4;i++) - { - plotpixel(searchx+i,searchy,whitecol); - plotpixel(searchx-i,searchy,whitecol); - plotpixel(searchx,searchy-i,whitecol); - plotpixel(searchx,searchy+i,whitecol); - } -} -*/ - -static int32_t mhk=0; -void loadmhk(int32_t domessage) -{ - char *p; char levname[BMAX_PATH]; - - if (!mhk) - return; - - Bstrcpy(levname, boardfilename); - p = Bstrrchr(levname,'.'); - if (!p) - Bstrcat(levname,".mhk"); - else - { - p[1]='m'; - p[2]='h'; - p[3]='k'; - p[4]=0; - } - - if (!loadmaphack(levname)) - { - if (domessage) - message("Loaded map hack file '%s'",levname); - else - initprintf("Loaded map hack file '%s'\n",levname); - } - else - { - mhk=2; - if (domessage) - message("No maphack found for map '%s'",boardfilename); - } -} - - -static void move_and_update(int32_t xvect, int32_t yvect, int32_t addshr) -{ - if (noclip) - { - pos.x += xvect>>(14+addshr); - pos.y += yvect>>(14+addshr); - updatesector(pos.x,pos.y, &cursectnum); - } - else - clipmove(&pos,&cursectnum, xvect>>addshr,yvect>>addshr, - 128,4<<8,4<<8, CLIPMASK0); -} - -static void mainloop_move() -{ - int32_t xvect, yvect, doubvel; - - if (angvel != 0) //ang += angvel * constant - { - //ENGINE calculates angvel for you - - //Lt. shift makes turn velocity 50% faster - doubvel = (synctics + DOWN_BK(RUN)*(synctics>>1)); - - ang += ((angvel*doubvel)>>4); - ang &= 2047; - } - if ((vel|svel) != 0) - { - //Lt. shift doubles forward velocity - doubvel = (1+(DOWN_BK(RUN)))*synctics; - - xvect = 0; - yvect = 0; - - if (vel != 0) - { - xvect += (vel*doubvel*(int32_t)sintable[(ang+2560)&2047])>>3; - yvect += (vel*doubvel*(int32_t)sintable[(ang+2048)&2047])>>3; - } - if (svel != 0) - { - xvect += (svel*doubvel*(int32_t)sintable[(ang+2048)&2047])>>3; - yvect += (svel*doubvel*(int32_t)sintable[(ang+1536)&2047])>>3; - } - - move_and_update(xvect, yvect, 0); - } -} - -void editinput(void) -{ - int32_t mousz, bstatus; - int32_t i, j, k, tempint=0; - int32_t goalz, xvect, yvect, hiz, loz; - int32_t dax, day, hihit, lohit, omlook=mlook; - -// 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 -// F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL - - mousz = 0; - getmousevalues(&mousx,&mousy,&bstatus); - mousx = (mousx<<16) + mousexsurp; - mousy = (mousy<<16) + mouseysurp; - - if (unrealedlook && !mskip) - { - if (mlook==0 && (bstatus&(1|2|4))==2) - mlook = 3; - else if ((bstatus&(1|2|4))==1) - mlook = 3; - } - - { - ldiv_t ld; - if (mlook) - { - ld = ldiv(mousx, (int32_t)((1<<16)/(msens*0.5f))); mousx = ld.quot; mousexsurp = ld.rem; - ld = ldiv(mousy, (int32_t)((1<<16)/(msens*0.25f))); mousy = ld.quot; mouseysurp = ld.rem; - } - else - { - ld = ldiv(mousx, (int32_t)((1<<16)/msens)); mousx = ld.quot; mousexsurp = ld.rem; - ld = ldiv(mousy, (int32_t)((1<<16)/msens)); mousy = ld.quot; mouseysurp = ld.rem; - } - } - - if (mlook == 3) - mlook = omlook; - - // UnrealEd: - // rmb: mouselook - // lbm: x:turn y:fwd/back local x - // lmb&rmb: x:strafe y:up/dn (move in local yz plane) - // mmb: fwd/back in viewing vector - - if (unrealedlook && !mskip) //PK - { - if ((bstatus&(1|2|4))==1) - { - ang += mousx; - xvect = -((mousy*(int32_t)sintable[(ang+2560)&2047])<<(3+pk_uedaccel)); - yvect = -((mousy*(int32_t)sintable[(ang+2048)&2047])<<(3+pk_uedaccel)); - - move_and_update(xvect, yvect, 0); - } - else if (!mlook && (bstatus&(1|2|4))==2) - { - mlook=2; - } - else if ((bstatus&(1|2|4))==(1|2)) - { - zmode = 2; - xvect = -((mousx*(int32_t)sintable[(ang+2048)&2047])<>6)* - ((int32_t)sintable[(tempint+512)&2047])>>6) - <>6)* - ((int32_t)sintable[(tempint+512)&2047])>>6) - <>(10-pk_uedaccel)); - - move_and_update(xvect, yvect, 2); - } - } - - if (mskip) - { - // mskip was set in astub.c to not trigger UEd mouse movements. - // Reset now. - mskip = 0; - } - else - { - if (mlook && (unrealedlook==0 || (bstatus&(1|4))==0)) - { - ang += mousx; - horiz -= mousy; - - /* - if (mousy && !(mousy/4)) - horiz--; - if (mousx && !(mousx/2)) - ang++; - */ - - bclamp(&horiz, -99, 299); - - if (mlook == 1) - { - searchx = xdim>>1; - searchy = ydim>>1; - } - osearchx = searchx-mousx; - osearchy = searchy-mousy; - } - else if (unrealedlook==0 || (bstatus&(1|2|4))==0) - { - osearchx = searchx; - osearchy = searchy; - searchx += mousx; - searchy += mousy; - - bclamp(&searchx, 12, xdim-13); - bclamp(&searchy, 12, ydim-13); - } - } - -// showmouse(); - -// if (keystatus[0x3b] > 0) pos.x--; -// if (keystatus[0x3c] > 0) pos.x++; -// if (keystatus[0x3d] > 0) pos.y--; -// if (keystatus[0x3e] > 0) pos.y++; -// if (keystatus[0x43] > 0) ang--; -// if (keystatus[0x44] > 0) ang++; - - if (keystatus[0x43]) // F9 - { - if (mhk) - { - Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); - Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID)); - delete_maphack_lights(); - mhk = 0; - message("Maphacks disabled"); - } - else - { - mhk = 1; - loadmhk(1); - } - - keystatus[0x43] = 0; - } - - mainloop_move(); - - getzrange(&pos,cursectnum, &hiz,&hihit, &loz,&lohit, 128,CLIPMASK0); - - if (zmode == 0) - { - goalz = loz-(kensplayerheight<<8); //playerheight pixels above floor - if (goalz < hiz+(16<<8)) //ceiling&floor too close - goalz = (loz+hiz)>>1; - goalz += mousz; - - if (DOWN_BK(MOVEUP)) //A (stand high) - { - goalz -= (16<<8); - if (DOWN_BK(RUN)) - goalz -= (24<<8); - } - if (DOWN_BK(MOVEDOWN)) //Z (stand low) - { - goalz += (12<<8); - if (DOWN_BK(RUN)) - goalz += (12<<8); - } - - if (goalz != pos.z) - { - if (pos.z < goalz) hvel += 64; - if (pos.z > goalz) hvel = ((goalz-pos.z)>>3); - - pos.z += hvel; - if (pos.z > loz-(4<<8)) pos.z = loz-(4<<8), hvel = 0; - if (pos.z < hiz+(4<<8)) pos.z = hiz+(4<<8), hvel = 0; - } - } - else - { - goalz = pos.z; - if (DOWN_BK(MOVEUP)) //A - { - if (eitherCTRL) - { - horiz = max(-100,horiz-((DOWN_BK(RUN)+1)*synctics*2)); - } - else - { - if (zmode != 1) - goalz -= (8<<8); - else - { - zlock += (4<<8); - DOWN_BK(MOVEUP) = 0; - } - } - } - if (DOWN_BK(MOVEDOWN)) //Z (stand low) - { - if (eitherCTRL) - { - horiz = min(300,horiz+((DOWN_BK(RUN)+1)*synctics*2)); - } - else - { - if (zmode != 1) - goalz += (8<<8); - else if (zlock > 0) - { - zlock -= (4<<8); - DOWN_BK(MOVEDOWN) = 0; - } - } - } - - if (!noclip) - bclamp(&goalz, hiz+(4<<8), loz-(4<<8)); - - if (zmode == 1) goalz = loz-zlock; - if (!noclip && (goalz < hiz+(4<<8))) - goalz = ((loz+hiz)>>1); //ceiling&floor too close - if (zmode == 1) pos.z = goalz; - - if (goalz != pos.z) - { - //if (pos.z < goalz) hvel += (32< goalz) hvel -= (32< loz-(4<<8)) pos.z = loz-(4<<8), hvel = 0; - if (pos.z < hiz+(4<<8)) pos.z = hiz+(4<<8), hvel = 0; - } - } - else - hvel = 0; - } - - updatesectorz(pos.x,pos.y,pos.z, &cursectnum); - - searchit = 2; - if (searchstat >= 0) - { - if ((bstatus&(1|2|4)) > 0) - searchit = 0; - - if (keystatus[0x1f]) //S (insert sprite) (3D) - { - hitdata_t hitinfo; - - dax = 16384; - day = divscale14(searchx-(xdim>>1), xdim>>1); - rotatepoint(0,0, dax,day, ang, &dax,&day); - - hitscan((const vec3_t *)&pos,cursectnum, //Start position - dax,day,(scale(searchy,200,ydim)-horiz)*2000, //vector of 3D ang - &hitinfo,CLIPMASK1); - - if (hitinfo.hitsect >= 0) - { - dax = hitinfo.pos.x; - day = hitinfo.pos.y; - if (gridlock && grid > 0) - { - if (searchstat == 0 || searchstat == 4) - hitinfo.pos.z &= 0xfffffc00; - else - locktogrid(&dax, &day); - } - - i = insert_sprite_common(hitinfo.hitsect, dax, day); - - if (i < 0) - message("Couldn't insert sprite."); - else - { - int32_t cz, fz; - - if (somethingintab == 3) - { - sprite[i].picnum = temppicnum; - if (tilesizx[temppicnum] <= 0 || tilesizy[temppicnum] <= 0) - { - j = 0; - for (k=0; k 0 && tilesizy[k] > 0) - { - j = k; - break; - } - sprite[i].picnum = j; - } - - sprite[i].shade = tempshade; - sprite[i].pal = temppal; - sprite[i].xrepeat = max(tempxrepeat, 1); - sprite[i].yrepeat = max(tempyrepeat, 1); - sprite[i].cstat = tempcstat; - } - - getzsofslope(hitinfo.hitsect, hitinfo.pos.x, hitinfo.pos.y, &cz, &fz); - - j = spriteheight(i, NULL)>>1; - sprite[i].z = hitinfo.pos.z; - if ((sprite[i].cstat&48)!=32) - { - if ((sprite[i].cstat&128) == 0) - bclamp(&sprite[i].z, cz+(j<<1), fz); - else - bclamp(&sprite[i].z, cz+j, fz-j); - } - - if (searchstat == 0 || searchstat == 4) - { - sprite[i].cstat &= ~48; - sprite[i].cstat |= (16+64); - - correct_ornamented_sprite(i, hitinfo.hitwall); - } - else - sprite[i].cstat |= (tilesizy[sprite[i].picnum]>=32); - - correct_sprite_yoffset(i); - - updatenumsprites(); - asksave = 1; - - VM_OnEvent(EVENT_INSERTSPRITE3D, i); - } - } - - keystatus[0x1f] = 0; - } - - if (keystatus[0x3f]||keystatus[0x40]) //F5,F6 - { - switch (searchstat) - { - case 1: - case 2: - ExtShowSectorData(searchsector); break; - case 0: - case 4: - ExtShowWallData(searchwall); break; - case 3: - ExtShowSpriteData(searchwall); break; - } - - keystatus[0x3f] = keystatus[0x40] = 0; - } - if (keystatus[0x41]||keystatus[0x42]) //F7,F8 - { - switch (searchstat) - { - case 1: - case 2: - ExtEditSectorData(searchsector); break; - case 0: - case 4: - ExtEditWallData(searchwall); break; - case 3: - ExtEditSpriteData(searchwall); break; - } - - keystatus[0x41] = keystatus[0x42] = 0; - } - - } - - if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter - { - - vid_gamma_3d = vid_gamma; - vid_contrast_3d = vid_contrast; - vid_brightness_3d = vid_brightness; - - vid_gamma = vid_contrast = 1.0; - vid_brightness = 0.0; - - setbrightness(0,0,0); - - keystatus[buildkeys[BK_MODE2D_3D]] = 0; - overheadeditor(); - keystatus[buildkeys[BK_MODE2D_3D]] = 0; - - vid_gamma = vid_gamma_3d; - vid_contrast = vid_contrast_3d; - vid_brightness = vid_brightness_3d; - - vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1; - - setbrightness(GAMMA_CALC,0,0); - } -} - -char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck) -{ - if (dadir < 0) - { - if ((dachar > 0) || (boundcheck == 0)) - { - dachar--; - if (smooshyalign > 0) - dachar = (dachar&0xf8); - } - } - else if (dadir > 0) - { - if ((dachar < 255) || (boundcheck == 0)) - { - dachar++; - if (smooshyalign > 0) - { - if (dachar >= 256-8) dachar = 255; - else dachar = ((dachar+7)&0xf8); - } - } - } - return(dachar); -} - - -////////////////////// OVERHEADEDITOR ////////////////////// - -int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom, - int32_t x, int32_t y, int16_t sectnum) -{ - if (!m32_sideview) - return inside(x, y, sectnum); - - // if in side-view mode, use the screen coords instead - { - int32_t dst = MAXSECTORS+M32_FIXME_SECTORS-1, i, oi; - int32_t srcw=sector[sectnum].wallptr, dstw=MAXWALLS; - int32_t ret; - - if (sector[sectnum].wallnum > M32_FIXME_WALLS) - return -1; - - Bmemcpy(§or[dst], §or[sectnum], sizeof(sectortype)); - sector[dst].wallptr = dstw; - - Bmemcpy(&wall[dstw], &wall[srcw], sector[dst].wallnum*sizeof(walltype)); - for (i=dstw, oi=srcw; ix, wall[i].y-pos->y, zoom); - wall[i].y += getscreenvdisp(getflorzofslope(sectnum,wall[oi].x,wall[oi].y)-pos->z, zoom); - wall[i].x += halfxdim16; - wall[i].y += midydim16; - } - - i = numsectors; - numsectors = dst+1; - ret = inside(searchx, searchy, dst); - numsectors = i; - return ret; - } -} - -static inline void drawline16base(int32_t bx, int32_t by, int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) -{ - drawline16(bx+x1, by+y1, bx+x2, by+y2, col); -} - -void drawsmallabel(const char *text, char col, char backcol, int32_t dax, int32_t day, int32_t daz) -{ - int32_t x1, y1, x2, y2; - - screencoords(&dax,&day, dax-pos.x,day-pos.y, zoom); - if (m32_sideview) - day += getscreenvdisp(daz-pos.z, zoom); - - x1 = halfxdim16+dax-(Bstrlen(text)<<1); - y1 = midydim16+day-4; - x2 = x1 + (Bstrlen(text)<<2)+2; - y2 = y1 + 7; - - if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16)) - { - printext16(x1,y1, col,backcol, text,1); - drawline16(x1-1,y1-1, x2-3,y1-1, backcol); - drawline16(x1-1,y2+1, x2-3,y2+1, backcol); - - drawline16(x1-2,y1, x1-2,y2, backcol); - drawline16(x2-2,y1, x2-2,y2, backcol); - drawline16(x2-3,y1, x2-3,y2, backcol); - } -} - -// backup highlighted sectors with sprites as mapinfo for later restoration -// return values: -// -1: highlightsectorcnt<=0 -// -2: out of mem -// 0: ok -static int32_t backup_highlighted_map(mapinfofull_t *mapinfo) -{ - int32_t i, j, k, m, tmpnumwalls=0, tmpnumsprites=0; - - if (highlightsectorcnt <= 0) - return -1; - - // count walls & sprites - for (i=0; isector = Bmalloc(highlightsectorcnt * sizeof(sectortype)); - if (!mapinfo->sector) return -2; - mapinfo->wall = Bmalloc(tmpnumwalls * sizeof(walltype)); - if (!mapinfo->wall) { Bfree(mapinfo->sector); return -2; } - if (tmpnumsprites>0) - { - mapinfo->sprite = Bmalloc(tmpnumsprites * sizeof(spritetype)); - if (!mapinfo->sprite) - { - Bfree(mapinfo->sector); - Bfree(mapinfo->wall); - return -2; - } - } - - - // copy everything over - tmpnumwalls = 0; - tmpnumsprites = 0; - for (i=0; isector[i], §or[k], sizeof(sectortype)); - mapinfo->sector[i].wallptr = tmpnumwalls; - - for (j=0; jwall[tmpnumwalls+j], &wall[sector[k].wallptr+j], sizeof(walltype)); - mapinfo->wall[tmpnumwalls+j].point2 += (tmpnumwalls-sector[k].wallptr); - mapinfo->wall[tmpnumwalls+j].nextsector = -1; - mapinfo->wall[tmpnumwalls+j].nextwall = -1; - } - tmpnumwalls += j; - - m = headspritesect[highlightsector[i]]; - while (m != -1) - { - Bmemcpy(&mapinfo->sprite[tmpnumsprites], &sprite[m], sizeof(spritetype)); - mapinfo->sprite[tmpnumsprites].sectnum = i; - m = nextspritesect[m]; - tmpnumsprites++; - } - } - - - mapinfo->numsectors = highlightsectorcnt; - mapinfo->numwalls = tmpnumwalls; - mapinfo->numsprites = tmpnumsprites; - - return 0; -} - -static void mapinfofull_free(mapinfofull_t *mapinfo) -{ - Bfree(mapinfo->sector); - Bfree(mapinfo->wall); - if (mapinfo->numsprites>0) - Bfree(mapinfo->sprite); -} - -// restore map saved with backup_highlighted_map, also -// frees mapinfo's sector, wall, (sprite) in any case. -// return values: -// -1: limits exceeded -// 0: ok -static int32_t restore_highlighted_map(mapinfofull_t *mapinfo) -{ - int32_t i, j, sect, onumsectors=numsectors, newnumsectors, newnumwalls; - - updatenumsprites(); - if (numsectors+mapinfo->numsectors>MAXSECTORS || numwalls+mapinfo->numwalls>MAXWALLS - || numsprites+mapinfo->numsprites>MAXSPRITES) - { - mapinfofull_free(mapinfo); - return -1; - } - - newnumsectors = numsectors + mapinfo->numsectors; - newnumwalls = numwalls + mapinfo->numwalls; - - // copy sectors & walls - Bmemcpy(§or[numsectors], mapinfo->sector, mapinfo->numsectors*sizeof(sectortype)); - Bmemcpy(&wall[numwalls], mapinfo->wall, mapinfo->numwalls*sizeof(walltype)); - - // tweak index members - for (i=numsectors; i>3] |= (1<<(i&7)); - } - for (i=numwalls; inumsprites; i++) - { - sect = onumsectors+mapinfo->sprite[i].sectnum; - j = insertsprite(sect, mapinfo->sprite[i].statnum); - Bmemcpy(&sprite[j], &mapinfo->sprite[i], sizeof(spritetype)); - sprite[j].sectnum = sect; - } - - numwalls = newnumwalls; - updatenumsprites(); - - update_highlightsector(); - - mapinfofull_free(mapinfo); - return 0; -} - - -static int32_t newnumwalls=-1; - -static void ovh_whiteoutgrab() -{ - int32_t i, j, k, startwall, endwall; - - //White out all bordering lines of grab that are - //not highlighted on both sides - for (i=highlightsectorcnt-1; i>=0; i--) - { - startwall = sector[highlightsector[i]].wallptr; - endwall = startwall + sector[highlightsector[i]].wallnum; - for (j=startwall; j= 0) - { -// for (k=highlightsectorcnt-1; k>=0; k--) -// if (highlightsector[k] == wall[j].nextsector) -// break; - k = wall[j].nextsector; - if ((hlsectorbitmap[k>>3]&(1<<(k&7)))==0) -// if (k < 0) - { - NEXTWALL(j).nextwall = -1; - NEXTWALL(j).nextsector = -1; - wall[j].nextwall = -1; - wall[j].nextsector = -1; - } - } - } - } -} - -static void duplicate_selected_sectors() -{ - int32_t i, j, startwall, endwall, newnumsectors, newwalls = 0; - int32_t minx=INT_MAX, maxx=INT_MIN, miny=INT_MAX, maxy=INT_MIN, dx, dy; - - for (i=0; i= 0) - checksectorpointer(wall[j].nextwall,wall[j].nextsector); - checksectorpointer(j, highlightsector[i]); - - minx = min(minx, wall[j].x); - maxx = max(maxx, wall[j].x); - miny = min(miny, wall[j].y); - maxy = max(maxy, wall[j].y); - } - - // Then, highlight the ones just copied. - // These will have all walls whited out. - j = numsectors + i; - hlsectorbitmap[j>>3] |= (1<<(j&7)); - } - - // displace walls of new sectors by a small amount - dx = 512; //((maxx-minx)+255)&~255; - dy = -256; //((maxy-miny)+255)&~255; - if (maxx+dx >= editorgridextent) dx*=-1; - if (minx+dx <= -editorgridextent) dx*=-1; - if (maxy+dy >= editorgridextent) dy*=-1; - if (miny+dy <= -editorgridextent) dy*=-1; - - for (i=numsectors; i=0; j=nextspritesect[j]) - { - sprite[j].x += dx; - sprite[j].y += dy; - } - } - - numsectors = newnumsectors; - numwalls = newnumwalls; - - update_highlightsector(); // must be after numsectors = newnumsectors - - newnumwalls = -1; - newnumsectors = -1; - - updatenumsprites(); - printmessage16("Sectors duplicated and stamped."); - asksave = 1; - } - else - { - printmessage16("Copying sectors would exceed sector or wall limit."); - } -} - -static void duplicate_selected_sprites() -{ - int32_t i, j, k=0; - - for (i=0; i= 0) - sprite[i].ang = (getangle(POINT2(hitw).x-wall[hitw].x, - POINT2(hitw).y-wall[hitw].y)+512)&2047; - - //Make sure sprite's in right sector - if (inside(sprite[i].x, sprite[i].y, sprite[i].sectnum) == 0) - { - j = wall[hitw].point2; - sprite[i].x -= ksgn(wall[j].y-wall[hitw].y); - sprite[i].y += ksgn(wall[j].x-wall[hitw].x); - } -} - -void DoSpriteOrnament(int32_t i) -{ - hitdata_t hitinfo; - - hitscan((const vec3_t *)&sprite[i],sprite[i].sectnum, - sintable[(sprite[i].ang+1536)&2047], - sintable[(sprite[i].ang+1024)&2047], - 0, - &hitinfo,CLIPMASK1); - - sprite[i].x = hitinfo.pos.x; - sprite[i].y = hitinfo.pos.y; - sprite[i].z = hitinfo.pos.z; - changespritesect(i, hitinfo.hitsect); - - correct_ornamented_sprite(i, hitinfo.hitwall); -} - -void update_highlight() -{ - int32_t i; - - highlightcnt = 0; - for (i=0; i>3]&(1<<(i&7))) - highlight[highlightcnt++] = i; - for (i=0; i>3]&(1<<(i&7))) - highlight[highlightcnt++] = i+16384; - } - else - show2dsprite[i>>3] &= ~(1<<(i&7)); - - if (highlightcnt == 0) - highlightcnt = -1; -} - -void update_highlightsector() -{ - int32_t i; - - highlightsectorcnt = 0; - for (i=0; i>3]&(1<<(i&7))) - highlightsector[highlightsectorcnt++] = i; - - if (highlightsectorcnt==0) - highlightsectorcnt = -1; -} - -// hook run after handleevents in side view -static void sideview_filter_keys(void) -{ - uint32_t i; - - for (i=0; i 0) - { - dax /= k; - day /= k; - } - - *cx = dax; - *cy = day; -} - -static int32_t insert_sprite_common(int32_t sucksect, int32_t dax, int32_t day) -{ - int32_t i, j, k; - - i = insertsprite(sucksect,0); - if (i < 0) - return -1; - - sprite[i].x = dax, sprite[i].y = day; - sprite[i].cstat = DEFAULT_SPRITE_CSTAT; - sprite[i].shade = 0; - sprite[i].pal = 0; - sprite[i].xrepeat = 64, sprite[i].yrepeat = 64; - sprite[i].xoffset = 0, sprite[i].yoffset = 0; - sprite[i].ang = 1536; - sprite[i].xvel = 0; sprite[i].yvel = 0; sprite[i].zvel = 0; - sprite[i].owner = -1; - sprite[i].clipdist = 32; - sprite[i].lotag = 0; - sprite[i].hitag = 0; - sprite[i].extra = -1; - - Bmemset(localartfreq, 0, sizeof(localartfreq)); - for (k=0; k localartfreq[j]) - j = k; - - if (localartfreq[j] > 0) - sprite[i].picnum = j; - else - sprite[i].picnum = 0; - - return i; -} - -void correct_sprite_yoffset(int32_t i) -{ - int32_t tileyofs = (int8_t)((picanm[sprite[i].picnum]>>16)&255); - int32_t tileysiz = tilesizy[sprite[i].picnum]; - - if (klabs(tileyofs) >= tileysiz) - { - tileyofs *= -1; - if (tileyofs == 128) - tileyofs = 127; - - sprite[i].yoffset = tileyofs; - } - else - sprite[i].yoffset = 0; -} - -static void fade_screen() -{ - char blackcol=editorcolors[0], greycol=whitecol-25, *cp; - int32_t i; - - begindrawing(); - cp = (char *)frameplace; - for (i=0; i= 0 ? &wall[src] : &nullwall; - - dstwal->cstat = srcwal->cstat; - dstwal->shade = srcwal->shade; - dstwal->yrepeat = srcwal->yrepeat; - fixrepeats(dst); // xrepeat - dstwal->picnum = srcwal->picnum; - dstwal->overpicnum = srcwal->overpicnum; - - dstwal->nextwall = -1; - dstwal->nextsector = -1; - - dstwal->pal = srcwal->pal; - dstwal->xpanning = srcwal->xpanning; - dstwal->ypanning = srcwal->ypanning; - dstwal->lotag = 0; //srcwal->lotag; - dstwal->hitag = 0; //srcwal->hitag; - dstwal->extra = -1; //srcwal->extra; -} - -// helpers for often needed ops: -static int32_t copyloop1(int16_t *danumwalls, int32_t *m) -{ - if (*danumwalls >= MAXWALLS + M32_FIXME_WALLS) - return 1; - - Bmemcpy(&wall[*danumwalls], &wall[*m], sizeof(walltype)); - wall[*danumwalls].point2 = *danumwalls+1; - (*danumwalls)++; - *m = wall[*m].point2; - - return 0; -} - -static void updatesprite1(int16_t i) -{ - setsprite(i, (vec3_t *)&sprite[i]); - - if (sprite[i].sectnum>=0) - { - int32_t tempint, cz, fz; - tempint = spriteheight(i, NULL); - if (sprite[i].cstat&128) - tempint >>= 1; - getzsofslope(sprite[i].sectnum, sprite[i].x, sprite[i].y, &cz, &fz); - sprite[i].z = max(sprite[i].z, cz+tempint); - sprite[i].z = min(sprite[i].z, fz); - } -} - -static int32_t ask_if_sure(const char *query, uint32_t flags); -static int32_t ask_above_or_below(); - -// returns: -// 0: continue -// >0: newnumwalls -// <0: error -static int32_t trace_loop(int32_t j, uint8_t *visitedwall, int16_t *ignore_ret, int16_t *refsect_ret) -{ - int16_t refsect, ignore; - int32_t k, n, refwall; - - if (wall[j].nextwall>=0 || (visitedwall[j>>3]&(1<<(j&7)))) - return 0; - - n=2*MAXWALLS; // simple inf loop check - refwall = j; - k = numwalls; - - ignore = 0; - - if (ignore_ret) - { - refsect = -1; - updatesectorexclude(wall[j].x, wall[j].y, &refsect, hlsectorbitmap); - if (refsect<0) - return -1; - } - - do - { - if (j!=refwall && visitedwall[j>>3]&(1<<(j&7))) - ignore = 1; - visitedwall[j>>3] |= (1<<(j&7)); - - if (ignore_ret) - { - if (inside(wall[j].x, wall[j].y, refsect) != 1) - ignore = 1; - } - - if (!ignore) - { - if (k>=MAXWALLS) - { - message("Wall limits exceeded while tracing outer loop."); - return -2; - } - - Bmemcpy(&wall[k], &wall[j], sizeof(walltype)); - wall[k].point2 = k+1; - wall[k].nextsector = wall[k].nextwall = wall[k].extra = -1; - k++; - } - - j = wall[j].point2; - n--; - - while (wall[j].nextwall>=0 && n>0) - { - j = wall[wall[j].nextwall].point2; -// if (j!=refwall && (visitedwall[j>>3]&(1<<(j&7)))) -// ignore = 1; -// visitedwall[j>>3] |= (1<<(j&7)); - n--; - } - } - while (j!=refwall && n>0); - - if (j!=refwall) - { - message("internal error while tracing outer loop: didn't reach refwall"); - return -3; - } - - if (ignore_ret) - { - *ignore_ret = ignore; - if (refsect_ret) - *refsect_ret = refsect; - } - - return k; -} - -static int32_t backup_drawn_walls(int32_t restore) -{ - static int32_t wallsdrawn = -1; - static walltype *tmpwall; - - // back up - if (restore==0) - { - if (newnumwalls == -1) - { - wallsdrawn = -1; - } - else - { - wallsdrawn = newnumwalls-numwalls; - - tmpwall = Bmalloc(wallsdrawn * sizeof(walltype)); - if (!tmpwall) - { - wallsdrawn = -1; - return 1; - } - - Bmemcpy(tmpwall, &wall[numwalls], wallsdrawn*sizeof(walltype)); - newnumwalls = -1; - } - - return 0; - } - - // restore - if (wallsdrawn != -1) - { - int32_t i; - - Bmemcpy(&wall[numwalls], tmpwall, wallsdrawn*sizeof(walltype)); - newnumwalls = numwalls + wallsdrawn; - for (i=numwalls; i>1) == 0) - { - if (!((vel|angvel|svel) //DOWN_BK(MOVEFORWARD) || DOWN_BK(MOVEBACKWARD) || DOWN_BK(TURNLEFT) || DOWN_BK(TURNRIGHT) - || DOWN_BK(MOVEUP) || DOWN_BK(MOVEDOWN) || keystatus[0x10] || keystatus[0x11] - || keystatus[0x48] || keystatus[0x4b] || keystatus[0x4d] || keystatus[0x50] // keypad keys - || bstatus || OSD_IsMoving())) - { - if (totalclock > waitdelay) - { - uint32_t ms = (highlightsectorcnt>0) ? 75 : 200; - // wait for event, timeout after 200 ms - (last loop time) - idle_waitevent_timeout(ms - min(getticks()-lasttick, ms)); - // have synctics reset to 0 after we've slept to avoid zooming out to the max instantly - resetsynctics = 1; - } - } - else waitdelay = totalclock + 30; // should be 250 ms - - lasttick = getticks(); - - if (handleevents()) - { - if (quitevent) - { - keystatus[1] = 1; - quitevent = 0; - } - } - - if (resetsynctics) - { - resetsynctics = 0; - lockclock = totalclock; - synctics = 0; - } - - OSD_DispatchQueued(); - - if (totalclock < 120*3) - printmessage16("Uses BUILD technology by Ken Silverman."); - else if (totalclock < 120*6) - { - printmessage16("Press F1 for help. This is a test release; always keep backups of your maps."); - // printext16(8L,ydim-STATUS2DSIZ+32L,editorcolors[9],-1,kensig,0); - } - - oldmousebstatus = bstatus; - getmousevalues(&mousx,&mousy,&bstatus); - mousx = (mousx<<16)+mousexsurp; - mousy = (mousy<<16)+mouseysurp; - { - ldiv_t ld; - ld = ldiv(mousx, 1<<16); mousx = ld.quot; mousexsurp = ld.rem; - ld = ldiv(mousy, 1<<16); mousy = ld.quot; mouseysurp = ld.rem; - } - searchx += mousx; - searchy += mousy; - - bclamp(&searchx, 8, xdim-8-1); - bclamp(&searchy, 8, ydim-8-1); - - /* - if (keystatus[0x3b] > 0) pos.x--, keystatus[0x3b] = 0; - if (keystatus[0x3c] > 0) pos.x++, keystatus[0x3c] = 0; - if (keystatus[0x3d] > 0) pos.y--, keystatus[0x3d] = 0; - if (keystatus[0x3e] > 0) pos.y++, keystatus[0x3e] = 0; - if (keystatus[0x43] > 0) ang--, keystatus[0x43] = 0; - if (keystatus[0x44] > 0) ang++, keystatus[0x44] = 0; - */ - - mainloop_move(); - - getpoint(searchx,searchy,&mousxplc,&mousyplc); - linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight); - - if (newnumwalls >= numwalls) - { - // if we're in the process of drawing a wall, set the end point's coordinates - dax = mousxplc; - day = mousyplc; - adjustmark(&dax,&day,newnumwalls); - wall[newnumwalls].x = dax; - wall[newnumwalls].y = day; - } - - ydim16 = ydim;// - STATUS2DSIZ2; - midydim16 = ydim>>1; - - tempint = numwalls; - numwalls = newnumwalls; - if (numwalls < 0) - numwalls = tempint; - - if ((getticks() - lastdraw) >= 5 || (vel|angvel|svel) || DOWN_BK(MOVEUP) || DOWN_BK(MOVEDOWN) - || mousx || mousy || bstatus || keystatus[0x10] || keystatus[0x11] - || newnumwalls>=0 || OSD_IsMoving()) - { - lastdraw = getticks(); - - clear2dscreen(); - - setup_sideview_sincos(); - - if (graphicsmode && !m32_sideview) - { - Bmemset(show2dsector, 0xff, sizeof(show2dsector)); - setview(0, 0, xdim-1, ydim16-1); - - if (graphicsmode == 2) - totalclocklock = totalclock; - - drawmapview(pos.x, pos.y, zoom, 1536); - } - - draw2dgrid(pos.x,pos.y,pos.z,cursectnum,ang,zoom,grid); - - ExtPreCheckKeys(); - - { - int32_t cx, cy; - - // Draw brown arrow (start) - screencoords(&x2, &y2, startposx-pos.x,startposy-pos.y, zoom); - if (m32_sideview) - y2 += getscreenvdisp(startposz-pos.z, zoom); - - cx = halfxdim16+x2; - cy = midydim16+y2; - if ((cx >= 2 && cx <= xdim-3) && (cy >= 2 && cy <= ydim16-3)) - { - int16_t angofs = m32_sideview ? m32_sideang : 0; - x1 = mulscale11(sintable[(startang+angofs+2560)&2047],zoom) / 768; - y1 = mulscale11(sintable[(startang+angofs+2048)&2047],zoom) / 768; - i = scalescreeny(x1); - j = scalescreeny(y1); - begindrawing(); //{{{ - drawline16base(cx,cy, x1,j, -x1,-j, editorcolors[2]); - drawline16base(cx,cy, x1,j, +y1,-i, editorcolors[2]); - drawline16base(cx,cy, x1,j, -y1,+i, editorcolors[2]); - enddrawing(); //}}} - } - } - - draw2dscreen(&pos,cursectnum,ang,zoom,grid); - - begindrawing(); //{{{ - if (showtags == 1) - { - if (zoom >= 768) - { - for (i=0; i= 0) - { - for (i=newnumwalls; i>=tempint; i--) - wall[i].cstat |= (1<<14); - } - - i = numwalls-1; - if (newnumwalls >= 0) - i = newnumwalls-1; - for (wal=&wall[i]; i>=0; i--,wal--) - { - if (zoom < 768 && !(wal->cstat & (1<<14))) - continue; - - //Get average point of wall - dax = (wal->x+wall[wal->point2].x)>>1; - day = (wal->y+wall[wal->point2].y)>>1; - if ((dax > x3) && (dax < x4) && (day > y3) && (day < y4)) - { - dabuffer = (char *)ExtGetWallCaption(i); - if (dabuffer[0] == 0) - continue; - - drawsmallabel(dabuffer, editorcolors[0], editorcolors[31], - dax, day, getflorzofslope(sectorofwall(i), dax,day)); - } - } - - i = 0; j = numsprites; k=0; - if (zoom >= 768) - while (j > 0 && i < MAXSPRITES && (!m32_sideview || k= 0) - { - int32_t oydim16 = ydim16; - ydim16 = ydim-STATUS2DSIZ2; - for (i=0; i>3]&(1<<(i&7))) - fillsector(i,2); - ydim16 = oydim16; - } - - if (keystatus[0x2a]) // FIXME - { - drawlinepat = 0x00ff00ff; - drawline16(searchx,0, searchx,ydim2d-1, editorcolors[15]); - drawline16(0,searchy, xdim2d-1,searchy, editorcolors[15]); - drawlinepat = 0xffffffff; - - _printmessage16("(%d,%d)",mousxplc,mousyplc); -#if 0 - i = (Bstrlen(tempbuf)<<3)+6; - if ((searchx+i) < (xdim2d-1)) - i = 0; - else i = (searchx+i)-(xdim2d-1); - if ((searchy+16) < (ydim2d-STATUS2DSIZ2-1)) - j = 0; - else j = (searchy+16)-(ydim2d-STATUS2DSIZ2-1); - printext16(searchx+6-i,searchy+6-j,editorcolors[11],-1,tempbuf,0); -#endif - } - drawline16(searchx,0, searchx,8, editorcolors[15]); - drawline16(0,searchy, 8,searchy, editorcolors[15]); - - ////// draw mouse pointer - col = editorcolors[15 - 3*gridlock]; - if (joinsector[0] >= 0) - col = editorcolors[11]; - - if (numcorruptthings>0) - { - static char cbuf[64]; - - if ((pointhighlight&16384)==0) - { - for (i=0; i=MAXCORRUPTTHINGS ? ">=":"", numcorruptthings); - printext16(8,8, editorcolors[13],editorcolors[0],cbuf,0); - } - - if (keystatus[0x36] || keystatus[0xb8]) // RSHIFT || RALT - { - if (keystatus[0x27] || keystatus[0x28]) // ' and ; - { - col = editorcolors[14]; - - drawline16base(searchx+16, searchy-16, -4,0, +4,0, col); - if (keystatus[0x28]) - drawline16base(searchx+16, searchy-16, 0,-4, 0,+4, col); - } - - if (keystatus[0x36] && eitherCTRL) - printext16(searchx+6,searchy-6-8,editorcolors[12],-1,"S",0); - } - - drawline16base(searchx,searchy, +0,-8, +0,-1, col); - drawline16base(searchx,searchy, +1,-8, +1,-1, col); - drawline16base(searchx,searchy, +0,+2, +0,+9, col); - drawline16base(searchx,searchy, +1,+2, +1,+9, col); - drawline16base(searchx,searchy, -8,+0, -1,+0, col); - drawline16base(searchx,searchy, -8,+1, -1,+1, col); - drawline16base(searchx,searchy, +2,+0, +9,+0, col); - drawline16base(searchx,searchy, +2,+1, +9,+1, col); - - ////// Draw the white pixel closest to mouse cursor on linehighlight - if (linehighlight>=0 && !m32_sideview) - { - getclosestpointonwall(mousxplc,mousyplc, linehighlight, &dax,&day); - x2 = mulscale14(dax-pos.x,zoom); - y2 = mulscale14(day-pos.y,zoom); - - drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0, - wall[linehighlight].nextsector >= 0 ? editorcolors[15] : editorcolors[5]); - } - - enddrawing(); //}}} - - OSD_Draw(); - } - - VM_OnEvent(EVENT_PREKEYS2D, -1); - ExtCheckKeys(); // TX 20050101, it makes more sense to have this here so keys can be overwritten with new functions in bstub.c - - // Flip/mirror sector Ed Coolidge - if (keystatus[0x2d] || keystatus[0x15]) // X or Y (2D) - { - int32_t about_x=keystatus[0x2d]; - int32_t doMirror = eitherALT; // mirror walls and wall/floor sprites - - if (highlightsectorcnt > 0) - { - keystatus[0x2d] = keystatus[0x15] = 0; - - get_sectors_center(highlightsector, highlightsectorcnt, &dax, &day); - - if (gridlock && grid > 0) - locktogrid(&dax, &day); - - for (i=0; i>1; - for (w=1; w<=numtoswap; w++) - { - Bmemcpy(&tempwall, &wall[startofloop+w], sizeof(walltype)); - Bmemcpy(&wall[startofloop+w], &wall[endofloop-w+1], sizeof(walltype)); - Bmemcpy(&wall[endofloop-w+1], &tempwall, sizeof(walltype)); - } - - //make point2 point to next wall in loop - for (w=startofloop; w= 0) - { - wall[linehighlight].cstat ^= 1; - wall[linehighlight].cstat &= ~64; - if ((wall[linehighlight].nextwall >= 0) && !eitherSHIFT) - { - NEXTWALL(linehighlight).cstat &= ~(1+64); - NEXTWALL(linehighlight).cstat |= (wall[linehighlight].cstat&1); - } - asksave = 1; - } - keystatus[0x30] = 0; - } - if (keystatus[0x21]) //F (F alone does nothing in 2D right now) - { - keystatus[0x21] = 0; - if (eitherALT) //ALT-F (relative alignmment flip) - { - linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight); - if (linehighlight >= 0) - { - int32_t secti = sectorofwall(linehighlight); - setfirstwall(secti, linehighlight); - asksave = 1; - printmessage16("This wall now sector %d's first wall (sector[].wallptr)", secti); - } - } - } - - if (keystatus[0x18]) // O (ornament onto wall) (2D) - { - keystatus[0x18] = 0; - if ((pointhighlight&0xc000) == 16384) - { - asksave = 1; - DoSpriteOrnament(pointhighlight&16383); - } - } - - - tsign = 0; - if (keystatus[0x33] || (bstatus&33)==33) // , (2D) - tsign = +1; - if (keystatus[0x34] || (bstatus&17)==17) // . (2D) - tsign = -1; - - if (tsign) - { - if (highlightsectorcnt > 0) - { - int32_t smoothRotation = !eitherSHIFT; - - get_sectors_center(highlightsector, highlightsectorcnt, &dax, &day); - - if (smoothRotation) - { - if (gridlock && grid > 0) - locktogrid(&dax, &day); - } - - for (i=0; i= 16384) - { - i = pointhighlight-16384; - if (eitherSHIFT) - sprite[i].ang = (sprite[i].ang-tsign)&2047; - else - { - sprite[i].ang = (sprite[i].ang-128*tsign)&2047; - keystatus[0x33] = keystatus[0x34] = 0; - } - - mouseb &= ~(16|32); - bstatus &= ~(16|32); - -// clearmidstatbar16(); -// showspritedata((int16_t)pointhighlight-16384); - } - } - } - - if (keystatus[0x46]) //Scroll lock (set starting position) - { - startposx = pos.x; - startposy = pos.y; - startposz = pos.z; - startang = ang; - startsectnum = cursectnum; - keystatus[0x46] = 0; - asksave = 1; - } -#if 1 - if (keystatus[0x3f]) //F5 - { -// keystatus[0x3f] = 0; - - ydim16 = STATUS2DSIZ; - ExtShowSectorData((int16_t)0); - ydim16 = ydim-STATUS2DSIZ2; - } - if (keystatus[0x40]) //F6 - { -// keystatus[0x40] = 0; - - if (pointhighlight >= 16384) - { - i = pointhighlight-16384; - - ydim16 = STATUS2DSIZ; - ExtShowSpriteData((int16_t)i); - ydim16 = ydim-STATUS2DSIZ2; - } - else if (linehighlight >= 0) - { - i = linehighlight; - - ydim16 = STATUS2DSIZ; - ExtShowWallData((int16_t)i); - ydim16 = ydim-STATUS2DSIZ2; - } - else - { - ydim16 = STATUS2DSIZ; - ExtShowWallData((int16_t)0); - ydim16 = ydim-STATUS2DSIZ2; - } - } - if (keystatus[0x41]) //F7 - { - keystatus[0x41] = 0; - - for (i=0; i= 16384) - { - i = pointhighlight-16384; - - ydim16 = STATUS2DSIZ; - ExtEditSpriteData((int16_t)i); - ydim16 = ydim-STATUS2DSIZ2; - } - else if (linehighlight >= 0) - { - i = linehighlight; - - ydim16 = STATUS2DSIZ; - ExtEditWallData((int16_t)i); - ydim16 = ydim-STATUS2DSIZ2; - } - } -#endif - - if (keystatus[0x23]) //H (Hi 16 bits of tag) - { - keystatus[0x23] = 0; - if (eitherCTRL) //Ctrl-H - { - pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight); - linehighlight = getlinehighlight(mousxplc, mousyplc, linehighlight); - - if ((pointhighlight&0xc000) == 16384) - { - sprite[pointhighlight&16383].cstat ^= 256; - asksave = 1; - } - else if (linehighlight >= 0) - { - wall[linehighlight].cstat ^= 64; - if ((wall[linehighlight].nextwall >= 0) && !eitherSHIFT) - { - NEXTWALL(linehighlight).cstat &= ~64; - NEXTWALL(linehighlight).cstat |= (wall[linehighlight].cstat&64); - } - asksave = 1; - } - } - else if (eitherALT) //ALT - { - if (pointhighlight >= 16384) - { - i = pointhighlight-16384; - Bsprintf(buffer, "Sprite (%d) Hi-tag: ", i); - sprite[i].hitag = getnumber16(buffer, sprite[i].hitag, BTAG_MAX, 0); - } - else if (linehighlight >= 0) - { - i = linehighlight; - Bsprintf(buffer, "Wall (%d) Hi-tag: ", i); - wall[i].hitag = getnumber16(buffer, wall[i].hitag, BTAG_MAX, 0); - } - } - else - { - for (i=0; i= 16384) - { - i = pointhighlight-16384; - Bsprintf(buffer, "Sprite (%d) Status list: ", i); - changespritestat(i, getnumber16(buffer, sprite[i].statnum, MAXSTATUS-1, 0)); -// clearmidstatbar16(); -// showspritedata((int16_t)i); - // printmessage16(""); - } - } - else if (highlightsectorcnt > 0 && newnumwalls < 0&&0) - { - ////////// YAX ////////// - static const char *cfs[2] = {"ceiling", "floor"}; - - int32_t cf, thez; - - cf = ask_above_or_below(); - if (cf==-1) - goto end_yax; - - thez = YAX_SECTORFLD(highlightsector[0],z, cf); - for (i=0; i= 0) - { - message("Sector %d's %s is already extended", highlightsector[i], cfs[cf]); - goto end_yax; - } - - if (i==0) - continue; - - if (YAX_SECTORFLD(highlightsector[i],z, cf) != thez) - { - message("All sectors must have the same %s height", cfs[cf]); - goto end_yax; - } - if ((YAX_SECTORFLD(highlightsector[i],stat, cf)&2)!=0) - { - message("Sector %ss must not be sloped", cfs[cf]); - goto end_yax; - } - } - - m = numwalls; - Bmemset(visited, 0, sizeof(visited)); - // construct! - for (i=0; i highlightx2) - swaplong(&highlightx1, &highlightx2); - if (highlighty1 > highlighty2) - swaplong(&highlighty1, &highlighty2); - - // Ctrl+RShift: select all wall-points of highlighted wall's loop: - if (eitherCTRL && highlightx1==highlightx2 && highlighty1==highlighty2) - { - Bmemset(show2dwall, 0, sizeof(show2dwall)); - Bmemset(show2dsprite, 0, sizeof(show2dsprite)); - - if (linehighlight >= 0 && linehighlight < MAXWALLS) - { - i = linehighlight; - do - { - show2dwall[i>>3] |= (1<<(i&7)); - - for (j=0; j>3] |= (1<<(j&7)); - - i = wall[i].point2; - } - while (i != linehighlight); - } - - update_highlight(); - } - else - { - int32_t add=keystatus[0x28], sub=(!add && keystatus[0x27]), setop=(add||sub); - int32_t tx, ty, onlySprites=eitherCTRL; - - if (!setop) - { - Bmemset(show2dwall, 0, sizeof(show2dwall)); - Bmemset(show2dsprite, 0, sizeof(show2dsprite)); - } - - for (i=0; i= highlightx1 && tx <= highlightx2 && - ty >= highlighty1 && ty <= highlighty2) - { - if (!sub) - show2dwall[i>>3] |= (1<<(i&7)); - else if (sub) - show2dwall[i>>3] &= ~(1<<(i&7)); - } - } - - if (m32_sideview && !onlySprites) - { - // also select walls that would be dragged but - // maybe were missed -#if 1 - for (i=0; i>3]&(1<<(i&7))) - { - //N^2...ugh - for (j=0; j>3] |= (1<<(j&7)); - } -#else - for (i=0; i>3]&(1<<(i&7))) - dragpoint(i, wall[i].x, wall[i].y); - for (i=0; i>3] |= (1<<(i&7)); - wall[i].cstat &= ~(1<<14); - } -#endif - } - - for (i=0; i= highlightx1 && tx <= highlightx2 && - ty >= highlighty1 && ty <= highlighty2) - { - if (!sub) - { - if (sprite[i].sectnum >= 0) // don't allow to select sprites in null space - show2dsprite[i>>3] |= (1<<(i&7)); - } - else - show2dsprite[i>>3] &= ~(1<<(i&7)); - } - } - - update_highlight(); - } - } - } - } - - if (highlightcnt < 0) - { - if (keystatus[0xb8]) //Right alt (sector highlighting) - { - if (highlightsectorcnt == 0) - { - if (!eitherCTRL) - { - int32_t xx[] = { highlightx1, highlightx1, searchx, searchx, highlightx1 }; - int32_t yy[] = { highlighty1, searchy, searchy, highlighty1, highlighty1 }; - - highlightx2 = searchx; - highlighty2 = searchy; - ydim16 = ydim-STATUS2DSIZ2; - - plotlines2d(xx, yy, 5, editorcolors[10]); - } - } - else - { - int32_t didmakered = (highlightsectorcnt<0), hadouterpoint=0; - int16_t tmprefsect; - - for (i=0; i= 0) - checksectorpointer(wall[j].nextwall,wall[j].nextsector); - didmakered |= !!checksectorpointer(j, highlightsector[i]); - - if (!didmakered) - { - updatesectorexclude(wall[j].x, wall[j].y, &tmprefsect, hlsectorbitmap); - if (tmprefsect<0) - hadouterpoint = 1; - } - } - } - - if (!didmakered && !hadouterpoint && newnumwalls<0) - { - // fade the screen to have the user's attention - fade_screen(); - - didmakered |= !ask_if_sure("Insert outer loop and make red walls?", 0); - clearkeys(); - } - - if (!didmakered && !hadouterpoint && newnumwalls<0) - { - int16_t ignore, refsect; - int32_t n; - - Bmemset(visited, 0, sizeof(visited)); - - for (i=0; i= begwalltomove) - wall[m].nextwall += n; - } - for (m=refsect+1; m highlightx2) - swaplong(&highlightx1, &highlightx2); - if (highlighty1 > highlighty2) - swaplong(&highlighty1, &highlighty2); - } - - if (!setop) - Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap)); - - for (i=0; i highlightx2) bad = 1; - if (ty < highlighty1 || ty > highlighty2) bad = 1; - if (bad == 1) break; - } - } - - if (bad == 0) - { - if (sub) - { - hlsectorbitmap[i>>3] &= ~(1<<(i&7)); - for (j=sector[i].wallptr; j= 0) - checksectorpointer(wall[j].nextwall,wall[j].nextsector); - checksectorpointer(j, i); - } - } - else - hlsectorbitmap[i>>3] |= (1<<(i&7)); - } - } - - update_highlightsector(); - ovh_whiteoutgrab(); - -// if (highlightsectorcnt>0) -// printmessage16("Total selected sectors: %d", highlightsectorcnt); - } - } - } - - if (((bstatus&1) < (oldmousebstatus&1)) && highlightsectorcnt < 0) //after dragging - { - int32_t runi; - - if (backup_drawn_walls(0)) - goto end_after_dragging; - - j = 1; - if (highlightcnt > 0) - for (i=0; i=0; i--) //delete points - { - if (wall[i].x == POINT2(i).x && wall[i].y == POINT2(i).y - && sector[sectorofwall(i)].wallnum > 3 - && sector[sectorofwall(wall[i].point2)].wallnum > 3) - { - int32_t b = (wall[i].nextwall == -1 || - (sector[sectorofwall(wall[i].nextwall)].wallnum > 3 && - sector[sectorofwall(NEXTWALL(i).point2)].wallnum > 3)); - if (runi==0 && !b) - { - printmessage16("Invalid operation, delete or join sector instead."); - goto end_after_dragging; - } - else if (runi==1 && b) - { - deletepoint(i); - printmessage16("Point deleted."); - asksave = 1; - } - } - } - - for (i=0; i 0) //drag points - { - if (highlightsectorcnt > 0) - { - if ((bstatus&1) > (oldmousebstatus&1)) - { - newnumwalls = -1; - sectorhighlightstat = -1; - -// updatesector(mousxplc,mousyplc,&cursectorhighlight); - cursectorhighlight = -1; - for (i=0; i= 0 && cursectorhighlight < numsectors) - { -// for (i=0; i 0) - locktogrid(&dax, &day); - - sectorhighlightx = dax; - sectorhighlighty = day; -// break; - } - } - } - else if (sectorhighlightstat == 1) - { - dax = mousxplc; - day = mousyplc; - if (gridlock && grid > 0) - locktogrid(&dax, &day); - - dax -= sectorhighlightx; - day -= sectorhighlighty; - sectorhighlightx += dax; - sectorhighlighty += day; - - for (i=0; i=0; j=nextspritesect[j]) - { sprite[j].x += dax; sprite[j].y += day; } - } - - //for(i=0;i= 0) - // checksectorpointer(wall[j].nextwall,wall[j].nextsector); - // checksectorpointer((short)j,highlightsector[i]); - // } - //} - asksave = 1; - } - - } - else //if (highlightsectorcnt <= 0) - { - if ((bstatus&1) > (oldmousebstatus&1)) - pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight); - - if (pointhighlight >= 0 && (!m32_sideview || m32_sideelev>=32)) - { - if (m32_sideview) - { - int32_t dz; - if (pointhighlight>=16384) - dz = sprite[pointhighlight&16383].z - pos.z; - else - dz = getflorzofslope(sectorofwall(pointhighlight), - wall[pointhighlight].x, wall[pointhighlight].y) - pos.z; - getinvdisplacement(&dax,&day, -dz); - dax += mousxplc; - day += mousyplc; - } - else - { - dax = mousxplc; - day = mousyplc; - } - - if (gridlock && grid > 0) - locktogrid(&dax, &day); - - j = 1; - if (highlightcnt > 0) - for (i=0; i= numwalls && - wall[pointhighlight].x==firstx && wall[pointhighlight].y==firsty) - { - printmessage16("Can't drag point where drawing started."); - goto end_point_dragging; - } - - dragpoint(pointhighlight,dax,day); - } - else if ((pointhighlight&0xc000) == 16384) - { - int32_t daspr=pointhighlight&16383, osec=sprite[daspr].sectnum; - vec3_t vec, ovec; - - Bmemcpy(&ovec, (vec3_t *)&sprite[daspr], sizeof(vec3_t)); - vec.x = dax; - vec.y = day; - vec.z = sprite[daspr].z; - if (setsprite(daspr, &vec) == -1 && osec>=0) - Bmemcpy(&sprite[daspr], &ovec, sizeof(vec3_t)); -#if 0 - daz = spriteheight(daspr, NULL); - - for (i=0; i= getceilzofslope(i,dax,day)) - if (sprite[daspr].z-daz <= getflorzofslope(i,dax,day)) - { - sprite[daspr].x = dax; - sprite[daspr].y = day; - if (sprite[daspr].sectnum != i) - changespritesect(daspr,(int16_t)i); - break; - } -#endif - } - } - asksave = 1; - } - } - } - else //if ((bstatus&1) == 0) - { - pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight); - sectorhighlightstat = -1; - } -end_point_dragging: - - if (bstatus&(2|4)) // change arrow position - { - if (eitherCTRL) - { - int16_t cursectornum; - - for (cursectornum=0; cursectornum= 16384) - { - i = pointhighlight-16384; - ExtEditSpriteData((int16_t)i); - } - else if ((linehighlight >= 0) && (bstatus&1 || sectorofwall(linehighlight) == cursectornum)) - ExtEditWallData((int16_t)linehighlight); - else if (cursectornum >= 0) - ExtEditSectorData((int16_t)cursectornum); - } - - bstatus &= ~6; - } - else - { - if (m32_sideview && (bstatus&4)) - { - pos.z += divscale18(searchy-midydim16,zoom); - getpoint(searchx,midydim16, &pos.x, &pos.y); - } - else - { - pos.x = mousxplc; - pos.y = mousyplc; - } - - if (m32_sideview) - { - int32_t opat=drawlinepat; - - y1 = INT_MAX; - - for (i=0; i 0) - updatesectorz(pos.x,pos.y,pos.z,&cursectnum); - - if (circlewall != -1 && (keystatus[0x4a] || ((bstatus&32) && !eitherCTRL))) // -, mousewheel down - { - if (circlepoints > 1) - circlepoints--; - keystatus[0x4a] = 0; - mouseb &= ~32; - bstatus &= ~32; - } - if (circlewall != -1 && (keystatus[0x4e] || ((bstatus&16) && !eitherCTRL))) // +, mousewheel up - { - if (circlepoints < 63) - circlepoints++; - keystatus[0x4e] = 0; - mouseb &= ~16; - bstatus &= ~16; - } - - if (keystatus[0x3d]) // F3 - { - keystatus[0x3d]=0; - if (!m32_sideview && (newnumwalls>=0 || joinsector[0]>=0 || circlewall>=0 || (bstatus&1))) - message("Must not be editing map while switching to side view mode."); - else - { - m32_sideview = !m32_sideview; - printmessage16("Side view %s", m32_sideview?"enabled":"disabled"); - - m32_setkeyfilter(1); - } - } - - if (m32_sideview && (keystatus[0x10] || keystatus[0x11])) - { - if (eitherCTRL) - { - if (m32_sideang&63) - { - m32_sideang += (1-2*keystatus[0x10])*(1-2*sideview_reversehrot)*32; - m32_sideang &= (2047&~63); - } - else - { - m32_sideang += (1-2*keystatus[0x10])*(1-2*sideview_reversehrot)*64; - m32_sideang &= 2047; - } - - keystatus[0x10] = keystatus[0x11] = 0; - } - else - { - m32_sideang += (1-2*keystatus[0x10])*(1-2*sideview_reversehrot)*synctics<<(eitherSHIFT*2); - m32_sideang &= 2047; - } - _printmessage16("Sideview angle: %d", (int32_t)m32_sideang); - } - - if (m32_sideview && (keystatus[0x2a] || (bstatus&(16|32)))) // LShift - { - if ((DOWN_BK(MOVEUP) || (bstatus&16)) && m32_sideelev < 512) - { - m32_sideelev += synctics<<(1+!!(bstatus&16)); - if (m32_sideelev > 512) - m32_sideelev = 512; - _printmessage16("Sideview elevation: %d", m32_sideelev); - } - if ((DOWN_BK(MOVEDOWN) || (bstatus&32)) && m32_sideelev > 0) - { - m32_sideelev -= synctics<<(1+!!(bstatus&32)); - if (m32_sideelev < 0) - m32_sideelev = 0; - _printmessage16("Sideview elevation: %d", m32_sideelev); - } - } - else - { - int32_t didzoom=0; - - if ((DOWN_BK(MOVEUP) || (bstatus&16)) && zoom < 65536) - { - zoom += synctics*(zoom>>4); - if (zoom < 24) zoom += 2; - didzoom = 1; - } - if ((DOWN_BK(MOVEDOWN) || (bstatus&32)) && zoom > 8) - { - zoom -= synctics*(zoom>>4); - didzoom = 1; - } - - if (didzoom) - { - if (eitherALT) - { - searchx = halfxdim16; - searchy = midydim16; - pos.x = mousxplc; - pos.y = mousyplc; - } - zoom = clamp(zoom, 8, 65536); - _printmessage16("Zoom: %d",zoom); - } - } - - if (keystatus[0x22]) // G (grid on/off) - { - keystatus[0x22] = 0; - grid++; - if (grid == 7) grid = 0; - } - if (keystatus[0x26]) // L (grid lock) - { - keystatus[0x26] = 0; - gridlock = !gridlock; - printmessage16("Grid locking %s", gridlock?"on":"off"); - } - - if (keystatus[0x24]) // J (join sectors) - { - keystatus[0x24] = 0; - - if (newnumwalls >= 0) - { - printmessage16("Can't join sectors while editing."); - goto end_join_sectors; - } - - if (joinsector[0] < 0) - { - joinsector[0] = -1; - for (i=0; i= MAXWALLS + M32_FIXME_WALLS) - { - message("Joining sectors failed: not enough space beyond wall[]"); - joinsector[0] = -1; - newnumwalls = -1; - - for (i=0; i0 && ((wall[i].cstat & (1<<14))==0) - && (wall[i].nextsector != joinsector[1-joink])); - - wall[newnumwalls-1].point2 = m; - - if (loopnum==0) - { - printmessage16("internal error while joining sectors: infloop!"); - newnumwalls = -1; - } - } - } - - if (newnumwalls > numwalls) - { - Bmemcpy(§or[numsectors], §or[joinsector[0]], sizeof(sectortype)); - sector[numsectors].wallptr = numwalls; - sector[numsectors].wallnum = newnumwalls-numwalls; - - //fix sprites - for (i=0; i<2; i++) - { - j = headspritesect[joinsector[i]]; - while (j != -1) - { - k = nextspritesect[j]; - changespritesect(j, numsectors); - j = k; - } - } - - numsectors++; - - for (i=numwalls; i= 0) - { - NEXTWALL(i).nextwall = i; - NEXTWALL(i).nextsector = numsectors-1; - } - } - - numwalls = newnumwalls; - newnumwalls = -1; - - for (k=0; k<2; k++) - for (WALLS_OF_SECTOR(joinsector[k], j)) - wall[j].nextwall = wall[j].nextsector = -1; - - deletesector(joinsector[0]); - if (joinsector[0] < joinsector[1]) - joinsector[1]--; - deletesector(joinsector[1]); - - printmessage16("Sectors joined."); - asksave = 1; - } - - joinsector[0] = -1; - } - } -end_join_sectors: - -// PK - for (i=0x02; i<=0x0b; i++) // keys '1' to '0' on the upper row - if (keystatus[i]) - { - prefixarg = prefixtiles[i-2]; - break; - } - - if (eitherALT && keystatus[0x1f]) //ALT-S - { - keystatus[0x1f] = 0; - - if (linehighlight >= 0 && wall[linehighlight].nextwall == -1) - { - newnumwalls = whitelinescan(linehighlight); - if (newnumwalls < numwalls) - { - printmessage16("Can't make a sector out there."); - newnumwalls = -1; - } - else if (newnumwalls > MAXWALLS) - { - printmessage16("Making new sector from inner loop would exceed wall limits."); - newnumwalls = -1; - } - else - { - for (i=numwalls; i= 0) - { - dax = mousxplc; - day = mousyplc; - if (gridlock && grid > 0) - locktogrid(&dax, &day); - - i = insert_sprite_common(sucksect, dax, day); - - if (i < 0) - printmessage16("Couldn't insert sprite."); - else - { - sprite[i].z = getflorzofslope(sucksect,dax,day); -// if (sprite[i].cstat&128) -// sprite[i].z -= spriteheight(i, NULL)>>1; - -// PK - if (prefixarg) - { - sprite[i].picnum = prefixarg; - sprite[i].xrepeat = sprite[i].yrepeat = 48; - prefixarg = 0; - } - else if (somethingintab == 3) - { - sprite[i].picnum = temppicnum; - if (tilesizx[temppicnum] <= 0 || tilesizy[temppicnum] <= 0) - { - j = 0; - for (k=0; k 0 && tilesizy[k] > 0) - { - j = k; - break; - } - sprite[i].picnum = j; - } - sprite[i].shade = tempshade; - sprite[i].pal = temppal; - sprite[i].xrepeat = max(tempxrepeat, 1); - sprite[i].yrepeat = max(tempyrepeat, 1); - sprite[i].cstat = tempcstat; - } - - if (tilesizy[sprite[i].picnum] >= 32) - sprite[i].cstat |= 1; - - correct_sprite_yoffset(i); - - printmessage16("Sprite inserted."); - updatenumsprites(); - asksave = 1; - - VM_OnEvent(EVENT_INSERTSPRITE2D, i); - } - } - } - - if (keystatus[0x2e]) // C (make circle of points) - { - if (highlightsectorcnt >= 0) - duplicate_selected_sectors(); - else if (highlightcnt >= 0) - duplicate_selected_sprites(); - - else if (circlewall >= 0) - { - circlewall = -1; - } - else - { - if (linehighlight >= 0) - circlewall = linehighlight; - } - keystatus[0x2e] = 0; - } - - bad = keystatus[0x39]; //Gotta do this to save lots of 3 spaces! - - if (circlewall >= 0) - { - x1 = wall[circlewall].x; - y1 = wall[circlewall].y; - x2 = POINT2(circlewall).x; - y2 = POINT2(circlewall).y; - x3 = mousxplc; - y3 = mousyplc; - adjustmark(&x3,&y3,newnumwalls); - tempint1 = dmulscale4(x3-x2,x1-x3, y1-y3,y3-y2); - tempint2 = dmulscale4(y1-y2,x1-x3, y1-y3,x2-x1); - - if (tempint2 != 0) - { - int32_t ps = 2, goodtogo; // pointsize - - centerx = ((x1+x2) + scale(y1-y2,tempint1,tempint2))>>1; - centery = ((y1+y2) + scale(x2-x1,tempint1,tempint2))>>1; - - dax = mulscale14(centerx-pos.x,zoom); - day = mulscale14(centery-pos.y,zoom); - drawline16base(halfxdim16+dax,midydim16+day, -2,-2, +2,+2, editorcolors[14]); - drawline16base(halfxdim16+dax,midydim16+day, -2,+2, +2,-2, editorcolors[14]); - - circleang1 = getangle(x1-centerx,y1-centery); - circleang2 = getangle(x2-centerx,y2-centery); - - circleangdir = 1; - k = ((circleang2-circleang1)&2047); - if (mulscale4(x3-x1,y2-y1) < mulscale4(x2-x1,y3-y1)) - { - circleangdir = -1; - k = -((circleang1-circleang2)&2047); - } - - circlerad = ksqrt(dmulscale4(centerx-x1,centerx-x1, centery-y1,centery-y1))<<2; - goodtogo = (numwalls+circlepoints <= MAXWALLS); - - for (i=circlepoints; i>0; i--) - { - j = (circleang1 + scale(i,k,circlepoints+1))&2047; - dax = centerx + mulscale14(sintable[(j+512)&2047],circlerad); - day = centery + mulscale14(sintable[j],circlerad); - - bclamp(&dax, -editorgridextent, editorgridextent); - bclamp(&day, -editorgridextent, editorgridextent); - - if (bad > 0 && goodtogo) - { - insertpoint(circlewall,dax,day); - if (wall[circlewall].nextwall >= 0 && wall[circlewall].nextwall < circlewall) - circlewall++; - } - - dax = mulscale14(dax-pos.x,zoom); - day = mulscale14(day-pos.y,zoom); - drawline16base(halfxdim16+dax,midydim16+day, -ps,-ps, +ps,-ps, editorcolors[14]); - drawline16base(halfxdim16+dax,midydim16+day, +ps,-ps, +ps,+ps, editorcolors[14]); - drawline16base(halfxdim16+dax,midydim16+day, +ps,+ps, -ps,+ps, editorcolors[14]); - drawline16base(halfxdim16+dax,midydim16+day, -ps,+ps, -ps,-ps, editorcolors[14]); -// drawcircle16(halfxdim16+dax, midydim16+day, 3, 14); - } - - if (bad > 0) - { - bad = 0; - keystatus[0x39] = 0; - - if (goodtogo) - { - asksave = 1; - printmessage16("Circle points inserted."); - circlewall = -1; - } - else - printmessage16("Inserting circle points would exceed wall limit."); - } - } - } - - if (bad > 0) //Space bar test - { - keystatus[0x39] = 0; - adjustmark(&mousxplc,&mousyplc,newnumwalls); - - if (checkautoinsert(mousxplc,mousyplc,newnumwalls) == 1) - { - printmessage16("You must insert a point there first."); - bad = 0; - } - } - - if (bad > 0) //Space - { - if (newnumwalls < numwalls) // starting wall drawing - { - if (numwalls >= MAXWALLS-1) - { - // whatever we do, we will need at least two new walls - printmessage16("Can't start sector drawing: wall limit reached."); - goto end_space_handling; - } - - if (numsectors >= MAXSECTORS) - { - printmessage16("Can't start sector drawing: sector limit reached."); - goto end_space_handling; - } - - firstx = mousxplc; - firsty = mousyplc; //Make first point - newnumwalls = numwalls; - suckwall = -1; - split = 0; - - Bmemset(&wall[newnumwalls], 0, sizeof(walltype)); - wall[newnumwalls].extra = -1; - - wall[newnumwalls].x = mousxplc; - wall[newnumwalls].y = mousyplc; - wall[newnumwalls].nextsector = -1; - wall[newnumwalls].nextwall = -1; - - for (i=0; i=MAXWALLS) - { - printmessage16("Inserting another point would exceed wall limit."); - goto end_space_handling; - } - - j = 0; - for (i=numwalls; i>1; - day = (wall[numwalls].y+mousyplc)>>1; - - for (i=0; i=0 && (POINT2(k).x != mousxplc || POINT2(k).y != mousyplc)) - if (wall[lastwall(k)].x != mousxplc || wall[lastwall(k)].y != mousyplc) - { - split = 1; - splitsect = i; - splitstartwall = m; - break; - } - } - } - - //make new point - - //make sure not drawing over old red line - bad = 0; - for (i=0; i= 0) - { - int32_t lastwalx = wall[newnumwalls-1].x; - int32_t lastwaly = wall[newnumwalls-1].y; - - if (wall[i].x == mousxplc && wall[i].y == mousyplc) - if (POINT2(i).x == lastwalx && POINT2(i).y == lastwaly) - bad = 1; - if (wall[i].x == lastwalx && wall[i].y == lastwaly) - if (POINT2(i).x == mousxplc && POINT2(i).y == mousyplc) - bad = 1; - } - } - - if (bad == 0) - { - Bmemset(&wall[newnumwalls], 0, sizeof(walltype)); - wall[newnumwalls].extra = -1; - - wall[newnumwalls].x = mousxplc; - wall[newnumwalls].y = mousyplc; - wall[newnumwalls].nextsector = -1; - wall[newnumwalls].nextwall = -1; - - for (i=0; i= numwalls+3 - && firstx==mousxplc && firsty==mousyplc) - { - wall[newnumwalls-1].point2 = numwalls; - - if (suckwall == -1) //if no connections to other sectors - { - k = -1; - for (i=0; i= suckwall) - wall[i].nextwall += j; - if (wall[i].point2 >= suckwall) - wall[i].point2 += j; - } - - for (i=newnumwalls-1; i>=suckwall; i--) - Bmemcpy(&wall[i+j], &wall[i], sizeof(walltype)); - for (i=0; i MAXWALLS) - { - printmessage16("%s would exceed wall limit.", bad==0 ? - "Splitting sector" : "Joining sector loops"); - newnumwalls--; - break; - } - - ////////// common code for splitting/loop joining ////////// - - newnumwalls--; //first fix up the new walls - for (i=numwalls; inumwalls; j--) - { - Bmemcpy(&wall[danumwalls], &wall[j], sizeof(walltype)); - wall[danumwalls].nextwall = -1; - wall[danumwalls].nextsector = -1; - wall[danumwalls].point2 = danumwalls+1; - danumwalls++; - } - - m = splitstartwall; //copy rest of loop next - - if (doSectorSplit) - { - while (m != splitendwall) - if (copyloop1(&danumwalls, &m)) goto split_not_enough_walls; - wall[danumwalls-1].point2 = secondstartwall; - } - else - { - do - if (copyloop1(&danumwalls, &m)) goto split_not_enough_walls; - while (m != splitstartwall); - wall[danumwalls-1].point2 = numwalls; - } - - //Add other loops for 2nd sector - i = loopnum = loopnumofsector(splitsect,splitstartwall); - - for (j=startwall; j<=endwall; j++) - { - k = loopnumofsector(splitsect, j); - if (k==i) - continue; - - if (doSectorSplit && k==loopnum) - continue; - if (!doSectorSplit && (k == loopnumofsector(splitsect,splitstartwall) || k == loopnumofsector(splitsect,splitendwall))) - continue; - - i = k; - - if (doSectorSplit && (loopinside(wall[j].x,wall[j].y, secondstartwall) != 1)) - continue; - - m = j; k = danumwalls; //copy loop - do - if (copyloop1(&danumwalls, &m)) goto split_not_enough_walls; - while (m != j); - wall[danumwalls-1].point2 = k; - } - - //fix all next pointers on old sector line - for (j=numwalls; j= 0) - { - NEXTWALL(j).nextwall = j; - - if (!doSectorSplit || j < secondstartwall) - NEXTWALL(j).nextsector = numsectors; - else - NEXTWALL(j).nextsector = numsectors+1; - } - } - - if (doSectorSplit) - { - //set all next pointers on split - for (j=numwalls; j= 0) - checksectorpointer(wall[j].nextwall, wall[j].nextsector); - checksectorpointer(j, sectorofwall(j)); - } - - //k now safe to use as temp -#if 0 - if (doSectorSplit) - for (m=numsectors-2; m=0; i--) - sector[i].wallnum = sector[i+1].wallptr-sector[i].wallptr; - sector[numsectors-1].wallnum = numwalls-sector[numsectors-1].wallptr; - - for (i=0; i= 0) - { - checksectorpointer(linehighlight,sectorofwall(linehighlight)); - printmessage16("Highlighted line pointers checked."); - asksave = 1; - } - } - } - - { - static int32_t backspace_last = 0; - - if (keystatus[0x0e]) //Backspace - { - keystatus[0x0e] = 0; - - if (newnumwalls >= numwalls) - { - backspace_last = 1; - - if (newnumwalls == numwalls+1 || keystatus[0x1d]) // LCtrl: delete all newly drawn walls - newnumwalls = -1; - else - newnumwalls--; - } - else if (backspace_last==0) - { - graphicsmode += (1-2*(DOWN_BK(RUN) || keystatus[0x36]))+3; - graphicsmode %= 3; - printmessage16("2D mode textures %s", - (graphicsmode == 2)?"enabled w/ animation":graphicsmode?"enabled":"disabled"); - } - } - else - backspace_last = 0; - } - - if (keystatus[0xd3] && eitherCTRL && numwalls > 0) //sector delete - { - keystatus[0xd3] = 0; - - sucksect = -1; - for (i=0; i= 0) - for (j=0; j=0; j--) - { - deletesector(highlightsector[j]); - for (k=j-1; k>=0; k--) - if (highlightsector[k] >= highlightsector[j]) - highlightsector[k]--; - } - - printmessage16("Highlighted sectors deleted."); - k = 1; - break; - } - - if (k == 0) - { - deletesector(i); - printmessage16("Sector deleted."); - } - - Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap)); - highlightsectorcnt = -1; - - Bmemset(show2dwall, 0, sizeof(show2dwall)); - update_highlight(); - - newnumwalls = -1; - asksave = 1; - - break; - } - } - - if (keystatus[0xd3] && (pointhighlight >= 0)) - { - if ((pointhighlight&0xc000) == 16384) //Sprite Delete - { - deletesprite(pointhighlight&16383); - printmessage16("Sprite deleted."); - updatenumsprites(); - update_highlight(); - asksave = 1; - } - keystatus[0xd3] = 0; - } - - if (keystatus[0xd2] || keystatus[0x17]) //InsertPoint - { - if (highlightsectorcnt >= 0) - duplicate_selected_sectors(); - else if (highlightcnt >= 0) - duplicate_selected_sprites(); - else if (linehighlight >= 0) - { - int32_t onewnumwalls = newnumwalls; - int32_t wallis2sided = (wall[linehighlight].nextwall>=0); - - if (backup_drawn_walls(0)) - { - message("OUT OF MEMORY!"); - } - else if (max(numwalls,onewnumwalls) >= MAXWALLS-wallis2sided) - { - printmessage16("Inserting point would exceed wall limit."); - } - else - { - getclosestpointonwall(mousxplc,mousyplc, linehighlight, &dax,&day); - adjustmark(&dax,&day, newnumwalls); - insertpoint(linehighlight, dax,day); - printmessage16("Point inserted."); - - j = 0; - //Check to see if point was inserted over another point - for (i=numwalls-1; i>=0; i--) //delete points - if (wall[i].x == POINT2(i).x && wall[i].y == POINT2(i).y) - { - deletepoint(i); - j++; - } - for (i=0; i>1); - // day = ((wall[linehighlight].y + POINT2(linehighlight).y)>>1); - // if ((dax != wall[linehighlight].x) || (day != wall[linehighlight].y)) - // if ((dax != POINT2(linehighlight).x) || (day != POINT2(linehighlight).y)) - // { - // insertpoint(linehighlight,dax,day); - // printmessage16("Point inserted at midpoint."); - // } - //} - } - - backup_drawn_walls(1); - - asksave = 1; - } - keystatus[0xd2] = keystatus[0x17] = 0; - } - - /*j = 0; - for(i=22-1;i>=0;i--) updatecrc16(j,kensig[i]); - if ((j&0xffff) != 0xebf) - { - printf("Don't screw with my name.\n"); - exit(0); - }*/ - //printext16(9L,336+9L,4,-1,kensig,0); - //printext16(8L,336+8L,12,-1,kensig,0); - - showframe(1); - synctics = totalclock-lockclock; - lockclock += synctics; - - if (keystatus[buildkeys[BK_MODE2D_3D]]) - { - updatesector(pos.x,pos.y,&cursectnum); - if (cursectnum >= 0) - keystatus[buildkeys[BK_MODE2D_3D]] = 2; - else - printmessage16("Arrow must be inside a sector before entering 3D mode."); - } - -// vvv PK ------------------------------------ (LShift) Ctrl-X: (prev) next map -// this is copied from 'L' (load map), but without copying the highlighted sectors - - if (quickmapcycling && keystatus[0x2d]) //X - { - if (eitherCTRL) //Ctrl - { -nextmap: -// bad = 0; - i = menuselect_auto(keystatus[0x2a] ? 0:1); // Left Shift: prev map - if (i < 0) - { - if (i == -1) - message("No more map files."); - else if (i == -2) - message("No .MAP files found."); - else if (i == -3) - message("Load map first!"); - } - else - { - if (LoadBoard(NULL, 4)) - goto nextmap; - - sectorhighlightstat = -1; - joinsector[0] = -1; - circlewall = -1; - circlepoints = 7; - oposz = pos.z; - } - showframe(1); - keystatus[0x1c] = 0; - - keystatus[0x2d]=keystatus[0x13]=0; - - } - } -// ^^^ PK ------------------------------------ - - if (keystatus[1] && joinsector[0] >= 0) - { - keystatus[1]=0; - joinsector[0]=-1; - printmessage16("No sectors joined."); - } - -CANCEL: - if (keystatus[1]) - { - m32_setkeyfilter(0); - - keystatus[1] = 0; - _printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (T)est map, (U)ndo, (R)edo, (Q)uit"); - showframe(1); - bflushchars(); - bad = 1; - while (bad == 1) - { - if (handleevents()) - { - if (quitevent) - quitevent = 0; - } - idle(); - - ch = bgetchar(); - - if (keystatus[1]) - { - keystatus[1] = 0; - bad = 0; - // printmessage16(""); - } - else if (ch == 'n' || ch == 'N') //N - { - bad = 0; - - if (!ask_if_sure("Are you sure you want to start a new board? (Y/N)", 0)) - break; - else - { - int32_t bakstat=-1; - mapinfofull_t bakmap; - - if (highlightsectorcnt > 0) - bakstat = backup_highlighted_map(&bakmap); - -// Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap)); -// highlightsectorcnt = -1; - - highlightcnt = -1; - //Clear all highlights - Bmemset(show2dwall, 0, sizeof(show2dwall)); - Bmemset(show2dsprite, 0, sizeof(show2dsprite)); - - for (i=0; i 0) - bakstat = backup_highlighted_map(&bakmap); -// __old_mapcopy_2__ - if (LoadBoard(NULL, 4)) - { - printmessage16("Invalid map format."); - if (bakstat==0) - mapinfofull_free(&bakmap); - } - else - { - sectorhighlightstat = -1; - joinsector[0] = -1; - circlewall = -1; - circlepoints = 7; - oposz = pos.z; - - if (bakstat==0) - { - bakstat = restore_highlighted_map(&bakmap); - if (bakstat == -1) - message("Can't copy highlighted portion of old map: limits exceeded."); - } - } - } - showframe(1); - keystatus[0x1c] = 0; - } - else if (ch == 'a' || ch == 'A') //A - { - int32_t corrupt = CheckMapCorruption(4, 0); - - bad = 0; - - Bstrcpy(selectedboardfilename, boardfilename); - if (Bstrrchr(boardfilename, '/')) - Bstrcpy(boardfilename, Bstrrchr(boardfilename, '/')+1); - - i = 0; - while ((boardfilename[i] != 0) && (i < 64)) - i++; - if (boardfilename[i-4] == '.') - i -= 4; - boardfilename[i] = 0; - - bflushchars(); - while (bad == 0) - { - _printmessage16("%sSave as: ^011%s%s", corrupt>=4?"(map corrupt) ":"", - boardfilename, (totalclock&32)?"_":""); - showframe(1); - - if (handleevents()) - quitevent = 0; - - idle(); - - ch = bgetchar(); - - if (keystatus[1]) bad = 1; - else if (ch == 13) bad = 2; - else if (ch > 0) - { - if (i > 0 && (ch == 8 || ch == 127)) - { - i--; - boardfilename[i] = 0; - } - else if (i < 40 && ch > 32 && ch < 128) - { - boardfilename[i++] = ch; - boardfilename[i] = 0; - } - } - } - - if (bad == 1) - { - Bstrcpy(boardfilename, selectedboardfilename); - keystatus[1] = 0; - printmessage16("Operation cancelled"); - showframe(1); - } - else if (bad == 2) - { - const char *f; - char *slash; - - keystatus[0x1c] = 0; - - boardfilename[i] = '.'; - boardfilename[i+1] = 'm'; - boardfilename[i+2] = 'a'; - boardfilename[i+3] = 'p'; - boardfilename[i+4] = 0; - - slash = Bstrrchr(selectedboardfilename,'/'); - Bstrcpy(slash ? slash+1 : selectedboardfilename, boardfilename); - - _printmessage16("Saving board..."); - showframe(1); - - f = SaveBoard(selectedboardfilename, 0); - - if (f) - printmessage16("Saved board to %s.", f); - else - printmessage16("Saving board failed."); - - Bstrcpy(boardfilename, selectedboardfilename); - } - bad = 0; - } - else if (ch == 's' || ch == 'S') //S - { - const char *f; - - bad = 0; - - if (CheckMapCorruption(4, 0)>=4) - if (!ask_if_sure("Map is corrupt. Are you sure you want to save?", 0)) - break; - - _printmessage16("Saving board..."); - showframe(1); - - f = SaveBoard(NULL, 0); - - if (f) - printmessage16("Saved board to %s.", f); - else - printmessage16("Saving board failed."); - - showframe(1); - } - else if (ch == 't' || ch == 'T') - { - test_map(0); - } - else if (ch == 'u' || ch == 'U') - { - bad = 0; - if (map_undoredo(0)) printmessage16("Nothing to undo!"); - else printmessage16("Revision %d undone",map_revision); - } - else if (ch == 'r' || ch == 'R') - { - bad = 0; - if (map_undoredo(1)) printmessage16("Nothing to redo!"); - else printmessage16("Restored revision %d",map_revision-1); - } - else if (ch == 'q' || ch == 'Q') //Q - { - bad = 0; - - if (ask_if_sure("Are you sure you want to quit?", 0)) - { - //QUIT! - - int32_t corrupt = CheckMapCorruption(4, 0); - - if (ask_if_sure(corrupt<4?"Save changes?":"Map corrupt. Save changes?", 2+(corrupt>=4))) - SaveBoard(NULL, 0); - - while (keystatus[1] || keystatus[0x2e]) - { - keystatus[1] = 0; - keystatus[0x2e] = 0; - quitevent = 0; - printmessage16("Operation cancelled"); - showframe(1); - goto CANCEL; - } - - ExtUnInit(); - clearfilenames(); - uninittimer(); - uninitinput(); - uninitengine(); - exit(0); - } - - // printmessage16(""); - showframe(1); - } - } - - clearkeys(); - - m32_setkeyfilter(1); - } - - VM_OnEvent(EVENT_KEYS2D, -1); - - //nextpage(); - } - - for (i=0; i= 0) - checksectorpointer(wall[j].nextwall, wall[j].nextsector); - checksectorpointer(j, highlightsector[i]); - } - } - - fixspritesectors(); - - if (setgamemode(fullscreen,xdimgame,ydimgame,bppgame) < 0) - { - initprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); - ExtUnInit(); - uninitinput(); - uninittimer(); - uninitsystem(); - clearfilenames(); - exit(1); - } - - setbrightness(GAMMA_CALC,0,0); - - pos.z = oposz; - - searchx = clamp(scale(searchx,xdimgame,xdim2d), 8, xdimgame-8-1); - searchy = clamp(scale(searchy,ydimgame,ydim2d-STATUS2DSIZ), 8, ydimgame-8-1); - - m32_setkeyfilter(0); - - VM_OnEvent(EVENT_ENTER3DMODE, -1); -} - -// flags: -// 1: quit_is_yes -// 2: don't clear keys on return -static int32_t ask_if_sure(const char *query, uint32_t flags) -{ - char ch; - int32_t ret=-1; - - if (!query) - _printmessage16("Are you sure?"); - else - _printmessage16("%s", query); - showframe(1); - bflushchars(); - - while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1) - { - if (handleevents()) - { - if (quitevent) - { - if (flags&1) - return 1; - else - quitevent = 0; - } - } - idle(); - - ch = bgetchar(); - - if (ch == 'y' || ch == 'Y') - ret = 1; - else if (ch == 'n' || ch == 'N' || ch == 13 || ch == ' ') - ret = 0; - } - - if ((flags&2)==0) - clearkeys(); - - if (ret >= 0) - return ret; - - return 0; -} - -static int32_t ask_above_or_below() -{ - char ch; - int32_t ret=-1; - - _printmessage16("Extend above (a) or below (z)?"); - - showframe(1); - bflushchars(); - - while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1) - { - if (handleevents()) - quitevent = 0; - - idle(); - ch = bgetchar(); - - if (ch == 'a' || ch == 'A') - ret = 0; - else if (ch == 'z' || ch == 'Z') - ret = 1; - } - - clearkeys(); - - return ret; -} - -// flags: 1:no ExSaveMap (backup.map) -const char *SaveBoard(const char *fn, uint32_t flags) -{ - const char *f; - int32_t ret; - - if (!fn) - fn = boardfilename; - - if (pathsearchmode) - f = fn; - else - { - // virtual filesystem mode can't save to directories so drop the file into - // the current directory - f = Bstrrchr(fn, '/'); - if (!f) - f = fn; - else - f++; - } - - fixspritesectors(); //Do this before saving! - updatesector(startposx,startposy,&startsectnum); - ExtPreSaveMap(); - ret = saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum); - if ((flags&1)==0) - ExtSaveMap(f); - - if (!ret) - return f; - else - return NULL; -} - -// flags: 1: for running on Mapster32 init -// 4: passed to loadboard flags (no polymer_loadboard); implies no maphack loading -int32_t LoadBoard(const char *filename, uint32_t flags) -{ - int32_t i; - - if (!filename) - filename = selectedboardfilename; - - if (filename != boardfilename) - Bstrcpy(boardfilename, filename); - - if ((flags&1)==0) - { - highlightcnt = -1; - Bmemset(show2dwall, 0, sizeof(show2dwall)); //Clear all highlights - Bmemset(show2dsprite, 0, sizeof(show2dsprite)); - - newnumwalls = -1; - } - -/// sectorhighlightstat = -1; -/// joinsector[0] = -1; -/// circlewall = -1; -/// circlepoints = 7; - - for (i=0; i=0 && wall[closest].nextwall >= 0) - { - //if red line, allow highlighting of both sides - x1 = wall[closest].x; - y1 = wall[closest].y; - x2 = POINT2(closest).x; - y2 = POINT2(closest).y; - if (dmulscale32(xplc-x1,y2-y1,-(x2-x1),yplc-y1) >= 0) - closest = wall[closest].nextwall; - } - - return(closest); -} - -int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point) -{ - int32_t i, j, dst, dist = 512, closest = -1; - int32_t dax,day; - - if (numwalls == 0) - return(-1); - - if (mouseb & 1) - return point; - - if (grid < 1) - dist = 0; - - for (i=0; i= xdim || midydim16+day < 0 || midydim16+day >= ydim) - continue; - - dst = klabs(halfxdim16+dax-searchx) + klabs(midydim16+day-searchy); - } - - if (dst <= dist) - { - // prefer white walls - if (dst=0)-(wall[closest].nextwall>=0) <= 0) - dist = dst, closest = j; - } - } - - if (zoom >= 256) - for (i=0; i= xdim || midydim16+day < 0 || midydim16+day >= ydim) - continue; - - dst = klabs(halfxdim16+dax-searchx) + klabs(midydim16+day-searchy); - } - - // was (dst <= dist), but this way, when duplicating sprites, - // the selected ones are dragged first - if (dst < dist || (dst == dist && (show2dsprite[i>>3]&(1<<(i&7))))) - dist = dst, closest = i+16384; - } - - return(closest); -} - -static void locktogrid(int32_t *dax, int32_t *day) -{ - *dax = ((*dax+(1024>>grid))&(0xffffffff<<(11-grid))); - *day = ((*day+(1024>>grid))&(0xffffffff<<(11-grid))); -} - -static int32_t adjustmark(int32_t *xplc, int32_t *yplc, int16_t danumwalls) -{ - int32_t i, dst, dist, dax, day, pointlockdist; - - if (danumwalls < 0) - danumwalls = numwalls; - - pointlockdist = 0; - if (grid > 0 && gridlock) - pointlockdist = (128>>grid); - - dist = pointlockdist; - dax = *xplc; - day = *yplc; - - for (i=0; i 0) - locktogrid(&dax, &day); - - *xplc = dax; - *yplc = day; - - return(0); -} - -static int32_t checkautoinsert(int32_t dax, int32_t day, int16_t danumwalls) -{ - int32_t i, x1, y1, x2, y2; - - if (danumwalls < 0) - danumwalls = numwalls; - - for (i=0; i= y2 && y1 <= y0) return(0); - if (y1 >= y0 && y1 <= y2) return(1); - - tempint = (x0-x1)*(y2-y1) - (x2-x1)*(y0-y1); - if (tempint < 0) - return(0); - else - return(1); -} - -static void flipwalls(int16_t numwalls, int16_t newnumwalls) -{ - int32_t i, j, nume, tempint; - - nume = newnumwalls-numwalls; - - for (i=numwalls; i>1); i++) - { - j = numwalls+newnumwalls-i-1; - tempint = wall[i].x; wall[i].x = wall[j].x; wall[j].x = tempint; - tempint = wall[i].y; wall[i].y = wall[j].y; wall[j].y = tempint; - } -} - -static void insertpoint(int16_t linehighlight, int32_t dax, int32_t day) -{ - int16_t sucksect; - int32_t i, j, k; - uint32_t templenrepquot; - - j = linehighlight; - sucksect = sectorofwall(j); - templenrepquot = divscale12(wallength(j), wall[j].xrepeat); - templenrepquot = max(1, templenrepquot); - - sector[sucksect].wallnum++; - for (i=sucksect+1; i= 0) - { - k = wall[j].nextwall; - - sucksect = sectorofwall(k); - - sector[sucksect].wallnum++; - for (i=sucksect+1; i= 0) - { - NEXTWALL(j).nextwall = -1; - NEXTWALL(j).nextsector = -1; - } - if (wall[point].nextwall >= 0) - { - NEXTWALL(point).nextwall = -1; - NEXTWALL(point).nextsector = -1; - } - - movewalls(point, -1); - - checksectorpointer(j, sucksect); -} - -static int32_t deletesector(int16_t sucksect) -{ - int32_t i, j, k, nextk, startwall, endwall; - - while (headspritesect[sucksect] >= 0) - deletesprite(headspritesect[sucksect]); - updatenumsprites(); - - startwall = sector[sucksect].wallptr; - endwall = startwall + sector[sucksect].wallnum - 1; - j = sector[sucksect].wallnum; - - for (i=sucksect; i= 0) - { - NEXTWALL(i).nextwall = -1; - NEXTWALL(i).nextsector = -1; - } - - movewalls(startwall, -j); - for (i=0; i= startwall) - wall[i].nextsector--; - - return(0); -} - -void fixspritesectors(void) -{ - int32_t i, j, dax, day, daz; - - for (i=numsectors-1; i>=0; i--) - if (sector[i].wallnum <= 0 || sector[i].wallptr >= numwalls) - deletesector(i); - - for (i=0; i= getceilzofslope(j,dax,day) - && sprite[i].z-daz <= getflorzofslope(j,dax,day)) - { - changespritesect(i, j); - break; - } - } - } -} - -static int32_t movewalls(int32_t start, int32_t offs) -{ - int32_t i; - - if (offs < 0) //Delete - { - for (i=start; i 0) //Insert - { - for (i=numwalls+offs-1; i>=start+offs; i--) - Bmemcpy(&wall[i], &wall[i-offs], sizeof(walltype)); - } - - numwalls += offs; - for (i=0; i= start) wall[i].nextwall += offs; - if (wall[i].point2 >= start) wall[i].point2 += offs; - } - - return(0); -} - -int32_t wallength(int16_t i) -{ - int64_t dax = POINT2(i).x - wall[i].x; - int64_t day = POINT2(i).y - wall[i].y; -#if 1 //def POLYMOST - int64_t hypsq = dax*dax + day*day; - if (hypsq > (int64_t)INT_MAX) - return (int32_t)sqrt((double)hypsq); - else - return ksqrt((int32_t)hypsq); -#else - return ksqrt(dax*dax + day*day); -#endif -} - -void fixrepeats(int16_t i) -{ - int32_t dist = wallength(i); - int32_t day = wall[i].yrepeat; - - wall[i].xrepeat = clamp(mulscale10(dist,day), 1, 255); -} - -void fixxrepeat(int16_t i, uint32_t lenrepquot) // lenrepquot: divscale12(wallength,xrepeat) -{ - if (lenrepquot != 0) - wall[i].xrepeat = clamp(divscale12(wallength(i), lenrepquot), 1, 255); -} - - -int32_t overridepm16y = -1; - -void clearmidstatbar16(void) -{ - int32_t y = overridepm16y<0 ? STATUS2DSIZ : overridepm16y; - - begindrawing(); -// ydim16 = ydim; - - // clearbuf((char *)(frameplace + (bytesperline*(ydim-STATUS2DSIZ+25L))),(bytesperline*(STATUS2DSIZ-1-(25<<1))) >> 2, 0x08080808l); - - CLEARLINES2D(ydim-y+25, STATUS2DSIZ+2-(25<<1), 0); - -// drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,editorcolors[7]); -// drawline16base(xdim,ydim, -1,-STATUS2DSIZ, -1,-1, editorcolors[7]); - - ydim16 = ydim-STATUS2DSIZ2; - enddrawing(); -} - -static void clearministatbar16(void) -{ - int32_t i, col = whitecol - 21; -// static const char *tempbuf = "Mapster32" " " VERSION; - char tempbuf[16]; - - begindrawing(); - - for (i=ydim-STATUS2DSIZ2; i= x || x2 >= x) - { - y1 = wall[i].y; - y2 = POINT2(i).y; - - if (y1 > y2) - { - swaplong(&x1, &x2); - swaplong(&y1, &y2); - } - if (y1 <= y && y2 > y) - if (x1*(y-y2)+x2*(y1-y) <= x*(y1-y2)) - cnt ^= 1; - } - i = wall[i].point2; - } - while (i != startwall); - - return(cnt); -} - -#if 0 -static int32_t numloopsofsector(int16_t sectnum) -{ - int32_t i, numloops, startwall, endwall; - - numloops = 0; - startwall = sector[sectnum].wallptr; - endwall = startwall + sector[sectnum].wallnum; - for (i=startwall; i= '0' && ch <= '9') - { - int64_t nbig; - if (danum >= 0) - { - nbig = ((int64_t)danum*10)+(ch-'0'); - if (nbig <= (int64_t)maxnumber) danum = nbig; - } - else if (sign) // this extra check isn't hurting anything - { - nbig = ((int64_t)danum*10)-(ch-'0'); - if (nbig >= (int64_t)-maxnumber) danum = nbig; - } - } - else if (ch == 8 || ch == 127) // backspace - { - danum /= 10; - } - else if (ch == 13) - { - oldnum = danum; - asksave = 1; - printmessage16("%s", buffer); - break; - } - else if (ch == '-' && sign) // negate - { - danum = -danum; - } - } - clearkeys(); - return(oldnum); -} - -int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t)) -{ - char buffer[80], ch; - int32_t danum, oldnum; - - danum = num; - oldnum = danum; - bflushchars(); - while (keystatus[0x1] == 0) - { - if (handleevents()) - quitevent = 0; - - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif - - ch = bgetchar(); - - if (keystatus[0x1]) break; - - clearkeys(); - - mouseb = 0; - searchx = osearchx; - searchy = osearchy; - - ExtCheckKeys(); - - Bsprintf(buffer,"%s%d",namestart,danum); - if (totalclock & 32) Bstrcat(buffer,"_ "); - printmessage256(0, 0, buffer); - if (func != NULL) - { - Bsprintf(buffer,"%s",(char *)func((int32_t)danum)); - printmessage256(0, 9, buffer); - } - - showframe(1); - - if (ch >= '0' && ch <= '9') - { - int64_t nbig; - if (danum >= 0) - { - nbig = ((int64_t)danum*10)+(ch-'0'); - if (nbig <= (int64_t)maxnumber) danum = nbig; - } - else if (sign) - { - nbig = ((int64_t)danum*10)-(ch-'0'); - if (nbig >= (int64_t)-maxnumber) danum = nbig; - } - } - else if (ch == 8 || ch == 127) // backspace - { - danum /= 10; - } - else if (ch == 13) - { - oldnum = danum; - asksave = 1; - break; - } - else if (ch == '-' && sign) // negate - { - danum = -danum; - } - } - clearkeys(); - - lockclock = totalclock; //Reset timing - - return(oldnum); -} - -// querystr: e.g. "Name: ", must be !=NULL -// defaultstr: can be NULL -// NO overflow checks are done when copying them! -// maxlen: maximum length of entry string, if ==1, enter single char -const char *getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen) -{ - static char buf[128]; - int32_t ei=0, qrylen=0; - char ch; - - bflushchars(); - clearkeys(); - - if (maxlen==0) - maxlen = 1000; - - Bmemset(buf, 0, sizeof(buf)); - - qrylen = Bstrlen(querystr); - Bmemcpy(buf, querystr, qrylen); - - ei = qrylen; - - if (defaultstr) - { - int32_t deflen = Bstrlen(defaultstr); - Bmemcpy(&buf[ei], defaultstr, deflen); - ei += deflen; - } - - buf[ei] = 0; - - if (maxlen==1) - { - ei = qrylen; - buf[ei] = '_'; - buf[ei+1] = 0; - } - - while (1) - { - printext256(0, 0, whitecol, 0, buf, 0); - showframe(1); - - if (handleevents()) - quitevent = 0; - - idle_waitevent(); - - ch = bgetchar(); - - if (ch==13) - { - if (maxlen != 1) - buf[ei] = 0; - break; - } - else if (keystatus[1]) - { - clearkeys(); - return defaultstr; - } - - if (maxlen!=1) - { - if (ei>qrylen && (ch==8 || ch==127)) - { - buf[ei] = ' '; - buf[--ei] = '_'; - } - else if ((unsigned)einext) numdirs++; - for (r = findfiles; r; r=r->next) numfiles++; - - finddirshigh = finddirs; - findfileshigh = findfiles; - currentlist = 0; - if (findfileshigh) currentlist = 1; - - return(0); -} - -// vvv PK ------------------------------------ -// copied off menuselect - -static const char *g_oldpath=NULL; -static int32_t menuselect_auto(int32_t direction) // 20080104: jump to next (direction!=0) or prev (direction==0) file -{ - const char *boardbasename; - - if (!g_oldpath) - return -3; // not inited - else - Bmemcpy(selectedboardfilename, g_oldpath, BMAX_PATH); - - if (pathsearchmode) - Bcanonicalisefilename(selectedboardfilename, 1); // clips off the last token and compresses relative path - else - Bcorrectfilename(selectedboardfilename, 1); - - getfilenames(selectedboardfilename, "*.map"); - if (numfiles==0) - return -2; - - boardbasename = Bstrrchr(boardfilename,'/'); // PK - if (!boardbasename) - boardbasename=boardfilename; - else - boardbasename++; - - for (; findfileshigh; findfileshigh=findfileshigh->next) - if (!Bstrcmp(findfileshigh->name,boardbasename)) - break; - - if (!findfileshigh) - findfileshigh=findfiles; - - if (direction) - { - if (findfileshigh->next) - findfileshigh=findfileshigh->next; - else - return -1; - } - else - { - if (findfileshigh->prev) - findfileshigh=findfileshigh->prev; - else - return -1; - } - - Bstrcat(selectedboardfilename, findfileshigh->name); - - return(0); -} -// ^^^ PK ------------------------------------ - -static int32_t menuselect(void) -{ - int32_t listsize; - int32_t i; - char ch, buffer[96], /*PK*/ *boardbasename; - static char oldpath[BMAX_PATH]; - CACHE1D_FIND_REC *dir; - int32_t bakpathsearchmode = pathsearchmode; - - g_oldpath=oldpath; //PK: need it in menuselect_auto - - Bstrcpy(selectedboardfilename, oldpath); - if (pathsearchmode) - Bcanonicalisefilename(selectedboardfilename, 1); // clips off the last token and compresses relative path - else - Bcorrectfilename(selectedboardfilename, 1); - - getfilenames(selectedboardfilename, "*.map"); - - // PK 20080103: start with last selected map - boardbasename = Bstrrchr(boardfilename,'/'); - if (!boardbasename) - boardbasename=boardfilename; - else - boardbasename++; - - for (; findfileshigh; findfileshigh=findfileshigh->next) - if (!Bstrcmp(findfileshigh->name,boardbasename)) - break; - - if (!findfileshigh) - findfileshigh=findfiles; - - _printmessage16("Select map file with arrow keys and enter."); - - ydim16 = ydim-STATUS2DSIZ2; - listsize = (ydim16-32)/9; - - do - { - begindrawing(); //{{{ - - CLEARLINES2D(0, ydim16, 0); - - if (pathsearchmode) - Bstrcpy(buffer,"Local filesystem mode. Ctrl-F: game filesystem"); - else - Bsprintf(buffer,"Game filesystem %smode. Ctrl-F: local filesystem, Ctrl-G: %s", - grponlymode?"GRP-only ":"", grponlymode?"all files":"GRP contents only"); - - printext16(halfxdim16-(8*Bstrlen(buffer)/2), 4, editorcolors[12],editorcolors[0],buffer,0); - - Bsnprintf(buffer,sizeof(buffer)-1,"(%d dirs, %d files) %s",numdirs,numfiles,selectedboardfilename); - buffer[sizeof(buffer)-1] = 0; - - printext16(8,ydim16-8-1,editorcolors[8],editorcolors[0],buffer,0); - - if (finddirshigh) - { - dir = finddirshigh; - for (i=(listsize/2)-1; i>=0; i--) - { - if (!dir->prev) break; - else dir=dir->prev; - } - for (i=0; ((inext) - { - int32_t c = (dir->type == CACHE1D_FIND_DIR ? 2 : 3); //PK - Bmemset(buffer,0,sizeof(buffer)); - Bstrncpy(buffer,dir->name,25); - if (Bstrlen(buffer) == 25) - buffer[21] = buffer[22] = buffer[23] = '.', buffer[24] = 0; - if (dir == finddirshigh) - { - if (currentlist == 0) printext16(8,16+9*i,editorcolors[c|8],editorcolors[0],"->",0); - printext16(32,16+9*i,editorcolors[c|8],editorcolors[0],buffer,0); - } - else - { - printext16(32,16+9*i,editorcolors[c],editorcolors[0],buffer,0); - } - } - } - - if (findfileshigh) - { - dir = findfileshigh; - for (i=(listsize/2)-1; i>=0; i--) - { - if (!dir->prev) break; - else dir=dir->prev; - } - for (i=0; ((inext) - { - if (dir == findfileshigh) - { - if (currentlist == 1) printext16(240,16+9*i,editorcolors[7|8],editorcolors[0],"->",0); - printext16(240+24,16+9*i,editorcolors[7|8],editorcolors[0],dir->name,0); - } - else - { - printext16(240+24,16+9*i,editorcolors[7],editorcolors[0],dir->name,0); - } - } - } - - enddrawing(); //}}} - showframe(1); - - keystatus[0xcb] = 0; - keystatus[0xcd] = 0; - keystatus[0xc8] = 0; - keystatus[0xd0] = 0; - keystatus[0x1c] = 0; //enter - keystatus[0xf] = 0; //tab - keystatus[1] = 0; //esc - ch = 0; //Interesting fakery of ch = getch() - while (ch == 0) - { - if (handleevents()) - if (quitevent) - { - keystatus[1] = 1; - quitevent = 0; - } - - idle(); - - ch = bgetchar(); - - { - // JBF 20040208: seek to first name matching pressed character - CACHE1D_FIND_REC *seeker = currentlist ? findfiles : finddirs; - if (keystatus[0xc7]||keystatus[0xcf]) // home/end - { - while (keystatus[0xcf]?seeker->next:seeker->prev) - seeker = keystatus[0xcf]?seeker->next:seeker->prev; - if (seeker) - { - if (currentlist) findfileshigh = seeker; - else finddirshigh = seeker; - } - ch = keystatus[0xcf]?80:72; - keystatus[0xc7] = keystatus[0xcf] = 0; - } - else if (keystatus[0xc9]|keystatus[0xd1]) // page up/down - { - seeker = currentlist?findfileshigh:finddirshigh; - i = (ydim2d-STATUS2DSIZ2-48)>>5/*3*/; //PK - - while (i>0) - { - if (keystatus[0xd1]?seeker->next:seeker->prev) - seeker = keystatus[0xd1]?seeker->next:seeker->prev; - i--; - } - if (seeker) - { - if (currentlist) findfileshigh = seeker; - else finddirshigh = seeker; - } - ch = keystatus[0xd1]?80:72; - keystatus[0xc9] = keystatus[0xd1] = 0; - } - else - { - char ch2; - if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || - (ch >= '0' && ch <= '9') || (ch=='_'))) - { -#ifdef _WIN32 - if (ch >= 'a') ch -= ('a'-'A'); -#endif - while (seeker) - { - ch2 = seeker->name[0]; -#ifdef _WIN32 - if (ch2 >= 'a' && ch2 <= 'z') ch2 -= ('a'-'A'); -#endif - if (ch2 == ch) break; - seeker = seeker->next; - } - if (seeker) - { - if (currentlist) findfileshigh = seeker; - else finddirshigh = seeker; - continue; - } - } - } - } - if (keystatus[0xcb]) ch = 9; // left arr - if (keystatus[0xcd]) ch = 9; // right arr - if (keystatus[0xc8]) ch = 72; // up arr - if (keystatus[0xd0]) ch = 80; // down arr - } - - if (ch==6) // Ctrl-F - { - currentlist = 0; - pathsearchmode = 1-pathsearchmode; - if (pathsearchmode) - { - Bstrcpy(selectedboardfilename, ""); - Bcanonicalisefilename(selectedboardfilename, 0); - } - else Bstrcpy(selectedboardfilename, "/"); - - getfilenames(selectedboardfilename, "*.map"); - Bstrcpy(oldpath,selectedboardfilename); - } - else if (ch==7) // Ctrl-G - { - if (!pathsearchmode) - { - grponlymode = 1-grponlymode; - getfilenames(selectedboardfilename, "*.map"); - Bstrcpy(oldpath,selectedboardfilename); - } - } - else if (ch == 9) - { - if ((currentlist == 0 && findfiles) || (currentlist == 1 && finddirs)) - currentlist = 1-currentlist; - } - else if (keystatus[0xc8] /*(ch == 75) || (ch == 72)*/) - { - if (currentlist == 0) - { - if (finddirshigh && finddirshigh->prev) - finddirshigh = finddirshigh->prev; - } - else - { - if (findfileshigh && findfileshigh->prev) - findfileshigh = findfileshigh->prev; - } - } - else if (keystatus[0xd0] /*(ch == 77) || (ch == 80)*/) - { - if (currentlist == 0) - { - if (finddirshigh && finddirshigh->next) - finddirshigh = finddirshigh->next; - } - else - { - if (findfileshigh && findfileshigh->next) - findfileshigh = findfileshigh->next; - } - } - else if ((ch == 13) && (currentlist == 0)) - { - if (finddirshigh->type == CACHE1D_FIND_DRIVE) - Bstrcpy(selectedboardfilename, finddirshigh->name); - else - Bstrcat(selectedboardfilename, finddirshigh->name); - - Bstrcat(selectedboardfilename, "/"); - - if (pathsearchmode) - Bcanonicalisefilename(selectedboardfilename, 1); - else - Bcorrectfilename(selectedboardfilename, 1); - - Bstrcpy(oldpath,selectedboardfilename); - //printf("Changing directories to: %s\n", selectedboardfilename); - - getfilenames(selectedboardfilename, "*.map"); - ch = 0; - - begindrawing(); - CLEARLINES2D(0, ydim16, 0); - enddrawing(); - showframe(1); - } - - if (ch == 13 && !findfileshigh) ch = 0; - } - while ((ch != 13) && (ch != 27)); - - if (ch == 13) - { - Bstrcat(selectedboardfilename, findfileshigh->name); - //printf("Selected file: %s\n", selectedboardfilename); - - return(0); - } - - pathsearchmode = bakpathsearchmode; - - return(-1); -} - -static int32_t fillsectorxy[MAXWALLS][2]; - -int32_t fillsector(int16_t sectnum, char fillcolor) -{ - int32_t x1, x2, y1, y2, sy, y; - int32_t lborder, rborder, uborder, dborder, miny, maxy, dax; - int16_t z, zz, startwall, endwall, fillcnt; - - UNREFERENCED_PARAMETER(fillcolor); - - lborder = 0; rborder = xdim; - uborder = 0; dborder = ydim16; - - if (sectnum == -1) - return 0; - - miny = dborder-1; - maxy = uborder; - - startwall = sector[sectnum].wallptr; - endwall = startwall + sector[sectnum].wallnum - 1; - for (z=startwall; z<=endwall; z++) - { - screencoords(&x1,&y1, wall[z].x-pos.x,wall[z].y-pos.y, zoom); - if (m32_sideview) - y1 += getscreenvdisp(getflorzofslope(sectnum,wall[z].x,wall[z].y)-pos.z, zoom); - - x1 += halfxdim16; - y1 += midydim16; - - if (m32_sideview) - { - fillsectorxy[z][0] = x1; - fillsectorxy[z][1] = y1; - } - - miny = min(miny, y1); - maxy = max(maxy, y1); - } - - if (miny < uborder) miny = uborder; - if (maxy >= dborder) maxy = dborder-1; - -//+((totalclock>>2)&3) - for (sy=miny; sy<=maxy; sy+=3) // JBF 20040116: numframes%3 -> (totalclock>>2)&3 - { - y = pos.y + ((sy-midydim16)<<14)/zoom; - - fillist[0] = lborder; fillcnt = 1; - for (z=startwall; z<=endwall; z++) - { - if (m32_sideview) - { - x1 = fillsectorxy[z][0]; - y1 = fillsectorxy[z][1]; - x2 = fillsectorxy[wall[z].point2][0]; - y2 = fillsectorxy[wall[z].point2][1]; - - if (y1 > y2) - { - swaplong(&x1, &x2); - swaplong(&y1, &y2); - } - - if (y1 <= sy && sy < y2) - { - if (fillcnt == sizeof(fillist)/sizeof(fillist[0])) - break; - - x1 += scale(sy-y1, x2-x1, y2-y1); - fillist[fillcnt++] = x1; - } - } - else - { - x1 = wall[z].x; x2 = POINT2(z).x; - y1 = wall[z].y; y2 = POINT2(z).y; - - if (y1 > y2) - { - swaplong(&x1, &x2); - swaplong(&y1, &y2); - } - - if (y1 <= y && y < y2) - //if (x1*(y-y2) + x2*(y1-y) <= 0) - { - dax = x1 + scale(y-y1, x2-x1, y2-y1); - dax = halfxdim16 + (((dax-pos.x)*zoom)>>14); - if (dax >= lborder) - { - if (fillcnt == sizeof(fillist)/sizeof(fillist[0])) - break; - - fillist[fillcnt++] = dax; - } - } - } - } - - if (fillcnt > 0) - { - for (z=1; z rborder) - break; - if (fillist[z+1] > rborder) - fillist[z+1] = rborder; - - drawline16(fillist[z],sy, fillist[z+1],sy, 159 //editorcolors[fillcolor] - -klabs(sintable[((totalclock<<3)&2047)]>>11)); - } - } - } - - return(0); -} - -static int16_t whitelinescan(int16_t dalinehighlight) -{ - int32_t i, j, k; - int16_t sucksect, tnewnumwalls; - - sucksect = sectorofwall(dalinehighlight); - - if (numsectors >= MAXSECTORS) - return MAXWALLS+1; - - Bmemcpy(§or[numsectors], §or[sucksect], sizeof(sectortype)); - sector[numsectors].wallptr = numwalls; - sector[numsectors].wallnum = 0; - - i = dalinehighlight; - tnewnumwalls = numwalls; - do - { - if (tnewnumwalls >= MAXWALLS) - return MAXWALLS+1; - - j = lastwall(i); - if (wall[j].nextwall >= 0) - { - j = wall[j].point2; - for (k=0; k= 1) - { - if (a > 1) - if (buffer[a-2] == '\r') buffer[a-2] = 0; - if (buffer[a-1] == '\n') buffer[a-1] = 0; - } - - p = buffer; - line++; - while (*p == 32) p++; - if (*p == 0) continue; // blank line - - if (*p == '#' && !comment) - { - p++; - while (*p == 32) p++; - if (*p == 0) continue; // null directive - - if (!Bstrncmp(p, "define ", 7)) - { - // #define_... - p += 7; - while (*p == 32) p++; - if (*p == 0) - { - initprintf("Error: Malformed #define at line %d\n", line-1); - continue; - } - - name = p; - while (*p != 32 && *p != 0) p++; - if (*p == 32) - { - *(p++) = 0; - while (*p == 32) p++; - if (*p == 0) // #define_NAME with no number - { - initprintf("Error: No number given for name \"%s\" (line %d)\n", name, line-1); - continue; - } - - number = p; - while (*p != 0) p++; - if (*p != 0) *p = 0; - - // add to list - num = Bstrtol(number, &endptr, 10); - if (*endptr != 0) - { - p = endptr; - goto badline; - } - //printf("Grokked \"%s\" -> \"%d\"\n", name, num); - if (num < 0 || num >= MAXTILES) - { - initprintf("Error: Constant %d for name \"%s\" out of range (line %d)\n", num, name, line-1); - continue; - } - - if (Bstrlen(name) > 24) - initprintf("Warning: Name \"%s\" longer than 24 characters (line %d). Truncating.\n", name, line-1); - - Bstrncpy(names[num], name, 24); - names[num][24] = 0; - - syms++; - - continue; - - } - else // #define_NAME with no number - { - initprintf("Error: No number given for name \"%s\" (line %d)\n", name, line-1); - continue; - } - } - else goto badline; - } - else if (*p == '/') - { - if (*(p+1) == '*') {comment++; continue;} - if (*(p+1) == '/') continue; // comment - } - else if (*p == '*' && p[1] == '/') - { - comment--; continue; - } - else if (comment)continue; -badline: - initprintf("Error: Invalid statement found at character %d on line %d\n", (int32_t)(p-buffer), line-1); - } - initprintf("Read %d lines, loaded %d names.\n", line, syms); - - Bfclose(fp); - return 0; -} - -void printcoords16(int32_t posxe, int32_t posye, int16_t ange) -{ - char snotbuf[80]; - int32_t i, m; - int32_t v8 = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7); - - Bsprintf(snotbuf,"x:%d y:%d ang:%d r%d",posxe,posye,ange,map_revision-1); - i = 0; - while ((snotbuf[i] != 0) && (i < 33)) - i++; - while (i < 33) - { - snotbuf[i] = 32; - i++; - } - snotbuf[33] = 0; - - clearministatbar16(); - - printext16(8, ydim-STATUS2DSIZ+128, whitecol, -1, snotbuf,0); - - if (highlightcnt<=0 && highlightsectorcnt<=0) - { - Bsprintf(snotbuf,"%d/%d sect. %d/%d walls %d/%d spri.", - numsectors, v8?MAXSECTORSV8:MAXSECTORSV7, - numwalls, v8?MAXWALLSV8:MAXWALLSV7, - numsprites, v8?MAXSPRITESV8:MAXSPRITESV7); - } - else - { - if (highlightcnt>0) - { - m = 0; - for (i=0; i0) - Bsprintf(snotbuf, "%d sectors selected", highlightsectorcnt); - else - snotbuf[0] = 0; - - v8 = 1; - } - - m = xdim/8 - 264/8; - m = clamp(m, 1, (signed)sizeof(snotbuf)-1); - - i = 0; - while (snotbuf[i] && i < m) - i++; - while (i < m) - { - snotbuf[i] = 32; - i++; - } - snotbuf[m] = 0; - - printext16(264, ydim-STATUS2DSIZ+128, v8?editorcolors[10]:whitecol, -1, snotbuf,0); -} - -void updatenumsprites(void) -{ - int32_t i; - - numsprites = 0; - for (i=0; i= 0) - { - k = wall[newnumwalls].nextsector; - if (oldtonewsect && oldtonewsect[k]>=0) - { - wall[newnumwalls].nextsector = oldtonewsect[k]; - m = 0; - for (i=0; i= 0) - // checksectorpointer(wall[j].nextwall,wall[j].nextsector); - // checksectorpointer((short)j,destsector); - //} - - if (newnumwalls > deststartwall) - { - //duplicate sectors - Bmemcpy(§or[destsector],§or[soursector],sizeof(sectortype)); - sector[destsector].wallptr = deststartwall; - sector[destsector].wallnum = newnumwalls-deststartwall; - - if (copystat == 1) - { - //duplicate sprites - j = headspritesect[soursector]; - while (j >= 0) - { - m = insertsprite(destsector,sprite[j].statnum); - if (m<0) - { - message("Some sprites not duplicated because limit was reached."); - break; - } - - Bmemcpy(&sprite[m],&sprite[j],sizeof(spritetype)); - sprite[m].sectnum = destsector; //Don't let memcpy overwrite sector! - - j = nextspritesect[j]; - } - } - } -} - -#define DOPRINT(Yofs, fmt, ...) \ - Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \ - printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0); - -void showsectordata(int16_t sectnum, int16_t small) -{ - sectortype *sec; - char snotbuf[80]; - int32_t col=0; //,row = 0; - int32_t color = small ? whitecol : editorcolors[11]; - - sec = §or[sectnum]; - - if (small) - { - _printmessage16("^10Sector %d %s ^O(F7 to edit)", sectnum, ExtGetSectorCaption(sectnum)); - return; - } - - DOPRINT(32, "^10Sector %d", sectnum); - DOPRINT(48, "Firstwall: %d", sec->wallptr); - DOPRINT(56, "Numberofwalls: %d", sec->wallnum); - DOPRINT(64, "Firstsprite: %d", headspritesect[sectnum]); - DOPRINT(72, "Tags: %d, %d", sec->hitag, sec->lotag); - DOPRINT(80, " (0x%x), (0x%x)", sec->hitag, sec->lotag); - DOPRINT(88, "Extra: %d", sec->extra); - DOPRINT(96, "Visibility: %d", sec->visibility); - DOPRINT(104, "Pixel height: %d", (sec->floorz-sec->ceilingz)>>8); - - col++; - - DOPRINT(32, "^10CEILING:^O"); - DOPRINT(48, "Flags (hex): %x", sec->ceilingstat); - DOPRINT(56, "(X,Y)pan: %d, %d", sec->ceilingxpanning, sec->ceilingypanning); - DOPRINT(64, "Shade byte: %d", sec->ceilingshade); - DOPRINT(72, "Z-coordinate: %d", sec->ceilingz); - DOPRINT(80, "Tile number: %d", sec->ceilingpicnum); - DOPRINT(88, "Ceiling heinum: %d", sec->ceilingheinum); - DOPRINT(96, "Palookup number: %d", sec->ceilingpal); - - col++; - - DOPRINT(32, "^10FLOOR:^O"); - DOPRINT(48, "Flags (hex): %x", sec->floorstat); - DOPRINT(56, "(X,Y)pan: %d, %d", sec->floorxpanning, sec->floorypanning); - DOPRINT(64, "Shade byte: %d", sec->floorshade); - DOPRINT(72, "Z-coordinate: %d", sec->floorz); - DOPRINT(80, "Tile number: %d", sec->floorpicnum); - DOPRINT(88, "Floor heinum: %d", sec->floorheinum); - DOPRINT(96, "Palookup number: %d", sec->floorpal); -} - -void showwalldata(int16_t wallnum, int16_t small) -{ - walltype *wal; - int32_t sec; - char snotbuf[80]; - int32_t col=0; //, row = 0; - int32_t color = small ? whitecol : editorcolors[11]; - - wal = &wall[wallnum]; - - if (small) - { - _printmessage16("^10Wall %d %s ^O(F8 to edit)", wallnum, ExtGetWallCaption(wallnum)); - return; - } - - DOPRINT(32, "^10Wall %d", wallnum); - DOPRINT(48, "X-coordinate: %d", wal->x); - DOPRINT(56, "Y-coordinate: %d", wal->y); - DOPRINT(64, "Point2: %d", wal->point2); - DOPRINT(72, "Sector: ^010%d", sectorofwall(wallnum)); - - DOPRINT(88, "Tags: %d, %d", wal->hitag, wal->lotag); - DOPRINT(96, " (0x%x), (0x%x)", wal->hitag, wal->lotag); - - col++; - - DOPRINT(32, "^10%s^O", (wal->picnum>=0 && wal->picnumpicnum] : "!INVALID!"); - DOPRINT(48, "Flags (hex): %x", wal->cstat); - DOPRINT(56, "Shade: %d", wal->shade); - DOPRINT(64, "Pal: %d", wal->pal); - DOPRINT(72, "(X,Y)repeat: %d, %d", wal->xrepeat, wal->yrepeat); - DOPRINT(80, "(X,Y)pan: %d, %d", wal->xpanning, wal->ypanning); - DOPRINT(88, "Tile number: %d", wal->picnum); - DOPRINT(96, "OverTile number: %d", wal->overpicnum); - - col++; - - DOPRINT(48-(small?16:0), "nextsector: %d", wal->nextsector); - DOPRINT(56-(small?16:0), "nextwall: %d", wal->nextwall); - - DOPRINT(72-(small?16:0), "Extra: %d", wal->extra); - - // TX 20050102 I'm not sure what unit dist<<4 is supposed to be, but dist itself is correct in terms of game coordinates as one would expect - DOPRINT(96-(small?16:0), "Wall length: %d", wallength(wallnum)); - - sec = sectorofwall(wallnum); - DOPRINT(104-(small?16:0), "Pixel height: %d", (sector[sec].floorz-sector[sec].ceilingz)>>8); -} - -void showspritedata(int16_t spritenum, int16_t small) -{ - spritetype *spr; - char snotbuf[80]; - int32_t col=0; //, row = 0; - int32_t color = small ? whitecol : editorcolors[11]; - - spr = &sprite[spritenum]; - - if (small) - { - _printmessage16("^10Sprite %d %s ^O(F8 to edit)",spritenum, ExtGetSpriteCaption(spritenum)); - return; - } - - DOPRINT(32, "^10Sprite %d", spritenum); - DOPRINT(48, "X-coordinate: %d", spr->x); - DOPRINT(56, "Y-coordinate: %d", spr->y); - DOPRINT(64, "Z-coordinate: %d", spr->z); - - DOPRINT(72, "Sectnum: ^010%d", spr->sectnum); - DOPRINT(80, "Statnum: %d", spr->statnum); - - DOPRINT(96, "Tags: %d, %d", spr->hitag, spr->lotag); - DOPRINT(104, " (0x%x), (0x%x)", spr->hitag, spr->lotag); - - col++; - - DOPRINT(32, "^10%s^O", (spr->picnum>=0 && spr->picnumpicnum] : "!INVALID!"); - DOPRINT(48, "Flags (hex): %x", spr->cstat); - DOPRINT(56, "Shade: %d", spr->shade); - DOPRINT(64, "Pal: %d", spr->pal); - DOPRINT(72, "(X,Y)repeat: %d, %d", spr->xrepeat, spr->yrepeat); - DOPRINT(80, "(X,Y)offset: %d, %d", spr->xoffset, spr->yoffset); - DOPRINT(88, "Tile number: %d", spr->picnum); - - col++; - - DOPRINT(48, "Angle (2048 degrees): %d", spr->ang); - DOPRINT(56, "X-Velocity: %d", spr->xvel); - DOPRINT(64, "Y-Velocity: %d", spr->yvel); - DOPRINT(72, "Z-Velocity: %d", spr->zvel); - DOPRINT(80, "Owner: %d", spr->owner); - DOPRINT(88, "Clipdist: %d", spr->clipdist); - DOPRINT(96, "Extra: %d", spr->extra); -} - -#undef DOPRINT - -// gets called once per totalclock increment since last call -void keytimerstuff(void) -{ - if (DOWN_BK(STRAFE) == 0) - { - if (DOWN_BK(TURNLEFT)) angvel = max(angvel-pk_turnaccel, -128); - if (DOWN_BK(TURNRIGHT)) angvel = min(angvel+pk_turnaccel, 127); - } - else - { - if (DOWN_BK(TURNLEFT)) svel = min(svel+16, 255); // svel and vel aren't even chars... - if (DOWN_BK(TURNRIGHT)) svel = max(svel-16, -256); - } - if (DOWN_BK(MOVEFORWARD)) vel = min(vel+16, 255); - if (DOWN_BK(MOVEBACKWARD)) vel = max(vel-16, -256); - /* if (DOWN_BK(STRAFELEFT)) svel = min(svel+8, 127); - if (DOWN_BK(STRAFERIGHT)) svel = max(svel-8, -128); */ - - if (angvel < 0) angvel = min(angvel+pk_turndecel, 0); - if (angvel > 0) angvel = max(angvel-pk_turndecel, 0); - if (svel < 0) svel = min(svel+6, 0); - if (svel > 0) svel = max(svel-6, 0); - if (vel < 0) vel = min(vel+6, 0); - if (vel > 0) vel = max(vel-6, 0); - /* if(mlook) pos.z -= (horiz-101)*(vel/40); */ -} - -#if 0 -int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...) -{ - char tmpstr[256]; - int32_t nwritten, ofs; - va_list va; - - va_start(va, fmt); - nwritten = Bvsnprintf(tmpstr, bufsiz, fmt, va); - va_end(va); - - ofs = min(nwritten, (signed)bufsiz-1); - Bmemset(outbuf, fill, bufsiz-ofs); - - return ofs; -} -#endif - -void _printmessage16(const char *fmt, ...) -{ - int32_t i, ybase; - char snotbuf[156]; - char tmpstr[160]; - va_list va; - - va_start(va, fmt); - Bvsnprintf(tmpstr, 156, fmt, va); - va_end(va); - - i = 0; - while (tmpstr[i] && i < 146) - { - snotbuf[i] = tmpstr[i]; - i++; - } - snotbuf[i] = 0; - if (lastpm16time == totalclock) - Bstrcpy(lastpm16buf, snotbuf); - - clearministatbar16(); - -// ybase = (overridepm16y >= 0) ? ydim-overridepm16y : ydim-STATUS2DSIZ+128-8; - ybase = ydim-STATUS2DSIZ+128-8; - - printext16(/*(overridepm16y >= 0) ? 200L-24 :*/ 8, ybase+8, whitecol, -1, snotbuf, 0); -} - -void printmessage256(int32_t x, int32_t y, const char *name) -{ - char snotbuf[80]; - int32_t i; - - i = 0; - while (name[i] && i < 62) - { - snotbuf[i] = name[i]; - i++; - } - while (i < 62) - { - snotbuf[i] = 32; - i++; - } - snotbuf[62] = 0; - printext256(x+2,y+2,0,-1,snotbuf,0); - printext256(x,y,whitecol,-1,snotbuf,0); -} - -//Find closest point (*dax, *day) on wall (dawall) to (x, y) -static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny) -{ - walltype *wal; - int64_t i, j, dx, dy; - - wal = &wall[dawall]; - dx = wall[wal->point2].x - wal->x; - dy = wall[wal->point2].y - wal->y; - i = dx*(x-wal->x) + dy*(y-wal->y); - if (i <= 0) { *nx = wal->x; *ny = wal->y; return; } - j = dx*dx+dy*dy; - if (i >= j) { *nx = wal->x+dx; *ny = wal->y+dy; return; } - i=((i<<15)/j)<<15; - *nx = wal->x + ((dx*i)>>30); - *ny = wal->y + ((dy*i)>>30); -} - -static void initcrc(void) -{ - int32_t i, j, k, a; - - for (j=0; j<256; j++) //Calculate CRC table - { - k = (j<<8); a = 0; - for (i=7; i>=0; i--) - { - if (((k^a)&0x8000) > 0) - a = ((a<<1)&65535) ^ 0x1021; //0x1021 = genpoly - else - a = ((a<<1)&65535); - k = ((k<<1)&65535); - } - crctable[j] = (a&65535); - } -} - -static int32_t GetWallZPeg(int32_t nWall) -{ - int32_t z=0, nSector, nNextSector; - - nSector = sectorofwall((int16_t)nWall); - nNextSector = wall[nWall].nextsector; - if (nNextSector == -1) - { - //1-sided wall - if (wall[nWall].cstat&4) z = sector[nSector].floorz; - else z = sector[nSector].ceilingz; - } - else - { - //2-sided wall - if (wall[nWall].cstat&4) - z = sector[nSector].ceilingz; - else - { - if (sector[nNextSector].ceilingz > sector[nSector].ceilingz) - z = sector[nNextSector].ceilingz; //top step - if (sector[nNextSector].floorz < sector[nSector].floorz) - z = sector[nNextSector].floorz; //bottom step - } - } - return(z); -} - -static void AlignWalls(int32_t nWall0, int32_t z0, int32_t nWall1, int32_t z1, int32_t nTile) -{ - int32_t n; - - //do the x alignment - wall[nWall1].cstat &= ~0x0108; //Set to non-flip - wall[nWall1].xpanning = (uint8_t)((wall[nWall0].xpanning+(wall[nWall0].xrepeat<<3))%tilesizx[nTile]); - - z1 = GetWallZPeg(nWall1); - - for (n=picsiz[nTile]>>4; (1<>(n+3))); -} - -void AutoAlignWalls(int32_t nWall0, int32_t ply) -{ - int32_t z0, z1, nTile, nWall1, branch, visible, nNextSector, nSector; - - nTile = wall[nWall0].picnum; - branch = 0; - if (ply == 0) - { - //clear visited bits - Bmemset(visited, 0, sizeof(visited)); - visited[nWall0>>3] |= (1<<(nWall0&7)); - } - - z0 = GetWallZPeg(nWall0); - - nWall1 = wall[nWall0].point2; - - //loop through walls at this vertex in CCW order - while (1) - { - //break if this wall would connect us in a loop - if (visited[nWall1>>3]&(1<<(nWall1&7))) - break; - - visited[nWall1>>3] |= (1<<(nWall1&7)); - - //break if reached back of left wall - if (wall[nWall1].nextwall == nWall0) - break; - - if (wall[nWall1].picnum == nTile) - { - z1 = GetWallZPeg(nWall1); - visible = 0; - - nNextSector = wall[nWall1].nextsector; - if (nNextSector < 0) - visible = 1; - else - { - //ignore two sided walls that have no visible face - nSector = NEXTWALL(nWall1).nextsector; - if (getceilzofslope((int16_t)nSector,wall[nWall1].x,wall[nWall1].y) < - getceilzofslope((int16_t)nNextSector,wall[nWall1].x,wall[nWall1].y)) - visible = 1; - - if (getflorzofslope((int16_t)nSector,wall[nWall1].x,wall[nWall1].y) > - getflorzofslope((int16_t)nNextSector,wall[nWall1].x,wall[nWall1].y)) - visible = 1; - } - - if (visible) - { - branch++; - AlignWalls(nWall0,z0,nWall1,z1,nTile); - - //if wall was 1-sided, no need to recurse - if (wall[nWall1].nextwall < 0) - { - nWall0 = nWall1; - z0 = GetWallZPeg(nWall0); - nWall1 = wall[nWall0].point2; - branch = 0; - continue; - } - else - AutoAlignWalls(nWall1,ply+1); - } - } - - if (wall[nWall1].nextwall < 0) break; - nWall1 = NEXTWALL(nWall1).point2; - } -} - -#define PLAYTEST_MAPNAME "autosave_playtest.map" - -void test_map(int32_t mode) -{ - if (!mode) - updatesector(pos.x, pos.y, &cursectnum); - else - updatesector(startposx, startposy, &startsectnum); - - if ((!mode && cursectnum >= 0) || (mode && startsectnum >= 0)) - { - char *param = " -map " PLAYTEST_MAPNAME " -noinstancechecking"; - char *fullparam; - char current_cwd[BMAX_PATH]; - int32_t slen = 0; - BFILE *fp; - - if ((program_origcwd[0] == '\0') || !getcwd(current_cwd, BMAX_PATH)) - current_cwd[0] = '\0'; - else // Before we check if file exists, for the case there's no absolute path. - chdir(program_origcwd); - - fp = fopen(game_executable, "rb"); // File exists? - if (fp != NULL) - fclose(fp); - else - { -#ifdef _WIN32 - fullparam = Bstrrchr(mapster32_fullpath, '\\'); -#else - fullparam = Bstrrchr(mapster32_fullpath, '/'); -#endif - if (fullparam) - { - slen = fullparam-mapster32_fullpath+1; - Bstrncpy(game_executable, mapster32_fullpath, slen); - // game_executable is now expected to not be NULL-terminated! - Bstrcpy(game_executable+slen, DEFAULT_GAME_EXEC); - } - else - Bstrcpy(game_executable, DEFAULT_GAME_LOCAL_EXEC); - } - - if (current_cwd[0] != '\0') // Temporarily changing back, - chdir(current_cwd); // after checking if file exists. - - if (testplay_addparam) - slen = Bstrlen(testplay_addparam); - - // Considering the NULL character, quatation marks - // and a possible extra space not in testplay_addparam, - // the length should be Bstrlen(game_executable)+Bstrlen(param)+(slen+1)+2+1. - - fullparam = Bmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4); - Bsprintf(fullparam,"\"%s\"",game_executable); - - if (testplay_addparam) - { - Bstrcat(fullparam, " "); - Bstrcat(fullparam, testplay_addparam); - } - Bstrcat(fullparam, param); - - fixspritesectors(); //Do this before saving! - ExtPreSaveMap(); - if (mode) - saveboard(PLAYTEST_MAPNAME,&startposx,&startposy,&startposz,&startang,&startsectnum); - else - saveboard(PLAYTEST_MAPNAME,&pos.x,&pos.y,&pos.z,&ang,&cursectnum); - - message("Board saved to " PLAYTEST_MAPNAME ". Starting the game..."); - OSD_Printf("...as `%s'\n", fullparam); - - showframe(1); - uninitmouse(); -#ifdef _WIN32 - { - STARTUPINFO si; - PROCESS_INFORMATION pi; - - ZeroMemory(&si,sizeof(si)); - ZeroMemory(&pi,sizeof(pi)); - si.cb = sizeof(si); - - if (!CreateProcess(NULL,fullparam,NULL,NULL,0,0,NULL,NULL,&si,&pi)) - message("Error launching the game!"); - else WaitForSingleObject(pi.hProcess,INFINITE); - } -#else - if (current_cwd[0] != '\0') - { - chdir(program_origcwd); - if (system(fullparam)) - message("Error launching the game!"); - chdir(current_cwd); - } - else system(fullparam); -#endif - printmessage16("Game process exited"); - initmouse(); - clearkeys(); - - Bfree(fullparam); - } - else - printmessage16("Position must be in valid player space to test map!"); -} diff --git a/polymer-perf/eduke32/build/src/cache1d.c b/polymer-perf/eduke32/build/src/cache1d.c deleted file mode 100644 index 5f945026b..000000000 --- a/polymer-perf/eduke32/build/src/cache1d.c +++ /dev/null @@ -1,1420 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. -// -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - -#include "compat.h" -#include "cache1d.h" -#include "pragmas.h" -#include "baselayer.h" - -#ifdef WITHKPLIB -#include "kplib.h" - -//Insert '|' in front of filename -//Doing this tells kzopen to load the file only if inside a .ZIP file -static intptr_t kzipopen(const char *filnam) -{ - uint32_t i; - char newst[BMAX_PATH+8]; - - newst[0] = '|'; - for (i=0; filnam[i] && (i < sizeof(newst)-2); i++) newst[i+1] = filnam[i]; - newst[i+1] = 0; - return(kzopen(newst)); -} - -#endif - - -// This module keeps track of a standard linear cacheing system. -// To use this module, here's all you need to do: -// -// Step 1: Allocate a nice BIG buffer, like from 1MB-4MB and -// Call initcache(int32_t cachestart, int32_t cachesize) where -// -// cachestart = (intptr_t)(pointer to start of BIG buffer) -// cachesize = length of BIG buffer -// -// Step 2: Call allocache(intptr_t *bufptr, int32_t bufsiz, char *lockptr) -// whenever you need to allocate a buffer, where: -// -// *bufptr = pointer to multi-byte pointer to buffer -// Confused? Using this method, cache2d can remove -// previously allocated things from the cache safely by -// setting the multi-byte pointer to 0. -// bufsiz = number of bytes to allocate -// *lockptr = pointer to locking char which tells whether -// the region can be removed or not. If *lockptr = 0 then -// the region is not locked else its locked. -// -// Step 3: If you need to remove everything from the cache, or every -// unlocked item from the cache, you can call uninitcache(); -// Call uninitcache(0) to remove all unlocked items, or -// Call uninitcache(1) to remove everything. -// After calling uninitcache, it is still ok to call allocache -// without first calling initcache. - -#define MAXCACHEOBJECTS 9216 - -static int32_t cachesize = 0; -int32_t cachecount = 0; -char zerochar = 0; -intptr_t cachestart = 0; -int32_t cacnum = 0, agecount = 0; -cactype cac[MAXCACHEOBJECTS]; -static int32_t lockrecip[200]; - -static char toupperlookup[256]; - -static void reportandexit(const char *errormessage); - -extern char pow2char[8]; - - -void initcache(intptr_t dacachestart, int32_t dacachesize) -{ - int32_t i; - - for (i=1; i<200; i++) lockrecip[i] = (1<<28)/(200-i); - - // The following code was relocated here from engine.c, since this - // function is only ever called once (from there), and it seems to - // really belong here: - // - // initcache((FP_OFF(pic)+15)&0xfffffff0,(cachesize-((-FP_OFF(pic))&15))&0xfffffff0); - // - // I'm not sure why it's necessary, but the code is making sure the - // cache starts on a multiple of 16 bytes? -- SA - -//printf("BEFORE: cachestart = %x, cachesize = %d\n", dacachestart, dacachesize); - cachestart = ((uintptr_t)dacachestart+15)&~(uintptr_t)0xf; - cachesize = (dacachesize-(((uintptr_t)(dacachestart))&0xf))&~(uintptr_t)0xf; -//printf("AFTER : cachestart = %x, cachesize = %d\n", cachestart, cachesize); - - cac[0].leng = cachesize; - cac[0].lock = &zerochar; - cacnum = 1; - - initprintf("Initialized %.1fM cache\n", (float)(dacachesize/1024.f/1024.f)); -} - -void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr) -{ - int32_t i, /*j,*/ z, zz, bestz=0, daval, bestval, besto=0, o1, o2, sucklen, suckz; - -//printf(" ==> asking for %d bytes, ", newbytes); - // Make all requests a multiple of 16 bytes - newbytes = (newbytes+15)&0xfffffff0; -//printf("allocated %d bytes\n", newbytes); - - if ((unsigned)newbytes > (unsigned)cachesize) - { - Bprintf("Cachesize: %d\n",cachesize); - Bprintf("*Newhandle: 0x%" PRIxPTR ", Newbytes: %d, *Newlock: %d\n",(intptr_t)newhandle,newbytes,*newlockptr); - reportandexit("BUFFER TOO BIG TO FIT IN CACHE!"); - } - - if (*newlockptr == 0) - { - reportandexit("ALLOCACHE CALLED WITH LOCK OF 0!"); - } - - //Find best place - bestval = 0x7fffffff; o1 = cachesize; - for (z=cacnum-1; z>=0; z--) - { - o1 -= cac[z].leng; - o2 = o1+newbytes; if (o2 > cachesize) continue; - - daval = 0; - for (i=o1,zz=z; i= 200) { daval = 0x7fffffff; break; } - daval += mulscale32(cac[zz].leng+65536,lockrecip[*cac[zz].lock]); - if (daval >= bestval) break; - } - if (daval < bestval) - { - bestval = daval; besto = o1; bestz = z; - if (bestval == 0) break; - } - } - - //printf("%d %d %d\n",besto,newbytes,*newlockptr); - - if (bestval == 0x7fffffff) - reportandexit("CACHE SPACE ALL LOCKED UP!"); - - //Suck things out - for (sucklen=-newbytes,suckz=bestz; sucklen<0; sucklen+=cac[suckz++].leng) - if (*cac[suckz].lock) *cac[suckz].hand = 0; - - //Remove all blocks except 1 - suckz -= (bestz+1); cacnum -= suckz; - copybufbyte(&cac[bestz+suckz],&cac[bestz],(cacnum-bestz)*sizeof(cactype)); - cac[bestz].hand = newhandle; *newhandle = cachestart+(intptr_t)besto; - cac[bestz].leng = newbytes; - cac[bestz].lock = newlockptr; - cachecount++; - - //Add new empty block if necessary - if (sucklen <= 0) return; - - bestz++; - if (bestz == cacnum) - { - cacnum++; if (cacnum > MAXCACHEOBJECTS) reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)"); - cac[bestz].leng = sucklen; - cac[bestz].lock = &zerochar; - return; - } - - if (*cac[bestz].lock == 0) { cac[bestz].leng += sucklen; return; } - - cacnum++; if (cacnum > MAXCACHEOBJECTS) reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)"); - for (z=cacnum-1; z>bestz; z--) cac[z] = cac[z-1]; - cac[bestz].leng = sucklen; - cac[bestz].lock = &zerochar; -} - -void suckcache(intptr_t *suckptr) -{ - int32_t i; - - //Can't exit early, because invalid pointer might be same even though lock = 0 - for (i=0; i 0) && (*cac[i-1].lock == 0)) - { - cac[i-1].leng += cac[i].leng; - cacnum--; copybuf(&cac[i+1],&cac[i],(cacnum-i)*sizeof(cactype)); - } - else if ((i < cacnum-1) && (*cac[i+1].lock == 0)) - { - cac[i+1].leng += cac[i].leng; - cacnum--; copybuf(&cac[i+1],&cac[i],(cacnum-i)*sizeof(cactype)); - } - } - } -} - -void agecache(void) -{ - int32_t cnt = (cacnum>>4); - - if (agecount >= cacnum) agecount = cacnum-1; - if (agecount < 0 || !cnt) return; - - for (; cnt>=0; cnt--) - { - if (cac[agecount].lock && (((*cac[agecount].lock)-2)&255) < 198) - (*cac[agecount].lock)--; - - agecount--; - if (agecount < 0) agecount = cacnum-1; - } -} - -static void reportandexit(const char *errormessage) -{ - int32_t i, j; - - //setvmode(0x3); - j = 0; - for (i=0; i - -typedef struct _searchpath -{ - struct _searchpath *next; - char *path; - size_t pathlen; // to save repeated calls to strlen() -} searchpath_t; -static searchpath_t *searchpathhead = NULL; -static size_t maxsearchpathlen = 0; -int32_t pathsearchmode = 0; - -int32_t addsearchpath(const char *p) -{ - struct stat st; - char *s; - searchpath_t *srch; - - if (Bstat(p, &st) < 0) - { - if (errno == ENOENT) return -2; - return -1; - } - if (!(st.st_mode & BS_IFDIR)) return -1; - - srch = (searchpath_t *)Bmalloc(sizeof(searchpath_t)); - if (!srch) return -1; - - srch->next = searchpathhead; - srch->pathlen = strlen(p)+1; - srch->path = (char *)Bmalloc(srch->pathlen + 1); - if (!srch->path) - { - Bfree(srch); - return -1; - } - strcpy(srch->path, p); - for (s=srch->path; *s; s++) ; s--; if (spath || toupperlookup[*s] != '/') strcat(srch->path, "/"); - - searchpathhead = srch; - if (srch->pathlen > maxsearchpathlen) maxsearchpathlen = srch->pathlen; - - Bcorrectfilename(srch->path,0); - - initprintf("Using %s for game data\n", srch->path); - - return 0; -} - -int32_t findfrompath(const char *fn, char **where) -{ - searchpath_t *sp; - char *pfn, *ffn; - int32_t allocsiz; - - // pathsearchmode == 0: tests current dir and then the dirs of the path stack - // pathsearchmode == 1: tests fn without modification, then like for pathsearchmode == 0 - - if (pathsearchmode) - { - // test unmolested filename first - if (access(fn, F_OK) >= 0) - { - *where = Bstrdup(fn); - return 0; - } - else - { - char *tfn = Bstrtolower(Bstrdup(fn)); - - if (access(tfn, F_OK) >= 0) - { - *where = tfn; - return 0; - } - - Bstrupr(tfn); - - if (access(tfn, F_OK) >= 0) - { - *where = tfn; - return 0; - } - - Bfree(tfn); - } - } - - for (pfn = (char *)fn; toupperlookup[*pfn] == '/'; pfn++); - ffn = Bstrdup(pfn); - if (!ffn) return -1; - Bcorrectfilename(ffn,0); // compress relative paths - - allocsiz = max(maxsearchpathlen, 2); // "./" (aka. curdir) - allocsiz += strlen(ffn); - allocsiz += 1; // a nul - - pfn = (char *)Bmalloc(allocsiz); - if (!pfn) { Bfree(ffn); return -1; } - - strcpy(pfn, "./"); - strcat(pfn, ffn); - if (access(pfn, F_OK) >= 0) - { - *where = pfn; - Bfree(ffn); - return 0; - } - - for (sp = searchpathhead; sp; sp = sp->next) - { - char *tfn = Bstrdup(ffn); - - strcpy(pfn, sp->path); - strcat(pfn, ffn); - //initprintf("Trying %s\n", pfn); - if (access(pfn, F_OK) >= 0) - { - *where = pfn; - Bfree(ffn); - Bfree(tfn); - return 0; - } - - //Check with all lowercase - strcpy(pfn, sp->path); - Bstrtolower(tfn); - strcat(pfn, tfn); - if (access(pfn, F_OK) >= 0) - { - *where = pfn; - Bfree(ffn); - Bfree(tfn); - return 0; - } - - //Check again with uppercase - strcpy(pfn, sp->path); - Bstrupr(tfn); - strcat(pfn, tfn); - if (access(pfn, F_OK) >= 0) - { - *where = pfn; - Bfree(ffn); - Bfree(tfn); - return 0; - } - - Bfree(tfn); - } - Bfree(pfn); Bfree(ffn); - return -1; -} - -int32_t openfrompath(const char *fn, int32_t flags, int32_t mode) -{ - char *pfn; - int32_t h; - - if (findfrompath(fn, &pfn) < 0) return -1; - h = Bopen(pfn, flags, mode); - Bfree(pfn); - - return h; -} - -BFILE *fopenfrompath(const char *fn, const char *mode) -{ - int32_t fh; - BFILE *h; - int32_t bmode = 0, smode = 0; - const char *c; - - for (c=mode; c[0];) - { - if (c[0] == 'r' && c[1] == '+') { bmode = BO_RDWR; smode = BS_IREAD|BS_IWRITE; c+=2; } - else if (c[0] == 'r') { bmode = BO_RDONLY; smode = BS_IREAD; c+=1; } - else if (c[0] == 'w' && c[1] == '+') { bmode = BO_RDWR|BO_CREAT|BO_TRUNC; smode = BS_IREAD|BS_IWRITE; c+=2; } - else if (c[0] == 'w') { bmode = BO_WRONLY|BO_CREAT|BO_TRUNC; smode = BS_IREAD|BS_IWRITE; c+=2; } - else if (c[0] == 'a' && c[1] == '+') { bmode = BO_RDWR|BO_CREAT; smode=BS_IREAD|BS_IWRITE; c+=2; } - else if (c[0] == 'a') { bmode = BO_WRONLY|BO_CREAT; smode=BS_IREAD|BS_IWRITE; c+=1; } - else if (c[0] == 'b') { bmode |= BO_BINARY; c+=1; } - else if (c[1] == 't') { bmode |= BO_TEXT; c+=1; } - else c++; - } - fh = openfrompath(fn,bmode,smode); - if (fh < 0) return NULL; - - h = fdopen(fh,mode); - if (!h) close(fh); - - return h; -} - -static char toupperlookup[256] = -{ - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, - 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, - 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, - 0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, - 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x7b,0x7c,0x7d,0x7e,0x7f, - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f, - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f, - 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf, - 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf, - 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, - 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf, - 0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef, - 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff -}; - -int32_t numgroupfiles = 0; -static int32_t gnumfiles[MAXGROUPFILES]; -static int32_t groupfil[MAXGROUPFILES] = {-1,-1,-1,-1,-1,-1,-1,-1}; -static int32_t groupfilpos[MAXGROUPFILES]; -static char *gfilelist[MAXGROUPFILES]; -static int32_t *gfileoffs[MAXGROUPFILES]; - -char filegrp[MAXOPENFILES]; -static int32_t filepos[MAXOPENFILES]; -static intptr_t filehan[MAXOPENFILES] = -{ - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -}; -#ifdef WITHKPLIB -static char filenamsav[MAXOPENFILES][260]; -static int32_t kzcurhand = -1; -#endif - -int32_t initgroupfile(const char *filename) -{ - char buf[16]; - int32_t i, j, k; -#ifdef WITHKPLIB - char *zfn; -#endif - -#ifdef _WIN32 - // on Windows, translate all backslashes (0x5c) to forward slashes (0x2f) - toupperlookup[0x5c] = 0x2f; -#endif - -#ifdef WITHKPLIB - if (findfrompath(filename, &zfn) < 0) return -1; - - // check to see if the file passed is a ZIP and pass it on to kplib if it is - i = Bopen(zfn,BO_BINARY|BO_RDONLY,BS_IREAD); - if (i < 0) { Bfree(zfn); return -1; } - - Bread(i, buf, 4); - if (buf[0] == 0x50 && buf[1] == 0x4B && buf[2] == 0x03 && buf[3] == 0x04) - { - Bclose(i); - j = kzaddstack(zfn); - Bfree(zfn); - return j; - } - Bfree(zfn); - - if (numgroupfiles >= MAXGROUPFILES) return(-1); - - Blseek(i,0,BSEEK_SET); - groupfil[numgroupfiles] = i; -#else - groupfil[numgroupfiles] = openfrompath(filename,BO_BINARY|BO_RDONLY,BS_IREAD); - if (groupfil[numgroupfiles] != -1) -#endif - { - groupfilpos[numgroupfiles] = 0; - Bread(groupfil[numgroupfiles],buf,16); - if ((buf[0] != 'K') || (buf[1] != 'e') || (buf[2] != 'n') || - (buf[3] != 'S') || (buf[4] != 'i') || (buf[5] != 'l') || - (buf[6] != 'v') || (buf[7] != 'e') || (buf[8] != 'r') || - (buf[9] != 'm') || (buf[10] != 'a') || (buf[11] != 'n')) - { - Bclose(groupfil[numgroupfiles]); - groupfil[numgroupfiles] = -1; - return(-1); - } - gnumfiles[numgroupfiles] = B_LITTLE32(*((int32_t *)&buf[12])); - - if ((gfilelist[numgroupfiles] = (char *)Bmalloc(gnumfiles[numgroupfiles]<<4)) == 0) - { Bprintf("Not enough memory for file grouping system\n"); exit(0); } - if ((gfileoffs[numgroupfiles] = (int32_t *)Bmalloc((gnumfiles[numgroupfiles]+1)<<2)) == 0) - { Bprintf("Not enough memory for file grouping system\n"); exit(0); } - - Bread(groupfil[numgroupfiles],gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4); - - j = 0; - for (i=0; i=0; i--) - if (groupfil[i] != -1 && groupfil[i] == grphandle) - { - Bfree(gfilelist[i]); - Bfree(gfileoffs[i]); - Bclose(groupfil[i]); - groupfil[i] = -1; - grpnum = i; - break; - } - - if (grpnum == -1) return; - - // JBF 20040111 - numgroupfiles--; - - // move any group files following this one back - for (i=grpnum+1; i= 254) // external file (255) or ZIPped file (254) - continue; - else if (filegrp[i] == grpnum) // close file in group we closed - filehan[i] = -1; - else if (filegrp[i] > grpnum) // move back a file in a group after the one we closed - filegrp[i]--; - } -} - -void uninitgroupfile(void) -{ - int32_t i; - - for (i=numgroupfiles-1; i>=0; i--) - if (groupfil[i] != -1) - { - Bfree(gfilelist[i]); - Bfree(gfileoffs[i]); - Bclose(groupfil[i]); - groupfil[i] = -1; - } - numgroupfiles = 0; - - // JBF 20040111: "close" any files open in groups - for (i=0; i= 0) - { - filegrp[newhandle] = 255; - filehan[newhandle] = fil; - filepos[newhandle] = 0; - return(newhandle); - } - - for (; toupperlookup[*filename] == '/'; filename++); - -#ifdef WITHKPLIB - if ((kzcurhand != newhandle) && (kztell() >= 0)) - { - if (kzcurhand >= 0) filepos[kzcurhand] = kztell(); - kzclose(); - } - if (searchfirst != 1 && (i = kzipopen(filename)) != 0) - { - kzcurhand = newhandle; - filegrp[newhandle] = 254; - filehan[newhandle] = i; - filepos[newhandle] = 0; - strcpy(filenamsav[newhandle],filename); - return newhandle; - } -#endif - - for (k=numgroupfiles-1; k>=0; k--) - { - if (searchfirst == 1) k = 0; - if (groupfil[k] >= 0) - { - for (i=gnumfiles[k]-1; i>=0; i--) - { - gfileptr = (char *)&gfilelist[k][i<<4]; - - bad = 0; - for (j=0; j<13; j++) - { - if (!filename[j]) break; - if (toupperlookup[filename[j]] != toupperlookup[gfileptr[j]]) - { bad = 1; break; } - } - if (bad) continue; - if (j<13 && gfileptr[j]) continue; // JBF: because e1l1.map might exist before e1l1 - if (j==13 && filename[j]) continue; // JBF: long file name - - filegrp[newhandle] = k; - filehan[newhandle] = i; - filepos[newhandle] = 0; - return(newhandle); - } - } - } - return(-1); -} - -int32_t kread(int32_t handle, void *buffer, int32_t leng) -{ - int32_t i; - int32_t filenum = filehan[handle]; - int32_t groupnum = filegrp[handle]; - - if (groupnum == 255) return(Bread(filenum,buffer,leng)); -#ifdef WITHKPLIB - else if (groupnum == 254) - { - if (kzcurhand != handle) - { - if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } - kzcurhand = handle; - kzipopen(filenamsav[handle]); - kzseek(filepos[handle],SEEK_SET); - } - return(kzread(buffer,leng)); - } -#endif - - if (groupfil[groupnum] != -1) - { - i = gfileoffs[groupnum][filenum]+filepos[handle]; - if (i != groupfilpos[groupnum]) - { - Blseek(groupfil[groupnum],i+((gnumfiles[groupnum]+1)<<4),BSEEK_SET); - groupfilpos[groupnum] = i; - } - leng = min(leng,(gfileoffs[groupnum][filenum+1]-gfileoffs[groupnum][filenum])-filepos[handle]); - leng = Bread(groupfil[groupnum],buffer,leng); - filepos[handle] += leng; - groupfilpos[groupnum] += leng; - return(leng); - } - - return(0); -} - -int32_t klseek(int32_t handle, int32_t offset, int32_t whence) -{ - int32_t i, groupnum; - - groupnum = filegrp[handle]; - - if (groupnum == 255) return(Blseek(filehan[handle],offset,whence)); -#ifdef WITHKPLIB - else if (groupnum == 254) - { - if (kzcurhand != handle) - { - if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } - kzcurhand = handle; - kzipopen(filenamsav[handle]); - kzseek(filepos[handle],SEEK_SET); - } - return(kzseek(offset,whence)); - } -#endif - - if (groupfil[groupnum] != -1) - { - switch (whence) - { - case BSEEK_SET: - filepos[handle] = offset; break; - case BSEEK_END: - i = filehan[handle]; - filepos[handle] = (gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i])+offset; - break; - case BSEEK_CUR: - filepos[handle] += offset; break; - } - return(filepos[handle]); - } - return(-1); -} - -int32_t kfilelength(int32_t handle) -{ - int32_t i, groupnum; - - groupnum = filegrp[handle]; - if (groupnum == 255) - { - // return(filelength(filehan[handle])) - return Bfilelength(filehan[handle]); - } -#ifdef WITHKPLIB - else if (groupnum == 254) - { - if (kzcurhand != handle) - { - if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } - kzcurhand = handle; - kzipopen(filenamsav[handle]); - kzseek(filepos[handle],SEEK_SET); - } - return kzfilelength(); - } -#endif - i = filehan[handle]; - return(gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i]); -} - -int32_t ktell(int32_t handle) -{ - int32_t groupnum = filegrp[handle]; - - if (groupnum == 255) return(Blseek(filehan[handle],0,BSEEK_CUR)); -#ifdef WITHKPLIB - else if (groupnum == 254) - { - if (kzcurhand != handle) - { - if (kztell() >= 0) { filepos[kzcurhand] = kztell(); kzclose(); } - kzcurhand = handle; - kzipopen(filenamsav[handle]); - kzseek(filepos[handle],SEEK_SET); - } - return kztell(); - } -#endif - if (groupfil[groupnum] != -1) - return filepos[handle]; - return(-1); -} - -void kclose(int32_t handle) -{ - if (handle < 0) return; - if (filegrp[handle] == 255) Bclose(filehan[handle]); -#ifdef WITHKPLIB - else if (filegrp[handle] == 254) - { - kzclose(); - kzcurhand = -1; - } -#endif - filehan[handle] = -1; -} - -static int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source) -{ - CACHE1D_FIND_REC *r = NULL, *attach = NULL; - - if (*rec) - { - int32_t insensitive, v; - CACHE1D_FIND_REC *last = NULL; - - for (attach = *rec; attach; last = attach, attach = attach->next) - { - if (type == CACHE1D_FIND_DRIVE) continue; // we just want to get to the end for drives -#ifdef _WIN32 - insensitive = 1; -#else - if (source == CACHE1D_SOURCE_GRP || attach->source == CACHE1D_SOURCE_GRP) - insensitive = 1; - else if (source == CACHE1D_SOURCE_ZIP || attach->source == CACHE1D_SOURCE_ZIP) - insensitive = 1; - else - insensitive = 0; -#endif - if (insensitive) v = Bstrcasecmp(name, attach->name); - else v = Bstrcmp(name, attach->name); - - // sorted list - if (v > 0) continue; // item to add is bigger than the current one - // so look for something bigger than us - if (v < 0) // item to add is smaller than the current one - { - attach = NULL; // so wedge it between the current item and the one before - break; - } - - // matched - if (source >= attach->source) return 1; // item to add is of lower priority - r = attach; - break; - } - - // wasn't found in the list, so attach to the end - if (!attach) attach = last; - } - - if (r) - { - r->type = type; - r->source = source; - return 0; - } - - r = (CACHE1D_FIND_REC *)Bmalloc(sizeof(CACHE1D_FIND_REC)+strlen(name)+1); - if (!r) return -1; - r->name = (char *)r + sizeof(CACHE1D_FIND_REC); strcpy(r->name, name); - r->type = type; - r->source = source; - r->usera = r->userb = NULL; - - if (!attach) // we are the first item - { - r->prev = NULL; - r->next = *rec; - if (*rec)(*rec)->prev = r; - *rec = r; - } - else - { - r->prev = attach; - r->next = attach->next; - if (attach->next) attach->next->prev = r; - attach->next = r; - } - - return 0; -} - -void klistfree(CACHE1D_FIND_REC *rec) -{ - CACHE1D_FIND_REC *n; - - while (rec) - { - n = rec->next; - Bfree(rec); - rec = n; - } -} - -CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int32_t type) -{ - CACHE1D_FIND_REC *rec = NULL; - char *path; - - // pathsearchmode == 0: enumerates a path in the virtual filesystem - // pathsearchmode == 1: enumerates the system filesystem path passed in - - path = Bstrdup(_path); - if (!path) return NULL; - - // we don't need any leading dots and slashes or trailing slashes either - { - int32_t i,j; - for (i=0; path[i] == '.' || toupperlookup[path[i]] == '/';) i++; - for (j=0; (path[j] = path[i]); j++,i++) ; - while (j>0 && toupperlookup[path[j-1]] == '/') j--; - path[j] = 0; - //initprintf("Cleaned up path = \"%s\"\n",path); - } - - if (*path && (type & CACHE1D_FIND_DIR)) - { - if (klistaddentry(&rec, "..", CACHE1D_FIND_DIR, CACHE1D_SOURCE_CURDIR) < 0) goto failure; - } - - if (!(type & CACHE1D_OPT_NOSTACK)) // current directory and paths in the search stack - { - searchpath_t *search = NULL; - BDIR *dir; - struct Bdirent *dirent; - // Adjusted for the following "autoload" dir fix - NY00123 - const char *d = "./"; - int32_t stackdepth = CACHE1D_SOURCE_CURDIR; - char buf[BMAX_PATH]; - - if (pathsearchmode) d = _path; - - do - { - if (!pathsearchmode) - { - // Fix for "autoload" dir in multi-user environments - NY00123 - strcpy(buf, d); - strcat(buf, path); - if (*path) strcat(buf, "/"); - } - else strcpy(buf, d); - dir = Bopendir(buf); - if (dir) - { - while ((dirent = Breaddir(dir))) - { - if ((dirent->name[0] == '.' && dirent->name[1] == 0) || - (dirent->name[0] == '.' && dirent->name[1] == '.' && dirent->name[2] == 0)) - continue; - if ((type & CACHE1D_FIND_DIR) && !(dirent->mode & BS_IFDIR)) continue; - if ((type & CACHE1D_FIND_FILE) && (dirent->mode & BS_IFDIR)) continue; - if (!Bwildmatch(dirent->name, mask)) continue; - switch (klistaddentry(&rec, dirent->name, - (dirent->mode & BS_IFDIR) ? CACHE1D_FIND_DIR : CACHE1D_FIND_FILE, - stackdepth)) - { - case -1: goto failure; - //case 1: initprintf("%s:%s dropped for lower priority\n", d,dirent->name); break; - //case 0: initprintf("%s:%s accepted\n", d,dirent->name); break; - default: - break; - } - } - Bclosedir(dir); - } - - if (pathsearchmode) break; - - if (!search) - { - search = searchpathhead; - stackdepth = CACHE1D_SOURCE_PATH; - } - else - { - search = search->next; - stackdepth++; - } - if (search) d = search->path; - } - while (search); - } - - if (!pathsearchmode) // next, zip files - { - char buf[BMAX_PATH+4]; - int32_t i, j, ftype; - strcpy(buf,path); - if (*path) strcat(buf,"/"); - strcat(buf,mask); - for (kzfindfilestart(buf); kzfindfile(buf);) - { - if (buf[0] != '|') continue; // local files we don't need - - // scan for the end of the string and shift - // everything left a char in the process - for (i=1; (buf[i-1]=buf[i]); i++) ; i-=2; - - // if there's a slash at the end, this is a directory entry - if (toupperlookup[buf[i]] == '/') { ftype = CACHE1D_FIND_DIR; buf[i] = 0; } - else ftype = CACHE1D_FIND_FILE; - - // skip over the common characters at the beginning of the base path and the zip entry - for (j=0; buf[j] && path[j]; j++) - { - if (toupperlookup[ path[j] ] == toupperlookup[ buf[j] ]) continue; - break; - } - // we've now hopefully skipped the common path component at the beginning. - // if that's true, we should be staring at a null byte in path and either any character in buf - // if j==0, or a slash if j>0 - if ((!path[0] && buf[j]) || (!path[j] && toupperlookup[ buf[j] ] == '/')) - { - if (j>0) j++; - - // yep, so now we shift what follows back to the start of buf and while we do that, - // keep an eye out for any more slashes which would mean this entry has sub-entities - // and is useless to us. - for (i = 0; (buf[i] = buf[j]) && toupperlookup[buf[j]] != '/'; i++,j++) ; - if (toupperlookup[buf[j]] == '/') continue; // damn, try next entry - } - else - { - // if we're here it means we have a situation where: - // path = foo - // buf = foobar... - // or - // path = foobar - // buf = foo... - // which would mean the entry is higher up in the directory tree and is also useless - continue; - } - - if ((type & CACHE1D_FIND_DIR) && ftype != CACHE1D_FIND_DIR) continue; - if ((type & CACHE1D_FIND_FILE) && ftype != CACHE1D_FIND_FILE) continue; - - // the entry is in the clear - switch (klistaddentry(&rec, buf, ftype, CACHE1D_SOURCE_ZIP)) - { - case -1: - goto failure; - //case 1: initprintf(":%s dropped for lower priority\n", buf); break; - //case 0: initprintf(":%s accepted\n", buf); break; - default: - break; - } - } - } - - // then, grp files - if (!pathsearchmode && !*path && (type & CACHE1D_FIND_FILE)) - { - char buf[13]; - int32_t i,j; - buf[12] = 0; - for (i=0; i=0; j--) - { - Bmemcpy(buf,&gfilelist[i][j<<4],12); - if (!Bwildmatch(buf,mask)) continue; - switch (klistaddentry(&rec, buf, CACHE1D_FIND_FILE, CACHE1D_SOURCE_GRP)) - { - case -1: - goto failure; - //case 1: initprintf(":%s dropped for lower priority\n", workspace); break; - //case 0: initprintf(":%s accepted\n", workspace); break; - default: - break; - } - } - } - } - - if (pathsearchmode && (type & CACHE1D_FIND_DRIVE)) - { - char *drives, *drp; - drives = Bgetsystemdrives(); - if (drives) - { - for (drp=drives; *drp; drp+=strlen(drp)+1) - { - if (klistaddentry(&rec, drp, CACHE1D_FIND_DRIVE, CACHE1D_SOURCE_DRIVE) < 0) - { - Bfree(drives); - goto failure; - } - } - Bfree(drives); - } - } - - Bfree(path); - return rec; -failure: - Bfree(path); - klistfree(rec); - return NULL; -} - -//Internal LZW variables -#define LZWSIZE 16384 //Watch out for shorts! -static char *lzwbuf1, *lzwbuf4, *lzwbuf5, lzwbuflock[5]; -static int16_t *lzwbuf2, *lzwbuf3; - -static int32_t lzwcompress(char *lzwinbuf, int32_t uncompleng, char *lzwoutbuf); -static int32_t lzwuncompress(char *lzwinbuf, int32_t compleng, char *lzwoutbuf); - -int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil) -{ - uint32_t i, j, k, kgoal; - int16_t leng; - char *ptr; - - lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200; - if (lzwbuf1 == NULL) allocache((intptr_t *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]); - if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); - if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); - if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); - if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); - - if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } - ptr = (char *)buffer; - - if (kread(fil,&leng,2) != 2) return -1; leng = B_LITTLE16(leng); - if (kread(fil,lzwbuf5,(int32_t)leng) != leng) return -1; - k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4); - - copybufbyte(lzwbuf4,ptr,(int32_t)dasizeof); - k += (int32_t)dasizeof; - - for (i=1; i= kgoal) - { - if (kread(fil,&leng,2) != 2) return -1; leng = B_LITTLE16(leng); - if (kread(fil,lzwbuf5,(int32_t)leng) != leng) return -1; - k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4); - } - for (j=0; j>4),&lzwbuflock[0]); - if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); - if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); - if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); - if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); - - if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } - ptr = (char *)buffer; - - if (Bfread(&leng,2,1,fil) != 1) return -1; leng = B_LITTLE16(leng); - if (Bfread(lzwbuf5,(int32_t)leng,1,fil) != 1) return -1; - k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4); - - copybufbyte(lzwbuf4,ptr,(int32_t)dasizeof); - k += (int32_t)dasizeof; - - for (i=1; i= kgoal) - { - if (Bfread(&leng,2,1,fil) != 1) return -1; leng = B_LITTLE16(leng); - if (Bfread(lzwbuf5,(int32_t)leng,1,fil) != 1) return -1; - k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4); - } - for (j=0; j>4),&lzwbuflock[0]); - if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); - if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); - if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); - if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); - - if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } - ptr = (char *)buffer; - - copybufbyte(ptr,lzwbuf4,(int32_t)dasizeof); - k = dasizeof; - - if (k > LZWSIZE-dasizeof) - { - leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng); - Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int32_t)leng); - } - - for (i=1; i LZWSIZE-dasizeof) - { - leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng); - Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int32_t)leng); - } - ptr += dasizeof; - } - if (k > 0) - { - leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); swleng = B_LITTLE16(leng); - Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int32_t)leng); - } - lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 1; -} - -void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil) -{ - uint32_t i, j, k; - int16_t leng, swleng; - char *ptr; - - lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 200; - if (lzwbuf1 == NULL) allocache((intptr_t *)&lzwbuf1,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[0]); - if (lzwbuf2 == NULL) allocache((intptr_t *)&lzwbuf2,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[1]); - if (lzwbuf3 == NULL) allocache((intptr_t *)&lzwbuf3,(LZWSIZE+(LZWSIZE>>4))*2,&lzwbuflock[2]); - if (lzwbuf4 == NULL) allocache((intptr_t *)&lzwbuf4,LZWSIZE,&lzwbuflock[3]); - if (lzwbuf5 == NULL) allocache((intptr_t *)&lzwbuf5,LZWSIZE+(LZWSIZE>>4),&lzwbuflock[4]); - - if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } - ptr = (char *)buffer; - - copybufbyte(ptr,lzwbuf4,(int32_t)dasizeof); - k = dasizeof; - - if (k > LZWSIZE-dasizeof) - { - leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng); - Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int32_t)leng,1,fil); - } - - for (i=1; i LZWSIZE-dasizeof) - { - leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); k = 0; swleng = B_LITTLE16(leng); - Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int32_t)leng,1,fil); - } - ptr += dasizeof; - } - if (k > 0) - { - leng = (int16_t)lzwcompress(lzwbuf4,k,lzwbuf5); swleng = B_LITTLE16(leng); - Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int32_t)leng,1,fil); - } - lzwbuflock[0] = lzwbuflock[1] = lzwbuflock[2] = lzwbuflock[3] = lzwbuflock[4] = 1; -} - -static int32_t lzwcompress(char *lzwinbuf, int32_t uncompleng, char *lzwoutbuf) -{ - int32_t i, addr, newaddr, addrcnt, zx, *intptr; - int32_t bytecnt1, bitcnt, numbits, oneupnumbits; - int16_t *shortptr; - - for (i=255; i>=0; i--) { lzwbuf1[i] = i; lzwbuf3[i] = (i+1)&255; } - clearbuf(lzwbuf2,256>>1,0xffffffff); - clearbuf(lzwoutbuf,((uncompleng+15)+3)>>2,0L); - - addrcnt = 256; bytecnt1 = 0; bitcnt = (4<<3); - numbits = 8; oneupnumbits = (1<<8); - do - { - addr = lzwinbuf[bytecnt1]; - do - { - bytecnt1++; - if (bytecnt1 == uncompleng) break; - if (lzwbuf2[addr] < 0) {lzwbuf2[addr] = addrcnt; break;} - newaddr = lzwbuf2[addr]; - while (lzwbuf1[newaddr] != lzwinbuf[bytecnt1]) - { - zx = lzwbuf3[newaddr]; - if (zx < 0) {lzwbuf3[newaddr] = addrcnt; break;} - newaddr = zx; - } - if (lzwbuf3[newaddr] == addrcnt) break; - addr = newaddr; - } - while (addr >= 0); - lzwbuf1[addrcnt] = lzwinbuf[bytecnt1]; - lzwbuf2[addrcnt] = -1; - lzwbuf3[addrcnt] = -1; - - intptr = (int32_t *)&lzwoutbuf[bitcnt>>3]; - intptr[0] |= B_LITTLE32(addr<<(bitcnt&7)); - bitcnt += numbits; - if ((addr&((oneupnumbits>>1)-1)) > ((addrcnt-1)&((oneupnumbits>>1)-1))) - bitcnt--; - - addrcnt++; - if (addrcnt > oneupnumbits) { numbits++; oneupnumbits <<= 1; } - } - while ((bytecnt1 < uncompleng) && (bitcnt < (uncompleng<<3))); - - intptr = (int32_t *)&lzwoutbuf[bitcnt>>3]; - intptr[0] |= B_LITTLE32(addr<<(bitcnt&7)); - bitcnt += numbits; - if ((addr&((oneupnumbits>>1)-1)) > ((addrcnt-1)&((oneupnumbits>>1)-1))) - bitcnt--; - - shortptr = (int16_t *)lzwoutbuf; - shortptr[0] = B_LITTLE16((int16_t)uncompleng); - if (((bitcnt+7)>>3) < uncompleng) - { - shortptr[1] = B_LITTLE16((int16_t)addrcnt); - return((bitcnt+7)>>3); - } - shortptr[1] = (int16_t)0; - for (i=0; i>2); - return((int32_t)B_LITTLE16(shortptr[0])); //uncompleng - } - for (i=255; i>=0; i--) { lzwbuf2[i] = i; lzwbuf3[i] = i; } - currstr = 256; bitcnt = (4<<3); outbytecnt = 0; - numbits = 8; oneupnumbits = (1<<8); - do - { - intptr = (int32_t *)&lzwinbuf[bitcnt>>3]; - dat = ((B_LITTLE32(intptr[0])>>(bitcnt&7)) & (oneupnumbits-1)); - bitcnt += numbits; - if ((dat&((oneupnumbits>>1)-1)) > ((currstr-1)&((oneupnumbits>>1)-1))) - { dat &= ((oneupnumbits>>1)-1); bitcnt--; } - - lzwbuf3[currstr] = dat; - - for (leng=0; dat>=256; leng++,dat=lzwbuf3[dat]) - lzwbuf1[leng] = lzwbuf2[dat]; - - lzwoutbuf[outbytecnt++] = dat; - for (i=leng-1; i>=0; i--) lzwoutbuf[outbytecnt++] = lzwbuf1[i]; - - lzwbuf2[currstr-1] = dat; lzwbuf2[currstr] = dat; - currstr++; - if (currstr > oneupnumbits) { numbits++; oneupnumbits <<= 1; } - } - while (currstr < strtot); - return((int32_t)B_LITTLE16(shortptr[0])); //uncompleng -} - -/* - * vim:ts=4:sw=4: - */ diff --git a/polymer-perf/eduke32/build/src/compat.c b/polymer-perf/eduke32/build/src/compat.c deleted file mode 100644 index 427018ca2..000000000 --- a/polymer-perf/eduke32/build/src/compat.c +++ /dev/null @@ -1,846 +0,0 @@ -/* - * Playing-field leveller for Build - * by Jonathon Fowler - * - * A note about this: - * 1. There is some kind of problem somewhere in the functions below because - * compiling with __compat_h_macrodef__ disabled makes stupid things happen. - * 2. The functions below, aside from the ones which aren't trivial, were never - * really intended to be used for anything except tracking anr removing ties - * to the standard C library from games. Using the Bxx versions of functions - * means we can redefine those names to link up with different runtime library - * names. - */ - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#define _WIN32_IE 0x0400 -#define _WIN32_WINNT 0x0501 -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -// #include -#include - -#ifdef __APPLE__ -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 -# include -# include -#endif -#endif - -#if defined(_MSC_VER) -# include -#else -# include -#endif - -#include "compat.h" -#include "baselayer.h" - -#ifndef __compat_h_macrodef__ - -int32_t Brand(void) -{ - return rand(); -} - -void *Bmalloc(bsize_t size) -{ -#ifdef NEDMALLOC - return nedmalloc(size); -#else - return malloc(size); -#endif -} - -void Bfree(void *ptr) -{ -#ifdef NEDMALLOC - nedfree(ptr); -#else - free(ptr); -#endif -} - -int32_t Bopen(const char *pathname, int32_t flags, uint32_t mode) -{ - int32_t n=0,o=0; - - if (flags&BO_BINARY) n|=O_BINARY; else n|=O_TEXT; - if ((flags&BO_RDWR)==BO_RDWR) n|=O_RDWR; - else if ((flags&BO_RDWR)==BO_WRONLY) n|=O_WRONLY; - else if ((flags&BO_RDWR)==BO_RDONLY) n|=O_RDONLY; - if (flags&BO_APPEND) n|=O_APPEND; - if (flags&BO_CREAT) n|=O_CREAT; - if (flags&BO_TRUNC) n|=O_TRUNC; - if (mode&BS_IREAD) o|=S_IREAD; - if (mode&BS_IWRITE) o|=S_IWRITE; - if (mode&BS_IEXEC) o|=S_IEXEC; - - return open(pathname,n,o); -} - -int32_t Bclose(int32_t fd) -{ - return close(fd); -} - -bssize_t Bwrite(int32_t fd, const void *buf, bsize_t count) -{ - return write(fd,buf,count); -} - -bssize_t Bread(int32_t fd, void *buf, bsize_t count) -{ - return read(fd,buf,count); -} - -int32_t Blseek(int32_t fildes, int32_t offset, int32_t whence) -{ - switch (whence) - { - case BSEEK_SET: - whence=SEEK_SET; break; - case BSEEK_CUR: - whence=SEEK_CUR; break; - case BSEEK_END: - whence=SEEK_END; break; - } - return lseek(fildes,offset,whence); -} - -BFILE *Bfopen(const char *path, const char *mode) -{ - return (BFILE *)fopen(path,mode); -} - -int32_t Bfclose(BFILE *stream) -{ - return fclose((FILE *)stream); -} - -void Brewind(BFILE *stream) -{ - rewind((FILE *)stream); -} - -int32_t Bfgetc(BFILE *stream) -{ - return fgetc((FILE *)stream); -} - -char *Bfgets(char *s, int32_t size, BFILE *stream) -{ - return fgets(s,size,(FILE *)stream); -} - -int32_t Bfputc(int32_t c, BFILE *stream) -{ - return fputc(c,(FILE *)stream); -} - -int32_t Bfputs(const char *s, BFILE *stream) -{ - return fputs(s,(FILE *)stream); -} - -bsize_t Bfread(void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream) -{ - return fread(ptr,size,nmemb,(FILE *)stream); -} - -bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream) -{ - return fwrite(ptr,size,nmemb,(FILE *)stream); -} - - -char *Bstrdup(const char *s) -{ -#ifdef NEDMALLOC - return nedstrdup(s); -#else - return strdup(s); -#endif -} - -char *Bstrcpy(char *dest, const char *src) -{ - return strcpy(dest,src); -} - -char *Bstrncpy(char *dest, const char *src, bsize_t n) -{ - return Bstrncpy(dest,src,n); -} - -int32_t Bstrcmp(const char *s1, const char *s2) -{ - return strcmp(s1,s2); -} - -int32_t Bstrncmp(const char *s1, const char *s2, bsize_t n) -{ - return strncmp(s1,s2,n); -} - -int32_t Bstrcasecmp(const char *s1, const char *s2) -{ -#ifdef _MSC_VER - return _stricmp(s1,s2); -#else - return strcasecmp(s1,s2); -#endif -} - -int32_t Bstrncasecmp(const char *s1, const char *s2, bsize_t n) -{ -#ifdef _MSC_VER - return _strnicmp(s1,s2,n); -#else - return strncasecmp(s1,s2,n); -#endif -} - -char *Bstrcat(char *dest, const char *src) -{ - return strcat(dest,src); -} - -char *Bstrncat(char *dest, const char *src, bsize_t n) -{ - return strncat(dest,src,n); -} - -bsize_t Bstrlen(const char *s) -{ - return strlen(s); -} - -char *Bstrchr(const char *s, int32_t c) -{ - return strchr(s,c); -} - -char *Bstrrchr(const char *s, int32_t c) -{ - return strrchr(s,c); -} - -int32_t Batoi(const char *nptr) -{ - return atoi(nptr); -} - -int32_t Batol(const char *nptr) -{ - return atol(nptr); -} - -int32_t int32_t Bstrtol(const char *nptr, char **endptr, int32_t base) -{ - return strtol(nptr,endptr,base); -} - -uint32_t int32_t Bstrtoul(const char *nptr, char **endptr, int32_t base) -{ - return strtoul(nptr,endptr,base); -} - -void *Bmemcpy(void *dest, const void *src, bsize_t n) -{ - return memcpy(dest,src,n); -} - -void *Bmemmove(void *dest, const void *src, bsize_t n) -{ - return memmove(dest,src,n); -} - -void *Bmemchr(const void *s, int32_t c, bsize_t n) -{ - return memchr(s,c,n); -} - -void *Bmemset(void *s, int32_t c, bsize_t n) -{ - return memset(s,c,n); -} - -int32_t Bprintf(const char *format, ...) -{ - va_list ap; - int32_t r; - - va_start(ap,format); -#ifdef _MSC_VER - r = _vprintf(format,ap); -#else - r = vprintf(format,ap); -#endif - va_end(ap); - return r; -} - -int32_t Bsprintf(char *str, const char *format, ...) -{ - va_list ap; - int32_t r; - - va_start(ap,format); -#ifdef _MSC_VER - r = _vsprintf(str,format,ap); -#else - r = vsprintf(str,format,ap); -#endif - va_end(ap); - return r; -} - -int32_t Bsnprintf(char *str, bsize_t size, const char *format, ...) -{ - va_list ap; - int32_t r; - - va_start(ap,format); -#ifdef _MSC_VER - r = _vsnprintf(str,size,format,ap); -#else - r = vsnprintf(str,size,format,ap); -#endif - va_end(ap); - return r; -} - -int32_t Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap) -{ -#ifdef _MSC_VER - return _vsnprintf(str,size,format,ap); -#else - return vsnprintf(str,size,format,ap); -#endif -} - -char *Bgetenv(const char *name) -{ - return getenv(name); -} - -char *Bgetcwd(char *buf, bsize_t size) -{ - return getcwd(buf,size); -} - -#endif // __compat_h_macrodef__ - - -// -// Stuff which must be a function -// - -char *Bgethomedir(void) -{ -#ifdef _WIN32 - FARPROC aSHGetSpecialFolderPathA; - TCHAR appdata[MAX_PATH]; - int32_t loaded = 0; - HMODULE hShell32 = GetModuleHandle("shell32.dll"); - - if (hShell32 == NULL) - { - hShell32 = LoadLibrary("shell32.dll"); - loaded = 1; - } - - if (hShell32 == NULL) - return NULL; - - aSHGetSpecialFolderPathA = GetProcAddress(hShell32, "SHGetSpecialFolderPathA"); - if (aSHGetSpecialFolderPathA != NULL) - if (SUCCEEDED(aSHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE))) - { - if (loaded) - FreeLibrary(hShell32); - return Bstrdup(appdata); - } - - if (loaded) - FreeLibrary(hShell32); - return NULL; -#elif defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 - FSRef ref; - CFStringRef str; - CFURLRef base; - char *s; - - if (FSFindFolder(kUserDomain, kVolumeRootFolderType, kDontCreateFolder, &ref) < 0) return NULL; - base = CFURLCreateFromFSRef(NULL, &ref); - if (!base) return NULL; - str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle); - CFRelease(base); - if (!str) return NULL; - s = (char *)CFStringGetCStringPtr(str,CFStringGetSystemEncoding()); - if (s) s = Bstrdup(s); - CFRelease(str); - return s; -#else - char *e = getenv("HOME"); - if (!e) return NULL; - return Bstrdup(e); -#endif -} - -char *Bgetsupportdir(int32_t global) -{ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3_ - UNREFERENCED_PARAMETER(global); - return Bgethomedir(); -#else - FSRef ref; - CFStringRef str; - CFURLRef base; - char *s; - - if (FSFindFolder(global ? kLocalDomain : kUserDomain, - kApplicationSupportFolderType, - kDontCreateFolder, &ref) < 0) return NULL; - base = CFURLCreateFromFSRef(NULL, &ref); - if (!base) return NULL; - str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle); - CFRelease(base); - if (!str) return NULL; - s = (char *)CFStringGetCStringPtr(str,CFStringGetSystemEncoding()); - if (s) s = Bstrdup(s); - CFRelease(str); - return s; -#endif -} - -int32_t Bcorrectfilename(char *filename, int32_t removefn) -{ - char *fn; - char *tokarr[64], *first, *next = NULL, *token; - int32_t i, ntok = 0, leadslash = 0, trailslash = 0; - - fn = Bstrdup(filename); - if (!fn) return -1; - - for (first=fn; *first; first++) - { -#ifdef _WIN32 - if (*first == '\\') *first = '/'; -#endif - } - leadslash = (*fn == '/'); - trailslash = (first>fn && first[-1] == '/'); - - first = fn; - do - { - token = Bstrtoken(first, "/", &next, 1); - first = NULL; - if (!token) break; - else if (token[0] == 0) continue; - else if (token[0] == '.' && token[1] == 0) continue; - else if (token[0] == '.' && token[1] == '.' && token[2] == 0) ntok = max(0,ntok-1); - else tokarr[ntok++] = token; - } - while (1); - - if (!trailslash && removefn) { ntok = max(0,ntok-1); trailslash = 1; } - if (ntok == 0 && trailslash && leadslash) trailslash = 0; - - first = filename; - if (leadslash) *(first++) = '/'; - for (i=0; i0) *(first++) = '/'; - for (token=tokarr[i]; *token; token++) - *(first++) = *token; - } - if (trailslash) *(first++) = '/'; - *(first++) = 0; - - Bfree(fn); - return 0; -} - -int32_t Bcanonicalisefilename(char *filename, int32_t removefn) -{ - char cwd[BMAX_PATH], fn[BMAX_PATH], *p; - char *fnp = filename; -#ifdef _WIN32 - int32_t drv = 0; -#endif - -#ifdef _WIN32 - { - if (filename[0] && filename[1] == ':') - { - // filename is prefixed with a drive - drv = toupper(filename[0])-'A' + 1; - fnp += 2; - } - if (!_getdcwd(drv, cwd, sizeof(cwd))) return -1; - for (p=cwd; *p; p++) if (*p == '\\') *p = '/'; - } -#else - if (!getcwd(cwd,sizeof(cwd))) return -1; -#endif - p = strrchr(cwd,'/'); if (!p || p[1]) strcat(cwd, "/"); - - strcpy(fn, fnp); -#ifdef _WIN32 - for (p=fn; *p; p++) if (*p == '\\') *p = '/'; -#endif - - if (fn[0] != '/') - { - // we are dealing with a path relative to the current directory - strcpy(filename, cwd); - strcat(filename, fn); - } - else - { -#ifdef _WIN32 - filename[0] = cwd[0]; - filename[1] = ':'; - filename[2] = 0; -#else - filename[0] = 0; -#endif - strcat(filename, fn); - } - fnp = filename; -#ifdef _WIN32 - fnp += 2; // skip the drive -#endif - UNREFERENCED_PARAMETER(removefn); // change the call below to use removefn instead of 1? - return Bcorrectfilename(fnp,1); -} - -char *Bgetsystemdrives(void) -{ -#ifdef _WIN32 - char *str, *p; - DWORD drv, mask; - int32_t number=0; - - drv = GetLogicalDrives(); - if (drv == 0) return NULL; - - for (mask=1; mask<0x8000000l; mask<<=1) - { - if ((drv&mask) == 0) continue; - number++; - } - - str = p = (char *)Bmalloc(1 + (3*number)); - if (!str) return NULL; - - number = 0; - for (mask=1; mask<0x8000000l; mask<<=1, number++) - { - if ((drv&mask) == 0) continue; - *(p++) = 'A' + number; - *(p++) = ':'; - *(p++) = 0; - } - *(p++) = 0; - - return str; -#else - // Perhaps have Unix OS's put /, /home/user, and /mnt/* in the "drives" list? - return NULL; -#endif -} - - -int32_t Bfilelength(int32_t fd) -{ - struct stat st; - if (fstat(fd, &st) < 0) return -1; - return(int32_t)(st.st_size); -} - - -typedef struct -{ -#ifdef _MSC_VER - int32_t dir; - struct _finddata_t fid; -#else - DIR *dir; -#endif - struct Bdirent info; - int32_t status; - char name[1]; -} BDIR_real; - -BDIR *Bopendir(const char *name) -{ - BDIR_real *dirr; -#ifdef _MSC_VER - char *t,*tt; - t = (char *)Bmalloc(strlen(name)+1+4); - if (!t) return NULL; -#endif - - dirr = (BDIR_real *)Bmalloc(sizeof(BDIR_real) + strlen(name)); - if (!dirr) - { -#ifdef _MSC_VER - Bfree(t); -#endif - return NULL; - } - -#ifdef _MSC_VER - strcpy(t,name); - tt = t+strlen(name)-1; - while (*tt == ' ' && tt>t) tt--; - if (*tt != '/' && *tt != '\\') *(++tt) = '/'; - *(++tt) = '*'; - *(++tt) = '.'; - *(++tt) = '*'; - *(++tt) = 0; - - dirr->dir = _findfirst(t,&dirr->fid); - Bfree(t); - if (dirr->dir == -1) - { - Bfree(dirr); - return NULL; - } -#else - dirr->dir = opendir(name); - if (dirr->dir == NULL) - { - Bfree(dirr); - return NULL; - } -#endif - - dirr->status = 0; - strcpy(dirr->name, name); - - return (BDIR *)dirr; -} - -struct Bdirent *Breaddir(BDIR *dir) -{ - BDIR_real *dirr = (BDIR_real *)dir; - struct dirent *de; - struct stat st; - char *fn; - -#ifdef _MSC_VER - if (dirr->status > 0) - { - if (_findnext(dirr->dir,&dirr->fid) != 0) - { - dirr->status = -1; - return NULL; - } - } - dirr->info.namlen = strlen(dirr->fid.name); - dirr->info.name = dirr->fid.name; - dirr->status++; -#else - de = readdir(dirr->dir); - if (de == NULL) - { - dirr->status = -1; - return NULL; - } - else - { - dirr->status++; - } - //# if defined(__WATCOMC__) || defined(__linux) || defined(__BEOS__) || defined(__QNX__) || defined(SKYOS) - dirr->info.namlen = strlen(de->d_name); - //# else - // dirr->info.namlen = de->d_namlen; - //# endif - dirr->info.name = de->d_name; -#endif - dirr->info.mode = 0; - dirr->info.size = 0; - dirr->info.mtime = 0; - - fn = (char *)Bmalloc(strlen(dirr->name) + 1 + dirr->info.namlen + 1); - if (fn) - { - Bsprintf(fn,"%s/%s",dirr->name,dirr->info.name); - if (!Bstat(fn, &st)) - { - dirr->info.mode = st.st_mode; - dirr->info.size = st.st_size; - dirr->info.mtime = st.st_mtime; - } - Bfree(fn); - } - - return &dirr->info; -} - -int32_t Bclosedir(BDIR *dir) -{ - BDIR_real *dirr = (BDIR_real *)dir; - -#ifdef _MSC_VER - _findclose(dirr->dir); -#else - closedir(dirr->dir); -#endif - Bfree(dirr); - - return 0; -} - - -char *Bstrtoken(char *s, const char *delim, char **ptrptr, int32_t chop) -{ - char *p, *start; - - if (!ptrptr) return NULL; - - if (s) p = s; - else p = *ptrptr; - - if (!p) return NULL; - - while (*p != 0 && strchr(delim, *p)) p++; - if (*p == 0) - { - *ptrptr = NULL; - return NULL; - } - start = p; - while (*p != 0 && !strchr(delim, *p)) p++; - if (*p == 0) *ptrptr = NULL; - else - { - if (chop) *(p++) = 0; - *ptrptr = p; - } - - return start; -} - - -//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher -//Given: string i and string j. string j can have wildcards -//Returns: 1:matches, 0:doesn't match -int32_t Bwildmatch(const char *i, const char *j) -{ - const char *k; - char c0, c1; - - if (!*j) return(1); - do - { - if (*j == '*') - { - for (k=i,j++; *k; k++) if (Bwildmatch(k,j)) return(1); - continue; - } - if (!*i) return(0); - if (*j == '?') { i++; j++; continue; } - c0 = *i; if ((c0 >= 'a') && (c0 <= 'z')) c0 -= 32; - c1 = *j; if ((c1 >= 'a') && (c1 <= 'z')) c1 -= 32; -#ifdef _WIN32 - if (c0 == '/') c0 = '\\'; - if (c1 == '/') c1 = '\\'; -#endif - if (c0 != c1) return(0); - i++; j++; - } - while (*j); - return(!*i); -} - -#if !defined(_WIN32) -char *Bstrlwr(char *s) -{ - char *t = s; - if (!s) return s; - while (*t) { *t = Btolower(*t); t++; } - return s; -} - -char *Bstrupr(char *s) -{ - char *t = s; - if (!s) return s; - while (*t) { *t = Btoupper(*t); t++; } - return s; -} -#endif - - -// -// Bgetsysmemsize() -- gets the amount of system memory in the machine -// -uint32_t Bgetsysmemsize(void) -{ -#ifdef _WIN32 - uint32_t siz = UINT_MAX; - HMODULE lib = LoadLibrary("KERNEL32.DLL"); - - if (lib) - { - BOOL (WINAPI *aGlobalMemoryStatusEx)(LPMEMORYSTATUSEX) = - (void *)GetProcAddress(lib, "GlobalMemoryStatusEx"); - - if (aGlobalMemoryStatusEx) - { - //WinNT - MEMORYSTATUSEX memst; - memst.dwLength = sizeof(MEMORYSTATUSEX); - if (aGlobalMemoryStatusEx(&memst)) - siz = (uint32_t)min(UINT_MAX, memst.ullTotalPhys); - } - else - { - // Yeah, there's enough Win9x hatred here that a perfectly good workaround - // has been replaced by an error message. Oh well, we don't support 9x anyway. - initprintf("Bgetsysmemsize(): error determining system memory size!\n"); - } - - FreeLibrary(lib); - } - - return siz; -#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES) - uint32_t siz = UINT_MAX; - int64_t scpagesiz, scphyspages; - -#ifdef _SC_PAGE_SIZE - scpagesiz = sysconf(_SC_PAGE_SIZE); -#else - scpagesiz = sysconf(_SC_PAGESIZE); -#endif - scphyspages = sysconf(_SC_PHYS_PAGES); - if (scpagesiz >= 0 && scphyspages >= 0) - siz = (uint32_t)min(UINT_MAX, (int64_t)scpagesiz * (int64_t)scphyspages); - - //initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n", - // scphyspages, scpagesiz, siz); - - return siz; -#else - return UINT_MAX; -#endif -} - - - diff --git a/polymer-perf/eduke32/build/src/config.c b/polymer-perf/eduke32/build/src/config.c deleted file mode 100644 index e6cce4e0d..000000000 --- a/polymer-perf/eduke32/build/src/config.c +++ /dev/null @@ -1,556 +0,0 @@ -// Evil and Nasty Configuration File Reader for KenBuild -// by Jonathon Fowler - -#include "compat.h" -#include "build.h" -#include "editor.h" -#include "osd.h" - -#ifdef RENDERTYPEWIN -#include "winlayer.h" -#endif -#include "baselayer.h" - -static int32_t vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400}, - {360,400},{640,350},{640,400},{640,480},{800,600}, - {1024,768},{1280,1024},{1600,1200} -}; - -static int32_t readconfig(BFILE *fp, const char *key, char *value, uint32_t len) -{ - char buf[1000], *k, *v, *eq; - int32_t x=0; - - if (len < 1) return 0; - - Brewind(fp); - - while (1) - { - if (!Bfgets(buf, 1000, fp)) return 0; - - if (buf[0] == ';') continue; - - eq = Bstrchr(buf, '='); - if (!eq) continue; - - k = buf; - v = eq+1; - - while (*k == ' ' || *k == '\t') k++; - *(eq--) = 0; - while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0; - - if (Bstrcasecmp(k, key)) continue; - - while (*v == ' ' || *k == '\t') v++; - eq = v + Bstrlen(v)-1; - - while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0; - - value[--len] = 0; - do value[x] = v[x]; while (v[x++] != 0 && len-- > 0); - - return x-1; - } -} - -extern int16_t brightness; -extern int32_t vsync; -extern char game_executable[BMAX_PATH]; -extern int32_t fullscreen; -extern char default_buildkeys[NUMBUILDKEYS]; -static char *const keys = default_buildkeys; -extern char remap[256]; -extern int32_t remapinit; -extern double msens; -extern int32_t editorgridextent, grid, autogrid; -static int32_t default_grid=3; -extern int32_t graphicsmode; -extern int32_t AmbienceToggle, MixRate; -extern int32_t ParentalLock; - -/* - * SETUP.DAT - * 0 = video mode (0:chained 1:vesa 2:screen buffered 3/4/5:tseng/paradise/s3 6:red-blue) - * 1 = sound (0:none) - * 2 = music (0:none) - * 3 = input (0:keyboard 1:+mouse) - * 4 = multiplayer (0:single 1-4:com 5-11:ipx) - * 5&0xf0 = com speed - * 5&0x0f = com irq - * 6&0xf0 = chained y-res - * 6&0x0f = chained x-res or vesa mode - * 7&0xf0 = sound samplerate - * 7&0x01 = sound quality - * 7&0x02 = 8/16 bit - * 7&0x04 = mono/stereo - * - * bytes 8 to 26 are key settings: - * 0 = Forward (0xc8) - * 1 = Backward (0xd0) - * 2 = Turn left (0xcb) - * 3 = Turn right (0xcd) - * 4 = Run (0x2a) - * 5 = Strafe (0x9d) - * 6 = Fire (0x1d) - * 7 = Use (0x39) - * 8 = Stand high (0x1e) - * 9 = Stand low (0x2c) - * 10 = Look up (0xd1) - * 11 = Look down (0xc9) - * 12 = Strafe left (0x33) - * 13 = Strafe right (0x34) - * 14 = 2D/3D switch (0x9c) - * 15 = View cycle (0x1c) - * 16 = 2D Zoom in (0xd) - * 17 = 2D Zoom out (0xc) - * 18 = Chat (0xf) - */ - -int32_t loadsetup(const char *fn) -{ - BFILE *fp; -#define VL 1024 - char val[VL]; - int32_t i; - - if ((fp = Bfopen(fn, "rt")) == NULL) return -1; - - if (readconfig(fp, "forcesetup", val, VL) > 0) { if (Batoi(val) != 0) forcesetup = 1; else forcesetup = 0; } - if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; } - if (readconfig(fp, "resolution", val, VL) > 0) - { - i = Batoi(val) & 0x0f; - if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; } - } - if (readconfig(fp, "2dresolution", val, VL) > 0) - { - i = Batoi(val) & 0x0f; - if ((unsigned)i<13) { xdim2d = vesares[i][0]; ydim2d = vesares[i][1]; } - } - if (readconfig(fp, "xdim2d", val, VL) > 0) xdim2d = Batoi(val); - if (readconfig(fp, "ydim2d", val, VL) > 0) ydim2d = Batoi(val); - if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val); - if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val); -// if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4; -// if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; } -// if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; } - if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val); - if (readconfig(fp, "vsync", val, VL) > 0) vsync = Batoi(val)?1:0; - if (readconfig(fp, "editorgridextent", val, VL) > 0) editorgridextent = max(min(262144,Batoi(val)),32768); - if (readconfig(fp, "grid", val, VL) > 0) - { - grid = Batoi(val); - default_grid = grid; - autogrid = (grid==9); - grid = min(max(0, grid), 8); - } -#ifdef POLYMER - if (readconfig(fp, "rendmode", val, VL) > 0) { i = Batoi(val); glrendmode = i; } -#endif - if (readconfig(fp, "vid_gamma", val, VL) > 0) vid_gamma = Bstrtod(val, NULL); - if (readconfig(fp, "vid_brightness", val, VL) > 0) vid_brightness = Bstrtod(val, NULL); - if (readconfig(fp, "vid_contrast", val, VL) > 0) vid_contrast = Bstrtod(val, NULL); -#ifdef RENDERTYPEWIN - if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val); -#endif -#ifdef USE_OPENGL - if (readconfig(fp, "usemodels", val, VL) > 0) usemodels = Batoi(val)?1:0; - if (readconfig(fp, "usehightile", val, VL) > 0) usehightile = Batoi(val)?1:0; - - glusetexcache = -1; - if (readconfig(fp, "glusetexcache", val, VL) > 0) - { - glusetexcache = clamp(Batoi(val), 0, 2); - } - if (readconfig(fp, "gltexfiltermode", val, VL) > 0) - { - gltexfiltermode = Batoi(val); - } - if (readconfig(fp, "glanisotropy", val, VL) > 0) - { - glanisotropy = Batoi(val); - } - if (readconfig(fp, "r_downsize", val, VL) > 0) - { - r_downsize = Batoi(val); - r_downsize = clamp(r_downsize, 0, 5); - r_downsizevar = r_downsize; - } - if (readconfig(fp, "r_texcompr", val, VL) > 0) - { - glusetexcompr = !!Batoi(val); - } -#endif - - if (readconfig(fp, "gameexecutable", val, VL) > 0) - Bstrcpy(game_executable, val); - -// option[0] = 1; // vesa all the way... -// option[1] = 1; // sound all the way... -// option[4] = 0; // no multiplayer -// option[5] = 0; - -#if 1 - if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16); - if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16); -#endif - -#ifdef RENDERTYPEWIN - if (readconfig(fp, "windowpositioning", val, VL) > 0) windowpos = Batoi(val); - windowx = -1; - if (readconfig(fp, "windowposx", val, VL) > 0) windowx = Batoi(val); - windowy = -1; - if (readconfig(fp, "windowposy", val, VL) > 0) windowy = Batoi(val); -#endif - - if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); } - - if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL); - - if (readconfig(fp, "mousenavigation", val, VL) > 0) unrealedlook = !!Batoi(val); - - if (readconfig(fp, "mousenavigationaccel", val, VL) > 0) pk_uedaccel = Batoi(val); - - if (readconfig(fp, "quickmapcycling", val, VL) > 0) quickmapcycling = !!Batoi(val); - - if (readconfig(fp, "sideview_reversehorizrot", val, VL) > 0) sideview_reversehrot = !!Batoi(val); - if (readconfig(fp, "revertCTRL", val, VL) > 0) revertCTRL = !!Batoi(val); - - if (readconfig(fp, "scrollamount", val, VL) > 0) scrollamount = Batoi(val); - - if (readconfig(fp, "turnaccel", val, VL) > 0) pk_turnaccel = Batoi(val); - - if (readconfig(fp, "turndecel", val, VL) > 0) pk_turndecel = Batoi(val); - -// if (readconfig(fp, "autosave", val, VL) > 0) autosave = Batoi(val)*60; - if (readconfig(fp, "autosavesec", val, VL) > 0) autosave = max(0, Batoi(val)); - if (readconfig(fp, "autocorruptchecksec", val, VL) > 0) autocorruptcheck = max(0, Batoi(val)); - - if (readconfig(fp, "showheightindicators", val, VL) > 0) - showheightindicators = min(max(Batoi(val),0),2); - if (readconfig(fp, "showambiencesounds", val, VL) > 0) - showambiencesounds = min(max(Batoi(val),0),2); - - if (readconfig(fp, "graphicsmode", val, VL) > 0) - graphicsmode = min(max(Batoi(val),0),2); - - if (readconfig(fp, "samplerate", val, VL) > 0) MixRate = min(max(8000, Batoi(val)), 48000); - if (readconfig(fp, "ambiencetoggle", val, VL) > 0) AmbienceToggle = !!Batoi(val); - if (readconfig(fp, "parlock", val, VL) > 0) ParentalLock = !!Batoi(val); - - if (readconfig(fp, "osdtryscript", val, VL) > 0) m32_osd_tryscript = !!Batoi(val); - - for (i=0; i<256; i++) - remap[i]=i; - - remapinit=1; - if (readconfig(fp, "remap", val, VL) > 0) - { - char *p=val; int32_t v1,v2; - while (*p) - { - if (!sscanf(p,"%x",&v1))break; - if ((p=strchr(p,'-'))==0)break; p++; - if (!sscanf(p,"%x",&v2))break; - remap[v1]=v2; - initprintf("Remap %X key to %X\n",v1,v2); - if ((p=strchr(p,','))==0)break; p++; - } - } - - // load m32script history - for (i=0; i>1)) : (j>>1); - crc32table[i] = j; - } -} - -uint32_t crc32once(uint8_t *blk, uint32_t len) -{ - uint32_t crc; - - crc32init(&crc); - crc32block(&crc, blk, len); - return crc32finish(&crc); -} diff --git a/polymer-perf/eduke32/build/src/defs.c b/polymer-perf/eduke32/build/src/defs.c deleted file mode 100644 index daed7423f..000000000 --- a/polymer-perf/eduke32/build/src/defs.c +++ /dev/null @@ -1,1940 +0,0 @@ -/* - * Definitions file parser for Build - * by Jonathon Fowler (jonof@edgenetwork.org) - * Remixed substantially by Ken Silverman - * See the included license file "BUILDLIC.TXT" for license info. - */ - -#include "build.h" -#include "compat.h" -#include "engine_priv.h" -#include "baselayer.h" -#include "scriptfile.h" -#include "cache1d.h" -#include "kplib.h" -#include "quicklz.h" - -enum scripttoken_t -{ - T_EOF = -2, - T_ERROR = -1, - T_INCLUDE = 0, - T_DEFINE, - T_DEFINETEXTURE, - T_DEFINESKYBOX, - T_DEFINETINT, - T_DEFINEMODEL, - T_DEFINEMODELFRAME, - T_DEFINEMODELANIM, - T_DEFINEMODELSKIN, - T_SELECTMODELSKIN, - T_DEFINEVOXEL, - T_DEFINEVOXELTILES, - T_MODEL, - T_FILE, - T_SCALE, - T_SHADE, - T_FRAME, - T_SMOOTHDURATION, - T_ANIM, - T_SKIN, - T_SURF, - T_TILE, - T_TILE0, - T_TILE1, - T_FRAME0, - T_FRAME1, - T_FPS, - T_FLAGS, - T_PAL, - T_BASEPAL, - T_DETAIL, - T_GLOW, - T_SPECULAR, - T_NORMAL, - T_PARAM, - T_HUD, - T_XADD, - T_YADD, - T_ZADD, - T_ANGADD, - T_FOV, - T_FLIPPED, - T_HIDE, - T_NOBOB, - T_NODEPTH, - T_VOXEL, - T_SKYBOX, - T_FRONT,T_RIGHT,T_BACK,T_LEFT,T_TOP,T_BOTTOM, - T_HIGHPALOOKUP, - T_TINT,T_RED,T_GREEN,T_BLUE, - T_TEXTURE,T_ALPHACUT,T_XSCALE,T_YSCALE,T_SPECPOWER,T_SPECFACTOR,T_NOCOMPRESS,T_NODOWNSIZE, - T_UNDEFMODEL,T_UNDEFMODELRANGE,T_UNDEFMODELOF,T_UNDEFTEXTURE,T_UNDEFTEXTURERANGE, - T_ALPHAHACK,T_ALPHAHACKRANGE, - T_SPRITECOL,T_2DCOL, - T_FOGPAL, - T_LOADGRP, - T_DUMMYTILE,T_DUMMYTILERANGE, - T_SETUPTILE,T_SETUPTILERANGE, - T_ANIMTILERANGE, - T_CACHESIZE, - T_IMPORTTILE, - T_MUSIC,T_ID,T_SOUND, - T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET -}; - -typedef struct { const char *text; int32_t tokenid; } tokenlist; - -static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens) -{ - char *tok; - int32_t i; - - if (!sf) return T_ERROR; - tok = scriptfile_gettoken(sf); - if (!tok) return T_EOF; - - for (i=ntokens-1; i>=0; i--) - { - if (!Bstrcasecmp(tok, tl[i].text)) - return tl[i].tokenid; - } - - return T_ERROR; -} - -static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0; -extern int32_t nextvoxid; - -#ifdef USE_OPENGL -extern float alphahackarray[MAXTILES]; -#endif - -static const char *skyfaces[6] = -{ - "front face", "right face", "back face", - "left face", "top face", "bottom face" -}; - -static int32_t defsparser(scriptfile *script) -{ - int32_t tokn; - char *cmdtokptr; - - static const tokenlist basetokens[] = - { - { "include", T_INCLUDE }, - { "#include", T_INCLUDE }, - { "define", T_DEFINE }, - { "#define", T_DEFINE }, - - // deprecated style - { "definetexture", T_DEFINETEXTURE }, - { "defineskybox", T_DEFINESKYBOX }, - { "definetint", T_DEFINETINT }, - { "definemodel", T_DEFINEMODEL }, - { "definemodelframe",T_DEFINEMODELFRAME }, - { "definemodelanim", T_DEFINEMODELANIM }, - { "definemodelskin", T_DEFINEMODELSKIN }, - { "selectmodelskin", T_SELECTMODELSKIN }, - { "definevoxel", T_DEFINEVOXEL }, - { "definevoxeltiles",T_DEFINEVOXELTILES }, - - // new style - { "model", T_MODEL }, - { "voxel", T_VOXEL }, - { "skybox", T_SKYBOX }, - { "highpalookup", T_HIGHPALOOKUP }, - { "tint", T_TINT }, - { "texture", T_TEXTURE }, - { "tile", T_TEXTURE }, - { "music", T_MUSIC }, - { "sound", T_SOUND }, - - // other stuff - { "undefmodel", T_UNDEFMODEL }, - { "undefmodelrange", T_UNDEFMODELRANGE }, - { "undefmodelof", T_UNDEFMODELOF }, - { "undeftexture", T_UNDEFTEXTURE }, - { "undeftexturerange", T_UNDEFTEXTURERANGE }, - { "alphahack", T_ALPHAHACK }, - { "alphahackrange", T_ALPHAHACKRANGE }, - { "spritecol", T_SPRITECOL }, - { "2dcol", T_2DCOL }, - { "fogpal", T_FOGPAL }, - { "loadgrp", T_LOADGRP }, - { "dummytile", T_DUMMYTILE }, - { "dummytilerange", T_DUMMYTILERANGE }, - { "setuptile", T_SETUPTILE }, - { "setuptilerange", T_SETUPTILERANGE }, - { "animtilerange", T_ANIMTILERANGE }, - { "cachesize", T_CACHESIZE }, - { "dummytilefrompic",T_IMPORTTILE }, - { "tilefromtexture", T_TILEFROMTEXTURE }, - }; - - while (1) - { - if (quitevent) return 0; - tokn = getatoken(script,basetokens,sizeof(basetokens)/sizeof(tokenlist)); - cmdtokptr = script->ltextptr; - switch (tokn) - { - case T_ERROR: - initprintf("Error on line %s:%d.\n", script->filename,scriptfile_getlinum(script,cmdtokptr)); - break; - case T_EOF: - return(0); - case T_INCLUDE: - { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included; - - included = scriptfile_fromfile(fn); - if (!included) - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - defsparser(included); - scriptfile_close(included); - } - } - break; - } - case T_DEFINE: - { - char *name; - int32_t number; - - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getsymbol(script,&number)) break; - - if (scriptfile_addsymbolvalue(name,number) < 0) - initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", - name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); - break; - } - - // OLD (DEPRECATED) DEFINITION SYNTAX - case T_DEFINETEXTURE: - { - int32_t tile,pal,fnoo,i; - char *fn, *tfn = NULL; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getnumber(script,&fnoo)) break; //x-center - if (scriptfile_getnumber(script,&fnoo)) break; //y-center - if (scriptfile_getnumber(script,&fnoo)) break; //x-size - if (scriptfile_getnumber(script,&fnoo)) break; //y-size - if (scriptfile_getstring(script,&fn)) break; - - i = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn,&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn); - pathsearchmode = i; - break; - } - } - else Bfree(tfn); - pathsearchmode = i; - - hicsetsubsttex(tile,pal,fn,-1.0,1.0,1.0,1.0,1.0,0); - } - break; - case T_DEFINESKYBOX: - { - int32_t tile,pal,i,ii; - char *fn[6],happy=1,*tfn = NULL; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getsymbol(script,&i)) break; //future expansion - for (i=0; i<6; i++) - { - if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces - ii = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn[i],&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn[i]); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn[i]); - happy = 0; - } - } - else Bfree(tfn); - pathsearchmode = ii; - } - if (i < 6 || !happy) break; - hicsetskybox(tile,pal,fn); - } - break; - case T_DEFINETINT: - { - int32_t pal, r,g,b,f; - - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getnumber(script,&r)) break; - if (scriptfile_getnumber(script,&g)) break; - if (scriptfile_getnumber(script,&b)) break; - if (scriptfile_getnumber(script,&f)) break; //effects - hicsetpalettetint(pal,r,g,b,f); - } - break; - case T_ALPHAHACK: - { - int32_t tile; - double alpha; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getdouble(script,&alpha)) break; -#ifdef USE_OPENGL - if ((uint32_t)tile < MAXTILES) alphahackarray[tile] = alpha; -#endif - } - break; - case T_ALPHAHACKRANGE: - { - int32_t tilenume1,tilenume2,i; - double alpha; - - if (scriptfile_getsymbol(script,&tilenume1)) break; - if (scriptfile_getsymbol(script,&tilenume2)) break; - if (scriptfile_getdouble(script,&alpha)) break; - if (tilenume2 < tilenume1) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - i = tilenume2; - tilenume2 = tilenume1; - tilenume1 = i; - } -#ifdef USE_OPENGL - if ((tilenume1 >= 0 && tilenume1 < MAXTILES) && (tilenume2 >= 0 && tilenume2 < MAXTILES)) - { - for (i=tilenume1; i<=tilenume2; i++) - { - if ((uint32_t)i < MAXTILES) - alphahackarray[i] = alpha; - } - } -#endif - } - break; - case T_SPRITECOL: - { - int32_t tile,col,col2; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getnumber(script,&col)) break; - if (scriptfile_getnumber(script,&col2)) break; - if ((uint32_t)tile < MAXTILES) - { - spritecol2d[tile][0] = col; - spritecol2d[tile][1] = col2; - } - } - break; - case T_2DCOL: - { - int32_t col,b,g,r; - - if (scriptfile_getnumber(script,&col)) break; - if (scriptfile_getnumber(script,&r)) break; - if (scriptfile_getnumber(script,&g)) break; - if (scriptfile_getnumber(script,&b)) break; - - if (col < 256) - { - vgapal16[col*4+0] = b; // blue - vgapal16[col*4+1] = g; // green - vgapal16[col*4+2] = r; // red - } - } - break; - case T_FOGPAL: - { - int32_t p,r,g,b,j; - char tempbuf[256]; - - if (scriptfile_getnumber(script,&p)) break; - if (scriptfile_getnumber(script,&r)) break; - if (scriptfile_getnumber(script,&g)) break; - if (scriptfile_getnumber(script,&b)) break; - - for (j = 0; j < 256; j++) - tempbuf[j] = j; - makepalookup(p, tempbuf, r, g, b, 1); - } - break; - case T_LOADGRP: - { - char *bs; - scriptfile_getstring(script,&bs); - } - break; - case T_CACHESIZE: - { - int32_t j; - - if (scriptfile_getnumber(script,&j)) break; - } - break; - case T_SETUPTILE: - { - int32_t tile, tmp; - - if (scriptfile_getsymbol(script,&tile)) break; - if (tile >= MAXTILES)break; - if (scriptfile_getsymbol(script,&h_xsize[tile])) break; - if (scriptfile_getsymbol(script,&h_ysize[tile])) break; - if (scriptfile_getsymbol(script,&tmp)) break; - h_xoffs[tile]=tmp; - if (scriptfile_getsymbol(script,&tmp)) break; - h_yoffs[tile]=tmp; - break; - } - case T_SETUPTILERANGE: - { - int32_t tile1,tile2,xsiz,ysiz,xoffs,yoffs,i; - - if (scriptfile_getnumber(script,&tile1)) break; - if (scriptfile_getnumber(script,&tile2)) break; - if (scriptfile_getnumber(script,&xsiz)) break; - if (scriptfile_getnumber(script,&ysiz)) break; - if (scriptfile_getsymbol(script,&xoffs)) break; - if (scriptfile_getsymbol(script,&yoffs)) break; - if (tile2 < tile1) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - i = tile2; - tile2 = tile1; - tile1 = i; - } - if ((tile1 >= 0 && tile1 < MAXTILES) && (tile2 >= 0 && tile2 < MAXTILES)) - { - for (i=tile1; i<=tile2; i++) - { - if ((uint32_t)i < MAXTILES) - { - h_xsize[i] = xsiz; - h_ysize[i] = ysiz; - h_xoffs[i] = xoffs; - h_yoffs[i] = yoffs; - } - } - } - break; - } - case T_ANIMTILERANGE: - { - int32_t tile1, tile2, spd, type, i; - - if (scriptfile_getsymbol(script,&tile1)) break; - if (tile1 >= MAXTILES)break; - if (scriptfile_getsymbol(script,&tile2)) break; - if (tile2 >= MAXTILES)break; - if (scriptfile_getsymbol(script,&spd)) break; - if (scriptfile_getsymbol(script,&type)) break; - if (tile2 < tile1) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - i = tile2; - tile2 = tile1; - tile1 = i; - } - picanm[tile1]=(picanm[tile1]&0xffffff3f)+(spd<<24)+(type<<6)+tile2-tile1; - break; - } - case T_TILEFROMTEXTURE: - { - char *texturetokptr = script->ltextptr, *textureend, *fn = NULL, *tfn = NULL, *ftd = NULL; - int32_t tile=-1, token, i; - int32_t alphacut = 255; - int32_t xoffset = 0, yoffset = 0, goodtogo=0; - - static const tokenlist tilefromtexturetokens[] = - { - { "file", T_FILE }, - { "name", T_FILE }, - { "alphacut", T_ALPHACUT }, - { "xoffset", T_XOFFSET }, - { "xoff", T_XOFFSET }, - { "yoffset", T_YOFFSET }, - { "yoff", T_YOFFSET }, - }; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getbraces(script,&textureend)) break; - while (script->textptr < textureend) - { - token = getatoken(script,tilefromtexturetokens,sizeof(tilefromtexturetokens)/sizeof(tokenlist)); - switch (token) - { - case T_FILE: - scriptfile_getstring(script,&fn); break; - case T_ALPHACUT: - scriptfile_getsymbol(script,&alphacut); break; - case T_XOFFSET: - scriptfile_getsymbol(script,&xoffset); break; - case T_YOFFSET: - scriptfile_getsymbol(script,&yoffset); break; - default: - break; - } - - if ((unsigned)tile > (unsigned)MAXTILES) break; // message is printed later - if (!fn) - { - initprintf("Error: missing 'file name' for tilefromtexture definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,texturetokptr)); - break; - } - if (alphacut > 255) alphacut = 255; - if (alphacut < 0) alphacut = 0; - - i = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn,&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn); - pathsearchmode = i; - break; - } - } - else Bfree(tfn); - pathsearchmode = i; - goodtogo = 1; - } - - if ((unsigned)tile >= (unsigned)MAXTILES) - { - initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,texturetokptr)); - break; - } - - if (goodtogo) - { - int32_t xsiz, ysiz, j; - int32_t *picptr = NULL; - palette_t *col; - - kpzload(fn, (intptr_t *)&picptr, &j, &xsiz, &ysiz); - - // initprintf("got bpl %d xsiz %d ysiz %d\n",bpl,xsiz,ysiz); - - ftd = Bmalloc(xsiz*ysiz); - faketiledata[tile] = Bmalloc(xsiz*ysiz); - - for (i=xsiz-1; i>=0; i--) - { - for (j=ysiz-1; j>=0; j--) - { - col = (palette_t *)&picptr[j*xsiz+i]; - if (col->f < alphacut) { ftd[i*ysiz+j] = 255; continue; } - ftd[i*ysiz+j] = getclosestcol(col->b>>2,col->g>>2,col->r>>2); - } - // initprintf(" %d %d %d %d\n",col->r,col->g,col->b,col->f); - } - - if (xsiz > 0 && ysiz > 0) - { - tilesizx[tile] = xsiz; - tilesizy[tile] = ysiz; - - faketilesiz[tile] = qlz_compress(ftd, faketiledata[tile], xsiz*ysiz, state_compress); - - xoffset = clamp(xoffset, -128, 127); - picanm[tile] = (picanm[tile]&0xffff00ff)+((xoffset&255)<<8); - yoffset = clamp(yoffset, -128, 127); - picanm[tile] = (picanm[tile]&0xff00ffff)+((yoffset&255)<<16); - - j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; - picsiz[tile] = ((uint8_t)j); - j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; - picsiz[tile] += ((uint8_t)(j<<4)); - } - - Bfree(picptr); - Bfree(ftd); - } - } - break; - case T_IMPORTTILE: - { - int32_t tile, xsiz, ysiz, j, i; - int32_t *picptr = NULL; - int32_t bpl; - char *fn, *ftd = NULL; - palette_t *col; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getstring(script,&fn)) break; - - kpzload(fn, (intptr_t *)&picptr, &bpl, &xsiz, &ysiz); - -// initprintf("got bpl %d xsiz %d ysiz %d\n",bpl,xsiz,ysiz); - - ftd = Bmalloc(xsiz*ysiz); - faketiledata[tile] = Bmalloc(xsiz*ysiz); - - for (i=xsiz-1; i>=0; i--) - { - for (j=ysiz-1; j>=0; j--) - { - col = (palette_t *)&picptr[j*xsiz+i]; - if (col->f != 255) { ftd[i*ysiz+j] = 255; continue; } - ftd[i*ysiz+j] = getclosestcol(col->b>>2,col->g>>2,col->r>>2); - } -// initprintf(" %d %d %d %d\n",col->r,col->g,col->b,col->f); - } - - if (xsiz > 0 && ysiz > 0) - { - tilesizx[tile] = xsiz; - tilesizy[tile] = ysiz; - faketilesiz[tile] = qlz_compress(ftd, faketiledata[tile], xsiz*ysiz, state_compress); - picanm[tile] = 0; - - j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; - picsiz[tile] = ((uint8_t)j); - j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; - picsiz[tile] += ((uint8_t)(j<<4)); - } - - Bfree(picptr); - Bfree(ftd); - break; - } - case T_DUMMYTILE: - { - int32_t tile, xsiz, ysiz, j; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getsymbol(script,&xsiz)) break; - if (scriptfile_getsymbol(script,&ysiz)) break; - - if (xsiz > 0 && ysiz > 0) - { - tilesizx[tile] = xsiz; - tilesizy[tile] = ysiz; - faketilesiz[tile] = -1; - picanm[tile] = 0; - - j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; - picsiz[tile] = ((uint8_t)j); - j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; - picsiz[tile] += ((uint8_t)(j<<4)); - } - - break; - } - case T_DUMMYTILERANGE: - { - int32_t tile1,tile2,xsiz,ysiz,i,j; - - if (scriptfile_getnumber(script,&tile1)) break; - if (scriptfile_getnumber(script,&tile2)) break; - if (scriptfile_getnumber(script,&xsiz)) break; - if (scriptfile_getnumber(script,&ysiz)) break; - if (tile2 < tile1) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - i = tile2; - tile2 = tile1; - tile1 = i; - } - if ((tile1 >= 0 && tile1 < MAXTILES) && (tile2 >= 0 && tile2 < MAXTILES)) - { - for (i=tile1; i<=tile2; i++) - { - if ((uint32_t)i < MAXTILES) - { - if (xsiz > 0 && ysiz > 0) - { - tilesizx[i] = xsiz; - tilesizy[i] = ysiz; - faketilesiz[i] = -1; - picanm[i] = 0; - - j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; - picsiz[i] = ((uint8_t)j); - j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; - picsiz[i] += ((uint8_t)(j<<4)); - } - } - } - } - break; - } - - case T_DEFINEMODEL: - { - char *modelfn; - double scale; - int32_t shadeoffs; - - if (scriptfile_getstring(script,&modelfn)) break; - if (scriptfile_getdouble(script,&scale)) break; - if (scriptfile_getnumber(script,&shadeoffs)) break; - -#ifdef USE_OPENGL - lastmodelid = md_loadmodel(modelfn); - if (lastmodelid < 0) - { - initprintf("Warning: Failed loading MD2/MD3 model \"%s\"\n", modelfn); - break; - } - md_setmisc(lastmodelid,(float)scale, shadeoffs,0.0,0); -#endif - modelskin = lastmodelskin = 0; - seenframe = 0; - } - break; - case T_DEFINEMODELFRAME: - { - char *framename; -#ifdef USE_OPENGL - char happy=1; -#endif - int32_t ftilenume, ltilenume, tilex; - - if (scriptfile_getstring(script,&framename)) break; - if (scriptfile_getnumber(script,&ftilenume)) break; //first tile number - if (scriptfile_getnumber(script,<ilenume)) break; //last tile number (inclusive) - if (ltilenume < ftilenume) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } - - if (lastmodelid < 0) - { - initprintf("Warning: Ignoring frame definition.\n"); - break; - } -#ifdef USE_OPENGL - for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) - { - switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), 0.0f,0)) - { - case 0: - break; - case -1: - happy = 0; break; // invalid model id!? - case -2: - initprintf("Invalid tile number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - happy = 0; - break; - case -3: - initprintf("Invalid frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - happy = 0; - break; - } - } -#endif - seenframe = 1; - } - break; - case T_DEFINEMODELANIM: - { - char *startframe, *endframe; - int32_t flags; - double dfps; - - if (scriptfile_getstring(script,&startframe)) break; - if (scriptfile_getstring(script,&endframe)) break; - if (scriptfile_getdouble(script,&dfps)) break; //animation frame rate - if (scriptfile_getnumber(script,&flags)) break; - - if (lastmodelid < 0) - { - initprintf("Warning: Ignoring animation definition.\n"); - break; - } -#ifdef USE_OPENGL - switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags)) - { - case 0: - break; - case -1: - break; // invalid model id!? - case -2: - initprintf("Invalid starting frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -3: - initprintf("Invalid ending frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -4: - initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } -#endif - } - break; - case T_DEFINEMODELSKIN: - { - int32_t palnum; - char *skinfn; - - if (scriptfile_getsymbol(script,&palnum)) break; - if (scriptfile_getstring(script,&skinfn)) break; //skin filename - - // if we see a sequence of definemodelskin, then a sequence of definemodelframe, - // and then a definemodelskin, we need to increment the skin counter. - // - // definemodel "mymodel.md2" 1 1 - // definemodelskin 0 "normal.png" // skin 0 - // definemodelskin 21 "normal21.png" - // definemodelframe "foo" 1000 1002 // these use skin 0 - // definemodelskin 0 "wounded.png" // skin 1 - // definemodelskin 21 "wounded21.png" - // definemodelframe "foo2" 1003 1004 // these use skin 1 - // selectmodelskin 0 // resets to skin 0 - // definemodelframe "foo3" 1005 1006 // these use skin 0 - if (seenframe) { modelskin = ++lastmodelskin; } - seenframe = 0; - -#ifdef USE_OPENGL - switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0, 0.0f, 1.0f, 1.0f)) - { - case 0: - break; - case -1: - break; // invalid model id!? - case -2: - initprintf("Invalid skin filename on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -3: - initprintf("Invalid palette number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -4: - initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } -#endif - } - break; - case T_SELECTMODELSKIN: - { - if (scriptfile_getsymbol(script,&modelskin)) break; - } - break; - case T_DEFINEVOXEL: - { - char *fn; - - if (scriptfile_getstring(script,&fn)) break; //voxel filename - - if (nextvoxid == MAXVOXELS) - { - initprintf("Maximum number of voxels already defined.\n"); - break; - } - - if (qloadkvx(nextvoxid, fn)) - { - initprintf("Failure loading voxel file \"%s\"\n",fn); - break; - } - - lastvoxid = nextvoxid++; - } - break; - case T_DEFINEVOXELTILES: - { - int32_t ftilenume, ltilenume, tilex; - - if (scriptfile_getnumber(script,&ftilenume)) break; //1st tile # - if (scriptfile_getnumber(script,<ilenume)) break; //last tile # - - if (ltilenume < ftilenume) - { - initprintf("Warning: backwards tile range on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } - if (ltilenume < 0 || ftilenume >= MAXTILES) - { - initprintf("Invalid tile range on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - - if (lastvoxid < 0) - { - initprintf("Warning: Ignoring voxel tiles definition.\n"); - break; - } - - for (tilex = ftilenume; tilex <= ltilenume; tilex++) - tiletovox[tilex] = lastvoxid; - } - break; - - // NEW (ENCOURAGED) DEFINITION SYNTAX - case T_MODEL: - { - char *modelend, *modelfn; - double scale=1.0, mzadd=0.0; - int32_t shadeoffs=0, pal=0, flags=0; - - static const tokenlist modeltokens[] = - { - { "scale", T_SCALE }, - { "shade", T_SHADE }, - { "zadd", T_ZADD }, - { "frame", T_FRAME }, - { "anim", T_ANIM }, - { "skin", T_SKIN }, - { "detail", T_DETAIL }, - { "glow", T_GLOW }, - { "specular", T_SPECULAR }, - { "normal", T_NORMAL }, - { "hud", T_HUD }, - { "flags", T_FLAGS }, - }; - - modelskin = lastmodelskin = 0; - seenframe = 0; - - if (scriptfile_getstring(script,&modelfn)) break; - if (scriptfile_getbraces(script,&modelend)) break; -#ifdef USE_OPENGL - lastmodelid = md_loadmodel(modelfn); - if (lastmodelid < 0) - { - initprintf("Warning: Failed loading MD2/MD3 model \"%s\"\n", modelfn); - script->textptr = modelend+1; - break; - } -#endif - while (script->textptr < modelend) - { - int32_t token = getatoken(script,modeltokens,sizeof(modeltokens)/sizeof(tokenlist)); - switch (token) - { - //case T_ERROR: initprintf("Error on line %s:%d in model tokens\n", script->filename,script->linenum); break; - case T_SCALE: - scriptfile_getdouble(script,&scale); break; - case T_SHADE: - scriptfile_getnumber(script,&shadeoffs); break; - case T_ZADD: - scriptfile_getdouble(script,&mzadd); break; - case T_FLAGS: - scriptfile_getnumber(script,&flags); break; - case T_FRAME: - { - char *frametokptr = script->ltextptr; - char *frameend, *framename = 0, happy=1; - int32_t ftilenume = -1, ltilenume = -1, tilex = 0; - double smoothduration = 0.1f; - - static const tokenlist modelframetokens[] = - { - { "pal", T_PAL }, - { "frame", T_FRAME }, - { "name", T_FRAME }, - { "tile", T_TILE }, - { "tile0", T_TILE0 }, - { "tile1", T_TILE1 }, - { "smoothduration", T_SMOOTHDURATION }, - }; - - if (scriptfile_getbraces(script,&frameend)) break; - while (script->textptr < frameend) - { - switch (getatoken(script,modelframetokens,sizeof(modelframetokens)/sizeof(tokenlist))) - { - case T_PAL: - scriptfile_getnumber(script,&pal); break; - case T_FRAME: - scriptfile_getstring(script,&framename); break; - case T_TILE: - scriptfile_getsymbol(script,&ftilenume); ltilenume = ftilenume; break; - case T_TILE0: - scriptfile_getsymbol(script,&ftilenume); break; //first tile number - case T_TILE1: - scriptfile_getsymbol(script,<ilenume); break; //last tile number (inclusive) - case T_SMOOTHDURATION: - scriptfile_getdouble(script,&smoothduration); break; - } - } - - if (ftilenume < 0) initprintf("Error: missing 'first tile number' for frame definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)), happy = 0; - if (ltilenume < 0) initprintf("Error: missing 'last tile number' for frame definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)), happy = 0; - if (!happy) break; - - if (ltilenume < ftilenume) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } - - if (lastmodelid < 0) - { - initprintf("Warning: Ignoring frame definition.\n"); - break; - } -#ifdef USE_OPENGL - for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) - { - switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), smoothduration,pal)) - { - case 0: - break; - case -1: - happy = 0; break; // invalid model id!? - case -2: - initprintf("Invalid tile number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,frametokptr)); - happy = 0; - break; - case -3: - initprintf("Invalid frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,frametokptr)); - happy = 0; - break; - } - } -#endif - seenframe = 1; - } - break; - case T_ANIM: - { - char *animtokptr = script->ltextptr; - char *animend, *startframe = 0, *endframe = 0, happy=1; - int32_t flags = 0; - double dfps = 1.0; - - static const tokenlist modelanimtokens[] = - { - { "frame0", T_FRAME0 }, - { "frame1", T_FRAME1 }, - { "fps", T_FPS }, - { "flags", T_FLAGS }, - }; - - if (scriptfile_getbraces(script,&animend)) break; - while (script->textptr < animend) - { - switch (getatoken(script,modelanimtokens,sizeof(modelanimtokens)/sizeof(tokenlist))) - { - case T_FRAME0: - scriptfile_getstring(script,&startframe); break; - case T_FRAME1: - scriptfile_getstring(script,&endframe); break; - case T_FPS: - scriptfile_getdouble(script,&dfps); break; //animation frame rate - case T_FLAGS: - scriptfile_getsymbol(script,&flags); break; - } - } - - if (!startframe) initprintf("Error: missing 'start frame' for anim definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,animtokptr)), happy = 0; - if (!endframe) initprintf("Error: missing 'end frame' for anim definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,animtokptr)), happy = 0; - if (!happy) break; - - if (lastmodelid < 0) - { - initprintf("Warning: Ignoring animation definition.\n"); - break; - } -#ifdef USE_OPENGL - switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags)) - { - case 0: - break; - case -1: - break; // invalid model id!? - case -2: - initprintf("Invalid starting frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,animtokptr)); - break; - case -3: - initprintf("Invalid ending frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,animtokptr)); - break; - case -4: - initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,animtokptr)); - break; - } -#endif - } - break; - case T_SKIN: case T_DETAIL: case T_GLOW: case T_SPECULAR: case T_NORMAL: - { - char *skintokptr = script->ltextptr; - char *skinend, *skinfn = 0; - int32_t palnum = 0, surfnum = 0; - double param = 1.0, specpower = 1.0, specfactor = 1.0; - - static const tokenlist modelskintokens[] = - { - { "pal", T_PAL }, - { "file", T_FILE }, - { "surf", T_SURF }, - { "surface", T_SURF }, - { "intensity", T_PARAM }, - { "scale", T_PARAM }, - { "detailscale", T_PARAM }, - { "specpower", T_SPECPOWER }, { "parallaxscale", T_SPECPOWER }, - { "specfactor", T_SPECFACTOR }, { "parallaxbias", T_SPECFACTOR }, - }; - - if (scriptfile_getbraces(script,&skinend)) break; - while (script->textptr < skinend) - { - switch (getatoken(script,modelskintokens,sizeof(modelskintokens)/sizeof(tokenlist))) - { - case T_PAL: - scriptfile_getsymbol(script,&palnum); break; - case T_PARAM: - scriptfile_getdouble(script,¶m); break; - case T_SPECPOWER: - scriptfile_getdouble(script,&specpower); break; - case T_SPECFACTOR: - scriptfile_getdouble(script,&specfactor); break; - case T_FILE: - scriptfile_getstring(script,&skinfn); break; //skin filename - case T_SURF: - scriptfile_getnumber(script,&surfnum); break; - } - } - - if (!skinfn) - { - initprintf("Error: missing 'skin filename' for skin definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,skintokptr)); - break; - } - - if (seenframe) { modelskin = ++lastmodelskin; } - seenframe = 0; - - switch (token) - { - case T_DETAIL: - palnum = DETAILPAL; - param = 1.0f / param; - break; - case T_GLOW: - palnum = GLOWPAL; - break; - case T_SPECULAR: - palnum = SPECULARPAL; - break; - case T_NORMAL: - palnum = NORMALPAL; - break; - } - -#ifdef USE_OPENGL - switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum, param, specpower, specfactor)) - { - case 0: - break; - case -1: - break; // invalid model id!? - case -2: - initprintf("Invalid skin filename on line %s:%d\n", - script->filename, scriptfile_getlinum(script,skintokptr)); - break; - case -3: - initprintf("Invalid palette number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,skintokptr)); - break; - case -4: - initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,skintokptr)); - break; - } -#endif - } - break; - case T_HUD: - { - char *hudtokptr = script->ltextptr; - char happy=1, *frameend; - int32_t ftilenume = -1, ltilenume = -1, tilex = 0, flags = 0, fov = -1; - double xadd = 0.0, yadd = 0.0, zadd = 0.0, angadd = 0.0; - - static const tokenlist modelhudtokens[] = - { - { "tile", T_TILE }, - { "tile0", T_TILE0 }, - { "tile1", T_TILE1 }, - { "xadd", T_XADD }, - { "yadd", T_YADD }, - { "zadd", T_ZADD }, - { "angadd", T_ANGADD }, - { "fov", T_FOV }, - { "hide", T_HIDE }, - { "nobob", T_NOBOB }, - { "flipped",T_FLIPPED}, - { "nodepth",T_NODEPTH}, - }; - - if (scriptfile_getbraces(script,&frameend)) break; - while (script->textptr < frameend) - { - switch (getatoken(script,modelhudtokens,sizeof(modelhudtokens)/sizeof(tokenlist))) - { - case T_TILE: - scriptfile_getsymbol(script,&ftilenume); ltilenume = ftilenume; break; - case T_TILE0: - scriptfile_getsymbol(script,&ftilenume); break; //first tile number - case T_TILE1: - scriptfile_getsymbol(script,<ilenume); break; //last tile number (inclusive) - case T_XADD: - scriptfile_getdouble(script,&xadd); break; - case T_YADD: - scriptfile_getdouble(script,&yadd); break; - case T_ZADD: - scriptfile_getdouble(script,&zadd); break; - case T_ANGADD: - scriptfile_getdouble(script,&angadd); break; - case T_FOV: - scriptfile_getsymbol(script,&fov); break; - case T_HIDE: - flags |= 1; break; - case T_NOBOB: - flags |= 2; break; - case T_FLIPPED: - flags |= 4; break; - case T_NODEPTH: - flags |= 8; break; - } - } - - if (ftilenume < 0) initprintf("Error: missing 'first tile number' for hud definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)), happy = 0; - if (ltilenume < 0) initprintf("Error: missing 'last tile number' for hud definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)), happy = 0; - if (!happy) break; - - if (ltilenume < ftilenume) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } - - if (lastmodelid < 0) - { - initprintf("Warning: Ignoring frame definition.\n"); - break; - } -#ifdef USE_OPENGL - for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) - { - switch (md_definehud(lastmodelid, tilex, xadd, yadd, zadd, angadd, flags, fov)) - { - case 0: - break; - case -1: - happy = 0; break; // invalid model id!? - case -2: - initprintf("Invalid tile number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,hudtokptr)); - happy = 0; - break; - case -3: - initprintf("Invalid frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,hudtokptr)); - happy = 0; - break; - } - } -#endif - } - break; - } - } - -#ifdef USE_OPENGL - md_setmisc(lastmodelid,(float)scale,shadeoffs,(float)mzadd,flags); -#endif - - modelskin = lastmodelskin = 0; - seenframe = 0; - - } - break; - case T_VOXEL: - { - char *voxeltokptr = script->ltextptr; - char *fn, *modelend; - int32_t tile0 = MAXTILES, tile1 = -1, tilex = -1; - - static const tokenlist voxeltokens[] = - { - { "tile", T_TILE }, - { "tile0", T_TILE0 }, - { "tile1", T_TILE1 }, - { "scale", T_SCALE }, - }; - - if (scriptfile_getstring(script,&fn)) break; //voxel filename - if (nextvoxid == MAXVOXELS) { initprintf("Maximum number of voxels already defined.\n"); break; } - if (qloadkvx(nextvoxid, fn)) { initprintf("Failure loading voxel file \"%s\"\n",fn); break; } - lastvoxid = nextvoxid++; - - if (scriptfile_getbraces(script,&modelend)) break; - while (script->textptr < modelend) - { - switch (getatoken(script,voxeltokens,sizeof(voxeltokens)/sizeof(tokenlist))) - { - //case T_ERROR: initprintf("Error on line %s:%d in voxel tokens\n", script->filename,linenum); break; - case T_TILE: - scriptfile_getsymbol(script,&tilex); - if ((uint32_t)tilex < MAXTILES) tiletovox[tilex] = lastvoxid; - else initprintf("Invalid tile number on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); - break; - case T_TILE0: - scriptfile_getsymbol(script,&tile0); break; //1st tile # - case T_TILE1: - scriptfile_getsymbol(script,&tile1); - if (tile0 > tile1) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,voxeltokptr)); - tilex = tile0; tile0 = tile1; tile1 = tilex; - } - if ((tile1 < 0) || (tile0 >= MAXTILES)) - { initprintf("Invalid tile range on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); break; } - for (tilex=tile0; tilex<=tile1; tilex++) tiletovox[tilex] = lastvoxid; - break; //last tile number (inclusive) - case T_SCALE: - { - double scale=1.0; - scriptfile_getdouble(script,&scale); - voxscale[lastvoxid] = (int32_t)(65536*scale); - break; - } - } - } - lastvoxid = -1; - } - break; - case T_SKYBOX: - { - char *skyboxtokptr = script->ltextptr; - char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1, *tfn = NULL; - int32_t i, tile = -1, pal = 0,ii; - - static const tokenlist skyboxtokens[] = - { - { "tile" ,T_TILE }, - { "pal" ,T_PAL }, - { "ft" ,T_FRONT },{ "front" ,T_FRONT },{ "forward",T_FRONT }, - { "rt" ,T_RIGHT },{ "right" ,T_RIGHT }, - { "bk" ,T_BACK },{ "back" ,T_BACK }, - { "lf" ,T_LEFT },{ "left" ,T_LEFT },{ "lt" ,T_LEFT }, - { "up" ,T_TOP },{ "top" ,T_TOP },{ "ceiling",T_TOP },{ "ceil" ,T_TOP }, - { "dn" ,T_BOTTOM },{ "bottom" ,T_BOTTOM },{ "floor" ,T_BOTTOM },{ "down" ,T_BOTTOM } - }; - - if (scriptfile_getbraces(script,&modelend)) break; - while (script->textptr < modelend) - { - switch (getatoken(script,skyboxtokens,sizeof(skyboxtokens)/sizeof(tokenlist))) - { - //case T_ERROR: initprintf("Error on line %s:%d in skybox tokens\n",script->filename,linenum); break; - case T_TILE: - scriptfile_getsymbol(script,&tile); break; - case T_PAL: - scriptfile_getsymbol(script,&pal); break; - case T_FRONT: - scriptfile_getstring(script,&fn[0]); break; - case T_RIGHT: - scriptfile_getstring(script,&fn[1]); break; - case T_BACK: - scriptfile_getstring(script,&fn[2]); break; - case T_LEFT: - scriptfile_getstring(script,&fn[3]); break; - case T_TOP: - scriptfile_getstring(script,&fn[4]); break; - case T_BOTTOM: - scriptfile_getstring(script,&fn[5]); break; - } - } - - if (tile < 0) initprintf("Error: missing 'tile number' for skybox definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy=0; - for (i=0; i<6; i++) - { - if (!fn[i]) initprintf("Error: missing '%s filename' for skybox definition near line %s:%d\n", skyfaces[i], script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy = 0; - // FIXME? - ii = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn[i],&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn[i]); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn[i]); - happy = 0; - } - } - else Bfree(tfn); - pathsearchmode = ii; - } - if (!happy) break; - - hicsetskybox(tile,pal,fn); - } - break; - case T_HIGHPALOOKUP: - { - char *highpaltokptr = script->ltextptr; - int32_t basepal=-1, pal=-1, oldpathsearchmode; - char *fn = NULL, *tfn = NULL; - char *highpalend; -#ifdef POLYMER - int32_t fd; - char *highpaldata; -#endif - static const tokenlist highpaltokens[] = - { - { "basepal", T_BASEPAL }, - { "pal", T_PAL }, - { "file", T_FILE } - }; - - if (scriptfile_getbraces(script,&highpalend)) break; - while (script->textptr < highpalend) - { - switch (getatoken(script,highpaltokens,sizeof(highpaltokens)/sizeof(tokenlist))) - { - case T_BASEPAL: - scriptfile_getsymbol(script,&basepal); break; - case T_PAL: - scriptfile_getsymbol(script,&pal); break; - case T_FILE: - scriptfile_getstring(script,&fn); break; - } - } - if ((unsigned)basepal >= ((unsigned)basepalcount)) - { - initprintf("Error: missing or invalid 'base palette number' for highpalookup definition " - "near line %s:%d\n", script->filename, scriptfile_getlinum(script,highpaltokptr)); - break; - } - - if ((unsigned)pal >= ((unsigned)MAXPALOOKUPS - RESERVEDPALS)) - { - initprintf("Error: missing or invalid 'palette number' for highpalookup definition near " - "line %s:%d\n", script->filename, scriptfile_getlinum(script,highpaltokptr)); - break; - } - - if (!fn) - { - initprintf("Error: missing 'file name' for highpalookup definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,highpaltokptr)); - break; - } - - oldpathsearchmode = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn,&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn); - pathsearchmode = oldpathsearchmode; - break; - } - } - else Bfree(tfn); - pathsearchmode = oldpathsearchmode; - -#ifdef POLYMER - fd = kopen4load(fn, 0); - - // load the highpalookup and send it to polymer - highpaldata = Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE); - - { - char *filebuf; - int32_t xsiz, ysiz, filesize, i; - - filesize = kfilelength(fd); - - filebuf = Bmalloc(filesize); - if (!filebuf) { kclose(fd); Bfree(highpaldata); break; } - - klseek(fd, 0, SEEK_SET); - if (kread(fd, filebuf, filesize)!=filesize) - { kclose(fd); Bfree(highpaldata); initprintf("Error: didn't read all of '%s'.\n", fn); break; } - - kclose(fd); - kpgetdim(filebuf, filesize, &xsiz, &ysiz); - - if (xsiz != PR_HIGHPALOOKUP_DIM *PR_HIGHPALOOKUP_DIM || ysiz != PR_HIGHPALOOKUP_DIM) - { - initprintf("Error: image dimensions of '%s' must be %dx%d.\n", - fn, PR_HIGHPALOOKUP_DIM*PR_HIGHPALOOKUP_DIM, PR_HIGHPALOOKUP_DIM); - Bfree(filebuf); Bfree(highpaldata); - break; - } - - i = kprender(filebuf, filesize, (intptr_t)highpaldata, xsiz*sizeof(coltype), xsiz, ysiz, 0, 0); - Bfree(filebuf); - if (i) - { Bfree(highpaldata); initprintf("Error: failed rendering '%s'.\n", fn); break; } - } - - polymer_definehighpalookup(basepal, pal, highpaldata); - - Bfree(highpaldata); -#endif - } - break; - case T_TINT: - { - char *tinttokptr = script->ltextptr; - int32_t red=255, green=255, blue=255, pal=-1, flags=0; - char *tintend; - - static const tokenlist tinttokens[] = - { - { "pal", T_PAL }, - { "red", T_RED },{ "r", T_RED }, - { "green", T_GREEN },{ "g", T_GREEN }, - { "blue", T_BLUE },{ "b", T_BLUE }, - { "flags", T_FLAGS } - }; - - if (scriptfile_getbraces(script,&tintend)) break; - while (script->textptr < tintend) - { - switch (getatoken(script,tinttokens,sizeof(tinttokens)/sizeof(tokenlist))) - { - case T_PAL: - scriptfile_getsymbol(script,&pal); break; - case T_RED: - scriptfile_getnumber(script,&red); red = min(255,max(0,red)); break; - case T_GREEN: - scriptfile_getnumber(script,&green); green = min(255,max(0,green)); break; - case T_BLUE: - scriptfile_getnumber(script,&blue); blue = min(255,max(0,blue)); break; - case T_FLAGS: - scriptfile_getsymbol(script,&flags); break; - } - } - - if (pal < 0) - { - initprintf("Error: missing 'palette number' for tint definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr)); - break; - } - - hicsetpalettetint(pal,red,green,blue,flags); - } - break; - case T_TEXTURE: - { - char *texturetokptr = script->ltextptr, *textureend; - int32_t tile=-1, token; - - static const tokenlist texturetokens[] = - { - { "pal", T_PAL }, - { "detail", T_DETAIL }, - { "glow", T_GLOW }, - { "specular",T_SPECULAR }, - { "normal", T_NORMAL }, - }; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getbraces(script,&textureend)) break; - while (script->textptr < textureend) - { - token = getatoken(script,texturetokens,sizeof(texturetokens)/sizeof(tokenlist)); - switch (token) - { - case T_PAL: - { - char *paltokptr = script->ltextptr, *palend; - int32_t pal=-1, i; - char *fn = NULL, *tfn = NULL; - double alphacut = -1.0, xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0; - char flags = 0; - - static const tokenlist texturetokens_pal[] = - { - { "file", T_FILE },{ "name", T_FILE }, - { "alphacut", T_ALPHACUT }, - { "detailscale", T_XSCALE }, { "scale", T_XSCALE }, { "xscale", T_XSCALE }, { "intensity", T_XSCALE }, - { "yscale", T_YSCALE }, - { "specpower", T_SPECPOWER }, { "parallaxscale", T_SPECPOWER }, - { "specfactor", T_SPECFACTOR }, { "parallaxbias", T_SPECFACTOR }, - { "nocompress", T_NOCOMPRESS }, - { "nodownsize", T_NODOWNSIZE }, - }; - - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getbraces(script,&palend)) break; - while (script->textptr < palend) - { - switch (getatoken(script,texturetokens_pal,sizeof(texturetokens_pal)/sizeof(tokenlist))) - { - case T_FILE: - scriptfile_getstring(script,&fn); break; - case T_ALPHACUT: - scriptfile_getdouble(script,&alphacut); break; - case T_XSCALE: - scriptfile_getdouble(script,&xscale); break; - case T_YSCALE: - scriptfile_getdouble(script,&yscale); break; - case T_SPECPOWER: - scriptfile_getdouble(script,&specpower); break; - case T_SPECFACTOR: - scriptfile_getdouble(script,&specfactor); break; - case T_NOCOMPRESS: - flags |= 1; break; - case T_NODOWNSIZE: - flags |= 16; break; - default: - break; - } - } - - if ((unsigned)tile > (unsigned)MAXTILES) break; // message is printed later - if ((unsigned)pal >= ((unsigned)MAXPALOOKUPS - RESERVEDPALS)) - { - initprintf("Error: missing or invalid 'palette number' for texture definition near " - "line %s:%d\n", script->filename, scriptfile_getlinum(script,paltokptr)); - break; - } - if (!fn) - { - initprintf("Error: missing 'file name' for texture definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,paltokptr)); - break; - } - - i = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn,&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn); - pathsearchmode = i; - break; - } - } - else Bfree(tfn); - pathsearchmode = i; - xscale = 1.0f / xscale; - yscale = 1.0f / yscale; - - hicsetsubsttex(tile,pal,fn,alphacut,xscale,yscale, specpower, specfactor,flags); - } - break; - case T_DETAIL: case T_GLOW: case T_SPECULAR: case T_NORMAL: - { - char *detailtokptr = script->ltextptr, *detailend; - int32_t pal = 0, i; - char *fn = NULL, *tfn = NULL; - double xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0; - char flags = 0; - - static const tokenlist texturetokens_pal[] = - { - { "file", T_FILE },{ "name", T_FILE }, - { "alphacut", T_ALPHACUT }, - { "detailscale", T_XSCALE }, { "scale", T_XSCALE }, { "xscale", T_XSCALE }, { "intensity", T_XSCALE }, - { "yscale", T_YSCALE }, - { "specpower", T_SPECPOWER }, { "parallaxscale", T_SPECPOWER }, - { "specfactor", T_SPECFACTOR }, { "parallaxbias", T_SPECFACTOR }, - { "nocompress", T_NOCOMPRESS }, - { "nodownsize", T_NODOWNSIZE }, - }; - - if (scriptfile_getbraces(script,&detailend)) break; - while (script->textptr < detailend) - { - switch (getatoken(script,texturetokens_pal,sizeof(texturetokens_pal)/sizeof(tokenlist))) - { - case T_FILE: - scriptfile_getstring(script,&fn); break; - case T_XSCALE: - scriptfile_getdouble(script,&xscale); break; - case T_YSCALE: - scriptfile_getdouble(script,&yscale); break; - case T_SPECPOWER: - scriptfile_getdouble(script,&specpower); break; - case T_SPECFACTOR: - scriptfile_getdouble(script,&specfactor); break; - case T_NOCOMPRESS: - flags |= 1; break; - case T_NODOWNSIZE: - flags |= 16; break; - default: - break; - } - } - - if ((unsigned)tile > (unsigned)MAXTILES) break; // message is printed later - if (!fn) - { - initprintf("Error: missing 'file name' for texture definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,detailtokptr)); - break; - } - - i = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn,&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn); - pathsearchmode = i; - break; - } - } - else Bfree(tfn); - pathsearchmode = i; - - switch (token) - { - case T_DETAIL: - pal = DETAILPAL; - xscale = 1.0f / xscale; - yscale = 1.0f / yscale; - break; - case T_GLOW: - pal = GLOWPAL; - break; - case T_SPECULAR: - pal = SPECULARPAL; - break; - case T_NORMAL: - pal = NORMALPAL; - break; - } - hicsetsubsttex(tile,pal,fn,-1.0f,xscale,yscale, specpower, specfactor,flags); - } - break; - default: - break; - } - } - if ((unsigned)tile >= (unsigned)MAXTILES) - { - initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,texturetokptr)); - break; - } - } - break; - - case T_UNDEFMODEL: - case T_UNDEFMODELRANGE: - { - int32_t r0,r1; - - if (scriptfile_getsymbol(script,&r0)) break; - if (tokn == T_UNDEFMODELRANGE) - { - if (scriptfile_getsymbol(script,&r1)) break; - if (r1 < r0) - { - int32_t t = r1; - r1 = r0; - r0 = t; - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - } - if (r0 < 0 || r1 >= MAXTILES) - { - initprintf("Error: invalid tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - } - else - { - r1 = r0; - if ((unsigned)r0 >= (unsigned)MAXTILES) - { - initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - } -#ifdef USE_OPENGL - for (; r0 <= r1; r0++) md_undefinetile(r0); -#endif - } - break; - - case T_UNDEFMODELOF: - { - int32_t r0; -#ifdef USE_OPENGL - int32_t mid; -#endif - - if (scriptfile_getsymbol(script,&r0)) break; - if ((unsigned)r0 >= (unsigned)MAXTILES) - { - initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - -#ifdef USE_OPENGL - mid = md_tilehasmodel(r0,0); - if (mid < 0) break; - - md_undefinemodel(mid); -#endif - } - break; - - case T_UNDEFTEXTURE: - case T_UNDEFTEXTURERANGE: - { - int32_t r0,r1,i; - - if (scriptfile_getsymbol(script,&r0)) break; - if (tokn == T_UNDEFTEXTURERANGE) - { - if (scriptfile_getsymbol(script,&r1)) break; - if (r1 < r0) - { - int32_t t = r1; - r1 = r0; - r0 = t; - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - } - if (r0 < 0 || r1 >= MAXTILES) - { - initprintf("Error: invalid tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - } - else - { - r1 = r0; - if ((unsigned)r0 >= (unsigned)MAXTILES) - { - initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - } - - for (; r0 <= r1; r0++) - for (i=MAXPALOOKUPS-1; i>=0; i--) - hicclearsubst(r0,i); - } - break; - - case T_SOUND: - case T_MUSIC: - { - char *dummy, *dummy2; - static const tokenlist sound_musictokens[] = - { - { "id", T_ID }, - { "file", T_FILE }, - }; - - if (scriptfile_getbraces(script,&dummy)) break; - while (script->textptr < dummy) - { - switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist))) - { - case T_ID: - scriptfile_getstring(script,&dummy2); - break; - case T_FILE: - scriptfile_getstring(script,&dummy2); - break; - } - } - } - break; - - default: - initprintf("Unknown token.\n"); break; - } - } - return 0; -} - - -int32_t loaddefinitionsfile(const char *fn) -{ - scriptfile *script; - int32_t f = flushlogwindow; - - script = scriptfile_fromfile(fn); - if (!script) return -1; - - flushlogwindow = 1; - initprintf("Loading '%s'\n",fn); - flushlogwindow = 0; - defsparser(script); - - flushlogwindow = f; - scriptfile_close(script); - scriptfile_clearsymbols(); - - return 0; -} - -// vim:ts=4: diff --git a/polymer-perf/eduke32/build/src/dynamicgtk.c b/polymer-perf/eduke32/build/src/dynamicgtk.c deleted file mode 100644 index c8df161a7..000000000 --- a/polymer-perf/eduke32/build/src/dynamicgtk.c +++ /dev/null @@ -1,182 +0,0 @@ -#include -#include -#include - -#define __dynamicgtkfoo__ -#include "dynamicgtk.h" - -static void *handle = NULL; -struct _dynamicgtksyms dynamicgtksyms; - -#define GETDLSYM(x) { \ - dynamicgtksyms.x = dlsym(handle, (failsym = (const char *)#x)); \ - if (!dynamicgtksyms.x ) { err = 1; break; } \ -} - -int32_t dynamicgtk_init(void) -{ - int32_t err = 0; - const char *failsym = NULL; - - if (handle) return 1; - - handle = dlopen("libgtk-x11-2.0.so.0", RTLD_NOW|RTLD_GLOBAL); - if (!handle) return -1; - - memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms)); - - do - { - GETDLSYM(g_free) - GETDLSYM(g_object_get_data) - GETDLSYM(g_object_set_data) - GETDLSYM(g_object_set_data_full) - GETDLSYM(g_object_unref) - GETDLSYM(g_signal_connect_data) - GETDLSYM(g_signal_handlers_block_matched) - GETDLSYM(g_signal_handlers_unblock_matched) - GETDLSYM(g_type_check_instance_cast) - GETDLSYM(gdk_pixbuf_from_pixdata) - GETDLSYM(gdk_pixbuf_new_from_data) - GETDLSYM(gtk_accel_group_new) - GETDLSYM(gtk_alignment_new) - GETDLSYM(gtk_box_get_type) - GETDLSYM(gtk_box_pack_start) - GETDLSYM(gtk_button_box_get_type) - GETDLSYM(gtk_button_box_set_layout) - GETDLSYM(gtk_button_new) - GETDLSYM(gtk_cell_layout_get_type) - GETDLSYM(gtk_cell_layout_pack_start) - GETDLSYM(gtk_cell_layout_set_attributes) - GETDLSYM(gtk_cell_renderer_text_new) - GETDLSYM(gtk_check_button_new_with_mnemonic) - GETDLSYM(gtk_combo_box_get_active) - GETDLSYM(gtk_combo_box_get_active_iter) - GETDLSYM(gtk_combo_box_get_active_text) - GETDLSYM(gtk_combo_box_get_model) - GETDLSYM(gtk_combo_box_get_type) - GETDLSYM(gtk_combo_box_new_text) - GETDLSYM(gtk_combo_box_new_with_model) - GETDLSYM(gtk_combo_box_set_active) - GETDLSYM(gtk_combo_box_set_active_iter) - GETDLSYM(gtk_container_add) - GETDLSYM(gtk_container_foreach) - GETDLSYM(gtk_container_get_type) - GETDLSYM(gtk_container_set_border_width) - GETDLSYM(gtk_dialog_get_type) - GETDLSYM(gtk_dialog_run) - GETDLSYM(gtk_hbox_new) - GETDLSYM(gtk_hbutton_box_new) - GETDLSYM(gtk_image_new_from_pixbuf) - GETDLSYM(gtk_image_new_from_stock) - GETDLSYM(gtk_init_check) - GETDLSYM(gtk_label_get_type) - GETDLSYM(gtk_label_new) - GETDLSYM(gtk_label_new_with_mnemonic) - GETDLSYM(gtk_label_set_mnemonic_widget) - GETDLSYM(gtk_list_store_append) - GETDLSYM(gtk_list_store_clear) - GETDLSYM(gtk_list_store_get_type) - GETDLSYM(gtk_list_store_new) - GETDLSYM(gtk_list_store_set) - GETDLSYM(gtk_main) - GETDLSYM(gtk_main_iteration_do) - GETDLSYM(gtk_main_quit) - GETDLSYM(gtk_message_dialog_new) - GETDLSYM(gtk_misc_get_type) - GETDLSYM(gtk_misc_set_alignment) - GETDLSYM(gtk_notebook_get_nth_page) - GETDLSYM(gtk_notebook_get_type) - GETDLSYM(gtk_notebook_new) - GETDLSYM(gtk_notebook_set_current_page) - GETDLSYM(gtk_notebook_set_tab_label) - GETDLSYM(gtk_object_get_type) - GETDLSYM(gtk_scrolled_window_get_type) - GETDLSYM(gtk_scrolled_window_new) - GETDLSYM(gtk_scrolled_window_set_policy) - GETDLSYM(gtk_scrolled_window_set_shadow_type) - GETDLSYM(gtk_table_get_type) - GETDLSYM(gtk_table_new) - GETDLSYM(gtk_table_attach) - GETDLSYM(gtk_text_buffer_backspace) - GETDLSYM(gtk_text_buffer_create_mark) - GETDLSYM(gtk_text_buffer_delete_mark) - GETDLSYM(gtk_text_buffer_get_end_iter) - GETDLSYM(gtk_text_buffer_insert) - // FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0) - // around these three, or should I not care? - GETDLSYM(gtk_text_iter_backward_cursor_position) - GETDLSYM(gtk_text_iter_equal) - GETDLSYM(gtk_text_buffer_delete_interactive) - // - GETDLSYM(gtk_text_view_get_buffer) - GETDLSYM(gtk_text_view_get_type) - GETDLSYM(gtk_text_view_new) - GETDLSYM(gtk_text_view_scroll_to_mark) - GETDLSYM(gtk_text_view_set_cursor_visible) - GETDLSYM(gtk_text_view_set_editable) - GETDLSYM(gtk_text_view_set_left_margin) - GETDLSYM(gtk_text_view_set_right_margin) - GETDLSYM(gtk_text_view_set_wrap_mode) - GETDLSYM(gtk_toggle_button_get_active) - GETDLSYM(gtk_toggle_button_get_type) - GETDLSYM(gtk_toggle_button_set_active) - GETDLSYM(gtk_tree_model_get) - GETDLSYM(gtk_tree_model_get_iter) - GETDLSYM(gtk_tree_model_get_path) - GETDLSYM(gtk_tree_model_get_type) - GETDLSYM(gtk_tree_path_get_indices) - GETDLSYM(gtk_tree_path_new_from_indices) - GETDLSYM(gtk_tree_selection_get_selected) - GETDLSYM(gtk_tree_selection_select_iter) - GETDLSYM(gtk_tree_selection_set_mode) - GETDLSYM(gtk_tree_sortable_get_type) - GETDLSYM(gtk_tree_sortable_set_sort_column_id) - GETDLSYM(gtk_tree_sortable_set_sort_func) - GETDLSYM(gtk_tree_view_append_column) - GETDLSYM(gtk_tree_view_column_new_with_attributes) - GETDLSYM(gtk_tree_view_column_set_expand) - GETDLSYM(gtk_tree_view_column_set_min_width) - GETDLSYM(gtk_tree_view_get_model) - GETDLSYM(gtk_tree_view_get_selection) - GETDLSYM(gtk_tree_view_get_type) - GETDLSYM(gtk_tree_view_new_with_model) - GETDLSYM(gtk_tree_view_set_enable_search) - GETDLSYM(gtk_tree_view_set_headers_visible) - GETDLSYM(gtk_vbox_new) - GETDLSYM(gtk_widget_add_accelerator) - GETDLSYM(gtk_widget_destroy) - GETDLSYM(gtk_widget_ref) - GETDLSYM(gtk_widget_set_sensitive) - GETDLSYM(gtk_widget_set_size_request) - GETDLSYM(gtk_widget_show_all) - GETDLSYM(gtk_widget_unref) - GETDLSYM(gtk_window_add_accel_group) - GETDLSYM(gtk_window_get_type) - GETDLSYM(gtk_window_new) - GETDLSYM(gtk_window_set_default_icon) - GETDLSYM(gtk_window_set_position) - GETDLSYM(gtk_window_set_resizable) - GETDLSYM(gtk_window_set_title) - GETDLSYM(gtk_window_set_type_hint) - GETDLSYM(gtk_window_set_default) - GETDLSYM(g_utf8_collate) - } - while (0); - - if (err) - { - //printf("Failed fetching symbol %s from GTK lib\n", failsym); - dlclose(handle); - handle = NULL; - return -1; - } - return 0; -} - -void dynamicgtk_uninit(void) -{ - if (handle) dlclose(handle); - handle = NULL; - memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms)); -} diff --git a/polymer-perf/eduke32/build/src/engine.c b/polymer-perf/eduke32/build/src/engine.c deleted file mode 100644 index d189955b9..000000000 --- a/polymer-perf/eduke32/build/src/engine.c +++ /dev/null @@ -1,13899 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. -// -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - - -#define ENGINE - -#include "compat.h" -#include "build.h" -#include "pragmas.h" -#include "cache1d.h" -#include "a.h" -#include "osd.h" -#include "crc32.h" -#include "quicklz.h" - -#include "baselayer.h" -#include "scriptfile.h" - -#ifdef USE_OPENGL -# ifdef USE_OPENGL -# include "glbuild.h" -# include "mdsprite.h" -# ifdef POLYMER -# include "polymer.h" -# endif -# endif -# include "hightile.h" -# include "polymost.h" -# ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# include -# endif -#endif - -#include - -#include "engine_priv.h" - -#define CACHEAGETIME 16 - -float debug1, debug2; - -static void drawpixel_safe(void *s, char a) -{ -#if defined __GNUC__ - if (__builtin_expect((intptr_t)s >= frameplace && (intptr_t)s < frameplace+bytesperline*ydim, 1)) -#else - if ((intptr_t)s >= frameplace && (intptr_t)s < frameplace+bytesperline*ydim) -#endif - drawpixel(s, a); -#ifdef DEBUGGINGAIDS - else - { - static const char *const c = &editorcolors[15]; - drawpixel((intptr_t *)frameplace, *c); - drawpixel((intptr_t *)frameplace+1, *c); - drawpixel((intptr_t *)frameplace+2, *c); - drawpixel((intptr_t *)frameplace+bytesperline, *c); - drawpixel((intptr_t *)frameplace+bytesperline+1, *c); - drawpixel((intptr_t *)frameplace+bytesperline+2, *c); - drawpixel((intptr_t *)frameplace+2*bytesperline, *c); - drawpixel((intptr_t *)frameplace+2*bytesperline+1, *c); - drawpixel((intptr_t *)frameplace+2*bytesperline+2, *c); - } -#endif -} - -void loadvoxel(int32_t voxindex) { voxindex=0; } -int32_t tiletovox[MAXTILES]; -int32_t usevoxels = 1; -#define kloadvoxel loadvoxel - -int32_t novoxmips = 0; -int32_t editorgridextent = 131072; - -//These variables need to be copied into BUILD -#define MAXXSIZ 256 -#define MAXYSIZ 256 -#define MAXZSIZ 255 -#define MAXVOXMIPS 5 -intptr_t voxoff[MAXVOXELS][MAXVOXMIPS]; char voxlock[MAXVOXELS][MAXVOXMIPS]; -int32_t voxscale[MAXVOXELS]; - -static int32_t ggxinc[MAXXSIZ+1], ggyinc[MAXXSIZ+1]; -static int32_t lowrecip[1024], nytooclose, nytoofar; -static uint32_t distrecip[65536]; - -static intptr_t *lookups = NULL; -static char lookupsalloctype = 255; -int32_t dommxoverlay = 1, beforedrawrooms = 1, indrawroomsandmasks = 0; - -static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1; - -// r_usenewaspect is the cvar, newaspect_enable to trigger the new behaviour in the code -int32_t r_usenewaspect = 0, newaspect_enable=0; -uint32_t r_screenxy = 403; // 4:3 aspect ratio - -int32_t curbrightness = 0, gammabrightness = 0; - -double vid_gamma = DEFAULT_GAMMA; -double vid_contrast = DEFAULT_CONTRAST; -double vid_brightness = DEFAULT_BRIGHTNESS; - -//Textured Map variables -static char globalpolytype; -static int16_t *dotp1[MAXYDIM], *dotp2[MAXYDIM]; - -static int8_t tempbuf[MAXWALLS]; - -int32_t ebpbak, espbak; -intptr_t slopalookup[16384]; // was 2048 -#if defined(USE_OPENGL) -palette_t palookupfog[MAXPALOOKUPS]; -#endif - -static char permanentlock = 255; -int32_t artversion, mapversion=7L; // JBF 20040211: default mapversion to 7 -void *pic = NULL; -char picsiz[MAXTILES], tilefilenum[MAXTILES]; -int32_t lastageclock; -int32_t tilefileoffs[MAXTILES]; - -int32_t artsize = 0, cachesize = 0; - -// unlikely to occur, but .art files with less than 256 tiles are certainly possible -// this would be 60 (MAXTILES/256) if we just assumed there were 256 tiles per .art as in Duke -char *artptrs[256]; - -static int16_t radarang2[MAXXDIM]; -static uint16_t sqrtable[4096], shlookup[4096+256]; -char pow2char[8] = {1,2,4,8,16,32,64,128}; -int32_t pow2long[32] = -{ - 1L,2L,4L,8L, - 16L,32L,64L,128L, - 256L,512L,1024L,2048L, - 4096L,8192L,16384L,32768L, - 65536L,131072L,262144L,524288L, - 1048576L,2097152L,4194304L,8388608L, - 16777216L,33554432L,67108864L,134217728L, - 268435456L,536870912L,1073741824L,2147483647L -}; -int32_t reciptable[2048], fpuasm; - -char britable[16][256]; // JBF 20040207: full 8bit precision - -extern char textfont[2048], smalltextfont[2048]; - -static char kensmessage[128]; -const char *engineerrstr = "No error"; - -int32_t showfirstwall=0; -int32_t showheightindicators=2; -int32_t circlewall=-1; - -char cachedebug = 0; - -qlz_state_compress *state_compress = NULL; -qlz_state_decompress *state_decompress = NULL; - -int32_t whitecol; - -#ifdef POLYMER -static int16_t maphacklightcnt=0; -static int16_t maphacklight[PR_MAXLIGHTS]; -#endif - -// forward refs -inline int32_t getscreenvdisp(int32_t bz, int32_t zoome); -void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome); - - -////////// YAX ////////// -#define YAX_BUNCHNUM(Sect, Cf) (*(int16_t *)(§or[Sect].ceilingxpanning + 6*Cf)) - -int16_t yax_getbunch(int16_t i, int16_t cf) -{ - if (((*(§or[i].ceilingstat + cf))&YAX_BIT)==0) - return -1; - - return YAX_BUNCHNUM(i, cf); -} - -void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum) -{ - if (i<0) - { - *(§or[i].ceilingstat + cf) &= ~YAX_BIT; - YAX_BUNCHNUM(i, cf) = 0; - return; - } - - *(§or[i].ceilingstat + cf) |= YAX_BIT; - YAX_BUNCHNUM(i, cf) = bunchnum; -} - - -////////// editor side view ////////// -int32_t m32_sideview = 0; -int32_t m32_sideelev = 256; // elevation in BUILD degrees, 0..512 -int16_t m32_sideang = 200; // azimuth, 0..2047 - -int32_t m32_sidecos, m32_sidesin; -int32_t m32_swcnt; -int16_t *m32_wallsprite; // [MAXSWALLS+MAXSPRITES] -static int32_t *m32_sidedist; // [MAXSWALLS+MAXSPRITES] -static vec3_t m32_viewplane; - - -////// sector-like clipping for sprites ////// -typedef struct -{ - int16_t numsectors, numwalls; - sectortype *sector; - walltype *wall; -} mapinfo_t; - -static void mapinfo_set(mapinfo_t *bak, mapinfo_t *new) -{ - if (bak) - { - bak->numsectors = numsectors; - bak->numwalls = numwalls; - bak->sector = sector; - bak->wall = wall; - } - - if (new) - { - numsectors = new->numsectors; - numwalls = new->numwalls; - sector = new->sector; - wall = new->wall; - } -} - -static mapinfo_t origmapinfo, clipmapinfo; -static int32_t quickloadboard=0; - - -#define CM_MAX 256 // must be a power of 2 - -typedef struct -{ - int16_t qbeg, qend; // indices into sectq - int16_t picnum, next; - int32_t maxdist; -} clipinfo_t; - -static int32_t numclipmaps; -static clipinfo_t clipinfo[CM_MAX]; - -static int32_t numclipsects; // number in sectq[] -static int16_t *sectoidx, *sectq; // [numsectors] -static int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index -static int16_t *tempictoidx; - -static sectortype *loadsector; -static walltype *loadwall, *loadwallinv; -static spritetype *loadsprite; - -// sectoidx bits -#define CM_NONE (CM_MAX<<1) -#define CM_SOME (CM_NONE-1) -#define CM_OUTER (CM_MAX) // sector surrounds clipping sector - -// sprite -> sector tag mappings -#define CM_XREPEAT floorpal -#define CM_YREPEAT floorxpanning -#define CM_XOFFSET ceilingshade -#define CM_YOFFSET floorshade -#define CM_CSTAT hitag -#define CM_ANG extra -#define CM_FLOORZ(Sec) (*(int32_t *)§or[Sec].ceilingxpanning) // ceilingxpanning,ceilingypanning,floorpicnum -#define CM_CEILINGZ(Sec) (*(int32_t *)§or[Sec].visibility) // visibility,filler,lotag - -// backup of original normalized coordinates -#define CM_WALL_X(Wal) (*(int32_t *)&wall[Wal].picnum) -#define CM_WALL_Y(Wal) (*(int32_t *)&wall[Wal].lotag) - -// don't rotate when applying clipping, for models with rotational symmetry -#define CM_NOROT(Spri) (sprite[Spri].cstat&2) -#define CM_NOROTS(Sect) (sector[Sect].CM_CSTAT&2) - - -static void clipmapinfo_init() -{ - int32_t i; - - numclipmaps = 0; - numclipsects = 0; - - if (sectq) { Bfree(sectq); sectq=NULL; } - if (sectoidx) { Bfree(sectoidx); sectoidx=NULL; } - if (tempictoidx) { Bfree(tempictoidx); tempictoidx=NULL; } - - for (i=0; iMAXSECTORS || - ournumwalls+numwalls>MAXWALLS || - ournumsprites+numsprites>MAXSPRITES) - { - initprintf("clip map: warning: exceeded limits when loading %s, aborting.\n", fn); - break; - } - - Bmemcpy(loadsector+ournumsectors, sector, numsectors*sizeof(sectortype)); - Bmemcpy(loadwall+ournumwalls, wall, numwalls*sizeof(walltype)); - Bmemcpy(loadsprite+ournumsprites, sprite, numsprites*sizeof(spritetype)); - for (i=ournumsectors; i=0) - loadwall[i].point2 += ournumwalls; - if (loadwall[i].nextwall>=0) - { - loadwall[i].nextwall += ournumwalls; - loadwall[i].nextsector += ournumsectors; - } - } - for (i=ournumsprites; i=0) - loadsprite[i].sectnum += ournumsectors; - ournumsectors += numsectors; - ournumwalls += numwalls; - ournumsprites += numsprites; - - if (lwcp != loadedwhich) - { - *lwcp++ = ','; - *lwcp++ = ' '; - } - *lwcp++ = fi; - *lwcp = 0; - } - quickloadboard = 0; - - if (ournumsectors==0 || ournumwalls==0 || ournumsprites==0) // nothing loaded - { - clipmapinfo_init(); - return -1; - } - - // shrink - loadsector = Brealloc(loadsector, ournumsectors*sizeof(sectortype)); - loadwall = Brealloc(loadwall, ournumwalls*sizeof(walltype)); - - Bmemcpy(sector, loadsector, ournumsectors*sizeof(sectortype)); - Bmemcpy(wall, loadwall, ournumwalls*sizeof(walltype)); - Bmemcpy(sprite, loadsprite, ournumsprites*sizeof(spritetype)); - numsectors = ournumsectors; - numwalls = ournumwalls; - - // vvvv don't use headsprite[sect,stat]! vvvv - - sectoidx = Bmalloc(numsectors*sizeof(sectoidx[0])); - if (!sectoidx || !sector || !wall) - { - clipmapinfo_init(); - return 1; - } - for (i=0; i=0 && sectoidx[wall[w].nextsector]==CM_OUTER) - { - wall[k].nextwall = wall[k].nextsector = -1; - wall[w].nextwall = wall[w].nextsector = -1; - } - } - } - - { - int16_t ns, outersect; - int32_t pn,scnt, x,y,z, maxdist; - - sectq = Bmalloc(numsectors*sizeof(sectq[0])); - tempictoidx = Bmalloc(MAXTILES*sizeof(tempictoidx[0])); - if (!sectq || !tempictoidx) - { - clipmapinfo_init(); - return 1; - } - for (i=0; i=MAXTILES || k<0 || k>=numsectors || (sectoidx[k]&CM_OUTER)) - continue; - - // chain - if (pictoidx[pn]>=0) - { - if (sectoidx[k]&CM_SOME) - { - for (fi=0; fi<9; fi++) - if (k>=fisec[fi]) - break; - initprintf("clip map %d: error: tried to chain picnum %d (sprite %d) in sector %d which" - " already belongs to picnum %d.\n", fi, pn, i-fispr[fi], k-fisec[fi], - clipinfo[sectoidx[k]].picnum); - clipmapinfo_init(); - return 2; - } - - // new one is front - clipinfo[numclipmaps].next = pictoidx[pn]; - pictoidx[pn] = numclipmaps; - } - else - { - clipinfo[numclipmaps].next = -1; - pictoidx[pn] = numclipmaps; - } - - if (!CM_NOROT(i)) - { - if (sprite[i].ang!=1536 && sprite[i].ang!=512) - { - for (fi=0; fi<9; fi++) - if (i>=fispr[fi]) - break; - initprintf("clip map %d: warning: sprite %d pointing neither northward nor southward. %s will be wrong.\n", - fi, i-fispr[fi], (sprite[i].cstat&48)==32 ? "Scaling and flipping" : "X-flipping"); - } - } - - clipinfo[numclipmaps].picnum = pn; - - // collect sectors - scnt = numclipsects; - sectq[numclipsects++] = k; - sectoidx[k] = numclipmaps; - - clipinfo[numclipmaps].qbeg = scnt; - - outersect = -1; - - do - { - k = sectq[scnt]; - - for (w=sector[k].wallptr; w=0) - { - if (sectoidx[ns]==CM_NONE) - { - sectoidx[ns] = numclipmaps; - sectq[numclipsects++] = ns; - } - else if (sectoidx[ns]&CM_OUTER) - { - if (outersect>=0 && ns!=outersect) - { - for (fi=0; fi<9; fi++) - if (ns>=fisec[fi]) - break; - initprintf("clip map %d: error: encountered more than one outer sector (%d and %d)" - " for sprite %d.\n", fi, outersect-fisec[fi], ns-fisec[fi], i-fispr[fi]); - clipmapinfo_init(); - return 3; - } - - outersect = ns; - sectoidx[outersect] |= numclipmaps; - } - else if (sectoidx[ns]!=numclipmaps) - { - for (fi=0; fi<9; fi++) - if (ns>=fisec[fi]) - break; - initprintf("clip map %d: error: encountered sector %d belonging to index %d" - " while collecting sectors for sprite %d (index %d).\n", - fi, ns-fisec[fi], sectoidx[ns], i-fispr[fi], numclipmaps); - clipmapinfo_init(); - return 4; - } - } - } - } - while (++scnt < numclipsects); - - if (outersect==-1) - { - initprintf("clip map: INTERNAL ERROR: outersect==-1!\n"); - clipmapinfo_init(); - return 5; - } - - sectq[numclipsects++] = outersect; // last is outer - clipinfo[numclipmaps].qend = numclipsects-1; - - // normalize - maxdist = 0; - - for (scnt=clipinfo[numclipmaps].qbeg; scnt<=clipinfo[numclipmaps].qend; scnt++) - { - k = sectq[scnt]; - - x = sprite[i].x; - y = sprite[i].y; - z = sprite[i].z; - - sector[k].floorz -= z; - sector[k].ceilingz -= z; - - if (scnt==clipinfo[numclipmaps].qbeg) - { - // backup sprite tags since we'll discard sprites later - sector[k].CM_XREPEAT = sprite[i].xrepeat; - sector[k].CM_YREPEAT = sprite[i].yrepeat; - sector[k].CM_XOFFSET = sprite[i].xoffset; - sector[k].CM_YOFFSET = sprite[i].yoffset; - sector[k].CM_CSTAT = sprite[i].cstat; - sector[k].CM_ANG = sprite[i].ang; - } - - // backup floor and ceiling z - CM_FLOORZ(k) = sector[k].floorz; - CM_CEILINGZ(k) = sector[k].ceilingz; - - for (w=sector[k].wallptr; w maxdist) - maxdist = klabs(wall[w].x); - if (klabs(wall[w].y) > maxdist) - maxdist = klabs(wall[w].y); - } - else - { - int32_t tmp = ksqrt(wall[w].x*wall[w].x + wall[w].y*wall[w].y); - if (tmp > maxdist) - maxdist = tmp; - } - } - - // aliasing - if (wall[w].lotag>0 || wall[w].hitag>0) - { - int32_t ii; - - if (wall[w].lotag>0 && wall[w].hitag>0) - { - if (wall[w].lotag > wall[w].hitag) - swapshort(&wall[w].lotag, &wall[w].hitag); - - for (ii=wall[w].lotag; ii0) - { - if (wall[w].lotag=0) - pictoidx[i]=tempictoidx[i]; - } - - Bfree(loadsprite); loadsprite=NULL; - Bfree(tempictoidx); tempictoidx=NULL; - - // don't let other code be distracted by the temporary map we constructed - numsectors = 0; - numwalls = 0; - initspritelists(); - - initprintf("Loaded clip map%s %s.\n", lwcp==loadedwhich+1?"":"s", loadedwhich); - - return 0; -} - -////// ////// - - -int32_t checksectorpointer(int16_t i, int16_t sectnum) -{ - int32_t j, k, startwall, endwall, x1, y1, x2, y2, numnewwalls=0; - -#if 0 - if (checksectorpointer_warn && (i<0 || i>=max(numwalls,newnumwalls))) - { - char buf[128]; - Bsprintf(buf, "WARN: checksectorpointer called with i=%d but (new)numwalls=%d", i, max(numwalls,newnumwalls)); - OSD_Printf("%s\n", buf); - printmessage16("%s", buf); - return 0; - } -#endif - - x1 = wall[i].x; - y1 = wall[i].y; - x2 = (wall[wall[i].point2]).x; - y2 = (wall[wall[i].point2]).y; - - if (wall[i].nextwall >= 0) //Check for early exit - { - k = wall[i].nextwall; - if (wall[k].x == x2 && wall[k].y == y2) - if ((wall[wall[k].point2]).x == x1 && (wall[wall[k].point2]).y == y1) - return(0); - } - - wall[i].nextsector = -1; - wall[i].nextwall = -1; - for (j=0; j=0 && wall[k].nextwall != i) - continue; - - if (sectnum != -2) // -2 means dry run - { - wall[i].nextsector = j; - wall[i].nextwall = k; - wall[k].nextsector = sectnum; - wall[k].nextwall = i; - } - numnewwalls++; - } - } - } - return(numnewwalls); -} - - -#if defined(_MSC_VER) && !defined(NOASM) - -// -// Microsoft C Inline Assembly Routines -// - -static inline int32_t nsqrtasm(int32_t a) -{ - _asm - { - push ebx - mov eax, a - test eax, 0xff000000 - mov ebx, eax - jnz short over24 - shr ebx, 12 - mov cx, word ptr shlookup[ebx*2] - jmp short under24 - over24: - shr ebx, 24 - mov cx, word ptr shlookup[ebx*2+8192] - under24: - shr eax, cl - mov cl, ch - mov ax, word ptr sqrtable[eax*2] - shr eax, cl - pop ebx - } -} - -static inline int32_t msqrtasm(int32_t c) -{ - _asm - { - push ebx - mov ecx, c - mov eax, 0x40000000 - mov ebx, 0x20000000 - begit: - cmp ecx, eax - jl skip - sub ecx, eax - lea eax, [eax+ebx*4] - skip: - sub eax, ebx - shr eax, 1 - shr ebx, 2 - jnz begit - cmp ecx, eax - sbb eax, -1 - shr eax, 1 - pop ebx - } -} - -//0x007ff000 is (11<<13), 0x3f800000 is (127<<23) -static inline int32_t krecipasm(int32_t a) -{ - _asm - { - push ebx - mov eax, a - mov fpuasm, eax - fild dword ptr fpuasm - add eax, eax - fstp dword ptr fpuasm - sbb ebx, ebx - mov eax, fpuasm - mov ecx, eax - and eax, 0x007ff000 - shr eax, 10 - sub ecx, 0x3f800000 - shr ecx, 23 - mov eax, dword ptr reciptable[eax] - sar eax, cl - xor eax, ebx - pop ebx - } -} - -static inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d) -{ - _asm - { - push ebx - mov eax, a - mov ebx, b - mov ecx, c - mov edx, d - sar eax, 31 - add ebx, ebx - adc eax, eax - add ecx, ecx - adc eax, eax - add edx, edx - adc eax, eax - mov ebx, eax - shl ebx, 4 - or al, 0xf0 - xor eax, ebx - pop ebx - } -} - -static inline int32_t getkensmessagecrc(void *b) -{ - _asm - { - push ebx - mov ebx, b - xor eax, eax - mov ecx, 32 - beg: - mov edx, dword ptr [ebx+ecx*4-4] - ror edx, cl - adc eax, edx - bswap eax - loop short beg - pop ebx - } -} - -#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // _MSC_VER - -// -// GCC "Inline" Assembly Routines -// - -#define nsqrtasm(a) \ - ({ int32_t __r, __a=(a); \ - __asm__ __volatile__ ( \ - "testl $0xff000000, %%eax\n\t" \ - "movl %%eax, %%ebx\n\t" \ - "jnz 0f\n\t" \ - "shrl $12, %%ebx\n\t" \ - "movw "ASMSYM("shlookup")"(,%%ebx,2), %%cx\n\t" \ - "jmp 1f\n\t" \ - "0:\n\t" \ - "shrl $24, %%ebx\n\t" \ - "movw ("ASMSYM("shlookup")"+8192)(,%%ebx,2), %%cx\n\t" \ - "1:\n\t" \ - "shrl %%cl, %%eax\n\t" \ - "movb %%ch, %%cl\n\t" \ - "movw "ASMSYM("sqrtable")"(,%%eax,2), %%ax\n\t" \ - "shrl %%cl, %%eax" \ - : "=a" (__r) : "a" (__a) : "ebx", "ecx", "cc"); \ - __r; }) - -// edx is blown by this code somehow?! -#define msqrtasm(c) \ - ({ int32_t __r, __c=(c); \ - __asm__ __volatile__ ( \ - "movl $0x40000000, %%eax\n\t" \ - "movl $0x20000000, %%ebx\n\t" \ - "0:\n\t" \ - "cmpl %%eax, %%ecx\n\t" \ - "jl 1f\n\t" \ - "subl %%eax, %%ecx\n\t" \ - "leal (%%eax,%%ebx,4), %%eax\n\t" \ - "1:\n\t" \ - "subl %%ebx, %%eax\n\t" \ - "shrl $1, %%eax\n\t" \ - "shrl $2, %%ebx\n\t" \ - "jnz 0b\n\t" \ - "cmpl %%eax, %%ecx\n\t" \ - "sbbl $-1, %%eax\n\t" \ - "shrl $1, %%eax" \ - : "=a" (__r) : "c" (__c) : "edx","ebx", "cc"); \ - __r; }) - -#define krecipasm(a) \ - ({ int32_t __a=(a); \ - __asm__ __volatile__ ( \ - "movl %%eax, ("ASMSYM("fpuasm")"); fildl ("ASMSYM("fpuasm")"); " \ - "addl %%eax, %%eax; fstps ("ASMSYM("fpuasm")"); sbbl %%ebx, %%ebx; " \ - "movl ("ASMSYM("fpuasm")"), %%eax; movl %%eax, %%ecx; " \ - "andl $0x007ff000, %%eax; shrl $10, %%eax; subl $0x3f800000, %%ecx; " \ - "shrl $23, %%ecx; movl "ASMSYM("reciptable")"(%%eax), %%eax; " \ - "sarl %%cl, %%eax; xorl %%ebx, %%eax" \ - : "=a" (__a) : "a" (__a) : "ebx", "ecx", "memory", "cc"); \ - __a; }) - -#define getclipmask(a,b,c,d) \ - ({ int32_t __a=(a), __b=(b), __c=(c), __d=(d); \ - __asm__ __volatile__ ("sarl $31, %%eax; addl %%ebx, %%ebx; adcl %%eax, %%eax; " \ - "addl %%ecx, %%ecx; adcl %%eax, %%eax; addl %%edx, %%edx; " \ - "adcl %%eax, %%eax; movl %%eax, %%ebx; shl $4, %%ebx; " \ - "orb $0xf0, %%al; xorl %%ebx, %%eax" \ - : "=a" (__a), "=b" (__b), "=c" (__c), "=d" (__d) \ - : "a" (__a), "b" (__b), "c" (__c), "d" (__d) : "cc"); \ - __a; }) - - -#define getkensmessagecrc(b) \ - ({ int32_t __a, __b=(b); \ - __asm__ __volatile__ ( \ - "xorl %%eax, %%eax\n\t" \ - "movl $32, %%ecx\n\t" \ - "0:\n\t" \ - "movl -4(%%ebx,%%ecx,4), %%edx\n\t" \ - "rorl %%cl, %%edx\n\t" \ - "adcl %%edx, %%eax\n\t" \ - "bswapl %%eax\n\t" \ - "loop 0b" \ - : "=a" (__a) : "b" (__b) : "ecx", "edx" \ - __a; }) - -#else // __GNUC__ && __i386__ - -static inline uint32_t nsqrtasm(uint32_t a) -{ - // JBF 20030901: This was a damn lot simpler to reverse engineer than - // msqrtasm was. Really, it was just like simplifying an algebra equation. - uint16_t c; - - if (a & 0xff000000) // test eax, 0xff000000 / jnz short over24 - { - c = shlookup[(a >> 24) + 4096]; // mov ebx, eax - // over24: shr ebx, 24 - // mov cx, word ptr shlookup[ebx*2+8192] - } - else - { - c = shlookup[a >> 12]; // mov ebx, eax - // shr ebx, 12 - // mov cx, word ptr shlookup[ebx*2] - // jmp short under24 - } - a >>= c&0xff; // under24: shr eax, cl - a = (a&0xffff0000)|(sqrtable[a]); // mov ax, word ptr sqrtable[eax*2] - a >>= ((c&0xff00) >> 8); // mov cl, ch - // shr eax, cl - return a; -} - -static inline int32_t msqrtasm(uint32_t c) -{ - uint32_t a,b; - - a = 0x40000000l; // mov eax, 0x40000000 - b = 0x20000000l; // mov ebx, 0x20000000 - do // begit: - { - if (c >= a) // cmp ecx, eax / jl skip - { - c -= a; // sub ecx, eax - a += b*4; // lea eax, [eax+ebx*4] - } // skip: - a -= b; // sub eax, ebx - a >>= 1; // shr eax, 1 - b >>= 2; // shr ebx, 2 - } - while (b); // jnz begit - if (c >= a) // cmp ecx, eax - a++; // sbb eax, -1 - a >>= 1; // shr eax, 1 - return a; -} - -static inline int32_t krecipasm(int32_t i) -{ - // Ken did this - float f = (float)i; i = *(int32_t *)&f; - return((reciptable[(i>>12)&2047]>>(((i-0x3f800000)>>23)&31))^(i>>31)); -} - - -static inline int32_t getclipmask(int32_t a, int32_t b, int32_t c, int32_t d) -{ - // Ken did this - d = ((a<0)*8) + ((b<0)*4) + ((c<0)*2) + (d<0); - return(((d<<4)^0xf0)|d); -} - -inline int32_t getkensmessagecrc(int32_t b) -{ - return 0x56c764d4l; - b=b; -} - -#endif - - -int32_t xb1[MAXWALLSB], yb1[MAXWALLSB], xb2[MAXWALLSB], yb2[MAXWALLSB]; -int32_t rx1[MAXWALLSB], ry1[MAXWALLSB], rx2[MAXWALLSB], ry2[MAXWALLSB]; -int16_t p2[MAXWALLSB], thesector[MAXWALLSB]; -int16_t thewall[MAXWALLSB]; - -int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; - -static int16_t smost[MAXYSAVES], smostcnt; -static int16_t smoststart[MAXWALLSB]; -static char smostwalltype[MAXWALLSB]; -static int32_t smostwall[MAXWALLSB], smostwallcnt = -1L; - -int16_t maskwall[MAXWALLSB], maskwallcnt; -static int32_t spritesx[MAXSPRITESONSCREEN]; -static int32_t spritesy[MAXSPRITESONSCREEN+1]; -static int32_t spritesz[MAXSPRITESONSCREEN]; -spritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; - -int16_t umost[MAXXDIM], dmost[MAXXDIM]; -static int16_t bakumost[MAXXDIM], bakdmost[MAXXDIM]; -int16_t uplc[MAXXDIM], dplc[MAXXDIM]; -static int16_t uwall[MAXXDIM], dwall[MAXXDIM]; -static int32_t swplc[MAXXDIM], lplc[MAXXDIM]; -static int32_t swall[MAXXDIM], lwall[MAXXDIM+4]; -int32_t xdimen = -1, xdimenrecip, halfxdimen, xdimenscale, xdimscale; -int32_t wx1, wy1, wx2, wy2, ydimen; -intptr_t /*viewoffset,*/ frameoffset; - -static int32_t nrx1[8], nry1[8], nrx2[8], nry2[8]; // JBF 20031206: Thanks Ken - -static int32_t rxi[8], ryi[8], rzi[8], rxi2[8], ryi2[8], rzi2[8]; -static int32_t xsi[8], ysi[8], horizycent; -static intptr_t *horizlookup=0, *horizlookup2=0; - -int32_t globalposx, globalposy, globalposz, globalhoriz; -int16_t globalang, globalcursectnum; -int32_t globalpal, cosglobalang, singlobalang; -int32_t cosviewingrangeglobalang, sinviewingrangeglobalang; -char *globalpalwritten; -int32_t globaluclip, globaldclip, globvis; -int32_t globalvisibility, globalhisibility, globalpisibility, globalcisibility; -char globparaceilclip, globparaflorclip; - -int32_t xyaspect, viewingrangerecip; - -intptr_t asm1, asm2, asm3, asm4,palookupoffse[4]; -int32_t vplce[4], vince[4], bufplce[4]; -char globalxshift, globalyshift; -int32_t globalxpanning, globalypanning, globalshade; -int16_t globalpicnum, globalshiftval; -int32_t globalzd, globalyscale, globalorientation; -intptr_t globalbufplc; -int32_t globalx1, globaly1, globalx2, globaly2, globalx3, globaly3, globalzx; -int32_t globalx, globaly, globalz; - -int16_t sectorborder[256], sectorbordercnt; -static char tablesloaded = 0; -int32_t pageoffset, ydim16, qsetmode = 0; -int32_t startposx, startposy, startposz; -int16_t startang, startsectnum; -int16_t pointhighlight, linehighlight, highlightcnt; -int32_t lastx[MAXYDIM]; -char *transluc = NULL, paletteloaded = 0; - -int32_t halfxdim16, midydim16; - -#define FASTPALGRIDSIZ 8 -static int32_t rdist[129], gdist[129], bdist[129]; -static char colhere[((FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2))>>3]; -static char colhead[(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)]; -static int32_t colnext[256]; -static char coldist[8] = {0,1,2,3,4,3,2,1}; -static int32_t colscan[27]; - -static int16_t clipnum, hitwalls[4]; -const int32_t hitscangoalx = (1<<29)-1, hitscangoaly = (1<<29)-1; -#ifdef USE_OPENGL -int32_t hitallsprites = 0; -#endif - -typedef struct { int32_t x1, y1, x2, y2; } linetype; -static linetype clipit[MAXCLIPNUM]; -static int16_t clipsectorlist[MAXCLIPNUM], clipsectnum, origclipsectorlist[MAXCLIPNUM], origclipsectnum; -static int16_t clipspritelist[MAXCLIPNUM], clipspritenum; // sector-like sprite clipping -static int16_t clipobjectval[MAXCLIPNUM]; - -typedef struct -{ - int32_t sx, sy, z; - int16_t a, picnum; - int8_t dashade; - char dapalnum, dastat, pagesleft; - int32_t cx1, cy1, cx2, cy2; - int32_t uniqid; //JF extension -} permfifotype; -static permfifotype permfifo[MAXPERMS]; -static int32_t permhead = 0, permtail = 0; - -int16_t numscans, numhits, numbunches; -int16_t capturecount = 0; - -char vgapal16[4*256] = -{ - 00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00, - 42,00,42,00, 00,21,42,00, 42,42,42,00, 21,21,21,00, 63,21,21,00, - 21,63,21,00, 63,63,21,00, 21,21,63,00, 63,21,63,00, 21,63,63,00, - 63,63,63,00 -}; - -int16_t editstatus = 0; -int16_t searchit; -int32_t searchx = -1, searchy; //search input -int16_t searchsector, searchwall, searchstat; //search output - -// if searchstat==0 (wall), searchbottomwall is ==.nextwall if aiming at -// bottom of a wall with swapped walls (.cstat&2), else it's ==searchwall -int16_t searchbottomwall; - -double msens = 1.0; - -static char artfilename[20]; -static int32_t numtilefiles, artfil = -1, artfilnum, artfilplc; - -char inpreparemirror = 0; -static int32_t mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2; - -static int32_t setviewcnt = 0; // interface layers use this now -static int32_t bakframeplace[4], bakxsiz[4], bakysiz[4]; -static int32_t bakwindowx1[4], bakwindowy1[4]; -static int32_t bakwindowx2[4], bakwindowy2[4]; -#ifdef USE_OPENGL -static int32_t bakrendmode,baktile; -#endif - -int32_t totalclocklock; - -char apptitle[256] = "Build Engine"; - -uint8_t **basepaltableptr; -uint8_t basepalcount; -uint8_t curbasepal; - -palette_t curpalette[256]; // the current palette, unadjusted for brightness or tint -palette_t curpalettefaded[256]; // the current palette, adjusted for brightness and tint (ie. what gets sent to the card) -palette_t palfadergb = { 0,0,0,0 }; -char palfadedelta = 0; - - - -// -// Internal Engine Functions -// -//int32_t cacheresets = 0,cacheinvalidates = 0; - - -// -// getpalookup (internal) -// -static inline int32_t getpalookup(int32_t davis, int32_t dashade) -{ - return(min(max(dashade+(davis>>8),0),numpalookups-1)); -} - - -// -// scansector (internal) -// -static void scansector(int16_t sectnum) -{ - walltype *wal, *wal2; - spritetype *spr; - int32_t xs, ys, x1, y1, x2, y2, xp1, yp1, xp2=0, yp2=0, tempint; - int16_t z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst; - int16_t nextsectnum; - - if (sectnum < 0) return; - - if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7]; - - sectorborder[0] = sectnum, sectorbordercnt = 1; - do - { - sectnum = sectorborder[--sectorbordercnt]; - - for (z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) - { - spr = &sprite[z]; - if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && - (spr->xrepeat > 0) && (spr->yrepeat > 0) && - (spritesortcnt < MAXSPRITESONSCREEN)) - { - xs = spr->x-globalposx; ys = spr->y-globalposy; - if ((spr->cstat&48) || (xs*cosglobalang+ys*singlobalang > 0)) - { - copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype)); - spriteext[z].tspr = (spritetype *)&tsprite[spritesortcnt]; - tsprite[spritesortcnt++].owner = z; - } - } - } - - gotsector[sectnum>>3] |= pow2char[sectnum&7]; - - bunchfrst = numbunches; - numscansbefore = numscans; - - startwall = sector[sectnum].wallptr; - endwall = startwall + sector[sectnum].wallnum; - scanfirst = numscans; - for (z=startwall,wal=&wall[z]; znextsector; - - wal2 = &wall[wal->point2]; - x1 = wal->x-globalposx; y1 = wal->y-globalposy; - x2 = wal2->x-globalposx; y2 = wal2->y-globalposy; - - if ((nextsectnum >= 0) && ((wal->cstat&32) == 0)) - if ((gotsector[nextsectnum>>3]&pow2char[nextsectnum&7]) == 0) - { - tempint = x1*y2-x2*y1; - if (((unsigned)tempint+262144) < 524288) // BXY_MAX? - if (mulscale5(tempint,tempint) <= (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) - sectorborder[sectorbordercnt++] = nextsectnum; - } - - if ((z == startwall) || (wall[z-1].point2 != z)) - { - xp1 = dmulscale6(y1,cosglobalang,-x1,singlobalang); - yp1 = dmulscale6(x1,cosviewingrangeglobalang,y1,sinviewingrangeglobalang); - } - else - { - xp1 = xp2; - yp1 = yp2; - } - xp2 = dmulscale6(y2,cosglobalang,-x2,singlobalang); - yp2 = dmulscale6(x2,cosviewingrangeglobalang,y2,sinviewingrangeglobalang); - if ((yp1 < 256) && (yp2 < 256)) goto skipitaddwall; - - //If wall's NOT facing you - if (dmulscale32(xp1,yp2,-xp2,yp1) >= 0) goto skipitaddwall; - - if (xp1 >= -yp1) - { - if ((xp1 > yp1) || (yp1 == 0)) goto skipitaddwall; - xb1[numscans] = halfxdimen + scale(xp1,halfxdimen,yp1); - if (xp1 >= 0) xb1[numscans]++; //Fix for SIGNED divide - if (xb1[numscans] >= xdimen) xb1[numscans] = xdimen-1; - yb1[numscans] = yp1; - } - else - { - if (xp2 < -yp2) goto skipitaddwall; - xb1[numscans] = 0; - tempint = yp1-yp2+xp1-xp2; - if (tempint == 0) goto skipitaddwall; - yb1[numscans] = yp1 + scale(yp2-yp1,xp1+yp1,tempint); - } - if (yb1[numscans] < 256) goto skipitaddwall; - - if (xp2 <= yp2) - { - if ((xp2 < -yp2) || (yp2 == 0)) goto skipitaddwall; - xb2[numscans] = halfxdimen + scale(xp2,halfxdimen,yp2) - 1; - if (xp2 >= 0) xb2[numscans]++; //Fix for SIGNED divide - if (xb2[numscans] >= xdimen) xb2[numscans] = xdimen-1; - yb2[numscans] = yp2; - } - else - { - if (xp1 > yp1) goto skipitaddwall; - xb2[numscans] = xdimen-1; - tempint = xp2-xp1+yp1-yp2; - if (tempint == 0) goto skipitaddwall; - yb2[numscans] = yp1 + scale(yp2-yp1,yp1-xp1,tempint); - } - if ((yb2[numscans] < 256) || (xb1[numscans] > xb2[numscans])) goto skipitaddwall; - - //Made it all the way! - thesector[numscans] = sectnum; thewall[numscans] = z; - rx1[numscans] = xp1; ry1[numscans] = yp1; - rx2[numscans] = xp2; ry2[numscans] = yp2; - p2[numscans] = numscans+1; - numscans++; - skipitaddwall: - - if ((wall[z].point2 < z) && (scanfirst < numscans)) - p2[numscans-1] = scanfirst, scanfirst = numscans; - } - - for (z=numscansbefore; z= xb1[p2[z]])) - bunchfirst[numbunches++] = p2[z], p2[z] = -1; - - for (z=bunchfrst; z=0; zz=p2[zz]); - bunchlast[z] = zz; - } - } - while (sectorbordercnt > 0); -} - - -// -// maskwallscan (internal) -// -static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32_t *swal, int32_t *lwal) -{ - int32_t x,/* startx,*/ xnice, ynice; - intptr_t startx, p, fpalookup; - int32_t y1ve[4], y2ve[4], /* p,*/ tsizx, tsizy; -#ifndef ENGINE_USING_A_C - char bad; - int32_t i, u4, d4, dax, z; -#endif - - tsizx = tilesizx[globalpicnum]; - tsizy = tilesizy[globalpicnum]; - setgotpic(globalpicnum); - if ((tsizx <= 0) || (tsizy <= 0)) return; - if ((uwal[x1] > ydimen) && (uwal[x2] > ydimen)) return; - if ((dwal[x1] < 0) && (dwal[x2] < 0)) return; - - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - - startx = x1; - - xnice = (pow2long[picsiz[globalpicnum]&15] == tsizx); - if (xnice) tsizx = (tsizx-1); - ynice = (pow2long[picsiz[globalpicnum]>>4] == tsizy); - if (ynice) tsizy = (picsiz[globalpicnum]>>4); - - if (palookup[globalpal] == NULL) - globalpal = 0; - - fpalookup = FP_OFF(palookup[globalpal]); - - setupmvlineasm(globalshiftval); - -#ifndef ENGINE_USING_A_C - - x = startx; - while ((startumost[x+windowx1] > startdmost[x+windowx1]) && (x <= x2)) x++; - - p = x+frameoffset; - - for (; (x<=x2)&&(p&3); x++,p++) - { - y1ve[0] = max(uwal[x],startumost[x+windowx1]-windowy1); - y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1); - if (y2ve[0] <= y1ve[0]) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - - bufplce[0] = lwal[x] + globalxpanning; - if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; } - if (ynice == 0) bufplce[0] *= tsizy; else bufplce[0] <<= tsizy; - - vince[0] = swal[x]*globalyscale; - vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1); - - mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]); - } - for (; x<=x2-3; x+=4,p+=4) - { - bad = 0; - for (z=3,dax=x+3; z>=0; z--,dax--) - { - y1ve[z] = max(uwal[dax],startumost[dax+windowx1]-windowy1); - y2ve[z] = min(dwal[dax],startdmost[dax+windowx1]-windowy1)-1; - if (y2ve[z] < y1ve[z]) { bad += pow2char[z]; continue; } - - i = lwal[dax] + globalxpanning; - if (i >= tsizx) { if (xnice == 0) i %= tsizx; else i &= tsizx; } - if (ynice == 0) i *= tsizy; else i <<= tsizy; - bufplce[z] = waloff[globalpicnum]+i; - - vince[z] = swal[dax]*globalyscale; - vplce[z] = globalzd + vince[z]*(y1ve[z]-globalhoriz+1); - } - if (bad == 15) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - palookupoffse[3] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+3],globvis),globalshade)<<8); - - if ((palookupoffse[0] == palookupoffse[3]) && ((bad&0x9) == 0)) - { - palookupoffse[1] = palookupoffse[0]; - palookupoffse[2] = palookupoffse[0]; - } - else - { - palookupoffse[1] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+1],globvis),globalshade)<<8); - palookupoffse[2] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+2],globvis),globalshade)<<8); - } - - u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3])); - d4 = min(min(y2ve[0],y2ve[1]),min(y2ve[2],y2ve[3])); - - if ((bad > 0) || (u4 >= d4)) - { - if (!(bad&1)) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0); - if (!(bad&2)) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1); - if (!(bad&4)) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2); - if (!(bad&8)) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3); - continue; - } - - if (u4 > y1ve[0]) vplce[0] = mvlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0); - if (u4 > y1ve[1]) vplce[1] = mvlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1); - if (u4 > y1ve[2]) vplce[2] = mvlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2); - if (u4 > y1ve[3]) vplce[3] = mvlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3); - - if (d4 >= u4) mvlineasm4(d4-u4+1,ylookup[u4]+p); - - i = p+ylookup[d4+1]; - if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); - if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); - if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); - if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3); - } - for (; x<=x2; x++,p++) - { - y1ve[0] = max(uwal[x],startumost[x+windowx1]-windowy1); - y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1); - if (y2ve[0] <= y1ve[0]) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - - bufplce[0] = lwal[x] + globalxpanning; - if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; } - if (ynice == 0) bufplce[0] *= tsizy; else bufplce[0] <<= tsizy; - - vince[0] = swal[x]*globalyscale; - vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1); - - mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]); - } - -#else // ENGINE_USING_A_C - - p = startx+frameoffset; - for (x=startx; x<=x2; x++,p++) - { - y1ve[0] = max(uwal[x],startumost[x+windowx1]-windowy1); - y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1); - if (y2ve[0] <= y1ve[0]) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - - bufplce[0] = lwal[x] + globalxpanning; - if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; } - if (ynice == 0) bufplce[0] *= tsizy; else bufplce[0] <<= tsizy; - - vince[0] = swal[x]*globalyscale; - vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1); - - mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]); - } - -#endif - - faketimerhandler(); -} - - -// -// wallfront (internal) -// -int32_t wallfront(int32_t l1, int32_t l2) -{ - walltype *wal; - int32_t x11, y11, x21, y21, x12, y12, x22, y22, dx, dy, t1, t2; - - wal = &wall[thewall[l1]]; x11 = wal->x; y11 = wal->y; - wal = &wall[wal->point2]; x21 = wal->x; y21 = wal->y; - wal = &wall[thewall[l2]]; x12 = wal->x; y12 = wal->y; - wal = &wall[wal->point2]; x22 = wal->x; y22 = wal->y; - - dx = x21-x11; dy = y21-y11; - t1 = dmulscale2(x12-x11,dy,-dx,y12-y11); //p1(l2) vs. l1 - t2 = dmulscale2(x22-x11,dy,-dx,y22-y11); //p2(l2) vs. l1 - if (t1 == 0) { t1 = t2; if (t1 == 0) return(-1); } - if (t2 == 0) t2 = t1; - if ((t1^t2) >= 0) - { - t2 = dmulscale2(globalposx-x11,dy,-dx,globalposy-y11); //pos vs. l1 - return((t2^t1) >= 0); - } - - dx = x22-x12; dy = y22-y12; - t1 = dmulscale2(x11-x12,dy,-dx,y11-y12); //p1(l1) vs. l2 - t2 = dmulscale2(x21-x12,dy,-dx,y21-y12); //p2(l1) vs. l2 - if (t1 == 0) { t1 = t2; if (t1 == 0) return(-1); } - if (t2 == 0) t2 = t1; - if ((t1^t2) >= 0) - { - t2 = dmulscale2(globalposx-x12,dy,-dx,globalposy-y12); //pos vs. l2 - return((t2^t1) < 0); - } - return(-2); -} - - -// -// spritewallfront (internal) -// -static inline int32_t spritewallfront(spritetype *s, int32_t w) -{ - walltype *wal; - int32_t x1, y1; - - wal = &wall[w]; x1 = wal->x; y1 = wal->y; - wal = &wall[wal->point2]; - return (dmulscale32(wal->x-x1,s->y-y1,-(s->x-x1),wal->y-y1) >= 0); -} - -// -// spritebehindwall(internal) -// -#if 0 -static int32_t spriteobstructswall(spritetype *s, int32_t w) -{ - walltype *wal; - int32_t x, y; - int32_t x1, y1; - int32_t x2, y2; - double a1, b1, c1; - double a2, b2, c2; - double d1, d2; - - // wall line equation - wal = &wall[w]; x1 = wal->x - globalposx; y1 = wal->y - globalposy; - wal = &wall[wal->point2]; x2 = wal->x - globalposx; y2 = wal->y - globalposy; - if ((x2 - x1) != 0) - a1 = (float)(y2 - y1)/(x2 - x1); - else - a1 = 1e+37; // not infinite, but almost ;) - b1 = -1; - c1 = (y1 - (a1 * x1)); - - // player to sprite line equation - if ((s->x - globalposx) != 0) - a2 = (float)(s->y - globalposy)/(s->x - globalposx); - else - a2 = 1e+37; - b2 = -1; - c2 = 0; - - // intersection point - d1 = (float)(1) / (a1*b2 - a2*b1); - x = ((b1*c2 - b2*c1) * d1); - y = ((a2*c1 - a1*c2) * d1); - - // distance between the sprite and the player - a1 = s->x - globalposx; - b1 = s->y - globalposy; - d1 = (a1 * a1 + b1 * b1); - - // distance between the intersection point and the player - d2 = (x * x + y * y); - - // check if the sprite obstructs the wall - if ((d1 < d2) && (min(x1, x2) <= x) && (x <= max(x1, x2)) && (min(y1, y2) <= y) && (y <= max(y1, y2))) - return (1); - else - return (0); -} -#endif -// -// bunchfront (internal) -// -static inline int32_t bunchfront(int32_t b1, int32_t b2) -{ - int32_t x1b1, x2b1, x1b2, x2b2, b1f, b2f, i; - - b1f = bunchfirst[b1]; x1b1 = xb1[b1f]; x2b2 = xb2[bunchlast[b2]]+1; - if (x1b1 >= x2b2) return(-1); - b2f = bunchfirst[b2]; x1b2 = xb1[b2f]; x2b1 = xb2[bunchlast[b1]]+1; - if (x1b2 >= x2b1) return(-1); - - if (x1b1 >= x1b2) - { - for (i=b2f; xb2[i] xr) return; - r = horizlookup2[yp-globalhoriz+horizycent]; - asm1 = globalx1*r; - asm2 = globaly2*r; - s = ((int32_t)getpalookup((int32_t)mulscale16(r,globvis),globalshade)<<8); - - hlineasm4(xr-xl,0,s,globalx2*r+globalypanning,globaly1*r+globalxpanning, - ylookup[yp]+xr+frameoffset); -} - - -// -// slowhline (internal) -// -static inline void slowhline(int32_t xr, int32_t yp) -{ - int32_t xl, r; - - xl = lastx[yp]; if (xl > xr) return; - r = horizlookup2[yp-globalhoriz+horizycent]; - asm1 = globalx1*r; - asm2 = globaly2*r; - - asm3 = (intptr_t)globalpalwritten + ((intptr_t)getpalookup((int32_t)mulscale16(r,globvis),globalshade)<<8); - if (!(globalorientation&256)) - { - mhline(globalbufplc,globaly1*r+globalxpanning-asm1*(xr-xl),(xr-xl)<<16,0L, - globalx2*r+globalypanning-asm2*(xr-xl),ylookup[yp]+xl+frameoffset); - return; - } - thline(globalbufplc,globaly1*r+globalxpanning-asm1*(xr-xl),(xr-xl)<<16,0L, - globalx2*r+globalypanning-asm2*(xr-xl),ylookup[yp]+xl+frameoffset); -} - - -// -// prepwall (internal) -// -static void prepwall(int32_t z, walltype *wal) -{ - int32_t i, l=0, ol=0, splc, sinc, x, topinc, top, botinc, bot, walxrepeat; - - walxrepeat = (wal->xrepeat<<3); - - //lwall calculation - i = xb1[z]-halfxdimen; - topinc = -(ry1[z]>>2); - botinc = ((ry2[z]-ry1[z])>>8); - top = mulscale5(rx1[z],xdimen)+mulscale2(topinc,i); - bot = mulscale11(rx1[z]-rx2[z],xdimen)+mulscale2(botinc,i); - - splc = mulscale19(ry1[z],xdimscale); - sinc = mulscale16(ry2[z]-ry1[z],xdimscale); - - x = xb1[z]; - if (bot != 0) - { - l = divscale12(top,bot); - swall[x] = mulscale21(l,sinc)+splc; - l *= walxrepeat; - lwall[x] = (l>>18); - } - while (x+4 <= xb2[z]) - { - top += topinc; bot += botinc; - if (bot != 0) - { - ol = l; l = divscale12(top,bot); - swall[x+4] = mulscale21(l,sinc)+splc; - l *= walxrepeat; - lwall[x+4] = (l>>18); - } - i = ((ol+l)>>1); - lwall[x+2] = (i>>18); - lwall[x+1] = ((ol+i)>>19); - lwall[x+3] = ((l+i)>>19); - swall[x+2] = ((swall[x]+swall[x+4])>>1); - swall[x+1] = ((swall[x]+swall[x+2])>>1); - swall[x+3] = ((swall[x+4]+swall[x+2])>>1); - x += 4; - } - if (x+2 <= xb2[z]) - { - top += (topinc>>1); bot += (botinc>>1); - if (bot != 0) - { - ol = l; l = divscale12(top,bot); - swall[x+2] = mulscale21(l,sinc)+splc; - l *= walxrepeat; - lwall[x+2] = (l>>18); - } - lwall[x+1] = ((l+ol)>>19); - swall[x+1] = ((swall[x]+swall[x+2])>>1); - x += 2; - } - if (x+1 <= xb2[z]) - { - bot += (botinc>>2); - if (bot != 0) - { - l = divscale12(top+(topinc>>2),bot); - swall[x+1] = mulscale21(l,sinc)+splc; - lwall[x+1] = mulscale18(l,walxrepeat); - } - } - - if (lwall[xb1[z]] < 0) lwall[xb1[z]] = 0; - if ((lwall[xb2[z]] >= walxrepeat) && (walxrepeat)) lwall[xb2[z]] = walxrepeat-1; - if (wal->cstat&8) - { - walxrepeat--; - for (x=xb1[z]; x<=xb2[z]; x++) lwall[x] = walxrepeat-lwall[x]; - } -} - - -// -// animateoffs (internal) -// -inline int32_t animateoffs(int16_t tilenum, int16_t fakevar) -{ - int32_t i, k, offs; - - UNREFERENCED_PARAMETER(fakevar); - - offs = 0; - i = (totalclocklock>>((picanm[tilenum]>>24)&15)); - if ((picanm[tilenum]&63) > 0) - { - switch (picanm[tilenum]&192) - { - case 64: - k = (i%((picanm[tilenum]&63)<<1)); - if (k < (picanm[tilenum]&63)) - offs = k; - else - offs = (((picanm[tilenum]&63)<<1)-k); - break; - case 128: - offs = (i%((picanm[tilenum]&63)+1)); - break; - case 192: - offs = -(i%((picanm[tilenum]&63)+1)); - } - } - return(offs); -} - - -// -// owallmost (internal) -// -static int32_t owallmost(int16_t *mostbuf, int32_t w, int32_t z) -{ - int32_t bad, inty, xcross, y, yinc; - int32_t s1, s2, s3, s4, ix1, ix2, iy1, iy2, t; - int32_t i; - - z <<= 7; - s1 = mulscale20(globaluclip,yb1[w]); s2 = mulscale20(globaluclip,yb2[w]); - s3 = mulscale20(globaldclip,yb1[w]); s4 = mulscale20(globaldclip,yb2[w]); - bad = (zs3)<<2)+((z>s4)<<3); - - ix1 = xb1[w]; iy1 = yb1[w]; - ix2 = xb2[w]; iy2 = yb2[w]; - - if ((bad&3) == 3) - { - //clearbufbyte(&mostbuf[ix1],(ix2-ix1+1)*sizeof(mostbuf[0]),0L); - for (i=ix1; i<=ix2; i++) mostbuf[i] = 0; - return(bad); - } - - if ((bad&12) == 12) - { - //clearbufbyte(&mostbuf[ix1],(ix2-ix1+1)*sizeof(mostbuf[0]),ydimen+(ydimen<<16)); - for (i=ix1; i<=ix2; i++) mostbuf[i] = ydimen; - return(bad); - } - - if (bad&3) - { - t = divscale30(z-s1,s2-s1); - inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t); - xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty); - - if ((bad&3) == 2) - { - if (xb1[w] <= xcross) { iy2 = inty; ix2 = xcross; } - //clearbufbyte(&mostbuf[xcross+1],(xb2[w]-xcross)*sizeof(mostbuf[0]),0L); - for (i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = 0; - } - else - { - if (xcross <= xb2[w]) { iy1 = inty; ix1 = xcross; } - //clearbufbyte(&mostbuf[xb1[w]],(xcross-xb1[w]+1)*sizeof(mostbuf[0]),0L); - for (i=xb1[w]; i<=xcross; i++) mostbuf[i] = 0; - } - } - - if (bad&12) - { - t = divscale30(z-s3,s4-s3); - inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t); - xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty); - - if ((bad&12) == 8) - { - if (xb1[w] <= xcross) { iy2 = inty; ix2 = xcross; } - //clearbufbyte(&mostbuf[xcross+1],(xb2[w]-xcross)*sizeof(mostbuf[0]),ydimen+(ydimen<<16)); - for (i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = ydimen; - } - else - { - if (xcross <= xb2[w]) { iy1 = inty; ix1 = xcross; } - //clearbufbyte(&mostbuf[xb1[w]],(xcross-xb1[w]+1)*sizeof(mostbuf[0]),ydimen+(ydimen<<16)); - for (i=xb1[w]; i<=xcross; i++) mostbuf[i] = ydimen; - } - } - - y = (scale(z,xdimenscale,iy1)<<4); - yinc = ((scale(z,xdimenscale,iy2)<<4)-y) / (ix2-ix1+1); - qinterpolatedown16short((intptr_t)&mostbuf[ix1],ix2-ix1+1,y+(globalhoriz<<16),yinc); - - if (mostbuf[ix1] < 0) mostbuf[ix1] = 0; - if (mostbuf[ix1] > ydimen) mostbuf[ix1] = ydimen; - if (mostbuf[ix2] < 0) mostbuf[ix2] = 0; - if (mostbuf[ix2] > ydimen) mostbuf[ix2] = ydimen; - - return(bad); -} - - -// -// wallmost (internal) -// -static int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat) -{ - int32_t bad, i, j, t, y, z, inty, intz, xcross, yinc, fw; - int32_t x1, y1, z1, x2, y2, z2, xv, yv, dx, dy, dasqr, oz1, oz2; - int32_t s1, s2, s3, s4, ix1, ix2, iy1, iy2; - //char datempbuf[256]; - - if (dastat == 0) - { - z = sector[sectnum].ceilingz-globalposz; - if ((sector[sectnum].ceilingstat&2) == 0) return(owallmost(mostbuf,w,z)); - } - else - { - z = sector[sectnum].floorz-globalposz; - if ((sector[sectnum].floorstat&2) == 0) return(owallmost(mostbuf,w,z)); - } - - i = thewall[w]; - if (i == sector[sectnum].wallptr) return(owallmost(mostbuf,w,z)); - - x1 = wall[i].x; x2 = wall[wall[i].point2].x-x1; - y1 = wall[i].y; y2 = wall[wall[i].point2].y-y1; - - fw = sector[sectnum].wallptr; i = wall[fw].point2; - dx = wall[i].x-wall[fw].x; dy = wall[i].y-wall[fw].y; - dasqr = krecipasm(nsqrtasm(dx*dx+dy*dy)); - - if (xb1[w] == 0) - { xv = cosglobalang+sinviewingrangeglobalang; yv = singlobalang-cosviewingrangeglobalang; } - else - { xv = x1-globalposx; yv = y1-globalposy; } - i = xv*(y1-globalposy)-yv*(x1-globalposx); j = yv*x2-xv*y2; - if (klabs(j) > klabs(i>>3)) i = divscale28(i,j); - if (dastat == 0) - { - t = mulscale15(sector[sectnum].ceilingheinum,dasqr); - z1 = sector[sectnum].ceilingz; - } - else - { - t = mulscale15(sector[sectnum].floorheinum,dasqr); - z1 = sector[sectnum].floorz; - } - z1 = dmulscale24(dx*t,mulscale20(y2,i)+((y1-wall[fw].y)<<8), - -dy*t,mulscale20(x2,i)+((x1-wall[fw].x)<<8))+((z1-globalposz)<<7); - - - if (xb2[w] == xdimen-1) - { xv = cosglobalang-sinviewingrangeglobalang; yv = singlobalang+cosviewingrangeglobalang; } - else - { xv = (x2+x1)-globalposx; yv = (y2+y1)-globalposy; } - i = xv*(y1-globalposy)-yv*(x1-globalposx); j = yv*x2-xv*y2; - if (klabs(j) > klabs(i>>3)) i = divscale28(i,j); - if (dastat == 0) - { - t = mulscale15(sector[sectnum].ceilingheinum,dasqr); - z2 = sector[sectnum].ceilingz; - } - else - { - t = mulscale15(sector[sectnum].floorheinum,dasqr); - z2 = sector[sectnum].floorz; - } - z2 = dmulscale24(dx*t,mulscale20(y2,i)+((y1-wall[fw].y)<<8), - -dy*t,mulscale20(x2,i)+((x1-wall[fw].x)<<8))+((z2-globalposz)<<7); - - - s1 = mulscale20(globaluclip,yb1[w]); s2 = mulscale20(globaluclip,yb2[w]); - s3 = mulscale20(globaldclip,yb1[w]); s4 = mulscale20(globaldclip,yb2[w]); - bad = (z1s3)<<2)+((z2>s4)<<3); - - ix1 = xb1[w]; ix2 = xb2[w]; - iy1 = yb1[w]; iy2 = yb2[w]; - oz1 = z1; oz2 = z2; - - if ((bad&3) == 3) - { - //clearbufbyte(&mostbuf[ix1],(ix2-ix1+1)*sizeof(mostbuf[0]),0L); - for (i=ix1; i<=ix2; i++) mostbuf[i] = 0; - return(bad); - } - - if ((bad&12) == 12) - { - //clearbufbyte(&mostbuf[ix1],(ix2-ix1+1)*sizeof(mostbuf[0]),ydimen+(ydimen<<16)); - for (i=ix1; i<=ix2; i++) mostbuf[i] = ydimen; - return(bad); - } - - if (bad&3) - { - //inty = intz / (globaluclip>>16) - t = divscale30(oz1-s1,s2-s1+oz1-oz2); - inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t); - intz = oz1 + mulscale30(oz2-oz1,t); - xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty); - - //t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4)); - //inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t); - //intz = z1 + mulscale30(z2-z1,t); - - if ((bad&3) == 2) - { - if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; } - //clearbufbyte(&mostbuf[xcross+1],(xb2[w]-xcross)*sizeof(mostbuf[0]),0L); - for (i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = 0; - } - else - { - if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; } - //clearbufbyte(&mostbuf[xb1[w]],(xcross-xb1[w]+1)*sizeof(mostbuf[0]),0L); - for (i=xb1[w]; i<=xcross; i++) mostbuf[i] = 0; - } - } - - if (bad&12) - { - //inty = intz / (globaldclip>>16) - t = divscale30(oz1-s3,s4-s3+oz1-oz2); - inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t); - intz = oz1 + mulscale30(oz2-oz1,t); - xcross = xb1[w] + scale(mulscale30(yb2[w],t),xb2[w]-xb1[w],inty); - - //t = divscale30((x1<<4)-xcross*yb1[w],xcross*(yb2[w]-yb1[w])-((x2-x1)<<4)); - //inty = yb1[w] + mulscale30(yb2[w]-yb1[w],t); - //intz = z1 + mulscale30(z2-z1,t); - - if ((bad&12) == 8) - { - if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; } - //clearbufbyte(&mostbuf[xcross+1],(xb2[w]-xcross)*sizeof(mostbuf[0]),ydimen+(ydimen<<16)); - for (i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = ydimen; - } - else - { - if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; } - //clearbufbyte(&mostbuf[xb1[w]],(xcross-xb1[w]+1)*sizeof(mostbuf[0]),ydimen+(ydimen<<16)); - for (i=xb1[w]; i<=xcross; i++) mostbuf[i] = ydimen; - } - } - - y = (scale(z1,xdimenscale,iy1)<<4); - yinc = ((scale(z2,xdimenscale,iy2)<<4)-y) / (ix2-ix1+1); - qinterpolatedown16short((intptr_t)&mostbuf[ix1],ix2-ix1+1,y+(globalhoriz<<16),yinc); - - if (mostbuf[ix1] < 0) mostbuf[ix1] = 0; - if (mostbuf[ix1] > ydimen) mostbuf[ix1] = ydimen; - if (mostbuf[ix2] < 0) mostbuf[ix2] = 0; - if (mostbuf[ix2] > ydimen) mostbuf[ix2] = ydimen; - - return(bad); -} - - -// -// ceilscan (internal) -// -static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum) -{ - int32_t i, j, ox, oy, x, y1, y2, twall, bwall; - sectortype *sec; - - sec = §or[sectnum]; - if (palookup[sec->ceilingpal] != globalpalwritten) - { - globalpalwritten = palookup[sec->ceilingpal]; - if (!globalpalwritten) globalpalwritten = palookup[globalpal]; // JBF: fixes null-pointer crash - setpalookupaddress(globalpalwritten); - } - - globalzd = sec->ceilingz-globalposz; - if (globalzd > 0) return; - globalpicnum = sec->ceilingpicnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - setgotpic(globalpicnum); - if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs((int16_t)globalpicnum,(int16_t)sectnum); - - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - globalbufplc = waloff[globalpicnum]; - - globalshade = (int32_t)sec->ceilingshade; - globvis = globalcisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalorientation = (int32_t)sec->ceilingstat; - - - if ((globalorientation&64) == 0) - { - globalx1 = singlobalang; globalx2 = singlobalang; - globaly1 = cosglobalang; globaly2 = cosglobalang; - globalxpanning = (globalposx<<20); - globalypanning = -(globalposy<<20); - } - else - { - j = sec->wallptr; - ox = wall[wall[j].point2].x - wall[j].x; - oy = wall[wall[j].point2].y - wall[j].y; - i = nsqrtasm(ox*ox+oy*oy); if (i == 0) i = 1024; else i = 1048576/i; - globalx1 = mulscale10(dmulscale10(ox,singlobalang,-oy,cosglobalang),i); - globaly1 = mulscale10(dmulscale10(ox,cosglobalang,oy,singlobalang),i); - globalx2 = -globalx1; - globaly2 = -globaly1; - - ox = ((wall[j].x-globalposx)<<6); oy = ((wall[j].y-globalposy)<<6); - i = dmulscale14(oy,cosglobalang,-ox,singlobalang); - j = dmulscale14(ox,cosglobalang,oy,singlobalang); - ox = i; oy = j; - globalxpanning = globalx1*ox - globaly1*oy; - globalypanning = globaly2*ox + globalx2*oy; - } - globalx2 = mulscale16(globalx2,viewingrangerecip); - globaly1 = mulscale16(globaly1,viewingrangerecip); - globalxshift = (8-(picsiz[globalpicnum]&15)); - globalyshift = (8-(picsiz[globalpicnum]>>4)); - if (globalorientation&8) { globalxshift++; globalyshift++; } - - if ((globalorientation&0x4) > 0) - { - i = globalxpanning; globalxpanning = globalypanning; globalypanning = i; - i = globalx2; globalx2 = -globaly1; globaly1 = -i; - i = globalx1; globalx1 = globaly2; globaly2 = i; - } - if ((globalorientation&0x10) > 0) globalx1 = -globalx1, globaly1 = -globaly1, globalxpanning = -globalxpanning; - if ((globalorientation&0x20) > 0) globalx2 = -globalx2, globaly2 = -globaly2, globalypanning = -globalypanning; - globalx1 <<= globalxshift; globaly1 <<= globalxshift; - globalx2 <<= globalyshift; globaly2 <<= globalyshift; - globalxpanning <<= globalxshift; globalypanning <<= globalyshift; - globalxpanning += (((int32_t)sec->ceilingxpanning)<<24); - globalypanning += (((int32_t)sec->ceilingypanning)<<24); - globaly1 = (-globalx1-globaly1)*halfxdimen; - globalx2 = (globalx2-globaly2)*halfxdimen; - - sethlinesizes(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4,globalbufplc); - - globalx2 += globaly2*(x1-1); - globaly1 += globalx1*(x1-1); - globalx1 = mulscale16(globalx1,globalzd); - globalx2 = mulscale16(globalx2,globalzd); - globaly1 = mulscale16(globaly1,globalzd); - globaly2 = mulscale16(globaly2,globalzd); - globvis = klabs(mulscale10(globvis,globalzd)); - - if (!(globalorientation&0x180)) - { - y1 = umost[x1]; y2 = y1; - for (x=x1; x<=x2; x++) - { - twall = umost[x]-1; bwall = min(uplc[x],dmost[x]); - if (twall < bwall-1) - { - if (twall >= y2) - { - while (y1 < y2-1) hline(x-1,++y1); - y1 = twall; - } - else - { - while (y1 < twall) hline(x-1,++y1); - while (y1 > twall) lastx[y1--] = x; - } - while (y2 > bwall) hline(x-1,--y2); - while (y2 < bwall) lastx[y2++] = x; - } - else - { - while (y1 < y2-1) hline(x-1,++y1); - if (x == x2) { globalx2 += globaly2; globaly1 += globalx1; break; } - y1 = umost[x+1]; y2 = y1; - } - globalx2 += globaly2; globaly1 += globalx1; - } - while (y1 < y2-1) hline(x2,++y1); - faketimerhandler(); - return; - } - - switch (globalorientation&0x180) - { - case 128: - msethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); - break; - case 256: - settransnormal(); - tsethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); - break; - case 384: - settransreverse(); - tsethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); - break; - } - - y1 = umost[x1]; y2 = y1; - for (x=x1; x<=x2; x++) - { - twall = umost[x]-1; bwall = min(uplc[x],dmost[x]); - if (twall < bwall-1) - { - if (twall >= y2) - { - while (y1 < y2-1) slowhline(x-1,++y1); - y1 = twall; - } - else - { - while (y1 < twall) slowhline(x-1,++y1); - while (y1 > twall) lastx[y1--] = x; - } - while (y2 > bwall) slowhline(x-1,--y2); - while (y2 < bwall) lastx[y2++] = x; - } - else - { - while (y1 < y2-1) slowhline(x-1,++y1); - if (x == x2) { globalx2 += globaly2; globaly1 += globalx1; break; } - y1 = umost[x+1]; y2 = y1; - } - globalx2 += globaly2; globaly1 += globalx1; - } - while (y1 < y2-1) slowhline(x2,++y1); - faketimerhandler(); -} - - -// -// florscan (internal) -// -static void florscan(int32_t x1, int32_t x2, int32_t sectnum) -{ - int32_t i, j, ox, oy, x, y1, y2, twall, bwall; - sectortype *sec; - - sec = §or[sectnum]; - if (palookup[sec->floorpal] != globalpalwritten) - { - globalpalwritten = palookup[sec->floorpal]; - if (!globalpalwritten) globalpalwritten = palookup[globalpal]; // JBF: fixes null-pointer crash - setpalookupaddress(globalpalwritten); - } - - globalzd = globalposz-sec->floorz; - if (globalzd > 0) return; - globalpicnum = sec->floorpicnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - setgotpic(globalpicnum); - if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs((int16_t)globalpicnum,(int16_t)sectnum); - - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - globalbufplc = waloff[globalpicnum]; - - globalshade = (int32_t)sec->floorshade; - globvis = globalcisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalorientation = (int32_t)sec->floorstat; - - - if ((globalorientation&64) == 0) - { - globalx1 = singlobalang; globalx2 = singlobalang; - globaly1 = cosglobalang; globaly2 = cosglobalang; - globalxpanning = (globalposx<<20); - globalypanning = -(globalposy<<20); - } - else - { - j = sec->wallptr; - ox = wall[wall[j].point2].x - wall[j].x; - oy = wall[wall[j].point2].y - wall[j].y; - i = nsqrtasm(ox*ox+oy*oy); if (i == 0) i = 1024; else i = 1048576/i; - globalx1 = mulscale10(dmulscale10(ox,singlobalang,-oy,cosglobalang),i); - globaly1 = mulscale10(dmulscale10(ox,cosglobalang,oy,singlobalang),i); - globalx2 = -globalx1; - globaly2 = -globaly1; - - ox = ((wall[j].x-globalposx)<<6); oy = ((wall[j].y-globalposy)<<6); - i = dmulscale14(oy,cosglobalang,-ox,singlobalang); - j = dmulscale14(ox,cosglobalang,oy,singlobalang); - ox = i; oy = j; - globalxpanning = globalx1*ox - globaly1*oy; - globalypanning = globaly2*ox + globalx2*oy; - } - globalx2 = mulscale16(globalx2,viewingrangerecip); - globaly1 = mulscale16(globaly1,viewingrangerecip); - globalxshift = (8-(picsiz[globalpicnum]&15)); - globalyshift = (8-(picsiz[globalpicnum]>>4)); - if (globalorientation&8) { globalxshift++; globalyshift++; } - - if ((globalorientation&0x4) > 0) - { - i = globalxpanning; globalxpanning = globalypanning; globalypanning = i; - i = globalx2; globalx2 = -globaly1; globaly1 = -i; - i = globalx1; globalx1 = globaly2; globaly2 = i; - } - if ((globalorientation&0x10) > 0) globalx1 = -globalx1, globaly1 = -globaly1, globalxpanning = -globalxpanning; - if ((globalorientation&0x20) > 0) globalx2 = -globalx2, globaly2 = -globaly2, globalypanning = -globalypanning; - globalx1 <<= globalxshift; globaly1 <<= globalxshift; - globalx2 <<= globalyshift; globaly2 <<= globalyshift; - globalxpanning <<= globalxshift; globalypanning <<= globalyshift; - globalxpanning += (((int32_t)sec->floorxpanning)<<24); - globalypanning += (((int32_t)sec->floorypanning)<<24); - globaly1 = (-globalx1-globaly1)*halfxdimen; - globalx2 = (globalx2-globaly2)*halfxdimen; - - sethlinesizes(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4,globalbufplc); - - globalx2 += globaly2*(x1-1); - globaly1 += globalx1*(x1-1); - globalx1 = mulscale16(globalx1,globalzd); - globalx2 = mulscale16(globalx2,globalzd); - globaly1 = mulscale16(globaly1,globalzd); - globaly2 = mulscale16(globaly2,globalzd); - globvis = klabs(mulscale10(globvis,globalzd)); - - if (!(globalorientation&0x180)) - { - y1 = max(dplc[x1],umost[x1]); y2 = y1; - for (x=x1; x<=x2; x++) - { - twall = max(dplc[x],umost[x])-1; bwall = dmost[x]; - if (twall < bwall-1) - { - if (twall >= y2) - { - while (y1 < y2-1) hline(x-1,++y1); - y1 = twall; - } - else - { - while (y1 < twall) hline(x-1,++y1); - while (y1 > twall) lastx[y1--] = x; - } - while (y2 > bwall) hline(x-1,--y2); - while (y2 < bwall) lastx[y2++] = x; - } - else - { - while (y1 < y2-1) hline(x-1,++y1); - if (x == x2) { globalx2 += globaly2; globaly1 += globalx1; break; } - y1 = max(dplc[x+1],umost[x+1]); y2 = y1; - } - globalx2 += globaly2; globaly1 += globalx1; - } - while (y1 < y2-1) hline(x2,++y1); - faketimerhandler(); - return; - } - - switch (globalorientation&0x180) - { - case 128: - msethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); - break; - case 256: - settransnormal(); - tsethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); - break; - case 384: - settransreverse(); - tsethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); - break; - } - - y1 = max(dplc[x1],umost[x1]); y2 = y1; - for (x=x1; x<=x2; x++) - { - twall = max(dplc[x],umost[x])-1; bwall = dmost[x]; - if (twall < bwall-1) - { - if (twall >= y2) - { - while (y1 < y2-1) slowhline(x-1,++y1); - y1 = twall; - } - else - { - while (y1 < twall) slowhline(x-1,++y1); - while (y1 > twall) lastx[y1--] = x; - } - while (y2 > bwall) slowhline(x-1,--y2); - while (y2 < bwall) lastx[y2++] = x; - } - else - { - while (y1 < y2-1) slowhline(x-1,++y1); - if (x == x2) { globalx2 += globaly2; globaly1 += globalx1; break; } - y1 = max(dplc[x+1],umost[x+1]); y2 = y1; - } - globalx2 += globaly2; globaly1 += globalx1; - } - while (y1 < y2-1) slowhline(x2,++y1); - faketimerhandler(); -} - - -// -// wallscan (internal) -// -static void wallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32_t *swal, int32_t *lwal) -{ - int32_t x, xnice, ynice; - intptr_t fpalookup; - int32_t y1ve[4], y2ve[4], tsizx, tsizy; -#ifndef ENGINE_USING_A_C - char bad; - int32_t i, u4, d4, z; -#endif - - if (x2 >= xdim) x2 = xdim-1; - - tsizx = tilesizx[globalpicnum]; - tsizy = tilesizy[globalpicnum]; - setgotpic(globalpicnum); - if ((tsizx <= 0) || (tsizy <= 0)) return; - if ((uwal[x1] > ydimen) && (uwal[x2] > ydimen)) return; - if ((dwal[x1] < 0) && (dwal[x2] < 0)) return; - - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - - xnice = (pow2long[picsiz[globalpicnum]&15] == tsizx); - if (xnice) tsizx--; - ynice = (pow2long[picsiz[globalpicnum]>>4] == tsizy); - if (ynice) tsizy = (picsiz[globalpicnum]>>4); - - fpalookup = FP_OFF(palookup[globalpal]); - - setupvlineasm(globalshiftval); - -#ifndef ENGINE_USING_A_C - - x = x1; - while ((umost[x] > dmost[x]) && (x <= x2)) x++; - - for (; (x<=x2)&&((x+frameoffset)&3); x++) - { - y1ve[0] = max(uwal[x],umost[x]); - y2ve[0] = min(dwal[x],dmost[x]); - if (y2ve[0] <= y1ve[0]) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - - bufplce[0] = lwal[x] + globalxpanning; - if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; } - if (ynice == 0) bufplce[0] *= tsizy; else bufplce[0] <<= tsizy; - - vince[0] = swal[x]*globalyscale; - vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1); - - vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]); - } - for (; x<=x2-3; x+=4) - { - bad = 0; - for (z=3; z>=0; z--) - { - y1ve[z] = max(uwal[x+z],umost[x+z]); - y2ve[z] = min(dwal[x+z],dmost[x+z])-1; - if (y2ve[z] < y1ve[z]) { bad += pow2char[z]; continue; } - - i = lwal[x+z] + globalxpanning; - if (i >= tsizx) { if (xnice == 0) i %= tsizx; else i &= tsizx; } - if (ynice == 0) i *= tsizy; else i <<= tsizy; - bufplce[z] = waloff[globalpicnum]+i; - - vince[z] = swal[x+z]*globalyscale; - vplce[z] = globalzd + vince[z]*(y1ve[z]-globalhoriz+1); - } - if (bad == 15) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - palookupoffse[3] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+3],globvis),globalshade)<<8); - - if ((palookupoffse[0] == palookupoffse[3]) && ((bad&0x9) == 0)) - { - palookupoffse[1] = palookupoffse[0]; - palookupoffse[2] = palookupoffse[0]; - } - else - { - palookupoffse[1] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+1],globvis),globalshade)<<8); - palookupoffse[2] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x+2],globvis),globalshade)<<8); - } - - u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3])); - d4 = min(min(y2ve[0],y2ve[1]),min(y2ve[2],y2ve[3])); - - if ((bad != 0) || (u4 >= d4)) - { - if (!(bad&1)) prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],bufplce[0],ylookup[y1ve[0]]+x+frameoffset+0); - if (!(bad&2)) prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],bufplce[1],ylookup[y1ve[1]]+x+frameoffset+1); - if (!(bad&4)) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],bufplce[2],ylookup[y1ve[2]]+x+frameoffset+2); - if (!(bad&8)) prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],bufplce[3],ylookup[y1ve[3]]+x+frameoffset+3); - continue; - } - - if (u4 > y1ve[0]) vplce[0] = prevlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+x+frameoffset+0); - if (u4 > y1ve[1]) vplce[1] = prevlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+x+frameoffset+1); - if (u4 > y1ve[2]) vplce[2] = prevlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],bufplce[2],ylookup[y1ve[2]]+x+frameoffset+2); - if (u4 > y1ve[3]) vplce[3] = prevlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],bufplce[3],ylookup[y1ve[3]]+x+frameoffset+3); - - if (d4 >= u4) vlineasm4(d4-u4+1,ylookup[u4]+x+frameoffset); - - i = x+frameoffset+ylookup[d4+1]; - if (y2ve[0] > d4) prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); - if (y2ve[1] > d4) prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); - if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); - if (y2ve[3] > d4) prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3); - } - for (; x<=x2; x++) - { - y1ve[0] = max(uwal[x],umost[x]); - y2ve[0] = min(dwal[x],dmost[x]); - if (y2ve[0] <= y1ve[0]) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - - bufplce[0] = lwal[x] + globalxpanning; - if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; } - if (ynice == 0) bufplce[0] *= tsizy; else bufplce[0] <<= tsizy; - - vince[0] = swal[x]*globalyscale; - vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1); - - vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]); - } - -#else // ENGINE_USING_A_C - - for (x=x1; x<=x2; x++) - { - y1ve[0] = max(uwal[x],umost[x]); - y2ve[0] = min(dwal[x],dmost[x]); - if (y2ve[0] <= y1ve[0]) continue; - - palookupoffse[0] = fpalookup+(getpalookup((int32_t)mulscale16(swal[x],globvis),globalshade)<<8); - - bufplce[0] = lwal[x] + globalxpanning; - if (bufplce[0] >= tsizx) { if (xnice == 0) bufplce[0] %= tsizx; else bufplce[0] &= tsizx; } - if (ynice == 0) bufplce[0] *= tsizy; else bufplce[0] <<= tsizy; - - vince[0] = swal[x]*globalyscale; - vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1); - - vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]); - } - -#endif - - faketimerhandler(); -} - - -// -// transmaskvline (internal) -// -static void transmaskvline(int32_t x) -{ - int32_t vplc, vinc, i; - intptr_t palookupoffs; - intptr_t bufplc,p; - int16_t y1v, y2v; - - if ((x < 0) || (x >= xdimen)) return; - - y1v = max(uwall[x],startumost[x+windowx1]-windowy1); - y2v = min(dwall[x],startdmost[x+windowx1]-windowy1); - y2v--; - if (y2v < y1v) return; - - palookupoffs = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8); - - vinc = swall[x]*globalyscale; - vplc = globalzd + vinc*(y1v-globalhoriz+1); - - i = lwall[x]+globalxpanning; - if (i >= tilesizx[globalpicnum]) i %= tilesizx[globalpicnum]; - bufplc = waloff[globalpicnum]+i*tilesizy[globalpicnum]; - - p = ylookup[y1v]+x+frameoffset; - - tvlineasm1(vinc,palookupoffs,y2v-y1v,vplc,bufplc,p); -} - - -// -// transmaskvline2 (internal) -// -#ifndef ENGINE_USING_A_C -static void transmaskvline2(int32_t x) -{ - int32_t i, y1, y2, x2; - int16_t y1ve[2], y2ve[2]; - - if ((x < 0) || (x >= xdimen)) return; - if (x == xdimen-1) { transmaskvline(x); return; } - - x2 = x+1; - - y1ve[0] = max(uwall[x],startumost[x+windowx1]-windowy1); - y2ve[0] = min(dwall[x],startdmost[x+windowx1]-windowy1)-1; - if (y2ve[0] < y1ve[0]) { transmaskvline(x2); return; } - y1ve[1] = max(uwall[x2],startumost[x2+windowx1]-windowy1); - y2ve[1] = min(dwall[x2],startdmost[x2+windowx1]-windowy1)-1; - if (y2ve[1] < y1ve[1]) { transmaskvline(x); return; } - - palookupoffse[0] = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x],globvis),globalshade)<<8); - palookupoffse[1] = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale16(swall[x2],globvis),globalshade)<<8); - - setuptvlineasm2(globalshiftval,palookupoffse[0],palookupoffse[1]); - - vince[0] = swall[x]*globalyscale; - vince[1] = swall[x2]*globalyscale; - vplce[0] = globalzd + vince[0]*(y1ve[0]-globalhoriz+1); - vplce[1] = globalzd + vince[1]*(y1ve[1]-globalhoriz+1); - - i = lwall[x] + globalxpanning; - if (i >= tilesizx[globalpicnum]) i %= tilesizx[globalpicnum]; - bufplce[0] = waloff[globalpicnum]+i*tilesizy[globalpicnum]; - - i = lwall[x2] + globalxpanning; - if (i >= tilesizx[globalpicnum]) i %= tilesizx[globalpicnum]; - bufplce[1] = waloff[globalpicnum]+i*tilesizy[globalpicnum]; - - y1 = max(y1ve[0],y1ve[1]); - y2 = min(y2ve[0],y2ve[1]); - - i = x+frameoffset; - - if (y1ve[0] != y1ve[1]) - { - if (y1ve[0] < y1) - vplce[0] = tvlineasm1(vince[0],palookupoffse[0],y1-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+i); - else - vplce[1] = tvlineasm1(vince[1],palookupoffse[1],y1-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+i+1); - } - - if (y2 > y1) - { - asm1 = vince[1]; - asm2 = ylookup[y2]+i+1; - tvlineasm2(vplce[1],vince[0],bufplce[0],bufplce[1],vplce[0],ylookup[y1]+i); - } - else - { - asm1 = vplce[0]; - asm2 = vplce[1]; - } - - if (y2ve[0] > y2ve[1]) - tvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y2-1,asm1,bufplce[0],ylookup[y2+1]+i); - else if (y2ve[0] < y2ve[1]) - tvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y2-1,asm2,bufplce[1],ylookup[y2+1]+i+1); - - faketimerhandler(); -} -#endif - -// -// transmaskwallscan (internal) -// -static inline void transmaskwallscan(int32_t x1, int32_t x2) -{ - int32_t x; - - setgotpic(globalpicnum); - if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return; - - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - - setuptvlineasm(globalshiftval); - - x = x1; - while ((startumost[x+windowx1] > startdmost[x+windowx1]) && (x <= x2)) x++; -#ifndef ENGINE_USING_A_C - if ((x <= x2) && (x&1)) transmaskvline(x), x++; - while (x < x2) transmaskvline2(x), x += 2; -#endif - while (x <= x2) transmaskvline(x), x++; - faketimerhandler(); -} - - -// -// ceilspritehline (internal) -// -static inline void ceilspritehline(int32_t x2, int32_t y) -{ - int32_t x1, v, bx, by; - - //x = x1 + (x2-x1)t + (y1-y2)u ~ x = 160v - //y = y1 + (y2-y1)t + (x2-x1)u ~ y = (scrx-160)v - //z = z1 = z2 ~ z = posz + (scry-horiz)v - - x1 = lastx[y]; if (x2 < x1) return; - - v = mulscale20(globalzd,horizlookup[y-globalhoriz+horizycent]); - bx = mulscale14(globalx2*x1+globalx1,v) + globalxpanning; - by = mulscale14(globaly2*x1+globaly1,v) + globalypanning; - asm1 = mulscale14(globalx2,v); - asm2 = mulscale14(globaly2,v); - - asm3 = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale28(klabs(v),globvis),globalshade)<<8); - - if ((globalorientation&2) == 0) - mhline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset); - else - { - thline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset); - } -} - - -// -// ceilspritescan (internal) -// -static inline void ceilspritescan(int32_t x1, int32_t x2) -{ - int32_t x, y1, y2, twall, bwall; - - y1 = uwall[x1]; y2 = y1; - for (x=x1; x<=x2; x++) - { - twall = uwall[x]-1; bwall = dwall[x]; - if (twall < bwall-1) - { - if (twall >= y2) - { - while (y1 < y2-1) ceilspritehline(x-1,++y1); - y1 = twall; - } - else - { - while (y1 < twall) ceilspritehline(x-1,++y1); - while (y1 > twall) lastx[y1--] = x; - } - while (y2 > bwall) ceilspritehline(x-1,--y2); - while (y2 < bwall) lastx[y2++] = x; - } - else - { - while (y1 < y2-1) ceilspritehline(x-1,++y1); - if (x == x2) break; - y1 = uwall[x+1]; y2 = y1; - } - } - while (y1 < y2-1) ceilspritehline(x2,++y1); - faketimerhandler(); -} - - -// -// grouscan (internal) -// -#define BITSOFPRECISION 3 //Don't forget to change this in A.ASM also! -static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat) -{ - int32_t i, l, x, y, dx, dy, wx, wy, y1, y2, daz; - int32_t daslope, dasqr; - int32_t shoffs, shinc, m1, m2; - intptr_t *mptr1, *mptr2, *nptr1, *nptr2,j; - walltype *wal; - sectortype *sec; - - sec = §or[sectnum]; - - if (dastat == 0) - { - if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) - return; //Back-face culling - globalorientation = sec->ceilingstat; - globalpicnum = sec->ceilingpicnum; - globalshade = sec->ceilingshade; - globalpal = sec->ceilingpal; - daslope = sec->ceilingheinum; - daz = sec->ceilingz; - } - else - { - if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) - return; //Back-face culling - globalorientation = sec->floorstat; - globalpicnum = sec->floorpicnum; - globalshade = sec->floorshade; - globalpal = sec->floorpal; - daslope = sec->floorheinum; - daz = sec->floorz; - } - - if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs(globalpicnum,sectnum); - setgotpic(globalpicnum); - if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) return; - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - - wal = &wall[sec->wallptr]; - wx = wall[wal->point2].x - wal->x; - wy = wall[wal->point2].y - wal->y; - dasqr = krecipasm(nsqrtasm(wx*wx+wy*wy)); - i = mulscale21(daslope,dasqr); - wx *= i; wy *= i; - - globalx = -mulscale19(singlobalang,xdimenrecip); - globaly = mulscale19(cosglobalang,xdimenrecip); - globalx1 = (globalposx<<8); - globaly1 = -(globalposy<<8); - i = (dax1-halfxdimen)*xdimenrecip; - globalx2 = mulscale16(cosglobalang<<4,viewingrangerecip) - mulscale27(singlobalang,i); - globaly2 = mulscale16(singlobalang<<4,viewingrangerecip) + mulscale27(cosglobalang,i); - globalzd = (xdimscale<<9); - globalzx = -dmulscale17(wx,globaly2,-wy,globalx2) + mulscale10(1-globalhoriz,globalzd); - globalz = -dmulscale25(wx,globaly,-wy,globalx); - - if (globalorientation&64) //Relative alignment - { - dx = mulscale14(wall[wal->point2].x-wal->x,dasqr); - dy = mulscale14(wall[wal->point2].y-wal->y,dasqr); - - i = nsqrtasm(daslope*daslope+16777216); - - x = globalx; y = globaly; - globalx = dmulscale16(x,dx,y,dy); - globaly = mulscale12(dmulscale16(-y,dx,x,dy),i); - - x = ((wal->x-globalposx)<<8); y = ((wal->y-globalposy)<<8); - globalx1 = dmulscale16(-x,dx,-y,dy); - globaly1 = mulscale12(dmulscale16(-y,dx,x,dy),i); - - x = globalx2; y = globaly2; - globalx2 = dmulscale16(x,dx,y,dy); - globaly2 = mulscale12(dmulscale16(-y,dx,x,dy),i); - } - if (globalorientation&0x4) - { - i = globalx; globalx = -globaly; globaly = -i; - i = globalx1; globalx1 = globaly1; globaly1 = i; - i = globalx2; globalx2 = -globaly2; globaly2 = -i; - } - if (globalorientation&0x10) { globalx1 = -globalx1, globalx2 = -globalx2, globalx = -globalx; } - if (globalorientation&0x20) { globaly1 = -globaly1, globaly2 = -globaly2, globaly = -globaly; } - - daz = dmulscale9(wx,globalposy-wal->y,-wy,globalposx-wal->x) + ((daz-globalposz)<<8); - globalx2 = mulscale20(globalx2,daz); globalx = mulscale28(globalx,daz); - globaly2 = mulscale20(globaly2,-daz); globaly = mulscale28(globaly,-daz); - - i = 8-(picsiz[globalpicnum]&15); j = 8-(picsiz[globalpicnum]>>4); - if (globalorientation&8) { i++; j++; } - globalx1 <<= (i+12); globalx2 <<= i; globalx <<= i; - globaly1 <<= (j+12); globaly2 <<= j; globaly <<= j; - - if (dastat == 0) - { - globalx1 += (((int32_t)sec->ceilingxpanning)<<24); - globaly1 += (((int32_t)sec->ceilingypanning)<<24); - } - else - { - globalx1 += (((int32_t)sec->floorxpanning)<<24); - globaly1 += (((int32_t)sec->floorypanning)<<24); - } - - asm1 = -(globalzd>>(16-BITSOFPRECISION)); - - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globvis = mulscale13(globvis,daz); - globvis = mulscale16(globvis,xdimscale); - j = FP_OFF(palookup[globalpal]); - - setupslopevlin(((int32_t)(picsiz[globalpicnum]&15))+(((int32_t)(picsiz[globalpicnum]>>4))<<8),waloff[globalpicnum],-ylookup[1]); - - l = (globalzd>>16); - - shinc = mulscale16(globalz,xdimenscale); - if (shinc > 0) shoffs = (4<<15); else shoffs = ((16380-ydimen)<<15); // JBF: was 2044 - if (dastat == 0) y1 = umost[dax1]; else y1 = max(umost[dax1],dplc[dax1]); - m1 = mulscale16(y1,globalzd) + (globalzx>>6); - //Avoid visibility overflow by crossing horizon - if (globalzd > 0) m1 += (globalzd>>16); else m1 -= (globalzd>>16); - m2 = m1+l; - mptr1 = (intptr_t *)&slopalookup[y1+(shoffs>>15)]; mptr2 = mptr1+1; - - for (x=dax1; x<=dax2; x++) - { - if (dastat == 0) { y1 = umost[x]; y2 = min(dmost[x],uplc[x])-1; } - else { y1 = max(umost[x],dplc[x]); y2 = dmost[x]-1; } - if (y1 <= y2) - { - nptr1 = (intptr_t *)&slopalookup[y1+(shoffs>>15)]; - nptr2 = (intptr_t *)&slopalookup[y2+(shoffs>>15)]; - while (nptr1 <= mptr1) - { - *mptr1-- = j + (getpalookup((int32_t)mulscale24(krecipasm(m1),globvis),globalshade)<<8); - m1 -= l; - } - while (nptr2 >= mptr2) - { - *mptr2++ = j + (getpalookup((int32_t)mulscale24(krecipasm(m2),globvis),globalshade)<<8); - m2 += l; - } - - globalx3 = (globalx2>>10); - globaly3 = (globaly2>>10); - asm3 = mulscale16(y2,globalzd) + (globalzx>>6); - slopevlin(ylookup[y2]+x+frameoffset,krecipasm(asm3>>3),(intptr_t)nptr2,y2-y1+1,globalx1,globaly1); - - if ((x&15) == 0) faketimerhandler(); - } - globalx2 += globalx; - globaly2 += globaly; - globalzx += globalz; - shoffs += shinc; - } -} - - -// -// parascan (internal) -// -static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, int32_t bunch) -{ - sectortype *sec; - int32_t j, k, l, m, n, x, z, wallnum, nextsectnum, globalhorizbak; - int16_t *topptr, *botptr; - - UNREFERENCED_PARAMETER(dax1); - UNREFERENCED_PARAMETER(dax2); - - sectnum = thesector[bunchfirst[bunch]]; sec = §or[sectnum]; - - globalhorizbak = globalhoriz; - if (parallaxyscale != 65536) - globalhoriz = mulscale16(globalhoriz-(ydimen>>1),parallaxyscale) + (ydimen>>1); - globvis = globalpisibility; - //globalorientation = 0L; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - - if (dastat == 0) - { - globalpal = sec->ceilingpal; - globalpicnum = sec->ceilingpicnum; - globalshade = (int32_t)sec->ceilingshade; - globalxpanning = (int32_t)sec->ceilingxpanning; - globalypanning = (int32_t)sec->ceilingypanning; - topptr = umost; - botptr = uplc; - } - else - { - globalpal = sec->floorpal; - globalpicnum = sec->floorpicnum; - globalshade = (int32_t)sec->floorshade; - globalxpanning = (int32_t)sec->floorxpanning; - globalypanning = (int32_t)sec->floorypanning; - topptr = dplc; - botptr = dmost; - } - - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)sectnum); - globalshiftval = (picsiz[globalpicnum]>>4); - if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; - globalshiftval = 32-globalshiftval; - globalzd = (((tilesizy[globalpicnum]>>1)+parallaxyoffs)<=0; z=p2[z]) - { - wallnum = thewall[z]; nextsectnum = wall[wallnum].nextsector; - - if (nextsectnum >= 0) //else negative array access - { - if (dastat == 0) j = sector[nextsectnum].ceilingstat; - else j = sector[nextsectnum].floorstat; - } - - if ((nextsectnum < 0) || (wall[wallnum].cstat&32) || ((j&1) == 0)) - { - if (x == -1) x = xb1[z]; - - if (parallaxtype == 0) - { - n = mulscale16(xdimenrecip,viewingrange); - for (j=xb1[z]; j<=xb2[z]; j++) - lplc[j] = (((mulscale23(j-halfxdimen,n)+globalang)&2047)>>k); - } - else - { - for (j=xb1[z]; j<=xb2[z]; j++) - lplc[j] = ((((int32_t)radarang2[j]+globalang)&2047)>>k); - } - if (parallaxtype == 2) - { - n = mulscale16(xdimscale,viewingrange); - for (j=xb1[z]; j<=xb2[z]; j++) - swplc[j] = mulscale14(sintable[((int32_t)radarang2[j]+512)&2047],n); - } - else - clearbuf(&swplc[xb1[z]],xb2[z]-xb1[z]+1,mulscale16(xdimscale,viewingrange)); - } - else if (x >= 0) - { - l = globalpicnum; m = (picsiz[globalpicnum]&15); - globalpicnum = l+pskyoff[lplc[x]>>m]; - - if (((lplc[x]^lplc[xb1[z]-1])>>m) == 0) - wallscan(x,xb1[z]-1,topptr,botptr,swplc,lplc); - else - { - j = x; - while (x < xb1[z]) - { - n = l+pskyoff[lplc[x]>>m]; - if (n != globalpicnum) - { - wallscan(j,x-1,topptr,botptr,swplc,lplc); - j = x; - globalpicnum = n; - } - x++; - } - if (j < x) - wallscan(j,x-1,topptr,botptr,swplc,lplc); - } - - globalpicnum = l; - x = -1; - } - } - - if (x >= 0) - { - l = globalpicnum; m = (picsiz[globalpicnum]&15); - globalpicnum = l+pskyoff[lplc[x]>>m]; - - if (((lplc[x]^lplc[xb2[bunchlast[bunch]]])>>m) == 0) - wallscan(x,xb2[bunchlast[bunch]],topptr,botptr,swplc,lplc); - else - { - j = x; - while (x <= xb2[bunchlast[bunch]]) - { - n = l+pskyoff[lplc[x]>>m]; - if (n != globalpicnum) - { - wallscan(j,x-1,topptr,botptr,swplc,lplc); - j = x; - globalpicnum = n; - } - x++; - } - if (j <= x) - wallscan(j,x-1,topptr,botptr,swplc,lplc); - } - globalpicnum = l; - } - globalhoriz = globalhorizbak; -} - - -// -// drawalls (internal) -// -static void drawalls(int32_t bunch) -{ - sectortype *sec, *nextsec; - walltype *wal; - int32_t i, x, x1, x2, cz[5], fz[5]; - int32_t z, wallnum, sectnum, nextsectnum; - int32_t startsmostwallcnt, startsmostcnt, gotswall; - char andwstat1, andwstat2; - - z = bunchfirst[bunch]; - sectnum = thesector[z]; sec = §or[sectnum]; - - andwstat1 = 0xff; andwstat2 = 0xff; - for (; z>=0; z=p2[z]) //uplc/dplc calculation - { - andwstat1 &= wallmost(uplc,z,sectnum,(uint8_t)0); - andwstat2 &= wallmost(dplc,z,sectnum,(uint8_t)1); - } - - if ((andwstat1&3) != 3) //draw ceilings - { - if ((sec->ceilingstat&3) == 2) - grouscan(xb1[bunchfirst[bunch]],xb2[bunchlast[bunch]],sectnum,0); - else if ((sec->ceilingstat&1) == 0) - ceilscan(xb1[bunchfirst[bunch]],xb2[bunchlast[bunch]],sectnum); - else - parascan(xb1[bunchfirst[bunch]],xb2[bunchlast[bunch]],sectnum,0,bunch); - } - if ((andwstat2&12) != 12) //draw floors - { - if ((sec->floorstat&3) == 2) - grouscan(xb1[bunchfirst[bunch]],xb2[bunchlast[bunch]],sectnum,1); - else if ((sec->floorstat&1) == 0) - florscan(xb1[bunchfirst[bunch]],xb2[bunchlast[bunch]],sectnum); - else - parascan(xb1[bunchfirst[bunch]],xb2[bunchlast[bunch]],sectnum,1,bunch); - } - - //DRAW WALLS SECTION! - for (z=bunchfirst[bunch]; z>=0; z=p2[z]) - { - x1 = xb1[z]; x2 = xb2[z]; - if (umost[x2] >= dmost[x2]) - { - for (x=x1; x= x2) - { - smostwall[smostwallcnt] = z; - smostwalltype[smostwallcnt] = 0; - smostwallcnt++; - continue; - } - } - - wallnum = thewall[z]; wal = &wall[wallnum]; - nextsectnum = wal->nextsector; - nextsec = nextsectnum>=0 ? §or[nextsectnum] : NULL; - - gotswall = 0; - - startsmostwallcnt = smostwallcnt; - startsmostcnt = smostcnt; - - if ((searchit == 2) && (searchx >= x1) && (searchx <= x2)) - { - if (searchy <= uplc[searchx]) //ceiling - { - searchsector = sectnum; searchwall = wallnum; - searchstat = 1; searchit = 1; - } - else if (searchy >= dplc[searchx]) //floor - { - searchsector = sectnum; searchwall = wallnum; - searchstat = 2; searchit = 1; - } - } - - if (nextsectnum >= 0) - { - getzsofslope((int16_t)sectnum,wal->x,wal->y,&cz[0],&fz[0]); - getzsofslope((int16_t)sectnum,wall[wal->point2].x,wall[wal->point2].y,&cz[1],&fz[1]); - getzsofslope((int16_t)nextsectnum,wal->x,wal->y,&cz[2],&fz[2]); - getzsofslope((int16_t)nextsectnum,wall[wal->point2].x,wall[wal->point2].y,&cz[3],&fz[3]); - getzsofslope((int16_t)nextsectnum,globalposx,globalposy,&cz[4],&fz[4]); - - if ((wal->cstat&48) == 16) maskwall[maskwallcnt++] = z; - - if (((sec->ceilingstat&1) == 0) || ((nextsec->ceilingstat&1) == 0)) - { - if ((cz[2] <= cz[0]) && (cz[3] <= cz[1])) - { - if (globparaceilclip) - for (x=x1; x<=x2; x++) - if (uplc[x] > umost[x]) - if (umost[x] <= dmost[x]) - { - umost[x] = uplc[x]; - if (umost[x] > dmost[x]) numhits--; - } - } - else - { - wallmost(dwall,z,nextsectnum,(uint8_t)0); - if ((cz[2] > fz[0]) || (cz[3] > fz[1])) - for (i=x1; i<=x2; i++) if (dwall[i] > dplc[i]) dwall[i] = dplc[i]; - - if ((searchit == 2) && (searchx >= x1) && (searchx <= x2)) - if (searchy <= dwall[searchx]) //wall - { - searchsector = sectnum; searchbottomwall = searchwall = wallnum; - searchstat = 0; searchit = 1; - } - - globalorientation = (int32_t)wal->cstat; - globalpicnum = wal->picnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - globalxpanning = (int32_t)wal->xpanning; - globalypanning = (int32_t)wal->ypanning; - globalshiftval = (picsiz[globalpicnum]>>4); - if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; - globalshiftval = 32-globalshiftval; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384); - globalshade = (int32_t)wal->shade; - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalpal = (int32_t)wal->pal; - if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash - globalyscale = (wal->yrepeat<<(globalshiftval-19)); - if ((globalorientation&4) == 0) - globalzd = (((globalposz-nextsec->ceilingz)*globalyscale)<<8); - else - globalzd = (((globalposz-sec->ceilingz)*globalyscale)<<8); - globalzd += (globalypanning<<24); - if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd; - - if (gotswall == 0) { gotswall = 1; prepwall(z,wal); } - wallscan(x1,x2,uplc,dwall,swall,lwall); - - if ((cz[2] >= cz[0]) && (cz[3] >= cz[1])) - { - for (x=x1; x<=x2; x++) - if (dwall[x] > umost[x]) - if (umost[x] <= dmost[x]) - { - umost[x] = dwall[x]; - if (umost[x] > dmost[x]) numhits--; - } - } - else - { - for (x=x1; x<=x2; x++) - if (umost[x] <= dmost[x]) - { - i = max(uplc[x],dwall[x]); - if (i > umost[x]) - { - umost[x] = i; - if (umost[x] > dmost[x]) numhits--; - } - } - } - } - if ((cz[2] < cz[0]) || (cz[3] < cz[1]) || (globalposz < cz[4])) - { - i = x2-x1+1; - if (smostcnt+i < MAXYSAVES) - { - smoststart[smostwallcnt] = smostcnt; - smostwall[smostwallcnt] = z; - smostwalltype[smostwallcnt] = 1; //1 for umost - smostwallcnt++; - copybufbyte(&umost[x1],&smost[smostcnt],i*sizeof(smost[0])); - smostcnt += i; - } - } - } - if (((sec->floorstat&1) == 0) || ((nextsec->floorstat&1) == 0)) - { - if ((fz[2] >= fz[0]) && (fz[3] >= fz[1])) - { - if (globparaflorclip) - for (x=x1; x<=x2; x++) - if (dplc[x] < dmost[x]) - if (umost[x] <= dmost[x]) - { - dmost[x] = dplc[x]; - if (umost[x] > dmost[x]) numhits--; - } - } - else - { - wallmost(uwall,z,nextsectnum,(uint8_t)1); - if ((fz[2] < cz[0]) || (fz[3] < cz[1])) - for (i=x1; i<=x2; i++) if (uwall[i] < uplc[i]) uwall[i] = uplc[i]; - - if ((searchit == 2) && (searchx >= x1) && (searchx <= x2)) - if (searchy >= uwall[searchx]) //wall - { - searchsector = sectnum; searchbottomwall = searchwall = wallnum; - if ((wal->cstat&2) > 0) searchbottomwall = wal->nextwall; - searchstat = 0; searchit = 1; - } - - if ((wal->cstat&2) > 0) - { - wallnum = wal->nextwall; wal = &wall[wallnum]; - globalorientation = (int32_t)wal->cstat; - globalpicnum = wal->picnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - globalxpanning = (int32_t)wal->xpanning; - globalypanning = (int32_t)wal->ypanning; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384); - globalshade = (int32_t)wal->shade; - globalpal = (int32_t)wal->pal; - wallnum = thewall[z]; wal = &wall[wallnum]; - } - else - { - globalorientation = (int32_t)wal->cstat; - globalpicnum = wal->picnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - globalxpanning = (int32_t)wal->xpanning; - globalypanning = (int32_t)wal->ypanning; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384); - globalshade = (int32_t)wal->shade; - globalpal = (int32_t)wal->pal; - } - if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalshiftval = (picsiz[globalpicnum]>>4); - if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; - globalshiftval = 32-globalshiftval; - globalyscale = (wal->yrepeat<<(globalshiftval-19)); - if ((globalorientation&4) == 0) - globalzd = (((globalposz-nextsec->floorz)*globalyscale)<<8); - else - globalzd = (((globalposz-sec->ceilingz)*globalyscale)<<8); - globalzd += (globalypanning<<24); - if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd; - - if (gotswall == 0) { gotswall = 1; prepwall(z,wal); } - wallscan(x1,x2,uwall,dplc,swall,lwall); - - if ((fz[2] <= fz[0]) && (fz[3] <= fz[1])) - { - for (x=x1; x<=x2; x++) - if (uwall[x] < dmost[x]) - if (umost[x] <= dmost[x]) - { - dmost[x] = uwall[x]; - if (umost[x] > dmost[x]) numhits--; - } - } - else - { - for (x=x1; x<=x2; x++) - if (umost[x] <= dmost[x]) - { - i = min(dplc[x],uwall[x]); - if (i < dmost[x]) - { - dmost[x] = i; - if (umost[x] > dmost[x]) numhits--; - } - } - } - } - if ((fz[2] > fz[0]) || (fz[3] > fz[1]) || (globalposz > fz[4])) - { - i = x2-x1+1; - if (smostcnt+i < MAXYSAVES) - { - smoststart[smostwallcnt] = smostcnt; - smostwall[smostwallcnt] = z; - smostwalltype[smostwallcnt] = 2; //2 for dmost - smostwallcnt++; - copybufbyte(&dmost[x1],&smost[smostcnt],i*sizeof(smost[0])); - smostcnt += i; - } - } - } - if (numhits < 0) return; - if ((!(wal->cstat&32)) && ((gotsector[nextsectnum>>3]&pow2char[nextsectnum&7]) == 0)) - { - if (umost[x2] < dmost[x2]) - scansector(nextsectnum); - else - { - for (x=x1; xcstat&32)) //White/1-way wall - { - globalorientation = (int32_t)wal->cstat; - if (nextsectnum < 0) globalpicnum = wal->picnum; - else globalpicnum = wal->overpicnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - globalxpanning = (int32_t)wal->xpanning; - globalypanning = (int32_t)wal->ypanning; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)wallnum+16384); - globalshade = (int32_t)wal->shade; - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalpal = (int32_t)wal->pal; - if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash - globalshiftval = (picsiz[globalpicnum]>>4); - if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; - globalshiftval = 32-globalshiftval; - globalyscale = (wal->yrepeat<<(globalshiftval-19)); - if (nextsectnum >= 0) - { - if ((globalorientation&4) == 0) globalzd = globalposz-nextsec->ceilingz; - else globalzd = globalposz-sec->ceilingz; - } - else - { - if ((globalorientation&4) == 0) globalzd = globalposz-sec->ceilingz; - else globalzd = globalposz-sec->floorz; - } - globalzd = ((globalzd*globalyscale)<<8) + (globalypanning<<24); - if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd; - - if (gotswall == 0) { gotswall = 1; prepwall(z,wal); } - wallscan(x1,x2,uplc,dplc,swall,lwall); - - for (x=x1; x<=x2; x++) - if (umost[x] <= dmost[x]) - { umost[x] = 1; dmost[x] = 0; numhits--; } - smostwall[smostwallcnt] = z; - smostwalltype[smostwallcnt] = 0; - smostwallcnt++; - - if ((searchit == 2) && (searchx >= x1) && (searchx <= x2)) - { - searchit = 1; searchsector = sectnum; searchbottomwall = searchwall = wallnum; - if (nextsectnum < 0) searchstat = 0; else searchstat = 4; - } - } - } -} - - -// -// drawvox -// -static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasprang, - int32_t daxscale, int32_t dayscale, char daindex, - int8_t dashade, char dapal, int32_t *daumost, int32_t *dadmost) -{ - int32_t i, j, k, x, y, syoff, ggxstart, ggystart, nxoff; - int32_t cosang, sinang, sprcosang, sprsinang, backx, backy, gxinc, gyinc; - int32_t daxsiz, daysiz, dazsiz, daxpivot, daypivot, dazpivot; - int32_t daxscalerecip, dayscalerecip, cnt, gxstart, gystart, odayscale; - int32_t l1, l2, /*slabxoffs,*/ xyvoxoffs, *longptr; - intptr_t slabxoffs; - int32_t lx, rx, nx, ny, x1=0, y1=0, z1, x2=0, y2=0, z2, yplc, yinc=0; - int32_t yoff, xs=0, ys=0, xe, ye, xi=0, yi=0, cbackx, cbacky, dagxinc, dagyinc; - int16_t *shortptr; - char *voxptr, *voxend, *davoxptr, oand, oand16, oand32; - - cosang = sintable[(globalang+512)&2047]; - sinang = sintable[globalang&2047]; - sprcosang = sintable[(dasprang+512)&2047]; - sprsinang = sintable[dasprang&2047]; - - i = klabs(dmulscale6(dasprx-globalposx,cosang,daspry-globalposy,sinang)); - j = (int32_t)(getpalookup((int32_t)mulscale21(globvis,i),(int32_t)dashade)<<8); - setupdrawslab(ylookup[1],FP_OFF(palookup[dapal])+j); - j = 1310720; - j *= min(daxscale,dayscale); j >>= 6; //New hacks (for sized-down voxels) - for (k=0; k= MAXVOXMIPS) i = MAXVOXMIPS-1; - - if (novoxmips) i = 0; - davoxptr = (char *)voxoff[daindex][i]; - if (!davoxptr && i > 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; } - if (!davoxptr) return; - - if (voxscale[daindex] == 65536) - { daxscale <<= (i+8); dayscale <<= (i+8); } - else - { - daxscale = mulscale8(daxscale<>8); - backy = ((dmulscale10(y,sprcosang,x,-sprsinang)+daypivot)>>8); - cbackx = min(max(backx,0),daxsiz-1); - cbacky = min(max(backy,0),daysiz-1); - - sprcosang = mulscale14(daxscale,sprcosang); - sprsinang = mulscale14(daxscale,sprsinang); - - x = (dasprx-globalposx) - dmulscale18(daxpivot,sprcosang,daypivot,-sprsinang); - y = (daspry-globalposy) - dmulscale18(daypivot,sprcosang,daxpivot,sprsinang); - - cosang = mulscale16(cosang,dayscalerecip); - sinang = mulscale16(sinang,dayscalerecip); - - gxstart = y*cosang - x*sinang; - gystart = x*cosang + y*sinang; - gxinc = dmulscale10(sprsinang,cosang,sprcosang,-sinang); - gyinc = dmulscale10(sprcosang,cosang,sprsinang,sinang); - - x = 0; y = 0; j = max(daxsiz,daysiz); - for (i=0; i<=j; i++) - { - ggxinc[i] = x; x += gxinc; - ggyinc[i] = y; y += gyinc; - } - - if ((klabs(globalposz-dasprz)>>10) >= klabs(odayscale)) return; - syoff = divscale21(globalposz-dasprz,odayscale) + (dazpivot<<7); - yoff = ((klabs(gxinc)+klabs(gyinc))>>1); - longptr = (int32_t *)davoxptr; - xyvoxoffs = ((daxsiz+1)<<2); - - begindrawing(); //{{{ - - for (cnt=0; cnt<8; cnt++) - { - switch (cnt) - { - case 0: - xs = 0; ys = 0; xi = 1; yi = 1; break; - case 1: - xs = daxsiz-1; ys = 0; xi = -1; yi = 1; break; - case 2: - xs = 0; ys = daysiz-1; xi = 1; yi = -1; break; - case 3: - xs = daxsiz-1; ys = daysiz-1; xi = -1; yi = -1; break; - case 4: - xs = 0; ys = cbacky; xi = 1; yi = 2; break; - case 5: - xs = daxsiz-1; ys = cbacky; xi = -1; yi = 2; break; - case 6: - xs = cbackx; ys = 0; xi = 2; yi = 1; break; - case 7: - xs = cbackx; ys = daysiz-1; xi = 2; yi = -1; break; - } - xe = cbackx; ye = cbacky; - if (cnt < 4) - { - if ((xi < 0) && (xe >= xs)) continue; - if ((xi > 0) && (xe <= xs)) continue; - if ((yi < 0) && (ye >= ys)) continue; - if ((yi > 0) && (ye <= ys)) continue; - } - else - { - if ((xi < 0) && (xe > xs)) continue; - if ((xi > 0) && (xe < xs)) continue; - if ((yi < 0) && (ye > ys)) continue; - if ((yi > 0) && (ye < ys)) continue; - xe += xi; ye += yi; - } - - i = ksgn(ys-backy)+ksgn(xs-backx)*3+4; - switch (i) - { - case 6: - case 7: - x1 = 0; y1 = 0; break; - case 8: - case 5: - x1 = gxinc; y1 = gyinc; break; - case 0: - case 3: - x1 = gyinc; y1 = -gxinc; break; - case 2: - case 1: - x1 = gxinc+gyinc; y1 = gyinc-gxinc; break; - } - switch (i) - { - case 2: - case 5: - x2 = 0; y2 = 0; break; - case 0: - case 1: - x2 = gxinc; y2 = gyinc; break; - case 8: - case 7: - x2 = gyinc; y2 = -gxinc; break; - case 6: - case 3: - x2 = gxinc+gyinc; y2 = gyinc-gxinc; break; - } - oand = pow2char[(xs 0) { dagxinc = gxinc; dagyinc = mulscale16(gyinc,viewingrangerecip); } - else { dagxinc = -gxinc; dagyinc = -mulscale16(gyinc,viewingrangerecip); } - - //Fix for non 90 degree viewing ranges - nxoff = mulscale16(x2-x1,viewingrangerecip); - x1 = mulscale16(x1,viewingrangerecip); - - ggxstart = gxstart+ggyinc[ys]; - ggystart = gystart-ggxinc[ys]; - - for (x=xs; x!=xe; x+=xi) - { - slabxoffs = (intptr_t)&davoxptr[B_LITTLE32(longptr[x])]; - shortptr = (int16_t *)&davoxptr[((x*(daysiz+1))<<1)+xyvoxoffs]; - - nx = mulscale16(ggxstart+ggxinc[x],viewingrangerecip)+x1; - ny = ggystart+ggyinc[x]; - for (y=ys; y!=ye; y+=yi,nx+=dagyinc,ny-=dagxinc) - { - if ((ny <= nytooclose) || (ny >= nytoofar)) continue; - voxptr = (char *)(B_LITTLE16(shortptr[y])+slabxoffs); - voxend = (char *)(B_LITTLE16(shortptr[y+1])+slabxoffs); - if (voxptr == voxend) continue; - - lx = mulscale32(nx>>3,distrecip[(ny+y1)>>14])+halfxdimen; - if (lx < 0) lx = 0; - rx = mulscale32((nx+nxoff)>>3,distrecip[(ny+y2)>>14])+halfxdimen; - if (rx > xdimen) rx = xdimen; - if (rx <= lx) continue; - rx -= lx; - - l1 = distrecip[(ny-yoff)>>14]; - l2 = distrecip[(ny+yoff)>>14]; - for (; voxptr= 1024) yinc = divscale16(voxptr[1],z2-z1); - else if (z2 > z1) yinc = (lowrecip[z2-z1]*voxptr[1]>>8); - if (z1 < daumost[lx]) { yplc = yinc*(daumost[lx]-z1); z1 = daumost[lx]; } - else yplc = 0; - } - if (z2 > dadmost[lx]) z2 = dadmost[lx]; - z2 -= z1; if (z2 <= 0) continue; - - drawslab(rx,yplc,z2,yinc,(intptr_t)&voxptr[3],ylookup[z1]+lx+frameoffset); - } - } - } - } - - enddrawing(); //}}} -} - -// -// drawsprite (internal) -// -static void drawsprite(int32_t snum) -{ - spritetype *tspr; - sectortype *sec; - int32_t startum, startdm, sectnum, xb, yp, cstat; - int32_t siz, xsiz, ysiz, xoff, yoff, xspan, yspan; - int32_t x1, y1, x2, y2, lx, rx, dalx2, darx2, i, j, k, x, linum, linuminc; - int32_t yinc, z, z1, z2, xp1, yp1, xp2, yp2; - int32_t xv, yv, top, topinc, bot, botinc, hplc, hinc; - int32_t cosang, sinang, dax, day, lpoint, lmax, rpoint, rmax, dax1, dax2, y; - int32_t npoints, npoints2, zz, t, zsgn, zzsgn, *longptr; - int32_t tilenum, vtilenum = 0, spritenum; - char swapped, daclip; - - //============================================================================= //POLYMOST BEGINS -#ifdef USE_OPENGL - if (rendmode == 3) - { - polymost_drawsprite(snum); -# ifdef USE_OPENGL - bglDisable(GL_POLYGON_OFFSET_FILL); -# endif - return; - } -# ifdef POLYMER - if (rendmode == 4) - { - bglEnable(GL_ALPHA_TEST); - bglEnable(GL_BLEND); - - polymer_drawsprite(snum); - - bglDisable(GL_BLEND); - bglDisable(GL_ALPHA_TEST); - return; - } -# endif -#endif - //============================================================================= //POLYMOST ENDS - - tspr = tspriteptr[snum]; - - xb = spritesx[snum]; - yp = spritesy[snum]; - tilenum = tspr->picnum; - spritenum = tspr->owner; - cstat = tspr->cstat; - - if (tilenum < 0 || tilenum >= MAXSPRITES) return; - - if ((cstat&48)==48) vtilenum = tilenum; // if the game wants voxels, it gets voxels - else if ((cstat&48)!=48 && (usevoxels) && (tiletovox[tilenum] != -1) -#ifdef USE_OPENGL - && (!(spriteext[tspr->owner].flags&SPREXT_NOTMD)) -#endif - ) - { - vtilenum = tiletovox[tilenum]; - cstat |= 48; - } - - if ((cstat&48) != 48) - { - if (picanm[tilenum]&192) tilenum += animateoffs(tilenum,spritenum+32768); - if ((tilesizx[tilenum] <= 0) || (tilesizy[tilenum] <= 0) || (spritenum < 0)) - return; - } - if ((tspr->xrepeat <= 0) || (tspr->yrepeat <= 0)) return; - - sectnum = tspr->sectnum; sec = §or[sectnum]; - globalpal = tspr->pal; - if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes null-pointer crash - globalshade = tspr->shade; - if (cstat&2) - { - if (cstat&512) settransreverse(); else settransnormal(); - } - - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)tspr->xoffset); - yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)tspr->yoffset); - - if ((cstat&48) == 0) - { - if (yp <= (4<<8)) return; - - siz = divscale19(xdimenscale,yp); - - xv = mulscale16(((int32_t)tspr->xrepeat)<<16,xyaspect); - - xspan = tilesizx[tilenum]; - yspan = tilesizy[tilenum]; - xsiz = mulscale30(siz,xv*xspan); - ysiz = mulscale14(siz,tspr->yrepeat*yspan); - - if (((tilesizx[tilenum]>>11) >= xsiz) || (yspan >= (ysiz>>1))) - return; //Watch out for divscale overflow - - x1 = xb-(xsiz>>1); - if (xspan&1) x1 += mulscale31(siz,xv); //Odd xspans - i = mulscale30(siz,xv*xoff); - if ((cstat&4) == 0) x1 -= i; else x1 += i; - - y1 = mulscale16(tspr->z-globalposz,siz); - y1 -= mulscale14(siz,tspr->yrepeat*yoff); - y1 += (globalhoriz<<8)-ysiz; - if (cstat&128) - { - y1 += (ysiz>>1); - if (yspan&1) y1 += mulscale15(siz,tspr->yrepeat); //Odd yspans - } - - x2 = x1+xsiz-1; - y2 = y1+ysiz-1; - if ((y1|255) >= (y2|255)) return; - - lx = (x1>>8)+1; if (lx < 0) lx = 0; - rx = (x2>>8); if (rx >= xdimen) rx = xdimen-1; - if (lx > rx) return; - - yinc = divscale32(yspan,ysiz); - - if ((sec->ceilingstat&3) == 0) - startum = globalhoriz+mulscale24(siz,sec->ceilingz-globalposz)-1; - else - startum = 0; - if ((sec->floorstat&3) == 0) - startdm = globalhoriz+mulscale24(siz,sec->floorz-globalposz)+1; - else - startdm = 0x7fffffff; - if ((y1>>8) > startum) startum = (y1>>8); - if ((y2>>8) < startdm) startdm = (y2>>8); - - if (startum < -32768) startum = -32768; - if (startdm > 32767) startdm = 32767; - if (startum >= startdm) return; - - if ((cstat&4) == 0) - { - linuminc = divscale24(xspan,xsiz); - linum = mulscale8((lx<<8)-x1,linuminc); - } - else - { - linuminc = -divscale24(xspan,xsiz); - linum = mulscale8((lx<<8)-x2,linuminc); - } - if ((cstat&8) > 0) - { - yinc = -yinc; - i = y1; y1 = y2; y2 = i; - } - - for (x=lx; x<=rx; x++) - { - uwall[x] = max(startumost[x+windowx1]-windowy1,(int16_t)startum); - dwall[x] = min(startdmost[x+windowx1]-windowy1,(int16_t)startdm); - } - daclip = 0; - for (i=smostwallcnt-1; i>=0; i--) - { - if (smostwalltype[i]&daclip) continue; - j = smostwall[i]; - if ((xb1[j] > rx) || (xb2[j] < lx)) continue; - if ((yp <= yb1[j]) && (yp <= yb2[j])) continue; - if (spritewallfront(tspr,(int32_t)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j]))) continue; - - dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx); - - switch (smostwalltype[i]) - { - case 0: - if (dalx2 <= darx2) - { - if ((dalx2 == lx) && (darx2 == rx)) return; - //clearbufbyte(&dwall[dalx2],(darx2-dalx2+1)*sizeof(dwall[0]),0L); - for (k=dalx2; k<=darx2; k++) dwall[k] = 0; - } - break; - case 1: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; - if ((dalx2 == lx) && (darx2 == rx)) daclip |= 1; - break; - case 2: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; - if ((dalx2 == lx) && (darx2 == rx)) daclip |= 2; - break; - } - } - - if (uwall[rx] >= dwall[rx]) - { - for (x=lx; x= 1) && (searchx >= lx) && (searchx <= rx)) - if ((searchy >= uwall[searchx]) && (searchy < dwall[searchx])) - { - searchsector = sectnum; searchwall = spritenum; - searchstat = 3; searchit = 1; - } - - z2 = tspr->z - ((yoff*tspr->yrepeat)<<2); - if (cstat&128) - { - z2 += ((yspan*tspr->yrepeat)<<1); - if (yspan&1) z2 += (tspr->yrepeat<<1); //Odd yspans - } - z1 = z2 - ((yspan*tspr->yrepeat)<<2); - - globalorientation = 0; - globalpicnum = tilenum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - globalxpanning = 0L; - globalypanning = 0L; - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalshiftval = (picsiz[globalpicnum]>>4); - if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; - globalshiftval = 32-globalshiftval; - globalyscale = divscale(512,tspr->yrepeat,globalshiftval-19); - globalzd = (((globalposz-z1)*globalyscale)<<8); - if ((cstat&8) > 0) - { - globalyscale = -globalyscale; - globalzd = (((globalposz-z2)*globalyscale)<<8); - } - - qinterpolatedown16((intptr_t)&lwall[lx],rx-lx+1,linum,linuminc); - clearbuf(&swall[lx],rx-lx+1,mulscale19(yp,xdimscale)); - - if ((cstat&2) == 0) - maskwallscan(lx,rx,uwall,dwall,swall,lwall); - else - transmaskwallscan(lx,rx); - } - else if ((cstat&48) == 16) - { - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; - - xspan = tilesizx[tilenum]; yspan = tilesizy[tilenum]; - xv = tspr->xrepeat*sintable[(tspr->ang+2560+1536)&2047]; - yv = tspr->xrepeat*sintable[(tspr->ang+2048+1536)&2047]; - i = (xspan>>1)+xoff; - x1 = tspr->x-globalposx-mulscale16(xv,i); x2 = x1+mulscale16(xv,xspan); - y1 = tspr->y-globalposy-mulscale16(yv,i); y2 = y1+mulscale16(yv,xspan); - - yp1 = dmulscale6(x1,cosviewingrangeglobalang,y1,sinviewingrangeglobalang); - yp2 = dmulscale6(x2,cosviewingrangeglobalang,y2,sinviewingrangeglobalang); - if ((yp1 <= 0) && (yp2 <= 0)) return; - xp1 = dmulscale6(y1,cosglobalang,-x1,singlobalang); - xp2 = dmulscale6(y2,cosglobalang,-x2,singlobalang); - - x1 += globalposx; y1 += globalposy; - x2 += globalposx; y2 += globalposy; - - swapped = 0; - if (dmulscale32(xp1,yp2,-xp2,yp1) >= 0) //If wall's NOT facing you - { - if ((cstat&64) != 0) return; - i = xp1, xp1 = xp2, xp2 = i; - i = yp1, yp1 = yp2, yp2 = i; - i = x1, x1 = x2, x2 = i; - i = y1, y1 = y2, y2 = i; - swapped = 1; - } - - if (xp1 >= -yp1) - { - if (xp1 > yp1) return; - - if (yp1 == 0) return; - xb1[MAXWALLSB-1] = halfxdimen + scale(xp1,halfxdimen,yp1); - if (xp1 >= 0) xb1[MAXWALLSB-1]++; //Fix for SIGNED divide - if (xb1[MAXWALLSB-1] >= xdimen) xb1[MAXWALLSB-1] = xdimen-1; - yb1[MAXWALLSB-1] = yp1; - } - else - { - if (xp2 < -yp2) return; - xb1[MAXWALLSB-1] = 0; - i = yp1-yp2+xp1-xp2; - if (i == 0) return; - yb1[MAXWALLSB-1] = yp1 + scale(yp2-yp1,xp1+yp1,i); - } - if (xp2 <= yp2) - { - if (xp2 < -yp2) return; - - if (yp2 == 0) return; - xb2[MAXWALLSB-1] = halfxdimen + scale(xp2,halfxdimen,yp2) - 1; - if (xp2 >= 0) xb2[MAXWALLSB-1]++; //Fix for SIGNED divide - if (xb2[MAXWALLSB-1] >= xdimen) xb2[MAXWALLSB-1] = xdimen-1; - yb2[MAXWALLSB-1] = yp2; - } - else - { - if (xp1 > yp1) return; - - xb2[MAXWALLSB-1] = xdimen-1; - i = xp2-xp1+yp1-yp2; - if (i == 0) return; - yb2[MAXWALLSB-1] = yp1 + scale(yp2-yp1,yp1-xp1,i); - } - - if ((yb1[MAXWALLSB-1] < 256) || (yb2[MAXWALLSB-1] < 256) || (xb1[MAXWALLSB-1] > xb2[MAXWALLSB-1])) - return; - - topinc = -mulscale10(yp1,xspan); - top = (((mulscale10(xp1,xdimen) - mulscale9(xb1[MAXWALLSB-1]-halfxdimen,yp1))*xspan)>>3); - botinc = ((yp2-yp1)>>8); - bot = mulscale11(xp1-xp2,xdimen) + mulscale2(xb1[MAXWALLSB-1]-halfxdimen,botinc); - - j = xb2[MAXWALLSB-1]+3; - z = mulscale20(top,krecipasm(bot)); - lwall[xb1[MAXWALLSB-1]] = (z>>8); - for (x=xb1[MAXWALLSB-1]+4; x<=j; x+=4) - { - top += topinc; bot += botinc; - zz = z; z = mulscale20(top,krecipasm(bot)); - lwall[x] = (z>>8); - i = ((z+zz)>>1); - lwall[x-2] = (i>>8); - lwall[x-3] = ((i+zz)>>9); - lwall[x-1] = ((i+z)>>9); - } - - if (lwall[xb1[MAXWALLSB-1]] < 0) lwall[xb1[MAXWALLSB-1]] = 0; - if (lwall[xb2[MAXWALLSB-1]] >= xspan) lwall[xb2[MAXWALLSB-1]] = xspan-1; - - if ((swapped^((cstat&4)>0)) > 0) - { - j = xspan-1; - for (x=xb1[MAXWALLSB-1]; x<=xb2[MAXWALLSB-1]; x++) - lwall[x] = j-lwall[x]; - } - - rx1[MAXWALLSB-1] = xp1; ry1[MAXWALLSB-1] = yp1; - rx2[MAXWALLSB-1] = xp2; ry2[MAXWALLSB-1] = yp2; - - hplc = divscale19(xdimenscale,yb1[MAXWALLSB-1]); - hinc = divscale19(xdimenscale,yb2[MAXWALLSB-1]); - hinc = (hinc-hplc)/(xb2[MAXWALLSB-1]-xb1[MAXWALLSB-1]+1); - - z2 = tspr->z - ((yoff*tspr->yrepeat)<<2); - if (cstat&128) - { - z2 += ((yspan*tspr->yrepeat)<<1); - if (yspan&1) z2 += (tspr->yrepeat<<1); //Odd yspans - } - z1 = z2 - ((yspan*tspr->yrepeat)<<2); - - globalorientation = 0; - globalpicnum = tilenum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - globalxpanning = 0L; - globalypanning = 0L; - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalshiftval = (picsiz[globalpicnum]>>4); - if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; - globalshiftval = 32-globalshiftval; - globalyscale = divscale(512,tspr->yrepeat,globalshiftval-19); - globalzd = (((globalposz-z1)*globalyscale)<<8); - if ((cstat&8) > 0) - { - globalyscale = -globalyscale; - globalzd = (((globalposz-z2)*globalyscale)<<8); - } - - if (((sec->ceilingstat&1) == 0) && (z1 < sec->ceilingz)) - z1 = sec->ceilingz; - if (((sec->floorstat&1) == 0) && (z2 > sec->floorz)) - z2 = sec->floorz; - - owallmost(uwall,(int32_t)(MAXWALLSB-1),z1-globalposz); - owallmost(dwall,(int32_t)(MAXWALLSB-1),z2-globalposz); - for (i=xb1[MAXWALLSB-1]; i<=xb2[MAXWALLSB-1]; i++) - { swall[i] = (krecipasm(hplc)<<2); hplc += hinc; } - - for (i=smostwallcnt-1; i>=0; i--) - { - j = smostwall[i]; - - if ((xb1[j] > xb2[MAXWALLSB-1]) || (xb2[j] < xb1[MAXWALLSB-1])) continue; - - dalx2 = xb1[j]; darx2 = xb2[j]; - if (max(yb1[MAXWALLSB-1],yb2[MAXWALLSB-1]) > min(yb1[j],yb2[j])) - { - if (min(yb1[MAXWALLSB-1],yb2[MAXWALLSB-1]) > max(yb1[j],yb2[j])) - { - x = 0x80000000; - } - else - { - x = thewall[j]; xp1 = wall[x].x; yp1 = wall[x].y; - x = wall[x].point2; xp2 = wall[x].x; yp2 = wall[x].y; - - z1 = (xp2-xp1)*(y1-yp1) - (yp2-yp1)*(x1-xp1); - z2 = (xp2-xp1)*(y2-yp1) - (yp2-yp1)*(x2-xp1); - if ((z1^z2) >= 0) - x = (z1+z2); - else - { - z1 = (x2-x1)*(yp1-y1) - (y2-y1)*(xp1-x1); - z2 = (x2-x1)*(yp2-y1) - (y2-y1)*(xp2-x1); - - if ((z1^z2) >= 0) - x = -(z1+z2); - else - { - if ((xp2-xp1)*(tspr->y-yp1) == (tspr->x-xp1)*(yp2-yp1)) - { - if (wall[thewall[j]].nextsector == tspr->sectnum) - x = 0x80000000; - else - x = 0x7fffffff; - } - else - { - //INTERSECTION! - x = (xp1-globalposx) + scale(xp2-xp1,z1,z1-z2); - y = (yp1-globalposy) + scale(yp2-yp1,z1,z1-z2); - - yp1 = dmulscale14(x,cosglobalang,y,singlobalang); - if (yp1 > 0) - { - xp1 = dmulscale14(y,cosglobalang,-x,singlobalang); - - x = halfxdimen + scale(xp1,halfxdimen,yp1); - if (xp1 >= 0) x++; //Fix for SIGNED divide - - if (z1 < 0) - { if (dalx2 < x) dalx2 = x; } - else - { if (darx2 > x) darx2 = x; } - x = 0x80000001; - } - else - x = 0x7fffffff; - } - } - } - } - if (x < 0) - { - if (dalx2 < xb1[MAXWALLSB-1]) dalx2 = xb1[MAXWALLSB-1]; - if (darx2 > xb2[MAXWALLSB-1]) darx2 = xb2[MAXWALLSB-1]; - switch (smostwalltype[i]) - { - case 0: - if (dalx2 <= darx2) - { - if ((dalx2 == xb1[MAXWALLSB-1]) && (darx2 == xb2[MAXWALLSB-1])) return; - //clearbufbyte(&dwall[dalx2],(darx2-dalx2+1)*sizeof(dwall[0]),0L); - for (k=dalx2; k<=darx2; k++) dwall[k] = 0; - } - break; - case 1: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; - break; - case 2: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; - break; - } - } - } - } - - //sprite - if ((searchit >= 1) && (searchx >= xb1[MAXWALLSB-1]) && (searchx <= xb2[MAXWALLSB-1])) - if ((searchy >= uwall[searchx]) && (searchy <= dwall[searchx])) - { - searchsector = sectnum; searchwall = spritenum; - searchstat = 3; searchit = 1; - } - - if ((cstat&2) == 0) - { - maskwallscan(xb1[MAXWALLSB-1],xb2[MAXWALLSB-1],uwall,dwall,swall,lwall); - } - else - { - transmaskwallscan(xb1[MAXWALLSB-1],xb2[MAXWALLSB-1]); - } - } - else if ((cstat&48) == 32) - { - if ((cstat&64) != 0) - if ((globalposz > tspr->z) == ((cstat&8)==0)) - return; - - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; - xspan = tilesizx[tilenum]; - yspan = tilesizy[tilenum]; - - //Rotate center point - dax = tspr->x-globalposx; - day = tspr->y-globalposy; - rzi[0] = dmulscale10(cosglobalang,dax,singlobalang,day); - rxi[0] = dmulscale10(cosglobalang,day,-singlobalang,dax); - - //Get top-left corner - i = ((tspr->ang+2048-globalang)&2047); - cosang = sintable[(i+512)&2047]; sinang = sintable[i]; - dax = ((xspan>>1)+xoff)*tspr->xrepeat; - day = ((yspan>>1)+yoff)*tspr->yrepeat; - rzi[0] += dmulscale12(sinang,dax,cosang,day); - rxi[0] += dmulscale12(sinang,day,-cosang,dax); - - //Get other 3 corners - dax = xspan*tspr->xrepeat; - day = yspan*tspr->yrepeat; - rzi[1] = rzi[0]-mulscale12(sinang,dax); - rxi[1] = rxi[0]+mulscale12(cosang,dax); - dax = -mulscale12(cosang,day); - day = -mulscale12(sinang,day); - rzi[2] = rzi[1]+dax; rxi[2] = rxi[1]+day; - rzi[3] = rzi[0]+dax; rxi[3] = rxi[0]+day; - - //Put all points on same z - ryi[0] = scale((tspr->z-globalposz),yxaspect,320<<8); - if (ryi[0] == 0) return; - ryi[1] = ryi[2] = ryi[3] = ryi[0]; - - if ((cstat&4) == 0) - { z = 0; z1 = 1; z2 = 3; } - else - { z = 1; z1 = 0; z2 = 2; } - - dax = rzi[z1]-rzi[z]; day = rxi[z1]-rxi[z]; - bot = dmulscale8(dax,dax,day,day); - if (((klabs(dax)>>13) >= bot) || ((klabs(day)>>13) >= bot)) return; - globalx1 = divscale18(dax,bot); - globalx2 = divscale18(day,bot); - - dax = rzi[z2]-rzi[z]; day = rxi[z2]-rxi[z]; - bot = dmulscale8(dax,dax,day,day); - if (((klabs(dax)>>13) >= bot) || ((klabs(day)>>13) >= bot)) return; - globaly1 = divscale18(dax,bot); - globaly2 = divscale18(day,bot); - - //Calculate globals for hline texture mapping function - globalxpanning = (rxi[z]<<12); - globalypanning = (rzi[z]<<12); - globalzd = (ryi[z]<<12); - - rzi[0] = mulscale16(rzi[0],viewingrange); - rzi[1] = mulscale16(rzi[1],viewingrange); - rzi[2] = mulscale16(rzi[2],viewingrange); - rzi[3] = mulscale16(rzi[3],viewingrange); - - if (ryi[0] < 0) //If ceilsprite is above you, reverse order of points - { - i = rxi[1]; rxi[1] = rxi[3]; rxi[3] = i; - i = rzi[1]; rzi[1] = rzi[3]; rzi[3] = i; - } - - - //Clip polygon in 3-space - npoints = 4; - - //Clip edge 1 - npoints2 = 0; - zzsgn = rxi[0]+rzi[0]; - for (z=0; z= 0) - { - rxi2[npoints2] = rxi[z]; ryi2[npoints2] = ryi[z]; rzi2[npoints2] = rzi[z]; - npoints2++; - } - if ((zsgn^zzsgn) < 0) - { - t = divscale30(zsgn,zsgn-zzsgn); - rxi2[npoints2] = rxi[z] + mulscale30(t,rxi[zz]-rxi[z]); - ryi2[npoints2] = ryi[z] + mulscale30(t,ryi[zz]-ryi[z]); - rzi2[npoints2] = rzi[z] + mulscale30(t,rzi[zz]-rzi[z]); - npoints2++; - } - } - if (npoints2 <= 2) return; - - //Clip edge 2 - npoints = 0; - zzsgn = rxi2[0]-rzi2[0]; - for (z=0; z= 0) - { - rxi2[npoints2] = rxi[z]; - ryi2[npoints2] = ryi[z]; - rzi2[npoints2] = rzi[z]; - npoints2++; - } - if ((zsgn^zzsgn) < 0) - { - t = divscale30(zsgn,zsgn-zzsgn); - rxi2[npoints2] = rxi[z] + mulscale30(t,rxi[zz]-rxi[z]); - ryi2[npoints2] = ryi[z] + mulscale30(t,ryi[zz]-ryi[z]); - rzi2[npoints2] = rzi[z] + mulscale30(t,rzi[zz]-rzi[z]); - npoints2++; - } - } - if (npoints2 <= 2) return; - - //Clip edge 4 - npoints = 0; - zzsgn = ryi2[0]*halfxdimen + (rzi2[0]*(globalhoriz-ydimen)); - for (z=0; z (xdimen<<16)) xsi[z] = (xdimen<<16); - if (ysi[z] < ((int32_t)0<<16)) ysi[z] = ((int32_t)0<<16); - if (ysi[z] > ((int32_t)ydimen<<16)) ysi[z] = ((int32_t)ydimen<<16); - if (xsi[z] < lmax) lmax = xsi[z], lpoint = z; - if (xsi[z] > rmax) rmax = xsi[z], rpoint = z; - } - - //Get uwall arrays - for (z=lpoint; z!=rpoint; z=zz) - { - zz = z+1; if (zz == npoints) zz = 0; - - dax1 = ((xsi[z]+65535)>>16); - dax2 = ((xsi[zz]+65535)>>16); - if (dax2 > dax1) - { - yinc = divscale16(ysi[zz]-ysi[z],xsi[zz]-xsi[z]); - y = ysi[z] + mulscale16((dax1<<16)-xsi[z],yinc); - qinterpolatedown16short((intptr_t)(&uwall[dax1]),dax2-dax1,y,yinc); - } - } - - //Get dwall arrays - for (; z!=lpoint; z=zz) - { - zz = z+1; if (zz == npoints) zz = 0; - - dax1 = ((xsi[zz]+65535)>>16); - dax2 = ((xsi[z]+65535)>>16); - if (dax2 > dax1) - { - yinc = divscale16(ysi[zz]-ysi[z],xsi[zz]-xsi[z]); - y = ysi[zz] + mulscale16((dax1<<16)-xsi[zz],yinc); - qinterpolatedown16short((intptr_t)(&dwall[dax1]),dax2-dax1,y,yinc); - } - } - - - lx = ((lmax+65535)>>16); - rx = ((rmax+65535)>>16); - for (x=lx; x<=rx; x++) - { - uwall[x] = max(uwall[x],startumost[x+windowx1]-windowy1); - dwall[x] = min(dwall[x],startdmost[x+windowx1]-windowy1); - } - - //Additional uwall/dwall clipping goes here - for (i=smostwallcnt-1; i>=0; i--) - { - j = smostwall[i]; - if ((xb1[j] > rx) || (xb2[j] < lx)) continue; - if ((yp <= yb1[j]) && (yp <= yb2[j])) continue; - - //if (spritewallfront(tspr,thewall[j]) == 0) - x = thewall[j]; xp1 = wall[x].x; yp1 = wall[x].y; - x = wall[x].point2; xp2 = wall[x].x; yp2 = wall[x].y; - x = (xp2-xp1)*(tspr->y-yp1)-(tspr->x-xp1)*(yp2-yp1); - if ((yp > yb1[j]) && (yp > yb2[j])) x = -1; - if ((x >= 0) && ((x != 0) || (wall[thewall[j]].nextsector != tspr->sectnum))) continue; - - dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx); - - switch (smostwalltype[i]) - { - case 0: - if (dalx2 <= darx2) - { - if ((dalx2 == lx) && (darx2 == rx)) return; - //clearbufbyte(&dwall[dalx2],(darx2-dalx2+1)*sizeof(dwall[0]),0L); - for (x=dalx2; x<=darx2; x++) dwall[x] = 0; - } - break; - case 1: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; - break; - case 2: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; - break; - } - } - - //sprite - if ((searchit >= 1) && (searchx >= lx) && (searchx <= rx)) - if ((searchy >= uwall[searchx]) && (searchy <= dwall[searchx])) - { - searchsector = sectnum; searchwall = spritenum; - searchstat = 3; searchit = 1; - } - - globalorientation = cstat; - globalpicnum = tilenum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - //if (picanm[globalpicnum]&192) globalpicnum += animateoffs((short)globalpicnum,spritenum+32768); - - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - setgotpic(globalpicnum); - globalbufplc = waloff[globalpicnum]; - - globvis = mulscale16(globalhisibility,viewingrange); - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - - x = picsiz[globalpicnum]; y = ((x>>4)&15); x &= 15; - if (pow2long[x] != xspan) - { - x++; - globalx1 = mulscale(globalx1,xspan,x); - globalx2 = mulscale(globalx2,xspan,x); - } - - dax = globalxpanning; day = globalypanning; - globalxpanning = -dmulscale6(globalx1,day,globalx2,dax); - globalypanning = -dmulscale6(globaly1,day,globaly2,dax); - - globalx2 = mulscale16(globalx2,viewingrange); - globaly2 = mulscale16(globaly2,viewingrange); - globalzd = mulscale16(globalzd,viewingrangerecip); - - globalx1 = (globalx1-globalx2)*halfxdimen; - globaly1 = (globaly1-globaly2)*halfxdimen; - - if ((cstat&2) == 0) - msethlineshift(x,y); - else - tsethlineshift(x,y); - - //Draw it! - ceilspritescan(lx,rx-1); - } - else if ((cstat&48) == 48) - { - int32_t nxrepeat, nyrepeat; - - lx = 0; rx = xdim-1; - for (x=lx; x<=rx; x++) - { - lwall[x] = (int32_t)startumost[x+windowx1]-windowy1; - swall[x] = (int32_t)startdmost[x+windowx1]-windowy1; - } - for (i=smostwallcnt-1; i>=0; i--) - { - j = smostwall[i]; - if ((xb1[j] > rx) || (xb2[j] < lx)) continue; - if ((yp <= yb1[j]) && (yp <= yb2[j])) continue; - if (spritewallfront(tspr,(int32_t)thewall[j]) && ((yp <= yb1[j]) || (yp <= yb2[j]))) continue; - - dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx); - - switch (smostwalltype[i]) - { - case 0: - if (dalx2 <= darx2) - { - if ((dalx2 == lx) && (darx2 == rx)) return; - //clearbufbyte(&swall[dalx2],(darx2-dalx2+1)*sizeof(swall[0]),0L); - for (x=dalx2; x<=darx2; x++) swall[x] = 0; - } - break; - case 1: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] > lwall[x]) lwall[x] = smost[k+x]; - break; - case 2: - k = smoststart[i] - xb1[j]; - for (x=dalx2; x<=darx2; x++) - if (smost[k+x] < swall[x]) swall[x] = smost[k+x]; - break; - } - } - - if (lwall[rx] >= swall[rx]) - { - for (x=lx; xxrepeat)<<16); - nyrepeat = (((int32_t)tspr->yrepeat)<<16); - } - else - { - nxrepeat = ((int32_t)tspr->xrepeat)*voxscale[vtilenum]; - nyrepeat = ((int32_t)tspr->yrepeat)*voxscale[vtilenum]; - } - - if (!(cstat&128)) tspr->z -= mulscale22(B_LITTLE32(longptr[5]),nyrepeat); - yoff = (int32_t)((int8_t)((picanm[sprite[tspr->owner].picnum]>>16)&255))+((int32_t)tspr->yoffset); - tspr->z -= mulscale14(yoff,nyrepeat); - - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - - if ((searchit >= 1) && (yp > (4<<8)) && (searchy >= lwall[searchx]) && (searchy < swall[searchx])) - { - siz = divscale19(xdimenscale,yp); - - xv = mulscale16(nxrepeat,xyaspect); - - xspan = ((B_LITTLE32(longptr[0])+B_LITTLE32(longptr[1]))>>1); - yspan = B_LITTLE32(longptr[2]); - xsiz = mulscale30(siz,xv*xspan); - ysiz = mulscale30(siz,nyrepeat*yspan); - - //Watch out for divscale overflow - if (((xspan>>11) < xsiz) && (yspan < (ysiz>>1))) - { - x1 = xb-(xsiz>>1); - if (xspan&1) x1 += mulscale31(siz,xv); //Odd xspans - i = mulscale30(siz,xv*xoff); - if ((cstat&4) == 0) x1 -= i; else x1 += i; - - y1 = mulscale16(tspr->z-globalposz,siz); - //y1 -= mulscale30(siz,nyrepeat*yoff); - y1 += (globalhoriz<<8)-ysiz; - //if (cstat&128) //Already fixed up above - y1 += (ysiz>>1); - - x2 = x1+xsiz-1; - y2 = y1+ysiz-1; - if (((y1|255) < (y2|255)) && (searchx >= (x1>>8)+1) && (searchx <= (x2>>8))) - { - if ((sec->ceilingstat&3) == 0) - startum = globalhoriz+mulscale24(siz,sec->ceilingz-globalposz)-1; - else - startum = 0; - if ((sec->floorstat&3) == 0) - startdm = globalhoriz+mulscale24(siz,sec->floorz-globalposz)+1; - else - startdm = 0x7fffffff; - - //sprite - if ((searchy >= max(startum,(y1>>8))) && (searchy < min(startdm,(y2>>8)))) - { - searchsector = sectnum; searchwall = spritenum; - searchstat = 3; searchit = 1; - } - } - } - } - - i = (int32_t)tspr->ang+1536; -#ifdef USE_OPENGL - i += spriteext[tspr->owner].angoff; -#endif - drawvox(tspr->x,tspr->y,tspr->z,i,(int32_t)tspr->xrepeat,(int32_t)tspr->yrepeat,vtilenum,tspr->shade,tspr->pal,lwall,swall); - } - if (automapping == 1) show2dsprite[spritenum>>3] |= pow2char[spritenum&7]; -} - - -// -// drawmaskwall (internal) -// -static void drawmaskwall(int16_t damaskwallcnt) -{ - int32_t i, j, k, x, z, sectnum, z1, z2, lx, rx; - sectortype *sec, *nsec; - walltype *wal; - - //============================================================================= //POLYMOST BEGINS -#ifdef USE_OPENGL - if (rendmode == 3) { polymost_drawmaskwall(damaskwallcnt); return; } -# ifdef POLYMER - if (rendmode == 4) - { - bglEnable(GL_ALPHA_TEST); - bglEnable(GL_BLEND); - - polymer_drawmaskwall(damaskwallcnt); - - bglDisable(GL_BLEND); - bglDisable(GL_ALPHA_TEST); - - return; - } -#endif -#endif - //============================================================================= //POLYMOST ENDS - - z = maskwall[damaskwallcnt]; - wal = &wall[thewall[z]]; - sectnum = thesector[z]; sec = §or[sectnum]; - nsec = §or[wal->nextsector]; - z1 = max(nsec->ceilingz,sec->ceilingz); - z2 = min(nsec->floorz,sec->floorz); - - wallmost(uwall,z,sectnum,(uint8_t)0); - wallmost(uplc,z,(int32_t)wal->nextsector,(uint8_t)0); - for (x=xb1[z]; x<=xb2[z]; x++) if (uplc[x] > uwall[x]) uwall[x] = uplc[x]; - wallmost(dwall,z,sectnum,(uint8_t)1); - wallmost(dplc,z,(int32_t)wal->nextsector,(uint8_t)1); - for (x=xb1[z]; x<=xb2[z]; x++) if (dplc[x] < dwall[x]) dwall[x] = dplc[x]; - prepwall(z,wal); - - globalorientation = (int32_t)wal->cstat; - globalpicnum = wal->overpicnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - globalxpanning = (int32_t)wal->xpanning; - globalypanning = (int32_t)wal->ypanning; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)thewall[z]+16384); - globalshade = (int32_t)wal->shade; - globvis = globalvisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalpal = (int32_t)wal->pal; - globalshiftval = (picsiz[globalpicnum]>>4); - if (pow2long[globalshiftval] != tilesizy[globalpicnum]) globalshiftval++; - globalshiftval = 32-globalshiftval; - globalyscale = (wal->yrepeat<<(globalshiftval-19)); - if ((globalorientation&4) == 0) - globalzd = (((globalposz-z1)*globalyscale)<<8); - else - globalzd = (((globalposz-z2)*globalyscale)<<8); - globalzd += (globalypanning<<24); - if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd; - - for (i=smostwallcnt-1; i>=0; i--) - { - j = smostwall[i]; - if ((xb1[j] > xb2[z]) || (xb2[j] < xb1[z])) continue; - if (wallfront(j,z)) continue; - - lx = max(xb1[j],xb1[z]); rx = min(xb2[j],xb2[z]); - - switch (smostwalltype[i]) - { - case 0: - if (lx <= rx) - { - if ((lx == xb1[z]) && (rx == xb2[z])) return; - //clearbufbyte(&dwall[lx],(rx-lx+1)*sizeof(dwall[0]),0L); - for (x=lx; x<=rx; x++) dwall[x] = 0; - } - break; - case 1: - k = smoststart[i] - xb1[j]; - for (x=lx; x<=rx; x++) - if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; - break; - case 2: - k = smoststart[i] - xb1[j]; - for (x=lx; x<=rx; x++) - if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; - break; - } - } - - //maskwall - if ((searchit >= 1) && (searchx >= xb1[z]) && (searchx <= xb2[z])) - if ((searchy >= uwall[searchx]) && (searchy <= dwall[searchx])) - { - searchsector = sectnum; searchwall = thewall[z]; - searchstat = 4; searchit = 1; - } - - if ((globalorientation&128) == 0) - maskwallscan(xb1[z],xb2[z],uwall,dwall,swall,lwall); - else - { - if (globalorientation&128) - { - if (globalorientation&512) settransreverse(); else settransnormal(); - } - transmaskwallscan(xb1[z],xb2[z]); - } -} - - -// -// fillpolygon (internal) -// -static void fillpolygon(int32_t npoints) -{ - int32_t z, zz, x1, y1, x2, y2, miny, maxy, y, xinc, cnt; - int32_t ox, oy, bx, by, day1, day2; - int16_t *ptr, *ptr2; - intptr_t p; - -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) { polymost_fillpolygon(npoints); return; } -#endif - - miny = 0x7fffffff; maxy = 0x80000000; - for (z=npoints-1; z>=0; z--) - { y = ry1[z]; miny = min(miny,y); maxy = max(maxy,y); } - miny = (miny>>12); maxy = (maxy>>12); - if (miny < 0) miny = 0; - if (maxy >= ydim) maxy = ydim-1; - ptr = smost; //They're pointers! - watch how you optimize this thing - for (y=miny; y<=maxy; y++) - { - dotp1[y] = ptr; dotp2[y] = ptr+(MAXNODESPERLINE>>1); - ptr += MAXNODESPERLINE; - } - - for (z=npoints-1; z>=0; z--) - { - zz = xb1[z]; - y1 = ry1[z]; day1 = (y1>>12); - y2 = ry1[zz]; day2 = (y2>>12); - if (day1 != day2) - { - x1 = rx1[z]; x2 = rx1[zz]; - xinc = divscale12(x2-x1,y2-y1); - if (day2 > day1) - { - x1 += mulscale12((day1<<12)+4095-y1,xinc); - for (y=day1; y>12); x1 += xinc; } - } - else - { - x2 += mulscale12((day2<<12)+4095-y2,xinc); - for (y=day2; y>12); x2 += xinc; } - } - } - } - - globalx1 = mulscale16(globalx1,xyaspect); - globaly2 = mulscale16(globaly2,xyaspect); - - oy = miny+1-(ydim>>1); - globalposx += oy*globalx1; - globalposy += oy*globaly2; - - setuphlineasm4(asm1,asm2); - - ptr = smost; - for (y=miny; y<=maxy; y++) - { - cnt = dotp1[y]-ptr; ptr2 = ptr+(MAXNODESPERLINE>>1); - for (z=cnt-1; z>=0; z--) - { - day1 = 0; day2 = 0; - for (zz=z; zz>0; zz--) - { - if (ptr[zz] < ptr[day1]) day1 = zz; - if (ptr2[zz] < ptr2[day2]) day2 = zz; - } - x1 = ptr[day1]; ptr[day1] = ptr[z]; - x2 = ptr2[day2]-1; ptr2[day2] = ptr2[z]; - if (x1 > x2) continue; - - if (globalpolytype < 1) - { - //maphline - ox = x2+1-(xdim>>1); - bx = ox*asm1 + globalposx; - by = ox*asm2 - globalposy; - - p = ylookup[y]+x2+frameplace; - hlineasm4(x2-x1,-1L,globalshade<<8,by,bx,p); - } - else - { - //maphline - ox = x1+1-(xdim>>1); - bx = ox*asm1 + globalposx; - by = ox*asm2 - globalposy; - - p = ylookup[y]+x1+frameplace; - if (globalpolytype == 1) - mhline(globalbufplc,bx,(x2-x1)<<16,0L,by,p); - else - { - thline(globalbufplc,bx,(x2-x1)<<16,0L,by,p); - } - } - } - globalposx += globalx1; - globalposy += globaly2; - ptr += MAXNODESPERLINE; - } - faketimerhandler(); -} - - -// -// clippoly (internal) -// -static int32_t clippoly(int32_t npoints, int32_t clipstat) -{ - int32_t z, zz, s1, s2, t, npoints2, start2, z1, z2, z3, z4, splitcnt; - int32_t cx1, cy1, cx2, cy2; - - cx1 = windowx1; - cy1 = windowy1; - cx2 = windowx2+1; - cy2 = windowy2+1; - cx1 <<= 12; cy1 <<= 12; cx2 <<= 12; cy2 <<= 12; - - if (clipstat&0xa) //Need to clip top or left - { - npoints2 = 0; start2 = 0; z = 0; splitcnt = 0; - do - { - s2 = cx1-rx1[z]; - do - { - zz = xb1[z]; xb1[z] = -1; - s1 = s2; s2 = cx1-rx1[zz]; - if (s1 < 0) - { - rx2[npoints2] = rx1[z]; ry2[npoints2] = ry1[z]; - xb2[npoints2] = npoints2+1; npoints2++; - } - if ((s1^s2) < 0) - { - rx2[npoints2] = rx1[z]+scale(rx1[zz]-rx1[z],s1,s1-s2); - ry2[npoints2] = ry1[z]+scale(ry1[zz]-ry1[z],s1,s1-s2); - if (s1 < 0) p2[splitcnt++] = npoints2; - xb2[npoints2] = npoints2+1; - npoints2++; - } - z = zz; - } - while (xb1[z] >= 0); - - if (npoints2 >= start2+3) - xb2[npoints2-1] = start2, start2 = npoints2; - else - npoints2 = start2; - - z = 1; - while ((z < npoints) && (xb1[z] < 0)) z++; - } - while (z < npoints); - if (npoints2 <= 2) return(0); - - for (z=1; z= 0); - - if (npoints >= start2+3) - xb1[npoints-1] = start2, start2 = npoints; - else - npoints = start2; - - z = 1; - while ((z < npoints2) && (xb2[z] < 0)) z++; - } - while (z < npoints2); - if (npoints <= 2) return(0); - - for (z=1; z= 0); - - if (npoints2 >= start2+3) - xb2[npoints2-1] = start2, start2 = npoints2; - else - npoints2 = start2; - - z = 1; - while ((z < npoints) && (xb1[z] < 0)) z++; - } - while (z < npoints); - if (npoints2 <= 2) return(0); - - for (z=1; z= 0); - - if (npoints >= start2+3) - xb1[npoints-1] = start2, start2 = npoints; - else - npoints = start2; - - z = 1; - while ((z < npoints2) && (xb2[z] < 0)) z++; - } - while (z < npoints2); - if (npoints <= 2) return(0); - - for (z=1; z= 3 && qsetmode == 200) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,uniqid); return; } -#endif - //============================================================================= //POLYMOST ENDS - - if (cx1 < 0) cx1 = 0; - if (cy1 < 0) cy1 = 0; - if (cx2 > xres-1) cx2 = xres-1; - if (cy2 > yres-1) cy2 = yres-1; - - xsiz = tilesizx[picnum]; ysiz = tilesizy[picnum]; - if (dastat&16) { xoff = 0; yoff = 0; } - else - { - xoff = (int32_t)((int8_t)((picanm[picnum]>>8)&255))+(xsiz>>1); - yoff = (int32_t)((int8_t)((picanm[picnum]>>16)&255))+(ysiz>>1); - } - - if (dastat&4) yoff = ysiz-yoff; - - cosang = sintable[(a+512)&2047]; sinang = sintable[a&2047]; - - if ((dastat&2) != 0) //Auto window size scaling - { - if ((dastat&8) == 0) - { - x = xdimenscale; //= scale(xdimen,yxaspect,320); - sx = ((cx1+cx2+2)<<15)+scale(sx-(320<<15),xdimen,320); - sy = ((cy1+cy2+2)<<15)+mulscale16(sy-(200<<15),x); - } - else - { - //If not clipping to startmosts, & auto-scaling on, as a - //hard-coded bonus, scale to full screen instead - x = scale(xdim,yxaspect,320); - sx = (xdim<<15)+32768+scale(sx-(320<<15),xdim,320); - sy = (ydim<<15)+32768+mulscale16(sy-(200<<15),x); - } - z = mulscale16(z,x); - } - - xv = mulscale14(cosang,z); - yv = mulscale14(sinang,z); - if (((dastat&2) != 0) || ((dastat&8) == 0)) //Don't aspect unscaled perms - { - xv2 = mulscale16(xv,xyaspect); - yv2 = mulscale16(yv,xyaspect); - } - else - { - xv2 = xv; - yv2 = yv; - } - - nry1[0] = sy - (yv*xoff + xv*yoff); - nry1[1] = nry1[0] + yv*xsiz; - nry1[3] = nry1[0] + xv*ysiz; - nry1[2] = nry1[1]+nry1[3]-nry1[0]; - i = (cy1<<16); if ((nry1[0]i) && (nry1[1]>i) && (nry1[2]>i) && (nry1[3]>i)) return; - - nrx1[0] = sx - (xv2*xoff - yv2*yoff); - nrx1[1] = nrx1[0] + xv2*xsiz; - nrx1[3] = nrx1[0] - yv2*ysiz; - nrx1[2] = nrx1[1]+nrx1[3]-nrx1[0]; - i = (cx1<<16); if ((nrx1[0]i) && (nrx1[1]>i) && (nrx1[2]>i) && (nrx1[3]>i)) return; - - gx1 = nrx1[0]; gy1 = nry1[0]; //back up these before clipping - - if ((npoints = clippoly4(cx1<<16,cy1<<16,(cx2+1)<<16,(cy2+1)<<16)) < 3) return; - - lx = nrx1[0]; rx = nrx1[0]; - - nextv = 0; - for (v=npoints-1; v>=0; v--) - { - x1 = nrx1[v]; x2 = nrx1[nextv]; - dax1 = (x1>>16); if (x1 < lx) lx = x1; - dax2 = (x2>>16); if (x1 > rx) rx = x1; - if (dax1 != dax2) - { - y1 = nry1[v]; y2 = nry1[nextv]; - yinc = divscale16(y2-y1,x2-x1); - if (dax2 > dax1) - { - yplc = y1 + mulscale16((dax1<<16)+65535-x1,yinc); - qinterpolatedown16short((intptr_t)(&uplc[dax1]),dax2-dax1,yplc,yinc); - } - else - { - yplc = y2 + mulscale16((dax2<<16)+65535-x2,yinc); - qinterpolatedown16short((intptr_t)(&dplc[dax2]),dax1-dax2,yplc,yinc); - } - } - nextv = v; - } - - if (waloff[picnum] == 0) loadtile(picnum); - setgotpic(picnum); - bufplc = waloff[picnum]; - - if (palookup[dapalnum] == NULL) dapalnum = 0; - palookupoffs = FP_OFF(palookup[dapalnum]) + (getpalookup(0L,(int32_t)dashade)<<8); - - i = divscale32(1L,z); - xv = mulscale14(sinang,i); - yv = mulscale14(cosang,i); - if (((dastat&2) != 0) || ((dastat&8) == 0)) //Don't aspect unscaled perms - { - yv2 = mulscale16(-xv,yxaspect); - xv2 = mulscale16(yv,yxaspect); - } - else - { - yv2 = -xv; - xv2 = yv; - } - - x1 = (lx>>16); x2 = (rx>>16); - - oy = 0; - x = (x1<<16)-1-gx1; y = (oy<<16)+65535-gy1; - bx = dmulscale16(x,xv2,y,xv); - by = dmulscale16(x,yv2,y,yv); - if (dastat&4) { yv = -yv; yv2 = -yv2; by = (ysiz<<16)-1-by; } - - /* if (origbuffermode == 0) - { - if (dastat&128) - { - obuffermode = buffermode; - buffermode = 0; - setactivepage(activepage); - } - } - else if (dastat&8) - permanentupdate = 1; */ - -#ifndef ENGINE_USING_A_C - - if ((dastat&1) == 0) - { - if (((a&1023) == 0) && (ysiz <= 256)) //vlineasm4 has 256 high limit! - { - if (dastat&64) setupvlineasm(24L); else setupmvlineasm(24L); - by <<= 8; yv <<= 8; yv2 <<= 8; - - palookupoffse[0] = palookupoffse[1] = palookupoffse[2] = palookupoffse[3] = palookupoffs; - vince[0] = vince[1] = vince[2] = vince[3] = yv; - - for (x=x1; x y1) y1 = startumost[x+xx]; - if (startdmost[x+xx] < y2) y2 = startdmost[x+xx]; - } - if (y2 <= y1) continue; - - by += yv*(y1-oy); oy = y1; - - bufplce[xx] = (bx>>16)*ysiz+bufplc; - vplce[xx] = by; - y1ve[xx] = y1; - y2ve[xx] = y2-1; - bad &= ~pow2char[xx]; - } - - p = x+frameplace; - - u4 = max(max(y1ve[0],y1ve[1]),max(y1ve[2],y1ve[3])); - d4 = min(min(y2ve[0],y2ve[1]),min(y2ve[2],y2ve[3])); - - if (dastat&64) - { - if ((bad != 0) || (u4 >= d4)) - { - if (!(bad&1)) prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0); - if (!(bad&2)) prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1); - if (!(bad&4)) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2); - if (!(bad&8)) prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3); - continue; - } - - if (u4 > y1ve[0]) vplce[0] = prevlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0); - if (u4 > y1ve[1]) vplce[1] = prevlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1); - if (u4 > y1ve[2]) vplce[2] = prevlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2); - if (u4 > y1ve[3]) vplce[3] = prevlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3); - - if (d4 >= u4) vlineasm4(d4-u4+1,ylookup[u4]+p); - - i = p+ylookup[d4+1]; - if (y2ve[0] > d4) prevlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); - if (y2ve[1] > d4) prevlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); - if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); - if (y2ve[3] > d4) prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3); - } - else - { - if ((bad != 0) || (u4 >= d4)) - { - if (!(bad&1)) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0],vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0); - if (!(bad&2)) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-y1ve[1],vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1); - if (!(bad&4)) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-y1ve[2],vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2); - if (!(bad&8)) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-y1ve[3],vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3); - continue; - } - - if (u4 > y1ve[0]) vplce[0] = mvlineasm1(vince[0],palookupoffse[0],u4-y1ve[0]-1,vplce[0],bufplce[0],ylookup[y1ve[0]]+p+0); - if (u4 > y1ve[1]) vplce[1] = mvlineasm1(vince[1],palookupoffse[1],u4-y1ve[1]-1,vplce[1],bufplce[1],ylookup[y1ve[1]]+p+1); - if (u4 > y1ve[2]) vplce[2] = mvlineasm1(vince[2],palookupoffse[2],u4-y1ve[2]-1,vplce[2],bufplce[2],ylookup[y1ve[2]]+p+2); - if (u4 > y1ve[3]) vplce[3] = mvlineasm1(vince[3],palookupoffse[3],u4-y1ve[3]-1,vplce[3],bufplce[3],ylookup[y1ve[3]]+p+3); - - if (d4 >= u4) mvlineasm4(d4-u4+1,ylookup[u4]+p); - - i = p+ylookup[d4+1]; - if (y2ve[0] > d4) mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-d4-1,vplce[0],bufplce[0],i+0); - if (y2ve[1] > d4) mvlineasm1(vince[1],palookupoffse[1],y2ve[1]-d4-1,vplce[1],bufplce[1],i+1); - if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); - if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3); - } - - faketimerhandler(); - } - } - else - { - if (dastat&64) - { - if ((xv2&0x0000ffff) == 0) - { - qlinemode = 1; - setupqrhlineasm4(0L,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),palookupoffs,0L,0L); - } - else - { - qlinemode = 0; - setuprhlineasm4(xv2<<16,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),palookupoffs,ysiz,0L); - } - } - else - setuprmhlineasm4(xv2<<16,yv2<<16,(xv2>>16)*ysiz+(yv2>>16),palookupoffs,ysiz,0L); - - y1 = uplc[x1]; - if (((dastat&8) == 0) && (startumost[x1] > y1)) y1 = startumost[x1]; - y2 = y1; - for (x=x1; x ny1) ny1 = startumost[x]-1; - if (startdmost[x] < ny2) ny2 = startdmost[x]; - } - - if (ny1 < ny2-1) - { - if (ny1 >= y2) - { - while (y1 < y2-1) - { - y1++; if ((y1&31) == 0) faketimerhandler(); - - //x,y1 - bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; - if (dastat&64) - { - if (qlinemode) qrhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace); - else rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace); - } - else rmhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace); - } - y1 = ny1; - } - else - { - while (y1 < ny1) - { - y1++; if ((y1&31) == 0) faketimerhandler(); - - //x,y1 - bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; - if (dastat&64) - { - if (qlinemode) qrhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace); - else rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace); - } - else rmhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace); - } - while (y1 > ny1) lastx[y1--] = x; - } - while (y2 > ny2) - { - y2--; if ((y2&31) == 0) faketimerhandler(); - - //x,y2 - bx += xv*(y2-oy); by += yv*(y2-oy); oy = y2; - if (dastat&64) - { - if (qlinemode) qrhlineasm4(x-lastx[y2],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y2]+x+frameplace); - else rhlineasm4(x-lastx[y2],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y2]+x+frameplace); - } - else rmhlineasm4(x-lastx[y2],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y2]+x+frameplace); - } - while (y2 < ny2) lastx[y2++] = x; - } - else - { - while (y1 < y2-1) - { - y1++; if ((y1&31) == 0) faketimerhandler(); - - //x,y1 - bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; - if (dastat&64) - { - if (qlinemode) qrhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L ,by<<16,ylookup[y1]+x+frameplace); - else rhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace); - } - else rmhlineasm4(x-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x+frameplace); - } - if (x == x2-1) { bx += xv2; by += yv2; break; } - y1 = uplc[x+1]; - if (((dastat&8) == 0) && (startumost[x+1] > y1)) y1 = startumost[x+1]; - y2 = y1; - } - bx += xv2; by += yv2; - } - while (y1 < y2-1) - { - y1++; if ((y1&31) == 0) faketimerhandler(); - - //x2,y1 - bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; - if (dastat&64) - { - if (qlinemode) qrhlineasm4(x2-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,0L,by<<16,ylookup[y1]+x2+frameplace); - else rhlineasm4(x2-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x2+frameplace); - } - else rmhlineasm4(x2-lastx[y1],(bx>>16)*ysiz+(by>>16)+bufplc,0L,bx<<16,by<<16,ylookup[y1]+x2+frameplace); - } - } - } - else - { - if ((dastat&1) == 0) - { - if (dastat&64) - setupspritevline(palookupoffs,(xv>>16)*ysiz,xv<<16,ysiz,yv,0L); - else - msetupspritevline(palookupoffs,(xv>>16)*ysiz,xv<<16,ysiz,yv,0L); - } - else - { - tsetupspritevline(palookupoffs,(xv>>16)*ysiz,xv<<16,ysiz,yv,0L); - if (dastat&32) settransreverse(); else settransnormal(); - } - for (x=x1; x y1) y1 = startumost[x]; - if (startdmost[x] < y2) y2 = startdmost[x]; - } - if (y2 <= y1) continue; - - switch (y1-oy) - { - case -1: - bx -= xv; by -= yv; oy = y1; break; - case 0: - break; - case 1: - bx += xv; by += yv; oy = y1; break; - default: - bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; break; - } - - p = ylookup[y1]+x+frameplace; - - if ((dastat&1) == 0) - { - if (dastat&64) - spritevline(0L,by<<16,y2-y1+1,bx<<16,(bx>>16)*ysiz+(by>>16)+bufplc,p); - else - mspritevline(0L,by<<16,y2-y1+1,bx<<16,(bx>>16)*ysiz+(by>>16)+bufplc,p); - } - else - { - tspritevline(0L,by<<16,y2-y1+1,bx<<16,(bx>>16)*ysiz+(by>>16)+bufplc,p); - } - faketimerhandler(); - } - } - -#else // ENGINE_USING_A_C - - if ((dastat&1) == 0) - { - if (dastat&64) - setupspritevline(palookupoffs,xv,yv,ysiz); - else - msetupspritevline(palookupoffs,xv,yv,ysiz); - } - else - { - tsetupspritevline(palookupoffs,xv,yv,ysiz); - if (dastat&32) settransreverse(); else settransnormal(); - } - for (x=x1; x y1) y1 = startumost[x]; - if (startdmost[x] < y2) y2 = startdmost[x]; - } - if (y2 <= y1) continue; - - switch (y1-oy) - { - case -1: - bx -= xv; by -= yv; oy = y1; break; - case 0: - break; - case 1: - bx += xv; by += yv; oy = y1; break; - default: - bx += xv*(y1-oy); by += yv*(y1-oy); oy = y1; break; - } - - p = ylookup[y1]+x+frameplace; - - if ((dastat&1) == 0) - { - if (dastat&64) - spritevline(bx&65535,by&65535,y2-y1+1,(bx>>16)*ysiz+(by>>16)+bufplc,p); - else - mspritevline(bx&65535,by&65535,y2-y1+1,(bx>>16)*ysiz+(by>>16)+bufplc,p); - } - else - { - tspritevline(bx&65535,by&65535,y2-y1+1,(bx>>16)*ysiz+(by>>16)+bufplc,p); - //transarea += (y2-y1); - } - faketimerhandler(); - } - -#endif - - /* if ((dastat&128) && (origbuffermode == 0)) - { - buffermode = obuffermode; - setactivepage(activepage); - }*/ -} - - -// -// initksqrt (internal) -// -static inline void initksqrt(void) -{ - int32_t i, j, k; - - j = 1; k = 0; - for (i=0; i<4096; i++) - { - if (i >= j) { j <<= 2; k++; } - sqrtable[i] = (uint16_t)(msqrtasm((i<<18)+131072)<<1); - shlookup[i] = (k<<1)+((10-k)<<8); - if (i < 256) shlookup[i+4096] = ((k+6)<<1)+((10-(k+6))<<8); - } -} - - -// -// dosetaspect -// -static void dosetaspect(void) -{ - int32_t i, j, k, x, xinc; - - if (xyaspect != oxyaspect) - { - oxyaspect = xyaspect; - j = xyaspect*320; - horizlookup2[horizycent-1] = divscale26(131072,j); - for (i=ydim*4-1; i>=0; i--) - if (i != (horizycent-1)) - { - horizlookup[i] = divscale28(1,i-(horizycent-1)); - horizlookup2[i] = divscale14(klabs(horizlookup[i]),j); - } - } - if ((xdimen != oxdimen) || (viewingrange != oviewingrange)) - { - oxdimen = xdimen; - oviewingrange = viewingrange; - xinc = mulscale32(viewingrange*320,xdimenrecip); - x = (640<<16)-mulscale1(xinc,xdimen); - for (i=0; i>16); x += xinc; - if (j != 0) j = mulscale16((int32_t)radarang[k+1]-(int32_t)radarang[k],j); - radarang2[i] = (int16_t)(((int32_t)radarang[k]+j)>>6); - } - for (i=1; i<65536; i++) distrecip[i] = divscale20(xdimen,i); - nytooclose = xdimen*2100; - nytoofar = 65536*16384-1048576; - } -} - - -// -// loadtables (internal) -// -static inline void calcbritable(void) -{ - int32_t i,j; - double a,b; - for (i=0; i<16; i++) - { - a = (double)8 / ((double)i+8); - b = (double)255 / pow((double)255,a); - for (j=0; j<256; j++) // JBF 20040207: full 8bit precision - britable[i][j] = (uint8_t)(pow((double)j,a)*b); - } -} - -static int32_t loadtables(void) -{ - int32_t i, fil; - - if (tablesloaded == 0) - { - initksqrt(); - - for (i=0; i<2048; i++) reciptable[i] = divscale30(2048L,i+2048); - - if ((fil = kopen4load("tables.dat",0)) != -1) - { - kread(fil,sintable,2048*2); for (i=2048-1; i>=0; i--) sintable[i] = B_LITTLE16(sintable[i]); - kread(fil,radarang,640*2); for (i=640-1; i>=0; i--) radarang[i] = B_LITTLE16(radarang[i]); - for (i=0; i<640; i++) radarang[1279-i] = -radarang[i]; - //kread(fil,textfont,1024); - //kread(fil,smalltextfont,1024); - //kread(fil,britable,1024); - calcbritable(); - - kclose(fil); - } - else - { - engineerrstr = "Failed to load TABLES.DAT!"; - initprintf("ERROR: %s\n", engineerrstr); - return 1; - } - tablesloaded = 1; - } - - return 0; -} - - -// -// initfastcolorlookup (internal) -// -static void initfastcolorlookup(int32_t rscale, int32_t gscale, int32_t bscale) -{ - int32_t i, j, x, y, z; - char *pal1; - - j = 0; - for (i=64; i>=0; i--) - { - //j = (i-64)*(i-64); - rdist[i] = rdist[128-i] = j*rscale; - gdist[i] = gdist[128-i] = j*gscale; - bdist[i] = bdist[128-i] = j*bscale; - j += 129-(i<<1); - } - - //clearbufbyte(colhere,sizeof(colhere),0L); - //clearbufbyte(colhead,sizeof(colhead),0L); - Bmemset(colhere,0,sizeof(colhere)); - Bmemset(colhead,0,sizeof(colhead)); - - pal1 = (char *)&palette[768-3]; - for (i=255; i>=0; i--,pal1-=3) - { - j = (pal1[0]>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(pal1[1]>>3)*FASTPALGRIDSIZ+(pal1[2]>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1; - if (colhere[j>>3]&pow2char[j&7]) colnext[i] = colhead[j]; else colnext[i] = -1; - colhead[j] = i; - colhere[j>>3] |= pow2char[j&7]; - } - - i = 0; - for (x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ; x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ; x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ) - for (y=-FASTPALGRIDSIZ; y<=FASTPALGRIDSIZ; y+=FASTPALGRIDSIZ) - for (z=-1; z<=1; z++) - colscan[i++] = x+y+z; - i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i; -} - - -// -// loadpalette (internal) -// -static void loadpalette(void) -{ - int32_t fil; - - if (paletteloaded != 0) return; - if ((fil = kopen4load("palette.dat",0)) == -1) return; - - kread(fil,palette,768); - kread(fil,&numpalookups,2); numpalookups = B_LITTLE16(numpalookups); - - if ((palookup[0] = (char *)Bmalloc(numpalookups<<8)) == NULL) - allocache((intptr_t *)&palookup[0],numpalookups<<8,&permanentlock); - if ((transluc = (char *)Bmalloc(65536L)) == NULL) - allocache((intptr_t *)&transluc,65536,&permanentlock); - - globalpalwritten = palookup[0]; globalpal = 0; - setpalookupaddress(globalpalwritten); - - fixtransluscence(FP_OFF(transluc)); - - kread(fil,palookup[globalpal],numpalookups<<8); - kread(fil,transluc,65536); - kclose(fil); - - initfastcolorlookup(30L,59L,11L); - - { - int32_t i, j, k = 0; - for (i=0; i<256; i++) - { - j = ((int32_t)palette[i*3])+((int32_t)palette[i*3+1])+((int32_t)palette[i*3+2]); - if (j > k) { k = j; whitecol = i; } - } - } - - paletteloaded = 1; -} - - -// -// getclosestcol -// -int32_t getclosestcol(int32_t r, int32_t g, int32_t b) -{ - int32_t i, j, k, dist, mindist, retcol; - char *pal1; - - j = (r>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(g>>3)*FASTPALGRIDSIZ+(b>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1; - mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]); - mindist = min(mindist,bdist[coldist[b&7]+64+8]); - mindist++; - - r = 64-r; g = 64-g; b = 64-b; - - retcol = -1; - for (k=26; k>=0; k--) - { - i = colscan[k]+j; if ((colhere[i>>3]&pow2char[i&7]) == 0) continue; - i = colhead[i]; - do - { - pal1 = (char *)&palette[i*3]; - dist = gdist[pal1[1]+g]; - if (dist < mindist) - { - dist += rdist[pal1[0]+r]; - if (dist < mindist) - { - dist += bdist[pal1[2]+b]; - if (dist < mindist) { mindist = dist; retcol = i; } - } - } - i = colnext[i]; - } - while (i >= 0); - } - if (retcol >= 0) return(retcol); - - mindist = 0x7fffffff; - pal1 = (char *)&palette[768-3]; - for (i=255; i>=0; i--,pal1-=3) - { - dist = gdist[pal1[1]+g]; if (dist >= mindist) continue; - dist += rdist[pal1[0]+r]; if (dist >= mindist) continue; - dist += bdist[pal1[2]+b]; if (dist >= mindist) continue; - mindist = dist; retcol = i; - } - return(retcol); -} - - -// -// insertspritesect (internal) -// -int32_t insertspritesect(int16_t sectnum) -{ - int16_t blanktouse; - - if ((sectnum >= MAXSECTORS) || (headspritesect[MAXSECTORS] == -1)) - return(-1); //list full - - blanktouse = headspritesect[MAXSECTORS]; - - headspritesect[MAXSECTORS] = nextspritesect[blanktouse]; - if (headspritesect[MAXSECTORS] >= 0) - prevspritesect[headspritesect[MAXSECTORS]] = -1; - - prevspritesect[blanktouse] = -1; - nextspritesect[blanktouse] = headspritesect[sectnum]; - if (headspritesect[sectnum] >= 0) - prevspritesect[headspritesect[sectnum]] = blanktouse; - headspritesect[sectnum] = blanktouse; - - sprite[blanktouse].sectnum = sectnum; - - return(blanktouse); -} - - -// -// insertspritestat (internal) -// -int32_t insertspritestat(int16_t statnum) -{ - int16_t blanktouse; - - if ((statnum >= MAXSTATUS) || (headspritestat[MAXSTATUS] == -1)) - return(-1); //list full - - blanktouse = headspritestat[MAXSTATUS]; - - headspritestat[MAXSTATUS] = nextspritestat[blanktouse]; - if (headspritestat[MAXSTATUS] >= 0) - prevspritestat[headspritestat[MAXSTATUS]] = -1; - - prevspritestat[blanktouse] = -1; - nextspritestat[blanktouse] = headspritestat[statnum]; - if (headspritestat[statnum] >= 0) - prevspritestat[headspritestat[statnum]] = blanktouse; - headspritestat[statnum] = blanktouse; - - sprite[blanktouse].statnum = statnum; - - return(blanktouse); -} - - -// -// deletespritesect (internal) -// -int32_t deletespritesect(int16_t deleteme) -{ - if (sprite[deleteme].sectnum == MAXSECTORS) - return(-1); - - if (headspritesect[sprite[deleteme].sectnum] == deleteme) - headspritesect[sprite[deleteme].sectnum] = nextspritesect[deleteme]; - - if (prevspritesect[deleteme] >= 0) nextspritesect[prevspritesect[deleteme]] = nextspritesect[deleteme]; - if (nextspritesect[deleteme] >= 0) prevspritesect[nextspritesect[deleteme]] = prevspritesect[deleteme]; - - if (headspritesect[MAXSECTORS] >= 0) prevspritesect[headspritesect[MAXSECTORS]] = deleteme; - prevspritesect[deleteme] = -1; - nextspritesect[deleteme] = headspritesect[MAXSECTORS]; - headspritesect[MAXSECTORS] = deleteme; - - sprite[deleteme].sectnum = MAXSECTORS; - return(0); -} - - -// -// deletespritestat (internal) -// -int32_t deletespritestat(int16_t deleteme) -{ - if (sprite[deleteme].statnum == MAXSTATUS) - return(-1); - - if (headspritestat[sprite[deleteme].statnum] == deleteme) - headspritestat[sprite[deleteme].statnum] = nextspritestat[deleteme]; - - if (prevspritestat[deleteme] >= 0) nextspritestat[prevspritestat[deleteme]] = nextspritestat[deleteme]; - if (nextspritestat[deleteme] >= 0) prevspritestat[nextspritestat[deleteme]] = prevspritestat[deleteme]; - - if (headspritestat[MAXSTATUS] >= 0) prevspritestat[headspritestat[MAXSTATUS]] = deleteme; - prevspritestat[deleteme] = -1; - nextspritestat[deleteme] = headspritestat[MAXSTATUS]; - headspritestat[MAXSTATUS] = deleteme; - - sprite[deleteme].statnum = MAXSTATUS; - return(0); -} - - -// -// lintersect (internal) -// -static inline int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) -{ - //p1 to p2 is a line segment - int32_t x21, y21, x34, y34, x31, y31, bot, topt, topu, t; - - x21 = x2-x1; x34 = x3-x4; - y21 = y2-y1; y34 = y3-y4; - bot = x21*y34 - y21*x34; - if (bot >= 0) - { - if (bot == 0) return(0); - x31 = x3-x1; y31 = y3-y1; - topt = x31*y34 - y31*x34; if ((topt < 0) || (topt >= bot)) return(0); - topu = x21*y31 - y21*x31; if ((topu < 0) || (topu >= bot)) return(0); - } - else - { - x31 = x3-x1; y31 = y3-y1; - topt = x31*y34 - y31*x34; if ((topt > 0) || (topt <= bot)) return(0); - topu = x21*y31 - y21*x31; if ((topu > 0) || (topu <= bot)) return(0); - } - t = divscale24(topt,bot); - *intx = x1 + mulscale24(x21,t); - *inty = y1 + mulscale24(y21,t); - *intz = z1 + mulscale24(z2-z1,t); - return(1); -} - - -int32_t lineintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) -{ - return lintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, intx, inty, intz); -} - -// -// rintersect (internal) -// -static inline int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) -{ - //p1 towards p2 is a ray - int32_t x34, y34, x31, y31, bot, topt, topu, t; - - x34 = x3-x4; y34 = y3-y4; - bot = vx*y34 - vy*x34; - if (bot >= 0) - { - if (bot == 0) return(0); - x31 = x3-x1; y31 = y3-y1; - topt = x31*y34 - y31*x34; if (topt < 0) return(0); - topu = vx*y31 - vy*x31; if ((topu < 0) || (topu >= bot)) return(0); - } - else - { - x31 = x3-x1; y31 = y3-y1; - topt = x31*y34 - y31*x34; if (topt > 0) return(0); - topu = vx*y31 - vy*x31; if ((topu > 0) || (topu <= bot)) return(0); - } - t = divscale16(topt,bot); - *intx = x1 + mulscale16(vx,t); - *inty = y1 + mulscale16(vy,t); - *intz = z1 + mulscale16(vz,t); - return(1); -} - -int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) -{ - return rintersect(x1, y1, z1, vx, vy, vz, x3, y3, x4, y4, intx, inty, intz); -} - -// -// keepaway (internal) -// -static inline void keepaway(int32_t *x, int32_t *y, int32_t w) -{ - int32_t dx, dy, ox, oy, x1, y1; - char first; - - x1 = clipit[w].x1; dx = clipit[w].x2-x1; - y1 = clipit[w].y1; dy = clipit[w].y2-y1; - ox = ksgn(-dy); oy = ksgn(dx); - first = (klabs(dx) <= klabs(dy)); - - while (1) - { - if (dx*(*y-y1) > (*x-x1)*dy) return; - if (first == 0) *x += ox; else *y += oy; - first ^= 1; - } -} - - -// -// raytrace (internal) -// -static inline int32_t raytrace(int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) -{ - int32_t x1, y1, x2, y2, bot, topu, nintx, ninty, cnt, z, hitwall; - int32_t x21, y21, x43, y43; - - hitwall = -1; - for (z=clipnum-1; z>=0; z--) - { - x1 = clipit[z].x1; x2 = clipit[z].x2; x21 = x2-x1; - y1 = clipit[z].y1; y2 = clipit[z].y2; y21 = y2-y1; - - topu = x21*(y3-y1) - (x3-x1)*y21; if (topu <= 0) continue; - if (x21*(*y4-y1) > (*x4-x1)*y21) continue; - x43 = *x4-x3; y43 = *y4-y3; - if (x43*(y1-y3) > (x1-x3)*y43) continue; - if (x43*(y2-y3) <= (x2-x3)*y43) continue; - bot = x43*y21 - x21*y43; if (bot == 0) continue; - - cnt = 256; - do - { - cnt--; if (cnt < 0) { *x4 = x3; *y4 = y3; return(z); } - nintx = x3 + scale(x43,topu,bot); - ninty = y3 + scale(y43,topu,bot); - topu--; - } - while (x21*(ninty-y1) <= (nintx-x1)*y21); - - if (klabs(x3-nintx)+klabs(y3-ninty) < klabs(x3-*x4)+klabs(y3-*y4)) - { *x4 = nintx; *y4 = ninty; hitwall = z; } - } - return(hitwall); -} - - - -// -// Exported Engine Functions -// - -#if !defined _WIN32 && defined DEBUGGINGAIDS -#include -static void sighandler(int32_t sig, const siginfo_t *info, void *ctx) -{ - const char *s; - UNREFERENCED_PARAMETER(ctx); - switch (sig) - { - case SIGFPE: - switch (info->si_code) - { - case FPE_INTDIV: - s = "FPE_INTDIV (integer divide by zero)"; break; - case FPE_INTOVF: - s = "FPE_INTOVF (integer overflow)"; break; - case FPE_FLTDIV: - s = "FPE_FLTDIV (floating-point divide by zero)"; break; - case FPE_FLTOVF: - s = "FPE_FLTOVF (floating-point overflow)"; break; - case FPE_FLTUND: - s = "FPE_FLTUND (floating-point underflow)"; break; - case FPE_FLTRES: - s = "FPE_FLTRES (floating-point inexact result)"; break; - case FPE_FLTINV: - s = "FPE_FLTINV (floating-point invalid operation)"; break; - case FPE_FLTSUB: - s = "FPE_FLTSUB (floating-point subscript out of range)"; break; - default: - s = "?! (unknown)"; break; - } - fprintf(stderr, "Caught SIGFPE at address %p, code %s. Aborting.\n", info->si_addr, s); - break; - default: - break; - } - abort(); -} -#endif - -// -// preinitengine -// -static int32_t preinitcalled = 0; - -// #define DYNALLOC_ARRAYS - -#ifndef DYNALLOC_ARRAYS -static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID]; -static spritesmooth_t spritesmooth_s[MAXSPRITES+MAXUNIQHUDID]; -static sectortype sector_s[MAXSECTORS + M32_FIXME_SECTORS]; -static walltype wall_s[MAXWALLS + M32_FIXME_WALLS]; -static spritetype sprite_s[MAXSPRITES]; -static spritetype tsprite_s[MAXSPRITESONSCREEN]; -#else -void *blockptr = NULL; -#endif - -int32_t preinitengine(void) -{ - char *e; - if (initsystem()) exit(9); - - makeasmwriteable(); - -#ifdef DYNALLOC_ARRAYS - { - size_t i, size = 0; - - // allocate everything at once... why not? entries can just be added to this table - // to allocate future arrays without further intervention - struct - { - void **ptr; - size_t size; - } - dynarray[] = - { - { (void **) §or, sizeof(sectortype) *MAXSECTORS }, - { (void **) &wall, sizeof(walltype) *MAXWALLS }, // +512: editor quirks. FIXME! - { (void **) &sprite, sizeof(spritetype) *MAXSPRITES }, - { (void **) &tsprite, sizeof(spritetype) *MAXSPRITESONSCREEN }, - { (void **) &spriteext, sizeof(spriteext_t) *(MAXSPRITES+MAXUNIQHUDID) }, - { (void **) &spritesmooth, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID) }, - { (void **) &state_compress, sizeof(qlz_state_compress) }, - { (void **) &state_decompress, sizeof(qlz_state_decompress) } - }; - - if (editstatus) - { - dynarray[0].size += M32_FIXME_SECTORS*sizeof(sectortype); // join sectors needs a temp. sector - dynarray[1].size += M32_FIXME_WALLS*sizeof(walltype); - Bprintf("FIXME: Allocating additional space beyond wall[] for editor bugs.\n"); - } - - for (i=0; i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++) - size += dynarray[i].size; - - if ((blockptr = Bcalloc(1, size)) == NULL) - return 1; - - size = 0; - - for (i=0; i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++) - { - *dynarray[i].ptr = (int8_t *)blockptr + size; - size += dynarray[i].size; - } - } - -#else - sector = sector_s; - wall = wall_s; - sprite = sprite_s; - tsprite = tsprite_s; - spriteext = spriteext_s; - spritesmooth = spritesmooth_s; - state_compress = (qlz_state_compress *) Bmalloc(sizeof(qlz_state_compress) + sizeof(qlz_state_decompress)); - state_decompress = (qlz_state_decompress *)((int8_t *)(state_compress) + sizeof(qlz_state_compress)); -#endif - - if ((e = Bgetenv("BUILD_NOP6")) != NULL) - if (!Bstrcasecmp(e, "TRUE")) - { - Bprintf("Disabling P6 optimizations.\n"); - dommxoverlay = 0; - } - if (dommxoverlay) mmxoverlay(); - - validmodecnt = 0; - getvalidmodes(); - - initcrc32table(); - - clipmapinfo_init(); - - preinitcalled = 1; - return 0; -} - - -// -// initengine -// -int32_t initengine(void) -{ - int32_t i, j; - -#if !defined _WIN32 && defined DEBUGGINGAIDS - struct sigaction sigact, oldact; - memset(&sigact, 0, sizeof(sigact)); - sigact.sa_sigaction = (void *)sighandler; - sigact.sa_flags = SA_SIGINFO; - sigaction(SIGFPE, &sigact, &oldact); -#endif - - if (!preinitcalled) - { - i = preinitengine(); - if (i) return i; - } - - if (loadtables()) return 1; - - xyaspect = -1; - - pskyoff[0] = 0; pskybits = 0; - - parallaxtype = 2; parallaxyoffs = 0L; parallaxyscale = 65536; - showinvisibility = 0; - - for (i=1; i<1024; i++) lowrecip[i] = ((1<<24)-1)/i; - for (i=0; i>2,65536L); - - paletteloaded = 0; - - searchit = 0; searchstat = -1; - - for (i=0; i>5),0L); - clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L); - clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L); - automapping = 0; - - pointhighlight = -1; - linehighlight = -1; - highlightcnt = 0; - - totalclock = 0; - visibility = 512; - parallaxvisibility = 512; - - captureformat = 0; - - loadpalette(); -#ifdef USE_OPENGL - if (!hicfirstinit) hicinit(); - if (!mdinited) mdinit(); -#endif - - return 0; -} - - -// -// uninitengine -// -void uninitengine(void) -{ - int32_t i; - - //OSD_Printf("cacheresets = %d, cacheinvalidates = %d\n", cacheresets, cacheinvalidates); - -#ifdef USE_OPENGL - polymost_glreset(); - hicinit(); - freeallmodels(); -#ifdef POLYMER - polymer_uninit(); -#endif - /* if (cachefilehandle > -1) - Bclose(cachefilehandle); - if (cacheindexptr != NULL) - Bfclose(cacheindexptr); */ -#endif - - if (artfil != -1) kclose(artfil); - - i=(sizeof(artptrs)/sizeof(intptr_t))-1; - - // this leaves a bunch of invalid pointers in waloff... fixme? - for (; i>=0; i--) - { - if (artptrs[i]) - { - Bfree(artptrs[i]); - artptrs[i] = NULL; - } - } - - if (transluc != NULL) { Bfree(transluc); transluc = NULL; } - if (pic != NULL) { Bfree(pic); pic = NULL; } - if (lookups != NULL) - { - if (lookupsalloctype == 0) Bfree((void *)lookups); - //if (lookupsalloctype == 1) suckcache(lookups); //Cache already gone - lookups = NULL; - } - - for (i=0; i>1); - - globaluclip = (0-globalhoriz)*xdimscale; - globaldclip = (ydimen-globalhoriz)*xdimscale; - - i = mulscale16(xdimenscale,viewingrangerecip); - globalpisibility = mulscale16(parallaxvisibility,i); - globalvisibility = mulscale16(visibility,i); - globalhisibility = mulscale16(globalvisibility,xyaspect); - globalcisibility = mulscale8(globalhisibility,320); - - globalcursectnum = dacursectnum; - totalclocklock = totalclock; - - cosglobalang = sintable[(globalang+512)&2047]; - singlobalang = sintable[globalang&2047]; - cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange); - sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange); - - if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange)) - dosetaspect(); - - //clearbufbyte(&gotsector[0],(int32_t)((numsectors+7)>>3),0L); - Bmemset(&gotsector[0],0,(int32_t)((numsectors+7)>>3)); - - shortptr1 = (int16_t *)&startumost[windowx1]; - shortptr2 = (int16_t *)&startdmost[windowx1]; - i = xdimen-1; - do - { - umost[i] = shortptr1[i]-windowy1; - dmost[i] = shortptr2[i]-windowy1; - i--; - } - while (i != 0); - umost[0] = shortptr1[0]-windowy1; - dmost[0] = shortptr2[0]-windowy1; - -#ifdef USE_OPENGL -# ifdef POLYMER - if (rendmode == 4) - { - polymer_glinit(); - polymer_drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum); - bglDisable(GL_CULL_FACE); - gloy1 = 0; - return; - } -# endif - - //============================================================================= //POLYMOST BEGINS - polymost_drawrooms(); - if (rendmode) - return; -#endif - //============================================================================= //POLYMOST ENDS - - begindrawing(); //{{{ - - //frameoffset = frameplace + viewoffset; - frameoffset = frameplace + windowy1*bytesperline + windowx1; - - //if (smostwallcnt < 0) - // if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4) - // { /* setvmode(0x3);*/ OSD_Printf("Nice try.\n"); exit(0); } - - numhits = xdimen; numscans = 0; numbunches = 0; - maskwallcnt = 0; smostwallcnt = 0; smostcnt = 0; spritesortcnt = 0; - - if (globalcursectnum >= MAXSECTORS) - globalcursectnum -= MAXSECTORS; - else - { - i = globalcursectnum; - updatesector(globalposx,globalposy,&globalcursectnum); - if (globalcursectnum < 0) globalcursectnum = i; - - // PK 20110123: I'm not sure what the line above is supposed to do, but 'i' - // *can* be negative, so let's just quit here in that case... - if (globalcursectnum<0) - { - enddrawing(); - return; - } - } - - globparaceilclip = 1; - globparaflorclip = 1; - getzsofslope(globalcursectnum,globalposx,globalposy,&cz,&fz); - if (globalposz < cz) globparaceilclip = 0; - if (globalposz > fz) globparaflorclip = 0; - - scansector(globalcursectnum); - - if (inpreparemirror) - { - inpreparemirror = 0; - mirrorsx1 = xdimen-1; mirrorsx2 = 0; - for (i=numscans-1; i>=0; i--) - { - if (wall[thewall[i]].nextsector < 0) continue; - if (xb1[i] < mirrorsx1) mirrorsx1 = xb1[i]; - if (xb2[i] > mirrorsx2) mirrorsx2 = xb2[i]; - } - - for (i=0; i 0) && (numhits > 0)) - { - clearbuf(&tempbuf[0],(int32_t)((numbunches+3)>>2),0L); - tempbuf[0] = 1; - - closest = 0; //Almost works, but not quite :( - for (i=1; i=0; z=p2[z]) - show2dwall[thewall[z]>>3] |= pow2char[thewall[z]&7]; - } - - numbunches--; - bunchfirst[closest] = bunchfirst[numbunches]; - bunchlast[closest] = bunchlast[numbunches]; - } - - enddrawing(); //}}} -} - -// UTILITY TYPES AND FUNCTIONS FOR DRAWMASKS OCCLUSION TREE -// typedef struct s_maskleaf -// { -// int32_t index; -// _point2d p1, p2; -// _equation maskeq, p1eq, p2eq; -// struct s_maskleaf* branch[MAXWALLSB]; -// int32_t drawing; -// } _maskleaf; -// -// _maskleaf maskleaves[MAXWALLSB]; - -// returns equation of a line given two points -static inline _equation equation(float x1, float y1, float x2, float y2) -{ - _equation ret; - - if ((x2 - x1) != 0) - { - ret.a = (float)(y2 - y1)/(float)(x2 - x1); - ret.b = -1; - ret.c = (y1 - (ret.a * x1)); - } - else // vertical - { - ret.a = 1; - ret.b = 0; - ret.c = -x1; - } - - return (ret); -} - -int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum) -{ - // 1 if wall is in front of player 0 otherwise - int32_t a1, a2; - walltype *w1, *w2; - - w1 = &wall[wallnum]; - w2 = &wall[w1->point2]; - - a1 = getangle(w1->x - x, w1->y - y); - a2 = getangle(w2->x - x, w2->y - y); - - //if ((wallnum == 23) || (wallnum == 9)) - // OSD_Printf("Wall %d : %d - sector %d - x %d - y %d.\n", wallnum, (a2 + (2048 - a1)) & 2047, globalcursectnum, globalposx, globalposy); - - if (((a2 + (2048 - a1)) & 2047) <= 1024) - return (1); - return (0); -} -/* -// returns the intersection point between two lines -_point2d intersection(_equation eq1, _equation eq2) -{ - _point2d ret; - float det; - - det = (float)(1) / (eq1.a*eq2.b - eq2.a*eq1.b); - ret.x = ((eq1.b*eq2.c - eq2.b*eq1.c) * det); - ret.y = ((eq2.a*eq1.c - eq1.a*eq2.c) * det); - - return (ret); -} - -// check if a point that's on the line is within the segment boundaries -int32_t pointonmask(_point2d point, _maskleaf* wall) -{ - if ((min(wall->p1.x, wall->p2.x) <= point.x) && (point.x <= max(wall->p1.x, wall->p2.x)) && (min(wall->p1.y, wall->p2.y) <= point.y) && (point.y <= max(wall->p1.y, wall->p2.y))) - return (1); - return (0); -} - -// returns 1 if wall2 is hidden by wall1 -int32_t wallobstructswall(_maskleaf* wall1, _maskleaf* wall2) -{ - _point2d cross; - - cross = intersection(wall2->p1eq, wall1->maskeq); - if (pointonmask(cross, wall1)) - return (1); - - cross = intersection(wall2->p2eq, wall1->maskeq); - if (pointonmask(cross, wall1)) - return (1); - - cross = intersection(wall1->p1eq, wall2->maskeq); - if (pointonmask(cross, wall2)) - return (1); - - cross = intersection(wall1->p2eq, wall2->maskeq); - if (pointonmask(cross, wall2)) - return (1); - - return (0); -} - -// recursive mask drawing function -static inline void drawmaskleaf(_maskleaf* wall) -{ - int32_t i; - - wall->drawing = 1; - i = 0; - while (wall->branch[i] != NULL) - { - if (wall->branch[i]->drawing == 0) - { - //OSD_Printf("Drawing parent of %i : mask %i\n", wall->index, wall->branch[i]->index); - drawmaskleaf(wall->branch[i]); - } - i++; - } - - //OSD_Printf("Drawing mask %i\n", wall->index); - drawmaskwall(wall->index); -} -*/ - -static inline int32_t sameside(_equation *eq, _point2d *p1, _point2d *p2) -{ - float sign1, sign2; - - sign1 = eq->a * p1->x + eq->b * p1->y + eq->c; - sign2 = eq->a * p2->x + eq->b * p2->y + eq->c; - - sign1 = sign1 * sign2; - if (sign1 > 0) - { - //OSD_Printf("SAME SIDE !\n"); - return (1); - } - //OSD_Printf("OPPOSITE SIDE !\n"); - return (0); -} - - -// -// drawmasks -// -void drawmasks(void) -{ - int32_t i, j, k, l, gap, xs, ys, xp, yp, yoff, yspan; - // PLAG: sorting stuff - _equation maskeq, p1eq, p2eq; - _point2d dot, dot2, middle, pos, spr; - -#ifdef POLYMER - if ((rendmode == 4) && 0) - { - polymer_drawmasks(); - return; - } -#endif - - for (i=spritesortcnt-1; i>=0; i--) tspriteptr[i] = &tsprite[i]; - for (i=spritesortcnt-1; i>=0; i--) - { - xs = tspriteptr[i]->x-globalposx; ys = tspriteptr[i]->y-globalposy; - yp = dmulscale6(xs,cosviewingrangeglobalang,ys,sinviewingrangeglobalang); - if (yp > (4<<8)) - { - xp = dmulscale6(ys,cosglobalang,-xs,singlobalang); - if (mulscale24(labs(xp+yp),xdimen) >= yp) goto killsprite; - spritesx[i] = scale(xp+yp,xdimen<<7,yp); - } - else if ((tspriteptr[i]->cstat&48) == 0) - { - killsprite: - spritesortcnt--; //Delete face sprite if on wrong side! - if (i == spritesortcnt) continue; - tspriteptr[i] = tspriteptr[spritesortcnt]; - spritesx[i] = spritesx[spritesortcnt]; - spritesy[i] = spritesy[spritesortcnt]; - continue; - } - spritesy[i] = yp; - } - - { - gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1; - for (gap>>=1; gap>0; gap>>=1) //Sort sprite list - for (i=0; i=0; l-=gap) - { - if (spritesy[l] <= spritesy[l+gap]) break; - swaplong(&tspriteptr[l],&tspriteptr[l+gap]); - swaplong(&spritesx[l],&spritesx[l+gap]); - swaplong(&spritesy[l],&spritesy[l+gap]); - } - - if (spritesortcnt > 0) - spritesy[spritesortcnt] = (spritesy[spritesortcnt-1]^1); - - ys = spritesy[0]; i = 0; - for (j=1; j<=spritesortcnt; j++) - { - if (spritesy[j] == ys) continue; - ys = spritesy[j]; - if (j > i+1) - { - for (k=i; kz; - if ((tspriteptr[k]->cstat&48) != 32) - { - yoff = (int32_t)((int8_t)((picanm[tspriteptr[k]->picnum]>>16)&255))+((int32_t)tspriteptr[k]->yoffset); - spritesz[k] -= ((yoff*tspriteptr[k]->yrepeat)<<2); - yspan = (tilesizy[tspriteptr[k]->picnum]*tspriteptr[k]->yrepeat<<2); - if (!(tspriteptr[k]->cstat&128)) spritesz[k] -= (yspan>>1); - if (klabs(spritesz[k]-globalposz) < (yspan>>1)) spritesz[k] = globalposz; - } - } - for (k=i+1; kstatnum < tspriteptr[l]->statnum) - { - swaplong(&tspriteptr[k],&tspriteptr[l]); - swaplong(&spritesx[k],&spritesx[l]); - swaplong(&spritesy[k],&spritesy[l]); - } - } - i = j; - } - } - - begindrawing(); //{{{ - - /*for(i=spritesortcnt-1;i>=0;i--) - { - xs = tspriteptr[i].x-globalposx; - ys = tspriteptr[i].y-globalposy; - zs = tspriteptr[i].z-globalposz; - - xp = ys*cosglobalang-xs*singlobalang; - yp = (zs<<1); - zp = xs*cosglobalang+ys*singlobalang; - - xs = scale(xp,halfxdimen<<12,zp)+((halfxdimen+windowx1)<<12); - ys = scale(yp,xdimenscale<<12,zp)+((globalhoriz+windowy1)<<12); - - drawline256(xs-65536,ys-65536,xs+65536,ys+65536,31); - drawline256(xs+65536,ys-65536,xs-65536,ys+65536,31); - }*/ - - { -#ifdef USE_OPENGL - curpolygonoffset = 0; - cullcheckcnt = 0; -#endif - pos.x = (float)globalposx; - pos.y = (float)globalposy; - - while (maskwallcnt) - { - maskwallcnt--; -#if defined(USE_OPENGL) && defined(POLYMER) - if (rendmode == 4) - { - dot.x = (float)wall[maskwall[maskwallcnt]].x; - dot.y = (float)wall[maskwall[maskwallcnt]].y; - dot2.x = (float)wall[wall[maskwall[maskwallcnt]].point2].x; - dot2.y = (float)wall[wall[maskwall[maskwallcnt]].point2].y; - } - else -#endif - { - dot.x = (float)wall[thewall[maskwall[maskwallcnt]]].x; - dot.y = (float)wall[thewall[maskwall[maskwallcnt]]].y; - dot2.x = (float)wall[wall[thewall[maskwall[maskwallcnt]]].point2].x; - dot2.y = (float)wall[wall[thewall[maskwall[maskwallcnt]]].point2].y; - } - - maskeq = equation(dot.x, dot.y, dot2.x, dot2.y); - p1eq = equation(pos.x, pos.y, dot.x, dot.y); - p2eq = equation(pos.x, pos.y, dot2.x, dot2.y); - - middle.x = (dot.x + dot2.x) / 2; - middle.y = (dot.y + dot2.y) / 2; - - i = spritesortcnt; - while (i) - { - i--; - if (tspriteptr[i] != NULL) - { - spr.x = (float)tspriteptr[i]->x; - spr.y = (float)tspriteptr[i]->y; - - if ((sameside(&maskeq, &spr, &pos) == 0) && sameside(&p1eq, &middle, &spr) && sameside(&p2eq, &middle, &spr)) - { - drawsprite(i); - tspriteptr[i] = NULL; - } - } - } - drawmaskwall(maskwallcnt); - } - - while (spritesortcnt) - { - spritesortcnt--; - if (tspriteptr[spritesortcnt] != NULL) - drawsprite(spritesortcnt); - } -#ifdef USE_OPENGL - if (totalclock < lastcullcheck - CULL_DELAY) - lastcullcheck = totalclock; - if (totalclock >= lastcullcheck + CULL_DELAY) - lastcullcheck = (totalclock + CULL_DELAY); -#endif - } - - indrawroomsandmasks = 0; - enddrawing(); //}}} -} - -// -// drawmapview -// -void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) -{ - walltype *wal; - sectortype *sec; - spritetype *spr; - int32_t tilenum, xoff, yoff, i, j, k, l, cosang, sinang, xspan, yspan; - int32_t xrepeat, yrepeat, x, y, x1, y1, x2, y2, x3, y3, x4, y4, bakx1, baky1; - int32_t s, w, ox, oy, startwall, cx1, cy1, cx2, cy2; - int32_t bakgxvect, bakgyvect, sortnum, gap, npoints; - int32_t xvect, yvect, xvect2, yvect2, daslope; - int32_t oydim=ydim; - - int32_t oyxaspect=yxaspect, oviewingrange=viewingrange; - - ydim = (int32_t)((double)xdim * 0.625f); - setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); - ydim = oydim; - - beforedrawrooms = 0; - - clearbuf(&gotsector[0],(int32_t)((numsectors+31)>>5),0L); - - cx1 = (windowx1<<12); cy1 = (windowy1<<12); - cx2 = ((windowx2+1)<<12)-1; cy2 = ((windowy2+1)<<12)-1; - - zoome <<= 8; - - bakgxvect = divscale28(sintable[(1536-ang)&2047],zoome); - bakgyvect = divscale28(sintable[(2048-ang)&2047],zoome); - xvect = mulscale8(sintable[(2048-ang)&2047],zoome); - yvect = mulscale8(sintable[(1536-ang)&2047],zoome); - xvect2 = mulscale16(xvect,yxaspect); - yvect2 = mulscale16(yvect,yxaspect); - - sortnum = 0; - - begindrawing(); //{{{ - - for (s=0,sec=§or[s]; s>3]&pow2char[s&7]) - { - npoints = 0; i = 0; - startwall = sec->wallptr; -#if 0 - for (w=sec->wallnum,wal=&wall[startwall]; w>0; w--,wal++) - { - ox = wal->x - dax; oy = wal->y - day; - x = dmulscale16(ox,xvect,-oy,yvect) + (xdim<<11); - y = dmulscale16(oy,xvect2,ox,yvect2) + (ydim<<11); - i |= getclipmask(x-cx1,cx2-x,y-cy1,cy2-y); - rx1[npoints] = x; - ry1[npoints] = y; - xb1[npoints] = wal->point2 - startwall; - npoints++; - } -#else - j = startwall; l = 0; - for (w=sec->wallnum,wal=&wall[startwall]; w>0; w--,wal++,j++) - { - k = lastwall(j); - if ((k > j) && (npoints > 0)) { xb1[npoints-1] = l; l = npoints; } //overwrite point2 - //wall[k].x wal->x wall[wal->point2].x - //wall[k].y wal->y wall[wal->point2].y - if (!dmulscale1(wal->x-wall[k].x,wall[wal->point2].y-wal->y,-(wal->y-wall[k].y),wall[wal->point2].x-wal->x)) continue; - ox = wal->x - dax; oy = wal->y - day; - x = dmulscale16(ox,xvect,-oy,yvect) + (xdim<<11); - y = dmulscale16(oy,xvect2,ox,yvect2) + (ydim<<11); - i |= getclipmask(x-cx1,cx2-x,y-cy1,cy2-y); - rx1[npoints] = x; - ry1[npoints] = y; - xb1[npoints] = npoints+1; - npoints++; - } - if (npoints > 0) xb1[npoints-1] = l; //overwrite point2 -#endif - if ((i&0xf0) != 0xf0) continue; - bakx1 = rx1[0]; baky1 = mulscale16(ry1[0]-(ydim<<11),xyaspect)+(ydim<<11); - if (i&0x0f) - { - npoints = clippoly(npoints,i); - if (npoints < 3) continue; - } - - //Collect floor sprites to draw - for (i=headspritesect[s]; i>=0; i=nextspritesect[i]) - if ((sprite[i].cstat&48) == 32) - { - if ((sprite[i].cstat&(64+8)) == (64+8)) continue; - tsprite[sortnum++].owner = i; - } - - gotsector[s>>3] |= pow2char[s&7]; - - globalorientation = (int32_t)sec->floorstat; - if ((globalorientation&1) != 0) continue; - - globalpal = sec->floorpal; - - if (palookup[sec->floorpal] != globalpalwritten) - { - globalpalwritten = palookup[sec->floorpal]; - if (!globalpalwritten) globalpalwritten = palookup[0]; // JBF: fixes null-pointer crash - setpalookupaddress(globalpalwritten); - } - globalpicnum = sec->floorpicnum; - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - setgotpic(globalpicnum); - if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue; - if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((int16_t)globalpicnum,s); - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - globalbufplc = waloff[globalpicnum]; - globalshade = max(min(sec->floorshade,numpalookups-1),0); - globvis = globalhisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalpolytype = 0; - if ((globalorientation&64) == 0) - { - globalposx = dax; globalx1 = bakgxvect; globaly1 = bakgyvect; - globalposy = day; globalx2 = bakgxvect; globaly2 = bakgyvect; - } - else - { - ox = wall[wall[startwall].point2].x - wall[startwall].x; - oy = wall[wall[startwall].point2].y - wall[startwall].y; - i = nsqrtasm(ox*ox+oy*oy); if (i == 0) continue; - i = 1048576/i; - globalx1 = mulscale10(dmulscale10(ox,bakgxvect,oy,bakgyvect),i); - globaly1 = mulscale10(dmulscale10(ox,bakgyvect,-oy,bakgxvect),i); - ox = (bakx1>>4)-(xdim<<7); oy = (baky1>>4)-(ydim<<7); - globalposx = dmulscale28(-oy,globalx1,-ox,globaly1); - globalposy = dmulscale28(-ox,globalx1,oy,globaly1); - globalx2 = -globalx1; - globaly2 = -globaly1; - - daslope = sector[s].floorheinum; - i = nsqrtasm(daslope*daslope+16777216); - globalposy = mulscale12(globalposy,i); - globalx2 = mulscale12(globalx2,i); - globaly2 = mulscale12(globaly2,i); - } - globalxshift = (8-(picsiz[globalpicnum]&15)); - globalyshift = (8-(picsiz[globalpicnum]>>4)); - if (globalorientation&8) {globalxshift++; globalyshift++; } - - sethlinesizes(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4,globalbufplc); - - if ((globalorientation&0x4) > 0) - { - i = globalposx; globalposx = -globalposy; globalposy = -i; - i = globalx2; globalx2 = globaly1; globaly1 = i; - i = globalx1; globalx1 = -globaly2; globaly2 = -i; - } - if ((globalorientation&0x10) > 0) globalx1 = -globalx1, globaly1 = -globaly1, globalposx = -globalposx; - if ((globalorientation&0x20) > 0) globalx2 = -globalx2, globaly2 = -globaly2, globalposy = -globalposy; - asm1 = (globaly1<floorxpanning)<<24); - globalposy = (globalposy<<(20+globalyshift))-(((int32_t)sec->floorypanning)<<24); - - fillpolygon(npoints); - } - - //Sort sprite list - gap = 1; while (gap < sortnum) gap = (gap<<1)+1; - for (gap>>=1; gap>0; gap>>=1) - for (i=0; i=0; j-=gap) - { - if (sprite[tsprite[j].owner].z <= sprite[tsprite[j+gap].owner].z) break; - swapshort(&tsprite[j].owner,&tsprite[j+gap].owner); - } - - for (s=sortnum-1; s>=0; s--) - { - spr = &sprite[tsprite[s].owner]; - if ((spr->cstat&48) == 32) - { - npoints = 0; - - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset); - if ((spr->cstat&4) > 0) xoff = -xoff; - if ((spr->cstat&8) > 0) yoff = -yoff; - - k = spr->ang; - cosang = sintable[(k+512)&2047]; sinang = sintable[k]; - xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat; - yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat; - - ox = ((xspan>>1)+xoff)*xrepeat; oy = ((yspan>>1)+yoff)*yrepeat; - x1 = spr->x + mulscale(sinang,ox,16) + mulscale(cosang,oy,16); - y1 = spr->y + mulscale(sinang,oy,16) - mulscale(cosang,ox,16); - l = xspan*xrepeat; - x2 = x1 - mulscale(sinang,l,16); - y2 = y1 + mulscale(cosang,l,16); - l = yspan*yrepeat; - k = -mulscale(cosang,l,16); x3 = x2+k; x4 = x1+k; - k = -mulscale(sinang,l,16); y3 = y2+k; y4 = y1+k; - - xb1[0] = 1; xb1[1] = 2; xb1[2] = 3; xb1[3] = 0; - npoints = 4; - - i = 0; - - ox = x1 - dax; oy = y1 - day; - x = dmulscale16(ox,xvect,-oy,yvect) + (xdim<<11); - y = dmulscale16(oy,xvect2,ox,yvect2) + (ydim<<11); - i |= getclipmask(x-cx1,cx2-x,y-cy1,cy2-y); - rx1[0] = x; ry1[0] = y; - - ox = x2 - dax; oy = y2 - day; - x = dmulscale16(ox,xvect,-oy,yvect) + (xdim<<11); - y = dmulscale16(oy,xvect2,ox,yvect2) + (ydim<<11); - i |= getclipmask(x-cx1,cx2-x,y-cy1,cy2-y); - rx1[1] = x; ry1[1] = y; - - ox = x3 - dax; oy = y3 - day; - x = dmulscale16(ox,xvect,-oy,yvect) + (xdim<<11); - y = dmulscale16(oy,xvect2,ox,yvect2) + (ydim<<11); - i |= getclipmask(x-cx1,cx2-x,y-cy1,cy2-y); - rx1[2] = x; ry1[2] = y; - - x = rx1[0]+rx1[2]-rx1[1]; - y = ry1[0]+ry1[2]-ry1[1]; - i |= getclipmask(x-cx1,cx2-x,y-cy1,cy2-y); - rx1[3] = x; ry1[3] = y; - - if ((i&0xf0) != 0xf0) continue; - bakx1 = rx1[0]; baky1 = mulscale16(ry1[0]-(ydim<<11),xyaspect)+(ydim<<11); - if (i&0x0f) - { - npoints = clippoly(npoints,i); - if (npoints < 3) continue; - } - - globalpicnum = spr->picnum; - globalpal = spr->pal; // GL needs this, software doesn't - if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0; - setgotpic(globalpicnum); - if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue; - if ((picanm[globalpicnum]&192) != 0) globalpicnum += animateoffs((int16_t)globalpicnum,s); - if (waloff[globalpicnum] == 0) loadtile(globalpicnum); - globalbufplc = waloff[globalpicnum]; - if ((sector[spr->sectnum].ceilingstat&1) > 0) - globalshade = ((int32_t)sector[spr->sectnum].ceilingshade); - else - globalshade = ((int32_t)sector[spr->sectnum].floorshade); - globalshade = max(min(globalshade+spr->shade+6,numpalookups-1),0); - asm3 = FP_OFF(palookup[spr->pal]+(globalshade<<8)); - globvis = globalhisibility; - if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16))); - globalpolytype = ((spr->cstat&2)>>1)+1; - - //relative alignment stuff - ox = x2-x1; oy = y2-y1; - i = ox*ox+oy*oy; if (i == 0) continue; i = (65536*16384)/i; - globalx1 = mulscale10(dmulscale10(ox,bakgxvect,oy,bakgyvect),i); - globaly1 = mulscale10(dmulscale10(ox,bakgyvect,-oy,bakgxvect),i); - ox = y1-y4; oy = x4-x1; - i = ox*ox+oy*oy; if (i == 0) continue; i = (65536*16384)/i; - globalx2 = mulscale10(dmulscale10(ox,bakgxvect,oy,bakgyvect),i); - globaly2 = mulscale10(dmulscale10(ox,bakgyvect,-oy,bakgxvect),i); - - ox = picsiz[globalpicnum]; oy = ((ox>>4)&15); ox &= 15; - if (pow2long[ox] != xspan) - { - ox++; - globalx1 = mulscale(globalx1,xspan,ox); - globaly1 = mulscale(globaly1,xspan,ox); - } - - bakx1 = (bakx1>>4)-(xdim<<7); baky1 = (baky1>>4)-(ydim<<7); - globalposx = dmulscale28(-baky1,globalx1,-bakx1,globaly1); - globalposy = dmulscale28(bakx1,globalx2,-baky1,globaly2); - - if ((spr->cstat&2) == 0) - msethlineshift(ox,oy); - else - { - if (spr->cstat&512) settransreverse(); else settransnormal(); - tsethlineshift(ox,oy); - } - - if ((spr->cstat&0x4) > 0) globalx1 = -globalx1, globaly1 = -globaly1, globalposx = -globalposx; - asm1 = (globaly1<<2); globalx1 <<= 2; globalposx <<= (20+2); - asm2 = (globalx2<<2); globaly2 <<= 2; globalposy <<= (20+2); - - globalorientation = ((spr->cstat&2)<<7) | ((spr->cstat&512)>>2); // so polymost can get the translucency. ignored in software mode. - fillpolygon(npoints); - } - } - - enddrawing(); //}}} - if (r_usenewaspect) - setaspect(oviewingrange, oyxaspect); - else - setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); -} - - -// -// loadboard -// -// flags: 1, 2: former parameter "fromwhere" -// 4: don't call polymer_loadboard -int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy, int32_t *daposz, - int16_t *daang, int16_t *dacursectnum) -{ - int16_t fil, i, numsprites, dq[MAXSPRITES], dnum = 0; -#ifdef POLYMER - char myflags = flags&(~3); -#endif - - flags &= 3; - - i = strlen(filename)-1; - if (filename[i] == 255) { filename[i] = 0; flags = 1; } // JBF 20040119: "compatibility" - if ((fil = kopen4load(filename,flags)) == -1) - { mapversion = 7L; return(-1); } - - kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion); - if (mapversion != 7L && mapversion != 8L) { kclose(fil); return(-2); } - - /* - // Enable this for doing map checksum tests - clearbufbyte(&wall, sizeof(wall), 0); - clearbufbyte(§or, sizeof(sector), 0); - clearbufbyte(&sprite, sizeof(sprite), 0); - */ - -#ifdef NEDMALLOC - nedtrimthreadcache(0, 0); -#endif - - initspritelists(); - -#define MYMAXSECTORS (mapversion==7l?MAXSECTORSV7:MAXSECTORSV8) -#define MYMAXWALLS (mapversion==7l?MAXWALLSV7:MAXWALLSV8) -#define MYMAXSPRITES (mapversion==7l?MAXSPRITESV7:MAXSPRITESV8) - - clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L); - clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L); - clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L); - - kread(fil,daposx,4); *daposx = B_LITTLE32(*daposx); - kread(fil,daposy,4); *daposy = B_LITTLE32(*daposy); - kread(fil,daposz,4); *daposz = B_LITTLE32(*daposz); - kread(fil,daang,2); *daang = B_LITTLE16(*daang); - kread(fil,dacursectnum,2); *dacursectnum = B_LITTLE16(*dacursectnum); - - kread(fil,&numsectors,2); numsectors = B_LITTLE16(numsectors); - if (numsectors > MYMAXSECTORS) { kclose(fil); return(-1); } - kread(fil,§or[0],sizeof(sectortype)*numsectors); - for (i=numsectors-1; i>=0; i--) - { - sector[i].wallptr = B_LITTLE16(sector[i].wallptr); - sector[i].wallnum = B_LITTLE16(sector[i].wallnum); - sector[i].ceilingz = B_LITTLE32(sector[i].ceilingz); - sector[i].floorz = B_LITTLE32(sector[i].floorz); - sector[i].ceilingstat = B_LITTLE16(sector[i].ceilingstat); - sector[i].floorstat = B_LITTLE16(sector[i].floorstat); - sector[i].ceilingpicnum = B_LITTLE16(sector[i].ceilingpicnum); - sector[i].ceilingheinum = B_LITTLE16(sector[i].ceilingheinum); - sector[i].floorpicnum = B_LITTLE16(sector[i].floorpicnum); - sector[i].floorheinum = B_LITTLE16(sector[i].floorheinum); - sector[i].lotag = B_LITTLE16(sector[i].lotag); - sector[i].hitag = B_LITTLE16(sector[i].hitag); - sector[i].extra = B_LITTLE16(sector[i].extra); - } - - kread(fil,&numwalls,2); numwalls = B_LITTLE16(numwalls); - if (numwalls > MYMAXWALLS) { kclose(fil); return(-1); } - kread(fil,&wall[0],sizeof(walltype)*numwalls); - for (i=numwalls-1; i>=0; i--) - { - wall[i].x = B_LITTLE32(wall[i].x); - wall[i].y = B_LITTLE32(wall[i].y); - wall[i].point2 = B_LITTLE16(wall[i].point2); - wall[i].nextwall = B_LITTLE16(wall[i].nextwall); - wall[i].nextsector = B_LITTLE16(wall[i].nextsector); - wall[i].cstat = B_LITTLE16(wall[i].cstat); - wall[i].picnum = B_LITTLE16(wall[i].picnum); - wall[i].overpicnum = B_LITTLE16(wall[i].overpicnum); - wall[i].lotag = B_LITTLE16(wall[i].lotag); - wall[i].hitag = B_LITTLE16(wall[i].hitag); - wall[i].extra = B_LITTLE16(wall[i].extra); - } - - kread(fil,&numsprites,2); numsprites = B_LITTLE16(numsprites); - if (numsprites > MYMAXSPRITES) { kclose(fil); return(-1); } - kread(fil,&sprite[0],sizeof(spritetype)*numsprites); - for (i=numsprites-1; i>=0; i--) - { - sprite[i].x = B_LITTLE32(sprite[i].x); - sprite[i].y = B_LITTLE32(sprite[i].y); - sprite[i].z = B_LITTLE32(sprite[i].z); - sprite[i].cstat = B_LITTLE16(sprite[i].cstat); - sprite[i].picnum = B_LITTLE16(sprite[i].picnum); - sprite[i].sectnum = B_LITTLE16(sprite[i].sectnum); - sprite[i].statnum = B_LITTLE16(sprite[i].statnum); - sprite[i].ang = B_LITTLE16(sprite[i].ang); - sprite[i].owner = B_LITTLE16(sprite[i].owner); - sprite[i].xvel = B_LITTLE16(sprite[i].xvel); - sprite[i].yvel = B_LITTLE16(sprite[i].yvel); - sprite[i].zvel = B_LITTLE16(sprite[i].zvel); - sprite[i].lotag = B_LITTLE16(sprite[i].lotag); - sprite[i].hitag = B_LITTLE16(sprite[i].hitag); - sprite[i].extra = B_LITTLE16(sprite[i].extra); - - if (sprite[i].sectnum<0||sprite[i].sectnum>=MYMAXSECTORS) - { - initprintf(OSD_ERROR "Map error: sprite #%d(%d,%d) with illegal sector(%d). Map is corrupt!\n",i,sprite[i].x,sprite[i].y,sprite[i].sectnum); - updatesector(sprite[i].x, sprite[i].y, &sprite[i].sectnum); - } - - if (sprite[i].picnum<0||sprite[i].picnum>=MAXTILES) - { - initprintf(OSD_ERROR "Map error: sprite #%d(%d,%d) with illegal picnum(%d). Map is corrupt!\n",i,sprite[i].x,sprite[i].y,sprite[i].picnum); - dq[dnum++] = i; - sprite[i].picnum = 0; - } - } - - for (i=0; i= 0; ii--) - { - for (jj=32; jj >= 0; jj--) - { - updatesector(sprite[k].x+ii-16, sprite[k].y+jj-16, §); - if (sect != -1) break; - } - if (sect != -1) break; - } - - / * fuck it, the sprite is clearly not legitimately in any sector at this point - so let's queue it up for deletion * / - if (sect == -1) - dq[dnum++] = k; - } - */ - } - - /* - while (dnum--) - { - initprintf(OSD_ERROR "Map error: removing sprite #%d(%d,%d) in null space. Map is corrupt!\n",dq[dnum],sprite[dq[dnum]].x,sprite[dq[dnum]].y); - deletesprite(dq[dnum]); - } - */ - - //Must be after loading sectors, etc! - updatesector(*daposx,*daposy,dacursectnum); - - kclose(fil); - - if (!quickloadboard) - { - Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); - -#ifdef USE_OPENGL - Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); - -// polymost_cachesync(); - -# ifdef POLYMER - if (rendmode == 4) - { - if ((myflags&4)==0) - polymer_loadboard(); - } -#endif -#endif - } - guniqhudid = 0; - - startposx = *daposx; - startposy = *daposy; - startposz = *daposz; - startang = *daang; - startsectnum = *dacursectnum; - - return(0); -} - - -// -// loadboardv5/6 -// -#pragma pack(push,1) -struct sectortypev5 -{ - uint16_t wallptr, wallnum; - int16_t ceilingpicnum, floorpicnum; - int16_t ceilingheinum, floorheinum; - int32_t ceilingz, floorz; - int8_t ceilingshade, floorshade; - char ceilingxpanning, floorxpanning; - char ceilingypanning, floorypanning; - char ceilingstat, floorstat; - char ceilingpal, floorpal; - char visibility; - int16_t lotag, hitag; - int16_t extra; -}; -struct walltypev5 -{ - int32_t x, y; - int16_t point2; - int16_t picnum, overpicnum; - int8_t shade; - int16_t cstat; - char xrepeat, yrepeat, xpanning, ypanning; - int16_t nextsector1, nextwall1; - int16_t nextsector2, nextwall2; - int16_t lotag, hitag; - int16_t extra; -}; -struct spritetypev5 -{ - int32_t x, y, z; - char cstat; - int8_t shade; - char xrepeat, yrepeat; - int16_t picnum, ang, xvel, yvel, zvel, owner; - int16_t sectnum, statnum; - int16_t lotag, hitag; - int16_t extra; -}; -struct sectortypev6 -{ - uint16_t wallptr, wallnum; - int16_t ceilingpicnum, floorpicnum; - int16_t ceilingheinum, floorheinum; - int32_t ceilingz, floorz; - int8_t ceilingshade, floorshade; - char ceilingxpanning, floorxpanning; - char ceilingypanning, floorypanning; - char ceilingstat, floorstat; - char ceilingpal, floorpal; - char visibility; - int16_t lotag, hitag, extra; -}; -struct walltypev6 -{ - int32_t x, y; - int16_t point2, nextsector, nextwall; - int16_t picnum, overpicnum; - int8_t shade; - char pal; - int16_t cstat; - char xrepeat, yrepeat, xpanning, ypanning; - int16_t lotag, hitag, extra; -}; -struct spritetypev6 -{ - int32_t x, y, z; - int16_t cstat; - int8_t shade; - char pal, clipdist; - char xrepeat, yrepeat; - int8_t xoffset, yoffset; - int16_t picnum, ang, xvel, yvel, zvel, owner; - int16_t sectnum, statnum; - int16_t lotag, hitag, extra; -}; -#pragma pack(pop) - -static int16_t sectorofwallv5(int16_t theline) -{ - int16_t i, startwall, endwall, sucksect; - - sucksect = -1; - for (i=0; i= startwall) && (theline <= endwall)) - { - sucksect = i; - break; - } - } - return(sucksect); -} - -static void convertv5sectv6(struct sectortypev5 *from, struct sectortypev6 *to) -{ - to->wallptr = from->wallptr; - to->wallnum = from->wallnum; - to->ceilingpicnum = from->ceilingpicnum; - to->floorpicnum = from->floorpicnum; - to->ceilingheinum = from->ceilingheinum; - to->floorheinum = from->floorheinum; - to->ceilingz = from->ceilingz; - to->floorz = from->floorz; - to->ceilingshade = from->ceilingshade; - to->floorshade = from->floorshade; - to->ceilingxpanning = from->ceilingxpanning; - to->floorxpanning = from->floorxpanning; - to->ceilingypanning = from->ceilingypanning; - to->floorypanning = from->floorypanning; - to->ceilingstat = from->ceilingstat; - to->floorstat = from->floorstat; - to->ceilingpal = from->ceilingpal; - to->floorpal = from->floorpal; - to->visibility = from->visibility; - to->lotag = from->lotag; - to->hitag = from->hitag; - to->extra = from->extra; -} - -static void convertv5wallv6(struct walltypev5 *from, struct walltypev6 *to, int32_t i) -{ - to->x = from->x; - to->y = from->y; - to->point2 = from->point2; - to->nextsector = from->nextsector1; - to->nextwall = from->nextwall1; - to->picnum = from->picnum; - to->overpicnum = from->overpicnum; - to->shade = from->shade; - to->pal = sector[sectorofwallv5((int16_t)i)].floorpal; - to->cstat = from->cstat; - to->xrepeat = from->xrepeat; - to->yrepeat = from->yrepeat; - to->xpanning = from->xpanning; - to->ypanning = from->ypanning; - to->lotag = from->lotag; - to->hitag = from->hitag; - to->extra = from->extra; -} - -static void convertv5sprv6(struct spritetypev5 *from, struct spritetypev6 *to) -{ - int16_t j; - to->x = from->x; - to->y = from->y; - to->z = from->z; - to->cstat = from->cstat; - to->shade = from->shade; - - j = from->sectnum; - if ((sector[j].ceilingstat&1) > 0) - to->pal = sector[j].ceilingpal; - else - to->pal = sector[j].floorpal; - - to->clipdist = 32; - to->xrepeat = from->xrepeat; - to->yrepeat = from->yrepeat; - to->xoffset = 0; - to->yoffset = 0; - to->picnum = from->picnum; - to->ang = from->ang; - to->xvel = from->xvel; - to->yvel = from->yvel; - to->zvel = from->zvel; - to->owner = from->owner; - to->sectnum = from->sectnum; - to->statnum = from->statnum; - to->lotag = from->lotag; - to->hitag = from->hitag; - to->extra = from->extra; -} - -static void convertv6sectv7(struct sectortypev6 *from, sectortype *to) -{ - to->ceilingz = from->ceilingz; - to->floorz = from->floorz; - to->wallptr = from->wallptr; - to->wallnum = from->wallnum; - to->ceilingpicnum = from->ceilingpicnum; - to->ceilingheinum = max(min(((int32_t)from->ceilingheinum)<<5,32767),-32768); - if ((from->ceilingstat&2) == 0) to->ceilingheinum = 0; - to->ceilingshade = from->ceilingshade; - to->ceilingpal = from->ceilingpal; - to->ceilingxpanning = from->ceilingxpanning; - to->ceilingypanning = from->ceilingypanning; - to->floorpicnum = from->floorpicnum; - to->floorheinum = max(min(((int32_t)from->floorheinum)<<5,32767),-32768); - if ((from->floorstat&2) == 0) to->floorheinum = 0; - to->floorshade = from->floorshade; - to->floorpal = from->floorpal; - to->floorxpanning = from->floorxpanning; - to->floorypanning = from->floorypanning; - to->ceilingstat = from->ceilingstat; - to->floorstat = from->floorstat; - to->visibility = from->visibility; - to->filler = 0; - to->lotag = from->lotag; - to->hitag = from->hitag; - to->extra = from->extra; -} - -static void convertv6wallv7(struct walltypev6 *from, walltype *to) -{ - to->x = from->x; - to->y = from->y; - to->point2 = from->point2; - to->nextwall = from->nextwall; - to->nextsector = from->nextsector; - to->cstat = from->cstat; - to->picnum = from->picnum; - to->overpicnum = from->overpicnum; - to->shade = from->shade; - to->pal = from->pal; - to->xrepeat = from->xrepeat; - to->yrepeat = from->yrepeat; - to->xpanning = from->xpanning; - to->ypanning = from->ypanning; - to->lotag = from->lotag; - to->hitag = from->hitag; - to->extra = from->extra; -} - -static void convertv6sprv7(struct spritetypev6 *from, spritetype *to) -{ - to->x = from->x; - to->y = from->y; - to->z = from->z; - to->cstat = from->cstat; - to->picnum = from->picnum; - to->shade = from->shade; - to->pal = from->pal; - to->clipdist = from->clipdist; - to->filler = 0; - to->xrepeat = from->xrepeat; - to->yrepeat = from->yrepeat; - to->xoffset = from->xoffset; - to->yoffset = from->yoffset; - to->sectnum = from->sectnum; - to->statnum = from->statnum; - to->ang = from->ang; - to->owner = from->owner; - to->xvel = from->xvel; - to->yvel = from->yvel; - to->zvel = from->zvel; - to->lotag = from->lotag; - to->hitag = from->hitag; - to->extra = from->extra; -} - -// Powerslave uses v6 -// Witchaven 1 and TekWar and LameDuke use v5 -int32_t loadoldboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, - int16_t *daang, int16_t *dacursectnum) -{ - int16_t fil, i, numsprites; - struct sectortypev5 v5sect; - struct walltypev5 v5wall; - struct spritetypev5 v5spr; - struct sectortypev6 v6sect; - struct walltypev6 v6wall; - struct spritetypev6 v6spr; - - i = strlen(filename)-1; - if (filename[i] == 255) { filename[i] = 0; fromwhere = 1; } // JBF 20040119: "compatibility" - if ((fil = kopen4load(filename,fromwhere)) == -1) - { mapversion = 5L; return(-1); } - - kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion); - if (mapversion != 5L && mapversion != 6L) { kclose(fil); return(-2); } - - initspritelists(); - - clearbuf(&show2dsector[0],(int32_t)((MAXSECTORS+3)>>5),0L); - clearbuf(&show2dsprite[0],(int32_t)((MAXSPRITES+3)>>5),0L); - clearbuf(&show2dwall[0],(int32_t)((MAXWALLS+3)>>5),0L); - - kread(fil,daposx,4); *daposx = B_LITTLE32(*daposx); - kread(fil,daposy,4); *daposy = B_LITTLE32(*daposy); - kread(fil,daposz,4); *daposz = B_LITTLE32(*daposz); - kread(fil,daang,2); *daang = B_LITTLE16(*daang); - kread(fil,dacursectnum,2); *dacursectnum = B_LITTLE16(*dacursectnum); - - kread(fil,&numsectors,2); numsectors = B_LITTLE16(numsectors); - if (numsectors > MAXSECTORS) { kclose(fil); return(-1); } - for (i=0; i MAXWALLS) { kclose(fil); return(-1); } - for (i=0; i MAXSPRITES) { kclose(fil); return(-1); } - for (i=0; iltextptr; - - if (!filename && legaltokens[i].tokenid != T_LIGHT) continue; - - switch (legaltokens[i].tokenid) - { - case T_SPRITE: // sprite - if (scriptfile_getnumber(script, &whichsprite)) break; - - if ((unsigned)whichsprite >= (unsigned)MAXSPRITES) - { - // sprite number out of range - initprintf("Sprite number out of range 0-%d on line %s:%d\n", - MAXSPRITES-1,script->filename, scriptfile_getlinum(script,cmdtokptr)); - whichsprite = -1; - break; - } - - break; - case T_ANGOFF: // angoff - { - int32_t ang; - if (scriptfile_getnumber(script, &ang)) break; - - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring angle offset directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].angoff = (int16_t)ang; - } - break; - case T_NOMODEL: // notmd - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring not-MD2/MD3 directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].flags |= SPREXT_NOTMD; - break; - case T_NOANIM: // nomdanim - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring no-MD2/MD3-anim directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].flags |= SPREXT_NOMDANIM; - break; - case T_PITCH: // pitch - { - int32_t pitch; - if (scriptfile_getnumber(script, &pitch)) break; - - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring pitch directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].pitch = (int16_t)pitch; - } - break; - case T_ROLL: // roll - { - int32_t roll; - if (scriptfile_getnumber(script, &roll)) break; - - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring roll directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].roll = (int16_t)roll; - } - break; - case T_MDXOFF: // mdxoff - { - int32_t i; - if (scriptfile_getnumber(script, &i)) break; - - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring mdxoff directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].xoff = i; - } - break; - case T_MDYOFF: // mdyoff - { - int32_t i; - if (scriptfile_getnumber(script, &i)) break; - - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring mdyoff directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].yoff = i; - } - break; - case T_MDZOFF: // mdzoff - { - int32_t i; - if (scriptfile_getnumber(script, &i)) break; - - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring mdzoff directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].zoff = i; - } - break; - case T_AWAY1: // away1 - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring moving away directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].flags |= SPREXT_AWAY1; - break; - case T_AWAY2: // away2 - if (whichsprite < 0) - { - // no sprite directive preceeding - initprintf("Ignoring moving away directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].flags |= SPREXT_AWAY2; - break; -#ifdef POLYMER - case T_LIGHT: // light sector x y z range r g b radius faderadius angle horiz minshade maxshade priority tilenum - { - int32_t value; - int16_t lightid; -#pragma pack(push,1) - _prlight light; -#pragma pack(pop) - scriptfile_getnumber(script, &value); - light.sector = value; - scriptfile_getnumber(script, &value); - light.x = value; - scriptfile_getnumber(script, &value); - light.y = value; - scriptfile_getnumber(script, &value); - light.z = value; - scriptfile_getnumber(script, &value); - light.range = value; - scriptfile_getnumber(script, &value); - light.color[0] = value; - scriptfile_getnumber(script, &value); - light.color[1] = value; - scriptfile_getnumber(script, &value); - light.color[2] = value; - scriptfile_getnumber(script, &value); - light.radius = value; - scriptfile_getnumber(script, &value); - light.faderadius = value; - scriptfile_getnumber(script, &value); - light.angle = value; - scriptfile_getnumber(script, &value); - light.horiz = value; - scriptfile_getnumber(script, &value); - light.minshade = value; - scriptfile_getnumber(script, &value); - light.maxshade = value; - scriptfile_getnumber(script, &value); - light.priority = value; - scriptfile_getnumber(script, &value); - light.tilenum = value; - - if (rendmode == 4) - { - lightid = polymer_addlight(&light); - if (lightid>=0) - maphacklight[maphacklightcnt++] = lightid; - } - - break; - } -#endif // POLYMER - - default: - // unrecognised token - break; - } - } - - scriptfile_close(script); - return 0; -#else - UNREFERENCED_PARAMETER(filename); - return -1; -#endif -} - - -// -// saveboard -// -int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz, - int16_t *daang, int16_t *dacursectnum) -{ - int16_t fil, i, j, numsprites, ts; - int32_t tl; - sectortype *tsect = NULL; - walltype *twall = NULL; - spritetype *tspri = NULL; - sectortype *sec; - walltype *wal; - spritetype *spri; - - if ((fil = Bopen(filename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) - { - initprintf("Couldn't open \"%s\" for writing: %s\n", filename, strerror(errno)); - return(-1); - } - - for (j=0; jMAXSTATUS) - { - initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",j,sprite[j].x,sprite[j].y,sprite[j].statnum); - changespritestat(j,0); - } - - numsprites = 0; -#if 0 - for (j=0; j MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7) - mapversion = 8; - else - mapversion = 7; - tl = B_LITTLE32(mapversion); Bwrite(fil,&tl,4); - - tl = B_LITTLE32(*daposx); Bwrite(fil,&tl,4); - tl = B_LITTLE32(*daposy); Bwrite(fil,&tl,4); - tl = B_LITTLE32(*daposz); Bwrite(fil,&tl,4); - ts = B_LITTLE16(*daang); Bwrite(fil,&ts,2); - ts = B_LITTLE16(*dacursectnum); Bwrite(fil,&ts,2); - - ts = B_LITTLE16(numsectors); Bwrite(fil,&ts,2); - - while (1) - { - tsect = (sectortype *)Bmalloc(sizeof(sectortype) * numsectors); - - if (tsect == NULL) - break; - - Bmemcpy(&tsect[0], §or[0], sizeof(sectortype) * numsectors); - - for (i=0; iwallptr = B_LITTLE16(sec->wallptr); - sec->wallnum = B_LITTLE16(sec->wallnum); - sec->ceilingz = B_LITTLE32(sec->ceilingz); - sec->floorz = B_LITTLE32(sec->floorz); - sec->ceilingstat = B_LITTLE16(sec->ceilingstat); - sec->floorstat = B_LITTLE16(sec->floorstat); - sec->ceilingpicnum = B_LITTLE16(sec->ceilingpicnum); - sec->ceilingheinum = B_LITTLE16(sec->ceilingheinum); - sec->floorpicnum = B_LITTLE16(sec->floorpicnum); - sec->floorheinum = B_LITTLE16(sec->floorheinum); - sec->lotag = B_LITTLE16(sec->lotag); - sec->hitag = B_LITTLE16(sec->hitag); - sec->extra = B_LITTLE16(sec->extra); - } - - Bwrite(fil,&tsect[0],sizeof(sectortype) * numsectors); - Bfree(tsect); - - ts = B_LITTLE16(numwalls); - Bwrite(fil,&ts,2); - - twall = (walltype *)Bmalloc(sizeof(walltype) * numwalls); - - if (twall == NULL) - break; - - Bmemcpy(&twall[0], &wall[0], sizeof(walltype) * numwalls); - - for (i=0; ix = B_LITTLE32(wal->x); - wal->y = B_LITTLE32(wal->y); - wal->point2 = B_LITTLE16(wal->point2); - wal->nextwall = B_LITTLE16(wal->nextwall); - wal->nextsector = B_LITTLE16(wal->nextsector); - wal->cstat = B_LITTLE16(wal->cstat); - wal->picnum = B_LITTLE16(wal->picnum); - wal->overpicnum = B_LITTLE16(wal->overpicnum); - wal->lotag = B_LITTLE16(wal->lotag); - wal->hitag = B_LITTLE16(wal->hitag); - wal->extra = B_LITTLE16(wal->extra); - } - - Bwrite(fil,&twall[0],sizeof(walltype) * numwalls); - Bfree(twall); - - ts = B_LITTLE16(numsprites); Bwrite(fil,&ts,2); - - tspri = (spritetype *)Bmalloc(sizeof(spritetype) * numsprites); - - if (tspri == NULL) - break; - - - spri=tspri; - - for (j=0; jx = B_LITTLE32(spri->x); - spri->y = B_LITTLE32(spri->y); - spri->z = B_LITTLE32(spri->z); - spri->cstat = B_LITTLE16(spri->cstat); - spri->picnum = B_LITTLE16(spri->picnum); - spri->sectnum = B_LITTLE16(spri->sectnum); - spri->statnum = B_LITTLE16(spri->statnum); - spri->ang = B_LITTLE16(spri->ang); - spri->owner = B_LITTLE16(spri->owner); - spri->xvel = B_LITTLE16(spri->xvel); - spri->yvel = B_LITTLE16(spri->yvel); - spri->zvel = B_LITTLE16(spri->zvel); - spri->lotag = B_LITTLE16(spri->lotag); - spri->hitag = B_LITTLE16(spri->hitag); - spri->extra = B_LITTLE16(spri->extra); - spri++; - } - } - - Bwrite(fil,&tspri[0],sizeof(spritetype) * numsprites); - Bfree(tspri); - - Bclose(fil); - return(0); - } - - Bclose(fil); - - if (tsect != NULL) - Bfree(tsect); - - if (twall != NULL) - Bfree(twall); - - if (tspri != NULL) - Bfree(tspri); - - return(-1); -} - - -// -// setgamemode -// -// JBF: davidoption now functions as a windowed-mode flag (0 == windowed, 1 == fullscreen) -extern char videomodereset; -int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp) -{ - int32_t i, j; - -#ifdef USE_OPENGL - extern char nogl; - - if (nogl) dabpp = 8; -#endif - if ((qsetmode == 200) && (videomodereset == 0) && - (davidoption == fullscreen) && (xdim == daxdim) && (ydim == daydim) && (bpp == dabpp) - /* - #ifdef POLYMER - && glrendmode != 4 - #endif // POLYMER - */ - ) - return(0); - - strcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI. (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!"); - // if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4) - // { OSD_Printf("Nice try.\n"); exit(0); } - - //if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1); - - //bytesperline is set in this function - - j = bpp; - - if (setvideomode(daxdim,daydim,dabpp,davidoption) < 0) return(-1); - - // Workaround possible bugs in the GL driver - makeasmwriteable(); - -#ifdef USE_OPENGL - if (dabpp > 8) rendmode = glrendmode; // GL renderer - else if (dabpp == 8 && j > 8) rendmode = 0; // going from GL to software activates softpolymost -#endif - - xdim = daxdim; ydim = daydim; - - j = ydim*4*sizeof(intptr_t); //Leave room for horizlookup&horizlookup2 - - if (lookups != NULL) - { - if (lookupsalloctype == 0) Bfree((void *)lookups); - if (lookupsalloctype == 1) suckcache(lookups); - lookups = NULL; - } - lookupsalloctype = 0; - if ((lookups = (intptr_t *)Bmalloc(j<<1)) == NULL) - { - allocache((intptr_t *)&lookups,j<<1,&permanentlock); - lookupsalloctype = 1; - } - - horizlookup = lookups; - horizlookup2 = (intptr_t *)((intptr_t)lookups+j); // FIXME_SA - horizycent = ((ydim*4)>>1); - - //Force drawrooms to call dosetaspect & recalculate stuff - oxyaspect = oxdimen = oviewingrange = -1; - - setvlinebpl(bytesperline); - j = 0; - for (i=0; i<=ydim; i++) ylookup[i] = j, j += bytesperline; - - setview(0L,0L,xdim-1,ydim-1); - clearallviews(0L); - setbrightness(curbrightness,0,0); - - if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); } - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - polymost_glreset(); - polymost_glinit(); - } -# ifdef POLYMER - if (rendmode == 4) - { - if (!polymer_init()) - rendmode = 3; - } -#endif -#endif - qsetmode = 200; - return(0); -} - - -// -// nextpage -// -void nextpage(void) -{ - int32_t i; - permfifotype *per; - - //char snotbuf[32]; - //j = 0; k = 0; - //for(i=0;i<4096;i++) - // if (waloff[i] != 0) - // { - // sprintf(snotbuf,"%d-%d",i,tilesizx[i]*tilesizy[i]); - // printext256((j>>5)*40+32,(j&31)*6,walock[i]>>3,-1,snotbuf,1); - // k += tilesizx[i]*tilesizy[i]; - // j++; - // } - //sprintf(snotbuf,"Total: %d",k); - //printext256((j>>5)*40+32,(j&31)*6,31,-1,snotbuf,1); - - switch (qsetmode) - { - case 200: - begindrawing(); //{{{ - for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) - { - per = &permfifo[i]; - if ((per->pagesleft > 0) && (per->pagesleft <= numpages)) - dorotatesprite(per->sx,per->sy,per->z,per->a,per->picnum, - per->dashade,per->dapalnum,per->dastat, - per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid); - } - enddrawing(); //}}} - - OSD_Draw(); - showframe(0); - - begindrawing(); //{{{ - for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) - { - per = &permfifo[i]; - if (per->pagesleft >= 130) - dorotatesprite(per->sx,per->sy,per->z,per->a,per->picnum, - per->dashade,per->dapalnum,per->dastat, - per->cx1,per->cy1,per->cx2,per->cy2,per->uniqid); - - if (per->pagesleft&127) per->pagesleft--; - if (((per->pagesleft&127) == 0) && (i == permtail)) - permtail = ((permtail+1)&(MAXPERMS-1)); - } - enddrawing(); //}}} - break; - - case 350: - case 480: - break; - } - faketimerhandler(); - - if ((totalclock >= lastageclock+CACHEAGETIME) || (totalclock < lastageclock)) - { lastageclock = totalclock; agecache(); } - -#ifdef USE_OPENGL - omdtims = mdtims; mdtims = getticks(); - - { - int32_t i; - for (i=0; i>5),0L); - - //cachesize = min((int32_t)((Bgetsysmemsize()/100)*60),max(artsize,askedsize)); - if (Bgetsysmemsize() <= (uint32_t)askedsize) - cachesize = (Bgetsysmemsize()/100)*60; - else - cachesize = askedsize; - - while ((pic = Bmalloc(cachesize)) == NULL) - { - cachesize -= 65536L; - if (cachesize < 65536) return(-1); - } - initcache((intptr_t) pic, cachesize); - - for (i=0; i 1) && (pow2long[j] > tilesizx[i])) j--; - picsiz[i] = ((uint8_t)j); - j = 15; - while ((j > 1) && (pow2long[j] > tilesizy[i])) j--; - picsiz[i] += ((uint8_t)(j<<4)); - } - - artfil = -1; - artfilnum = -1; - artfilplc = 0L; - - return(0); -} - - -// -// loadtile -// -void loadtile(int16_t tilenume) -{ - int32_t i, dasiz; - - if ((unsigned)tilenume >= (unsigned)MAXTILES) return; - if ((dasiz = tilesizx[tilenume]*tilesizy[tilenume]) <= 0) return; - -#ifdef WITHKPLIB - if (artptrs[(i = tilefilenum[tilenume])]) // from zip - { - waloff[tilenume] = (intptr_t)(artptrs[i]) + tilefileoffs[tilenume]; - faketimerhandler(); - // OSD_Printf("loaded tile %d from zip\n", tilenume); - return; - } -#endif - - if (i != artfilnum) - { - if (artfil != -1) kclose(artfil); - artfilnum = i; - artfilplc = 0L; - - artfilename[7] = (i%10)+48; - artfilename[6] = ((i/10)%10)+48; - artfilename[5] = ((i/100)%10)+48; - artfil = kopen4load(artfilename,0); - faketimerhandler(); - } - - if (cachedebug) OSD_Printf("Tile:%d\n",tilenume); - - // dummy tiles for highres replacements and tilefromtexture definitions - if (faketilesiz[tilenume]) - { - if (faketilesiz[tilenume] == -1) - { - walock[tilenume] = 255; // permanent tile - allocache(&waloff[tilenume], dasiz, &walock[tilenume]); - Bmemset((char *)waloff[tilenume],0,dasiz); - } - else if (faketiledata[tilenume] != NULL) - { - walock[tilenume] = 255; - allocache(&waloff[tilenume], dasiz, &walock[tilenume]); - qlz_decompress(faketiledata[tilenume], (char *)waloff[tilenume], state_decompress); - Bfree(faketiledata[tilenume]); - faketiledata[tilenume] = NULL; - } - - faketimerhandler(); - return; - } - - if (waloff[tilenume] == 0) - { - walock[tilenume] = 199; - allocache(&waloff[tilenume],dasiz,&walock[tilenume]); - } - - if (artfilplc != tilefileoffs[tilenume]) - { - klseek(artfil,tilefileoffs[tilenume]-artfilplc,BSEEK_CUR); - faketimerhandler(); - } - - kread(artfil, (char *)waloff[tilenume], dasiz); - faketimerhandler(); - artfilplc = tilefileoffs[tilenume]+dasiz; -} - -// -// allocatepermanenttile -// -int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz) -{ - int32_t j, dasiz; - - if ((xsiz <= 0) || (ysiz <= 0) || ((unsigned)tilenume >= (unsigned)MAXTILES)) - return(0); - - dasiz = xsiz*ysiz; - - walock[tilenume] = 255; - allocache(&waloff[tilenume],dasiz,&walock[tilenume]); - - tilesizx[tilenume] = xsiz; - tilesizy[tilenume] = ysiz; - picanm[tilenume] = 0; - - j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; - picsiz[tilenume] = ((uint8_t)j); - j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; - picsiz[tilenume] += ((uint8_t)(j<<4)); - - return(waloff[tilenume]); -} - - -// -// copytilepiece -// -void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, - int32_t tilenume2, int32_t sx2, int32_t sy2) -{ - char *ptr1, *ptr2, dat; - int32_t xsiz1, ysiz1, xsiz2, ysiz2, i, j, x1, y1, x2, y2; - - xsiz1 = tilesizx[tilenume1]; ysiz1 = tilesizy[tilenume1]; - xsiz2 = tilesizx[tilenume2]; ysiz2 = tilesizy[tilenume2]; - if ((xsiz1 > 0) && (ysiz1 > 0) && (xsiz2 > 0) && (ysiz2 > 0)) - { - if (waloff[tilenume1] == 0) loadtile(tilenume1); - if (waloff[tilenume2] == 0) loadtile(tilenume2); - - x1 = sx1; - for (i=0; i= 0) && (y2 >= 0) && (x2 < xsiz2) && (y2 < ysiz2)) - { - ptr1 = (char *)(waloff[tilenume1] + x1*ysiz1 + y1); - ptr2 = (char *)(waloff[tilenume2] + x2*ysiz2 + y2); - dat = *ptr1; - if (dat != 255) - *ptr2 = *ptr1; - } - - y1++; if (y1 >= ysiz1) y1 = 0; - } - x1++; if (x1 >= xsiz1) x1 = 0; - } - } -} - - -// -// qloadkvx -// -int32_t qloadkvx(int32_t voxindex, const char *filename) -{ - int32_t i, fil, dasiz, lengcnt, lengtot; - char *ptr; - - if ((fil = kopen4load(filename,0)) == -1) return -1; - - lengcnt = 0; - lengtot = kfilelength(fil); - - for (i=0; i= lengtot-768) break; - } - kclose(fil); - -#ifdef USE_OPENGL - if (voxmodels[voxindex]) - { - voxfree(voxmodels[voxindex]); - voxmodels[voxindex] = NULL; - } - voxmodels[voxindex] = voxload(filename); -#endif - return 0; -} - - -// -// clipinsidebox -// -int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist) -{ - walltype *wal; - int32_t x1, y1, x2, y2, r; - - r = (walldist<<1); - wal = &wall[wallnum]; x1 = wal->x+walldist-x; y1 = wal->y+walldist-y; - wal = &wall[wal->point2]; x2 = wal->x+walldist-x; y2 = wal->y+walldist-y; - - if ((x1 < 0) && (x2 < 0)) return(0); - if ((y1 < 0) && (y2 < 0)) return(0); - if ((x1 >= r) && (x2 >= r)) return(0); - if ((y1 >= r) && (y2 >= r)) return(0); - - x2 -= x1; y2 -= y1; - if (x2*(walldist-y1) >= y2*(walldist-x1)) //Front - { - if (x2 > 0) x2 *= (0-y1); else x2 *= (r-y1); - if (y2 > 0) y2 *= (r-x1); else y2 *= (0-x1); - return(x2 < y2); - } - if (x2 > 0) x2 *= (r-y1); else x2 *= (0-y1); - if (y2 > 0) y2 *= (0-x1); else y2 *= (r-x1); - return((x2 >= y2)<<1); -} - - -// -// clipinsideboxline -// -int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t walldist) -{ - int32_t r; - - r = (walldist<<1); - - x1 += walldist-x; x2 += walldist-x; - if ((x1 < 0) && (x2 < 0)) return(0); - if ((x1 >= r) && (x2 >= r)) return(0); - - y1 += walldist-y; y2 += walldist-y; - if ((y1 < 0) && (y2 < 0)) return(0); - if ((y1 >= r) && (y2 >= r)) return(0); - - x2 -= x1; y2 -= y1; - if (x2*(walldist-y1) >= y2*(walldist-x1)) //Front - { - if (x2 > 0) x2 *= (0-y1); else x2 *= (r-y1); - if (y2 > 0) y2 *= (r-x1); else y2 *= (0-x1); - return(x2 < y2); - } - if (x2 > 0) x2 *= (r-y1); else x2 *= (0-y1); - if (y2 > 0) y2 *= (0-x1); else y2 *= (r-x1); - return((x2 >= y2)<<1); -} - - -// -// inside -// -int32_t inside(int32_t x, int32_t y, int16_t sectnum) -{ - walltype *wal; - int32_t i, x1, y1, x2, y2; - uint32_t cnt; - - if ((sectnum < 0) || (sectnum >= numsectors)) return(-1); - - cnt = 0; - wal = &wall[sector[sectnum].wallptr]; - i = sector[sectnum].wallnum; - do - { - y1 = wal->y-y; y2 = wall[wal->point2].y-y; - if ((y1^y2) < 0) - { - x1 = wal->x-x; x2 = wall[wal->point2].x-x; - if ((x1^x2) >= 0) cnt ^= x1; else cnt ^= (x1*y2-x2*y1)^y2; - } - wal++; i--; - } - while (i); - return(cnt>>31); -} - - -// -// ksqrt -// -int32_t ksqrt(int32_t num) -{ - return(nsqrtasm(num)); -} - - -// -// krecip -// -int32_t krecip(int32_t num) -{ - return(krecipasm(num)); -} - -int32_t spriteheight(int16_t i, int32_t *basez) -{ - int32_t hei, flooraligned=((sprite[i].cstat&48)==32); - - if (flooraligned) - { - if (basez) - *basez = sprite[i].z; - return 0; - } - - hei = (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2; - if (basez) - { - *basez = sprite[i].z; - if (sprite[i].cstat&128) - *basez -= (hei>>1); - } - return hei; -} - -// -// setsprite -// -int32_t setsprite(int16_t spritenum, const vec3_t *new) -{ - int16_t tempsectnum = sprite[spritenum].sectnum; - - if ((void *)new != (void *)&sprite[spritenum]) - Bmemcpy(&sprite[spritenum], new, sizeof(vec3_t)); - - updatesector(new->x,new->y,&tempsectnum); - - if (tempsectnum < 0) - return(-1); - if (tempsectnum != sprite[spritenum].sectnum) - changespritesect(spritenum,tempsectnum); - - return(0); -} - -int32_t setspritez(int16_t spritenum, const vec3_t *new) -{ - int16_t tempsectnum = sprite[spritenum].sectnum; - - if ((void *)new != (void *)&sprite[spritenum]) - Bmemcpy(&sprite[spritenum], new, sizeof(vec3_t)); - - updatesectorz(new->x,new->y,new->z,&tempsectnum); - - if (tempsectnum < 0) - return(-1); - if (tempsectnum != sprite[spritenum].sectnum) - changespritesect(spritenum,tempsectnum); - - return(0); -} - -// -// changespritesect -// -int32_t changespritesect(int16_t spritenum, int16_t newsectnum) -{ - if ((newsectnum < 0) || (newsectnum > MAXSECTORS)) return(-1); - if (sprite[spritenum].sectnum == newsectnum) return(0); - if (sprite[spritenum].sectnum == MAXSECTORS) return(-1); - if (deletespritesect(spritenum) < 0) return(-1); - insertspritesect(newsectnum); - return(0); -} - - -// -// changespritestat -// -int32_t changespritestat(int16_t spritenum, int16_t newstatnum) -{ - if ((newstatnum < 0) || (newstatnum > MAXSTATUS)) return(-1); - if (sprite[spritenum].statnum == newstatnum) return(0); - if (sprite[spritenum].statnum == MAXSTATUS) return(-1); - if (deletespritestat(spritenum) < 0) return(-1); - insertspritestat(newstatnum); - return(0); -} - - -// -// nextsectorneighborz -// -int32_t nextsectorneighborz(int16_t sectnum, int32_t thez, int16_t topbottom, int16_t direction) -{ - walltype *wal; - int32_t i, testz, nextz; - int16_t sectortouse; - - if (direction == 1) nextz = 0x7fffffff; else nextz = 0x80000000; - - sectortouse = -1; - - wal = &wall[sector[sectnum].wallptr]; - i = sector[sectnum].wallnum; - do - { - if (wal->nextsector >= 0) - { - if (topbottom == 1) - { - testz = sector[wal->nextsector].floorz; - if (direction == 1) - { - if ((testz > thez) && (testz < nextz)) - { - nextz = testz; - sectortouse = wal->nextsector; - } - } - else - { - if ((testz < thez) && (testz > nextz)) - { - nextz = testz; - sectortouse = wal->nextsector; - } - } - } - else - { - testz = sector[wal->nextsector].ceilingz; - if (direction == 1) - { - if ((testz > thez) && (testz < nextz)) - { - nextz = testz; - sectortouse = wal->nextsector; - } - } - else - { - if ((testz < thez) && (testz > nextz)) - { - nextz = testz; - sectortouse = wal->nextsector; - } - } - } - } - wal++; - i--; - } - while (i != 0); - - return(sectortouse); -} - - -// -// cansee -// -int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2) -{ - sectortype *sec; - walltype *wal, *wal2; - int32_t i, cnt, nexts, x, y, z, cz, fz, dasectnum, dacnt, danum; - int32_t x21, y21, z21, x31, y31, x34, y34, bot, t; - - if ((x1 == x2) && (y1 == y2)) return(sect1 == sect2); - - x21 = x2-x1; y21 = y2-y1; z21 = z2-z1; - - clipsectorlist[0] = sect1; danum = 1; - for (dacnt=0; dacntwallnum,wal=&wall[sec->wallptr]; cnt>0; cnt--,wal++) - { - wal2 = &wall[wal->point2]; - x31 = wal->x-x1; x34 = wal->x-wal2->x; - y31 = wal->y-y1; y34 = wal->y-wal2->y; - - bot = y21*x34-x21*y34; if (bot <= 0) continue; - t = y21*x31-x21*y31; if ((unsigned)t >= (unsigned)bot) continue; - t = y31*x34-x31*y34; if ((unsigned)t >= (unsigned)bot) continue; - - nexts = wal->nextsector; - if ((nexts < 0) || (wal->cstat&32)) return(0); - - t = divscale24(t,bot); - x = x1 + mulscale24(x21,t); - y = y1 + mulscale24(y21,t); - z = z1 + mulscale24(z21,t); - - getzsofslope((int16_t)dasectnum,x,y,&cz,&fz); - if ((z <= cz) || (z >= fz)) return(0); - getzsofslope((int16_t)nexts,x,y,&cz,&fz); - if ((z <= cz) || (z >= fz)) return(0); - - for (i=danum-1; i>=0; i--) if (clipsectorlist[i] == nexts) break; - if (i < 0) clipsectorlist[danum++] = nexts; - } - } - for (i=danum-1; i>=0; i--) if (clipsectorlist[i] == sect2) return(1); - return(0); -} - -// stat, heinum, z: either ceiling- or floor- -// how: -1: behave like ceiling, 1: behave like floor -static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdata_t *hitinfo, - int32_t vx, int32_t vy, int32_t vz, - int16_t stat, int16_t heinum, int32_t z, int32_t how, const intptr_t *tmp) -{ - int32_t x1 = 0x7fffffff, y1, z1; - int32_t dax, day, i, j; - walltype *wal, *wal2; - - if (stat&2) - { - wal = &wall[sec->wallptr]; wal2 = &wall[wal->point2]; - dax = wal2->x-wal->x; day = wal2->y-wal->y; - i = nsqrtasm(dax*dax+day*day); if (i == 0) return 1; //continue; - i = divscale15(heinum,i); - dax *= i; day *= i; - - j = (vz<<8)-dmulscale15(dax,vy,-day,vx); - if (j != 0) - { - i = ((z - sv->z)<<8)+dmulscale15(dax,sv->y-wal->y,-day,sv->x-wal->x); - if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j))) - { - i = divscale30(i,j); - x1 = sv->x + mulscale30(vx,i); - y1 = sv->y + mulscale30(vy,i); - z1 = sv->z + mulscale30(vz,i); - } - } - } - else if ((how*vz > 0) && (how*sv->z <= how*z)) - { - z1 = z; i = z1-sv->z; - if ((klabs(i)>>1) < vz*how) - { - i = divscale30(i,vz); - x1 = sv->x + mulscale30(vx,i); - y1 = sv->y + mulscale30(vy,i); - } - } - - if ((x1 != 0x7fffffff) && (klabs(x1-sv->x)+klabs(y1-sv->y) < klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y))) - { - if (tmp==NULL) - { - if (inside(x1,y1,sec-sector) != 0) - { - hitinfo->hitsect = sec-sector; hitinfo->hitwall = -1; hitinfo->hitsprite = -1; - hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; - } - } - else - { - int32_t curidx=(int32_t)tmp[0]; - spritetype *curspr=(spritetype *)tmp[1]; - int32_t thislastsec = tmp[2]; - - if (!thislastsec) - { - if (inside(x1,y1,sec-sector) != 0) - { - hitinfo->hitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; - hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; - } - } - else - { - for (i=clipinfo[curidx].qbeg; ihitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; - hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; - break; - } - } - } - } - } - - return 0; -} - - -// -// hitscan -// -static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t *clipsectcnt, const vec3_t *vect); - -int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, - hitdata_t *hitinfo, uint32_t cliptype) -{ - sectortype *sec; - walltype *wal, *wal2; - spritetype *spr; - int32_t z, zz, x1, y1=0, z1=0, x2, y2, x3, y3, x4, y4, intx, inty, intz; - int32_t topt, topu, bot, dist, offx, offy, cstat; - int32_t i, k, l, tilenum, xoff, yoff, dax, day, daz, daz2; - int32_t ang, cosang, sinang, xspan, yspan, xrepeat, yrepeat; - int32_t dawalclipmask, dasprclipmask; - int16_t tempshortcnt, tempshortnum, dasector, startwall, endwall; - int16_t nextsector; - char clipyou; - - spritetype *curspr = NULL; - int32_t clipspritecnt, curidx=-1; - // tmp: { (int32_t)curidx, (spritetype *)curspr, (!=0 if outer sector) } - intptr_t tmp[3], *tmpptr=NULL; - - hitinfo->hitsect = -1; hitinfo->hitwall = -1; hitinfo->hitsprite = -1; - if (sectnum < 0) return(-1); - - hitinfo->pos.x = hitscangoalx; hitinfo->pos.y = hitscangoaly; - - dawalclipmask = (cliptype&65535); - dasprclipmask = (cliptype>>16); - - clipsectorlist[0] = sectnum; - tempshortcnt = 0; tempshortnum = 1; - clipspritecnt = clipspritenum = 0; - do - { - if (tempshortcnt >= tempshortnum) - { - // one bunch of sectors completed, prepare the next - if (!curspr) - mapinfo_set(&origmapinfo, &clipmapinfo); // replace sector and wall with clip map - - curspr = &sprite[clipspritelist[clipspritecnt]]; - - if (curidx < 0) // per-sprite init - curidx = pictoidx[curspr->picnum]; - else - curidx = clipinfo[curidx].next; - - while (curidx>=0 && (curspr->cstat&32) != (sector[sectq[clipinfo[curidx].qbeg]].CM_CSTAT&32)) - curidx = clipinfo[curidx].next; - - if (curidx < 0) - { - clipspritecnt++; - continue; - } - - tmp[0] = (intptr_t)curidx; - tmp[1] = (intptr_t)curspr; - tmpptr = tmp; - - clipsprite_initindex(curidx, curspr, &i, sv); // &i is dummy - tempshortnum = (int16_t)clipsectnum; - tempshortcnt = 0; - } - - dasector = clipsectorlist[tempshortcnt]; sec = §or[dasector]; - - i = 1; - if (curspr) - { - if (dasector == sectq[clipinfo[curidx].qend]) - { - i = -1; - tmp[2] = 1; - } - else tmp[2] = 0; - } - - if (hitscan_trysector(sv, sec, hitinfo, vx,vy,vz, sec->ceilingstat, sec->ceilingheinum, sec->ceilingz, -i, tmpptr)) - continue; - if (hitscan_trysector(sv, sec, hitinfo, vx,vy,vz, sec->floorstat, sec->floorheinum, sec->floorz, i, tmpptr)) - continue; - - startwall = sec->wallptr; endwall = startwall + sec->wallnum; - for (z=startwall,wal=&wall[startwall]; znextsector<0) continue; - - wal2 = &wall[wal->point2]; - x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y; - - if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue; - if (rintersect(sv->x,sv->y,sv->z, vx,vy,vz, x1,y1, x2,y2, &intx,&inty,&intz) == 0) continue; - - if (klabs(intx-sv->x)+klabs(inty-sv->y) >= klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) - continue; - - nextsector = wal->nextsector; - if (!curspr) - { - if ((nextsector < 0) || (wal->cstat&dawalclipmask)) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - continue; - } - getzsofslope(nextsector,intx,inty,&daz,&daz2); - if ((intz <= daz) || (intz >= daz2)) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - continue; - } - } - else - { - int32_t cz,fz; - - if (wal->cstat&dawalclipmask) - { - hitinfo->hitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - continue; - } - getzsofslope(nextsector,intx,inty,&daz,&daz2); - getzsofslope(sectq[clipinfo[curidx].qend],intx,inty,&cz,&fz); - // ceil cz daz daz2 fz floor - if ((cz <= intz && intz <= daz) || (daz2 <= intz && intz <= fz)) - { - hitinfo->hitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - continue; - } - } - - for (zz=tempshortnum-1; zz>=0; zz--) - if (clipsectorlist[zz] == nextsector) break; - if (zz < 0) clipsectorlist[tempshortnum++] = nextsector; - } - - if (curspr) - continue; - - for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) - { - spr = &sprite[z]; - cstat = spr->cstat; -#ifdef USE_OPENGL - if (!hitallsprites) -#endif - if ((cstat&dasprclipmask) == 0) continue; - - // try and see whether this sprite's picnum has sector-like clipping data - i = pictoidx[spr->picnum]; - // handle sector-like floor sprites separately - while (i>=0 && (spr->cstat&32) != (clipmapinfo.sector[sectq[clipinfo[i].qbeg]].CM_CSTAT&32)) - i = clipinfo[i].next; - if (i>=0 && clipspritenumx; y1 = spr->y; z1 = spr->z; - switch (cstat&48) - { - case 0: - topt = vx*(x1-sv->x) + vy*(y1-sv->y); if (topt <= 0) continue; - bot = vx*vx + vy*vy; if (bot == 0) continue; - - intz = sv->z+scale(vz,topt,bot); - - i = (tilesizy[spr->picnum]*spr->yrepeat<<2); - if (cstat&128) z1 += (i>>1); - if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - if ((intz > z1) || (intz < z1-i)) continue; - topu = vx*(y1-sv->y) - vy*(x1-sv->x); - - offx = scale(vx,topu,bot); - offy = scale(vy,topu,bot); - dist = offx*offx + offy*offy; - i = tilesizx[spr->picnum]*spr->xrepeat; i *= i; - if (dist > (i>>7)) continue; - intx = sv->x + scale(vx,topt,bot); - inty = sv->y + scale(vy,topt,bot); - - if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; - - hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - break; - case 16: - //These lines get the 2 points of the rotated sprite - //Given: (x1, y1) starts out as the center point - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - if ((cstat&4) > 0) xoff = -xoff; - k = spr->ang; l = spr->xrepeat; - dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l; - l = tilesizx[tilenum]; k = (l>>1)+xoff; - x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l); - y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l); - - if ((cstat&64) != 0) //back side of 1-way sprite - if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue; - - if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue; - - if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; - - k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); - if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - if ((intz < daz) && (intz > daz-k)) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - } - break; - case 32: - if (vz == 0) continue; - intz = z1; - if (((intz-sv->z)^vz) < 0) continue; - if ((cstat&64) != 0) - if ((sv->z > intz) == ((cstat&8)==0)) continue; - -#if 1 // Abyss crash prevention code ((intz-sv->z)*zx overflowing a 8-bit word) - zz=(int32_t)((intz-sv->z)*vx); - intx = sv->x+scale(zz,1,vz); - zz=(int32_t)((intz-sv->z)*vy); - inty = sv->y+scale(zz,1,vz); -#else - intx = sv->x+scale(intz-sv->z,vx,vz); - inty = sv->y+scale(intz-sv->z,vy,vz); -#endif - - if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; - - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset); - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; - - ang = spr->ang; - cosang = sintable[(ang+512)&2047]; sinang = sintable[ang]; - xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat; - yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat; - - dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat; - x1 += dmulscale16(sinang,dax,cosang,day)-intx; - y1 += dmulscale16(sinang,day,-cosang,dax)-inty; - l = xspan*xrepeat; - x2 = x1 - mulscale16(sinang,l); - y2 = y1 + mulscale16(cosang,l); - l = yspan*yrepeat; - k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k; - k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k; - - clipyou = 0; - if ((y1^y2) < 0) - { - if ((x1^x2) < 0) clipyou ^= (x1*y2= 0) clipyou ^= 1; - } - if ((y2^y3) < 0) - { - if ((x2^x3) < 0) clipyou ^= (x2*y3= 0) clipyou ^= 1; - } - if ((y3^y4) < 0) - { - if ((x3^x4) < 0) clipyou ^= (x3*y4= 0) clipyou ^= 1; - } - if ((y4^y1) < 0) - { - if ((x4^x1) < 0) clipyou ^= (x4*y1= 0) clipyou ^= 1; - } - - if (clipyou != 0) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - } - break; - } - } - } - while (++tempshortcnt < tempshortnum || clipspritecnt < clipspritenum); - - if (curspr) - mapinfo_set(NULL, &origmapinfo); - - return(0); -} - - -// -// neartag -// -int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, - int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch) -{ - walltype *wal, *wal2; - spritetype *spr; - int32_t i, z, zz, xe, ye, ze, x1, y1, z1, x2, y2, intx, inty, intz; - int32_t topt, topu, bot, dist, offx, offy, vx, vy, vz; - int16_t tempshortcnt, tempshortnum, dasector, startwall, endwall; - int16_t nextsector, good; - - *neartagsector = -1; *neartagwall = -1; *neartagsprite = -1; - *neartaghitdist = 0; - - if (sectnum < 0 || (tagsearch & 3) == 0) return(0); - - vx = mulscale14(sintable[(ange+2560)&2047],neartagrange); xe = xs+vx; - vy = mulscale14(sintable[(ange+2048)&2047],neartagrange); ye = ys+vy; - vz = 0; ze = 0; - - clipsectorlist[0] = sectnum; - tempshortcnt = 0; tempshortnum = 1; - - do - { - dasector = clipsectorlist[tempshortcnt]; - - startwall = sector[dasector].wallptr; - endwall = startwall + sector[dasector].wallnum - 1; - for (z=startwall,wal=&wall[startwall]; z<=endwall; z++,wal++) - { - wal2 = &wall[wal->point2]; - x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y; - - nextsector = wal->nextsector; - - good = 0; - if (nextsector >= 0) - { - if ((tagsearch&1) && sector[nextsector].lotag) good |= 1; - if ((tagsearch&2) && sector[nextsector].hitag) good |= 1; - } - if ((tagsearch&1) && wal->lotag) good |= 2; - if ((tagsearch&2) && wal->hitag) good |= 2; - - if ((good == 0) && (nextsector < 0)) continue; - if ((x1-xs)*(y2-ys) < (x2-xs)*(y1-ys)) continue; - - if (lintersect(xs,ys,zs,xe,ye,ze,x1,y1,x2,y2,&intx,&inty,&intz) == 1) - { - if (good != 0) - { - if (good&1) *neartagsector = nextsector; - if (good&2) *neartagwall = z; - *neartaghitdist = dmulscale14(intx-xs,sintable[(ange+2560)&2047],inty-ys,sintable[(ange+2048)&2047]); - xe = intx; ye = inty; ze = intz; - } - if (nextsector >= 0) - { - for (zz=tempshortnum-1; zz>=0; zz--) - if (clipsectorlist[zz] == nextsector) break; - if (zz < 0) clipsectorlist[tempshortnum++] = nextsector; - } - } - } - - tempshortcnt++; - - if (tagsearch & 4) continue; // skip sprite search - - for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) - { - spr = &sprite[z]; - - good = 0; - if ((tagsearch&1) && spr->lotag) good |= 1; - if ((tagsearch&2) && spr->hitag) good |= 1; - if (good != 0) - { - x1 = spr->x; y1 = spr->y; z1 = spr->z; - - topt = vx*(x1-xs) + vy*(y1-ys); - if (topt > 0) - { - bot = vx*vx + vy*vy; - if (bot != 0) - { - intz = zs+scale(vz,topt,bot); - i = tilesizy[spr->picnum]*spr->yrepeat; - if (spr->cstat&128) z1 += (i<<1); - if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - if ((intz <= z1) && (intz >= z1-(i<<2))) - { - topu = vx*(y1-ys) - vy*(x1-xs); - - offx = scale(vx,topu,bot); - offy = scale(vy,topu,bot); - dist = offx*offx + offy*offy; - i = (tilesizx[spr->picnum]*spr->xrepeat); i *= i; - if (dist <= (i>>7)) - { - intx = xs + scale(vx,topt,bot); - inty = ys + scale(vy,topt,bot); - if (klabs(intx-xs)+klabs(inty-ys) < klabs(xe-xs)+klabs(ye-ys)) - { - *neartagsprite = z; - *neartaghitdist = dmulscale14(intx-xs,sintable[(ange+2560)&2047],inty-ys,sintable[(ange+2048)&2047]); - xe = intx; - ye = inty; - ze = intz; - } - } - } - } - } - } - } - } - while (tempshortcnt < tempshortnum); - return(0); -} - - -// -// dragpoint -// -void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day) -{ - int16_t cnt, tempshort; - int32_t thelastwall; - - wall[pointhighlight].x = dax; - wall[pointhighlight].y = day; - wall[pointhighlight].cstat |= (1<<14); - if (linehighlight >= 0 && linehighlight < MAXWALLS) - wall[linehighlight].cstat |= (1<<14); - wall[lastwall(pointhighlight)].cstat |= (1<<14); - - cnt = MAXWALLS; - tempshort = pointhighlight; //search points CCW - do - { - if (wall[tempshort].nextwall >= 0) - { - tempshort = wall[wall[tempshort].nextwall].point2; - wall[tempshort].x = dax; - wall[tempshort].y = day; - wall[tempshort].cstat |= (1<<14); - } - else - { - tempshort = pointhighlight; //search points CW if not searched all the way around - do - { - thelastwall = lastwall(tempshort); - if (wall[thelastwall].nextwall >= 0) - { - tempshort = wall[thelastwall].nextwall; - wall[tempshort].x = dax; - wall[tempshort].y = day; - wall[tempshort].cstat |= (1<<14); - } - else - { - break; - } - cnt--; - } - while ((tempshort != pointhighlight) && (cnt > 0)); - break; - } - cnt--; - } - while ((tempshort != pointhighlight) && (cnt > 0)); -} - - -// -// lastwall -// -int32_t lastwall(int16_t point) -{ - int32_t i, j, cnt; - - if ((point > 0) && (wall[point-1].point2 == point)) return(point-1); - i = point; - cnt = MAXWALLS; - do - { - j = wall[i].point2; - if (j == point) return(i); - i = j; - cnt--; - } - while (cnt > 0); - return(point); -} - - -////////// CLIPMOVE ////////// - -int32_t clipmoveboxtracenum = 3; - -static int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax) -{ - int32_t i,k,tempint1,tempint2; - - // try and see whether this sprite's picnum has sector-like clipping data - i = pictoidx[spr->picnum]; - // handle sector-like floor sprites separately - while (i>=0 && (spr->cstat&32) != (clipmapinfo.sector[sectq[clipinfo[i].qbeg]].CM_CSTAT&32)) - i = clipinfo[i].next; - - if (i>=0) - { - int32_t maxcorrection = clipinfo[i].maxdist; - - k = sectq[clipinfo[i].qbeg]; - if ((spr->cstat&48)!=32) // face/wall sprite - { - tempint1 = clipmapinfo.sector[k].CM_XREPEAT; - maxcorrection = (maxcorrection * (int32_t)spr->xrepeat)/tempint1; - } - else // floor sprite - { - tempint1 = clipmapinfo.sector[k].CM_XREPEAT; - tempint2 = clipmapinfo.sector[k].CM_YREPEAT; - maxcorrection = max((maxcorrection * (int32_t)spr->xrepeat)/tempint1, - (maxcorrection * (int32_t)spr->yrepeat)/tempint2); - } - - maxcorrection -= MAXCLIPDIST; - - if (spr->x < xmin - maxcorrection) return 1; - if (spr->y < ymin - maxcorrection) return 1; - if (spr->x > xmax + maxcorrection) return 1; - if (spr->y > ymax + maxcorrection) return 1; - - if (clipspritenum < MAXCLIPNUM) - clipspritelist[clipspritenum++] = spr-sprite; -//initprintf("%d: clip sprite[%d]\n",clipspritenum,j); - return 1; - } - - return 0; -} - -// return: -1 if curspr has x-flip xor y-flip (in the horizontal map plane!), 1 else -static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t *clipsectcnt, const vec3_t *vect) -{ - int32_t j,k,w,tempint1,tempint2,daz = curspr->z; - int32_t scalex,scaley,scalez,flipx,flipy,rotang, dorot; - int32_t startwall, endwall, flipmul=1; - sectortype *sec; - walltype *wal; - - j = sectq[clipinfo[curidx].qbeg]; - tempint1 = sector[j].CM_XREPEAT; - tempint2 = sector[j].CM_YREPEAT; - if ((curspr->cstat&48)!=32) // face/wall sprite - { - scalex = scaley = divscale22(curspr->xrepeat, tempint1); - scalez = divscale22(curspr->yrepeat, tempint2); - - flipx = 1-((curspr->cstat&4)>>1); - flipy = 1; - } - else - { - scalex = divscale22(curspr->xrepeat, tempint1); - scaley = divscale22(curspr->yrepeat, tempint2); - scalez = scalex; - - flipx = 1-((curspr->cstat&4)>>1); - flipy = 1-((curspr->cstat&8)>>2); - } - rotang = (curspr->ang - sector[j].CM_ANG)&2047; - dorot = !CM_NOROTS(j); - if (dorot) - { - flipmul = flipx*flipy; - if (flipmul==-1) - wall = loadwallinv; - } - - if ((curspr->cstat&128) != (sector[j].CM_CSTAT&128)) - daz += (((curspr->cstat&128)>>6)-1)*(((int32_t)tilesizy[curspr->picnum]*(int32_t)curspr->yrepeat)<<1); - - *clipsectcnt = clipsectnum = 0; - // init sectors for this index - for (k=clipinfo[curidx].qbeg; k<=clipinfo[curidx].qend; k++) - { - j = sectq[k]; - sec = §or[j]; - - sec->floorz = daz + mulscale22(scalez, CM_FLOORZ(j)); - sec->ceilingz = daz + mulscale22(scalez, CM_CEILINGZ(j)); -//initprintf("sec %d: f=%d, c=%d\n", j, sec->floorz, sec->ceilingz); - - startwall=sec->wallptr; endwall=startwall+sec->wallnum; - for (w=startwall,wal=&wall[startwall]; wx = mulscale22(scalex, CM_WALL_X(w)); - wal->y = mulscale22(scaley, CM_WALL_Y(w)); - - if (dorot) - { - wal->x *= flipx; - wal->y *= flipy; - rotatepoint(0,0, wal->x,wal->y, rotang, &wal->x,&wal->y); - } - - wal->x += curspr->x; - wal->y += curspr->y; - } - - if (inside(vect->x, vect->y, j)==1) - clipsectorlist[clipsectnum++] = j; - } - - if (clipsectnum==0) - clipsectorlist[clipsectnum++] = sectq[k-1]; - - return flipmul; -} - - -static int32_t clipmove_warned=0; - -static void addclipline(int32_t dax1, int32_t day1, int32_t dax2, int32_t day2, int32_t daoval) -{ - if (clipnum < MAXCLIPNUM) - { - clipit[clipnum].x1 = dax1; clipit[clipnum].y1 = day1; - clipit[clipnum].x2 = dax2; clipit[clipnum].y2 = day2; - clipobjectval[clipnum] = daoval; - clipnum++; - } - else if (!clipmove_warned) - { - initprintf("!!clipnum\n"); - clipmove_warned = 1; - } -} - -// -// clipmove -// -int32_t clipmove(vec3_t *pos, int16_t *sectnum, - int32_t xvect, int32_t yvect, - int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) -{ - walltype *wal, *wal2; - spritetype *spr; - sectortype *sec, *sec2; - int32_t i, j, tempint1, tempint2; - int32_t oxvect, oyvect, goalx, goaly, intx, inty, lx, ly, retval; - int32_t k, l, clipsectcnt, startwall, endwall, cstat, dasect; - int32_t x1, y1, x2, y2, cx, cy, rad, xmin, ymin, xmax, ymax, daz, daz2; - int32_t bsz, dax, day, xoff, yoff, xspan, yspan, cosang, sinang, tilenum; - int32_t xrepeat, yrepeat, gx, gy, dx, dy, dasprclipmask, dawalclipmask; - int32_t hitwall, cnt, clipyou; - - spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping - int32_t curidx=-1, clipspritecnt; - - if (((xvect|yvect) == 0) || (*sectnum < 0)) return(0); - retval = 0; - - clipmove_warned = 0; - - oxvect = xvect; - oyvect = yvect; - - goalx = pos->x + (xvect>>14); - goaly = pos->y + (yvect>>14); - - - clipnum = 0; - - cx = (pos->x+goalx)>>1; - cy = (pos->y+goaly)>>1; - //Extra walldist for sprites on sector lines - gx = goalx-(pos->x); gy = goaly-(pos->y); - rad = nsqrtasm(gx*gx + gy*gy) + MAXCLIPDIST+walldist + 8; - xmin = cx-rad; ymin = cy-rad; - xmax = cx+rad; ymax = cy+rad; - - dawalclipmask = (cliptype&65535); //CLIPMASK0 = 0x00010001 - dasprclipmask = (cliptype>>16); //CLIPMASK1 = 0x01000040 - - clipsectorlist[0] = (*sectnum); - clipsectcnt = 0; clipsectnum = 1; - clipspritecnt = 0; clipspritenum = 0; - do - { - if (clipsectcnt>=clipsectnum) - { - // one bunch of sectors completed (either the very first - // one or a sector-like sprite one), prepare the next - -//initprintf("init sprite %d\n", clipspritecnt); - if (!curspr) - { - // init sector-like sprites for clipping - origclipsectnum = clipsectnum; - Bmemcpy(origclipsectorlist, clipsectorlist, clipsectnum*sizeof(clipsectorlist[0])); - - // replace sector and wall with clip map - mapinfo_set(&origmapinfo, &clipmapinfo); - } - - curspr = &sprite[clipspritelist[clipspritecnt]]; - - if (curidx < 0) // per-sprite init - curidx = pictoidx[curspr->picnum]; - else - curidx = clipinfo[curidx].next; - - while (curidx>=0 && (curspr->cstat&32) != (sector[sectq[clipinfo[curidx].qbeg]].CM_CSTAT&32)) - curidx = clipinfo[curidx].next; - - if (curidx < 0) - { - clipspritecnt++; - continue; - } - - clipsprite_initindex(curidx, curspr, &clipsectcnt, pos); - } - - - dasect = clipsectorlist[clipsectcnt++]; -//if (curspr) -// initprintf("sprite %d/%d: sect %d/%d (%d)\n", clipspritecnt,clipspritenum, clipsectcnt,clipsectnum,dasect); - - sec = §or[dasect]; - startwall = sec->wallptr; endwall = startwall + sec->wallnum; - for (j=startwall,wal=&wall[startwall]; jpoint2]; - if ((wal->x < xmin) && (wal2->x < xmin)) continue; - if ((wal->x > xmax) && (wal2->x > xmax)) continue; - if ((wal->y < ymin) && (wal2->y < ymin)) continue; - if ((wal->y > ymax) && (wal2->y > ymax)) continue; - - x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y; - - dx = x2-x1; dy = y2-y1; - if (dx*((pos->y)-y1) < ((pos->x)-x1)*dy) continue; //If wall's not facing you - - if (dx > 0) dax = dx*(ymin-y1); else dax = dx*(ymax-y1); - if (dy > 0) day = dy*(xmax-x1); else day = dy*(xmin-x1); - if (dax >= day) continue; - - clipyou = 0; - if (curspr) - { - if (wal->nextsector>=0) - { - int32_t basez; - - if (rintersect(pos->x,pos->y,0, gx,gy,0, x1,y1, x2,y2, &dax,&day,&daz) == 0) - dax = pos->x, day = pos->y; - daz = getflorzofslope(dasect, dax,day); - daz2 = getflorzofslope(wal->nextsector, dax,day); - basez = getflorzofslope(sectq[clipinfo[curidx].qend], dax,day); - - sec2 = §or[wal->nextsector]; - if ((sec2->floorstat&1) == 0) -// if (dasect==sectq[clipinfo[curidx].qend] || daz2 < daz-(1<<8)) - if (daz2-(flordist-1) <= pos->z && pos->z <= basez+(flordist-1)) - clipyou = 1; - if (clipyou == 0) - { - daz = getceilzofslope(dasect, dax,day); - daz2 = getceilzofslope(wal->nextsector, dax,day); - basez = getceilzofslope(sectq[clipinfo[curidx].qend], dax,day); - if ((sec2->ceilingstat&1) == 0) -// if (dasect==sectq[clipinfo[curidx].qend] || daz2 > daz+(1<<8)) - if (basez-(ceildist-1) <= pos->z && pos->z <= daz2+(ceildist-1)) - clipyou = 1; - } - } - } - else if ((wal->nextsector < 0) || (wal->cstat&dawalclipmask)) clipyou = 1; - else if (editstatus == 0) - { - if (rintersect(pos->x,pos->y,0,gx,gy,0,x1,y1,x2,y2,&dax,&day,&daz) == 0) - dax = pos->x, day = pos->y; - daz = getflorzofslope(dasect, dax,day); - daz2 = getflorzofslope(wal->nextsector, dax,day); - - sec2 = §or[wal->nextsector]; - if (daz2 < daz-(1<<8)) - if ((sec2->floorstat&1) == 0) - if ((pos->z) >= daz2-(flordist-1)) clipyou = 1; - if (clipyou == 0) - { - daz = getceilzofslope(dasect, dax,day); - daz2 = getceilzofslope(wal->nextsector, dax,day); - if (daz2 > daz+(1<<8)) - if ((sec2->ceilingstat&1) == 0) - if ((pos->z) <= daz2+(ceildist-1)) clipyou = 1; - } - } - - if (clipyou) - { - int16_t objtype; - if (!curspr) - objtype = (int16_t)j+32768; - else - objtype = (int16_t)(curspr-sprite)+49152; - - //Add 2 boxes at endpoints - bsz = walldist; if (gx < 0) bsz = -bsz; - addclipline(x1-bsz,y1-bsz, x1-bsz,y1+bsz, objtype); - addclipline(x2-bsz,y2-bsz, x2-bsz,y2+bsz, objtype); - bsz = walldist; if (gy < 0) bsz = -bsz; - addclipline(x1+bsz,y1-bsz, x1-bsz,y1-bsz, objtype); - addclipline(x2+bsz,y2-bsz, x2-bsz,y2-bsz, objtype); - - dax = walldist; if (dy > 0) dax = -dax; - day = walldist; if (dx < 0) day = -day; - addclipline(x1+dax,y1+day, x2+dax,y2+day, objtype); - } - else if (wal->nextsector>=0) - { - for (i=clipsectnum-1; i>=0; i--) - if (wal->nextsector == clipsectorlist[i]) break; - if (i < 0) clipsectorlist[clipsectnum++] = wal->nextsector; - } - } - - if (curspr) - continue; // next sector of this index - - for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j]) - { - spr = &sprite[j]; - cstat = spr->cstat; - if ((cstat&dasprclipmask) == 0) continue; - - if (clipsprite_try(spr, xmin,ymin, xmax,ymax)) - continue; - - x1 = spr->x; y1 = spr->y; - - switch (cstat&48) - { - case 0: - if ((x1 >= xmin) && (x1 <= xmax) && (y1 >= ymin) && (y1 <= ymax)) - { - k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); - if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - if (((pos->z) < daz+ceildist) && ((pos->z) > daz-k-flordist)) - { - bsz = (spr->clipdist<<2)+walldist; if (gx < 0) bsz = -bsz; - addclipline(x1-bsz,y1-bsz,x1-bsz,y1+bsz,(int16_t)j+49152); - bsz = (spr->clipdist<<2)+walldist; if (gy < 0) bsz = -bsz; - addclipline(x1+bsz,y1-bsz,x1-bsz,y1-bsz,(int16_t)j+49152); - } - } - break; - case 16: - k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); - if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - daz2 = daz-k; - daz += ceildist; daz2 -= flordist; - if (((pos->z) < daz) && ((pos->z) > daz2)) - { - //These lines get the 2 points of the rotated sprite - //Given: (x1, y1) starts out as the center point - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - if ((cstat&4) > 0) xoff = -xoff; - k = spr->ang; l = spr->xrepeat; - dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l; - l = tilesizx[tilenum]; k = (l>>1)+xoff; - x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l); - y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l); - if (clipinsideboxline(cx,cy,x1,y1,x2,y2,rad) != 0) - { - dax = mulscale14(sintable[(spr->ang+256+512)&2047],walldist); - day = mulscale14(sintable[(spr->ang+256)&2047],walldist); - - if ((x1-(pos->x))*(y2-(pos->y)) >= (x2-(pos->x))*(y1-(pos->y))) //Front - { - addclipline(x1+dax,y1+day,x2+day,y2-dax,(int16_t)j+49152); - } - else - { - if ((cstat&64) != 0) continue; - addclipline(x2-dax,y2-day,x1-day,y1+dax,(int16_t)j+49152); - } - - //Side blocker - if ((x2-x1)*((pos->x)-x1) + (y2-y1)*((pos->y)-y1) < 0) - { addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152); } - else if ((x1-x2)*((pos->x)-x2) + (y1-y2)*((pos->y)-y2) < 0) - { addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); } - } - } - break; - case 32: - daz = spr->z+ceildist; - daz2 = spr->z-flordist; - if (((pos->z) < daz) && ((pos->z) > daz2)) - { - if ((cstat&64) != 0) - if (((pos->z) > spr->z) == ((cstat&8)==0)) continue; - - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset); - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; - - k = spr->ang; - cosang = sintable[(k+512)&2047]; sinang = sintable[k]; - xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat; - yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat; - - dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat; - rxi[0] = x1 + dmulscale16(sinang,dax,cosang,day); - ryi[0] = y1 + dmulscale16(sinang,day,-cosang,dax); - l = xspan*xrepeat; - rxi[1] = rxi[0] - mulscale16(sinang,l); - ryi[1] = ryi[0] + mulscale16(cosang,l); - l = yspan*yrepeat; - k = -mulscale16(cosang,l); rxi[2] = rxi[1]+k; rxi[3] = rxi[0]+k; - k = -mulscale16(sinang,l); ryi[2] = ryi[1]+k; ryi[3] = ryi[0]+k; - - dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist); - day = mulscale14(sintable[(spr->ang-256)&2047],walldist); - - if ((rxi[0]-(pos->x))*(ryi[1]-(pos->y)) < (rxi[1]-(pos->x))*(ryi[0]-(pos->y))) - { - if (clipinsideboxline(cx,cy,rxi[1],ryi[1],rxi[0],ryi[0],rad) != 0) - addclipline(rxi[1]-day,ryi[1]+dax,rxi[0]+dax,ryi[0]+day,(int16_t)j+49152); - } - else if ((rxi[2]-(pos->x))*(ryi[3]-(pos->y)) < (rxi[3]-(pos->x))*(ryi[2]-(pos->y))) - { - if (clipinsideboxline(cx,cy,rxi[3],ryi[3],rxi[2],ryi[2],rad) != 0) - addclipline(rxi[3]+day,ryi[3]-dax,rxi[2]-dax,ryi[2]-day,(int16_t)j+49152); - } - - if ((rxi[1]-(pos->x))*(ryi[2]-(pos->y)) < (rxi[2]-(pos->x))*(ryi[1]-(pos->y))) - { - if (clipinsideboxline(cx,cy,rxi[2],ryi[2],rxi[1],ryi[1],rad) != 0) - addclipline(rxi[2]-dax,ryi[2]-day,rxi[1]-day,ryi[1]+dax,(int16_t)j+49152); - } - else if ((rxi[3]-(pos->x))*(ryi[0]-(pos->y)) < (rxi[0]-(pos->x))*(ryi[3]-(pos->y))) - { - if (clipinsideboxline(cx,cy,rxi[0],ryi[0],rxi[3],ryi[3],rad) != 0) - addclipline(rxi[0]+dax,ryi[0]+day,rxi[3]+day,ryi[3]-dax,(int16_t)j+49152); - } - } - break; - } - } - } - while (clipsectcnt < clipsectnum || clipspritecnt < clipspritenum); - - if (curspr) - { - // restore original map - mapinfo_set(NULL, &origmapinfo); - - clipsectnum = origclipsectnum; - Bmemcpy(clipsectorlist, origclipsectorlist, clipsectnum*sizeof(clipsectorlist[0])); - } - - hitwall = 0; - cnt = clipmoveboxtracenum; - do - { - intx = goalx; inty = goaly; - hitwall = raytrace(pos->x, pos->y, &intx, &inty); - if (hitwall >= 0) - { - lx = clipit[hitwall].x2-clipit[hitwall].x1; - ly = clipit[hitwall].y2-clipit[hitwall].y1; - tempint2 = lx*lx + ly*ly; - if (tempint2 > 0) - { - tempint1 = (goalx-intx)*lx + (goaly-inty)*ly; - - if ((klabs(tempint1)>>11) < tempint2) - i = divscale20(tempint1,tempint2); - else - i = 0; - goalx = mulscale20(lx,i)+intx; - goaly = mulscale20(ly,i)+inty; - } -// else if (tempint2<0) -// Bprintf("!! tempint2<0 !!\n"); - - tempint1 = dmulscale6(lx,oxvect,ly,oyvect); - for (i=cnt+1; i<=clipmoveboxtracenum; i++) - { - j = hitwalls[i]; - tempint2 = dmulscale6(clipit[j].x2-clipit[j].x1,oxvect,clipit[j].y2-clipit[j].y1,oyvect); - if ((tempint1^tempint2) < 0) - { - updatesector(pos->x,pos->y,sectnum); - return(retval); - } - } - - keepaway(&goalx, &goaly, hitwall); - xvect = ((goalx-intx)<<14); - yvect = ((goaly-inty)<<14); - - if (cnt == clipmoveboxtracenum) retval = clipobjectval[hitwall]; - hitwalls[cnt] = hitwall; - } - cnt--; - - pos->x = intx; - pos->y = inty; - } - while (((xvect|yvect) != 0) && (hitwall >= 0) && (cnt > 0)); - - for (j=0; jx,pos->y,clipsectorlist[j]) == 1) - { - *sectnum = clipsectorlist[j]; - return(retval); - } - - *sectnum = -1; tempint1 = 0x7fffffff; - for (j=numsectors-1; j>=0; j--) - if (inside(pos->x,pos->y,j) == 1) - { - if (sector[j].ceilingstat&2) - tempint2 = (getceilzofslope((int16_t)j,pos->x,pos->y)-(pos->z)); - else - tempint2 = (sector[j].ceilingz-(pos->z)); - - if (tempint2 > 0) - { - if (tempint2 < tempint1) - { *sectnum = j; tempint1 = tempint2; } - } - else - { - if (sector[j].floorstat&2) - tempint2 = ((pos->z)-getflorzofslope((int16_t)j,pos->x,pos->y)); - else - tempint2 = ((pos->z)-sector[j].floorz); - - if (tempint2 <= 0) - { - *sectnum = j; - return(retval); - } - if (tempint2 < tempint1) - { *sectnum = j; tempint1 = tempint2; } - } - } - - return(retval); -} - - -// -// pushmove -// -int32_t pushmove(vec3_t *vect, int16_t *sectnum, - int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) -{ - sectortype *sec, *sec2; - walltype *wal; - int32_t i, j, k, t, dx, dy, dax, day, daz, daz2, bad, dir; - int32_t dasprclipmask, dawalclipmask; - int16_t startwall, endwall, clipsectcnt; - char bad2; - - if ((*sectnum) < 0) return(-1); - - dawalclipmask = (cliptype&65535); - dasprclipmask = (cliptype>>16); - - k = 32; - dir = 1; - do - { - bad = 0; - - clipsectorlist[0] = *sectnum; - clipsectcnt = 0; clipsectnum = 1; - do - { - /*Push FACE sprites - for(i=headspritesect[clipsectorlist[clipsectcnt]];i>=0;i=nextspritesect[i]) - { - spr = &sprite[i]; - if (((spr->cstat&48) != 0) && ((spr->cstat&48) != 48)) continue; - if ((spr->cstat&dasprclipmask) == 0) continue; - - dax = (vect->x)-spr->x; day = (vect->y)-spr->y; - t = (spr->clipdist<<2)+walldist; - if ((klabs(dax) < t) && (klabs(day) < t)) - { - t = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); - if (spr->cstat&128) daz = spr->z+(t>>1); else daz = spr->z; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - if (((vect->z) < daz+ceildist) && ((vect->z) > daz-t-flordist)) - { - t = (spr->clipdist<<2)+walldist; - - j = getangle(dax,day); - dx = (sintable[(j+512)&2047]>>11); - dy = (sintable[(j)&2047]>>11); - bad2 = 16; - do - { - vect->x = (vect->x) + dx; vect->y = (vect->y) + dy; - bad2--; if (bad2 == 0) break; - } while ((klabs((vect->x)-spr->x) < t) && (klabs((vect->y)-spr->y) < t)); - bad = -1; - k--; if (k <= 0) return(bad); - updatesector(vect->x,vect->y,sectnum); - } - } - }*/ - - sec = §or[clipsectorlist[clipsectcnt]]; - if (dir > 0) - startwall = sec->wallptr, endwall = startwall + sec->wallnum; - else - endwall = sec->wallptr, startwall = endwall + sec->wallnum; - - for (i=startwall,wal=&wall[startwall]; i!=endwall; i+=dir,wal+=dir) - if (clipinsidebox(vect->x,vect->y,i,walldist-4) == 1) - { - j = 0; - if (wal->nextsector < 0) j = 1; - if (wal->cstat&dawalclipmask) j = 1; - if (j == 0) - { - sec2 = §or[wal->nextsector]; - - - //Find closest point on wall (dax, day) to (vect->x, vect->y) - dax = wall[wal->point2].x-wal->x; - day = wall[wal->point2].y-wal->y; - daz = dax*((vect->x)-wal->x) + day*((vect->y)-wal->y); - if (daz <= 0) - t = 0; - else - { - daz2 = dax*dax+day*day; - if (daz >= daz2) t = (1<<30); else t = divscale30(daz,daz2); - } - dax = wal->x + mulscale30(dax,t); - day = wal->y + mulscale30(day,t); - - - daz = getflorzofslope(clipsectorlist[clipsectcnt],dax,day); - daz2 = getflorzofslope(wal->nextsector,dax,day); - if ((daz2 < daz-(1<<8)) && ((sec2->floorstat&1) == 0)) - if (vect->z >= daz2-(flordist-1)) j = 1; - - daz = getceilzofslope(clipsectorlist[clipsectcnt],dax,day); - daz2 = getceilzofslope(wal->nextsector,dax,day); - if ((daz2 > daz+(1<<8)) && ((sec2->ceilingstat&1) == 0)) - if (vect->z <= daz2+(ceildist-1)) j = 1; - } - if (j != 0) - { - j = getangle(wall[wal->point2].x-wal->x,wall[wal->point2].y-wal->y); - dx = (sintable[(j+1024)&2047]>>11); - dy = (sintable[(j+512)&2047]>>11); - bad2 = 16; - do - { - vect->x = (vect->x) + dx; vect->y = (vect->y) + dy; - bad2--; if (bad2 == 0) break; - } - while (clipinsidebox(vect->x,vect->y,i,walldist-4) != 0); - bad = -1; - k--; if (k <= 0) return(bad); - updatesector(vect->x,vect->y,sectnum); - if (*sectnum < 0) return -1; - } - else - { - for (j=clipsectnum-1; j>=0; j--) - if (wal->nextsector == clipsectorlist[j]) break; - if (j < 0) clipsectorlist[clipsectnum++] = wal->nextsector; - } - } - - clipsectcnt++; - } - while (clipsectcnt < clipsectnum); - dir = -dir; - } - while (bad != 0); - - return(bad); -} - - -// -// updatesector[z] -// -void updatesector(int32_t x, int32_t y, int16_t *sectnum) -{ - walltype *wal; - int32_t i, j; - - if (inside(x,y,*sectnum) == 1) return; - - if ((*sectnum >= 0) && (*sectnum < numsectors)) - { - wal = &wall[sector[*sectnum].wallptr]; - j = sector[*sectnum].wallnum; - do - { - i = wal->nextsector; - if (i >= 0) - if (inside(x,y,(int16_t)i) == 1) - { - *sectnum = i; - return; - } - wal++; - j--; - } - while (j != 0); - } - - for (i=numsectors-1; i>=0; i--) - if (inside(x,y,(int16_t)i) == 1) - { - *sectnum = i; - return; - } - - *sectnum = -1; -} - -void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *excludesectbitmap) -{ - walltype *wal; - int32_t i, j; - - if (!(excludesectbitmap[*sectnum>>3]&(1<<(*sectnum&7))) && inside(x,y,*sectnum) == 1) - return; - - if ((*sectnum >= 0) && (*sectnum < numsectors)) - { - wal = &wall[sector[*sectnum].wallptr]; - j = sector[*sectnum].wallnum; - do - { - i = wal->nextsector; - if (i >= 0) - if (!(excludesectbitmap[i>>3]&(1<<(i&7))) && inside(x,y,(int16_t)i) == 1) - { - *sectnum = i; - return; - } - wal++; - j--; - } - while (j != 0); - } - - for (i=numsectors-1; i>=0; i--) - if (!(excludesectbitmap[i>>3]&(1<<(i&7))) && inside(x,y,(int16_t)i) == 1) - { - *sectnum = i; - return; - } - - *sectnum = -1; -} - -void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) -{ - walltype *wal; - int32_t i, j, cz, fz; - - if ((*sectnum >= 0) && (*sectnum < numsectors)) - { - // this block used to be outside the "if" and caused crashes in Polymost Mapster32 - getzsofslope(*sectnum, x, y, &cz, &fz); - if ((z >= cz) && (z <= fz)) - if (inside(x,y,*sectnum) != 0) return; - - wal = &wall[sector[*sectnum].wallptr]; - j = sector[*sectnum].wallnum; - do - { - i = wal->nextsector; - if (i >= 0) - { - getzsofslope(i, x, y, &cz, &fz); - if ((z >= cz) && (z <= fz)) - if (inside(x,y,(int16_t)i) == 1) - { *sectnum = i; return; } - } - wal++; j--; - } - while (j != 0); - } - - for (i=numsectors-1; i>=0; i--) - { - getzsofslope(i, x, y, &cz, &fz); - if ((z >= cz) && (z <= fz)) - if (inside(x,y,(int16_t)i) == 1) - { *sectnum = i; return; } - } - - *sectnum = -1; -} - - -// -// rotatepoint -// -void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2) -{ - int32_t dacos, dasin; - - dacos = sintable[(daang+2560)&2047]; - dasin = sintable[(daang+2048)&2047]; - x -= xpivot; - y -= ypivot; - *x2 = dmulscale14(x,dacos,-y,dasin) + xpivot; - *y2 = dmulscale14(y,dacos,x,dasin) + ypivot; -} - - -// -// getmousevalues -// - -void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) -{ - readmousexy(mousx,mousy); - readmousebstatus(bstatus); -} - - -#if KRANDDEBUG -# include -# define KRD_MAXCALLS 262144 -# define KRD_DEPTH 8 -static int32_t krd_numcalls=0; -static void *krd_fromwhere[KRD_MAXCALLS][KRD_DEPTH]; -static int32_t krd_enabled=0; - -void krd_enable(int which) // 0: disable, 1: rec, 2: play -{ - krd_enabled = which; - - if (which) - Bmemset(krd_fromwhere, 0, sizeof(krd_fromwhere)); -} - -int32_t krd_print(const char *filename) -{ - FILE *fp; - int32_t i, j; - - if (!krd_enabled) return 1; - krd_enabled = 0; - - fp = fopen(filename, "wb"); - if (!fp) { OSD_Printf("krd_print (2): fopen"); return 1; } - - for (i=0; i=KRD_DEPTH || krd_fromwhere[i][j]==NULL) - { - fprintf(fp, "\n"); - break; - } - fprintf(fp, " [%p]", krd_fromwhere[i][j]); - } - } - - krd_numcalls = 0; - - fclose(fp); - return 0; -} -#endif // KRANDDEBUG - - -// -// krand -// -int32_t krand(void) -{ -// randomseed = (randomseed*27584621)+1; - randomseed = (randomseed * 1664525ul) + 221297ul; - -#if KRANDDEBUG - if (krd_enabled) - if (krd_numcalls < KRD_MAXCALLS) - { - backtrace(krd_fromwhere[krd_numcalls], KRD_DEPTH); - krd_numcalls++; - } -#endif - - return(((uint32_t)randomseed)>>16); -} - - -// -// getzrange -// -void getzrange(const vec3_t *vect, int16_t sectnum, - int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, - int32_t walldist, uint32_t cliptype) -{ - sectortype *sec; - walltype *wal, *wal2; - spritetype *spr; - int32_t clipsectcnt, startwall, endwall, tilenum, xoff, yoff, dax, day; - int32_t xmin, ymin, xmax, ymax, i, j, k, l, daz, daz2, dx, dy; - int32_t x1, y1, x2, y2, x3, y3, x4, y4, ang, cosang, sinang; - int32_t xspan, yspan, xrepeat, yrepeat, dasprclipmask, dawalclipmask; - int16_t cstat; - - char clipyou; - - spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping - int32_t curidx=-1, clipspritecnt; - - if (sectnum < 0) - { - *ceilz = 0x80000000; *ceilhit = -1; - *florz = 0x7fffffff; *florhit = -1; - return; - } - - //Extra walldist for sprites on sector lines - i = walldist+MAXCLIPDIST+1; - xmin = vect->x-i; ymin = vect->y-i; - xmax = vect->x+i; ymax = vect->y+i; - - getzsofslope(sectnum,vect->x,vect->y,ceilz,florz); - *ceilhit = sectnum+16384; *florhit = sectnum+16384; - - dawalclipmask = (cliptype&65535); - dasprclipmask = (cliptype>>16); - - clipsectorlist[0] = sectnum; - clipsectcnt = 0; clipsectnum = 1; - clipspritecnt = clipspritenum = 0; - - if (0) - { - beginagain: - // replace sector and wall with clip map - mapinfo_set(&origmapinfo, &clipmapinfo); - clipsectcnt = clipsectnum; // should be a nop, "safety"... - } - - do //Collect sectors inside your square first - { - if (clipsectcnt>=clipsectnum) - { - // one bunch of sectors completed, prepare the next - - curspr = &sprite[clipspritelist[clipspritecnt]]; - - if (curidx < 0) // per-sprite init - curidx = pictoidx[curspr->picnum]; - else - curidx = clipinfo[curidx].next; - - while (curidx>=0 && (curspr->cstat&32) != (sector[sectq[clipinfo[curidx].qbeg]].CM_CSTAT&32)) - curidx = clipinfo[curidx].next; - - if (curidx < 0) - { - clipspritecnt++; - continue; - } - - clipsprite_initindex(curidx, curspr, &clipsectcnt, vect); - - for (i=0; ix,vect->y,&daz,&daz2); - getzsofslope(sectq[clipinfo[curidx].qend],vect->x,vect->y,&cz,&fz); - - if ((sector[k].ceilingstat&1)==0) - { - if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = (curspr-sprite)+49152; } - if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = (curspr-sprite)+49152; } - } - if ((sector[k].floorstat&1)==0) - { - if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = (curspr-sprite)+49152; } - if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = (curspr-sprite)+49152; } - } - } - } - - sec = §or[clipsectorlist[clipsectcnt]]; - startwall = sec->wallptr; endwall = startwall + sec->wallnum; - for (j=startwall,wal=&wall[startwall]; jnextsector; - if (k >= 0) - { - wal2 = &wall[wal->point2]; - x1 = wal->x; x2 = wal2->x; - if ((x1 < xmin) && (x2 < xmin)) continue; - if ((x1 > xmax) && (x2 > xmax)) continue; - y1 = wal->y; y2 = wal2->y; - if ((y1 < ymin) && (y2 < ymin)) continue; - if ((y1 > ymax) && (y2 > ymax)) continue; - - dx = x2-x1; dy = y2-y1; - if (dx*(vect->y-y1) < (vect->x-x1)*dy) continue; //back - if (dx > 0) dax = dx*(ymin-y1); else dax = dx*(ymax-y1); - if (dy > 0) day = dy*(xmax-x1); else day = dy*(xmin-x1); - if (dax >= day) continue; - - if (wal->cstat&dawalclipmask) continue; - sec = §or[k]; - - if (curspr) - { - if (k==sectq[clipinfo[curidx].qend]) - continue; - if ((sec->ceilingstat&1) && (sec->floorstat&1)) - continue; - } - else if (editstatus == 0) - { - if (((sec->ceilingstat&1) == 0) && (vect->z <= sec->ceilingz+(3<<8))) continue; - if (((sec->floorstat&1) == 0) && (vect->z >= sec->floorz-(3<<8))) continue; - } - - for (i=clipsectnum-1; i>=0; i--) if (clipsectorlist[i] == k) break; - if (i < 0) clipsectorlist[clipsectnum++] = k; - - if ((x1 < xmin+MAXCLIPDIST) && (x2 < xmin+MAXCLIPDIST)) continue; - if ((x1 > xmax-MAXCLIPDIST) && (x2 > xmax-MAXCLIPDIST)) continue; - if ((y1 < ymin+MAXCLIPDIST) && (y2 < ymin+MAXCLIPDIST)) continue; - if ((y1 > ymax-MAXCLIPDIST) && (y2 > ymax-MAXCLIPDIST)) continue; - if (dx > 0) dax += dx*MAXCLIPDIST; else dax -= dx*MAXCLIPDIST; - if (dy > 0) day -= dy*MAXCLIPDIST; else day += dy*MAXCLIPDIST; - if (dax >= day) continue; - - //It actually got here, through all the continue's!!! - getzsofslope((int16_t)k,vect->x,vect->y,&daz,&daz2); - if (curspr) - { - int32_t fz,cz; - getzsofslope(sectq[clipinfo[curidx].qend],vect->x,vect->y,&cz,&fz); - - if ((sec->ceilingstat&1)==0) - { - if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = (curspr-sprite)+49152; } - if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = (curspr-sprite)+49152; } - } - if ((sec->floorstat&1)==0) - { - if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = (curspr-sprite)+49152; } - if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = (curspr-sprite)+49152; } - } - } - else - { - if (daz > *ceilz) { *ceilz = daz; *ceilhit = k+16384; } - if (daz2 < *florz) { *florz = daz2; *florhit = k+16384; } - } - } - } - clipsectcnt++; - } - while (clipsectcnt < clipsectnum || clipspritecnt < clipspritenum); - - if (curspr) - { - mapinfo_set(NULL, &origmapinfo); // restore original map - return; - } - - for (i=0; i=0; j=nextspritesect[j]) - { - spr = &sprite[j]; - cstat = spr->cstat; - if (cstat&dasprclipmask) - { - if (clipsprite_try(spr, xmin,ymin, xmax,ymax)) - continue; - - x1 = spr->x; y1 = spr->y; - - clipyou = 0; - switch (cstat&48) - { - case 0: - k = walldist+(spr->clipdist<<2)+1; - if ((klabs(x1-vect->x) <= k) && (klabs(y1-vect->y) <= k)) - { - daz = spr->z; - k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1); - if (cstat&128) daz += k; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - daz2 = daz - (k<<1); - clipyou = 1; - } - break; - case 16: - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - if ((cstat&4) > 0) xoff = -xoff; - k = spr->ang; l = spr->xrepeat; - dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l; - l = tilesizx[tilenum]; k = (l>>1)+xoff; - x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l); - y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l); - if (clipinsideboxline(vect->x,vect->y,x1,y1,x2,y2,walldist+1) != 0) - { - daz = spr->z; k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1); - if (cstat&128) daz += k; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - daz2 = daz-(k<<1); - clipyou = 1; - } - break; - case 32: - daz = spr->z; daz2 = daz; - - if ((cstat&64) != 0) - if ((vect->z > daz) == ((cstat&8)==0)) continue; - - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset); - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; - - ang = spr->ang; - cosang = sintable[(ang+512)&2047]; sinang = sintable[ang]; - xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat; - yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat; - - dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat; - x1 += dmulscale16(sinang,dax,cosang,day)-vect->x; - y1 += dmulscale16(sinang,day,-cosang,dax)-vect->y; - l = xspan*xrepeat; - x2 = x1 - mulscale16(sinang,l); - y2 = y1 + mulscale16(cosang,l); - l = yspan*yrepeat; - k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k; - k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k; - - dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist+4); - day = mulscale14(sintable[(spr->ang-256)&2047],walldist+4); - x1 += dax; x2 -= day; x3 -= dax; x4 += day; - y1 += day; y2 += dax; y3 -= day; y4 -= dax; - - if ((y1^y2) < 0) - { - if ((x1^x2) < 0) clipyou ^= (x1*y2= 0) clipyou ^= 1; - } - if ((y2^y3) < 0) - { - if ((x2^x3) < 0) clipyou ^= (x2*y3= 0) clipyou ^= 1; - } - if ((y3^y4) < 0) - { - if ((x3^x4) < 0) clipyou ^= (x3*y4= 0) clipyou ^= 1; - } - if ((y4^y1) < 0) - { - if ((x4^x1) < 0) clipyou ^= (x4*y1= 0) clipyou ^= 1; - } - break; - } - - if (clipyou != 0) - { - if ((vect->z > daz) && (daz > *ceilz)) { *ceilz = daz; *ceilhit = j+49152; } - if ((vect->z < daz2) && (daz2 < *florz)) { *florz = daz2; *florhit = j+49152; } - } - } - } - } - - if (clipspritenum>0) - goto beginagain; -} - -void setaspect_new() -{ - if (r_usenewaspect && newaspect_enable) - { - // the correction factor 100/107 has been found - // out experimentally. squares ftw! - int32_t vr, yx=(65536*4*100)/(3*107); - int32_t y, x; - - if (fullscreen) - { - x=r_screenxy/100; y=r_screenxy%100; - if (y==0 || x==0) { x=4; y=3; } - } - else - { - x = xdim; - y = ydim; - } - - vr = (65536*x*3)/(y*4); - - setaspect(vr, yx); - } - else - setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); -} - -// -// setview -// -void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2) -{ - int32_t i; - - windowx1 = x1; wx1 = (x1<<12); - windowy1 = y1; wy1 = (y1<<12); - windowx2 = x2; wx2 = ((x2+1)<<12); - windowy2 = y2; wy2 = ((y2+1)<<12); - - xdimen = (x2-x1)+1; halfxdimen = (xdimen>>1); - xdimenrecip = divscale32(1L,xdimen); - ydimen = (y2-y1)+1; - - setaspect_new(); - - for (i=0; i cx2) || (cy1 > cy2)) return; - if (z <= 16) return; - if (picanm[picnum]&192) picnum += animateoffs(picnum,(int16_t)0xc000); - if ((tilesizx[picnum] <= 0) || (tilesizy[picnum] <= 0)) return; - - if (((dastat&128) == 0) || (numpages < 2) || (beforedrawrooms != 0)) - { - begindrawing(); //{{{ - dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,guniqhudid); - enddrawing(); //}}} - } - - if ((dastat&64) && (cx1 <= 0) && (cy1 <= 0) && (cx2 >= xdim-1) && (cy2 >= ydim-1) && - (sx == (160<<16)) && (sy == (100<<16)) && (z == 65536L) && (a == 0) && ((dastat&1) == 0)) - permhead = permtail = 0; - - if ((dastat&128) == 0) return; - if (numpages >= 2) - { - per = &permfifo[permhead]; - per->sx = sx; per->sy = sy; per->z = z; per->a = a; - per->picnum = picnum; - per->dashade = dashade; per->dapalnum = dapalnum; - per->dastat = dastat; - per->pagesleft = numpages+((beforedrawrooms&1)<<7); - per->cx1 = cx1; per->cy1 = cy1; per->cx2 = cx2; per->cy2 = cy2; - per->uniqid = guniqhudid; //JF extension - - //Would be better to optimize out true bounding boxes - if (dastat&64) //If non-masking write, checking for overlapping cases - { - for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) - { - per2 = &permfifo[i]; - if ((per2->pagesleft&127) == 0) continue; - if (per2->sx != per->sx) continue; - if (per2->sy != per->sy) continue; - if (per2->z != per->z) continue; - if (per2->a != per->a) continue; - if (tilesizx[per2->picnum] > tilesizx[per->picnum]) continue; - if (tilesizy[per2->picnum] > tilesizy[per->picnum]) continue; - if (per2->cx1 < per->cx1) continue; - if (per2->cy1 < per->cy1) continue; - if (per2->cx2 > per->cx2) continue; - if (per2->cy2 > per->cy2) continue; - per2->pagesleft = 0; - } - if ((per->z == 65536) && (per->a == 0)) - for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) - { - per2 = &permfifo[i]; - if ((per2->pagesleft&127) == 0) continue; - if (per2->z != 65536) continue; - if (per2->a != 0) continue; - if (per2->cx1 < per->cx1) continue; - if (per2->cy1 < per->cy1) continue; - if (per2->cx2 > per->cx2) continue; - if (per2->cy2 > per->cy2) continue; - if ((per2->sx>>16) < (per->sx>>16)) continue; - if ((per2->sy>>16) < (per->sy>>16)) continue; - if ((per2->sx>>16)+tilesizx[per2->picnum] > (per->sx>>16)+tilesizx[per->picnum]) continue; - if ((per2->sy>>16)+tilesizy[per2->picnum] > (per->sy>>16)+tilesizy[per->picnum]) continue; - per2->pagesleft = 0; - } - } - - permhead = ((permhead+1)&(MAXPERMS-1)); - } -} - - -// -// makepalookup -// -void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat) -{ - int32_t i, j, palscale; - char *ptr, *ptr2; - - if (paletteloaded == 0) return; - - if (palookup[palnum] == NULL) - { - //Allocate palookup buffer - if ((palookup[palnum] = (char *)Bmalloc(numpalookups<<8)) == NULL) - allocache((intptr_t *)&palookup[palnum],numpalookups<<8,&permanentlock); - } - - if (dastat == 0) return; - if ((r|g|b|63) != 63) return; - - if ((r|g|b) == 0) - { - for (i=0; i<256; i++) - { - ptr = (char *)(FP_OFF(palookup[0])+remapbuf[i]); - ptr2 = (char *)(FP_OFF(palookup[palnum])+i); - for (j=0; j= MAXBASEPALS) - thebasepalcount = MAXBASEPALS - 1; - - basepaltableptr = thebasepaltable; - basepalcount = thebasepalcount; -} - -// -// setbrightness -// -void setbrightness(char dabrightness, uint8_t dapalid, char noapply) -{ - int32_t i, k, j; - uint8_t *dapal; -// uint32_t lastbright = curbrightness; - - if (dapalid >= basepalcount) - dapalid = 0; - - curbasepal = dapalid; - - dapal = basepaltableptr[dapalid]; - - if (!(noapply&4)) - { - curbrightness = min(max((int32_t)dabrightness,0),15); -// if (lastbright != (unsigned)curbrightness) -// vid_gamma = 1.0 + ((float)curbrightness / 10.0); - } - - if (setgamma()) j = curbrightness; else j = 0; - - for (k=i=0; i<256; i++) - { - // save palette without any brightness adjustment - curpalette[i].r = dapal[i*3+0] << 2; - curpalette[i].g = dapal[i*3+1] << 2; - curpalette[i].b = dapal[i*3+2] << 2; - curpalette[i].f = 0; - - // brightness adjust the palette - curpalettefaded[i].b = britable[j][ curpalette[i].b ]; - curpalettefaded[i].g = britable[j][ curpalette[i].g ]; - curpalettefaded[i].r = britable[j][ curpalette[i].r ]; - curpalettefaded[i].f = 0; - } - - if ((noapply&1) == 0) setpalette(0,256); - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - static uint32_t lastpalettesum = 0; - uint32_t newpalettesum = crc32once((uint8_t *)curpalettefaded, sizeof(curpalettefaded)); - - // only reset the textures if the preserve flag (bit 1 of noapply) is clear and - // either (a) the new palette is different to the last, or (b) the brightness - // changed and we couldn't set it using hardware gamma - if (!(noapply&2) && (newpalettesum != lastpalettesum)) - gltexinvalidateall(); - if (!(noapply&8) && (newpalettesum != lastpalettesum)) - gltexinvalidate8(); -#ifdef POLYMER - if ((rendmode == 4) && (newpalettesum != lastpalettesum)) - polymer_texinvalidate(); -#endif - lastpalettesum = newpalettesum; - } -#endif - - palfadergb.r = palfadergb.g = palfadergb.b = 0; - palfadedelta = 0; -} - -static inline palette_t getpal(int32_t col) -{ - if (gammabrightness) return curpalette[col]; - else - { - palette_t p; - p.b = britable[curbrightness][ curpalette[col].b ]; - p.g = britable[curbrightness][ curpalette[col].g ]; - p.r = britable[curbrightness][ curpalette[col].r ]; - return p; - } -} - -// -// setpalettefade -// -void setpalettefade(char r, char g, char b, char offset) -{ - int32_t i; - palette_t p; - - palfadergb.r = min(63,r) << 2; - palfadergb.g = min(63,g) << 2; - palfadergb.b = min(63,b) << 2; - palfadedelta = min(63,offset) << 2; - - for (i=0; i<256; i++) - { - p = getpal(i); - - curpalettefaded[i].b = - p.b + (((palfadergb.b - p.b) * offset) >> 6); - curpalettefaded[i].g = - p.g + (((palfadergb.g - p.g) * offset) >> 6); - curpalettefaded[i].r = - p.r + (((palfadergb.r - p.r) * offset) >> 6); - curpalettefaded[i].f = 0; - } - - setpalette(0,256); -} - - -// -// clearview -// -void clearview(int32_t dacol) -{ - intptr_t p; - int32_t y, dx; - - if (qsetmode != 200) return; - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - palette_t p = getpal(dacol); - - bglClearColor(((float)p.r)/255.0, - ((float)p.g)/255.0, - ((float)p.b)/255.0, - 0); - bglClear(GL_COLOR_BUFFER_BIT); - return; - } -#endif - - begindrawing(); //{{{ - dx = windowx2-windowx1+1; - //dacol += (dacol<<8); dacol += (dacol<<16); - p = frameplace+ylookup[windowy1]+windowx1; - for (y=windowy1; y<=windowy2; y++) - { - //clearbufbyte((void*)p,dx,dacol); - Bmemset((void *)p,dacol,dx); - p += ylookup[1]; - } - enddrawing(); //}}} - - faketimerhandler(); -} - - -// -// clearallviews -// -void clearallviews(int32_t dacol) -{ - if (qsetmode != 200) return; - //dacol += (dacol<<8); dacol += (dacol<<16); - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - palette_t p = getpal(dacol); - - bglViewport(0,0,xdim,ydim); glox1 = -1; - bglClearColor(((float)p.r)/255.0, - ((float)p.g)/255.0, - ((float)p.b)/255.0, - 0); - bglClear(GL_COLOR_BUFFER_BIT); - return; - } -#endif - - begindrawing(); //{{{ - //clearbufbyte((void*)frameplace,imageSize,0L); - Bmemset((void *)frameplace,dacol,imageSize); - enddrawing(); //}}} - //nextpage(); - - faketimerhandler(); -} - - -// -// plotpixel -// -void plotpixel(int32_t x, int32_t y, char col) -{ -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) - { - palette_t p = getpal(col); - - setpolymost2dview(); // JBF 20040205: more efficient setup - -// bglBegin(GL_POINTS); -// bglColor4ub(p.r,p.g,p.b,255); -// bglVertex2i(x,y); -// bglEnd(); - bglRasterPos4i(x, y, 0, 1); - bglDrawPixels(1, 1, GL_RGB, GL_UNSIGNED_BYTE, &p); - bglRasterPos4i(0, 0, 0, 1); - return; - } -#endif - - begindrawing(); //{{{ - drawpixel_safe((void *)(ylookup[y]+x+frameplace),(int32_t)col); - enddrawing(); //}}} -} - -void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char col) -{ - int32_t i; - -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) - { - palette_t p = getpal(col); - - bglBegin(GL_LINE_STRIP); - - bglColor4ub(p.r, p.g, p.b, 1); - - for (i=0; i= 3 && qsetmode == 200) return 0; -#endif - - begindrawing(); //{{{ - r = readpixel((void *)(ylookup[y]+x+frameplace)); - enddrawing(); //}}} - return(r); -} - - -//MUST USE RESTOREFORDRAWROOMS AFTER DRAWING - -// -// setviewtotile -// -void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz) -{ - int32_t i, j; - - //DRAWROOMS TO TILE BACKUP&SET CODE - tilesizx[tilenume] = xsiz; tilesizy[tilenume] = ysiz; - bakxsiz[setviewcnt] = xsiz; bakysiz[setviewcnt] = ysiz; - bakframeplace[setviewcnt] = frameplace; frameplace = waloff[tilenume]; - bakwindowx1[setviewcnt] = windowx1; bakwindowy1[setviewcnt] = windowy1; - bakwindowx2[setviewcnt] = windowx2; bakwindowy2[setviewcnt] = windowy2; -#ifdef USE_OPENGL - if (setviewcnt == 0) - { - bakrendmode = rendmode; - baktile = tilenume; - } - rendmode = 0;//2; -#endif - copybufbyte(&startumost[windowx1],&bakumost[windowx1],(windowx2-windowx1+1)*sizeof(bakumost[0])); - copybufbyte(&startdmost[windowx1],&bakdmost[windowx1],(windowx2-windowx1+1)*sizeof(bakdmost[0])); - setviewcnt++; - - offscreenrendering = 1; - setview(0,0,ysiz-1,xsiz-1); - setaspect(65536,65536); - j = 0; for (i=0; i<=xsiz; i++) { ylookup[i] = j, j += ysiz; } - setvlinebpl(ysiz); -} - - -// -// setviewback -// -extern char modechange; -void setviewback(void) -{ - int32_t i, j, k; - - if (setviewcnt <= 0) return; - setviewcnt--; - - offscreenrendering = (setviewcnt>0); -#ifdef USE_OPENGL - if (setviewcnt == 0) - { - rendmode = bakrendmode; - invalidatetile(baktile,-1,-1); - } -#endif - - setview(bakwindowx1[setviewcnt],bakwindowy1[setviewcnt], - bakwindowx2[setviewcnt],bakwindowy2[setviewcnt]); - copybufbyte(&bakumost[windowx1],&startumost[windowx1],(windowx2-windowx1+1)*sizeof(startumost[0])); - copybufbyte(&bakdmost[windowx1],&startdmost[windowx1],(windowx2-windowx1+1)*sizeof(startdmost[0])); - frameplace = bakframeplace[setviewcnt]; - if (setviewcnt == 0) - k = bakxsiz[0]; - else - k = max(bakxsiz[setviewcnt-1],bakxsiz[setviewcnt]); - j = 0; for (i=0; i<=k; i++) ylookup[i] = j, j += bytesperline; - setvlinebpl(bytesperline); - modechange=1; -} - - -// -// squarerotatetile -// -void squarerotatetile(int16_t tilenume) -{ - int32_t siz; - - //supports square tiles only for rotation part - if ((siz = tilesizx[tilenume]) == tilesizy[tilenume]) - { - int32_t i = siz-1; - - for (; i>=0; i--) - { - int32_t j=(i>>1)-1; - char *ptr1 = (char *)(waloff[tilenume]+i*(siz+1)), *ptr2 = ptr1; - if (i&1) swapchar(--ptr1, (ptr2 -= siz)); - for (; j>=0; j--) swapchar2((ptr1 -= 2), (ptr2 -= (siz<<1)), siz); - } - } -} - -// -// preparemirror -// -void preparemirror(int32_t dax, int32_t day, int32_t daz, int16_t daang, int32_t dahoriz, int16_t dawall, int16_t dasector, int32_t *tposx, int32_t *tposy, int16_t *tang) -{ - int32_t i, j, x, y, dx, dy; - - UNREFERENCED_PARAMETER(daz); - UNREFERENCED_PARAMETER(dahoriz); - UNREFERENCED_PARAMETER(dasector); - - x = wall[dawall].x; dx = wall[wall[dawall].point2].x-x; - y = wall[dawall].y; dy = wall[wall[dawall].point2].y-y; - j = dx*dx + dy*dy; if (j == 0) return; - i = (((dax-x)*dx + (day-y)*dy)<<1); - *tposx = (x<<1) + scale(dx,i,j) - dax; - *tposy = (y<<1) + scale(dy,i,j) - day; - *tang = (((getangle(dx,dy)<<1)-daang)&2047); - - inpreparemirror = 1; -} - - -// -// completemirror -// -void completemirror(void) -{ - int32_t i, dy; - intptr_t p; - -#ifdef USE_OPENGL - if (rendmode) return; -#endif - - //Can't reverse with uninitialized data - if (inpreparemirror) { inpreparemirror = 0; return; } - if (mirrorsx1 > 0) mirrorsx1--; - if (mirrorsx2 < windowx2-windowx1-1) mirrorsx2++; - if (mirrorsx2 < mirrorsx1) return; - - begindrawing(); - p = frameplace+ylookup[windowy1+mirrorsy1]+windowx1+mirrorsx1; - i = windowx2-windowx1-mirrorsx2-mirrorsx1; mirrorsx2 -= mirrorsx1; - for (dy=mirrorsy2-mirrorsy1-1; dy>=0; dy--) - { - copybufbyte((void *)(p+1),tempbuf,mirrorsx2+1); - tempbuf[mirrorsx2] = tempbuf[mirrorsx2-1]; - copybufreverse(&tempbuf[mirrorsx2],(void *)(p+i),mirrorsx2+1); - p += ylookup[1]; - faketimerhandler(); - } - enddrawing(); -} - - -// -// sectorofwall -// -static int32_t sectorofwall_internal(int16_t theline) -{ - int32_t i, gap; - - gap = (numsectors>>1); i = gap; - while (gap > 1) - { - gap >>= 1; - if (sector[i].wallptr < theline) i += gap; else i -= gap; - } - while (sector[i].wallptr > theline) i--; - while (sector[i].wallptr+sector[i].wallnum <= theline) i++; - return(i); -} - -int32_t sectorofwall(int16_t theline) -{ - int32_t i; - - if ((theline < 0) || (theline >= numwalls)) return(-1); - i = wall[theline].nextwall; if (i >= 0 && i < MAXWALLS) return(wall[i].nextsector); - - return sectorofwall_internal(theline); -} - -int32_t sectorofwall_noquick(int16_t theline) -{ - if ((theline < 0) || (theline >= numwalls)) return(-1); - - return sectorofwall_internal(theline); -} - - -// -// getceilzofslope -// -int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day) -{ - if (!(sector[sectnum].ceilingstat&2)) return(sector[sectnum].ceilingz); - - { - int32_t dx, dy, i, j; - walltype *wal; - - wal = &wall[sector[sectnum].wallptr]; - dx = wall[wal->point2].x-wal->x; dy = wall[wal->point2].y-wal->y; - i = (nsqrtasm(dx*dx+dy*dy)<<5); if (i == 0) return(sector[sectnum].ceilingz); - j = dmulscale3(dx,day-wal->y,-dy,dax-wal->x); - return(sector[sectnum].ceilingz+(scale(sector[sectnum].ceilingheinum,j>>1,i)<<1)); - } -} - - -// -// getflorzofslope -// -int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day) -{ - if (!(sector[sectnum].floorstat&2)) return(sector[sectnum].floorz); - - { - int32_t dx, dy, i, j; - walltype *wal; - - wal = &wall[sector[sectnum].wallptr]; - dx = wall[wal->point2].x-wal->x; dy = wall[wal->point2].y-wal->y; - i = (nsqrtasm(dx*dx+dy*dy)<<5); if (i == 0) return(sector[sectnum].floorz); - j = dmulscale3(dx,day-wal->y,-dy,dax-wal->x); - return(sector[sectnum].floorz+(scale(sector[sectnum].floorheinum,j>>1,i)<<1)); - } -} - - -// -// getzsofslope -// -void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) -{ - int32_t dx, dy, i, j; - walltype *wal, *wal2; - sectortype *sec; - - sec = §or[sectnum]; - *ceilz = sec->ceilingz; *florz = sec->floorz; - if ((sec->ceilingstat|sec->floorstat)&2) - { - wal = &wall[sec->wallptr]; wal2 = &wall[wal->point2]; - dx = wal2->x-wal->x; dy = wal2->y-wal->y; - i = (nsqrtasm(dx*dx+dy*dy)<<5); if (i == 0) return; - j = dmulscale3(dx,day-wal->y,-dy,dax-wal->x); - if (sec->ceilingstat&2) *ceilz = (*ceilz)+(scale(sec->ceilingheinum,j>>1,i)<<1); - if (sec->floorstat&2) *florz = (*florz)+(scale(sec->floorheinum,j>>1,i)<<1); - } -} - - -// -// alignceilslope -// -void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z) -{ - int32_t i, dax, day; - walltype *wal; - - wal = &wall[sector[dasect].wallptr]; - dax = wall[wal->point2].x-wal->x; - day = wall[wal->point2].y-wal->y; - - i = (y-wal->y)*dax - (x-wal->x)*day; if (i == 0) return; - sector[dasect].ceilingheinum = scale((z-sector[dasect].ceilingz)<<8, - nsqrtasm(dax*dax+day*day),i); - - if (sector[dasect].ceilingheinum == 0) sector[dasect].ceilingstat &= ~2; - else sector[dasect].ceilingstat |= 2; -} - - -// -// alignflorslope -// -void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z) -{ - int32_t i, dax, day; - walltype *wal; - - wal = &wall[sector[dasect].wallptr]; - dax = wall[wal->point2].x-wal->x; - day = wall[wal->point2].y-wal->y; - - i = (y-wal->y)*dax - (x-wal->x)*day; if (i == 0) return; - sector[dasect].floorheinum = scale((z-sector[dasect].floorz)<<8, - nsqrtasm(dax*dax+day*day),i); - - if (sector[dasect].floorheinum == 0) sector[dasect].floorstat &= ~2; - else sector[dasect].floorstat |= 2; -} - - -// -// loopnumofsector -// -int32_t loopnumofsector(int16_t sectnum, int16_t wallnum) -{ - int32_t i, numloops, startwall, endwall; - - numloops = 0; - startwall = sector[sectnum].wallptr; - endwall = startwall + sector[sectnum].wallnum; - for (i=startwall; i= startwall+danumwalls)) return; - - tmpwall = Bmalloc(danumwalls * sizeof(walltype)); - if (!tmpwall) - { - initprintf("setfirstwall: OUT OF MEMORY!\n"); - return; - } - - Bmemcpy(tmpwall, &wall[startwall], danumwalls*sizeof(walltype)); -// for (i=0; i 0) - { - j = 0; - while (loopnumofsector(sectnum,j+startwall) != dagoalloop) j++; - for (i=0; i= danumwalls) k -= danumwalls; - Bmemcpy(&wall[startwall+i], &tmpwall[k], sizeof(walltype)); - - wall[startwall+i].point2 += danumwalls-startwall-j; - if (wall[startwall+i].point2 >= danumwalls) - wall[startwall+i].point2 -= danumwalls; - wall[startwall+i].point2 += startwall; - } - newfirstwall += danumwalls-j; - if (newfirstwall >= startwall+danumwalls) newfirstwall -= danumwalls; - } - - for (i=0; i= numwallsofloop) k -= numwallsofloop; - Bmemcpy(&wall[startwall+i], &tmpwall[k], sizeof(walltype)); - - wall[startwall+i].point2 += numwallsofloop-newfirstwall; - if (wall[startwall+i].point2 >= numwallsofloop) - wall[startwall+i].point2 -= numwallsofloop; - wall[startwall+i].point2 += startwall; - } - - for (i=startwall; i= 0) wall[wall[i].nextwall].nextwall = i; - - Bfree(tmpwall); -} - - -// -// drawline256 -// -void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) -{ - int32_t dx, dy, i, j, inc, plc, daend; - intptr_t p; - - col = palookup[0][col]; - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - palette_t p; - if (gammabrightness) p = curpalette[col]; - else - { - p.r = britable[curbrightness][ curpalette[col].r ]; - p.g = britable[curbrightness][ curpalette[col].g ]; - p.b = britable[curbrightness][ curpalette[col].b ]; - } - - setpolymost2dview(); // JBF 20040205: more efficient setup - - //bglEnable(GL_BLEND); // When using line antialiasing, this is needed - bglBegin(GL_LINES); - bglColor4ub(p.r,p.g,p.b,255); - bglVertex2f((float)x1/4096.0,(float)y1/4096.0); - bglVertex2f((float)x2/4096.0,(float)y2/4096.0); - bglEnd(); - //bglDisable(GL_BLEND); - - return; - } -#endif - - dx = x2-x1; dy = y2-y1; - if (dx >= 0) - { - if ((x1 >= wx2) || (x2 < wx1)) return; - if (x1 < wx1) y1 += scale(wx1-x1,dy,dx), x1 = wx1; - if (x2 > wx2) y2 += scale(wx2-x2,dy,dx), x2 = wx2; - } - else - { - if ((x2 >= wx2) || (x1 < wx1)) return; - if (x2 < wx1) y2 += scale(wx1-x2,dy,dx), x2 = wx1; - if (x1 > wx2) y1 += scale(wx2-x1,dy,dx), x1 = wx2; - } - if (dy >= 0) - { - if ((y1 >= wy2) || (y2 < wy1)) return; - if (y1 < wy1) x1 += scale(wy1-y1,dx,dy), y1 = wy1; - if (y2 > wy2) x2 += scale(wy2-y2,dx,dy), y2 = wy2; - } - else - { - if ((y2 >= wy2) || (y1 < wy1)) return; - if (y2 < wy1) x2 += scale(wy1-y2,dx,dy), y2 = wy1; - if (y1 > wy2) x1 += scale(wy2-y1,dx,dy), y1 = wy2; - } - - if (klabs(dx) >= klabs(dy)) - { - if (dx == 0) return; - if (dx < 0) - { - i = x1; x1 = x2; x2 = i; - i = y1; y1 = y2; y2 = i; - } - - inc = divscale12(dy,dx); - plc = y1+mulscale12((2047-x1)&4095,inc); - i = ((x1+2048)>>12); daend = ((x2+2048)>>12); - - begindrawing(); //{{{ - for (; i>12); - if ((j >= startumost[i]) && (j < startdmost[i])) - drawpixel_safe((void *)(frameplace+ylookup[j]+i),col); - plc += inc; - } - enddrawing(); //}}} - } - else - { - if (dy < 0) - { - i = x1; x1 = x2; x2 = i; - i = y1; y1 = y2; y2 = i; - } - - inc = divscale12(dx,dy); - plc = x1+mulscale12((2047-y1)&4095,inc); - i = ((y1+2048)>>12); daend = ((y2+2048)>>12); - - begindrawing(); //{{{ - p = ylookup[i]+frameplace; - for (; i>12); - if ((i >= startumost[j]) && (i < startdmost[j])) - drawpixel_safe((void *)(j+p),col); - plc += inc; p += ylookup[1]; - } - enddrawing(); //}}} - } -} - -//static void attach_here() {} - -// -// drawline16 -// -// JBF: Had to add extra tests to make sure x-coordinates weren't winding up -'ve -// after clipping or crashes would ensue -uint32_t drawlinepat = 0xffffffff; - -int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) -{ - int32_t i, dx, dy, pinc, d; - uint32_t patc=0; - intptr_t p; - -//int32_t odx,ody; -//int32_t ox1=x1,oy1=y1, ox2=x2,oy2=y2; - - dx = x2-x1; - dy = y2-y1; - -//odx=dx; -//ody=dy; - - if (dx >= 0) - { - if (x1 >= xres || x2 < 0) - return 0; - if (x1 < 0) - { - if (dy) y1 += scale(0-x1,dy,dx); - x1 = 0; - } - if (x2 >= xres) - { - if (dy) y2 += scale(xres-1-x2,dy,dx); - x2 = xres-1; - } - } - else - { - if (x2 >= xres || x1 < 0) - return 0; - if (x2 < 0) - { - if (dy) y2 += scale(0-x2,dy,dx); - x2 = 0; - } - if (x1 >= xres) - { - if (dy) y1 += scale(xres-1-x1,dy,dx); - x1 = xres-1; - } - } - - if (dy >= 0) - { - if (y1 >= ydim16 || y2 < 0) - return 0; - if (y1 < 0) - { - if (dx) x1 += scale(0-y1,dx,dy); - y1 = 0; - x1 = clamp(x1, 0, xres-1); - } - if (y2 >= ydim16) - { - if (dx) x2 += scale(ydim16-1-y2,dx,dy); - y2 = ydim16-1; - x2 = clamp(x2, 0, xres-1); - } - } - else - { - if (y2 >= ydim16 || y1 < 0) - return 0; - if (y2 < 0) - { - if (dx) x2 += scale(0-y2,dx,dy); - y2 = 0; - x2 = clamp(x2, 0, xres-1); - } - if (y1 >= ydim16) - { - if (dx) x1 += scale(ydim16-1-y1,dx,dy); - y1 = ydim16-1; - x1 = clamp(x1, 0, xres-1); - } - } - -//if (ox1||ox2||oy1||oy2) -// if (x1<0||x1>=xres || y2<0||y2>=yres) -// attach_here(); - - dx = klabs(x2-x1)+1; dy = klabs(y2-y1)+1; - if (dx >= dy) - { - if (x2 < x1) - { - i = x1; x1 = x2; x2 = i; - i = y1; y1 = y2; y2 = i; - } - d = 0; - if (y2 > y1) pinc = bytesperline; else pinc = -bytesperline; - - begindrawing(); //{{{ - p = (y1*bytesperline)+x1+frameplace; - if (dy == 0 && drawlinepat == 0xffffffff) - { - i = ((int32_t)col<<24)|((int32_t)col<<16)|((int32_t)col<<8)|col; - clearbufbyte((void *)p, dx, i); - } - else - for (i=dx; i>0; i--) - { - if (drawlinepat & pow2long[(patc++)&31]) - drawpixel((char *)p, col); - d += dy; - if (d >= dx) { d -= dx; p += pinc; } - p++; - } - enddrawing(); //}}} - - return 1; - } - - if (y2 < y1) - { - i = x1; x1 = x2; x2 = i; - i = y1; y1 = y2; y2 = i; - } - d = 0; - if (x2 > x1) pinc = 1; else pinc = -1; - - begindrawing(); //{{{ - p = (y1*bytesperline)+x1+frameplace; - for (i=dy; i>0; i--) - { - if (drawlinepat & pow2long[(patc++)&31]) - drawpixel((char *)p, col); - d += dx; - if (d >= dy) { d -= dy; p += pinc; } - p += bytesperline; - } - enddrawing(); //}}} - - return 1; -} - -static void drawline16mid(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) -{ - drawline16(halfxdim16+x1,midydim16+y1, halfxdim16+x2,midydim16+y2, col); -} - -// eccen: eccentricity of the ellipse, -// 16384: circle -// <16384: shrink in y -// >16384: grow in y -void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col) -{ - if (eccen==16384) - { - intptr_t p; - int32_t xp, yp, xpbpl, ypbpl, d, de, dse, patc=0; - - if (r < 0) r = -r; - if (x1+r < 0 || x1-r >= xres) return; - if (y1+r < 0 || y1-r >= ydim16) return; - - /* - * d - * 6 | 7 - * \ | / - * 5 \|/ 8 - * c----+----a - * 4 /|\ 1 - * / | \ - * 3 | 2 - * b - */ - - xp = 0; - yp = r; - d = 1 - r; - de = 2; - dse = 5 - (r << 1); - - begindrawing(); - p = (y1*bytesperline)+x1+frameplace; - - if (drawlinepat & pow2long[(patc++)&31]) - { - if ((uint32_t)y1 < (uint32_t)ydim16 && (uint32_t)(x1+r) < (uint32_t)xres) - drawpixel_safe((char *)(p+r), col); // a - if ((uint32_t)x1 < (uint32_t)xres && (uint32_t)(y1+r) < (uint32_t)ydim16) - drawpixel_safe((char *)(p+(r*bytesperline)), col); // b - if ((uint32_t)y1 < (uint32_t)ydim16 && (uint32_t)(x1-r) < (uint32_t)xres) - drawpixel_safe((char *)(p-r), col); // c - if ((uint32_t)x1 < (uint32_t)xres && (uint32_t)(y1-r) < (uint32_t)ydim16) - drawpixel_safe((char *)(p-(r*bytesperline)), col); // d - } - - do - { - if (d < 0) - { - d += de; - de += 2; - dse += 2; - xp++; - } - else - { - d += dse; - de += 2; - dse += 4; - xp++; - yp--; - } - - ypbpl = yp*bytesperline; - xpbpl = xp*bytesperline; - if (drawlinepat & pow2long[(patc++)&31]) - { - if ((uint32_t)(x1+yp) < (uint32_t)xres && (uint32_t)(y1+xp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p+yp+xpbpl), col); // 1 - if ((uint32_t)(x1+xp) < (uint32_t)xres && (uint32_t)(y1+yp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p+xp+ypbpl), col); // 2 - if ((uint32_t)(x1-xp) < (uint32_t)xres && (uint32_t)(y1+yp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p-xp+ypbpl), col); // 3 - if ((uint32_t)(x1-yp) < (uint32_t)xres && (uint32_t)(y1+xp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p-yp+xpbpl), col); // 4 - if ((uint32_t)(x1-yp) < (uint32_t)xres && (uint32_t)(y1-xp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p-yp-xpbpl), col); // 5 - if ((uint32_t)(x1-xp) < (uint32_t)xres && (uint32_t)(y1-yp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p-xp-ypbpl), col); // 6 - if ((uint32_t)(x1+xp) < (uint32_t)xres && (uint32_t)(y1-yp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p+xp-ypbpl), col); // 7 - if ((uint32_t)(x1+yp) < (uint32_t)xres && (uint32_t)(y1-xp) < (uint32_t)ydim16) - drawpixel_safe((char *)(p+yp-xpbpl), col); // 8 - } - } - while (yp > xp); - enddrawing(); - } - else - { - // JonoF's rough approximation of a circle - int32_t l,spx,spy,lpx,lpy,px,py; - - spx = lpx = x1 + mulscale14(r,sintable[0]); - spy = lpy = y1 + mulscale14(eccen, mulscale14(r,sintable[512])); - - for (l=64; l<2048; l+=64) - { - px = x1 + mulscale14(r,sintable[l]); - py = y1 + mulscale14(eccen, mulscale14(r,sintable[(l+512)&2047])); - - drawline16(lpx,lpy,px,py,col); - - lpx = px; - lpy = py; - } - - drawline16(lpx,lpy,spx,spy,col); - } -} - - -// -// qsetmode640350 -// -void qsetmode640350(void) -{ - if (qsetmode != 350) - { - if (setvideomode(640, 350, 8, fullscreen) < 0) - { - //fprintf(stderr, "Couldn't set 640x350 video mode for some reason.\n"); - return; - } - - xdim = xres; - ydim = yres; - -// setvgapalette(); - - ydim16 = 350; - halfxdim16 = 320; - midydim16 = 146; - - begindrawing(); //{{{ - clearbuf((char *)frameplace, (bytesperline*350L) >> 2, 0); - enddrawing(); //}}} - } - - qsetmode = 350; -} - - -// -// qsetmode640480 -// -void qsetmode640480(void) -{ - if (qsetmode != 480) - { - if (setvideomode(640, 480, 8, fullscreen) < 0) - { - //fprintf(stderr, "Couldn't set 640x480 video mode for some reason.\n"); - return; - } - - xdim = xres; - ydim = yres; - -// setvgapalette(); - - ydim16 = 336; - halfxdim16 = 320; - midydim16 = 200; - - begindrawing(); //{{{ - clearbuf((char *)(frameplace + (336l*bytesperline)), (bytesperline*144L) >> 2, 0x08080808l); - clearbuf((char *)frameplace, (bytesperline*336L) >> 2, 0L); - enddrawing(); //}}} - } - - qsetmode = 480; -} - - -// -// qsetmodeany -// -void qsetmodeany(int32_t daxdim, int32_t daydim) -{ - if (daxdim < 640) daxdim = 640; - if (daydim < 480) daydim = 480; - - if (qsetmode != ((daxdim<<16)|(daydim&0xffff))) - { - if (setvideomode(daxdim, daydim, 8, fullscreen) < 0) - return; - - xdim = xres; - ydim = yres; - -// setvgapalette(); - - ydim16 = yres - STATUS2DSIZ2; - halfxdim16 = xres >> 1; - midydim16 = ydim16 >> 1; // scale(200,yres,480); - - begindrawing(); //{{{ - clearbuf((char *)(frameplace + (ydim16*bytesperline)), (bytesperline*STATUS2DSIZ2) >> 2, 0x08080808l); - clearbuf((char *)frameplace, (ydim16*bytesperline) >> 2, 0L); - enddrawing(); //}}} - } - - qsetmode = ((daxdim<<16)|(daydim&0xffff)); -} - - -// -// clear2dscreen -// -void clear2dscreen(void) -{ - int32_t clearsz; - - begindrawing(); //{{{ - if (qsetmode == 350) clearsz = 350; - else - { - if (ydim16 <= yres-STATUS2DSIZ2) clearsz = yres - STATUS2DSIZ2; - else clearsz = yres; - } - clearbuf((char *)frameplace, (bytesperline*clearsz) >> 2, 0); - enddrawing(); //}}} -} - - -////////// editor side view ////////// - -inline int32_t scalescreeny(int32_t sy) -{ - if (m32_sideview) - return mulscale14(sy, m32_sidesin); - else - return sy; -} - -// return screen coordinates for BUILD coords x and y (relative to current position) -void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) -{ - if (m32_sideview) - rotatepoint(0,0, x,y, m32_sideang, &x,&y); - - *xres = mulscale14(x,zoome); - *yres = scalescreeny(mulscale14(y,zoome)); -} - -#if 0 -void invscreencoords(int32_t *dx, int32_t *dy, int32_t sx, int32_t sy, int32_t zoome) -{ - if (m32_sidesin==0 || zoome==0) { *dx=0; *dy=0; return; } - - sy = divscale14(divscale14(sy, m32_sidesin), zoome); - sx = divscale14(sx, zoome); - - rotatepoint(0,0, sx,sy, -m32_sideang, dx,dy); -} -#endif - -// invscreencoords with sx==0 and sy==getscreenvdisp(dz, zoom) -int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) -{ - if (m32_sidesin==0) - return 1; - - dz = (((int64_t)dz * (int64_t)m32_sidecos)/(int64_t)m32_sidesin)>>4; - rotatepoint(0,0, 0,dz, -m32_sideang, dx,dy); - - return 0; -} - -// return vertical screen coordinate displacement for BUILD z coord -inline int32_t getscreenvdisp(int32_t bz, int32_t zoome) -{ - return mulscale32(bz,zoome*m32_sidecos); -} - -void setup_sideview_sincos() -{ - if (m32_sideview) - { - m32_viewplane.x = 0; - m32_viewplane.y = -512; - - m32_sidesin = sintable[m32_sideelev&2047]; - m32_sidecos = sintable[(m32_sideelev+512)&2047]; - - rotatepoint(0,0, m32_viewplane.x,m32_viewplane.y, -m32_sideang, &m32_viewplane.x,&m32_viewplane.y); - m32_viewplane.x = mulscale14(m32_viewplane.x, m32_sidecos); - m32_viewplane.y = mulscale14(m32_viewplane.y, m32_sidecos); - m32_viewplane.z = m32_sidesin>>5; - } -} - -static void sideview_getdist(int16_t sw, int16_t sect) -{ - vec3_t *p; - vec3_t v; - - if (sw>1; - v.y = (wall[sw].y + wall[wall[sw].point2].y)>>1; - v.z = getflorzofslope(sect, v.x, v.y); - p = &v; - } - else - p = (vec3_t *)&sprite[sw-MAXWALLS]; - - m32_sidedist[sw] = p->x*m32_viewplane.x + p->y*m32_viewplane.y + (p->z>>4)*m32_viewplane.z; -} - -static int sideview_cmppoints(const int16_t *sw1, const int16_t *sw2) -{ - int32_t dist1 = m32_sidedist[*sw1]; - int32_t dist2 = m32_sidedist[*sw2]; - - if (dist2>dist1) - return 1; - else if (dist1>dist2) - return -1; - -// if (*sw1=0) - (wall[*sw1].nextwall>=0); - - return 0; -} - -// -// draw2dgrid -// -void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) -{ - int64_t i, xp1, yp1, xp2=0, yp2, tempy; - - UNREFERENCED_PARAMETER(ange); - - if (gride <= 0) - return; - - begindrawing(); //{{{ - - if (m32_sideview) - { - int32_t sx1,sy1, sx2,sy2, dx=0,dy=0; - int32_t xinc=0, yinc=2048>>gride, yofs; - -// yofs = getscreenvdisp((yinc-posze)&((yinc<<4)-1), zoome); - if (cursectnum<0 || cursectnum>=numsectors) - yofs = getscreenvdisp(-posze, zoome); - else - yofs = getscreenvdisp(getflorzofslope(cursectnum, posxe,posye)-posze, zoome); - - while (scalescreeny(mulscale14(yinc, zoome))==0 && gride>2) - { - gride--; - yinc = 2048>>gride; - } - - xp2 = xp1 = ((posxe+(1024>>gride))&(((int64_t)(-1))<<(11-gride))); - yp2 = yp1 = ((posye+(1024>>gride))&(((int64_t)(-1))<<(11-gride))); - - do - { - if (xinc==0) - { - screencoords(&sx1,&sy1, -editorgridextent-posxe,yp2-posye, zoome); - if (yp2 == yp1) - { - screencoords(&sx2,&sy2, editorgridextent-posxe,yp2-posye, zoome); - dx = sx2-sx1; - dy = sy2-sy1; - } - yp2 += yinc; - } - else // if (yinc==0) - { - screencoords(&sx1,&sy1, xp2-posxe, -editorgridextent-posye, zoome); - if (xp2 == xp1) - { - screencoords(&sx2,&sy2, xp2-posxe, editorgridextent-posye, zoome); - dx = sx2-sx1; - dy = sy2-sy1; - } - xp2 += xinc; - } - - i = drawline16(halfxdim16+sx1,midydim16+sy1+yofs, halfxdim16+sx1+dx,midydim16+sy1+dy+yofs, whitecol-25); - if (i==0 || (xp2<-editorgridextent || xp2>editorgridextent || - yp2<-editorgridextent || yp2>editorgridextent)) - { - xp2 = xp1; - yp2 = yp1; - - i = 1; - - if (yinc>0) - yinc *= -1; - else if (yinc<0) - { - xinc = -yinc; - yinc = 0; - } - else if (xinc>0) - xinc *= -1; - else // if (xinc<0) - i = 0; - } - } - while (i); - } - else - { - // vertical lines - yp1 = midydim16-mulscale14(posye+editorgridextent,zoome); - if (yp1 < 0) yp1 = 0; - - yp2 = midydim16-mulscale14(posye-editorgridextent,zoome); - if (yp2 >= ydim16) yp2 = ydim16-1; - - if ((yp1 < ydim16) && (yp2 >= 0) && (yp2 >= yp1)) - { - xp1 = halfxdim16-mulscale14(posxe+editorgridextent,zoome); - - for (i=-editorgridextent; i<=editorgridextent; i+=(2048>>gride)) - { - xp2 = xp1; - xp1 = halfxdim16-mulscale14(posxe-i,zoome); - - if (xp1 >= xdim) - break; - - if (xp1 >= 0) - { - if (xp1 != xp2) - drawline16(xp1,yp1,xp1,yp2,whitecol-25); - } - } - if (i >= editorgridextent && xp1 < xdim) - xp2 = xp1; - if (xp2 >= 0 && xp2 < xdim) - drawline16(xp2,yp1, xp2,yp2, whitecol-25); - } - - // horizontal lines - xp1 = mulscale14(posxe+editorgridextent,zoome); - xp2 = mulscale14(posxe-editorgridextent,zoome); - tempy = 0x80000000l; - - for (i=-editorgridextent; i<=editorgridextent; i+=(2048>>gride)) - { - yp1 = ((posye-i)*zoome)>>14; - if (yp1 != tempy) - { - if ((yp1 > midydim16-ydim16) && (yp1 <= midydim16)) - { - drawline16mid(-xp1,-yp1, -xp2,-yp1, whitecol-25); - tempy = yp1; - } - } - } - } - - enddrawing(); //}}} -} - - -static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome) -{ - const walltype *wal = &wall[i]; - int32_t sect=0, j, x1, y1, x2, y2, dz = 0, dz2 = 0; - int32_t fz=0,fzn=0; -// intptr_t tempint; - char col; - - int64_t dist,dx,dy; - - if (editstatus == 0) - { - if ((show2dwall[i>>3]&pow2char[i&7]) == 0) return; - j = wal->nextwall; - if ((j >= 0) && (i > j)) - if ((show2dwall[j>>3]&pow2char[j&7]) > 0) return; - } - else - { - j = wal->nextwall; - if (!m32_sideview && (j >= 0) && (i > j)) return; - } - - if (j < 0) - { - col = 15; - if (i == linehighlight) - col = (totalclock & 16) ? 15 : 7; - } - else - { - col = 33; - if ((wal->cstat&1) != 0) - col = 5; - if (wal->nextwall >= 0 && ((wal->cstat^wall[j].cstat)&1)) - col = 2; - if ((i == linehighlight) || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall))) - if (totalclock & 16) - col += (2<<2); - } - - screencoords(&x1,&y1, wal->x-posxe,wal->y-posye, zoome); - screencoords(&x2,&y2, wall[wal->point2].x-posxe,wall[wal->point2].y-posye, zoome); - - dx = wal->x-wall[wal->point2].x; - dy = wal->y-wall[wal->point2].y; - dist = dx*dx+dy*dy; - - if (dist > 0xffffffffll) - { - col=9; - if (i == linehighlight || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall))) - if (totalclock & 16) col -= (2<<2); - } - else if (showfirstwall && searchsector>=0 && (sector[searchsector].wallptr == i || - sector[searchsector].wallptr == wall[i].nextwall)) - { - col = 14; - if (i == linehighlight) if (totalclock & 16) col -= (2<<2); - } - else if (circlewall >= 0 && (i == circlewall || wal->nextwall == circlewall)) - col = 14; - - if (m32_sideview) - { - // draw vertical line to neighboring wall - int32_t fz2; - sect = sectorofwall(i); - - fz = getflorzofslope(sect, wal->x,wal->y); - fz2 = getflorzofslope(sect, wall[wal->point2].x,wall[wal->point2].y); - - dz = getscreenvdisp(fz-posze,zoome); - dz2 = getscreenvdisp(fz2-posze,zoome); - - y1 += dz; - y2 += dz2; - - if (wal->nextwall>=0) - { - fzn = getflorzofslope(wal->nextsector, wal->x,wal->y); -// if (i < wall[j].point2) - drawline16mid(x1,y1, x1,y1+getscreenvdisp(fzn-fz,zoome), editorcolors[col]); - } - } - - if (wal->cstat&64) // if hitscan bit set - { - int32_t one=(klabs(x2-x1) >= klabs(y2-y1)), no=!one; - - drawline16mid(x1+no,y1+one, x2+no,y2+one, editorcolors[col]); - drawline16mid(x1-no,y1-one, x2-no,y2-one, editorcolors[col]); - - col += 8; - } - - drawline16mid(x1,y1, x2,y2, editorcolors[col]); - - if (showheightindicators && !m32_sideview) - { - int32_t dax,day, k=getangle(x1-x2, y1-y2); //+angofs; - - screencoords(&dax,&day, ((wal->x+wall[wal->point2].x)>>1)-posxe,((wal->y+wall[wal->point2].y)>>1)-posye, zoome); - if (m32_sideview) - day += (dz2+dz)>>1; - - if (wal->nextsector >= 0) - { - int32_t ii = sector[sectorofwall(i)].floorz; - int32_t jj = sector[wal->nextsector].floorz; - - if (jj == ii && showheightindicators > 1) - { - int32_t dax3 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560; - int32_t day3 = mulscale11(sintable[(k+512)&2047],zoome) / 2560; - int32_t dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560; - int32_t day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560; - - day2 = scalescreeny(day2); - day3 = scalescreeny(day3); - - drawline16mid(dax+dax3,day+day3, dax+dax2,day+day2, editorcolors[col]); - } - else - { - int32_t bb = (jj < ii); - int32_t dax2 = mulscale11(sintable[(k+1024 + 1024*bb)&2047],zoome) / 2560; - int32_t day2 = mulscale11(sintable[(k+512 + 1024*bb)&2047],zoome) / 2560; - - day2 = scalescreeny(day2); - drawline16mid(dax,day, dax+dax2,day+day2, editorcolors[col]); - } - } - else if (showheightindicators > 1) - { - int32_t dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560; - int32_t day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560; - - day2 = scalescreeny(day2); - drawline16mid(dax,day, dax+dax2,day+day2, editorcolors[col]); - } - } - - if (zoome >= 256 && editstatus == 1) - if ((halfxdim16+x1 >= 2) && (halfxdim16+x1 <= xdim-3) && - (midydim16+y1 >= 2) && (midydim16+y1 <= ydim16-3)) - { - int32_t pointsize = 2; - - if (i == pointhighlight || ((pointhighlight < MAXWALLS) && (pointhighlight >= 0) && - (wall[i].x == wall[pointhighlight].x) && (wall[i].y == wall[pointhighlight].y))) - { - if (totalclock & 16) - pointsize++; - } - else //if (highlightcnt > 0) - { - if (show2dwall[i>>3]&pow2char[i&7]) - { - if (totalclock & 16) - pointsize++; - } - } - - col = 15; - if (m32_sideview) - { - if (wal->nextwall >= 0) - { - if (fz < fzn) - col = 7; - else if (fz == fzn) - col = 4; - } - } - -// tempint = ((midydim16+y1)*bytesperline)+(halfxdim16+x1)+frameplace; - do - drawcircle16(halfxdim16+x1, midydim16+y1, pointsize--, 16384, editorcolors[col]); - while (pointsize); - } -} - -static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome) -{ - int32_t x1, y1, x2, y2; - char col; - int16_t hitblocking=(sprite[j].cstat&256), flooraligned=(sprite[j].cstat&32), wallaligned=(sprite[j].cstat&16); - - int16_t angofs = m32_sideview ? m32_sideang : 0; - - if (sprite[j].sectnum<0) - col = 4; // red - else - { - col = 3; - if (spritecol2d[sprite[j].picnum][0]) - col = spritecol2d[sprite[j].picnum][0]; - else if ((sprite[j].cstat&1) > 0) - { - col = 5; - if (spritecol2d[sprite[j].picnum][1]) - col = spritecol2d[sprite[j].picnum][1]; - } - } - - if (editstatus == 1) - { - if ((pointhighlight) >= 16384 && (j+16384 == pointhighlight || - (!m32_sideview && ((sprite[j].x == sprite[pointhighlight-16384].x) && - (sprite[j].y == sprite[pointhighlight-16384].y))))) - { - if (totalclock & 32) col += 8; - } - else // if (highlightcnt > 0) - { - if (show2dsprite[j>>3]&pow2char[j&7]) - if (totalclock & 32) col += 8; - } - } - - screencoords(&x1,&y1, sprite[j].x-posxe,sprite[j].y-posye, zoome); -// tempint = ((midydim16+y1)*bytesperline)+(halfxdim16+x1)+frameplace; - - if (m32_sideview) - y1 += getscreenvdisp(sprite[j].z-posze,zoome); - - if ((halfxdim16+x1 >= 0) && (halfxdim16+x1 < xdim) && - (midydim16+y1 >= 0) && (midydim16+y1 < ydim16)) - { - drawcircle16(halfxdim16+x1, midydim16+y1, 4, 16384, editorcolors[col]); - - x2 = mulscale11(sintable[(sprite[j].ang+angofs+2560)&2047],zoome) / 768; - y2 = mulscale11(sintable[(sprite[j].ang+angofs+2048)&2047],zoome) / 768; - y2 = scalescreeny(y2); - - drawline16mid(x1,y1, x1+x2,y1+y2, editorcolors[col]); - - if (hitblocking) - { - drawline16mid(x1,y1+1, x1+x2,y1+y2+1, editorcolors[col]); - drawline16mid(x1,y1-1, x1+x2,y1+y2-1, editorcolors[col]); - drawline16mid(x1-1,y1, x1+x2-1,y1+y2, editorcolors[col]); - drawline16mid(x1+1,y1, x1+x2+1,y1+y2, editorcolors[col]); - } - - if (flooraligned) - { - int32_t fx = mulscale10(mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat),zoome) >> 1; - int32_t fy = mulscale10(mulscale6(tilesizy[sprite[j].picnum], sprite[j].yrepeat),zoome) >> 1; - int32_t co[4][2], ii, in; - int32_t sinang = sintable[(sprite[j].ang+angofs+1536)&2047]; - int32_t cosang = sintable[(sprite[j].ang+angofs+1024)&2047]; - int32_t r,s; - - co[0][0] = co[3][0] = -fx; - co[0][1] = co[1][1] = -fy; - co[1][0] = co[2][0] = fx; - co[2][1] = co[3][1] = fy; - - for (ii=3; ii>=0; ii--) - { - r = mulscale14(cosang,co[ii][0]) - mulscale14(sinang,co[ii][1]); - s = mulscale14(sinang,co[ii][0]) + mulscale14(cosang,co[ii][1]); - s = scalescreeny(s); - co[ii][0] = r; - co[ii][1] = s; - } - drawlinepat = 0xcfcfcfcf; - for (ii=3; ii>=0; ii--) - { - in = (ii+1)&3; - drawline16mid(x1+co[ii][0], y1-co[ii][1], x1+co[in][0], y1-co[in][1], editorcolors[col]); - if (hitblocking) - { - drawline16mid(x1+co[ii][0], y1-co[ii][1]+1, x1+co[in][0], y1-co[in][1]+1, editorcolors[col]); - drawline16mid(x1+co[ii][0], y1-co[ii][1]-1, x1+co[in][0], y1-co[in][1]-1, editorcolors[col]); - drawline16mid(x1+co[ii][0]+1, y1-co[ii][1], x1+co[in][0]+1, y1-co[in][1], editorcolors[col]); - drawline16mid(x1+co[ii][0]-1, y1-co[ii][1], x1+co[in][0]-1, y1-co[in][1], editorcolors[col]); - } - drawline16mid(x1, y1, x1 + co[in][0], y1 - co[in][1], editorcolors[col]); - } - drawlinepat = 0xffffffff; - } - else if (wallaligned) - { - int32_t fx = mulscale6(tilesizx[sprite[j].picnum], sprite[j].xrepeat); - int32_t one=(((sprite[j].ang+angofs+256)&512) == 0), no=!one; - - x2 = mulscale11(sintable[(sprite[j].ang+angofs+2560)&2047],zoome) / 6144; - y2 = mulscale11(sintable[(sprite[j].ang+angofs+2048)&2047],zoome) / 6144; - y2 = scalescreeny(y2); - - drawline16mid(x1,y1, x1+x2,y1+y2, editorcolors[col]); - if (!(sprite[j].cstat&64)) // not 1-sided - { - drawline16mid(x1,y1, x1-x2,y1-y2, editorcolors[col]); - if (hitblocking) - { - drawline16mid(x1-no,y1-one, x1-x2-no,y1-y2-one, editorcolors[col]); - drawline16mid(x1+no,y1+one, x1-x2+no,y1-y2+one, editorcolors[col]); - } - } - - if (hitblocking) - { - drawline16mid(x1-no,y1-one, x1+x2-no,y1+y2-one, editorcolors[col]); - drawline16mid(x1+no,y1+one, x1+x2+no,y1+y2+one, editorcolors[col]); - } - - - x2 = mulscale13(sintable[(sprite[j].ang+angofs+1024)&2047],zoome) * fx / 4096; - y2 = mulscale13(sintable[(sprite[j].ang+angofs+512)&2047],zoome) * fx / 4096; - y2 = scalescreeny(y2); - - drawline16mid(x1,y1, x1-x2,y1-y2, editorcolors[col]); - drawline16mid(x1,y1, x1+x2,y1+y2, editorcolors[col]); - - if (hitblocking) - { - drawline16mid(x1+1,y1, x1+x2+1,y1+y2, editorcolors[col]); - drawline16mid(x1-1,y1, x1-x2-1,y1-y2, editorcolors[col]); - drawline16mid(x1-1,y1, x1+x2-1,y1+y2, editorcolors[col]); - drawline16mid(x1+1,y1, x1-x2+1,y1-y2, editorcolors[col]); - - drawline16mid(x1,y1-1, x1+x2,y1+y2-1, editorcolors[col]); - drawline16mid(x1,y1+1, x1-x2,y1-y2+1, editorcolors[col]); - drawline16mid(x1,y1+1, x1+x2,y1+y2+1, editorcolors[col]); - drawline16mid(x1,y1-1, x1-x2,y1-y2-1, editorcolors[col]); - } - } - } -} - -// -// draw2dscreen -// -void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) -{ - int32_t i, j, x1, y1; - int16_t angofs = m32_sideview ? m32_sideang : 0; - - int32_t posxe=pos->x, posye=pos->y, posze=pos->z; - - if (qsetmode == 200) return; - - setup_sideview_sincos(); - if (m32_sideview && !m32_wallsprite) - { - m32_wallsprite = Bmalloc((MAXWALLS+MAXSPRITES)*sizeof(int16_t)); - m32_sidedist = Bmalloc((MAXWALLS+MAXSPRITES)*sizeof(m32_sidedist[0])); - if (!m32_wallsprite || !m32_sidedist) - { - if (m32_wallsprite) Bfree(m32_wallsprite); - if (m32_sidedist) { Bfree(m32_sidedist); m32_sidedist=NULL; } - initprintf("out of memory!"); - m32_sideview = 0; - } - } - - begindrawing(); //{{{ - - - if (editstatus == 0) - { -// faketimerhandler(); - clear2dscreen(); - -// faketimerhandler(); - draw2dgrid(posxe,posye,posze,cursectnum,ange,zoome,gride); - } - - faketimerhandler(); - - m32_swcnt = 0; - - if (!m32_sideview) - for (i=numwalls-1; i>=0; i--) - drawscreen_drawwall(i,posxe,posye,posze,zoome); - else - { - for (i=0; i= 256 || editstatus == 0) - for (j=0; j>3]&pow2char[j&7]))) - { - if (!m32_sideview) - drawscreen_drawsprite(j,posxe,posye,posze,zoome); - else - { - m32_wallsprite[m32_swcnt++] = MAXWALLS+j; - sideview_getdist(MAXWALLS+j, -1); - } - } - - faketimerhandler(); - - if (m32_sideview) - { - qsort(m32_wallsprite, m32_swcnt, sizeof(int16_t), (int( *)(const void *, const void *))&sideview_cmppoints); - - for (i=0; i7) - return 0; - } - else if (ypos+7 >= ydim) - { - ymax = ydim-ypos-1; - if (ymax<0) - return 0; - } - - if (fontsize & 2) printext16(xpos+1, ypos+1, 0, -1, name, (fontsize & ~2) | 4); - if (fontsize & 1) { fontptr = smalltextfont; charxsiz = 4; } - else { fontptr = textfont; charxsiz = 8; } - - begindrawing(); //{{{ - for (i=0; name[i]; i++) - { - if (name[i] == '^') - { - i++; - if (name[i] == 'O') // ^O resets formatting - { - if (fontsize & 4) continue; - - col = ocol; - backcol = obackcol; - continue; - } - if (isdigit(name[i])) - { - if (isdigit(name[i+1])) - { - if (isdigit(name[i+2])) - { - Bmemcpy(&smallbuf[0],&name[i],3); - i += 2; - smallbuf[3] = '\0'; - } - else - { - Bmemcpy(&smallbuf[0],&name[i],2); - i++; - smallbuf[2] = '\0'; - } - } - else - { - smallbuf[0] = name[i]; - smallbuf[1] = '\0'; - } - if (!(fontsize & 4)) - col = editorcolors[atol(smallbuf)]; - - if (name[i+1] == ',' && isdigit(name[i+2])) - { - i+=2; - if (isdigit(name[i+1])) - { - if (isdigit(name[i+2])) - { - Bmemcpy(&smallbuf[0],&name[i],3); - i += 2; - smallbuf[3] = '\0'; - } - else - { - Bmemcpy(&smallbuf[0],&name[i],2); - i++; - smallbuf[2] = '\0'; - } - } - else - { - smallbuf[0] = name[i]; - smallbuf[1] = '\0'; - } - - if (!(fontsize & 4)) - backcol = editorcolors[atol(smallbuf)]; - } - continue; - } - } - - if (stx<0) - { - stx += charxsiz; - continue; - } - - letptr = &fontptr[name[i]<<3]; - ptr = (char *)(bytesperline*ypos + (stx-(fontsize&1)) + frameplace); - for (y=ymin; y<=ymax; y++) - { - for (x=0; x= xdim) - break; - if (letptr[y]&pow2char[7-(fontsize&1)-x]) - ptr[x] = (uint8_t)col; - else if (backcol >= 0) - ptr[x] = (uint8_t)backcol; - } - ptr += bytesperline; - } - stx += charxsiz; - if (stx >= xdim) - break; - } - enddrawing(); //}}} - - return stx; -} - - -// -// printext256 -// -void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) -{ - int32_t stx, i, x, y, charxsiz; - char *fontptr, *letptr, *ptr; - - stx = xpos; - - if (fontsize) { fontptr = smalltextfont; charxsiz = 4; } - else { fontptr = textfont; charxsiz = 8; } - -#ifdef USE_OPENGL - if (!polymost_printext256(xpos,ypos,col,backcol,name,fontsize)) return; - - if (rendmode >= 3 && qsetmode == 200) - { - int32_t xx, yy; - int32_t lc=-1; - palette_t p=getpal(col), b=getpal(backcol); - - setpolymost2dview(); - bglDisable(GL_ALPHA_TEST); - bglDepthMask(GL_FALSE); // disable writing to the z-buffer - - bglBegin(GL_POINTS); - - for (i=0; name[i]; i++) - { - if (name[i] == '^' && isdigit(name[i+1])) - { - char smallbuf[8]; - int32_t bi=0; - - while (isdigit(name[i+1]) && bi<8) - { - smallbuf[bi++]=name[i+1]; - i++; - } - smallbuf[bi++]=0; - if (col) - col = atol(smallbuf); - - p = getpal(col); - - continue; - } - letptr = &fontptr[name[i]<<3]; - xx = stx-fontsize; - yy = ypos+7 + 2; //+1 is hack! - for (y=7; y>=0; y--) - { - for (x=charxsiz-1; x>=0; x--) - { - if (letptr[y]&pow2char[7-fontsize-x]) - { - if (lc!=col) - bglColor4ub(p.r,p.g,p.b,255); - lc = col; - bglVertex2i(xx+x,yy); - } - else if (backcol >= 0) - { - if (lc!=backcol) - bglColor4ub(b.r,b.g,b.b,255); - lc = backcol; - bglVertex2i(xx+x,yy); - } - } - yy--; - } - stx += charxsiz; - } - - bglEnd(); - bglDepthMask(GL_TRUE); // re-enable writing to the z-buffer - - return; - } -#endif - - begindrawing(); //{{{ - for (i=0; name[i]; i++) - { - if (name[i] == '^' && isdigit(name[i+1])) - { - char smallbuf[8]; - int32_t bi=0; - while (isdigit(name[i+1]) && bi<8) - { - smallbuf[bi++]=name[i+1]; - i++; - } - smallbuf[bi++]=0; - if (col)col = atol(smallbuf); - continue; - } - letptr = &fontptr[name[i]<<3]; - ptr = (char *)(ylookup[ypos+7]+(stx-fontsize)+frameplace); - for (y=7; y>=0; y--) - { - for (x=charxsiz-1; x>=0; x--) - { - if (letptr[y]&pow2char[7-fontsize-x]) - ptr[x] = (uint8_t)col; - else if (backcol >= 0) - ptr[x] = (uint8_t)backcol; - } - ptr -= ylookup[1]; - } - stx += charxsiz; - } - enddrawing(); //}}} -} - - -// -// screencapture -// -int32_t screencapture_tga(const char *filename, char inverseit) -{ - int32_t i,j; - char *ptr, head[18] = { 0,1,1,0,0,0,1,24,0,0,0,0,0/*wlo*/,0/*whi*/,0/*hlo*/,0/*hhi*/,8,0 }; - //char palette[4*256]; - char *fn = Bstrdup(filename), *inversebuf; - BFILE *fil; - - do // JBF 2004022: So we don't overwrite existing screenshots - { - if (capturecount > 9999) return -1; - - i = Bstrrchr(fn,'.')-fn-4; - fn[i++] = ((capturecount/1000)%10)+48; - fn[i++] = ((capturecount/100)%10)+48; - fn[i++] = ((capturecount/10)%10)+48; - fn[i++] = (capturecount%10)+48; - i++; - fn[i++] = 't'; - fn[i++] = 'g'; - fn[i++] = 'a'; - - if ((fil = Bfopen(fn,"rb")) == NULL) break; - Bfclose(fil); - capturecount++; - } - while (1); - fil = Bfopen(fn,"wb"); - if (fil == NULL) - { - Bfree(fn); - return -1; - } - -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) - { - head[1] = 0; // no colourmap - head[2] = 2; // uncompressed truecolour - head[3] = 0; // (low) first colourmap index - head[4] = 0; // (high) first colourmap index - head[5] = 0; // (low) number colourmap entries - head[6] = 0; // (high) number colourmap entries - head[7] = 0; // colourmap entry size - head[16] = 24; // 24 bits per pixel - } -#endif - - head[12] = xdim & 0xff; - head[13] = (xdim >> 8) & 0xff; - head[14] = ydim & 0xff; - head[15] = (ydim >> 8) & 0xff; - - Bfwrite(head, 18, 1, fil); - - begindrawing(); //{{{ - ptr = (char *)frameplace; - - // palette first -#ifdef USE_OPENGL - if (rendmode < 3 || (rendmode >= 3 && qsetmode != 200)) - { -#endif - //getpalette(0,256,palette); - for (i=0; i<256; i++) - { - Bfputc(curpalettefaded[i].b, fil); // b - Bfputc(curpalettefaded[i].g, fil); // g - Bfputc(curpalettefaded[i].r, fil); // r - } -#ifdef USE_OPENGL - } -#endif - - // targa renders bottom to top, from left to right - if (inverseit && qsetmode != 200) - { - inversebuf = (char *)Bmalloc(bytesperline); - if (inversebuf) - { - for (i=ydim-1; i>=0; i--) - { - copybuf(ptr+i*bytesperline, inversebuf, xdim >> 2); - for (j=0; j < (bytesperline>>2); j++)((int32_t *)inversebuf)[j] ^= 0x0f0f0f0fL; - Bfwrite(inversebuf, xdim, 1, fil); - } - Bfree(inversebuf); - } - } - else - { -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) - { - char c; - // 24bit - inversebuf = (char *)Bmalloc(xdim*ydim*3); - if (inversebuf) - { - bglReadPixels(0,0,xdim,ydim,GL_RGB,GL_UNSIGNED_BYTE,inversebuf); - j = xdim*ydim*3; - for (i=0; i=0; i--) - Bfwrite(ptr+i*bytesperline, xdim, 1, fil); -#ifdef USE_OPENGL - } -#endif - } - - enddrawing(); //}}} - - Bfclose(fil); - OSD_Printf("Saved screenshot to %s\n", fn); - Bfree(fn); - capturecount++; - return(0); -} - -// PCX is nasty, which is why I've lifted these functions from the PCX spec by ZSoft -static int32_t writepcxbyte(char colour, char count, BFILE *fp) -{ - if (!count) return 0; - if (count == 1 && (colour & 0xc0) != 0xc0) - { - Bfputc(colour, fp); - return 1; - } - else - { - Bfputc(0xc0 | count, fp); - Bfputc(colour, fp); - return 2; - } -} - -static void writepcxline(char *buf, int32_t bytes, int32_t step, BFILE *fp) -{ - char ths, last; - int32_t srcIndex; - char runCount; - - runCount = 1; - last = *buf; - - for (srcIndex=1; srcIndex 9999) return -1; - - i = Bstrrchr(fn,'.')-fn-4; - fn[i++] = ((capturecount/1000)%10)+48; - fn[i++] = ((capturecount/100)%10)+48; - fn[i++] = ((capturecount/10)%10)+48; - fn[i++] = (capturecount%10)+48; - i++; - fn[i++] = 'p'; - fn[i++] = 'c'; - fn[i++] = 'x'; - - if ((fil = Bfopen(fn,"rb")) == NULL) break; - Bfclose(fil); - capturecount++; - } - while (1); - fil = Bfopen(fn,"wb"); - if (fil == NULL) - { - Bfree(fn); - return -1; - } - - memset(head,0,128); - head[0] = 10; - head[1] = 5; - head[2] = 1; - head[3] = 8; - head[12] = 72; head[13] = 0; - head[14] = 72; head[15] = 0; - head[65] = 1; // 8-bit - head[68] = 1; - -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) - { - head[65] = 3; // 24-bit - } -#endif - - head[8] = (xdim-1) & 0xff; - head[9] = ((xdim-1) >> 8) & 0xff; - head[10] = (ydim-1) & 0xff; - head[11] = ((ydim-1) >> 8) & 0xff; - - bpl = xdim + (xdim&1); - - head[66] = bpl & 0xff; - head[67] = (bpl >> 8) & 0xff; - - Bfwrite(head, 128, 1, fil); - - begindrawing(); //{{{ - ptr = (char *)frameplace; - - // targa renders bottom to top, from left to right - if (inverseit && qsetmode != 200) - { - inversebuf = (char *)Bmalloc(bytesperline); - if (inversebuf) - { - for (i=0; i> 2); - for (j=0; j < (bytesperline>>2); j++)((int32_t *)inversebuf)[j] ^= 0x0f0f0f0fL; - writepcxline(inversebuf, xdim, 1, fil); - } - Bfree(inversebuf); - } - } - else - { -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) - { - // 24bit - inversebuf = (char *)Bmalloc(xdim*ydim*3); - if (inversebuf) - { - bglReadPixels(0,0,xdim,ydim,GL_RGB,GL_UNSIGNED_BYTE,inversebuf); - for (i=ydim-1; i>=0; i--) - { - writepcxline(inversebuf+i*xdim*3, xdim, 3, fil); - writepcxline(inversebuf+i*xdim*3+1, xdim, 3, fil); - writepcxline(inversebuf+i*xdim*3+2, xdim, 3, fil); - } - Bfree(inversebuf); - } - } - else - { -#endif - for (i=0; i= 3 && qsetmode != 200)) - { -#endif - //getpalette(0,256,palette); - Bfputc(12,fil); - for (i=0; i<256; i++) - { - Bfputc(curpalettefaded[i].r, fil); // b - Bfputc(curpalettefaded[i].g, fil); // g - Bfputc(curpalettefaded[i].b, fil); // r - } -#ifdef USE_OPENGL - } -#endif - - Bfclose(fil); - OSD_Printf("Saved screenshot to %s\n", fn); - Bfree(fn); - capturecount++; - return(0); -} - -int32_t screencapture(const char *filename, char inverseit) -{ - if (captureformat == 0) return screencapture_tga(filename,inverseit); - else return screencapture_pcx(filename,inverseit); -} - - - -// -// setrendermode -// -int32_t setrendermode(int32_t renderer) -{ - UNREFERENCED_PARAMETER(renderer); -#ifdef USE_OPENGL - if (bpp == 8) renderer = 0; -# ifdef POLYMER - else renderer = min(4,max(3,renderer)); - - if (renderer == 4) - { - int32_t i; - - // potentially deferred MD3 postprocessing - for (i=0; imdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL) - { - static int32_t warned=0; - - if (!warned) - { - OSD_Printf("Post-processing MD3 models for Polymer. This can take a while...\n"); - nextpage(); - warned = 1; - } - - if (!md3postload_polymer((md3model_t *)models[i])) - OSD_Printf("INTERNAL ERROR: mdmodel %d failed postprocessing!\n", i); - - if (((md3model_t *)models[i])->head.surfs[0].geometry == NULL) - OSD_Printf("INTERNAL ERROR: wtf?\n"); - } -// else -// OSD_Printf("mdmodel %d already postprocessed.\n", i); - } - - if (!polymer_init()) - renderer = 3; - } -# else - else renderer = 3; -# endif - - rendmode = renderer; - if (rendmode >= 3) - glrendmode = rendmode; -#endif - - return 0; -} - -// -// setrollangle -// -#ifdef USE_OPENGL -void setrollangle(int32_t rolla) -{ - UNREFERENCED_PARAMETER(rolla); - if (rolla == 0) gtang = 0.0; - else gtang = PI * (double)rolla / 1024.0; -} -#endif - - -// -// invalidatetile -// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette -// how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield -// bit 0: opaque or masked (non-translucent) texture, using repeating -// bit 1: ignored -// bit 2: ignored (33% translucence, using repeating) -// bit 3: ignored (67% translucence, using repeating) -// bit 4: opaque or masked (non-translucent) texture, using clamping -// bit 5: ignored -// bit 6: ignored (33% translucence, using clamping) -// bit 7: ignored (67% translucence, using clamping) -// clamping is for sprites, repeating is for walls -// -void invalidatetile(int16_t tilenume, int32_t pal, int32_t how) -{ -#ifdef USE_OPENGL - int32_t numpal, firstpal, np; - int32_t hp; - - if (rendmode < 3) return; - - if (pal < 0) - { - numpal = MAXPALOOKUPS; - firstpal = 0; - } - else - { - numpal = 1; - firstpal = pal % MAXPALOOKUPS; - } - - for (hp = 0; hp < 8; hp+=4) - { - if (!(how & pow2long[hp])) continue; - - for (np = firstpal; np < firstpal+numpal; np++) - { - gltexinvalidate(tilenume, np, hp); - } - } -#endif - UNREFERENCED_PARAMETER(tilenume); - UNREFERENCED_PARAMETER(pal); - UNREFERENCED_PARAMETER(how); -} - - -// -// setpolymost2dview -// Sets OpenGL for 2D drawing -// -void setpolymost2dview(void) -{ -#ifdef USE_OPENGL - if (rendmode < 3) return; - - if (gloy1 != -1) - { - bglViewport(0,0,xres,yres); - bglMatrixMode(GL_PROJECTION); - bglLoadIdentity(); - bglOrtho(0,xres,yres,0,-1,1); - bglMatrixMode(GL_MODELVIEW); - bglLoadIdentity(); - } - - gloy1 = -1; - - bglDisable(GL_DEPTH_TEST); - bglDisable(GL_TEXTURE_2D); - bglDisable(GL_BLEND); -#endif -} - -void hash_init(hashtable_t *t) -{ - hash_free(t); - t->items=Bcalloc(1, t->size * sizeof(hashitem_t)); -} - -void hash_free(hashtable_t *t) -{ - hashitem_t *cur, *tmp; - int32_t i; - int32_t num; - - if (t->items == NULL) - return; -// initprintf("*free, num:%d\n",t->size); - i= t->size-1; - do - { - cur = t->items[i]; - num = 0; - while (cur) - { - tmp = cur; - cur = cur->next; -// initprintf("Free %4d '%s'\n",tmp->key,(tmp->string)?tmp->string:"."); - if (tmp->string) - { - Bfree(tmp->string); - tmp->string = NULL; - } - Bfree(tmp); - num++; - } -// initprintf("#%4d: %3d\t",i,num); - } - while (--i > -1); - Bfree(t->items); - t->items = 0; -} - -// djb3 algorithm -static inline uint32_t hash_getcode(const char *s) -{ - uint32_t h = 5381; - int32_t ch; - - while ((ch = *s++) != '\0') - h = ((h << 5) + h) ^ ch; - - return h; -} - -void hash_add(hashtable_t *t, const char *s, int32_t key, int32_t replace) -{ - hashitem_t *cur, *prev=NULL; - int32_t code; - - if (t->items == NULL) - { - initprintf("hash_replace(): table not initialized!\n"); - return; - } - - code = hash_getcode(s) % t->size; - cur = t->items[code]; - - if (!cur) - { - cur = (hashitem_t *)Bcalloc(1,sizeof(hashitem_t)); - cur->string = Bstrdup(s); - cur->key = key; - cur->next = NULL; - t->items[code] = cur; - return; - } - - do - { - if (Bstrcmp(s,cur->string) == 0) - { - if (replace) cur->key = key; - return; - } - prev = cur; - } - while ((cur = cur->next)); - - cur = (hashitem_t *)Bcalloc(1,sizeof(hashitem_t)); - cur->string = Bstrdup(s); - cur->key = key; - cur->next = NULL; - prev->next = cur; -} - -int32_t hash_find(hashtable_t *t, const char *s) -{ - hashitem_t *cur; - - if (t->items == NULL) - { - initprintf("hash_find(): table not initialized!\n"); - return -1; - } - - if ((cur = t->items[hash_getcode(s) % t->size]) == NULL) return -1; - - do - if (Bstrcmp(s,cur->string) == 0) - return cur->key; - while ((cur = cur->next)); - - return -1; -} - -int32_t hash_findcase(hashtable_t *t, const char *s) -{ - hashitem_t *cur; - - if (t->items == NULL) - { - initprintf("hash_findcase(): table not initialized!\n"); - return -1; - } - - if ((cur=t->items[hash_getcode(s)%t->size]) == NULL) return -1; - - do - if (Bstrcasecmp(s,cur->string) == 0) - return cur->key; - while ((cur=cur->next)); - - return -1; -} - -/* - * vim:ts=8: - */ - diff --git a/polymer-perf/eduke32/build/src/engine_priv.h b/polymer-perf/eduke32/build/src/engine_priv.h deleted file mode 100644 index 579150e5f..000000000 --- a/polymer-perf/eduke32/build/src/engine_priv.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef ENGINE_PRIV_H -#define ENGINE_PRIV_H - -#define MAXCLIPNUM 1024 -#define MAXPERMS 512 -#define MAXTILEFILES 256 -#define MAXYSAVES ((MAXXDIM*MAXSPRITES)>>7) -#define MAXNODESPERLINE 42 //Warning: This depends on MAXYSAVES & MAXYDIM! -#define MAXCLIPDIST 1024 - -extern uint8_t **basepaltableptr; -extern uint8_t basepalcount; -extern uint8_t curbasepal; - -extern char pow2char[8]; -extern int32_t pow2int[32]; - -extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB]; -extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; -extern int16_t maskwall[MAXWALLSB], maskwallcnt; -extern spritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; -extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen; -extern intptr_t frameoffset; -extern int32_t globalposx, globalposy, globalposz, globalhoriz; -extern int16_t globalang, globalcursectnum; -extern int32_t globalpal, cosglobalang, singlobalang; -extern int32_t cosviewingrangeglobalang, sinviewingrangeglobalang; -extern int32_t globalvisibility; -extern int32_t xyaspect; -extern intptr_t asm1, asm2, asm3, asm4; -extern int32_t globalshade; -extern int16_t globalpicnum; -extern int32_t globalx1, globaly2; -extern int32_t globalorientation; - -extern int16_t searchit; -extern int32_t searchx, searchy; -extern int16_t searchsector, searchwall, searchstat; -extern int16_t searchbottomwall; - -extern char inpreparemirror; - -extern int32_t curbrightness, gammabrightness; -extern char britable[16][256]; -extern char picsiz[MAXTILES]; -extern int32_t lastx[MAXYDIM]; -extern char *transluc; -extern int16_t sectorborder[256], sectorbordercnt; -extern int32_t qsetmode; -extern int32_t hitallsprites; - -extern int32_t xb1[MAXWALLSB]; -extern int32_t rx1[MAXWALLSB], ry1[MAXWALLSB]; -extern int16_t p2[MAXWALLSB]; -extern int16_t numscans, numhits, numbunches; - -#ifdef USE_OPENGL -extern palette_t palookupfog[MAXPALOOKUPS]; -#endif - -// int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat); -int32_t wallfront(int32_t l1, int32_t l2); -int32_t animateoffs(int16_t tilenum, int16_t fakevar); - -extern int32_t indrawroomsandmasks; - - -#if defined(_MSC_VER) && !defined(NOASM) - -static inline void setgotpic(int32_t a) -{ - _asm { - push ebx - mov eax, a - mov ebx, eax - cmp byte ptr walock[eax], 200 - jae skipit - mov byte ptr walock[eax], 199 -skipit: - shr eax, 3 - and ebx, 7 - mov dl, byte ptr gotpic[eax] - mov bl, byte ptr pow2char[ebx] - or dl, bl - mov byte ptr gotpic[eax], dl - pop ebx - } -} - -#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // _MSC_VER - -#define setgotpic(a) \ -({ int32_t __a=(a); \ - __asm__ __volatile__ ( \ - "movl %%eax, %%ebx\n\t" \ - "cmpb $200, "ASMSYM("walock")"(%%eax)\n\t" \ - "jae 0f\n\t" \ - "movb $199, "ASMSYM("walock")"(%%eax)\n\t" \ - "0:\n\t" \ - "shrl $3, %%eax\n\t" \ - "andl $7, %%ebx\n\t" \ - "movb "ASMSYM("gotpic")"(%%eax), %%dl\n\t" \ - "movb "ASMSYM("pow2char")"(%%ebx), %%bl\n\t" \ - "orb %%bl, %%dl\n\t" \ - "movb %%dl, "ASMSYM("gotpic")"(%%eax)" \ - : "=a" (__a) : "a" (__a) \ - : "ebx", "edx", "memory", "cc"); \ - __a; }) - -#else // __GNUC__ && __i386__ - -static inline void setgotpic(int32_t tilenume) -{ - if (walock[tilenume] < 200) walock[tilenume] = 199; - gotpic[tilenume>>3] |= pow2char[tilenume&7]; -} - -#endif - -#endif /* ENGINE_PRIV_H */ diff --git a/polymer-perf/eduke32/build/src/glbuild.c b/polymer-perf/eduke32/build/src/glbuild.c deleted file mode 100644 index fd5644f4d..000000000 --- a/polymer-perf/eduke32/build/src/glbuild.c +++ /dev/null @@ -1,1000 +0,0 @@ -#include "compat.h" -#include "glbuild.h" -#include "baselayer.h" -#include -#include -#include - -#if defined USE_OPENGL - -#ifdef RENDERTYPESDL -#include "sdl_inc.h" -#endif - -void (APIENTRY *bglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -void (APIENTRY *bglClear)(GLbitfield mask); -void (APIENTRY *bglColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -void (APIENTRY *bglAlphaFunc)(GLenum func, GLclampf ref); -void (APIENTRY *bglBlendFunc)(GLenum sfactor, GLenum dfactor); -void (APIENTRY *bglCullFace)(GLenum mode); -void (APIENTRY *bglFrontFace)(GLenum mode); -void (APIENTRY *bglPolygonOffset)(GLfloat factor, GLfloat units); -void (APIENTRY *bglPolygonMode)(GLenum face, GLenum mode); -void (APIENTRY *bglEnable)(GLenum cap); -void (APIENTRY *bglDisable)(GLenum cap); -void (APIENTRY *bglGetDoublev)(GLenum pname, GLdouble *params); -void (APIENTRY *bglGetFloatv)(GLenum pname, GLfloat *params); -void (APIENTRY *bglGetIntegerv)(GLenum pname, GLint *params); -void (APIENTRY *bglPushAttrib)(GLbitfield mask); -void (APIENTRY *bglPopAttrib)(void); -GLenum(APIENTRY *bglGetError)(void); -const GLubyte *(APIENTRY *bglGetString)(GLenum name); -void (APIENTRY *bglHint)(GLenum target, GLenum mode); -void (APIENTRY *bglDrawBuffer)(GLenum mode); -void (APIENTRY *bglReadBuffer)(GLenum mode); -void (APIENTRY *bglScissor)(GLint x, GLint y, GLsizei width, GLsizei height); -void (APIENTRY *bglClipPlane)(GLenum plane, const GLdouble *equation); - -// Depth -void (APIENTRY *bglDepthFunc)(GLenum func); -void (APIENTRY *bglDepthMask)(GLboolean flag); -void (APIENTRY *bglDepthRange)(GLclampd near_val, GLclampd far_val); - -// Matrix -void (APIENTRY *bglMatrixMode)(GLenum mode); -void (APIENTRY *bglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val); -void (APIENTRY *bglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val); -void (APIENTRY *bglViewport)(GLint x, GLint y, GLsizei width, GLsizei height); -void (APIENTRY *bglPushMatrix)(void); -void (APIENTRY *bglPopMatrix)(void); -void (APIENTRY *bglLoadIdentity)(void); -void (APIENTRY *bglLoadMatrixf)(const GLfloat *m); -void (APIENTRY *bglLoadMatrixd)(const GLdouble *m); -void (APIENTRY *bglMultMatrixf)(const GLfloat *m); -void (APIENTRY *bglMultMatrixd)(const GLdouble *m); -void (APIENTRY *bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -void (APIENTRY *bglScalef)(GLfloat x, GLfloat y, GLfloat z); -void (APIENTRY *bglTranslatef)(GLfloat x, GLfloat y, GLfloat z); - -// Drawing -void (APIENTRY *bglBegin)(GLenum mode); -void (APIENTRY *bglEnd)(void); -void (APIENTRY *bglVertex2f)(GLfloat x, GLfloat y); -void (APIENTRY *bglVertex2i)(GLint x, GLint y); -void (APIENTRY *bglVertex3f)(GLfloat x, GLfloat y, GLfloat z); -void (APIENTRY *bglVertex3d)(GLdouble x, GLdouble y, GLdouble z); -void (APIENTRY *bglVertex3fv)(const GLfloat *v); -void (APIENTRY *bglVertex3dv)(const GLdouble *v); -void (APIENTRY *bglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -void (APIENTRY *bglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -void (APIENTRY *bglTexCoord2d)(GLdouble s, GLdouble t); -void (APIENTRY *bglTexCoord2f)(GLfloat s, GLfloat t); -void (APIENTRY *bglTexCoord2i)(GLint s, GLint t); -void (APIENTRY *bglNormal3f)(GLfloat x, GLfloat y, GLfloat z); - -// Lighting -void (APIENTRY *bglShadeModel)(GLenum mode); -void (APIENTRY *bglLightfv)(GLenum light, GLenum pname, const GLfloat *params); - -// Raster funcs -void (APIENTRY *bglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); -void (APIENTRY *bglRasterPos4i)(GLint x, GLint y, GLint z, GLint w); -void (APIENTRY *bglDrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); - -// Texture mapping -void (APIENTRY *bglTexEnvf)(GLenum target, GLenum pname, GLfloat param); -void (APIENTRY *bglGenTextures)(GLsizei n, GLuint *textures); // 1.1 -void (APIENTRY *bglDeleteTextures)(GLsizei n, const GLuint *textures); // 1.1 -void (APIENTRY *bglBindTexture)(GLenum target, GLuint texture); // 1.1 -void (APIENTRY *bglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -void (APIENTRY *bglTexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -void (APIENTRY *bglCopyTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -void (APIENTRY *bglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -void (APIENTRY *bglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); // 1.1 -void (APIENTRY *bglTexParameterf)(GLenum target, GLenum pname, GLfloat param); -void (APIENTRY *bglTexParameteri)(GLenum target, GLenum pname, GLint param); -void (APIENTRY *bglGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params); -void (APIENTRY *bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); -void (APIENTRY *bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *); -void (APIENTRY *bglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params); - -// Fog -void (APIENTRY *bglFogf)(GLenum pname, GLfloat param); -void (APIENTRY *bglFogi)(GLenum pname, GLint param); -void (APIENTRY *bglFogfv)(GLenum pname, const GLfloat *params); - -// Display Lists -void (APIENTRY *bglNewList)(GLuint list, GLenum mode); -void (APIENTRY *bglEndList)(void); -void (APIENTRY *bglCallList)(GLuint list); -void (APIENTRY *bglDeleteLists)(GLuint list, GLsizei range); - -// Vertex Arrays -void (APIENTRY *bglEnableClientState)(GLenum cap); -void (APIENTRY *bglDisableClientState)(GLenum cap); -void (APIENTRY *bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -void (APIENTRY *bglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); -void (APIENTRY *bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -void (APIENTRY *bglDrawArrays)(GLenum mode, GLint first, GLsizei count); -void (APIENTRY *bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); - -// Stencil Buffer -void (APIENTRY *bglClearStencil)(GLint s); -void (APIENTRY *bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass); -void (APIENTRY *bglStencilFunc)(GLenum func, GLint ref, GLuint mask); - -// GPU Programs -void (APIENTRY *bglGenProgramsARB)(GLsizei, GLuint *); -void (APIENTRY *bglBindProgramARB)(GLenum, GLuint); -void (APIENTRY *bglProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *); -void (APIENTRY *bglDeleteProgramsARB)(GLsizei n, const GLuint *programs); - -// Multitexturing -void (APIENTRY *bglActiveTextureARB)(GLenum texture); -void (APIENTRY *bglClientActiveTextureARB)(GLenum texture); -void (APIENTRY *bglMultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); -void (APIENTRY *bglMultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); - -// Frame Buffer Objects -void (APIENTRY *bglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers); -void (APIENTRY *bglBindFramebufferEXT)(GLenum target, GLuint framebuffer); -void (APIENTRY *bglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLenum(APIENTRY *bglCheckFramebufferStatusEXT)(GLenum target); -void (APIENTRY *bglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers); - -// Vertex Buffer Objects -void (APIENTRY *bglGenBuffersARB)(GLsizei n, GLuint *buffers); -void (APIENTRY *bglBindBufferARB)(GLenum target, GLuint buffer); -void (APIENTRY *bglDeleteBuffersARB)(GLsizei n, const GLuint *buffers); -void (APIENTRY *bglBufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); -void (APIENTRY *bglBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); -void *(APIENTRY *bglMapBufferARB)(GLenum target, GLenum access); -GLboolean(APIENTRY *bglUnmapBufferARB)(GLenum target); - -// Occlusion queries -void (APIENTRY *bglGenQueriesARB)(GLsizei n, GLuint *ids); -void (APIENTRY *bglDeleteQueriesARB)(GLsizei n, const GLuint *ids); -GLboolean(APIENTRY *bglIsQueryARB)(GLuint id); -void (APIENTRY *bglBeginQueryARB)(GLenum target, GLuint id); -void (APIENTRY *bglEndQueryARB)(GLenum target); -void (APIENTRY *bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params); -void (APIENTRY *bglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params); -void (APIENTRY *bglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params); - -// Shader Objects -void (APIENTRY *bglDeleteObjectARB)(GLhandleARB); -GLhandleARB(APIENTRY *bglGetHandleARB)(GLenum); -void (APIENTRY *bglDetachObjectARB)(GLhandleARB, GLhandleARB); -GLhandleARB(APIENTRY *bglCreateShaderObjectARB)(GLenum); -void (APIENTRY *bglShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); -void (APIENTRY *bglCompileShaderARB)(GLhandleARB); -GLhandleARB(APIENTRY *bglCreateProgramObjectARB)(void); -void (APIENTRY *bglAttachObjectARB)(GLhandleARB, GLhandleARB); -void (APIENTRY *bglLinkProgramARB)(GLhandleARB); -void (APIENTRY *bglUseProgramObjectARB)(GLhandleARB); -void (APIENTRY *bglValidateProgramARB)(GLhandleARB); -void (APIENTRY *bglUniform1fARB)(GLint, GLfloat); -void (APIENTRY *bglUniform2fARB)(GLint, GLfloat, GLfloat); -void (APIENTRY *bglUniform3fARB)(GLint, GLfloat, GLfloat, GLfloat); -void (APIENTRY *bglUniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat); -void (APIENTRY *bglUniform1iARB)(GLint, GLint); -void (APIENTRY *bglUniform2iARB)(GLint, GLint, GLint); -void (APIENTRY *bglUniform3iARB)(GLint, GLint, GLint, GLint); -void (APIENTRY *bglUniform4iARB)(GLint, GLint, GLint, GLint, GLint); -void (APIENTRY *bglUniform1fvARB)(GLint, GLsizei, const GLfloat *); -void (APIENTRY *bglUniform2fvARB)(GLint, GLsizei, const GLfloat *); -void (APIENTRY *bglUniform3fvARB)(GLint, GLsizei, const GLfloat *); -void (APIENTRY *bglUniform4fvARB)(GLint, GLsizei, const GLfloat *); -void (APIENTRY *bglUniform1ivARB)(GLint, GLsizei, const GLint *); -void (APIENTRY *bglUniform2ivARB)(GLint, GLsizei, const GLint *); -void (APIENTRY *bglUniform3ivARB)(GLint, GLsizei, const GLint *); -void (APIENTRY *bglUniform4ivARB)(GLint, GLsizei, const GLint *); -void (APIENTRY *bglUniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *); -void (APIENTRY *bglUniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *); -void (APIENTRY *bglUniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *); -void (APIENTRY *bglGetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *); -void (APIENTRY *bglGetObjectParameterivARB)(GLhandleARB, GLenum, GLint *); -void (APIENTRY *bglGetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *); -void (APIENTRY *bglGetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); -GLint(APIENTRY *bglGetUniformLocationARB)(GLhandleARB, const GLcharARB *); -void (APIENTRY *bglGetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -void (APIENTRY *bglGetUniformfvARB)(GLhandleARB, GLint, GLfloat *); -void (APIENTRY *bglGetUniformivARB)(GLhandleARB, GLint, GLint *); -void (APIENTRY *bglGetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *); - -// Vertex Shaders -void (APIENTRY *bglVertexAttrib1dARB)(GLuint, GLdouble); -void (APIENTRY *bglVertexAttrib1dvARB)(GLuint, const GLdouble *); -void (APIENTRY *bglVertexAttrib1fARB)(GLuint, GLfloat); -void (APIENTRY *bglVertexAttrib1fvARB)(GLuint, const GLfloat *); -void (APIENTRY *bglVertexAttrib1sARB)(GLuint, GLshort); -void (APIENTRY *bglVertexAttrib1svARB)(GLuint, const GLshort *); -void (APIENTRY *bglVertexAttrib2dARB)(GLuint, GLdouble, GLdouble); -void (APIENTRY *bglVertexAttrib2dvARB)(GLuint, const GLdouble *); -void (APIENTRY *bglVertexAttrib2fARB)(GLuint, GLfloat, GLfloat); -void (APIENTRY *bglVertexAttrib2fvARB)(GLuint, const GLfloat *); -void (APIENTRY *bglVertexAttrib2sARB)(GLuint, GLshort, GLshort); -void (APIENTRY *bglVertexAttrib2svARB)(GLuint, const GLshort *); -void (APIENTRY *bglVertexAttrib3dARB)(GLuint, GLdouble, GLdouble, GLdouble); -void (APIENTRY *bglVertexAttrib3dvARB)(GLuint, const GLdouble *); -void (APIENTRY *bglVertexAttrib3fARB)(GLuint, GLfloat, GLfloat, GLfloat); -void (APIENTRY *bglVertexAttrib3fvARB)(GLuint, const GLfloat *); -void (APIENTRY *bglVertexAttrib3sARB)(GLuint, GLshort, GLshort, GLshort); -void (APIENTRY *bglVertexAttrib3svARB)(GLuint, const GLshort *); -void (APIENTRY *bglVertexAttrib4NbvARB)(GLuint, const GLbyte *); -void (APIENTRY *bglVertexAttrib4NivARB)(GLuint, const GLint *); -void (APIENTRY *bglVertexAttrib4NsvARB)(GLuint, const GLshort *); -void (APIENTRY *bglVertexAttrib4NubARB)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte); -void (APIENTRY *bglVertexAttrib4NubvARB)(GLuint, const GLubyte *); -void (APIENTRY *bglVertexAttrib4NuivARB)(GLuint, const GLuint *); -void (APIENTRY *bglVertexAttrib4NusvARB)(GLuint, const GLushort *); -void (APIENTRY *bglVertexAttrib4bvARB)(GLuint, const GLbyte *); -void (APIENTRY *bglVertexAttrib4dARB)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble); -void (APIENTRY *bglVertexAttrib4dvARB)(GLuint, const GLdouble *); -void (APIENTRY *bglVertexAttrib4fARB)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -void (APIENTRY *bglVertexAttrib4fvARB)(GLuint, const GLfloat *); -void (APIENTRY *bglVertexAttrib4ivARB)(GLuint, const GLint *); -void (APIENTRY *bglVertexAttrib4sARB)(GLuint, GLshort, GLshort, GLshort, GLshort); -void (APIENTRY *bglVertexAttrib4svARB)(GLuint, const GLshort *); -void (APIENTRY *bglVertexAttrib4ubvARB)(GLuint, const GLubyte *); -void (APIENTRY *bglVertexAttrib4uivARB)(GLuint, const GLuint *); -void (APIENTRY *bglVertexAttrib4usvARB)(GLuint, const GLushort *); -void (APIENTRY *bglVertexAttribPointerARB)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); -void (APIENTRY *bglEnableVertexAttribArrayARB)(GLuint); -void (APIENTRY *bglDisableVertexAttribArrayARB)(GLuint); -void (APIENTRY *bglGetVertexAttribdvARB)(GLuint, GLenum, GLdouble *); -void (APIENTRY *bglGetVertexAttribfvARB)(GLuint, GLenum, GLfloat *); -void (APIENTRY *bglGetVertexAttribivARB)(GLuint, GLenum, GLint *); -void (APIENTRY *bglGetVertexAttribPointervARB)(GLuint, GLenum, GLvoid* *); -void (APIENTRY *bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *); -void (APIENTRY *bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); -GLint(APIENTRY *bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *); - -// GLU -void (APIENTRY *bgluTessBeginContour)(GLUtesselator *tess); -void (APIENTRY *bgluTessBeginPolygon)(GLUtesselator *tess, GLvoid *data); -void (APIENTRY *bgluTessCallback)(GLUtesselator *tess, GLenum which, void (PR_CALLBACK CallBackFunc)()); -void (APIENTRY *bgluTessEndContour)(GLUtesselator *tess); -void (APIENTRY *bgluTessEndPolygon)(GLUtesselator *tess); -void (APIENTRY *bgluTessNormal)(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); -void (APIENTRY *bgluTessProperty)(GLUtesselator *tess, GLenum which, GLdouble data); -void (APIENTRY *bgluTessVertex)(GLUtesselator *tess, GLdouble *location, GLvoid *data); -GLUtesselator *(APIENTRY *bgluNewTess)(void); - -void (APIENTRY *bgluPerspective)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); - -const GLubyte *(APIENTRY *bgluErrorString)(GLenum error); - -GLint(APIENTRY *bgluProject)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble *winX, GLdouble *winY, GLdouble *winZ); -GLint(APIENTRY *bgluUnProject)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble *objX, GLdouble *objY, GLdouble *objZ); - - -#ifdef RENDERTYPEWIN -// Windows -HGLRC(WINAPI *bwglCreateContext)(HDC); -BOOL (WINAPI *bwglDeleteContext)(HGLRC); -PROC(WINAPI *bwglGetProcAddress)(LPCSTR); -BOOL (WINAPI *bwglMakeCurrent)(HDC,HGLRC); - -BOOL (WINAPI *bwglSwapBuffers)(HDC); -int32_t (WINAPI *bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR *); -int32_t (WINAPI *bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR); -int32_t (WINAPI *bwglGetPixelFormat)(HDC); -BOOL (WINAPI *bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR *); -BOOL (WINAPI *bwglSwapIntervalEXT)(int32_t); - -static HANDLE hGLDLL, hGLUDLL; -#else -#include - -static void *gluhandle = NULL; -#endif - -char *gldriver = NULL, *glulibrary = NULL; - -static void *getproc_(const char *s, int32_t *err, int32_t fatal, int32_t extension) -{ - void *t; -#if defined RENDERTYPESDL - UNREFERENCED_PARAMETER(extension); - t = (void *)SDL_GL_GetProcAddress(s); -#elif defined _WIN32 - if (extension) t = (void *)bwglGetProcAddress(s); - else t = (void *)GetProcAddress(hGLDLL,s); -#else -#error Need a dynamic loader for this platform... -#endif - if (!t && fatal) - { - initprintf("Failed to find %s in %s\n", s, gldriver); - *err = 1; - } - return t; -} -#define GETPROC(s) getproc_(s,&err,1,0) -#define GETPROCSOFT(s) getproc_(s,&err,0,0) -#define GETPROCEXT(s) getproc_(s,&err,1,1) -#define GETPROCEXTSOFT(s) getproc_(s,&err,0,1) - -int32_t loadgldriver(const char *driver) -{ - int32_t err=0; - -#ifdef RENDERTYPEWIN - if (hGLDLL) return 0; -#endif - - if (!driver) - { -#ifdef _WIN32 - driver = "opengl32.dll"; -#elif defined __APPLE__ - driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; -#else - driver = "libGL.so.1"; -#endif - } - -#if defined RENDERTYPESDL - if (SDL_GL_LoadLibrary(driver)) goto fail; -#elif defined _WIN32 - hGLDLL = LoadLibrary(driver); - if (!hGLDLL) goto fail; -#endif - gldriver = Bstrdup(driver); - -#ifdef RENDERTYPEWIN - bwglCreateContext = GETPROC("wglCreateContext"); - bwglDeleteContext = GETPROC("wglDeleteContext"); - bwglGetProcAddress = GETPROC("wglGetProcAddress"); - bwglMakeCurrent = GETPROC("wglMakeCurrent"); - - bwglSwapBuffers = GETPROC("wglSwapBuffers"); - bwglChoosePixelFormat = GETPROC("wglChoosePixelFormat"); - bwglDescribePixelFormat = GETPROC("wglDescribePixelFormat"); - bwglGetPixelFormat = GETPROC("wglGetPixelFormat"); - bwglSetPixelFormat = GETPROC("wglSetPixelFormat"); -#endif - - bglClearColor = GETPROC("glClearColor"); - bglClear = GETPROC("glClear"); - bglColorMask = GETPROC("glColorMask"); - bglAlphaFunc = GETPROC("glAlphaFunc"); - bglBlendFunc = GETPROC("glBlendFunc"); - bglCullFace = GETPROC("glCullFace"); - bglFrontFace = GETPROC("glFrontFace"); - bglPolygonOffset = GETPROC("glPolygonOffset"); - bglPolygonMode = GETPROC("glPolygonMode"); - bglEnable = GETPROC("glEnable"); - bglDisable = GETPROC("glDisable"); - bglGetDoublev = GETPROC("glGetDoublev"); - bglGetFloatv = GETPROC("glGetFloatv"); - bglGetIntegerv = GETPROC("glGetIntegerv"); - bglPushAttrib = GETPROC("glPushAttrib"); - bglPopAttrib = GETPROC("glPopAttrib"); - bglGetError = GETPROC("glGetError"); - bglGetString = GETPROC("glGetString"); - bglHint = GETPROC("glHint"); - bglDrawBuffer = GETPROC("glDrawBuffer"); - bglReadBuffer = GETPROC("glDrawBuffer"); - bglScissor = GETPROC("glScissor"); - bglClipPlane = GETPROC("glClipPlane"); - - // Depth - bglDepthFunc = GETPROC("glDepthFunc"); - bglDepthMask = GETPROC("glDepthMask"); - bglDepthRange = GETPROC("glDepthRange"); - - // Matrix - bglMatrixMode = GETPROC("glMatrixMode"); - bglOrtho = GETPROC("glOrtho"); - bglFrustum = GETPROC("glFrustum"); - bglViewport = GETPROC("glViewport"); - bglPushMatrix = GETPROC("glPushMatrix"); - bglPopMatrix = GETPROC("glPopMatrix"); - bglLoadIdentity = GETPROC("glLoadIdentity"); - bglLoadMatrixf = GETPROC("glLoadMatrixf"); - bglLoadMatrixd = GETPROC("glLoadMatrixd"); - bglMultMatrixf = GETPROC("glMultMatrixf"); - bglMultMatrixd = GETPROC("glMultMatrixd"); - bglRotatef = GETPROC("glRotatef"); - bglScalef = GETPROC("glScalef"); - bglTranslatef = GETPROC("glTranslatef"); - - // Drawing - bglBegin = GETPROC("glBegin"); - bglEnd = GETPROC("glEnd"); - bglVertex2f = GETPROC("glVertex2f"); - bglVertex2i = GETPROC("glVertex2i"); - bglVertex3f = GETPROC("glVertex3f"); - bglVertex3d = GETPROC("glVertex3d"); - bglVertex3fv = GETPROC("glVertex3fv"); - bglVertex3dv = GETPROC("glVertex3dv"); - bglColor4f = GETPROC("glColor4f"); - bglColor4ub = GETPROC("glColor4ub"); - bglTexCoord2d = GETPROC("glTexCoord2d"); - bglTexCoord2f = GETPROC("glTexCoord2f"); - bglTexCoord2i = GETPROC("glTexCoord2i"); - bglNormal3f = GETPROC("glNormal3f"); - - // Lighting - bglShadeModel = GETPROC("glShadeModel"); - bglLightfv = GETPROC("glLightfv"); - - // Raster funcs - bglReadPixels = GETPROC("glReadPixels"); - bglRasterPos4i = GETPROC("glRasterPos4i"); - bglDrawPixels = GETPROC("glDrawPixels"); - - // Texture mapping - bglTexEnvf = GETPROC("glTexEnvf"); - bglGenTextures = GETPROC("glGenTextures"); - bglDeleteTextures = GETPROC("glDeleteTextures"); - bglBindTexture = GETPROC("glBindTexture"); - bglTexImage2D = GETPROC("glTexImage2D"); - bglCopyTexImage2D = GETPROC("glCopyTexImage2D"); - bglCopyTexSubImage2D= GETPROC("glCopyTexSubImage2D"); - bglTexSubImage2D = GETPROC("glTexSubImage2D"); - bglTexParameterf = GETPROC("glTexParameterf"); - bglTexParameteri = GETPROC("glTexParameteri"); - bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv"); - bglTexGenfv = GETPROC("glTexGenfv"); - - // Fog - bglFogf = GETPROC("glFogf"); - bglFogi = GETPROC("glFogi"); - bglFogfv = GETPROC("glFogfv"); - - // Display Lists - bglNewList = GETPROC("glNewList"); - bglEndList = GETPROC("glEndList"); - bglCallList = GETPROC("glCallList"); - bglDeleteLists = GETPROC("glDeleteLists"); - - // Vertex Arrays - bglEnableClientState = GETPROC("glEnableClientState"); - bglDisableClientState = GETPROC("glDisableClientState"); - bglVertexPointer = GETPROC("glVertexPointer"); - bglNormalPointer = GETPROC("glNormalPointer"); - bglTexCoordPointer = GETPROC("glTexCoordPointer"); - bglDrawArrays = GETPROC("glDrawArrays"); - bglDrawElements = GETPROC("glDrawElements"); - - // Stencil Buffer - bglClearStencil = GETPROC("glClearStencil"); - bglStencilOp = GETPROC("glStencilOp"); - bglStencilFunc = GETPROC("glStencilFunc"); - - loadglextensions(); - loadglulibrary(getenv("BUILD_GLULIB")); - - if (err) unloadgldriver(); - return err; - -fail: - initprintf("Failed loading \"%s\"\n",driver); - return -1; -} - -int32_t loadglextensions(void) -{ - int32_t err = 0; -#ifdef RENDERTYPEWIN - if (!hGLDLL) return 0; -#endif - - bglTexImage3D = GETPROCEXTSOFT("glTexImage3D"); - bglCompressedTexImage2DARB = GETPROCEXTSOFT("glCompressedTexImage2DARB"); - bglGetCompressedTexImageARB = GETPROCEXTSOFT("glGetCompressedTexImageARB"); - - // GPU Programs - bglGenProgramsARB = GETPROCEXTSOFT("glGenProgramsARB"); - bglBindProgramARB = GETPROCEXTSOFT("glBindProgramARB"); - bglProgramStringARB = GETPROCEXTSOFT("glProgramStringARB"); - bglDeleteProgramsARB= GETPROCEXTSOFT("glDeleteProgramsARB"); - - // Multitexturing - bglActiveTextureARB = GETPROCEXTSOFT("glActiveTextureARB"); - bglClientActiveTextureARB = GETPROCEXTSOFT("glClientActiveTextureARB"); - bglMultiTexCoord2dARB = GETPROCEXTSOFT("glMultiTexCoord2dARB"); - bglMultiTexCoord2fARB = GETPROCEXTSOFT("glMultiTexCoord2fARB"); - - // Frame Buffer Objects - bglGenFramebuffersEXT = GETPROCEXTSOFT("glGenFramebuffersEXT"); - bglBindFramebufferEXT = GETPROCEXTSOFT("glBindFramebufferEXT"); - bglFramebufferTexture2DEXT = GETPROCEXTSOFT("glFramebufferTexture2DEXT"); - bglCheckFramebufferStatusEXT = GETPROCEXTSOFT("glCheckFramebufferStatusEXT"); - bglDeleteFramebuffersEXT = GETPROCEXTSOFT("glDeleteFramebuffersEXT"); - - // Vertex Buffer Objects - bglGenBuffersARB = GETPROCEXTSOFT("glGenBuffersARB"); - bglBindBufferARB = GETPROCEXTSOFT("glBindBufferARB"); - bglDeleteBuffersARB = GETPROCEXTSOFT("glDeleteBuffersARB"); - bglBufferDataARB = GETPROCEXTSOFT("glBufferDataARB"); - bglBufferSubDataARB = GETPROCEXTSOFT("glBufferSubDataARB"); - bglMapBufferARB = GETPROCEXTSOFT("glMapBufferARB"); - bglUnmapBufferARB = GETPROCEXTSOFT("glUnmapBufferARB"); - - // Occlusion queries - bglGenQueriesARB = GETPROCEXTSOFT("glGenQueriesARB"); - bglDeleteQueriesARB = GETPROCEXTSOFT("glDeleteQueriesARB"); - bglIsQueryARB = GETPROCEXTSOFT("glIsQueryARB"); - bglBeginQueryARB = GETPROCEXTSOFT("glBeginQueryARB"); - bglEndQueryARB = GETPROCEXTSOFT("glEndQueryARB"); - bglGetQueryivARB = GETPROCEXTSOFT("glGetQueryivARB"); - bglGetQueryObjectivARB = GETPROCEXTSOFT("glGetQueryObjectivARB"); - bglGetQueryObjectuivARB = GETPROCEXTSOFT("glGetQueryObjectuivARB"); - - // Shader Objects - bglDeleteObjectARB = GETPROCEXTSOFT("glDeleteObjectARB"); - bglGetHandleARB = GETPROCEXTSOFT("glGetHandleARB"); - bglDetachObjectARB = GETPROCEXTSOFT("glDetachObjectARB"); - bglCreateShaderObjectARB = GETPROCEXTSOFT("glCreateShaderObjectARB"); - bglShaderSourceARB = GETPROCEXTSOFT("glShaderSourceARB"); - bglCompileShaderARB = GETPROCEXTSOFT("glCompileShaderARB"); - bglCreateProgramObjectARB = GETPROCEXTSOFT("glCreateProgramObjectARB"); - bglAttachObjectARB = GETPROCEXTSOFT("glAttachObjectARB"); - bglLinkProgramARB = GETPROCEXTSOFT("glLinkProgramARB"); - bglUseProgramObjectARB = GETPROCEXTSOFT("glUseProgramObjectARB"); - bglValidateProgramARB = GETPROCEXTSOFT("glValidateProgramARB"); - bglUniform1fARB = GETPROCEXTSOFT("glUniform1fARB"); - bglUniform2fARB = GETPROCEXTSOFT("glUniform2fARB"); - bglUniform3fARB = GETPROCEXTSOFT("glUniform3fARB"); - bglUniform4fARB = GETPROCEXTSOFT("glUniform4fARB"); - bglUniform1iARB = GETPROCEXTSOFT("glUniform1iARB"); - bglUniform2iARB = GETPROCEXTSOFT("glUniform2iARB"); - bglUniform3iARB = GETPROCEXTSOFT("glUniform3iARB"); - bglUniform4iARB = GETPROCEXTSOFT("glUniform4iARB"); - bglUniform1fvARB = GETPROCEXTSOFT("glUniform1fvARB"); - bglUniform2fvARB = GETPROCEXTSOFT("glUniform2fvARB"); - bglUniform3fvARB = GETPROCEXTSOFT("glUniform3fvARB"); - bglUniform4fvARB = GETPROCEXTSOFT("glUniform4fvARB"); - bglUniform1ivARB = GETPROCEXTSOFT("glUniform1ivARB"); - bglUniform2ivARB = GETPROCEXTSOFT("glUniform2ivARB"); - bglUniform3ivARB = GETPROCEXTSOFT("glUniform3ivARB"); - bglUniform4ivARB = GETPROCEXTSOFT("glUniform4ivARB"); - bglUniformMatrix2fvARB = GETPROCEXTSOFT("glUniformMatrix2fvARB"); - bglUniformMatrix3fvARB = GETPROCEXTSOFT("glUniformMatrix3fvARB"); - bglUniformMatrix4fvARB = GETPROCEXTSOFT("glUniformMatrix4fvARB"); - bglGetObjectParameterfvARB = GETPROCEXTSOFT("glGetObjectParameterfvARB"); - bglGetObjectParameterivARB = GETPROCEXTSOFT("glGetObjectParameterivARB"); - bglGetInfoLogARB = GETPROCEXTSOFT("glGetInfoLogARB"); - bglGetAttachedObjectsARB = GETPROCEXTSOFT("glGetAttachedObjectsARB"); - bglGetUniformLocationARB = GETPROCEXTSOFT("glGetUniformLocationARB"); - bglGetActiveUniformARB = GETPROCEXTSOFT("glGetActiveUniformARB"); - bglGetUniformfvARB = GETPROCEXTSOFT("glGetUniformfvARB"); - bglGetUniformivARB = GETPROCEXTSOFT("glGetUniformivARB"); - bglGetShaderSourceARB = GETPROCEXTSOFT("glGetShaderSourceARB"); - - // Vertex Shaders - bglVertexAttrib1dARB = GETPROCEXTSOFT("glVertexAttrib1dARB"); - bglVertexAttrib1dvARB = GETPROCEXTSOFT("glVertexAttrib1dvARB"); - bglVertexAttrib1fARB = GETPROCEXTSOFT("glVertexAttrib1fARB"); - bglVertexAttrib1fvARB = GETPROCEXTSOFT("glVertexAttrib1fvARB"); - bglVertexAttrib1sARB = GETPROCEXTSOFT("glVertexAttrib1sARB"); - bglVertexAttrib1svARB = GETPROCEXTSOFT("glVertexAttrib1svARB"); - bglVertexAttrib2dARB = GETPROCEXTSOFT("glVertexAttrib2dARB"); - bglVertexAttrib2dvARB = GETPROCEXTSOFT("glVertexAttrib2dvARB"); - bglVertexAttrib2fARB = GETPROCEXTSOFT("glVertexAttrib2fARB"); - bglVertexAttrib2fvARB = GETPROCEXTSOFT("glVertexAttrib2fvARB"); - bglVertexAttrib2sARB = GETPROCEXTSOFT("glVertexAttrib2sARB"); - bglVertexAttrib2svARB = GETPROCEXTSOFT("glVertexAttrib2svARB"); - bglVertexAttrib3dARB = GETPROCEXTSOFT("glVertexAttrib3dARB"); - bglVertexAttrib3dvARB = GETPROCEXTSOFT("glVertexAttrib3dvARB"); - bglVertexAttrib3fARB = GETPROCEXTSOFT("glVertexAttrib3fARB"); - bglVertexAttrib3fvARB = GETPROCEXTSOFT("glVertexAttrib3fvARB"); - bglVertexAttrib3sARB = GETPROCEXTSOFT("glVertexAttrib3sARB"); - bglVertexAttrib3svARB = GETPROCEXTSOFT("glVertexAttrib3svARB"); - bglVertexAttrib4NbvARB = GETPROCEXTSOFT("glVertexAttrib4NbvARB"); - bglVertexAttrib4NivARB = GETPROCEXTSOFT("glVertexAttrib4NivARB"); - bglVertexAttrib4NsvARB = GETPROCEXTSOFT("glVertexAttrib4NsvARB"); - bglVertexAttrib4NubARB = GETPROCEXTSOFT("glVertexAttrib4NubARB"); - bglVertexAttrib4NubvARB = GETPROCEXTSOFT("glVertexAttrib4NubvARB"); - bglVertexAttrib4NuivARB = GETPROCEXTSOFT("glVertexAttrib4NuivARB"); - bglVertexAttrib4NusvARB = GETPROCEXTSOFT("glVertexAttrib4NusvARB"); - bglVertexAttrib4bvARB = GETPROCEXTSOFT("glVertexAttrib4bvARB"); - bglVertexAttrib4dARB = GETPROCEXTSOFT("glVertexAttrib4dARB"); - bglVertexAttrib4dvARB = GETPROCEXTSOFT("glVertexAttrib4dvARB"); - bglVertexAttrib4fARB = GETPROCEXTSOFT("glVertexAttrib4fARB"); - bglVertexAttrib4fvARB = GETPROCEXTSOFT("glVertexAttrib4fvARB"); - bglVertexAttrib4ivARB = GETPROCEXTSOFT("glVertexAttrib4ivARB"); - bglVertexAttrib4sARB = GETPROCEXTSOFT("glVertexAttrib4sARB"); - bglVertexAttrib4svARB = GETPROCEXTSOFT("glVertexAttrib4svARB"); - bglVertexAttrib4ubvARB = GETPROCEXTSOFT("glVertexAttrib4ubvARB"); - bglVertexAttrib4uivARB = GETPROCEXTSOFT("glVertexAttrib4uivARB"); - bglVertexAttrib4usvARB = GETPROCEXTSOFT("glVertexAttrib4usvARB"); - bglVertexAttribPointerARB = GETPROCEXTSOFT("glVertexAttribPointerARB"); - bglEnableVertexAttribArrayARB = GETPROCEXTSOFT("glEnableVertexAttribArrayARB"); - bglDisableVertexAttribArrayARB = GETPROCEXTSOFT("glDisableVertexAttribArrayARB"); - bglGetVertexAttribdvARB = GETPROCEXTSOFT("glGetVertexAttribdvARB"); - bglGetVertexAttribfvARB = GETPROCEXTSOFT("glGetVertexAttribfvARB"); - bglGetVertexAttribivARB = GETPROCEXTSOFT("glGetVertexAttribivARB"); - bglGetVertexAttribPointervARB = GETPROCEXTSOFT("glGetVertexAttribPointervARB"); - bglBindAttribLocationARB = GETPROCEXTSOFT("glBindAttribLocationARB"); - bglGetActiveAttribARB = GETPROCEXTSOFT("glGetActiveAttribARB"); - bglGetAttribLocationARB = GETPROCEXTSOFT("glGetAttribLocationARB"); - -#ifdef RENDERTYPEWIN - bwglSwapIntervalEXT = GETPROCEXTSOFT("wglSwapIntervalEXT"); -#endif - return err; -} - -int32_t unloadgldriver(void) -{ - unloadglulibrary(); - -#ifdef RENDERTYPEWIN - if (!hGLDLL) return 0; -#endif - - Bfree(gldriver); - gldriver = NULL; - -#ifdef RENDERTYPEWIN - FreeLibrary(hGLDLL); - hGLDLL = NULL; -#endif - - bglClearColor = NULL; - bglClear = NULL; - bglColorMask = NULL; - bglAlphaFunc = NULL; - bglBlendFunc = NULL; - bglCullFace = NULL; - bglFrontFace = NULL; - bglPolygonOffset = NULL; - bglPolygonMode = NULL; - bglEnable = NULL; - bglDisable = NULL; - bglGetDoublev = NULL; - bglGetFloatv = NULL; - bglGetIntegerv = NULL; - bglPushAttrib = NULL; - bglPopAttrib = NULL; - bglGetError = NULL; - bglGetString = NULL; - bglHint = NULL; - bglDrawBuffer = NULL; - bglReadBuffer = NULL; - bglScissor = NULL; - bglClipPlane = NULL; - - // Depth - bglDepthFunc = NULL; - bglDepthMask = NULL; - bglDepthRange = NULL; - - // Matrix - bglMatrixMode = NULL; - bglOrtho = NULL; - bglFrustum = NULL; - bglViewport = NULL; - bglPushMatrix = NULL; - bglPopMatrix = NULL; - bglLoadIdentity = NULL; - bglLoadMatrixf = NULL; - bglLoadMatrixd = NULL; - bglMultMatrixf = NULL; - bglMultMatrixd = NULL; - bglRotatef = NULL; - bglScalef = NULL; - bglTranslatef = NULL; - - // Drawing - bglBegin = NULL; - bglEnd = NULL; - bglVertex2f = NULL; - bglVertex2i = NULL; - bglVertex3f = NULL; - bglVertex3d = NULL; - bglVertex3fv = NULL; - bglColor4f = NULL; - bglColor4ub = NULL; - bglTexCoord2d = NULL; - bglTexCoord2f = NULL; - bglTexCoord2i = NULL; - bglNormal3f = NULL; - - // Lighting - bglShadeModel = NULL; - bglLightfv = NULL; - - // Raster funcs - bglReadPixels = NULL; - bglRasterPos4i = NULL; - bglDrawPixels = NULL; - - // Texture mapping - bglTexEnvf = NULL; - bglGenTextures = NULL; - bglDeleteTextures = NULL; - bglBindTexture = NULL; - bglTexImage2D = NULL; - bglTexImage3D = NULL; - bglCopyTexImage2D = NULL; - bglCopyTexSubImage2D= NULL; - bglTexSubImage2D = NULL; - bglTexParameterf = NULL; - bglTexParameteri = NULL; - bglGetTexLevelParameteriv = NULL; - bglCompressedTexImage2DARB = NULL; - bglGetCompressedTexImageARB = NULL; - - // Fog - bglFogf = NULL; - bglFogi = NULL; - bglFogfv = NULL; - - // Display Lists - bglNewList = NULL; - bglEndList = NULL; - bglCallList = NULL; - bglDeleteLists = NULL; - - // Vertex Arrays - bglEnableClientState = NULL; - bglDisableClientState = NULL; - bglVertexPointer = NULL; - bglNormalPointer = NULL; - bglTexCoordPointer = NULL; - bglDrawElements = NULL; - - // Stencil Buffer - bglClearStencil = NULL; - bglStencilOp = NULL; - bglStencilFunc = NULL; - - // GPU Programs - bglGenProgramsARB = NULL; - bglBindProgramARB = NULL; - bglProgramStringARB = NULL; - bglDeleteProgramsARB= NULL; - - // Multitexturing - bglActiveTextureARB = NULL; - bglClientActiveTextureARB = NULL; - bglMultiTexCoord2dARB = NULL; - bglMultiTexCoord2fARB = NULL; - - // Frame Buffer Objects - bglGenFramebuffersEXT = NULL; - bglBindFramebufferEXT = NULL; - bglFramebufferTexture2DEXT = NULL; - bglCheckFramebufferStatusEXT = NULL; - bglDeleteFramebuffersEXT = NULL; - - // Vertex Buffer Objects - bglGenBuffersARB = NULL; - bglBindBufferARB = NULL; - bglDeleteBuffersARB = NULL; - bglBufferDataARB = NULL; - bglBufferSubDataARB = NULL; - bglMapBufferARB = NULL; - bglUnmapBufferARB = NULL; - - // Occlusion queries - bglGenQueriesARB = NULL; - bglDeleteQueriesARB = NULL; - bglIsQueryARB = NULL; - bglBeginQueryARB = NULL; - bglEndQueryARB = NULL; - bglGetQueryivARB = NULL; - bglGetQueryObjectivARB = NULL; - bglGetQueryObjectuivARB = NULL; - - // Shader Objects - bglDeleteObjectARB = NULL; - bglGetHandleARB = NULL; - bglDetachObjectARB = NULL; - bglCreateShaderObjectARB = NULL; - bglShaderSourceARB = NULL; - bglCompileShaderARB = NULL; - bglCreateProgramObjectARB = NULL; - bglAttachObjectARB = NULL; - bglLinkProgramARB = NULL; - bglUseProgramObjectARB = NULL; - bglValidateProgramARB = NULL; - bglUniform1fARB = NULL; - bglUniform2fARB = NULL; - bglUniform3fARB = NULL; - bglUniform4fARB = NULL; - bglUniform1iARB = NULL; - bglUniform2iARB = NULL; - bglUniform3iARB = NULL; - bglUniform4iARB = NULL; - bglUniform1fvARB = NULL; - bglUniform2fvARB = NULL; - bglUniform3fvARB = NULL; - bglUniform4fvARB = NULL; - bglUniform1ivARB = NULL; - bglUniform2ivARB = NULL; - bglUniform3ivARB = NULL; - bglUniform4ivARB = NULL; - bglUniformMatrix2fvARB = NULL; - bglUniformMatrix3fvARB = NULL; - bglUniformMatrix4fvARB = NULL; - bglGetObjectParameterfvARB = NULL; - bglGetObjectParameterivARB = NULL; - bglGetInfoLogARB = NULL; - bglGetAttachedObjectsARB = NULL; - bglGetUniformLocationARB = NULL; - bglGetActiveUniformARB = NULL; - bglGetUniformfvARB = NULL; - bglGetUniformivARB = NULL; - bglGetShaderSourceARB = NULL; - - // Vertex Shaders - bglVertexAttrib1dARB = NULL; - bglVertexAttrib1dvARB = NULL; - bglVertexAttrib1fARB = NULL; - bglVertexAttrib1fvARB = NULL; - bglVertexAttrib1sARB = NULL; - bglVertexAttrib1svARB = NULL; - bglVertexAttrib2dARB = NULL; - bglVertexAttrib2dvARB = NULL; - bglVertexAttrib2fARB = NULL; - bglVertexAttrib2fvARB = NULL; - bglVertexAttrib2sARB = NULL; - bglVertexAttrib2svARB = NULL; - bglVertexAttrib3dARB = NULL; - bglVertexAttrib3dvARB = NULL; - bglVertexAttrib3fARB = NULL; - bglVertexAttrib3fvARB = NULL; - bglVertexAttrib3sARB = NULL; - bglVertexAttrib3svARB = NULL; - bglVertexAttrib4NbvARB = NULL; - bglVertexAttrib4NivARB = NULL; - bglVertexAttrib4NsvARB = NULL; - bglVertexAttrib4NubARB = NULL; - bglVertexAttrib4NubvARB = NULL; - bglVertexAttrib4NuivARB = NULL; - bglVertexAttrib4NusvARB = NULL; - bglVertexAttrib4bvARB = NULL; - bglVertexAttrib4dARB = NULL; - bglVertexAttrib4dvARB = NULL; - bglVertexAttrib4fARB = NULL; - bglVertexAttrib4fvARB = NULL; - bglVertexAttrib4ivARB = NULL; - bglVertexAttrib4sARB = NULL; - bglVertexAttrib4svARB = NULL; - bglVertexAttrib4ubvARB = NULL; - bglVertexAttrib4uivARB = NULL; - bglVertexAttrib4usvARB = NULL; - bglVertexAttribPointerARB = NULL; - bglEnableVertexAttribArrayARB = NULL; - bglDisableVertexAttribArrayARB = NULL; - bglGetVertexAttribdvARB = NULL; - bglGetVertexAttribfvARB = NULL; - bglGetVertexAttribivARB = NULL; - bglGetVertexAttribPointervARB = NULL; - bglBindAttribLocationARB = NULL; - bglGetActiveAttribARB = NULL; - bglGetAttribLocationARB = NULL; - -#ifdef RENDERTYPEWIN - bwglCreateContext = NULL; - bwglDeleteContext = NULL; - bwglGetProcAddress = NULL; - bwglMakeCurrent = NULL; - - bwglSwapBuffers = NULL; - bwglChoosePixelFormat = NULL; - bwglDescribePixelFormat = NULL; - bwglGetPixelFormat = NULL; - bwglSetPixelFormat = NULL; - bwglSwapIntervalEXT = NULL; -#endif - - return 0; -} - -static void *glugetproc_(const char *s, int32_t *err, int32_t fatal) -{ - void *t; -#if defined _WIN32 - t = (void *)GetProcAddress(hGLUDLL,s); -#else - t = (void *)dlsym(gluhandle,s); -#endif - if (!t && fatal) - { - initprintf("Failed to find %s in %s\n", s, glulibrary); - *err = 1; - } - return t; -} -#define GLUGETPROC(s) glugetproc_(s,&err,1) -#define GLUGETPROCSOFT(s) glugetproc_(s,&err,0) - -int32_t loadglulibrary(const char *driver) -{ - int32_t err=0; - -#ifdef RENDERTYPEWIN - if (hGLUDLL) return 0; -#endif - - if (!driver) - { -#ifdef _WIN32 - driver = "glu32.dll"; -#elif defined __APPLE__ - driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; // FIXME: like I know anything about Apple. Hah. -#else - driver = "libGLU.so.1"; -#endif - } - -#if defined _WIN32 - hGLUDLL = LoadLibrary(driver); - if (!hGLUDLL) goto fail; -#else - gluhandle = dlopen(driver, RTLD_NOW|RTLD_GLOBAL); - if (!gluhandle) goto fail; -#endif - glulibrary = Bstrdup(driver); - - bgluTessBeginContour = GLUGETPROC("gluTessBeginContour"); - bgluTessBeginPolygon = GLUGETPROC("gluTessBeginPolygon"); - bgluTessCallback = GLUGETPROC("gluTessCallback"); - bgluTessEndContour = GLUGETPROC("gluTessEndContour"); - bgluTessEndPolygon = GLUGETPROC("gluTessEndPolygon"); - bgluTessNormal = GLUGETPROC("gluTessNormal"); - bgluTessProperty = GLUGETPROC("gluTessProperty"); - bgluTessVertex = GLUGETPROC("gluTessVertex"); - bgluNewTess = GLUGETPROC("gluNewTess"); - - bgluPerspective = GLUGETPROC("gluPerspective"); - - bgluErrorString = GLUGETPROC("gluErrorString"); - - bgluProject = GLUGETPROC("gluProject"); - bgluUnProject = GLUGETPROC("gluUnProject"); - - if (err) unloadglulibrary(); - return err; - -fail: - initprintf("Failed loading \"%s\"\n",driver); - return -1; -} - -int32_t unloadglulibrary(void) -{ -#ifdef RENDERTYPEWIN - if (!hGLUDLL) return 0; -#endif - - Bfree(glulibrary); - glulibrary = NULL; - -#ifdef RENDERTYPEWIN - FreeLibrary(hGLUDLL); - hGLUDLL = NULL; -#else - if (gluhandle) dlclose(gluhandle); - gluhandle = NULL; -#endif - - bgluTessBeginContour = NULL; - bgluTessBeginPolygon = NULL; - bgluTessCallback = NULL; - bgluTessEndContour = NULL; - bgluTessEndPolygon = NULL; - bgluTessNormal = NULL; - bgluTessProperty = NULL; - bgluTessVertex = NULL; - bgluNewTess = NULL; - - bgluPerspective = NULL; - - bgluErrorString = NULL; - - bgluProject = NULL; - bgluUnProject = NULL; - - return 0; -} -#endif - diff --git a/polymer-perf/eduke32/build/src/gtkbits.c b/polymer-perf/eduke32/build/src/gtkbits.c deleted file mode 100644 index c43b20387..000000000 --- a/polymer-perf/eduke32/build/src/gtkbits.c +++ /dev/null @@ -1,89 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "dynamicgtk.h" - -#include "baselayer.h" -#include "build.h" - -int32_t gtkenabled = 0; - -static GdkPixbuf *appicon = NULL; - -int32_t gtkbuild_msgbox(char *name, char *msg) -{ - GtkWidget *dialog; - - if (!gtkenabled) return -1; - - dialog = gtk_message_dialog_new(NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - "%s", msg); - gtk_window_set_title(GTK_WINDOW(dialog), name); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - - return 1; -} - -int32_t gtkbuild_ynbox(char *name, char *msg) -{ - int32_t r; - GtkWidget *dialog; - - if (!gtkenabled) return -1; - - dialog = gtk_message_dialog_new(NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_YES_NO, - "%s", msg); - gtk_window_set_title(GTK_WINDOW(dialog), name); - r = gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - - if (r == GTK_RESPONSE_YES) return 1; - return 0; -} - -#ifdef RENDERTYPESDL -#include "sdlayer.h" -extern struct sdlappicon sdlappicon; -#endif -void gtkbuild_init(int32_t *argc, char ***argv) -{ -#ifndef LINKED_GTK - gtkenabled = dynamicgtk_init(); - if (gtkenabled < 0) - { - gtkenabled = 0; - return; - } -#endif - gtkenabled = gtk_init_check(argc, argv); - if (!gtkenabled) return; -#ifdef RENDERTYPESDL - appicon = gdk_pixbuf_new_from_data((const guchar *)sdlappicon.pixels, - GDK_COLORSPACE_RGB, TRUE, 8, sdlappicon.width, sdlappicon.height, - sdlappicon.width*4, NULL, NULL); -#endif - if (appicon) gtk_window_set_default_icon(appicon); -} - -void gtkbuild_exit(int32_t r) -{ - UNREFERENCED_PARAMETER(r); - if (gtkenabled) - { - if (appicon) g_object_unref((gpointer)appicon); - } -#ifndef LINKED_GTK - dynamicgtk_uninit(); -#endif -} diff --git a/polymer-perf/eduke32/build/src/hightile.c b/polymer-perf/eduke32/build/src/hightile.c deleted file mode 100644 index c05b268a6..000000000 --- a/polymer-perf/eduke32/build/src/hightile.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * High-colour textures support for Polymost - * by Jonathon Fowler - * See the included license file "BUILDLIC.TXT" for license info. - */ - -#ifdef USE_OPENGL - -#include "build.h" -#include "compat.h" -#include "kplib.h" -#include "hightile.h" -#include "baselayer.h" - - -palette_t hictinting[MAXPALOOKUPS]; - -hicreplctyp *hicreplc[MAXTILES]; -char hicfirstinit = 0; - -// -// find the index into hicreplc[] which contains the replacement tile particulars -// -hicreplctyp *hicfindsubst(int32_t picnum, int32_t palnum, int32_t skybox) -{ - if (!hicfirstinit || (uint32_t)picnum >= (uint32_t)MAXTILES) return NULL; - - do - { - if (skybox) - { - hicreplctyp *hr = hicreplc[picnum]; - for (; hr; hr = hr->next) - if (hr->palnum == palnum && hr->skybox && !hr->skybox->ignore) - return hr; - } - else - { - hicreplctyp *hr = hicreplc[picnum]; - for (; hr; hr = hr->next) - if (hr->palnum == palnum && !hr->ignore) - return hr; - } - - if (!palnum || palnum >= (MAXPALOOKUPS - RESERVEDPALS)) break; - palnum = 0; - } - while (1); - - return NULL; // no replacement found -} - - -// -// hicinit() -// Initialize the high-colour stuff to default. -// -void hicinit(void) -{ - int32_t i,j; - hicreplctyp *hr, *next; - - for (i=0; i=0; i--) - { - for (hr=hicreplc[i]; hr;) - { - next = hr->next; - - if (hr->skybox) - { - for (j=5; j>=0; j--) - { - if (hr->skybox->face[j]) - { - Bfree(hr->skybox->face[j]); - } - } - Bfree(hr->skybox); - } - if (hr->filename) Bfree(hr->filename); - Bfree(hr); - - hr = next; - } - } - memset(hicreplc,0,sizeof(hicreplc)); - - hicfirstinit = 1; -} - - -// -// hicsetpalettetint(pal,r,g,b,effect) -// The tinting values represent a mechanism for emulating the effect of global sector -// palette shifts on true-colour textures and only true-colour textures. -// effect bitset: 1 = greyscale, 2 = invert -// -void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect) -{ - if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return; - if (!hicfirstinit) hicinit(); - - hictinting[palnum].r = r; - hictinting[palnum].g = g; - hictinting[palnum].b = b; - hictinting[palnum].f = effect & HICEFFECTMASK; -} - - -// -// hicsetsubsttex(picnum,pal,filen,alphacut) -// Specifies a replacement graphic file for an ART tile. -// -int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut, float xscale, float yscale, float specpower, float specfactor, char flags) -{ - hicreplctyp *hr, *hrn; - - if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1; - if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1; - if (!hicfirstinit) hicinit(); - - for (hr = hicreplc[picnum]; hr; hr = hr->next) - { - if (hr->palnum == palnum) - break; - } - - if (!hr) - { - // no replacement yet defined - hrn = (hicreplctyp *)Bcalloc(1,sizeof(hicreplctyp)); - if (!hrn) return -1; - hrn->palnum = palnum; - } - else hrn = hr; - - // store into hicreplc the details for this replacement - if (hrn->filename) Bfree(hrn->filename); - - hrn->filename = Bstrdup(filen); - if (!hrn->filename) - { - if (hrn->skybox) return -1; // don't free the base structure if there's a skybox defined - if (hr == NULL) Bfree(hrn); // not yet a link in the chain - return -1; - } - hrn->ignore = 0; - hrn->alphacut = min(alphacut,1.0); - hrn->xscale = xscale; - hrn->yscale = yscale; - hrn->specpower = specpower; - hrn->specfactor = specfactor; - hrn->flags = flags; - if (hr == NULL) - { - hrn->next = hicreplc[picnum]; - hicreplc[picnum] = hrn; - } - - if (tilesizx[picnum]<=0 || tilesizy[picnum]<=0) - { - static int32_t first=1; - initprintf("Warning: defined hightile replacement for empty tile %d.", picnum); - if (first) - { - initprintf(" Maybe some tilesXXX.art are not loaded?"); - first = 0; - } - initprintf("\n"); - } - - //printf("Replacement [%d,%d]: %s\n", picnum, palnum, hicreplc[i]->filename); - - return 0; -} - - -// -// hicsetskybox(picnum,pal,faces[6]) -// Specifies a graphic files making up a skybox. -// -int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6]) -{ - hicreplctyp *hr, *hrn; - int32_t j; - - if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1; - if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1; - for (j=5; j>=0; j--) if (!faces[j]) return -1; - if (!hicfirstinit) hicinit(); - - for (hr = hicreplc[picnum]; hr; hr = hr->next) - { - if (hr->palnum == palnum) - break; - } - - if (!hr) - { - // no replacement yet defined - hrn = (hicreplctyp *)Bcalloc(1,sizeof(hicreplctyp)); - if (!hrn) return -1; - - hrn->palnum = palnum; - } - else hrn = hr; - - if (!hrn->skybox) - { - hrn->skybox = (struct hicskybox_t *)Bcalloc(1,sizeof(struct hicskybox_t)); - if (!hrn->skybox) - { - if (hr == NULL) Bfree(hrn); // not yet a link in the chain - return -1; - } - } - else - { - for (j=5; j>=0; j--) - { - if (hrn->skybox->face[j]) - Bfree(hrn->skybox->face[j]); - } - } - - // store each face's filename - for (j=0; j<6; j++) - { - hrn->skybox->face[j] = Bstrdup(faces[j]); - if (!hrn->skybox->face[j]) - { - for (--j; j>=0; --j) // free any previous faces - Bfree(hrn->skybox->face[j]); - Bfree(hrn->skybox); - hrn->skybox = NULL; - if (hr == NULL) Bfree(hrn); - return -1; - } - } - hrn->skybox->ignore = 0; - if (hr == NULL) - { - hrn->next = hicreplc[picnum]; - hicreplc[picnum] = hrn; - } - - return 0; -} - - -// -// hicclearsubst(picnum,pal) -// Clears a replacement for an ART tile, including skybox faces. -// -int32_t hicclearsubst(int32_t picnum, int32_t palnum) -{ - hicreplctyp *hr, *hrn = NULL; - - if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1; - if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1; - if (!hicfirstinit) return 0; - - for (hr = hicreplc[picnum]; hr; hrn = hr, hr = hr->next) - { - if (hr->palnum == palnum) - break; - } - - if (!hr) return 0; - - if (hr->filename) Bfree(hr->filename); - if (hr->skybox) - { - int32_t i; - for (i=5; i>=0; i--) - if (hr->skybox->face[i]) - Bfree(hr->skybox->face[i]); - Bfree(hr->skybox); - } - - if (hrn) hrn->next = hr->next; - else hicreplc[picnum] = hr->next; - Bfree(hr); - - return 0; -} - -#else /* POLYMOST */ - -#include "inttypes.h" - -void hicsetpalettetint(int32_t palnum, char r, char g, char b, char effect) { } -int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float alphacut) { return 0; } -int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6]) { return 0; } -int32_t hicclearsubst(int32_t picnum, int32_t palnum) { return 0; } - -#endif - diff --git a/polymer-perf/eduke32/build/src/kplib.c b/polymer-perf/eduke32/build/src/kplib.c deleted file mode 100644 index fc9b44125..000000000 --- a/polymer-perf/eduke32/build/src/kplib.c +++ /dev/null @@ -1,3300 +0,0 @@ -/************************************************************************************************** -KPLIB.C: Ken's Picture LIBrary written by Ken Silverman -Copyright (c) 1998-2008 Ken Silverman -Ken Silverman's official web site: http://advsys.net/ken - -Features of KPLIB.C: - * Routines for decoding JPG/PNG/GIF/PCX/TGA/BMP/DDS/CEL. - See kpgetdim(), kprender(), and optional helper function: kpzload(). - * Routines for reading files out of ZIP/GRP files. All ZIP/GRP functions start with "kz". - * Multi-platform support: Dos/Windows/Linux/Mac/etc.. - * Compact code, all in a single source file. Yeah, bad design on my part... but makes life - easier for everyone else - you simply add a single C file to your project, throw a few - externs in there, add the function calls, and you're done! - -Brief history: -1998?: Wrote KPEG, a JPEG viewer for DOS -2000: Wrote KPNG, a PNG viewer for DOS -2001: Combined KPEG & KPNG, ported to Visual C, and made it into a library called KPLIB.C -2002: Added support for TGA,GIF,CEL,ZIP -2003: Added support for BMP -05/18/2004: Added support for 8&24 bit PCX -12/09/2005: Added support for progressive JPEG -01/05/2006: Added support for DDS -07/28/2007: Added support for GRP (Build Engine archive) - -I offer this code to the community for free use - all I ask is that my name be included in the -credits. - --Ken S. -**************************************************************************************************/ - -#include "compat.h" - -#include -#include -#include -#include -#include -#include - -#if defined(__POWERPC__) -#define BIGENDIAN 1 -#endif - -#ifdef BIGENDIAN -static uint32_t LSWAPIB(uint32_t a) { return(((a>>8)&0xff00)+((a&0xff00)<<8)+(a<<24)+(a>>24)); } -static uint16_t SSWAPIB(uint16_t a) { return((a>>8)+(a<<8)); } -#define LSWAPIL(a) (a) -#define SSWAPIL(a) (a) -#else -#define LSWAPIB(a) (a) -#define SSWAPIB(a) (a) -static uint32_t LSWAPIL(uint32_t a) { return(((a>>8)&0xff00)+((a&0xff00)<<8)+(a<<24)+(a>>24)); } -static uint16_t SSWAPIL(uint16_t a) { return((a>>8)+(a<<8)); } -#endif - -#if !defined(_WIN32) -#include -#include -typedef long long __int64; -static __inline int32_t _lrotl(int32_t i, int sh) -{ return((i>>(-sh))|(i< -#endif - -#if defined(_WIN32) -#define WIN32_LEAN_AND_MEAN -#include -#endif - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#if !defined(max) -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#if !defined(min) -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#if defined(__GNUC__) -#define _inline inline -#endif - -//use GCC-specific extension to force symbol name to be something in particular to override underscoring. -#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) -#define ASMNAME(x) asm(x) -#else -#define ASMNAME(x) -#endif - -static intptr_t frameplace; -static int32_t bytesperline, xres, yres, globxoffs, globyoffs; - -static const int32_t pow2mask[32] = -{ - 0x00000000,0x00000001,0x00000003,0x00000007, - 0x0000000f,0x0000001f,0x0000003f,0x0000007f, - 0x000000ff,0x000001ff,0x000003ff,0x000007ff, - 0x00000fff,0x00001fff,0x00003fff,0x00007fff, - 0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff, - 0x000fffff,0x001fffff,0x003fffff,0x007fffff, - 0x00ffffff,0x01ffffff,0x03ffffff,0x07ffffff, - 0x0fffffff,0x1fffffff,0x3fffffff,0x7fffffff, -}; -static const int32_t pow2long[32] = -{ - 0x00000001,0x00000002,0x00000004,0x00000008, - 0x00000010,0x00000020,0x00000040,0x00000080, - 0x00000100,0x00000200,0x00000400,0x00000800, - 0x00001000,0x00002000,0x00004000,0x00008000, - 0x00010000,0x00020000,0x00040000,0x00080000, - 0x00100000,0x00200000,0x00400000,0x00800000, - 0x01000000,0x02000000,0x04000000,0x08000000, - 0x10000000,0x20000000,0x40000000,0x80000000, -}; - -//Hack for peekbits,getbits,suckbits (to prevent lots of duplicate code) -// 0: PNG: do 12-byte chunk_header removal hack -// !=0: ZIP: use 64K buffer (olinbuf) -static int32_t zipfilmode; -typedef struct -{ - FILE *fil; //0:no file open, !=0:open file (either stand-alone or zip) - int32_t comptyp; //0:raw data (can be ZIP or stand-alone), 8:PKZIP LZ77 *flate - int32_t seek0; //0:stand-alone file, !=0: start of zip compressed stream data - int32_t compleng;//Global variable for compression FIFO - int32_t comptell;//Global variable for compression FIFO - int32_t leng; //Uncompressed file size (bytes) - int32_t pos; //Current uncompressed relative file position (0<=pos<=leng) - int32_t endpos; //Temp global variable for kzread - int32_t jmpplc; //Store place where decompression paused - int32_t i; //For stand-alone/ZIP comptyp#0, this is like "uncomptell" - //For ZIP comptyp#8&btype==0 "<64K store", this saves i state - int32_t bfinal; //LZ77 decompression state (for later calls) -} kzfilestate; -static kzfilestate kzfs; - -//Initialized tables (can't be in union) -//jpg: png: -// crmul 16384 abstab10 4096 -// cbmul 16384 hxbit 472 -// dct 4608 pow2mask 128* -// colclip 4096 -// colclipup8 4096 -// colclipup16 4096 -// unzig 256 -// pow2mask 128* -// dcflagor 64 - -int32_t palcol[256] ASMNAME("palcol"), paleng, bakcol, numhufblocks, zlibcompflags; -int8_t coltype, filtype, bitdepth; - -//============================ KPNGILIB begins =============================== - -//07/31/2000: KPNG.C first ported to C from READPNG.BAS -//10/11/2000: KPNG.C split into 2 files: KPNG.C and PNGINLIB.C -//11/24/2000: Finished adding support for coltypes 4&6 -//03/31/2001: Added support for Adam7-type interlaced images -//Currently, there is no support for: -// * 16-bit color depth -// * Some useless ancillary chunks, like: gAMA(gamma) & pHYs(aspect ratio) - -//.PNG specific variables: -static int32_t bakr = 0x80, bakg = 0x80, bakb = 0x80; //this used to be public... -static int32_t gslidew = 0, gslider = 0, xm, xmn[4], xr0, xr1, xplc, yplc; -static intptr_t nfplace; -static int32_t clen[320], cclen[19], bitpos, filt, xsiz, ysiz; -static int32_t xsizbpl, ixsiz, ixoff, iyoff, ixstp, iystp, intlac, nbpl, trnsrgb ASMNAME("trnsrgb"); -static int32_t ccind[19] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -static int32_t hxbit[59][2], ibuf0[288], nbuf0[32], ibuf1[32], nbuf1[32]; -static const uint8_t *filptr; -static uint8_t slidebuf[32768], opixbuf0[4], opixbuf1[4]; -static uint8_t pnginited = 0, olinbuf[131072] ASMNAME("olinbuf"); //WARNING:max xres is: 131072/bpp-1 -static int32_t gotcmov = -2, abstab10[1024] ASMNAME("abstab10"); - -//Variables to speed up dynamic Huffman decoding: -#define LOGQHUFSIZ0 9 -#define LOGQHUFSIZ1 6 -static int32_t qhufval0[1<>8) + ((a&0xff00)<<8) + (a<<24) + (a>>24)); -} - -static inline int32_t bitrev(int32_t b, int32_t c) -{ - int32_t i, j; - for (i=1,j=0,c=(1< 0x80000000) - { - cpuid(0x80000001,cpb); - i |= (cpb[3]&(1<<31)); - if (!((cpid[1]^0x68747541)|(cpid[3]^0x69746e65)|(cpid[2]^0x444d4163))) //AuthenticAMD - i |= (cpb[3]&((1<<22)|(1<<30))); - } - if (i&(1<<25)) i |= (1<<22); //SSE implies MMX+ support - return(i); -} - -static uint8_t fakebuf[8], *nfilptr; -static int32_t nbitpos; -static void suckbitsnextblock() -{ - int32_t n; - - if (!zipfilmode) - { - if (!nfilptr) - { - //|===|===|crc|lng|typ|===|===| - // \ fakebuf: / - // |===|===| - //----x O---x O-------- - nbitpos = LSWAPIL(*(int32_t *)&filptr[8]); - nfilptr = (uint8_t *)&filptr[nbitpos+12]; - *(int32_t *)&fakebuf[0] = *(int32_t *)&filptr[0]; //Copy last dword of IDAT chunk - if (*(int32_t *)&filptr[12] == LSWAPIB(0x54414449)) //Copy 1st dword of next IDAT chunk - *(int32_t *)&fakebuf[4] = *(int32_t *)&filptr[16]; - filptr = &fakebuf[4]; bitpos -= 32; - } - else - { - filptr = nfilptr; nfilptr = 0; - bitpos -= ((nbitpos-4)<<3); - } - //if (n_from_suckbits < 4) will it crash? - } - else - { - //NOTE: should only read bytes inside compsize, not 64K!!! :/ - *(int32_t *)&olinbuf[0] = *(int32_t *)&olinbuf[sizeof(olinbuf)-4]; - n = min((unsigned)(kzfs.compleng-kzfs.comptell),sizeof(olinbuf)-4); - fread(&olinbuf[4],n,1,kzfs.fil); - kzfs.comptell += n; - bitpos -= ((sizeof(olinbuf)-4)<<3); - } -} - -static _inline int32_t peekbits(int32_t n) { return((LSWAPIB(*(int32_t *)&filptr[bitpos>>3])>>(bitpos&7))&pow2mask[n]); } -static _inline void suckbits(int32_t n) { bitpos += n; if (bitpos >= 0) suckbitsnextblock(); } -static _inline int32_t getbits(int32_t n) { int32_t i = peekbits(n); suckbits(n); return(i); } - -static int32_t hufgetsym(int32_t *hitab, int32_t *hbmax) -{ - int32_t v, n; - - v = n = 0; - do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; } - while (v >= 0); - return(hitab[hbmax[n]+v]); -} - -//This did not result in a speed-up on P4-3.6Ghz (02/22/2005) -//static int32_t hufgetsym_skipb (int32_t *hitab, int32_t *hbmax, int32_t n, int32_t addit) -//{ -// int32_t v; -// -// v = bitrev(getbits(n),n)+addit; -// do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; } while (v >= 0); -// return(hitab[hbmax[n]+v]); -//} - -static void qhufgencode(int32_t *hitab, int32_t *hbmax, int32_t *qhval, uint8_t *qhbit, int32_t numbits) -{ - int32_t i, j, k, n, r; - - //r is the bit reverse of i. Ex: if: i = 1011100111, r = 1110011101 - i = r = 0; - for (n=1; n<=numbits; n++) - for (k=hbmax[n-1]; k>n)&1) + hbmax[n]-hbmax[n+1]; - // - //n = numbits; - //k = hbmax[n]-r; - // - //j = peekbits(LOGQHUFSIZ); i = qhufval[j]; j = qhufbit[j]; - // - //i = j = 0; - //do - //{ - // i = (i<<1)+getbits(1)+nbuf0[j]-nbuf0[j+1]; j++; - //} while (i >= 0); - //i = ibuf0[nbuf0[j]+i]; - //qhval[r] = k; - - qhbit[r] = 0; //n-32; - } - - // //hufgetsym_skipb related code: - //for(k=n=0;n=0; i--) tbuf[inbuf[i]]++; - tbuf[0] = hbmax[0] = 0; //Hack to remove symbols of length 0? - for (i=0; i<31; i++) hbmax[i+1] = hbmax[i]+tbuf[i]; - for (i=0; i>i)&15); - iyoff = ((0x00402010>>i)&15); - if (((ixoff >= xsiz) || (iyoff >= ysiz)) && (intlac >= 2)) { i = -1; intlac--; } - } - while (i < 0); - j = ((0x33221100>>i)&15); ixstp = (1<>i)&15); iystp = (1<>3) = 2 - //j=3,ixoff=4 2 ((12+(1<<3)-1 - 4)>>3) = 1 - //j=2,ixoff=2 3 4 5 ((12+(1<<2)-1 - 2)>>2) = 3 - //j=1,ixoff=1 6 7 8 9 a b ((12+(1<<1)-1 - 1)>>1) = 6 - ixsiz = ((xsiz+ixstp-1-ixoff)>>j); //It's confusing! See the above example. - nbpl = (bytesperline<>(coltype<<2))&15)*ixsiz; - switch (bitdepth) - { - case 1: xsizbpl = ((xsizbpl+7)>>3); break; - case 2: xsizbpl = ((xsizbpl+3)>>2); break; - case 4: xsizbpl = ((xsizbpl+1)>>1); break; - } - - Bmemset(olinbuf,0,(xsizbpl+1)*sizeof(olinbuf[0])); - *(int32_t *)&opixbuf0[0] = *(int32_t *)&opixbuf1[0] = 0; - xplc = xsizbpl; yplc = globyoffs+iyoff; xm = 0; filt = -1; - - i = globxoffs+ixoff; i = (((-(i>=0))|(ixstp-1))&i); - k = (((-(yplc>=0))|(iystp-1))&yplc); - nfplace = k*bytesperline + (i<<2) + frameplace; - - //Precalculate x-clipping to screen borders (speeds up putbuf) - //Equation: (0 <= xr <= ixsiz) && (0 <= xr*ixstp+globxoffs+ixoff <= xres) - xr0 = max((-globxoffs-ixoff+(1<>j,0); - xr1 = min((xres-globxoffs-ixoff+(1<>j,ixsiz); - xr0 = ixsiz-xr0; - xr1 = ixsiz-xr1; - - if (coltype == 4) { xr0 = xr0*2; xr1 = xr1*2; } - else if (coltype == 2) { xr0 = xr0*3-2; xr1 = xr1*3-2; } - else if (coltype == 6) { xr0 = xr0*4-2; xr1 = xr1*4-2; } - else - { - switch (bitdepth) - { - case 1: xr0 += ((-ixsiz)&7)+7; - xr1 += ((-ixsiz)&7)+7; break; - case 2: xr0 = ((xr0+((-ixsiz)&3)+3)<<1); - xr1 = ((xr1+((-ixsiz)&3)+3)<<1); break; - case 4: xr0 = ((xr0+((-ixsiz)&1)+1)<<2); - xr1 = ((xr1+((-ixsiz)&1)+1)<<2); break; - } - } - ixstp <<= 2; - return(0); -} - -static int32_t Paeth(int32_t a, int32_t b, int32_t c) -{ - int32_t pa, pb, pc; - - pa = b-c; pb = a-c; pc = labs(pa+pb); pa = labs(pa); pb = labs(pb); - if ((pa <= pb) && (pa <= pc)) return(a); - if (pb <= pc) return(b); else return(c); -} - -#if defined(_MSC_VER) && !defined(NOASM) - -static _inline int32_t Paeth686(int32_t a, int32_t b, int32_t c) -{ - _asm - { - push ebx - push esi - push edi - mov eax, a - mov ebx, b - mov ecx, c - mov edx, ecx - sub edx, eax - sub edx, ebx - lea edx, abstab10[edx*4+2048] - mov esi, [ebx*4+edx] - mov edi, [ecx*4+edx] - cmp edi, esi - cmovge edi, esi - cmovge ecx, ebx - cmp edi, [eax*4+edx] - cmovl eax, ecx - pop edi - pop esi - pop ebx - } -} - -static _inline void rgbhlineasm(int32_t c, int32_t d, int32_t t, int32_t b) -{ - _asm - { - push ebx - push edi - - mov ecx, c - mov edx, d - mov edi, t - mov ebx, b - sub ecx, edx - jle short endit - add edx, offset olinbuf - cmp dword ptr trnsrgb, 0 - jz short begit2 - begit: - mov eax, dword ptr [ecx+edx] - or eax, 0xff000000 - cmp eax, dword ptr trnsrgb - jne short skipit - and eax, 0xffffff - skipit: - sub ecx, 3 - mov [edi], eax - lea edi, [edi+ebx] - jnz short begit - jmp short endit - begit2: - mov eax, dword ptr [ecx+edx] - or eax, 0xff000000 - sub ecx, 3 - mov [edi], eax - lea edi, [edi+ebx] - jnz short begit2 - endit: - pop edi - pop ebx - } -} - -static _inline void pal8hlineasm(int32_t c, int32_t d, int32_t t, int32_t b) -{ - _asm - { - mov ecx, c - mov edx, d - sub ecx, edx - jle short endit - - push ebx - push edi - mov edi, t - mov ebx, b - add edx, offset olinbuf - begit:movzx eax, byte ptr [ecx+edx] - mov eax, dword ptr palcol[eax*4] - sub ecx, 1 - mov [edi], eax - lea edi, [edi+ebx] - jnz short begit - pop edi - pop ebx - endit: - } -} - -#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) - -static inline int32_t Paeth686(int32_t a, int32_t b, int32_t c) -{ - __asm__ __volatile__( - "movl %%ecx, %%edx \n" - "subl %%eax, %%edx \n" - "subl %%ebx, %%edx \n" - "leal (abstab10+2048)(,%%edx,4), %%edx \n" - "movl (%%edx,%%ebx,4), %%esi \n" - "movl (%%edx,%%ecx,4), %%edi \n" - "cmpl %%esi, %%edi \n" - "cmovgel %%esi, %%edi \n" - "cmovgel %%ebx, %%ecx \n" - "cmpl (%%edx,%%eax,4), %%edi \n" - "cmovgel %%eax, %%ecx \n" - : "+c"(c) : "a"(a), "b"(b) : "edx","esi","edi","memory","cc" - ); - return c; -} - -//Note: "cmove eax,?" may be faster than "jne ?:and eax,?" but who cares -static inline void rgbhlineasm(int32_t c, int32_t d, int32_t t, int32_t b) -{ - __asm__ __volatile__( - "subl %%edx, %%ecx \n" - "jle 3f \n" - "addl $olinbuf, %%edx \n" - "cmpl $0, trnsrgb(,1) \n" - "jz 2f \n" - "0: movl (%%ecx,%%edx,1), %%eax \n" - "orl $0xff000000, %%eax \n" - "cmpl trnsrgb(,1), %%eax \n" - "jne 1f \n" - "andl $0xffffff, %%eax \n" - "1: subl $3, %%ecx \n" - "movl %%eax, (%%edi) \n" - "leal (%%edi,%%ebx,1), %%edi \n" - "jnz 0b \n" - "jmp 3f \n" - "2: movl (%%ecx,%%edx,1), %%eax \n" - "orl $0xff000000, %%eax \n" - "subl $3, %%ecx \n" - "movl %%eax, (%%edi) \n" - "leal (%%edi,%%ebx,1), %%edi \n" - "jnz 2b \n" - "3: \n" - : "+c"(c), "+d"(d), "+D"(t) : "b"(b) : "eax","memory","cc" - ); -} - -static inline void pal8hlineasm(int32_t c, int32_t d, int32_t t, int32_t b) -{ - __asm__ __volatile__( - "subl %%edx, %%ecx \n" - "jle 1f \n" - "addl $olinbuf, %%edx \n" - "0: movzbl (%%ecx,%%edx,1), %%eax \n" - "movl palcol(,%%eax,4), %%eax \n" - "subl $1, %%ecx \n" - "movl %%eax, (%%edi) \n" - "leal (%%edi,%%ebx,1), %%edi \n" - "jnz 0b \n" - "1: \n" - : "+c"(c), "+d"(d), "+D"(t) : "b"(b) : "eax","memory","cc" - ); -} - -#else - -static inline int32_t Paeth686(int32_t a, int32_t b, int32_t c) -{ - return(Paeth(a,b,c)); -} - -static inline void rgbhlineasm(int32_t x, int32_t xr1, intptr_t p, int32_t ixstp) -{ - int32_t i; - if (!trnsrgb) - { - for (; x>xr1; p+=ixstp,x-=3) *(int32_t *)p = (*(int32_t *)&olinbuf[x])|LSWAPIB(0xff000000); - return; - } - for (; x>xr1; p+=ixstp,x-=3) - { - i = (*(int32_t *)&olinbuf[x])|LSWAPIB(0xff000000); - if (i == trnsrgb) i &= LSWAPIB(0xffffff); - *(int32_t *)p = i; - } -} - -static inline void pal8hlineasm(int32_t x, int32_t xr1, intptr_t p, int32_t ixstp) -{ - for (; x>xr1; p+=ixstp,x--) *(int32_t *)p = palcol[olinbuf[x]]; -} - -#endif - -//Autodetect filter -// /f0: 0000000... -// /f1: 1111111... -// /f2: 2222222... -// /f3: 1333333... -// /f3: 3333333... -// /f4: 4444444... -// /f5: 0142321... -static int32_t filter1st, filterest; -static void putbuf(const uint8_t *buf, int32_t leng) -{ - int32_t i, x; - intptr_t p; - - if (filt < 0) - { - if (leng <= 0) return; - filt = buf[0]; - if (filter1st < 0) filter1st = filt; else filterest |= (1< leng) x = leng; - switch (filt) - { - case 0: - while (i < x) { olinbuf[xplc] = buf[i]; xplc--; i++; } - break; - case 1: - while (i < x) - { - olinbuf[xplc] = (uint8_t)(opixbuf1[xm] += buf[i]); - xm = xmn[xm]; xplc--; i++; - } - break; - case 2: - while (i < x) { olinbuf[xplc] += (uint8_t)buf[i]; xplc--; i++; } - break; - case 3: - while (i < x) - { - opixbuf1[xm] = olinbuf[xplc] = (uint8_t)(((opixbuf1[xm]+olinbuf[xplc])>>1)+buf[i]); - xm = xmn[xm]; xplc--; i++; - } - break; - case 4: - while (i < x) - { - opixbuf1[xm] = (uint8_t)(Paeth(opixbuf1[xm],olinbuf[xplc],opixbuf0[xm])+buf[i]); - opixbuf0[xm] = olinbuf[xplc]; - olinbuf[xplc] = opixbuf1[xm]; - xm = xmn[xm]; xplc--; i++; - } - break; - case 5: //Special hack for Paeth686 (Doesn't have to be case 5) - while (i < x) - { - opixbuf1[xm] = (uint8_t)(Paeth686(opixbuf1[xm],olinbuf[xplc],opixbuf0[xm])+buf[i]); - opixbuf0[xm] = olinbuf[xplc]; - olinbuf[xplc] = opixbuf1[xm]; - xm = xmn[xm]; xplc--; i++; - } - break; - } - - if (xplc > 0) return; - - //Draw line! - if ((uint32_t)yplc < (uint32_t)yres) - { - x = xr0; p = nfplace; - switch (coltype) - { - case 2: rgbhlineasm(x,xr1,p,ixstp); break; - case 4: - for (; x>xr1; p+=ixstp,x-=2) - *(int32_t *)p = (palcol[olinbuf[x]]&LSWAPIB(0xffffff))|LSWAPIL((int32_t)olinbuf[x-1]); - break; - case 6: - for (; x>xr1; p+=ixstp,x-=4) - { - *(char *)(p) = olinbuf[x ]; //B - *(char *)(p+1) = olinbuf[x+1]; //G - *(char *)(p+2) = olinbuf[x+2]; //R - *(char *)(p+3) = olinbuf[x-1]; //A - } - break; - default: - switch (bitdepth) - { - case 1: for (; x>xr1; p+=ixstp,x--) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&7)]; break; - case 2: for (; x>xr1; p+=ixstp,x-=2) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&6)]; break; - case 4: for (; x>xr1; p+=ixstp,x-=4) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&4)]; break; - case 8: pal8hlineasm(x,xr1,p,ixstp); break; //for(;x>xr1;p+=ixstp,x-- ) *(int32_t *)p = palcol[olinbuf[x]]; break; - } - break; - } - nfplace += nbpl; - } - - *(int32_t *)&opixbuf0[0] = *(int32_t *)&opixbuf1[0] = 0; - xplc = xsizbpl; yplc += iystp; - if ((intlac) && (yplc >= globyoffs+ysiz)) { intlac--; initpass(); } - if (i < leng) - { - filt = buf[i++]; - if (filter1st < 0) filter1st = filt; else filterest |= (1<= 2)); - } - j = 3; k = 0; - for (i=257; i<285; i++) - { - hxbit[i+30-257][1] = j; j += (1<= 264)); - } - hxbit[285+30-257][1] = 258; hxbit[285+30-257][0] = 0; - - k = getcputype(); - if (k&(1<<15)) - { - gotcmov = 4; - for (i=0; i<512; i++) abstab10[512+i] = abstab10[512-i] = i; - } -} - -static int32_t kpngrend(const char *kfilebuf, int32_t kfilength, - intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres, - int32_t daglobxoffs, int32_t daglobyoffs) -{ - int32_t i, j, k, bfinal, btype, hlit, hdist, leng; - int32_t slidew, slider; - //int32_t qhuf0v, qhuf1v; - - UNREFERENCED_PARAMETER(kfilength); - - if (!pnginited) { pnginited = 1; initpngtables(); } - - if ((*(int32_t *)&kfilebuf[0] != LSWAPIB(0x474e5089)) || (*(int32_t *)&kfilebuf[4] != LSWAPIB(0x0a1a0a0d))) - return(-1); //"Invalid PNG file signature" - filptr = (uint8_t *)&kfilebuf[8]; - - trnsrgb = 0; filter1st = -1; filterest = 0; - - while (1) - { - leng = LSWAPIL(*(int32_t *)&filptr[0]); i = *(int32_t *)&filptr[4]; - filptr = &filptr[8]; - - if (i == LSWAPIB(0x52444849)) //IHDR (must be first) - { - xsiz = LSWAPIL(*(int32_t *)&filptr[0]); if (xsiz <= 0) return(-1); - ysiz = LSWAPIL(*(int32_t *)&filptr[4]); if (ysiz <= 0) return(-1); - bitdepth = filptr[8]; if (!((1<= 2) return(-1); //"Unsupported interlace type" - intlac = filptr[12]*7; //0=no interlace/1=Adam7 interlace - - //Save code by making grayscale look like a palette color scheme - if ((!coltype) || (coltype == 4)) - { - j = 0xff000000; k = (255 / ((1<=0; i--) palcol[i] = LSWAPIB((LSWAPIL(*(int32_t *)&filptr[i*3])>>8)|0xff000000); - } - else if (i == LSWAPIB(0x44474b62)) //bKGD (must be after PLTE and before IDAT) - { - switch (coltype) - { - case 0: case 4: - bakcol = (((int32_t)filptr[0]<<8)+(int32_t)filptr[1])*255/((1<>16)&255); - bakg = ((bakcol>>8)&255); - bakb = (bakcol&255); - bakcol = LSWAPIB(bakcol); - } - else if (i == LSWAPIB(0x534e5274)) //tRNS (must be after PLTE and before IDAT) - { - switch (coltype) - { - case 0: - if (bitdepth <= 8) - palcol[(int32_t)filptr[1]] &= LSWAPIB(0xffffff); - //else {} // /c0 /d16 not yet supported - break; - case 2: - if (bitdepth == 8) - { trnsrgb = LSWAPIB((((int32_t)filptr[1])<<16)+(((int32_t)filptr[3])<<8)+((int32_t)filptr[5])+0xff000000); } - //else {} //WARNING: PNG docs say: MUST compare all 48 bits :( - break; - case 3: - for (i=min(leng,paleng)-1; i>=0; i--) - palcol[i] &= LSWAPIB((((int32_t)filptr[i])<<24)|0xffffff); - break; - default:; - } - } - else if (i == LSWAPIB(0x54414449)) { break; } //IDAT - - filptr = &filptr[leng+4]; //crc = LSWAPIL(*(int32_t *)&filptr[-4]); - } - - //Initialize this for the getbits() function - zipfilmode = 0; - filptr = &filptr[leng-4]; bitpos = -((leng-4)<<3); nfilptr = 0; - //if (leng < 4) will it crash? - - frameplace = daframeplace; - bytesperline = dabytesperline; - xres = daxres; - yres = dayres; - globxoffs = daglobxoffs; - globyoffs = daglobyoffs; - - switch (coltype) - { - case 4: xmn[0] = 1; xmn[1] = 0; break; - case 2: xmn[0] = 1; xmn[1] = 2; xmn[2] = 0; break; - case 6: xmn[0] = 1; xmn[1] = 2; xmn[2] = 3; xmn[3] = 0; break; - default: xmn[0] = 0; break; - } - switch (bitdepth) - { - case 1: for (i=2; i<256; i++) palcol[i] = palcol[i&1]; break; - case 2: for (i=4; i<256; i++) palcol[i] = palcol[i&3]; break; - case 4: for (i=16; i<256; i++) palcol[i] = palcol[i&15]; break; - } - - //coltype: bitdepth: format: - // 0 1,2,4,8,16 I - // 2 8,16 RGB - // 3 1,2,4,8 P - // 4 8,16 IA - // 6 8,16 RGBA - xsizbpl = ((0x04021301>>(coltype<<2))&15)*xsiz; - switch (bitdepth) - { - case 1: xsizbpl = ((xsizbpl+7)>>3); break; - case 2: xsizbpl = ((xsizbpl+3)>>2); break; - case 4: xsizbpl = ((xsizbpl+1)>>1); break; - } - //Tests to see if xsiz > allocated space in olinbuf - //Note: xsizbpl gets re-written inside initpass() - if ((xsizbpl+1)*sizeof(olinbuf[0]) > sizeof(olinbuf)) return(-1); - - initpass(); - - slidew = 0; slider = 16384; - zlibcompflags = getbits(16); //Actually 2 fields: 8:compmethflags, 8:addflagscheck - do - { - bfinal = getbits(1); btype = getbits(2); - if (btype == 0) - { - //Raw (uncompressed) - suckbits((-bitpos)&7); //Synchronize to start of next byte - i = getbits(16); if ((getbits(16)^i) != 0xffff) return(-1); - for (; i; i--) - { - if (slidew >= slider) - { - putbuf(&slidebuf[(slider-16384)&32767],16384); slider += 16384; - if ((yplc >= yres) && (intlac < 2)) goto kpngrend_goodret; - } - slidebuf[(slidew++)&32767] = (uint8_t)getbits(8); - } - continue; - } - if (btype == 3) continue; - - if (btype == 1) //Fixed Huffman - { - hlit = 288; hdist = 32; i = 0; - for (; i<144; i++) clen[i] = 8; //Fixed bit sizes (literals) - for (; i<256; i++) clen[i] = 9; //Fixed bit sizes (literals) - for (; i<280; i++) clen[i] = 7; //Fixed bit sizes (EOI,lengths) - for (; i<288; i++) clen[i] = 8; //Fixed bit sizes (lengths) - for (; i<320; i++) clen[i] = 5; //Fixed bit sizes (distances) - } - else //Dynamic Huffman - { - numhufblocks++; - hlit = getbits(5)+257; hdist = getbits(5)+1; j = getbits(4)+4; - for (i=0; i= slider) - { - putbuf(&slidebuf[(slider-16384)&32767],16384); slider += 16384; - if ((yplc >= yres) && (intlac < 2)) goto kpngrend_goodret; - } - - k = peekbits(LOGQHUFSIZ0); - if (qhufbit0[k]) { i = qhufval0[k]; suckbits((int32_t)qhufbit0[k]); } - else i = hufgetsym(ibuf0,nbuf0); - //else i = hufgetsym_skipb(ibuf0,nbuf0,LOGQHUFSIZ0,qhuf0v); //hufgetsym_skipb related code - - if (i < 256) { slidebuf[(slidew++)&32767] = (uint8_t)i; continue; } - if (i == 256) break; - i = getbits(hxbit[i+30-257][0]) + hxbit[i+30-257][1]; - - k = peekbits(LOGQHUFSIZ1); - if (qhufbit1[k]) { j = qhufval1[k]; suckbits((int32_t)qhufbit1[k]); } - else j = hufgetsym(ibuf1,nbuf1); - //else j = hufgetsym_skipb(ibuf1,nbuf1,LOGQHUFSIZ1,qhuf1v); //hufgetsym_skipb related code - - j = getbits(hxbit[j][0]) + hxbit[j][1]; - i += slidew; do { slidebuf[slidew&32767] = slidebuf[(slidew-j)&32767]; slidew++; } - while (slidew < i); - } - } - while (!bfinal); - - slider -= 16384; - if (!((slider^slidew)&32768)) - putbuf(&slidebuf[slider&32767],slidew-slider); - else - { - putbuf(&slidebuf[slider&32767],(-slider)&32767); - putbuf(slidebuf,slidew&32767); - } - - kpngrend_goodret:; - if (!(filterest&~(1<>24)); -} - -static inline int32_t mulshr32(int32_t a, int32_t b) -{ - return((int32_t)((((__int64)a)*((__int64)b))>>32)); -} - -#endif - -static int32_t cosqr16[8] = //cosqr16[i] = ((cos(PI*i/16)*sqrt(2))<<24); -{23726566,23270667,21920489,19727919,16777216,13181774,9079764,4628823}; -static int32_t crmul[4096], cbmul[4096]; - -static void initkpeg() -{ - int32_t i, x, y; - - x = 0; //Back & forth diagonal pattern (aligning bytes for best compression) - for (i=0; i<16; i+=2) - { - for (y=8-1; y>=0; y--) - if ((unsigned)(i-y) < (unsigned)8) unzig[x++] = (y<<3)+i-y; - for (y=0; y<8; y++) - if ((unsigned)(i+1-y) < (unsigned)8) unzig[x++] = (y<<3)+i+1-y; - } - for (i=64-1; i>=0; i--) zigit[unzig[i]] = i; - for (i=64-1; i>=0; i--) dcflagor[i] = (uint8_t)(1<<(unzig[i]>>3)); - - for (i=0; i<128; i++) colclip[i] = i+128; - for (i=128; i<512; i++) colclip[i] = 255; - for (i=512; i<896; i++) colclip[i] = 0; - for (i=896; i<1024; i++) colclip[i] = i-896; - for (i=0; i<1024; i++) - { - colclipup8[i] = (colclip[i]<<8); - colclipup16[i] = (colclip[i]<<16)+0xff000000; //Hack: set alphas to 255 - } -#if defined(BIGENDIAN) - for (i=0; i<1024; i++) - { - colclip[i] = bswap(colclip[i]); - colclipup8[i] = bswap(colclipup8[i]); - colclipup16[i] = bswap(colclipup16[i]); - } -#endif - - for (i=0; i<2048; i++) - { - crmul[(i<<1)+0] = (i-1024)*1470104; //1.402*1048576 - crmul[(i<<1)+1] = (i-1024)*-748830; //-0.71414*1048576 - cbmul[(i<<1)+0] = (i-1024)*-360857; //-0.34414*1048576 - cbmul[(i<<1)+1] = (i-1024)*1858077; //1.772*1048576 - } - - Bmemset((void *)&dct[10][0],0,64*2*sizeof(dct[0][0])); -} - -static void huffgetval(int32_t index, int32_t curbits, int32_t num, int32_t *daval, int32_t *dabits) -{ - int32_t b, v, pow2, *hmax; - - hmax = &hufmaxatbit[index][0]; - pow2 = pow2long[curbits-1]; - if (num&pow2) v = 1; else v = 0; - for (b=1; b<=16; b++) - { - if (v < hmax[b]) - { - *dabits = b; - *daval = huftable[index][hufvalatbit[index][b]+v]; - return; - } - pow2 >>= 1; v <<= 1; - if (num&pow2) v++; - } - *dabits = 16; *daval = 0; -} - -static void invdct8x8(int32_t *dc, uint8_t dcflag) -{ -#define SQRT2 23726566 //(sqrt(2))<<24 -#define C182 31000253 //(cos(PI/8)*2)<<24 -#define C18S22 43840978 //(cos(PI/8)*sqrt(2)*2)<<24 -#define C38S22 18159528 //(cos(PI*3/8)*sqrt(2)*2)<<24 - int32_t *edc, t0, t1, t2, t3, t4, t5, t6, t7; - - edc = dc+64; - do - { - if (dcflag&1) //pow2char[z]) - { - t3 = dc[2] + dc[6]; - t2 = (mulshr32(dc[2]-dc[6],SQRT2<<6)<<2) - t3; - t4 = dc[0] + dc[4]; t5 = dc[0] - dc[4]; - t0 = t4+t3; t3 = t4-t3; t1 = t5+t2; t2 = t5-t2; - t4 = (mulshr32(dc[5]-dc[3]+dc[1]-dc[7],C182<<6)<<2); - t7 = dc[1] + dc[7] + dc[5] + dc[3]; - t6 = (mulshr32(dc[3]-dc[5],C18S22<<5)<<3) + t4 - t7; - t5 = (mulshr32(dc[1]+dc[7]-dc[5]-dc[3],SQRT2<<6)<<2) - t6; - t4 = (mulshr32(dc[1]-dc[7],C38S22<<6)<<2) - t4 + t5; - dc[0] = t0+t7; dc[7] = t0-t7; dc[1] = t1+t6; dc[6] = t1-t6; - dc[2] = t2+t5; dc[5] = t2-t5; dc[4] = t3+t4; dc[3] = t3-t4; - } - dc += 8; dcflag >>= 1; - } - while (dc < edc); - dc -= 32; edc -= 24; - do - { - t3 = dc[2*8-32] + dc[6*8-32]; - t2 = (mulshr32(dc[2*8-32]-dc[6*8-32],SQRT2<<6)<<2) - t3; - t4 = dc[0*8-32] + dc[4*8-32]; t5 = dc[0*8-32] - dc[4*8-32]; - t0 = t4+t3; t3 = t4-t3; t1 = t5+t2; t2 = t5-t2; - t4 = (mulshr32(dc[5*8-32]-dc[3*8-32]+dc[1*8-32]-dc[7*8-32],C182<<6)<<2); - t7 = dc[1*8-32] + dc[7*8-32] + dc[5*8-32] + dc[3*8-32]; - t6 = (mulshr32(dc[3*8-32]-dc[5*8-32],C18S22<<5)<<3) + t4 - t7; - t5 = (mulshr32(dc[1*8-32]+dc[7*8-32]-dc[5*8-32]-dc[3*8-32],SQRT2<<6)<<2) - t6; - t4 = (mulshr32(dc[1*8-32]-dc[7*8-32],C38S22<<6)<<2) - t4 + t5; - dc[0*8-32] = t0+t7; dc[7*8-32] = t0-t7; dc[1*8-32] = t1+t6; dc[6*8-32] = t1-t6; - dc[2*8-32] = t2+t5; dc[5*8-32] = t2-t5; dc[4*8-32] = t3+t4; dc[3*8-32] = t3-t4; - dc++; - } - while (dc < edc); -} - -static void yrbrend(int32_t x, int32_t y, int32_t *ldct) -{ - int32_t i, j, ox, oy, xx, yy, xxx, yyy, xxxend, yyyend, yv, cr = 0, cb = 0, *odc, *dc, *dc2; - intptr_t p, pp; - - odc = ldct; dc2 = &ldct[10<<6]; - for (yy=0; yy<(lcompvsamp[0]<<3); yy+=8) - { - oy = y+yy+globyoffs; if ((unsigned)oy >= (unsigned)clipydim) { odc += (lcomphsamp[0]<<6); continue; } - pp = oy*bytesperline + ((x+globxoffs)<<2) + frameplace; - for (xx=0; xx<(lcomphsamp[0]<<3); xx+=8,odc+=64) - { - ox = x+xx+globxoffs; if ((unsigned)ox >= (unsigned)clipxdim) continue; - p = pp+(xx<<2); - dc = odc; - if (lnumcomponents > 1) dc2 = &ldct[(lcomphvsamp0<<6)+((yy>>lcompvsampshift0)<<3)+(xx>>lcomphsampshift0)]; - xxxend = min(clipxdim-ox,8); - yyyend = min(clipydim-oy,8); - if ((lcomphsamp[0] == 1) && (xxxend == 8)) - { - for (yyy=0; yyy>(20-1))&~1; - cb = (dc2[xxx ]>>(20-1))&~1; - ((int32_t *)p)[xxx] = colclipup16[(unsigned)(yv+crmul[cr+2048])>>22]+ - colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+ - colclip[(unsigned)(yv+cbmul[cb+2049])>>22]; - } - p += bytesperline; - dc += 8; - if (!((yyy+1)&(lcompvsamp[0]-1))) dc2 += 8; - } - } - else if ((lcomphsamp[0] == 2) && (xxxend == 8)) - { - for (yyy=0; yyy>1)+64]>>(20-1))&~1; - cb = (dc2[(xxx>>1)]>>(20-1))&~1; - i = crmul[cr+2049]+cbmul[cb+2048]; - cr = crmul[cr+2048]; - cb = cbmul[cb+2049]; - ((int32_t *)p)[xxx] = colclipup16[(unsigned)(yv+cr)>>22]+ - colclipup8[(unsigned)(yv+ i)>>22]+ - colclip[(unsigned)(yv+cb)>>22]; - yv = dc[xxx+1]; - ((int32_t *)p)[xxx+1] = colclipup16[(unsigned)(yv+cr)>>22]+ - colclipup8[(unsigned)(yv+ i)>>22]+ - colclip[(unsigned)(yv+cb)>>22]; - } - p += bytesperline; - dc += 8; - if (!((yyy+1)&(lcompvsamp[0]-1))) dc2 += 8; - } - } - else - { - for (yyy=0; yyy>(20-1))&~1; - cb = (dc2[i ]>>(20-1))&~1; - i++; - } - ((int32_t *)p)[xxx] = colclipup16[(unsigned)(yv+crmul[cr+2048])>>22]+ - colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+ - colclip[(unsigned)(yv+cbmul[cb+2049])>>22]; - } - p += bytesperline; - dc += 8; - if (!((yyy+1)&(lcompvsamp[0]-1))) dc2 += 8; - } - } - } - } -} -void (*kplib_yrbrend_func)(int32_t,int32_t,int32_t *) = yrbrend; - -static int32_t kpegrend(const char *kfilebuf, int32_t kfilength, - intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres, - int32_t daglobxoffs, int32_t daglobyoffs) -{ - int32_t i, j, v, leng, xdim = 0, ydim = 0, index, prec, restartcnt, restartinterval; - int32_t x, y, z, xx, yy, zz, *dc = NULL, num, curbits, c, daval, dabits, *hqval, *hqbits, hqcnt, *quanptr = NULL; - int32_t passcnt = 0, ghsampmax = 0, gvsampmax = 0, glhsampmax = 0, glvsampmax = 0, glhstep, glvstep; - int32_t eobrun, Ss, Se, Ah, Al, Alut[2], dctx[12], dcty[12], ldctx[12], ldcty[12], lshx[4], lshy[4]; - int16_t *dctbuf = 0, *dctptr[12], *ldctptr[12], *dcs = NULL; - uint8_t ch, marker, dcflag; - const uint8_t *kfileptr; - - if (!kpeginited) { kpeginited = 1; initkpeg(); } - - kfileptr = (uint8_t *)kfilebuf; - - if (*(uint16_t *)kfileptr == SSWAPIB(0xd8ff)) kfileptr += 2; - else return(-1); //"%s is not a JPEG file\n",filename - - restartinterval = 0; - for (i=0; i<4; i++) lastdc[i] = 0; - for (i=0; i<8; i++) hufcnt[i] = 0; - - coltype = 0; bitdepth = 8; //For PNGOUT - do - { - ch = *kfileptr++; if (ch != 255) continue; - do { marker = *kfileptr++; } - while (marker == 255); - if (marker != 0xd9) //Don't read past end of buffer - { - leng = ((intptr_t)kfileptr[0]<<8)+(intptr_t)kfileptr[1]-2; - kfileptr += 2; - } - //printf("fileoffs=%08x, marker=%02x,leng=%d",((int32_t)kfileptr)-((int32_t)kfilebuf)-2,marker,leng); - switch (marker) - { - case 0xc0: case 0xc1: case 0xc2: - //processit! - kfileptr++; //numbits = *kfileptr++; - - ydim = SSWAPIL(*(uint16_t *)&kfileptr[0]); - xdim = SSWAPIL(*(uint16_t *)&kfileptr[2]); - //printf("%s: %ld / %ld = %ld\n",filename,xdim*ydim*3,kfilength,(xdim*ydim*3)/kfilength); - - frameplace = daframeplace; - bytesperline = dabytesperline; - xres = daxres; - yres = dayres; - globxoffs = daglobxoffs; - globyoffs = daglobyoffs; - - gnumcomponents = kfileptr[4]; - kfileptr += 5; - ghsampmax = gvsampmax = glhsampmax = glvsampmax = 0; - for (z=0; z>4); - gcompvsamp[z] = (kfileptr[1]&15); - gcompquantab[z] = kfileptr[2]; - for (i=0; i<8; i++) if (gcomphsamp[z] == pow2long[i]) { gcomphsampshift[z] = i; break; } - for (i=0; i<8; i++) if (gcompvsamp[z] == pow2long[i]) { gcompvsampshift[z] = i; break; } - if (gcomphsamp[z] > ghsampmax) { ghsampmax = gcomphsamp[z]; glhsampmax = gcomphsampshift[z]; } - if (gcompvsamp[z] > gvsampmax) { gvsampmax = gcompvsamp[z]; glvsampmax = gcompvsampshift[z]; } - kfileptr += 3; - } - - break; - case 0xc4: //Huffman table - do - { - ch = *kfileptr++; leng--; - if (ch >= 16) { index = ch-12; } - else { index = ch; } - Bmemcpy((void *)&hufnumatbit[index][1],(void *)kfileptr,16); kfileptr += 16; - leng -= 16; - - v = 0; hufcnt[index] = 0; - hufquickcnt[index] = 0; - for (i=1; i<=16; i++) - { - hufmaxatbit[index][i] = v+hufnumatbit[index][i]; - hufvalatbit[index][i] = hufcnt[index]-v; - Bmemcpy((void *)&huftable[index][hufcnt[index]],(void *)kfileptr,(int32_t)hufnumatbit[index][i]); - if (i <= 10) - for (c=0; c0; j--) - { - hufquickval[index][hufquickcnt[index]] = huftable[index][hufcnt[index]+c]; - hufquickbits[index][hufquickcnt[index]] = i; - hufquickcnt[index]++; - } - kfileptr += hufnumatbit[index][i]; - leng -= hufnumatbit[index][i]; - hufcnt[index] += hufnumatbit[index][i]; - v = ((v+hufnumatbit[index][i])<<1); - } - - } - while (leng > 0); - break; - case 0xdb: - do - { - ch = *kfileptr++; leng--; - index = (ch&15); - prec = (ch>>4); - for (z=0; z<64; z++) - { - v = (int32_t)(*kfileptr++); - if (prec) v = (v<<8)+((int32_t)(*kfileptr++)); - v <<= 19; - if (unzig[z]&7) v = mulshr24(v,cosqr16[unzig[z]&7 ]); - if (unzig[z]>>3) v = mulshr24(v,cosqr16[unzig[z]>>3]); - quantab[index][unzig[z]] = v; - } - leng -= 64; - if (prec) leng -= 64; - } - while (leng > 0); - break; - case 0xdd: - restartinterval = SSWAPIL(*(uint16_t *)&kfileptr[0]); - kfileptr += leng; - break; - case 0xda: - if ((xdim <= 0) || (ydim <= 0)) { if (dctbuf) Bfree(dctbuf); return(-1); } - - lnumcomponents = (int32_t)(*kfileptr++); if (!lnumcomponents) { if (dctbuf) Bfree(dctbuf); return(-1); } - if (lnumcomponents > 1) coltype = 2; - for (z=0; z>4); - lcompac[z] = (kfileptr[1]&15); - kfileptr += 2; - } - - Ss = kfileptr[0]; - Se = kfileptr[1]; - Ah = (kfileptr[2]>>4); - Al = (kfileptr[2]&15); - kfileptr += 3; - //printf("passcnt=%d, Ss=%d, Se=%d, Ah=%d, Al=%d\n",passcnt,Ss,Se,Ah,Al); - - if ((!passcnt) && ((Ss) || (Se != 63) || (Ah) || (Al))) - { - for (z=zz=0; z>(glhsampmax+3)) << gcomphsampshift[z]; - dcty[z] = ((ydim+(gvsampmax<<3)-1)>>(glvsampmax+3)) << gcompvsampshift[z]; - zz += dctx[z]*dcty[z]; - } - z = zz*64*sizeof(int16_t); - dctbuf = (int16_t *)Bmalloc(z); if (!dctbuf) return(-1); - Bmemset(dctbuf,0,z); - for (z=zz=0; z>glhstep); lcomphsamp[0] = min(lcomphsamp[0],glhstep); glhstep <<= 3; - glvstep = (gvsampmax>>glvstep); lcompvsamp[0] = min(lcompvsamp[0],glvstep); glvstep <<= 3; - lcomphvsamp0 = lcomphsamp[0]*lcompvsamp[0]; - - clipxdim = min(xdim+globxoffs,xres); - clipydim = min(ydim+globyoffs,yres); - - if ((max(globxoffs,0) >= xres) || (min(globxoffs+xdim,xres) <= 0) || - (max(globyoffs,0) >= yres) || (min(globyoffs+ydim,yres) <= 0)) - { if (dctbuf) Bfree(dctbuf); return(0); } - - Alut[0] = (1<= kfilength) goto kpegrend_break2; //rest of file is missing! - - if (!dctbuf) dc = dct[0]; - for (c=0; c>lshy[c])*ldctx[c] + ((x+xx)>>lshx[c]))<<6]; - - //Get DC - if (!Ss) - { - while (curbits < 16) //Getbits - { - ch = *kfileptr++; if (ch == 255) kfileptr++; - num = (num<<8)+((int32_t)ch); curbits += 8; - } - - if (!Ah) - { - i = ((num>>(curbits-10))&1023); - if (i < hufquickcnt[lcompdc[c]]) - { daval = hufquickval[lcompdc[c]][i]; curbits -= hufquickbits[lcompdc[c]][i]; } - else { huffgetval(lcompdc[c],curbits,num,&daval,&dabits); curbits -= dabits; } - - if (daval) - { - while (curbits < daval) //Getbits - { - ch = *kfileptr++; if (ch == 255) kfileptr++; - num = (num<<8)+((int32_t)ch); curbits += 8; - } - - curbits -= daval; v = ((unsigned)num >> curbits) & pow2mask[daval]; - if (v <= pow2mask[daval-1]) v -= pow2mask[daval]; - lastdc[c] += v; - } - if (!dctbuf) dc[0] = lastdc[c]; else dcs[0] = (int16_t)(lastdc[c]<>(curbits-10))&1023); - if (i < hqcnt) - { daval = hqval[i]; curbits -= hqbits[i]; } - else { huffgetval(lcompac[c]+4,curbits,num,&daval,&dabits); curbits -= dabits; } - - zz = (daval>>4); daval &= 15; - if (daval) - { - if (Ah) - { - if (curbits < 8) //Getbits - { - ch = *kfileptr++; if (ch == 255) kfileptr++; - num = (num<<8)+((long)ch); curbits += 8; - } - if (num&(pow2long[--curbits])) daval = Alut[0]; else daval = Alut[1]; - } - } - else if (zz < 15) - { - eobrun = pow2long[zz]; - if (zz) - { - while (curbits < zz) //Getbits - { - ch = *kfileptr++; if (ch == 255) kfileptr++; - num = (num<<8)+((int32_t)ch); curbits += 8; - } - curbits -= zz; eobrun += ((unsigned)num >> curbits) & pow2mask[zz]; - } - if (!Ah) eobrun--; - break; - } - if (Ah) - { - do - { - if (dcs[z]) - { - if (curbits < 8) //Getbits - { - ch = *kfileptr++; if (ch == 255) kfileptr++; - num = (num<<8)+((int32_t)ch); curbits += 8; - } - if (num&(pow2long[--curbits])) dcs[z] += (int16_t)Alut[dcs[z] < 0]; - } - else if (--zz < 0) break; - z++; - } - while (z <= Se); - if (daval) dcs[z] = (int16_t)daval; - } - else - { - z += zz; if (z > Se) break; - - while (curbits < daval) //Getbits - { - ch = *kfileptr++; if (ch == 255) kfileptr++; - num = (num<<8)+((int32_t)ch); curbits += 8; - } - curbits -= daval; v = ((unsigned)num >> curbits) & pow2mask[daval]; - if (v <= pow2mask[daval-1]) v -= pow2mask[daval]; - dcflag |= dcflagor[z]; - if (!dctbuf) dc[unzig[z]] = v; else dcs[z] = (int16_t)(v< 0)) - { - eobrun--; - for (; z<=Se; z++) - { - if (!dcs[z]) continue; - if (curbits < 8) //Getbits - { - ch = *kfileptr++; if (ch == 255) kfileptr++; - num = (num<<8)+((int32_t)ch); curbits += 8; - } - if (num&(pow2long[--curbits])) dcs[z] += ((int16_t)Alut[dcs[z] < 0]); - } - } - - if (!dctbuf) - { - for (z=64-1; z>=0; z--) dc[z] *= quanptr[z]; - invdct8x8(dc,dcflag); dc += 64; - } - } - } - - if (!dctbuf) kplib_yrbrend_func(x,y,&dct[0][0]); - - restartcnt--; - if (!restartcnt) - { - kfileptr += 1-(curbits>>3); curbits = 0; - if ((kfileptr[-2] != 255) || (kfileptr[-1] != marker)) kfileptr--; - marker++; if (marker >= 0xd8) marker = 0xd0; - restartcnt = restartinterval; - for (i=0; i<4; i++) lastdc[i] = 0; - eobrun = 0; - } - } - kpegrend_break2:; - if (!dctbuf) return(0); - passcnt++; kfileptr -= ((curbits>>3)+1); break; - case 0xd9: break; - default: kfileptr += leng; break; - } - } - while (kfileptr-(uint8_t *)kfilebuf < kfilength); - - if (!dctbuf) return(0); - - lnumcomponents = gnumcomponents; - for (i=0; i>lshy[c])*dctx[c] + ((x+xx)>>lshx[c]))<<6]; - quanptr = &quantab[gcompquantab[c]][0]; - for (z=0; z<64; z++) dc[z] = ((int32_t)dcs[zigit[z]])*quanptr[z]; - invdct8x8(dc,0xff); - } - kplib_yrbrend_func(x,y,&dct[0][0]); - } - - Bfree(dctbuf); return(0); -} - -//============================== KPEGILIB ends ============================== -//================================ GIF begins ================================ - -static uint8_t suffix[4100], filbuffer[768], tempstack[4096]; -static int32_t prefix[4100]; - -static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength, - intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres, - int32_t daglobxoffs, int32_t daglobyoffs) -{ - int32_t i, x, y, xsiz, ysiz, yinc, xend, xspan, yspan, currstr, numbitgoal; - int32_t lzcols, dat, blocklen, bitcnt, xoff, transcol, backcol, *lptr; - intptr_t yoff; - char numbits, startnumbits, chunkind, ilacefirst; - const uint8_t *ptr, *cptr = NULL; - - UNREFERENCED_PARAMETER(kfilelength); - - coltype = 3; bitdepth = 8; //For PNGOUT - - if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') || (kfilebuf[2] != 'F')) return(-1); - paleng = (1<<((kfilebuf[10]&7)+1)); - ptr = (uint8_t *)&kfilebuf[13]; - if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; } - transcol = -1; - while ((chunkind = *ptr++) == '!') - { - //! 0xf9 leng flags ? ? transcol - if (ptr[0] == 0xf9) { if (ptr[2]&1) transcol = (int32_t)(((uint8_t)ptr[5])); } - ptr++; - do { i = *ptr++; ptr += i; } - while (i); - } - if (chunkind != ',') return(-1); - - xoff = SSWAPIB(*(uint16_t *)&ptr[0]); - yoff = SSWAPIB(*(uint16_t *)&ptr[2]); - xspan = SSWAPIB(*(uint16_t *)&ptr[4]); - yspan = SSWAPIB(*(uint16_t *)&ptr[6]); ptr += 9; - if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; } - else { yinc = 1; ilacefirst = 0; } - if (ptr[-1]&128) - { - paleng = (1<<((ptr[-1]&7)+1)); - cptr = ptr; ptr += paleng*3; - } - - for (i=0; i= 0) palcol[transcol] &= LSWAPIB(~0xff000000); - - //Handle GIF files with different logical&image sizes or non-0 offsets (added 05/15/2004) - xsiz = SSWAPIB(*(uint16_t *)&kfilebuf[6]); - ysiz = SSWAPIB(*(uint16_t *)&kfilebuf[8]); - if ((xoff != 0) || (yoff != 0) || (xsiz != xspan) || (ysiz != yspan)) - { - int32_t xx[4], yy[4]; - if (kfilebuf[10]&128) backcol = palcol[(uint8_t)kfilebuf[11]]; else backcol = 0; - - //Fill border to backcol - xx[0] = max(daglobxoffs , 0); yy[0] = max(daglobyoffs , 0); - xx[1] = min(daglobxoffs+xoff ,daxres); yy[1] = min(daglobyoffs+yoff ,dayres); - xx[2] = max(daglobxoffs+xoff+xspan, 0); yy[2] = min(daglobyoffs+yoff+yspan,dayres); - xx[3] = min(daglobxoffs+xsiz ,daxres); yy[3] = min(daglobyoffs+ysiz ,dayres); - - lptr = (int32_t *)(yy[0]*dabytesperline+daframeplace); - for (y=yy[0]; y=0; i--) { suffix[i] = (uint8_t)(prefix[i] = i); } - currstr = lzcols+2; numbits = startnumbits; numbitgoal = (lzcols<<1); - blocklen = *ptr++; - Bmemcpy(filbuffer,ptr,blocklen); ptr += blocklen; - bitcnt = 0; - while (1) - { - dat = (LSWAPIB(*(int32_t *)&filbuffer[bitcnt>>3])>>(bitcnt&7)) & (numbitgoal-1); - bitcnt += numbits; - if ((bitcnt>>3) > blocklen-3) - { - *(int16_t *)filbuffer = *(int16_t *)&filbuffer[bitcnt>>3]; - i = blocklen-(bitcnt>>3); - blocklen = (int32_t)*ptr++; - Bmemcpy(&filbuffer[i],ptr,blocklen); ptr += blocklen; - bitcnt &= 7; blocklen += i; - } - if (dat == lzcols) - { - currstr = lzcols+2; numbits = startnumbits; numbitgoal = (lzcols<<1); - continue; - } - if ((currstr == numbitgoal) && (numbits < 12)) - { numbits++; numbitgoal <<= 1; } - - prefix[currstr] = dat; - for (i=0; dat>=lzcols; dat=prefix[dat]) tempstack[i++] = suffix[dat]; - tempstack[i] = (uint8_t)prefix[dat]; - suffix[currstr-1] = suffix[currstr] = (uint8_t)dat; - - for (; i>=0; i--) - { - if ((uint32_t)x < (uint32_t)daxres) - *(int32_t *)(yoff+(x<<2)) = palcol[(int32_t)tempstack[i]]; - x++; - if (x == xend) - { - y += yinc; - if (y >= yspan) - switch (yinc) - { - case 8: if (!ilacefirst) { y = daglobyoffs+2; yinc = 4; break; } - ilacefirst = 0; y = daglobyoffs+4; yinc = 8; break; - case 4: y = daglobyoffs+1; yinc = 2; break; - case 2: case 1: return(0); - } - if ((uint32_t)y < (uint32_t)dayres) - { yoff = y*dabytesperline+daframeplace; x = daglobxoffs; xend = xspan; } - else - { x = daglobxoffs+0x80000000; xend = xspan+0x80000000; } - } - } - currstr++; - } -} - -//=============================== GIF ends ================================== -//============================== CEL begins ================================= - -// //old .CEL format: -//int16_t id = 0x9119, xdim, ydim, xoff, yoff, id = 0x0008; -//int32_t imagebytes, filler[4]; -//char pal6bit[256][3], image[ydim][xdim]; -static int32_t kcelrend(const char *buf, int32_t fleng, - intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres, - int32_t daglobxoffs, int32_t daglobyoffs) -{ - int32_t i, x, y, x0, x1, y0, y1, xsiz, ysiz; - const char *cptr; - - UNREFERENCED_PARAMETER(fleng); - UNREFERENCED_PARAMETER(daglobxoffs); - - coltype = 3; bitdepth = 8; paleng = 256; //For PNGOUT - - xsiz = (int32_t)SSWAPIB(*(uint16_t *)&buf[2]); if (xsiz <= 0) return(-1); - ysiz = (int32_t)SSWAPIB(*(uint16_t *)&buf[4]); if (ysiz <= 0) return(-1); - - cptr = &buf[32]; - for (i=0; i<256; i++) - { - palcol[i] = (((int32_t)cptr[0])<<18) + - (((int32_t)cptr[1])<<10) + - (((int32_t)cptr[2])<< 2) + LSWAPIB(0xff000000); - cptr += 3; - } - - x0 = daglobyoffs; x1 = xsiz+daglobyoffs; - y0 = daglobyoffs; y1 = ysiz+daglobyoffs; - for (y=y0; y= 12) || (!((1< 32)) return(-1); - if (header[17]&0xc0) return(-1); - - fptr = (uint8_t *)&header[header[0]+18]; - xsiz = (int32_t)SSWAPIB(*(uint16_t *)&header[12]); if (xsiz <= 0) return(-1); - ysiz = (int32_t)SSWAPIB(*(uint16_t *)&header[14]); if (ysiz <= 0) return(-1); - colbyte = ((((int32_t)header[16])+7)>>3); - - if (header[1] == 1) - { - pixbyte = ((((int32_t)header[7])+7)>>3); - cptr = &fptr[-SSWAPIB(*(uint16_t *)&header[3])*pixbyte]; - fptr += SSWAPIB(*(uint16_t *)&header[5])*pixbyte; - } - else pixbyte = colbyte; - - switch (pixbyte) //For PNGOUT - { - case 1: coltype = 0; bitdepth = 8; palcol[0] = LSWAPIB(0xff000000); - for (i=1; i<256; i++) palcol[i] = palcol[i-1]+LSWAPIB(0x10101); break; - case 2: case 3: coltype = 2; break; - case 4: coltype = 6; break; - } - - if (!(header[17]&16)) { x0 = 0; x1 = xsiz; xi = 1; } - else { x0 = xsiz-1; x1 = -1; xi =-1; } - if (header[17]&32) { y0 = 0; y1 = ysiz; yi = 1; pi = dabytesperline; } - else { y0 = ysiz-1; y1 = -1; yi =-1; pi =-dabytesperline; } - x0 += daglobxoffs; y0 += daglobyoffs; - x1 += daglobxoffs; y1 += daglobyoffs; - if (header[2] < 8) rlestat = -2; else rlestat = -1; - - p = y0*dabytesperline+daframeplace; - for (y=y0; y!=y1; y+=yi,p+=pi) - for (x=x0; x!=x1; x+=xi) - { - if (rlestat < 128) - { - if ((rlestat&127) == 127) { rlestat = (int32_t)fptr[0]; fptr++; } - if (header[1] == 1) - { - if (colbyte == 1) i = fptr[0]; - else i = (int32_t)SSWAPIB(*(uint16_t *)&fptr[0]); - nptr = &cptr[i*pixbyte]; - } - else nptr = fptr; - - switch (pixbyte) - { - case 1: i = palcol[(int32_t)nptr[0]]; break; - case 2: i = (int32_t)SSWAPIB(*(uint16_t *)&nptr[0]); - i = LSWAPIB(((i&0x7c00)<<9) + ((i&0x03e0)<<6) + ((i&0x001f)<<3) + 0xff000000); - break; - case 3: i = (*(int32_t *)&nptr[0]) | LSWAPIB(0xff000000); break; - case 4: i = (*(int32_t *)&nptr[0]); break; - } - fptr += colbyte; - } - if (rlestat >= 0) rlestat--; - - if (((uint32_t)x < (uint32_t)daxres) && ((uint32_t)y < (uint32_t)dayres)) - *(int32_t *)(x*4+p) = i; - } - return(0); -} - -//============================== TARGA ends ================================= -//============================== BMP begins ================================= -//TODO: handle BI_RLE8 and BI_RLE4 (compression types 1&2 respectively) -// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -// ³ 0(2): "BM" ³ -// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿³ 10(4): rastoff³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -// ³headsiz=12 (OS/2 1.x)³³ 14(4): headsiz³ ³ All new formats: ³ -//ÚÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÁÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÁÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ -//³ 18(2): xsiz ³ 18(4): xsiz ³ -//³ 20(2): ysiz ³ 22(4): ysiz ³ -//³ 22(2): planes (always 1) ³ 26(2): planes (always 1) ³ -//³ 24(2): cdim (1,4,8,24) ³ 28(2): cdim (1,4,8,16,24,32) ³ -//³ if (cdim < 16) ³ 30(4): compression (0,1,2,3!?,4) ³ -//³ 26(rastoff-14-headsiz): pal(bgr) ³ 34(4): (bitmap data size+3)&3 ³ -//³ ³ 46(4): N colors (0=2^cdim) ³ -//³ ³ if (cdim < 16) ³ -//³ ³ 14+headsiz(rastoff-14-headsiz): pal(bgr0) ³ -//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -// ³ rastoff(?): bitmap data ³ -// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ -static int32_t kbmprend(const char *buf, int32_t fleng, - intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres, - int32_t daglobxoffs, int32_t daglobyoffs) -{ - int32_t i, j, x, y, x0, x1, y0, y1, rastoff, headsiz, xsiz, ysiz, cdim, comp, cptrinc, *lptr; - const char *cptr; - - UNREFERENCED_PARAMETER(fleng); - - headsiz = *(int32_t *)&buf[14]; - if (headsiz == LSWAPIB(12)) //OS/2 1.x (old format) - { - if (*(int16_t *)(&buf[22]) != SSWAPIB(1)) return(-1); - xsiz = (int32_t)SSWAPIB(*(uint16_t *)&buf[18]); - ysiz = (int32_t)SSWAPIB(*(uint16_t *)&buf[20]); - cdim = (int32_t)SSWAPIB(*(uint16_t *)&buf[24]); - comp = 0; - } - else //All newer formats... - { - if (*(int16_t *)(&buf[26]) != SSWAPIB(1)) return(-1); - xsiz = LSWAPIB(*(int32_t *)&buf[18]); - ysiz = LSWAPIB(*(int32_t *)&buf[22]); - cdim = (int32_t)SSWAPIB(*(uint16_t *)&buf[28]); - comp = LSWAPIB(*(int32_t *)&buf[30]); - } - if ((xsiz <= 0) || (!ysiz)) return(-1); - //cdim must be: (1,4,8,16,24,32) - if (((uint32_t)(cdim-1) >= (uint32_t)32) || (!((1<>1); - } - for (palcol[i+3]=0; palcol[i+3]<32; palcol[i+3]++) - { - if (!(j&1)) break; - j = (((uint32_t)j)>>1); - } - } - } - palcol[0] = 24-(palcol[0]+palcol[3]); - palcol[1] = 16-(palcol[1]+palcol[4]); - palcol[2] = 8-(palcol[2]+palcol[5]); - palcol[3] = ((-1<<(24-palcol[3]))&0x00ff0000); - palcol[4] = ((-1<<(16-palcol[4]))&0x0000ff00); - palcol[5] = ((-1<<(8-palcol[5]))&0x000000ff); - } - - cptrinc = (((xsiz*cdim+31)>>3)&~3); cptr = &buf[rastoff]; - if (ysiz < 0) { ysiz = -ysiz; } - else { cptr = &cptr[(ysiz-1)*cptrinc]; cptrinc = -cptrinc; } - - x0 = daglobxoffs; x1 = xsiz+daglobxoffs; - y0 = daglobyoffs; y1 = ysiz+daglobyoffs; - if ((x0 >= daxres) || (x1 <= 0) || (y0 >= dayres) || (y1 <= 0)) return(0); - if (x0 < 0) x0 = 0; - if (x1 > daxres) x1 = daxres; - for (y=y0; y= (uint32_t)dayres) continue; - lptr = (int32_t *)(y*dabytesperline-(daglobyoffs<<2)+daframeplace); - switch (cdim) - { - case 1: for (x=x0; x>3]>>((x&7)^7))&1)]; break; - case 4: for (x=x0; x>1]>>(((x&1)^1)<<2))&15)]; break; - case 8: for (x=x0; x xsiz) { daxres = min(daxres,x1); x1 += bpl-xsiz; } - - j = nplanes-1; daxres <<= 2; x0 <<= 2; x1 <<= 2; x <<= 2; x += j; - if (nplanes == 1) //8-bit PCX - { - do - { - c = *cptr++; if (c < 192) i = 1; else { i = (c&63); c = *cptr++; } - j = palcol[(int32_t)c]; - for (; i; i--) - { - if ((uint32_t)y < (uint32_t)dayres) - if ((uint32_t)x < (uint32_t)daxres) *(int32_t *)(x+p) = j; - x += 4; if (x >= x1) { x = x0; y++; p += dabytesperline; } - } - } - while (y < y1); - } - else if (nplanes == 3) //24-bit PCX - { - do - { - c = *cptr++; if (c < 192) i = 1; else { i = (c&63); c = *cptr++; } - for (; i; i--) - { - if ((uint32_t)y < (uint32_t)dayres) - if ((uint32_t)x < (uint32_t)daxres) *(char *)(x+p) = c; - x += 4; if (x >= x1) { j--; if (j < 0) { j = 3-1; y++; p += dabytesperline; } x = x0+j; } - } - } - while (y < y1); - } - - return(0); -} - -//=============================== PCX ends ================================== -//============================== DDS begins ================================= - -//Note:currently supports: DXT1,DXT2,DXT3,DXT4,DXT5,A8R8G8B8 -static int32_t kddsrend(const char *buf, int32_t leng, - intptr_t frameptr, int32_t bpl, int32_t xdim, int32_t ydim, int32_t xoff, int32_t yoff) -{ - int32_t x, y, z = 0, xx, yy, xsiz, ysiz, dxt, al[2], ai, k, v, c0, c1, stride; - intptr_t j; - uint32_t lut[256], r[4], g[4], b[4], a[8], rr, gg, bb; - uint8_t *uptr, *wptr; - - UNREFERENCED_PARAMETER(leng); - - xsiz = LSWAPIB(*(int32_t *)&buf[16]); - ysiz = LSWAPIB(*(int32_t *)&buf[12]); - if ((*(int32_t *)&buf[80])&LSWAPIB(64)) //Uncompressed supports only A8R8G8B8 for now - { - if ((*(int32_t *)&buf[88]) != LSWAPIB(32)) return(-1); - if ((*(int32_t *)&buf[92]) != LSWAPIB(0x00ff0000)) return(-1); - if ((*(int32_t *)&buf[96]) != LSWAPIB(0x0000ff00)) return(-1); - if ((*(int32_t *)&buf[100]) != LSWAPIB(0x000000ff)) return(-1); - if ((*(uint32_t *)&buf[104]) != LSWAPIB(0xff000000)) return(-1); - buf += 128; - - j = yoff*bpl + (xoff<<2) + frameptr; xx = (xsiz<<2); - if (xoff < 0) { j -= (xoff<<2); buf -= (xoff<<2); xsiz += xoff; } - xsiz = (min(xsiz,xdim-xoff)<<2); ysiz = min(ysiz,ydim); - for (y=0; y= (uint32_t)ydim) continue; - Bmemcpy((void *)j,(void *)buf,xsiz); - } - return(0); - } - if (!((*(int32_t *)&buf[80])&LSWAPIB(4))) return(-1); //FOURCC invalid - dxt = buf[87]-'0'; - if ((buf[84] != 'D') || (buf[85] != 'X') || (buf[86] != 'T') || (dxt < 1) || (dxt > 5)) return(-1); - buf += 128; - - if (!(dxt&1)) - { - for (z=256-1; z>0; z--) lut[z] = (255<<16)/z; - lut[0] = (1<<16); - } - if (dxt == 1) stride = (xsiz<<1); else stride = (xsiz<<2); - - for (y=0; y>8)&0xf8); g[0] = ((c0>>3)&0xfc); b[0] = ((c0<<3)&0xfc); a[0] = 255; - c1 = SSWAPIB(*(uint16_t *)&uptr[2]); - r[1] = ((c1>>8)&0xf8); g[1] = ((c1>>3)&0xfc); b[1] = ((c1<<3)&0xfc); a[1] = 255; - if ((c0 > c1) || (dxt != 1)) - { - r[2] = (((r[0]*2 + r[1] + 1)*(65536/3))>>16); - g[2] = (((g[0]*2 + g[1] + 1)*(65536/3))>>16); - b[2] = (((b[0]*2 + b[1] + 1)*(65536/3))>>16); a[2] = 255; - r[3] = (((r[0] + r[1]*2 + 1)*(65536/3))>>16); - g[3] = (((g[0] + g[1]*2 + 1)*(65536/3))>>16); - b[3] = (((b[0] + b[1]*2 + 1)*(65536/3))>>16); a[3] = 255; - } - else - { - r[2] = (r[0] + r[1])>>1; - g[2] = (g[0] + g[1])>>1; - b[2] = (b[0] + b[1])>>1; a[2] = 255; - r[3] = g[3] = b[3] = a[3] = 0; //Transparent - } - v = LSWAPIB(*(int32_t *)&uptr[4]); - if (dxt >= 4) - { - a[0] = uptr[-8]; a[1] = uptr[-7]; k = a[1]-a[0]; - if (k < 0) - { - z = a[0]*6 + a[1] + 3; - for (j=2; j<8; j++) { a[j] = ((z*(65536/7))>>16); z += k; } - } - else - { - z = a[0]*4 + a[1] + 2; - for (j=2; j<6; j++) { a[j] = ((z*(65536/5))>>16); z += k; } - a[6] = 0; a[7] = 255; - } - al[0] = LSWAPIB(*(int32_t *)&uptr[-6]); - al[1] = LSWAPIB(*(int32_t *)&uptr[-3]); - } - wptr = (uint8_t *)((y+yoff)*bpl + ((x+xoff)<<2) + frameptr); - ai = 0; - for (yy=0; yy<4; yy++,wptr+=bpl) - { - if ((uint32_t)(y+yy+yoff) >= (uint32_t)ydim) { ai += 4; continue; } - for (xx=0; xx<4; xx++,ai++) - { - if ((uint32_t)(x+xx+xoff) >= (uint32_t)xdim) continue; - - j = ((v>>(ai<<1))&3); - switch (dxt) - { - case 1: z = a[j]; break; - case 2: case 3: z = ((uptr[(ai>>1)-8] >> ((xx&1)<<2))&15)*17; break; - case 4: case 5: z = a[(al[yy>>1] >> ((ai&7)*3))&7]; break; - } - rr = r[j]; gg = g[j]; bb = b[j]; - if (!(dxt&1)) - { - bb = min((bb*lut[z])>>16,255); - gg = min((gg*lut[z])>>16,255); - rr = min((rr*lut[z])>>16,255); - } - wptr[(xx<<2)+0] = (uint8_t)bb; - wptr[(xx<<2)+1] = (uint8_t)gg; - wptr[(xx<<2)+2] = (uint8_t)rr; - wptr[(xx<<2)+3] = (uint8_t)z; - } - } - } - return(0); -} - -//=============================== DDS ends ================================== -//=================== External picture interface begins ====================== - -void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz) -{ - int32_t *lptr; - const uint8_t *cptr; - uint8_t *ubuf = (uint8_t *)buf; - - (*xsiz) = (*ysiz) = 0; if (leng < 16) return; - if ((ubuf[0] == 0x89) && (ubuf[1] == 0x50)) //.PNG - { - lptr = (int32_t *)buf; - if ((lptr[0] != LSWAPIB(0x474e5089)) || (lptr[1] != LSWAPIB(0x0a1a0a0d))) return; - lptr = &lptr[2]; - while (((uintptr_t)lptr-(uintptr_t)buf) < (uintptr_t)(leng-16)) - { - if (lptr[1] == LSWAPIB(0x52444849)) //IHDR - {(*xsiz) = LSWAPIL(lptr[2]); (*ysiz) = LSWAPIL(lptr[3]); break; } - lptr = (int32_t *)((intptr_t)lptr + LSWAPIL(lptr[0]) + 12); - } - } - else if ((ubuf[0] == 0xff) && (ubuf[1] == 0xd8)) //.JPG - { - cptr = (uint8_t *)&buf[2]; - while (((uintptr_t)cptr-(uintptr_t)buf) < (uintptr_t)(leng-8)) - { - if ((cptr[0] != 0xff) || (cptr[1] == 0xff)) { cptr++; continue; } - if ((uint32_t)(cptr[1]-0xc0) < 3) - { - (*ysiz) = SSWAPIL(*(uint16_t *)&cptr[5]); - (*xsiz) = SSWAPIL(*(uint16_t *)&cptr[7]); - break; - } - cptr = &cptr[SSWAPIL(*(uint16_t *)&cptr[2])+2]; - } - } - else if ((ubuf[0] == 'G') && (ubuf[1] == 'I') && (ubuf[2] == 'F')) //.GIF - { - (*xsiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[6]); - (*ysiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[8]); - } - else if ((ubuf[0] == 0x19) && (ubuf[1] == 0x91) && (ubuf[10] == 8) && (ubuf[11] == 0)) //old .CEL/.PIC - { - (*xsiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[2]); - (*ysiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[4]); - } - else if ((ubuf[0] == 'B') && (ubuf[1] == 'M')) //.BMP - { - if (*(int32_t *)(&buf[14]) == LSWAPIB(12)) //OS/2 1.x (old format) - { - if (*(int16_t *)(&buf[22]) != SSWAPIB(1)) return; - (*xsiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[18]); - (*ysiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[20]); - } - else //All newer formats... - { - if (*(int16_t *)(&buf[26]) != SSWAPIB(1)) return; - (*xsiz) = LSWAPIB(*(int32_t *)&buf[18]); - (*ysiz) = LSWAPIB(*(int32_t *)&buf[22]); - } - } - else if (*(int32_t *)ubuf == LSWAPIB(0x0801050a)) //.PCX - { - (*xsiz) = SSWAPIB(*(int16_t *)&buf[ 8])-SSWAPIB(*(int16_t *)&buf[4])+1; - (*ysiz) = SSWAPIB(*(int16_t *)&buf[10])-SSWAPIB(*(int16_t *)&buf[6])+1; - } - else if ((*(int32_t *)ubuf == LSWAPIB(0x20534444)) && (*(int32_t *)&ubuf[4] == LSWAPIB(124))) //.DDS - { - (*xsiz) = LSWAPIB(*(int32_t *)&buf[16]); - (*ysiz) = LSWAPIB(*(int32_t *)&buf[12]); - } - else - { - //Unreliable .TGA identification - this MUST be final case! - if ((leng >= 19) && (!(ubuf[1]&0xfe))) - if ((ubuf[2] < 12) && ((1<= 19) && (!(ubuf[1]&0xfe))) - if ((ubuf[2] < 12) && ((1<= 'a') && (c0 <= 'z')) c0 -= 32; - c1 = *j; if ((c1 >= 'a') && (c1 <= 'z')) c1 -= 32; - if (c0 == '/') c0 = '\\'; - if (c1 == '/') c1 = '\\'; - if (c0 != c1) return(0); - i++; j++; - } - while (*j); - return(!*i); -} - -//Same as: stricmp(st0,st1) except: '/' == '\' -static int32_t filnamcmp(const char *st0, const char *st1) -{ - int32_t i; - char ch0, ch1; - - for (i=0; st0[i]; i++) - { - ch0 = st0[i]; if ((ch0 >= 'a') && (ch0 <= 'z')) ch0 -= 32; - ch1 = st1[i]; if ((ch1 >= 'a') && (ch1 <= 'z')) ch1 -= 32; - if (ch0 == '/') ch0 = '\\'; - if (ch1 == '/') ch1 = '\\'; - if (ch0 != ch1) return(-1); - } - if (!st1[i]) return(0); - return(-1); -} - -//===================== ZIP decompression code begins ======================== - -//format: (used by kzaddstack/kzopen to cache file name&start info) -//[char zipnam[?]\0] -//[next hashindex/-1][next index/-1][zipnam index][fileoffs][fileleng][iscomp][char filnam[?]\0] -//[next hashindex/-1][next index/-1][zipnam index][fileoffs][fileleng][iscomp][char filnam[?]\0] -//... -//[char zipnam[?]\0] -//[next hashindex/-1][next index/-1][zipnam index][fileoffs][fileleng][iscomp][char filnam[?]\0] -//[next hashindex/-1][next index/-1][zipnam index][fileoffs][fileleng][iscomp][char filnam[?]\0] -//... -#define KZHASHINITSIZE 8192 -static char *kzhashbuf = 0; -static int32_t kzhashead[256], kzhashpos, kzlastfnam, kzhashsiz, kzdirnamhead = -1; - -static int32_t kzcheckhashsiz(int32_t siz) -{ - int32_t i; - - if (!kzhashbuf) //Initialize hash table on first call - { - Bmemset(kzhashead,-1,sizeof(kzhashead)); - kzhashbuf = (char *)Bmalloc(KZHASHINITSIZE); if (!kzhashbuf) return(0); - kzhashpos = 0; kzlastfnam = -1; kzhashsiz = KZHASHINITSIZE; kzdirnamhead = -1; - } - if (kzhashpos+siz > kzhashsiz) //Make sure string fits in kzhashbuf - { - i = kzhashsiz; do { i <<= 1; } - while (kzhashpos+siz > i); - kzhashbuf = (char *)Brealloc(kzhashbuf,i); if (!kzhashbuf) return(0); - kzhashsiz = i; - } - return(1); -} - -static int32_t kzcalchash(const char *st) -{ - int32_t i, hashind; - char ch; - - for (i=0,hashind=0; st[i]; i++) - { - ch = st[i]; - if ((ch >= 'a') && (ch <= 'z')) ch -= 32; - if (ch == '/') ch = '\\'; - hashind = (ch - hashind*3); - } - return(hashind%(sizeof(kzhashead)/sizeof(kzhashead[0]))); -} - -static int32_t kzcheckhash(const char *filnam, char **zipnam, int32_t *fileoffs, int32_t *fileleng, char *iscomp) -{ - int32_t i; - - if (!kzhashbuf) return(0); - if (filnam[0] == '|') filnam++; - for (i=kzhashead[kzcalchash(filnam)]; i>=0; i=(*(int32_t *)&kzhashbuf[i])) - if (!filnamcmp(filnam,&kzhashbuf[i+21])) - { - (*zipnam) = &kzhashbuf[*(int32_t *)&kzhashbuf[i+8]]; - (*fileoffs) = *(int32_t *)&kzhashbuf[i+12]; - (*fileleng) = *(int32_t *)&kzhashbuf[i+16]; - (*iscomp) = *(int32_t *)&kzhashbuf[i+20]; - return(1); - } - return(0); -} - -void kzuninit() -{ - if (kzhashbuf) { Bfree(kzhashbuf); kzhashbuf = 0; } - kzhashpos = kzhashsiz = 0; kzdirnamhead = -1; -} - -//If file found, loads internal directory from ZIP/GRP into Bmemory (hash) to allow faster access later -//If file not found, assumes it's a directory and adds it to an internal list -int32_t kzaddstack(const char *filnam) -{ - FILE *fil; - int32_t i, j, k, leng, hashind, zipnamoffs, numfiles; - char tempbuf[260+46]; - - fil = fopen(filnam,"rb"); - if (!fil) //if file not found, assume it's a directory - { - //Add directory name to internal list (using kzhashbuf for convenience of dynamic allocation) - i = strlen(filnam)+5; if (!kzcheckhashsiz(i)) return(-1); - *(int32_t *)&kzhashbuf[kzhashpos] = kzdirnamhead; kzdirnamhead = kzhashpos; - strcpy(&kzhashbuf[kzhashpos+4],filnam); - kzhashpos += i; - - return(-1); - } - - //Write ZIP/GRP filename to hash - i = strlen(filnam)+1; if (!kzcheckhashsiz(i)) { fclose(fil); return(-1); } - strcpy(&kzhashbuf[kzhashpos],filnam); - zipnamoffs = kzhashpos; kzhashpos += i; - - fread(&i,4,1,fil); - if (i == LSWAPIB(0x04034b50)) //'PK\3\4' is ZIP file id - { - fseek(fil,-22,SEEK_END); - fread(tempbuf,22,1,fil); - if (*(int32_t *)&tempbuf[0] == LSWAPIB(0x06054b50)) //Fast way of finding dir info - { - numfiles = SSWAPIB(*(int16_t *)&tempbuf[10]); - fseek(fil,LSWAPIB(*(int32_t *)&tempbuf[16]),SEEK_SET); - } - else //Slow way of finding dir info (used when ZIP has junk at end) - { - fseek(fil,0,SEEK_SET); numfiles = 0; - while (1) - { - if (!fread(&j,4,1,fil)) { numfiles = -1; break; } - if (j == LSWAPIB(0x02014b50)) break; //Found central file header :) - if (j != LSWAPIB(0x04034b50)) { numfiles = -1; break; } - fread(tempbuf,26,1,fil); - fseek(fil,LSWAPIB(*(int32_t *)&tempbuf[14]) + SSWAPIB(*(int16_t *)&tempbuf[24]) + SSWAPIB(*(int16_t *)&tempbuf[22]),SEEK_CUR); - numfiles++; - } - if (numfiles < 0) { fclose(fil); return(-1); } - fseek(fil,-4,SEEK_CUR); - } - for (i=0; i 2GB-32K bytes - gslidew = 0x7fffffff; //Force reload at beginning - - return((intptr_t)kzfs.fil); - default: fclose(kzfs.fil); kzfs.fil = 0; return(0); - } - } - } - - //Finally, check mounted dirs - for (i=kzdirnamhead; i>=0; i=*(int32_t *)&kzhashbuf[i]) - { - strcpy(tempbuf,&kzhashbuf[i+4]); - j = strlen(tempbuf); - if (strlen(filnam)+1+j >= sizeof(tempbuf)) continue; //don't allow int32_t filenames to buffer overrun - if ((j) && (tempbuf[j-1] != '/') && (tempbuf[j-1] != '\\') && (filnam[0] != '/') && (filnam[0] != '\\')) -#if defined(_WIN32) - strcat(tempbuf,"\\"); -#else - strcat(tempbuf,"/"); -#endif - strcat(tempbuf,filnam); - kzfs.fil = fopen(tempbuf,"rb"); - if (kzfs.fil) - { - kzfs.comptyp = 0; - kzfs.seek0 = 0; - kzfs.leng = filelength(_fileno(kzfs.fil)); - kzfs.pos = 0; - kzfs.i = 0; - return((intptr_t)kzfs.fil); - } - } - - return(0); -} - -// -------------------------------------------------------------------------- - -#if defined(_WIN32) -static HANDLE hfind = INVALID_HANDLE_VALUE; -static WIN32_FIND_DATA findata; -#else -#define MAX_PATH 260 -static DIR *hfind = NULL; -static struct dirent *findata = NULL; -#endif - -//File find state variables. Example sequence (read top->bot, left->right): -// srchstat srchzoff srchdoff -// 0,1,2,3 -// 500,200,-1 -// 4 300 -// 0,1,2,3,4 100 -// 0,1,2,3,4 -1 -static int32_t srchstat = -1, srchzoff = 0, srchdoff = -1, wildstpathleng; -static char wildst[MAX_PATH] = "", newildst[MAX_PATH] = ""; - -void kzfindfilestart(const char *st) -{ -#if defined(_WIN32) - if (hfind != INVALID_HANDLE_VALUE) - { FindClose(hfind); hfind = INVALID_HANDLE_VALUE; } -#else - if (hfind) { closedir(hfind); hfind = NULL; } -#endif - strcpy(wildst,st); strcpy(newildst,st); - srchstat = 0; srchzoff = kzlastfnam; srchdoff = kzdirnamhead; -} - -int32_t kzfindfile(char *filnam) -{ - int32_t i; - - kzfindfile_beg:; - filnam[0] = 0; - if (srchstat == 0) - { - if (!newildst[0]) { srchstat = -1; return(0); } - do - { - srchstat = 1; - - //Extract directory from wildcard string for pre-pending - wildstpathleng = 0; - for (i=0; newildst[i]; i++) - if ((newildst[i] == '/') || (newildst[i] == '\\')) - wildstpathleng = i+1; - - Bmemcpy(filnam,newildst,wildstpathleng); - -#if defined(_WIN32) - hfind = FindFirstFile(newildst,&findata); - if (hfind == INVALID_HANDLE_VALUE) - { if (!kzhashbuf) return(0); srchstat = 2; continue; } - if (findata.dwFileAttributes&FILE_ATTRIBUTE_HIDDEN) continue; - i = wildstpathleng; - if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) - if ((findata.cFileName[0] == '.') && (!findata.cFileName[1])) continue; - strcpy(&filnam[i],findata.cFileName); - if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) strcat(&filnam[i],"\\"); -#else - if (!hfind) - { - char *s = "."; - if (wildstpathleng > 0) - { - filnam[wildstpathleng] = 0; - s = filnam; - } - hfind = opendir(s); - if (!hfind) { if (!kzhashbuf) return 0; srchstat = 2; continue; } - } - break; // process srchstat == 1 -#endif - return(1); - } - while (0); - } - if (srchstat == 1) - { - while (1) - { - Bmemcpy(filnam,newildst,wildstpathleng); -#if defined(_WIN32) - if (!FindNextFile(hfind,&findata)) - { FindClose(hfind); hfind = INVALID_HANDLE_VALUE; if (!kzhashbuf) return(0); srchstat = 2; break; } - if (findata.dwFileAttributes&FILE_ATTRIBUTE_HIDDEN) continue; - i = wildstpathleng; - if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) - if ((findata.cFileName[0] == '.') && (!findata.cFileName[1])) continue; - strcpy(&filnam[i],findata.cFileName); - if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) strcat(&filnam[i],"\\"); -#else - if ((findata = readdir(hfind)) == NULL) - { closedir(hfind); hfind = NULL; if (!kzhashbuf) return 0; srchstat = 2; break; } - i = wildstpathleng; - if (findata->d_type == DT_DIR) - { if (findata->d_name[0] == '.' && !findata->d_name[1]) continue; } //skip . - else if ((findata->d_type == DT_REG) || (findata->d_type == DT_LNK)) - { if (findata->d_name[0] == '.') continue; } //skip hidden (dot) files - else continue; //skip devices and fifos and such - if (!wildmatch(findata->d_name,&newildst[wildstpathleng])) continue; - strcpy(&filnam[i],findata->d_name); - if (findata->d_type == DT_DIR) strcat(&filnam[i],"/"); -#endif - return(1); - } - } - while (srchstat == 2) - { - if (srchzoff < 0) { srchstat = 3; break; } - if (wildmatch(&kzhashbuf[srchzoff+21],newildst)) - { - //strcpy(filnam,&kzhashbuf[srchzoff+21]); - filnam[0] = '|'; strcpy(&filnam[1],&kzhashbuf[srchzoff+21]); - srchzoff = *(int32_t *)&kzhashbuf[srchzoff+4]; - return(1); - } - srchzoff = *(int32_t *)&kzhashbuf[srchzoff+4]; - } - while (srchstat == 3) - { - if (srchdoff < 0) { srchstat = -1; break; } - strcpy(newildst,&kzhashbuf[srchdoff+4]); - i = strlen(newildst); - if ((i) && (newildst[i-1] != '/') && (newildst[i-1] != '\\') && (filnam[0] != '/') && (filnam[0] != '\\')) -#if defined(_WIN32) - strcat(newildst,"\\"); -#else - strcat(newildst,"/"); -#endif - strcat(newildst,wildst); - srchdoff = *(int32_t *)&kzhashbuf[srchdoff]; - srchstat = 0; goto kzfindfile_beg; - } - - return(0); -} - -//File searching code (supports inside ZIP files!) How to use this code: -// char filnam[MAX_PATH]; -// kzfindfilestart("vxl/*.vxl"); -// while (kzfindfile(filnam)) puts(filnam); -//NOTES: -// * Directory names end with '\' or '/' (depending on system) -// * Files inside zip begin with '|' - -// -------------------------------------------------------------------------- - -static char *gzbufptr; -static void putbuf4zip(const uint8_t *buf, int32_t uncomp0, int32_t uncomp1) -{ - int32_t i0, i1; - // uncomp0 ... uncomp1 - // &gzbufptr[kzfs.pos] ... &gzbufptr[kzfs.endpos]; - i0 = max(uncomp0,kzfs.pos); - i1 = min(uncomp1,kzfs.endpos); - if (i0 < i1) Bmemcpy(&gzbufptr[i0],&buf[i0-uncomp0],i1-i0); -} - -//returns number of bytes copied -int32_t kzread(void *buffer, int32_t leng) -{ - int32_t i, j, k, bfinal, btype, hlit, hdist; - - if ((!kzfs.fil) || (leng <= 0)) return(0); - - if (kzfs.comptyp == 0) - { - if (kzfs.pos != kzfs.i) //Seek only when position changes - fseek(kzfs.fil,kzfs.seek0+kzfs.pos,SEEK_SET); - i = min(kzfs.leng-kzfs.pos,leng); - fread(buffer,i,1,kzfs.fil); - kzfs.i += i; //kzfs.i is a local copy of ftell(kzfs.fil); - } - else if (kzfs.comptyp == 8) - { - zipfilmode = 1; - - //Initialize for putbuf4zip - gzbufptr = (char *)buffer; gzbufptr = &gzbufptr[-kzfs.pos]; - kzfs.endpos = min(kzfs.pos+leng,kzfs.leng); - if (kzfs.endpos == kzfs.pos) return(0); //Guard against reading 0 length - - if (kzfs.pos < gslidew-32768) // Must go back to start :( - { - if (kzfs.comptell) fseek(kzfs.fil,kzfs.seek0,SEEK_SET); - - gslidew = 0; gslider = 16384; - kzfs.jmpplc = 0; - - //Initialize for suckbits/peekbits/getbits - kzfs.comptell = min((unsigned)kzfs.compleng,sizeof(olinbuf)); - fread(&olinbuf[0],kzfs.comptell,1,kzfs.fil); - //Make it re-load when there are < 32 bits left in FIFO - bitpos = -(((int32_t)sizeof(olinbuf)-4)<<3); - //Identity: filptr + (bitpos>>3) = &olinbuf[0] - filptr = &olinbuf[-(bitpos>>3)]; - } - else - { - i = max(gslidew-32768,0); j = gslider-16384; - - //HACK: Don't unzip anything until you have to... - // (keeps file pointer as low as possible) - if (kzfs.endpos <= gslidew) j = kzfs.endpos; - - //write uncompoffs on slidebuf from: i to j - if (!((i^j)&32768)) - putbuf4zip(&slidebuf[i&32767],i,j); - else - { - putbuf4zip(&slidebuf[i&32767],i,j&~32767); - putbuf4zip(slidebuf,j&~32767,j); - } - - //HACK: Don't unzip anything until you have to... - // (keeps file pointer as low as possible) - if (kzfs.endpos <= gslidew) goto retkzread; - } - - switch (kzfs.jmpplc) - { - case 0: goto kzreadplc0; - case 1: goto kzreadplc1; - case 2: goto kzreadplc2; - case 3: goto kzreadplc3; - } - kzreadplc0:; - do - { - bfinal = getbits(1); btype = getbits(2); - -#if 0 - //Display Huffman block offsets&lengths of input file - for debugging only! - { - static int32_t ouncomppos = 0, ocomppos = 0; - if (kzfs.comptell == sizeof(olinbuf)) i = 0; - else if (kzfs.comptell < kzfs.compleng) i = kzfs.comptell-(sizeof(olinbuf)-4); - else i = kzfs.comptell-(kzfs.comptell%(sizeof(olinbuf)-4)); - i += ((int32_t)&filptr[bitpos>>3])-((int32_t)(&olinbuf[0])); - i = (i<<3)+(bitpos&7)-3; - if (gslidew) printf(" ULng:0x%08x CLng:0x%08x.%x",gslidew-ouncomppos,(i-ocomppos)>>3,((i-ocomppos)&7)<<1); - printf("\ntype:%d, Uoff:0x%08x Coff:0x%08x.%x",btype,gslidew,i>>3,(i&7)<<1); - if (bfinal) - { - printf(" ULng:0x%08x CLng:0x%08x.%x",kzfs.leng-gslidew,((kzfs.compleng<<3)-i)>>3,(((kzfs.compleng<<3)-i)&7)<<1); - printf("\n Uoff:0x%08x Coff:0x%08x.0",kzfs.leng,kzfs.compleng); - ouncomppos = ocomppos = 0; - } - else { ouncomppos = gslidew; ocomppos = i; } - } -#endif - - if (btype == 0) - { - //Raw (uncompressed) - suckbits((-bitpos)&7); //Synchronize to start of next byte - i = getbits(16); if ((getbits(16)^i) != 0xffff) return(-1); - for (; i; i--) - { - if (gslidew >= gslider) - { - putbuf4zip(&slidebuf[(gslider-16384)&32767],gslider-16384,gslider); gslider += 16384; - if (gslider-16384 >= kzfs.endpos) - { - kzfs.jmpplc = 1; kzfs.i = i; kzfs.bfinal = bfinal; - goto retkzread; - kzreadplc1:; i = kzfs.i; bfinal = kzfs.bfinal; - } - } - slidebuf[(gslidew++)&32767] = (uint8_t)getbits(8); - } - continue; - } - if (btype == 3) continue; - - if (btype == 1) //Fixed Huffman - { - hlit = 288; hdist = 32; i = 0; - for (; i<144; i++) clen[i] = 8; //Fixed bit sizes (literals) - for (; i<256; i++) clen[i] = 9; //Fixed bit sizes (literals) - for (; i<280; i++) clen[i] = 7; //Fixed bit sizes (EOI,lengths) - for (; i<288; i++) clen[i] = 8; //Fixed bit sizes (lengths) - for (; i<320; i++) clen[i] = 5; //Fixed bit sizes (distances) - } - else //Dynamic Huffman - { - hlit = getbits(5)+257; hdist = getbits(5)+1; j = getbits(4)+4; - for (i=0; i= gslider) - { - putbuf4zip(&slidebuf[(gslider-16384)&32767],gslider-16384,gslider); gslider += 16384; - if (gslider-16384 >= kzfs.endpos) - { - kzfs.jmpplc = 2; kzfs.bfinal = bfinal; goto retkzread; - kzreadplc2:; bfinal = kzfs.bfinal; - } - } - - k = peekbits(LOGQHUFSIZ0); - if (qhufbit0[k]) { i = qhufval0[k]; suckbits((int32_t)qhufbit0[k]); } - else i = hufgetsym(ibuf0,nbuf0); - - if (i < 256) { slidebuf[(gslidew++)&32767] = (uint8_t)i; continue; } - if (i == 256) break; - i = getbits(hxbit[i+30-257][0]) + hxbit[i+30-257][1]; - - k = peekbits(LOGQHUFSIZ1); - if (qhufbit1[k]) { j = qhufval1[k]; suckbits((int32_t)qhufbit1[k]); } - else j = hufgetsym(ibuf1,nbuf1); - - j = getbits(hxbit[j][0]) + hxbit[j][1]; - for (; i; i--,gslidew++) slidebuf[gslidew&32767] = slidebuf[(gslidew-j)&32767]; - } - } - while (!bfinal); - - gslider -= 16384; - if (!((gslider^gslidew)&32768)) - putbuf4zip(&slidebuf[gslider&32767],gslider,gslidew); - else - { - putbuf4zip(&slidebuf[gslider&32767],gslider,gslidew&~32767); - putbuf4zip(slidebuf,gslidew&~32767,gslidew); - } - kzreadplc3:; kzfs.jmpplc = 3; - } - - retkzread:; - i = kzfs.pos; - kzfs.pos += leng; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng; - return(kzfs.pos-i); -} - -int32_t kzfilelength() -{ - if (!kzfs.fil) return(0); - return(kzfs.leng); -} - -//WARNING: kzseek(<-32768,SEEK_CUR); or: -// kzseek(0,SEEK_END); can make next kzread very slow!!! -int32_t kzseek(int32_t offset, int32_t whence) -{ - if (!kzfs.fil) return(-1); - switch (whence) - { - case SEEK_CUR: kzfs.pos += offset; break; - case SEEK_END: kzfs.pos = kzfs.leng+offset; break; -case SEEK_SET: default: kzfs.pos = offset; - } - if (kzfs.pos < 0) kzfs.pos = 0; - if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng; - return(kzfs.pos); -} - -int32_t kztell() -{ - if (!kzfs.fil) return(-1); - return(kzfs.pos); -} - -int32_t kzgetc() -{ - char ch; - if (!kzread(&ch,1)) return(-1); - return((int32_t)ch); -} - -int32_t kzeof() -{ - if (!kzfs.fil) return(-1); - return(kzfs.pos >= kzfs.leng); -} - -void kzclose() -{ - if (kzfs.fil) { fclose(kzfs.fil); kzfs.fil = 0; } -} - -//====================== ZIP decompression code ends ========================= -//===================== HANDY PICTURE function begins ======================== -#include "cache1d.h" - -void kpzload(const char *filnam, intptr_t *pic, int32_t *bpl, int32_t *xsiz, int32_t *ysiz) -{ - char *buf; - int32_t leng; - int32_t handle = kopen4load((char *)filnam, 0); - - (*pic) = 0; - if (handle < 0) return; - leng = kfilelength(handle); - buf = (char *)Bmalloc(leng); if (!buf) return; - kread(handle,buf,leng); - kclose(handle); - - kpgetdim(buf,leng,xsiz,ysiz); - (*bpl) = ((*xsiz)<<2); - (*pic) = (intptr_t)Bmalloc((*ysiz)*(*bpl)); if (!(*pic)) { Bfree(buf); return; } - if (kprender(buf,leng,*pic,*bpl,*xsiz,*ysiz,0,0) < 0) { Bfree(buf); Bfree((void *)*pic); (*pic) = 0; return; } - Bfree(buf); -} -//====================== HANDY PICTURE function ends ========================= diff --git a/polymer-perf/eduke32/build/src/lzwnew.c b/polymer-perf/eduke32/build/src/lzwnew.c deleted file mode 100644 index 89a9053e1..000000000 --- a/polymer-perf/eduke32/build/src/lzwnew.c +++ /dev/null @@ -1,122 +0,0 @@ -//-------------------------------------------------------------------------------------------------- -#include "compat.h" -#if defined(__POWERPC__) -static uint32_t LSWAPIB(uint32_t a) { return(((a>>8)&0xff00)+((a&0xff00)<<8)+(a<<24)+(a>>24)); } -static uint16_t SSWAPIB(uint16_t a) { return((a>>8)+(a<<8)); } -#else -#define LSWAPIB(a) (a) -#define SSWAPIB(a) (a) -#endif - -#define USENEW 1 -int32_t lzwcompress(char *ucompbuf, int32_t ucompleng, char *compbuf) -{ - int32_t i, j, numnodes, *lptr, bitcnt, nbits, oneupnbits, hmask, *child; - int32_t *sibly; -#if USENEW - int32_t *sibry; -#endif - char *nodev, *cptr, *eptr; - - nodev = (char *)Bmalloc((ucompleng+256)*sizeof(uint8_t)); if (!nodev) return(0); - child = (int32_t *)Bmalloc((ucompleng+256)*sizeof(int32_t)); if (!child) { Bfree(nodev); return(0); } - sibly = (int32_t *)Bmalloc((ucompleng+256)*sizeof(int32_t)); if (!sibly) { Bfree(child); Bfree(nodev); return(0); } -#if USENEW - sibry = (int32_t *)Bmalloc((ucompleng+256)*sizeof(int32_t)); if (!sibry) { Bfree(sibly); Bfree(child); Bfree(nodev); return(0); } -#endif - - for (i=255; i>=0; i--) { nodev[i] = i; child[i] = -1; } - memset(compbuf,0,ucompleng+15); - - cptr = ucompbuf; eptr = &ucompbuf[ucompleng]; - - numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1); - do - { - for (i=cptr[0]; i>=0; i=j) - { - cptr++; if (cptr >= eptr) goto lzwcompbreak2b; - j = child[i]; if (j < 0) { child[i] = numnodes; break; } -#if USENEW - //This is about 2x faster when ucompbuf is more random, 5% slower when very compressible - while (cptr[0] != nodev[j]) - { - if (cptr[0] < nodev[j]) - { if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; } j = sibly[j]; } - else { if (sibry[j] < 0) { sibry[j] = numnodes; goto lzwcompbreak2a; } j = sibry[j]; } - } -#else - for (; nodev[j]!=cptr[0]; j=sibly[j]) - if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; } -#endif - } -lzwcompbreak2a: - nodev[numnodes] = cptr[0]; -lzwcompbreak2b: - child[numnodes] = sibly[numnodes] = -1; -#if USENEW - sibry[numnodes] = -1; -#endif - - lptr = (int32_t *)&compbuf[bitcnt>>3]; lptr[0] |= LSWAPIB(i<<(bitcnt&7)); - bitcnt += nbits; if ((i&hmask) > ((numnodes-1)&hmask)) bitcnt--; - - numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); } - } - while ((cptr < eptr) && (bitcnt < (ucompleng<<3))); - -#if USENEW - Bfree(sibry); -#endif - Bfree(sibly); - Bfree(child); Bfree(nodev); - - lptr = (int32_t *)compbuf; - if (((bitcnt+7)>>3) < ucompleng) { lptr[0] = LSWAPIB(numnodes); return((bitcnt+7)>>3); } - Bmemcpy(compbuf,ucompbuf,ucompleng); return(ucompleng); -} - -int32_t lzwuncompress(char *compbuf, int32_t compleng, char *ucompbuf, int32_t ucompleng) -{ - int32_t i, dat, leng, bitcnt, *lptr, numnodes, totnodes, nbits, oneupnbits, hmask, *prefix; - char ch, *ucptr, *suffix; - int32_t ucomp = (int32_t)ucompbuf; - - if (compleng >= ucompleng) { Bmemcpy(ucompbuf,compbuf,ucompleng); return ucompleng; } - - totnodes = LSWAPIB(((int32_t *)compbuf)[0]); if (totnodes <= 0 || totnodes >= ucompleng+256) return 0; - - prefix = (int32_t *)Bmalloc(totnodes*sizeof(int32_t)); if (!prefix) return 0; - suffix = (char *)Bmalloc(totnodes*sizeof(uint8_t)); if (!suffix) { Bfree(prefix); return 0; } - - numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1); - do - { - lptr = (int32_t *)&compbuf[bitcnt>>3]; dat = ((LSWAPIB(lptr[0])>>(bitcnt&7))&(oneupnbits-1)); - bitcnt += nbits; if ((dat&hmask) > ((numnodes-1)&hmask)) { dat &= hmask; bitcnt--; } - - prefix[numnodes] = dat; - - ucompbuf++; - for (leng=0; dat>=256; dat=prefix[dat]) - { - if ((int32_t)ucompbuf+leng-ucomp > ucompleng) goto bail; - ucompbuf[leng++] = suffix[dat]; - } - - ucptr = &ucompbuf[leng-1]; - for (i=(leng>>1)-1; i>=0; i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; } - ucompbuf[-1] = dat; ucompbuf += leng; - - suffix[numnodes-1] = suffix[numnodes] = dat; - - numnodes++; if (numnodes > oneupnbits) { nbits++; oneupnbits <<= 1; hmask = ((oneupnbits>>1)-1); } - } - while (numnodes < totnodes); - -bail: - Bfree(suffix); Bfree(prefix); - - return (int32_t)ucompbuf-ucomp; -} -//-------------------------------------------------------------------------------------------------- diff --git a/polymer-perf/eduke32/build/src/md4.c b/polymer-perf/eduke32/build/src/md4.c deleted file mode 100644 index 8ef1920ed..000000000 --- a/polymer-perf/eduke32/build/src/md4.c +++ /dev/null @@ -1,275 +0,0 @@ -/* MD4C.C - RSA Data Security, Inc., MD4 message-digest algorithm - Modified from original version published in RFC1320 by - Jonathon Fowler (jonof@edgenetwork.org) - */ - -/* Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD4 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD4 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -typedef unsigned char *POINTER; -typedef unsigned short UINT2; -typedef unsigned int UINT4; - -#include "md4.h" -#include "compat.h" - -/* Constants for MD4Transform routine. - */ -#define S11 3 -#define S12 7 -#define S13 11 -#define S14 19 -#define S21 3 -#define S22 5 -#define S23 9 -#define S24 13 -#define S31 3 -#define S32 9 -#define S33 11 -#define S34 15 - -static void MD4Transform(UINT4 [4], unsigned char [64]); -static void Encode(unsigned char *, UINT4 *, unsigned int); -static void Decode(UINT4 *, unsigned char *, unsigned int); -#define MD4_memcpy Bmemcpy -#define MD4_memset memset - -static unsigned char PADDING[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* F, G and H are basic MD4 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ -/* Rotation is separate from addition to prevent recomputation */ -#define FF(a, b, c, d, x, s) { \ - (a) += F ((b), (c), (d)) + (x); \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define GG(a, b, c, d, x, s) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } -#define HH(a, b, c, d, x, s) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \ - (a) = ROTATE_LEFT ((a), (s)); \ - } - -void md4once(unsigned char *block, unsigned int len, unsigned char digest[16]) -{ - MD4_CTX ctx; - - md4init(&ctx); - md4block(&ctx, block, len); - md4finish(digest, &ctx); -} - -/* MD4 initialization. Begins an MD4 operation, writing a new context. - */ -void md4init(MD4_CTX *context) -{ - context->count[0] = context->count[1] = 0; - - /* Load magic initialization constants. - */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/* MD4 block update operation. Continues an MD4 message-digest - operation, processing another message block, and updating the - context. - */ -void md4block(MD4_CTX *context, unsigned char *input, unsigned int inputLen) -{ - unsigned int i, index, partLen; - - /* Compute number of bytes mod 64 */ - index = (unsigned int)((context->count[0] >> 3) & 0x3F); - /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) - < ((UINT4)inputLen << 3)) - context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); - - partLen = 64 - index; - - /* Transform as many times as possible. - */ - if (inputLen >= partLen) - { - MD4_memcpy - ((POINTER)&context->buffer[index], (POINTER)input, partLen); - MD4Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD4Transform(context->state, &input[i]); - - index = 0; - } - else - i = 0; - - /* Buffer remaining input */ - MD4_memcpy - ((POINTER)&context->buffer[index], (POINTER)&input[i], - inputLen-i); -} - -/* MD4 finalization. Ends an MD4 message-digest operation, writing the - the message digest and zeroizing the context. - */ -void md4finish(unsigned char digest[16], MD4_CTX *context) -{ - unsigned char bits[8]; - unsigned int index, padLen; - - /* Save number of bits */ - Encode(bits, context->count, 8); - - /* Pad out to 56 mod 64. - */ - index = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - md4block(context, PADDING, padLen); - - /* Append length (before padding) */ - md4block(context, bits, 8); - /* Store state in digest */ - Encode(digest, context->state, 16); - - /* Zeroize sensitive information. - */ - MD4_memset((POINTER)context, 0, sizeof(*context)); -} - -/* MD4 basic transformation. Transforms state based on block. - */ -static void MD4Transform(UINT4 state[4], unsigned char block[64]) -{ - UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode(x, block, 64); - - /* Round 1 */ - FF(a, b, c, d, x[ 0], S11); /* 1 */ - FF(d, a, b, c, x[ 1], S12); /* 2 */ - FF(c, d, a, b, x[ 2], S13); /* 3 */ - FF(b, c, d, a, x[ 3], S14); /* 4 */ - FF(a, b, c, d, x[ 4], S11); /* 5 */ - FF(d, a, b, c, x[ 5], S12); /* 6 */ - FF(c, d, a, b, x[ 6], S13); /* 7 */ - FF(b, c, d, a, x[ 7], S14); /* 8 */ - FF(a, b, c, d, x[ 8], S11); /* 9 */ - FF(d, a, b, c, x[ 9], S12); /* 10 */ - FF(c, d, a, b, x[10], S13); /* 11 */ - FF(b, c, d, a, x[11], S14); /* 12 */ - FF(a, b, c, d, x[12], S11); /* 13 */ - FF(d, a, b, c, x[13], S12); /* 14 */ - FF(c, d, a, b, x[14], S13); /* 15 */ - FF(b, c, d, a, x[15], S14); /* 16 */ - - /* Round 2 */ - GG(a, b, c, d, x[ 0], S21); /* 17 */ - GG(d, a, b, c, x[ 4], S22); /* 18 */ - GG(c, d, a, b, x[ 8], S23); /* 19 */ - GG(b, c, d, a, x[12], S24); /* 20 */ - GG(a, b, c, d, x[ 1], S21); /* 21 */ - GG(d, a, b, c, x[ 5], S22); /* 22 */ - GG(c, d, a, b, x[ 9], S23); /* 23 */ - GG(b, c, d, a, x[13], S24); /* 24 */ - GG(a, b, c, d, x[ 2], S21); /* 25 */ - GG(d, a, b, c, x[ 6], S22); /* 26 */ - GG(c, d, a, b, x[10], S23); /* 27 */ - GG(b, c, d, a, x[14], S24); /* 28 */ - GG(a, b, c, d, x[ 3], S21); /* 29 */ - GG(d, a, b, c, x[ 7], S22); /* 30 */ - GG(c, d, a, b, x[11], S23); /* 31 */ - GG(b, c, d, a, x[15], S24); /* 32 */ - - /* Round 3 */ - HH(a, b, c, d, x[ 0], S31); /* 33 */ - HH(d, a, b, c, x[ 8], S32); /* 34 */ - HH(c, d, a, b, x[ 4], S33); /* 35 */ - HH(b, c, d, a, x[12], S34); /* 36 */ - HH(a, b, c, d, x[ 2], S31); /* 37 */ - HH(d, a, b, c, x[10], S32); /* 38 */ - HH(c, d, a, b, x[ 6], S33); /* 39 */ - HH(b, c, d, a, x[14], S34); /* 40 */ - HH(a, b, c, d, x[ 1], S31); /* 41 */ - HH(d, a, b, c, x[ 9], S32); /* 42 */ - HH(c, d, a, b, x[ 5], S33); /* 43 */ - HH(b, c, d, a, x[13], S34); /* 44 */ - HH(a, b, c, d, x[ 3], S31); /* 45 */ - HH(d, a, b, c, x[11], S32); /* 46 */ - HH(c, d, a, b, x[ 7], S33); /* 47 */ - HH(b, c, d, a, x[15], S34); /* 48 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. - */ - MD4_memset((POINTER)x, 0, sizeof(x)); -} - -/* Encodes input (UINT4) into output (unsigned char). Assumes len is - a multiple of 4. - */ -static void Encode(unsigned char *output, UINT4 *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } -} - -/* Decodes input (unsigned char) into output (UINT4). Assumes len is - a multiple of 4. - */ -static void Decode(UINT4 *output, unsigned char *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | - (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); -} diff --git a/polymer-perf/eduke32/build/src/mdsprite.c b/polymer-perf/eduke32/build/src/mdsprite.c deleted file mode 100644 index d5835cb43..000000000 --- a/polymer-perf/eduke32/build/src/mdsprite.c +++ /dev/null @@ -1,3319 +0,0 @@ -//------------------------------------- MD2/MD3 LIBRARY BEGINS ------------------------------------- - -#ifdef USE_OPENGL - -#include "compat.h" -#include "build.h" -#include "glbuild.h" -#include "pragmas.h" -#include "baselayer.h" -#include "engine_priv.h" -#include "hightile.h" -#include "polymost.h" -#include "mdsprite.h" -#include "cache1d.h" -#include "kplib.h" -#include "md4.h" - -#include - -voxmodel_t *voxmodels[MAXVOXELS]; -int32_t curextra=MAXTILES; -// nedpool *model_data_pool; -// #define MODEL_POOL_SIZE 20971520 -#define model_data_pool (nedpool *) 0 // take it out of the system pool - -#define MIN_CACHETIME_PRINT 5 - -static void QuitOnFatalError(const char *msg) -{ - if (msg) - initprintf("%s\n", msg); - uninitengine(); - exit(1); -} - - -int32_t addtileP(int32_t model,int32_t tile,int32_t pallet) -{ - UNREFERENCED_PARAMETER(model); - if (curextra==MAXTILES+EXTRATILES-2)return curextra; - if (tile2model[tile].modelid==-1) {tile2model[tile].pal=pallet; return tile;} - if (tile2model[tile].pal==pallet)return tile; - while (tile2model[tile].next!=-1) - { - tile=tile2model[tile].next; - if (tile2model[tile].pal==pallet)return tile; - } - tile2model[tile].next=curextra; - tile2model[curextra].pal=pallet; - return curextra++; -} -int32_t Ptile2tile(int32_t tile,int32_t pallet) -{ - int32_t t=tile; -// if(tile>=1550&&tile<=1589){initprintf("(%d, %d)\n",tile,pallet);pallet=0;} - while ((tile=tile2model[tile].next)!=-1) - if (tile2model[tile].pal==pallet) - return tile; - return t; -} - -int32_t mdinited=0; -int32_t mdpause=0; - -#define MODELALLOCGROUP 256 -int32_t nummodelsalloced = 0, nextmodelid = 0; - -static int32_t maxmodelverts = 0, allocmodelverts = 0; -static int32_t maxmodeltris = 0, allocmodeltris = 0; -static point3d *vertlist = NULL; //temp array to store interpolated vertices for drawing - -static int32_t allocvbos = 0, curvbo = 0; -static GLuint *vertvbos = NULL; -static GLuint *indexvbos = NULL; - -mdmodel_t *mdload(const char *); -int32_t mddraw(spritetype *); -void mdfree(mdmodel_t *); -int32_t globalnoeffect=0; - -extern int32_t timerticspersec; - -void freevbos() -{ - int32_t i; - - for (i=0; imdnum == 3) - { - md3model_t *m = (md3model_t *)models[i]; - if (m->vbos) - { - // OSD_Printf("freeing model %d vbo\n",i); - bglDeleteBuffersARB(m->head.numsurfs, m->vbos); - Bfree(m->vbos); - m->vbos = NULL; - } - } - - if (allocvbos) - { - bglDeleteBuffersARB(allocvbos, indexvbos); - bglDeleteBuffersARB(allocvbos, vertvbos); - allocvbos = 0; - } -} - -void freeallmodels() -{ - int32_t i; - - if (models) - { - for (i=0; imdnum == 1) - { - voxmodel_t *v = (voxmodel_t *)m; - for (j=0; jtexid[j]) bglDeleteTextures(1,(GLuint *)&v->texid[j]); - v->texid[j] = 0; - } - } - else if (m->mdnum == 2 || m->mdnum == 3) - { - md2model_t *m2 = (md2model_t *)m; - mdskinmap_t *sk; - for (j=0; jnumskins*(HICEFFECTMASK+1); j++) - { - if (m2->texid[j]) bglDeleteTextures(1,(GLuint *)&m2->texid[j]); - m2->texid[j] = 0; - } - - for (sk=m2->skinmap; sk; sk=sk->next) - for (j=0; j<(HICEFFECTMASK+1); j++) - { - if (sk->texid[j]) bglDeleteTextures(1,(GLuint *)&sk->texid[j]); - sk->texid[j] = 0; - } - } - } - - for (i=0; itexid[j]) bglDeleteTextures(1,(GLuint *)&v->texid[j]); - v->texid[j] = 0; - } - } -} - -void mdinit() -{ - memset(hudmem,0,sizeof(hudmem)); - freeallmodels(); -// if (!model_data_pool) -// model_data_pool = nedcreatepool(MODEL_POOL_SIZE, 0); - mdinited = 1; -} - -int32_t md_loadmodel(const char *fn) -{ - mdmodel_t *vm, **ml; - - if (!mdinited) mdinit(); - - if (nextmodelid >= nummodelsalloced) - { - ml = (mdmodel_t **)Brealloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void *)); if (!ml) return(-1); - models = ml; nummodelsalloced += MODELALLOCGROUP; - } - - vm = mdload(fn); if (!vm) return(-1); - models[nextmodelid++] = vm; - return(nextmodelid-1); -} - -int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags) -{ - mdmodel_t *m; - - if (!mdinited) mdinit(); - - if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1; - m = models[modelid]; - m->bscale = scale; - m->shadeoff = shadeoff; - m->zadd = zadd; - m->flags = flags; - - return 0; -} - -/* -int32_t md_tilehasmodel(int32_t tilenume,int32_t pal) -{ - if (!mdinited) return -1; - return tile2model[Ptile2tile(tilenume,pal)].modelid; -} -*/ - -static int32_t framename2index(mdmodel_t *vm, const char *nam) -{ - int32_t i = 0; - - switch (vm->mdnum) - { - case 2: - { - md2model_t *m = (md2model_t *)vm; - md2frame_t *fr; - for (i=0; inumframes; i++) - { - fr = (md2frame_t *)&m->frames[i*m->framebytes]; - if (!Bstrcmp(fr->name, nam)) break; - } - } - break; - case 3: - { - md3model_t *m = (md3model_t *)vm; - for (i=0; inumframes; i++) - if (!Bstrcmp(m->head.frames[i].nam,nam)) break; - } - break; - } - return(i); -} - -int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal) -{ - md2model_t *m; - int32_t i; - - if (!mdinited) mdinit(); - - if ((uint32_t)modelid >= (uint32_t)nextmodelid) return(-1); - if ((uint32_t)tilenume >= (uint32_t)MAXTILES) return(-2); - if (!framename) return(-3); - - tilenume=addtileP(modelid,tilenume,pal); - m = (md2model_t *)models[modelid]; - if (m->mdnum == 1) - { - tile2model[tilenume].modelid = modelid; - tile2model[tilenume].framenum = tile2model[tilenume].skinnum = 0; - return 0; - } - - i = framename2index((mdmodel_t *)m,framename); - if (i == m->numframes) return(-3); // frame name invalid - - tile2model[tilenume].modelid = modelid; - tile2model[tilenume].framenum = i; - tile2model[tilenume].skinnum = skinnum; - tile2model[tilenume].smoothduration = smoothduration; - - return 0; -} - -int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fpssc, int32_t flags) -{ - md2model_t *m; - mdanim_t ma, *map; - int32_t i; - - if (!mdinited) mdinit(); - - if ((uint32_t)modelid >= (uint32_t)nextmodelid) return(-1); - - memset(&ma, 0, sizeof(ma)); - m = (md2model_t *)models[modelid]; - if (m->mdnum < 2) return 0; - - //find index of start frame - i = framename2index((mdmodel_t *)m,framestart); - if (i == m->numframes) return -2; - ma.startframe = i; - - //find index of finish frame which must trail start frame - i = framename2index((mdmodel_t *)m,frameend); - if (i == m->numframes) return -3; - ma.endframe = i; - - ma.fpssc = fpssc; - ma.flags = flags; - - map = (mdanim_t *)Bcalloc(1,sizeof(mdanim_t)); - if (!map) return(-4); - Bmemcpy(map, &ma, sizeof(ma)); - - map->next = m->animations; - m->animations = map; - - return(0); -} - -int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param, float specpower, float specfactor) -{ - mdskinmap_t *sk, *skl; - md2model_t *m; - - if (!mdinited) mdinit(); - - if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1; - if (!skinfn) return -2; - if ((unsigned)palnum >= (unsigned)MAXPALOOKUPS) return -3; - - m = (md2model_t *)models[modelid]; - if (m->mdnum < 2) return 0; - if (m->mdnum == 2) surfnum = 0; - - skl = NULL; - for (sk = m->skinmap; sk; skl = sk, sk = sk->next) - if (sk->palette == (uint8_t)palnum && skinnum == sk->skinnum && surfnum == sk->surfnum) break; - if (!sk) - { - sk = (mdskinmap_t *)Bcalloc(1,sizeof(mdskinmap_t)); - if (!sk) return -4; - - if (!skl) m->skinmap = sk; - else skl->next = sk; - } - else if (sk->fn) Bfree(sk->fn); - - sk->palette = (uint8_t)palnum; - sk->skinnum = skinnum; - sk->surfnum = surfnum; - sk->param = param; - sk->specpower = specpower; - sk->specfactor = specfactor; - sk->fn = (char *)Bmalloc(strlen(skinfn)+1); - if (!sk->fn) return(-4); - strcpy(sk->fn, skinfn); - - return 0; -} - -int32_t md_definehud(int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags, int32_t fov) -{ - if (!mdinited) mdinit(); - - if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1; - if ((uint32_t)tilex >= (uint32_t)MAXTILES) return -2; - - hudmem[(flags>>2)&1][tilex].xadd = xadd; - hudmem[(flags>>2)&1][tilex].yadd = yadd; - hudmem[(flags>>2)&1][tilex].zadd = zadd; - hudmem[(flags>>2)&1][tilex].angadd = ((int16_t)angadd)|2048; - hudmem[(flags>>2)&1][tilex].flags = (int16_t)flags; - hudmem[(flags>>2)&1][tilex].fov = (int16_t)fov; - - return 0; -} - -int32_t md_undefinetile(int32_t tile) -{ - if (!mdinited) return 0; - if ((unsigned)tile >= (unsigned)MAXTILES) return -1; - - tile2model[tile].modelid = -1; - tile2model[tile].next=-1; - return 0; -} - -int32_t md_undefinemodel(int32_t modelid) -{ - int32_t i; - if (!mdinited) return 0; - if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1; - - for (i=MAXTILES+EXTRATILES-1; i>=0; i--) - if (tile2model[i].modelid == modelid) - tile2model[i].modelid = -1; - - if (models) - { - mdfree(models[modelid]); - models[modelid] = NULL; - } - - return 0; -} - -md2model_t *modelhead; -mdskinmap_t *skhead; - -static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t *sizx, int32_t *sizy, int32_t *osizx, int32_t *osizy, char *hasalpha, int32_t pal, char effect) -{ - int32_t picfillen, j,y,x; - char *picfil,*cptr,al=255; - coltype *pic; - int32_t xsiz, ysiz, tsizx, tsizy; - int32_t r, g, b; - - picfillen = kfilelength(filh); - picfil = (char *)Bmalloc(picfillen+1); if (!picfil) { return -1; } - kread(filh, picfil, picfillen); - - // tsizx/y = replacement texture's natural size - // xsiz/y = 2^x size of replacement - - kpgetdim(picfil,picfillen,&tsizx,&tsizy); - if (tsizx == 0 || tsizy == 0) { Bfree(picfil); return -1; } - - if (!glinfo.texnpot) - { - for (xsiz=1; xsiz=0; j--) - { - swapchar(&pic[j].r, &pic[j].b); - } - } - - *sizx = xsiz; - *sizy = ysiz; - *bpl = xsiz; - *fptr = (intptr_t)pic; - *hasalpha = (al != 255); - - return 0; -} - -// JONOF'S COMPRESSED TEXTURE CACHE STUFF --------------------------------------------------- -int32_t mdloadskin_trytexcache(char *fn, int32_t len, int32_t pal, char effect, texcacheheader *head) -{ - int32_t fp, err=0; - char cachefn[BMAX_PATH], *cp; - uint8_t mdsum[16]; - - if (!glinfo.texcompr || !glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1; - if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB) - { - // lacking the necessary extensions to do this - OSD_Printf("Warning: the GL driver lacks necessary functions to use caching\n"); - glusetexcache = 0; - return -1; - } - - md4once((uint8_t *)fn, strlen(fn), mdsum); -// for (cp = cachefn, fp = 0; (*cp = TEXCACHEFILE[fp]); cp++,fp++); -// *(cp++) = '/'; - cp = cachefn; - for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); - Bsprintf(cp, "-%x-%x%x", len, pal, effect); - -// fil = kopen4load(cachefn, 0); -// if (fil < 0) return -1; - - { - int32_t offset = 0; - int32_t len = 0; - int32_t i; - /* - texcacheindex *cacheindexptr = &firstcacheindex; - - do - { - // initprintf("checking %s against %s\n",cachefn,cacheindexptr->name); - if (!Bstrcmp(cachefn,cacheindexptr->name)) - { - offset = cacheindexptr->offset; - len = cacheindexptr->len; - // initprintf("got a match for %s offset %d\n",cachefn,offset); - break; - } - cacheindexptr = cacheindexptr->next; - } - while (cacheindexptr->next); - */ - i = hash_find(&h_texcache,cachefn); - if (i != -1) - { - texcacheindex *cacheindexptr = cacheptrs[i]; - len = cacheindexptr->len; - offset = cacheindexptr->offset; - // initprintf("got a match for %s offset %d\n",cachefn,offset); - } - if (len == 0) return -1; // didn't find it - cachepos = offset; - } - -// initprintf("Loading cached skin: %s\n", cachefn); - - if (memcachedata && memcachesize >= (signed)(cachepos + sizeof(texcacheheader))) - { - // initprintf("using memcache!\n"); - Bmemcpy(head, memcachedata + cachepos, sizeof(texcacheheader)); - cachepos += sizeof(texcacheheader); - } - else - { - Blseek(cachefilehandle, cachepos, BSEEK_SET); - if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) - { - cachepos += sizeof(texcacheheader); - err = 1; - goto failure; - } - cachepos += sizeof(texcacheheader); - } - - if (memcmp(head->magic, TEXCACHEMAGIC, 4)) { err=2; goto failure; } - - head->xdim = B_LITTLE32(head->xdim); - head->ydim = B_LITTLE32(head->ydim); - head->flags = B_LITTLE32(head->flags); - head->quality = B_LITTLE32(head->quality); - - if (head->quality != r_downsize) { err=3; goto failure; } - if ((head->flags & 4) && glusetexcache != 2) { err=4; goto failure; } - if (!(head->flags & 4) && glusetexcache == 2) { err=5; goto failure; } - if (gltexmaxsize && (head->xdim > (1<ydim > (1<flags & 1)) { err=7; goto failure; } - - return cachefilehandle; -failure: -// kclose(fil); - initprintf("skin cache miss: %d\n", err); - return -1; -} - -static int32_t mdloadskin_cached(int32_t fil, texcacheheader *head, int32_t *doalloc, GLuint *glpic, int32_t *xsiz, int32_t *ysiz, int32_t pal) -{ - int32_t level, r; - texcachepicture pict; - void *pic = NULL, *packbuf = NULL; - void *midbuf = NULL; - int32_t alloclen=0; - - UNREFERENCED_PARAMETER(pal); - - if (*doalloc&1) - { - bglGenTextures(1,glpic); //# of textures (make OpenGL allocate structure) - *doalloc |= 2; // prevents bglGenTextures being called again if we fail in here - } - bglBindTexture(GL_TEXTURE_2D,*glpic); - - bglGetError(); - - // load the mipmaps - for (level = 0; level==0 || (pict.xdim > 1 || pict.ydim > 1); level++) - { - Blseek(fil, cachepos, BSEEK_SET); - r = Bread(fil, &pict, sizeof(texcachepicture)); - cachepos += sizeof(texcachepicture); - if (r < (int32_t)sizeof(texcachepicture)) goto failure; - - pict.size = B_LITTLE32(pict.size); - pict.format = B_LITTLE32(pict.format); - pict.xdim = B_LITTLE32(pict.xdim); - pict.ydim = B_LITTLE32(pict.ydim); - pict.border = B_LITTLE32(pict.border); - pict.depth = B_LITTLE32(pict.depth); - - if (level == 0) { *xsiz = pict.xdim; *ysiz = pict.ydim; } - - if (alloclen < pict.size) - { - void *picc = Brealloc(pic, pict.size); - if (!picc) goto failure; else pic = picc; - alloclen = pict.size; - - picc = Brealloc(packbuf, alloclen+16); - if (!picc) goto failure; else packbuf = picc; - - picc = Brealloc(midbuf, pict.size); - if (!picc) goto failure; else midbuf = picc; - } - - if (dedxtfilter(fil, &pict, pic, midbuf, packbuf, (head->flags&4)==4)) goto failure; - - bglCompressedTexImage2DARB(GL_TEXTURE_2D,level,pict.format,pict.xdim,pict.ydim,pict.border, - pict.size,pic); - if (bglGetError() != GL_NO_ERROR) goto failure; - } - - if (midbuf) Bfree(midbuf); - if (pic) Bfree(pic); - if (packbuf) Bfree(packbuf); - return 0; -failure: - if (midbuf) Bfree(midbuf); - if (pic) Bfree(pic); - if (packbuf) Bfree(packbuf); - return -1; -} -// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF - -//Note: even though it says md2model, it works for both md2model&md3model -int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) -{ - int32_t i,j, bpl, xsiz=0, ysiz=0, osizx, osizy, texfmt = GL_RGBA, intexfmt = GL_RGBA; - intptr_t fptr=0; - char *skinfile, hasalpha, fn[BMAX_PATH]; - GLuint *texidx = NULL; - mdskinmap_t *sk, *skzero = NULL; - int32_t doalloc = 1, filh; - int32_t cachefil = -1, picfillen; - texcacheheader cachead; - - int32_t startticks, willprint=0; - - modelhead=m; // for palmaps - - if (m->mdnum == 2) surf = 0; - - if ((unsigned)pal >= (unsigned)MAXPALOOKUPS) return 0; - i = -1; - for (sk = m->skinmap; sk; sk = sk->next) - { - if ((int32_t)sk->palette == pal && sk->skinnum == number && sk->surfnum == surf) - { - skinfile = sk->fn; - texidx = &sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]; - strncpy(fn,skinfile,BMAX_PATH); - //OSD_Printf("Using exact match skin (pal=%d,skinnum=%d,surfnum=%d) %s\n",pal,number,surf,skinfile); - break; - } - //If no match, give highest priority to number, then pal.. (Parkar's request, 02/27/2005) - else if (((int32_t)sk->palette == 0) && (sk->skinnum == number) && (sk->surfnum == surf) && (i < 5)) { i = 5; skzero = sk; } - else if (((int32_t)sk->palette == pal) && (sk->skinnum == 0) && (sk->surfnum == surf) && (i < 4)) { i = 4; skzero = sk; } - else if (((int32_t)sk->palette == 0) && (sk->skinnum == 0) && (sk->surfnum == surf) && (i < 3)) { i = 3; skzero = sk; } - else if (((int32_t)sk->palette == 0) && (sk->skinnum == number) && (i < 2)) { i = 2; skzero = sk; } - else if (((int32_t)sk->palette == pal) && (sk->skinnum == 0) && (i < 1)) { i = 1; skzero = sk; } - else if (((int32_t)sk->palette == 0) && (sk->skinnum == 0) && (i < 0)) { i = 0; skzero = sk; } - } - if (!sk) - { - if (pal >= (MAXPALOOKUPS - RESERVEDPALS)) - return (0); - if (skzero) - { - skinfile = skzero->fn; - texidx = &skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]; - strncpy(fn,skinfile,BMAX_PATH); - //OSD_Printf("Using def skin 0,0 as fallback, pal=%d\n", pal); - } - else - { - if ((unsigned)number >= (unsigned)m->numskins) number = 0; - skinfile = m->skinfn + number*64; - texidx = &m->texid[ number * (HICEFFECTMASK+1) + (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]; - strncpy(fn,m->basepath,BMAX_PATH); - if ((Bstrlen(fn) + Bstrlen(skinfile)) < BMAX_PATH) - strcat(fn,skinfile); - //OSD_Printf("Using MD2/MD3 skin (%d) %s, pal=%d\n",number,skinfile,pal); - } - } - skhead=sk; // for palmaps - if (!skinfile[0]) return 0; - - if (*texidx) return *texidx; - - // possibly fetch an already loaded multitexture :_) - if (pal >= (MAXPALOOKUPS - RESERVEDPALS)) - for (i=0; iskinmap; skzero; skzero = skzero->next) - if (!Bstrcasecmp(skzero->fn, sk->fn) && skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]) - { - sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)] = skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]; - return sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)]; - } - - *texidx = 0; - - if ((filh = kopen4load(fn, 0)) < 0) - { - OSD_Printf("Skin %s not found.\n",fn); - skinfile[0] = 0; - return 0; - } - - picfillen = kfilelength(filh); - kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c - - startticks = getticks(); - - cachefil = mdloadskin_trytexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK), &cachead); - if (cachefil >= 0 && !mdloadskin_cached(cachefil, &cachead, &doalloc, texidx, &xsiz, &ysiz, pal)) - { - osizx = cachead.xdim; - osizy = cachead.ydim; - hasalpha = (cachead.flags & 2) ? 1 : 0; - if (pal < (MAXPALOOKUPS - RESERVEDPALS))m->usesalpha = hasalpha; -// kclose(cachefil); - //kclose(filh); // FIXME: uncomment when cache1d.c is fixed - // cachefil >= 0, so it won't be rewritten - } - else - { - int32_t ret; - -// if (cachefil >= 0) kclose(cachefil); - cachefil = -1; // the compressed version will be saved to disk - - if ((filh = kopen4load(fn, 0)) < 0) return -1; - ret=daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)); - if (ret) - { - kclose(filh); - OSD_Printf("Failed loading skin file \"%s\": error %d\n", fn, ret); - if (ret==-1) - QuitOnFatalError("OUT OF MEMORY in daskinloader!"); - - skinfile[0] = 0; - return(0); - } - else kclose(filh); - - willprint = 1; - - if (pal < (MAXPALOOKUPS - RESERVEDPALS)) m->usesalpha = hasalpha; - if ((doalloc&3)==1) bglGenTextures(1,(GLuint *)texidx); - bglBindTexture(GL_TEXTURE_2D,*texidx); - - //gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,xsiz,ysiz,GL_BGRA_EXT,GL_UNSIGNED_BYTE,(char *)fptr); - if (glinfo.texcompr && glusetexcompr) intexfmt = hasalpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB; - else if (!hasalpha) intexfmt = GL_RGB; - if (glinfo.bgra) texfmt = GL_BGRA; - uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype *)fptr, xsiz, ysiz, 0|8192); - Bfree((void *)fptr); - } - - if (!m->skinloaded) - { - if (xsiz != osizx || ysiz != osizy) - { - float fx, fy; - fx = ((float)osizx)/((float)xsiz); - fy = ((float)osizy)/((float)ysiz); - if (m->mdnum == 2) - { - int32_t *lptr; - for (lptr=m->glcmds; (i=*lptr++);) - for (i=labs(i); i>0; i--,lptr+=3) - { - ((float *)lptr)[0] *= fx; - ((float *)lptr)[1] *= fy; - } - } - else if (m->mdnum == 3) - { - md3model_t *m3 = (md3model_t *)m; - md3surf_t *s; - int32_t surfi; - for (surfi=0; surfihead.numsurfs; surfi++) - { - s = &m3->head.surfs[surfi]; - for (i=s->numverts-1; i>=0; i--) - { - s->uv[i].u *= fx; - s->uv[i].v *= fy; - } - } - } - } - m->skinloaded = 1+number; - } - - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - if (glinfo.maxanisotropy > 1.0) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - - if (glinfo.texcompr && glusetexcompr && glusetexcache) - if (cachefil < 0) - { - // save off the compressed version - cachead.quality = r_downsize; - cachead.xdim = osizx>>cachead.quality; - cachead.ydim = osizy>>cachead.quality; - - i = 0; - for (j=0; j<31; j++) - { - if (xsiz == pow2long[j]) { i |= 1; } - if (ysiz == pow2long[j]) { i |= 2; } - } - cachead.flags = (i!=3) | (hasalpha ? 2 : 0); -/// OSD_Printf("Caching \"%s\"\n",fn); - writexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK), &cachead); - - if (willprint) - { - int32_t etime = getticks()-startticks; - if (etime>=MIN_CACHETIME_PRINT) - OSD_Printf("Load skin: p%d-e%d \"%s\"... cached... %d ms\n", pal, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK), fn, etime); - willprint = 0; - } - else - OSD_Printf("Cached skin \"%s\"\n", fn); - } - - if (willprint) - { - int32_t etime = getticks()-startticks; - if (etime>=MIN_CACHETIME_PRINT) - OSD_Printf("Load skin: p%d-e%d \"%s\"... %d ms\n", pal, (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK), fn, etime); - } - - return(*texidx); -} - -//Note: even though it says md2model, it works for both md2model&md3model -void updateanimation(md2model_t *m, spritetype *tspr) -{ - mdanim_t *anim; - int32_t i, j, k; - int32_t fps; - char lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal; - - if (m->numframes < 2) - { - m->interpol = 0; - return; - } - - m->cframe = m->nframe = tile2model[Ptile2tile(tspr->picnum,lpal)].framenum; - - for (anim = m->animations; - anim && anim->startframe != m->cframe; - anim = anim->next) ; - if (!anim) - { - if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,lpal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdoldframe != m->cframe)) - { - if (spritesmooth[tspr->owner].mdsmooth == 0) - { - spriteext[tspr->owner].mdanimtims = mdtims; - m->interpol = 0; - spritesmooth[tspr->owner].mdsmooth = 1; - spritesmooth[tspr->owner].mdcurframe = m->cframe; - } - if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,lpal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe)) - { - spriteext[tspr->owner].mdanimtims = mdtims; - m->interpol = 0; - spritesmooth[tspr->owner].mdsmooth = 1; - spritesmooth[tspr->owner].mdoldframe = spritesmooth[tspr->owner].mdcurframe; - spritesmooth[tspr->owner].mdcurframe = m->cframe; - } - } - else if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,lpal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe)) - { - spriteext[tspr->owner].mdanimtims = mdtims; - m->interpol = 0; - spritesmooth[tspr->owner].mdsmooth = 1; - spritesmooth[tspr->owner].mdoldframe = spritesmooth[tspr->owner].mdcurframe; - spritesmooth[tspr->owner].mdcurframe = m->cframe; - } - else - { - m->interpol = 0; - return; - } - } - - if (anim && (((int32_t)spriteext[tspr->owner].mdanimcur) != anim->startframe)) - { - //if (spriteext[tspr->owner].flags & SPREXT_NOMDANIM) OSD_Printf("SPREXT_NOMDANIM\n"); - //OSD_Printf("smooth launched ! oldanim %i new anim %i\n", spriteext[tspr->owner].mdanimcur, anim->startframe); - spriteext[tspr->owner].mdanimcur = (int16_t)anim->startframe; - spriteext[tspr->owner].mdanimtims = mdtims; - m->interpol = 0; - if (!r_animsmoothing || (tile2model[Ptile2tile(tspr->picnum,lpal)].smoothduration == 0)) - { - m->cframe = m->nframe = anim->startframe; - return; - } - m->nframe = anim->startframe; - m->cframe = spritesmooth[tspr->owner].mdoldframe; - spritesmooth[tspr->owner].mdsmooth = 1; - return; - } - - if (spritesmooth[tspr->owner].mdsmooth) - ftol((1.0f / (float)(tile2model[Ptile2tile(tspr->picnum,lpal)].smoothduration)) * 66.f, &fps); - else - fps = anim->fpssc; - - i = (mdtims-spriteext[tspr->owner].mdanimtims)*((fps*timerticspersec)/120); - - if (spritesmooth[tspr->owner].mdsmooth) - j = 65536; - else - j = ((anim->endframe+1-anim->startframe)<<16); - //Just in case you play the game for a VERY int32_t time... - if (i < 0) { i = 0; spriteext[tspr->owner].mdanimtims = mdtims; } - //compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT - if ((anim) && (i >= j+j) && (fps) && !mdpause) //Keep mdanimtims close to mdtims to avoid the use of MOD - spriteext[tspr->owner].mdanimtims += j/((fps*timerticspersec)/120); - - k = i; - - if (anim && (anim->flags&MDANIM_ONESHOT)) - { if (i > j-65536) i = j-65536; } - else { if (i >= j) { i -= j; if (i >= j) i %= j; } } - - if (r_animsmoothing && spritesmooth[tspr->owner].mdsmooth) - { - m->nframe = (anim) ? anim->startframe : spritesmooth[tspr->owner].mdcurframe; - m->cframe = spritesmooth[tspr->owner].mdoldframe; - //OSD_Printf("smoothing... cframe %i nframe %i\n", m->cframe, m->nframe); - if (k > 65535) - { - spriteext[tspr->owner].mdanimtims = mdtims; - m->interpol = 0; - spritesmooth[tspr->owner].mdsmooth = 0; - m->cframe = m->nframe = (anim) ? anim->startframe : spritesmooth[tspr->owner].mdcurframe; - spritesmooth[tspr->owner].mdoldframe = m->cframe; - //OSD_Printf("smooth stopped !\n"); - return; - } - } - else - { - m->cframe = (i>>16)+anim->startframe; - m->nframe = m->cframe+1; if (m->nframe > anim->endframe) m->nframe = anim->startframe; - spritesmooth[tspr->owner].mdoldframe = m->cframe; - //OSD_Printf("not smoothing... cframe %i nframe %i\n", m->cframe, m->nframe); - } - m->interpol = ((float)(i&65535))/65536.f; - //OSD_Printf("interpol %f\n", m->interpol); -} - -// VBO generation and allocation -static void mdloadvbos(md3model_t *m) -{ - int32_t i; - - m->vbos = Bmalloc(m->head.numsurfs * sizeof(GLuint)); - bglGenBuffersARB(m->head.numsurfs, m->vbos); - - i = 0; - while (i < m->head.numsurfs) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->vbos[i]); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, m->head.surfs[i].numverts * sizeof(md3uv_t), m->head.surfs[i].uv, GL_STATIC_DRAW_ARB); - i++; - } - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); -} - -//--------------------------------------- MD2 LIBRARY BEGINS --------------------------------------- -static md2model_t *md2load(int32_t fil, const char *filnam) -{ - md2model_t *m; - md3model_t *m3; - md3surf_t *s; - md2frame_t *f; - md2head_t head; - char st[BMAX_PATH]; - int32_t i, j, k; - - m = (md2model_t *)Bcalloc(1,sizeof(md2model_t)); if (!m) return(0); - m->mdnum = 2; m->scale = .01f; - - kread(fil,(char *)&head,sizeof(md2head_t)); - head.id = B_LITTLE32(head.id); head.vers = B_LITTLE32(head.vers); - head.skinxsiz = B_LITTLE32(head.skinxsiz); head.skinysiz = B_LITTLE32(head.skinysiz); - head.framebytes = B_LITTLE32(head.framebytes); head.numskins = B_LITTLE32(head.numskins); - head.numverts = B_LITTLE32(head.numverts); head.numuv = B_LITTLE32(head.numuv); - head.numtris = B_LITTLE32(head.numtris); head.numglcmds = B_LITTLE32(head.numglcmds); - head.numframes = B_LITTLE32(head.numframes); head.ofsskins = B_LITTLE32(head.ofsskins); - head.ofsuv = B_LITTLE32(head.ofsuv); head.ofstris = B_LITTLE32(head.ofstris); - head.ofsframes = B_LITTLE32(head.ofsframes); head.ofsglcmds = B_LITTLE32(head.ofsglcmds); - head.ofseof = B_LITTLE32(head.ofseof); - - if ((head.id != 0x32504449) || (head.vers != 8)) { Bfree(m); return(0); } //"IDP2" - - m->numskins = head.numskins; - m->numframes = head.numframes; - m->numverts = head.numverts; - m->numglcmds = head.numglcmds; - m->framebytes = head.framebytes; - - m->frames = (char *)Bmalloc(m->numframes*m->framebytes); if (!m->frames) { Bfree(m); return(0); } - m->glcmds = (int32_t *)Bmalloc(m->numglcmds*sizeof(int32_t)); if (!m->glcmds) { Bfree(m->frames); Bfree(m); return(0); } - m->tris = (md2tri_t *)Bmalloc(head.numtris*sizeof(md2tri_t)); if (!m->tris) { Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - m->uv = (md2uv_t *)Bmalloc(head.numuv*sizeof(md2uv_t)); if (!m->uv) { Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - - klseek(fil,head.ofsframes,SEEK_SET); - if (kread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes) - { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - - klseek(fil,head.ofsglcmds,SEEK_SET); - if (kread(fil,(char *)m->glcmds,m->numglcmds*sizeof(int32_t)) != (int32_t)(m->numglcmds*sizeof(int32_t))) - { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - - klseek(fil,head.ofstris,SEEK_SET); - if (kread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t))) - { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - - klseek(fil,head.ofsuv,SEEK_SET); - if (kread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t))) - { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - -#if B_BIG_ENDIAN != 0 - { - char *f = (char *)m->frames; - int32_t *l,j; - md2frame_t *fr; - - for (i = m->numframes-1; i>=0; i--) - { - fr = (md2frame_t *)f; - l = (int32_t *)&fr->mul; - for (j=5; j>=0; j--) l[j] = B_LITTLE32(l[j]); - f += m->framebytes; - } - - for (i = m->numglcmds-1; i>=0; i--) - { - m->glcmds[i] = B_LITTLE32(m->glcmds[i]); - } - for (i = head.numtris-1; i>=0; i--) - { - m->tris[i].v[0] = B_LITTLE16(m->tris[i].v[0]); - m->tris[i].v[1] = B_LITTLE16(m->tris[i].v[1]); - m->tris[i].v[2] = B_LITTLE16(m->tris[i].v[2]); - m->tris[i].u[0] = B_LITTLE16(m->tris[i].u[0]); - m->tris[i].u[1] = B_LITTLE16(m->tris[i].u[1]); - m->tris[i].u[2] = B_LITTLE16(m->tris[i].u[2]); - } - for (i = head.numuv-1; i>=0; i--) - { - m->uv[i].u = B_LITTLE16(m->uv[i].u); - m->uv[i].v = B_LITTLE16(m->uv[i].v); - } - } -#endif - - strcpy(st,filnam); - for (i=strlen(st)-1; i>0; i--) - if ((st[i] == '/') || (st[i] == '\\')) { i++; break; } - if (i<0) i=0; - st[i] = 0; - m->basepath = (char *)Bmalloc(i+1); if (!m->basepath) { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - strcpy(m->basepath, st); - - m->skinfn = (char *)Bmalloc(m->numskins*64); if (!m->skinfn) { Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - klseek(fil,head.ofsskins,SEEK_SET); - if (kread(fil,m->skinfn,64*m->numskins) != 64*m->numskins) - { Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - - m->texid = (GLuint *)Bcalloc(m->numskins, sizeof(GLuint) * (HICEFFECTMASK+1)); - if (!m->texid) { Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - - maxmodelverts = max(maxmodelverts, m->numverts); - maxmodeltris = max(maxmodeltris, head.numtris); - - //return(m); - - // the MD2 is now loaded internally - let's begin the MD3 conversion process - //OSD_Printf("Beginning md3 conversion.\n"); - m3 = (md3model_t *)Bcalloc(1, sizeof(md3model_t)); if (!m3) { Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - m3->mdnum = 3; m3->texid = 0; m3->scale = m->scale; - m3->head.id = 0x33504449; m3->head.vers = 15; - // this changes the conversion code to do real MD2->MD3 conversion - // it breaks HRP MD2 oozfilter, change the flags to 1337 to revert - // to the old, working code - m3->head.flags = 0; - m3->head.numframes = m->numframes; - m3->head.numtags = 0; m3->head.numsurfs = 1; - m3->head.numskins = 0; - - m3->numskins = m3->head.numskins; - m3->numframes = m3->head.numframes; - - m3->head.frames = (md3frame_t *)Bcalloc(m3->head.numframes, sizeof(md3frame_t)); if (!m3->head.frames) { Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - m3->muladdframes = (point3d *)Bcalloc(m->numframes * 2, sizeof(point3d)); - - f = (md2frame_t *)(m->frames); - - // frames converting - i = 0; - while (i < m->numframes) - { - f = (md2frame_t *)&m->frames[i*m->framebytes]; - strcpy(m3->head.frames[i].nam, f->name); - //OSD_Printf("Copied frame %s.\n", m3->head.frames[i].nam); - m3->muladdframes[i*2] = f->mul; - m3->muladdframes[i*2+1] = f->add; - i++; - } - - m3->head.tags = NULL; - - m3->head.surfs = (md3surf_t *)Bcalloc(1, sizeof(md3surf_t)); if (!m3->head.surfs) { Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - s = m3->head.surfs; - - // model converting - s->id = 0x33504449; s->flags = 0; - s->numframes = m->numframes; s->numshaders = 0; - s->numtris = head.numtris; - s->numverts = head.numtris * 3; // oh man talk about memory effectiveness :(((( - // MD2 is actually more accurate than MD3 in term of uv-mapping, because each triangle has a triangle counterpart on the UV-map. - // In MD3, each vertex unique UV coordinates, meaning that you have to duplicate vertices if you need non-seamless UV-mapping. - - maxmodelverts = max(maxmodelverts, s->numverts); - - strcpy(s->nam, "Dummy surface from MD2"); - - s->shaders = NULL; - - s->tris = (md3tri_t *)Bcalloc(head.numtris, sizeof(md3tri_t)); if (!s->tris) { Bfree(s); Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - s->uv = (md3uv_t *)Bcalloc(s->numverts, sizeof(md3uv_t)); if (!s->uv) { Bfree(s->tris); Bfree(s); Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - s->xyzn = (md3xyzn_t *)Bcalloc(s->numverts * m->numframes, sizeof(md3xyzn_t)); if (!s->xyzn) { Bfree(s->uv); Bfree(s->tris); Bfree(s); Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - - //memoryusage += (s->numverts * m->numframes * sizeof(md3xyzn_t)); - //OSD_Printf("Current model geometry memory usage : %i.\n", memoryusage); - - //OSD_Printf("Number of frames : %i\n", m->numframes); - //OSD_Printf("Number of triangles : %i\n", head.numtris); - //OSD_Printf("Number of vertices : %i\n", s->numverts); - - // triangle converting - i = 0; - while (i < head.numtris) - { - j = 0; - //OSD_Printf("Triangle : %i\n", i); - while (j < 3) - { - // triangle vertex indexes - s->tris[i].i[j] = i*3 + j; - - // uv coords - s->uv[i*3+j].u = (float)(m->uv[m->tris[i].u[j]].u) / (float)(head.skinxsiz); - s->uv[i*3+j].v = (float)(m->uv[m->tris[i].u[j]].v) / (float)(head.skinysiz); - - // vertices for each frame - k = 0; - while (k < m->numframes) - { - f = (md2frame_t *)&m->frames[k*m->framebytes]; - if (m3->head.flags == 1337) - { - s->xyzn[(k*s->numverts) + (i*3) + j].x = f->verts[m->tris[i].v[j]].v[0]; - s->xyzn[(k*s->numverts) + (i*3) + j].y = f->verts[m->tris[i].v[j]].v[1]; - s->xyzn[(k*s->numverts) + (i*3) + j].z = f->verts[m->tris[i].v[j]].v[2]; - } - else - { - s->xyzn[(k*s->numverts) + (i*3) + j].x = (int16_t)(((f->verts[m->tris[i].v[j]].v[0] * f->mul.x) + f->add.x) * 64.f); - s->xyzn[(k*s->numverts) + (i*3) + j].y = (int16_t)(((f->verts[m->tris[i].v[j]].v[1] * f->mul.y) + f->add.y) * 64.f); - s->xyzn[(k*s->numverts) + (i*3) + j].z = (int16_t)(((f->verts[m->tris[i].v[j]].v[2] * f->mul.z) + f->add.z) * 64.f); - } - - k++; - } - j++; - } - //OSD_Printf("End triangle.\n"); - i++; - } - //OSD_Printf("Finished md3 conversion.\n"); - - { - mdskinmap_t *sk; - - sk = (mdskinmap_t *)Bcalloc(1,sizeof(mdskinmap_t)); - sk->palette = 0; - sk->skinnum = 0; - sk->surfnum = 0; - - if (m->numskins > 0) - { - sk->fn = (char *)Bmalloc(strlen(m->basepath)+strlen(m->skinfn)+1); - strcpy(sk->fn, m->basepath); - strcat(sk->fn, m->skinfn); - } - m3->skinmap = sk; - } - - m3->indexes = Bmalloc(sizeof(uint16_t) * s->numtris); - m3->vindexes = Bmalloc(sizeof(uint16_t) * s->numtris * 3); - m3->maxdepths = Bmalloc(sizeof(float) * s->numtris); - - if (!m3->indexes || !m3->vindexes || !m3->maxdepths) - QuitOnFatalError("OUT OF MEMORY in md2load!"); - - m3->vbos = NULL; - - // die MD2 ! DIE ! - Bfree(m->texid); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); - - return((md2model_t *)m3); -} -//---------------------------------------- MD2 LIBRARY ENDS ---------------------------------------- - -// DICHOTOMIC RECURSIVE SORTING - USED BY MD3DRAW - MAY PUT IT IN ITS OWN SOURCE FILE LATER -int32_t partition(uint16_t *indexes, float *depths, int32_t f, int32_t l) -{ - int32_t up,down; - float tempf; - uint16_t tempus; - float piv = depths[f]; - uint16_t piv2 = indexes[f]; - up = f; - down = l; - do - { - while ((depths[up] <= piv) && (up < l)) - up++; - while ((depths[down] > piv) && (down > f)) - down--; - if (up < down) - { - tempf = depths[up]; - depths[up] = depths[down]; - depths[down] = tempf; - tempus = indexes[up]; - indexes[up] = indexes[down]; - indexes[down] = tempus; - } - } - while (down > up); - depths[f] = depths[down]; - depths[down] = piv; - indexes[f] = indexes[down]; - indexes[down] = piv2; - return down; -} - -void quicksort(uint16_t *indexes, float *depths, int32_t first, int32_t last) -{ - int32_t pivIndex = 0; - if (first < last) - { - pivIndex = partition(indexes,depths,first, last); - quicksort(indexes,depths,first,(pivIndex-1)); - quicksort(indexes,depths,(pivIndex+1),last); - } -} -// END OF QUICKSORT LIB - -//--------------------------------------- MD3 LIBRARY BEGINS --------------------------------------- - -static md3model_t *md3load(int32_t fil) -{ - int32_t i, surfi, ofsurf, offs[4], leng[4]; - int32_t maxtrispersurf; - md3model_t *m; - md3surf_t *s; - - m = (md3model_t *)Bcalloc(1,sizeof(md3model_t)); if (!m) return(0); - m->mdnum = 3; m->texid = 0; m->scale = .01f; - - m->muladdframes = NULL; - - kread(fil,&m->head,SIZEOF_MD3HEAD_T); - m->head.id = B_LITTLE32(m->head.id); m->head.vers = B_LITTLE32(m->head.vers); - m->head.flags = B_LITTLE32(m->head.flags); m->head.numframes = B_LITTLE32(m->head.numframes); - m->head.numtags = B_LITTLE32(m->head.numtags); m->head.numsurfs = B_LITTLE32(m->head.numsurfs); - m->head.numskins = B_LITTLE32(m->head.numskins); m->head.ofsframes = B_LITTLE32(m->head.ofsframes); - m->head.ofstags = B_LITTLE32(m->head.ofstags); m->head.ofssurfs = B_LITTLE32(m->head.ofssurfs); - m->head.eof = B_LITTLE32(m->head.eof); - - if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { Bfree(m); return(0); } //"IDP3" - - m->numskins = m->head.numskins; //<- dead code? - m->numframes = m->head.numframes; - - ofsurf = m->head.ofssurfs; - - klseek(fil,m->head.ofsframes,SEEK_SET); i = m->head.numframes*sizeof(md3frame_t); - m->head.frames = (md3frame_t *)Bmalloc(i); if (!m->head.frames) { Bfree(m); return(0); } - kread(fil,m->head.frames,i); - - if (m->head.numtags == 0) m->head.tags = NULL; - else - { - klseek(fil,m->head.ofstags,SEEK_SET); i = m->head.numtags*sizeof(md3tag_t); - m->head.tags = (md3tag_t *)Bmalloc(i); if (!m->head.tags) { Bfree(m->head.frames); Bfree(m); return(0); } - kread(fil,m->head.tags,i); - } - - klseek(fil,m->head.ofssurfs,SEEK_SET); i = m->head.numsurfs*sizeof(md3surf_t); - m->head.surfs = (md3surf_t *)Bmalloc(i); if (!m->head.surfs) { if (m->head.tags) Bfree(m->head.tags); Bfree(m->head.frames); Bfree(m); return(0); } - m->head.surfs[0].geometry = NULL; // for deferred polymer model postprocessing (else: crashes) - -#if B_BIG_ENDIAN != 0 - { - int32_t *l; - - for (i = m->head.numframes-1; i>=0; i--) - { - l = (int32_t *)&m->head.frames[i].min; - for (j=3+3+3+1-1; j>=0; j--) l[j] = B_LITTLE32(l[j]); - } - - for (i = m->head.numtags-1; i>=0; i--) - { - l = (int32_t *)&m->head.tags[i].p; - for (j=3+3+3+3-1; j>=0; j--) l[j] = B_LITTLE32(l[j]); - } - } -#endif - - maxtrispersurf = 0; - - for (surfi=0; surfihead.numsurfs; surfi++) - { - s = &m->head.surfs[surfi]; - klseek(fil,ofsurf,SEEK_SET); kread(fil,s,SIZEOF_MD3SURF_T); - -#if B_BIG_ENDIAN != 0 - { - int32_t *l; - s->id = B_LITTLE32(s->id); - l = (int32_t *)&s->flags; - for (j=1+1+1+1+1+1+1+1+1+1-1; j>=0; j--) l[j] = B_LITTLE32(l[j]); - } -#endif - - offs[0] = ofsurf+s->ofstris; leng[0] = s->numtris*sizeof(md3tri_t); - offs[1] = ofsurf+s->ofsshaders; leng[1] = s->numshaders*sizeof(md3shader_t); - offs[2] = ofsurf+s->ofsuv; leng[2] = s->numverts*sizeof(md3uv_t); - offs[3] = ofsurf+s->ofsxyzn; leng[3] = s->numframes*s->numverts*sizeof(md3xyzn_t); - //memoryusage += (s->numverts * s->numframes * sizeof(md3xyzn_t)); - //OSD_Printf("Current model geometry memory usage : %i.\n", memoryusage); - - - s->tris = (md3tri_t *)Bmalloc(leng[0]+leng[1]+leng[2]+leng[3]); - if (!s->tris) - { - for (surfi--; surfi>=0; surfi--) Bfree(m->head.surfs[surfi].tris); - if (m->head.tags) Bfree(m->head.tags); Bfree(m->head.frames); Bfree(m); return(0); - } - s->shaders = (md3shader_t *)(((intptr_t)s->tris)+leng[0]); - s->uv = (md3uv_t *)(((intptr_t)s->shaders)+leng[1]); - s->xyzn = (md3xyzn_t *)(((intptr_t)s->uv)+leng[2]); - - klseek(fil,offs[0],SEEK_SET); kread(fil,s->tris ,leng[0]); - klseek(fil,offs[1],SEEK_SET); kread(fil,s->shaders,leng[1]); - klseek(fil,offs[2],SEEK_SET); kread(fil,s->uv ,leng[2]); - klseek(fil,offs[3],SEEK_SET); kread(fil,s->xyzn ,leng[3]); - -#if B_BIG_ENDIAN != 0 - { - int32_t *l; - - for (i=s->numtris-1; i>=0; i--) - { - for (j=2; j>=0; j--) s->tris[i].i[j] = B_LITTLE32(s->tris[i].i[j]); - } - for (i=s->numshaders-1; i>=0; i--) - { - s->shaders[i].i = B_LITTLE32(s->shaders[i].i); - } - for (i=s->numverts-1; i>=0; i--) - { - l = (int32_t *)&s->uv[i].u; - l[0] = B_LITTLE32(l[0]); - l[1] = B_LITTLE32(l[1]); - } - for (i=s->numframes*s->numverts-1; i>=0; i--) - { - s->xyzn[i].x = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].x); - s->xyzn[i].y = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].y); - s->xyzn[i].z = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].z); - } - } -#endif - maxmodelverts = max(maxmodelverts, s->numverts); - maxmodeltris = max(maxmodeltris, s->numtris); - maxtrispersurf = max(maxtrispersurf, s->numtris); - ofsurf += s->ofsend; - } - -#if 0 - { - char *buf, st[BMAX_PATH+2], bst[BMAX_PATH+2]; - int32_t j, bsc; - - strcpy(st,filnam); - for (i=0,j=0; st[i]; i++) if ((st[i] == '/') || (st[i] == '\\')) j = i+1; - st[j] = '*'; st[j+1] = 0; - kzfindfilestart(st); bsc = -1; - while (kzfindfile(st)) - { - if (st[0] == '\\') continue; - - for (i=0,j=0; st[i]; i++) if (st[i] == '.') j = i+1; - if ((!stricmp(&st[j],"JPG")) || (!stricmp(&st[j],"PNG")) || (!stricmp(&st[j],"GIF")) || - (!stricmp(&st[j],"PCX")) || (!stricmp(&st[j],"TGA")) || (!stricmp(&st[j],"BMP")) || - (!stricmp(&st[j],"CEL"))) - { - for (i=0; st[i]; i++) if (st[i] != filnam[i]) break; - if (i > bsc) { bsc = i; strcpy(bst,st); } - } - } - if (!mdloadskin(&m->texid,&m->usesalpha,bst)) ;//bad! - } -#endif - - m->indexes = Bmalloc(sizeof(uint16_t) * maxtrispersurf); - m->vindexes = Bmalloc(sizeof(uint16_t) * maxtrispersurf * 3); - m->maxdepths = Bmalloc(sizeof(float) * maxtrispersurf); - - if (!m->indexes || !m->vindexes || !m->maxdepths) - QuitOnFatalError("OUT OF MEMORY in md3load!"); - - m->vbos = NULL; - - return(m); -} - -static inline void invertmatrix(float *m, float *out) -{ - float det; - - det = m[0] * (m[4]*m[8] - m[5] * m[7]); - det -= m[1] * (m[3]*m[8] - m[5] * m[6]); - det += m[2] * (m[3]*m[7] - m[4] * m[6]); - - det = 1.0f / det; - - out[0] = det * (m[4] * m[8] - m[5] * m[7]); - out[3] = det * (m[5] * m[6] - m[3] * m[8]); - out[6] = det * (m[3] * m[7] - m[1] * m[6]); - - out[1] = det * (m[2] * m[7] - m[1] * m[8]); - out[4] = det * (m[0] * m[8] - m[2] * m[6]); - out[7] = det * (m[1] * m[6] - m[0] * m[7]); - - out[2] = det * (m[1] * m[5] - m[2] * m[4]); - out[5] = det * (m[2] * m[3] - m[0] * m[5]); - out[8] = det * (m[0] * m[4] - m[1] * m[3]); -} - -static inline void normalize(float *vec) -{ - double norm; - - norm = vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]; - - norm = sqrt(norm); - norm = 1.0 / norm; - vec[0] *= norm; - vec[1] *= norm; - vec[2] *= norm; -} - -static void md3postload_common(md3model_t *m) -{ - int framei, surfi, verti; - md3frame_t *frame; - md3xyzn_t *frameverts; - float dist, vec1[5]; - - // apparently we can't trust loaded models bounding box/sphere information, - // so let's compute it ourselves - - framei = 0; - - while (framei < m->head.numframes) - { - frame = &m->head.frames[framei]; - - frame->min.x = 0.0f; - frame->min.y = 0.0f; - frame->min.z = 0.0f; - - frame->max.x = 0.0f; - frame->max.y = 0.0f; - frame->max.z = 0.0f; - - frame->r = 0.0f; - - surfi = 0; - while (surfi < m->head.numsurfs) - { - frameverts = &m->head.surfs[surfi].xyzn[framei * m->head.surfs[surfi].numverts]; - - verti = 0; - while (verti < m->head.surfs[surfi].numverts) - { - if (!verti && !surfi) - { - frame->min.x = frameverts[verti].x; - frame->min.y = frameverts[verti].y; - frame->min.z = frameverts[verti].z; - - frame->max.x = frameverts[verti].x; - frame->max.y = frameverts[verti].y; - frame->max.z = frameverts[verti].z; - } - else - { - if (frame->min.x > frameverts[verti].x) - frame->min.x = frameverts[verti].x; - if (frame->max.x < frameverts[verti].x) - frame->max.x = frameverts[verti].x; - - if (frame->min.y > frameverts[verti].y) - frame->min.y = frameverts[verti].y; - if (frame->max.y < frameverts[verti].y) - frame->max.y = frameverts[verti].y; - - if (frame->min.z > frameverts[verti].z) - frame->min.z = frameverts[verti].z; - if (frame->max.z < frameverts[verti].z) - frame->max.z = frameverts[verti].z; - } - - verti++; - } - surfi++; - } - - frame->cen.x = (frame->min.x + frame->max.x) / 2.0f; - frame->cen.y = (frame->min.y + frame->max.y) / 2.0f; - frame->cen.z = (frame->min.z + frame->max.z) / 2.0f; - - surfi = 0; - while (surfi < m->head.numsurfs) - { - frameverts = &m->head.surfs[surfi].xyzn[framei * m->head.surfs[surfi].numverts]; - - verti = 0; - while (verti < m->head.surfs[surfi].numverts) - { - vec1[0] = frameverts[verti].x - frame->cen.x; - vec1[1] = frameverts[verti].y - frame->cen.y; - vec1[2] = frameverts[verti].z - frame->cen.z; - - dist = vec1[0] * vec1[0] + vec1[1] * vec1[1] + vec1[2] * vec1[2]; - - if (dist > frame->r) - frame->r = dist; - - verti++; - } - surfi++; - } - - frame->r = sqrt(frame->r); - - framei++; - } -} - -#ifdef POLYMER -// pre-check success of conversion since it must not fail later. -// keep in sync with md3postload_polymer! -static int md3postload_polymer_check(md3model_t *m) -{ - int surfi, trii; - md3surf_t *s; - - surfi = 0; - while (surfi < m->head.numsurfs) - { - s = &m->head.surfs[surfi]; - - trii = 0; - while (trii < s->numtris) - { - // let the vertices know they're being referenced by a triangle - if (s->tris[trii].i[0] >= s->numverts || s->tris[trii].i[0] < 0 || - s->tris[trii].i[1] >= s->numverts || s->tris[trii].i[1] < 0 || - s->tris[trii].i[2] >= s->numverts || s->tris[trii].i[2] < 0) - { - // corrupt model - OSD_Printf("Triangle index out of bounds!\n"); - return 0; - } - - trii++; - } - - surfi++; - } - - return 1; -} -#endif - -int md3postload_polymer(md3model_t *m) -{ -#ifdef POLYMER - int framei, surfi, verti, trii, i; - md3surf_t *s; - int *numtris; - float lat, lng, vec1[5], vec2[5], mat[9], r; - - // let's also repack the geometry to more usable formats - - surfi = 0; - while (surfi < m->head.numsurfs) - { - s = &m->head.surfs[surfi]; - - s->geometry = Bcalloc(m->head.numframes * s->numverts * sizeof(float), 15); - - numtris = Bcalloc(s->numverts, sizeof(int)); - - if (!s->geometry || !numtris) - QuitOnFatalError("OUT OF MEMORY in md3postload_polymer!"); - - verti = 0; - while (verti < (m->head.numframes * s->numverts)) - { - s->geometry[(verti * 15) + 0] = s->xyzn[verti].x; - s->geometry[(verti * 15) + 1] = s->xyzn[verti].y; - s->geometry[(verti * 15) + 2] = s->xyzn[verti].z; - - // normal extraction from packed spherical coordinates - // FIXME: swapping lat and lng because of npherno's compiler - lat = s->xyzn[verti].nlng * (2 * PI) / 255.0f; - lng = s->xyzn[verti].nlat * (2 * PI) / 255.0f; - - s->geometry[(verti * 15) + 3] = cos(lat) * sin(lng); - s->geometry[(verti * 15) + 4] = sin(lat) * sin(lng); - s->geometry[(verti * 15) + 5] = cos(lng); - - verti++; - } - - trii = 0; - while (trii < s->numtris) - { - // let the vertices know they're being referenced by a triangle - if (s->tris[trii].i[0] >= s->numverts || s->tris[trii].i[0] < 0 || - s->tris[trii].i[1] >= s->numverts || s->tris[trii].i[1] < 0 || - s->tris[trii].i[2] >= s->numverts || s->tris[trii].i[2] < 0) - { - // corrupt model - Bfree(numtris); - OSD_Printf("Triangle index out of bounds!\n"); - return 0; - } - numtris[s->tris[trii].i[0]]++; - numtris[s->tris[trii].i[1]]++; - numtris[s->tris[trii].i[2]]++; - - framei = 0; - while (framei < m->head.numframes) - { - vec1[0] = s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[1] * 15) + 0] - - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[0] * 15) + 0]; - vec1[1] = s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[1] * 15) + 1] - - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[0] * 15) + 1]; - vec1[2] = s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[1] * 15) + 2] - - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[0] * 15) + 2]; - vec1[3] = s->uv[s->tris[trii].i[1]].u - s->uv[s->tris[trii].i[0]].u; - vec1[4] = s->uv[s->tris[trii].i[1]].v - s->uv[s->tris[trii].i[0]].v; - - vec2[0] = s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[2] * 15) + 0] - - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[1] * 15) + 0]; - vec2[1] = s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[2] * 15) + 1] - - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[1] * 15) + 1]; - vec2[2] = s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[2] * 15) + 2] - - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[1] * 15) + 2]; - vec2[3] = s->uv[s->tris[trii].i[2]].u - s->uv[s->tris[trii].i[1]].u; - vec2[4] = s->uv[s->tris[trii].i[2]].v - s->uv[s->tris[trii].i[1]].v; - - r = 1.0 / (vec1[3] * vec2[4] - vec2[3] * vec1[4]); - - // tangent - mat[0] = (vec2[4] * vec1[0] - vec1[4] * vec2[0]) * r; - mat[1] = (vec2[4] * vec1[1] - vec1[4] * vec2[1]) * r; - mat[2] = (vec2[4] * vec1[2] - vec1[4] * vec2[2]) * r; - - normalize(&mat[0]); - - // bitangent - mat[3] = (vec1[3] * vec2[0] - vec2[3] * vec1[0]) * r; - mat[4] = (vec1[3] * vec2[1] - vec2[3] * vec1[1]) * r; - mat[5] = (vec1[3] * vec2[2] - vec2[3] * vec1[2]) * r; - - normalize(&mat[3]); - - // T and B are shared for the three vertices in that triangle - i = 0; - while (i < 6) - { - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[0] * 15) + 6 + i] += mat[i]; - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[1] * 15) + 6 + i] += mat[i]; - s->geometry[(framei * s->numverts * 15) + (s->tris[trii].i[2] * 15) + 6 + i] += mat[i]; - i++; - } - - framei++; - } - - trii++; - } - - // now that we accumulated the TBNs, average and invert them for each vertex - verti = 0; - while (verti < (m->head.numframes * s->numverts)) - { - i = 6; - while (i < 12) - { - s->geometry[(verti * 15) + i] /= numtris[verti % s->numverts]; - i++; - } - // copy N over - s->geometry[(verti * 15) + 12] = s->geometry[(verti * 15) + 3]; - s->geometry[(verti * 15) + 13] = s->geometry[(verti * 15) + 4]; - s->geometry[(verti * 15) + 14] = s->geometry[(verti * 15) + 5]; - - invertmatrix(&s->geometry[(verti * 15) + 6], mat); - memcpy(&s->geometry[(verti * 15) + 6], mat, sizeof(float) * 9); - - verti++; - } - - Bfree(numtris); - - surfi++; - } - -#else - UNREFERENCED_PARAMETER(m); -#endif - - return 1; -} - - -static int32_t md3draw(md3model_t *m, spritetype *tspr) -{ - point3d fp, fp1, fp2, m0, m1, a0; - md3xyzn_t *v0, *v1; - int32_t i, j, k, l, surfi; - float f, g, k0, k1, k2, k3, k4, k5, k6, k7, mat[16]; - md3surf_t *s; - GLfloat pc[4]; - int32_t texunits = GL_TEXTURE0_ARB; - mdskinmap_t *sk; - //PLAG : sorting stuff - void *vbotemp; - point3d *vertexhandle = NULL; - uint16_t *indexhandle; - char lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal; - - if (r_vbos && (m->vbos == NULL)) - mdloadvbos(m); - - // if ((tspr->cstat&48) == 32) return 0; - - updateanimation((md2model_t *)m,tspr); - - //create current&next frame's vertex list from whole list - - f = m->interpol; g = 1-f; - - if (m->interpol < 0 || m->interpol > 1 || - m->cframe < 0 || m->cframe >= m->numframes || - m->nframe < 0 || m->nframe >= m->numframes) - { - OSD_Printf("Model frame out of bounds!\n"); - if (m->interpol < 0) - m->interpol = 0; - if (m->interpol > 1) - m->interpol = 1; - if (m->cframe < 0) - m->cframe = 0; - if (m->cframe >= m->numframes) - m->cframe = m->numframes - 1; - if (m->nframe < 0) - m->nframe = 0; - if (m->nframe >= m->numframes) - m->nframe = m->numframes - 1; - } - - if (m->head.flags == 1337) - { - // md2 - m0.x = m->scale * g; m1.x = m->scale *f; - m0.y = m->scale * g; m1.y = m->scale *f; - m0.z = m->scale * g; m1.z = m->scale *f; - a0.x = a0.y = 0; a0.z = ((globalorientation&8)?-m->zadd:m->zadd)*m->scale; - } - else - { - m0.x = (1.0/64.0) * m->scale * g; m1.x = (1.0/64.0) * m->scale *f; - m0.y = (1.0/64.0) * m->scale * g; m1.y = (1.0/64.0) * m->scale *f; - m0.z = (1.0/64.0) * m->scale * g; m1.z = (1.0/64.0) * m->scale *f; - a0.x = a0.y = 0; a0.z = ((globalorientation&8)?-m->zadd:m->zadd)*m->scale; - } - - - // Parkar: Moved up to be able to use k0 for the y-flipping code - k0 = (float)tspr->z; - if ((globalorientation&128) && !((globalorientation&48)==32)) k0 += (float)((tilesizy[tspr->picnum]*tspr->yrepeat)<<1); - - // Parkar: Changed to use the same method as centeroriented sprites - if (globalorientation&8) //y-flipping - { - m0.z = -m0.z; m1.z = -m1.z; a0.z = -a0.z; - k0 -= (float)((tilesizy[tspr->picnum]*tspr->yrepeat)<<2); - } - if (globalorientation&4) { m0.y = -m0.y; m1.y = -m1.y; a0.y = -a0.y; } //x-flipping - - f = ((float)tspr->xrepeat)/64*m->bscale; - m0.x *= f; m1.x *= f; a0.x *= f; f = -f; // 20040610: backwards models aren't cool - m0.y *= f; m1.y *= f; a0.y *= f; - f = ((float)tspr->yrepeat)/64*m->bscale; - m0.z *= f; m1.z *= f; a0.z *= f; - - // floor aligned - k1 = (float)tspr->y; - if ((globalorientation&48)==32) - { - m0.z = -m0.z; m1.z = -m1.z; a0.z = -a0.z; - m0.y = -m0.y; m1.y = -m1.y; a0.y = -a0.y; - f = a0.x; a0.x = a0.z; a0.z = f; - k1 += (float)((tilesizy[tspr->picnum]*tspr->yrepeat)>>3); - } - - f = (65536.0*512.0)/((float)xdimen*viewingrange); - g = 32.0/((float)xdimen*gxyaspect); - m0.y *= f; m1.y *= f; a0.y = (((float)(tspr->x-globalposx))/ 1024.0 + a0.y)*f; - m0.x *=-f; m1.x *=-f; a0.x = (((float)(k1 -globalposy))/ -1024.0 + a0.x)*-f; - m0.z *= g; m1.z *= g; a0.z = (((float)(k0 -globalposz))/-16384.0 + a0.z)*g; - - k0 = ((float)(tspr->x-globalposx))*f/1024.0; - k1 = ((float)(tspr->y-globalposy))*f/1024.0; - f = gcosang2*gshang; - g = gsinang2*gshang; - k4 = (float)sintable[(tspr->ang+spriteext[tspr->owner].angoff+1024)&2047] / 16384.0; - k5 = (float)sintable[(tspr->ang+spriteext[tspr->owner].angoff+ 512)&2047] / 16384.0; - k2 = k0*(1-k4)+k1*k5; - k3 = k1*(1-k4)-k0*k5; - k6 = f*gstang - gsinang*gctang; k7 = g*gstang + gcosang*gctang; - mat[0] = k4*k6 + k5*k7; mat[4] = gchang*gstang; mat[ 8] = k4*k7 - k5*k6; mat[12] = k2*k6 + k3*k7; - k6 = f*gctang + gsinang*gstang; k7 = g*gctang - gcosang*gstang; - mat[1] = k4*k6 + k5*k7; mat[5] = gchang*gctang; mat[ 9] = k4*k7 - k5*k6; mat[13] = k2*k6 + k3*k7; - k6 = gcosang2*gchang; k7 = gsinang2*gchang; - mat[2] = k4*k6 + k5*k7; mat[6] =-gshang; mat[10] = k4*k7 - k5*k6; mat[14] = k2*k6 + k3*k7; - - mat[12] += a0.y*mat[0] + a0.z*mat[4] + a0.x*mat[ 8]; - mat[13] += a0.y*mat[1] + a0.z*mat[5] + a0.x*mat[ 9]; - mat[14] += a0.y*mat[2] + a0.z*mat[6] + a0.x*mat[10]; - - // floor aligned - if ((globalorientation&48)==32) - { - f = mat[4]; mat[4] = mat[8]*16.0; mat[8] = -f*(1.0/16.0); - f = mat[5]; mat[5] = mat[9]*16.0; mat[9] = -f*(1.0/16.0); - f = mat[6]; mat[6] = mat[10]*16.0; mat[10] = -f*(1.0/16.0); - } - - //Mirrors - if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; } - - //------------ - //bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE - //to use Z-buffer hacks to hide overdraw problems with the shadows - if (tspr->cstat&1024) - { - bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS - bglDepthRange(0.0,0.9999); - } - bglPushAttrib(GL_POLYGON_BIT); - if ((grhalfxdown10x >= 0) ^((globalorientation&8) != 0) ^((globalorientation&4) != 0)) bglFrontFace(GL_CW); else bglFrontFace(GL_CCW); - bglEnable(GL_CULL_FACE); - bglCullFace(GL_BACK); - - bglEnable(GL_TEXTURE_2D); - - pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups); - if (!(hictinting[globalpal].f&4)) - { - if (!(m->flags&1) || (!(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0)) - { - pc[0] *= (float)hictinting[globalpal].r / 255.0; - pc[1] *= (float)hictinting[globalpal].g / 255.0; - pc[2] *= (float)hictinting[globalpal].b / 255.0; - if (hictinting[MAXPALOOKUPS-1].r != 255 || hictinting[MAXPALOOKUPS-1].g != 255 || hictinting[MAXPALOOKUPS-1].b != 255) - { - pc[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0f; - pc[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0f; - pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0f; - } - } - else globalnoeffect=1; - } - - if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66f; else pc[3] = 0.33f; } - else pc[3] = 1.0; - if (m->usesalpha) //Sprites with alpha in texture - { - // bglEnable(GL_BLEND);// bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - // bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,0.32); - // float al = 0.32; - // PLAG : default cutoff removed - float al = 0.0; - if (alphahackarray[globalpicnum] != 0) - al=alphahackarray[globalpicnum]; - bglEnable(GL_BLEND); - bglEnable(GL_ALPHA_TEST); - bglAlphaFunc(GL_GREATER,al); - } - else - { - if (tspr->cstat&2) bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); - } - bglColor4f(pc[0],pc[1],pc[2],pc[3]); - //if (m->head.flags == 1337) - // bglColor4f(0.0f, 0.0f, 1.0f, 1.0f); - //------------ - - // PLAG: Cleaner model rotation code - if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll || m->head.flags == 1337) - { - if (spriteext[tspr->owner].xoff) - a0.x = (float)(spriteext[tspr->owner].xoff / (2560 * (m0.x+m1.x))); - else - a0.x = 0; - if (spriteext[tspr->owner].yoff) - a0.y = (float)(spriteext[tspr->owner].yoff / (2560 * (m0.x+m1.x))); - else - a0.y = 0; - if ((spriteext[tspr->owner].zoff) && !(tspr->cstat&1024)) - a0.z = (float)(spriteext[tspr->owner].zoff / (655360 * (m0.z+m1.z))); - else - a0.z = 0; - k0 = (float)sintable[(spriteext[tspr->owner].pitch+512)&2047] / 16384.0; - k1 = (float)sintable[spriteext[tspr->owner].pitch&2047] / 16384.0; - k2 = (float)sintable[(spriteext[tspr->owner].roll+512)&2047] / 16384.0; - k3 = (float)sintable[spriteext[tspr->owner].roll&2047] / 16384.0; - } - for (surfi=0; surfihead.numsurfs; surfi++) - { - s = &m->head.surfs[surfi]; - v0 = &s->xyzn[m->cframe*s->numverts]; - v1 = &s->xyzn[m->nframe*s->numverts]; - - if (r_vertexarrays && r_vbos) - { - if (++curvbo >= r_vbocount) - curvbo = 0; - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, vertvbos[curvbo]); - vbotemp = bglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); - vertexhandle = (point3d *)vbotemp; - } - - for (i=s->numverts-1; i>=0; i--) - { - if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll || m->head.flags == 1337) - { - fp.z = ((m->head.flags == 1337) ? (v0[i].x * m->muladdframes[m->cframe*2].x) + m->muladdframes[m->cframe*2+1].x : v0[i].x) + a0.x; - fp.x = ((m->head.flags == 1337) ? (v0[i].y * m->muladdframes[m->cframe*2].y) + m->muladdframes[m->cframe*2+1].y : v0[i].y) + a0.y; - fp.y = ((m->head.flags == 1337) ? (v0[i].z * m->muladdframes[m->cframe*2].z) + m->muladdframes[m->cframe*2+1].z : v0[i].z) + a0.z; - fp1.x = fp.x*k2 + fp.y*k3; - fp1.y = fp.x*k0*(-k3) + fp.y*k0*k2 + fp.z*(-k1); - fp1.z = fp.x*k1*(-k3) + fp.y*k1*k2 + fp.z*k0; - fp.z = ((m->head.flags == 1337) ? (v1[i].x * m->muladdframes[m->nframe*2].x) + m->muladdframes[m->nframe*2+1].x : v1[i].x) + a0.x; - fp.x = ((m->head.flags == 1337) ? (v1[i].y * m->muladdframes[m->nframe*2].y) + m->muladdframes[m->nframe*2+1].y : v1[i].y) + a0.y; - fp.y = ((m->head.flags == 1337) ? (v1[i].z * m->muladdframes[m->nframe*2].z) + m->muladdframes[m->nframe*2+1].z : v1[i].z) + a0.z; - fp2.x = fp.x*k2 + fp.y*k3; - fp2.y = fp.x*k0*(-k3) + fp.y*k0*k2 + fp.z*(-k1); - fp2.z = fp.x*k1*(-k3) + fp.y*k1*k2 + fp.z*k0; - fp.z = (fp1.z - a0.x)*m0.x + (fp2.z - a0.x)*m1.x; - fp.x = (fp1.x - a0.y)*m0.y + (fp2.x - a0.y)*m1.y; - fp.y = (fp1.y - a0.z)*m0.z + (fp2.y - a0.z)*m1.z; - } - else - { - fp.z = v0[i].x*m0.x + v1[i].x*m1.x; - fp.y = v0[i].z*m0.z + v1[i].z*m1.z; - fp.x = v0[i].y*m0.y + v1[i].y*m1.y; - } - if (r_vertexarrays && r_vbos) - { - vertexhandle[i].x = fp.x; - vertexhandle[i].y = fp.y; - vertexhandle[i].z = fp.z; - } - vertlist[i].x = fp.x; - vertlist[i].y = fp.y; - vertlist[i].z = fp.z; - } - - if (r_vertexarrays && r_vbos) - { - bglUnmapBufferARB(GL_ARRAY_BUFFER_ARB); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } - - bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation - mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat); - // PLAG: End - - i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,globalpal,surfi); if (!i) continue; - //i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,surfi); //hack for testing multiple surfaces per MD3 - bglBindTexture(GL_TEXTURE_2D, i); - - if (r_detailmapping && !(tspr->cstat&1024)) - i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi); - else - i = 0; - - if (i) - { - bglActiveTextureARB(++texunits); - - bglEnable(GL_TEXTURE_2D); - bglBindTexture(GL_TEXTURE_2D, i); - - bglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE); - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); - - bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0f); - - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - - for (sk = m->skinmap; sk; sk = sk->next) - if ((int32_t)sk->palette == DETAILPAL && sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum && sk->surfnum == surfi) - f = sk->param; - - bglMatrixMode(GL_TEXTURE); - bglLoadIdentity(); - bglScalef(f, f, 1.0f); - bglMatrixMode(GL_MODELVIEW); - } - - if (r_glowmapping && !(tspr->cstat&1024)) - i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi); - else - i = 0; - - if (i) - { - bglActiveTextureARB(++texunits); - - bglEnable(GL_TEXTURE_2D); - bglBindTexture(GL_TEXTURE_2D, i); - - bglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_TEXTURE); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_ONE_MINUS_SRC_ALPHA); - - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE); - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); - - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - } - - if (r_vertexarrays && r_vbos) - { - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[curvbo]); - vbotemp = bglMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); - indexhandle = (uint16_t *)vbotemp; - } - else - indexhandle = m->vindexes; - - //PLAG: delayed polygon-level sorted rendering - if (m->usesalpha && !(tspr->cstat & 1024)) - { - for (i=s->numtris-1; i>=0; i--) - { - // Matrix multiplication - ugly but clear - fp.x = (vertlist[s->tris[i].i[0]].x * mat[0]) + (vertlist[s->tris[i].i[0]].y * mat[4]) + (vertlist[s->tris[i].i[0]].z * mat[8]) + mat[12]; - fp.y = (vertlist[s->tris[i].i[0]].x * mat[1]) + (vertlist[s->tris[i].i[0]].y * mat[5]) + (vertlist[s->tris[i].i[0]].z * mat[9]) + mat[13]; - fp.z = (vertlist[s->tris[i].i[0]].x * mat[2]) + (vertlist[s->tris[i].i[0]].y * mat[6]) + (vertlist[s->tris[i].i[0]].z * mat[10]) + mat[14]; - - fp1.x = (vertlist[s->tris[i].i[1]].x * mat[0]) + (vertlist[s->tris[i].i[1]].y * mat[4]) + (vertlist[s->tris[i].i[1]].z * mat[8]) + mat[12]; - fp1.y = (vertlist[s->tris[i].i[1]].x * mat[1]) + (vertlist[s->tris[i].i[1]].y * mat[5]) + (vertlist[s->tris[i].i[1]].z * mat[9]) + mat[13]; - fp1.z = (vertlist[s->tris[i].i[1]].x * mat[2]) + (vertlist[s->tris[i].i[1]].y * mat[6]) + (vertlist[s->tris[i].i[1]].z * mat[10]) + mat[14]; - - fp2.x = (vertlist[s->tris[i].i[2]].x * mat[0]) + (vertlist[s->tris[i].i[2]].y * mat[4]) + (vertlist[s->tris[i].i[2]].z * mat[8]) + mat[12]; - fp2.y = (vertlist[s->tris[i].i[2]].x * mat[1]) + (vertlist[s->tris[i].i[2]].y * mat[5]) + (vertlist[s->tris[i].i[2]].z * mat[9]) + mat[13]; - fp2.z = (vertlist[s->tris[i].i[2]].x * mat[2]) + (vertlist[s->tris[i].i[2]].y * mat[6]) + (vertlist[s->tris[i].i[2]].z * mat[10]) + mat[14]; - - f = (fp.x * fp.x) + (fp.y * fp.y) + (fp.z * fp.z); - - g = (fp1.x * fp1.x) + (fp1.y * fp1.y) + (fp1.z * fp1.z); - if (f > g) - f = g; - g = (fp2.x * fp2.x) + (fp2.y * fp2.y) + (fp2.z * fp2.z); - if (f > g) - f = g; - - m->maxdepths[i] = f; - m->indexes[i] = i; - } - - // dichotomic recursive sorting - about 100x less iterations than bubblesort - quicksort(m->indexes, m->maxdepths, 0, s->numtris - 1); - - if (r_vertexarrays) - { - k = 0; - for (i=s->numtris-1; i>=0; i--) - for (j=0; j<3; j++) - indexhandle[k++] = s->tris[m->indexes[i]].i[j]; - } - else - { - bglBegin(GL_TRIANGLES); - for (i=s->numtris-1; i>=0; i--) - for (j=0; j<3; j++) - { - k = s->tris[m->indexes[i]].i[j]; - if (texunits > GL_TEXTURE0_ARB) - { - l = GL_TEXTURE0_ARB; - while (l <= texunits) - bglMultiTexCoord2fARB(l++, s->uv[k].u,s->uv[k].v); - } - else - bglTexCoord2f(s->uv[k].u,s->uv[k].v); - bglVertex3fv((float *)&vertlist[k]); - } - bglEnd(); - } - } - else - { - if (r_vertexarrays) - { - k = 0; - for (i=s->numtris-1; i>=0; i--) - for (j=0; j<3; j++) - indexhandle[k++] = s->tris[i].i[j]; - } - else - { - bglBegin(GL_TRIANGLES); - for (i=s->numtris-1; i>=0; i--) - for (j=0; j<3; j++) - { - k = s->tris[i].i[j]; - if (texunits > GL_TEXTURE0_ARB) - { - l = GL_TEXTURE0_ARB; - while (l <= texunits) - bglMultiTexCoord2fARB(l++, s->uv[k].u,s->uv[k].v); - } - else - bglTexCoord2f(s->uv[k].u,s->uv[k].v); - bglVertex3fv((float *)&vertlist[k]); - } - bglEnd(); - } - } - - if (r_vertexarrays && r_vbos) - { - bglUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - } - - if (r_vertexarrays) - { - if (r_vbos) - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->vbos[surfi]); - l = GL_TEXTURE0_ARB; - while (l <= texunits) - { - bglClientActiveTextureARB(l++); - bglEnableClientState(GL_TEXTURE_COORD_ARRAY); - if (r_vbos) - bglTexCoordPointer(2, GL_FLOAT, 0, 0); - else - bglTexCoordPointer(2, GL_FLOAT, 0, &(s->uv[0].u)); - } - - if (r_vbos) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, vertvbos[curvbo]); - bglVertexPointer(3, GL_FLOAT, 0, 0); - } - else - bglVertexPointer(3, GL_FLOAT, 0, &(vertlist[0].x)); - - if (r_vbos) - { - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[curvbo]); - bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, 0); - } - else - bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, m->vindexes); - - if (r_vbos) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - } - } - - while (texunits > GL_TEXTURE0_ARB) - { - bglMatrixMode(GL_TEXTURE); - bglLoadIdentity(); - bglMatrixMode(GL_MODELVIEW); - bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f); - bglDisable(GL_TEXTURE_2D); - if (r_vertexarrays) - { - bglDisableClientState(GL_TEXTURE_COORD_ARRAY); - bglClientActiveTextureARB(texunits - 1); - } - bglActiveTextureARB(--texunits); - } - } - //------------ - - if (m->usesalpha) bglDisable(GL_ALPHA_TEST); - bglDisable(GL_CULL_FACE); - bglPopAttrib(); - if (tspr->cstat&1024) - { - bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS - bglDepthRange(0.0,0.99999); - } - bglLoadIdentity(); - - globalnoeffect=0; - return 1; -} - -static void md3free(md3model_t *m) -{ - mdanim_t *anim, *nanim = NULL; - mdskinmap_t *sk, *nsk = NULL; - md3surf_t *s; - int32_t surfi; - - if (!m) return; - - for (anim=m->animations; anim; anim=nanim) - { - nanim = anim->next; - Bfree(anim); - } - for (sk=m->skinmap; sk; sk=nsk) - { - nsk = sk->next; - Bfree(sk->fn); - Bfree(sk); - } - - if (m->head.surfs) - { - for (surfi=m->head.numsurfs-1; surfi>=0; surfi--) - { - s = &m->head.surfs[surfi]; - if (s->tris) Bfree(s->tris); - if (m->head.flags == 1337) - { - if (s->shaders) Bfree(s->shaders); - if (s->uv) Bfree(s->uv); - if (s->xyzn) Bfree(s->xyzn); - if (s->geometry) Bfree(s->geometry); - } - } - Bfree(m->head.surfs); - } - if (m->head.tags) Bfree(m->head.tags); - if (m->head.frames) Bfree(m->head.frames); - - if (m->texid) Bfree(m->texid); - - if (m->muladdframes) Bfree(m->muladdframes); - - if (m->indexes) Bfree(m->indexes); - if (m->vindexes) Bfree(m->vindexes); - if (m->maxdepths) Bfree(m->maxdepths); - - if (m->vbos) - { - bglDeleteBuffersARB(m->head.numsurfs, m->vbos); - Bfree(m->vbos); - m->vbos = NULL; - } - - Bfree(m); -} - -//---------------------------------------- MD3 LIBRARY ENDS ---------------------------------------- -//--------------------------------------- VOX LIBRARY BEGINS --------------------------------------- - -//For loading/conversion only -static int32_t xsiz, ysiz, zsiz, yzsiz, *vbit = 0; //vbit: 1 bit per voxel: 0=air,1=solid -static float xpiv, ypiv, zpiv; //Might want to use more complex/unique names! -static int32_t *vcolhashead = 0, vcolhashsizm1; -typedef struct { int32_t p, c, n; } voxcol_t; -static voxcol_t *vcol = 0; int32_t vnum = 0, vmax = 0; -typedef struct { int16_t x, y; } spoint2d; -static spoint2d *shp; -static int32_t *shcntmal, *shcnt = 0, shcntp; -static int32_t mytexo5, *zbit, gmaxx, gmaxy, garea, pow2m1[33]; -static voxmodel_t *gvox; - -//pitch must equal xsiz*4 -uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, int32_t dapal) -{ - uint32_t rtexid; - coltype *pic, *pic2; - char *cptr; - int32_t i; - - pic = (coltype *)picbuf; //Correct for GL's RGB order; also apply gamma here.. - pic2 = (coltype *)Bmalloc(xsiz*ysiz*sizeof(int32_t)); if (!pic2) return((unsigned)-1); - cptr = (char *)&britable[gammabrightness ? 0 : curbrightness][0]; - if (!is8bit) - { - for (i=xsiz*ysiz-1; i>=0; i--) - { - pic2[i].b = cptr[pic[i].r]; - pic2[i].g = cptr[pic[i].g]; - pic2[i].r = cptr[pic[i].b]; - pic2[i].a = 255; - } - } - else - { - if (palookup[dapal] == NULL) dapal = 0; - for (i=xsiz*ysiz-1; i>=0; i--) - { - pic2[i].b = cptr[palette[(int32_t)palookup[dapal][pic[i].a]*3+2]*4]; - pic2[i].g = cptr[palette[(int32_t)palookup[dapal][pic[i].a]*3+1]*4]; - pic2[i].r = cptr[palette[(int32_t)palookup[dapal][pic[i].a]*3+0]*4]; - pic2[i].a = 255; - } - } - - bglGenTextures(1,(GLuint *)&rtexid); - bglBindTexture(GL_TEXTURE_2D,rtexid); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); - bglTexImage2D(GL_TEXTURE_2D,0,4,xsiz,ysiz,0,GL_RGBA,GL_UNSIGNED_BYTE,(char *)pic2); - Bfree(pic2); - return(rtexid); -} - -static int32_t getvox(int32_t x, int32_t y, int32_t z) -{ - z += x*yzsiz + y*zsiz; - for (x=vcolhashead[(z*214013)&vcolhashsizm1]; x>=0; x=vcol[x].n) - if (vcol[x].p == z) return(vcol[x].c); - return(0x808080); -} - -static void putvox(int32_t x, int32_t y, int32_t z, int32_t col) -{ - if (vnum >= vmax) { vmax = max(vmax<<1,4096); vcol = (voxcol_t *)Brealloc(vcol,vmax*sizeof(voxcol_t)); } - - z += x*yzsiz + y*zsiz; - vcol[vnum].p = z; z = ((z*214013)&vcolhashsizm1); - vcol[vnum].c = col; - vcol[vnum].n = vcolhashead[z]; vcolhashead[z] = vnum++; -} - -//Set all bits in vbit from (x,y,z0) to (x,y,z1-1) to 0's -#if 0 -static void setzrange0(int32_t *lptr, int32_t z0, int32_t z1) -{ - int32_t z, ze; - if (!((z0^z1)&~31)) { lptr[z0>>5] &= ((~(-1<>5); ze = (z1>>5); - lptr[z] &=~(-1<>5] |= ((~(-1<>5); ze = (z1>>5); - lptr[z] |= (-1<mytexx + x0; - for (dy=0; dy; dy--,i+=gvox->mytexx) - for (x=0; x>5]&(1<>5); dx += x0-1; c = (dx>>5) - (x0>>5); - m = ~pow2m1[x0&31]; m1 = pow2m1[(dx&31)+1]; - if (!c) { for (m&=m1; dy; dy--,i+=mytexo5) if (zbit[i]&m) return(0); } - else - { - for (; dy; dy--,i+=mytexo5) - { - if (zbit[i]&m) return(0); - for (x=1; xmytexx + x0; - for (y=0; ymytexx) - for (x=0; x>5] |= (1<>5); dx += x0-1; c = (dx>>5) - (x0>>5); - m = ~pow2m1[x0&31]; m1 = pow2m1[(dx&31)+1]; - if (!c) { for (m&=m1; dy; dy--,i+=mytexo5) zbit[i] |= m; } - else - { - for (; dy; dy--,i+=mytexo5) - { - zbit[i] |= m; - for (x=1; x gmaxx) gmaxx = x; - if (y > gmaxy) gmaxy = y; - garea += (x+(VOXBORDWIDTH<<1))*(y+(VOXBORDWIDTH<<1)); - gvox->qcnt++; -} - -static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t face) -{ - int32_t i, j, x, y, z, xx, yy, nx = 0, ny = 0, nz = 0, *lptr; - voxrect_t *qptr; - - x = labs(x2-x0); y = labs(y2-y0); z = labs(z2-z0); - if (!x) { x = y; y = z; i = 0; } - else if (!y) { y = z; i = 1; } - else i = 2; - if (x < y) { z = x; x = y; y = z; i += 3; } - z = shcnt[y*shcntp+x]++; - lptr = &gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+(shp[z].x+VOXBORDWIDTH)]; - switch (face) - { - case 0: - ny = y1; x2 = x0; x0 = x1; x1 = x2; break; - case 1: - ny = y0; y0++; y1++; y2++; break; - case 2: - nz = z1; y0 = y2; y2 = y1; y1 = y0; z0++; z1++; z2++; break; - case 3: - nz = z0; break; - case 4: - nx = x1; y2 = y0; y0 = y1; y1 = y2; x0++; x1++; x2++; break; - case 5: - nx = x0; break; - } - for (yy=0; yymytexx) - for (xx=0; xxmytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x]; - lptr[xx] = lptr[VOXBORDWIDTH]; lptr[xx+x+VOXBORDWIDTH] = lptr[x-1+VOXBORDWIDTH]; - } - //Extend borders vertically - for (yy=0; yymytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x], - &gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+shp[z].x], - (x+(VOXBORDWIDTH<<1))<<2); - Bmemcpy(&gvox->mytex[(shp[z].y+y+yy+VOXBORDWIDTH)*gvox->mytexx+shp[z].x], - &gvox->mytex[(shp[z].y+y-1+VOXBORDWIDTH)*gvox->mytexx+shp[z].x], - (x+(VOXBORDWIDTH<<1))<<2); - } - - qptr = &gvox->quad[gvox->qcnt]; - qptr->v[0].x = x0; qptr->v[0].y = y0; qptr->v[0].z = z0; - qptr->v[1].x = x1; qptr->v[1].y = y1; qptr->v[1].z = z1; - qptr->v[2].x = x2; qptr->v[2].y = y2; qptr->v[2].z = z2; - for (j=0; j<3; j++) { qptr->v[j].u = shp[z].x+VOXBORDWIDTH; qptr->v[j].v = shp[z].y+VOXBORDWIDTH; } - if (i < 3) qptr->v[1].u += x; else qptr->v[1].v += y; - qptr->v[2].u += x; qptr->v[2].v += y; - - qptr->v[3].u = qptr->v[0].u - qptr->v[1].u + qptr->v[2].u; - qptr->v[3].v = qptr->v[0].v - qptr->v[1].v + qptr->v[2].v; - qptr->v[3].x = qptr->v[0].x - qptr->v[1].x + qptr->v[2].x; - qptr->v[3].y = qptr->v[0].y - qptr->v[1].y + qptr->v[2].y; - qptr->v[3].z = qptr->v[0].z - qptr->v[1].z + qptr->v[2].z; - if (gvox->qfacind[face] < 0) gvox->qfacind[face] = gvox->qcnt; - gvox->qcnt++; - -} - -static int32_t isolid(int32_t x, int32_t y, int32_t z) -{ - if ((uint32_t)x >= (uint32_t)xsiz) return(0); - if ((uint32_t)y >= (uint32_t)ysiz) return(0); - if ((uint32_t)z >= (uint32_t)zsiz) return(0); - z += x*yzsiz + y*zsiz; return(vbit[z>>5]&(1<qfacind[i] = -1; - - i = ((max(ysiz,zsiz)+1)<<2); - bx0 = (int32_t *)Bmalloc(i<<1); if (!bx0) { Bfree(gvox); return(0); } - by0 = (int32_t *)(((intptr_t)bx0)+i); - - for (cnt=0; cnt<2; cnt++) - { - if (!cnt) daquad = cntquad; - else daquad = addquad; - gvox->qcnt = 0; - - memset(by0,-1,(max(ysiz,zsiz)+1)<<2); v = 0; - - for (i=-1; i<=1; i+=2) - for (y=0; y= 0) && ((by0[z] != oz) || (v >= ov))) - { daquad(bx0[z],y,by0[z],x,y,by0[z],x,y,z,i>=0); by0[z] = -1; } - if (v > ov) oz = z; else if ((v < ov) && (by0[z] != oz)) { bx0[z] = x; by0[z] = oz; } - } - - for (i=-1; i<=1; i+=2) - for (z=0; z= 0) && ((by0[y] != oz) || (v >= ov))) - { daquad(bx0[y],by0[y],z,x,by0[y],z,x,y,z,(i>=0)+2); by0[y] = -1; } - if (v > ov) oz = y; else if ((v < ov) && (by0[y] != oz)) { bx0[y] = x; by0[y] = oz; } - } - - for (i=-1; i<=1; i+=2) - for (x=0; x= 0) && ((by0[z] != oz) || (v >= ov))) - { daquad(x,bx0[z],by0[z],x,y,by0[z],x,y,z,(i>=0)+4); by0[z] = -1; } - if (v > ov) oz = z; else if ((v < ov) && (by0[z] != oz)) { bx0[z] = y; by0[z] = oz; } - } - - if (!cnt) - { - shp = (spoint2d *)Bmalloc(gvox->qcnt*sizeof(spoint2d)); - if (!shp) { Bfree(bx0); Bfree(gvox); return(0); } - - sc = 0; - for (y=gmaxy; y; y--) - for (x=gmaxx; x>=y; x--) - { - i = shcnt[y*shcntp+x]; shcnt[y*shcntp+x] = sc; //shcnt changes from counter to head index - for (; i>0; i--) { shp[sc].x = x; shp[sc].y = y; sc++; } - } - - for (gvox->mytexx=32; gvox->mytexx<(gmaxx+(VOXBORDWIDTH<<1)); gvox->mytexx<<=1); - for (gvox->mytexy=32; gvox->mytexy<(gmaxy+(VOXBORDWIDTH<<1)); gvox->mytexy<<=1); - while (gvox->mytexx*gvox->mytexy*8 < garea*9) //This should be sufficient to fit most skins... - { -skindidntfit: - ; - if (gvox->mytexx <= gvox->mytexy) gvox->mytexx <<= 1; else gvox->mytexy <<= 1; - } - mytexo5 = (gvox->mytexx>>5); - - i = (((gvox->mytexx*gvox->mytexy+31)>>5)<<2); - zbit = (int32_t *)Bmalloc(i); if (!zbit) { Bfree(bx0); Bfree(gvox); Bfree(shp); return(0); } - memset(zbit,0,i); - - v = gvox->mytexx*gvox->mytexy; - for (z=0; zmytexx,255)-dx))>>15); - y0 = (((rand()&32767)*(min(gvox->mytexy,255)-dy))>>15); -#else - x0 = (((rand()&32767)*(gvox->mytexx+1-dx))>>15); - y0 = (((rand()&32767)*(gvox->mytexy+1-dy))>>15); -#endif - i--; - if (i < 0) //Time-out! Very slow if this happens... but at least it still works :P - { - Bfree(zbit); - - //Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/ - j = 0; - for (y=gmaxy; y; y--) - for (x=gmaxx; x>=y; x--) - { - i = shcnt[y*shcntp+x]; - for (; jquad = (voxrect_t *)Bmalloc(gvox->qcnt*sizeof(voxrect_t)); - if (!gvox->quad) { Bfree(zbit); Bfree(shp); Bfree(bx0); Bfree(gvox); return(0); } - - gvox->mytex = (int32_t *)Bmalloc(gvox->mytexx*gvox->mytexy*sizeof(int32_t)); - if (!gvox->mytex) { Bfree(gvox->quad); Bfree(zbit); Bfree(shp); Bfree(bx0); Bfree(gvox); return(0); } - } - } - Bfree(shp); Bfree(zbit); Bfree(bx0); - return(gvox); -} - -static int32_t loadvox(const char *filnam) -{ - int32_t i, j, k, x, y, z, pal[256], fil; - char c[3], *tbuf; - - fil = kopen4load((char *)filnam,0); if (fil < 0) return(-1); - kread(fil,&xsiz,4); xsiz = B_LITTLE32(xsiz); - kread(fil,&ysiz,4); ysiz = B_LITTLE32(ysiz); - kread(fil,&zsiz,4); zsiz = B_LITTLE32(zsiz); - xpiv = ((float)xsiz)*.5; - ypiv = ((float)ysiz)*.5; - zpiv = ((float)zsiz)*.5; - - klseek(fil,-768,SEEK_END); - for (i=0; i<256; i++) - { kread(fil,c,3); pal[i] = (((int32_t)c[0])<<18)+(((int32_t)c[1])<<10)+(((int32_t)c[2])<<2)+(i<<24); } - pal[255] = -1; - - vcolhashsizm1 = 8192-1; - vcolhashead = (int32_t *)Bmalloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); } - memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t)); - - yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); - vbit = (int32_t *)Bmalloc(i); if (!vbit) { kclose(fil); return(-1); } - memset(vbit,0,i); - - tbuf = (char *)Bmalloc(zsiz*sizeof(uint8_t)); if (!tbuf) { kclose(fil); return(-1); } - - klseek(fil,12,SEEK_SET); - for (x=0; x=0; z--) - { if (tbuf[z] != 255) { i = j+z; vbit[i>>5] |= (1<>5]&(1<>5]&(1<>5]&(1<>5]&(1<>5]&(1<>5]&(1<=0; i--) xyoffs[i] = B_LITTLE16(xyoffs[i]); - - klseek(fil,-768,SEEK_END); - for (i=0; i<256; i++) - { kread(fil,c,3); pal[i] = B_LITTLE32((((int32_t)c[0])<<18)+(((int32_t)c[1])<<10)+(((int32_t)c[2])<<2)+(i<<24)); } - - yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); - vbit = (int32_t *)Bmalloc(i); if (!vbit) { Bfree(xyoffs); kclose(fil); return(-1); } - memset(vbit,0,i); - - for (vcolhashsizm1=4096; vcolhashsizm1<(mip1leng>>1); vcolhashsizm1<<=1); vcolhashsizm1--; //approx to numvoxs! - vcolhashead = (int32_t *)Bmalloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { Bfree(xyoffs); kclose(fil); return(-1); } - memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t)); - - klseek(fil,28+((xsiz+1)<<2)+((ysizp1*xsiz)<<1),SEEK_SET); - - i = kfilelength(fil)-ktell(fil); - tbuf = (char *)Bmalloc(i); if (!tbuf) { Bfree(xyoffs); kclose(fil); return(-1); } - kread(fil,tbuf,i); kclose(fil); - - cptr = tbuf; - for (x=0; x=0; i--) ylen[i] = B_LITTLE16(ylen[i]); - klseek(fil,32,SEEK_SET); - - yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); - vbit = (int32_t *)Bmalloc(i); if (!vbit) { Bfree(ylen); kclose(fil); return(-1); } - memset(vbit,0,i); - - for (vcolhashsizm1=4096; vcolhashsizm10; i--) - { - kread(fil,c,8); //b,g,r,a,z_lo,z_hi,vis,dir - z0 = B_LITTLE16(*(uint16_t *)&c[4]); - if (!(c[6]&16)) setzrange1(vbit,j+z1,j+z0); - vbit[(j+z0)>>5] |= (1<>3); - vbit = (int32_t *)Bmalloc(i); if (!vbit) { kclose(fil); return(-1); } - memset(vbit,-1,i); - - vcolhashsizm1 = 1048576-1; - vcolhashead = (int32_t *)Bmalloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); } - memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t)); - - //Allocate huge buffer and load rest of file into it... - i = kfilelength(fil)-ktell(fil); - vbuf = (char *)Bmalloc(i); if (!vbuf) { kclose(fil); return(-1); } - kread(fil,vbuf,i); - kclose(fil); - - v = vbuf; - for (y=0; ymytex) Bfree(m->mytex); - if (m->quad) Bfree(m->quad); - if (m->texid) Bfree(m->texid); - Bfree(m); -} - -voxmodel_t *voxload(const char *filnam) -{ - int32_t i, is8bit, ret; - voxmodel_t *vm; - - i = strlen(filnam)-4; if (i < 0) return(0); - if (!Bstrcasecmp(&filnam[i],".vox")) { ret = loadvox(filnam); is8bit = 1; } - else if (!Bstrcasecmp(&filnam[i],".kvx")) { ret = loadkvx(filnam); is8bit = 1; } - else if (!Bstrcasecmp(&filnam[i],".kv6")) { ret = loadkv6(filnam); is8bit = 0; } - //else if (!Bstrcasecmp(&filnam[i],".vxl")) { ret = loadvxl(filnam); is8bit = 0; } - else return(0); - if (ret >= 0) vm = vox2poly(); else vm = 0; - if (vm) - { - vm->mdnum = 1; //VOXel model id - vm->scale = vm->bscale = 1.0; - vm->xsiz = xsiz; vm->ysiz = ysiz; vm->zsiz = zsiz; - vm->xpiv = xpiv; vm->ypiv = ypiv; vm->zpiv = zpiv; - vm->is8bit = is8bit; - - vm->texid = (uint32_t *)Bcalloc(MAXPALOOKUPS,sizeof(uint32_t)); - if (!vm->texid) { voxfree(vm); vm = 0; } - } - if (shcntmal) { Bfree(shcntmal); shcntmal = 0; } - if (vbit) { Bfree(vbit); vbit = 0; } - if (vcol) { Bfree(vcol); vcol = 0; vnum = 0; vmax = 0; } - if (vcolhashead) { Bfree(vcolhashead); vcolhashead = 0; } - return(vm); -} - -//Draw voxel model as perfect cubes -int32_t voxdraw(voxmodel_t *m, spritetype *tspr) -{ - point3d fp, m0, a0; - int32_t i, j, fi, xx, yy, zz; - float ru, rv, phack[2], clut[6] = {1,1,1,1,1,1}; //1.02,1.02,0.94,1.06,0.98,0.98}; - float f, g, k0, k1, k2, k3, k4, k5, k6, k7, mat[16], omat[16], pc[4]; - vert_t *vptr; - - if ((intptr_t)m == (intptr_t)(-1)) // hackhackhack - return 0; - if ((tspr->cstat&48)==32) return 0; - - //updateanimation((md2model *)m,tspr); - - m0.x = m->scale; - m0.y = m->scale; - m0.z = m->scale; - a0.x = a0.y = 0; a0.z = ((globalorientation&8)?-m->zadd:m->zadd)*m->scale; - - //if (globalorientation&8) //y-flipping - //{ - // m0.z = -m0.z; a0.z = -a0.z; - // //Add height of 1st frame (use same frame to prevent animation bounce) - // a0.z += m->zsiz*m->scale; - //} - //if (globalorientation&4) { m0.y = -m0.y; a0.y = -a0.y; } //x-flipping - - f = ((float)tspr->xrepeat)*(256.0/320.0)/64.0*m->bscale; - m0.x *= f; a0.x *= f; f = -f; - m0.y *= f; a0.y *= f; - f = ((float)tspr->yrepeat)/64.0*m->bscale; - m0.z *= f; a0.z *= f; - - k0 = (float)tspr->z; - if (globalorientation&128) k0 += (float)((tilesizy[tspr->picnum]*tspr->yrepeat)<<1); - - f = (65536.0*512.0)/((float)xdimen*viewingrange); - g = 32.0/((float)xdimen*gxyaspect); - m0.y *= f; a0.y = (((float)(tspr->x-globalposx))/ 1024.0 + a0.y)*f; - m0.x *=-f; a0.x = (((float)(tspr->y-globalposy))/ -1024.0 + a0.x)*-f; - m0.z *= g; a0.z = (((float)(k0 -globalposz))/-16384.0 + a0.z)*g; - - k0 = ((float)(tspr->x-globalposx))*f/1024.0; - k1 = ((float)(tspr->y-globalposy))*f/1024.0; - f = gcosang2*gshang; - g = gsinang2*gshang; - k4 = (float)sintable[(tspr->ang+spriteext[tspr->owner].angoff+1024)&2047] / 16384.0; - k5 = (float)sintable[(tspr->ang+spriteext[tspr->owner].angoff+ 512)&2047] / 16384.0; - k2 = k0*(1-k4)+k1*k5; - k3 = k1*(1-k4)-k0*k5; - k6 = f*gstang - gsinang*gctang; k7 = g*gstang + gcosang*gctang; - mat[0] = k4*k6 + k5*k7; mat[4] = gchang*gstang; mat[ 8] = k4*k7 - k5*k6; mat[12] = k2*k6 + k3*k7; - k6 = f*gctang + gsinang*gstang; k7 = g*gctang - gcosang*gstang; - mat[1] = k4*k6 + k5*k7; mat[5] = gchang*gctang; mat[ 9] = k4*k7 - k5*k6; mat[13] = k2*k6 + k3*k7; - k6 = gcosang2*gchang; k7 = gsinang2*gchang; - mat[2] = k4*k6 + k5*k7; mat[6] =-gshang; mat[10] = k4*k7 - k5*k6; mat[14] = k2*k6 + k3*k7; - - mat[12] += a0.y*mat[0] + a0.z*mat[4] + a0.x*mat[ 8]; - mat[13] += a0.y*mat[1] + a0.z*mat[5] + a0.x*mat[ 9]; - mat[14] += a0.y*mat[2] + a0.z*mat[6] + a0.x*mat[10]; - - //Mirrors - if (grhalfxdown10x < 0) { mat[0] = -mat[0]; mat[4] = -mat[4]; mat[8] = -mat[8]; mat[12] = -mat[12]; } - - //------------ - //bit 10 is an ugly hack in game.c\animatesprites telling MD2SPRITE - //to use Z-buffer hacks to hide overdraw problems with the shadows - if (tspr->cstat&1024) - { - bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS - bglDepthRange(0.0,0.9999); - } - bglPushAttrib(GL_POLYGON_BIT); - if ((grhalfxdown10x >= 0) /*^ ((globalorientation&8) != 0) ^ ((globalorientation&4) != 0)*/) bglFrontFace(GL_CW); else bglFrontFace(GL_CCW); - bglEnable(GL_CULL_FACE); - bglCullFace(GL_BACK); - - bglEnable(GL_TEXTURE_2D); - - pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups); - pc[0] *= (float)hictinting[globalpal].r / 255.0; - pc[1] *= (float)hictinting[globalpal].g / 255.0; - pc[2] *= (float)hictinting[globalpal].b / 255.0; - if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66f; else pc[3] = 0.33f; } - else pc[3] = 1.0; - if (tspr->cstat&2) bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); - //------------ - - //transform to Build coords - Bmemcpy(omat,mat,sizeof(omat)); - f = 1.f/64.f; - g = m0.x*f; mat[0] *= g; mat[1] *= g; mat[2] *= g; - g = m0.y*f; mat[4] = omat[8]*g; mat[5] = omat[9]*g; mat[6] = omat[10]*g; - g =-m0.z*f; mat[8] = omat[4]*g; mat[9] = omat[5]*g; mat[10] = omat[6]*g; - mat[12] -= (m->xpiv*mat[0] + m->ypiv*mat[4] + (m->zpiv+m->zsiz*.5)*mat[ 8]); - mat[13] -= (m->xpiv*mat[1] + m->ypiv*mat[5] + (m->zpiv+m->zsiz*.5)*mat[ 9]); - mat[14] -= (m->xpiv*mat[2] + m->ypiv*mat[6] + (m->zpiv+m->zsiz*.5)*mat[10]); - bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation - mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; - - bglLoadMatrixf(mat); - - ru = 1.f/((float)m->mytexx); - rv = 1.f/((float)m->mytexy); -#if (VOXBORDWIDTH == 0) - uhack[0] = ru*.125; uhack[1] = -uhack[0]; - vhack[0] = rv*.125; vhack[1] = -vhack[0]; -#endif - phack[0] = 0; phack[1] = 1.f/256.f; - - if (!m->texid[globalpal]) m->texid[globalpal] = gloadtex(m->mytex,m->mytexx,m->mytexy,m->is8bit,globalpal); - else bglBindTexture(GL_TEXTURE_2D,m->texid[globalpal]); - bglBegin(GL_QUADS); - for (i=0,fi=0; iqcnt; i++) - { - if (i == m->qfacind[fi]) { f = clut[fi++]; bglColor4f(pc[0]*f,pc[1]*f,pc[2]*f,pc[3]*f); } - vptr = &m->quad[i].v[0]; - - xx = vptr[0].x+vptr[2].x; - yy = vptr[0].y+vptr[2].y; - zz = vptr[0].z+vptr[2].z; - - for (j=0; j<4; j++) - { -#if (VOXBORDWIDTH == 0) - bglTexCoord2f(((float)vptr[j].u)*ru+uhack[vptr[j].u!=vptr[0].u], - ((float)vptr[j].v)*rv+vhack[vptr[j].v!=vptr[0].v]); -#else - bglTexCoord2f(((float)vptr[j].u)*ru,((float)vptr[j].v)*rv); -#endif - fp.x = ((float)vptr[j].x) - phack[xx>vptr[j].x*2] + phack[xxvptr[j].y*2] + phack[yyvptr[j].z*2] + phack[zzcstat&1024) - { - bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS - bglDepthRange(0.0,0.99999); - } - bglLoadIdentity(); - return 1; -} - -//---------------------------------------- VOX LIBRARY ENDS ---------------------------------------- -//--------------------------------------- MD LIBRARY BEGINS --------------------------------------- - -mdmodel_t *mdload(const char *filnam) -{ - mdmodel_t *vm; - int32_t fil; - int32_t i; - - vm = (mdmodel_t *)voxload(filnam); if (vm) return(vm); - - fil = kopen4load((char *)filnam,0); if (fil < 0) return(0); - kread(fil,&i,4); klseek(fil,0,SEEK_SET); - - switch (B_LITTLE32(i)) - { - case 0x32504449: -// initprintf("Warning: model '%s' is version IDP2; wanted version IDP3\n",filnam); - vm = (mdmodel_t *)md2load(fil,filnam); - break; //IDP2 - case 0x33504449: - vm = (mdmodel_t *)md3load(fil); - break; //IDP3 - default: - vm = (mdmodel_t *)0; break; - } - kclose(fil); - - if (vm) - { - md3postload_common((md3model_t *)vm); -#ifdef POLYMER -// implies defined(POLYMOST) && defined(USE_OPENGL)? - if (glrendmode==4) - i = md3postload_polymer((md3model_t *)vm); - else - i = md3postload_polymer_check((md3model_t *)vm); - - if (!i) - { - mdfree(vm); - vm = (mdmodel_t *)0; - } -#endif - } - - return(vm); -} - -int32_t mddraw(spritetype *tspr) -{ - mdmodel_t *vm; - int32_t i; - - if (r_vbos && (r_vbocount > allocvbos)) - { - indexvbos = Brealloc(indexvbos, sizeof(GLuint) * r_vbocount); - vertvbos = Brealloc(vertvbos, sizeof(GLuint) * r_vbocount); - - bglGenBuffersARB(r_vbocount - allocvbos, &(indexvbos[allocvbos])); - bglGenBuffersARB(r_vbocount - allocvbos, &(vertvbos[allocvbos])); - - i = allocvbos; - while (i < r_vbocount) - { - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[i]); - bglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, maxmodeltris * 3 * sizeof(uint16_t), NULL, GL_STREAM_DRAW_ARB); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, vertvbos[i]); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, maxmodelverts * sizeof(point3d), NULL, GL_STREAM_DRAW_ARB); - i++; - } - - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,0); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - - allocvbos = r_vbocount; - } - - if (maxmodelverts > allocmodelverts) - { - point3d *vl = (point3d *)Brealloc(vertlist,sizeof(point3d)*maxmodelverts); - if (!vl) { OSD_Printf("ERROR: Not enough memory to allocate %d vertices!\n",maxmodelverts); return 0; } - vertlist = vl; - allocmodelverts = maxmodelverts; - } - - vm = models[tile2model[Ptile2tile(tspr->picnum,(tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal)].modelid]; - if (vm->mdnum == 1) { return voxdraw((voxmodel_t *)vm,tspr); } - if (vm->mdnum == 3) { return md3draw((md3model_t *)vm,tspr); } - return 0; -} - -void mdfree(mdmodel_t *vm) -{ - if (vm->mdnum == 1) { voxfree((voxmodel_t *)vm); return; } - if (vm->mdnum == 2 || vm->mdnum == 3) { md3free((md3model_t *)vm); return; } -} - -#endif - -//---------------------------------------- MD LIBRARY ENDS ---------------------------------------- diff --git a/polymer-perf/eduke32/build/src/misc/buildres.rc b/polymer-perf/eduke32/build/src/misc/buildres.rc deleted file mode 100644 index 2caec07e1..000000000 --- a/polymer-perf/eduke32/build/src/misc/buildres.rc +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include "startwin.editor.h" - -RSRC_ICON ICON "rsrc/build_icon.ico" -RSRC_BMP BITMAP "rsrc/build.bmp" - -WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 -STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU -CAPTION "Startup" -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 - CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170 - CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14 - CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14 - - CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32 -END - -WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -CAPTION "Dialog" -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 - CONTROL "", IDC2DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56 - CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10 - CONTROL "&3D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 24, 50, 8 - CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 22, 80, 56 - CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8 -END - diff --git a/polymer-perf/eduke32/build/src/misc/enumdisplay.c b/polymer-perf/eduke32/build/src/misc/enumdisplay.c deleted file mode 100644 index 313839b9f..000000000 --- a/polymer-perf/eduke32/build/src/misc/enumdisplay.c +++ /dev/null @@ -1,156 +0,0 @@ -#include -#define WIN32_LEAN_AND_MEAN -#include -#include - -#define DEFAULT_OUTPUT_FILE "enumdisplay.txt" -char *outputfile = DEFAULT_OUTPUT_FILE; - -HMODULE hDDrawDLL = NULL; -LPDIRECTDRAW lpDD = NULL; -FILE *output = NULL; - -void usage(void) -{ - printf( - "enumdisplay by Jonathon Fowler (jonof@edgenetwork.org)\n" - "Options:\n" - " -h, -?, --help This message\n" - " -o Use different output file (default: " - DEFAULT_OUTPUT_FILE ", use - for stdout)\n" - ); -} - -void dumpdevmode(DEVMODE *devmode) -{ - fprintf(output, "\tdmFields has"); - if (devmode->dmFields & DM_PELSWIDTH) fprintf(output, " DM_PELSWIDTH"); - if (devmode->dmFields & DM_PELSHEIGHT) fprintf(output, " DM_PELSHEIGHT"); - if (devmode->dmFields & DM_BITSPERPEL) fprintf(output, " DM_BITSPERPEL"); - fprintf(output, "\n\tdmPelsWidth = %d\n", devmode->dmPelsWidth); - fprintf(output, "\tdmPelsHeight = %d\n", devmode->dmPelsHeight); - fprintf(output, "\tdmBitsPerPel = %d\n", devmode->dmBitsPerPel); -} - -HRESULT WINAPI ddenum(DDSURFACEDESC *ddsd, VOID *udata) -{ - fprintf(output, "\tdwFlags has"); - if (ddsd->dwFlags & DDSD_WIDTH) fprintf(output, " DDSD_WIDTH"); - if (ddsd->dwFlags & DDSD_HEIGHT) fprintf(output, " DDSD_HEIGHT"); - if (ddsd->dwFlags & DDSD_PIXELFORMAT) fprintf(output, " DDSD_PIXELFORMAT"); - fprintf(output, "\n\tdwWidth = %d\n", ddsd->dwWidth); - fprintf(output, "\tdwHeight = %d\n", ddsd->dwHeight); - fprintf(output, "\tddpfPixelFormat.dwFlags has"); - if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED1) fprintf(output, " DDPF_PALETTEINDEXED1"); - if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED2) fprintf(output, " DDPF_PALETTEINDEXED2"); - if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) fprintf(output, " DDPF_PALETTEINDEXED4"); - if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) fprintf(output, " DDPF_PALETTEINDEXED8"); - if (ddsd->ddpfPixelFormat.dwFlags & DDPF_RGB) fprintf(output, " DDPF_RGB"); - fprintf(output, "\n\tddpfPixelFormat.dwRGBBitCount = %d\n", ddsd->ddpfPixelFormat.dwRGBBitCount); - fprintf(output, "\n"); - - return(DDENUMRET_OK); -} - -int InitDirectDraw(void) -{ - HRESULT result; - HRESULT (WINAPI *aDirectDrawCreate)(GUID *, LPDIRECTDRAW *, IUnknown *); - HRESULT (WINAPI *aDirectDrawEnumerate)(LPDDENUMCALLBACK, LPVOID); - DDCAPS ddcaps; - - hDDrawDLL = LoadLibrary("DDRAW.DLL"); - if (!hDDrawDLL) { fprintf(output, "Failed loading DDRAW.DLL\n"); return -1; } - - aDirectDrawEnumerate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA"); - if (!aDirectDrawEnumerate) { fprintf(output, "Error fetching DirectDrawEnumerate\n"); return -1; } - - aDirectDrawCreate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawCreate"); - if (!aDirectDrawCreate) { fprintf(output, "Error fetching DirectDrawCreate\n"); return -1; } - - result = aDirectDrawCreate(NULL, &lpDD, NULL); - if (result != DD_OK) { fprintf(output, "DirectDrawCreate() failed (%d)\n", result); return -1; } - - return 0; -} - -void UninitDirectDraw(void) -{ - if (lpDD) IDirectDraw_Release(lpDD); - lpDD = NULL; - if (hDDrawDLL) FreeLibrary(hDDrawDLL); - hDDrawDLL = NULL; -} - -int main(int argc, char **argv) -{ - int i; - - DEVMODE devmode; - HRESULT hresult; - - for (i=1; i -#include -#include "startwin.game.h" - -RSRC_ICON ICON "rsrc/game_icon.ico" -RSRC_BMP BITMAP "rsrc/game.bmp" - -WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 -STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU -CAPTION "Startup" -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 - CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170 - CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14 - CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14 - - CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32 -END - -WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD -CAPTION "Dialog" -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 - CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56 - CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10 - CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8 -END - diff --git a/polymer-perf/eduke32/build/src/misc/getdxdidf.c b/polymer-perf/eduke32/build/src/misc/getdxdidf.c deleted file mode 100644 index f0c7675c6..000000000 --- a/polymer-perf/eduke32/build/src/misc/getdxdidf.c +++ /dev/null @@ -1,129 +0,0 @@ -// compile with: -// gcc -o getdxdidf.exe src\getdxdidf.c -Ic:\mingw32\dx6\include -Lc:\mingw32\dx6\lib -ldxguid -ldinput -mwindows - -#define WIN32_LEAN_AND_MEAN -#define INITGUID -#include -#include -#include - - -char *WhatGUID(const GUID *guid) -{ - if (guid == &GUID_XAxis) return "&GUID_XAxis"; - if (guid == &GUID_YAxis) return "&GUID_YAxis"; - if (guid == &GUID_ZAxis) return "&GUID_ZAxis"; - if (guid == &GUID_RxAxis) return "&GUID_RxAxis"; - if (guid == &GUID_RyAxis) return "&GUID_RyAxis"; - if (guid == &GUID_RzAxis) return "&GUID_RzAxis"; - if (guid == &GUID_Slider) return "&GUID_Slider"; - - if (guid == &GUID_Button) return "&GUID_Button"; - if (guid == &GUID_Key) return "&GUID_Key"; - - if (guid == &GUID_POV) return "&GUID_POV"; - - if (guid == &GUID_Unknown) return "&GUID_Unknown"; - - return "NULL"; -} - - - -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -{ - FILE *fp; - DWORD i; - - fp = fopen("didf.txt", "w"); - if (!fp) return -1; - setvbuf(fp, NULL, _IONBF, 0); - - - fprintf(fp, - "// Keyboard\n" - "\n" - "static DIOBJECTDATAFORMAT c_dfDIKeyboard_odf[] = {\n" - ); - - for (i=0; i - - - - - - True - Startup - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - False - False - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - - - - - True - False - 0 - - - - - 0 - False - False - - - - - - True - False - 0 - - - - 4 - True - True - True - True - GTK_POS_TOP - False - False - - - - True - False - 0 - - - - 6 - True - - - - 88 - 29 - True - _2D Video mode: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - vmode2dcombo - - - 0 - 0 - - - - - - 88 - 29 - True - _3D Video mode: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - vmode3dcombo - - - 0 - 32 - - - - - - 85 - 29 - True - True - _Fullscreen - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - - 248 - 0 - - - - - - 150 - 29 - True - - - - - - 96 - 0 - - - - - - 150 - 29 - True - - - - - 96 - 32 - - - - - 0 - True - True - - - - - - True - True - _Always show configuration on start - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - - 0 - False - False - - - - - False - True - - - - - - True - Configuration - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - False - 0 - 0 - 0 - 2 - 2 - 0 - - - - - - False - True - - - - - - True - Messages - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - 0 - True - True - - - - - - 3 - True - GTK_BUTTONBOX_END - 0 - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-cancel - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Cancel - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - - - - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-execute - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Start - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - - diff --git a/polymer-perf/eduke32/build/src/misc/gtkstartwin/gtkstartwin.gladep b/polymer-perf/eduke32/build/src/misc/gtkstartwin/gtkstartwin.gladep deleted file mode 100644 index e27cd5bd5..000000000 --- a/polymer-perf/eduke32/build/src/misc/gtkstartwin/gtkstartwin.gladep +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Gtkstartwin - gtkstartwin - FALSE - FALSE - FALSE - FALSE - diff --git a/polymer-perf/eduke32/build/src/misc/gtkstartwin/pixmaps/game.bmp b/polymer-perf/eduke32/build/src/misc/gtkstartwin/pixmaps/game.bmp deleted file mode 100644 index c079eef46..000000000 Binary files a/polymer-perf/eduke32/build/src/misc/gtkstartwin/pixmaps/game.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/build/src/misc/makesdlkeytrans.c b/polymer-perf/eduke32/build/src/misc/makesdlkeytrans.c deleted file mode 100644 index e34271078..000000000 --- a/polymer-perf/eduke32/build/src/misc/makesdlkeytrans.c +++ /dev/null @@ -1,163 +0,0 @@ -// gcc b.c -Lc:/mingw32/lib -lmingw32 -lSDLmain -lSDL - -#include -#include "SDL/SDL.h" - -int keytranslation[SDLK_LAST]; -char *keysyms[SDLK_LAST]; - -static int buildkeytranslationtable(void) -{ - memset(keytranslation,0,sizeof(keytranslation)); - memset(keysyms,0,sizeof(keysyms)); - -#define MAP(x,y) { \ - keytranslation[x] = y; \ - keysyms[x] = #x ; \ -} - MAP(SDLK_BACKSPACE, 0xe); - MAP(SDLK_TAB, 0xf); - MAP(SDLK_RETURN, 0x1c); - MAP(SDLK_PAUSE, 0x59); // 0x1d + 0x45 + 0x9d + 0xc5 - MAP(SDLK_ESCAPE, 0x1); - MAP(SDLK_SPACE, 0x39); - MAP(SDLK_EXCLAIM, 0x2); // '1' - MAP(SDLK_QUOTEDBL, 0x28); // ''' - MAP(SDLK_HASH, 0x4); // '3' - MAP(SDLK_DOLLAR, 0x5); // '4' - MAP(37, 0x6); // '5' <-- where's the keysym SDL guys? - MAP(SDLK_AMPERSAND, 0x8); // '7' - MAP(SDLK_QUOTE, 0x28); // ''' - MAP(SDLK_LEFTPAREN, 0xa); // '9' - MAP(SDLK_RIGHTPAREN, 0xb); // '0' - MAP(SDLK_ASTERISK, 0x9); // '8' - MAP(SDLK_PLUS, 0xd); // '=' - MAP(SDLK_COMMA, 0x33); - MAP(SDLK_MINUS, 0xc); - MAP(SDLK_PERIOD, 0x34); - MAP(SDLK_SLASH, 0x35); - MAP(SDLK_0, 0xb); - MAP(SDLK_1, 0x2); - MAP(SDLK_2, 0x3); - MAP(SDLK_3, 0x4); - MAP(SDLK_4, 0x5); - MAP(SDLK_5, 0x6); - MAP(SDLK_6, 0x7); - MAP(SDLK_7, 0x8); - MAP(SDLK_8, 0x9); - MAP(SDLK_9, 0xa); - MAP(SDLK_COLON, 0x27); - MAP(SDLK_SEMICOLON, 0x27); - MAP(SDLK_LESS, 0x33); - MAP(SDLK_EQUALS, 0xd); - MAP(SDLK_GREATER, 0x34); - MAP(SDLK_QUESTION, 0x35); - MAP(SDLK_AT, 0x3); // '2' - MAP(SDLK_LEFTBRACKET, 0x1a); - MAP(SDLK_BACKSLASH, 0x2b); - MAP(SDLK_RIGHTBRACKET, 0x1b); - MAP(SDLK_CARET, 0x7); // '7' - MAP(SDLK_UNDERSCORE, 0xc); - MAP(SDLK_BACKQUOTE, 0x29); - MAP(SDLK_a, 0x1e); - MAP(SDLK_b, 0x30); - MAP(SDLK_c, 0x2e); - MAP(SDLK_d, 0x20); - MAP(SDLK_e, 0x12); - MAP(SDLK_f, 0x21); - MAP(SDLK_g, 0x22); - MAP(SDLK_h, 0x23); - MAP(SDLK_i, 0x17); - MAP(SDLK_j, 0x24); - MAP(SDLK_k, 0x25); - MAP(SDLK_l, 0x26); - MAP(SDLK_m, 0x32); - MAP(SDLK_n, 0x31); - MAP(SDLK_o, 0x18); - MAP(SDLK_p, 0x19); - MAP(SDLK_q, 0x10); - MAP(SDLK_r, 0x13); - MAP(SDLK_s, 0x1f); - MAP(SDLK_t, 0x14); - MAP(SDLK_u, 0x16); - MAP(SDLK_v, 0x2f); - MAP(SDLK_w, 0x11); - MAP(SDLK_x, 0x2d); - MAP(SDLK_y, 0x15); - MAP(SDLK_z, 0x2c); - MAP(SDLK_DELETE, 0xd3); - MAP(SDLK_KP0, 0x52); - MAP(SDLK_KP1, 0x4f); - MAP(SDLK_KP2, 0x50); - MAP(SDLK_KP3, 0x51); - MAP(SDLK_KP4, 0x4b); - MAP(SDLK_KP5, 0x4c); - MAP(SDLK_KP6, 0x4d); - MAP(SDLK_KP7, 0x47); - MAP(SDLK_KP8, 0x48); - MAP(SDLK_KP9, 0x49); - MAP(SDLK_KP_PERIOD, 0x53); - MAP(SDLK_KP_DIVIDE, 0xb5); - MAP(SDLK_KP_MULTIPLY, 0x37); - MAP(SDLK_KP_MINUS, 0x4a); - MAP(SDLK_KP_PLUS, 0x4e); - MAP(SDLK_KP_ENTER, 0x9c); - //MAP(SDLK_KP_EQUALS, ); - MAP(SDLK_UP, 0xc8); - MAP(SDLK_DOWN, 0xd0); - MAP(SDLK_RIGHT, 0xcd); - MAP(SDLK_LEFT, 0xcb); - MAP(SDLK_INSERT, 0xd2); - MAP(SDLK_HOME, 0xc7); - MAP(SDLK_END, 0xcf); - MAP(SDLK_PAGEUP, 0xc9); - MAP(SDLK_PAGEDOWN, 0xd1); - MAP(SDLK_F1, 0x3b); - MAP(SDLK_F2, 0x3c); - MAP(SDLK_F3, 0x3d); - MAP(SDLK_F4, 0x3e); - MAP(SDLK_F5, 0x3f); - MAP(SDLK_F6, 0x40); - MAP(SDLK_F7, 0x41); - MAP(SDLK_F8, 0x42); - MAP(SDLK_F9, 0x43); - MAP(SDLK_F10, 0x44); - MAP(SDLK_F11, 0x57); - MAP(SDLK_F12, 0x58); - MAP(SDLK_NUMLOCK, 0x45); - MAP(SDLK_CAPSLOCK, 0x3a); - MAP(SDLK_SCROLLOCK, 0x46); - MAP(SDLK_RSHIFT, 0x36); - MAP(SDLK_LSHIFT, 0x2a); - MAP(SDLK_RCTRL, 0x9d); - MAP(SDLK_LCTRL, 0x1d); - MAP(SDLK_RALT, 0xb8); - MAP(SDLK_LALT, 0x38); - MAP(SDLK_LSUPER, 0xdb); // win l - MAP(SDLK_RSUPER, 0xdc); // win r - MAP(SDLK_PRINT, -2); // 0xaa + 0xb7 - MAP(SDLK_SYSREQ, 0x54); // alt+printscr - MAP(SDLK_BREAK, 0xb7); // ctrl+pause - MAP(SDLK_MENU, 0xdd); // win menu? -#undef MAP - - return 0; -} - -#undef main - -int main(int argc, char **argv) -{ - int i; - - buildkeytranslationtable(); - - for (i=0;i0) printf(", "); - if (i%8 == 7) printf("\n"); - printf("%d",keytranslation[i]); - } - - return 0; -} - diff --git a/polymer-perf/eduke32/build/src/mutex.c b/polymer-perf/eduke32/build/src/mutex.c deleted file mode 100644 index 6f7c78c3c..000000000 --- a/polymer-perf/eduke32/build/src/mutex.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "compat.h" -#include "mutex.h" - -int32_t mutex_init(mutex_t *mutex) -{ -#ifdef _WIN32 - *mutex = CreateMutex(0, FALSE, 0); - return (*mutex == 0); -#else - return pthread_mutex_init(mutex, NULL); -#endif - return -1; -} - -int32_t mutex_lock(mutex_t *mutex) -{ -#ifdef _WIN32 - return (WaitForSingleObject(*mutex, INFINITE) == WAIT_FAILED); -#else - return pthread_mutex_lock(mutex); -#endif - return -1; -} - -int32_t mutex_unlock(mutex_t *mutex) -{ -#ifdef _WIN32 - return (ReleaseMutex(*mutex) == 0); -#else - return pthread_mutex_unlock(mutex); -#endif - return -1; -} - - diff --git a/polymer-perf/eduke32/build/src/nedmalloc.c b/polymer-perf/eduke32/build/src/nedmalloc.c deleted file mode 100644 index 68ab11a85..000000000 --- a/polymer-perf/eduke32/build/src/nedmalloc.c +++ /dev/null @@ -1,1603 +0,0 @@ -/* Alternative malloc implementation for multiple threads without -lock contention based on dlmalloc. (C) 2005-2009 Niall Douglas - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -*/ - -#include "compat.h" - -#ifdef _MSC_VER -/* Enable full aliasing on MSVC */ -/*#pragma optimize("a", on)*/ -#pragma warning(push) -#pragma warning(disable:4100) /* unreferenced formal parameter */ -#pragma warning(disable:4127) /* conditional expression is constant */ -#pragma warning(disable:4232) /* address of dllimport is not static, identity not guaranteed */ -#pragma warning(disable:4706) /* assignment within conditional expression */ -#endif - -/*#define ENABLE_TOLERANT_NEDMALLOC 1*/ -/*#define ENABLE_FAST_HEAP_DETECTION 1*/ -/*#define NEDMALLOC_DEBUG 1*/ - -/*#define FULLSANITYCHECKS*/ -/* If link time code generation is on, don't force or prevent inlining */ -#if defined(_MSC_VER) && defined(NEDMALLOC_DLL_EXPORTS) -// #define FORCEINLINE -// #define NOINLINE -#endif - -#include "nedmalloc.h" -#if defined(_WIN32) -#include -#endif -#if defined(__linux__) || defined(__FreeBSD__) -/* Sadly we can't include as it causes a redefinition error */ -extern size_t malloc_usable_size(void *); -#endif -#if defined(__APPLE__) -/* PK: for malloc_size(): */ -#include -#endif -#if USE_ALLOCATOR==1 -#define MSPACES 1 -#define ONLY_MSPACES 1 -#endif -#define USE_DL_PREFIX 1 -#ifndef USE_LOCKS -#define USE_LOCKS 1 -#endif -#define FOOTERS 1 /* Need to enable footers so frees lock the right mspace */ -#ifndef NEDMALLOC_DEBUG -#if defined(DEBUG) || defined(_DEBUG) -#define NEDMALLOC_DEBUG 1 -#else -#define NEDMALLOC_DEBUG 0 -#endif -#endif -/* We need to consistently define DEBUG=0|1, _DEBUG and NDEBUG for dlmalloc */ -#undef DEBUG -#undef _DEBUG -#if NEDMALLOC_DEBUG -#define _DEBUG -#define DEBUG 1 -#else -#define DEBUG 0 -#endif -#ifdef NDEBUG /* Disable assert checking on release builds */ -#undef DEBUG -#undef _DEBUG -#endif -/* The default of 64Kb means we spend too much time kernel-side */ -#ifndef DEFAULT_GRANULARITY -#define DEFAULT_GRANULARITY (1*1024*1024) -#if DEBUG -#define DEFAULT_GRANULARITY_ALIGNED -#endif -#endif -/*#define USE_SPIN_LOCKS 0*/ - - -#include "malloc.c.h" -#ifdef NDEBUG /* Disable assert checking on release builds */ -#undef DEBUG -#elif !NEDMALLOC_DEBUG -#ifdef __GNUC__ -#warning DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed. -#elif defined(_MSC_VER) -#pragma message(__FILE__ ": WARNING: DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.") -#endif -#endif - -/* The maximum concurrent threads in a pool possible */ -#ifndef MAXTHREADSINPOOL -#define MAXTHREADSINPOOL 16 -#endif -/* The maximum number of threadcaches which can be allocated */ -#ifndef THREADCACHEMAXCACHES -#define THREADCACHEMAXCACHES 256 -#endif -/* The maximum size to be allocated from the thread cache */ -#ifndef THREADCACHEMAX -#define THREADCACHEMAX 8192 -#elif THREADCACHEMAX && !defined(THREADCACHEMAXBINS) -#ifdef __GNUC__ -#warning If you are changing THREADCACHEMAX, do you also need to change THREADCACHEMAXBINS=(topbitpos(THREADCACHEMAX)-4)? -#elif defined(_MSC_VER) -#pragma message(__FILE__ ": WARNING: If you are changing THREADCACHEMAX, do you also need to change THREADCACHEMAXBINS=(topbitpos(THREADCACHEMAX)-4)?") -#endif -#endif -#ifndef THREADCACHEMAXBINS -#ifdef FINEGRAINEDBINS -/* The number of cache entries for finer grained bins. This is (topbitpos(THREADCACHEMAX)-4)*2 */ -#define THREADCACHEMAXBINS ((13-4)*2) -#else -/* The number of cache entries. This is (topbitpos(THREADCACHEMAX)-4) */ -#define THREADCACHEMAXBINS (13-4) -#endif -#endif -/* Point at which the free space in a thread cache is garbage collected */ -#ifndef THREADCACHEMAXFREESPACE -#define THREADCACHEMAXFREESPACE (512*1024) -#endif - - -#if USE_LOCKS -#ifdef WIN32 -#define TLSVAR DWORD -#define TLSALLOC(k) (*(k)=TlsAlloc(), TLS_OUT_OF_INDEXES==*(k)) -#define TLSFREE(k) (!TlsFree(k)) -#define TLSGET(k) TlsGetValue(k) -#define TLSSET(k, a) (!TlsSetValue(k, a)) -#ifdef DEBUG -static LPVOID ChkedTlsGetValue(DWORD idx) -{ - LPVOID ret=TlsGetValue(idx); - assert(S_OK==GetLastError()); - return ret; -} -#undef TLSGET -#define TLSGET(k) ChkedTlsGetValue(k) -#endif -#else -#define TLSVAR pthread_key_t -#define TLSALLOC(k) pthread_key_create(k, 0) -#define TLSFREE(k) pthread_key_delete(k) -#define TLSGET(k) pthread_getspecific(k) -#define TLSSET(k, a) pthread_setspecific(k, a) -#endif -#else /* Probably if you're not using locks then you don't want ANY pthread stuff at all */ -#define TLSVAR void * -#define TLSALLOC(k) (*k=0) -#define TLSFREE(k) (k=0) -#define TLSGET(k) k -#define TLSSET(k, a) (k=a, 0) -#endif - -#if defined(__cplusplus) -#if !defined(NO_NED_NAMESPACE) -namespace nedalloc -{ -#else -extern "C" { -#endif -#endif - -#if USE_ALLOCATOR==0 -static void *unsupported_operation(const char *opname) THROWSPEC -{ - fprintf(stderr, "nedmalloc: The operation %s is not supported under this build configuration\n", opname); - abort(); - return 0; -} -static size_t mspacecounter=(size_t) 0xdeadbeef; -#endif -#ifndef ENABLE_FAST_HEAP_DETECTION -static void *RESTRICT leastusedaddress; -static size_t largestusedblock; -#endif -/* Used to redirect system allocator ops if needed */ -extern void *(*sysmalloc)(size_t); -extern void *(*syscalloc)(size_t, size_t); -extern void *(*sysrealloc)(void *, size_t); -extern void (*sysfree)(void *); -extern size_t (*sysblksize)(void *); - -void *(*sysmalloc)(size_t)=malloc; -void *(*syscalloc)(size_t, size_t)=calloc; -void *(*sysrealloc)(void *, size_t)=realloc; -void (*sysfree)(void *)=free; -size_t (*sysblksize)(void *)= -#ifdef WIN32 - /* This is the MSVCRT equivalent */ - _msize; -#elif defined(__linux__) || defined(__FreeBSD__) - /* This is the glibc/ptmalloc2/dlmalloc equivalent. */ - malloc_usable_size; -#elif defined(__APPLE__) - /* This is the BSD libc equivalent. */ - malloc_size; -#else -#error Cannot tolerate the memory allocator of an unknown system! -#endif - -static FORCEINLINE NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *CallMalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC -{ - void *RESTRICT ret=0; - size_t _alignment=alignment; -#if USE_MAGIC_HEADERS - size_t *_ret=0; - size+=alignment+3*sizeof(size_t); - _alignment=0; -#endif -#if USE_ALLOCATOR==0 - ret=sysmalloc(size); /* magic headers takes care of alignment */ -#elif USE_ALLOCATOR==1 - ret=_alignment ? mspace_memalign((mstate) mspace, _alignment, size) : mspace_malloc((mstate) mspace, size); -#ifndef ENABLE_FAST_HEAP_DETECTION - if (ret) - { - size_t truesize=chunksize(mem2chunk(ret)); - if (!leastusedaddress || (void *)((mstate) mspace)->least_addrleast_addr; - if (!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1); - } -#endif -#endif - if (!ret) return 0; -#if USE_MAGIC_HEADERS - _ret=(size_t *) ret; - ret=(void *)(_ret+3); - if (alignment) ret=(void *)(((size_t) ret+alignment-1)&~(alignment-1)); - for (; _ret<(size_t *)ret-2; _ret++) *_ret=*(size_t *)"NEDMALOC"; - _ret[0]=(size_t) mspace; - _ret[1]=size-3*sizeof(size_t); -#endif - return ret; -} - -static FORCEINLINE NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *CallCalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC -{ - void *RESTRICT ret=0; -#if USE_MAGIC_HEADERS - size_t *_ret=0; - size+=alignment+3*sizeof(size_t); -#endif -#if USE_ALLOCATOR==0 - ret=syscalloc(1, size); -#elif USE_ALLOCATOR==1 - ret=mspace_calloc((mstate) mspace, 1, size); -#ifndef ENABLE_FAST_HEAP_DETECTION - if (ret) - { - size_t truesize=chunksize(mem2chunk(ret)); - if (!leastusedaddress || (void *)((mstate) mspace)->least_addrleast_addr; - if (!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1); - } -#endif -#endif - if (!ret) return 0; -#if USE_MAGIC_HEADERS - _ret=(size_t *) ret; - ret=(void *)(_ret+3); - if (alignment) ret=(void *)(((size_t) ret+alignment-1)&~(alignment-1)); - for (; _ret<(size_t *)ret-2; _ret++) *_ret=*(size_t *) "NEDMALOC"; - _ret[0]=(size_t) mspace; - _ret[1]=size-3*sizeof(size_t); -#endif - return ret; -} - -static FORCEINLINE NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *CallRealloc(void *RESTRICT mspace, void *RESTRICT mem, int isforeign, size_t oldsize, size_t newsize) THROWSPEC -{ - void *RESTRICT ret=0; -#if USE_MAGIC_HEADERS - mstate oldmspace=0; - size_t *_ret=0, *_mem=(size_t *) mem-3; -#endif - if (isforeign) - { - /* Transfer */ -#if USE_MAGIC_HEADERS - assert(_mem[0]!=*(size_t *) "NEDMALOC"); -#endif - if ((ret=CallMalloc(mspace, newsize, 0))) - { -#if defined(DEBUG) - printf("*** nedmalloc frees system allocated block %p\n", mem); -#endif - memcpy(ret, mem, oldsize=_mem[2]); - for (; *_mem==*(size_t *) "NEDMALOC"; *_mem--=*(size_t *) "nedmaloc"); - mem=(void *)(++_mem); -#endif -#if USE_ALLOCATOR==0 - ret=sysrealloc(mem, newsize); -#elif USE_ALLOCATOR==1 - ret=mspace_realloc((mstate) mspace, mem, newsize); -#ifndef ENABLE_FAST_HEAP_DETECTION - if (ret) - { - size_t truesize=chunksize(mem2chunk(ret)); - if (!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1); - } -#endif -#endif - if (!ret) - { - /* Put it back the way it was */ -#if USE_MAGIC_HEADERS - for (; *_mem==0; *_mem++=*(size_t *) "NEDMALOC"); -#endif - return 0; - } -#if USE_MAGIC_HEADERS - _ret=(size_t *) ret; - ret=(void *)(_ret+3); - for (; _ret<(size_t *)ret-2; _ret++) *_ret=*(size_t *) "NEDMALOC"; - _ret[0]=(size_t) mspace; - _ret[1]=newsize-3*sizeof(size_t); -#endif - return ret; -} - -static FORCEINLINE void CallFree(void *RESTRICT mspace, void *RESTRICT mem, int isforeign) THROWSPEC -{ -#if USE_MAGIC_HEADERS - mstate oldmspace=0; - size_t *_mem=(size_t *) mem-3, oldsize=0; -#endif - if (isforeign) - { -#if USE_MAGIC_HEADERS - assert(_mem[0]!=*(size_t *) "NEDMALOC"); -#endif -#if defined(DEBUG) - printf("*** nedmalloc frees system allocated block %p\n", mem); -#endif - sysfree(mem); - return; - } -#if USE_MAGIC_HEADERS - assert(_mem[0]==*(size_t *) "NEDMALOC"); - oldmspace=(mstate) _mem[1]; - oldsize=_mem[2]; - for (; *_mem==*(size_t *) "NEDMALOC"; *_mem--=*(size_t *) "nedmaloc"); - mem=(void *)(++_mem); -#endif -#if USE_ALLOCATOR==0 - sysfree(mem); -#elif USE_ALLOCATOR==1 - mspace_free((mstate) mspace, mem); -#endif -} - -static NEDMALLOCNOALIASATTR mstate nedblkmstate(void *RESTRICT mem) THROWSPEC -{ - if (mem) - { -#if USE_MAGIC_HEADERS - size_t *_mem=(size_t *) mem-3; - if (_mem[0]==*(size_t *) "NEDMALOC") - { - return (mstate) _mem[1]; - } - else return 0; -#else -#if USE_ALLOCATOR==0 - /* Fail everything */ - return 0; -#elif USE_ALLOCATOR==1 -#ifdef ENABLE_FAST_HEAP_DETECTION -#ifdef WIN32 - /* On Windows for RELEASE both x86 and x64 the NT heap precedes each block with an eight byte header - which looks like: - normal: 4 bytes of size, 4 bytes of [char < 64, char < 64, char < 64 bit 0 always set, char random ] - mmaped: 4 bytes of size 4 bytes of [zero, zero, 0xb, zero ] - - On Windows for DEBUG both x86 and x64 the preceding four bytes is always 0xfdfdfdfd (no man's land). - */ -#pragma pack(push, 1) - struct _HEAP_ENTRY - { - USHORT Size; - USHORT PreviousSize; - UCHAR Cookie; /* SegmentIndex */ - UCHAR Flags; /* always bit 0 (HEAP_ENTRY_BUSY). bit 1=(HEAP_ENTRY_EXTRA_PRESENT), bit 2=normal block (HEAP_ENTRY_FILL_PATTERN), bit 3=mmap block (HEAP_ENTRY_VIRTUAL_ALLOC). Bit 4 (HEAP_ENTRY_LAST_ENTRY) could be set */ - UCHAR UnusedBytes; - UCHAR SmallTagIndex; /* fastbin index. Always one of 0x02, 0x03, 0x04 < 0x80 */ - } *RESTRICT he=((struct _HEAP_ENTRY *) mem)-1; -#pragma pack(pop) - unsigned int header=((unsigned int *)mem)[-1], mask1=0x8080E100, result1, mask2=0xFFFFFF06, result2; - result1=header & mask1; /* Positive testing for NT heap */ - result2=header & mask2; /* Positive testing for dlmalloc */ - if (result1==0x00000100 && result2!=0x00000102) - { - /* This is likely a NT heap block */ - return 0; - } -#endif -#ifdef __linux__ - /* On Linux glibc uses ptmalloc2 (really dlmalloc) just as we do, but prev_foot contains rubbish - when the preceding block is allocated because ptmalloc2 finds the local mstate by rounding the ptr - down to the nearest megabyte. It's like dlmalloc with FOOTERS disabled. */ - mchunkptr p=mem2chunk(mem); - mstate fm=get_mstate_for(p); - /* If it's a ptmalloc2 block, fm is likely to be some crazy value */ - if (!is_aligned(fm)) return 0; - if ((size_t)mem-(size_t)fm>=(size_t)1<<(SIZE_T_BITSIZE-1)) return 0; - if (ok_magic(fm)) - return fm; - else - return 0; - if (1) { } -#endif - else - { - mchunkptr p=mem2chunk(mem); - mstate fm=get_mstate_for(p); - assert(ok_magic(fm)); /* If this fails, someone tried to free a block twice */ - if (ok_magic(fm)) - return fm; - } -#else -#ifdef WIN32 -#ifdef _MSC_VER - __try -#elif defined(__MINGW32__) - __try1 -#endif -#endif - { - /* We try to return zero here if it isn't one of our own blocks, however - the current block annotation scheme used by dlmalloc makes it impossible - to be absolutely sure of avoiding a segfault. - - mchunkptr->prev_foot = mem-(2*size_t) = mstate ^ mparams.magic for PRECEDING block; - mchunkptr->head = mem-(1*size_t) = 8 multiple size of this block with bottom three bits = FLAG_BITS - FLAG_BITS = bit 0 is CINUSE (currently in use unless is mmap), bit 1 is PINUSE (previous block currently - in use unless mmap), bit 2 is UNUSED and currently is always zero. - */ - register void *RESTRICT leastusedaddress_=leastusedaddress; /* Cache these to avoid register reloading */ - register size_t largestusedblock_=largestusedblock; - if (!is_aligned(mem)) return 0; /* Would fail very rarely as all allocators return aligned blocks */ - if (memhead &FLAG4_BIT)) return 0; - /* Reduced uncertainty by 0.5^2 = 25.0% */ - /* size should never exceed largestusedblock */ - if (chunksize(p)>largestusedblock_) return 0; - /* Reduced uncertainty by a minimum of 0.5^3 = 12.5%, maximum 0.5^16 = 0.0015% */ - /* Having sanity checked prev_foot and head, check next block */ - if (!ismmapped && (!next_pinuse(p) || (next_chunk(p)->head &FLAG4_BIT))) return 0; - /* Reduced uncertainty by 0.5^5 = 3.13% or 0.5^18 = 0.00038% */ -#if 0 - /* If previous block is free, check that its next block pointer equals us */ - if (!ismmapped && !pinuse(p)) - if (next_chunk(prev_chunk(p))!=p) return 0; - /* We could start comparing prev_foot's for similarity but it starts getting slow. */ -#endif - fm = get_mstate_for(p); - if (!is_aligned(fm) || (void *)fm=(size_t)1<<(SIZE_T_BITSIZE-1)) return 0; - assert(ok_magic(fm)); /* If this fails, someone tried to free a block twice */ - if (ok_magic(fm)) - return fm; - } - } -#ifdef WIN32 -#ifdef _MSC_VER - __except(1) { } -#elif defined(__MINGW32__) - __except1(1) { } -#endif -#endif -#endif -#endif -#endif - } - return 0; -} -NEDMALLOCNOALIASATTR size_t nedblksize(int *RESTRICT isforeign, void *RESTRICT mem) THROWSPEC -{ - if (mem) - { - if (isforeign) *isforeign=1; -#if USE_MAGIC_HEADERS - { - size_t *_mem=(size_t *) mem-3; - if (_mem[0]==*(size_t *) "NEDMALOC") - { - //mstate mspace=(mstate) _mem[1]; - size_t size=_mem[2]; - if (isforeign) *isforeign=0; - return size; - } - } -#elif USE_ALLOCATOR==1 - if (nedblkmstate(mem)) - { - mchunkptr p=mem2chunk(mem); - if (isforeign) *isforeign=0; - return chunksize(p)-overhead_for(p); - } -#ifdef DEBUG - else - { - int a=1; /* Set breakpoints here if needed */ - } -#endif -#endif -#if defined(ENABLE_TOLERANT_NEDMALLOC) || USE_ALLOCATOR==0 - return sysblksize(mem); -#endif - } - return 0; -} - -NEDMALLOCNOALIASATTR void nedsetvalue(void *v) THROWSPEC { nedpsetvalue((nedpool *) 0, v); } -NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *nedmalloc(size_t size) THROWSPEC { return nedpmalloc((nedpool *) 0, size); } -NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *nedcalloc(size_t no, size_t size) THROWSPEC { return nedpcalloc((nedpool *) 0, no, size); } -NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *nedrealloc(void *mem, size_t size) THROWSPEC { return nedprealloc((nedpool *) 0, mem, size); } -NEDMALLOCNOALIASATTR void nedfree(void *mem) THROWSPEC { nedpfree((nedpool *) 0, mem); } -NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *nedmemalign(size_t alignment, size_t bytes) THROWSPEC { return nedpmemalign((nedpool *) 0, alignment, bytes); } -NEDMALLOCNOALIASATTR struct nedmallinfo nedmallinfo(void) THROWSPEC { return nedpmallinfo((nedpool *) 0); } -NEDMALLOCNOALIASATTR int nedmallopt(int parno, int value) THROWSPEC { return nedpmallopt((nedpool *) 0, parno, value); } -NEDMALLOCNOALIASATTR int nedmalloc_trim(size_t pad) THROWSPEC { return nedpmalloc_trim((nedpool *) 0, pad); } -void nedmalloc_stats() THROWSPEC { nedpmalloc_stats((nedpool *) 0); } -NEDMALLOCNOALIASATTR size_t nedmalloc_footprint() THROWSPEC { return nedpmalloc_footprint((nedpool *) 0); } -NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC { return nedpindependent_calloc((nedpool *) 0, elemsno, elemsize, chunks); } -NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC { return nedpindependent_comalloc((nedpool *) 0, elems, sizes, chunks); } - -struct threadcacheblk_t; -typedef struct threadcacheblk_t threadcacheblk; -struct threadcacheblk_t -{ - /* Keep less than 16 bytes on 32 bit systems and 32 bytes on 64 bit systems */ -#ifdef FULLSANITYCHECKS - unsigned int magic; -#endif - unsigned int lastUsed, size; - threadcacheblk *next, *prev; -}; -typedef struct threadcache_t -{ -#ifdef FULLSANITYCHECKS - unsigned int magic1; -#endif - int mymspace; /* Last mspace entry this thread used */ - long threadid; - unsigned int mallocs, frees, successes; - size_t freeInCache; /* How much free space is stored in this cache */ - threadcacheblk *bins[(THREADCACHEMAXBINS+1)*2]; -#ifdef FULLSANITYCHECKS - unsigned int magic2; -#endif -} threadcache; -struct nedpool_t -{ -#if USE_LOCKS - MLOCK_T mutex; -#endif - void *uservalue; - int threads; /* Max entries in m to use */ - threadcache *caches[THREADCACHEMAXCACHES]; - TLSVAR mycache; /* Thread cache for this thread. 0 for unset, negative for use mspace-1 directly, otherwise is cache-1 */ - mstate m[MAXTHREADSINPOOL+1]; /* mspace entries for this pool */ -}; -static nedpool syspool; - -static FORCEINLINE NEDMALLOCNOALIASATTR unsigned int size2binidx(size_t _size) THROWSPEC -{ - /* 8=1000 16=10000 20=10100 24=11000 32=100000 48=110000 4096=1000000000000 */ - unsigned int topbit, size=(unsigned int)(_size>>4); - /* 16=1 20=1 24=1 32=10 48=11 64=100 96=110 128=1000 4096=100000000 */ - -#if defined(__GNUC__) - topbit = sizeof(size)*__CHAR_BIT__ - 1 - __builtin_clz(size); -#elif defined(_MSC_VER) && _MSC_VER>=1300 - { - unsigned long bsrTopBit; - - _BitScanReverse(&bsrTopBit, size); - - topbit = bsrTopBit; - } -#else -#if 0 - union { - unsigned asInt[2]; - double asDouble; - }; - int n; - - asDouble = (double)size + 0.5; - topbit = (asInt[!FOX_BIGENDIAN] >> 20) - 1023; -#else - { - unsigned int x=size; - x = x | (x >> 1); - x = x | (x >> 2); - x = x | (x >> 4); - x = x | (x >> 8); - x = x | (x >>16); - x = ~x; - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0F0F0F0F; - x = x + (x << 8); - x = x + (x << 16); - topbit=31 - (x >> 24); - } -#endif -#endif - return topbit; -} - - -#ifdef FULLSANITYCHECKS -static void tcsanitycheck(threadcacheblk **ptr) THROWSPEC -{ - assert((ptr[0] && ptr[1]) || (!ptr[0] && !ptr[1])); - if (ptr[0] && ptr[1]) - { - assert(nedblksize(ptr[0])>=sizeof(threadcacheblk)); - assert(nedblksize(ptr[1])>=sizeof(threadcacheblk)); - assert(*(unsigned int *) "NEDN"==ptr[0]->magic); - assert(*(unsigned int *) "NEDN"==ptr[1]->magic); - assert(!ptr[0]->prev); - assert(!ptr[1]->next); - if (ptr[0]==ptr[1]) - { - assert(!ptr[0]->next); - assert(!ptr[1]->prev); - } - } -} -static void tcfullsanitycheck(threadcache *tc) THROWSPEC -{ - threadcacheblk **tcbptr=tc->bins; - int n; - for (n=0; n<=THREADCACHEMAXBINS; n++, tcbptr+=2) - { - threadcacheblk *b, *ob=0; - tcsanitycheck(tcbptr); - for (b=tcbptr[0]; b; ob=b, b=b->next) - { - assert(*(unsigned int *) "NEDN"==b->magic); - assert(!ob || ob->next==b); - assert(!ob || b->prev==ob); - } - } -} -#endif - -static NOINLINE void RemoveCacheEntries(nedpool *RESTRICT p, threadcache *RESTRICT tc, unsigned int age) THROWSPEC -{ - UNREFERENCED_PARAMETER(p); -#ifdef FULLSANITYCHECKS - tcfullsanitycheck(tc); -#endif - if (tc->freeInCache) - { - threadcacheblk **tcbptr=tc->bins; - int n; - for (n=0; n<=THREADCACHEMAXBINS; n++, tcbptr+=2) - { - threadcacheblk **tcb=tcbptr+1; /* come from oldest end of list */ - /*tcsanitycheck(tcbptr);*/ - for (; *tcb && tc->frees-(*tcb)->lastUsed>=age;) - { - threadcacheblk *f=*tcb; - size_t blksize=f->size; /*nedblksize(f);*/ - assert(blksize<=nedblksize(0, f)); - assert(blksize); -#ifdef FULLSANITYCHECKS - assert(*(unsigned int *) "NEDN"==(*tcb)->magic); -#endif - *tcb=(*tcb)->prev; - if (*tcb) - (*tcb)->next=0; - else - *tcbptr=0; - tc->freeInCache-=blksize; - assert((long) tc->freeInCache>=0); - CallFree(0, f, 0); - /*tcsanitycheck(tcbptr);*/ - } - } - } -#ifdef FULLSANITYCHECKS - tcfullsanitycheck(tc); -#endif -} -static void DestroyCaches(nedpool *RESTRICT p) THROWSPEC -{ - if (p->caches) - { - threadcache *tc; - int n; - for (n=0; ncaches[n])) - { - tc->frees++; - RemoveCacheEntries(p, tc, 0); - assert(!tc->freeInCache); - tc->mymspace=-1; - tc->threadid=0; - CallFree(0, tc, 0); - p->caches[n]=0; - } - } - } -} - -static NOINLINE threadcache *AllocCache(nedpool *RESTRICT p) THROWSPEC -{ - threadcache *tc=0; - int n, end; -#if USE_LOCKS - ACQUIRE_LOCK(&p->mutex); -#endif - for (n=0; ncaches[n]; n++); - if (THREADCACHEMAXCACHES==n) - { - /* List exhausted, so disable for this thread */ -#if USE_LOCKS - RELEASE_LOCK(&p->mutex); -#endif - return 0; - } - tc=p->caches[n]=(threadcache *) CallCalloc(p->m[0], sizeof(threadcache), 0); - if (!tc) - { -#if USE_LOCKS - RELEASE_LOCK(&p->mutex); -#endif - return 0; - } -#ifdef FULLSANITYCHECKS - tc->magic1=*(unsigned int *)"NEDMALC1"; - tc->magic2=*(unsigned int *)"NEDMALC2"; -#endif - tc->threadid= -#if USE_LOCKS - (long)(size_t)CURRENT_THREAD; -#else - 1; -#endif - for (end=0; p->m[end]; end++); - tc->mymspace=abs(tc->threadid) % end; -#if USE_LOCKS - RELEASE_LOCK(&p->mutex); -#endif - if (TLSSET(p->mycache, (void *)(size_t)(n+1))) abort(); - return tc; -} - -static void *threadcache_malloc(nedpool *RESTRICT p, threadcache *RESTRICT tc, size_t *RESTRICT _size) THROWSPEC -{ - UNREFERENCED_PARAMETER(p); - - void *RESTRICT ret=0; - size_t size=*_size, blksize=0; - unsigned int bestsize; - unsigned int idx=size2binidx(size); - threadcacheblk *RESTRICT blk, * *RESTRICT binsptr; -#ifdef FULLSANITYCHECKS - tcfullsanitycheck(tc); -#endif - /* Calculate best fit bin size */ - bestsize=1<<(idx+4); -#ifdef FINEGRAINEDBINS - /* Finer grained bin fit */ - idx<<=1; - if (size>bestsize) - { - idx++; - bestsize+=bestsize>>1; - } - if (size>bestsize) - { - idx++; - bestsize=1<<(4+(idx>>1)); - } -#else - if (size>bestsize) - { - idx++; - bestsize<<=1; - } -#endif - assert(bestsize>=size); - if (sizebins[idx*2]; - /* Try to match close, but move up a bin if necessary */ - blk=*binsptr; - if (!blk || blk->sizesize; /*nedblksize(blk);*/ - assert(nedblksize(0, blk)>=blksize); - assert(blksize>=size); - if (blk->next) - blk->next->prev=0; - *binsptr=blk->next; - if (!*binsptr) - binsptr[1]=0; -#ifdef FULLSANITYCHECKS - blk->magic=0; -#endif - assert(binsptr[0]!=blk && binsptr[1]!=blk); - assert(nedblksize(0, blk)>=sizeof(threadcacheblk) && nedblksize(0, blk)<=THREADCACHEMAX+CHUNK_OVERHEAD); - /*printf("malloc: %p, %p, %p, %lu\n", p, tc, blk, (long) _size);*/ - ret=(void *) blk; - } - ++tc->mallocs; - if (ret) - { - assert(blksize>=size); - ++tc->successes; - tc->freeInCache-=blksize; - assert((long) tc->freeInCache>=0); - } -#if defined(DEBUG) && 0 - if (!(tc->mallocs & 0xfff)) - { - printf("*** threadcache=%u, mallocs=%u (%f), free=%u (%f), freeInCache=%u\n", (unsigned int) tc->threadid, tc->mallocs, - (float) tc->successes/tc->mallocs, tc->frees, (float) tc->successes/tc->frees, (unsigned int) tc->freeInCache); - } -#endif -#ifdef FULLSANITYCHECKS - tcfullsanitycheck(tc); -#endif - *_size=size; - return ret; -} -static NOINLINE void ReleaseFreeInCache(nedpool *RESTRICT p, threadcache *RESTRICT tc, int mymspace) THROWSPEC -{ - UNREFERENCED_PARAMETER(mymspace); - - unsigned int age=THREADCACHEMAXFREESPACE/8192; -#if USE_LOCKS - /*ACQUIRE_LOCK(&p->m[mymspace]->mutex);*/ -#endif - while (age && tc->freeInCache>=THREADCACHEMAXFREESPACE) - { - RemoveCacheEntries(p, tc, age); - /*printf("*** Removing cache entries older than %u (%u)\n", age, (unsigned int) tc->freeInCache);*/ - age>>=1; - } -#if USE_LOCKS - /*RELEASE_LOCK(&p->m[mymspace]->mutex);*/ -#endif -} -static void threadcache_free(nedpool *RESTRICT p, threadcache *RESTRICT tc, int mymspace, void *RESTRICT mem, size_t size) THROWSPEC -{ - unsigned int bestsize; - unsigned int idx=size2binidx(size); - threadcacheblk **RESTRICT binsptr, *RESTRICT tck=(threadcacheblk *) mem; - assert(size>=sizeof(threadcacheblk) && size<=THREADCACHEMAX+CHUNK_OVERHEAD); -#ifdef DEBUG - /* Make sure this is a valid memory block */ - assert(nedblksize(0, mem)); -#endif -#ifdef FULLSANITYCHECKS - tcfullsanitycheck(tc); -#endif - /* Calculate best fit bin size */ - bestsize=1<<(idx+4); -#ifdef FINEGRAINEDBINS - /* Finer grained bin fit */ - idx<<=1; - if (size>bestsize) - { - unsigned int biggerbestsize=bestsize+(bestsize<<1); - if (size>=biggerbestsize) - { - idx++; - bestsize=biggerbestsize; - } - } -#endif - if (bestsize!=size) /* dlmalloc can round up, so we round down to preserve indexing */ - size=bestsize; - binsptr=&tc->bins[idx*2]; - assert(idx<=THREADCACHEMAXBINS); - if (tck==*binsptr) - { - fprintf(stderr, "nedmalloc: Attempt to free already freed memory block %p - aborting!\n", tck); - abort(); - } -#ifdef FULLSANITYCHECKS - tck->magic=*(unsigned int *) "NEDN"; -#endif - tck->lastUsed=++tc->frees; - tck->size=(unsigned int) size; - tck->next=*binsptr; - tck->prev=0; - if (tck->next) - tck->next->prev=tck; - else - binsptr[1]=tck; - assert(!*binsptr || (*binsptr)->size==tck->size); - *binsptr=tck; - assert(tck==tc->bins[idx*2]); - assert(tc->bins[idx*2+1]==tck || binsptr[0]->next->prev==tck); - /*printf("free: %p, %p, %p, %lu\n", p, tc, mem, (long) size);*/ - tc->freeInCache+=size; -#ifdef FULLSANITYCHECKS - tcfullsanitycheck(tc); -#endif -#if 1 - if (tc->freeInCache>=THREADCACHEMAXFREESPACE) - ReleaseFreeInCache(p, tc, mymspace); -#endif -} - - - - -static NOINLINE int InitPool(nedpool *RESTRICT p, size_t capacity, int threads) THROWSPEC -{ - /* threads is -1 for system pool */ - ensure_initialization(); - ACQUIRE_MALLOC_GLOBAL_LOCK(); - if (p->threads) goto done; -#if USE_LOCKS - if (INITIAL_LOCK(&p->mutex)) goto err; -#endif - if (TLSALLOC(&p->mycache)) goto err; -#if USE_ALLOCATOR==0 - p->m[0]=(mstate) mspacecounter++; -#elif USE_ALLOCATOR==1 - if (!(p->m[0]=(mstate) create_mspace(capacity, 1))) goto err; - p->m[0]->extp=p; -#endif - p->threads=(threads<1 || threads>MAXTHREADSINPOOL) ? MAXTHREADSINPOOL : threads; -done: - RELEASE_MALLOC_GLOBAL_LOCK(); - return 1; -err: - if (threads<0) - abort(); /* If you can't allocate for system pool, we're screwed */ - DestroyCaches(p); - if (p->m[0]) - { -#if USE_ALLOCATOR==1 - destroy_mspace(p->m[0]); -#endif - p->m[0]=0; - } - if (p->mycache) - { - if (TLSFREE(p->mycache)) abort(); - p->mycache=0; - } - RELEASE_MALLOC_GLOBAL_LOCK(); - return 0; -} -static NOINLINE mstate FindMSpace(nedpool *RESTRICT p, threadcache *RESTRICT tc, int *RESTRICT lastUsed, size_t size) THROWSPEC -{ - /* Gets called when thread's last used mspace is in use. The strategy - is to run through the list of all available mspaces looking for an - unlocked one and if we fail, we create a new one so long as we don't - exceed p->threads */ - int n, end; - n=end=*lastUsed+1; -#if USE_LOCKS - for (; p->m[n]; end=++n) - { - if (TRY_LOCK(&p->m[n]->mutex)) goto found; - } - for (n=0; n<*lastUsed && p->m[n]; n++) - { - if (TRY_LOCK(&p->m[n]->mutex)) goto found; - } - if (endthreads) - { - mstate temp; -#if USE_ALLOCATOR==0 - temp=(mstate) mspacecounter++; -#elif USE_ALLOCATOR==1 - if (!(temp=(mstate) create_mspace(size, 1))) - goto badexit; -#endif - /* Now we're ready to modify the lists, we lock */ - ACQUIRE_LOCK(&p->mutex); - while (p->m[end] && endthreads) - end++; - if (end>=p->threads) - { - /* Drat, must destroy it now */ - RELEASE_LOCK(&p->mutex); -#if USE_ALLOCATOR==1 - destroy_mspace((mstate) temp); -#endif - goto badexit; - } - /* We really want to make sure this goes into memory now but we - have to be careful of breaking aliasing rules, so write it twice */ - *((volatile struct malloc_state **) &p->m[end])=p->m[end]=temp; - ACQUIRE_LOCK(&p->m[end]->mutex); - /*printf("Created mspace idx %d\n", end);*/ - RELEASE_LOCK(&p->mutex); - n=end; - goto found; - } - /* Let it lock on the last one it used */ -badexit: - ACQUIRE_LOCK(&p->m[*lastUsed]->mutex); - return p->m[*lastUsed]; -#endif -found: - *lastUsed=n; - if (tc) - tc->mymspace=n; - else - { - if (TLSSET(p->mycache, (void *)(size_t)(-(n+1)))) abort(); - } - return p->m[n]; -} - -typedef struct PoolList_t -{ - size_t size; /* Size of list */ - size_t length; /* Actual entries in list */ -#ifdef DEBUG - nedpool *list[1]; /* Force testing of list expansion */ -#else - nedpool *list[16]; -#endif -} PoolList; -#if USE_LOCKS -static MLOCK_T poollistlock; -#endif -static PoolList *poollist; -NEDMALLOCPTRATTR nedpool *nedcreatepool(size_t capacity, int threads) THROWSPEC -{ - nedpool *ret=0; - if (!poollist) - { - PoolList *newpoollist=0; - if (!(newpoollist=(PoolList *) nedpcalloc(0, 1, sizeof(PoolList)+sizeof(nedpool *)))) return 0; -#if USE_LOCKS - INITIAL_LOCK(&poollistlock); - ACQUIRE_LOCK(&poollistlock); -#endif - poollist=newpoollist; - poollist->size=sizeof(poollist->list)/sizeof(nedpool *); - } -#if USE_LOCKS - else - ACQUIRE_LOCK(&poollistlock); -#endif - if (poollist->length==poollist->size) - { - PoolList *newpoollist=0; - size_t newsize=0; - newsize=sizeof(PoolList)+(poollist->size+1)*sizeof(nedpool *); - if (!(newpoollist=(PoolList *) nedprealloc(0, poollist, newsize))) goto badexit; - poollist=newpoollist; - memset(&poollist->list[poollist->size], 0, newsize-((size_t)&poollist->list[poollist->size]-(size_t)&poollist->list[0])); - poollist->size=((newsize-((char *)&poollist->list[0]-(char *)poollist))/sizeof(nedpool *))-1; - assert(poollist->size>poollist->length); - } - if (!(ret=(nedpool *) nedpcalloc(0, 1, sizeof(nedpool)))) goto badexit; - if (!InitPool(ret, capacity, threads)) - { - nedpfree(0, ret); - goto badexit; - } - poollist->list[poollist->length++]=ret; -badexit: - { -#if USE_LOCKS - RELEASE_LOCK(&poollistlock); -#endif - } - return ret; -} -void neddestroypool(nedpool *p) THROWSPEC -{ - unsigned int n; -#if USE_LOCKS - ACQUIRE_LOCK(&p->mutex); -#endif - DestroyCaches(p); - for (n=0; p->m[n]; n++) - { -#if USE_ALLOCATOR==1 - destroy_mspace(p->m[n]); -#endif - p->m[n]=0; - } -#if USE_LOCKS - RELEASE_LOCK(&p->mutex); -#endif - if (TLSFREE(p->mycache)) abort(); - nedpfree(0, p); -#if USE_LOCKS - ACQUIRE_LOCK(&poollistlock); -#endif - assert(poollist); - for (n=0; nlength && poollist->list[n]!=p; n++); - assert(n!=poollist->length); - memmove(&poollist->list[n], &poollist->list[n+1], (size_t)&poollist->list[poollist->length]-(size_t)&poollist->list[n]); - if (!--poollist->length) - { - assert(!poollist->list[0]); - nedpfree(0, poollist); - poollist=0; - } -#if USE_LOCKS - RELEASE_LOCK(&poollistlock); -#endif -} -void neddestroysyspool() THROWSPEC -{ - nedpool *p=&syspool; - int n; -#if USE_LOCKS - ACQUIRE_LOCK(&p->mutex); -#endif - DestroyCaches(p); - for (n=0; p->m[n]; n++) - { -#if USE_ALLOCATOR==1 - destroy_mspace(p->m[n]); -#endif - p->m[n]=0; - } - /* Render syspool unusable */ - for (n=0; ncaches[n]=(threadcache *)(size_t)(sizeof(size_t)>4 ? 0xdeadbeefdeadbeefULL : 0xdeadbeefUL); - for (n=0; nm[n]=(mstate)(size_t)(sizeof(size_t)>4 ? 0xdeadbeefdeadbeefULL : 0xdeadbeefUL); - if (TLSFREE(p->mycache)) abort(); -#if USE_LOCKS - RELEASE_LOCK(&p->mutex); -#endif -} -nedpool **nedpoollist() THROWSPEC -{ - nedpool **ret=0; - if (poollist) - { -#if USE_LOCKS - ACQUIRE_LOCK(&poollistlock); -#endif - if (!(ret=(nedpool **) nedmalloc((poollist->length+1)*sizeof(nedpool *)))) goto badexit; - memcpy(ret, poollist->list, (poollist->length+1)*sizeof(nedpool *)); -badexit: - { -#if USE_LOCKS - RELEASE_LOCK(&poollistlock); -#endif - } - } - return ret; -} - -void nedpsetvalue(nedpool *p, void *v) THROWSPEC -{ - if (!p) { p=&syspool; if (!syspool.threads) InitPool(&syspool, 0, -1); } - p->uservalue=v; -} -void *nedgetvalue(nedpool **p, void *mem) THROWSPEC -{ - nedpool *np=0; - mstate fm=nedblkmstate(mem); - if (!fm || !fm->extp) return 0; - np=(nedpool *) fm->extp; - if (p) *p=np; - return np->uservalue; -} - -void nedtrimthreadcache(nedpool *p, int disable) THROWSPEC -{ - int mycache; - if (!p) - { - p=&syspool; - if (!syspool.threads) InitPool(&syspool, 0, -1); - } - mycache=(int)(size_t) TLSGET(p->mycache); - if (!mycache) - { - /* Set to mspace 0 */ - if (disable && TLSSET(p->mycache, (void *)(size_t)-1)) abort(); - } - else if (mycache>0) - { - /* Set to last used mspace */ - threadcache *tc=p->caches[mycache-1]; -#if defined(DEBUG) - printf("Threadcache utilisation: %lf%% in cache with %lf%% lost to other threads\n", - 100.0*tc->successes/tc->mallocs, 100.0*((double) tc->mallocs-tc->frees)/tc->mallocs); -#endif - if (disable && TLSSET(p->mycache, (void *)(size_t)(-tc->mymspace))) abort(); - tc->frees++; - RemoveCacheEntries(p, tc, 0); - assert(!tc->freeInCache); - if (disable) - { - tc->mymspace=-1; - tc->threadid=0; - CallFree(0, p->caches[mycache-1], 0); - p->caches[mycache-1]=0; - } - } -} -void neddisablethreadcache(nedpool *p) THROWSPEC -{ - nedtrimthreadcache(p, 1); -} - -#if USE_LOCKS && USE_ALLOCATOR==1 -#define GETMSPACE(m,p,tc,ms,s,action) \ - do \ - { \ - mstate m = GetMSpace((p),(tc),(ms),(s)); \ - action; \ - RELEASE_LOCK(&m->mutex); \ - } while (0) -#else -#define GETMSPACE(m,p,tc,ms,s,action) \ - do \ - { \ - mstate m = GetMSpace((p),(tc),(ms),(s)); \ - action; \ - } while (0) -#endif - -static FORCEINLINE mstate GetMSpace(nedpool *RESTRICT p, threadcache *RESTRICT tc, int mymspace, size_t size) THROWSPEC -{ - /* Returns a locked and ready for use mspace */ - mstate m=p->m[mymspace]; - assert(m); -#if USE_LOCKS && USE_ALLOCATOR==1 - if (!TRY_LOCK(&p->m[mymspace]->mutex)) m=FindMSpace(p, tc, &mymspace, size); - /*assert(IS_LOCKED(&p->m[mymspace]->mutex));*/ -#endif - return m; -} -static NOINLINE void GetThreadCache_cold1(nedpool *RESTRICT *RESTRICT p) THROWSPEC -{ - *p=&syspool; - if (!syspool.threads) InitPool(&syspool, 0, -1); -} -static NOINLINE void GetThreadCache_cold2(nedpool *RESTRICT *RESTRICT p, threadcache *RESTRICT *RESTRICT tc, int *RESTRICT mymspace, int mycache) THROWSPEC -{ - if (!mycache) - { - /* Need to allocate a new cache */ - *tc=AllocCache(*p); - if (!*tc) - { - /* Disable */ - if (TLSSET((*p)->mycache, (void *)(size_t)-1)) abort(); - *mymspace=0; - } - else - *mymspace=(*tc)->mymspace; - } - else - { /* Cache disabled, but we do have an assigned thread pool */ - *tc=0; - *mymspace=-mycache-1; - } -} -static FORCEINLINE void GetThreadCache(nedpool *RESTRICT *RESTRICT p, threadcache *RESTRICT *RESTRICT tc, int *RESTRICT mymspace, size_t *RESTRICT size) THROWSPEC -{ - int mycache; - if (size && *sizemycache); - if (mycache>0) - { - /* Already have a cache */ - *tc=(*p)->caches[mycache-1]; - *mymspace=(*tc)->mymspace; - } - else GetThreadCache_cold2(p, tc, mymspace, mycache); - assert(*mymspace>=0); -#if USE_LOCKS - assert(!(*tc) || (long)(size_t)CURRENT_THREAD==(*tc)->threadid); -#endif -#ifdef FULLSANITYCHECKS - if (*tc) - { - if (*(unsigned int *)"NEDMALC1"!=(*tc)->magic1 || *(unsigned int *)"NEDMALC2"!=(*tc)->magic2) - { - abort(); - } - } -#endif -} - -NEDMALLOCPTRATTR void *nedpmalloc(nedpool *p, size_t size) THROWSPEC -{ - void *ret=0; - threadcache *tc; - int mymspace; - GetThreadCache(&p, &tc, &mymspace, &size); -#if THREADCACHEMAX - if (tc && size<=THREADCACHEMAX) - { - /* Use the thread cache */ - ret=threadcache_malloc(p, tc, &size); - } -#endif - if (!ret) - { - /* Use this thread's mspace */ - GETMSPACE(m, p, tc, mymspace, size, - ret=CallMalloc(m, size, 0)); - } - return ret; -} -NEDMALLOCPTRATTR void *nedpcalloc(nedpool *p, size_t no, size_t size) THROWSPEC -{ - size_t rsize=size*no; - void *ret=0; - threadcache *tc; - int mymspace; - GetThreadCache(&p, &tc, &mymspace, &rsize); -#if THREADCACHEMAX - if (tc && rsize<=THREADCACHEMAX) - { - /* Use the thread cache */ - if ((ret=threadcache_malloc(p, tc, &rsize))) - memset(ret, 0, rsize); - } -#endif - if (!ret) - { - /* Use this thread's mspace */ - GETMSPACE(m, p, tc, mymspace, rsize, - ret=CallCalloc(m, rsize, 0)); - } - return ret; -} -NEDMALLOCPTRATTR void *nedprealloc(nedpool *p, void *mem, size_t size) THROWSPEC -{ - void *ret=0; - threadcache *tc; - int mymspace, isforeign=1; - size_t memsize; - if (!mem) return nedpmalloc(p, size); - memsize=nedblksize(&isforeign, mem); - assert(memsize); - if (!memsize) - { - fprintf(stderr, "nedmalloc: nedprealloc() called with a block not created by nedmalloc!\n"); - abort(); - } - else if (size<=memsize && memsize-size< -#ifdef DEBUG - 32 -#else - 1024 -#endif - ) /* If realloc size is within 1Kb smaller than existing, noop it */ - return mem; - GetThreadCache(&p, &tc, &mymspace, &size); -#if THREADCACHEMAX - if (tc && size && size<=THREADCACHEMAX) - { - /* Use the thread cache */ - if ((ret=threadcache_malloc(p, tc, &size))) - { - memcpy(ret, mem, memsize=sizeof(threadcacheblk) && memsize<=(THREADCACHEMAX+CHUNK_OVERHEAD)) - threadcache_free(p, tc, mymspace, mem, memsize); - else - CallFree(0, mem, isforeign); - } - } -#endif - if (!ret) - { - /* Reallocs always happen in the mspace they happened in, so skip - locking the preferred mspace for this thread */ - ret=CallRealloc(p->m[mymspace], mem, isforeign, memsize, size); - } - return ret; -} -void nedpfree(nedpool *p, void *mem) THROWSPEC -{ - /* Frees always happen in the mspace they happened in, so skip - locking the preferred mspace for this thread */ - threadcache *tc; - int mymspace, isforeign=1; - size_t memsize; - if (!mem) - { - /* If you tried this on FreeBSD you'd be sorry! */ -#ifdef DEBUG - fprintf(stderr, "nedmalloc: WARNING nedpfree() called with zero. This is not portable behaviour!\n"); -#endif - return; - } - memsize=nedblksize(&isforeign, mem); - assert(memsize); - if (!memsize) - { - fprintf(stderr, "nedmalloc: nedpfree() called with a block not created by nedmalloc!\n"); - abort(); - } - GetThreadCache(&p, &tc, &mymspace, 0); -#if THREADCACHEMAX - if (mem && tc && memsize>=sizeof(threadcacheblk) && memsize<=(THREADCACHEMAX+CHUNK_OVERHEAD)) - threadcache_free(p, tc, mymspace, mem, memsize); - else -#endif - CallFree(0, mem, isforeign); -} -NEDMALLOCPTRATTR void *nedpmemalign(nedpool *p, size_t alignment, size_t bytes) THROWSPEC -{ - void *ret; - threadcache *tc; - int mymspace; - GetThreadCache(&p, &tc, &mymspace, &bytes); - { /* Use this thread's mspace */ - GETMSPACE(m, p, tc, mymspace, bytes, - ret=CallMalloc(m, bytes, alignment)); - } - return ret; -} -struct nedmallinfo nedpmallinfo(nedpool *p) THROWSPEC -{ - int n; - struct nedmallinfo ret= {0,0,0,0,0,0,0,0,0,0}; -if (!p) { p=&syspool; if (!syspool.threads) InitPool(&syspool, 0, -1); } -for (n=0; p->m[n]; n++) -{ -#if USE_ALLOCATOR==1 && !NO_MALLINFO -struct mallinfo t=mspace_mallinfo(p->m[n]); - ret.arena+=t.arena; - ret.ordblks+=t.ordblks; - ret.hblkhd+=t.hblkhd; - ret.usmblks+=t.usmblks; - ret.uordblks+=t.uordblks; - ret.fordblks+=t.fordblks; - ret.keepcost+=t.keepcost; -#endif -} -return ret; -} -int nedpmallopt(nedpool *p, int parno, int value) THROWSPEC -{ - UNREFERENCED_PARAMETER(p); -#if USE_ALLOCATOR==1 - return mspace_mallopt(parno, value); -#else - return 0; -#endif -} -NEDMALLOCNOALIASATTR void *nedmalloc_internals(size_t *granularity, size_t *magic) THROWSPEC -{ -#if USE_ALLOCATOR==1 - if (granularity) *granularity=mparams.granularity; - if (magic) *magic=mparams.magic; - return (void *) &syspool; -#else - if (granularity) *granularity=0; - if (magic) *magic=0; - return 0; -#endif -} -int nedpmalloc_trim(nedpool *p, size_t pad) THROWSPEC -{ - int n, ret=0; - if (!p) { p=&syspool; if (!syspool.threads) InitPool(&syspool, 0, -1); } - for (n=0; p->m[n]; n++) - { -#if USE_ALLOCATOR==1 - ret+=mspace_trim(p->m[n], pad); -#endif - } - return ret; -} -void nedpmalloc_stats(nedpool *p) THROWSPEC -{ - int n; - if (!p) { p=&syspool; if (!syspool.threads) InitPool(&syspool, 0, -1); } - for (n=0; p->m[n]; n++) - { -#if USE_ALLOCATOR==1 - mspace_malloc_stats(p->m[n]); -#endif - } -} -size_t nedpmalloc_footprint(nedpool *p) THROWSPEC -{ - size_t ret=0; - int n; - if (!p) { p=&syspool; if (!syspool.threads) InitPool(&syspool, 0, -1); } - for (n=0; p->m[n]; n++) - { -#if USE_ALLOCATOR==1 - ret+=mspace_footprint(p->m[n]); -#endif - } - return ret; -} -NEDMALLOCPTRATTR void **nedpindependent_calloc(nedpool *p, size_t elemsno, size_t elemsize, void **chunks) THROWSPEC -{ - void **ret; - threadcache *tc; - int mymspace; - GetThreadCache(&p, &tc, &mymspace, &elemsize); -#if USE_ALLOCATOR==0 - GETMSPACE(m, p, tc, mymspace, elemsno *elemsize, - ret=unsupported_operation("independent_calloc")); -#elif USE_ALLOCATOR==1 - GETMSPACE(m, p, tc, mymspace, elemsno *elemsize, - ret=mspace_independent_calloc(m, elemsno, elemsize, chunks)); -#endif - return ret; -} -NEDMALLOCPTRATTR void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **chunks) THROWSPEC -{ - void **ret; - threadcache *tc; - int mymspace; - size_t i, *adjustedsizes=(size_t *) alloca(elems *sizeof(size_t)); - if (!adjustedsizes) return 0; - for (i=0; iname || !cvar->name[0]) - { - OSD_Printf("OSD_RegisterCvar(): can't register cvar with null name\n"); - return -1; - } - - if (!cvar->var) - { - OSD_Printf("OSD_RegisterCvar(): can't register null cvar\n"); - return -1; - } - - // check for illegal characters in name - for (cp = cvar->name; *cp; cp++) - { - if ((cp == cvar->name) && (*cp >= '0') && (*cp <= '9')) - { - OSD_Printf("OSD_RegisterCvar(): first character of cvar name \"%s\" must not be a numeral\n", cvar->name); - return -1; - } - if ((*cp < '0') || - (*cp > '9' && *cp < 'A') || - (*cp > 'Z' && *cp < 'a' && *cp != '_') || - (*cp > 'z')) - { - OSD_Printf("OSD_RegisterCvar(): illegal character in cvar name \"%s\"\n", cvar->name); - return -1; - } - } - - cvars = (osdcvar_t *)Brealloc(cvars, (osdnumcvars + 1) * sizeof(osdcvar_t)); - - hash_add(&h_cvars, cvar->name, osdnumcvars, 1); - - switch (cvar->type & (CVAR_BOOL|CVAR_INT|CVAR_UINT|CVAR_FLOAT|CVAR_DOUBLE)) - { - case CVAR_BOOL: - case CVAR_INT: - cvars[osdnumcvars].dval.i = *(int32_t *)cvar->var; - break; - case CVAR_UINT: - cvars[osdnumcvars].dval.uint = *(uint32_t *)cvar->var; - break; - case CVAR_FLOAT: - cvars[osdnumcvars].dval.f = *(float *)cvar->var; - break; - case CVAR_DOUBLE: - cvars[osdnumcvars].dval.d = *(double *)cvar->var; - break; - } - - Bmemcpy(&cvars[osdnumcvars++], cvar, sizeof(cvar_t)); - - return 0; -} - -static int32_t OSD_CvarModified(const osdcvar_t *cvar) -{ - if ((osdflags & OSD_INITIALIZED) == 0) - return 0; - - if (!cvar->var) - { - OSD_Printf("OSD_CvarModified(): null cvar?!\n"); - return 0; - } - - switch (cvar->type & (CVAR_BOOL|CVAR_INT|CVAR_UINT|CVAR_FLOAT|CVAR_DOUBLE)) - { - case CVAR_BOOL: - case CVAR_INT: - return (cvar->dval.i != *(int32_t *)cvar->var); - case CVAR_UINT: - return (cvar->dval.uint != *(uint32_t *)cvar->var); - case CVAR_FLOAT: - return (cvar->dval.f != *(float *)cvar->var); - case CVAR_DOUBLE: - return (cvar->dval.d != *(double *)cvar->var); - default: - return 0; - } -} - -// color code format is as follows: -// ^## sets a color, where ## is the palette number -// ^S# sets a shade, range is 0-7 equiv to shades 0-14 -// ^O resets formatting to defaults - -const char *OSD_StripColors(char *out, const char *in) -{ - const char *ptr = out; - - do - { - if (*in == '^' && isdigit(*(in+1))) - { - in += 2; - if (isdigit(*in)) - in++; - continue; - } - if (*in == '^' && (Btoupper(*(in+1)) == 'S') && isdigit(*(in+2))) - { - in += 3; - continue; - } - if (*in == '^' && (Btoupper(*(in+1)) == 'O')) - { - in += 2; - continue; - } - *(out++) = *(in++); - } - while (*in); - - *out = '\0'; - return (ptr); -} - -int32_t OSD_Exec(const char *szScript) -{ - FILE *fp = fopenfrompath(szScript, "r"); - - if (fp != NULL) - { - char line[255]; - - OSD_Printf("Executing \"%s\"\n", szScript); - osdexecscript++; - while (fgets(line, sizeof(line)-1, fp) != NULL) - OSD_Dispatch(strtok(line,"\r\n")); - osdexecscript--; - fclose(fp); - return 0; - } - return 1; -} - -int32_t OSD_ParsingScript(void) -{ - return osdexecscript; -} - -int32_t OSD_OSDKey(void) -{ - return osdkey; -} - -char *OSD_GetTextPtr(void) -{ - return osdtext; -} - -char *OSD_GetFmtPtr(void) -{ - return osdfmt; -} - -char *OSD_GetFmt(char *ptr) -{ - return (ptr - osdtext + osdfmt); -} - -int32_t OSD_GetCols(void) -{ - return osdcols; -} - -int32_t OSD_IsMoving(void) -{ - return (osdrowscur!=-1 && osdrowscur!=osdrows); -} - -int32_t OSD_GetTextMode(void) -{ - return osdtextmode; -} - -void OSD_SetTextMode(int32_t mode) -{ - osdtextmode = (mode != 0); - if (osdtextmode) - { - if (drawosdchar != _internal_drawosdchar) - { - swaplong(&_drawosdchar,&drawosdchar); - swaplong(&_drawosdstr,&drawosdstr); - swaplong(&_drawosdcursor,&drawosdcursor); - swaplong(&_getcolumnwidth,&getcolumnwidth); - swaplong(&_getrowheight,&getrowheight); - } - } - else if (drawosdchar == _internal_drawosdchar) - { - swaplong(&_drawosdchar,&drawosdchar); - swaplong(&_drawosdstr,&drawosdstr); - swaplong(&_drawosdcursor,&drawosdcursor); - swaplong(&_getcolumnwidth,&getcolumnwidth); - swaplong(&_getrowheight,&getrowheight); - } - if (qsetmode == 200) - OSD_ResizeDisplay(xdim, ydim); -} - -static int32_t _internal_osdfunc_exec(const osdfuncparm_t *parm) -{ - char fn[BMAX_PATH]; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - Bstrcpy(fn,parm->parms[0]); - - if (OSD_Exec(fn)) - { - OSD_Printf(OSD_ERROR "exec: file \"%s\" not found.\n", fn); - return OSDCMD_OK; - } - return OSDCMD_OK; -} - -static int32_t _internal_osdfunc_echo(const osdfuncparm_t *parm) -{ - int32_t i; - for (i = 0; i < parm->numparms; i++) - { - if (i > 0) OSD_Printf(" "); - OSD_Printf("%s", parm->parms[i]); - } - OSD_Printf("\n"); - - return OSDCMD_OK; -} - -static int32_t _internal_osdfunc_fileinfo(const osdfuncparm_t *parm) -{ - uint32_t crc, length; - int32_t i,j; - char buf[256]; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - if ((i = kopen4load((char *)parm->parms[0],0)) < 0) - { - OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]); - return OSDCMD_OK; - } - - length = kfilelength(i); - - crc32init(&crc); - do - { - j = kread(i,buf,256); - crc32block(&crc,(uint8_t *)buf,j); - } - while (j == 256); - crc32finish(&crc); - - kclose(i); - - OSD_Printf("fileinfo: %s\n" - " File size: %d\n" - " CRC-32: %08X\n", - parm->parms[0], length, crc); - - return OSDCMD_OK; -} - -static void _internal_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal) -{ - char st[2] = { 0,0 }; - - UNREFERENCED_PARAMETER(shade); - UNREFERENCED_PARAMETER(pal); - - st[0] = ch; - - printext256(4+(x<<3),4+(y<<3), white, -1, st, 0); -} - -static void _internal_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int32_t pal) -{ - char st[1024]; - - UNREFERENCED_PARAMETER(shade); - UNREFERENCED_PARAMETER(pal); - - if (len>1023) len=1023; - Bmemcpy(st,ch,len); - st[len]=0; - - printext256(4+(x<<3),4+(y<<3), white, -1, st, 0); -} - -static void _internal_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress) -{ - char st[2] = { '_',0 }; - - UNREFERENCED_PARAMETER(lastkeypress); - - if (type) st[0] = '#'; - - if (white > -1) - { - printext256(4+(x<<3),4+(y<<3)+2, white, -1, st, 0); - return; - } - - { - int32_t i, j, k; - // find the palette index closest to white - k=0; - for (i=0; i<256; i++) - { - j = ((int32_t)curpalette[i].r)+((int32_t)curpalette[i].g)+((int32_t)curpalette[i].b); - if (j > k) { k = j; white = i; } - } - } - -} - -static int32_t _internal_getcolumnwidth(int32_t w) -{ - return w/8 - 1; -} - -static int32_t _internal_getrowheight(int32_t w) -{ - return w/8; -} - -static void _internal_clearbackground(int32_t cols, int32_t rows) -{ - UNREFERENCED_PARAMETER(cols); - UNREFERENCED_PARAMETER(rows); -} - -static int32_t _internal_gettime(void) -{ - return 0; -} - -static void _internal_onshowosd(int32_t a) -{ - UNREFERENCED_PARAMETER(a); -} - -//////////////////////////// - -static int32_t _internal_osdfunc_alias(const osdfuncparm_t *parm) -{ - symbol_t *i; - - if (parm->numparms < 1) - { - int32_t j = 0; - OSD_Printf("Alias listing:\n"); - for (i=symbols; i!=NULL; i=i->next) - if (i->func == OSD_ALIAS) - { - j++; - OSD_Printf(" %s \"%s\"\n", i->name, i->help); - } - if (j == 0) - OSD_Printf("No aliases found.\n"); - return OSDCMD_OK; - } - - for (i=symbols; i!=NULL; i=i->next) - { - if (!Bstrcasecmp(parm->parms[0],i->name)) - { - if (parm->numparms < 2) - { - if (i->func == OSD_ALIAS) - OSD_Printf("alias %s \"%s\"\n", i->name, i->help); - else OSD_Printf("%s is a function, not an alias\n",i->name); - return OSDCMD_OK; - } - if (i->func != OSD_ALIAS && i->func != OSD_UNALIASED) - { - OSD_Printf("Cannot override function \"%s\" with alias\n",i->name); - return OSDCMD_OK; - } - } - } - - OSD_RegisterFunction(Bstrdup(parm->parms[0]),Bstrdup(parm->parms[1]),OSD_ALIAS); - if (!osdexecscript) - OSD_Printf("%s\n",parm->raw); - return OSDCMD_OK; -} - -static int32_t _internal_osdfunc_unalias(const osdfuncparm_t *parm) -{ - symbol_t *i; - - if (parm->numparms < 1) - return OSDCMD_SHOWHELP; - - for (i=symbols; i!=NULL; i=i->next) - { - if (!Bstrcasecmp(parm->parms[0],i->name)) - { - if (parm->numparms < 2) - { - if (i->func == OSD_ALIAS) - { - OSD_Printf("Removed alias %s (\"%s\")\n", i->name, i->help); - i->func = OSD_UNALIASED; - } - else OSD_Printf("Invalid alias %s\n",i->name); - return OSDCMD_OK; - } - } - } - OSD_Printf("Invalid alias %s\n",parm->parms[0]); - return OSDCMD_OK; -} - -static int32_t _internal_osdfunc_listsymbols(const osdfuncparm_t *parm) -{ - symbol_t *i; - int32_t maxwidth = 0; - - UNREFERENCED_PARAMETER(parm); - - for (i=symbols; i!=NULL; i=i->next) - if (i->func != OSD_UNALIASED) - maxwidth = max((unsigned)maxwidth,Bstrlen(i->name)); - - if (maxwidth > 0) - { - int32_t x = 0, count = 0; - maxwidth += 3; - OSD_Printf(OSDTEXT_RED "Symbol listing:\n"); - for (i=symbols; i!=NULL; i=i->next) - { - if (i->func != OSD_UNALIASED) - { - int32_t j = hash_find(&h_cvars, i->name); - - if (j != -1 && OSD_CvarModified(&cvars[j])) - { - OSD_Printf(OSDTEXT_RED "*"); - OSD_Printf("%-*s",maxwidth-1,i->name); - } - else OSD_Printf("%-*s",maxwidth,i->name); - - x += maxwidth; - count++; - } - if (x > osdcols - maxwidth) - { - x = 0; - OSD_Printf("\n"); - } - } - if (x) OSD_Printf("\n"); - OSD_Printf(OSDTEXT_RED "Found %d symbols\n",count); - } - return OSDCMD_OK; -} - -static int32_t _internal_osdfunc_help(const osdfuncparm_t *parm) -{ - symbol_t *symb; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - symb = findexactsymbol(parm->parms[0]); - if (!symb) - OSD_Printf("Error: no help for undefined symbol \"%s\"\n", parm->parms[0]); - else - OSD_Printf("%s\n", symb->help); - - return OSDCMD_OK; -} - -static int32_t _internal_osdfunc_clear(const osdfuncparm_t *parm) -{ - UNREFERENCED_PARAMETER(parm); - Bmemset(osdtext,0,sizeof(osdtext)); - Bmemset(osdfmt,osdtextpal+(osdtextshade<<5),sizeof(osdfmt)); - osdlines = 1; - return OSDCMD_OK; -} - -static int32_t _internal_osdfunc_history(const osdfuncparm_t *parm) -{ - int32_t i, j = 0; - UNREFERENCED_PARAMETER(parm); - OSD_Printf(OSDTEXT_RED "Command history:\n"); - for (i=OSD_HISTORYDEPTH-1; i>=0; i--) - if (osdhistorybuf[i][0]) - OSD_Printf("%4d \"%s\"\n",osdhistorytotal-osdhistorysize+(++j),osdhistorybuf[i]); - return OSDCMD_OK; -} - -//////////////////////////// - - -// -// OSD_Cleanup() -- Cleans up the on-screen display -// -void OSD_Cleanup(void) -{ - symbol_t *s; - - hash_free(&h_osd); - hash_free(&h_cvars); - - for (; symbols; symbols=s) - { - s=symbols->next; - Bfree(symbols); - } - - if (osdlog) - { - Bfclose(osdlog); - osdlog = NULL; - } - - if (cvars) - { - Bfree(cvars); - cvars = NULL; - } - - osdflags &= ~OSD_INITIALIZED; -} - - -static int32_t osdcmd_cvar_set_osd(const osdfuncparm_t *parm) -{ - int32_t r = osdcmd_cvar_set(parm); - - if (r == OSDCMD_OK) - { - if (!Bstrcasecmp(parm->name, "osdrows")) - { - if (osdrows > osdmaxrows) osdrows = osdmaxrows; - if (osdrowscur!=-1)osdrowscur = osdrows; - return r; - } - else if (!Bstrcasecmp(parm->name, "osdtextmode")) - { - OSD_SetTextMode(osdtextmode); - return r; - } - } - return r; -} - -static int32_t _internal_osdfunc_toggle(const osdfuncparm_t *parm) -{ - int32_t i; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - i = hash_find(&h_cvars, parm->parms[0]); - - if (i == -1) - for (i = osdnumcvars-1; i >= 0; i--) - if (!Bstrcasecmp(parm->parms[0], cvars[i].name)) break; - - if (i == -1 || (cvars[i].type & CVAR_BOOL) != CVAR_BOOL) - { - OSD_Printf("Bad cvar name or cvar not boolean\n"); - return OSDCMD_OK; - } - - *(int32_t *)cvars[i].var = 1 - *(int32_t *)cvars[i].var; - return OSDCMD_OK; -} - -// -// OSD_Init() -- Initializes the on-screen display -// -void OSD_Init(void) -{ - uint32_t i; - cvar_t cvars_osd[] = - { - { "osdeditpal","osdeditpal: sets the palette of the OSD input text",(void *) &osdeditpal, CVAR_INT, 0, MAXPALOOKUPS-1 }, - { "osdpromptpal","osdpromptpal: sets the palette of the OSD prompt",(void *) &osdpromptpal, CVAR_INT, 0, MAXPALOOKUPS-1 }, - { "osdtextpal","osdtextpal: sets the palette of the OSD text",(void *) &osdtextpal, CVAR_INT, 0, MAXPALOOKUPS-1 }, - { "osdeditshade","osdeditshade: sets the shade of the OSD input text",(void *) &osdeditshade, CVAR_INT, 0, 7 }, - { "osdtextshade","osdtextshade: sets the shade of the OSD text",(void *) &osdtextshade, CVAR_INT, 0, 7 }, - { "osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",(void *) &osdpromptshade, CVAR_INT, INT8_MIN, INT8_MAX }, - { "osdrows","osdrows: sets the number of visible lines of the OSD",(void *) &osdrows, CVAR_INT|CVAR_FUNCPTR, 0, MAXPALOOKUPS-1 }, - { "osdtextmode","osdtextmode: set OSD text mode (0:graphical, 1:fast)",(void *) &osdtextmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "logcutoff","logcutoff: sets the maximal line count of the log file",(void *) &logcutoff, CVAR_INT, 0, 262144 }, - }; - - mutex_init(&m_osdprintf); - - Bmemset(osdtext, asc_Space, TEXTSIZE); - Bmemset(osdfmt, osdtextpal+(osdtextshade<<5), TEXTSIZE); - Bmemset(osdsymbptrs, 0, sizeof(osdsymbptrs)); - - osdnumsymbols = osdnumcvars = 0; - osdlines = 1; - osdflags |= OSD_INITIALIZED; - - hash_init(&h_osd); - hash_init(&h_cvars); - - for (i=0; i: executes a script", _internal_osdfunc_exec); - OSD_RegisterFunction("fileinfo","fileinfo : gets a file's information", _internal_osdfunc_fileinfo); - OSD_RegisterFunction("help","help: displays help for the specified cvar or command; \"listsymbols\" to show all commands",_internal_osdfunc_help); - OSD_RegisterFunction("history","history: displays the console command history",_internal_osdfunc_history); - OSD_RegisterFunction("listsymbols","listsymbols: lists all registered functions, cvars and aliases",_internal_osdfunc_listsymbols); - OSD_RegisterFunction("toggle","toggle: toggles the value of a boolean cvar",_internal_osdfunc_toggle); - OSD_RegisterFunction("unalias","unalias: removes a command alias",_internal_osdfunc_unalias); - - atexit(OSD_Cleanup); -} - - -// -// OSD_SetLogFile() -- Sets the text file where printed text should be echoed -// -void OSD_SetLogFile(char *fn) -{ - if (osdlog) - { - Bfclose(osdlog); - osdlog = NULL; - } - - if (fn) osdlog = Bfopen(fn,"w"); - if (osdlog) setvbuf(osdlog, (char *)NULL, _IONBF, 0); -} - - -// -// OSD_SetFunctions() -- Sets some callbacks which the OSD uses to understand its world -// -void OSD_SetFunctions( - void (*drawchar)(int32_t,int32_t,char,int32_t,int32_t), - void (*drawstr)(int32_t,int32_t,char *,int32_t,int32_t,int32_t), - void (*drawcursor)(int32_t,int32_t,int32_t,int32_t), - int32_t (*colwidth)(int32_t), - int32_t (*rowheight)(int32_t), - void (*clearbg)(int32_t,int32_t), - int32_t (*gtime)(void), - void (*showosd)(int32_t) -) -{ - drawosdchar = drawchar; - drawosdstr = drawstr; - drawosdcursor = drawcursor; - getcolumnwidth = colwidth; - getrowheight = rowheight; - clearbackground = clearbg; - gettime = gtime; - onshowosd = showosd; - - if (!drawosdchar) drawosdchar = _internal_drawosdchar; - if (!drawosdstr) drawosdstr = _internal_drawosdstr; - if (!drawosdcursor) drawosdcursor = _internal_drawosdcursor; - if (!getcolumnwidth) getcolumnwidth = _internal_getcolumnwidth; - if (!getrowheight) getrowheight = _internal_getrowheight; - if (!clearbackground) clearbackground = _internal_clearbackground; - if (!gettime) gettime = _internal_gettime; - if (!onshowosd) onshowosd = _internal_onshowosd; -} - - -// -// OSD_SetParameters() -- Sets the parameters for presenting the text -// -void OSD_SetParameters( - int32_t promptshade, int32_t promptpal, - int32_t editshade, int32_t editpal, - int32_t textshade, int32_t textpal -) -{ - osdpromptshade = promptshade; - osdpromptpal = promptpal; - osdeditshade = editshade; - osdeditpal = editpal; - osdtextshade = textshade; - osdtextpal = textpal; -} - - -// -// OSD_CaptureKey() -- Sets the scancode for the key which activates the onscreen display -// -void OSD_CaptureKey(int32_t sc) -{ - osdkey = sc; -} - -// -// OSD_FindDiffPoint() -- Finds the length of the longest common prefix of 2 strings, stolen from ZDoom -// -static int32_t OSD_FindDiffPoint(const char *str1, const char *str2) -{ - int32_t i; - - for (i = 0; Btolower(str1[i]) == Btolower(str2[i]); i++) - if (str1[i] == 0 || str2[i] == 0) - break; - - return i; -} - -static void OSD_HistoryPrev(void) -{ - if (osdhistorypos >= osdhistorysize-1) return; - - osdhistorypos++; - Bmemcpy(osdeditbuf, osdhistorybuf[osdhistorypos], OSD_EDITLENGTH+1); - - osdeditcursor = 0; - while (osdeditbuf[osdeditcursor]) osdeditcursor++; - osdeditlen = osdeditcursor; - - if (osdeditcursor=osdeditwinend) - { - osdeditwinstart+=(osdeditcursor-osdeditwinend); - osdeditwinend+=(osdeditcursor-osdeditwinend); - } -} - -static void OSD_HistoryNext(void) -{ - if (osdhistorypos < 0) return; - - if (osdhistorypos == 0) - { - osdeditlen=0; - osdeditcursor=0; - osdeditwinstart=0; - osdeditwinend=editlinewidth; - osdhistorypos = -1; - return; - } - - osdhistorypos--; - Bmemcpy(osdeditbuf, osdhistorybuf[osdhistorypos], OSD_EDITLENGTH+1); - - osdeditcursor = 0; - while (osdeditbuf[osdeditcursor]) osdeditcursor++; - osdeditlen = osdeditcursor; - - if (osdeditcursor=osdeditwinend) - { - osdeditwinstart+=(osdeditcursor-osdeditwinend); - osdeditwinend+=(osdeditcursor-osdeditwinend); - } -} - -// -// OSD_HandleKey() -- Handles keyboard input when capturing input. -// Returns 0 if the key was handled internally, or the scancode if it should -// be passed on to the game. -// - -int32_t OSD_HandleChar(char ch) -{ - int32_t i,j; - symbol_t *tabc = NULL; - static symbol_t *lastmatch = NULL; - - if ((osdflags & (OSD_INITIALIZED|OSD_CAPTURE)) != (OSD_INITIALIZED|OSD_CAPTURE)) - return ch; - - if (ch != 9) // tab - lastmatch = NULL; - - switch (ch) - { - case 1: // control a. jump to beginning of line - osdeditcursor=0; - osdeditwinstart=0; - osdeditwinend=editlinewidth; - return 0; - case 2: // control b, move one character left - if (osdeditcursor > 0) osdeditcursor--; - return 0; - case 3: // control c - osdeditbuf[osdeditlen] = 0; - OSD_Printf("%s\n",osdeditbuf); - osdeditlen=0; - osdeditcursor=0; - osdeditwinstart=0; - osdeditwinend=editlinewidth; - osdeditbuf[0] = 0; - return 0; - case 5: // control e, jump to end of line - osdeditcursor = osdeditlen; - osdeditwinend = osdeditcursor; - osdeditwinstart = osdeditwinend-editlinewidth; - if (osdeditwinstart<0) - { - osdeditwinstart=0; - osdeditwinend = editlinewidth; - } - return 0; - case 6: // control f, move one character right - if (osdeditcursor < osdeditlen) osdeditcursor++; - return 0; - case 8: -// case 127: // control h, backspace - if (!osdeditcursor || !osdeditlen) return 0; - if ((osdflags & OSD_OVERTYPE) == 0) - { - if (osdeditcursor < osdeditlen) - Bmemmove(osdeditbuf+osdeditcursor-1, osdeditbuf+osdeditcursor, osdeditlen-osdeditcursor); - osdeditlen--; - } - osdeditcursor--; - if (osdeditcursor0; i--) if (osdeditbuf[i-1] == ' ') break; - for (j=0; osdeditbuf[i] != ' ' && i < osdeditlen; j++,i++) - osdedittmp[j] = osdeditbuf[i]; - osdedittmp[j] = 0; - - if (j > 0) - { - tabc = findsymbol(osdedittmp, NULL); - - if (tabc && tabc->next && findsymbol(osdedittmp, tabc->next)) - { - symbol_t *symb=tabc; - int32_t maxwidth = 0, x = 0, num = 0, diffpt; - - while (symb && symb != lastmatch) - { - num++; - - if (lastmatch) - { - diffpt = OSD_FindDiffPoint(symb->name,lastmatch->name); - if (diffpt < commonsize) - commonsize = diffpt; - } - - maxwidth = max((unsigned)maxwidth,Bstrlen(symb->name)); - lastmatch = symb; - if (!lastmatch->next) break; - symb=findsymbol(osdedittmp, lastmatch->next); - } - OSD_Printf(OSDTEXT_RED "Found %d possible completions for '%s':\n",num,osdedittmp); - maxwidth += 3; - symb = tabc; - OSD_Printf(" "); - while (symb && (symb != lastmatch)) - { - tabc = lastmatch = symb; - OSD_Printf("%-*s",maxwidth,symb->name); - if (!lastmatch->next) break; - symb=findsymbol(osdedittmp, lastmatch->next); - x += maxwidth; - if (x > (osdcols - maxwidth)) - { - x = 0; - OSD_Printf("\n"); - if (symb && (symb != lastmatch)) - OSD_Printf(" "); - } - } - if (x) OSD_Printf("\n"); - OSD_Printf(OSDTEXT_RED "Press TAB again to cycle through matches\n"); - } - } - } - else - { - tabc = findsymbol(osdedittmp, lastmatch->next); - if (!tabc && lastmatch) - tabc = findsymbol(osdedittmp, NULL); // wrap */ - } - - if (tabc) - { - for (i=osdeditcursor; i>0; i--) if (osdeditbuf[i-1] == ' ') break; - osdeditlen = i; - for (j=0; tabc->name[j] && osdeditlen <= OSD_EDITLENGTH - && (osdeditlen < commonsize); i++,j++,osdeditlen++) - osdeditbuf[i] = tabc->name[j]; - osdeditcursor = osdeditlen; - osdeditwinend = osdeditcursor; - osdeditwinstart = osdeditwinend-editlinewidth; - if (osdeditwinstart<0) - { - osdeditwinstart=0; - osdeditwinend = editlinewidth; - } - - lastmatch = tabc; - } - } - return 0; - case 11: // control k, delete all to end of line - Bmemset(osdeditbuf+osdeditcursor,0,sizeof(osdeditbuf)-osdeditcursor); - return 0; - case 12: // control l, clear screen - Bmemset(osdtext,0,sizeof(osdtext)); - Bmemset(osdfmt,osdtextpal+(osdtextshade<<5),sizeof(osdfmt)); - osdlines = 1; - return 0; - case 13: // control m, enter - if (osdeditlen>0) - { - osdeditbuf[osdeditlen] = 0; - if (Bstrcmp(osdhistorybuf[0], osdeditbuf)) - { - Bmemmove(osdhistorybuf[1], osdhistorybuf[0], (OSD_HISTORYDEPTH-1)*(OSD_EDITLENGTH+1)); - Bmemmove(osdhistorybuf[0], osdeditbuf, OSD_EDITLENGTH+1); - if (osdhistorysize < OSD_HISTORYDEPTH) osdhistorysize++; - osdhistorytotal++; - if (osdexeccount == OSD_HISTORYDEPTH) - OSD_Printf("Command Buffer Warning: Failed queueing command " - "for execution. Buffer full.\n"); - else - osdexeccount++; - } - else - { - if (osdexeccount == OSD_HISTORYDEPTH) - OSD_Printf("Command Buffer Warning: Failed queueing command " - "for execution. Buffer full.\n"); - else - osdexeccount++; - } - osdhistorypos=-1; - } - - osdeditlen=0; - osdeditcursor=0; - osdeditwinstart=0; - osdeditwinend=editlinewidth; - return 0; - case 14: // control n, next (ie. down arrow) - OSD_HistoryNext(); - return 0; - case 16: // control p, previous (ie. up arrow) - OSD_HistoryPrev(); - return 0; - case 21: // control u, delete all to beginning - if (osdeditcursor>0 && osdeditlen) - { - if (osdeditcursor0 && osdeditlen>0) - { - i=osdeditcursor; - while (i>0 && osdeditbuf[i-1]==asc_Space) i--; - while (i>0 && osdeditbuf[i-1]!=asc_Space) i--; - if (osdeditcursor= asc_Space) // text char - { - if ((osdflags & OSD_OVERTYPE) == 0) - { - if (osdeditlen == OSD_EDITLENGTH) // buffer full, can't insert another char - return 0; - if (osdeditcursor < osdeditlen) - Bmemmove(osdeditbuf+osdeditcursor+1, osdeditbuf+osdeditcursor, osdeditlen-osdeditcursor); - osdeditlen++; - } - else if (osdeditcursor == osdeditlen) - osdeditlen++; - - osdeditbuf[osdeditcursor++] = ch; - - if (osdeditcursor > osdeditwinend) - osdeditwinstart++, osdeditwinend++; - } - return 0; - } - return 0; -} - -int32_t OSD_HandleScanCode(int32_t sc, int32_t press) -{ - if ((osdflags & OSD_INITIALIZED) == 0) - return sc; - - if (sc == osdkey) - { - if (press) - { - osdscroll = -osdscroll; - if (osdrowscur == -1) - osdscroll = 1; - else if (osdrowscur == osdrows) - osdscroll = -1; - osdrowscur += osdscroll; - OSD_CaptureInput(osdscroll == 1); - osdscrtime = getticks(); - } - return 0; - } - else if ((osdflags & OSD_CAPTURE) == 0) - return sc; - - if (!press) - { - if (sc == sc_LeftShift || sc == sc_RightShift) - osdflags &= ~OSD_SHIFT; - if (sc == sc_LeftControl || sc == sc_RightControl) - osdflags &= ~OSD_CTRL; - return 0; - } - - keytime = gettime(); - - switch (sc) - { - case sc_Escape: - // OSD_ShowDisplay(0); - osdscroll = -1; - osdrowscur--; - OSD_CaptureInput(0); - osdscrtime = getticks(); - break; - case sc_PgUp: - if (osdhead < osdlines-1) - osdhead++; - break; - case sc_PgDn: - if (osdhead > 0) - osdhead--; - break; - case sc_Home: - if (osdflags & OSD_CTRL) - osdhead = osdlines-1; - else - { - osdeditcursor = 0; - osdeditwinstart = osdeditcursor; - osdeditwinend = osdeditwinstart+editlinewidth; - } - break; - case sc_End: - if (osdflags & OSD_CTRL) - osdhead = 0; - else - { - osdeditcursor = osdeditlen; - osdeditwinend = osdeditcursor; - osdeditwinstart = osdeditwinend-editlinewidth; - if (osdeditwinstart<0) - { - osdeditwinstart=0; - osdeditwinend = editlinewidth; - } - } - break; - case sc_Insert: - osdflags = (osdflags & ~OSD_OVERTYPE) | (-((osdflags & OSD_OVERTYPE) == 0) & OSD_OVERTYPE); - break; - case sc_LeftArrow: - if (osdeditcursor>0) - { - if (osdflags & OSD_CTRL) - { - while (osdeditcursor>0) - { - if (osdeditbuf[osdeditcursor-1] != asc_Space) - break; - osdeditcursor--; - } - while (osdeditcursor>0) - { - if (osdeditbuf[osdeditcursor-1] == asc_Space) - break; - osdeditcursor--; - } - } - else osdeditcursor--; - } - if (osdeditcursor=osdeditwinend) - { - osdeditwinstart+=(osdeditcursor-osdeditwinend); - osdeditwinend+=(osdeditcursor-osdeditwinend); - } - break; - case sc_UpArrow: - OSD_HistoryPrev(); - break; - case sc_DownArrow: - OSD_HistoryNext(); - break; - case sc_LeftShift: - case sc_RightShift: - osdflags |= OSD_SHIFT; - break; - case sc_LeftControl: - case sc_RightControl: - osdflags |= OSD_CTRL; - break; - case sc_CapsLock: - osdflags = (osdflags & ~OSD_CAPS) | (-((osdflags & OSD_CAPS) == 0) & OSD_CAPS); - break; - case sc_Delete: - if (osdeditcursor == osdeditlen || !osdeditlen) - return 0; - if (osdeditcursor <= osdeditlen-1) - Bmemmove(osdeditbuf+osdeditcursor, osdeditbuf+osdeditcursor+1, osdeditlen-osdeditcursor-1); - osdeditlen--; - break; - } - return 0; -} - - -// -// OSD_ResizeDisplay() -- Handles readjustment of the display when the screen resolution -// changes on us. -// -void OSD_ResizeDisplay(int32_t w, int32_t h) -{ - int32_t newcols; - int32_t newmaxlines; - char newtext[TEXTSIZE]; - char newfmt[TEXTSIZE]; - int32_t i,j,k; - - newcols = getcolumnwidth(w); - newmaxlines = TEXTSIZE / newcols; - - j = min(newmaxlines, osdmaxlines); - k = min(newcols, osdcols); - - Bmemset(newtext, asc_Space, TEXTSIZE); - for (i=j-1; i>=0; i--) - { - Bmemcpy(newtext+newcols*i, osdtext+osdcols*i, k); - Bmemcpy(newfmt+newcols*i, osdfmt+osdcols*i, k); - } - - Bmemcpy(osdtext, newtext, TEXTSIZE); - Bmemcpy(osdfmt, newfmt, TEXTSIZE); - osdcols = newcols; - osdmaxlines = newmaxlines; - osdmaxrows = getrowheight(h)-2; - - if (osdrows > osdmaxrows) osdrows = osdmaxrows; - - osdpos = 0; - osdhead = 0; - osdeditwinstart = 0; - osdeditwinend = editlinewidth; - white = -1; -} - - -// -// OSD_CaptureInput() -// -void OSD_CaptureInput(int32_t cap) -{ - osdflags = (osdflags & ~(OSD_CAPTURE|OSD_CTRL|OSD_SHIFT)) | (-cap & OSD_CAPTURE); - - grabmouse(cap == 0); - onshowosd(cap); - - if (cap) - releaseallbuttons(); - - bflushchars(); -} - - -// -// OSD_ShowDisplay() -- Shows or hides the onscreen display -// -void OSD_ShowDisplay(int32_t onf) -{ - osdflags = (osdflags & ~OSD_DRAW) | (-onf & OSD_DRAW); - OSD_CaptureInput(onf); -} - - -// -// OSD_Draw() -- Draw the onscreen display -// - -void OSD_Draw(void) -{ - uint32_t topoffs; - int32_t row, lines, x, len; - - if ((osdflags & OSD_INITIALIZED) == 0) - return; - - if (osdrowscur == 0) - OSD_ShowDisplay(osdflags & OSD_DRAW ? 0 : 1); - - if (osdrowscur == osdrows) - osdscroll = 0; - else - { - int32_t j; - - if ((osdrowscur < osdrows && osdscroll == 1) || osdrowscur < -1) - { - j = (getticks()-osdscrtime); - while (j > -1) - { - osdrowscur++; - j -= 200/osdrows; - if (osdrowscur > osdrows-1) - break; - } - } - if ((osdrowscur > -1 && osdscroll == -1) || osdrowscur > osdrows) - { - j = (getticks()-osdscrtime); - while (j > -1) - { - osdrowscur--; - j -= 200/osdrows; - if (osdrowscur < 1) - break; - } - } - osdscrtime = getticks(); - } - - if ((osdflags & OSD_DRAW) == 0 || !osdrowscur) return; - - topoffs = osdhead * osdcols; - row = osdrowscur-1; - lines = min(osdlines-osdhead, osdrowscur); - - begindrawing(); - - clearbackground(osdcols,osdrowscur+1); - - for (; lines>0; lines--, row--) - { - drawosdstr(0,row,osdtext+topoffs,osdcols,osdtextshade,osdtextpal); - topoffs+=osdcols; - } - - { - int32_t offset = ((osdflags & (OSD_CAPS|OSD_SHIFT)) == (OSD_CAPS|OSD_SHIFT) && osdhead > 0); - int32_t shade = osdpromptshade?osdpromptshade:(sintable[(totalclock<<4)&2047]>>11); - - if (osdhead == osdlines-1) drawosdchar(0,osdrowscur,'~',shade,osdpromptpal); - else if (osdhead > 0) drawosdchar(0,osdrowscur,'^',shade,osdpromptpal); - if (osdflags & OSD_CAPS) drawosdchar(0+(osdhead > 0),osdrowscur,'C',shade,osdpromptpal); - if (osdflags & OSD_SHIFT) drawosdchar(1+(osdflags & OSD_CAPS && osdhead > 0),osdrowscur,'H',shade,osdpromptpal); - - drawosdchar(2+offset,osdrowscur,'>',shade,osdpromptpal); - - len = min(osdcols-1-3-offset, osdeditlen-osdeditwinstart); - for (x=len-1; x>=0; x--) - drawosdchar(3+x+offset,osdrowscur,osdeditbuf[osdeditwinstart+x],osdeditshade<<1,osdeditpal); - - offset += 3+osdeditcursor-osdeditwinstart; - - drawosdcursor(offset,osdrowscur,osdflags & OSD_OVERTYPE,keytime); - - if (osdver[0]) - drawosdstr(osdcols-osdverlen,osdrowscur - (offset >= osdcols-osdverlen), - osdver,osdverlen,(sintable[(totalclock<<4)&2047]>>11),osdverpal); - } - - enddrawing(); -} - - -// -// OSD_Printf() -- Print a string to the onscreen display -// and write it to the log file -// - -static inline void OSD_LineFeed(void) -{ - Bmemmove(osdtext+osdcols, osdtext, TEXTSIZE-osdcols); - Bmemset(osdtext, asc_Space, osdcols); - Bmemmove(osdfmt+osdcols, osdfmt, TEXTSIZE-osdcols); - Bmemset(osdfmt, osdtextpal, osdcols); - if (osdlines < osdmaxlines) osdlines++; -} -#define MAX_ERRORS 4096 -void OSD_Printf(const char *fmt, ...) -{ - static char tmpstr[8192]; - char *chp, p=osdtextpal, s=osdtextshade; - va_list va; - - mutex_lock(&m_osdprintf); - - va_start(va, fmt); - Bvsnprintf(tmpstr, 8192, fmt, va); - va_end(va); - - if (tmpstr[0]=='^' && tmpstr[1]=='1' && tmpstr[2]=='0' && ++OSD_errors > MAX_ERRORS) - { - if (OSD_errors == MAX_ERRORS + 1) - Bstrcpy(tmpstr, OSD_ERROR "\nToo many errors. Logging errors stopped.\n"); - else - { - OSD_errors = MAX_ERRORS + 2; - mutex_unlock(&m_osdprintf); - return; - } - } - - if (linecnt < logcutoff) - { - if (osdlog && (!logcutoff || linecnt < logcutoff)) - { - chp = Bstrdup(tmpstr); - Bfputs(OSD_StripColors(chp, tmpstr), osdlog); - Bprintf("%s", chp); - Bfree(chp); - } - } - else if (linecnt == logcutoff) - { - Bfputs("\nMaximal log size reached. Logging stopped.\nSet the \"logcutoff\" console variable to a higher value if you need a longer log.\n", osdlog); - linecnt = logcutoff + 1; - } - - chp = tmpstr; - do - { - if (*chp == '\n') - { - osdpos=0; - linecnt++; - OSD_LineFeed(); - continue; - } - - if (*chp == '\r') - { - osdpos=0; - continue; - } - - if (*chp == '^') - { - if (isdigit(*(chp+1))) - { - char smallbuf[4]; - if (!isdigit(*(++chp+1))) - { - smallbuf[0] = *(chp); - smallbuf[1] = '\0'; - p = atol(smallbuf); - continue; - } - - smallbuf[0] = *(chp++); - smallbuf[1] = *(chp); - smallbuf[2] = '\0'; - p = atol(smallbuf); - continue; - } - - if (Btoupper(*(chp+1)) == 'S') - { - chp++; - if (isdigit(*(++chp))) - s = *chp; - continue; - } - - if (Btoupper(*(chp+1)) == 'O') - { - chp++; - p = osdtextpal; - s = osdtextshade; - continue; - } - } - - osdtext[osdpos] = *chp; - osdfmt[osdpos++] = p+(s<<5); - - if (osdpos == osdcols) - { - osdpos = 0; - OSD_LineFeed(); - } - } - while (*(++chp)); - - mutex_unlock(&m_osdprintf); -} - - -// -// OSD_DispatchQueued() -- Executes any commands queued in the buffer -// -void OSD_DispatchQueued(void) -{ - int32_t cmd; - - if (!osdexeccount) return; - - cmd=osdexeccount-1; - osdexeccount=0; - - for (; cmd>=0; cmd--) - OSD_Dispatch((const char *)osdhistorybuf[cmd]); -} - - -// -// OSD_Dispatch() -- Executes a command string -// - -static char *strtoken(char *s, char **ptrptr, int32_t *restart) -{ - char *p, *p2, *start; - - *restart = 0; - if (!ptrptr) return NULL; - - // if s != NULL, we process from the start of s, otherwise - // we just continue with where ptrptr points to - if (s) p = s; - else p = *ptrptr; - - if (!p) return NULL; - - // eat up any leading whitespace - while (*p != 0 && *p != ';' && *p == ' ') p++; - - // a semicolon is an end of statement delimiter like a \0 is, so we signal - // the caller to 'restart' for the rest of the string pointed at by *ptrptr - if (*p == ';') - { - *restart = 1; - *ptrptr = p+1; - return NULL; - } - // or if we hit the end of the input, signal all done by nulling *ptrptr - else if (*p == 0) - { - *ptrptr = NULL; - return NULL; - } - - if (*p == '\"') - { - // quoted string - start = ++p; - p2 = p; - while (*p != 0) - { - if (*p == '\"') - { - p++; - break; - } - else if (*p == '\\') - { - switch (*(++p)) - { - case 'n': - *p2 = '\n'; break; - case 'r': - *p2 = '\r'; break; - default: - *p2 = *p; break; - } - } - else - { - *p2 = *p; - } - p2++, p++; - } - *p2 = 0; - } - else - { - start = p; - while (*p != 0 && *p != ';' && *p != ' ') p++; - } - - // if we hit the end of input, signal all done by nulling *ptrptr - if (*p == 0) - { - *ptrptr = NULL; - } - // or if we came upon a semicolon, signal caller to restart with the - // string at *ptrptr - else if (*p == ';') - { - *p = 0; - *ptrptr = p+1; - *restart = 1; - } - // otherwise, clip off the token and carry on - else - { - *(p++) = 0; - *ptrptr = p; - } - - return start; -} - -#define MAXPARMS 512 -int32_t OSD_Dispatch(const char *cmd) -{ - char *workbuf, *wp, *wtp, *state; - int32_t restart = 0; - - workbuf = state = Bstrdup(cmd); - if (!workbuf) return -1; - - do - { - int32_t numparms = 0; - symbol_t *symb; - osdfuncparm_t ofp; - char *parms[MAXPARMS]; - - Bmemset(parms, 0, sizeof(parms)); - - if ((wp = strtoken(state, &wtp, &restart)) == NULL) - { - state = wtp; - continue; - } - - if ((symb = findexactsymbol(wp)) == NULL) - { - if ((wp[0] != '/' || wp[1] != '/') && !m32_osd_tryscript) // cheap hack for comments in cfgs - { - OSD_Printf(OSDTEXT_RED "\"%s\" is not a valid command or cvar\n", wp); - } - else if (m32_osd_tryscript) - { - M32RunScript(cmd); - } - Bfree(workbuf); - return -1; - } - - ofp.name = wp; - while (wtp && !restart) - { - wp = strtoken(NULL, &wtp, &restart); - if (wp && numparms < MAXPARMS) parms[numparms++] = wp; - } - ofp.numparms = numparms; - ofp.parms = (const char **)parms; - ofp.raw = cmd; - - switch ((intptr_t)symb->func) - { - case(intptr_t)OSD_ALIAS: - OSD_Dispatch(symb->help); - case(intptr_t)OSD_UNALIASED: - break; - default: - switch (symb->func(&ofp)) - { - case OSDCMD_OK: - break; - case OSDCMD_SHOWHELP: - OSD_Printf("%s\n", symb->help); - break; - } - break; - } - - state = wtp; - } - while (wtp && restart); - - Bfree(workbuf); - - return 0; -} - - -// -// OSD_RegisterFunction() -- Registers a new function -// -int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)(const osdfuncparm_t *)) -{ - symbol_t *symb; - const char *cp; - - if ((osdflags & OSD_INITIALIZED) == 0) - OSD_Init(); - - if (!name || !name[0]) - { - OSD_Printf("OSD_RegisterFunction(): can't register function with null name\n"); - return -1; - } - - if (!func) - { - OSD_Printf("OSD_RegisterFunction(): can't register null function\n"); - return -1; - } - - // check for illegal characters in name - for (cp = name; *cp; cp++) - { - if ((cp == name) && (*cp >= '0') && (*cp <= '9')) - { - OSD_Printf("OSD_RegisterFunction(): first character of function name \"%s\" must not be a numeral\n", name); - return -1; - } - if ((*cp < '0') || - (*cp > '9' && *cp < 'A') || - (*cp > 'Z' && *cp < 'a' && *cp != '_') || - (*cp > 'z')) - { - OSD_Printf("OSD_RegisterFunction(): illegal character in function name \"%s\"\n", name); - return -1; - } - } - - if (!help) help = "(no description for this function)"; - - symb = findexactsymbol(name); - - if (symb) // allow this now for reusing an alias name - { - /* - if (symb->func != OSD_ALIAS && symb->func != OSD_UNALIASED) - { - OSD_Printf("OSD_RegisterFunction(): \"%s\" is already defined\n", name); - return -1; - } - */ -// Bfree((char *)symb->help); - symb->help = help; - symb->func = func; - return 0; - } - - symb = addnewsymbol(name); - - if (!symb) - { - OSD_Printf("OSD_RegisterFunction(): Failed registering function \"%s\"\n", name); - return -1; - } - - symb->name = name; - symb->help = help; - symb->func = func; - - return 0; -} - -// -// OSD_SetVersionString() -// -void OSD_SetVersion(const char *version, int32_t shade, int32_t pal) -{ - Bstrcpy(osdver,version); - osdverlen = Bstrlen(osdver); - osdvershade = shade; - osdverpal = pal; -} - -// -// addnewsymbol() -- Allocates space for a new symbol and attaches it -// appropriately to the lists, sorted. -// - -static symbol_t *addnewsymbol(const char *name) -{ - symbol_t *newsymb, *s, *t; - - if (osdnumsymbols >= MAXSYMBOLS) return NULL; - newsymb = (symbol_t *)Bmalloc(sizeof(symbol_t)); - if (!newsymb) { return NULL; } - Bmemset(newsymb, 0, sizeof(symbol_t)); - - // link it to the main chain - if (!symbols) - { - symbols = newsymb; - } - else - { - if (Bstrcasecmp(name, symbols->name) <= 0) - { - t = symbols; - symbols = newsymb; - symbols->next = t; - } - else - { - s = symbols; - while (s->next) - { - if (Bstrcasecmp(s->next->name, name) > 0) break; - s=s->next; - } - t = s->next; - s->next = newsymb; - newsymb->next = t; - } - } - hash_add(&h_osd, name, osdnumsymbols, 1); - name = Bstrtolower(Bstrdup(name)); - hash_add(&h_osd, name, osdnumsymbols, 1); - Bfree((void *)name); - osdsymbptrs[osdnumsymbols++] = newsymb; - return newsymb; -} - - -// -// findsymbol() -- Finds a symbol, possibly partially named -// -static symbol_t *findsymbol(const char *name, symbol_t *startingat) -{ - if (!startingat) startingat = symbols; - if (!startingat) return NULL; - - for (; startingat; startingat=startingat->next) - if (startingat->func != OSD_UNALIASED && !Bstrncasecmp(name, startingat->name, Bstrlen(name))) return startingat; - - return NULL; -} - -// -// findexactsymbol() -- Finds a symbol, complete named -// -static symbol_t *findexactsymbol(const char *name) -{ - int32_t i; - char *lname = Bstrdup(name); - if (!symbols) return NULL; - - i = hash_find(&h_osd,lname); - if (i > -1) - { -// if ((symbol_t *)osdsymbptrs[i]->func == OSD_UNALIASED) -// return NULL; - Bfree(lname); - return osdsymbptrs[i]; - } - - // try it again - Bstrtolower(lname); - i = hash_find(&h_osd,lname); - Bfree(lname); - - if (i > -1) - return osdsymbptrs[i]; - return NULL; -} - -int32_t osdcmd_cvar_set(const osdfuncparm_t *parm) -{ - int32_t showval = (parm->numparms == 0); - int32_t i; - - i = hash_find(&h_cvars, parm->name); - - if (i < 0) - for (i = osdnumcvars-1; i >= 0; i--) - if (!Bstrcasecmp(parm->name, cvars[i].name)) break; - - if (i > -1) - { - if ((cvars[i].type & CVAR_NOMULTI) && numplayers > 1) - { - // sound the alarm - OSD_Printf("Cvar \"%s\" locked in multiplayer.\n",cvars[i].name); - return OSDCMD_OK; - } - - switch (cvars[i].type&(CVAR_FLOAT|CVAR_DOUBLE|CVAR_INT|CVAR_UINT|CVAR_BOOL|CVAR_STRING)) - { - case CVAR_FLOAT: - { - float val; - if (showval) - { - OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(float *)cvars[i].var,(char *)cvars[i].helpstr); - return OSDCMD_OK; - } - - sscanf(parm->parms[0], "%f", &val); - - if (val < cvars[i].min || val > cvars[i].max) - { - OSD_Printf("%s value out of range\n",cvars[i].name); - return OSDCMD_OK; - } - *(float *)cvars[i].var = val; - if (!OSD_ParsingScript()) - OSD_Printf("%s %f",cvars[i].name,val); - } - break; - case CVAR_DOUBLE: - { - double val; - if (showval) - { - OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(double *)cvars[i].var,(char *)cvars[i].helpstr); - return OSDCMD_OK; - } - - sscanf(parm->parms[0], "%lf", &val); - - if (val < cvars[i].min || val > cvars[i].max) - { - OSD_Printf("%s value out of range\n",cvars[i].name); - return OSDCMD_OK; - } - *(double *)cvars[i].var = val; - if (!OSD_ParsingScript()) - OSD_Printf("%s %f",cvars[i].name,val); - } - break; - case CVAR_INT: - case CVAR_UINT: - case CVAR_BOOL: - { - int32_t val; - if (showval) - { - OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvars[i].name,*(int32_t *)cvars[i].var,(char *)cvars[i].helpstr); - return OSDCMD_OK; - } - - val = atoi(parm->parms[0]); - if (cvars[i].type & CVAR_BOOL) val = val != 0; - - if (val < cvars[i].min || val > cvars[i].max) - { - OSD_Printf("%s value out of range\n",cvars[i].name); - return OSDCMD_OK; - } - *(int32_t *)cvars[i].var = val; - if (!OSD_ParsingScript()) - OSD_Printf("%s %d",cvars[i].name,val); - } - break; - case CVAR_STRING: - { - if (showval) - { - OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvars[i].name,(char *)cvars[i].var,(char *)cvars[i].helpstr); - return OSDCMD_OK; - } - - Bstrncpy((char *)cvars[i].var, parm->parms[0], cvars[i].max-1); - ((char *)cvars[i].var)[cvars[i].max-1] = 0; - if (!OSD_ParsingScript()) - OSD_Printf("%s %s",cvars[i].name,(char *)cvars[i].var); - } - break; - default: - break; - } - } - - if (!OSD_ParsingScript()) - OSD_Printf("\n"); - - return OSDCMD_OK; -} - -void OSD_WriteCvars(FILE *fp) -{ - uint32_t i; - - if (!fp) - return; - - for (i=0; i - -#ifndef MAC_OS_VERSION_10_3 -# define MAC_OS_VERSION_10_3 1030 -#endif - -int osx_msgbox(char *name, char *msg) -{ - NSString *mmsg = [[NSString alloc] initWithCString: msg]; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - NSAlert *alert = [[NSAlert alloc] init]; - [alert addButtonWithTitle: @"OK"]; - [alert setInformativeText: mmsg]; - [alert setAlertStyle: NSInformationalAlertStyle]; - - [alert runModal]; - - [alert release]; - -#else - NSRunAlertPanel(nil, mmsg, @"OK", nil, nil); -#endif - - [mmsg release]; - return 0; -} - -int osx_ynbox(char *name, char *msg) -{ - NSString *mmsg = [[NSString alloc] initWithCString: msg]; - int r; - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - NSAlert *alert = [[NSAlert alloc] init]; - - [alert addButtonWithTitle:@"Yes"]; - [alert addButtonWithTitle:@"No"]; - [alert setInformativeText: mmsg]; - [alert setAlertStyle: NSInformationalAlertStyle]; - - r = ([alert runModal] == NSAlertFirstButtonReturn); - - [alert release]; -#else - r = (NSRunAlertPanel(nil, mmsg, @"Yes", @"No", nil) == NSAlertDefaultReturn); -#endif - - [mmsg release]; - return r; -} diff --git a/polymer-perf/eduke32/build/src/polymer.c b/polymer-perf/eduke32/build/src/polymer.c deleted file mode 100644 index 7a2c49781..000000000 --- a/polymer-perf/eduke32/build/src/polymer.c +++ /dev/null @@ -1,5375 +0,0 @@ -// blah - -#ifdef USE_OPENGL - -#define POLYMER_C -#include "polymer.h" -#include "engine_priv.h" -#include "crc32.h" - -// CVARS -int32_t pr_lighting = 1; -int32_t pr_normalmapping = 1; -int32_t pr_specularmapping = 1; -int32_t pr_shadows = 1; -int32_t pr_shadowcount = 5; -int32_t pr_shadowdetail = 4; -int32_t pr_shadowfiltering = 1; -int32_t pr_maxlightpasses = 10; -int32_t pr_maxlightpriority = PR_MAXLIGHTPRIORITY; -int32_t pr_fov = 426; // appears to be the classic setting. -float pr_customaspect = 0.0f; -int32_t pr_billboardingmode = 1; -int32_t pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood -int32_t pr_wireframe = 0; -int32_t pr_vbos = 2; -int32_t pr_gpusmoothing = 1; -int32_t pr_overrideparallax = 0; -float pr_parallaxscale = 0.1f; -float pr_parallaxbias = 0.0f; -int32_t pr_overridespecular = 0; -float pr_specularpower = 15.0f; -float pr_specularfactor = 1.0f; -int32_t pr_highpalookups = 1; -int32_t pr_overridehud = 0; -float pr_hudxadd = 0.0f; -float pr_hudyadd = 0.0f; -float pr_hudzadd = 0.0f; -int32_t pr_hudangadd = 0; -int32_t pr_hudfov = 426; -float pr_overridemodelscale = 0.0f; -int32_t pr_ati_fboworkaround = 0; -int32_t pr_ati_nodepthoffset = 0; -#ifdef __APPLE__ -int32_t pr_ati_textureformat_one = 0; -#endif - -int32_t r_pr_maxlightpasses = 5; // value of the cvar (not live value), used to detect changes - -GLenum mapvbousage = GL_STREAM_DRAW_ARB; -GLenum modelvbousage = GL_STATIC_DRAW_ARB; - -// BUILD DATA -_prsector *prsectors[MAXSECTORS]; -_prwall *prwalls[MAXWALLS]; -_prsprite *prsprites[MAXSPRITES]; -_prmaterial mdspritematerial; -_prhighpalookup prhighpalookups[MAXBASEPALS][MAXPALOOKUPS]; - -static const GLfloat vertsprite[4 * 5] = -{ - -0.5f, 0.0f, 0.0f, - 0.0f, 1.0f, - 0.5f, 0.0f, 0.0f, - 1.0f, 1.0f, - 0.5f, 1.0f, 0.0f, - 1.0f, 0.0f, - -0.5f, 1.0f, 0.0f, - 0.0f, 0.0f, -}; - -static const GLfloat horizsprite[4 * 5] = -{ - -0.5f, 0.0f, 0.5f, - 0.0f, 0.0f, - 0.5f, 0.0f, 0.5f, - 1.0f, 0.0f, - 0.5f, 0.0f, -0.5f, - 1.0f, 1.0f, - -0.5f, 0.0f, -0.5f, - 0.0f, 1.0f, -}; - -static const GLfloat skyboxdata[4 * 5 * 6] = -{ - // -ZY - -0.5f, -0.5f, 0.5f, - 0.0f, 1.0f, - -0.5f, -0.5f, -0.5f, - 1.0f, 1.0f, - -0.5f, 0.5f, -0.5f, - 1.0f, 0.0f, - -0.5f, 0.5f, 0.5f, - 0.0f, 0.0f, - - // XY - -0.5f, -0.5f, -0.5f, - 0.0f, 1.0f, - 0.5f, -0.5f, -0.5f, - 1.0f, 1.0f, - 0.5f, 0.5f, -0.5f, - 1.0f, 0.0f, - -0.5f, 0.5f, -0.5f, - 0.0f, 0.0f, - - // ZY - 0.5f, -0.5f, -0.5f, - 0.0f, 1.0f, - 0.5f, -0.5f, 0.5f, - 1.0f, 1.0f, - 0.5f, 0.5f, 0.5f, - 1.0f, 0.0f, - 0.5f, 0.5f, -0.5f, - 0.0f, 0.0f, - - // -XY - 0.5f, -0.5f, 0.5f, - 0.0f, 1.0f, - -0.5f, -0.5f, 0.5f, - 1.0f, 1.0f, - -0.5f, 0.5f, 0.5f, - 1.0f, 0.0f, - 0.5f, 0.5f, 0.5f, - 0.0f, 0.0f, - - // XZ - -0.5f, 0.5f, -0.5f, - 1.0f, 1.0f, - 0.5f, 0.5f, -0.5f, - 1.0f, 0.0f, - 0.5f, 0.5f, 0.5f, - 0.0f, 0.0f, - -0.5f, 0.5f, 0.5f, - 0.0f, 1.0f, - - // X-Z - -0.5f, -0.5f, 0.5f, - 0.0f, 0.0f, - 0.5f, -0.5f, 0.5f, - 0.0f, 1.0f, - 0.5f, -0.5f, -0.5f, - 1.0f, 1.0f, - -0.5f, -0.5f, -0.5f, - 1.0f, 0.0f, -}; - -GLuint skyboxdatavbo; - -GLfloat artskydata[16]; - -// LIGHTS -#pragma pack(push,1) -_prlight prlights[PR_MAXLIGHTS]; -int32_t lightcount; -int32_t curlight; -#pragma pack(pop) - -static const GLfloat shadowBias[] = -{ - 0.5, 0.0, 0.0, 0.0, - 0.0, 0.5, 0.0, 0.0, - 0.0, 0.0, 0.5, 0.0, - 0.5, 0.5, 0.5, 1.0 -}; - -// MATERIALS -_prprogrambit prprogrambits[PR_BIT_COUNT] = { - { - 1 << PR_BIT_HEADER, - // vert_def - "#version 120\n" - "#extension GL_ARB_texture_rectangle : enable\n" - "\n", - // vert_prog - "", - // frag_def - "#version 120\n" - "#extension GL_ARB_texture_rectangle : enable\n" - "\n", - // frag_prog - "", - }, - { - 1 << PR_BIT_ANIM_INTERPOLATION, - // vert_def - "attribute vec4 nextFrameData;\n" - "attribute vec4 nextFrameNormal;\n" - "uniform float frameProgress;\n" - "\n", - // vert_prog - " vec4 currentFramePosition;\n" - " vec4 nextFramePosition;\n" - "\n" - " currentFramePosition = curVertex * (1.0 - frameProgress);\n" - " nextFramePosition = nextFrameData * frameProgress;\n" - " curVertex = currentFramePosition + nextFramePosition;\n" - "\n" - " currentFramePosition = vec4(curNormal, 1.0) * (1.0 - frameProgress);\n" - " nextFramePosition = nextFrameNormal * frameProgress;\n" - " curNormal = vec3(currentFramePosition + nextFramePosition);\n" - "\n", - // frag_def - "", - // frag_prog - "", - }, - { - 1 << PR_BIT_LIGHTING_PASS, - // vert_def - "", - // vert_prog - "", - // frag_def - "", - // frag_prog - " isLightingPass = 1;\n" - " result = vec4(0.0, 0.0, 0.0, 1.0);\n" - "\n", - }, - { - 1 << PR_BIT_NORMAL_MAP, - // vert_def - "attribute vec3 T;\n" - "attribute vec3 B;\n" - "attribute vec3 N;\n" - "uniform vec3 eyePosition;\n" - "varying vec3 tangentSpaceEyeVec;\n" - "\n", - // vert_prog - " TBN = mat3(T, B, N);\n" - " tangentSpaceEyeVec = eyePosition - vec3(curVertex);\n" - " tangentSpaceEyeVec = TBN * tangentSpaceEyeVec;\n" - "\n" - " isNormalMapped = 1;\n" - "\n", - // frag_def - "uniform sampler2D normalMap;\n" - "uniform vec2 normalBias;\n" - "varying vec3 tangentSpaceEyeVec;\n" - "\n", - // frag_prog - " vec4 normalStep;\n" - " float biasedHeight;\n" - "\n" - " eyeVec = normalize(tangentSpaceEyeVec);\n" - "\n" - " for (int i = 0; i < 4; i++) {\n" - " normalStep = texture2D(normalMap, commonTexCoord.st);\n" - " biasedHeight = normalStep.a * normalBias.x - normalBias.y;\n" - " commonTexCoord += (biasedHeight - commonTexCoord.z) * normalStep.z * eyeVec;\n" - " }\n" - "\n" - " normalTexel = texture2D(normalMap, commonTexCoord.st);\n" - "\n" - " isNormalMapped = 1;\n" - "\n", - }, - { - 1 << PR_BIT_DIFFUSE_MAP, - // vert_def - "uniform vec2 diffuseScale;\n" - "\n", - // vert_prog - " gl_TexCoord[0] = vec4(diffuseScale, 1.0, 1.0) * gl_MultiTexCoord0;\n" - "\n", - // frag_def - "uniform sampler2D diffuseMap;\n" - "\n", - // frag_prog - " diffuseTexel = texture2D(diffuseMap, commonTexCoord.st);\n" - "\n", - }, - { - 1 << PR_BIT_DIFFUSE_DETAIL_MAP, - // vert_def - "uniform vec2 detailScale;\n" - "varying vec2 fragDetailScale;\n" - "\n", - // vert_prog - " fragDetailScale = detailScale;\n" - " if (isNormalMapped == 0)\n" - " gl_TexCoord[1] = vec4(detailScale, 1.0, 1.0) * gl_MultiTexCoord0;\n" - "\n", - // frag_def - "uniform sampler2D detailMap;\n" - "varying vec2 fragDetailScale;\n" - "\n", - // frag_prog - " if (isNormalMapped == 0)\n" - " diffuseTexel *= texture2D(detailMap, gl_TexCoord[1].st);\n" - " else\n" - " diffuseTexel *= texture2D(detailMap, commonTexCoord.st * fragDetailScale);\n" - " diffuseTexel.rgb *= 2.0;\n" - "\n", - }, - { - 1 << PR_BIT_DIFFUSE_MODULATION, - // vert_def - "", - // vert_prog - " gl_FrontColor = gl_Color;\n" - "\n", - // frag_def - "", - // frag_prog - " if (isLightingPass == 0)\n" - " result *= vec4(gl_Color);\n" - "\n", - }, - { - 1 << PR_BIT_DIFFUSE_MAP2, - // vert_def - "", - // vert_prog - "", - // frag_def - "", - // frag_prog - " if (isLightingPass == 0)\n" - " result *= diffuseTexel;\n" - "\n", - }, - { - 1 << PR_BIT_HIGHPALOOKUP_MAP, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform sampler3D highPalookupMap;\n" - "\n", - // frag_prog - " float highPalScale = 0.9921875; // for 6 bits\n" - " float highPalBias = 0.00390625;\n" - "\n" - " if (isLightingPass == 0)\n" - " result.rgb = texture3D(highPalookupMap, result.rgb * highPalScale + highPalBias).rgb;\n" - " diffuseTexel.rgb = texture3D(highPalookupMap, diffuseTexel.rgb * highPalScale + highPalBias).rgb;\n" - "\n", - }, - { - 1 << PR_BIT_SPECULAR_MAP, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform sampler2D specMap;\n" - "\n", - // frag_prog - " specTexel = texture2D(specMap, commonTexCoord.st);\n" - "\n" - " isSpecularMapped = 1;\n" - "\n", - }, - { - 1 << PR_BIT_SPECULAR_MATERIAL, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform vec2 specMaterial;\n" - "\n", - // frag_prog - " specularMaterial = specMaterial;\n" - "\n", - }, - { - 1 << PR_BIT_MIRROR_MAP, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform sampler2DRect mirrorMap;\n" - "\n", - // frag_prog - " vec4 mirrorTexel;\n" - " vec2 mirrorCoords;\n" - "\n" - " mirrorCoords = gl_FragCoord.st;\n" - " if (isNormalMapped == 1) {\n" - " mirrorCoords += 100.0 * (normalTexel.rg - 0.5);\n" - " }\n" - " mirrorTexel = texture2DRect(mirrorMap, mirrorCoords);\n" - " result = vec4((result.rgb * (1.0 - specTexel.a)) + (mirrorTexel.rgb * specTexel.rgb * specTexel.a), result.a);\n" - "\n", - }, - { - 1 << PR_BIT_FOG, - // vert_def - "", - // vert_prog - "", - // frag_def - "", - // frag_prog - " float fragDepth;\n" - " float fogFactor;\n" - "\n" - " fragDepth = gl_FragCoord.z / gl_FragCoord.w / 35.0;\n" - " fragDepth *= fragDepth;\n" - " fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fragDepth * 1.442695);\n" - " result.rgb = mix(gl_Fog.color.rgb, result.rgb, fogFactor);\n" - "\n", - }, - { - 1 << PR_BIT_GLOW_MAP, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform sampler2D glowMap;\n" - "\n", - // frag_prog - " vec4 glowTexel;\n" - "\n" - " glowTexel = texture2D(glowMap, commonTexCoord.st);\n" - " result = vec4((result.rgb * (1.0 - glowTexel.a)) + (glowTexel.rgb * glowTexel.a), result.a);\n" - "\n", - }, - { - 1 << PR_BIT_PROJECTION_MAP, - // vert_def - "uniform mat4 shadowProjMatrix;\n" - "\n", - // vert_prog - " gl_TexCoord[2] = shadowProjMatrix * curVertex;\n" - "\n", - // frag_def - "", - // frag_prog - "", - }, - { - 1 << PR_BIT_SHADOW_MAP, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform sampler2DShadow shadowMap;\n" - "\n", - // frag_prog - " shadowResult = shadow2DProj(shadowMap, gl_TexCoord[2]).a;\n" - "\n", - }, - { - 1 << PR_BIT_LIGHT_MAP, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform sampler2D lightMap;\n" - "\n", - // frag_prog - " lightTexel = texture2D(lightMap, gl_TexCoord[2].st / gl_TexCoord[2].q).rgb;\n" - "\n", - }, - { - 1 << PR_BIT_SPOT_LIGHT, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform vec3 spotDir;\n" - "uniform vec2 spotRadius;\n" - "\n", - // frag_prog - " spotVector = spotDir;\n" - " spotCosRadius = spotRadius;\n" - " isSpotLight = 1;\n" - "\n", - }, - { - 1 << PR_BIT_POINT_LIGHT, - // vert_def - "varying vec3 vertexNormal;\n" - "varying vec3 eyeVector;\n" - "varying vec3 lightVector;\n" - "varying vec3 tangentSpaceLightVector;\n" - "\n", - // vert_prog - " vec3 vertexPos;\n" - "\n" - " vertexPos = vec3(gl_ModelViewMatrix * curVertex);\n" - " eyeVector = -vertexPos;\n" - " lightVector = gl_LightSource[0].ambient.rgb - vertexPos;\n" - "\n" - " if (isNormalMapped == 1) {\n" - " tangentSpaceLightVector = gl_LightSource[0].specular.rgb - vec3(curVertex);\n" - " tangentSpaceLightVector = TBN * tangentSpaceLightVector;\n" - " } else\n" - " vertexNormal = normalize(gl_NormalMatrix * curNormal);\n" - "\n", - // frag_def - "varying vec3 vertexNormal;\n" - "varying vec3 eyeVector;\n" - "varying vec3 lightVector;\n" - "varying vec3 tangentSpaceLightVector;\n" - "\n", - // frag_prog - " float pointLightDistance;\n" - " float lightAttenuation;\n" - " float spotAttenuation;\n" - " vec3 N, L, E, R, D;\n" - " vec3 lightDiffuse;\n" - " float lightSpecular;\n" - " float NdotL;\n" - " float spotCosAngle;\n" - "\n" - " L = normalize(lightVector);\n" - "\n" - " pointLightDistance = dot(lightVector,lightVector);\n" - " lightAttenuation = clamp(1.0 - pointLightDistance * gl_LightSource[0].linearAttenuation, 0.0, 1.0);\n" - " spotAttenuation = 1.0;\n" - "\n" - " if (isSpotLight == 1) {\n" - " D = normalize(spotVector);\n" - " spotCosAngle = dot(-L, D);\n" - " spotAttenuation = clamp((spotCosAngle - spotCosRadius.x) * spotCosRadius.y, 0.0, 1.0);\n" - " }\n" - "\n" - " if (isNormalMapped == 1) {\n" - " E = eyeVec;\n" - " N = normalize(2.0 * (normalTexel.rgb - 0.5));\n" - " L = normalize(tangentSpaceLightVector);\n" - " } else {\n" - " E = normalize(eyeVector);\n" - " N = normalize(vertexNormal);\n" - " }\n" - " NdotL = max(dot(N, L), 0.0);\n" - "\n" - " R = reflect(-L, N);\n" - "\n" - " lightDiffuse = gl_Color.a * shadowResult * lightTexel *\n" - " gl_LightSource[0].diffuse.rgb * lightAttenuation * spotAttenuation;\n" - " result += vec4(lightDiffuse * diffuseTexel.a * diffuseTexel.rgb * NdotL, 0.0);\n" - "\n" - " if (isSpecularMapped == 0)\n" - " specTexel.rgb = diffuseTexel.rgb * diffuseTexel.a;\n" - "\n" - " lightSpecular = pow( max(dot(R, E), 0.0), specularMaterial.x * specTexel.a) * specularMaterial.y;\n" - " result += vec4(lightDiffuse * specTexel.rgb * lightSpecular, 0.0);\n" - "\n", - }, - { - 1 << PR_BIT_FOOTER, - // vert_def - "void main(void)\n" - "{\n" - " vec4 curVertex = gl_Vertex;\n" - " vec3 curNormal = gl_Normal;\n" - " int isNormalMapped = 0;\n" - " mat3 TBN;\n" - "\n" - " gl_TexCoord[0] = gl_MultiTexCoord0;\n" - "\n", - // vert_prog - " gl_Position = gl_ModelViewProjectionMatrix * curVertex;\n" - "}\n", - // frag_def - "void main(void)\n" - "{\n" - " vec3 commonTexCoord = vec3(gl_TexCoord[0].st, 0.0);\n" - " vec4 result = vec4(1.0, 1.0, 1.0, 1.0);\n" - " vec4 diffuseTexel = vec4(1.0, 1.0, 1.0, 1.0);\n" - " vec4 specTexel = vec4(1.0, 1.0, 1.0, 1.0);\n" - " vec4 normalTexel;\n" - " int isLightingPass = 0;\n" - " int isNormalMapped = 0;\n" - " int isSpecularMapped = 0;\n" - " vec3 eyeVec;\n" - " int isSpotLight = 0;\n" - " vec3 spotVector;\n" - " vec2 spotCosRadius;\n" - " float shadowResult = 1.0;\n" - " vec2 specularMaterial = vec2(15.0, 1.0);\n" - " vec3 lightTexel = vec3(1.0, 1.0, 1.0);\n" - "\n", - // frag_prog - " gl_FragColor = result;\n" - "}\n", - } -}; - -_prprograminfo prprograms[1 << PR_BIT_COUNT]; - -int32_t overridematerial; -int32_t globaloldoverridematerial; - -int32_t rotatespritematerialbits; - -// RENDER TARGETS -_prrt *prrts; - -// CONTROL -GLfloat spritemodelview[16]; -GLfloat mdspritespace[4][4]; -GLfloat rootmodelviewmatrix[16]; -GLfloat *curmodelviewmatrix; -GLfloat rootskymodelviewmatrix[16]; -GLfloat *curskymodelviewmatrix; - -static int16_t sectorqueue[MAXSECTORS]; -static int16_t querydelay[MAXSECTORS]; -static GLuint queryid[MAXWALLS]; -static int16_t drawingstate[MAXSECTORS]; - -float horizang; -int16_t viewangle; - -int32_t depth; -_prmirror mirrors[10]; - -GLUtesselator* prtess; - -int16_t cursky; -char curskypal; -int8_t curskyshade; - -_pranimatespritesinfo asi; - -int32_t polymersearching; - -// EXTERNAL FUNCTIONS -int32_t polymer_init(void) -{ - int32_t i, j; - - if (pr_verbosity >= 1) OSD_Printf("Initializing Polymer subsystem...\n"); - - if (!glinfo.texnpot || - !glinfo.depthtex || - !glinfo.shadow || - !glinfo.fbos || - !glinfo.rect || - !glinfo.multitex || - !glinfo.vbos || - !glinfo.occlusionqueries || - !glinfo.glsl) - { - OSD_Printf("PR : Your video card driver/combo doesn't support the necessary features!\n"); - OSD_Printf("PR : Disabling Polymer...\n"); - return (0); - } - - Bmemset(&prsectors[0], 0, sizeof(prsectors[0]) * MAXSECTORS); - Bmemset(&prwalls[0], 0, sizeof(prwalls[0]) * MAXWALLS); - - prtess = bgluNewTess(); - if (prtess == 0) - { - OSD_Printf("PR : Tessellation object initialization failed!\n"); - return (0); - } - - polymer_loadboard(); - - polymer_initartsky(); - skyboxdatavbo = 0; - - i = 0; - while (i < nextmodelid) - { - if (models[i]) - { - md3model_t* m; - - m = (md3model_t*)models[i]; - m->indices = NULL; - } - i++; - } - - i = 0; - while (i < (1 << PR_BIT_COUNT)) - { - prprograms[i].handle = 0; - i++; - } - - overridematerial = 0xFFFFFFFF; - - polymersearching = FALSE; - - polymer_initrendertargets(pr_shadowcount + 1); - - // Prime highpalookup maps - i = 0; - while (i < MAXBASEPALS) - { - j = 0; - while (j < MAXPALOOKUPS) - { - if (prhighpalookups[i][j].data) - { - bglGenTextures(1, &prhighpalookups[i][j].map); - bglBindTexture(GL_TEXTURE_3D, prhighpalookups[i][j].map); - bglTexImage3D(GL_TEXTURE_3D, // target - 0, // mip level - GL_RGBA, // internalFormat - PR_HIGHPALOOKUP_DIM, // width - PR_HIGHPALOOKUP_DIM, // height - PR_HIGHPALOOKUP_DIM, // depth - 0, // border - GL_BGRA, // upload format - GL_UNSIGNED_BYTE, // upload component type - prhighpalookups[i][j].data); // data pointer - bglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - bglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - bglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglBindTexture(GL_TEXTURE_3D, 0); - } - j++; - } - i++; - } - - if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete.\n"); - - return (1); -} - -void polymer_uninit(void) -{ - int32_t i, j; - - polymer_freeboard(); - - i = 0; - while (i < MAXBASEPALS) - { - j = 0; - while (j < MAXPALOOKUPS) - { - if (prhighpalookups[i][j].data) { - Bfree(prhighpalookups[i][j].data); - prhighpalookups[i][j].data = NULL; - } - if (prhighpalookups[i][j].map) { - bglDeleteTextures(1, &prhighpalookups[i][j].map); - prhighpalookups[i][j].map = 0; - } - j++; - } - i++; - } -} - -void polymer_setaspect(int32_t ang) -{ - float aspect; - - if (pr_customaspect != 0.0f) - aspect = pr_customaspect; - else - aspect = (float)(windowx2-windowx1+1) / - (float)(windowy2-windowy1+1); - - bglMatrixMode(GL_PROJECTION); - bglLoadIdentity(); - bgluPerspective((float)(ang) / (2048.0f / 360.0f), aspect, 0.01f, 100.0f); -} - -void polymer_glinit(void) -{ - bglClearColor(0.0f, 0.0f, 0.0f, 1.0f); - bglClearStencil(0); - bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - bglViewport(windowx1, yres-(windowy2+1),windowx2-windowx1+1, windowy2-windowy1+1); - - // texturing - bglEnable(GL_TEXTURE_2D); - - bglEnable(GL_DEPTH_TEST); - bglDepthFunc(GL_LEQUAL); - - bglDisable(GL_BLEND); - bglDisable(GL_ALPHA_TEST); - - if (pr_wireframe) - bglPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - else - bglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - polymer_setaspect(pr_fov); - - bglMatrixMode(GL_MODELVIEW); - bglLoadIdentity(); - - bglEnableClientState(GL_VERTEX_ARRAY); - bglEnableClientState(GL_TEXTURE_COORD_ARRAY); - - bglDisable(GL_FOG); - - bglEnable(GL_CULL_FACE); - bglCullFace(GL_BACK); -} - -void polymer_resetlights(void) -{ - int32_t i; - _prsector *s; - _prwall *w; - - i = 0; - while (i < numsectors) - { - s = prsectors[i]; - - if (!s) { - i++; - continue; - } - - polymer_resetplanelights(&s->floor); - polymer_resetplanelights(&s->ceil); - - i++; - } - - i = 0; - while (i < numwalls) - { - w = prwalls[i]; - - if (!w) { - i++; - continue; - } - - polymer_resetplanelights(&w->wall); - polymer_resetplanelights(&w->over); - polymer_resetplanelights(&w->mask); - - i++; - } - - i = 0; - while (i < PR_MAXLIGHTS) - { - prlights[i].flags.active = 0; - i++; - } - - lightcount = 0; - - loadmaphack(NULL); -} - -void polymer_loadboard(void) -{ - int32_t i; - - polymer_freeboard(); - - i = 0; - while (i < numsectors) - { - polymer_initsector(i); - polymer_updatesector(i); - i++; - } - - i = 0; - while (i < numwalls) - { - polymer_initwall(i); - polymer_updatewall(i); - i++; - } - - polymer_getsky(); - - polymer_resetlights(); - - if (pr_verbosity >= 1 && numsectors) OSD_Printf("PR : Board loaded.\n"); -} - -void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum) -{ - int16_t cursectnum; - int32_t i, cursectflorz, cursectceilz; - float skyhoriz, ang, tiltang; - float pos[3]; - pthtyp* pth; - - if (!rendmode) return; - - begindrawing(); - - // TODO: support for screen resizing - // frameoffset = frameplace + windowy1*bytesperline + windowx1; - - if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n"); - - // fogcalc needs this - gvisibility = ((float)globalvisibility)*FOGSCALE; - - ang = (float)(daang) / (2048.0f / 360.0f); - horizang = (float)(-getangle(128, dahoriz-100)) / (2048.0f / 360.0f); - tiltang = (gtang * 90.0f); - - pos[0] = (float)daposy; - pos[1] = -(float)(daposz) / 16.0f; - pos[2] = -(float)daposx; - - polymer_updatelights(); - -// polymer_resetlights(); -// if (pr_lighting) -// polymer_applylights(); - - depth = 0; - - if (pr_shadows && lightcount && (pr_shadowcount > 0)) - polymer_prepareshadows(); - - // hack for parallax skies - skyhoriz = horizang; - if (skyhoriz < -180.0f) - skyhoriz += 360.0f; - - drawingskybox = 1; - pth = gltexcache(cursky,0,0); - drawingskybox = 0; - - // if it's not a skybox, make the sky parallax - // the angle factor is computed from eyeballed values - // need to recompute it if we ever change the max horiz amplitude - if (!pth || !(pth->flags & 4)) - skyhoriz /= 4.3027f; - - bglMatrixMode(GL_MODELVIEW); - bglLoadIdentity(); - - bglRotatef(tiltang, 0.0f, 0.0f, -1.0f); - bglRotatef(skyhoriz, 1.0f, 0.0f, 0.0f); - bglRotatef(ang, 0.0f, 1.0f, 0.0f); - - bglScalef(1.0f / 1000.0f, 1.0f / 1000.0f, 1.0f / 1000.0f); - bglTranslatef(-pos[0], -pos[1], -pos[2]); - - bglGetFloatv(GL_MODELVIEW_MATRIX, rootskymodelviewmatrix); - curskymodelviewmatrix = rootskymodelviewmatrix; - - bglMatrixMode(GL_MODELVIEW); - bglLoadIdentity(); - - bglRotatef(tiltang, 0.0f, 0.0f, -1.0f); - bglRotatef(horizang, 1.0f, 0.0f, 0.0f); - bglRotatef(ang, 0.0f, 1.0f, 0.0f); - - bglScalef(1.0f / 1000.0f, 1.0f / 1000.0f, 1.0f / 1000.0f); - bglTranslatef(-pos[0], -pos[1], -pos[2]); - - bglGetFloatv(GL_MODELVIEW_MATRIX, rootmodelviewmatrix); - - cursectnum = dacursectnum; - updatesector(daposx, daposy, &cursectnum); - - if ((cursectnum >= 0) && (cursectnum < numsectors)) - dacursectnum = cursectnum; - - // unflag all sectors - i = numsectors-1; - while (i >= 0) - { - prsectors[i]->flags.uptodate = 0; - prsectors[i]->wallsproffset = 0.0f; - prsectors[i]->floorsproffset = 0.0f; - i--; - } - i = numwalls-1; - while (i >= 0) - { - prwalls[i]->flags.uptodate = 0; - i--; - } - - if (searchit == 2 && !polymersearching) - { - globaloldoverridematerial = overridematerial; - overridematerial = prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit; - overridematerial |= prprogrambits[PR_BIT_DIFFUSE_MAP2].bit; - polymersearching = TRUE; - } - if (!searchit && polymersearching) { - overridematerial = globaloldoverridematerial; - polymersearching = FALSE; - } - - if (dacursectnum > -1 && dacursectnum < numsectors) - getzsofslope(dacursectnum, daposx, daposy, &cursectceilz, &cursectflorz); - - // external view (editor) - if ((dacursectnum < 0) || (dacursectnum >= numsectors) || - (daposz > cursectflorz) || - (daposz < cursectceilz)) - { - curmodelviewmatrix = rootmodelviewmatrix; - i = numsectors-1; - while (i >= 0) - { - polymer_updatesector(i); - polymer_drawsector(i); - polymer_scansprites(i, tsprite, &spritesortcnt); - i--; - } - - i = numwalls-1; - while (i >= 0) - { - polymer_updatewall(i); - polymer_drawwall(sectorofwall(i), i); - i--; - } - viewangle = daang; - enddrawing(); - return; - } - - // GO! - polymer_displayrooms(dacursectnum); - - curmodelviewmatrix = rootmodelviewmatrix; - - // build globals used by rotatesprite - viewangle = daang; - globalang = (daang&2047); - cosglobalang = sintable[(globalang+512)&2047]; - singlobalang = sintable[globalang&2047]; - cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange); - sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange); - - // polymost globals used by polymost_dorotatesprite - gcosang = ((double)cosglobalang)/262144.0; - gsinang = ((double)singlobalang)/262144.0; - gcosang2 = gcosang*((double)viewingrange)/65536.0; - gsinang2 = gsinang*((double)viewingrange)/65536.0; - - if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n"); - enddrawing(); -} - -void polymer_drawmasks(void) -{ - bglEnable(GL_ALPHA_TEST); - bglEnable(GL_BLEND); - bglEnable(GL_POLYGON_OFFSET_FILL); - - while (--spritesortcnt) - { - tspriteptr[spritesortcnt] = &tsprite[spritesortcnt]; - polymer_drawsprite(spritesortcnt); - } - - bglDisable(GL_POLYGON_OFFSET_FILL); - bglDisable(GL_BLEND); - bglDisable(GL_ALPHA_TEST); -} - -static inline GLfloat dot2f(GLfloat *v1, GLfloat *v2) -{ - return v1[0]*v2[0] + v1[1]*v2[1]; -} -static inline GLfloat dot3f(GLfloat *v1, GLfloat *v2) -{ - return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; -} -static inline void relvec2f(GLfloat *v1, GLfloat *v2, GLfloat *out) -{ - out[0] = v2[0]-v1[0]; - out[1] = v2[1]-v1[1]; -} - -void polymer_editorpick(void) -{ - GLubyte picked[3]; - int16_t num; - - bglReadPixels(searchx, ydim - searchy, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, picked); - - num = *(int16_t *)(&picked[1]); - - searchstat = picked[0]; - - switch (searchstat) { - case 0: // wall - case 5: // botomwall - case 4: // 1-way/masked wall - searchsector = sectorofwall(num); - searchbottomwall = searchwall = num; - if (searchstat == 5) { - searchstat = 0; - if (wall[num].nextwall >= 0 && (wall[num].cstat & 2)) { - searchbottomwall = wall[num].nextwall; - } - } - break; - case 1: // floor - case 2: // ceiling - searchsector = num; - - // Apologies to Plagman for littering here, but this feature is quite essential - { - GLdouble model[16]; - GLdouble proj[16]; - GLint view[4]; - - GLdouble x,y,z; - GLfloat scr[3], scrv[3]; - GLdouble scrx,scry,scrz; - GLfloat dadepth; - - int16_t k, bestk=0; - GLfloat bestwdistsq = 3.4e38, wdistsq; - GLfloat w1[2], w2[2], w21[2], pw1[2], pw2[2]; - GLfloat ptonline[2]; - GLfloat scrvxz[2]; - GLfloat scrvxznorm, scrvxzn[2], scrpxz[2]; - GLfloat w1d, w2d; - walltype *wal = &wall[sector[searchsector].wallptr]; - - GLfloat t, svcoeff, p[2]; - GLfloat *pl; - - bglGetDoublev(GL_MODELVIEW_MATRIX, model); - bglGetDoublev(GL_PROJECTION_MATRIX, proj); - bglGetIntegerv(GL_VIEWPORT, view); - - bglReadPixels(searchx, ydim-searchy, 1,1, GL_DEPTH_COMPONENT, GL_FLOAT, &dadepth); - bgluUnProject(searchx, ydim-searchy, dadepth, model, proj, view, &x, &y, &z); - bgluUnProject(searchx, ydim-searchy, 0.0, model, proj, view, &scrx, &scry, &scrz); - - scr[0]=scrx, scr[1]=scry, scr[2]=scrz; - - scrv[0] = x-scrx; - scrv[1] = y-scry; - scrv[2] = z-scrz; - - scrvxz[0] = x-scrx; - scrvxz[1] = z-scrz; - - if (searchstat==1) - pl = &prsectors[searchsector]->ceil.plane[0]; - else - pl = &prsectors[searchsector]->floor.plane[0]; - - t = dot3f(pl,scrv); - svcoeff = -(dot3f(pl,scr)+pl[3])/t; - - // point on plane (x and z) - p[0] = scrx + svcoeff*scrv[0]; - p[1] = scrz + svcoeff*scrv[2]; - - for (k=0; k= 3) OSD_Printf("PR : Masked wall %i...\n", damaskwallcnt); - - sec = §or[sectorofwall(maskwall[damaskwallcnt])]; - wal = &wall[maskwall[damaskwallcnt]]; - w = prwalls[maskwall[damaskwallcnt]]; - - fogcalc(wal->shade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - - bglEnable(GL_CULL_FACE); - - if (searchit == 2) { - memcpy(oldcolor, w->mask.material.diffusemodulation, sizeof(GLubyte) * 4); - - w->mask.material.diffusemodulation[0] = 0x04; - w->mask.material.diffusemodulation[1] = ((GLubyte *)(&maskwall[damaskwallcnt]))[0]; - w->mask.material.diffusemodulation[2] = ((GLubyte *)(&maskwall[damaskwallcnt]))[1]; - w->mask.material.diffusemodulation[3] = 0xFF; - } - - polymer_drawplane(&w->mask); - - if (searchit == 2) - memcpy(w->mask.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); - - bglDisable(GL_CULL_FACE); -} - -void polymer_updatesprite(int32_t snum) -{ - int32_t curpicnum, xsize, ysize, tilexoff, tileyoff, xoff, yoff, i, j, cs; - spritetype *tspr = tspriteptr[snum]; - float xratio, yratio, ang; - float spos[3]; - const GLfloat *inbuffer; - uint8_t flipu, flipv; - _prsprite *s; - - if (pr_verbosity >= 3) OSD_Printf("PR : Updating sprite %i...\n", snum); - - if (tspr->owner < 0 || tspr->picnum < 0) return; - - cs = tspr->cstat; - - if (prsprites[tspr->owner] == NULL) - { - prsprites[tspr->owner] = (_prsprite *) Bcalloc(sizeof(_prsprite), 1); - - if (prsprites[tspr->owner] == NULL) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sprite %i : Bmalloc failed.\n", tspr->owner); - return; - } - - prsprites[tspr->owner]->plane.buffer = (GLfloat *) Bmalloc(4 * sizeof(GLfloat) * 5); - prsprites[tspr->owner]->plane.vertcount = 4; - } - - if ((tspr->cstat & 48) && (pr_vbos > 0) && !prsprites[tspr->owner]->plane.vbo) - { - bglGenBuffersARB(1, &prsprites[tspr->owner]->plane.vbo); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, prsprites[tspr->owner]->plane.vbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat) * 5, NULL, mapvbousage); - } - - s = prsprites[tspr->owner]; - - curpicnum = tspr->picnum; - if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,tspr->owner+32768); - - if (tspr->cstat & 48 && searchit != 2) - { - uint32_t crc = crc32once((uint8_t *)tspr, offsetof(spritetype, owner)); - int32_t curpriority = 0; - - if (crc == s->crc && tspr->picnum == curpicnum) return; - s->crc = crc; - - polymer_resetplanelights(&s->plane); - - while ((curpriority < pr_maxlightpriority) && (!depth || mirrors[depth-1].plane)) - { - i = j = 0; - while (j < lightcount) - { - while (!prlights[i].flags.active) - i++; - - if (prlights[i].priority != curpriority) - { - i++; - j++; - continue; - } - - if (polymer_planeinlight(&s->plane, &prlights[i])) - polymer_addplanelight(&s->plane, i); - i++; - j++; - } - curpriority++; - } - } - - polymer_getbuildmaterial(&s->plane.material, curpicnum, tspr->pal, tspr->shade, 4); - - if (tspr->cstat & 2) - { - if (tspr->cstat & 512) - s->plane.material.diffusemodulation[3] = 0x55; - else - s->plane.material.diffusemodulation[3] = 0xAA; - } - - s->plane.material.diffusemodulation[3] *= (1.0f - spriteext[tspr->owner].alpha); - - if (searchit == 2) - { - s->plane.material.diffusemodulation[0] = 0x03; - s->plane.material.diffusemodulation[1] = ((GLubyte *)(&tspr->owner))[0]; - s->plane.material.diffusemodulation[2] = ((GLubyte *)(&tspr->owner))[1]; - s->plane.material.diffusemodulation[3] = 0xFF; - s->crc = 0xdeadbeef; - } - - curpicnum = tspr->picnum; - if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,tspr->owner+32768); - - if (((tspr->cstat>>4) & 3) == 0) - xratio = (float)(tspr->xrepeat) * 0.20f; // 32 / 160 - else - xratio = (float)(tspr->xrepeat) * 0.25f; - - yratio = (float)(tspr->yrepeat) * 0.25f; - - xsize = tilesizx[curpicnum]; - ysize = tilesizy[curpicnum]; - - if (usehightile && h_xsize[curpicnum]) - { - xsize = h_xsize[curpicnum]; - ysize = h_ysize[curpicnum]; - } - - xsize = (int32_t)(xsize * xratio); - ysize = (int32_t)(ysize * yratio); - - tilexoff = (int32_t)tspr->xoffset; - tileyoff = (int32_t)tspr->yoffset; - tilexoff += (int8_t)((usehightile&&h_xsize[curpicnum])?(h_xoffs[curpicnum]):((picanm[curpicnum]>>8)&255)); - tileyoff += (int8_t)((usehightile&&h_xsize[curpicnum])?(h_yoffs[curpicnum]):((picanm[curpicnum]>>16)&255)); - - xoff = (int32_t)(tilexoff * xratio); - yoff = (int32_t)(tileyoff * yratio); - - if ((tspr->cstat & 128) && (((tspr->cstat>>4) & 3) != 2)) - yoff -= ysize / 2; - - spos[0] = (float)tspr->y; - spos[1] = -(float)(tspr->z) / 16.0f; - spos[2] = -(float)tspr->x; - - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - bglLoadIdentity(); - - inbuffer = vertsprite; - - flipu = flipv = 0; - - if (pr_billboardingmode && !((tspr->cstat>>4) & 3)) - { - // do surgery on the face tspr to make it look like a wall sprite - tspr->cstat |= 16; - tspr->ang = (viewangle + 1024) & 2047; - } - - switch ((tspr->cstat>>4) & 3) - { - case 0: - ang = (float)((viewangle) & 2047) / (2048.0f / 360.0f); - - bglTranslatef(spos[0], spos[1], spos[2]); - bglRotatef(-ang, 0.0f, 1.0f, 0.0f); - bglRotatef(-horizang, 1.0f, 0.0f, 0.0f); - bglTranslatef((float)(-xoff), (float)(yoff), 0.0f); - bglScalef((float)(xsize), (float)(ysize), 1.0f); - break; - case 1: - ang = (float)((tspr->ang + 1024) & 2047) / (2048.0f / 360.0f); - - bglTranslatef(spos[0], spos[1], spos[2]); - bglRotatef(-ang, 0.0f, 1.0f, 0.0f); - bglTranslatef((float)(-xoff), (float)(yoff), 0.0f); - bglScalef((float)(xsize), (float)(ysize), 1.0f); - break; - case 2: - ang = (float)((tspr->ang + 1024) & 2047) / (2048.0f / 360.0f); - - bglTranslatef(spos[0], spos[1], spos[2]); - bglRotatef(-ang, 0.0f, 1.0f, 0.0f); - if (tspr->cstat & 8) { - bglRotatef(-180.0, 0.0f, 0.0f, 1.0f); - flipu = !flipu; - } - bglTranslatef((float)(-xoff), 1.0f, (float)(yoff)); - bglScalef((float)(xsize), 1.0f, (float)(ysize)); - - inbuffer = horizsprite; - break; - } - - if ((tspr->cstat & 4) && (((tspr->cstat>>4) & 3) != 2)) - flipu = !flipu; - - if (!(tspr->cstat & 4) && (((tspr->cstat>>4) & 3) == 2)) - flipu = !flipu; - - if ((tspr->cstat & 8) && (((tspr->cstat>>4) & 3) != 2)) - flipv = !flipv; - - bglGetFloatv(GL_MODELVIEW_MATRIX, spritemodelview); - bglPopMatrix(); - - Bmemcpy(s->plane.buffer, inbuffer, sizeof(GLfloat) * 4 * 5); - - if (flipu || flipv) - { - i = 0; - do - { - if (flipu) - s->plane.buffer[(i * 5) + 3] = - (s->plane.buffer[(i * 5) + 3] - 1.0f) * -1.0f; - if (flipv) - s->plane.buffer[(i * 5) + 4] = - (s->plane.buffer[(i * 5) + 4] - 1.0f) * -1.0f; - } - while (++i < 4); - } - - i = 0; - do - polymer_transformpoint(&inbuffer[i * 5], &s->plane.buffer[i * 5], spritemodelview); - while (++i < 4); - - polymer_computeplane(&s->plane); - - if ((cs & 48) && (pr_vbos > 0)) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->plane.vbo); - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat) * 5, s->plane.buffer); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } - else if (s->plane.vbo) // clean up the vbo if a wall/floor sprite becomes a face sprite - { - bglDeleteBuffersARB(1, &s->plane.vbo); - s->plane.vbo = 0; - } -} - - -void polymer_drawsprite(int32_t snum) -{ - spritetype *tspr; - int32_t i, j, cs; - _prsprite *s; - - if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum); - - tspr = tspriteptr[snum]; - - if (tspr->owner < 0 || tspr->picnum < 0) return; - - if ((tspr->cstat & 8192) && (depth && !mirrors[depth-1].plane)) - return; - - if ((tspr->cstat & 16384) && (!depth || mirrors[depth-1].plane)) - return; - - fogcalc(tspr->shade,sector[tspr->sectnum].visibility,sector[tspr->sectnum].floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - - if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && - tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0 && - !(spriteext[tspr->owner].flags & SPREXT_NOTMD)) - { - polymer_drawmdsprite(tspr); - return; - } - - cs = tspr->cstat; - - // I think messing with the tspr is safe at this point? - // If not, change that to modify a temp position in updatesprite itself. - // I don't think this flags are meant to change on the fly so it'd possibly - // be safe to cache a plane that has them applied. - if (spriteext[tspr->owner].flags & SPREXT_AWAY1) - { - tspr->x += sintable[(tspr->ang + 512) & 2047] >> 13; - tspr->y += sintable[tspr->ang & 2047] >> 13; - } - else if (spriteext[tspr->owner].flags & SPREXT_AWAY2) - { - tspr->x -= sintable[(tspr->ang + 512) & 2047] >> 13; - tspr->y -= sintable[tspr->ang & 2047] >> 13; - } - - polymer_updatesprite(snum); - - if (prsprites[tspr->owner] == NULL) - return; - - s = prsprites[tspr->owner]; - - switch ((tspr->cstat>>4) & 3) - { - case 1: - prsectors[tspr->sectnum]->wallsproffset += 0.5f; - if (!depth || mirrors[depth-1].plane) - bglPolygonOffset(-1.0f, -1.0f); - break; - case 2: - prsectors[tspr->sectnum]->floorsproffset += 0.5f; - if (!depth || mirrors[depth-1].plane) - bglPolygonOffset(-1.0f, -1.0f); - break; - } - - if ((cs & 48) == 0) - { - int32_t curpriority = 0; - - s->plane.lightcount = 0; - - while ((curpriority < pr_maxlightpriority) && (!depth || mirrors[depth-1].plane)) - { - i = j = 0; - while (j < lightcount) - { - while (!prlights[i].flags.active) - i++; - - if (prlights[i].priority != curpriority) - { - i++; - j++; - continue; - } - - if (polymer_planeinlight(&s->plane, &prlights[i])) - s->plane.lights[s->plane.lightcount++] = i; - - i++; - j++; - } - curpriority++; - } - } - - if ((tspr->cstat & 64) && ((tspr->cstat>>4) & 3)) - bglEnable(GL_CULL_FACE); - - if ((!depth || mirrors[depth-1].plane) && !pr_ati_nodepthoffset) - bglEnable(GL_POLYGON_OFFSET_FILL); - - polymer_drawplane(&s->plane); - - if ((!depth || mirrors[depth-1].plane) && !pr_ati_nodepthoffset) - bglDisable(GL_POLYGON_OFFSET_FILL); - - if ((tspr->cstat & 64) && ((tspr->cstat>>4) & 3)) - bglDisable(GL_CULL_FACE); -} - -void polymer_setanimatesprites(animatespritesptr animatesprites, int32_t x, int32_t y, int32_t a, int32_t smoothratio) -{ - asi.animatesprites = animatesprites; - asi.x = x; - asi.y = y; - asi.a = a; - asi.smoothratio = smoothratio; -} - -int16_t polymer_addlight(_prlight* light) -{ - int32_t lighti; - - if (lightcount >= PR_MAXLIGHTS || light->priority > pr_maxlightpriority || !pr_lighting) - return (-1); - - if ((light->sector == -1) || (light->sector >= numsectors)) - return (-1); - - lighti = 0; - while ((lighti < PR_MAXLIGHTS) && (prlights[lighti].flags.active)) - lighti++; - - if (lighti == PR_MAXLIGHTS) - return (-1); - - Bmemcpy(&prlights[lighti], light, sizeof(_prlight)); - - if (light->radius) - polymer_processspotlight(&prlights[lighti]); - - prlights[lighti].flags.isinview = 0; - prlights[lighti].flags.active = 1; - - prlights[lighti].planecount = 0; - prlights[lighti].planelist = NULL; - - polymer_culllight(lighti); - - lightcount++; - - return (lighti); -} - -void polymer_deletelight(int16_t lighti) -{ - if (!prlights[lighti].flags.active) - return; - - polymer_removelight(lighti); - - prlights[lighti].flags.active = 0; - - lightcount--; -} - -void polymer_invalidatelights(void) -{ - int32_t i = PR_MAXLIGHTS-1; - - do - prlights[i].flags.invalidate = prlights[i].flags.active; - while (i--); -} - -void polymer_texinvalidate(void) -{ - int32_t i = numsectors-1; - - if (!numsectors || !prsectors[i]) - return; - - do - prsectors[i--]->flags.invalidtex = 1; - while (i >= 0); - - i = numwalls-1; - do - prwalls[i--]->flags.invalidtex = 1; - while (i >= 0); -} - -void polymer_definehighpalookup(char basepalnum, char palnum, char *data) -{ - prhighpalookups[basepalnum][palnum].data = Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE); - - Bmemcpy(prhighpalookups[basepalnum][palnum].data, data, PR_HIGHPALOOKUP_DATA_SIZE); -} - -// CORE -static void polymer_displayrooms(int16_t dacursectnum) -{ - sectortype *sec; - int32_t i; - GLint result; - int16_t doquery; - int32_t front; - int32_t back; - GLfloat localskymodelviewmatrix[16]; - GLfloat localmodelviewmatrix[16]; - GLfloat localprojectionmatrix[16]; - float frustum[5 * 4]; - int32_t localspritesortcnt; - spritetype localtsprite[MAXSPRITESONSCREEN]; - int16_t localmaskwall[MAXWALLSB]; - int16_t localmaskwallcnt; - _prmirror mirrorlist[10]; - int mirrorcount; - int32_t gx, gy, gz, px, py, pz; - GLdouble plane[4]; - float coeff; - - curmodelviewmatrix = localmodelviewmatrix; - bglGetFloatv(GL_MODELVIEW_MATRIX, localmodelviewmatrix); - bglGetFloatv(GL_PROJECTION_MATRIX, localprojectionmatrix); - - polymer_extractfrustum(localmodelviewmatrix, localprojectionmatrix, frustum); - - Bmemset(querydelay, 0, sizeof(int16_t) * numsectors); - Bmemset(queryid, 0, sizeof(GLuint) * numwalls); - Bmemset(drawingstate, 0, sizeof(int16_t) * numsectors); - - front = 0; - back = 1; - sectorqueue[0] = dacursectnum; - drawingstate[dacursectnum] = 1; - - localspritesortcnt = localmaskwallcnt = 0; - - mirrorcount = 0; - - bglDisable(GL_DEPTH_TEST); - bglColor4f(1.0f, 1.0f, 1.0f, 1.0f); - polymer_drawsky(cursky, curskypal, curskyshade); - bglEnable(GL_DEPTH_TEST); - - // depth-only occlusion testing pass -// overridematerial = 0; - - while (front != back) - { - sec = §or[sectorqueue[front]]; - - polymer_pokesector(sectorqueue[front]); - polymer_drawsector(sectorqueue[front]); - polymer_scansprites(sectorqueue[front], localtsprite, &localspritesortcnt); - - doquery = 0; - - i = sec->wallnum-1; - do - { - // this is a couple of fps faster for me... does it mess anything up? - if (wallvisible(globalposx, globalposy, sec->wallptr + i)) - polymer_drawwall(sectorqueue[front], sec->wallptr + i); - - // if we have a level boundary somewhere in the sector, - // consider these walls as visportals - if (wall[sec->wallptr + i].nextsector < 0) - doquery = 1; - } - while (--i >= 0); - - i = sec->wallnum-1; - while (i >= 0) - { - if ((wall[sec->wallptr + i].nextsector >= 0) && - (wallvisible(globalposx, globalposy, sec->wallptr + i)) && - (polymer_planeinfrustum(&prwalls[sec->wallptr + i]->mask, frustum))) - { - if ((prwalls[sec->wallptr + i]->mask.vertcount == 4) && - !(prwalls[sec->wallptr + i]->underover & 4) && - !(prwalls[sec->wallptr + i]->underover & 8)) - { - // early exit for closed sectors - _prwall *w; - - w = prwalls[sec->wallptr + i]; - - if ((w->mask.buffer[(0 * 5) + 1] >= w->mask.buffer[(3 * 5) + 1]) && - (w->mask.buffer[(1 * 5) + 1] >= w->mask.buffer[(2 * 5) + 1])) - { - i--; - continue; - } - } - - if (wall[sec->wallptr + i].cstat & 48) - localmaskwall[localmaskwallcnt++] = sec->wallptr + i; - - if (!depth && (overridematerial & prprogrambits[PR_BIT_MIRROR_MAP].bit) && - wall[sec->wallptr + i].overpicnum == 560 && - wall[sec->wallptr + i].cstat & 32) - { - mirrorlist[mirrorcount].plane = &prwalls[sec->wallptr + i]->mask; - mirrorlist[mirrorcount].sectnum = sectorqueue[front]; - mirrorlist[mirrorcount].wallnum = sec->wallptr + i; - mirrorcount++; - } - - if (!(wall[sec->wallptr + i].cstat & 32)) { - if (doquery && (!drawingstate[wall[sec->wallptr + i].nextsector])) - { - float pos[3], sqdist; - int32_t oldoverridematerial; - - pos[0] = (float)globalposy; - pos[1] = -(float)(globalposz) / 16.0f; - pos[2] = -(float)globalposx; - - sqdist = prwalls[sec->wallptr + i]->mask.plane[0] * pos[0] + - prwalls[sec->wallptr + i]->mask.plane[1] * pos[1] + - prwalls[sec->wallptr + i]->mask.plane[2] * pos[2] + - prwalls[sec->wallptr + i]->mask.plane[3]; - - // hack to avoid occlusion querying portals that are too close to the viewpoint - // this is needed because of the near z-clipping plane; - if (sqdist < 100) - queryid[sec->wallptr + i] = 0xFFFFFFFF; - else { - _prwall *w; - - w = prwalls[sec->wallptr + i]; - - bglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - bglDepthMask(GL_FALSE); - - bglGenQueriesARB(1, &queryid[sec->wallptr + i]); - bglBeginQueryARB(GL_SAMPLES_PASSED_ARB, queryid[sec->wallptr + i]); - - oldoverridematerial = overridematerial; - overridematerial = 0; - - if ((w->underover & 4) && (w->underover & 1)) - polymer_drawplane(&w->wall); - polymer_drawplane(&w->mask); - if ((w->underover & 8) && (w->underover & 2)) - polymer_drawplane(&w->over); - - overridematerial = oldoverridematerial; - - bglEndQueryARB(GL_SAMPLES_PASSED_ARB); - - bglDepthMask(GL_TRUE); - bglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } - } else - queryid[sec->wallptr + i] = 1; - } - } - - i--; - } - - i = sec->wallnum-1; - do - { - if ((queryid[sec->wallptr + i]) && - (!drawingstate[wall[sec->wallptr + i].nextsector])) - { - // REAP - result = 0; - if (doquery && (queryid[sec->wallptr + i] != 0xFFFFFFFF)) - { - bglGetQueryObjectivARB(queryid[sec->wallptr + i], - GL_QUERY_RESULT_ARB, - &result); - bglDeleteQueriesARB(1, &queryid[sec->wallptr + i]); - } else if (queryid[sec->wallptr + i] == 0xFFFFFFFF) - result = 1; - - queryid[sec->wallptr + i] = 0; - - if (result || !doquery) - { - sectorqueue[back++] = wall[sec->wallptr + i].nextsector; - drawingstate[wall[sec->wallptr + i].nextsector] = 1; - } - } - } - while (--i >= 0); - - front++; - } - - // do the actual shaded drawing -// overridematerial = 0xFFFFFFFF; - - // go through the sector queue again -// front = 0; -// while (front < back) -// { -// sec = §or[sectorqueue[front]]; -// -// polymer_drawsector(sectorqueue[front]); -// -// i = 0; -// while (i < sec->wallnum) -// { -// polymer_drawwall(sectorqueue[front], sec->wallptr + i); -// -// i++; -// } -// -// front++; -// } - - i = mirrorcount-1; - while (i >= 0) - { - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prrts[0].fbo); - bglPushAttrib(GL_VIEWPORT_BIT); - bglViewport(windowx1, yres-(windowy2+1),windowx2-windowx1+1, windowy2-windowy1+1); - - bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - Bmemcpy(localskymodelviewmatrix, curskymodelviewmatrix, sizeof(GLfloat) * 16); - curskymodelviewmatrix = localskymodelviewmatrix; - - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - - plane[0] = mirrorlist[i].plane->plane[0]; - plane[1] = mirrorlist[i].plane->plane[1]; - plane[2] = mirrorlist[i].plane->plane[2]; - plane[3] = mirrorlist[i].plane->plane[3]; - - bglClipPlane(GL_CLIP_PLANE0, plane); - polymer_inb4mirror(mirrorlist[i].plane->buffer, mirrorlist[i].plane->plane); - bglCullFace(GL_FRONT); - //bglEnable(GL_CLIP_PLANE0); - - if (mirrorlist[i].wallnum >= 0) - preparemirror(globalposx, globalposy, 0, globalang, 0, - mirrorlist[i].wallnum, 0, &gx, &gy, &viewangle); - - gx = globalposx; - gy = globalposy; - gz = globalposz; - - // map the player pos from build to polymer - px = globalposy; - py = -globalposz / 16; - pz = -globalposx; - - // calculate new player position on the other side of the mirror - // this way the basic build visibility shit can be used (wallvisible) - coeff = mirrorlist[i].plane->plane[0] * px + - mirrorlist[i].plane->plane[1] * py + - mirrorlist[i].plane->plane[2] * pz + - mirrorlist[i].plane->plane[3]; - - coeff /= (float)(mirrorlist[i].plane->plane[0] * mirrorlist[i].plane->plane[0] + - mirrorlist[i].plane->plane[1] * mirrorlist[i].plane->plane[1] + - mirrorlist[i].plane->plane[2] * mirrorlist[i].plane->plane[2]); - - px = (int32_t)(-coeff*mirrorlist[i].plane->plane[0]*2 + px); - py = (int32_t)(-coeff*mirrorlist[i].plane->plane[1]*2 + py); - pz = (int32_t)(-coeff*mirrorlist[i].plane->plane[2]*2 + pz); - - // map back from polymer to build - globalposx = -pz; - globalposy = px; - globalposz = -py * 16; - - mirrors[depth++] = mirrorlist[i]; - polymer_displayrooms(mirrorlist[i].sectnum); - depth--; - - globalposx = gx; - globalposy = gy; - globalposz = gz; - - bglDisable(GL_CLIP_PLANE0); - bglCullFace(GL_BACK); - bglMatrixMode(GL_MODELVIEW); - bglPopMatrix(); - - bglPopAttrib(); - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - mirrorlist[i].plane->material.mirrormap = prrts[0].color; - polymer_drawplane(mirrorlist[i].plane); - mirrorlist[i].plane->material.mirrormap = 0; - - i--; - } - - spritesortcnt = localspritesortcnt; - Bmemcpy(tsprite, localtsprite, sizeof(spritetype) * spritesortcnt); - maskwallcnt = localmaskwallcnt; - Bmemcpy(maskwall, localmaskwall, sizeof(int16_t) * maskwallcnt); - - if (depth) - { - // drawmasks needs these - cosglobalang = sintable[(viewangle+512)&2047]; - singlobalang = sintable[viewangle&2047]; - cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange); - sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange); - - if (mirrors[depth - 1].plane) - display_mirror = 1; - polymer_animatesprites(); - if (mirrors[depth - 1].plane) - display_mirror = 0; - - bglDisable(GL_CULL_FACE); - drawmasks(); - bglEnable(GL_CULL_FACE); - } - return; -} - -static void polymer_drawplane(_prplane* plane) -{ - int32_t materialbits; - - // debug code for drawing plane inverse TBN -// bglDisable(GL_TEXTURE_2D); -// bglBegin(GL_LINES); -// bglColor4f(1.0, 0.0, 0.0, 1.0); -// bglVertex3f(plane->buffer[0], -// plane->buffer[1], -// plane->buffer[2]); -// bglVertex3f(plane->buffer[0] + plane->t[0] * 50, -// plane->buffer[1] + plane->t[1] * 50, -// plane->buffer[2] + plane->t[2] * 50); -// bglColor4f(0.0, 1.0, 0.0, 1.0); -// bglVertex3f(plane->buffer[0], -// plane->buffer[1], -// plane->buffer[2]); -// bglVertex3f(plane->buffer[0] + plane->b[0] * 50, -// plane->buffer[1] + plane->b[1] * 50, -// plane->buffer[2] + plane->b[2] * 50); -// bglColor4f(0.0, 0.0, 1.0, 1.0); -// bglVertex3f(plane->buffer[0], -// plane->buffer[1], -// plane->buffer[2]); -// bglVertex3f(plane->buffer[0] + plane->n[0] * 50, -// plane->buffer[1] + plane->n[1] * 50, -// plane->buffer[2] + plane->n[2] * 50); -// bglEnd(); -// bglEnable(GL_TEXTURE_2D); - - // debug code for drawing plane normals -// bglDisable(GL_TEXTURE_2D); -// bglBegin(GL_LINES); -// bglColor4f(1.0, 1.0, 1.0, 1.0); -// bglVertex3f(plane->buffer[0], -// plane->buffer[1], -// plane->buffer[2]); -// bglVertex3f(plane->buffer[0] + plane->plane[0] * 50, -// plane->buffer[1] + plane->plane[1] * 50, -// plane->buffer[2] + plane->plane[2] * 50); -// bglEnd(); -// bglEnable(GL_TEXTURE_2D); - - bglNormal3f((float)(plane->plane[0]), (float)(plane->plane[1]), (float)(plane->plane[2])); - - if (plane->vbo && (pr_vbos > 0)) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, plane->vbo); - bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), NULL); - bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), (GLfloat*)(3 * sizeof(GLfloat))); - if (plane->indices) - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, plane->ivbo); - } else { - bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), plane->buffer); - bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), &plane->buffer[3]); - } - - curlight = 0; - do { - materialbits = polymer_bindmaterial(plane->material, plane->lights, plane->lightcount); - - if (materialbits & prprogrambits[PR_BIT_NORMAL_MAP].bit) - { - bglVertexAttrib3fvARB(prprograms[materialbits].attrib_T, &plane->tbn[0][0]); - bglVertexAttrib3fvARB(prprograms[materialbits].attrib_B, &plane->tbn[1][0]); - bglVertexAttrib3fvARB(prprograms[materialbits].attrib_N, &plane->tbn[2][0]); - } - - if (plane->indices) - { - if (plane->vbo && (pr_vbos > 0)) - bglDrawElements(GL_TRIANGLES, plane->indicescount, GL_UNSIGNED_SHORT, NULL); - else - bglDrawElements(GL_TRIANGLES, plane->indicescount, GL_UNSIGNED_SHORT, plane->indices); - } else - bglDrawArrays(GL_QUADS, 0, 4); - - polymer_unbindmaterial(materialbits); - - if (plane->lightcount && (!depth || mirrors[depth-1].plane)) - prlights[plane->lights[curlight]].flags.isinview = 1; - - curlight++; - } while ((curlight < plane->lightcount) && (curlight < pr_maxlightpasses) && (!depth || mirrors[depth-1].plane)); - - if (plane->vbo && (pr_vbos > 0)) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - if (plane->indices) - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - } -} - -static inline void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane) -{ - float pv; - float reflectionmatrix[16]; - - pv = buffer[0] * plane[0] + - buffer[1] * plane[1] + - buffer[2] * plane[2]; - - reflectionmatrix[0] = 1 - (2 * plane[0] * plane[0]); - reflectionmatrix[1] = -2 * plane[0] * plane[1]; - reflectionmatrix[2] = -2 * plane[0] * plane[2]; - reflectionmatrix[3] = 0; - - reflectionmatrix[4] = -2 * plane[0] * plane[1]; - reflectionmatrix[5] = 1 - (2 * plane[1] * plane[1]); - reflectionmatrix[6] = -2 * plane[1] * plane[2]; - reflectionmatrix[7] = 0; - - reflectionmatrix[8] = -2 * plane[0] * plane[2]; - reflectionmatrix[9] = -2 * plane[1] * plane[2]; - reflectionmatrix[10] = 1 - (2 * plane[2] * plane[2]); - reflectionmatrix[11] = 0; - - reflectionmatrix[12] = 2 * pv * plane[0]; - reflectionmatrix[13] = 2 * pv * plane[1]; - reflectionmatrix[14] = 2 * pv * plane[2]; - reflectionmatrix[15] = 1; - - bglMultMatrixf(reflectionmatrix); - - bglPushMatrix(); - bglLoadMatrixf(curskymodelviewmatrix); - bglMultMatrixf(reflectionmatrix); - bglGetFloatv(GL_MODELVIEW_MATRIX, curskymodelviewmatrix); - bglPopMatrix(); -} - -static void polymer_animatesprites(void) -{ - if (asi.animatesprites) - asi.animatesprites(globalposx, globalposy, viewangle, asi.smoothratio); -} - -static void polymer_freeboard(void) -{ - int32_t i; - - i = 0; - while (i < MAXSECTORS) - { - if (prsectors[i]) - { - if (prsectors[i]->verts) Bfree(prsectors[i]->verts); - if (prsectors[i]->floor.buffer) Bfree(prsectors[i]->floor.buffer); - if (prsectors[i]->ceil.buffer) Bfree(prsectors[i]->ceil.buffer); - if (prsectors[i]->floor.indices) Bfree(prsectors[i]->floor.indices); - if (prsectors[i]->ceil.indices) Bfree(prsectors[i]->ceil.indices); - if (prsectors[i]->ceil.vbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.vbo); - if (prsectors[i]->ceil.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.ivbo); - if (prsectors[i]->floor.vbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.vbo); - if (prsectors[i]->floor.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.ivbo); - - Bfree(prsectors[i]); - prsectors[i] = NULL; - } - - i++; - } - - i = 0; - while (i < MAXWALLS) - { - if (prwalls[i]) - { - if (prwalls[i]->bigportal) Bfree(prwalls[i]->bigportal); - if (prwalls[i]->mask.buffer) Bfree(prwalls[i]->mask.buffer); - if (prwalls[i]->cap) Bfree(prwalls[i]->cap); - if (prwalls[i]->wall.buffer) Bfree(prwalls[i]->wall.buffer); - if (prwalls[i]->wall.vbo) bglDeleteBuffersARB(1, &prwalls[i]->wall.vbo); - if (prwalls[i]->over.vbo) bglDeleteBuffersARB(1, &prwalls[i]->over.vbo); - if (prwalls[i]->mask.vbo) bglDeleteBuffersARB(1, &prwalls[i]->mask.vbo); - if (prwalls[i]->stuffvbo) bglDeleteBuffersARB(1, &prwalls[i]->stuffvbo); - - Bfree(prwalls[i]); - prwalls[i] = NULL; - } - - i++; - } - - i = 0; - while (i < MAXSPRITES) - { - if (prsprites[i]) - { - if (prsprites[i]->plane.buffer) Bfree(prsprites[i]->plane.buffer); - if (prsprites[i]->plane.vbo) bglDeleteBuffersARB(1, &prsprites[i]->plane.vbo); - Bfree(prsprites[i]); - prsprites[i] = NULL; - } - - i++; - } - -} - -// SECTORS -static int32_t polymer_initsector(int16_t sectnum) -{ - sectortype *sec; - _prsector* s; - - if (pr_verbosity >= 2) OSD_Printf("PR : Initializing sector %i...\n", sectnum); - - sec = §or[sectnum]; - s = Bcalloc(1, sizeof(_prsector)); - if (s == NULL) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : Bmalloc failed.\n", sectnum); - return (0); - } - - s->verts = Bcalloc(sec->wallnum, sizeof(GLdouble) * 3); - s->floor.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5); - s->floor.vertcount = sec->wallnum; - s->ceil.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5); - s->ceil.vertcount = sec->wallnum; - if ((s->verts == NULL) || (s->floor.buffer == NULL) || (s->ceil.buffer == NULL)) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : Bmalloc failed.\n", sectnum); - return (0); - } - bglGenBuffersARB(1, &s->floor.vbo); - bglGenBuffersARB(1, &s->ceil.vbo); - bglGenBuffersARB(1, &s->floor.ivbo); - bglGenBuffersARB(1, &s->ceil.ivbo); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->floor.vbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, sec->wallnum * sizeof(GLfloat) * 5, NULL, mapvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->ceil.vbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, sec->wallnum * sizeof(GLfloat) * 5, NULL, mapvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - - s->flags.empty = 1; // let updatesector know that everything needs to go - - prsectors[sectnum] = s; - - if (pr_verbosity >= 2) OSD_Printf("PR : Initialized sector %i.\n", sectnum); - - return (1); -} - -static int32_t polymer_updatesector(int16_t sectnum) -{ - _prsector* s; - sectortype *sec; - walltype *wal; - int32_t i, j; - int32_t ceilz, florz; - int32_t tex, tey, heidiff; - float secangcos, secangsin, scalecoef, xpancoef, ypancoef; - int32_t ang, needfloor, wallinvalidate; - int16_t curstat, curpicnum, floorpicnum, ceilingpicnum; - char curxpanning, curypanning; - GLfloat* curbuffer; - - s = prsectors[sectnum]; - sec = §or[sectnum]; - - secangcos = secangsin = 2; - - if (s == NULL) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum); - return (-1); - } - - needfloor = wallinvalidate = 0; - - // geometry - wal = &wall[sec->wallptr]; - i = 0; - while (i < sec->wallnum) - { - if ((-wal->x != s->verts[(i*3)+2])) - { - s->verts[(i*3)+2] = s->floor.buffer[(i*5)+2] = s->ceil.buffer[(i*5)+2] = -(float)wal->x; - needfloor = wallinvalidate = 1; - } - if ((wal->y != s->verts[i*3])) - { - s->verts[i*3] = s->floor.buffer[i*5] = s->ceil.buffer[i*5] = (float)wal->y; - needfloor = wallinvalidate = 1; - } - - i++; - wal = &wall[sec->wallptr + i]; - } - - if ((s->flags.empty) || - needfloor || - (sec->floorz != s->floorz) || - (sec->ceilingz != s->ceilingz) || - (sec->floorheinum != s->floorheinum) || - (sec->ceilingheinum != s->ceilingheinum)) - { - wallinvalidate = 1; - - wal = &wall[sec->wallptr]; - i = 0; - while (i < sec->wallnum) - { - getzsofslope(sectnum, wal->x, wal->y, &ceilz, &florz); - s->floor.buffer[(i*5)+1] = -(float)(florz) / 16.0f; - s->ceil.buffer[(i*5)+1] = -(float)(ceilz) / 16.0f; - - i++; - wal = &wall[sec->wallptr + i]; - } - - s->floorz = sec->floorz; - s->ceilingz = sec->ceilingz; - s->floorheinum = sec->floorheinum; - s->ceilingheinum = sec->ceilingheinum; - } - - floorpicnum = sec->floorpicnum; - if (picanm[floorpicnum]&192) floorpicnum += animateoffs(floorpicnum,sectnum); - ceilingpicnum = sec->ceilingpicnum; - if (picanm[ceilingpicnum]&192) ceilingpicnum += animateoffs(ceilingpicnum,sectnum); - - if ((!s->flags.empty) && (!needfloor) && - (sec->floorstat == s->floorstat) && - (sec->ceilingstat == s->ceilingstat) && - (floorpicnum == s->floorpicnum) && - (ceilingpicnum == s->ceilingpicnum) && - (sec->floorxpanning == s->floorxpanning) && - (sec->ceilingxpanning == s->ceilingxpanning) && - (sec->floorypanning == s->floorypanning) && - (sec->ceilingypanning == s->ceilingypanning)) - goto attributes; - - wal = &wall[sec->wallptr]; - i = 0; - while (i < sec->wallnum) - { - j = 2; - curstat = sec->floorstat; - curbuffer = s->floor.buffer; - curpicnum = floorpicnum; - curxpanning = sec->floorxpanning; - curypanning = sec->floorypanning; - - while (j) - { - if (j == 1) - { - curstat = sec->ceilingstat; - curbuffer = s->ceil.buffer; - curpicnum = ceilingpicnum; - curxpanning = sec->ceilingxpanning; - curypanning = sec->ceilingypanning; - } - - if (!waloff[curpicnum]) - loadtile(curpicnum); - - if (((sec->floorstat & 64) || (sec->ceilingstat & 64)) && - ((secangcos == 2) && (secangsin == 2))) - { - ang = (getangle(wall[wal->point2].x - wal->x, wall[wal->point2].y - wal->y) + 512) & 2047; - secangcos = (float)(sintable[(ang+512)&2047]) / 16383.0f; - secangsin = (float)(sintable[ang&2047]) / 16383.0f; - } - - // relative texturing - if (curstat & 64) - { - xpancoef = (float)(wal->x - wall[sec->wallptr].x); - ypancoef = (float)(wall[sec->wallptr].y - wal->y); - - tex = (int32_t)(xpancoef * secangsin + ypancoef * secangcos); - tey = (int32_t)(xpancoef * secangcos - ypancoef * secangsin); - } else { - tex = wal->x; - tey = -wal->y; - } - - if ((curstat & (2+64)) == (2+64)) - { - heidiff = (int32_t)(curbuffer[(i*5)+1] - curbuffer[1]); - // don't forget the sign, tey could be negative with concave sectors - if (tey >= 0) - tey = (int32_t)sqrt((tey * tey) + (heidiff * heidiff)); - else - tey = -(int32_t)sqrt((tey * tey) + (heidiff * heidiff)); - } - - if (curstat & 4) - swaplong(&tex, &tey); - - if (curstat & 16) tex = -tex; - if (curstat & 32) tey = -tey; - - scalecoef = (curstat & 8) ? 8.0f : 16.0f; - - if (curxpanning) - { - xpancoef = (float)(pow2long[picsiz[curpicnum] & 15]); - xpancoef *= (float)(curxpanning) / (256.0f * (float)(tilesizx[curpicnum])); - } - else - xpancoef = 0; - - if (curypanning) - { - ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]); - ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum])); - } - else - ypancoef = 0; - - curbuffer[(i*5)+3] = ((float)(tex) / (scalecoef * tilesizx[curpicnum])) + xpancoef; - curbuffer[(i*5)+4] = ((float)(tey) / (scalecoef * tilesizy[curpicnum])) + ypancoef; - - j--; - } - i++; - wal = &wall[sec->wallptr + i]; - } - - s->floorstat = sec->floorstat; - s->ceilingstat = sec->ceilingstat; - s->floorxpanning = sec->floorxpanning; - s->ceilingxpanning = sec->ceilingxpanning; - s->floorypanning = sec->floorypanning; - s->ceilingypanning = sec->ceilingypanning; - - i = -1; - -attributes: - if ((pr_vbos > 0) && ((i == -1) || (wallinvalidate))) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->floor.vbo); - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sec->wallnum * sizeof(GLfloat) * 5, s->floor.buffer); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->ceil.vbo); - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sec->wallnum * sizeof(GLfloat) * 5, s->ceil.buffer); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } - - if ((!s->flags.empty) && (!s->flags.invalidtex) && - (sec->floorshade == s->floorshade) && - (sec->ceilingshade == s->ceilingshade) && - (sec->floorpal == s->floorpal) && - (sec->ceilingpal == s->ceilingpal) && - (floorpicnum == s->floorpicnum) && - (ceilingpicnum == s->ceilingpicnum)) - goto finish; - - polymer_getbuildmaterial(&s->floor.material, floorpicnum, sec->floorpal, sec->floorshade, 0); - polymer_getbuildmaterial(&s->ceil.material, ceilingpicnum, sec->ceilingpal, sec->ceilingshade, 0); - - s->flags.invalidtex = 0; - - s->floorshade = sec->floorshade; - s->ceilingshade = sec->ceilingshade; - s->floorpal = sec->floorpal; - s->ceilingpal = sec->ceilingpal; - s->floorpicnum = floorpicnum; - s->ceilingpicnum = ceilingpicnum; - -finish: - - if (needfloor) - { - polymer_buildfloor(sectnum); - if ((pr_vbos > 0)) - { - if (s->oldindicescount < s->indicescount) - { - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->floor.ivbo); - bglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->indicescount * sizeof(GLushort), NULL, mapvbousage); - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->ceil.ivbo); - bglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->indicescount * sizeof(GLushort), NULL, mapvbousage); - s->oldindicescount = s->indicescount; - } - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->floor.ivbo); - bglBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, s->indicescount * sizeof(GLushort), s->floor.indices); - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->ceil.ivbo); - bglBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, s->indicescount * sizeof(GLushort), s->ceil.indices); - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - } - } - - if (wallinvalidate) - { - s->invalidid++; - polymer_computeplane(&s->floor); - polymer_computeplane(&s->ceil); - } - - s->flags.empty = 0; - s->flags.uptodate = 1; - - if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum); - - return (0); -} - -void PR_CALLBACK polymer_tesserror(GLenum error) -{ - /* This callback is called by the tesselator whenever it raises an error. - GLU_TESS_ERROR6 is the "no error"/"null" error spam in e1l1 and others. */ - - if (pr_verbosity >= 1 && error != GLU_TESS_ERROR6) OSD_Printf("PR : Tesselation error number %i reported : %s.\n", error, bgluErrorString(errno)); -} - -void PR_CALLBACK polymer_tessedgeflag(GLenum error) -{ - // Passing an edgeflag callback forces the tesselator to output a triangle list - UNREFERENCED_PARAMETER(error); - return; -} - -void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector) -{ - _prsector* s; - - s = (_prsector*)sector; - - if (s->curindice >= s->indicescount) - { - if (pr_verbosity >= 2) OSD_Printf("PR : Indice overflow, extending the indices list... !\n"); - s->indicescount++; - s->floor.indices = Brealloc(s->floor.indices, s->indicescount * sizeof(GLushort)); - s->ceil.indices = Brealloc(s->ceil.indices, s->indicescount * sizeof(GLushort)); - } - s->ceil.indices[s->curindice] = (intptr_t)vertex; - s->curindice++; -} - -static int32_t polymer_buildfloor(int16_t sectnum) -{ - // This function tesselates the floor/ceiling of a sector and stores the triangles in a display list. - _prsector* s; - sectortype *sec; - intptr_t i; - - if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum); - - s = prsectors[sectnum]; - sec = §or[sectnum]; - - if (s == NULL) - return (-1); - - if (s->floor.indices == NULL) - { - s->indicescount = (sec->wallnum - 2) * 3; - s->floor.indices = Bcalloc(s->indicescount, sizeof(GLushort)); - s->ceil.indices = Bcalloc(s->indicescount, sizeof(GLushort)); - } - - s->curindice = 0; - - bgluTessCallback(prtess, GLU_TESS_VERTEX_DATA, polymer_tessvertex); - bgluTessCallback(prtess, GLU_TESS_EDGE_FLAG, polymer_tessedgeflag); - bgluTessCallback(prtess, GLU_TESS_ERROR, polymer_tesserror); - - bgluTessProperty(prtess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE); - - bgluTessBeginPolygon(prtess, s); - bgluTessBeginContour(prtess); - - i = 0; - while (i < sec->wallnum) - { - bgluTessVertex(prtess, s->verts + (3 * i), (void *)i); - if ((i != (sec->wallnum - 1)) && ((sec->wallptr + i) > wall[sec->wallptr + i].point2)) - { - bgluTessEndContour(prtess); - bgluTessBeginContour(prtess); - } - i++; - } - bgluTessEndContour(prtess); - bgluTessEndPolygon(prtess); - - i = 0; - while (i < s->indicescount) - { - s->floor.indices[s->indicescount - i - 1] = s->ceil.indices[i]; - - i++; - } - s->floor.indicescount = s->ceil.indicescount = s->indicescount; - - if (pr_verbosity >= 2) OSD_Printf("PR : Tesselated floor of sector %i.\n", sectnum); - - return (1); -} - -static void polymer_drawsector(int16_t sectnum) -{ - sectortype *sec; - _prsector* s; - GLubyte oldcolor[4]; - - if (pr_verbosity >= 3) OSD_Printf("PR : Drawing sector %i...\n", sectnum); - - sec = §or[sectnum]; - s = prsectors[sectnum]; - - fogcalc(sec->floorshade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - - if (!(sec->floorstat & 1) || (searchit == 2)) { - if (searchit == 2) { - memcpy(oldcolor, s->floor.material.diffusemodulation, sizeof(GLubyte) * 4); - - s->floor.material.diffusemodulation[0] = 0x02; - s->floor.material.diffusemodulation[1] = ((GLubyte *)(§num))[0]; - s->floor.material.diffusemodulation[2] = ((GLubyte *)(§num))[1]; - s->floor.material.diffusemodulation[3] = 0xFF; - } - polymer_drawplane(&s->floor); - - if (searchit == 2) - memcpy(s->floor.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); - } - - fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - - if (!(sec->ceilingstat & 1) || (searchit == 2)) { - if (searchit == 2) { - memcpy(oldcolor, s->ceil.material.diffusemodulation, sizeof(GLubyte) * 4); - - s->ceil.material.diffusemodulation[0] = 0x01; - s->ceil.material.diffusemodulation[1] = ((GLubyte *)(§num))[0]; - s->ceil.material.diffusemodulation[2] = ((GLubyte *)(§num))[1]; - s->ceil.material.diffusemodulation[3] = 0xFF; - } - polymer_drawplane(&s->ceil); - - if (searchit == 2) - memcpy(s->ceil.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); - } - - if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing sector %i...\n", sectnum); -} - -// WALLS -static int32_t polymer_initwall(int16_t wallnum) -{ - _prwall *w; - - if (pr_verbosity >= 2) OSD_Printf("PR : Initializing wall %i...\n", wallnum); - - w = Bcalloc(1, sizeof(_prwall)); - if (w == NULL) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize wall %i : Bmalloc failed.\n", wallnum); - return (0); - } - - if (w->mask.buffer == NULL) { - w->mask.buffer = Bmalloc(4 * sizeof(GLfloat) * 5); - w->mask.vertcount = 4; - } - if (w->bigportal == NULL) - w->bigportal = Bmalloc(4 * sizeof(GLfloat) * 5); - if (w->cap == NULL) - w->cap = Bmalloc(4 * sizeof(GLfloat) * 3); - - bglGenBuffersARB(1, &w->wall.vbo); - bglGenBuffersARB(1, &w->over.vbo); - bglGenBuffersARB(1, &w->mask.vbo); - bglGenBuffersARB(1, &w->stuffvbo); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->wall.vbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat) * 5, NULL, mapvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->over.vbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat) * 5, NULL, mapvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->mask.vbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat) * 5, NULL, mapvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->stuffvbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, 8 * sizeof(GLfloat) * 5, NULL, mapvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - - w->flags.empty = 1; - - prwalls[wallnum] = w; - - if (pr_verbosity >= 2) OSD_Printf("PR : Initialized wall %i.\n", wallnum); - - return (1); -} - -static void polymer_updatewall(int16_t wallnum) -{ - int16_t nwallnum, nnwallnum, curpicnum, wallpicnum, walloverpicnum, nwallpicnum; - char curxpanning, curypanning, underwall, overwall, curpal; - int8_t curshade; - walltype *wal; - sectortype *sec, *nsec; - _prwall *w; - _prsector *s, *ns; - int32_t xref, yref; - float ypancoef, dist; - int32_t i; - uint32_t invalid; - int32_t sectofwall = sectorofwall(wallnum); - - // yes, this function is messy and unefficient - // it also works, bitches - sec = §or[sectofwall]; - - if (sectofwall < 0 || sectofwall >= numsectors || - wallnum < 0 || wallnum > numwalls || - sec->wallptr > wallnum || wallnum >= (sec->wallptr + sec->wallnum)) - return; // yay, corrupt map - - wal = &wall[wallnum]; - nwallnum = wal->nextwall; - - w = prwalls[wallnum]; - s = prsectors[sectofwall]; - invalid = s->invalidid; - if (nwallnum >= 0 && nwallnum < numwalls) - { - ns = prsectors[wal->nextsector]; - invalid += ns->invalidid; - nsec = §or[wal->nextsector]; - } - else - { - ns = NULL; - nsec = NULL; - } - - if (w->wall.buffer == NULL) { - w->wall.buffer = Bmalloc(4 * sizeof(GLfloat) * 5); - w->wall.vertcount = 4; - } - - wallpicnum = wal->picnum; - if (picanm[wallpicnum]&192) wallpicnum += animateoffs(wallpicnum,wallnum+16384); - walloverpicnum = wal->overpicnum; - if (picanm[walloverpicnum]&192) walloverpicnum += animateoffs(walloverpicnum,wallnum+16384); - if (nwallnum >= 0 && nwallnum < numwalls) - { - nwallpicnum = wall[nwallnum].picnum; - if (picanm[nwallpicnum]&192) nwallpicnum += animateoffs(nwallpicnum,wallnum+16384); - } - else - nwallpicnum = 0; - - if ((!w->flags.empty) && (!w->flags.invalidtex) && - (w->invalidid == invalid) && - (wal->cstat == w->cstat) && - (wallpicnum == w->picnum) && - (wal->pal == w->pal) && - (wal->xpanning == w->xpanning) && - (wal->ypanning == w->ypanning) && - (wal->xrepeat == w->xrepeat) && - (wal->yrepeat == w->yrepeat) && - (walloverpicnum == w->overpicnum) && - (wal->shade == w->shade) && - ((nwallnum < 0 || nwallnum > numwalls) || - ((nwallpicnum == w->nwallpicnum) && - (wall[nwallnum].xpanning == w->nwallxpanning) && - (wall[nwallnum].ypanning == w->nwallypanning) && - (wall[nwallnum].cstat == w->nwallcstat) && - (wall[nwallnum].shade == w->nwallshade)))) - { - w->flags.uptodate = 1; - return; // screw you guys I'm going home - } - else - { - if (w->invalidid != invalid) - polymer_invalidatesectorlights(sectofwall); - - w->invalidid = invalid; - w->cstat = wal->cstat; - w->picnum = wallpicnum; - w->pal = wal->pal; - w->xpanning = wal->xpanning; - w->ypanning = wal->ypanning; - w->xrepeat = wal->xrepeat; - w->yrepeat = wal->yrepeat; - w->overpicnum = walloverpicnum; - w->shade = wal->shade; - if (nwallnum >= 0 && nwallnum < numwalls) - { - w->nwallpicnum = nwallpicnum; - w->nwallxpanning = wall[nwallnum].xpanning; - w->nwallypanning = wall[nwallnum].ypanning; - w->nwallcstat = wall[nwallnum].cstat; - w->nwallshade = wall[nwallnum].shade; - } - } - - w->underover = underwall = overwall = 0; - - if (wal->cstat & 8) - xref = 1; - else - xref = 0; - - if (wal->nextsector < 0 || wal->nextsector >= numsectors) - { - Bmemcpy(w->wall.buffer, &s->floor.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->wall.buffer[5], &s->floor.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->wall.buffer[10], &s->ceil.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->wall.buffer[15], &s->ceil.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - - if (wal->nextsector < 0) - curpicnum = wallpicnum; - else - curpicnum = walloverpicnum; - - polymer_getbuildmaterial(&w->wall.material, curpicnum, wal->pal, wal->shade, 0); - - if (wal->cstat & 4) - yref = sec->floorz; - else - yref = sec->ceilingz; - - if ((wal->cstat & 32) && (wal->nextsector >= 0)) - { - if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4))) - yref = sec->ceilingz; - else - yref = nsec->floorz; - } - - if (wal->ypanning) - { - ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]); - if (ypancoef < tilesizy[curpicnum]) - ypancoef *= 2; - curypanning = wal->ypanning; - if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef)) - curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef); - ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum])); - } - else - ypancoef = 0; - - i = 0; - while (i < 4) - { - if ((i == 0) || (i == 3)) - dist = (float)xref; - else - dist = (float)(xref == 0); - - w->wall.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + wal->xpanning) / (float)(tilesizx[curpicnum]); - w->wall.buffer[(i * 5) + 4] = (-(float)(yref + (w->wall.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef; - - if (wal->cstat & 256) w->wall.buffer[(i * 5) + 4] = -w->wall.buffer[(i * 5) + 4]; - - i++; - } - - w->underover |= 1; - } - else - { - nnwallnum = wall[nwallnum].point2; - - if ((s->floor.buffer[((wallnum - sec->wallptr) * 5) + 1] < ns->floor.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->floor.buffer[((wal->point2 - sec->wallptr) * 5) + 1] < ns->floor.buffer[((nwallnum - nsec->wallptr) * 5) + 1])) - underwall = 1; - - if ((underwall) || (wal->cstat & 16) || (wal->cstat & 32)) - { - if (s->floor.buffer[((wallnum - sec->wallptr) * 5) + 1] < ns->floor.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) - Bmemcpy(w->wall.buffer, &s->floor.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - else - Bmemcpy(w->wall.buffer, &ns->floor.buffer[(nnwallnum - nsec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->wall.buffer[5], &s->floor.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->wall.buffer[10], &ns->floor.buffer[(nwallnum - nsec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->wall.buffer[15], &ns->floor.buffer[(nnwallnum - nsec->wallptr) * 5], sizeof(GLfloat) * 3); - - if (wal->cstat & 2) - { - curpicnum = nwallpicnum; - curpal = wall[nwallnum].pal; - curshade = wall[nwallnum].shade; - curxpanning = wall[nwallnum].xpanning; - curypanning = wall[nwallnum].ypanning; - } - else - { - curpicnum = wallpicnum; - curpal = wal->pal; - curshade = wal->shade; - curxpanning = wal->xpanning; - curypanning = wal->ypanning; - } - - polymer_getbuildmaterial(&w->wall.material, curpicnum, curpal, curshade, 0); - - if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4))) - yref = sec->ceilingz; - else - yref = nsec->floorz; - - if (curypanning) - { - ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]); - if (ypancoef < tilesizy[curpicnum]) - ypancoef *= 2; - if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef)) - curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef); - ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum])); - } - else - ypancoef = 0; - - i = 0; - while (i < 4) - { - if ((i == 0) || (i == 3)) - dist = (float)xref; - else - dist = (float)(xref == 0); - - w->wall.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + curxpanning) / (float)(tilesizx[curpicnum]); - w->wall.buffer[(i * 5) + 4] = (-(float)(yref + (w->wall.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef; - - if ((!(wal->cstat & 2) && (wal->cstat & 256)) || - ((wal->cstat & 2) && (wall[nwallnum].cstat & 256))) - w->wall.buffer[(i * 5) + 4] = -w->wall.buffer[(i * 5) + 4]; - - i++; - } - - if (underwall) - w->underover |= 1; - - Bmemcpy(w->mask.buffer, &w->wall.buffer[15], sizeof(GLfloat) * 5); - Bmemcpy(&w->mask.buffer[5], &w->wall.buffer[10], sizeof(GLfloat) * 5); - } - else - { - Bmemcpy(w->mask.buffer, &s->floor.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 5); - Bmemcpy(&w->mask.buffer[5], &s->floor.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 5); - } - - if ((s->ceil.buffer[((wallnum - sec->wallptr) * 5) + 1] > ns->ceil.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->ceil.buffer[((wal->point2 - sec->wallptr) * 5) + 1] > ns->ceil.buffer[((nwallnum - nsec->wallptr) * 5) + 1])) - overwall = 1; - - if ((overwall) || (wal->cstat & 16) || (wal->cstat & 32)) - { - if (w->over.buffer == NULL) { - w->over.buffer = Bmalloc(4 * sizeof(GLfloat) * 5); - w->over.vertcount = 4; - } - - Bmemcpy(w->over.buffer, &ns->ceil.buffer[(nnwallnum - nsec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->over.buffer[5], &ns->ceil.buffer[(nwallnum - nsec->wallptr) * 5], sizeof(GLfloat) * 3); - if (s->ceil.buffer[((wal->point2 - sec->wallptr) * 5) + 1] > ns->ceil.buffer[((nwallnum - nsec->wallptr) * 5) + 1]) - Bmemcpy(&w->over.buffer[10], &s->ceil.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - else - Bmemcpy(&w->over.buffer[10], &ns->ceil.buffer[(nwallnum - nsec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->over.buffer[15], &s->ceil.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - - if ((wal->cstat & 16) || (wal->overpicnum == 0)) - curpicnum = wallpicnum; - else - curpicnum = wallpicnum; - - polymer_getbuildmaterial(&w->over.material, curpicnum, wal->pal, wal->shade, 0); - - if ((wal->cstat & 16) || (wal->cstat & 32)) - { - // mask - polymer_getbuildmaterial(&w->mask.material, walloverpicnum, wal->pal, wal->shade, 0); - - if (wal->cstat & 128) - { - if (wal->cstat & 512) - w->mask.material.diffusemodulation[3] = 0x55; - else - w->mask.material.diffusemodulation[3] = 0xAA; - } - } - - if (wal->cstat & 4) - yref = sec->ceilingz; - else - yref = nsec->ceilingz; - - if (wal->ypanning) - { - ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]); - if (ypancoef < tilesizy[curpicnum]) - ypancoef *= 2; - curypanning = wal->ypanning; - if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef)) - curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef); - ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum])); - } - else - ypancoef = 0; - - i = 0; - while (i < 4) - { - if ((i == 0) || (i == 3)) - dist = (float)xref; - else - dist = (float)(xref == 0); - - w->over.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + wal->xpanning) / (float)(tilesizx[curpicnum]); - w->over.buffer[(i * 5) + 4] = (-(float)(yref + (w->over.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef; - - if (wal->cstat & 256) w->over.buffer[(i * 5) + 4] = -w->over.buffer[(i * 5) + 4]; - - i++; - } - - if (overwall) - w->underover |= 2; - - Bmemcpy(&w->mask.buffer[10], &w->over.buffer[5], sizeof(GLfloat) * 5); - Bmemcpy(&w->mask.buffer[15], &w->over.buffer[0], sizeof(GLfloat) * 5); - - if ((wal->cstat & 16) || (wal->cstat & 32)) - { - // mask wall pass - if (wal->cstat & 4) - yref = min(sec->floorz, nsec->floorz); - else - yref = max(sec->ceilingz, nsec->ceilingz); - - if (wal->cstat & 32) - { - if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4))) - yref = sec->ceilingz; - else - yref = nsec->ceilingz; - } - - curpicnum = walloverpicnum; - - if (wal->ypanning) - { - ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]); - if (ypancoef < tilesizy[curpicnum]) - ypancoef *= 2; - curypanning = wal->ypanning; - if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef)) - curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef); - ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum])); - } - else - ypancoef = 0; - - i = 0; - while (i < 4) - { - if ((i == 0) || (i == 3)) - dist = (float)xref; - else - dist = (float)(xref == 0); - - w->mask.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + wal->xpanning) / (float)(tilesizx[curpicnum]); - w->mask.buffer[(i * 5) + 4] = (-(float)(yref + (w->mask.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef; - - if (wal->cstat & 256) w->mask.buffer[(i * 5) + 4] = -w->mask.buffer[(i * 5) + 4]; - - i++; - } - } - } - else - { - Bmemcpy(&w->mask.buffer[10], &s->ceil.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 5); - Bmemcpy(&w->mask.buffer[15], &s->ceil.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 5); - } - } - - if (wal->nextsector < 0) - Bmemcpy(w->mask.buffer, w->wall.buffer, sizeof(GLfloat) * 4 * 5); - - Bmemcpy(w->bigportal, &s->floor.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->bigportal[5], &s->floor.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->bigportal[10], &s->ceil.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->bigportal[15], &s->ceil.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - - Bmemcpy(&w->cap[0], &s->ceil.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->cap[3], &s->ceil.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->cap[6], &s->ceil.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); - Bmemcpy(&w->cap[9], &s->ceil.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - w->cap[7] += 1048576; // this number is the result of 1048574 + 2 - w->cap[10] += 1048576; // this one is arbitrary - - if (w->underover & 1) - polymer_computeplane(&w->wall); - if (w->underover & 2) - polymer_computeplane(&w->over); - polymer_computeplane(&w->mask); - - if ((pr_vbos > 0)) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->wall.vbo); - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat) * 5, w->wall.buffer); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->over.vbo); - if (w->over.buffer) - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat) * 5, w->over.buffer); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->mask.vbo); - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat) * 5, w->mask.buffer); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->stuffvbo); - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat) * 5, w->bigportal); - bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat) * 5, 4 * sizeof(GLfloat) * 3, w->cap); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } - - w->flags.empty = 0; - w->flags.uptodate = 1; - w->flags.invalidtex = 0; - - if (pr_verbosity >= 3) OSD_Printf("PR : Updated wall %i.\n", wallnum); -} - -static void polymer_drawwall(int16_t sectnum, int16_t wallnum) -{ - sectortype *sec; - walltype *wal; - _prwall *w; - GLubyte oldcolor[4]; - int32_t parallaxedfloor = 0, parallaxedceiling = 0; - - if (pr_verbosity >= 3) OSD_Printf("PR : Drawing wall %i...\n", wallnum); - - sec = §or[sectnum]; - wal = &wall[wallnum]; - w = prwalls[wallnum]; - - if ((sec->floorstat & 1) && (wal->nextsector >= 0) && - (sector[wal->nextsector].floorstat & 1)) - parallaxedfloor = 1; - - if ((sec->ceilingstat & 1) && (wal->nextsector >= 0) && - (sector[wal->nextsector].ceilingstat & 1)) - parallaxedceiling = 1; - - fogcalc(wal->shade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - - if ((w->underover & 1) && (!parallaxedfloor || (searchit == 2))) - { - if (searchit == 2) { - memcpy(oldcolor, w->wall.material.diffusemodulation, sizeof(GLubyte) * 4); - - w->wall.material.diffusemodulation[0] = 0x05; - w->wall.material.diffusemodulation[1] = ((GLubyte *)(&wallnum))[0]; - w->wall.material.diffusemodulation[2] = ((GLubyte *)(&wallnum))[1]; - w->wall.material.diffusemodulation[3] = 0xFF; - } - - polymer_drawplane(&w->wall); - - if (searchit == 2) - memcpy(w->wall.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); - } - - if ((w->underover & 2) && (!parallaxedceiling || (searchit == 2))) - { - if (searchit == 2) { - memcpy(oldcolor, w->over.material.diffusemodulation, sizeof(GLubyte) * 4); - - w->over.material.diffusemodulation[0] = 0x00; - w->over.material.diffusemodulation[1] = ((GLubyte *)(&wallnum))[0]; - w->over.material.diffusemodulation[2] = ((GLubyte *)(&wallnum))[1]; - w->over.material.diffusemodulation[3] = 0xFF; - } - - polymer_drawplane(&w->over); - - if (searchit == 2) - memcpy(w->over.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); - } - - if ((wall[wallnum].cstat & 32) && (wall[wallnum].nextsector >= 0)) { - if (searchit == 2) { - memcpy(oldcolor, w->mask.material.diffusemodulation, sizeof(GLubyte) * 4); - - w->mask.material.diffusemodulation[0] = 0x04; - w->mask.material.diffusemodulation[1] = ((GLubyte *)(&wallnum))[0]; - w->mask.material.diffusemodulation[2] = ((GLubyte *)(&wallnum))[1]; - w->mask.material.diffusemodulation[3] = 0xFF; - } - - polymer_drawplane(&w->mask); - - if (searchit == 2) - memcpy(w->mask.material.diffusemodulation, oldcolor, sizeof(GLubyte) * 4); - } - - if (!searchit && (sector[sectnum].ceilingstat & 1) && - ((wall[wallnum].nextsector < 0) || - !(sector[wall[wallnum].nextsector].ceilingstat & 1))) - { - bglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - - if (pr_vbos) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->stuffvbo); - bglVertexPointer(3, GL_FLOAT, 0, (const GLvoid*)(4 * sizeof(GLfloat) * 5)); - } - else - bglVertexPointer(3, GL_FLOAT, 0, w->cap); - - bglDrawArrays(GL_QUADS, 0, 4); - - if (pr_vbos) - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - - bglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } - - if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing wall %i...\n", wallnum); -} - -#define INDICE(n) ((p->indices) ? (p->indices[(i+n)%p->indicescount]*5) : (((i+n)%p->vertcount)*5)) - -// HSR -static void polymer_computeplane(_prplane* p) -{ - GLfloat vec1[5], vec2[5], norm, r;// BxN[3], NxT[3], TxB[3]; - int32_t i; - GLfloat* buffer; - GLfloat* plane; - - if (p->indices && (p->indicescount < 3)) - return; // corrupt sector (E3L4, I'm looking at you) - - buffer = p->buffer; - plane = p->plane; - - i = 0; - do - { - vec1[0] = buffer[(INDICE(1)) + 0] - buffer[(INDICE(0)) + 0]; //x1 - vec1[1] = buffer[(INDICE(1)) + 1] - buffer[(INDICE(0)) + 1]; //y1 - vec1[2] = buffer[(INDICE(1)) + 2] - buffer[(INDICE(0)) + 2]; //z1 - vec1[3] = buffer[(INDICE(1)) + 3] - buffer[(INDICE(0)) + 3]; //s1 - vec1[4] = buffer[(INDICE(1)) + 4] - buffer[(INDICE(0)) + 4]; //t1 - - vec2[0] = buffer[(INDICE(2)) + 0] - buffer[(INDICE(1)) + 0]; //x2 - vec2[1] = buffer[(INDICE(2)) + 1] - buffer[(INDICE(1)) + 1]; //y2 - vec2[2] = buffer[(INDICE(2)) + 2] - buffer[(INDICE(1)) + 2]; //z2 - vec2[3] = buffer[(INDICE(2)) + 3] - buffer[(INDICE(1)) + 3]; //s2 - vec2[4] = buffer[(INDICE(2)) + 4] - buffer[(INDICE(1)) + 4]; //t2 - - polymer_crossproduct(vec2, vec1, plane); - - norm = plane[0] * plane[0] + plane[1] * plane[1] + plane[2] * plane[2]; - - // hack to work around a precision issue with slopes - if (norm >= 15000) - { - float tangent[3][3]; - double det; - - // normalize the normal/plane equation and calculate its plane norm - norm = -sqrt(norm); - norm = 1.0 / norm; - plane[0] *= norm; - plane[1] *= norm; - plane[2] *= norm; - plane[3] = -(plane[0] * buffer[0] + plane[1] * buffer[1] + plane[2] * buffer[2]); - - // calculate T and B - r = 1.0 / (vec1[3] * vec2[4] - vec2[3] * vec1[4]); - - // tangent - tangent[0][0] = (vec2[4] * vec1[0] - vec1[4] * vec2[0]) * r; - tangent[0][1] = (vec2[4] * vec1[1] - vec1[4] * vec2[1]) * r; - tangent[0][2] = (vec2[4] * vec1[2] - vec1[4] * vec2[2]) * r; - - polymer_normalize(&tangent[0][0]); - - // bitangent - tangent[1][0] = (vec1[3] * vec2[0] - vec2[3] * vec1[0]) * r; - tangent[1][1] = (vec1[3] * vec2[1] - vec2[3] * vec1[1]) * r; - tangent[1][2] = (vec1[3] * vec2[2] - vec2[3] * vec1[2]) * r; - - polymer_normalize(&tangent[1][0]); - - // normal - tangent[2][0] = plane[0]; - tangent[2][1] = plane[1]; - tangent[2][2] = plane[2]; - - INVERT_3X3(p->tbn, det, tangent); - - break; - } - i+= (p->indices) ? 3 : 1; - } - while ((p->indices && i < p->indicescount) || - (!p->indices && i < p->vertcount)); -} - -static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out) -{ - out[0] = in_a[1] * in_b[2] - in_a[2] * in_b[1]; - out[1] = in_a[2] * in_b[0] - in_a[0] * in_b[2]; - out[2] = in_a[0] * in_b[1] - in_a[1] * in_b[0]; -} - -static inline void polymer_transformpoint(const float* inpos, float* pos, float* matrix) -{ - pos[0] = inpos[0] * matrix[0] + - inpos[1] * matrix[4] + - inpos[2] * matrix[8] + - + matrix[12]; - pos[1] = inpos[0] * matrix[1] + - inpos[1] * matrix[5] + - inpos[2] * matrix[9] + - + matrix[13]; - pos[2] = inpos[0] * matrix[2] + - inpos[1] * matrix[6] + - inpos[2] * matrix[10] + - + matrix[14]; -} - -static inline void polymer_normalize(float* vec) -{ - double norm; - - norm = vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]; - - norm = sqrt(norm); - norm = 1.0 / norm; - vec[0] *= norm; - vec[1] *= norm; - vec[2] *= norm; -} - -static inline void polymer_pokesector(int16_t sectnum) -{ - sectortype *sec = §or[sectnum]; - _prsector *s = prsectors[sectnum]; - walltype *wal = &wall[sec->wallptr]; - int32_t i = 0; - - if (!s->flags.uptodate) - polymer_updatesector(sectnum); - - do - { - if ((wal->nextsector >= 0) && (!prsectors[wal->nextsector]->flags.uptodate)) - polymer_updatesector(wal->nextsector); - if (!prwalls[sec->wallptr + i]->flags.uptodate) - polymer_updatewall(sec->wallptr + i); - - i++; - wal = &wall[sec->wallptr + i]; - } - while (i < sec->wallnum); -} - -static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projection, float* frustum) -{ - GLfloat matrix[16]; - int32_t i; - - bglMatrixMode(GL_TEXTURE); - bglLoadMatrixf(projection); - bglMultMatrixf(modelview); - bglGetFloatv(GL_TEXTURE_MATRIX, matrix); - bglLoadIdentity(); - bglMatrixMode(GL_MODELVIEW); - - i = 0; - do - { - frustum[i] = matrix[(4 * i) + 3] + matrix[4 * i]; // left - frustum[i + 4] = matrix[(4 * i) + 3] - matrix[4 * i]; // right - frustum[i + 8] = matrix[(4 * i) + 3] - matrix[(4 * i) + 1]; // top - frustum[i + 12] = matrix[(4 * i) + 3] + matrix[(4 * i) + 1]; // bottom - frustum[i + 16] = matrix[(4 * i) + 3] - matrix[(4 * i) + 2]; // far - } - while (++i < 4); - - if (pr_verbosity >= 3) OSD_Printf("PR : Frustum extracted.\n"); -} - -static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum) -{ - int32_t i, j, k = -1; - - i = 4; - do - { - j = k = plane->vertcount - 1; - do - { - k -= ((frustum[(i << 2) + 0] * plane->buffer[j + (j << 2) + 0] + - frustum[(i << 2) + 1] * plane->buffer[j + (j << 2) + 1] + - frustum[(i << 2) + 2] * plane->buffer[j + (j << 2) + 2] + - frustum[(i << 2) + 3]) < 0.f); - - } - while (j--); - - if (k == -1) - return (0); // OUT ! - } - while (i--); - - return (1); -} - -static inline void polymer_scansprites(int16_t sectnum, spritetype* localtsprite, int32_t* localspritesortcnt) -{ - int32_t i; - spritetype *spr; - - for (i = headspritesect[sectnum];i >=0;i = nextspritesect[i]) - { - spr = &sprite[i]; - if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && - (spr->xrepeat > 0) && (spr->yrepeat > 0) && - (*localspritesortcnt < MAXSPRITESONSCREEN)) - { - copybufbyte(spr,&localtsprite[*localspritesortcnt],sizeof(spritetype)); - localtsprite[(*localspritesortcnt)++].owner = i; - } - } -} - -// SKIES -static void polymer_getsky(void) -{ - int32_t i; - - i = 0; - while (i < numsectors) - { - if (sector[i].ceilingstat & 1) - { - cursky = sector[i].ceilingpicnum; - curskypal = sector[i].ceilingpal; - curskyshade = sector[i].ceilingshade; - return; - } - i++; - } -} - -static void polymer_drawsky(int16_t tilenum, char palnum, int8_t shade) -{ - float pos[3]; - pthtyp* pth; - - pos[0] = (float)globalposy; - pos[1] = -(float)(globalposz) / 16.0f; - pos[2] = -(float)globalposx; - - bglPushMatrix(); - bglLoadIdentity(); - bglLoadMatrixf(curskymodelviewmatrix); - - bglTranslatef(pos[0], pos[1], pos[2]); - bglScalef(1000.0f, 1000.0f, 1000.0f); - - drawingskybox = 1; - pth = gltexcache(tilenum,0,0); - drawingskybox = 0; - - if (pth && (pth->flags & 4)) - polymer_drawskybox(tilenum, palnum, shade); - else - polymer_drawartsky(tilenum, palnum, shade); - - bglPopMatrix(); -} - -static void polymer_initartsky(void) -{ - GLfloat halfsqrt2 = 0.70710678f; - - artskydata[0] = -1.0f; artskydata[1] = 0.0f; // 0 - artskydata[2] = -halfsqrt2; artskydata[3] = halfsqrt2; // 1 - artskydata[4] = 0.0f; artskydata[5] = 1.0f; // 2 - artskydata[6] = halfsqrt2; artskydata[7] = halfsqrt2; // 3 - artskydata[8] = 1.0f; artskydata[9] = 0.0f; // 4 - artskydata[10] = halfsqrt2; artskydata[11] = -halfsqrt2; // 5 - artskydata[12] = 0.0f; artskydata[13] = -1.0f; // 6 - artskydata[14] = -halfsqrt2; artskydata[15] = -halfsqrt2; // 7 -} - -static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shade) -{ - pthtyp* pth; - GLuint glpics[5]; - GLfloat glcolors[5][3]; - int32_t i, j; - GLfloat height = 2.45f / 2.0f; - int16_t picnum; - - i = 0; - while (i < 5) - { - picnum = tilenum + i; - if (picanm[picnum]&192) picnum += animateoffs(picnum,0); - if (!waloff[picnum]) - loadtile(picnum); - pth = gltexcache(picnum, palnum, 0); - glpics[i] = pth ? pth->glpic : 0; - - glcolors[i][0] = glcolors[i][1] = glcolors[i][2] = - ((float)(numpalookups-min(max(shade*shadescale,0),numpalookups)))/((float)numpalookups); - - if (pth && (pth->flags & 2)) - { - if (pth->palnum != palnum) - { - glcolors[i][0] *= (float)hictinting[palnum].r / 255.0; - glcolors[i][1] *= (float)hictinting[palnum].g / 255.0; - glcolors[i][2] *= (float)hictinting[palnum].b / 255.0; - } - - if (hictinting[MAXPALOOKUPS-1].r != 255 || - hictinting[MAXPALOOKUPS-1].g != 255 || - hictinting[MAXPALOOKUPS-1].b != 255) - { - glcolors[i][0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0; - glcolors[i][1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0; - glcolors[i][2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0; - } - } - - i++; - } - - i = 0; - j = (1< 0) && (skyboxdatavbo == 0)) - { - bglGenBuffersARB(1, &skyboxdatavbo); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, skyboxdatavbo); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat) * 5 * 6, skyboxdata, modelvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } - - if (pr_vbos > 0) - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, skyboxdatavbo); - - if (picanm[tilenum]&192) tilenum += animateoffs(tilenum,0); - - i = 0; - while (i < 6) - { - drawingskybox = i + 1; - pth = gltexcache(tilenum, palnum, 4); - - color[0] = color[1] = color[2] = - ((float)(numpalookups-min(max(shade*shadescale,0),numpalookups)))/((float)numpalookups); - - if (pth && (pth->flags & 2)) - { - if (pth->palnum != palnum) - { - color[0] *= (float)hictinting[palnum].r / 255.0; - color[1] *= (float)hictinting[palnum].g / 255.0; - color[2] *= (float)hictinting[palnum].b / 255.0; - } - - if (hictinting[MAXPALOOKUPS-1].r != 255 || - hictinting[MAXPALOOKUPS-1].g != 255 || - hictinting[MAXPALOOKUPS-1].b != 255) - { - color[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0; - color[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0; - color[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0; - } - } - - bglColor4f(color[0], color[1], color[2], 1.0); - bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); - if (pr_vbos > 0) - { - bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), (GLfloat*)(4 * 5 * i * sizeof(GLfloat))); - bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), (GLfloat*)(((4 * 5 * i) + 3) * sizeof(GLfloat))); - } else { - bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), &skyboxdata[4 * 5 * i]); - bglTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), &skyboxdata[3 + (4 * 5 * i)]); - } - bglDrawArrays(GL_QUADS, 0, 4); - - i++; - } - drawingskybox = 0; - - if (pr_vbos > 0) - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - - return; -} - -// MDSPRITES -static void polymer_drawmdsprite(spritetype *tspr) -{ - md3model_t* m; - mdskinmap_t* sk; - float *v0, *v1; - md3surf_t *s; - char lpal, targetpal, usinghighpal, foundpalskin; - float spos2[3], spos[3], tspos[3], lpos[3], tlpos[3], vec[3], mat[4][4]; - float ang; - float scale; - double det; - int32_t surfi, i, j; - GLubyte* color; - int32_t materialbits; - float sradius, lradius; - int16_t modellights[PR_MAXLIGHTS]; - char modellightcount; - uint8_t curpriority; - - m = (md3model_t*)models[tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].modelid]; - updateanimation((md2model_t *)m,tspr); - - lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal; - - if ((pr_vbos > 1) && (m->indices == NULL)) - polymer_loadmodelvbos(m); - - // Hackish, but that means it's a model drawn by rotatesprite. - if (tspriteptr[MAXSPRITESONSCREEN] == tspr) { - float x, y, z; - - spos[0] = (float)globalposy; - spos[1] = -(float)(globalposz) / 16.0f; - spos[2] = -(float)globalposx; - - // The coordinates are actually floats disguised as int in this case - memcpy(&x, &tspr->x, sizeof(float)); - memcpy(&y, &tspr->y, sizeof(float)); - memcpy(&z, &tspr->z, sizeof(float)); - - spos2[0] = (float)y - globalposy; - spos2[1] = -(float)(z - globalposz) / 16.0f; - spos2[2] = -(float)(x - globalposx); - } else { - spos[0] = (float)tspr->y; - spos[1] = -(float)(tspr->z) / 16.0f; - spos[2] = -(float)tspr->x; - - spos2[0] = spos2[1] = spos2[2] = 0.0f; - } - - ang = (float)((tspr->ang+spriteext[tspr->owner].angoff) & 2047) / (2048.0f / 360.0f); - ang -= 90.0f; - if (((tspr->cstat>>4) & 3) == 2) - ang -= 90.0f; - - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - bglLoadIdentity(); - scale = (1.0/4.0); - scale *= m->scale; - if (pr_overridemodelscale) { - scale *= pr_overridemodelscale; - } else { - scale *= m->bscale; - } - - if (tspriteptr[MAXSPRITESONSCREEN] == tspr) { - float playerang, radplayerang, cosminusradplayerang, sinminusradplayerang, hudzoom; - - playerang = (globalang & 2047) / (2048.0f / 360.0f) - 90.0f; - radplayerang = (globalang & 2047) * 2.0f * PI / 2048.0f; - cosminusradplayerang = cos(-radplayerang); - sinminusradplayerang = sin(-radplayerang); - hudzoom = 65536.0 / spriteext[tspr->owner].zoff; - - bglTranslatef(spos[0], spos[1], spos[2]); - bglRotatef(horizang, -cosminusradplayerang, 0.0f, sinminusradplayerang); - bglRotatef(spriteext[tspr->owner].roll / (2048.0f / 360.0f), sinminusradplayerang, 0.0f, cosminusradplayerang); - bglRotatef(-playerang, 0.0f, 1.0f, 0.0f); - bglScalef(hudzoom, 1.0f, 1.0f); - bglRotatef(playerang, 0.0f, 1.0f, 0.0f); - bglTranslatef(spos2[0], spos2[1], spos2[2]); - bglRotatef(-ang, 0.0f, 1.0f, 0.0f); - } else { - bglTranslatef(spos[0], spos[1], spos[2]); - bglRotatef(-ang, 0.0f, 1.0f, 0.0f); - } - if (((tspr->cstat>>4) & 3) == 2) - { - bglTranslatef(0.0f, 0.0, -(float)(tilesizy[tspr->picnum] * tspr->yrepeat) / 8.0f); - bglRotatef(90.0f, 0.0f, 0.0f, 1.0f); - } - else - bglRotatef(-90.0f, 1.0f, 0.0f, 0.0f); - - if ((tspr->cstat & 128) && (((tspr->cstat>>4) & 3) != 2)) - bglTranslatef(0.0f, 0.0, -(float)(tilesizy[tspr->picnum] * tspr->yrepeat) / 8.0f); - - if (tspr->cstat & 8) - { - bglTranslatef(0.0f, 0.0, (float)(tilesizy[tspr->picnum] * tspr->yrepeat) / 4.0f); - bglScalef(1.0f, 1.0f, -1.0f); - } - - if (tspr->cstat & 4) - bglScalef(1.0f, -1.0f, 1.0f); - - bglScalef(scale * tspr->xrepeat, scale * tspr->xrepeat, scale * tspr->yrepeat); - bglTranslatef(0.0f, 0.0, m->zadd * 64); - - // scripted model rotation - if (tspr->owner < MAXSPRITES && - (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll)) - { - float pitchang, rollang, offsets[3]; - - pitchang = (float)(spriteext[tspr->owner].pitch) / (2048.0f / 360.0f); - rollang = (float)(spriteext[tspr->owner].roll) / (2048.0f / 360.0f); - - offsets[0] = -spriteext[tspr->owner].xoff / (scale * tspr->xrepeat); - offsets[1] = -spriteext[tspr->owner].yoff / (scale * tspr->xrepeat); - offsets[2] = (float)(spriteext[tspr->owner].zoff) / 16.0f / (scale * tspr->yrepeat); - - bglTranslatef(-offsets[0], -offsets[1], -offsets[2]); - - bglRotatef(pitchang, 0.0f, 1.0f, 0.0f); - bglRotatef(rollang, -1.0f, 0.0f, 0.0f); - - bglTranslatef(offsets[0], offsets[1], offsets[2]); - } - - bglGetFloatv(GL_MODELVIEW_MATRIX, spritemodelview); - - bglPopMatrix(); - bglPushMatrix(); - bglMultMatrixf(spritemodelview); - - // invert this matrix to get the polymer -> mdsprite space - memcpy(mat, spritemodelview, sizeof(float) * 16); - INVERT_4X4(mdspritespace, det, mat); - - // debug code for drawing the model bounding sphere -// bglDisable(GL_TEXTURE_2D); -// bglBegin(GL_LINES); -// bglColor4f(1.0, 0.0, 0.0, 1.0); -// bglVertex3f(m->head.frames[m->cframe].cen.x, -// m->head.frames[m->cframe].cen.y, -// m->head.frames[m->cframe].cen.z); -// bglVertex3f(m->head.frames[m->cframe].cen.x + m->head.frames[m->cframe].r, -// m->head.frames[m->cframe].cen.y, -// m->head.frames[m->cframe].cen.z); -// bglColor4f(0.0, 1.0, 0.0, 1.0); -// bglVertex3f(m->head.frames[m->cframe].cen.x, -// m->head.frames[m->cframe].cen.y, -// m->head.frames[m->cframe].cen.z); -// bglVertex3f(m->head.frames[m->cframe].cen.x, -// m->head.frames[m->cframe].cen.y + m->head.frames[m->cframe].r, -// m->head.frames[m->cframe].cen.z); -// bglColor4f(0.0, 0.0, 1.0, 1.0); -// bglVertex3f(m->head.frames[m->cframe].cen.x, -// m->head.frames[m->cframe].cen.y, -// m->head.frames[m->cframe].cen.z); -// bglVertex3f(m->head.frames[m->cframe].cen.x, -// m->head.frames[m->cframe].cen.y, -// m->head.frames[m->cframe].cen.z + m->head.frames[m->cframe].r); -// bglEnd(); -// bglEnable(GL_TEXTURE_2D); - - polymer_getscratchmaterial(&mdspritematerial); - - color = mdspritematerial.diffusemodulation; - - color[0] = color[1] = color[2] = - ((float)(numpalookups-min(max((tspr->shade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups) * 0xFF; - - usinghighpal = (pr_highpalookups && - prhighpalookups[curbasepal][tspr->pal].map); - - // If that palette has a highpalookup, we'll never use tinting. We might use - // alternate skins if they exist later, though. - if (!usinghighpal && !(hictinting[tspr->pal].f&4)) - { - if (!(m->flags&1) || (!(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0)) - { - color[0] *= (float)hictinting[tspr->pal].r / 255.0; - color[1] *= (float)hictinting[tspr->pal].g / 255.0; - color[2] *= (float)hictinting[tspr->pal].b / 255.0; - } - else globalnoeffect=1; //mdloadskin reads this - } - - // fullscreen tint on global palette change - if (!usinghighpal && - (hictinting[MAXPALOOKUPS-1].r != 255 || - hictinting[MAXPALOOKUPS-1].g != 255 || - hictinting[MAXPALOOKUPS-1].b != 255)) - { - color[0] *= hictinting[MAXPALOOKUPS-1].r / 255.0; - color[1] *= hictinting[MAXPALOOKUPS-1].g / 255.0; - color[2] *= hictinting[MAXPALOOKUPS-1].b / 255.0; - } - - if (tspr->cstat & 2) - { - if (!(tspr->cstat&512)) - color[3] = 0xAA; - else - color[3] = 0x55; - } else - color[3] = 0xFF; - - color[3] *= (1.0f - spriteext[tspr->owner].alpha); - - if (searchit == 2) - { - color[0] = 0x03; - color[1] = ((GLubyte *)(&tspr->owner))[0]; - color[2] = ((GLubyte *)(&tspr->owner))[1]; - color[3] = 0xFF; - } - - if (pr_gpusmoothing) - mdspritematerial.frameprogress = m->interpol; - - mdspritematerial.mdspritespace = GL_TRUE; - - modellightcount = 0; - curpriority = 0; - - // light culling - if (lightcount && (!depth || mirrors[depth-1].plane)) - { - sradius = (m->head.frames[m->cframe].r * (1 - m->interpol)) + - (m->head.frames[m->nframe].r * m->interpol); - - sradius *= max(scale * tspr->xrepeat, scale * tspr->yrepeat); - sradius /= 1000.0f; - - spos[0] = (m->head.frames[m->cframe].cen.x * (1 - m->interpol)) + - (m->head.frames[m->nframe].cen.x * m->interpol); - spos[1] = (m->head.frames[m->cframe].cen.y * (1 - m->interpol)) + - (m->head.frames[m->nframe].cen.y * m->interpol); - spos[2] = (m->head.frames[m->cframe].cen.z * (1 - m->interpol)) + - (m->head.frames[m->nframe].cen.z * m->interpol); - - polymer_transformpoint(spos, tspos, spritemodelview); - polymer_transformpoint(tspos, spos, rootmodelviewmatrix); - - while (curpriority < pr_maxlightpriority) - { - i = j = 0; - while (j < lightcount) - { - while (!prlights[i].flags.active) - i++; - - if (prlights[i].priority != curpriority) - { - i++; - j++; - continue; - } - - lradius = prlights[i].range / 1000.0f; - - lpos[0] = (float)prlights[i].y; - lpos[1] = -(float)prlights[i].z / 16.0f; - lpos[2] = -(float)prlights[i].x; - - polymer_transformpoint(lpos, tlpos, rootmodelviewmatrix); - - vec[0] = tlpos[0] - spos[0]; - vec[0] *= vec[0]; - vec[1] = tlpos[1] - spos[1]; - vec[1] *= vec[1]; - vec[2] = tlpos[2] - spos[2]; - vec[2] *= vec[2]; - - if ((vec[0] + vec[1] + vec[2]) <= ((sradius+lradius) * (sradius+lradius))) - modellights[modellightcount++] = i; - - i++; - j++; - } - curpriority++; - } - } - - for (surfi=0;surfihead.numsurfs;surfi++) - { - s = &m->head.surfs[surfi]; - v0 = &s->geometry[m->cframe*s->numverts*15]; - v1 = &s->geometry[m->nframe*s->numverts*15]; - - // debug code for drawing model normals -// bglDisable(GL_TEXTURE_2D); -// bglBegin(GL_LINES); -// bglColor4f(1.0, 1.0, 1.0, 1.0); -// -// int i = 0; -// while (i < s->numverts) -// { -// bglVertex3f(v0[(i * 6) + 0], -// v0[(i * 6) + 1], -// v0[(i * 6) + 2]); -// bglVertex3f(v0[(i * 6) + 0] + v0[(i * 6) + 3] * 100, -// v0[(i * 6) + 1] + v0[(i * 6) + 4] * 100, -// v0[(i * 6) + 2] + v0[(i * 6) + 5] * 100); -// i++; -// } -// bglEnd(); -// bglEnable(GL_TEXTURE_2D); - - - targetpal = tspr->pal; - foundpalskin = 0; - - for (sk = m->skinmap; sk; sk = sk->next) - if ((int32_t)sk->palette == tspr->pal && - sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum && - sk->surfnum == surfi) - { - if (sk->specpower != 1.0) - mdspritematerial.specmaterial[0] = sk->specpower; - mdspritematerial.specmaterial[1] = sk->specfactor; - foundpalskin = 1; - } - - // If we have a global palette tint, the palskin won't do us any good - if (curbasepal) - foundpalskin = 0; - - if (!foundpalskin && usinghighpal) { - // We don't have a specific skin defined for this palette - // Use the base skin instead and plug in our highpalookup map - targetpal = 0; - mdspritematerial.highpalookupmap = prhighpalookups[curbasepal][tspr->pal].map; - } - - mdspritematerial.diffusemap = - mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,targetpal,surfi); - if (!mdspritematerial.diffusemap) - continue; - - if (!(tspr->cstat&1024)) - { - mdspritematerial.detailmap = - mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi); - - for (sk = m->skinmap; sk; sk = sk->next) - if ((int32_t)sk->palette == DETAILPAL && - sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum && - sk->surfnum == surfi) - mdspritematerial.detailscale[0] = mdspritematerial.detailscale[1] = sk->param; - } - - if (!(tspr->cstat&1024)) - { - mdspritematerial.specmap = - mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,SPECULARPAL,surfi); - } - - if (!(tspr->cstat&1024)) - { - mdspritematerial.normalmap = - mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,NORMALPAL,surfi); - - for (sk = m->skinmap; sk; sk = sk->next) - if ((int32_t)sk->palette == NORMALPAL && - sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum && - sk->surfnum == surfi) { - mdspritematerial.normalbias[0] = sk->specpower; - mdspritematerial.normalbias[1] = sk->specfactor; - } - } - - if (!(tspr->cstat&1024)) - { - mdspritematerial.glowmap = - mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi); - } - - bglEnableClientState(GL_NORMAL_ARRAY); - - if (pr_vbos > 1) - { - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->texcoords[surfi]); - bglTexCoordPointer(2, GL_FLOAT, 0, 0); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->geometry[surfi]); - bglVertexPointer(3, GL_FLOAT, sizeof(float) * 15, (GLfloat*)(m->cframe * s->numverts * sizeof(float) * 15)); - bglNormalPointer(GL_FLOAT, sizeof(float) * 15, (GLfloat*)(m->cframe * s->numverts * sizeof(float) * 15) + 3); - - mdspritematerial.tbn = (GLfloat*)(m->cframe * s->numverts * sizeof(float) * 15) + 6; - - if (pr_gpusmoothing) { - mdspritematerial.nextframedata = (GLfloat*)(m->nframe * s->numverts * sizeof(float) * 15); - } - - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m->indices[surfi]); - - curlight = 0; - do { - materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount); - bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0); - polymer_unbindmaterial(materialbits); - } while ((++curlight < modellightcount) && (curlight < pr_maxlightpasses)); - - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - } - else - { - bglVertexPointer(3, GL_FLOAT, sizeof(float) * 15, v0); - bglNormalPointer(GL_FLOAT, sizeof(float) * 15, v0 + 3); - bglTexCoordPointer(2, GL_FLOAT, 0, s->uv); - - mdspritematerial.tbn = v0 + 6; - - if (pr_gpusmoothing) { - mdspritematerial.nextframedata = (GLfloat*)(v1); - } - - curlight = 0; - do { - materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount); - bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris); - polymer_unbindmaterial(materialbits); - } while ((++curlight < modellightcount) && (curlight < pr_maxlightpasses)); - } - - bglDisableClientState(GL_NORMAL_ARRAY); - } - - bglPopMatrix(); - - globalnoeffect = 0; -} - -static void polymer_loadmodelvbos(md3model_t* m) -{ - int32_t i; - md3surf_t *s; - - m->indices = Bmalloc(m->head.numsurfs * sizeof(GLuint)); - m->texcoords = Bmalloc(m->head.numsurfs * sizeof(GLuint)); - m->geometry = Bmalloc(m->head.numsurfs * sizeof(GLuint)); - - bglGenBuffersARB(m->head.numsurfs, m->indices); - bglGenBuffersARB(m->head.numsurfs, m->texcoords); - bglGenBuffersARB(m->head.numsurfs, m->geometry); - - i = 0; - while (i < m->head.numsurfs) - { - s = &m->head.surfs[i]; - - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m->indices[i]); - bglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->numtris * sizeof(md3tri_t), s->tris, modelvbousage); - - bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->texcoords[i]); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, s->numverts * sizeof(md3uv_t), s->uv, modelvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->geometry[i]); - bglBufferDataARB(GL_ARRAY_BUFFER_ARB, s->numframes * s->numverts * sizeof(float) * (15), s->geometry, modelvbousage); - - bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - i++; - } -} - -// MATERIALS -static void polymer_getscratchmaterial(_prmaterial* material) -{ - // this function returns a material that won't validate any bits - // make sure to keep it up to date with the validation logic in bindmaterial - - // PR_BIT_ANIM_INTERPOLATION - material->frameprogress = 0.0f; - material->nextframedata = NULL; - // PR_BIT_NORMAL_MAP - material->normalmap = 0; - material->normalbias[0] = material->normalbias[1] = 0.0f; - material->tbn = NULL; - // PR_BIT_DIFFUSE_MAP - material->diffusemap = 0; - material->diffusescale[0] = material->diffusescale[1] = 1.0f; - // PR_BIT_HIGHPALOOKUP_MAP - material->highpalookupmap = 0; - // PR_BIT_DIFFUSE_DETAIL_MAP - material->detailmap = 0; - material->detailscale[0] = material->detailscale[1] = 1.0f; - // PR_BIT_DIFFUSE_MODULATION - material->diffusemodulation[0] = - material->diffusemodulation[1] = - material->diffusemodulation[2] = - material->diffusemodulation[3] = 0xFF; - // PR_BIT_SPECULAR_MAP - material->specmap = 0; - // PR_BIT_SPECULAR_MATERIAL - material->specmaterial[0] = 15.0f; - material->specmaterial[1] = 1.0f; - // PR_BIT_MIRROR_MAP - material->mirrormap = 0; - // PR_BIT_GLOW_MAP - material->glowmap = 0; - // PR_BIT_PROJECTION_MAP - material->mdspritespace = GL_FALSE; -} - -static void polymer_getbuildmaterial(_prmaterial* material, int16_t tilenum, char pal, int8_t shade, int32_t cmeth) -{ - pthtyp* pth; - int32_t usinghighpal = 0; - - polymer_getscratchmaterial(material); - - // PR_BIT_DIFFUSE_MAP - if (!waloff[tilenum]) - loadtile(tilenum); - - // PR_BIT_HIGHPALOOKUP_MAP - if (pr_highpalookups && prhighpalookups[curbasepal][pal].map && - hicfindsubst(tilenum, 0, 0) && - (curbasepal || (hicfindsubst(tilenum, pal, 0)->palnum != pal))) - { - material->highpalookupmap = prhighpalookups[curbasepal][pal].map; - pal = 0; - usinghighpal = 1; - } - - if ((pth = gltexcache(tilenum, pal, cmeth))) - { - material->diffusemap = pth->glpic; - - if (pth->hicr) - { - material->diffusescale[0] = pth->hicr->xscale; - material->diffusescale[1] = pth->hicr->yscale; - - // PR_BIT_SPECULAR_MATERIAL - if (pth->hicr->specpower != 1.0f) - material->specmaterial[0] = pth->hicr->specpower; - material->specmaterial[1] = pth->hicr->specfactor; - } - - // PR_BIT_DIFFUSE_MODULATION - material->diffusemodulation[0] = - material->diffusemodulation[1] = - material->diffusemodulation[2] = - ((float)(numpalookups-min(max((shade * shadescale),0),numpalookups)))/((float)numpalookups) * 0xFF; - - if (pth->flags & 2) - { - if (pth->palnum != pal) - { - material->diffusemodulation[0] *= (float)hictinting[pal].r / 255.0; - material->diffusemodulation[1] *= (float)hictinting[pal].g / 255.0; - material->diffusemodulation[2] *= (float)hictinting[pal].b / 255.0; - } - - // fullscreen tint on global palette change... this is used for nightvision and underwater tinting - // if ((hictinting[MAXPALOOKUPS-1].r + hictinting[MAXPALOOKUPS-1].g + hictinting[MAXPALOOKUPS-1].b) != 0x2FD) - if (!usinghighpal && ((uint32_t)hictinting[MAXPALOOKUPS-1].r & 0xFFFFFF00) != 0xFFFFFF00) - { - material->diffusemodulation[0] *= hictinting[MAXPALOOKUPS-1].r / 255.0; - material->diffusemodulation[1] *= hictinting[MAXPALOOKUPS-1].g / 255.0; - material->diffusemodulation[2] *= hictinting[MAXPALOOKUPS-1].b / 255.0; - } - } - - // PR_BIT_GLOW_MAP - if (r_fullbrights && pth->flags & 16) - material->glowmap = pth->ofb->glpic; - } - - // PR_BIT_DIFFUSE_DETAIL_MAP - if (hicfindsubst(tilenum, DETAILPAL, 0) && (pth = gltexcache(tilenum, DETAILPAL, 0)) && - pth->hicr && (pth->hicr->palnum == DETAILPAL)) - { - material->detailmap = pth->glpic; - material->detailscale[0] = pth->hicr->xscale; - material->detailscale[1] = pth->hicr->yscale; - } - - // PR_BIT_GLOW_MAP - if (hicfindsubst(tilenum, GLOWPAL, 0) && (pth = gltexcache(tilenum, GLOWPAL, 0)) && - pth->hicr && (pth->hicr->palnum == GLOWPAL)) - material->glowmap = pth->glpic; - - // PR_BIT_SPECULAR_MAP - if (hicfindsubst(tilenum, SPECULARPAL, 0) && (pth = gltexcache(tilenum, SPECULARPAL, 0)) && - pth->hicr && (pth->hicr->palnum == SPECULARPAL)) - material->specmap = pth->glpic; - - // PR_BIT_NORMAL_MAP - if (hicfindsubst(tilenum, NORMALPAL, 0) && (pth = gltexcache(tilenum, NORMALPAL, 0)) && - pth->hicr && (pth->hicr->palnum == NORMALPAL)) - { - material->normalmap = pth->glpic; - material->normalbias[0] = pth->hicr->specpower; - material->normalbias[1] = pth->hicr->specfactor; - } -} - -static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, int matlightcount) -{ - int32_t programbits; - int32_t texunit; - - programbits = 0; - - // --------- bit validation - - // PR_BIT_ANIM_INTERPOLATION - if (material.nextframedata) - programbits |= prprogrambits[PR_BIT_ANIM_INTERPOLATION].bit; - - // PR_BIT_LIGHTING_PASS - if (curlight && matlightcount) - programbits |= prprogrambits[PR_BIT_LIGHTING_PASS].bit; - - // PR_BIT_NORMAL_MAP - if (pr_normalmapping && material.normalmap) - programbits |= prprogrambits[PR_BIT_NORMAL_MAP].bit; - - // PR_BIT_DIFFUSE_MAP - if (material.diffusemap) { - programbits |= prprogrambits[PR_BIT_DIFFUSE_MAP].bit; - programbits |= prprogrambits[PR_BIT_DIFFUSE_MAP2].bit; - } - - // PR_BIT_HIGHPALOOKUP_MAP - if (material.highpalookupmap) - programbits |= prprogrambits[PR_BIT_HIGHPALOOKUP_MAP].bit; - - // PR_BIT_DIFFUSE_DETAIL_MAP - if (r_detailmapping && material.detailmap) - programbits |= prprogrambits[PR_BIT_DIFFUSE_DETAIL_MAP].bit; - - // PR_BIT_DIFFUSE_MODULATION - programbits |= prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit; - - // PR_BIT_SPECULAR_MAP - if (pr_specularmapping && material.specmap) - programbits |= prprogrambits[PR_BIT_SPECULAR_MAP].bit; - - // PR_BIT_SPECULAR_MATERIAL - if ((material.specmaterial[0] != 15.0) || (material.specmaterial[1] != 1.0) || pr_overridespecular) - programbits |= prprogrambits[PR_BIT_SPECULAR_MATERIAL].bit; - - // PR_BIT_MIRROR_MAP - if (!curlight && material.mirrormap) - programbits |= prprogrambits[PR_BIT_MIRROR_MAP].bit; - - // PR_BIT_FOG - if (!material.mirrormap) - programbits |= prprogrambits[PR_BIT_FOG].bit; - - // PR_BIT_GLOW_MAP - if (!curlight && r_glowmapping && material.glowmap) - programbits |= prprogrambits[PR_BIT_GLOW_MAP].bit; - - // PR_BIT_POINT_LIGHT - if (matlightcount) { - programbits |= prprogrambits[PR_BIT_POINT_LIGHT].bit; - // PR_BIT_SPOT_LIGHT - if (prlights[lights[curlight]].radius) { - programbits |= prprogrambits[PR_BIT_SPOT_LIGHT].bit; - // PR_BIT_SHADOW_MAP - if (prlights[lights[curlight]].rtindex != -1) { - programbits |= prprogrambits[PR_BIT_SHADOW_MAP].bit; - programbits |= prprogrambits[PR_BIT_PROJECTION_MAP].bit; - } - // PR_BIT_LIGHT_MAP - if (prlights[lights[curlight]].lightmap) { - programbits |= prprogrambits[PR_BIT_LIGHT_MAP].bit; - programbits |= prprogrambits[PR_BIT_PROJECTION_MAP].bit; - } - } - } - - // material override - programbits &= overridematerial; - - programbits |= prprogrambits[PR_BIT_HEADER].bit; - programbits |= prprogrambits[PR_BIT_FOOTER].bit; - - // --------- program compiling - if (!prprograms[programbits].handle) - polymer_compileprogram(programbits); - - bglUseProgramObjectARB(prprograms[programbits].handle); - - // --------- bit setup - - texunit = 0; - - // PR_BIT_ANIM_INTERPOLATION - if (programbits & prprogrambits[PR_BIT_ANIM_INTERPOLATION].bit) - { - bglEnableVertexAttribArrayARB(prprograms[programbits].attrib_nextFrameData); - if (prprograms[programbits].attrib_nextFrameNormal != -1) - bglEnableVertexAttribArrayARB(prprograms[programbits].attrib_nextFrameNormal); - bglVertexAttribPointerARB(prprograms[programbits].attrib_nextFrameData, - 3, GL_FLOAT, GL_FALSE, - sizeof(float) * 15, - material.nextframedata); - if (prprograms[programbits].attrib_nextFrameNormal != -1) - bglVertexAttribPointerARB(prprograms[programbits].attrib_nextFrameNormal, - 3, GL_FLOAT, GL_FALSE, - sizeof(float) * 15, - material.nextframedata + 3); - - bglUniform1fARB(prprograms[programbits].uniform_frameProgress, material.frameprogress); - } - - // PR_BIT_LIGHTING_PASS - if (programbits & prprogrambits[PR_BIT_LIGHTING_PASS].bit) - { - // Careful with that, it works only if we respect the wrapping order - // or make sure GL_BLEND is the only ENABLE we mess with here. - bglPushAttrib(GL_ENABLE_BIT); - bglEnable(GL_BLEND); - bglBlendFunc(GL_ONE, GL_ONE); - } - - // PR_BIT_NORMAL_MAP - if (programbits & prprogrambits[PR_BIT_NORMAL_MAP].bit) - { - float pos[3], bias[2]; - - pos[0] = (float)globalposy; - pos[1] = -(float)(globalposz) / 16.0f; - pos[2] = -(float)globalposx; - - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_2D, material.normalmap); - - if (material.mdspritespace == GL_TRUE) { - float mdspritespacepos[3]; - polymer_transformpoint(pos, mdspritespacepos, (float *)mdspritespace); - bglUniform3fvARB(prprograms[programbits].uniform_eyePosition, 1, mdspritespacepos); - } else - bglUniform3fvARB(prprograms[programbits].uniform_eyePosition, 1, pos); - bglUniform1iARB(prprograms[programbits].uniform_normalMap, texunit); - if (pr_overrideparallax) { - bias[0] = pr_parallaxscale; - bias[1] = pr_parallaxbias; - bglUniform2fvARB(prprograms[programbits].uniform_normalBias, 1, bias); - } else - bglUniform2fvARB(prprograms[programbits].uniform_normalBias, 1, material.normalbias); - - if (material.tbn) { - bglEnableVertexAttribArrayARB(prprograms[programbits].attrib_T); - bglEnableVertexAttribArrayARB(prprograms[programbits].attrib_B); - bglEnableVertexAttribArrayARB(prprograms[programbits].attrib_N); - - bglVertexAttribPointerARB(prprograms[programbits].attrib_T, - 3, GL_FLOAT, GL_FALSE, - sizeof(float) * 15, - material.tbn); - bglVertexAttribPointerARB(prprograms[programbits].attrib_B, - 3, GL_FLOAT, GL_FALSE, - sizeof(float) * 15, - material.tbn + 3); - bglVertexAttribPointerARB(prprograms[programbits].attrib_N, - 3, GL_FLOAT, GL_FALSE, - sizeof(float) * 15, - material.tbn + 6); - } - - texunit++; - } - - // PR_BIT_DIFFUSE_MAP - if (programbits & prprogrambits[PR_BIT_DIFFUSE_MAP].bit) - { - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_2D, material.diffusemap); - - bglUniform1iARB(prprograms[programbits].uniform_diffuseMap, texunit); - bglUniform2fvARB(prprograms[programbits].uniform_diffuseScale, 1, material.diffusescale); - - texunit++; - } - - // PR_BIT_HIGHPALOOKUP_MAP - if (programbits & prprogrambits[PR_BIT_HIGHPALOOKUP_MAP].bit) - { - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_3D, material.highpalookupmap); - - bglUniform1iARB(prprograms[programbits].uniform_highPalookupMap, texunit); - - texunit++; - } - - // PR_BIT_DIFFUSE_DETAIL_MAP - if (programbits & prprogrambits[PR_BIT_DIFFUSE_DETAIL_MAP].bit) - { - float scale[2]; - - // scale by the diffuse map scale if we're not doing normal mapping - if (!(programbits & prprogrambits[PR_BIT_NORMAL_MAP].bit)) - { - scale[0] = material.diffusescale[0] * material.detailscale[0]; - scale[1] = material.diffusescale[1] * material.detailscale[1]; - } else { - scale[0] = material.detailscale[0]; - scale[1] = material.detailscale[1]; - } - - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_2D, material.detailmap); - - bglUniform1iARB(prprograms[programbits].uniform_detailMap, texunit); - bglUniform2fvARB(prprograms[programbits].uniform_detailScale, 1, scale); - - texunit++; - } - - // PR_BIT_DIFFUSE_MODULATION - if (programbits & prprogrambits[PR_BIT_DIFFUSE_MODULATION].bit) - { - bglColor4ub(material.diffusemodulation[0], - material.diffusemodulation[1], - material.diffusemodulation[2], - material.diffusemodulation[3]); - } - - // PR_BIT_SPECULAR_MAP - if (programbits & prprogrambits[PR_BIT_SPECULAR_MAP].bit) - { - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_2D, material.specmap); - - bglUniform1iARB(prprograms[programbits].uniform_specMap, texunit); - - texunit++; - } - - // PR_BIT_SPECULAR_MATERIAL - if (programbits & prprogrambits[PR_BIT_SPECULAR_MATERIAL].bit) - { - float specmaterial[2]; - - if (pr_overridespecular) { - specmaterial[0] = pr_specularpower; - specmaterial[1] = pr_specularfactor; - bglUniform2fvARB(prprograms[programbits].uniform_specMaterial, 1, specmaterial); - } else - bglUniform2fvARB(prprograms[programbits].uniform_specMaterial, 1, material.specmaterial); - } - - // PR_BIT_MIRROR_MAP - if (programbits & prprogrambits[PR_BIT_MIRROR_MAP].bit) - { - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_RECTANGLE, material.mirrormap); - - bglUniform1iARB(prprograms[programbits].uniform_mirrorMap, texunit); - - texunit++; - } - - // PR_BIT_GLOW_MAP - if (programbits & prprogrambits[PR_BIT_GLOW_MAP].bit) - { - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_2D, material.glowmap); - - bglUniform1iARB(prprograms[programbits].uniform_glowMap, texunit); - - texunit++; - } - - // PR_BIT_POINT_LIGHT - if (programbits & prprogrambits[PR_BIT_POINT_LIGHT].bit) - { - float inpos[4], pos[4]; - float range[2]; - float color[4]; - - inpos[0] = (float)prlights[lights[curlight]].y; - inpos[1] = -(float)prlights[lights[curlight]].z / 16.0f; - inpos[2] = -(float)prlights[lights[curlight]].x; - - polymer_transformpoint(inpos, pos, curmodelviewmatrix); - - // PR_BIT_SPOT_LIGHT - if (programbits & prprogrambits[PR_BIT_SPOT_LIGHT].bit) - { - float sinang, cosang, sinhorizang, coshorizangs; - float indir[3], dir[3]; - - cosang = (float)(sintable[(-prlights[lights[curlight]].angle+1024)&2047]) / 16383.0f; - sinang = (float)(sintable[(-prlights[lights[curlight]].angle+512)&2047]) / 16383.0f; - coshorizangs = (float)(sintable[(getangle(128, prlights[lights[curlight]].horiz-100)+1024)&2047]) / 16383.0f; - sinhorizang = (float)(sintable[(getangle(128, prlights[lights[curlight]].horiz-100)+512)&2047]) / 16383.0f; - - indir[0] = inpos[0] + sinhorizang * cosang; - indir[1] = inpos[1] - coshorizangs; - indir[2] = inpos[2] - sinhorizang * sinang; - - polymer_transformpoint(indir, dir, curmodelviewmatrix); - - dir[0] -= pos[0]; - dir[1] -= pos[1]; - dir[2] -= pos[2]; - - indir[0] = (float)(sintable[(prlights[lights[curlight]].radius+512)&2047]) / 16383.0f; - indir[1] = (float)(sintable[(prlights[lights[curlight]].faderadius+512)&2047]) / 16383.0f; - indir[1] = 1.0 / (indir[1] - indir[0]); - - bglUniform3fvARB(prprograms[programbits].uniform_spotDir, 1, dir); - bglUniform2fvARB(prprograms[programbits].uniform_spotRadius, 1, indir); - - // PR_BIT_PROJECTION_MAP - if (programbits & prprogrambits[PR_BIT_PROJECTION_MAP].bit) - { - GLfloat matrix[16]; - - bglMatrixMode(GL_TEXTURE); - bglLoadMatrixf(shadowBias); - bglMultMatrixf(prlights[lights[curlight]].proj); - bglMultMatrixf(prlights[lights[curlight]].transform); - if (material.mdspritespace == GL_TRUE) - bglMultMatrixf(spritemodelview); - bglGetFloatv(GL_TEXTURE_MATRIX, matrix); - bglLoadIdentity(); - bglMatrixMode(GL_MODELVIEW); - - bglUniformMatrix4fvARB(prprograms[programbits].uniform_shadowProjMatrix, 1, GL_FALSE, matrix); - - // PR_BIT_SHADOW_MAP - if (programbits & prprogrambits[PR_BIT_SHADOW_MAP].bit) - { - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(prrts[prlights[lights[curlight]].rtindex].target, prrts[prlights[lights[curlight]].rtindex].z); - - bglUniform1iARB(prprograms[programbits].uniform_shadowMap, texunit); - - texunit++; - } - - // PR_BIT_LIGHT_MAP - if (programbits & prprogrambits[PR_BIT_LIGHT_MAP].bit) - { - bglActiveTextureARB(texunit + GL_TEXTURE0_ARB); - bglBindTexture(GL_TEXTURE_2D, prlights[lights[curlight]].lightmap); - - bglUniform1iARB(prprograms[programbits].uniform_lightMap, texunit); - - texunit++; - } - } - } - - range[0] = prlights[lights[curlight]].range / 1000.0f; - range[1] = 1 / (range[0] * range[0]); - - color[0] = prlights[lights[curlight]].color[0] / 255.0f; - color[1] = prlights[lights[curlight]].color[1] / 255.0f; - color[2] = prlights[lights[curlight]].color[2] / 255.0f; - - bglLightfv(GL_LIGHT0, GL_AMBIENT, pos); - bglLightfv(GL_LIGHT0, GL_DIFFUSE, color); - if (material.mdspritespace == GL_TRUE) { - float mdspritespacepos[3]; - polymer_transformpoint(inpos, mdspritespacepos, (float *)mdspritespace); - bglLightfv(GL_LIGHT0, GL_SPECULAR, mdspritespacepos); - } else { - bglLightfv(GL_LIGHT0, GL_SPECULAR, inpos); - } - bglLightfv(GL_LIGHT0, GL_LINEAR_ATTENUATION, &range[1]); - } - - bglActiveTextureARB(GL_TEXTURE0_ARB); - - return (programbits); -} - -static void polymer_unbindmaterial(int32_t programbits) -{ - // repair any dirty GL state here - - // PR_BIT_ANIM_INTERPOLATION - if (programbits & prprogrambits[PR_BIT_ANIM_INTERPOLATION].bit) - { - if (prprograms[programbits].attrib_nextFrameNormal != -1) - bglDisableVertexAttribArrayARB(prprograms[programbits].attrib_nextFrameNormal); - bglDisableVertexAttribArrayARB(prprograms[programbits].attrib_nextFrameData); - } - - // PR_BIT_LIGHTING_PASS - if (programbits & prprogrambits[PR_BIT_LIGHTING_PASS].bit) - { - bglPopAttrib(); - bglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - - // PR_BIT_NORMAL_MAP - if (programbits & prprogrambits[PR_BIT_NORMAL_MAP].bit) - { - bglDisableVertexAttribArrayARB(prprograms[programbits].attrib_T); - bglDisableVertexAttribArrayARB(prprograms[programbits].attrib_B); - bglDisableVertexAttribArrayARB(prprograms[programbits].attrib_N); - } - - bglUseProgramObjectARB(0); -} - -static void polymer_compileprogram(int32_t programbits) -{ - int32_t i, enabledbits; - GLhandleARB vert, frag, program; - GLcharARB* source[PR_BIT_COUNT * 2]; - GLcharARB infobuffer[PR_INFO_LOG_BUFFER_SIZE]; - GLint linkstatus; - - // --------- VERTEX - vert = bglCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); - - enabledbits = i = 0; - while (i < PR_BIT_COUNT) - { - if (programbits & prprogrambits[i].bit) - source[enabledbits++] = prprogrambits[i].vert_def; - i++; - } - i = 0; - while (i < PR_BIT_COUNT) - { - if (programbits & prprogrambits[i].bit) - source[enabledbits++] = prprogrambits[i].vert_prog; - i++; - } - - bglShaderSourceARB(vert, enabledbits, (const GLcharARB**)source, NULL); - - bglCompileShaderARB(vert); - - // --------- FRAGMENT - frag = bglCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); - - enabledbits = i = 0; - while (i < PR_BIT_COUNT) - { - if (programbits & prprogrambits[i].bit) - source[enabledbits++] = prprogrambits[i].frag_def; - i++; - } - i = 0; - while (i < PR_BIT_COUNT) - { - if (programbits & prprogrambits[i].bit) - source[enabledbits++] = prprogrambits[i].frag_prog; - i++; - } - - bglShaderSourceARB(frag, enabledbits, (const GLcharARB**)source, NULL); - - bglCompileShaderARB(frag); - - // --------- PROGRAM - program = bglCreateProgramObjectARB(); - - bglAttachObjectARB(program, vert); - bglAttachObjectARB(program, frag); - - bglLinkProgramARB(program); - - bglGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB, &linkstatus); - - bglGetInfoLogARB(program, PR_INFO_LOG_BUFFER_SIZE, NULL, infobuffer); - - prprograms[programbits].handle = program; - - if (pr_verbosity >= 2) OSD_Printf("PR : Compiling GPU program with bits %i...\n", programbits); - if (!linkstatus) { - OSD_Printf("PR : Failed to compile GPU program with bits %i!\n", programbits); - if (pr_verbosity >= 1) OSD_Printf("PR : Compilation log:\n%s\n", infobuffer); - bglGetShaderSourceARB(vert, PR_INFO_LOG_BUFFER_SIZE, NULL, infobuffer); - if (pr_verbosity >= 1) OSD_Printf("PR : Vertex source dump:\n%s\n", infobuffer); - bglGetShaderSourceARB(frag, PR_INFO_LOG_BUFFER_SIZE, NULL, infobuffer); - if (pr_verbosity >= 1) OSD_Printf("PR : Fragment source dump:\n%s\n", infobuffer); - } - - // --------- ATTRIBUTE/UNIFORM LOCATIONS - - // PR_BIT_ANIM_INTERPOLATION - if (programbits & prprogrambits[PR_BIT_ANIM_INTERPOLATION].bit) - { - prprograms[programbits].attrib_nextFrameData = bglGetAttribLocationARB(program, "nextFrameData"); - prprograms[programbits].attrib_nextFrameNormal = bglGetAttribLocationARB(program, "nextFrameNormal"); - prprograms[programbits].uniform_frameProgress = bglGetUniformLocationARB(program, "frameProgress"); - } - - // PR_BIT_NORMAL_MAP - if (programbits & prprogrambits[PR_BIT_NORMAL_MAP].bit) - { - prprograms[programbits].attrib_T = bglGetAttribLocationARB(program, "T"); - prprograms[programbits].attrib_B = bglGetAttribLocationARB(program, "B"); - prprograms[programbits].attrib_N = bglGetAttribLocationARB(program, "N"); - prprograms[programbits].uniform_eyePosition = bglGetUniformLocationARB(program, "eyePosition"); - prprograms[programbits].uniform_normalMap = bglGetUniformLocationARB(program, "normalMap"); - prprograms[programbits].uniform_normalBias = bglGetUniformLocationARB(program, "normalBias"); - } - - // PR_BIT_DIFFUSE_MAP - if (programbits & prprogrambits[PR_BIT_DIFFUSE_MAP].bit) - { - prprograms[programbits].uniform_diffuseMap = bglGetUniformLocationARB(program, "diffuseMap"); - prprograms[programbits].uniform_diffuseScale = bglGetUniformLocationARB(program, "diffuseScale"); - } - - // PR_BIT_HIGHPALOOKUP_MAP - if (programbits & prprogrambits[PR_BIT_HIGHPALOOKUP_MAP].bit) - { - prprograms[programbits].uniform_highPalookupMap = bglGetUniformLocationARB(program, "highPalookupMap"); - } - - // PR_BIT_DIFFUSE_DETAIL_MAP - if (programbits & prprogrambits[PR_BIT_DIFFUSE_DETAIL_MAP].bit) - { - prprograms[programbits].uniform_detailMap = bglGetUniformLocationARB(program, "detailMap"); - prprograms[programbits].uniform_detailScale = bglGetUniformLocationARB(program, "detailScale"); - } - - // PR_BIT_SPECULAR_MAP - if (programbits & prprogrambits[PR_BIT_SPECULAR_MAP].bit) - { - prprograms[programbits].uniform_specMap = bglGetUniformLocationARB(program, "specMap"); - } - - // PR_BIT_SPECULAR_MATERIAL - if (programbits & prprogrambits[PR_BIT_SPECULAR_MATERIAL].bit) - { - prprograms[programbits].uniform_specMaterial = bglGetUniformLocationARB(program, "specMaterial"); - } - - // PR_BIT_MIRROR_MAP - if (programbits & prprogrambits[PR_BIT_MIRROR_MAP].bit) - { - prprograms[programbits].uniform_mirrorMap = bglGetUniformLocationARB(program, "mirrorMap"); - } - - // PR_BIT_GLOW_MAP - if (programbits & prprogrambits[PR_BIT_GLOW_MAP].bit) - { - prprograms[programbits].uniform_glowMap = bglGetUniformLocationARB(program, "glowMap"); - } - - // PR_BIT_PROJECTION_MAP - if (programbits & prprogrambits[PR_BIT_PROJECTION_MAP].bit) - { - prprograms[programbits].uniform_shadowProjMatrix = bglGetUniformLocationARB(program, "shadowProjMatrix"); - } - - // PR_BIT_SHADOW_MAP - if (programbits & prprogrambits[PR_BIT_SHADOW_MAP].bit) - { - prprograms[programbits].uniform_shadowMap = bglGetUniformLocationARB(program, "shadowMap"); - } - - // PR_BIT_LIGHT_MAP - if (programbits & prprogrambits[PR_BIT_LIGHT_MAP].bit) - { - prprograms[programbits].uniform_lightMap = bglGetUniformLocationARB(program, "lightMap"); - } - - // PR_BIT_SPOT_LIGHT - if (programbits & prprogrambits[PR_BIT_SPOT_LIGHT].bit) - { - prprograms[programbits].uniform_spotDir = bglGetUniformLocationARB(program, "spotDir"); - prprograms[programbits].uniform_spotRadius = bglGetUniformLocationARB(program, "spotRadius"); - } -} - -// LIGHTS -static void polymer_removelight(int16_t lighti) -{ - _prplanelist* oldhead; - - while (prlights[lighti].planelist) - { - polymer_deleteplanelight(prlights[lighti].planelist->plane, lighti); - oldhead = prlights[lighti].planelist; - prlights[lighti].planelist = prlights[lighti].planelist->n; - Bfree(oldhead); - } - prlights[lighti].planecount = 0; - prlights[lighti].planelist = NULL; -} - -static void polymer_updatelights(void) -{ - int32_t i = 0; - - do - { - if (prlights[i].flags.active && prlights[i].flags.invalidate) { - // highly suboptimal - polymer_removelight(i); - - if (prlights[i].radius) - polymer_processspotlight(&prlights[i]); - - polymer_culllight(i); - - prlights[i].flags.invalidate = 0; - } - - if (prlights[i].flags.active) - prlights[i].rtindex = -1; - } - while (++i < PR_MAXLIGHTS); -} - -static inline void polymer_resetplanelights(_prplane* plane) -{ - Bmemset(&plane->lights[0], -1, sizeof(plane->lights[0]) * plane->lightcount); - plane->lightcount = 0; -} - -static void polymer_addplanelight(_prplane* plane, int16_t lighti) -{ - _prplanelist* oldhead; - int32_t i = 0; - - if (plane->lightcount == PR_MAXLIGHTS - 1) - return; - - if (plane->lightcount) - { - do - { - if (plane->lights[i++] == lighti) - goto out; - } - while (i < plane->lightcount); - - i = 0; - while (i < plane->lightcount && prlights[plane->lights[i]].priority < prlights[lighti].priority) - i++; - Bmemmove(&plane->lights[i+1], &plane->lights[i], sizeof(int16_t) * (plane->lightcount - i)); - } - - plane->lights[i] = lighti; - plane->lightcount++; - -out: - oldhead = prlights[lighti].planelist; - while (oldhead != NULL) - { - if (oldhead->plane == plane) return; - oldhead = oldhead->n; - } - - oldhead = prlights[lighti].planelist; - prlights[lighti].planelist = Bmalloc(sizeof(_prplanelist)); - prlights[lighti].planelist->n = oldhead; - - prlights[lighti].planelist->plane = plane; - prlights[lighti].planecount++; -} - -static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti) -{ - int32_t i = plane->lightcount-1; - - while (i >= 0) - { - if (plane->lights[i] == lighti) - { - Bmemmove(&plane->lights[i], &plane->lights[i+1], sizeof(int16_t) * (plane->lightcount - i)); - plane->lightcount--; - return; - } - i--; - } -} - -static int32_t polymer_planeinlight(_prplane* plane, _prlight* light) -{ - float lightpos[3]; - int32_t i, j, k, l; - - if (!plane->vertcount) - return 0; - - if (light->radius) - return polymer_planeinfrustum(plane, light->frustum); - - lightpos[0] = (float)light->y; - lightpos[1] = -(float)light->z / 16.0f; - lightpos[2] = -(float)light->x; - - i = 0; - - do - { - j = k = l = 0; - - do - { - if (plane->buffer[(j * 5) + i] > (lightpos[i] + light->range)) k++; - if (plane->buffer[(j * 5) + i] < (lightpos[i] - light->range)) l++; - } - while (++j < plane->vertcount); - - if ((k == plane->vertcount) || (l == plane->vertcount)) - return 0; - } - while (++i < 3); - - return 1; -} - -static void polymer_invalidateplanelights(_prplane* plane) -{ - int32_t i = plane->lightcount; - - while (i--) - { - if (plane && (plane->lights[i] != -1) && (prlights[plane->lights[i]].flags.active)) - prlights[plane->lights[i]].flags.invalidate = 1; - } -} - -static void polymer_invalidatesectorlights(int16_t sectnum) -{ - int32_t i; - _prsector *s = prsectors[sectnum]; - sectortype *sec = §or[sectnum]; - - if (!s) - return; - - polymer_invalidateplanelights(&s->floor); - polymer_invalidateplanelights(&s->ceil); - - i = sec->wallnum; - - while (i--) - { - _prwall *w; - if (!(w = prwalls[sec->wallptr + i])) continue; - - polymer_invalidateplanelights(&w->wall); - polymer_invalidateplanelights(&w->over); - polymer_invalidateplanelights(&w->mask); - } -} - -static void polymer_processspotlight(_prlight* light) -{ - float radius, ang, horizang, lightpos[3]; - pthtyp* pth; - - // hack to avoid lights beams perpendicular to walls - if ((light->horiz <= 100) && (light->horiz > 90)) - light->horiz = 90; - if ((light->horiz > 100) && (light->horiz < 110)) - light->horiz = 110; - - lightpos[0] = (float)light->y; - lightpos[1] = -(float)light->z / 16.0f; - lightpos[2] = -(float)light->x; - - // calculate the spot light transformations and matrices - radius = (float)(light->radius) / (2048.0f / 360.0f); - ang = (float)(light->angle) / (2048.0f / 360.0f); - horizang = (float)(-getangle(128, light->horiz-100)) / (2048.0f / 360.0f); - - bglMatrixMode(GL_PROJECTION); - bglPushMatrix(); - bglLoadIdentity(); - bgluPerspective(radius * 2, 1, 0.1f, light->range / 1000.0f); - bglGetFloatv(GL_PROJECTION_MATRIX, light->proj); - bglPopMatrix(); - - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - bglLoadIdentity(); - bglRotatef(horizang, 1.0f, 0.0f, 0.0f); - bglRotatef(ang, 0.0f, 1.0f, 0.0f); - bglScalef(1.0f / 1000.0f, 1.0f / 1000.0f, 1.0f / 1000.0f); - bglTranslatef(-lightpos[0], -lightpos[1], -lightpos[2]); - bglGetFloatv(GL_MODELVIEW_MATRIX, light->transform); - bglPopMatrix(); - - polymer_extractfrustum(light->transform, light->proj, light->frustum); - - light->rtindex = -1; - - // get the texture handle for the lightmap - light->lightmap = 0; - if (light->tilenum > 0) - { - if (!waloff[light->tilenum]) - loadtile(light->tilenum); - - pth = NULL; - pth = gltexcache(light->tilenum, 0, 0); - - if (pth) - light->lightmap = pth->glpic; - } -} - -static inline void polymer_culllight(int16_t lighti) -{ - _prlight* light = &prlights[lighti]; - int32_t front = 0; - int32_t back = 1; - int32_t i; - int32_t j; - int32_t zdiff; - _prsector *s; - _prwall *w; - sectortype *sec; - - Bmemset(drawingstate, 0, sizeof(int16_t) * numsectors); - drawingstate[light->sector] = 1; - - sectorqueue[0] = light->sector; - - do - { - s = prsectors[sectorqueue[front]]; - sec = §or[sectorqueue[front]]; - - polymer_pokesector(sectorqueue[front]); - - zdiff = light->z - s->floorz; - if (zdiff < 0) - zdiff = -zdiff; - zdiff >>= 4; - - if (!light->radius && !(sec->floorstat & 1)) { - if (zdiff < light->range) - polymer_addplanelight(&s->floor, lighti); - } else if (polymer_planeinlight(&s->floor, light)) - polymer_addplanelight(&s->floor, lighti); - - zdiff = light->z - s->ceilingz; - if (zdiff < 0) - zdiff = -zdiff; - zdiff >>= 4; - - if (!light->radius && !(sec->ceilingstat & 1)) { - if (zdiff < light->range) - polymer_addplanelight(&s->ceil, lighti); - } else if (polymer_planeinlight(&s->ceil, light)) - polymer_addplanelight(&s->ceil, lighti); - - i = 0; - while (i < sec->wallnum) - { - w = prwalls[sec->wallptr + i]; - - j = 0; - - if (polymer_planeinlight(&w->wall, light)) { - polymer_addplanelight(&w->wall, lighti); - j++; - } - - if (polymer_planeinlight(&w->over, light)) { - polymer_addplanelight(&w->over, lighti); - j++; - } - - // assume the light hits the middle section if it hits the top and bottom - if (wallvisible(light->x, light->y, sec->wallptr + i) && - (j == 2 || polymer_planeinlight(&w->mask, light))) { - if ((w->mask.vertcount == 4) && - (w->mask.buffer[(0 * 5) + 1] >= w->mask.buffer[(3 * 5) + 1]) && - (w->mask.buffer[(1 * 5) + 1] >= w->mask.buffer[(2 * 5) + 1])) - { - i++; - continue; - } - - polymer_addplanelight(&w->mask, lighti); - - if ((wall[sec->wallptr + i].nextsector >= 0) && - (!drawingstate[wall[sec->wallptr + i].nextsector])) { - drawingstate[wall[sec->wallptr + i].nextsector] = 1; - sectorqueue[back] = wall[sec->wallptr + i].nextsector; - back++; - } - } - - i++; - } - front++; - } - while (front != back); - - i = MAXSPRITES-1; - - do - { - _prsprite *s = prsprites[i]; - - if ((sprite[i].cstat & 48) == 0 || s == NULL || sprite[i].statnum == MAXSTATUS || sprite[i].sectnum == MAXSECTORS) - continue; - - if (polymer_planeinlight(&s->plane, light)) - polymer_addplanelight(&s->plane, lighti); - } - while (i--); -} - -static void polymer_prepareshadows(void) -{ - int16_t oviewangle, oglobalang; - int32_t ocosglobalang, osinglobalang; - int32_t ocosviewingrangeglobalang, osinviewingrangeglobalang; - int32_t i, j, k; - int32_t gx, gy, gz; - int32_t oldoverridematerial; - - // for wallvisible() - gx = globalposx; - gy = globalposy; - gz = globalposz; - // build globals used by drawmasks - oviewangle = viewangle; - oglobalang = globalang; - ocosglobalang = cosglobalang; - osinglobalang = singlobalang; - ocosviewingrangeglobalang = cosviewingrangeglobalang; - osinviewingrangeglobalang = sinviewingrangeglobalang; - - i = j = k = 0; - - while ((k < lightcount) && (j < pr_shadowcount)) - { - while (!prlights[i].flags.active) - i++; - - if (prlights[i].radius && prlights[i].flags.isinview) - { - prlights[i].flags.isinview = 0; - prlights[i].rtindex = j + 1; - if (pr_verbosity >= 3) OSD_Printf("PR : Drawing shadow %i...\n", i); - - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prrts[prlights[i].rtindex].fbo); - bglPushAttrib(GL_VIEWPORT_BIT); - bglViewport(0, 0, prrts[prlights[i].rtindex].xdim, prrts[prlights[i].rtindex].ydim); - - bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - bglMatrixMode(GL_PROJECTION); - bglPushMatrix(); - bglLoadMatrixf(prlights[i].proj); - bglMatrixMode(GL_MODELVIEW); - bglLoadMatrixf(prlights[i].transform); - - bglEnable(GL_POLYGON_OFFSET_FILL); - bglPolygonOffset(5, SHADOW_DEPTH_OFFSET); - - globalposx = prlights[i].x; - globalposy = prlights[i].y; - globalposz = prlights[i].z; - - // build globals used by rotatesprite - viewangle = prlights[i].angle; - globalang = (prlights[i].angle&2047); - cosglobalang = sintable[(globalang+512)&2047]; - singlobalang = sintable[globalang&2047]; - cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange); - sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange); - - oldoverridematerial = overridematerial; - // smooth model shadows - overridematerial = prprogrambits[PR_BIT_ANIM_INTERPOLATION].bit; - // used by alpha-testing for sprite silhouette - overridematerial |= prprogrambits[PR_BIT_DIFFUSE_MAP].bit; - overridematerial |= prprogrambits[PR_BIT_DIFFUSE_MAP2].bit; - - // to force sprite drawing - mirrors[depth++].plane = NULL; - polymer_displayrooms(prlights[i].sector); - depth--; - - overridematerial = oldoverridematerial; - - bglDisable(GL_POLYGON_OFFSET_FILL); - - bglMatrixMode(GL_PROJECTION); - bglPopMatrix(); - - bglPopAttrib(); - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - j++; - } - i++; - k++; - } - - globalposx = gx; - globalposy = gy; - globalposz = gz; - - viewangle = oviewangle; - globalang = oglobalang; - cosglobalang = ocosglobalang; - singlobalang = osinglobalang; - cosviewingrangeglobalang = ocosviewingrangeglobalang; - sinviewingrangeglobalang = osinviewingrangeglobalang; -} - -// RENDER TARGETS -static void polymer_initrendertargets(int32_t count) -{ - int32_t i; - - prrts = Bcalloc(count, sizeof(_prrt)); - - i = 0; - while (i < count) - { - if (!i) { - prrts[i].target = GL_TEXTURE_RECTANGLE; - prrts[i].xdim = xdim; - prrts[i].ydim = ydim; - - bglGenTextures(1, &prrts[i].color); - bglBindTexture(prrts[i].target, prrts[i].color); - - bglTexImage2D(prrts[i].target, 0, GL_RGB, prrts[i].xdim, prrts[i].ydim, 0, GL_RGB, GL_SHORT, NULL); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - } else { - prrts[i].target = GL_TEXTURE_2D; - prrts[i].xdim = 128 << pr_shadowdetail; - prrts[i].ydim = 128 << pr_shadowdetail; - prrts[i].color = 0; - - if (pr_ati_fboworkaround) { - bglGenTextures(1, &prrts[i].color); - bglBindTexture(prrts[i].target, prrts[i].color); - - bglTexImage2D(prrts[i].target, 0, GL_RGB, prrts[i].xdim, prrts[i].ydim, 0, GL_RGB, GL_SHORT, NULL); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - } - } - - bglGenTextures(1, &prrts[i].z); - bglBindTexture(prrts[i].target, prrts[i].z); - - bglTexImage2D(prrts[i].target, 0, GL_DEPTH_COMPONENT, prrts[i].xdim, prrts[i].ydim, 0, GL_DEPTH_COMPONENT, GL_SHORT, NULL); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MIN_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_MAG_FILTER, pr_shadowfiltering ? GL_LINEAR : GL_NEAREST); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(prrts[i].target, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(prrts[i].target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); - bglTexParameteri(prrts[i].target, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); - bglTexParameteri(prrts[i].target, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); - - bglGenFramebuffersEXT(1, &prrts[i].fbo); - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prrts[i].fbo); - - if (prrts[i].color) - bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - prrts[i].target, prrts[i].color, 0); - else { - bglDrawBuffer(GL_NONE); - bglReadBuffer(GL_NONE); - } - bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, prrts[i].target, prrts[i].z, 0); - - if (bglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) - { - OSD_Printf("PR : FBO #%d initialization failed.\n", i); - } - - bglBindTexture(prrts[i].target, 0); - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - i++; - } -} - -#endif diff --git a/polymer-perf/eduke32/build/src/polymost.c b/polymer-perf/eduke32/build/src/polymost.c deleted file mode 100644 index 5e455e7be..000000000 --- a/polymer-perf/eduke32/build/src/polymost.c +++ /dev/null @@ -1,6678 +0,0 @@ -/************************************************************************************************** -"POLYMOST" code written by Ken Silverman -Ken Silverman's official web site: http://www.advsys.net/ken - -Motivation: -When 3D Realms released the Duke Nukem 3D source code, I thought somebody would do a OpenGL or -Direct3D port. Well, after a few months passed, I saw no sign of somebody working on a true -hardware-accelerated port of Build, just people saying it wasn't possible. Eventually, I realized -the only way this was going to happen was for me to do it myself. First, I needed to port Build to -Windows. I could have done it myself, but instead I thought I'd ask my Australian buddy, Jonathon -Fowler, if he would upgrade his Windows port to my favorite compiler (MSVC) - which he did. Once -that was done, I was ready to start the "POLYMOST" project. - -About: -This source file is basically a complete rewrite of the entire rendering part of the Build engine. -There are small pieces in ENGINE.C to activate this code, and other minor hacks in other source -files, but most of it is in here. If you're looking for polymost-related code in the other source -files, you should find most of them by searching for either "polymost" or "rendmode". Speaking of -rendmode, there are now 4 rendering modes in Build: - - rendmode 0: The original code I wrote from 1993-1997 - rendmode 1: Solid-color rendering: my debug code before I did texture mapping - rendmode 2: Software rendering before I started the OpenGL code (Note: this is just a quick - hack to make testing easier - it's not optimized to my usual standards!) - rendmode 3: The OpenGL code - -The original Build engine did hidden surface removal by using a vertical span buffer on the tops -and bottoms of walls. This worked nice back in the day, but it it's not suitable for a polygon -engine. So I decided to write a brand new hidden surface removal algorithm - using the same idea -as the original Build - but one that worked with vectors instead of already rasterized data. - -Brief history: -06/20/2000: I release Build Source code -04/01/2003: 3D Realms releases Duke Nukem 3D source code -10/04/2003: Jonathon Fowler gets his Windows port working in Visual C -10/04/2003: I start writing POLYMOST.BAS, a new hidden surface removal algorithm for Build that - works on a polygon level instead of spans. -10/16/2003: Ported POLYMOST.BAS to C inside JonoF KenBuild's ENGINE.C; later this code was split - out of ENGINE.C and put in this file, POLYMOST.C. -12/10/2003: Started OpenGL code for POLYMOST (rendmode 3) -12/23/2003: 1st public release -01/01/2004: 2nd public release: fixed stray lines, status bar, mirrors, sky, and lots of other bugs. - ----------------------------------------------------------------------------------------------------- - -Todo list (in approximate chronological order): - -High priority: - * BOTH: Do accurate software sorting/chopping for sprites: drawing in wrong order is bad :/ - * BOTH: Fix hall of mirrors near "zenith". Call polymost_drawrooms twice? - * OPENGL: drawmapview() - -Low priority: - * SOFT6D: Do back-face culling of sprites during up/down/tilt transformation (top of drawpoly) - * SOFT6D: Fix depth shading: use saturation&LUT - * SOFT6D: Optimize using hyperbolic mapping (similar to KUBE algo) - * SOFT6D: Slab6-style voxel sprites. How to accelerate? :/ - * OPENGL: KENBUILD: Write flipping code for floor mirrors - * BOTH: KENBUILD: Parallaxing sky modes 1&2 - * BOTH: Masked/1-way walls don't clip correctly to sectors of intersecting ceiling/floor slopes - * BOTH: Editart x-center is not working correctly with Duke's camera/turret sprites - * BOTH: Get rid of horizontal line above Duke full-screen status bar - * BOTH: Combine ceilings/floors into a single triangle strip (should lower poly count by 2x) - * BOTH: Optimize/clean up texture-map setup equations - -**************************************************************************************************/ - - -#ifdef USE_OPENGL - -#include "compat.h" -#include "build.h" - -#ifdef USE_OPENGL -# include "glbuild.h" -# include "mdsprite.h" -#endif - -#include "pragmas.h" -#include "baselayer.h" -#include "osd.h" -#include "engine_priv.h" -#include "hightile.h" -#include "polymost.h" -#include "polymer.h" -#include "scriptfile.h" -#include "cache1d.h" -#include "kplib.h" - -#ifndef _WIN32 -extern int32_t filelength(int h); // kplib.c -#endif - -extern char textfont[2048], smalltextfont[2048]; - -int32_t rendmode=0; -int32_t usemodels=1, usehightile=1; - -#include //<-important! -typedef struct { float x, cy[2], fy[2]; int32_t n, p, tag, ctag, ftag; } vsptyp; -#define VSPMAX 4096 //<- careful! -static vsptyp vsp[VSPMAX]; -static int32_t vcnt, gtag; - -static double dxb1[MAXWALLSB], dxb2[MAXWALLSB]; - -#define SCISDIST 1.0 //1.0: Close plane clipping distance -#define USEZBUFFER 1 //1:use zbuffer (slow, nice sprite rendering), 0:no zbuffer (fast, bad sprite rendering) -#define LINTERPSIZ 4 //log2 of interpolation size. 4:pretty fast&acceptable quality, 0:best quality/slow! -#define DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default - -float shadescale = 1.3f; - -double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz; -double gcosang, gsinang, gcosang2, gsinang2; -double gchang, gshang, gctang, gstang, gvisibility; -float gtang = 0.0; -double guo, gux, guy; //Screen-based texture mapping parameters -double gvo, gvx, gvy; -double gdo, gdx, gdy; - -static int32_t preview_mouseaim=0; // when 1, displays a CROSSHAIR tsprite at the _real_ aimed position - -#if (USEZBUFFER != 0) -int32_t zbufysiz = 0, zbufbpl = 0, *zbufoff = 0; -intptr_t zbufmem = 0; -#endif - -#ifdef USE_OPENGL -static int32_t srepeat = 0, trepeat = 0; - -int32_t glredbluemode = 0; -static int32_t lastglredbluemode = 0, redblueclearcnt = 0; - -struct glfiltermodes glfiltermodes[numglfiltermodes] = -{ - {"GL_NEAREST",GL_NEAREST,GL_NEAREST}, - {"GL_LINEAR",GL_LINEAR,GL_LINEAR}, - {"GL_NEAREST_MIPMAP_NEAREST",GL_NEAREST_MIPMAP_NEAREST,GL_NEAREST}, - {"GL_LINEAR_MIPMAP_NEAREST",GL_LINEAR_MIPMAP_NEAREST,GL_LINEAR}, - {"GL_NEAREST_MIPMAP_LINEAR",GL_NEAREST_MIPMAP_LINEAR,GL_NEAREST}, - {"GL_LINEAR_MIPMAP_LINEAR",GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR} -}; - -int32_t glanisotropy = 1; // 0 = maximum supported by card -int32_t glusetexcompr = 1; -int32_t gltexfiltermode = 2; // GL_NEAREST_MIPMAP_NEAREST -int32_t glusetexcache = 2; -int32_t glmultisample = 0, glnvmultisamplehint = 0; -int32_t gltexmaxsize = 0; // 0 means autodetection on first run -int32_t gltexmiplevel = 0; // discards this many mipmap levels -static int32_t lastglpolygonmode = 0; //FUK -int32_t glpolygonmode = 0; // 0:GL_FILL,1:GL_LINE,2:GL_POINT //FUK -int32_t glwidescreen = 0; -int32_t glprojectionhacks = 1; -static GLuint polymosttext = 0; -extern char nofog; -int32_t glrendmode = 3; - -// Those THREE globals control the drawing of fullbright tiles -static int32_t fullbrightloadingpass = 0; -static int32_t fullbrightdrawingpass = 0; -static int32_t shadeforfullbrightpass; - -float curpolygonoffset; // internal polygon offset stack for drawing flat sprites to avoid depth fighting - -// Detail mapping cvar -int32_t r_detailmapping = 1; - -// Glow mapping cvar -int32_t r_glowmapping = 1; - -// Vertex Array model drawing cvar -int32_t r_vertexarrays = 1; - -// Vertex Buffer Objects model drawing cvars -int32_t r_vbos = 1; -int32_t r_vbocount = 64; - -// model animation smoothing cvar -int32_t r_animsmoothing = 1; - -// line of sight checks before mddraw() -int32_t r_modelocclusionchecking = 0; - -// fullbright cvar -int32_t r_fullbrights = 1; - -// texture downsizing -// is medium quality a good default? -int32_t r_downsize = 1; -int32_t r_downsizevar = -1; - -// used for fogcalc -float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS]; -#endif - -static char ptempbuf[MAXWALLSB<<1]; - -// polymost ART sky control -int32_t r_parallaxskyclamping = 1; -int32_t r_parallaxskypanning = 0; - -extern int16_t editstatus; - -#define MIN_CACHETIME_PRINT 5 - - -static inline int32_t imod(int32_t a, int32_t b) -{ - if (a >= 0) return(a%b); - return(((a+1)%b)+b-1); -} - -void drawline2d(float x0, float y0, float x1, float y1, char col) -{ - float f, dx, dy, fxres, fyres; - int32_t e, inc, x, y; - uint32_t up16; - - dx = x1-x0; dy = y1-y0; if ((dx == 0) && (dy == 0)) return; - fxres = (float)xdimen; fyres = (float)ydimen; - if (x0 >= fxres) { if (x1 >= fxres) return; y0 += (fxres-x0)*dy/dx; x0 = fxres; } - else if (x0 < 0) { if (x1 < 0) return; y0 += (0-x0)*dy/dx; x0 = 0; } - if (x1 >= fxres) { y1 += (fxres-x1)*dy/dx; x1 = fxres; } - else if (x1 < 0) { y1 += (0-x1)*dy/dx; x1 = 0; } - if (y0 >= fyres) { if (y1 >= fyres) return; x0 += (fyres-y0)*dx/dy; y0 = fyres; } - else if (y0 < 0) { if (y1 < 0) return; x0 += (0-y0)*dx/dy; y0 = 0; } - if (y1 >= fyres) { x1 += (fyres-y1)*dx/dy; y1 = fyres; } - else if (y1 < 0) { x1 += (0-y1)*dx/dy; y1 = 0; } - - if (fabs(dx) > fabs(dy)) - { - if (x0 > x1) { f = x0; x0 = x1; x1 = f; f = y0; y0 = y1; y1 = f; } - y = (int32_t)(y0*65536.f)+32768; - inc = (int32_t)(dy/dx*65536.f+.5f); - x = (int32_t)(x0+.5); if (x < 0) { y -= inc*x; x = 0; } //if for safety - e = (int32_t)(x1+.5); if (e > xdimen) e = xdimen; //if for safety - up16 = (ydimen<<16); - for (; x>16]+x+frameoffset) = col; - } - else - { - if (y0 > y1) { f = x0; x0 = x1; x1 = f; f = y0; y0 = y1; y1 = f; } - x = (int32_t)(x0*65536.f)+32768; - inc = (int32_t)(dx/dy*65536.f+.5f); - y = (int32_t)(y0+.5); if (y < 0) { x -= inc*y; y = 0; } //if for safety - e = (int32_t)(y1+.5); if (e > ydimen) e = ydimen; //if for safety - up16 = (xdimen<<16); - for (; y>16)+frameoffset) = col; - } -} - -#ifdef USE_OPENGL -#include "md4.h" -#include "quicklz.h" - -//-------------------------------------------------------------------------------------------------- -//TEXTURE MANAGEMENT: treats same texture with different .PAL as a separate texture. This makes the -// max number of virtual textures very large (MAXTILES*256). Instead of allocating a handle for -// every virtual texture, I use a cache where indexing is managed through a hash table. -// - -// moved into polymost.h -/*typedef struct pthtyp_t -{ - struct pthtyp_t *next; - GLuint glpic; - short picnum; - char palnum; - char effects; - char flags; // 1 = clamped (dameth&4), 2 = hightile, 4 = skybox face, 8 = hasalpha, 16 = hasfullbright, 128 = invalidated - char skyface; - hicreplctyp *hicr; - - unsigned short sizx, sizy; - float scalex, scaley; - struct pthtyp_t *wofb; // without fullbright - struct pthtyp_t *ofb; // only fullbright -} pthtyp;*/ - -int32_t cachefilehandle = -1; // texture cache file handle -FILE *cacheindexptr = NULL; -uint8_t *memcachedata = NULL; -int32_t memcachesize = -1; -int32_t cachepos = 0; - -hashtable_t h_texcache = { 1024, NULL }; - -char TEXCACHEFILE[BMAX_PATH] = "textures"; - -int32_t mdtims, omdtims; -float alphahackarray[MAXTILES]; - -texcacheindex *firstcacheindex = NULL; -texcacheindex *curcacheindex = NULL; -texcacheindex *cacheptrs[MAXTILES<<1]; -int32_t numcacheentries = 0; - - -#define GLTEXCACHEADSIZ 8192 -pthtyp *gltexcachead[GLTEXCACHEADSIZ]; - -int32_t drawingskybox = 0; - -int32_t gloadtile_art(int32_t,int32_t,int32_t,pthtyp *,int32_t); -int32_t gloadtile_hi(int32_t,int32_t,int32_t,hicreplctyp *,int32_t,pthtyp *,int32_t,char); -static int32_t hicprecaching = 0; -pthtyp *gltexcache(int32_t dapicnum, int32_t dapalnum, int32_t dameth) -{ - int32_t i, j; - hicreplctyp *si; - pthtyp *pth, *pth2; - - j = (dapicnum&(GLTEXCACHEADSIZ-1)); - - si = usehightile ? hicfindsubst(dapicnum,dapalnum,drawingskybox) : NULL; - - if (!si) - { - if (drawingskybox || dapalnum >= (MAXPALOOKUPS - RESERVEDPALS)) return NULL; - goto tryart; - } - - /* if palette > 0 && replacement found - * no effects are applied to the texture - * else if palette > 0 && no replacement found - * effects are applied to the palette 0 texture if it exists - */ - - // load a replacement - for (pth=gltexcachead[j]; pth; pth=pth->next) - { - if (pth->picnum == dapicnum && - pth->palnum == si->palnum && - (si->palnum>0 ? 1 : (pth->effects == hictinting[dapalnum].f)) && - (pth->flags & (1+2+4)) == (((dameth&4)>>2)+2+((drawingskybox>0)<<2)) && - (drawingskybox>0 ? (pth->skyface == drawingskybox) : 1) - ) - { - if (pth->flags & 128) - { - pth->flags &= ~128; - if (gloadtile_hi(dapicnum,dapalnum,drawingskybox,si,dameth,pth,0, - (si->palnum>0) ? 0 : hictinting[dapalnum].f)) // reload tile - { - if (drawingskybox) return NULL; - goto tryart; // failed, so try for ART - } - } - return(pth); - } - } - - - pth = (pthtyp *)Bcalloc(1,sizeof(pthtyp)); - if (!pth) return NULL; - - // possibly fetch an already loaded multitexture :_) - if (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS)) - for (i = (GLTEXCACHEADSIZ - 1); i >= 0; i--) - for (pth2=gltexcachead[i]; pth2; pth2=pth2->next) - { - if ((pth2->hicr) && (pth2->hicr->filename) && (Bstrcasecmp(pth2->hicr->filename, si->filename) == 0)) - { - Bmemcpy(pth, pth2, sizeof(pthtyp)); - pth->picnum = dapicnum; - pth->flags = ((dameth&4)>>2) + 2 + ((drawingskybox>0)<<2); - if (pth2->flags & 8) pth->flags |= 8; //hasalpha - pth->hicr = si; - pth->next = gltexcachead[j]; - - gltexcachead[j] = pth; - return(pth); - } - } - - if (gloadtile_hi(dapicnum,dapalnum,drawingskybox,si,dameth,pth,1, (si->palnum>0) ? 0 : hictinting[dapalnum].f)) - { - Bfree(pth); - if (drawingskybox) return NULL; - goto tryart; // failed, so try for ART - } - pth->palnum = si->palnum; - pth->next = gltexcachead[j]; - gltexcachead[j] = pth; - return(pth); - -tryart: - if (hicprecaching) return NULL; - - // load from art - for (pth=gltexcachead[j]; pth; pth=pth->next) - if (pth->picnum == dapicnum && - pth->palnum == dapalnum && - (pth->flags & (1+2)) == ((dameth&4)>>2) - ) - { - if (pth->flags & 128) - { - pth->flags &= ~128; - if (gloadtile_art(dapicnum,dapalnum,dameth,pth,0)) return NULL; //reload tile (for animations) - } - return(pth); - } - - pth = (pthtyp *)Bcalloc(1,sizeof(pthtyp)); - if (!pth) return NULL; - - if (gloadtile_art(dapicnum,dapalnum,dameth,pth,1)) - { - Bfree(pth); - return NULL; - } - pth->next = gltexcachead[j]; - gltexcachead[j] = pth; - - return(pth); -} - -static inline int32_t gltexmayhavealpha(int32_t dapicnum, int32_t dapalnum) -{ - int32_t j = (dapicnum&(GLTEXCACHEADSIZ-1)); - pthtyp *pth; - - for (pth=gltexcachead[j]; pth; pth=pth->next) - if ((pth->picnum == dapicnum) && (pth->palnum == dapalnum)) - return((pth->flags&8) != 0); - return(1); -} - -void gltexinvalidate(int32_t dapicnum, int32_t dapalnum, int32_t dameth) -{ - int32_t j; - pthtyp *pth; - - j = (dapicnum&(GLTEXCACHEADSIZ-1)); - for (pth=gltexcachead[j]; pth; pth=pth->next) - if (pth->picnum == dapicnum && pth->palnum == dapalnum && (pth->flags & 1) == ((dameth&4)>>2)) - { - pth->flags |= 128; - if (pth->flags & 16) - pth->ofb->flags |= 128; - } -} - -//Make all textures "dirty" so they reload, but not re-allocate -//This should be much faster than polymost_glreset() -//Use this for palette effects ... but not ones that change every frame! -void gltexinvalidateall() -{ - int32_t j; - pthtyp *pth; - - for (j=GLTEXCACHEADSIZ-1; j>=0; j--) - for (pth=gltexcachead[j]; pth; pth=pth->next) - { - pth->flags |= 128; - if (pth->flags & 16) - pth->ofb->flags |= 128; - } - clearskins(); -#ifdef DEBUGGINGAIDS - OSD_Printf("gltexinvalidateall()\n"); -#endif -} - -void gltexinvalidate8() -{ - int32_t j; - pthtyp *pth; - - for (j=GLTEXCACHEADSIZ-1; j>=0; j--) - for (pth=gltexcachead[j]; pth; pth=pth->next) - { - if (pth->hicr == NULL) - { - pth->flags |= 128; - if (pth->flags & 16) - pth->ofb->flags |= 128; - } - } -#ifdef DEBUGGINGAIDS - OSD_Printf("gltexinvalidate8()\n"); -#endif -} - -void gltexapplyprops(void) -{ - int32_t i; - pthtyp *pth; - - if (glinfo.maxanisotropy > 1.0) - { - if (glanisotropy <= 0 || glanisotropy > glinfo.maxanisotropy) glanisotropy = (int32_t)glinfo.maxanisotropy; - } - - if (gltexfiltermode < 0) gltexfiltermode = 0; - else if (gltexfiltermode >= (int32_t)numglfiltermodes) gltexfiltermode = numglfiltermodes-1; - for (i=GLTEXCACHEADSIZ-1; i>=0; i--) - { - for (pth=gltexcachead[i]; pth; pth=pth->next) - { - bglBindTexture(GL_TEXTURE_2D,pth->glpic); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - if (glinfo.maxanisotropy > 1.0) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - if (r_fullbrights && pth->flags & 16) - { - bglBindTexture(GL_TEXTURE_2D,pth->ofb->glpic); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - if (glinfo.maxanisotropy > 1.0) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - } - } - } - - { - int32_t j; - mdskinmap_t *sk; - md2model_t *m; - - for (i=0; imdnum < 2) continue; - for (j=0; jnumskins*(HICEFFECTMASK+1); j++) - { - if (!m->texid[j]) continue; - bglBindTexture(GL_TEXTURE_2D,m->texid[j]); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - if (glinfo.maxanisotropy > 1.0) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - } - - for (sk=m->skinmap; sk; sk=sk->next) - for (j=0; j<(HICEFFECTMASK+1); j++) - { - if (!sk->texid[j]) continue; - bglBindTexture(GL_TEXTURE_2D,sk->texid[j]); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - if (glinfo.maxanisotropy > 1.0) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - } - } - } -} - -//-------------------------------------------------------------------------------------------------- -static int32_t LoadCacheOffsets(void); -float glox1, gloy1, glox2, gloy2; - -//Use this for both initialization and uninitialization of OpenGL. -static int32_t gltexcacnum = -1; -extern void freevbos(void); - -void polymost_cachesync(void) -{ - if (memcachedata && cachefilehandle != -1 && filelength(cachefilehandle) > memcachesize) - { - size_t len = filelength(cachefilehandle); - initprintf("Syncing memcache to texcache\n"); - memcachedata = (uint8_t *)Brealloc(memcachedata, len); - Blseek(cachefilehandle, memcachesize, BSEEK_SET); - Bread(cachefilehandle, memcachedata + memcachesize, len - memcachesize); - memcachesize = len; - } -} - - -void polymost_glreset() -{ - int32_t i; - pthtyp *pth, *next; - - for (i=MAXPALOOKUPS-1; i>=0; i--) - { - fogtable[i<<2] = palookupfog[i].r / 63.f; - fogtable[(i<<2)+1] = palookupfog[i].g / 63.f; - fogtable[(i<<2)+2] = palookupfog[i].b / 63.f; - fogtable[(i<<2)+3] = 0; - } - - //Reset if this is -1 (meaning 1st texture call ever), or > 0 (textures in memory) - if (gltexcacnum < 0) - { - gltexcacnum = 0; - - //Hack for polymost_dorotatesprite calls before 1st polymost_drawrooms() - gcosang = gcosang2 = ((double)16384)/262144.0; - gsinang = gsinang2 = ((double) 0)/262144.0; - } - else - { - for (i=GLTEXCACHEADSIZ-1; i>=0; i--) - { - for (pth=gltexcachead[i]; pth;) - { - next = pth->next; - if (pth->flags & 16) // fullbright textures - { - bglDeleteTextures(1,&pth->ofb->glpic); - Bfree(pth->ofb); - } - bglDeleteTextures(1,&pth->glpic); - Bfree(pth); - pth = next; - } - gltexcachead[i] = NULL; - } - clearskins(); - } - - if (polymosttext) bglDeleteTextures(1,&polymosttext); - polymosttext=0; - - freevbos(); - - memset(gltexcachead,0,sizeof(gltexcachead)); - glox1 = -1; - - /* - if (cachefilehandle != -1) - { - Bclose(cachefilehandle); - cachefilehandle = -1; - } - - if (cacheindexptr) - { - Bfclose(cacheindexptr); - cacheindexptr = NULL; - } - */ - - for (i = numcacheentries-1; i >= 0; i--) - if (cacheptrs[i]) - { - int32_t ii; - for (ii = numcacheentries-1; ii >= 0; ii--) - if (i != ii && cacheptrs[ii] == cacheptrs[i]) - { - /*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/ - cacheptrs[ii] = NULL; - } - - Bfree(cacheptrs[i]); - cacheptrs[i] = NULL; - } - - polymost_cachesync(); -} - -// one-time initialization of OpenGL for polymost -void polymost_glinit() -{ - GLfloat col[4]; - int32_t i; - - if (!Bstrcmp(glinfo.vendor, "NVIDIA Corporation")) - { - bglHint(GL_FOG_HINT,GL_NICEST); - } - else - { - bglHint(GL_FOG_HINT,GL_DONT_CARE); - } - - bglFogi(GL_FOG_MODE, GL_EXP2); - bglFogf(GL_FOG_DENSITY,1.0); //must be > 0, default is 1 - /* bglFogf(GL_FOG_START,0.0); //default is 0 - bglFogf(GL_FOG_END,1.0); //default is 1 */ - col[0] = 0; col[1] = 0; col[2] = 0; col[3] = 0; //range:0 to 1 - bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0 - - bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - - //bglHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - //bglEnable(GL_LINE_SMOOTH); - - if (glmultisample > 0 && glinfo.multisample) - { - if (glinfo.nvmultisamplehint) - bglHint(GL_MULTISAMPLE_FILTER_HINT_NV, glnvmultisamplehint ? GL_NICEST:GL_FASTEST); - bglEnable(GL_MULTISAMPLE_ARB); - } - - if (r_detailmapping && (!glinfo.multitex || !glinfo.envcombine)) - { - OSD_Printf("Your OpenGL implementation doesn't support detail mapping. Disabling...\n"); - r_detailmapping = 0; - } - - if (r_glowmapping && (!glinfo.multitex || !glinfo.envcombine)) - { - OSD_Printf("Your OpenGL implementation doesn't support glow mapping. Disabling...\n"); - r_glowmapping = 0; - } - - if (r_vbos && (!glinfo.vbos)) - { - OSD_Printf("Your OpenGL implementation doesn't support Vertex Buffer Objects. Disabling...\n"); - r_vbos = 0; - } - - bglEnableClientState(GL_VERTEX_ARRAY); - bglEnableClientState(GL_TEXTURE_COORD_ARRAY); - - if (cachefilehandle != -1) - { - Bclose(cachefilehandle); - cachefilehandle = -1; - } - - if (cacheindexptr) - { - Bfclose(cacheindexptr); - cacheindexptr = NULL; - } - - if (memcachedata) - { - Bfree(memcachedata); - memcachedata = NULL; - memcachesize = -1; - } - - for (i = numcacheentries-1; i >= 0; i--) - if (cacheptrs[i]) - { - int32_t ii; - for (ii = numcacheentries-1; ii >= 0; ii--) - if (i != ii && cacheptrs[ii] == cacheptrs[i]) - { - /*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/ - cacheptrs[ii] = NULL; - } - - Bfree(cacheptrs[i]); - cacheptrs[i] = NULL; - } - - curcacheindex = firstcacheindex = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex)); - numcacheentries = 0; - -// Bmemset(&firstcacheindex, 0, sizeof(texcacheindex)); -// Bmemset(&cacheptrs[0], 0, sizeof(cacheptrs)); - - hash_init(&h_texcache); - LoadCacheOffsets(); - - Bstrcpy(ptempbuf,TEXCACHEFILE); - Bstrcat(ptempbuf,".cache"); - cacheindexptr = Bfopen(ptempbuf, "at+"); - if (!cacheindexptr) - { - glusetexcache = 0; - initprintf("Unable to open cache index: %s\n",strerror(errno)); - return; - } - - fseek(cacheindexptr, 0, BSEEK_END); - if (!ftell(cacheindexptr)) - { - rewind(cacheindexptr); - Bfprintf(cacheindexptr,"// automatically generated by EDuke32, DO NOT MODIFY!\n"); - } - else rewind(cacheindexptr); - - cachefilehandle = Bopen(TEXCACHEFILE, BO_BINARY|BO_CREAT|BO_APPEND|BO_RDWR, BS_IREAD|BS_IWRITE); - - if (cachefilehandle < 0) - { - initprintf("Unable to open cache file: %s\n",strerror(errno)); - glusetexcache = 0; - return; - } - - memcachesize = filelength(cachefilehandle); - - if (memcachesize > 0) - { - memcachedata = (uint8_t *)Brealloc(memcachedata, memcachesize); - - if (!memcachedata) - { - initprintf("Failed allocating %d bytes for memcache\n", memcachesize); - memcachesize = -1; - } - - if (Bread(cachefilehandle, memcachedata, memcachesize) != memcachesize) - { - initprintf("Failed reading texcache into memcache!\n"); - Bfree(memcachedata); - memcachesize = -1; - } - } - - i = 0; - - curcacheindex = firstcacheindex; - while (curcacheindex->next) - { - i += curcacheindex->len; - curcacheindex = curcacheindex->next; - } - - i = Blseek(cachefilehandle, 0, BSEEK_END)-i; - if (i) - initprintf("Cache contains %d bytes of garbage data\n",i); -// Blseek(cachefilehandle, 0, BSEEK_SET); -} - -void invalidatecache(void) -{ - int32_t i; - - r_downsizevar = r_downsize; // update the cvar representation when the menu changes r_downsize - - polymost_glreset(); - - if (cachefilehandle != -1) - { - Bclose(cachefilehandle); - cachefilehandle = -1; - } - - if (cacheindexptr) - { - Bfclose(cacheindexptr); - cacheindexptr = NULL; - } - - if (memcachedata) - { - Bfree(memcachedata); - memcachedata = NULL; - memcachesize = -1; - } - - for (i = numcacheentries-1; i >= 0; i--) - if (cacheptrs[i]) - { - int32_t ii; - for (ii = numcacheentries-1; ii >= 0; ii--) - if (i != ii && cacheptrs[ii] == cacheptrs[i]) - { - /*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/ - cacheptrs[ii] = NULL; - } - - Bfree(cacheptrs[i]); - cacheptrs[i] = NULL; - } - - curcacheindex = firstcacheindex = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex)); - numcacheentries = 0; - -// Bmemset(&firstcacheindex, 0, sizeof(texcacheindex)); -// Bmemset(&cacheptrs[0], 0, sizeof(cacheptrs)); - - hash_init(&h_texcache); -// LoadCacheOffsets(); - - Bstrcpy(ptempbuf,TEXCACHEFILE); - unlink(ptempbuf); - Bstrcat(ptempbuf,".cache"); - unlink(ptempbuf); - cacheindexptr = Bfopen(ptempbuf, "at+"); - if (!cacheindexptr) - { - glusetexcache = 0; - initprintf("Unable to open cache index: %s\n",strerror(errno)); - return; - } - - Bfprintf(cacheindexptr,"// automatically generated by EDuke32, DO NOT MODIFY!\n"); - - cachefilehandle = Bopen(TEXCACHEFILE,BO_BINARY|BO_CREAT|BO_TRUNC|BO_APPEND|BO_RDWR,BS_IREAD|BS_IWRITE); - - if (cachefilehandle < 0) - { - initprintf("Unable to open cache file: %s\n",strerror(errno)); - glusetexcache = 0; - return; - } -} - -void resizeglcheck() -{ - float m[4][4]; - int32_t fovcorrect; - - if (glredbluemode < lastglredbluemode) - { - glox1 = -1; - bglColorMask(1,1,1,1); - } - else if (glredbluemode != lastglredbluemode) - { - redblueclearcnt = 0; - } - lastglredbluemode = glredbluemode; - - //FUK - if (lastglpolygonmode != glpolygonmode) - { - lastglpolygonmode = glpolygonmode; - switch (glpolygonmode) - { - default: - case 0: - bglPolygonMode(GL_FRONT_AND_BACK,GL_FILL); break; - case 1: - bglPolygonMode(GL_FRONT_AND_BACK,GL_LINE); break; - case 2: - bglPolygonMode(GL_FRONT_AND_BACK,GL_POINT); break; - } - } - if (glpolygonmode) //FUK - { - bglClearColor(1.0,1.0,1.0,0.0); - bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - bglDisable(GL_TEXTURE_2D); - } - - if ((glox1 != windowx1) || (gloy1 != windowy1) || (glox2 != windowx2) || (gloy2 != windowy2)) - { - double ratio = 1.05; - - if (glwidescreen == 1) - ratio = 1.2f; - else if (glprojectionhacks == 1) - { - double mul = (gshang*gshang); - ratio += mul*mul*mul*mul; - } - else if (glprojectionhacks == 2) - { - if (gshang > 0.7f) - ratio += 4.f*(gshang-0.7f); - if (gshang < -0.7f) - ratio += 4.f*(-gshang-0.7f); - } - - glox1 = (float)windowx1; gloy1 = (float)windowy1; - glox2 = (float)windowx2; gloy2 = (float)windowy2; - - fovcorrect = (int32_t)(glprojectionhacks?(glwidescreen?0:(((windowx2-windowx1+1) * ratio) - (windowx2-windowx1+1))):0); - - bglViewport(windowx1 - (fovcorrect / 2), yres-(windowy2+1),windowx2-windowx1+1 + fovcorrect, windowy2-windowy1+1); - - bglMatrixMode(GL_PROJECTION); - memset(m,0,sizeof(m)); - m[0][0] = (float)ydimen / (glprojectionhacks?ratio:1.f); m[0][2] = 1.0; - m[1][1] = (float)xdimen; m[1][2] = 1.0; - m[2][2] = 1.0; m[2][3] = (float)ydimen / (glprojectionhacks?ratio:1.f); - m[3][2] =-1.0; - bglLoadMatrixf(&m[0][0]); - //bglLoadIdentity(); - - bglMatrixMode(GL_MODELVIEW); - bglLoadIdentity(); - -#ifdef USE_OPENGL - if (!nofog) bglEnable(GL_FOG); -#endif - - //bglEnable(GL_TEXTURE_2D); - } -} - -void fixtransparency(coltype *dapic, int32_t daxsiz, int32_t daysiz, int32_t daxsiz2, int32_t daysiz2, int32_t dameth) -{ - coltype *wpptr; - int32_t j, x, y, r, g, b, dox, doy, naxsiz2; - - dox = daxsiz2-1; doy = daysiz2-1; - if (dameth&4) { dox = min(dox,daxsiz); doy = min(doy,daysiz); } - else { daxsiz = daxsiz2; daysiz = daysiz2; } //Make repeating textures duplicate top/left parts - - daxsiz--; daysiz--; naxsiz2 = -daxsiz2; //Hacks for optimization inside loop - - //Set transparent pixels to average color of neighboring opaque pixels - //Doing this makes bilinear filtering look much better for masked textures (I.E. sprites) - for (y=doy; y>=0; y--) - { - wpptr = &dapic[y*daxsiz2+dox]; - for (x=dox; x>=0; x--,wpptr--) - { - if (wpptr->a) continue; - r = g = b = j = 0; - if ((x> 0) && (wpptr[ -1].a)) { r += (int32_t)wpptr[ -1].r; g += (int32_t)wpptr[ -1].g; b += (int32_t)wpptr[ -1].b; j++; } - if ((x 0) && (wpptr[naxsiz2].a)) { r += (int32_t)wpptr[naxsiz2].r; g += (int32_t)wpptr[naxsiz2].g; b += (int32_t)wpptr[naxsiz2].b; j++; } - if ((yr = r ; wpptr->g = g ; wpptr->b = b ; break; - case 2: - wpptr->r = ((r + 1)>>1); wpptr->g = ((g + 1)>>1); wpptr->b = ((b + 1)>>1); break; - case 3: - wpptr->r = ((r*85+128)>>8); wpptr->g = ((g*85+128)>>8); wpptr->b = ((b*85+128)>>8); break; - case 4: - wpptr->r = ((r + 2)>>2); wpptr->g = ((g + 2)>>2); wpptr->b = ((b + 2)>>2); break; - default: - break; - } - } - } -} - -void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt, int32_t texfmt, coltype *pic, int32_t tsizx, int32_t tsizy, int32_t dameth) -{ - coltype *wpptr, *rpptr; - int32_t x2, y2, j, js=0, x3, y3, y, x, r, g, b, a, k; - int32_t hi = (dameth&8192)?1:0; - int32_t nocompress = (dameth&4096)?1:0; - - dameth &= ~(8192|4096); - - if (gltexmaxsize <= 0) - { - GLint i = 0; - bglGetIntegerv(GL_MAX_TEXTURE_SIZE, &i); - if (!i) gltexmaxsize = 6; // 2^6 = 64 == default GL max texture size - else - { - gltexmaxsize = 0; - for (; i>1; i>>=1) gltexmaxsize++; - } - } - - js = max(0,min(gltexmaxsize-1,gltexmiplevel)); - gltexmiplevel = js; - while ((xsiz>>js) > (1<>js) > (1< 1) || (y2 > 1); j++) - { - //x3 = ((x2+1)>>1); y3 = ((y2+1)>>1); - x3 = max(1, x2 >> 1); y3 = max(1, y2 >> 1); // this came from the GL_ARB_texture_non_power_of_two spec - for (y=0; yr = r; wpptr->g = g; wpptr->b = b; wpptr->a = a; break; - case 2: - wpptr->r = ((r+1)>>1); wpptr->g = ((g+1)>>1); wpptr->b = ((b+1)>>1); wpptr->a = ((a+1)>>1); break; - case 3: - wpptr->r = ((r*85+128)>>8); wpptr->g = ((g*85+128)>>8); wpptr->b = ((b*85+128)>>8); wpptr->a = ((a*85+128)>>8); break; - case 4: - wpptr->r = ((r+2)>>2); wpptr->g = ((g+2)>>2); wpptr->b = ((b+2)>>2); wpptr->a = ((a+2)>>2); break; - default: - break; - } - //if (wpptr->a) wpptr->a = 255; - } - } - if (tsizx >= 0) fixtransparency(pic,(tsizx+(1<>j,(tsizy+(1<>j,x3,y3,dameth); - if (j >= js) - { - if (doalloc&1) - bglTexImage2D(GL_TEXTURE_2D,j-js,intexfmt,x3,y3,0,texfmt,GL_UNSIGNED_BYTE,pic); //loading 1st time - else - bglTexSubImage2D(GL_TEXTURE_2D,j-js,0,0,x3,y3,texfmt,GL_UNSIGNED_BYTE,pic); //overwrite old texture - } - x2 = x3; y2 = y3; - } -#endif -} - -int32_t gloadtile_art(int32_t dapic, int32_t dapal, int32_t dameth, pthtyp *pth, int32_t doalloc) -{ - coltype *pic, *wpptr; - int32_t x, y, x2, y2, xsiz, ysiz, dacol, tsizx, tsizy; - char hasalpha = 0, hasfullbright = 0; - - tsizx = tilesizx[dapic]; - tsizy = tilesizy[dapic]; - if (!glinfo.texnpot) - { - for (xsiz=1; xsiz= tsizx) || (y >= tsizy))) //Clamp texture - { wpptr->r = wpptr->g = wpptr->b = wpptr->a = 0; continue; } - if (x < tsizx) x2 = x; else x2 = x-tsizx; - dacol = (int32_t)(*(char *)(waloff[dapic]+x2*tsizy+y2)); - if (!fullbrightloadingpass) - { - // regular texture - if ((dacol > 239) && (dacol != 255)) - hasfullbright = 1; - wpptr->a = 255; - } - else if (fullbrightloadingpass == 1) - { - // texture with only fullbright areas - if (dacol < 240) // regular colors - { - wpptr->a = 0; hasalpha = 1; - } - else // fullbright - { - wpptr->a = 255; - } - } - if (dacol != 255) - dacol = (int32_t)((uint8_t)palookup[dapal][dacol]); - else - { - wpptr->a = 0; hasalpha = 1; - } - if (gammabrightness) - { - wpptr->r = curpalette[dacol].r; - wpptr->g = curpalette[dacol].g; - wpptr->b = curpalette[dacol].b; - } - else - { - wpptr->r = britable[curbrightness][ curpalette[dacol].r ]; - wpptr->g = britable[curbrightness][ curpalette[dacol].g ]; - wpptr->b = britable[curbrightness][ curpalette[dacol].b ]; - } - } - } - } - - if (doalloc) bglGenTextures(1,(GLuint *)&pth->glpic); //# of textures (make OpenGL allocate structure) - bglBindTexture(GL_TEXTURE_2D,pth->glpic); - - fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth); - uploadtexture(doalloc,xsiz,ysiz,hasalpha?GL_RGBA:GL_RGB,GL_RGBA,pic,tsizx,tsizy,dameth); - - if (gltexfiltermode < 0) gltexfiltermode = 0; - else if (gltexfiltermode >= (int32_t)numglfiltermodes) gltexfiltermode = numglfiltermodes-1; - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - - if (glinfo.maxanisotropy > 1.0) - { - if (glanisotropy <= 0 || glanisotropy > glinfo.maxanisotropy) glanisotropy = (int32_t)glinfo.maxanisotropy; - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - } - - if (!(dameth&4)) - { - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - } - else - { - //For sprite textures, clamping looks better than wrapping - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - } - - if (pic) Bfree(pic); - - pth->picnum = dapic; - pth->palnum = dapal; - pth->effects = 0; - pth->flags = ((dameth&4)>>2) | (hasalpha<<3); - pth->hicr = NULL; - - if ((hasfullbright) && (!fullbrightloadingpass)) - { - // load the ONLY texture that'll be assembled with the regular one to make the final texture with fullbright pixels - fullbrightloadingpass = 1; - pth->ofb = (pthtyp *)Bcalloc(1,sizeof(pthtyp)); - if (!pth->ofb) return 1; - pth->flags |= (hasfullbright<<4); - if (gloadtile_art(dapic, dapal, dameth, pth->ofb, 1)) return 1; - - fullbrightloadingpass = 0; - } - return 0; -} - -// JONOF'S COMPRESSED TEXTURE CACHE STUFF --------------------------------------------------- - -static int32_t LoadCacheOffsets(void) -{ - int32_t foffset, fsize, i; - char *fname; - - scriptfile *script; - - Bstrcpy(ptempbuf,TEXCACHEFILE); - Bstrcat(ptempbuf,".cache"); - script = scriptfile_fromfile(ptempbuf); - - if (!script) return -1; - - while (!scriptfile_eof(script)) - { - if (scriptfile_getstring(script, &fname)) break; // filename - if (scriptfile_getnumber(script, &foffset)) break; // offset in cache - if (scriptfile_getnumber(script, &fsize)) break; // size - - i = hash_find(&h_texcache,fname); - if (i > -1) - { - // update an existing entry - texcacheindex *t = cacheptrs[i]; - t->offset = foffset; - t->len = fsize; - /*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, fname,foffset);*/ - } - else - { - Bstrncpy(curcacheindex->name, fname, BMAX_PATH); - curcacheindex->offset = foffset; - curcacheindex->len = fsize; - curcacheindex->next = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex)); - hash_add(&h_texcache, Bstrdup(fname), numcacheentries, 1); - cacheptrs[numcacheentries++] = curcacheindex; - curcacheindex = curcacheindex->next; - } - } - - scriptfile_close(script); - return 0; -} - -void phex(char v, char *s) -{ - int32_t x; - x = v>>4; - s[0] = x<10 ? (x+'0') : (x-10+'a'); - x = v&15; - s[1] = x<10 ? (x+'0') : (x-10+'a'); -} - -int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head) -{ - int32_t fp, err=0; - char cachefn[BMAX_PATH], *cp; - uint8_t mdsum[16]; - - if (!glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1; - if (!glinfo.texcompr || !bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB) - { - // lacking the necessary extensions to do this - OSD_Printf("Warning: the GL driver lacks necessary functions to use caching\n"); - glusetexcache = 0; - return -1; - } - - md4once((uint8_t *)fn, strlen(fn), mdsum); -// for (cp = cachefn, fp = 0; (*cp = TEXCACHEFILE[fp]); cp++,fp++); -// *(cp++) = '/'; - cp = cachefn; - for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); - Bsprintf(cp, "-%x-%x%x", len, dameth, effect); - - { - int32_t offset = 0; - int32_t len = 0; - int32_t i; - - i = hash_find(&h_texcache,cachefn); - if (i > -1) - { - texcacheindex *t = cacheptrs[i]; - if (!t) - i = -1; - else - { - len = t->len; - offset = t->offset; - } - /*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, cachefn,offset);*/ - } - - if (i < 0) - return -1; // didn't find it - - cachepos = offset; - } - -// initprintf("Loading cached tex: %s\n", cachefn); - - if (memcachedata && memcachesize >= (signed)(cachepos + sizeof(texcacheheader))) - { -// initprintf("using memcache!\n"); - Bmemcpy(head, memcachedata + cachepos, sizeof(texcacheheader)); - cachepos += sizeof(texcacheheader); - } - else - { - Blseek(cachefilehandle, cachepos, BSEEK_SET); - if (Bread(cachefilehandle, head, sizeof(texcacheheader)) < (int32_t)sizeof(texcacheheader)) - { - cachepos += sizeof(texcacheheader); - err = 1; - goto failure; - } - cachepos += sizeof(texcacheheader); - } - - if (Bmemcmp(head->magic, TEXCACHEMAGIC, 4)) { err=2; goto failure; } - head->xdim = B_LITTLE32(head->xdim); - head->ydim = B_LITTLE32(head->ydim); - head->flags = B_LITTLE32(head->flags); - head->quality = B_LITTLE32(head->quality); - - if ((head->flags & 4) && glusetexcache != 2) { err=3; goto failure; } - if (!(head->flags & 4) && glusetexcache == 2) { err=4; goto failure; } - - if (!(head->flags & 8) && head->quality != r_downsize) return -1; // handle nocompress - if (gltexmaxsize && (head->xdim > (1<ydim > (1<flags & 1)) { err=6; goto failure; } - - return cachefilehandle; -failure: - initprintf("cache miss: %d\n", err); - return -1; -} - -void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head) -{ - int32_t fp; - char cachefn[BMAX_PATH], *cp; - uint8_t mdsum[16]; - texcachepicture pict; - char *pic = NULL, *packbuf = NULL; - void *midbuf = NULL; - uint32_t alloclen=0, level, miplen; - uint32_t padx=0, pady=0; - GLint gi; - int32_t offset = 0; - - if (!glinfo.texcompr || !glusetexcompr || !glusetexcache) return; - if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB) - { - // lacking the necessary extensions to do this - OSD_Printf("Warning: the GL driver lacks necessary functions to use caching\n"); - glusetexcache = 0; - return; - } - if (!cacheindexptr || cachefilehandle < 0) - { - OSD_Printf("Warning: no active cache!\n"); - return; - } - - gi = GL_FALSE; - bglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, (GLint *)&gi); - if (gi != GL_TRUE) - { - OSD_Printf("Error: glGetTexLevelParameteriv returned GL_FALSE!\n"); - return; - } - - md4once((uint8_t *)fn, strlen(fn), mdsum); - - cp = cachefn; - for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); - Bsprintf(cp, "-%x-%x%x", len, dameth, effect); - - Blseek(cachefilehandle, 0, BSEEK_END); - - offset = Blseek(cachefilehandle, 0, BSEEK_CUR); -// OSD_Printf("Caching %s, offset 0x%x\n", cachefn, offset); - - Bmemcpy(head->magic, TEXCACHEMAGIC, 4); // sizes are set by caller - - if (glusetexcache == 2) head->flags |= 4; - - head->xdim = B_LITTLE32(head->xdim); - head->ydim = B_LITTLE32(head->ydim); - head->flags = B_LITTLE32(head->flags); - head->quality = B_LITTLE32(head->quality); - - if (Bwrite(cachefilehandle, head, sizeof(texcacheheader)) != sizeof(texcacheheader)) goto failure; - - bglGetError(); - for (level = 0; level==0 || (padx > 1 || pady > 1); level++) - { - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_COMPRESSED_ARB, (GLint *)&gi); - if (bglGetError() != GL_NO_ERROR) goto failure; - if (gi != GL_TRUE) goto failure; // an uncompressed mipmap - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&gi); - if (bglGetError() != GL_NO_ERROR) goto failure; -#ifdef __APPLE__ - if (pr_ati_textureformat_one && gi == 1) gi = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; -#endif - pict.format = B_LITTLE32(gi); - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, (GLint *)&gi); - if (bglGetError() != GL_NO_ERROR) goto failure; - padx = gi; pict.xdim = B_LITTLE32(gi); - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_HEIGHT, (GLint *)&gi); - if (bglGetError() != GL_NO_ERROR) goto failure; - pady = gi; pict.ydim = B_LITTLE32(gi); - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_BORDER, (GLint *)&gi); - if (bglGetError() != GL_NO_ERROR) goto failure; - pict.border = B_LITTLE32(gi); - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_DEPTH, (GLint *)&gi); - if (bglGetError() != GL_NO_ERROR) goto failure; - pict.depth = B_LITTLE32(gi); - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, (GLint *)&gi); - if (bglGetError() != GL_NO_ERROR) goto failure; - miplen = (int32_t)gi; pict.size = B_LITTLE32(gi); - - if (alloclen < miplen) - { - void *picc = Brealloc(pic, miplen); - if (!picc) goto failure; else pic = picc; - alloclen = miplen; - - picc = Brealloc(packbuf, alloclen+16); - if (!picc) goto failure; else packbuf = picc; - - picc = Brealloc(midbuf, miplen); - if (!picc) goto failure; else midbuf = picc; - } - - bglGetCompressedTexImageARB(GL_TEXTURE_2D, level, pic); - if (bglGetError() != GL_NO_ERROR) goto failure; - - if (Bwrite(cachefilehandle, &pict, sizeof(texcachepicture)) != sizeof(texcachepicture)) goto failure; - if (dxtfilter(cachefilehandle, &pict, pic, midbuf, packbuf, miplen)) goto failure; - } - - { - int32_t i = hash_find(&h_texcache,cachefn); - if (i > -1) - { - // update an existing entry - texcacheindex *t = cacheptrs[i]; - t->offset = offset; - t->len = Blseek(cachefilehandle, 0, BSEEK_CUR) - t->offset; - /*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, cachefn,offset);*/ - - if (cacheindexptr) - { - fseek(cacheindexptr, 0, BSEEK_END); - Bfprintf(cacheindexptr, "%s %d %d\n", t->name, t->offset, t->len); - } - else OSD_Printf("wtf?\n"); - } - else - { - Bstrcpy(curcacheindex->name, cachefn); - curcacheindex->offset = offset; - curcacheindex->len = Blseek(cachefilehandle, 0, BSEEK_CUR) - curcacheindex->offset; - curcacheindex->next = (texcacheindex *)Bcalloc(1, sizeof(texcacheindex)); - - if (cacheindexptr) - { - fseek(cacheindexptr, 0, BSEEK_END); - Bfprintf(cacheindexptr, "%s %d %d\n", curcacheindex->name, curcacheindex->offset, curcacheindex->len); - } - else OSD_Printf("wtf?\n"); - - hash_add(&h_texcache, Bstrdup(cachefn), numcacheentries, 0); - cacheptrs[numcacheentries++] = curcacheindex; - curcacheindex = curcacheindex->next; - } - } - - goto success; - -failure: - initprintf("ERROR: cache failure!\n"); - curcacheindex->offset = 0; - Bmemset(curcacheindex->name,0,sizeof(curcacheindex->name)); - -success: - if (midbuf) Bfree(midbuf); - if (pic) Bfree(pic); - if (packbuf) Bfree(packbuf); -} - -int32_t gloadtile_cached(int32_t fil, texcacheheader *head, int32_t *doalloc, pthtyp *pth,int32_t dapalnum) -{ - int32_t level, r; - texcachepicture pict; - char *pic = NULL, *packbuf = NULL; - void *midbuf = NULL; - int32_t alloclen=0; - - UNREFERENCED_PARAMETER(dapalnum); - - if (*doalloc&1) - { - bglGenTextures(1,(GLuint *)&pth->glpic); //# of textures (make OpenGL allocate structure) - *doalloc |= 2; // prevents bglGenTextures being called again if we fail in here - } - bglBindTexture(GL_TEXTURE_2D,pth->glpic); - - pth->sizx = head->xdim; - pth->sizy = head->ydim; - - bglGetError(); - - // load the mipmaps - for (level = 0; level==0 || (pict.xdim > 1 || pict.ydim > 1); level++) - { - if (memcachedata && memcachesize >= (signed)(cachepos + sizeof(texcachepicture))) - { - // initprintf("using memcache!\n"); - Bmemcpy(&pict, memcachedata + cachepos, sizeof(texcachepicture)); - cachepos += sizeof(texcachepicture); - } - else - { - Blseek(fil, cachepos, BSEEK_SET); - r = Bread(fil, &pict, sizeof(texcachepicture)); - cachepos += sizeof(texcachepicture); - if (r < (int32_t)sizeof(texcachepicture)) goto failure; - } - - pict.size = B_LITTLE32(pict.size); - pict.format = B_LITTLE32(pict.format); - pict.xdim = B_LITTLE32(pict.xdim); - pict.ydim = B_LITTLE32(pict.ydim); - pict.border = B_LITTLE32(pict.border); - pict.depth = B_LITTLE32(pict.depth); - - if (alloclen < pict.size) - { - void *picc = Brealloc(pic, pict.size); - if (!picc) goto failure; else pic = picc; - alloclen = pict.size; - - picc = Brealloc(packbuf, alloclen+16); - if (!picc) goto failure; else packbuf = picc; - - picc = Brealloc(midbuf, pict.size); - if (!picc) goto failure; else midbuf = picc; - } - - if (dedxtfilter(fil, &pict, pic, midbuf, packbuf, (head->flags&4)==4)) goto failure; - - bglCompressedTexImage2DARB(GL_TEXTURE_2D,level,pict.format,pict.xdim,pict.ydim,pict.border, - pict.size,pic); - if (bglGetError() != GL_NO_ERROR) goto failure; - - { - GLint format; - bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &format); - if (bglGetError() != GL_NO_ERROR) goto failure; -// format = B_LITTLE32(format); - if (pict.format != format) - { - OSD_Printf("invalid texture cache file format %d %d\n",pict.format, format); - goto failure; - } - } - - } - - if (midbuf) Bfree(midbuf); - if (pic) Bfree(pic); - if (packbuf) Bfree(packbuf); - return 0; -failure: - initprintf("failure!!!\n"); - if (midbuf) Bfree(midbuf); - if (pic) Bfree(pic); - if (packbuf) Bfree(packbuf); - return -1; -} -// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF -//static -int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp *hicr, int32_t dameth, pthtyp *pth, int32_t doalloc, char effect) -{ - coltype *pic = NULL, *rpptr; - int32_t j, x, y, xsiz=0, ysiz=0, tsizx, tsizy; - int32_t r, g, b; - - char *picfil = NULL, *fn, hasalpha = 255; - int32_t picfillen, texfmt = GL_RGBA, intexfmt = GL_RGBA, filh; - - int32_t cachefil = -1; - texcacheheader cachead; - - static coltype *lastpic = NULL; - static char *lastfn = NULL; - static int32_t lastsize = 0; - - int32_t startticks=0, willprint=0; - - if (!hicr) return -1; - if (facen > 0) - { - if (!hicr->skybox) return -1; - if (facen > 6) return -1; - if (!hicr->skybox->face[facen-1]) return -1; - fn = hicr->skybox->face[facen-1]; - } - else - { - if (!hicr->filename) return -1; - fn = hicr->filename; - } - - if ((filh = kopen4load(fn, 0)) < 0) - { - OSD_Printf("hightile: %s (pic %d) not found\n", fn, dapic); - if (facen > 0) - hicr->skybox->ignore = 1; - else - hicr->ignore = 1; - return -1; - } - picfillen = kfilelength(filh); - - kclose(filh); // FIXME: shouldn't have to do this. bug in cache1d.c - - cachefil = trytexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead); - if (cachefil >= 0 && !gloadtile_cached(cachefil, &cachead, &doalloc, pth, dapalnum)) - { - tsizx = cachead.xdim; - tsizy = cachead.ydim; - hasalpha = (cachead.flags & 2) ? 0 : 255; - } - else - { - cachefil = -1; // the compressed version will be saved to disk - - if ((filh = kopen4load(fn, 0)) < 0) return -1; - - picfil = (char *)Bmalloc(picfillen+1); if (!picfil) { kclose(filh); return 1; } - kread(filh, picfil, picfillen); - kclose(filh); - - // tsizx/y = replacement texture's natural size - // xsiz/y = 2^x size of replacement - - kpgetdim(picfil,picfillen,&tsizx,&tsizy); - if (tsizx == 0 || tsizy == 0) { Bfree(picfil); return -1; } - pth->sizx = tsizx; - pth->sizy = tsizy; - - if (!glinfo.texnpot) - { - for (xsiz=1; xsiz tsizx) //Copy left to right - { - int32_t *lptr = (int32_t *)pic; - for (y=0; y tsizy) //Copy top to bottom - Bmemcpy(&pic[xsiz*tsizy],pic,(ysiz-tsizy)*xsiz<<2); - } - if (!glinfo.bgra) - { - for (j=xsiz*ysiz-1; j>=0; j--) - { - swapchar(&pic[j].r, &pic[j].b); - } - } - else texfmt = GL_BGRA; - Bfree(picfil); picfil = 0; - - if (tsizx>>r_downsize <= tilesizx[dapic] || tsizy>>r_downsize <= tilesizy[dapic]) - hicr->flags |= 17; - - if (glinfo.texcompr && glusetexcompr && !(hicr->flags & 1)) - intexfmt = (hasalpha == 255) ? GL_COMPRESSED_RGB_ARB : GL_COMPRESSED_RGBA_ARB; - else if (hasalpha == 255) intexfmt = GL_RGB; - - if ((doalloc&3)==1) bglGenTextures(1,(GLuint *)&pth->glpic); //# of textures (make OpenGL allocate structure) - bglBindTexture(GL_TEXTURE_2D,pth->glpic); - - fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth); - uploadtexture(doalloc,xsiz,ysiz,intexfmt,texfmt,pic,-1,tsizy,dameth|8192|(hicr->flags & 16?4096:0)); - } - - // precalculate scaling parameters for replacement - if (facen > 0) - { - pth->scalex = ((float)tsizx) / 64.0; - pth->scaley = ((float)tsizy) / 64.0; - } - else - { - pth->scalex = ((float)tsizx) / ((float)tilesizx[dapic]); - pth->scaley = ((float)tsizy) / ((float)tilesizy[dapic]); - } - - if (gltexfiltermode < 0) gltexfiltermode = 0; - else if (gltexfiltermode >= (int32_t)numglfiltermodes) gltexfiltermode = numglfiltermodes-1; - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - - if (glinfo.maxanisotropy > 1.0) - { - if (glanisotropy <= 0 || glanisotropy > glinfo.maxanisotropy) glanisotropy = (int32_t)glinfo.maxanisotropy; - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - } - - if (!(dameth&4)) - { - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - } - else - { - //For sprite textures, clamping looks better than wrapping - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - } - - if (pic) Bfree(pic); - - if (tsizx>>r_downsize <= tilesizx[dapic] || tsizy>>r_downsize <= tilesizy[dapic]) - hicr->flags |= 17; - - pth->picnum = dapic; - pth->effects = effect; - pth->flags = ((dameth&4)>>2) + 2 + ((facen>0)<<2); if (hasalpha != 255) pth->flags |= 8; - pth->skyface = facen; - pth->hicr = hicr; - - if (glinfo.texcompr && glusetexcompr && glusetexcache && !(hicr->flags & 1)) - if (cachefil < 0) - { - // save off the compressed version - if (hicr->flags & 16) cachead.quality = 0; - else cachead.quality = r_downsize; - cachead.xdim = tsizx>>cachead.quality; - cachead.ydim = tsizy>>cachead.quality; - x = 0; - for (j=0; j<31; j++) - { - if (xsiz == pow2long[j]) { x |= 1; } - if (ysiz == pow2long[j]) { x |= 2; } - } - cachead.flags = (x!=3) | (hasalpha != 255 ? 2 : 0) | (hicr->flags & 16?8:0); // handle nocompress -/// OSD_Printf("Caching \"%s\"\n", fn); - writexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead); - - if (willprint) - { - int32_t etime = getticks()-startticks; - if (etime>=MIN_CACHETIME_PRINT) - OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... cached... %d ms\n", dapic, dapalnum, dameth, effect, - willprint==2 ? fn : "", etime); - willprint = 0; - } - else - OSD_Printf("Cached \"%s\"\n", fn); - } - - if (willprint) - { - int32_t etime = getticks()-startticks; - if (etime>=MIN_CACHETIME_PRINT) - OSD_Printf("Load tile %4d: p%d-m%d-e%d %s... %d ms\n", dapic, dapalnum, dameth, effect, - willprint==2 ? fn : "", etime); - } - - return 0; -} - -#endif - -//(dpx,dpy) specifies an n-sided polygon. The polygon must be a convex clockwise loop. -// n must be <= 8 (assume clipping can double number of vertices) -//method: 0:solid, 1:masked(255 is transparent), 2:transluscent #1, 3:transluscent #2 -// +4 means it's a sprite, so wraparound isn't needed -static int32_t pow2xsplit = 0, skyclamphack = 0; - -void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) -{ - double ngdx = 0.0, ngdy = 0.0, ngdo = 0.0, ngux = 0.0, nguy = 0.0, nguo = 0.0; - double ngvx = 0.0, ngvy = 0.0, ngvo = 0.0, dp, up, vp, rdp, du0 = 0.0, du1 = 0.0, dui, duj; - double ngdx2, ngux2, ngvx2; - double f, r, ox, oy, oz, ox2, oy2, oz2, dd[16], uu[16], vv[16], px[16], py[16], uoffs; - int32_t i, j, k, x, y, z, nn, ix0, ix1, mini, maxi, tsizx, tsizy, tsizxm1 = 0, tsizym1 = 0, ltsizy = 0; - int32_t xx, yy, xi, d0, u0, v0, d1, u1, v1, xmodnice = 0, ymulnice = 0, dorot; - char dacol = 0, *walptr, *palptr = NULL, *vidp, *vide; -#ifdef USE_OPENGL - pthtyp *pth, *detailpth, *glowpth; - int32_t texunits = GL_TEXTURE0_ARB; -#endif - // backup of the n for possible redrawing of fullbright - int32_t n_ = n, method_ = method; - - if (method == -1) return; - - if (n == 3) - { - if ((dpx[0]-dpx[1])*(dpy[2]-dpy[1]) >= (dpx[2]-dpx[1])*(dpy[0]-dpy[1])) return; //for triangle - } - else - { - f = 0; //f is area of polygon / 2 - for (i=n-2,j=n-1,k=0; k= MAXTILES) globalpicnum = 0; - setgotpic(globalpicnum); - tsizx = tilesizx[globalpicnum]; - tsizy = tilesizy[globalpicnum]; - if (palookup[globalpal] == NULL) - globalpal = 0; - if (!waloff[globalpicnum]) - { - loadtile(globalpicnum); - if (!waloff[globalpicnum]) - { - if (rendmode < 3) return; - tsizx = tsizy = 1; method = 1; //Hack to update Z-buffer for invalid mirror textures - } - } - walptr = (char *)waloff[globalpicnum]; - - j = 0; dorot = ((gchang != 1.0) || (gctang != 1.0)); - if (dorot) - { - for (i=0; i= 3) && (px[j-1] == px[0]) && (py[j-1] == py[0])) j--; - if (j < 3) return; - n = j; - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - float hackscx, hackscy; - - if (skyclamphack) method |= 4; - pth = gltexcache(globalpicnum,globalpal,method&(~3)); - - if (r_fullbrights && pth->flags & 16) - if (indrawroomsandmasks) - { - if (!fullbrightdrawingpass) - fullbrightdrawingpass = 1; - else if (fullbrightdrawingpass == 2) - pth = pth->ofb; - } - - bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); - - if (srepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - if (trepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - - // texture scale by parkar request - if (pth && pth->hicr && ((pth->hicr->xscale != 1.0f) || (pth->hicr->yscale != 1.0f)) && !drawingskybox) - { - bglMatrixMode(GL_TEXTURE); - bglLoadIdentity(); - bglScalef(pth->hicr->xscale, pth->hicr->yscale, 1.0f); - bglMatrixMode(GL_MODELVIEW); - } - - // detail texture - detailpth = NULL; - if (r_detailmapping && usehightile && !drawingskybox && - hicfindsubst(globalpicnum, DETAILPAL, 0)) - detailpth = gltexcache(globalpicnum, DETAILPAL, method&(~3)); - - if (detailpth && detailpth->hicr && (detailpth->hicr->palnum == DETAILPAL)) - { - bglActiveTextureARB(++texunits); - - bglEnable(GL_TEXTURE_2D); - bglBindTexture(GL_TEXTURE_2D, detailpth ? detailpth->glpic : 0); - - bglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE); - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); - - bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 2.0f); - - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - - - f = detailpth ? detailpth->hicr->xscale : 1.0; - - bglMatrixMode(GL_TEXTURE); - bglLoadIdentity(); - - if (pth && pth->hicr && ((pth->hicr->xscale != 1.0f) || (pth->hicr->yscale != 1.0f))) - bglScalef(pth->hicr->xscale, pth->hicr->yscale, 1.0f); - - if (detailpth && detailpth->hicr && ((detailpth->hicr->xscale != 1.0f) || (detailpth->hicr->yscale != 1.0f))) - bglScalef(detailpth->hicr->xscale, detailpth->hicr->yscale, 1.0f); - - bglMatrixMode(GL_MODELVIEW); - } - - // glow texture - glowpth = NULL; - if (r_glowmapping && usehightile && !drawingskybox && - hicfindsubst(globalpicnum, GLOWPAL, 0)) - glowpth = gltexcache(globalpicnum, GLOWPAL, method&(~3)); - - if (glowpth && glowpth->hicr && (glowpth->hicr->palnum == GLOWPAL)) - { - bglActiveTextureARB(++texunits); - - bglEnable(GL_TEXTURE_2D); - bglBindTexture(GL_TEXTURE_2D, glowpth ? glowpth->glpic : 0); - - bglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); - - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_TEXTURE); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_ONE_MINUS_SRC_ALPHA); - - bglTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE); - bglTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB); - bglTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); - - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); - } - - if (pth && (pth->flags & 2)) - { - hackscx = pth->scalex; - hackscy = pth->scaley; - tsizx = pth->sizx; - tsizy = pth->sizy; - } - else { hackscx = 1.0; hackscy = 1.0; } - - if (!glinfo.texnpot) - { - for (xx=1; xxhicr && pth->hicr->alphacut >= 0.0) al = pth->hicr->alphacut; - if (alphahackarray[globalpicnum]) - al=alphahackarray[globalpicnum]; - if (!waloff[globalpicnum]) al = 0.0; // invalid textures ignore the alpha cutoff settings - bglEnable(GL_BLEND); - bglEnable(GL_ALPHA_TEST); - bglAlphaFunc(GL_GREATER,al); - } - - if (!dorot) - { - for (i=n-1; i>=0; i--) - { - dd[i] = px[i]*gdx + py[i]*gdy + gdo; - uu[i] = px[i]*gux + py[i]*guy + guo; - vv[i] = px[i]*gvx + py[i]*gvy + gvo; - } - } - - { - float pc[4]; - f = ((float)(numpalookups-min(max((globalshade * shadescale),0),numpalookups)))/((float)numpalookups); - pc[0] = pc[1] = pc[2] = f; - switch (method&3) - { - default: - case 0: - pc[3] = 1.0f; break; - case 1: - pc[3] = 1.0f; break; - case 2: - pc[3] = 0.66f; break; - case 3: - pc[3] = 0.33f; break; - } - // tinting happens only to hightile textures, and only if the texture we're - // rendering isn't for the same palette as what we asked for - if (!(hictinting[globalpal].f&4)) - { - if (pth && (pth->flags & 2)) - { - if (pth->palnum != globalpal) - { - // apply tinting for replaced textures - pc[0] *= (float)hictinting[globalpal].r / 255.0; - pc[1] *= (float)hictinting[globalpal].g / 255.0; - pc[2] *= (float)hictinting[globalpal].b / 255.0; - } - if (hictinting[MAXPALOOKUPS-1].r != 255 || hictinting[MAXPALOOKUPS-1].g != 255 || hictinting[MAXPALOOKUPS-1].b != 255) - { - pc[0] *= (float)hictinting[MAXPALOOKUPS-1].r / 255.0; - pc[1] *= (float)hictinting[MAXPALOOKUPS-1].g / 255.0; - pc[2] *= (float)hictinting[MAXPALOOKUPS-1].b / 255.0; - } - } - // hack: this is for drawing the 8-bit crosshair recolored in polymost - else if (hictinting[globalpal].f & 8) - { - pc[0] *= (float)hictinting[globalpal].r / 255.0; - pc[1] *= (float)hictinting[globalpal].g / 255.0; - pc[2] *= (float)hictinting[globalpal].b / 255.0; - } - } - - bglColor4f(pc[0],pc[1],pc[2],pc[3]); - } - - //Hack for walls&masked walls which use textures that are not a power of 2 - if ((pow2xsplit) && (tsizx != xx)) - { - if (!dorot) - { - ngdx = gdx; ngdy = gdy; ngdo = gdo+(ngdx+ngdy)*.5; - ngux = gux; nguy = guy; nguo = guo+(ngux+nguy)*.5; - ngvx = gvx; ngvy = gvy; ngvo = gvo+(ngvx+ngvy)*.5; - } - else - { - ox = py[1]-py[2]; oy = py[2]-py[0]; oz = py[0]-py[1]; - r = 1.0 / (ox*px[0] + oy*px[1] + oz*px[2]); - ngdx = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - ngux = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - ngvx = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - ox = px[2]-px[1]; oy = px[0]-px[2]; oz = px[1]-px[0]; - ngdy = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - nguy = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - ngvy = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - ox = px[0]-.5; oy = py[0]-.5; //.5 centers texture nicely - ngdo = dd[0] - ox*ngdx - oy*ngdy; - nguo = uu[0] - ox*ngux - oy*nguy; - ngvo = vv[0] - ox*ngvx - oy*ngvy; - } - - ngux *= hackscx; nguy *= hackscx; nguo *= hackscx; - ngvx *= hackscy; ngvy *= hackscy; ngvo *= hackscy; - uoffs = ((double)(xx-tsizx)*.5); - ngux -= ngdx*uoffs; - nguy -= ngdy*uoffs; - nguo -= ngdo*uoffs; - - //Find min&max u coordinates (du0...du1) - for (i=0; i du1) du1 = f; - } - - f = 1.0/(double)tsizx; - ix0 = (int32_t)floor(du0*f); - ix1 = (int32_t)floor(du1*f); - for (; ix0<=ix1; ix0++) - { - du0 = (double)((ix0)*tsizx); // + uoffs; - du1 = (double)((ix0+1)*tsizx); // + uoffs; - - i = 0; nn = 0; - duj = (px[i]*ngux + py[i]*nguy + nguo) / (px[i]*ngdx + py[i]*ngdy + ngdo); - do - { - j = i+1; if (j == n) j = 0; - - dui = duj; duj = (px[j]*ngux + py[j]*nguy + nguo) / (px[j]*ngdx + py[j]*ngdy + ngdo); - - if ((du0 <= dui) && (dui <= du1)) { uu[nn] = px[i]; vv[nn] = py[i]; nn++; } - if (duj <= dui) - { - if ((du1 < duj) != (du1 < dui)) - { - //ox*(ngux-ngdx*du1) + oy*(nguy-ngdy*du1) + (nguo-ngdo*du1) = 0 - //(px[j]-px[i])*f + px[i] = ox - //(py[j]-py[i])*f + py[i] = oy - - ///Solve for f - //((px[j]-px[i])*f + px[i])*(ngux-ngdx*du1) + - //((py[j]-py[i])*f + py[i])*(nguy-ngdy*du1) + (nguo-ngdo*du1) = 0 - - f = -(px[i] *(ngux-ngdx*du1) + py[i] *(nguy-ngdy*du1) + (nguo-ngdo*du1)) / - ((px[j]-px[i])*(ngux-ngdx*du1) + (py[j]-py[i])*(nguy-ngdy*du1)); - uu[nn] = (px[j]-px[i])*f + px[i]; - vv[nn] = (py[j]-py[i])*f + py[i]; nn++; - } - if ((du0 < duj) != (du0 < dui)) - { - f = -(px[i] *(ngux-ngdx*du0) + py[i] *(nguy-ngdy*du0) + (nguo-ngdo*du0)) / - ((px[j]-px[i])*(ngux-ngdx*du0) + (py[j]-py[i])*(nguy-ngdy*du0)); - uu[nn] = (px[j]-px[i])*f + px[i]; - vv[nn] = (py[j]-py[i])*f + py[i]; nn++; - } - } - else - { - if ((du0 < duj) != (du0 < dui)) - { - f = -(px[i] *(ngux-ngdx*du0) + py[i] *(nguy-ngdy*du0) + (nguo-ngdo*du0)) / - ((px[j]-px[i])*(ngux-ngdx*du0) + (py[j]-py[i])*(nguy-ngdy*du0)); - uu[nn] = (px[j]-px[i])*f + px[i]; - vv[nn] = (py[j]-py[i])*f + py[i]; nn++; - } - if ((du1 < duj) != (du1 < dui)) - { - f = -(px[i] *(ngux-ngdx*du1) + py[i] *(nguy-ngdy*du1) + (nguo-ngdo*du1)) / - ((px[j]-px[i])*(ngux-ngdx*du1) + (py[j]-py[i])*(nguy-ngdy*du1)); - uu[nn] = (px[j]-px[i])*f + px[i]; - vv[nn] = (py[j]-py[i])*f + py[i]; nn++; - } - } - i = j; - } - while (i); - if (nn < 3) continue; - - bglBegin(GL_TRIANGLE_FAN); - for (i=0; i GL_TEXTURE0_ARB) - { - j = GL_TEXTURE0_ARB; - while (j <= texunits) - bglMultiTexCoord2dARB(j++, (up*r-du0+uoffs)*ox2,vp*r*oy2); - } - else - bglTexCoord2d((up*r-du0+uoffs)*ox2,vp*r*oy2); - bglVertex3d((ox-ghalfx)*r*grhalfxdown10x,(ghoriz-oy)*r*grhalfxdown10,r*(1.0/1024.0)); - } - bglEnd(); - } - } - else - { - ox2 *= hackscx; oy2 *= hackscy; - bglBegin(GL_TRIANGLE_FAN); - for (i=0; i GL_TEXTURE0_ARB) - { - j = GL_TEXTURE0_ARB; - while (j <= texunits) - bglMultiTexCoord2dARB(j++, uu[i]*r*ox2,vv[i]*r*oy2); - } - else - bglTexCoord2d(uu[i]*r*ox2,vv[i]*r*oy2); - bglVertex3d((px[i]-ghalfx)*r*grhalfxdown10x,(ghoriz-py[i])*r*grhalfxdown10,r*(1.0/1024.0)); - } - bglEnd(); - } - - while (texunits >= GL_TEXTURE0_ARB) - { - bglActiveTextureARB(texunits); - bglMatrixMode(GL_TEXTURE); - bglLoadIdentity(); - bglMatrixMode(GL_MODELVIEW); - if (texunits > GL_TEXTURE0_ARB) - { - bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f); - bglDisable(GL_TEXTURE_2D); - } - texunits--; - } - - if (srepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - if (trepeat) - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP); - - if (fullbrightdrawingpass == 1) // tile has fullbright colors ? - { - fullbrightdrawingpass = 2; - shadeforfullbrightpass = globalshade; // save the current shade - globalshade = -128; // fullbright - bglDisable(GL_FOG); - drawpoly(dpx, dpy, n_, method_); // draw them afterwards, then. :) - bglEnable(GL_FOG); - globalshade = shadeforfullbrightpass; - fullbrightdrawingpass = 0; - } - return; - } -#endif - - if (rendmode == 2) - { -#if (USEZBUFFER != 0) - if ((!zbufmem) || (zbufbpl != bytesperline) || (zbufysiz != ydim)) - { - zbufbpl = bytesperline; - zbufysiz = ydim; - zbufmem = (intptr_t)Brealloc((void *)zbufmem,zbufbpl*zbufysiz*4); - } - zbufoff = (int32_t *)(zbufmem-(frameplace<<2)); -#endif - if ((!transluc)) method = (method&~3)+1; //In case translucent table doesn't exist - - if (!dorot) - { - ngdx = gdx; ngdy = gdy; ngdo = gdo+(ngdx+ngdy)*.5; - ngux = gux; nguy = guy; nguo = guo+(ngux+nguy)*.5; - ngvx = gvx; ngvy = gvy; ngvo = gvo+(ngvx+ngvy)*.5; - } - else - { - //General equations: - //dd[i] = (px[i]*gdx + py[i]*gdy + gdo) - //uu[i] = (px[i]*gux + py[i]*guy + guo)/dd[i] - //vv[i] = (px[i]*gvx + py[i]*gvy + gvo)/dd[i] - // - //px[0]*gdx + py[0]*gdy + 1*gdo = dd[0] - //px[1]*gdx + py[1]*gdy + 1*gdo = dd[1] - //px[2]*gdx + py[2]*gdy + 1*gdo = dd[2] - // - //px[0]*gux + py[0]*guy + 1*guo = uu[0]*dd[0] (uu[i] premultiplied by dd[i] above) - //px[1]*gux + py[1]*guy + 1*guo = uu[1]*dd[1] - //px[2]*gux + py[2]*guy + 1*guo = uu[2]*dd[2] - // - //px[0]*gvx + py[0]*gvy + 1*gvo = vv[0]*dd[0] (vv[i] premultiplied by dd[i] above) - //px[1]*gvx + py[1]*gvy + 1*gvo = vv[1]*dd[1] - //px[2]*gvx + py[2]*gvy + 1*gvo = vv[2]*dd[2] - ox = py[1]-py[2]; oy = py[2]-py[0]; oz = py[0]-py[1]; - r = 1.0 / (ox*px[0] + oy*px[1] + oz*px[2]); - ngdx = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - ngux = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - ngvx = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - ox = px[2]-px[1]; oy = px[0]-px[2]; oz = px[1]-px[0]; - ngdy = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - nguy = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - ngvy = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - ox = px[0]-.5; oy = py[0]-.5; //.5 centers texture nicely - ngdo = dd[0] - ox*ngdx - oy*ngdy; - nguo = uu[0] - ox*ngux - oy*nguy; - ngvo = vv[0] - ox*ngvx - oy*ngvy; - } - palptr = &palookup[globalpal][min(max((int32_t)(globalshade * shadescale),0),numpalookups-1)<<8]; //<-need to make shade not static! - - tsizxm1 = tsizx-1; xmodnice = (!(tsizxm1&tsizx)); - tsizym1 = tsizy-1; ymulnice = (!(tsizym1&tsizy)); - if ((method&4) && (!xmodnice)) //Sprites don't need a mod on texture coordinates - { xmodnice = 1; for (tsizxm1=1; tsizxm1>4); - } - else - { - dacol = palookup[0][(int32_t)(*(char *)(waloff[globalpicnum]))+(min(max((int32_t)(globalshade * shadescale),0),numpalookups-1)<<8)]; - } - - if (grhalfxdown10x < 0) //Hack for mirrors - { - for (i=((n-1)>>1); i>=0; i--) - { - r = px[i]; px[i] = ((double)xdimen)-px[n-1-i]; px[n-1-i] = ((double)xdimen)-r; - r = py[i]; py[i] = py[n-1-i]; py[n-1-i] = r; - } - ngdo += ((double)xdimen)*ngdx; ngdx = -ngdx; - nguo += ((double)xdimen)*ngux; ngux = -ngux; - ngvo += ((double)xdimen)*ngvx; ngvx = -ngvx; - } - - ngdx2 = ngdx*(1<= py[1]); maxi = 1-mini; - for (z=2; z py[maxi]) maxi = z; - } - - i = maxi; dtol(py[i],&yy); if (yy > ydimen) yy = ydimen; - do - { - j = i+1; if (j == n) j = 0; - dtol(py[j],&y); if (y < 0) y = 0; - if (y < yy) - { - f = (px[j]-px[i])/(py[j]-py[i]); dtol(f*16384.0,&xi); - dtol((((double)yy-.5-py[j])*f + px[j])*16384.0+8192.0,&x); - for (; yy>y; yy--,x-=xi) lastx[yy-1] = (x>>14); - } - i = j; - } - while (i != mini); - do - { - j = i+1; if (j == n) j = 0; - dtol(py[j],&yy); if (yy > ydimen) yy = ydimen; - if (y < yy) - { - f = (px[j]-px[i])/(py[j]-py[i]); dtol(f*16384.0,&xi); - dtol((((double)y+.5-py[j])*f + px[j])*16384.0+8192.0,&x); - for (; y>14); if (ix1 > xdimen) ix1 = xdimen; - if (ix0 < ix1) - { - if (rendmode == 1) - memset((void *)(ylookup[y]+ix0+frameoffset),dacol,ix1-ix0); - else - { - vidp = (char *)(ylookup[y]+frameoffset+ix0); - dp = ngdx*(double)ix0 + ngdy*(double)y + ngdo; - up = ngux*(double)ix0 + nguy*(double)y + nguo; - vp = ngvx*(double)ix0 + ngvy*(double)y + ngvo; - rdp = 65536.0/dp; dp += ngdx2; - dtol(rdp,&d0); - dtol(up*rdp,&u0); up += ngux2; - dtol(vp*rdp,&v0); vp += ngvx2; - rdp = 65536.0/dp; - - switch (method&3) - { - case 0: - if (xmodnice&ymulnice) //both u&v texture sizes are powers of 2 :) - { - for (xx=ix0; xx>LINTERPSIZ); - dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); - dtol(vp*rdp,&v1); vp += ngvx2; v1 = ((v1-v0)>>LINTERPSIZ); - rdp = 65536.0/dp; vide = &vidp[min(ix1-xx,1<>16)&tsizxm1)<>16)&tsizym1)]]; //+((d0>>13)&0x3f00)]; -#else - vidp[0] = ((d0>>16)&255); -#endif - d0 += d1; u0 += u1; v0 += v1; vidp++; - } - } - } - else - { - for (xx=ix0; xx>LINTERPSIZ); - dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); - dtol(vp*rdp,&v1); vp += ngvx2; v1 = ((v1-v0)>>LINTERPSIZ); - rdp = 65536.0/dp; vide = &vidp[min(ix1-xx,1<>16,tsizx)*tsizy + ((v0>>16)&tsizym1)]]; //+((d0>>13)&0x3f00)]; -#else - vidp[0] = ((d0>>16)&255); -#endif - d0 += d1; u0 += u1; v0 += v1; vidp++; - } - } - } - break; - case 1: - if (xmodnice) //both u&v texture sizes are powers of 2 :) - { - for (xx=ix0; xx>LINTERPSIZ); - dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); - dtol(vp*rdp,&v1); vp += ngvx2; v1 = ((v1-v0)>>LINTERPSIZ); - rdp = 65536.0/dp; vide = &vidp[min(ix1-xx,1<>16)&tsizxm1)*tsizy) + ((v0>>16)&tsizym1)]; -#if (DEPTHDEBUG == 0) -#if (USEZBUFFER != 0) - if ((dacol != 255) && (d0 <= zbufoff[(intptr_t)vidp])) - { - zbufoff[(intptr_t)vidp] = d0; - vidp[0] = palptr[((int32_t)dacol)]; //+((d0>>13)&0x3f00)]; - } -#else - if (dacol != 255) vidp[0] = palptr[((int32_t)dacol)]; //+((d0>>13)&0x3f00)]; -#endif -#else - if ((dacol != 255) && (vidp[0] > (d0>>16))) vidp[0] = ((d0>>16)&255); -#endif - d0 += d1; u0 += u1; v0 += v1; vidp++; - } - } - } - else - { - for (xx=ix0; xx>LINTERPSIZ); - dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); - dtol(vp*rdp,&v1); vp += ngvx2; v1 = ((v1-v0)>>LINTERPSIZ); - rdp = 65536.0/dp; vide = &vidp[min(ix1-xx,1<>16,tsizx)*tsizy + ((v0>>16)&tsizym1)]; -#if (DEPTHDEBUG == 0) -#if (USEZBUFFER != 0) - if ((dacol != 255) && (d0 <= zbufoff[(intptr_t)vidp])) - { - zbufoff[(intptr_t)vidp] = d0; - vidp[0] = palptr[((int32_t)dacol)]; //+((d0>>13)&0x3f00)]; - } -#else - if (dacol != 255) vidp[0] = palptr[((int32_t)dacol)]; //+((d0>>13)&0x3f00)]; -#endif -#else - if ((dacol != 255) && (vidp[0] > (d0>>16))) vidp[0] = ((d0>>16)&255); -#endif - d0 += d1; u0 += u1; v0 += v1; vidp++; - } - } - } - break; - case 2: //Transluscence #1 - for (xx=ix0; xx>LINTERPSIZ); - dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); - dtol(vp*rdp,&v1); vp += ngvx2; v1 = ((v1-v0)>>LINTERPSIZ); - rdp = 65536.0/dp; vide = &vidp[min(ix1-xx,1<>16,tsizx)*tsizy + ((v0>>16)&tsizym1)]; - //dacol = walptr[(((u0>>16)&tsizxm1)<>16)&tsizym1)]; -#if (DEPTHDEBUG == 0) -#if (USEZBUFFER != 0) - if ((dacol != 255) && (d0 <= zbufoff[(intptr_t)vidp])) - { - zbufoff[(intptr_t)vidp] = d0; - vidp[0] = transluc[(((int32_t)vidp[0])<<8)+((int32_t)palptr[((int32_t)dacol)])]; //+((d0>>13)&0x3f00)])]; - } -#else - if (dacol != 255) - vidp[0] = transluc[(((int32_t)vidp[0])<<8)+((int32_t)palptr[((int32_t)dacol)])]; //+((d0>>13)&0x3f00)])]; -#endif -#else - if ((dacol != 255) && (vidp[0] > (d0>>16))) vidp[0] = ((d0>>16)&255); -#endif - d0 += d1; u0 += u1; v0 += v1; vidp++; - } - } - break; - case 3: //Transluscence #2 - for (xx=ix0; xx>LINTERPSIZ); - dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); - dtol(vp*rdp,&v1); vp += ngvx2; v1 = ((v1-v0)>>LINTERPSIZ); - rdp = 65536.0/dp; vide = &vidp[min(ix1-xx,1<>16,tsizx)*tsizy + ((v0>>16)&tsizym1)]; - //dacol = walptr[(((u0>>16)&tsizxm1)<>16)&tsizym1)]; -#if (DEPTHDEBUG == 0) -#if (USEZBUFFER != 0) - if ((dacol != 255) && (d0 <= zbufoff[(intptr_t)vidp])) - { - zbufoff[(intptr_t)vidp] = d0; - vidp[0] = transluc[((int32_t)vidp[0])+(((int32_t)palptr[((int32_t)dacol)/*+((d0>>13)&0x3f00)*/])<<8)]; - } -#else - if (dacol != 255) - vidp[0] = transluc[((int32_t)vidp[0])+(((int32_t)palptr[((int32_t)dacol)/*+((d0>>13)&0x3f00)*/])<<8)]; -#endif -#else - if ((dacol != 255) && (vidp[0] > (d0>>16))) vidp[0] = ((d0>>16)&255); -#endif - d0 += d1; u0 += u1; v0 += v1; vidp++; - } - } - break; - } - } - } - } - } - i = j; - } - while (i != maxi); - - if (rendmode == 1) - { - if (method&3) //Only draw border around sprites/maskwalls - { - for (i=0,j=n-1; i=2; i--) if (px[i] < px[imin]) imin = i; - - - vsp[vcnt].x = px[imin]; - vsp[vcnt].cy[0] = vsp[vcnt].fy[0] = py[imin]; - vcnt++; - i = imin+1; if (i >= n) i = 0; - j = imin-1; if (j < 0) j = n-1; - do - { - if (px[i] < px[j]) - { - if ((vcnt > 1) && (px[i] <= vsp[vcnt-1].x)) vcnt--; - vsp[vcnt].x = px[i]; - vsp[vcnt].cy[0] = py[i]; - k = j+1; if (k >= n) k = 0; - //(px[k],py[k]) - //(px[i],?) - //(px[j],py[j]) - vsp[vcnt].fy[0] = (px[i]-px[k])*(py[j]-py[k])/(px[j]-px[k]) + py[k]; - vcnt++; - i++; if (i >= n) i = 0; - } - else if (px[j] < px[i]) - { - if ((vcnt > 1) && (px[j] <= vsp[vcnt-1].x)) vcnt--; - vsp[vcnt].x = px[j]; - vsp[vcnt].fy[0] = py[j]; - k = i-1; if (k < 0) k = n-1; - //(px[k],py[k]) - //(px[j],?) - //(px[i],py[i]) - vsp[vcnt].cy[0] = (px[j]-px[k])*(py[i]-py[k])/(px[i]-px[k]) + py[k]; - vcnt++; - j--; if (j < 0) j = n-1; - } - else - { - if ((vcnt > 1) && (px[i] <= vsp[vcnt-1].x)) vcnt--; - vsp[vcnt].x = px[i]; - vsp[vcnt].cy[0] = py[i]; - vsp[vcnt].fy[0] = py[j]; - vcnt++; - i++; if (i >= n) i = 0; if (i == j) break; - j--; if (j < 0) j = n-1; - } - } - while (i != j); - if (px[i] > vsp[vcnt-1].x) - { - vsp[vcnt].x = px[i]; - vsp[vcnt].cy[0] = vsp[vcnt].fy[0] = py[i]; - vcnt++; - } - - - for (i=0; i= 0)) return(1); - } - return(0); -} - -static int32_t domostpolymethod = 0; - -void domost(float x0, float y0, float x1, float y1) -{ - double dpx[4], dpy[4]; - float d, f, n, t, slop, dx, dx0, dx1, nx, nx0, ny0, nx1, ny1; - float spx[4], spy[4], cy[2], cv[2]; - int32_t i, j, k, z, ni, vcnt = 0, scnt, newi, dir, spt[4]; - - if (x0 < x1) - { - dir = 1; //clip dmost (floor) - y0 -= .01f; y1 -= .01f; - } - else - { - if (x0 == x1) return; - f = x0; x0 = x1; x1 = f; - f = y0; y0 = y1; y1 = f; - dir = 0; //clip umost (ceiling) - //y0 += .01; y1 += .01; //necessary? - } - - slop = (y1-y0)/(x1-x0); - for (i=vsp[0].n; i; i=newi) - { - newi = vsp[i].n; nx0 = vsp[i].x; nx1 = vsp[newi].x; - if ((x0 >= nx1) || (nx0 >= x1) || (vsp[i].ctag <= 0)) continue; - dx = nx1-nx0; - cy[0] = vsp[i].cy[0]; cv[0] = vsp[i].cy[1]-cy[0]; - cy[1] = vsp[i].fy[0]; cv[1] = vsp[i].fy[1]-cy[1]; - - scnt = 0; - - //Test if left edge requires split (x0,y0) (nx0,cy(0)), - if ((x0 > nx0) && (x0 < nx1)) - { - t = (x0-nx0)*cv[dir] - (y0-cy[dir])*dx; - if (((!dir) && (t < 0)) || ((dir) && (t > 0))) - { spx[scnt] = x0; spy[scnt] = y0; spt[scnt] = -1; scnt++; } - } - - //Test for intersection on umost (j == 0) and dmost (j == 1) - for (j=0; j<2; j++) - { - d = (y0-y1)*dx - (x0-x1)*cv[j]; - n = (y0-cy[j])*dx - (x0-nx0)*cv[j]; - if ((fabs(n) <= fabs(d)) && (d *n >= 0) && (d != 0)) - { - t = n/d; nx = (x1-x0)*t + x0; - if ((nx > nx0) && (nx < nx1)) - { - spx[scnt] = nx; spy[scnt] = (y1-y0)*t + y0; - spt[scnt] = j; scnt++; - } - } - } - - //Nice hack to avoid full sort later :) - if ((scnt >= 2) && (spx[scnt-1] < spx[scnt-2])) - { - f = spx[scnt-1]; spx[scnt-1] = spx[scnt-2]; spx[scnt-2] = f; - f = spy[scnt-1]; spy[scnt-1] = spy[scnt-2]; spy[scnt-2] = f; - j = spt[scnt-1]; spt[scnt-1] = spt[scnt-2]; spt[scnt-2] = j; - } - - //Test if right edge requires split - if ((x1 > nx0) && (x1 < nx1)) - { - t = (x1-nx0)*cv[dir] - (y1-cy[dir])*dx; - if (((!dir) && (t < 0)) || ((dir) && (t > 0))) - { spx[scnt] = x1; spy[scnt] = y1; spt[scnt] = -1; scnt++; } - } - - vsp[i].tag = vsp[newi].tag = -1; - for (z=0; z<=scnt; z++,i=vcnt) - { - if (z < scnt) - { - vcnt = vsinsaft(i); - t = (spx[z]-nx0)/dx; - vsp[i].cy[1] = t*cv[0] + cy[0]; - vsp[i].fy[1] = t*cv[1] + cy[1]; - vsp[vcnt].x = spx[z]; - vsp[vcnt].cy[0] = vsp[i].cy[1]; - vsp[vcnt].fy[0] = vsp[i].fy[1]; - vsp[vcnt].tag = spt[z]; - } - - ni = vsp[i].n; if (!ni) continue; //this 'if' fixes many bugs! - dx0 = vsp[i].x; if (x0 > dx0) continue; - dx1 = vsp[ni].x; if (x1 < dx1) continue; - ny0 = (dx0-x0)*slop + y0; - ny1 = (dx1-x0)*slop + y0; - - // dx0 dx1 - // ~ ~ - //---------------------------- - // t0+=0 t1+=0 - // vsp[i].cy[0] vsp[i].cy[1] - //============================ - // t0+=1 t1+=3 - //============================ - // vsp[i].fy[0] vsp[i].fy[1] - // t0+=2 t1+=6 - // - // ny0 ? ny1 ? - - k = 1+3; - if ((vsp[i].tag == 0) || (ny0 <= vsp[i].cy[0]+.01)) k--; - if ((vsp[i].tag == 1) || (ny0 >= vsp[i].fy[0]-.01)) k++; - if ((vsp[ni].tag == 0) || (ny1 <= vsp[i].cy[1]+.01)) k -= 3; - if ((vsp[ni].tag == 1) || (ny1 >= vsp[i].fy[1]-.01)) k += 3; - - if (!dir) - { - switch (k) - { - case 1: - case 2: - dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; - dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; - dpx[2] = dx0; dpy[2] = ny0; drawpoly(dpx,dpy,3,domostpolymethod); - vsp[i].cy[0] = ny0; vsp[i].ctag = gtag; break; - case 3: - case 6: - dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; - dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; - dpx[2] = dx1; dpy[2] = ny1; drawpoly(dpx,dpy,3,domostpolymethod); - vsp[i].cy[1] = ny1; vsp[i].ctag = gtag; break; - case 4: - case 5: - case 7: - dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; - dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; - dpx[2] = dx1; dpy[2] = ny1; - dpx[3] = dx0; dpy[3] = ny0; drawpoly(dpx,dpy,4,domostpolymethod); - vsp[i].cy[0] = ny0; vsp[i].cy[1] = ny1; vsp[i].ctag = gtag; break; - case 8: - dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; - dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; - dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; - dpx[3] = dx0; dpy[3] = vsp[i].fy[0]; drawpoly(dpx,dpy,4,domostpolymethod); - vsp[i].ctag = vsp[i].ftag = -1; break; - default: - break; - } - } - else - { - switch (k) - { - case 7: - case 6: - dpx[0] = dx0; dpy[0] = ny0; - dpx[1] = dx1; dpy[1] = vsp[i].fy[1]; - dpx[2] = dx0; dpy[2] = vsp[i].fy[0]; drawpoly(dpx,dpy,3,domostpolymethod); - vsp[i].fy[0] = ny0; vsp[i].ftag = gtag; break; - case 5: - case 2: - dpx[0] = dx0; dpy[0] = vsp[i].fy[0]; - dpx[1] = dx1; dpy[1] = ny1; - dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; drawpoly(dpx,dpy,3,domostpolymethod); - vsp[i].fy[1] = ny1; vsp[i].ftag = gtag; break; - case 4: - case 3: - case 1: - dpx[0] = dx0; dpy[0] = ny0; - dpx[1] = dx1; dpy[1] = ny1; - dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; - dpx[3] = dx0; dpy[3] = vsp[i].fy[0]; drawpoly(dpx,dpy,4,domostpolymethod); - vsp[i].fy[0] = ny0; vsp[i].fy[1] = ny1; vsp[i].ftag = gtag; break; - case 0: - dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; - dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; - dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; - dpx[3] = dx0; dpy[3] = vsp[i].fy[0]; drawpoly(dpx,dpy,4,domostpolymethod); - vsp[i].ctag = vsp[i].ftag = -1; break; - default: - break; - } - } - } - } - - gtag++; - - //Combine neighboring vertical strips with matching collinear top&bottom edges - //This prevents x-splits from propagating through the entire scan - i = vsp[0].n; - while (i) - { - ni = vsp[i].n; - if ((vsp[i].cy[0] >= vsp[i].fy[0]) && (vsp[i].cy[1] >= vsp[i].fy[1])) { vsp[i].ctag = vsp[i].ftag = -1; } - if ((vsp[i].ctag == vsp[ni].ctag) && (vsp[i].ftag == vsp[ni].ftag)) - { vsp[i].cy[1] = vsp[ni].cy[1]; vsp[i].fy[1] = vsp[ni].fy[1]; vsdel(ni); } - else i = ni; - } -} - -static void polymost_scansector(int32_t sectnum); - -static void polymost_drawalls(int32_t bunch) -{ - sectortype *sec, *nextsec; - walltype *wal, *wal2, *nwal; - double ox, oy, oz, ox2, oy2, px[3], py[3], dd[3], uu[3], vv[3]; - double fx, fy, x0, x1, cy0, cy1, fy0, fy1, xp0, yp0, xp1, yp1, ryp0, ryp1, nx0, ny0, nx1, ny1; - double t, r, t0, t1, ocy0, ocy1, ofy0, ofy1, oxp0, oyp0, ft[4]; - double oguo, ogux, oguy; - int32_t i, x, y, z, cz, fz, wallnum, sectnum, nextsectnum; - int32_t ypan,yoffs; // for panning correction - - sectnum = thesector[bunchfirst[bunch]]; sec = §or[sectnum]; - -#if 0 // USE_OPENGL - if (!nofog) - { - if (rendmode >= 3) - { - float col[4]; - col[0] = (float)palookupfog[sec->floorpal].r / 63.f; - col[1] = (float)palookupfog[sec->floorpal].g / 63.f; - col[2] = (float)palookupfog[sec->floorpal].b / 63.f; - col[3] = 0; - bglFogfv(GL_FOG_COLOR,col); - bglFogf(GL_FOG_DENSITY,fogcalc(sec->floorshade,sec->visibility)); - - // bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); - } - } -#endif - - //DRAW WALLS SECTION! - for (z=bunchfirst[bunch]; z>=0; z=p2[z]) - { - wallnum = thewall[z]; wal = &wall[wallnum]; wal2 = &wall[wal->point2]; - nextsectnum = wal->nextsector; - nextsec = nextsectnum>=0 ? §or[nextsectnum] : NULL; - - //Offset&Rotate 3D coordinates to screen 3D space - x = wal->x-globalposx; y = wal->y-globalposy; - xp0 = (double)y*gcosang - (double)x*gsinang; - yp0 = (double)x*gcosang2 + (double)y*gsinang2; - x = wal2->x-globalposx; y = wal2->y-globalposy; - xp1 = (double)y*gcosang - (double)x*gsinang; - yp1 = (double)x*gcosang2 + (double)y*gsinang2; - - oxp0 = xp0; oyp0 = yp0; - - //Clip to close parallel-screen plane - if (yp0 < SCISDIST) - { - if (yp1 < SCISDIST) continue; - t0 = (SCISDIST-yp0)/(yp1-yp0); xp0 = (xp1-xp0)*t0+xp0; yp0 = SCISDIST; - nx0 = (wal2->x-wal->x)*t0+wal->x; - ny0 = (wal2->y-wal->y)*t0+wal->y; - } - else { t0 = 0.f; nx0 = wal->x; ny0 = wal->y; } - if (yp1 < SCISDIST) - { - t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; - nx1 = (wal2->x-wal->x)*t1+wal->x; - ny1 = (wal2->y-wal->y)*t1+wal->y; - } - else { t1 = 1.f; nx1 = wal2->x; ny1 = wal2->y; } - - ryp0 = 1.f/yp0; ryp1 = 1.f/yp1; - - //Generate screen coordinates for front side of wall - x0 = ghalfx*xp0*ryp0 + ghalfx; - x1 = ghalfx*xp1*ryp1 + ghalfx; - if (x1 <= x0) continue; - - ryp0 *= gyxscale; ryp1 *= gyxscale; - - getzsofslope(sectnum,(int32_t)nx0,(int32_t)ny0,&cz,&fz); - cy0 = ((float)(cz-globalposz))*ryp0 + ghoriz; - fy0 = ((float)(fz-globalposz))*ryp0 + ghoriz; - getzsofslope(sectnum,(int32_t)nx1,(int32_t)ny1,&cz,&fz); - cy1 = ((float)(cz-globalposz))*ryp1 + ghoriz; - fy1 = ((float)(fz-globalposz))*ryp1 + ghoriz; - - - globalpicnum = sec->floorpicnum; globalshade = sec->floorshade; globalpal = (int32_t)((uint8_t)sec->floorpal); - globalorientation = sec->floorstat; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,sectnum); - if (!(globalorientation&1)) - { - //(singlobalang/-16384*(sx-ghalfx) + 0*(sy-ghoriz) + (cosviewingrangeglobalang/16384)*ghalfx)*d + globalposx = u*16 - //(cosglobalang/ 16384*(sx-ghalfx) + 0*(sy-ghoriz) + (sinviewingrangeglobalang/16384)*ghalfx)*d + globalposy = v*16 - //( 0*(sx-ghalfx) + 1*(sy-ghoriz) + ( 0)*ghalfx)*d + globalposz/16 = (sec->floorz/16) - if (!(globalorientation&64)) - { ft[0] = globalposx; ft[1] = globalposy; ft[2] = cosglobalang; ft[3] = singlobalang; } - else - { - //relative alignment - fx = (double)(wall[wall[sec->wallptr].point2].x-wall[sec->wallptr].x); - fy = (double)(wall[wall[sec->wallptr].point2].y-wall[sec->wallptr].y); - r = 1.0/sqrt(fx*fx+fy*fy); fx *= r; fy *= r; - ft[2] = cosglobalang*fx + singlobalang*fy; - ft[3] = singlobalang*fx - cosglobalang*fy; - ft[0] = ((double)(globalposx-wall[sec->wallptr].x))*fx + ((double)(globalposy-wall[sec->wallptr].y))*fy; - ft[1] = ((double)(globalposy-wall[sec->wallptr].y))*fx - ((double)(globalposx-wall[sec->wallptr].x))*fy; - if (!(globalorientation&4)) globalorientation ^= 32; else globalorientation ^= 16; - } - gdx = 0; - gdy = gxyaspect; if (!(globalorientation&2)) gdy /= (double)(sec->floorz-globalposz); - gdo = -ghoriz*gdy; - if (globalorientation&8) { ft[0] /= 8; ft[1] /= -8; ft[2] /= 2097152; ft[3] /= 2097152; } - else { ft[0] /= 16; ft[1] /= -16; ft[2] /= 4194304; ft[3] /= 4194304; } - gux = (double)ft[3]*((double)viewingrange)/-65536.0; - gvx = (double)ft[2]*((double)viewingrange)/-65536.0; - guy = (double)ft[0]*gdy; gvy = (double)ft[1]*gdy; - guo = (double)ft[0]*gdo; gvo = (double)ft[1]*gdo; - guo += (double)(ft[2]-gux)*ghalfx; - gvo -= (double)(ft[3]+gvx)*ghalfx; - - //Texture flipping - if (globalorientation&4) - { - r = gux; gux = gvx; gvx = r; - r = guy; guy = gvy; gvy = r; - r = guo; guo = gvo; gvo = r; - } - if (globalorientation&16) { gux = -gux; guy = -guy; guo = -guo; } - if (globalorientation&32) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } - - //Texture panning - fx = (float)sec->floorxpanning*((float)(1<<(picsiz[globalpicnum]&15)))/256.0; - fy = (float)sec->floorypanning*((float)(1<<(picsiz[globalpicnum]>>4)))/256.0; - if ((globalorientation&(2+64)) == (2+64)) //Hack for panning for slopes w/ relative alignment - { - r = (float)sec->floorheinum / 4096.0; r = 1.0/sqrt(r*r+1); - if (!(globalorientation&4)) fy *= r; else fx *= r; - } - guy += gdy*fx; guo += gdo*fx; - gvy += gdy*fy; gvo += gdo*fy; - - if (globalorientation&2) //slopes - { - px[0] = x0; py[0] = ryp0 + ghoriz; - px[1] = x1; py[1] = ryp1 + ghoriz; - - //Pick some point guaranteed to be not collinear to the 1st two points - ox = nx0 + (ny1-ny0); - oy = ny0 + (nx0-nx1); - ox2 = (double)(oy-globalposy)*gcosang - (double)(ox-globalposx)*gsinang; - oy2 = (double)(ox-globalposx)*gcosang2 + (double)(oy-globalposy)*gsinang2; - oy2 = 1.0/oy2; - px[2] = ghalfx*ox2*oy2 + ghalfx; oy2 *= gyxscale; - py[2] = oy2 + ghoriz; - - for (i=0; i<3; i++) - { - dd[i] = px[i]*gdx + py[i]*gdy + gdo; - uu[i] = px[i]*gux + py[i]*guy + guo; - vv[i] = px[i]*gvx + py[i]*gvy + gvo; - } - - py[0] = fy0; - py[1] = fy1; - py[2] = (getflorzofslope(sectnum,(int32_t)ox,(int32_t)oy)-globalposz)*oy2 + ghoriz; - - ox = py[1]-py[2]; oy = py[2]-py[0]; oz = py[0]-py[1]; - r = 1.0 / (ox*px[0] + oy*px[1] + oz*px[2]); - gdx = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - gux = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - gvx = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - ox = px[2]-px[1]; oy = px[0]-px[2]; oz = px[1]-px[0]; - gdy = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - guy = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - gvy = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - gdo = dd[0] - px[0]*gdx - py[0]*gdy; - guo = uu[0] - px[0]*gux - py[0]*guy; - gvo = vv[0] - px[0]*gvx - py[0]*gvy; - - if (globalorientation&64) //Hack for relative alignment on slopes - { - r = (float)sec->floorheinum / 4096.0; - r = sqrt(r*r+1); - if (!(globalorientation&4)) { gvx *= r; gvy *= r; gvo *= r; } - else { gux *= r; guy *= r; guo *= r; } - } - } - domostpolymethod = (globalorientation>>7)&3; - if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling -#ifdef USE_OPENGL - if (!nofog) - { - fogcalc(sec->floorshade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - } -#endif - pow2xsplit = 0; domost(x0,fy0,x1,fy1); //flor - domostpolymethod = 0; - } - else if ((nextsectnum < 0) || (!(sector[nextsectnum].floorstat&1))) - { - //Parallaxing sky... hacked for Ken's mountain texture; paper-sky only :/ -#ifdef USE_OPENGL - if (rendmode >= 3) - { - /* if (!nofog) { - bglDisable(GL_FOG); - //r = ((float)globalpisibility)*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; - //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); - //bglFogf(GL_FOG_DENSITY,r); - } */ - - if (!nofog) - { - fogcalc(sec->floorshade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult * 0.005); - bglFogfv(GL_FOG_COLOR,fogcol); - } - - //Use clamping for tiled sky textures - for (i=(1<0; i--) - if (pskyoff[i] != pskyoff[i-1]) - { skyclamphack = r_parallaxskyclamping; break; } - } -#endif - if (bpp == 8 || !usehightile || !hicfindsubst(globalpicnum,globalpal,1)) - { - dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size! - t = (double)((1<<(picsiz[globalpicnum]&15))<>1)+parallaxyoffs)) - vv[1]*ghoriz; - i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i; - vv[0] += dd[0]*((double)((r_parallaxskypanning)?sec->floorypanning:0))*((double)i)/256.0; - - - //Hack to draw black rectangle below sky when looking down... - gdx = 0; gdy = gxyaspect / 262144.0; gdo = -ghoriz*gdy; - gux = 0; guy = 0; guo = 0; - gvx = 0; gvy = (double)(tilesizy[globalpicnum]-1)*gdy; gvo = (double)(tilesizy[globalpicnum-1])*gdo; - oy = (((double)tilesizy[globalpicnum])*dd[0]-vv[0])/vv[1]; - if ((oy > fy0) && (oy > fy1)) domost(x0,oy,x1,oy); - else if ((oy > fy0) != (oy > fy1)) - { - // fy0 fy1 - // \ / - //oy---------- oy---------- - // \ / - // fy1 fy0 - ox = (oy-fy0)*(x1-x0)/(fy1-fy0) + x0; - if (oy > fy0) { domost(x0,oy,ox,oy); domost(ox,oy,x1,fy1); } - else { domost(x0,fy0,ox,oy); domost(ox,oy,x1,oy); } - } - else domost(x0,fy0,x1,fy1); - - - gdx = 0; gdy = 0; gdo = dd[0]; - gux = gdo*(t*((double)xdimscale)*((double)yxaspect)*((double)viewingrange))/(16384.0*65536.0*65536.0*5.0*1024.0); - guy = 0; //guo calculated later - gvx = 0; gvy = vv[1]; gvo = vv[0]; - - i = globalpicnum; r = (fy1-fy0)/(x1-x0); //slope of line - oy = ((double)viewingrange)/(ghalfx*256.0); oz = 1/oy; - - y = ((((int32_t)((x0-ghalfx)*oy))+globalang)>>(11-pskybits)); - fx = x0; - do - { - globalpicnum = pskyoff[y&((1<floorxpanning:0)) - gux*ghalfx; - y++; - ox = fx; fx = ((double)((y<<(11-pskybits))-globalang))*oz+ghalfx; - if (fx > x1) { fx = x1; i = -1; } - - pow2xsplit = 0; domost(ox,(ox-x0)*r+fy0,fx,(fx-x0)*r+fy0); //flor - } - while (i >= 0); - - } - else //NOTE: code copied from ceiling code... lots of duplicated stuff :/ - { - //Skybox code for parallax ceiling! - double _xp0, _yp0, _xp1, _yp1, _oxp0, _oyp0, _t0, _t1, _nx0, _ny0, _nx1, _ny1; - double _ryp0, _ryp1, _x0, _x1, _cy0, _fy0, _cy1, _fy1, _ox0, _ox1; - double nfy0, nfy1; - int32_t skywalx[4] = {-512,512,512,-512}, skywaly[4] = {-512,-512,512,512}; - - pow2xsplit = 0; - skyclamphack = 1; - - for (i=0; i<4; i++) - { - x = skywalx[i&3]; y = skywaly[i&3]; - _xp0 = (double)y*gcosang - (double)x*gsinang; - _yp0 = (double)x*gcosang2 + (double)y*gsinang2; - x = skywalx[(i+1)&3]; y = skywaly[(i+1)&3]; - _xp1 = (double)y*gcosang - (double)x*gsinang; - _yp1 = (double)x*gcosang2 + (double)y*gsinang2; - - _oxp0 = _xp0; _oyp0 = _yp0; - - //Clip to close parallel-screen plane - if (_yp0 < SCISDIST) - { - if (_yp1 < SCISDIST) continue; - _t0 = (SCISDIST-_yp0)/(_yp1-_yp0); _xp0 = (_xp1-_xp0)*_t0+_xp0; _yp0 = SCISDIST; - _nx0 = (skywalx[(i+1)&3]-skywalx[i&3])*_t0+skywalx[i&3]; - _ny0 = (skywaly[(i+1)&3]-skywaly[i&3])*_t0+skywaly[i&3]; - } - else { _t0 = 0.f; _nx0 = skywalx[i&3]; _ny0 = skywaly[i&3]; } - if (_yp1 < SCISDIST) - { - _t1 = (SCISDIST-_oyp0)/(_yp1-_oyp0); _xp1 = (_xp1-_oxp0)*_t1+_oxp0; _yp1 = SCISDIST; - _nx1 = (skywalx[(i+1)&3]-skywalx[i&3])*_t1+skywalx[i&3]; - _ny1 = (skywaly[(i+1)&3]-skywaly[i&3])*_t1+skywaly[i&3]; - } - else { _t1 = 1.f; _nx1 = skywalx[(i+1)&3]; _ny1 = skywaly[(i+1)&3]; } - - _ryp0 = 1.f/_yp0; _ryp1 = 1.f/_yp1; - - //Generate screen coordinates for front side of wall - _x0 = ghalfx*_xp0*_ryp0 + ghalfx; - _x1 = ghalfx*_xp1*_ryp1 + ghalfx; - if (_x1 <= _x0) continue; - if ((_x0 >= x1) || (x0 >= _x1)) continue; - - _ryp0 *= gyxscale; _ryp1 *= gyxscale; - - _cy0 = -8192.f*_ryp0 + ghoriz; - _fy0 = 8192.f*_ryp0 + ghoriz; - _cy1 = -8192.f*_ryp1 + ghoriz; - _fy1 = 8192.f*_ryp1 + ghoriz; - - _ox0 = _x0; _ox1 = _x1; - - //Make sure: x0<=_x0<_x1<=_x1 - nfy0 = fy0; nfy1 = fy1; - if (_x0 < x0) - { - t = (x0-_x0)/(_x1-_x0); - _cy0 += (_cy1-_cy0)*t; - _fy0 += (_fy1-_fy0)*t; - _x0 = x0; - } - else if (_x0 > x0) nfy0 += (_x0-x0)*(fy1-fy0)/(x1-x0); - if (_x1 > x1) - { - t = (x1-_x1)/(_x1-_x0); - _cy1 += (_cy1-_cy0)*t; - _fy1 += (_fy1-_fy0)*t; - _x1 = x1; - } - else if (_x1 < x1) nfy1 += (_x1-x1)*(fy1-fy0)/(x1-x0); - - // (skybox floor) - //(_x0,_fy0)-(_x1,_fy1) - // (skybox wall) - //(_x0,_cy0)-(_x1,_cy1) - // (skybox ceiling) - //(_x0,nfy0)-(_x1,nfy1) - - //ceiling of skybox - ft[0] = 512/16; ft[1] = 512/-16; - ft[2] = ((float)cosglobalang)*(1.f/2147483648.f); - ft[3] = ((float)singlobalang)*(1.f/2147483648.f); - gdx = 0; - gdy = gxyaspect*(1.f/4194304.f); - gdo = -ghoriz*gdy; - gux = (double)ft[3]*((double)viewingrange)/-65536.0; - gvx = (double)ft[2]*((double)viewingrange)/-65536.0; - guy = (double)ft[0]*gdy; gvy = (double)ft[1]*gdy; - guo = (double)ft[0]*gdo; gvo = (double)ft[1]*gdo; - guo += (double)(ft[2]-gux)*ghalfx; - gvo -= (double)(ft[3]+gvx)*ghalfx; - gvx = -gvx; gvy = -gvy; gvo = -gvo; //y-flip skybox floor -#ifdef USE_OPENGL - drawingskybox = 6; //ceiling/5th texture/index 4 of skybox -#endif - if ((_fy0 > nfy0) && (_fy1 > nfy1)) domost(_x0,_fy0,_x1,_fy1); - else if ((_fy0 > nfy0) != (_fy1 > nfy1)) - { - //(ox,oy) is intersection of: (_x0,_cy0)-(_x1,_cy1) - // (_x0,nfy0)-(_x1,nfy1) - //ox = _x0 + (_x1-_x0)*t - //oy = _cy0 + (_cy1-_cy0)*t - //oy = nfy0 + (nfy1-nfy0)*t - t = (_fy0-nfy0)/(nfy1-nfy0-_fy1+_fy0); - ox = _x0 + (_x1-_x0)*t; - oy = _fy0 + (_fy1-_fy0)*t; - if (nfy0 > _fy0) { domost(_x0,nfy0,ox,oy); domost(ox,oy,_x1,_fy1); } - else { domost(_x0,_fy0,ox,oy); domost(ox,oy,_x1,nfy1); } - } - else domost(_x0,nfy0,_x1,nfy1); - - //wall of skybox -#ifdef USE_OPENGL - drawingskybox = i+1; //i+1th texture/index i of skybox -#endif - gdx = (_ryp0-_ryp1)*gxyaspect*(1.f/512.f) / (_ox0-_ox1); - gdy = 0; - gdo = _ryp0*gxyaspect*(1.f/512.f) - gdx*_ox0; - gux = (_t0*_ryp0 - _t1*_ryp1)*gxyaspect*(64.f/512.f) / (_ox0-_ox1); - guo = _t0*_ryp0*gxyaspect*(64.f/512.f) - gux*_ox0; - guy = 0; - _t0 = -8192.0*_ryp0 + ghoriz; - _t1 = -8192.0*_ryp1 + ghoriz; - t = ((gdx*_ox0 + gdo)*8.f) / ((_ox1-_ox0) * _ryp0 * 2048.f); - gvx = (_t0-_t1)*t; - gvy = (_ox1-_ox0)*t; - gvo = -gvx*_ox0 - gvy*_t0; - if ((_cy0 > nfy0) && (_cy1 > nfy1)) domost(_x0,_cy0,_x1,_cy1); - else if ((_cy0 > nfy0) != (_cy1 > nfy1)) - { - //(ox,oy) is intersection of: (_x0,_fy0)-(_x1,_fy1) - // (_x0,nfy0)-(_x1,nfy1) - //ox = _x0 + (_x1-_x0)*t - //oy = _fy0 + (_fy1-_fy0)*t - //oy = nfy0 + (nfy1-nfy0)*t - t = (_cy0-nfy0)/(nfy1-nfy0-_cy1+_cy0); - ox = _x0 + (_x1-_x0)*t; - oy = _cy0 + (_cy1-_cy0)*t; - if (nfy0 > _cy0) { domost(_x0,nfy0,ox,oy); domost(ox,oy,_x1,_cy1); } - else { domost(_x0,_cy0,ox,oy); domost(ox,oy,_x1,nfy1); } - } - else domost(_x0,nfy0,_x1,nfy1); - } - - //Floor of skybox -#ifdef USE_OPENGL - drawingskybox = 5; //floor/6th texture/index 5 of skybox -#endif - ft[0] = 512/16; ft[1] = -512/-16; - ft[2] = ((float)cosglobalang)*(1.f/2147483648.f); - ft[3] = ((float)singlobalang)*(1.f/2147483648.f); - gdx = 0; - gdy = gxyaspect*(-1.f/4194304.f); - gdo = -ghoriz*gdy; - gux = (double)ft[3]*((double)viewingrange)/-65536.0; - gvx = (double)ft[2]*((double)viewingrange)/-65536.0; - guy = (double)ft[0]*gdy; gvy = (double)ft[1]*gdy; - guo = (double)ft[0]*gdo; gvo = (double)ft[1]*gdo; - guo += (double)(ft[2]-gux)*ghalfx; - gvo -= (double)(ft[3]+gvx)*ghalfx; - domost(x0,fy0,x1,fy1); - - skyclamphack = 0; -#ifdef USE_OPENGL - drawingskybox = 0; -#endif - } -#ifdef USE_OPENGL - if (rendmode >= 3) - { - skyclamphack = 0; - if (!nofog) - { - bglEnable(GL_FOG); - //bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); - } - } -#endif - } - - globalpicnum = sec->ceilingpicnum; globalshade = sec->ceilingshade; globalpal = (int32_t)((uint8_t)sec->ceilingpal); - globalorientation = sec->ceilingstat; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,sectnum); - if (!(globalorientation&1)) - { - if (!(globalorientation&64)) - { ft[0] = globalposx; ft[1] = globalposy; ft[2] = cosglobalang; ft[3] = singlobalang; } - else - { - //relative alignment - fx = (double)(wall[wall[sec->wallptr].point2].x-wall[sec->wallptr].x); - fy = (double)(wall[wall[sec->wallptr].point2].y-wall[sec->wallptr].y); - r = 1.0/sqrt(fx*fx+fy*fy); fx *= r; fy *= r; - ft[2] = cosglobalang*fx + singlobalang*fy; - ft[3] = singlobalang*fx - cosglobalang*fy; - ft[0] = ((double)(globalposx-wall[sec->wallptr].x))*fx + ((double)(globalposy-wall[sec->wallptr].y))*fy; - ft[1] = ((double)(globalposy-wall[sec->wallptr].y))*fx - ((double)(globalposx-wall[sec->wallptr].x))*fy; - if (!(globalorientation&4)) globalorientation ^= 32; else globalorientation ^= 16; - } - gdx = 0; - gdy = gxyaspect; - if (!(globalorientation&2)) gdy /= (double)(sec->ceilingz-globalposz); - gdo = -ghoriz*gdy; - if (globalorientation&8) { ft[0] /= 8; ft[1] /= -8; ft[2] /= 2097152; ft[3] /= 2097152; } - else { ft[0] /= 16; ft[1] /= -16; ft[2] /= 4194304; ft[3] /= 4194304; } - gux = (double)ft[3]*((double)viewingrange)/-65536.0; - gvx = (double)ft[2]*((double)viewingrange)/-65536.0; - guy = (double)ft[0]*gdy; gvy = (double)ft[1]*gdy; - guo = (double)ft[0]*gdo; gvo = (double)ft[1]*gdo; - guo += (double)(ft[2]-gux)*ghalfx; - gvo -= (double)(ft[3]+gvx)*ghalfx; - - //Texture flipping - if (globalorientation&4) - { - r = gux; gux = gvx; gvx = r; - r = guy; guy = gvy; gvy = r; - r = guo; guo = gvo; gvo = r; - } - if (globalorientation&16) { gux = -gux; guy = -guy; guo = -guo; } - if (globalorientation&32) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } - - //Texture panning - fx = (float)sec->ceilingxpanning*((float)(1<<(picsiz[globalpicnum]&15)))/256.0; - fy = (float)sec->ceilingypanning*((float)(1<<(picsiz[globalpicnum]>>4)))/256.0; - if ((globalorientation&(2+64)) == (2+64)) //Hack for panning for slopes w/ relative alignment - { - r = (float)sec->ceilingheinum / 4096.0; r = 1.0/sqrt(r*r+1); - if (!(globalorientation&4)) fy *= r; else fx *= r; - } - guy += gdy*fx; guo += gdo*fx; - gvy += gdy*fy; gvo += gdo*fy; - - if (globalorientation&2) //slopes - { - px[0] = x0; py[0] = ryp0 + ghoriz; - px[1] = x1; py[1] = ryp1 + ghoriz; - - //Pick some point guaranteed to be not collinear to the 1st two points - ox = nx0 + (ny1-ny0); - oy = ny0 + (nx0-nx1); - ox2 = (double)(oy-globalposy)*gcosang - (double)(ox-globalposx)*gsinang ; - oy2 = (double)(ox-globalposx)*gcosang2 + (double)(oy-globalposy)*gsinang2; - oy2 = 1.0/oy2; - px[2] = ghalfx*ox2*oy2 + ghalfx; oy2 *= gyxscale; - py[2] = oy2 + ghoriz; - - for (i=0; i<3; i++) - { - dd[i] = px[i]*gdx + py[i]*gdy + gdo; - uu[i] = px[i]*gux + py[i]*guy + guo; - vv[i] = px[i]*gvx + py[i]*gvy + gvo; - } - - py[0] = cy0; - py[1] = cy1; - py[2] = (getceilzofslope(sectnum,(int32_t)ox,(int32_t)oy)-globalposz)*oy2 + ghoriz; - - ox = py[1]-py[2]; oy = py[2]-py[0]; oz = py[0]-py[1]; - r = 1.0 / (ox*px[0] + oy*px[1] + oz*px[2]); - gdx = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - gux = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - gvx = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - ox = px[2]-px[1]; oy = px[0]-px[2]; oz = px[1]-px[0]; - gdy = (ox*dd[0] + oy*dd[1] + oz*dd[2])*r; - guy = (ox*uu[0] + oy*uu[1] + oz*uu[2])*r; - gvy = (ox*vv[0] + oy*vv[1] + oz*vv[2])*r; - gdo = dd[0] - px[0]*gdx - py[0]*gdy; - guo = uu[0] - px[0]*gux - py[0]*guy; - gvo = vv[0] - px[0]*gvx - py[0]*gvy; - - if (globalorientation&64) //Hack for relative alignment on slopes - { - r = (float)sec->ceilingheinum / 4096.0; - r = sqrt(r*r+1); - if (!(globalorientation&4)) { gvx *= r; gvy *= r; gvo *= r; } - else { gux *= r; guy *= r; guo *= r; } - } - } - domostpolymethod = (globalorientation>>7)&3; - if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling -#ifdef USE_OPENGL - if (!nofog) - { - fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - } -#endif - pow2xsplit = 0; domost(x1,cy1,x0,cy0); //ceil - domostpolymethod = 0; - } - else if ((nextsectnum < 0) || (!(sector[nextsectnum].ceilingstat&1))) - { -#ifdef USE_OPENGL - if (rendmode >= 3) - { - /* if (!nofog) { - bglDisable(GL_FOG); - //r = ((float)globalpisibility)*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; - //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); - //bglFogf(GL_FOG_DENSITY,r); - } - */ - if (!nofog) - { - fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal); - bglFogf(GL_FOG_DENSITY,fogresult * 0.005); - bglFogfv(GL_FOG_COLOR,fogcol); - } - //Use clamping for tiled sky textures - for (i=(1<0; i--) - if (pskyoff[i] != pskyoff[i-1]) - { skyclamphack = r_parallaxskyclamping; break; } - } -#endif - //Parallaxing sky... - if (bpp == 8 || !usehightile || !hicfindsubst(globalpicnum,globalpal,1)) - { - //Render for parallaxtype == 0 / paper-sky - dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size! - t = (double)((1<<(picsiz[globalpicnum]&15))<>1)+parallaxyoffs)) - vv[1]*ghoriz; - i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i; - vv[0] += dd[0]*((double)((r_parallaxskypanning)?sec->ceilingypanning:0))*((double)i)/256.0; - - //Hack to draw black rectangle below sky when looking down... - gdx = 0; gdy = gxyaspect / -262144.0; gdo = -ghoriz*gdy; - gux = 0; guy = 0; guo = 0; - gvx = 0; gvy = 0; gvo = 0; - oy = -vv[0]/vv[1]; - if ((oy < cy0) && (oy < cy1)) domost(x1,oy,x0,oy); - else if ((oy < cy0) != (oy < cy1)) - { - /* cy1 cy0 - // / \ - //oy---------- oy--------- - // / \ - // cy0 cy1 - */ - ox = (oy-cy0)*(x1-x0)/(cy1-cy0) + x0; - if (oy < cy0) { domost(ox,oy,x0,oy); domost(x1,cy1,ox,oy); } - else { domost(ox,oy,x0,cy0); domost(x1,oy,ox,oy); } - } - else domost(x1,cy1,x0,cy0); - - gdx = 0; gdy = 0; gdo = dd[0]; - gux = gdo*(t*((double)xdimscale)*((double)yxaspect)*((double)viewingrange))/(16384.0*65536.0*65536.0*5.0*1024.0); - guy = 0; //guo calculated later - gvx = 0; gvy = vv[1]; gvo = vv[0]; - - i = globalpicnum; r = (cy1-cy0)/(x1-x0); //slope of line - oy = ((double)viewingrange)/(ghalfx*256.0); oz = 1/oy; - - y = ((((int32_t)((x0-ghalfx)*oy))+globalang)>>(11-pskybits)); - fx = x0; - do - { - globalpicnum = pskyoff[y&((1<ceilingxpanning:0)) - gux*ghalfx; - y++; - ox = fx; fx = ((double)((y<<(11-pskybits))-globalang))*oz+ghalfx; - if (fx > x1) { fx = x1; i = -1; } - pow2xsplit = 0; domost(fx,(fx-x0)*r+cy0,ox,(ox-x0)*r+cy0); //ceil - } - while (i >= 0); - } - else - { - //Skybox code for parallax ceiling! - double _xp0, _yp0, _xp1, _yp1, _oxp0, _oyp0, _t0, _t1, _nx0, _ny0, _nx1, _ny1; - double _ryp0, _ryp1, _x0, _x1, _cy0, _fy0, _cy1, _fy1, _ox0, _ox1; - double ncy0, ncy1; - int32_t skywalx[4] = {-512,512,512,-512}, skywaly[4] = {-512,-512,512,512}; - - pow2xsplit = 0; - skyclamphack = 1; - - for (i=0; i<4; i++) - { - x = skywalx[i&3]; y = skywaly[i&3]; - _xp0 = (double)y*gcosang - (double)x*gsinang; - _yp0 = (double)x*gcosang2 + (double)y*gsinang2; - x = skywalx[(i+1)&3]; y = skywaly[(i+1)&3]; - _xp1 = (double)y*gcosang - (double)x*gsinang; - _yp1 = (double)x*gcosang2 + (double)y*gsinang2; - - _oxp0 = _xp0; _oyp0 = _yp0; - - //Clip to close parallel-screen plane - if (_yp0 < SCISDIST) - { - if (_yp1 < SCISDIST) continue; - _t0 = (SCISDIST-_yp0)/(_yp1-_yp0); _xp0 = (_xp1-_xp0)*_t0+_xp0; _yp0 = SCISDIST; - _nx0 = (skywalx[(i+1)&3]-skywalx[i&3])*_t0+skywalx[i&3]; - _ny0 = (skywaly[(i+1)&3]-skywaly[i&3])*_t0+skywaly[i&3]; - } - else { _t0 = 0.f; _nx0 = skywalx[i&3]; _ny0 = skywaly[i&3]; } - if (_yp1 < SCISDIST) - { - _t1 = (SCISDIST-_oyp0)/(_yp1-_oyp0); _xp1 = (_xp1-_oxp0)*_t1+_oxp0; _yp1 = SCISDIST; - _nx1 = (skywalx[(i+1)&3]-skywalx[i&3])*_t1+skywalx[i&3]; - _ny1 = (skywaly[(i+1)&3]-skywaly[i&3])*_t1+skywaly[i&3]; - } - else { _t1 = 1.f; _nx1 = skywalx[(i+1)&3]; _ny1 = skywaly[(i+1)&3]; } - - _ryp0 = 1.f/_yp0; _ryp1 = 1.f/_yp1; - - //Generate screen coordinates for front side of wall - _x0 = ghalfx*_xp0*_ryp0 + ghalfx; - _x1 = ghalfx*_xp1*_ryp1 + ghalfx; - if (_x1 <= _x0) continue; - if ((_x0 >= x1) || (x0 >= _x1)) continue; - - _ryp0 *= gyxscale; _ryp1 *= gyxscale; - - _cy0 = -8192.f*_ryp0 + ghoriz; - _fy0 = 8192.f*_ryp0 + ghoriz; - _cy1 = -8192.f*_ryp1 + ghoriz; - _fy1 = 8192.f*_ryp1 + ghoriz; - - _ox0 = _x0; _ox1 = _x1; - - //Make sure: x0<=_x0<_x1<=_x1 - ncy0 = cy0; ncy1 = cy1; - if (_x0 < x0) - { - t = (x0-_x0)/(_x1-_x0); - _cy0 += (_cy1-_cy0)*t; - _fy0 += (_fy1-_fy0)*t; - _x0 = x0; - } - else if (_x0 > x0) ncy0 += (_x0-x0)*(cy1-cy0)/(x1-x0); - if (_x1 > x1) - { - t = (x1-_x1)/(_x1-_x0); - _cy1 += (_cy1-_cy0)*t; - _fy1 += (_fy1-_fy0)*t; - _x1 = x1; - } - else if (_x1 < x1) ncy1 += (_x1-x1)*(cy1-cy0)/(x1-x0); - - // (skybox ceiling) - //(_x0,_cy0)-(_x1,_cy1) - // (skybox wall) - //(_x0,_fy0)-(_x1,_fy1) - // (skybox floor) - //(_x0,ncy0)-(_x1,ncy1) - - //ceiling of skybox -#ifdef USE_OPENGL - drawingskybox = 5; //ceiling/5th texture/index 4 of skybox -#endif - ft[0] = 512/16; ft[1] = -512/-16; - ft[2] = ((float)cosglobalang)*(1.f/2147483648.f); - ft[3] = ((float)singlobalang)*(1.f/2147483648.f); - gdx = 0; - gdy = gxyaspect*-(1.f/4194304.f); - gdo = -ghoriz*gdy; - gux = (double)ft[3]*((double)viewingrange)/-65536.0; - gvx = (double)ft[2]*((double)viewingrange)/-65536.0; - guy = (double)ft[0]*gdy; gvy = (double)ft[1]*gdy; - guo = (double)ft[0]*gdo; gvo = (double)ft[1]*gdo; - guo += (double)(ft[2]-gux)*ghalfx; - gvo -= (double)(ft[3]+gvx)*ghalfx; - if ((_cy0 < ncy0) && (_cy1 < ncy1)) domost(_x1,_cy1,_x0,_cy0); - else if ((_cy0 < ncy0) != (_cy1 < ncy1)) - { - //(ox,oy) is intersection of: (_x0,_cy0)-(_x1,_cy1) - // (_x0,ncy0)-(_x1,ncy1) - //ox = _x0 + (_x1-_x0)*t - //oy = _cy0 + (_cy1-_cy0)*t - //oy = ncy0 + (ncy1-ncy0)*t - t = (_cy0-ncy0)/(ncy1-ncy0-_cy1+_cy0); - ox = _x0 + (_x1-_x0)*t; - oy = _cy0 + (_cy1-_cy0)*t; - if (ncy0 < _cy0) { domost(ox,oy,_x0,ncy0); domost(_x1,_cy1,ox,oy); } - else { domost(ox,oy,_x0,_cy0); domost(_x1,ncy1,ox,oy); } - } - else domost(_x1,ncy1,_x0,ncy0); - - //wall of skybox -#ifdef USE_OPENGL - drawingskybox = i+1; //i+1th texture/index i of skybox -#endif - gdx = (_ryp0-_ryp1)*gxyaspect*(1.f/512.f) / (_ox0-_ox1); - gdy = 0; - gdo = _ryp0*gxyaspect*(1.f/512.f) - gdx*_ox0; - gux = (_t0*_ryp0 - _t1*_ryp1)*gxyaspect*(64.f/512.f) / (_ox0-_ox1); - guo = _t0*_ryp0*gxyaspect*(64.f/512.f) - gux*_ox0; - guy = 0; - _t0 = -8192.0*_ryp0 + ghoriz; - _t1 = -8192.0*_ryp1 + ghoriz; - t = ((gdx*_ox0 + gdo)*8.f) / ((_ox1-_ox0) * _ryp0 * 2048.f); - gvx = (_t0-_t1)*t; - gvy = (_ox1-_ox0)*t; - gvo = -gvx*_ox0 - gvy*_t0; - if ((_fy0 < ncy0) && (_fy1 < ncy1)) domost(_x1,_fy1,_x0,_fy0); - else if ((_fy0 < ncy0) != (_fy1 < ncy1)) - { - //(ox,oy) is intersection of: (_x0,_fy0)-(_x1,_fy1) - // (_x0,ncy0)-(_x1,ncy1) - //ox = _x0 + (_x1-_x0)*t - //oy = _fy0 + (_fy1-_fy0)*t - //oy = ncy0 + (ncy1-ncy0)*t - t = (_fy0-ncy0)/(ncy1-ncy0-_fy1+_fy0); - ox = _x0 + (_x1-_x0)*t; - oy = _fy0 + (_fy1-_fy0)*t; - if (ncy0 < _fy0) { domost(ox,oy,_x0,ncy0); domost(_x1,_fy1,ox,oy); } - else { domost(ox,oy,_x0,_fy0); domost(_x1,ncy1,ox,oy); } - } - else domost(_x1,ncy1,_x0,ncy0); - } - - //Floor of skybox -#ifdef USE_OPENGL - drawingskybox = 6; //floor/6th texture/index 5 of skybox -#endif - ft[0] = 512/16; ft[1] = 512/-16; - ft[2] = ((float)cosglobalang)*(1.f/2147483648.f); - ft[3] = ((float)singlobalang)*(1.f/2147483648.f); - gdx = 0; - gdy = gxyaspect*(1.f/4194304.f); - gdo = -ghoriz*gdy; - gux = (double)ft[3]*((double)viewingrange)/-65536.0; - gvx = (double)ft[2]*((double)viewingrange)/-65536.0; - guy = (double)ft[0]*gdy; gvy = (double)ft[1]*gdy; - guo = (double)ft[0]*gdo; gvo = (double)ft[1]*gdo; - guo += (double)(ft[2]-gux)*ghalfx; - gvo -= (double)(ft[3]+gvx)*ghalfx; - gvx = -gvx; gvy = -gvy; gvo = -gvo; //y-flip skybox floor - domost(x1,cy1,x0,cy0); - - skyclamphack = 0; -#ifdef USE_OPENGL - drawingskybox = 0; -#endif - } -#ifdef USE_OPENGL - if (rendmode >= 3) - { - skyclamphack = 0; - if (!nofog) - { - bglEnable(GL_FOG); - //bglFogf(GL_FOG_DENSITY,gvisibility*((float)((uint8_t)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); - } - } -#endif - } - - //(x0,cy0) == (u= 0,v=0,d=) - //(x1,cy0) == (u=wal->xrepeat*8,v=0) - //(x0,fy0) == (u= 0,v=v) - // u = (gux*sx + guy*sy + guo) / (gdx*sx + gdy*sy + gdo) - // v = (gvx*sx + gvy*sy + gvo) / (gdx*sx + gdy*sy + gdo) - // 0 = (gux*x0 + guy*cy0 + guo) / (gdx*x0 + gdy*cy0 + gdo) - //wal->xrepeat*8 = (gux*x1 + guy*cy0 + guo) / (gdx*x1 + gdy*cy0 + gdo) - // 0 = (gvx*x0 + gvy*cy0 + gvo) / (gdx*x0 + gdy*cy0 + gdo) - // v = (gvx*x0 + gvy*fy0 + gvo) / (gdx*x0 + gdy*fy0 + gdo) - //sx = x0, u = t0*wal->xrepeat*8, d = yp0; - //sx = x1, u = t1*wal->xrepeat*8, d = yp1; - //d = gdx*sx + gdo - //u = (gux*sx + guo) / (gdx*sx + gdo) - //yp0 = gdx*x0 + gdo - //yp1 = gdx*x1 + gdo - //t0*wal->xrepeat*8 = (gux*x0 + guo) / (gdx*x0 + gdo) - //t1*wal->xrepeat*8 = (gux*x1 + guo) / (gdx*x1 + gdo) - //gdx*x0 + gdo = yp0 - //gdx*x1 + gdo = yp1 - gdx = (ryp0-ryp1)*gxyaspect / (x0-x1); - gdy = 0; - gdo = ryp0*gxyaspect - gdx*x0; - - //gux*x0 + guo = t0*wal->xrepeat*8*yp0 - //gux*x1 + guo = t1*wal->xrepeat*8*yp1 - gux = (t0*ryp0 - t1*ryp1)*gxyaspect*(float)wal->xrepeat*8.f / (x0-x1); - guo = t0*ryp0*gxyaspect*(float)wal->xrepeat*8.f - gux*x0; - guo += (float)wal->xpanning*gdo; - gux += (float)wal->xpanning*gdx; - guy = 0; - //Derivation for u: - // (gvx*x0 + gvy*cy0 + gvo) / (gdx*x0 + gdy*cy0 + gdo) = 0 - // (gvx*x1 + gvy*cy1 + gvo) / (gdx*x1 + gdy*cy1 + gdo) = 0 - // (gvx*x0 + gvy*fy0 + gvo) / (gdx*x0 + gdy*fy0 + gdo) = v - // (gvx*x1 + gvy*fy1 + gvo) / (gdx*x1 + gdy*fy1 + gdo) = v - // (gvx*x0 + gvy*cy0 + gvo*1) = 0 - // (gvx*x1 + gvy*cy1 + gvo*1) = 0 - // (gvx*x0 + gvy*fy0 + gvo*1) = t - ogux = gux; oguy = guy; oguo = guo; - - if (nextsectnum >= 0) - { - getzsofslope(nextsectnum,(int32_t)nx0,(int32_t)ny0,&cz,&fz); - ocy0 = ((float)(cz-globalposz))*ryp0 + ghoriz; - ofy0 = ((float)(fz-globalposz))*ryp0 + ghoriz; - getzsofslope(nextsectnum,(int32_t)nx1,(int32_t)ny1,&cz,&fz); - ocy1 = ((float)(cz-globalposz))*ryp1 + ghoriz; - ofy1 = ((float)(fz-globalposz))*ryp1 + ghoriz; - - if ((wal->cstat&48) == 16) maskwall[maskwallcnt++] = z; - - if (((cy0 < ocy0) || (cy1 < ocy1)) && (!((sec->ceilingstat§or[nextsectnum].ceilingstat)&1))) - { - globalpicnum = wal->picnum; globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal); - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384); - - if (!(wal->cstat&4)) i = sector[nextsectnum].ceilingz; else i = sec->ceilingz; - t0 = ((float)(i-globalposz))*ryp0 + ghoriz; - t1 = ((float)(i-globalposz))*ryp1 + ghoriz; - t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f); - i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1; - - ypan = wal->ypanning; - ftol((i-tilesizy[globalpicnum])*(255.f/i),&yoffs); - if (wal->cstat&4) - { - if (ypan>256-yoffs) - { - ypan-=yoffs; - } - } - else - { - // not hacked yet - } - - fy = (float)ypan * ((float)i) / 256.0; - gvx = (t0-t1)*t; - gvy = (x1-x0)*t; - gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy; - - if (wal->cstat&8) //xflip - { - t = (float)(wal->xrepeat*8 + wal->xpanning*2); - gux = gdx*t - gux; - guy = gdy*t - guy; - guo = gdo*t - guo; - } - if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip -#ifdef USE_OPENGL - if (!nofog) - { - fogcalc(wal->shade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - } -#endif - pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); - if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; } - } - if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat§or[nextsectnum].floorstat)&1))) - { - if (!(wal->cstat&2)) nwal = wal; - else - { - nwal = &wall[wal->nextwall]; - guo += (float)(nwal->xpanning-wal->xpanning)*gdo; - gux += (float)(nwal->xpanning-wal->xpanning)*gdx; - guy += (float)(nwal->xpanning-wal->xpanning)*gdy; - } - globalpicnum = nwal->picnum; globalshade = nwal->shade; globalpal = (int32_t)((uint8_t)nwal->pal); - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384); - - if (!(nwal->cstat&4)) i = sector[nextsectnum].floorz; else i = sec->ceilingz; - t0 = ((float)(i-globalposz))*ryp0 + ghoriz; - t1 = ((float)(i-globalposz))*ryp1 + ghoriz; - t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f); - i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1; - - ypan = nwal->ypanning; - ftol((i-tilesizy[globalpicnum])*(255.f/i),&yoffs); - if (!(nwal->cstat&4)) - { - if (ypan>256-yoffs) - { - ypan-=yoffs; - } - } - else - { - // Still need a hack, depending on the wall(height,ypanning,yrepeat,tilesizy) - // it should do "ypan-=yoffs" or "ypan+=yoffs" or [nothing]. - // Example: the film projector in the E1L1.map needs "ypan-=yoffs" - } - - fy = (float)ypan * ((float)i) / 256.0; - gvx = (t0-t1)*t; - gvy = (x1-x0)*t; - gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy; - - if (wal->cstat&8) //xflip - { - t = (float)(wal->xrepeat*8 + nwal->xpanning*2); - gux = gdx*t - gux; - guy = gdy*t - guy; - guo = gdo*t - guo; - } - if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip -#ifdef USE_OPENGL - if (!nofog) - { - fogcalc(nwal->shade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - } -#endif - pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); - if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; } - } - } - - if ((nextsectnum < 0) || (wal->cstat&32)) //White/1-way wall - { - if (nextsectnum < 0) globalpicnum = wal->picnum; else globalpicnum = wal->overpicnum; - globalshade = wal->shade; globalpal = (int32_t)((uint8_t)wal->pal); - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384); - - if (nextsectnum >= 0) { if (!(wal->cstat&4)) i = nextsec->ceilingz; else i = sec->ceilingz; } - else { if (!(wal->cstat&4)) i = sec->ceilingz; else i = sec->floorz; } - t0 = ((float)(i-globalposz))*ryp0 + ghoriz; - t1 = ((float)(i-globalposz))*ryp1 + ghoriz; - t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f); - i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1; - - ypan = wal->ypanning; - ftol((i-tilesizy[globalpicnum])*(255.f/i),&yoffs); - if (!(wal->cstat&4)) - { - if (ypan>256-yoffs) - { - ypan-=yoffs; - } - } - else - { - // not hacked yet - } - - fy = (float)ypan * ((float)i) / 256.0; - gvx = (t0-t1)*t; - gvy = (x1-x0)*t; - gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy; - - if (wal->cstat&8) //xflip - { - t = (float)(wal->xrepeat*8 + wal->xpanning*2); - gux = gdx*t - gux; - guy = gdy*t - guy; - guo = gdo*t - guo; - } - if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip -#ifdef USE_OPENGL - if (!nofog) - { - fogcalc(wal->shade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - } -#endif - pow2xsplit = 1; domost(x0,-10000,x1,-10000); - } - - if (nextsectnum >= 0) - if ((!(gotsector[nextsectnum>>3]&pow2char[nextsectnum&7])) && (testvisiblemost(x0,x1))) - polymost_scansector(nextsectnum); - } -} - -static int32_t polymost_bunchfront(int32_t b1, int32_t b2) -{ - double x1b1, x1b2, x2b1, x2b2; - int32_t b1f, b2f, i; - - b1f = bunchfirst[b1]; x1b1 = dxb1[b1f]; x2b2 = dxb2[bunchlast[b2]]; if (x1b1 >= x2b2) return(-1); - b2f = bunchfirst[b2]; x1b2 = dxb1[b2f]; x2b1 = dxb2[bunchlast[b1]]; if (x1b2 >= x2b1) return(-1); - - if (x1b1 >= x1b2) - { - for (i=b2f; dxb2[i]<=x1b1; i=p2[i]); - return(wallfront(b1f,i)); - } - for (i=b1f; dxb2[i]<=x1b2; i=p2[i]); - return(wallfront(i,b2f)); -} - -static void polymost_scansector(int32_t sectnum) -{ - double d, xp1, yp1, xp2, yp2; - walltype *wal, *wal2; - spritetype *spr; - int32_t z, zz, startwall, endwall, numscansbefore, scanfirst, bunchfrst, nextsectnum; - int32_t xs, ys, x1, y1, x2, y2; - - if (sectnum < 0) return; - if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7]; - - sectorborder[0] = sectnum, sectorbordercnt = 1; - do - { - sectnum = sectorborder[--sectorbordercnt]; - - for (z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) - { - spr = &sprite[z]; - if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && - (spr->xrepeat > 0) && (spr->yrepeat > 0) && - (spritesortcnt < MAXSPRITESONSCREEN)) - { - xs = spr->x-globalposx; ys = spr->y-globalposy; - if ((spr->cstat&48) || (xs*gcosang+ys*gsinang > 0)) - { - copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype)); - spriteext[z].tspr = (spritetype *)&tsprite[spritesortcnt]; - tsprite[spritesortcnt++].owner = z; - } - } - } - - gotsector[sectnum>>3] |= pow2char[sectnum&7]; - - bunchfrst = numbunches; - numscansbefore = numscans; - - startwall = sector[sectnum].wallptr; endwall = sector[sectnum].wallnum+startwall; - scanfirst = numscans; - xp2 = 0; yp2 = 0; - for (z=startwall,wal=&wall[z]; zpoint2]; - x1 = wal->x-globalposx; y1 = wal->y-globalposy; - x2 = wal2->x-globalposx; y2 = wal2->y-globalposy; - - nextsectnum = wal->nextsector; //Scan close sectors - if ((nextsectnum >= 0) && (!(wal->cstat&32)) && (!(gotsector[nextsectnum>>3]&pow2char[nextsectnum&7]))) - { - d = (double)x1*(double)y2 - (double)x2*(double)y1; xp1 = (double)(x2-x1); yp1 = (double)(y2-y1); - if (d *d <= (xp1*xp1 + yp1*yp1)*(SCISDIST*SCISDIST*260.0)) - sectorborder[sectorbordercnt++] = nextsectnum; - } - - if ((z == startwall) || (wall[z-1].point2 != z)) - { - xp1 = ((double)y1*(double)cosglobalang - (double)x1*(double)singlobalang)/64.0; - yp1 = ((double)x1*(double)cosviewingrangeglobalang + (double)y1*(double)sinviewingrangeglobalang)/64.0; - } - else { xp1 = xp2; yp1 = yp2; } - xp2 = ((double)y2*(double)cosglobalang - (double)x2*(double)singlobalang)/64.0; - yp2 = ((double)x2*(double)cosviewingrangeglobalang + (double)y2*(double)sinviewingrangeglobalang)/64.0; - if ((yp1 >= SCISDIST) || (yp2 >= SCISDIST)) - if ((double)xp1*(double)yp2 < (double)xp2*(double)yp1) //if wall is facing you... - { - if (yp1 >= SCISDIST) - dxb1[numscans] = (double)xp1*ghalfx/(double)yp1 + ghalfx; - else dxb1[numscans] = -1e32; - - if (yp2 >= SCISDIST) - dxb2[numscans] = (double)xp2*ghalfx/(double)yp2 + ghalfx; - else dxb2[numscans] = 1e32; - - if (dxb1[numscans] < dxb2[numscans]) - { thesector[numscans] = sectnum; thewall[numscans] = z; p2[numscans] = numscans+1; numscans++; } - } - - if ((wall[z].point2 < z) && (scanfirst < numscans)) - { p2[numscans-1] = scanfirst; scanfirst = numscans; } - } - - for (z=numscansbefore; z dxb1[p2[z]])) - { bunchfirst[numbunches++] = p2[z]; p2[z] = -1; } - - for (z=bunchfrst; z=0; zz=p2[zz]); - bunchlast[z] = zz; - } - } - while (sectorbordercnt > 0); -} - -void polymost_drawrooms() -{ - int32_t i, j, n, n2, closest; - double ox, oy, oz, ox2, oy2, oz2, r, px[6], py[6], pz[6], px2[6], py2[6], pz2[6], sx[6], sy[6]; - - if (!rendmode) return; - - begindrawing(); - frameoffset = frameplace + windowy1*bytesperline + windowx1; - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - resizeglcheck(); - - if (editstatus) - bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - - bglDisable(GL_BLEND); - bglEnable(GL_TEXTURE_2D); - //bglTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); //default anyway - bglEnable(GL_DEPTH_TEST); - bglDepthFunc(GL_ALWAYS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS - - //bglPolygonOffset(1,1); //Supposed to make sprites pasted on walls or floors not disappear - bglDepthRange(0.00001,1.0); //<- this is more widely supported than glPolygonOffset - - //Enable this for OpenGL red-blue glasses mode :) - if (glredbluemode) - { - static int32_t grbfcnt = 0; grbfcnt++; - if (redblueclearcnt < numpages) { redblueclearcnt++; bglColorMask(1,1,1,1); bglClear(GL_COLOR_BUFFER_BIT); } - if (grbfcnt&1) - { - bglViewport(windowx1-16,yres-(windowy2+1),windowx2-(windowx1-16)+1,windowy2-windowy1+1); - bglColorMask(1,0,0,1); - globalposx += singlobalang/1024; - globalposy -= cosglobalang/1024; - } - else - { - bglViewport(windowx1,yres-(windowy2+1),windowx2+16-windowx1+1,windowy2-windowy1+1); - bglColorMask(0,1,1,1); - globalposx -= singlobalang/1024; - globalposy += cosglobalang/1024; - } - } - } -#endif - - //Polymost supports true look up/down :) Here, we convert horizon to angle. - //gchang&gshang are cos&sin of this angle (respectively) - gyxscale = ((double)xdimenscale)/131072.0; - gxyaspect = ((double)xyaspect*(double)viewingrange)*(5.0/(65536.0*262144.0)); - gviewxrange = ((double)viewingrange)*((double)xdimen)/(32768.0*1024.0); - gcosang = ((double)cosglobalang)/262144.0; - gsinang = ((double)singlobalang)/262144.0; - gcosang2 = gcosang*((double)viewingrange)/65536.0; - gsinang2 = gsinang*((double)viewingrange)/65536.0; - ghalfx = (double)halfxdimen; grhalfxdown10 = 1.0/(((double)ghalfx)*1024); - ghoriz = (double)globalhoriz; - - gvisibility = ((float)globalvisibility)*FOGSCALE; - - //global cos/sin height angle - r = (double)((ydimen>>1)-ghoriz); - gshang = r/sqrt(r*r+ghalfx*ghalfx); - gchang = sqrt(1.0-gshang*gshang); - ghoriz = (double)(ydimen>>1); - - //global cos/sin tilt angle - gctang = cos(gtang); - gstang = sin(gtang); - if (fabs(gstang) < .001) //This hack avoids nasty precision bugs in domost() - { gstang = 0; if (gctang > 0) gctang = 1.0; else gctang = -1.0; } - - if (inpreparemirror) - gstang = -gstang; - - //Generate viewport trapezoid (for handling screen up/down) - px[0] = px[3] = 0-1; px[1] = px[2] = windowx2+1-windowx1+2; - py[0] = py[1] = 0-1; py[2] = py[3] = windowy2+1-windowy1+2; n = 4; - for (i=0; i= n) j = 0; - if (pz[i] >= SCISDIST) { px2[n2] = px[i]; py2[n2] = py[i]; pz2[n2] = pz[i]; n2++; } - if ((pz[i] >= SCISDIST) != (pz[j] >= SCISDIST)) - { - r = (SCISDIST-pz[i])/(pz[j]-pz[i]); - px2[n2] = (px[j]-px[i])*r + px[i]; - py2[n2] = (py[j]-py[i])*r + py[i]; - pz2[n2] = SCISDIST; n2++; - } - } - if (n2 < 3) { enddrawing(); return; } - for (i=0; i 0.7f) - ratio += 4.f*(gshang-0.7f); - if (gshang < -0.7f) - ratio += 4.f*(-gshang-0.7f); - } -#endif - - ox2 = (searchx-ghalfx)/ratio; oy2 = (searchy-ghoriz)/ ratio; oz2 = ghalfx; - - //Tilt rotation - ox = ox2*gctang + oy2*gstang; - oy = oy2*gctang - ox2*gstang; - oz = oz2; - - //Up/down rotation - ox2 = oz*gchang - oy*gshang; - oy2 = ox; - oz2 = oy*gchang + oz*gshang; - - //Standard Left/right rotation - vx = (int32_t)(ox2*((float)cosglobalang) - oy2*((float)singlobalang)); - vy = (int32_t)(ox2*((float)singlobalang) + oy2*((float)cosglobalang)); - vz = (int32_t)(oz2*16384.0); - - vect.x = globalposx; - vect.y = globalposy; - vect.z = globalposz; - - hitallsprites = 1; - hitscan((const vec3_t *)&vect,globalcursectnum, //Start position - vx>>10,vy>>10,vz>>6,&hitinfo,0xffff0030); - - if (hitinfo.hitsect != -1) // if hitsect is -1, hitscan overflowed somewhere - { - getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); - hitallsprites = 0; - - searchsector = hitinfo.hitsect; - if (hitinfo.pos.zfz) searchstat = 2; else if (hitinfo.hitwall >= 0) - { - searchbottomwall = searchwall = hitinfo.hitwall; searchstat = 0; - if (wall[hitinfo.hitwall].nextwall >= 0) - { - int32_t cz, fz; - getzsofslope(wall[hitinfo.hitwall].nextsector,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); - if (hitinfo.pos.z > fz) - { - if (wall[hitinfo.hitwall].cstat&2) //'2' bottoms of walls - searchbottomwall = wall[hitinfo.hitwall].nextwall; - } - else if ((hitinfo.pos.z > cz) && (wall[hitinfo.hitwall].cstat&(16+32))) //masking or 1-way - searchstat = 4; - } - } - else if (hitinfo.hitsprite >= 0) { searchwall = hitinfo.hitsprite; searchstat = 3; } - else - { - int32_t cz, fz; - getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); - if ((hitinfo.pos.z<<1) < cz+fz) searchstat = 1; else searchstat = 2; - //if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/ - } - - if (preview_mouseaim && spritesortcnt < MAXSPRITESONSCREEN) - { - spritetype *tsp = &tsprite[spritesortcnt]; - double dadist, x,y,z; - Bmemcpy(tsp, &hitinfo.pos, sizeof(vec3_t)); - x = tsp->x-globalposx; y=tsp->y-globalposy; z=(tsp->z-globalposz)/16.0; - dadist = sqrt(x*x + y*y + z*z); - tsp->sectnum = hitinfo.hitsect; - tsp->picnum = 2523; // CROSSHAIR - tsp->cstat = 128; - tsp->owner = MAXSPRITES-1; - tsp->xrepeat = tsp->yrepeat = min(max(1, (int32_t)(dadist*48.0/3200.0)), 255); - sprite[tsp->owner].xoffset = sprite[tsp->owner].yoffset = 0; - tspriteptr[spritesortcnt++] = tsp; - } - - if ((searchstat==1 || searchstat==2) && searchsector>=0) - { - int32_t scrv[2] = {(vx>>12), (vy>>12)}; - int32_t scrv_r[2] = {scrv[1], -scrv[0]}; - walltype *wal = &wall[sector[searchsector].wallptr]; - int32_t wdistsq, bestwdistsq=0x7fffffff; - int16_t k, bestk=-1; - - for (k=0; k= 0) - searchwall = sector[searchsector].wallptr + bestk; - } - } - searchit = 0; - } - - numscans = numbunches = 0; - - if (globalcursectnum >= MAXSECTORS) - globalcursectnum -= MAXSECTORS; - else - { - i = globalcursectnum; - updatesector(globalposx,globalposy,&globalcursectnum); - if (globalcursectnum < 0) globalcursectnum = i; - } - - polymost_scansector(globalcursectnum); - - if (inpreparemirror) - { - grhalfxdown10x = -grhalfxdown10; - inpreparemirror = 0; - polymost_drawalls(0); - numbunches--; - bunchfirst[0] = bunchfirst[numbunches]; - bunchlast[0] = bunchlast[numbunches]; - } - else - grhalfxdown10x = grhalfxdown10; - - while (numbunches > 0) - { - memset(ptempbuf,0,numbunches+3); ptempbuf[0] = 1; - - closest = 0; //Almost works, but not quite :( - for (i=1; i= 3) - { - bglDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS - - //bglPolygonOffset(0,0); - bglDepthRange(0.0,0.99999); //<- this is more widely supported than glPolygonOffset - } -#endif - - enddrawing(); -} - -void polymost_drawmaskwall(int32_t damaskwallcnt) -{ - double dpx[8], dpy[8], dpx2[8], dpy2[8]; - float fy, x0, x1, sx0, sy0, sx1, sy1, xp0, yp0, xp1, yp1, oxp0, oyp0, ryp0, ryp1; - float r, t, t0, t1, csy[4], fsy[4]; - int32_t i, j, n, n2, z, sectnum, z1, z2, cz[4], fz[4], method; - int32_t m0, m1; - sectortype *sec, *nsec; - walltype *wal, *wal2; - - z = maskwall[damaskwallcnt]; - wal = &wall[thewall[z]]; wal2 = &wall[wal->point2]; - sectnum = thesector[z]; sec = §or[sectnum]; - nsec = §or[wal->nextsector]; - z1 = max(nsec->ceilingz,sec->ceilingz); - z2 = min(nsec->floorz,sec->floorz); - - globalpicnum = wal->overpicnum; if ((uint32_t)globalpicnum >= MAXTILES) globalpicnum = 0; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(int16_t)thewall[z]+16384); - globalshade = (int32_t)wal->shade; - globalpal = (int32_t)((uint8_t)wal->pal); - globalorientation = (int32_t)wal->cstat; - - sx0 = (float)(wal->x-globalposx); sx1 = (float)(wal2->x-globalposx); - sy0 = (float)(wal->y-globalposy); sy1 = (float)(wal2->y-globalposy); - yp0 = sx0*gcosang2 + sy0*gsinang2; - yp1 = sx1*gcosang2 + sy1*gsinang2; - if ((yp0 < SCISDIST) && (yp1 < SCISDIST)) return; - xp0 = sy0*gcosang - sx0*gsinang; - xp1 = sy1*gcosang - sx1*gsinang; - - //Clip to close parallel-screen plane - oxp0 = xp0; oyp0 = yp0; - if (yp0 < SCISDIST) { t0 = (SCISDIST-yp0)/(yp1-yp0); xp0 = (xp1-xp0)*t0+xp0; yp0 = SCISDIST; } - else t0 = 0.f; - if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; } - else { t1 = 1.f; } - - m0 = (int32_t)((wal2->x-wal->x)*t0+wal->x); - m1 = (int32_t)((wal2->y-wal->y)*t0+wal->y); - getzsofslope(sectnum,m0,m1,&cz[0],&fz[0]); - getzsofslope(wal->nextsector,m0,m1,&cz[1],&fz[1]); - m0 = (int32_t)((wal2->x-wal->x)*t1+wal->x); - m1 = (int32_t)((wal2->y-wal->y)*t1+wal->y); - getzsofslope(sectnum,m0,m1,&cz[2],&fz[2]); - getzsofslope(wal->nextsector,m0,m1,&cz[3],&fz[3]); - - ryp0 = 1.f/yp0; ryp1 = 1.f/yp1; - - //Generate screen coordinates for front side of wall - x0 = ghalfx*xp0*ryp0 + ghalfx; - x1 = ghalfx*xp1*ryp1 + ghalfx; - if (x1 <= x0) return; - - ryp0 *= gyxscale; ryp1 *= gyxscale; - - gdx = (ryp0-ryp1)*gxyaspect / (x0-x1); - gdy = 0; - gdo = ryp0*gxyaspect - gdx*x0; - - //gux*x0 + guo = t0*wal->xrepeat*8*yp0 - //gux*x1 + guo = t1*wal->xrepeat*8*yp1 - gux = (t0*ryp0 - t1*ryp1)*gxyaspect*(float)wal->xrepeat*8.f / (x0-x1); - guo = t0*ryp0*gxyaspect*(float)wal->xrepeat*8.f - gux*x0; - guo += (float)wal->xpanning*gdo; - gux += (float)wal->xpanning*gdx; - guy = 0; - - if (!(wal->cstat&4)) i = z1; else i = z2; - i -= globalposz; - t0 = ((float)i)*ryp0 + ghoriz; - t1 = ((float)i)*ryp1 + ghoriz; - t = ((gdx*x0 + gdo) * (float)wal->yrepeat) / ((x1-x0) * ryp0 * 2048.f); - i = (1<<(picsiz[globalpicnum]>>4)); if (i < tilesizy[globalpicnum]) i <<= 1; - fy = (float)wal->ypanning * ((float)i) / 256.0; - gvx = (t0-t1)*t; - gvy = (x1-x0)*t; - gvo = -gvx*x0 - gvy*t0 + fy*gdo; gvx += fy*gdx; gvy += fy*gdy; - - if (wal->cstat&8) //xflip - { - t = (float)(wal->xrepeat*8 + wal->xpanning*2); - gux = gdx*t - gux; - guy = gdy*t - guy; - guo = gdo*t - guo; - } - if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip - - method = 1; pow2xsplit = 1; - if (wal->cstat&128) { if (!(wal->cstat&512)) method = 2; else method = 3; } - -#ifdef USE_OPENGL - if (!nofog) - { - if (rendmode >= 3) - { - fogcalc(wal->shade,sec->visibility,sec->floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - } - } -#endif - - for (i=0; i<2; i++) - { - csy[i] = ((float)(cz[i]-globalposz))*ryp0 + ghoriz; - fsy[i] = ((float)(fz[i]-globalposz))*ryp0 + ghoriz; - csy[i+2] = ((float)(cz[i+2]-globalposz))*ryp1 + ghoriz; - fsy[i+2] = ((float)(fz[i+2]-globalposz))*ryp1 + ghoriz; - } - - //Clip 2 quadrilaterals - // /csy3 - // / | - // csy0------/----csy2 - // | /xxxxxxx| - // | /xxxxxxxxx| - // csy1/xxxxxxxxxxx| - // |xxxxxxxxxxx/fsy3 - // |xxxxxxxxx/ | - // |xxxxxxx/ | - // fsy0----/------fsy2 - // | / - // fsy1/ - - dpx[0] = x0; dpy[0] = csy[1]; - dpx[1] = x1; dpy[1] = csy[3]; - dpx[2] = x1; dpy[2] = fsy[3]; - dpx[3] = x0; dpy[3] = fsy[1]; - n = 4; - - //Clip to (x0,csy[0])-(x1,csy[2]) - n2 = 0; t1 = -((dpx[0]-x0)*(csy[2]-csy[0]) - (dpy[0]-csy[0])*(x1-x0)); - for (i=0; i= n) j = 0; - - t0 = t1; t1 = -((dpx[j]-x0)*(csy[2]-csy[0]) - (dpy[j]-csy[0])*(x1-x0)); - if (t0 >= 0) { dpx2[n2] = dpx[i]; dpy2[n2] = dpy[i]; n2++; } - if ((t0 >= 0) != (t1 >= 0)) - { - r = t0/(t0-t1); - dpx2[n2] = (dpx[j]-dpx[i])*r + dpx[i]; - dpy2[n2] = (dpy[j]-dpy[i])*r + dpy[i]; - n2++; - } - } - if (n2 < 3) return; - - //Clip to (x1,fsy[2])-(x0,fsy[0]) - n = 0; t1 = -((dpx2[0]-x1)*(fsy[0]-fsy[2]) - (dpy2[0]-fsy[2])*(x0-x1)); - for (i=0; i= n2) j = 0; - - t0 = t1; t1 = -((dpx2[j]-x1)*(fsy[0]-fsy[2]) - (dpy2[j]-fsy[2])*(x0-x1)); - if (t0 >= 0) { dpx[n] = dpx2[i]; dpy[n] = dpy2[i]; n++; } - if ((t0 >= 0) != (t1 >= 0)) - { - r = t0/(t0-t1); - dpx[n] = (dpx2[j]-dpx2[i])*r + dpx2[i]; - dpy[n] = (dpy2[j]-dpy2[i])*r + dpy2[i]; - n++; - } - } - if (n < 3) return; - - drawpoly(dpx,dpy,n,method); -} - -int32_t lastcullcheck = 0; -char cullmodel[MAXSPRITES]; -int32_t cullcheckcnt = 0; - -int32_t __fastcall polymost_checkcoordinates(int32_t x, int32_t y, spritetype *tspr) -{ - int16_t datempsectnum = tspr->sectnum; - int32_t oldx = x, i, j = (tilesizy[tspr->picnum]*tspr->yrepeat); - -RECHECK: - updatesectorz(tspr->x+x,tspr->y+y,tspr->z,&datempsectnum); - - if (datempsectnum == -1) - { - if (x == y || x != oldx) - return 0; - swaplong(&x,&y); - updatesector(tspr->x+x,tspr->y+y,&datempsectnum); - } - - i = 4; - do - { - cullcheckcnt += 2; - if (cansee(globalposx, globalposy, globalposz, globalcursectnum, - tspr->x+x, tspr->y+y, tspr->z-(j*i)-512, datempsectnum)) - return 1; - if (cansee(globalposx, globalposy, globalposz, globalcursectnum, - tspr->x+x, tspr->y+y, tspr->z-(j*(i-1))-512, datempsectnum)) - return 1; - i -= 2; - } - while (i); - - cullcheckcnt++; - if (cansee(globalposx, globalposy, globalposz, globalcursectnum, - tspr->x+x, tspr->y+y, tspr->z-512, datempsectnum)) - return 1; - - if (x != y && x == oldx) - { - swaplong(&x,&y); - goto RECHECK; - } - - return 0; -} - -void polymost_drawsprite(int32_t snum) -{ - double px[6], py[6]; - float f, c, s, fx, fy, sx0, sy0, sx1, xp0, yp0, xp1, yp1, oxp0, oyp0, ryp0, ryp1, ft[4]; - float x0, y0, x1, y1, sc0, sf0, sc1, sf1, px2[6], py2[6], xv, yv, t0, t1; - int32_t i, j, spritenum, xoff=0, yoff=0, method, npoints; - spritetype *tspr; - int32_t posx,posy; - int32_t oldsizx, oldsizy; - int32_t tsizx, tsizy; - tspr = tspriteptr[snum]; - if (tspr->owner < 0 || tspr->picnum < 0 || tspr->picnum >= MAXTILES) return; - - globalpicnum = tspr->picnum; - globalshade = tspr->shade; - globalpal = tspr->pal; - globalorientation = tspr->cstat; - spritenum = tspr->owner; - - if ((globalorientation&48) != 48) // only non-voxel sprites should do this - { - int32_t flag; - if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,spritenum+32768); - flag = usehightile&&h_xsize[globalpicnum]; - xoff = (int32_t)tspr->xoffset; - yoff = (int32_t)tspr->yoffset; - xoff += (int8_t)((flag)?(h_xoffs[globalpicnum]):((picanm[globalpicnum]>>8)&255)); - yoff += (int8_t)((flag)?(h_yoffs[globalpicnum]):((picanm[globalpicnum]>>16)&255)); - } - - method = 1+4; - if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } - -#ifdef USE_OPENGL - - if (!nofog && rendmode >= 3) - { - fogcalc(globalshade,sector[tspr->sectnum].visibility,sector[tspr->sectnum].floorpal); - bglFogf(GL_FOG_DENSITY,fogresult); - bglFogfv(GL_FOG_COLOR,fogcol); - } - - while (rendmode >= 3 && !(spriteext[tspr->owner].flags&SPREXT_NOTMD)) - { - if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0) - { -// md2model *modelptr = (md2model *)models[tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid]; - if (tspr->owner < 0 || tspr->owner >= MAXSPRITES || tspr->statnum == TSPR_MIRROR) - { - if (mddraw(tspr)) return; - break; // else, render as flat sprite - } - if (r_modelocclusionchecking) - { - if (totalclock >= lastcullcheck + CULL_DELAY && cullcheckcnt < MAXCULLCHECKS && (/*modelptr->usesalpha ||*/ tspr->yrepeat*tilesizy[sprite[tspr->owner].picnum] > 1536 || tspr->xrepeat*tilesizx[sprite[tspr->owner].picnum] > 1536)) - { - do // this is so gay - { - uint32_t t = getticks()+4; - - // don't bother with shadows because processing its owner will take care of it - if (tspr->statnum == TSPR_TEMP) - break; - cullmodel[tspr->owner] = 1; - cullcheckcnt++; - - if (cansee(globalposx, globalposy, globalposz, globalcursectnum, - tspr->x, tspr->y, tspr->z,tspr->sectnum)) - { cullmodel[tspr->owner] = 0; break; } - - if (polymost_checkcoordinates(-CULL_OFFSET, 0, tspr) || getticks() > t || cullcheckcnt >= MAXCULLCHECKS) - { cullmodel[tspr->owner] = 0; break; } - if (polymost_checkcoordinates(-CULL_OFFSET, -CULL_OFFSET, tspr) || getticks() > t || cullcheckcnt >= MAXCULLCHECKS) - { cullmodel[tspr->owner] = 0; break; } - - if (polymost_checkcoordinates(CULL_OFFSET, 0, tspr) || getticks() > t || cullcheckcnt >= MAXCULLCHECKS) - { cullmodel[tspr->owner] = 0; break; } - if (polymost_checkcoordinates(CULL_OFFSET, CULL_OFFSET, tspr) || getticks() > t || cullcheckcnt >= MAXCULLCHECKS) - { cullmodel[tspr->owner] = 0; break; } - - if (polymost_checkcoordinates(-CULL_OFFSET, CULL_OFFSET, tspr) || getticks() > t || cullcheckcnt >= MAXCULLCHECKS) - { cullmodel[tspr->owner] = 0; break; } - - if (polymost_checkcoordinates(0, 0, tspr) || getticks() > t || cullcheckcnt >= MAXCULLCHECKS) - { cullmodel[tspr->owner] = 0; break; } - - break; - } - while (1); - } - } - else cullmodel[tspr->owner] = 0; - if (cullmodel[tspr->owner]) break; - if (mddraw(tspr)) return; - break; // else, render as flat sprite - } - if (usevoxels && (tspr->cstat&48)!=48 && tiletovox[tspr->picnum] >= 0 && voxmodels[ tiletovox[tspr->picnum] ]) - { - if (voxdraw(voxmodels[ tiletovox[tspr->picnum] ], tspr)) return; - break; // else, render as flat sprite - } - if ((tspr->cstat&48)==48 && voxmodels[ tspr->picnum ]) - { - voxdraw(voxmodels[ tspr->picnum ], tspr); - return; - } - break; - } - if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal)))) - { - curpolygonoffset += 0.01f; - bglEnable(GL_POLYGON_OFFSET_FILL); - bglPolygonOffset(-curpolygonoffset, -curpolygonoffset); - } -#endif - posx=tspr->x; - posy=tspr->y; - if (spriteext[tspr->owner].flags&SPREXT_AWAY1) - { - posx+=(sintable[(tspr->ang+512)&2047]>>13); - posy+=(sintable[(tspr->ang)&2047]>>13); - } - else if (spriteext[tspr->owner].flags&SPREXT_AWAY2) - { - posx-=(sintable[(tspr->ang+512)&2047]>>13); - posy-=(sintable[(tspr->ang)&2047]>>13); - } - oldsizx=tsizx=tilesizx[globalpicnum]; - oldsizy=tsizy=tilesizy[globalpicnum]; - if (usehightile&&h_xsize[globalpicnum]) - { - tsizx=h_xsize[globalpicnum]; - tsizy=h_ysize[globalpicnum]; - } - - switch ((globalorientation>>4)&3) - { - case 0: //Face sprite - //Project 3D to 2D - sx0 = (float)(tspr->x-globalposx); - sy0 = (float)(tspr->y-globalposy); - xp0 = sy0*gcosang - sx0*gsinang; - yp0 = sx0*gcosang2 + sy0*gsinang2; - if (yp0 <= SCISDIST) return; - ryp0 = 1/yp0; - sx0 = ghalfx*xp0*ryp0 + ghalfx; - sy0 = ((float)(tspr->z-globalposz))*gyxscale*ryp0 + ghoriz; - - f = ryp0*(float)xdimen/160.0; - fx = ((float)tspr->xrepeat)*f; - fy = ((float)tspr->yrepeat)*f*((float)yxaspect/65536.0); - sx0 -= fx*(float)xoff; if (tsizx&1) sx0 += fx*.5; - sy0 -= fy*(float)yoff; - fx *= ((float)tsizx); - fy *= ((float)tsizy); - - px[0] = px[3] = sx0-fx*.5; px[1] = px[2] = sx0+fx*.5; - if (!(globalorientation&128)) { py[0] = py[1] = sy0-fy; py[2] = py[3] = sy0; } - else { py[0] = py[1] = sy0-fy*.5; py[2] = py[3] = sy0+fy*.5; } - - gdx = gdy = guy = gvx = 0; gdo = ryp0*gviewxrange; - if (!(globalorientation&4)) - { gux = (float)tsizx*gdo/(px[1]-px[0]+.002); guo = -gux*(px[0]-.001); } - else { gux = (float)tsizx*gdo/(px[0]-px[1]-.002); guo = -gux*(px[1]+.001); } - if (!(globalorientation&8)) - { gvy = (float)tsizy*gdo/(py[3]-py[0]+.002); gvo = -gvy*(py[0]-.001); } - else { gvy = (float)tsizy*gdo/(py[0]-py[3]-.002); gvo = -gvy*(py[3]+.001); } - - // sprite panning - guy -= gdy*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx; - guo -= gdo*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx; - gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy; - gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy; - - //Clip sprites to ceilings/floors when no parallaxing and not sloped - if (!(sector[tspr->sectnum].ceilingstat&3)) - { - sy0 = ((float)(sector[tspr->sectnum].ceilingz-globalposz))*gyxscale*ryp0 + ghoriz; - if (py[0] < sy0) py[0] = py[1] = sy0; - } - if (!(sector[tspr->sectnum].floorstat&3)) - { - sy0 = ((float)(sector[tspr->sectnum].floorz-globalposz))*gyxscale*ryp0 + ghoriz; - if (py[2] > sy0) py[2] = py[3] = sy0; - } - -#ifdef USE_OPENGL - if (spriteext[spritenum].xpanning) - srepeat = 1; - if (spriteext[spritenum].ypanning) - trepeat = 1; -#endif - tilesizx[globalpicnum] = tsizx; - tilesizy[globalpicnum] = tsizy; - pow2xsplit = 0; drawpoly(px,py,4,method); - -#ifdef USE_OPENGL - if (spriteext[spritenum].xpanning) - srepeat = 0; - if (spriteext[spritenum].ypanning) - trepeat = 0; -#endif - - break; - case 1: //Wall sprite - - //Project 3D to 2D - if (globalorientation&4) xoff = -xoff; - if (globalorientation&8) yoff = -yoff; - - xv = (float)tspr->xrepeat * (float)sintable[(tspr->ang)&2047] / 65536.0; - yv = (float)tspr->xrepeat * (float)sintable[(tspr->ang+1536)&2047] / 65536.0; - f = (float)(tsizx>>1) + (float)xoff; - x0 = (float)(posx-globalposx) - xv*f; x1 = xv*(float)tsizx + x0; - y0 = (float)(posy-globalposy) - yv*f; y1 = yv*(float)tsizx + y0; - - yp0 = x0*gcosang2 + y0*gsinang2; - yp1 = x1*gcosang2 + y1*gsinang2; - if ((yp0 <= SCISDIST) && (yp1 <= SCISDIST)) return; - xp0 = y0*gcosang - x0*gsinang; - xp1 = y1*gcosang - x1*gsinang; - - //Clip to close parallel-screen plane - oxp0 = xp0; oyp0 = yp0; - if (yp0 < SCISDIST) { t0 = (SCISDIST-yp0)/(yp1-yp0); xp0 = (xp1-xp0)*t0+xp0; yp0 = SCISDIST; } - else { t0 = 0.f; } - if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; yp1 = SCISDIST; } - else { t1 = 1.f; } - - f = ((float)tspr->yrepeat) * (float)tsizy * 4; - - ryp0 = 1.0/yp0; - ryp1 = 1.0/yp1; - sx0 = ghalfx*xp0*ryp0 + ghalfx; - sx1 = ghalfx*xp1*ryp1 + ghalfx; - ryp0 *= gyxscale; - ryp1 *= gyxscale; - - tspr->z -= ((yoff*tspr->yrepeat)<<2); - if (globalorientation&128) - { - tspr->z += ((tsizy*tspr->yrepeat)<<1); - if (tsizy&1) tspr->z += (tspr->yrepeat<<1); //Odd yspans - } - - sc0 = ((float)(tspr->z-globalposz-f))*ryp0 + ghoriz; - sc1 = ((float)(tspr->z-globalposz-f))*ryp1 + ghoriz; - sf0 = ((float)(tspr->z-globalposz))*ryp0 + ghoriz; - sf1 = ((float)(tspr->z-globalposz))*ryp1 + ghoriz; - - gdx = (ryp0-ryp1)*gxyaspect / (sx0-sx1); - gdy = 0; - gdo = ryp0*gxyaspect - gdx*sx0; - - //Original equations: - //(gux*sx0 + guo)/(gdx*sx1 + gdo) = tsizx*t0 - //(gux*sx1 + guo)/(gdx*sx1 + gdo) = tsizx*t1 - // - // gvx*sx0 + gvy*sc0 + gvo = 0 - // gvy*sx1 + gvy*sc1 + gvo = 0 - //(gvx*sx0 + gvy*sf0 + gvo)/(gdx*sx0 + gdo) = tsizy - //(gvx*sx1 + gvy*sf1 + gvo)/(gdx*sx1 + gdo) = tsizy - - //gux*sx0 + guo = t0*tsizx*yp0 - //gux*sx1 + guo = t1*tsizx*yp1 - if (globalorientation&4) { t0 = 1.f-t0; t1 = 1.f-t1; } - - //sprite panning - t0 -= ((float)(spriteext[spritenum].xpanning)/255.f); - t1 -= ((float)(spriteext[spritenum].xpanning)/255.f); - gux = (t0*ryp0 - t1*ryp1)*gxyaspect*(float)tsizx / (sx0-sx1); - guy = 0; - guo = t0*ryp0*gxyaspect*(float)tsizx - gux*sx0; - - //gvx*sx0 + gvy*sc0 + gvo = 0 - //gvx*sx1 + gvy*sc1 + gvo = 0 - //gvx*sx0 + gvy*sf0 + gvo = tsizy*(gdx*sx0 + gdo) - f = ((float)tsizy)*(gdx*sx0 + gdo) / ((sx0-sx1)*(sc0-sf0)); - if (!(globalorientation&8)) - { - gvx = (sc0-sc1)*f; - gvy = (sx1-sx0)*f; - gvo = -gvx*sx0 - gvy*sc0; - } - else - { - gvx = (sf1-sf0)*f; - gvy = (sx0-sx1)*f; - gvo = -gvx*sx0 - gvy*sf0; - } - - // sprite panning - gvx -= gdx*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy; - gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy; - gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy; - - //Clip sprites to ceilings/floors when no parallaxing - if (!(sector[tspr->sectnum].ceilingstat&1)) - { - f = ((float)tspr->yrepeat) * (float)tsizy * 4; - if (sector[tspr->sectnum].ceilingz > tspr->z-f) - { - sc0 = ((float)(sector[tspr->sectnum].ceilingz-globalposz))*ryp0 + ghoriz; - sc1 = ((float)(sector[tspr->sectnum].ceilingz-globalposz))*ryp1 + ghoriz; - } - } - if (!(sector[tspr->sectnum].floorstat&1)) - { - if (sector[tspr->sectnum].floorz < tspr->z) - { - sf0 = ((float)(sector[tspr->sectnum].floorz-globalposz))*ryp0 + ghoriz; - sf1 = ((float)(sector[tspr->sectnum].floorz-globalposz))*ryp1 + ghoriz; - } - } - - if (sx0 > sx1) - { - if (globalorientation&64) return; //1-sided sprite - f = sx0; sx0 = sx1; sx1 = f; - f = sc0; sc0 = sc1; sc1 = f; - f = sf0; sf0 = sf1; sf1 = f; - } - - px[0] = sx0; py[0] = sc0; - px[1] = sx1; py[1] = sc1; - px[2] = sx1; py[2] = sf1; - px[3] = sx0; py[3] = sf0; - -#ifdef USE_OPENGL - if (spriteext[spritenum].xpanning) - srepeat = 1; - if (spriteext[spritenum].ypanning) - trepeat = 1; -#endif - - tilesizx[globalpicnum] = tsizx; - tilesizy[globalpicnum] = tsizy; - pow2xsplit = 0; drawpoly(px,py,4,method); - -#ifdef USE_OPENGL - if (spriteext[spritenum].xpanning) - srepeat = 0; - if (spriteext[spritenum].ypanning) - trepeat = 0; -#endif - - break; - case 2: //Floor sprite - - if ((globalorientation&64) != 0) - if ((globalposz > tspr->z) == (!(globalorientation&8))) - return; - if ((globalorientation&4) > 0) xoff = -xoff; - if ((globalorientation&8) > 0) yoff = -yoff; - - i = (tspr->ang&2047); - c = sintable[(i+512)&2047]/65536.0; - s = sintable[i]/65536.0; - x0 = (float)((tsizx>>1)-xoff)*tspr->xrepeat; - y0 = (float)((tsizy>>1)-yoff)*tspr->yrepeat; - x1 = (float)((tsizx>>1)+xoff)*tspr->xrepeat; - y1 = (float)((tsizy>>1)+yoff)*tspr->yrepeat; - - //Project 3D to 2D - for (j=0; j<4; j++) - { - sx0 = (float)(tspr->x-globalposx); - sy0 = (float)(tspr->y-globalposy); - if ((j+0)&2) { sy0 -= s*y0; sx0 -= c*y0; } - else { sy0 += s*y1; sx0 += c*y1; } - if ((j+1)&2) { sx0 -= s*x0; sy0 += c*x0; } - else { sx0 += s*x1; sy0 -= c*x1; } - px[j] = sy0*gcosang - sx0*gsinang; - py[j] = sx0*gcosang2 + sy0*gsinang2; - } - - if (tspr->z < globalposz) //if floor sprite is above you, reverse order of points - { - f = px[0]; px[0] = px[1]; px[1] = f; - f = py[0]; py[0] = py[1]; py[1] = f; - f = px[2]; px[2] = px[3]; px[3] = f; - f = py[2]; py[2] = py[3]; py[3] = f; - } - - //Clip to SCISDIST plane - npoints = 0; - for (i=0; i<4; i++) - { - j = ((i+1)&3); - if (py[i] >= SCISDIST) { px2[npoints] = px[i]; py2[npoints] = py[i]; npoints++; } - if ((py[i] >= SCISDIST) != (py[j] >= SCISDIST)) - { - f = (SCISDIST-py[i])/(py[j]-py[i]); - px2[npoints] = (px[j]-px[i])*f + px[i]; - py2[npoints] = (py[j]-py[i])*f + py[i]; npoints++; - } - } - if (npoints < 3) return; - - //Project rotated 3D points to screen - f = ((float)(tspr->z-globalposz))*gyxscale; - for (j=0; jz-globalposz); - gdo = -ghoriz*gdy; - //copied&modified from relative alignment - xv = (float)tspr->x + s*x1 + c*y1; fx = (double)-(x0+x1)*s; - yv = (float)tspr->y + s*y1 - c*x1; fy = (double)+(x0+x1)*c; - f = 1.0/sqrt(fx*fx+fy*fy); fx *= f; fy *= f; - ft[2] = singlobalang*fy + cosglobalang*fx; - ft[3] = singlobalang*fx - cosglobalang*fy; - ft[0] = ((double)(globalposy-yv))*fy + ((double)(globalposx-xv))*fx; - ft[1] = ((double)(globalposx-xv))*fy - ((double)(globalposy-yv))*fx; - gux = (double)ft[3]*((double)viewingrange)/(-65536.0*262144.0); - gvx = (double)ft[2]*((double)viewingrange)/(-65536.0*262144.0); - guy = (double)ft[0]*gdy; gvy = (double)ft[1]*gdy; - guo = (double)ft[0]*gdo; gvo = (double)ft[1]*gdo; - guo += (double)(ft[2]/262144.0-gux)*ghalfx; - gvo -= (double)(ft[3]/262144.0+gvx)*ghalfx; - f = 4.0/(float)tspr->xrepeat; gux *= f; guy *= f; guo *= f; - f =-4.0/(float)tspr->yrepeat; gvx *= f; gvy *= f; gvo *= f; - if (globalorientation&4) - { - gux = ((float)tsizx)*gdx - gux; - guy = ((float)tsizx)*gdy - guy; - guo = ((float)tsizx)*gdo - guo; - } - - // sprite panning - guy -= gdy*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx; - guo -= gdo*((float)(spriteext[spritenum].xpanning)/255.f)*tsizx; - gvy -= gdy*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy; - gvo -= gdo*((float)(spriteext[spritenum].ypanning)/255.f)*tsizy; - -#ifdef USE_OPENGL - if (spriteext[spritenum].xpanning) - srepeat = 1; - if (spriteext[spritenum].ypanning) - trepeat = 1; -#endif - - tilesizx[globalpicnum] = tsizx; - tilesizy[globalpicnum] = tsizy; - pow2xsplit = 0; drawpoly(px,py,npoints,method); - -#ifdef USE_OPENGL - if (spriteext[spritenum].xpanning) - srepeat = 0; - if (spriteext[spritenum].ypanning) - trepeat = 0; -#endif - - break; - - case 3: //Voxel sprite - break; - } - tilesizx[globalpicnum]=oldsizx; - tilesizy[globalpicnum]=oldsizy; -} - -//sx,sy center of sprite; screen coods*65536 -//z zoom*65536. > is zoomed in -//a angle (0 is default) -//dastat&1 1:translucence -//dastat&2 1:auto-scale mode (use 320*200 coordinates) -//dastat&4 1:y-flip -//dastat&8 1:don't clip to startumost/startdmost -//dastat&16 1:force point passed to be top-left corner, 0:Editart center -//dastat&32 1:reverse translucence -//dastat&64 1:non-masked, 0:masked -//dastat&128 1:draw all pages (permanent) -//cx1,... clip window (actual screen coords) -void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, - int8_t dashade, char dapalnum, int32_t dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2, int32_t uniqid) -{ - static int32_t onumframes = 0; - int32_t n, nn, x, zz, xoff, yoff, xsiz, ysiz, method; - int32_t ogpicnum, ogshade, ogpal, ofoffset, oxdimen, oydimen, oldviewingrange; - double ogxyaspect; - double ogchang, ogshang, ogctang, ogstang, oghalfx, oghoriz, fx, fy, x1, y1, z1, x2, y2; - double ogrhalfxdown10, ogrhalfxdown10x; - double d, cosang, sinang, cosang2, sinang2, px[8], py[8], px2[8], py2[8]; - float m[4][4]; - int32_t oxdim = xdim, oydim = ydim; - - -#ifdef USE_OPENGL - if (rendmode >= 3 && usemodels && hudmem[(dastat&4)>>2][picnum].angadd) - { - if ((tile2model[Ptile2tile(picnum,dapalnum)].modelid >= 0) && (tile2model[Ptile2tile(picnum,dapalnum)].framenum >= 0)) - { - spritetype tspr; - memset(&tspr,0,sizeof(spritetype)); - - if (hudmem[(dastat&4)>>2][picnum].flags&1) return; //"HIDE" is specified in DEF - - ogchang = gchang; gchang = 1.0; - ogshang = gshang; gshang = 0.0; d = (double)z/(65536.0*16384.0); - ogctang = gctang; gctang = (double)sintable[(a+512)&2047]*d; - ogstang = gstang; gstang = (double)sintable[a&2047]*d; - ogshade = globalshade; globalshade = dashade; - ogpal = globalpal; globalpal = (int32_t)((uint8_t)dapalnum); - ogxyaspect = gxyaspect; gxyaspect = 1.0; - oldviewingrange = viewingrange; viewingrange = 65536; - - x1 = hudmem[(dastat&4)>>2][picnum].xadd; - y1 = hudmem[(dastat&4)>>2][picnum].yadd; - z1 = hudmem[(dastat&4)>>2][picnum].zadd; - -#ifdef POLYMER - if (pr_overridehud) { - x1 = pr_hudxadd; - y1 = pr_hudyadd; - z1 = pr_hudzadd; - } -#endif - - if (!(hudmem[(dastat&4)>>2][picnum].flags&2)) //"NOBOB" is specified in DEF - { - fx = ((double)sx)*(1.0/65536.0); - fy = ((double)sy)*(1.0/65536.0); - - if (dastat&16) - { - xsiz = tilesizx[picnum]; ysiz = tilesizy[picnum]; - xoff = (int32_t)((int8_t)((picanm[picnum]>>8)&255))+(xsiz>>1); - yoff = (int32_t)((int8_t)((picanm[picnum]>>16)&255))+(ysiz>>1); - - d = (double)z/(65536.0*16384.0); - cosang2 = cosang = (double)sintable[(a+512)&2047]*d; - sinang2 = sinang = (double)sintable[a&2047]*d; - if ((dastat&2) || (!(dastat&8))) //Don't aspect unscaled perms - { d = (double)xyaspect/65536.0; cosang2 *= d; sinang2 *= d; } - fx += -(double)xoff*cosang2+ (double)yoff*sinang2; - fy += -(double)xoff*sinang - (double)yoff*cosang; - } - - if (!(dastat&2)) - { - x1 += fx/((double)(xdim<<15))-1.0; //-1: left of screen, +1: right of screen - y1 += fy/((double)(ydim<<15))-1.0; //-1: top of screen, +1: bottom of screen - } - else - { - x1 += fx/160.0-1.0; //-1: left of screen, +1: right of screen - y1 += fy/100.0-1.0; //-1: top of screen, +1: bottom of screen - } - } - tspr.ang = hudmem[(dastat&4)>>2][picnum].angadd+globalang; - -#ifdef POLYMER - if (pr_overridehud) { - tspr.ang = pr_hudangadd + globalang; - } -#endif - - if (dastat&4) { x1 = -x1; y1 = -y1; } - - // In Polymost, we don't care if the model is very big - if (rendmode < 4) - { - tspr.xrepeat = tspr.yrepeat = 32; - - tspr.x = (int32_t)(((double)gcosang*z1 - (double)gsinang*x1)*16384.0 + globalposx); - tspr.y = (int32_t)(((double)gsinang*z1 + (double)gcosang*x1)*16384.0 + globalposy); - tspr.z = (int32_t)(globalposz + y1*16384.0*0.8); - } - else - { - float x, y, z; - - tspr.xrepeat = tspr.yrepeat = 5; - - x = (float)(((double)gcosang*z1 - (double)gsinang*x1)*2560.0 + globalposx); - y = (float)(((double)gsinang*z1 + (double)gcosang*x1)*2560.0 + globalposy); - z = (float)(globalposz + y1*2560.0*0.8); - - memcpy(&tspr.x, &x, sizeof(float)); - memcpy(&tspr.y, &y, sizeof(float)); - memcpy(&tspr.z, &z, sizeof(float)); - } - tspr.picnum = picnum; - tspr.shade = dashade; - tspr.pal = dapalnum; - tspr.owner = uniqid+MAXSPRITES; - globalorientation = (dastat&1)+((dastat&32)<<4)+((dastat&4)<<1); - tspr.cstat = globalorientation; - - if ((dastat&10) == 2) - bglViewport(windowx1,yres-(windowy2+1),windowx2-windowx1+1,windowy2-windowy1+1); - else - { - bglViewport(0,0,xdim,ydim); - glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore) - } - - if (rendmode < 4) - { - bglMatrixMode(GL_PROJECTION); - memset(m,0,sizeof(m)); - if ((dastat&10) == 2) - { - float ratioratio = (float)xdim/ydim; - m[0][0] = (float)ydimen*(ratioratio >= 1.6?1.2:1); m[0][2] = 1.0; - m[1][1] = (float)xdimen; m[1][2] = 1.0; - m[2][2] = 1.0; m[2][3] = (float)ydimen*(ratioratio >= 1.6?1.2:1); - m[3][2] =-1.0; - } - else { m[0][0] = m[2][3] = 1.0f; m[1][1] = ((float)xdim)/((float)ydim); m[2][2] = 1.0001f; m[3][2] = 1-m[2][2]; } - bglLoadMatrixf(&m[0][0]); - bglMatrixMode(GL_MODELVIEW); - bglLoadIdentity(); - } - - if (hudmem[(dastat&4)>>2][picnum].flags&8) //NODEPTH flag - bglDisable(GL_DEPTH_TEST); - else - { - bglEnable(GL_DEPTH_TEST); - if (onumframes != numframes) - { - onumframes = numframes; - bglClear(GL_DEPTH_BUFFER_BIT); - } - } - -#ifdef USE_OPENGL - if (!nofog) bglDisable(GL_FOG); - if (rendmode < 4) - mddraw(&tspr); -# ifdef POLYMER - else - { - int32_t fov; - - tspriteptr[MAXSPRITESONSCREEN] = &tspr; - - bglEnable(GL_ALPHA_TEST); - bglEnable(GL_BLEND); - - spriteext[tspr.owner].roll = a; - spriteext[tspr.owner].zoff = z; - - fov = hudmem[(dastat&4)>>2][picnum].fov; - - if (fov == -1) { - fov = pr_fov; - } - - if (pr_overridehud) { - fov = pr_hudfov; - } - - polymer_setaspect(fov); - - polymer_drawsprite(MAXSPRITESONSCREEN); - - polymer_setaspect(pr_fov); - - spriteext[tspr.owner].zoff = 0; - spriteext[tspr.owner].roll = 0; - - bglDisable(GL_BLEND); - bglDisable(GL_ALPHA_TEST); - } -# endif - if (!nofog) bglEnable(GL_FOG); -#else - mddraw(&tspr); -#endif - - viewingrange = oldviewingrange; - gxyaspect = ogxyaspect; - globalshade = ogshade; - globalpal = ogpal; - gchang = ogchang; - gshang = ogshang; - gctang = ogctang; - gstang = ogstang; - return; - } - } -#endif - - ogpicnum = globalpicnum; globalpicnum = picnum; - ogshade = globalshade; globalshade = dashade; - ogpal = globalpal; globalpal = (int32_t)((uint8_t)dapalnum); - oghalfx = ghalfx; ghalfx = (double)(xdim>>1); - ogrhalfxdown10 = grhalfxdown10; grhalfxdown10 = 1.0/(((double)ghalfx)*1024); - ogrhalfxdown10x = grhalfxdown10x; grhalfxdown10x = grhalfxdown10; - oghoriz = ghoriz; ghoriz = (double)(ydim>>1); - ofoffset = frameoffset; frameoffset = frameplace; - oxdimen = xdimen; xdimen = xdim; - oydimen = ydimen; ydimen = ydim; - ogchang = gchang; gchang = 1.0; - ogshang = gshang; gshang = 0.0; - ogctang = gctang; gctang = 1.0; - ogstang = gstang; gstang = 0.0; - -#ifdef USE_OPENGL - if (rendmode >= 3) - { - bglViewport(0,0,xdim,ydim); glox1 = -1; //Force fullscreen (glox1=-1 forces it to restore) - bglMatrixMode(GL_PROJECTION); - memset(m,0,sizeof(m)); - m[0][0] = m[2][3] = 1.0f; m[1][1] = ((float)xdim)/((float)ydim); m[2][2] = 1.0001f; m[3][2] = 1-m[2][2]; - bglPushMatrix(); bglLoadMatrixf(&m[0][0]); - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - bglLoadIdentity(); - - bglDisable(GL_DEPTH_TEST); - bglDisable(GL_ALPHA_TEST); - bglEnable(GL_TEXTURE_2D); - -# ifdef POLYMER - if (rendmode >= 4) { - polymer_inb4rotatesprite(picnum, dapalnum, dashade); - } -# endif - } -#endif - - method = 0; - if (!(dastat&64)) - { - method = 1; - if (dastat&1) { if (!(dastat&32)) method = 2; else method = 3; } - } - method |= 4; //Use OpenGL clamping - dorotatesprite never repeats - - xsiz = tilesizx[globalpicnum]; ysiz = tilesizy[globalpicnum]; - if (dastat&16) { xoff = 0; yoff = 0; } - else - { - xoff = (int32_t)((int8_t)((picanm[globalpicnum]>>8)&255))+(xsiz>>1); - yoff = (int32_t)((int8_t)((picanm[globalpicnum]>>16)&255))+(ysiz>>1); - } - if (dastat&4) yoff = ysiz-yoff; - - if (dastat&2) //Auto window size scaling - { - // nasty hacks go here - if (!(dastat&8)) - { - x = xdimenscale; //= scale(xdimen,yxaspect,320); - - if (!(dastat & 1024) && ((double)ydim/(double)xdim) <= .75f) - { - xdim = (int32_t)((double)ydim * 1.33333333333333334f); - setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); - } - - if (dastat & 512) - sx = ((cx1+cx2+2+scale((oxdim-xdim), cx1+cx2+2, oxdim))<<15)+scale(sx-(320<<15),scale(xdimen, xdim, oxdim),320); - else if (dastat & 256) - sx = ((cx1+cx2+2-scale((oxdim-xdim), cx1+cx2+2, oxdim))<<15)+scale(sx-(320<<15),scale(xdimen, xdim, oxdim),320); - else - sx = ((cx1+cx2+2)<<15)+scale(sx-(320<<15),scale(xdimen, xdim, oxdim),320); - - sy = ((cy1+cy2+2)<<15)+mulscale16(sy-(200<<15),x); - } - else - { - //If not clipping to startmosts, & auto-scaling on, as a - //hard-coded bonus, scale to full screen instead - - if (!(dastat & 1024) && ((double)ydim/(double)xdim) <= .75f) - { - xdim = (int32_t)((double)ydim * 1.33333333333333334f); - setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); - } - - x = scale(xdim,yxaspect,320); - sx = (xdim<<15)+32768+scale(sx-(320<<15),xdim,320); - sy = (ydim<<15)+32768+mulscale16(sy-(200<<15),x); - - if (dastat & 512) - sx += (oxdim-xdim)<<16; - else if ((dastat & 256) == 0) - sx += (oxdim-xdim)<<15; - } - z = mulscale16(z,x); - } - else if (!(dastat & 1024) && ((double)ydim/(double)xdim) <= .75f) - { - ydim = (int32_t)((double)xdim * 0.75f); - setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); - } - - d = (double)z/(65536.0*16384.0); - cosang2 = cosang = (double)sintable[(a+512)&2047]*d; - sinang2 = sinang = (double)sintable[a&2047]*d; - if ((dastat&2) || (!(dastat&8))) //Don't aspect unscaled perms - { d = (double)xyaspect/65536.0; cosang2 *= d; sinang2 *= d; } - px[0] = (double)sx/65536.0 - (double)xoff*cosang2+ (double)yoff*sinang2; - py[0] = (double)sy/65536.0 - (double)xoff*sinang - (double)yoff*cosang; - px[1] = px[0] + (double)xsiz*cosang2; - py[1] = py[0] + (double)xsiz*sinang; - px[3] = px[0] - (double)ysiz*sinang2; - py[3] = py[0] + (double)ysiz*cosang; - px[2] = px[1]+px[3]-px[0]; - py[2] = py[1]+py[3]-py[0]; - n = 4; - - gdx = 0; gdy = 0; gdo = 1.0; - //px[0]*gux + py[0]*guy + guo = 0 - //px[1]*gux + py[1]*guy + guo = xsiz-.0001 - //px[3]*gux + py[3]*guy + guo = 0 - d = 1.0/(px[0]*(py[1]-py[3]) + px[1]*(py[3]-py[0]) + px[3]*(py[0]-py[1])); - gux = (py[3]-py[0])*((double)xsiz-.0001)*d; - guy = (px[0]-px[3])*((double)xsiz-.0001)*d; - guo = 0 - px[0]*gux - py[0]*guy; - - if (!(dastat&4)) - { - //px[0]*gvx + py[0]*gvy + gvo = 0 - //px[1]*gvx + py[1]*gvy + gvo = 0 - //px[3]*gvx + py[3]*gvy + gvo = ysiz-.0001 - gvx = (py[0]-py[1])*((double)ysiz-.0001)*d; - gvy = (px[1]-px[0])*((double)ysiz-.0001)*d; - gvo = 0 - px[0]*gvx - py[0]*gvy; - } - else - { - //px[0]*gvx + py[0]*gvy + gvo = ysiz-.0001 - //px[1]*gvx + py[1]*gvy + gvo = ysiz-.0001 - //px[3]*gvx + py[3]*gvy + gvo = 0 - gvx = (py[1]-py[0])*((double)ysiz-.0001)*d; - gvy = (px[0]-px[1])*((double)ysiz-.0001)*d; - gvo = (double)ysiz-.0001 - px[0]*gvx - py[0]*gvy; - } - - cx2++; cy2++; - //Clippoly4 (converted from int32_t to double) - nn = z = 0; - do - { - zz = z+1; if (zz == n) zz = 0; - x1 = px[z]; x2 = px[zz]-x1; if ((cx1 <= x1) && (x1 <= cx2)) { px2[nn] = x1; py2[nn] = py[z]; nn++; } - if (x2 <= 0) fx = cx2; else fx = cx1; d = fx-x1; - if ((d < x2) != (d < 0)) { px2[nn] = fx; py2[nn] = (py[zz]-py[z])*d/x2 + py[z]; nn++; } - if (x2 <= 0) fx = cx1; else fx = cx2; d = fx-x1; - if ((d < x2) != (d < 0)) { px2[nn] = fx; py2[nn] = (py[zz]-py[z])*d/x2 + py[z]; nn++; } - z = zz; - } - while (z); - if (nn >= 3) - { - n = z = 0; - do - { - zz = z+1; if (zz == nn) zz = 0; - y1 = py2[z]; y2 = py2[zz]-y1; if ((cy1 <= y1) && (y1 <= cy2)) { py[n] = y1; px[n] = px2[z]; n++; } - if (y2 <= 0) fy = cy2; else fy = cy1; d = fy-y1; - if ((d < y2) != (d < 0)) { py[n] = fy; px[n] = (px2[zz]-px2[z])*d/y2 + px2[z]; n++; } - if (y2 <= 0) fy = cy1; else fy = cy2; d = fy-y1; - if ((d < y2) != (d < 0)) { py[n] = fy; px[n] = (px2[zz]-px2[z])*d/y2 + px2[z]; n++; } - z = zz; - } - while (z); -#ifdef USE_OPENGL - if (!nofog) bglDisable(GL_FOG); - pow2xsplit = 0; drawpoly(px,py,n,method); - if (!nofog) bglEnable(GL_FOG); -#else - pow2xsplit = 0; drawpoly(px,py,n,method); -#endif - } - -#ifdef USE_OPENGL - if (rendmode >= 3) - { -# ifdef POLYMER - if (rendmode >= 4) { - polymer_postrotatesprite(); - } -# endif - bglMatrixMode(GL_PROJECTION); bglPopMatrix(); - bglMatrixMode(GL_MODELVIEW); bglPopMatrix(); - } -#endif - - globalpicnum = ogpicnum; - globalshade = ogshade; - globalpal = ogpal; - ghalfx = oghalfx; - grhalfxdown10 = ogrhalfxdown10; - grhalfxdown10x = ogrhalfxdown10x; - ghoriz = oghoriz; - frameoffset = ofoffset; - xdimen = oxdimen; - ydimen = oydimen; - gchang = ogchang; - gshang = ogshang; - gctang = ogctang; - gstang = ogstang; - xdim = oxdim; - ydim = oydim; - - setaspect_new(); -} - -#ifdef USE_OPENGL -static float trapextx[2]; -static void drawtrap(float x0, float x1, float y0, float x2, float x3, float y1) -{ - float px[4], py[4]; - int32_t i, n; - - if (y0 == y1) return; - px[0] = x0; py[0] = y0; py[2] = y1; - if (x0 == x1) { px[1] = x3; py[1] = y1; px[2] = x2; n = 3; } - else if (x2 == x3) { px[1] = x1; py[1] = y0; px[2] = x3; n = 3; } - else { px[1] = x1; py[1] = y0; px[2] = x3; px[3] = x2; py[3] = y1; n = 4; } - - bglBegin(GL_TRIANGLE_FAN); - for (i=0; i allocpoints) //16 for safety - { - allocpoints = numpoints+16; - rst = (raster *)Brealloc(rst,allocpoints*sizeof(raster)); - slist = (int32_t *)Brealloc(slist,allocpoints*sizeof(int32_t)); - npoint2 = (int32_t *)Brealloc(npoint2,allocpoints*sizeof(int32_t)); - } - - //Remove unnecessary collinear points: - for (i=0; i m1) { z |= 2; continue; } - npoint2[i] = k; npoint2[j] = -1; npoints--; i--; //collinear - } - if (!z) return; - trapextx[0] = trapextx[1] = px[0]; - for (i=j=0; i trapextx[1]) trapextx[1] = px[i]; - slist[j++] = i; - } - if (z != 3) //Simple polygon... early out - { - bglBegin(GL_TRIANGLE_FAN); - for (i=0; i>1); gap; gap>>=1) - for (i=0; i=0; j-=gap) - { - if (py[npoint2[slist[j]]] <= py[npoint2[slist[j+gap]]]) break; - k = slist[j]; slist[j] = slist[j+gap]; slist[j+gap] = k; - } - - numrst = 0; - for (z=0; z0; i--) - { - if (rst[i-1].xi*(py[i1]-rst[i-1].y) + rst[i-1].x < px[i1]) break; - rst[i+1] = rst[i-1]; - } - numrst += 2; - - if (i&1) //split inside area - { - j = i-1; - - x0 = (py[i1] - rst[j ].y)*rst[j ].xi + rst[j ].x; - x1 = (py[i1] - rst[j+1].y)*rst[j+1].xi + rst[j+1].x; - drawtrap(rst[j].x,rst[j+1].x,rst[j].y,x0,x1,py[i1]); - rst[j ].x = x0; rst[j ].y = py[i1]; - rst[j+3].x = x1; rst[j+3].y = py[i1]; - } - - m0 = (px[i0]-px[i1]) / (py[i0]-py[i1]); - m1 = (px[i3]-px[i2]) / (py[i3]-py[i2]); - j = ((px[i1] > px[i2]) || ((i1 == i2) && (m0 >= m1))) + i; - k = (i<<1)+1 - j; - rst[j].i = i0; rst[j].xi = m0; rst[j].x = px[i1]; rst[j].y = py[i1]; - rst[k].i = i3; rst[k].xi = m1; rst[k].x = px[i2]; rst[k].y = py[i2]; - } - else - { - //NOTE:don't count backwards! - if (i1 == i2) { for (i=0; i py[i0]) && (py[i2] > py[i3])) //Delete raster - { - for (; j<=i+1; j+=2) - { - x0 = (py[i1] - rst[j ].y)*rst[j ].xi + rst[j ].x; - if ((i == j) && (i1 == i2)) x1 = x0; else x1 = (py[i1] - rst[j+1].y)*rst[j+1].xi + rst[j+1].x; - drawtrap(rst[j].x,rst[j+1].x,rst[j].y,x0,x1,py[i1]); - rst[j ].x = x0; rst[j ].y = py[i1]; - rst[j+1].x = x1; rst[j+1].y = py[i1]; - } - numrst -= 2; for (; i=0; i--) - { - ((float *)rx1)[i] = ((float)rx1[i])/4096.0; - ((float *)ry1)[i] = ((float)ry1[i])/4096.0; - } - - if (gloy1 != -1) setpolymost2dview(); //disables blending, texturing, and depth testing - bglEnable(GL_ALPHA_TEST); - bglEnable(GL_TEXTURE_2D); - pth = gltexcache(globalpicnum,globalpal,0); - bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); - - f = ((float)(numpalookups-min(max((globalshade * shadescale),0),numpalookups)))/((float)numpalookups); - switch ((globalorientation>>7)&3) - { - case 0: - case 1: - a = 1.0f; bglDisable(GL_BLEND); break; - case 2: - a = 0.66f; bglEnable(GL_BLEND); break; - case 3: - a = 0.33f; bglEnable(GL_BLEND); break; - } - bglColor4f(f,f,f,a); - - tessectrap((float *)rx1,(float *)ry1,xb1,npoints); -} -#endif - -int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom) -{ -#ifdef USE_OPENGL - float xdime, ydime, xdimepad, ydimepad, scx, scy, ratio = 1.0; - int32_t i; - pthtyp *pth; - - if ((rendmode < 3) || (qsetmode != 200)) return(-1); - - if (!glinfo.texnpot) - { - i = (1<<(picsiz[wallnum]&15)); if (i < tilesizx[wallnum]) i += i; xdimepad = (float)i; - i = (1<<(picsiz[wallnum]>>4)); if (i < tilesizy[wallnum]) i += i; ydimepad = (float)i; - } - else - { - xdimepad = (float)tilesizx[wallnum]; - ydimepad = (float)tilesizy[wallnum]; - } - xdime = (float)tilesizx[wallnum]; xdimepad = xdime/xdimepad; - ydime = (float)tilesizy[wallnum]; ydimepad = ydime/ydimepad; - - if ((xdime <= dimen) && (ydime <= dimen)) - { - scx = xdime; - scy = ydime; - } - else - { - scx = (float)dimen; - scy = (float)dimen; - if (xdime < ydime) scx *= xdime/ydime; else scy *= ydime/xdime; - } - - pth = gltexcache(wallnum,0,4); - bglBindTexture(GL_TEXTURE_2D,pth ? pth->glpic : 0); - - bglDisable(GL_ALPHA_TEST); - - if (tilezoom) - { - if (scx > scy) ratio = dimen/scx; - else ratio = dimen/scy; - } - - if (!pth || (pth->flags & 8)) - { - bglDisable(GL_TEXTURE_2D); - bglBegin(GL_TRIANGLE_FAN); - if (gammabrightness) - bglColor4f((float)curpalette[255].r/255.0, - (float)curpalette[255].g/255.0, - (float)curpalette[255].b/255.0, - 1); - else - bglColor4f((float)britable[curbrightness][ curpalette[255].r ] / 255.0, - (float)britable[curbrightness][ curpalette[255].g ] / 255.0, - (float)britable[curbrightness][ curpalette[255].b ] / 255.0, - 1); - bglVertex2f((float)tilex ,(float)tiley); - bglVertex2f((float)tilex+(scx*ratio),(float)tiley); - bglVertex2f((float)tilex+(scx*ratio),(float)tiley+(scy*ratio)); - bglVertex2f((float)tilex ,(float)tiley+(scy*ratio)); - bglEnd(); - } - - bglColor4f(1,1,1,1); - bglEnable(GL_TEXTURE_2D); - bglEnable(GL_BLEND); - bglBegin(GL_TRIANGLE_FAN); - bglTexCoord2f(0, 0); bglVertex2f((float)tilex ,(float)tiley); - bglTexCoord2f(xdimepad, 0); bglVertex2f((float)tilex+(scx*ratio),(float)tiley); - bglTexCoord2f(xdimepad,ydimepad); bglVertex2f((float)tilex+(scx*ratio),(float)tiley+(scy*ratio)); - bglTexCoord2f(0,ydimepad); bglVertex2f((float)tilex ,(float)tiley+(scy*ratio)); - bglEnd(); - - return(0); -#else - return -1; -#endif -} - -int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize) -{ -#ifndef USE_OPENGL - return -1; -#else - GLfloat tx, ty, txc, tyc; - int32_t c; - palette_t p,b; - - if (gammabrightness) - { - p = curpalette[col]; - b = curpalette[backcol]; - } - else - { - p.r = britable[curbrightness][ curpalette[col].r ]; - p.g = britable[curbrightness][ curpalette[col].g ]; - p.b = britable[curbrightness][ curpalette[col].b ]; - b.r = britable[curbrightness][ curpalette[backcol].r ]; - b.g = britable[curbrightness][ curpalette[backcol].g ]; - b.b = britable[curbrightness][ curpalette[backcol].b ]; - } - - if ((rendmode < 3) || (qsetmode != 200)) return(-1); - - if (!polymosttext) - { - // construct a 256x128 8-bit alpha-only texture for the font glyph matrix - char *tbuf, *cptr, *tptr; - int32_t h,i,j; - - bglGenTextures(1,&polymosttext); - if (!polymosttext) return -1; - - tbuf = (char *)Bmalloc(256*128); - if (!tbuf) - { - bglDeleteTextures(1,&polymosttext); - polymosttext = 0; - return -1; - } - Bmemset(tbuf, 0, 256*128); - - cptr = (char *)textfont; - for (h=0; h<256; h++) - { - tptr = tbuf + (h%32)*8 + (h/32)*256*8; - for (i=0; i<8; i++) - { - for (j=0; j<8; j++) - { - if (cptr[h*8+i] & pow2char[7-j]) tptr[j] = 255; - } - tptr += 256; - } - } - - cptr = (char *)smalltextfont; - for (h=0; h<256; h++) - { - tptr = tbuf + 256*64 + (h%32)*8 + (h/32)*256*8; - for (i=1; i<7; i++) - { - for (j=2; j<6; j++) - { - if (cptr[h*8+i] & pow2char[7-j]) tptr[j-2] = 255; - } - tptr += 256; - } - } - - bglBindTexture(GL_TEXTURE_2D, polymosttext); - bglTexImage2D(GL_TEXTURE_2D,0,GL_ALPHA,256,128,0,GL_ALPHA,GL_UNSIGNED_BYTE,(GLvoid *)tbuf); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); - Bfree(tbuf); - } - else bglBindTexture(GL_TEXTURE_2D, polymosttext); - - setpolymost2dview(); // disables blending, texturing, and depth testing - bglDisable(GL_ALPHA_TEST); - bglDepthMask(GL_FALSE); // disable writing to the z-buffer - - if (backcol >= 0) - { - bglColor4ub(b.r,b.g,b.b,255); - c = Bstrlen(name); - - bglBegin(GL_QUADS); - bglVertex2i(xpos,ypos); - bglVertex2i(xpos,ypos+(fontsize?6:8)); - bglVertex2i(xpos+(c<<(3-fontsize)),ypos+(fontsize?6:8)); - bglVertex2i(xpos+(c<<(3-fontsize)),ypos); - bglEnd(); - } - - bglPushAttrib(GL_POLYGON_BIT); // we want to have readable text in wireframe mode, too - bglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - bglEnable(GL_TEXTURE_2D); - bglEnable(GL_BLEND); - bglColor4ub(p.r,p.g,p.b,255); - txc = fontsize ? (4.0/256.0) : (8.0/256.0); - tyc = fontsize ? (6.0/128.0) : (8.0/128.0); - bglBegin(GL_QUADS); - for (c=0; name[c]; c++) - { - if (name[c] == '^' && isdigit(name[c+1])) - { - char smallbuf[8]; - int32_t bi=0; - while (isdigit(name[c+1]) && bi<8) - { - smallbuf[bi++]=name[c+1]; - c++; - } - smallbuf[bi++]=0; - if (col)col = atol(smallbuf); - - if (gammabrightness) - { - p = curpalette[col]; - } - else - { - p.r = britable[curbrightness][ curpalette[col].r ]; - p.g = britable[curbrightness][ curpalette[col].g ]; - p.b = britable[curbrightness][ curpalette[col].b ]; - } - bglColor4ub(p.r,p.g,p.b,255); - continue; - } - tx = (float)(name[c]%32)/32.0; - ty = (float)((name[c]/32) + (fontsize*8))/16.0; - - bglTexCoord2f(tx,ty); bglVertex2i(xpos,ypos); - bglTexCoord2f(tx+txc,ty); bglVertex2i(xpos+(8>>fontsize),ypos); - bglTexCoord2f(tx+txc,ty+tyc); bglVertex2i(xpos+(8>>fontsize),ypos+(fontsize?6:8)); - bglTexCoord2f(tx,ty+tyc); bglVertex2i(xpos,ypos+(fontsize?6:8)); - - xpos += (8>>fontsize); - } - bglEnd(); - - bglDepthMask(GL_TRUE); // re-enable writing to the z-buffer - bglPopAttrib(); - - return 0; -#endif -} - -// Console commands by JBF -#ifdef USE_OPENGL -static int32_t gltexturemode(const osdfuncparm_t *parm) -{ - int32_t m; - const char *p; - - if (parm->numparms != 1) - { - OSD_Printf("Current texturing mode is %s\n", glfiltermodes[gltexfiltermode].name); - OSD_Printf(" Vaild modes are:\n"); - for (m = 0; m < (int32_t)numglfiltermodes; m++) - OSD_Printf(" %d - %s\n",m,glfiltermodes[m].name); - - return OSDCMD_OK; - } - - m = Bstrtoul(parm->parms[0], (char **)&p, 10); - if (p == parm->parms[0]) - { - // string - for (m = 0; m < (int32_t)numglfiltermodes; m++) - { - if (!Bstrcasecmp(parm->parms[0], glfiltermodes[m].name)) break; - } - if (m == numglfiltermodes) m = gltexfiltermode; // no change - } - else - { - if (m < 0) m = 0; - else if (m >= (int32_t)numglfiltermodes) m = numglfiltermodes - 1; - } - - gltexfiltermode = m; - gltexapplyprops(); - - OSD_Printf("Texture filtering mode changed to %s\n", glfiltermodes[gltexfiltermode].name); - - return OSDCMD_OK; -} -#endif - -static int32_t osdcmd_cvar_set_polymost(const osdfuncparm_t *parm) -{ - int32_t r = osdcmd_cvar_set(parm); - - if (xdim == 0 || ydim == 0 || bpp == 0) // video not set up yet - return r; - -#ifdef USE_OPENGL - if (r == OSDCMD_OK) - { - if (!Bstrcasecmp(parm->name, "r_swapinterval")) - { - setvsync(vsync); - return r; - } - else if (!Bstrcasecmp(parm->name, "r_downsize")) - { - if (r_downsize != r_downsizevar && r_downsizevar != -1) - { - invalidatecache(); - resetvideomode(); - if (setgamemode(fullscreen,xdim,ydim,bpp)) - OSD_Printf("restartvid: Reset failed...\n"); - } - else r_downsizevar = r_downsize; - - return r; - } - else if (!Bstrcasecmp(parm->name, "r_textureanisotropy")) - { - gltexapplyprops(); - return r; - } - else if (!Bstrcasecmp(parm->name, "r_texturemode")) - { - gltexturemode(parm); - return r; - } -#ifdef POLYMER - else if (!Bstrcasecmp(parm->name, "r_pr_maxlightpasses")) - { - if (pr_maxlightpasses != r_pr_maxlightpasses) - { - polymer_invalidatelights(); - pr_maxlightpasses = r_pr_maxlightpasses; - } - return r; - } -#endif - } -#endif - return r; -} - -void polymost_initosdfuncs(void) -{ - uint32_t i; - - cvar_t cvars_polymost[] = - { -#ifdef USE_OPENGL - { "r_animsmoothing","r_animsmoothing: enable/disable model animation smoothing",(void *) &r_animsmoothing, CVAR_BOOL, 0, 1 }, - { "r_modelocclusionchecking","r_modelocclusionchecking: enable/disable hack to cull \"obstructed\" models",(void *) &r_modelocclusionchecking, CVAR_INT, 0, 2 }, - { "r_detailmapping","r_detailmapping: enable/disable detail mapping",(void *) &r_detailmapping, CVAR_BOOL, 0, 1 }, - { "r_downsize","r_downsize: controls downsizing factor for hires textures",(void *) &r_downsize, CVAR_INT|CVAR_FUNCPTR, 0, 5 }, - { "r_fullbrights","r_fullbrights: enable/disable fullbright textures",(void *) &r_fullbrights, CVAR_BOOL, 0, 1 }, - { "r_glowmapping","r_glowmapping: enable/disable glow mapping",(void *) &r_glowmapping, CVAR_BOOL, 0, 1 }, - /* - { "r_multisample","r_multisample: sets the number of samples used for antialiasing (0 = off)",(void *)&r_glowmapping, CVAR_BOOL, 0, 1 } - { "r_nvmultisamplehint","r_nvmultisamplehint: enable/disable Nvidia multisampling hinting",(void *)&glnvmultisamplehint, CVAR_BOOL, 0, 1 } - */ - { - "r_parallaxskyclamping","r_parallaxskyclamping: enable/disable parallaxed floor/ceiling sky texture clamping", - (void *) &r_parallaxskyclamping, CVAR_BOOL, 0, 1 - }, - { - "r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky", - (void *) &r_parallaxskypanning, CVAR_BOOL, 0, 1 - }, - { "r_polygonmode","r_polygonmode: debugging feature",(void *) &glpolygonmode, CVAR_INT | CVAR_NOSAVE, 0, 3 }, - { "r_redbluemode","r_redbluemode: enable/disable experimental OpenGL red-blue glasses mode",(void *) &glredbluemode, CVAR_BOOL, 0, 1 }, - { "r_shadescale","r_shadescale: multiplier for lighting",(void *) &shadescale, CVAR_FLOAT, 0, 10 }, - { "r_swapinterval","r_swapinterval: sets the GL swap interval (VSync)",(void *) &vsync, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "r_texcache","r_texcache: enable/disable OpenGL compressed texture cache",(void *) &glusetexcache, CVAR_INT, 0, 2 }, - { "r_texcompr","r_texcompr: enable/disable OpenGL texture compression",(void *) &glusetexcompr, CVAR_BOOL, 0, 1 }, - { "r_textureanisotropy", "r_textureanisotropy: changes the OpenGL texture anisotropy setting", (void *) &glanisotropy, CVAR_INT|CVAR_FUNCPTR, 0, 16 }, - { "r_texturemaxsize","r_texturemaxsize: changes the maximum OpenGL texture size limit",(void *) &gltexmaxsize, CVAR_INT | CVAR_NOSAVE, 0, 4096 }, - { "r_texturemiplevel","r_texturemiplevel: changes the highest OpenGL mipmap level used",(void *) &gltexmiplevel, CVAR_INT, 0, 6 }, - { "r_texturemode", "r_texturemode: changes the texture filtering settings", (void *) &gltexfiltermode, CVAR_INT|CVAR_FUNCPTR, 0, 5 }, - { "r_vbocount","r_vbocount: sets the number of Vertex Buffer Objects to use when drawing models",(void *) &r_vbocount, CVAR_INT, 1, 256 }, - { "r_vbos","r_vbos: enable/disable using Vertex Buffer Objects when drawing models",(void *) &r_vbos, CVAR_BOOL, 0, 1 }, - { "r_vertexarrays","r_vertexarrays: enable/disable using vertex arrays when drawing models",(void *) &r_vertexarrays, CVAR_BOOL, 0, 1 }, - { "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void *) &glwidescreen, CVAR_BOOL, 0, 1 }, - { "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void *) &glprojectionhacks, CVAR_INT, 0, 2 }, - -#ifdef POLYMER - // polymer cvars - { "r_pr_lighting", "r_pr_lighting: enable/disable dynamic lights", (void *) &pr_lighting, CVAR_BOOL, 0, 1 }, - { "r_pr_normalmapping", "r_pr_normalmapping: enable/disable virtual displacement mapping", (void *) &pr_normalmapping, CVAR_BOOL, 0, 1 }, - { "r_pr_specularmapping", "r_pr_specularmapping: enable/disable specular mapping", (void *) &pr_specularmapping, CVAR_BOOL, 0, 1 }, - { "r_pr_shadows", "r_pr_shadows: enable/disable dynamic shadows", (void *) &pr_shadows, CVAR_BOOL, 0, 1 }, - { "r_pr_shadowcount", "r_pr_shadowcount: maximal amount of shadow emitting lights on screen - you need to restart the renderer for it to take effect", (void *) &pr_shadowcount, CVAR_INT, 0, 64 }, - { "r_pr_shadowdetail", "r_pr_shadowdetail: sets the shadow map resolution - you need to restart the renderer for it to take effect", (void *) &pr_shadowdetail, CVAR_INT, 0, 5 }, - { "r_pr_shadowfiltering", "r_pr_shadowfiltering: enable/disable shadow edges filtering - you need to restart the renderer for it to take effect", (void *) &pr_shadowfiltering, CVAR_BOOL, 0, 1 }, - { "r_pr_maxlightpasses", "r_pr_maxlightpasses: the maximal amount of lights a single object can by affected by", (void *) &r_pr_maxlightpasses, CVAR_INT|CVAR_FUNCPTR, 0, PR_MAXLIGHTS }, - { "r_pr_maxlightpriority", "r_pr_maxlightpriority: lowering that value removes less meaningful lights from the scene", (void *) &pr_maxlightpriority, CVAR_INT, 0, PR_MAXLIGHTPRIORITY }, - { "r_pr_fov", "r_pr_fov: sets the field of vision in build angle", (void *) &pr_fov, CVAR_INT, 0, 1023}, - { "r_pr_customaspect", "r_pr_customaspect: if non-zero, forces the 3D view aspect ratio", (void *) &pr_customaspect, CVAR_FLOAT, 0, 3 }, - { "r_pr_billboardingmode", "r_pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void *) &pr_billboardingmode, CVAR_INT, 0, 1 }, - { "r_pr_verbosity", "r_pr_verbosity: verbosity level of the polymer renderer", (void *) &pr_verbosity, CVAR_INT, 0, 3 }, - { "r_pr_wireframe", "r_pr_wireframe: toggles wireframe mode", (void *) &pr_wireframe, CVAR_INT | CVAR_NOSAVE, 0, 1 }, - { "r_pr_vbos", "r_pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void *) &pr_vbos, CVAR_INT, 0, 2 }, - { "r_pr_gpusmoothing", "r_pr_gpusmoothing: toggles model animation interpolation", (void *) &pr_gpusmoothing, CVAR_INT, 0, 1 }, - { "r_pr_overrideparallax", "r_pr_overrideparallax: overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void *) &pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 1 }, - { "r_pr_parallaxscale", "r_pr_parallaxscale: overriden parallax mapping offset scale", (void *) &pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 }, - { "r_pr_parallaxbias", "r_pr_parallaxbias: overriden parallax mapping offset bias", (void *) &pr_parallaxbias, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 }, - { "r_pr_overridespecular", "r_pr_overridespecular: overrides specular material power and factor values with values from the pr_specularpower and pr_specularfactor cvars; use it to fine-tune DEF tokens", (void *) &pr_overridespecular, CVAR_BOOL | CVAR_NOSAVE, 0, 1 }, - { "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void *) &pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 }, - { "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void *) &pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 }, - { "r_pr_highpalookups", "r_pr_highpalookups: enable/disable highpalookups", (void *) &pr_highpalookups, CVAR_BOOL, 0, 1 }, - { "r_pr_overridehud", "r_pr_overridehud: overrides hud model parameters with values from the pr_hud* cvars; use it to fine-tune DEF tokens", (void *) &pr_overridehud, CVAR_BOOL | CVAR_NOSAVE, 0, 1 }, - { "r_pr_hudxadd", "r_pr_hudxadd: overriden HUD xadd; see r_pr_overridehud", (void *) &pr_hudxadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 }, - { "r_pr_hudyadd", "r_pr_hudyadd: overriden HUD yadd; see r_pr_overridehud", (void *) &pr_hudyadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 }, - { "r_pr_hudzadd", "r_pr_hudzadd: overriden HUD zadd; see r_pr_overridehud", (void *) &pr_hudzadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 }, - { "r_pr_hudangadd", "r_pr_hudangadd: overriden HUD angadd; see r_pr_overridehud", (void *) &pr_hudangadd, CVAR_INT | CVAR_NOSAVE, -512, 512 }, - { "r_pr_hudfov", "r_pr_hudfov: overriden HUD fov; see r_pr_overridehud", (void *) &pr_hudfov, CVAR_INT | CVAR_NOSAVE, 0, 1023 }, - { "r_pr_overridemodelscale", "r_pr_overridemodelscale: overrides model scale if non-zero; use it to fine-tune DEF tokens", (void *) &pr_overridemodelscale, CVAR_FLOAT | CVAR_NOSAVE, 0, 500 }, - { "r_pr_ati_fboworkaround", "r_pr_ati_fboworkaround: enable this to workaround an ATI driver bug that causes sprite shadows to be square - you need to restart the renderer for it to take effect", (void *) &pr_ati_fboworkaround, CVAR_BOOL | CVAR_NOSAVE, 0, 1 }, - { "r_pr_ati_nodepthoffset", "r_pr_ati_nodepthoffset: enable this to workaround an ATI driver bug that causes sprite drawing to freeze the game on Radeon X1x00 hardware - you need to restart the renderer for it to take effect", (void *) &pr_ati_nodepthoffset, CVAR_BOOL | CVAR_NOSAVE, 0, 1 }, -#endif - - { "r_models","r_models: enable/disable model rendering",(void *) &usemodels, CVAR_BOOL, 0, 1 }, - { "r_hightile","r_hightile: enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 }, - - { "r_preview_mouseaim", "r_preview_mouseaim: toggles mouse aiming preview, use this to calibrate yxaspect in Polymost Mapster32", (void *) &preview_mouseaim, CVAR_BOOL, 0, 1 }, -#endif - }; - - for (i=0; imdnum < 2) return; - - { - int32_t i,j=0; - - if (models[mid]->mdnum == 3) - j = ((md3model_t *)models[mid])->head.numsurfs; - - for (i=0; i<=j; i++) - { - mdloadskin((md2model_t *)models[mid], 0, dapalnum, i); - } - } -#endif -} - -static uint16_t hicosub(uint16_t c) -{ - int32_t r, g, b; - g = ((c>> 5)&63); - r = ((c>>11)-(g>>1))&31; - b = ((c>> 0)-(g>>1))&31; - return((r<<11)+(g<<5)+b); -} - -static uint16_t hicoadd(uint16_t c) -{ - int32_t r, g, b; - g = ((c>> 5)&63); - r = ((c>>11)+(g>>1))&31; - b = ((c>> 0)+(g>>1))&31; - return((r<<11)+(g<<5)+b); -} - -/* -Description of Ken's filter to improve LZW compression of DXT1 format by ~15%: (as tested with the HRP) - - To increase LZW patterns, I store each field of the DXT block structure separately. - Here are the 3 DXT fields: - 1. __int64 alpha_4x4; //DXT3 only (16 byte structure size when included) - 2. short rgb0, rgb1; - 3. int32_t index_4x4; - - Each field is then stored with its own specialized algorithm. - 1. I haven't done much testing with this field - I just copy it raw without any transform for now. - - 2. For rgb0 and rgb1, I use a "green" filter like this: - g = g; - r = r-g; - b = b-g; - For grayscale, this makes the stream: x,0,0,x,0,0,x,0,0,... instead of x,x,x,x,x,x,x,x,... - Q:what was the significance of choosing green? A:largest/most dominant component - Believe it or not, this gave 1% better compression :P - I tried subtracting each componenet with the previous pixel, but strangely it hurt compression. - Oh, the joy of trial & error. :) - - 3. For index_4x4, I transform the ordering of 2-bit indices in the DXT blocks from this: - 0123 0123 0123 ---- ---- ---- - 4567 4567 4567 ---- ---- ---- - 89ab 89ab 89ab ---- ---- ---- - cdef cdef cdef ---- ---- ---- - To this: (I swap x & y axes) - 048c 048c 048c |||| |||| |||| - 159d 159d 159d |||| |||| |||| - 26ae 26ae 26ae |||| |||| |||| - 37bf 37bf 37bf |||| |||| |||| - The trick is: going from the bottom of the 4th line to the top of the 5th line - is the exact same jump (geometrically) as from 5th to 6th, etc.. This is not true in the top case. - These silly tricks will increase patterns and therefore make LZW compress better. - I think this improved compression by a few % :) - */ - -#ifdef USE_OPENGL -int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, uint32_t miplen) -{ - void *writebuf; - uint32_t j, k, offs, stride, cleng; - char *cptr; - - if ((pict->format == B_LITTLE32(GL_COMPRESSED_RGB_S3TC_DXT1_EXT)) || - (pict->format == B_LITTLE32(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT))) { offs = 0; stride = 8; } - else if ((pict->format == B_LITTLE32(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT)) || - (pict->format == B_LITTLE32(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT))) { offs = 8; stride = 16; } - else { offs = 0; stride = 8; } - - if (stride == 16) //If DXT3... - { - //alpha_4x4 - cptr = midbuf; - for (k=0; k<8; k++) *cptr++ = pic[k]; - for (j=stride; (unsigned)j j-1) - { - cleng = j; - writebuf = midbuf; - } - else writebuf = packbuf; - } - else - { - cleng = (miplen/stride)<<3; - writebuf = midbuf; - } - j = B_LITTLE32(cleng); - Bwrite(fil,&j,sizeof(j)); - Bwrite(fil,writebuf,cleng); - } - - //rgb0,rgb1 - cptr = midbuf; - for (k=0; k<=2; k+=2) - for (j=0; (unsigned)j j-1) - { - cleng = j; - writebuf = midbuf; - } - else writebuf = packbuf; - } - else - { - cleng = (miplen/stride)<<2; - writebuf = midbuf; - } - j = B_LITTLE32(cleng); - Bwrite(fil,&j,sizeof(j)); - Bwrite(fil,writebuf,cleng); - - //index_4x4 - cptr = midbuf; - for (j=0; (unsigned)j>0)&3) + (((c2[1]>>0)&3)<<2) + (((c2[2]>>0)&3)<<4) + (((c2[3]>>0)&3)<<6); - cptr[1] = ((c2[0]>>2)&3) + (((c2[1]>>2)&3)<<2) + (((c2[2]>>2)&3)<<4) + (((c2[3]>>2)&3)<<6); - cptr[2] = ((c2[0]>>4)&3) + (((c2[1]>>4)&3)<<2) + (((c2[2]>>4)&3)<<4) + (((c2[3]>>4)&3)<<6); - cptr[3] = ((c2[0]>>6)&3) + (((c2[1]>>6)&3)<<2) + (((c2[2]>>6)&3)<<4) + (((c2[3]>>6)&3)<<6); - cptr += 4; - } - if (glusetexcache == 2) - { - j = (miplen/stride)<<2; - cleng = qlz_compress(midbuf,packbuf,j,state_compress); - if (cleng == 0 || cleng > j-1) - { - cleng = j; - writebuf = midbuf; - } - else writebuf = packbuf; - } - else - { - cleng = (miplen/stride)<<2; - writebuf = midbuf; - } - j = B_LITTLE32(cleng); - Bwrite(fil,&j,sizeof(j)); - Bwrite(fil,writebuf,cleng); - return 0; -} - -int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, int32_t ispacked) -{ - void *inbuf; - int32_t j, k, offs, stride, cleng; - char *cptr; - - if (ispacked) inbuf = packbuf; else inbuf = midbuf; - - if ((pict->format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT) || - (pict->format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)) { offs = 0; stride = 8; } - else if ((pict->format == GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) || - (pict->format == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)) { offs = 8; stride = 16; } - else { offs = 0; stride = 8; } - - if (stride == 16) //If DXT3... - { - //alpha_4x4 - if (memcachedata && memcachesize >= (signed)(cachepos + sizeof(int32_t))) - { - cleng = *(int32_t *)(memcachedata + cachepos); - cachepos += sizeof(int32_t); - } - else - { - Blseek(fil, cachepos, BSEEK_SET); - cachepos += sizeof(int32_t); - if (Bread(fil,&cleng,sizeof(int32_t)) < (signed)sizeof(int32_t)) return -1; - cleng = B_LITTLE32(cleng); - } - - j = (pict->size/stride)*8; - - if (ispacked && cleng < j) inbuf = packbuf; else inbuf = midbuf; - - if (memcachedata && memcachesize >= (signed)(cachepos + cleng)) - { - if (ispacked && cleng < j) - { - if (qlz_decompress((const char *)memcachedata + cachepos,midbuf,state_decompress) == 0) - { - cachepos += cleng; - return -1; - } - } - else Bmemcpy(inbuf, memcachedata + cachepos, cleng); - - cachepos += cleng; - } - else - { - Blseek(fil, cachepos, BSEEK_SET); - cachepos += cleng; - if (Bread(fil,inbuf,cleng) < cleng) return -1; - - - if (ispacked && cleng < j) - if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1; - } - - cptr = midbuf; - for (k=0; k<8; k++) pic[k] = *cptr++; - for (j=stride; jsize; j+=stride) - for (k=0; k<8; k++) pic[j+k] = (*cptr++); - } - - //rgb0,rgb1 - if (memcachedata && memcachesize >= (signed)(cachepos + sizeof(int32_t))) - { - cleng = *(int32_t *)(memcachedata + cachepos); - cachepos += sizeof(int32_t); - } - else - { - Blseek(fil, cachepos, BSEEK_SET); - cachepos += sizeof(int32_t); - if (Bread(fil,&cleng,sizeof(int32_t)) < (signed)sizeof(int32_t)) return -1; - cleng = B_LITTLE32(cleng); - } - - j = (pict->size/stride)*4; - if (ispacked && cleng < j) inbuf = packbuf; else inbuf = midbuf; - - if (memcachedata && memcachesize >= (signed)(cachepos + cleng)) - { - if (ispacked && cleng < j) - { - if (qlz_decompress((const char *)memcachedata + cachepos,midbuf,state_decompress) == 0) - { - cachepos += cleng; - return -1; - } - } - else Bmemcpy(inbuf, memcachedata + cachepos, cleng); - - cachepos += cleng; - } - else - { - Blseek(fil, cachepos, BSEEK_SET); - cachepos += cleng; - if (Bread(fil,inbuf,cleng) < cleng) return -1; - - if (ispacked && cleng < j) - if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1; - } - - cptr = midbuf; - for (k=0; k<=2; k+=2) - { - for (j=0; jsize; j+=stride) - { - *(int16_t *)(&pic[offs+j+k]) = hicoadd(*(int16_t *)cptr); - cptr += 2; - } - } - - //index_4x4: - if (memcachedata && memcachesize >= (signed)(cachepos + sizeof(int32_t))) - { - cleng = *(int32_t *)(memcachedata + cachepos); - cachepos += sizeof(int32_t); - } - else - { - Blseek(fil, cachepos, BSEEK_SET); - cachepos += sizeof(int32_t); - if (Bread(fil,&cleng,sizeof(int32_t)) < (signed)sizeof(int32_t)) return -1; - cleng = B_LITTLE32(cleng); - } - - j = (pict->size/stride)*4; - if (ispacked && cleng < j) inbuf = packbuf; else inbuf = midbuf; - - if (memcachedata && memcachesize >= (signed)(cachepos + cleng)) - { - if (ispacked && cleng < j) - { - if (qlz_decompress((const char *)memcachedata + cachepos,midbuf,state_decompress) == 0) - { - cachepos += cleng; - return -1; - } - } - else Bmemcpy(inbuf, memcachedata + cachepos, cleng); - - cachepos += cleng; - } - else - { - Blseek(fil, cachepos, BSEEK_SET); - cachepos += cleng; - if (Bread(fil,inbuf,cleng) < cleng) return -1; - - if (ispacked && cleng < j) - if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1; - } - - cptr = midbuf; - for (j=0; jsize; j+=stride) - { - pic[j+offs+4] = ((cptr[0]>>0)&3) + (((cptr[1]>>0)&3)<<2) + (((cptr[2]>>0)&3)<<4) + (((cptr[3]>>0)&3)<<6); - pic[j+offs+5] = ((cptr[0]>>2)&3) + (((cptr[1]>>2)&3)<<2) + (((cptr[2]>>2)&3)<<4) + (((cptr[3]>>2)&3)<<6); - pic[j+offs+6] = ((cptr[0]>>4)&3) + (((cptr[1]>>4)&3)<<2) + (((cptr[2]>>4)&3)<<4) + (((cptr[3]>>4)&3)<<6); - pic[j+offs+7] = ((cptr[0]>>6)&3) + (((cptr[1]>>6)&3)<<2) + (((cptr[2]>>6)&3)<<4) + (((cptr[3]>>6)&3)<<6); - cptr += 4; - } - return 0; -} -#endif - -#else /* POLYMOST */ - -#include "inttypes.h" -int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen) { return -1; } - -#endif - -// vim:ts=4:sw=4: diff --git a/polymer-perf/eduke32/build/src/pragmas.c b/polymer-perf/eduke32/build/src/pragmas.c deleted file mode 100644 index 2e5410d48..000000000 --- a/polymer-perf/eduke32/build/src/pragmas.c +++ /dev/null @@ -1,245 +0,0 @@ -// Function-wrapped Watcom pragmas -// by Jonathon Fowler (jonof@edgenetwk.com) -// -// These functions represent some of the more longer-winded pragmas -// from the original pragmas.h wrapped into functions for easier -// use since many jumps and whatnot make it harder to write macro- -// inline versions. I'll eventually convert these to macro-inline -// equivalents. --Jonathon - -//#include "pragmas.h" -#include "compat.h" - -int32_t dmval; - -#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // NOASM - -// -// GCC Inline Assembler version -// - -#define ASM __asm__ __volatile__ - - -int32_t boundmulscale(int32_t a, int32_t b, int32_t c) -{ - ASM( - "imull %%ebx\n\t" - "movl %%edx, %%ebx\n\t" // mov ebx, edx - "shrdl %%cl, %%edx, %%eax\n\t" // mov eax, edx, cl - "sarl %%cl, %%edx\n\t" // sar edx, cl - "xorl %%eax, %%edx\n\t" // xor edx, eax - "js 0f\n\t" // js checkit - "xorl %%eax, %%edx\n\t" // xor edx, eax - "jz 1f\n\t" // js skipboundit - "cmpl $0xffffffff, %%edx\n\t" // cmp edx, 0xffffffff - "je 1f\n\t" // je skipboundit - "0:\n\t" // checkit: - "movl %%ebx, %%eax\n\t" // mov eax, ebx - "sarl $31, %%eax\n\t" // sar eax, 31 - "xorl $0x7fffffff, %%eax\n\t" // xor eax, 0x7fffffff - "1:" // skipboundit: - : "+a"(a), "+b"(b), "+c"(c) // input eax ebx ecx - : - : "edx", "cc" - ); - return a; -} - - -void clearbufbyte(void *D, int32_t c, int32_t a) -{ - ASM( - "cmpl $4, %%ecx\n\t" - "jae 1f\n\t" - "testb $1, %%cl\n\t" - "jz 0f\n\t" // jz preskip - "stosb\n\t" - "0:\n\t" // preskip: - "shrl $1, %%ecx\n\t" - "rep\n\t" - "stosw\n\t" - "jmp 5f\n\t" // jmp endit - "1:\n\t" // intcopy: - "testl $1, %%edi\n\t" - "jz 2f\n\t" // jz skip1 - "stosb\n\t" - "decl %%ecx\n\t" - "2:\n\t" // skip1: - "testl $2, %%edi\n\t" - "jz 3f\n\t" // jz skip2 - "stosw\n\t" - "subl $2, %%ecx\n\t" - "3:\n\t" // skip2: - "movl %%ecx, %%ebx\n\t" - "shrl $2, %%ecx\n\t" - "rep\n\t" - "stosl\n\t" - "testb $2, %%bl\n\t" - "jz 4f\n\t" // jz skip3 - "stosw\n\t" - "4:\n\t" // skip3: - "testb $1, %%bl\n\t" - "jz 5f\n\t" // jz endit - "stosb\n\t" - "5:" // endit - : "+D"(D), "+c"(c), "+a"(a) : - : "ebx", "memory", "cc" - ); -} - -void copybufbyte(void *S, void *D, int32_t c) -{ - ASM( - "cmpl $4, %%ecx\n\t" // cmp ecx, 4 - "jae 1f\n\t" - "testb $1, %%cl\n\t" // test cl, 1 - "jz 0f\n\t" - "movsb\n\t" - "0:\n\t" // preskip: - "shrl $1, %%ecx\n\t" // shr ecx, 1 - "rep\n\t" - "movsw\n\t" - "jmp 5f\n\t" - "1:\n\t" // intcopy: - "testl $1, %%edi\n\t" // test edi, 1 - "jz 2f\n\t" - "movsb\n\t" - "decl %%ecx\n\t" - "2:\n\t" // skip1: - "testl $2, %%edi\n\t" // test edi, 2 - "jz 3f\n\t" - "movsw\n\t" - "subl $2, %%ecx\n\t" // sub ecx, 2 - "3:\n\t" // skip2: - "movl %%ecx, %%ebx\n\t" // mov ebx, ecx - "shrl $2, %%ecx\n\t" // shr ecx ,2 - "rep\n\t" - "movsl\n\t" - "testb $2, %%bl\n\t" // test bl, 2 - "jz 4f\n\t" - "movsw\n\t" - "4:\n\t" // skip3: - "testb $1, %%bl\n\t" // test bl, 1 - "jz 5f\n\t" - "movsb\n\t" - "5:" // endit: - : "+c"(c), "+S"(S), "+D"(D) : - : "ebx", "memory", "cc" - ); -} - -void copybufreverse(void *S, void *D, int32_t c) -{ - ASM( - "shrl $1, %%ecx\n\t" - "jnc 0f\n\t" // jnc skipit1 - "movb (%%esi), %%al\n\t" - "decl %%esi\n\t" - "movb %%al, (%%edi)\n\t" - "incl %%edi\n\t" - "0:\n\t" // skipit1: - "shrl $1, %%ecx\n\t" - "jnc 1f\n\t" // jnc skipit2 - "movw -1(%%esi), %%ax\n\t" - "subl $2, %%esi\n\t" - "rorw $8, %%ax\n\t" - "movw %%ax, (%%edi)\n\t" - "addl $2, %%edi\n\t" - "1:\n\t" // skipit2 - "testl %%ecx, %%ecx\n\t" - "jz 3f\n\t" // jz endloop - "2:\n\t" // begloop - "movl -3(%%esi), %%eax\n\t" - "subl $4, %%esi\n\t" - "bswapl %%eax\n\t" - "movl %%eax, (%%edi)\n\t" - "addl $4, %%edi\n\t" - "decl %%ecx\n\t" - "jnz 2b\n\t" // jnz begloop - "3:" - : "+S"(S), "+D"(D), "+c"(c) : - : "eax", "memory", "cc" - ); -} - -#elif defined(_MSC_VER) && !defined(NOASM) // __GNUC__ && __i386__ - -// -// Microsoft C Inline Assembler version -// - -#else // _MSC_VER - -// -// Generic C version -// - -void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add) -{ - // gee, I wonder who could have provided this... - int32_t i, *lptr = (int32_t *)bufptr; - for (i=0; i>16); val += add; } -} - -void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add) -{ - // ...maybe the same person who provided this too? - int32_t i; int16_t *sptr = (int16_t *)bufptr; - for (i=0; i>16); val += add; } -} - -void clearbuf(void *d, int32_t c, int32_t a) -{ - int32_t *p = (int32_t *)d; - while ((c--) > 0) *(p++) = a; -} - -void copybuf(void *s, void *d, int32_t c) -{ - int32_t *p = (int32_t *)s, *q = (int32_t *)d; - while ((c--) > 0) *(q++) = *(p++); -} - -void swapbuf4(void *a, void *b, int32_t c) -{ - int32_t *p = (int32_t *)a, *q = (int32_t *)b; - int32_t x, y; - while ((c--) > 0) - { - x = *q; - y = *p; - *(q++) = y; - *(p++) = x; - } -} - -void clearbufbyte(void *D, int32_t c, int32_t a) -{ - // Cringe City - char *p = (char *)D; - int32_t m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l }; - int32_t n[4] = { 0,8,16,24 }; - int32_t z=0; - while ((c--) > 0) - { - *(p++) = (uint8_t)((a & m[z])>>n[z]); - z=(z+1)&3; - } -} - -void copybufbyte(void *S, void *D, int32_t c) -{ - char *p = (char *)S, *q = (char *)D; - while ((c--) > 0) *(q++) = *(p++); -} - -void copybufreverse(void *S, void *D, int32_t c) -{ - char *p = (char *)S, *q = (char *)D; - while ((c--) > 0) *(q++) = *(p--); -} - -#endif - - diff --git a/polymer-perf/eduke32/build/src/quicklz.c b/polymer-perf/eduke32/build/src/quicklz.c deleted file mode 100644 index db6364552..000000000 --- a/polymer-perf/eduke32/build/src/quicklz.c +++ /dev/null @@ -1,854 +0,0 @@ -// Fast data compression library -// Copyright (C) 2006-2009 Lasse Mikkel Reinhold -// lar@quicklz.com -// -// QuickLZ can be used for free under the GPL-1 or GPL-2 license (where anything -// released into public must be open source) or under a commercial license if such -// has been acquired (see http://www.quicklz.com/order.html). The commercial license -// does not cover derived or ported versions created by third parties under GPL. - -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION - -// 1.5.0 BETA 2 - -#include "quicklz.h" - -#if QLZ_VERSION_MAJOR != 1 || QLZ_VERSION_MINOR != 5 || QLZ_VERSION_REVISION != 0 -#error quicklz.c and quicklz.h have different versions -#endif - -#if (defined(__X86__) || defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(__386__) || defined(__x86_64__) || defined(_M_X64)) -#define X86X64 -#endif - -#define MINOFFSET 2 -#define UNCONDITIONAL_MATCHLEN 6 -#define UNCOMPRESSED_END 4 -#define CWORD_LEN 4 - -#if QLZ_COMPRESSION_LEVEL == 1 && defined QLZ_PTR_64 && QLZ_STREAMING_BUFFER == 0 -#define OFFSET_BASE source -#define CAST (ui32)(size_t) -#else -#define OFFSET_BASE 0 -#define CAST -#endif - -int qlz_get_setting(int setting) -{ - switch (setting) - { - case 0: return QLZ_COMPRESSION_LEVEL; - case 1: return sizeof(qlz_state_compress); - case 2: return sizeof(qlz_state_decompress); - case 3: return QLZ_STREAMING_BUFFER; -#ifdef QLZ_MEMORY_SAFE - case 6: return 1; -#else - case 6: return 0; -#endif - case 7: return QLZ_VERSION_MAJOR; - case 8: return QLZ_VERSION_MINOR; - case 9: return QLZ_VERSION_REVISION; - } - return -1; -} - -#if QLZ_COMPRESSION_LEVEL == 1 -static int same(const unsigned char *src, size_t n) -{ - while (n > 0 && *(src + n) == *src) - n--; - return n == 0 ? 1 : 0; -} -#endif - -static void reset_table_compress(qlz_state_compress *state) -{ - int i; - for (i = 0; i < QLZ_HASH_VALUES; i++) - { -#if QLZ_COMPRESSION_LEVEL == 1 - state->hash[i].offset = 0; -#else - state->hash_counter[i] = 0; -#endif - } -} - -static void reset_table_decompress(qlz_state_decompress *state) -{ - int i; - (void)state; - (void)i; -#if QLZ_COMPRESSION_LEVEL == 2 - for (i = 0; i < QLZ_HASH_VALUES; i++) - { - state->hash_counter[i] = 0; - } -#endif -} - -static __inline ui32 hash_func(ui32 i) -{ -#if QLZ_COMPRESSION_LEVEL == 2 - return ((i >> 9) ^(i >> 13) ^ i) & (QLZ_HASH_VALUES - 1); -#else - return ((i >> 12) ^ i) & (QLZ_HASH_VALUES - 1); -#endif -} - -static __inline ui32 fast_read(void const *src, ui32 bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char *)src; - switch (bytes) - { - case 4: - return(*p | *(p + 1) << 8 | *(p + 2) << 16 | *(p + 3) << 24); - case 3: - return(*p | *(p + 1) << 8 | *(p + 2) << 16); - case 2: - return(*p | *(p + 1) << 8); - case 1: - return(*p); - } - return 0; -#else - if (bytes >= 1 && bytes <= 4) - return *((ui32 *)src); - else - return 0; -#endif -} - -static __inline ui32 hashat(const unsigned char *src) -{ - ui32 fetch, hash; - fetch = fast_read(src, 3); - hash = hash_func(fetch); - return hash; -} - -static __inline void fast_write(ui32 f, void *dst, size_t bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char *)dst; - - switch (bytes) - { - case 4: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - *(p + 3) = (unsigned char)(f >> 24); - return; - case 3: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - return; - case 2: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - return; - case 1: - *p = (unsigned char)f; - return; - } -#else - switch (bytes) - { - case 4: - *((ui32 *)dst) = f; - return; - case 3: - *((ui32 *)dst) = f; - return; - case 2: - *((ui16 *)dst) = (ui16)f; - return; - case 1: - *((unsigned char *)dst) = (unsigned char)f; - return; - } -#endif -} - - -size_t qlz_size_decompressed(const char *source) -{ - ui32 n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1 + n, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_size_compressed(const char *source) -{ - ui32 n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_size_header(const char *source) -{ - size_t n = 2*((((*source) & 2) == 2) ? 4 : 1) + 1; - return n; -} - - -static __inline void memcpy_up(unsigned char *dst, const unsigned char *src, ui32 n) -{ - // Caution if modifying memcpy_up! Overlap of dst and src must be special handled. -#ifndef X86X64 - unsigned char *end = dst + n; - while (dst < end) - { - *dst = *src; - dst++; - src++; - } -#else - ui32 f = 0; - do - { - *(ui32 *)(dst + f) = *(ui32 *)(src + f); - f += MINOFFSET + 1; - } - while (f < n); -#endif -} - -static __inline void update_hash(qlz_state_decompress *state, const unsigned char *s) -{ -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash; - hash = hashat(s); - state->hash[hash].offset = s; - state->hash_counter[hash] = 1; -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash; - unsigned char c; - hash = hashat(s); - c = state->hash_counter[hash]; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = s; - c++; - state->hash_counter[hash] = c; -#endif - (void)state; - (void)s; -} - -#if QLZ_COMPRESSION_LEVEL <= 2 -static void update_hash_upto(qlz_state_decompress *state, unsigned char **lh, const unsigned char *max) -{ - while (*lh < max) - { - (*lh)++; - update_hash(state, *lh); - } -} -#endif - -static size_t qlz_compress_core(const unsigned char *source, unsigned char *destination, size_t size, qlz_state_compress *state) -{ - const unsigned char *last_byte = source + size - 1; - const unsigned char *src = source; - unsigned char *cword_ptr = destination; - unsigned char *dst = destination + CWORD_LEN; - ui32 cword_val = 1U << 31; - const unsigned char *last_matchstart = last_byte - UNCONDITIONAL_MATCHLEN - UNCOMPRESSED_END; - ui32 fetch = 0; - unsigned int lits = 0; - - (void) lits; - - if (src <= last_matchstart) - fetch = fast_read(src, 3); - - while (src <= last_matchstart) - { - if ((cword_val & 1) == 1) - { - // store uncompressed if compression ratio is too low - if (src > source + (size >> 1) && dst - destination > src - source - ((src - source) >> 5)) - return 0; - - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 1U << 31; - fetch = fast_read(src, 3); - } -#if QLZ_COMPRESSION_LEVEL == 1 - { - const unsigned char *o; - ui32 hash, cached; - - hash = hash_func(fetch); - cached = fetch ^ state->hash[hash].cache; - state->hash[hash].cache = fetch; - - o = state->hash[hash].offset + OFFSET_BASE; - state->hash[hash].offset = CAST(src - OFFSET_BASE); - -#ifdef X86X64 - if ((cached & 0xffffff) == 0 && o != OFFSET_BASE && (src - o > MINOFFSET || (src == o + 1 && lits >= 3 && src > source + 3 && same(src - 3, 6)))) - { - if (cached != 0) - { -#else - if (cached == 0 && o != OFFSET_BASE && (src - o > MINOFFSET || (src == o + 1 && lits >= 3 && src > source + 3 && same(src - 3, 6)))) - { - if (*(o + 3) != *(src + 3)) - { -#endif - hash <<= 4; - cword_val = (cword_val >> 1) | (1U << 31); - fast_write((3 - 2) | hash, dst, 2); - src += 3; - dst += 2; - } - else - { - const unsigned char *old_src = src; - size_t matchlen; - hash <<= 4; - - cword_val = (cword_val >> 1) | (1U << 31); - src += 4; - - if (*(o + (src - old_src)) == *src) - { - src++; - if (*(o + (src - old_src)) == *src) - { - size_t q = last_byte - UNCOMPRESSED_END - (src - 5) + 1; - size_t remaining = q > 255 ? 255 : q; - src++; - while (*(o + (src - old_src)) == *src && (size_t)(src - old_src) < remaining) - src++; - } - } - - matchlen = src - old_src; - if (matchlen < 18) - { - fast_write((ui32)(matchlen - 2) | hash, dst, 2); - dst += 2; - } - else - { - fast_write((ui32)(matchlen << 16) | hash, dst, 3); - dst += 3; - } - } - fetch = fast_read(src, 3); - lits = 0; - } - else - { - lits++; - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); -#ifdef X86X64 - fetch = fast_read(src, 3); -#else - fetch = (fetch >> 8 & 0xffff) | (*(src + 2) << 16); -#endif - } - } -#elif QLZ_COMPRESSION_LEVEL >= 2 - { - const unsigned char *o, *offset2; - ui32 hash, matchlen, k, m, best_k = 0; - unsigned char c; - size_t remaining = (last_byte - UNCOMPRESSED_END - src + 1) > 255 ? 255 : (last_byte - UNCOMPRESSED_END - src + 1); - (void)best_k; - - - //hash = hashat(src); - fetch = fast_read(src, 3); - hash = hash_func(fetch); - - c = state->hash_counter[hash]; - - offset2 = state->hash[hash].offset[0]; - if (offset2 < src - MINOFFSET && c > 0 && ((fast_read(offset2, 3) ^ fetch) & 0xffffff) == 0) - { - matchlen = 3; - if (*(offset2 + matchlen) == *(src + matchlen)) - { - matchlen = 4; - while (*(offset2 + matchlen) == *(src + matchlen) && matchlen < remaining) - matchlen++; - } - } - else - matchlen = 0; - for (k = 1; k < QLZ_POINTERS && c > k; k++) - { - o = state->hash[hash].offset[k]; -#if QLZ_COMPRESSION_LEVEL == 3 - if (((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET) -#elif QLZ_COMPRESSION_LEVEL == 2 - if (*(src + matchlen) == *(o + matchlen) && ((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET) -#endif - { - m = 3; - while (*(o + m) == *(src + m) && m < remaining) - m++; -#if QLZ_COMPRESSION_LEVEL == 3 - if ((m > matchlen) || (m == matchlen && o > offset2)) -#elif QLZ_COMPRESSION_LEVEL == 2 - if (m > matchlen) -#endif - { - offset2 = o; - matchlen = m; - best_k = k; - } - } - } - o = offset2; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = src; - c++; - state->hash_counter[hash] = c; - -#if QLZ_COMPRESSION_LEVEL == 3 - if (matchlen > 2 && src - o < 131071) - { - ui32 u; - size_t offset = src - o; - - for (u = 1; u < matchlen; u++) - { - hash = hashat(src + u); - c = state->hash_counter[hash]++; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = src + u; - } - - cword_val = (cword_val >> 1) | (1U << 31); - src += matchlen; - - if (matchlen == 3 && offset <= 63) - { - *dst = (unsigned char)(offset << 2); - dst++; - } - else if (matchlen == 3 && offset <= 16383) - { - ui32 f = (ui32)((offset << 2) | 1); - fast_write(f, dst, 2); - dst += 2; - } - else if (matchlen <= 18 && offset <= 1023) - { - ui32 f = ((matchlen - 3) << 2) | ((ui32)offset << 6) | 2; - fast_write(f, dst, 2); - dst += 2; - } - - else if (matchlen <= 33) - { - ui32 f = ((matchlen - 2) << 2) | ((ui32)offset << 7) | 3; - fast_write(f, dst, 3); - dst += 3; - } - else - { - ui32 f = ((matchlen - 3) << 7) | ((ui32)offset << 15) | 3; - fast_write(f, dst, 4); - dst += 4; - } - } - else - { - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } -#elif QLZ_COMPRESSION_LEVEL == 2 - - if (matchlen > 2) - { - cword_val = (cword_val >> 1) | (1U << 31); - src += matchlen; - - if (matchlen < 10) - { - ui32 f = best_k | ((matchlen - 2) << 2) | (hash << 5); - fast_write(f, dst, 2); - dst += 2; - } - else - { - ui32 f = best_k | (matchlen << 16) | (hash << 5); - fast_write(f, dst, 3); - dst += 3; - } - } - else - { - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } -#endif - } -#endif - } - while (src <= last_byte) - { - if ((cword_val & 1) == 1) - { - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 1U << 31; - } -#if QLZ_COMPRESSION_LEVEL < 3 - if (src <= last_byte - 3) - { -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash, fetch; - fetch = fast_read(src, 3); - hash = hash_func(fetch); - state->hash[hash].offset = CAST(src - OFFSET_BASE); - state->hash[hash].cache = fetch; -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash; - unsigned char c; - hash = hashat(src); - c = state->hash_counter[hash]; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = src; - c++; - state->hash_counter[hash] = c; -#endif - } -#endif - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } - - while ((cword_val & 1) != 1) - cword_val = (cword_val >> 1); - - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - - // min. size must be 9 bytes so that the qlz_size functions can take 9 bytes as argument - return dst - destination < 9 ? 9 : dst - destination; -} - -static size_t qlz_decompress_core(const unsigned char *source, unsigned char *destination, size_t size, qlz_state_decompress *state, const unsigned char *history) -{ - const unsigned char *src = source + qlz_size_header((const char *)source); - unsigned char *dst = destination; - const unsigned char *last_destination_byte = destination + size - 1; - ui32 cword_val = 1; - const unsigned char *last_matchstart = last_destination_byte - UNCONDITIONAL_MATCHLEN - UNCOMPRESSED_END; - unsigned char *last_hashed = destination - 1; - const unsigned char *last_source_byte = source + qlz_size_compressed((const char *)source) - 1; - static const ui32 bitlut[16] = {4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0}; - - (void) last_source_byte; - (void) last_hashed; - (void) state; - (void) history; - - for (;;) - { - ui32 fetch; - - if (cword_val == 1) - { -#ifdef QLZ_MEMORY_SAFE - if (src + CWORD_LEN - 1 > last_source_byte) - return 0; -#endif - cword_val = fast_read(src, CWORD_LEN); - src += CWORD_LEN; - } - -#ifdef QLZ_MEMORY_SAFE - if (src + 4 - 1 > last_source_byte) - return 0; -#endif - - fetch = fast_read(src, 4); - - if ((cword_val & 1) == 1) - { - ui32 matchlen; - const unsigned char *offset2; - -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash; - cword_val = cword_val >> 1; - hash = (fetch >> 4) & 0xfff; - offset2 = (const unsigned char *)(size_t)state->hash[hash].offset; - - if ((fetch & 0xf) != 0) - { - matchlen = (fetch & 0xf) + 2; - src += 2; - } - else - { - matchlen = *(src + 2); - src += 3; - } - -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash; - unsigned char c; - cword_val = cword_val >> 1; - hash = (fetch >> 5) & 0x7ff; - c = (unsigned char)(fetch & 0x3); - offset2 = state->hash[hash].offset[c]; - - if ((fetch & (28)) != 0) - { - matchlen = ((fetch >> 2) & 0x7) + 2; - src += 2; - } - else - { - matchlen = *(src + 2); - src += 3; - } - -#elif QLZ_COMPRESSION_LEVEL == 3 - ui32 offset; - cword_val = cword_val >> 1; - if ((fetch & 3) == 0) - { - offset = (fetch & 0xff) >> 2; - matchlen = 3; - src++; - } - else if ((fetch & 2) == 0) - { - offset = (fetch & 0xffff) >> 2; - matchlen = 3; - src += 2; - } - else if ((fetch & 1) == 0) - { - offset = (fetch & 0xffff) >> 6; - matchlen = ((fetch >> 2) & 15) + 3; - src += 2; - } - else if ((fetch & 127) != 3) - { - offset = (fetch >> 7) & 0x1ffff; - matchlen = ((fetch >> 2) & 0x1f) + 2; - src += 3; - } - else - { - offset = (fetch >> 15); - matchlen = ((fetch >> 7) & 255) + 3; - src += 4; - } - - offset2 = dst - offset; -#endif - -#ifdef QLZ_MEMORY_SAFE - if (offset2 < history || offset2 > dst - MINOFFSET - 1) - return 0; - - if (matchlen > (ui32)(last_destination_byte - dst - UNCOMPRESSED_END + 1)) - return 0; -#endif - - memcpy_up(dst, offset2, matchlen); - dst += matchlen; - -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(state, &last_hashed, dst - matchlen); - last_hashed = dst - 1; -#endif - } - else - { - if (dst < last_matchstart) - { - unsigned int n = bitlut[cword_val & 0xf]; -#ifdef X86X64 - *(ui32 *)dst = *(ui32 *)src; -#else - memcpy_up(dst, src, 4); -#endif - cword_val = cword_val >> n; - dst += n; - src += n; -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(state, &last_hashed, dst - 3); -#endif - } - else - { - while (dst <= last_destination_byte) - { - if (cword_val == 1) - { - src += CWORD_LEN; - cword_val = 1U << 31; - } -#ifdef QLZ_MEMORY_SAFE - if (src >= last_source_byte + 1) - return 0; -#endif - *dst = *src; - dst++; - src++; - cword_val = cword_val >> 1; - } - -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(state, &last_hashed, last_destination_byte - 3); // todo, use constant -#endif - return size; - } - - } - } -} - -size_t qlz_compress(const void *source, char *destination, size_t size, qlz_state_compress *state) -{ - size_t r; - ui32 compressed; - size_t base; - - if (size == 0 || size > 0xffffffff - 400) - return 0; - - if (size < 216) - base = 3; - else - base = 9; - -#if QLZ_STREAMING_BUFFER > 0 - if (state->stream_counter + size - 1 >= QLZ_STREAMING_BUFFER) -#endif - { - reset_table_compress(state); - r = base + qlz_compress_core((const unsigned char *)source, (unsigned char *)destination + base, size, state); -#if QLZ_STREAMING_BUFFER > 0 - reset_table_compress(state); -#endif - if (r == base) - { - memcpy(destination + base, source, size); - r = size + base; - compressed = 0; - } - else - { - compressed = 1; - } - state->stream_counter = 0; - } -#if QLZ_STREAMING_BUFFER > 0 - else - { - unsigned char *src = state->stream_buffer + state->stream_counter; - - memcpy(src, source, size); - r = base + qlz_compress_core(src, (unsigned char *)destination + base, size, state); - - if (r == base) - { - memcpy(destination + base, src, size); - r = size + base; - compressed = 0; - reset_table_compress(state); - } - else - { - compressed = 1; - } - state->stream_counter += size; - } -#endif - if (base == 3) - { - *destination = (unsigned char)(0 | compressed); - *(destination + 1) = (unsigned char)r; - *(destination + 2) = (unsigned char)size; - } - else - { - *destination = (unsigned char)(2 | compressed); - fast_write((ui32)r, destination + 1, 4); - fast_write((ui32)size, destination + 5, 4); - } - - *destination |= (QLZ_COMPRESSION_LEVEL << 2); - *destination |= (1 << 6); - *destination |= ((QLZ_STREAMING_BUFFER == 0 ? 0 : (QLZ_STREAMING_BUFFER == 100000 ? 1 : (QLZ_STREAMING_BUFFER == 1000000 ? 2 : 3))) << 4); - -// 76543210 -// 01SSLLHC - - return r; -} - -size_t qlz_decompress(const char *source, void *destination, qlz_state_decompress *state) -{ - size_t dsiz = qlz_size_decompressed(source); - -#if QLZ_STREAMING_BUFFER > 0 - if (state->stream_counter + qlz_size_decompressed(source) - 1 >= QLZ_STREAMING_BUFFER) -#endif - { - if ((*source & 1) == 1) - { - reset_table_decompress(state); - dsiz = qlz_decompress_core((const unsigned char *)source, (unsigned char *)destination, dsiz, state, (const unsigned char *)destination); - } - else - { - memcpy(destination, source + qlz_size_header(source), dsiz); - } - state->stream_counter = 0; - reset_table_decompress(state); - } -#if QLZ_STREAMING_BUFFER > 0 - else - { - unsigned char *dst = state->stream_buffer + state->stream_counter; - if ((*source & 1) == 1) - { - dsiz = qlz_decompress_core((const unsigned char *)source, dst, dsiz, state, (const unsigned char *)state->stream_buffer); - } - else - { - memcpy(dst, source + qlz_size_header(source), dsiz); - reset_table_decompress(state); - } - memcpy(destination, dst, dsiz); - state->stream_counter += dsiz; - } -#endif - return dsiz; -} - diff --git a/polymer-perf/eduke32/build/src/rawinput.c b/polymer-perf/eduke32/build/src/rawinput.c deleted file mode 100644 index d68cedceb..000000000 --- a/polymer-perf/eduke32/build/src/rawinput.c +++ /dev/null @@ -1,293 +0,0 @@ -#define WIN32_LEAN_AND_MEAN -#define _WIN32_WINNT 0x0501 -#include -#include "rawinput.h" -#include "winlayer.h" -#include "scancodes.h" -#include "build.h" - -static BOOL rawinput_started = 0; -static uint8_t KeyboardState[256] = {0}; // VKeys -static int8_t MWheel = 0; - -extern volatile uint8_t moustat, mousegrab; -extern uint32_t mousewheel[2]; -extern void SetKey(int32_t key, int32_t state); - -#define MASK_DOWN (1<<(i<<1)) -#define MASK_UP (MASK_DOWN<<1) -#define MouseWheelFakePressTime 50 -#ifndef GET_RAWINPUT_CODE_WPARAM -#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff) -#endif - -static inline void RI_ProcessMouse(const RAWMOUSE *rmouse) -{ - int32_t i, mask; - - if (!mousegrab || !appactive) - return; - - mousex += rmouse->lLastX; - mousey += rmouse->lLastY; - - if (rmouse->usFlags & MOUSE_MOVE_ABSOLUTE) - { - // untested... maybe devices like wacom tablets set this flag? - POINT pos = { xdim>>1, ydim>>1 }; - - ClientToScreen((HWND)win_gethwnd(), &pos); - - mousex -= pos.x; - mousey -= pos.y; - } - - for (i = 0, mask = 1; i < 4; i++) - { - if (rmouse->usButtonFlags & mask) // button down - { - if (mousepresscallback) - mousepresscallback(i, 1); - mouseb |= 1<usButtonFlags & (mask<<1)) // button up - { - if (mousepresscallback) - mousepresscallback(i, 0); - mouseb &= ~(1<usButtonFlags & RI_MOUSE_WHEEL) ? rmouse->usButtonData : 0; - - if (MWheel > 0) // wheel up - { - if (mousewheel[0] > 0 && mousepresscallback) mousepresscallback(5,0); - mousewheel[0] = getticks(); - mouseb |= 16; - if (mousepresscallback) mousepresscallback(5, 1); - } - else if (MWheel < 0) // wheel down - { - if (mousewheel[1] > 0 && mousepresscallback) mousepresscallback(6,0); - mousewheel[1] = getticks(); - mouseb |= 32; - if (mousepresscallback) mousepresscallback(6, 1); - } -} - -static inline void RI_ProcessKeyboard(const RAWKEYBOARD *rkbd) -{ - uint8_t key = rkbd->MakeCode, VKey = rkbd->VKey; - - // for some reason rkbd->MakeCode is wrong for these - // even though rkbd->VKey is right... - - switch (VKey) - { - case VK_SHIFT: - if (rkbd->Flags & RI_KEY_E0) VKey = VK_RSHIFT, key = sc_RightShift; break; - case VK_CONTROL: - if (rkbd->Flags & RI_KEY_E0) VKey = VK_RCONTROL, key = sc_RightControl; break; - case VK_MENU: - if (rkbd->Flags & RI_KEY_E0) VKey = VK_RMENU, key = sc_RightAlt; break; - case VK_UP: - case VK_NUMPAD8: - if (rkbd->Flags & RI_KEY_E0) VKey = VK_UP, key = sc_UpArrow; - else VKey = VK_NUMPAD8, key = sc_kpad_8; break; - case VK_DOWN: - case VK_NUMPAD2: - if (rkbd->Flags & RI_KEY_E0) VKey = VK_DOWN, key = sc_DownArrow; - else VKey = VK_NUMPAD2, key = sc_kpad_2; break; - case VK_LEFT: - case VK_NUMPAD4: - if (rkbd->Flags & RI_KEY_E0) VKey = VK_LEFT, key = sc_LeftArrow; - else VKey = VK_NUMPAD4, key = sc_kpad_4; break; - case VK_RIGHT: - case VK_NUMPAD6: - if (rkbd->Flags & RI_KEY_E0) VKey = VK_RIGHT, key = sc_RightArrow; - else VKey = VK_NUMPAD6, key = sc_kpad_6; break; - case VK_DIVIDE: -// if (rkbd->Flags & RI_KEY_E0) key = sc_Slash; -// else - key = sc_kpad_Slash; - break; - case VK_INSERT: - key = sc_Insert; break; - case VK_HOME: - key = sc_Home; break; - case VK_DELETE: - key = sc_Delete; break; - case VK_END: - key = sc_End; break; - case VK_PRIOR: - key = sc_PgUp; break; - case VK_NEXT: - key = sc_PgDn; break; - case VK_RETURN: - if (rkbd->Flags & RI_KEY_E0) key = sc_kpad_Enter; break; - case VK_PAUSE: - KeyboardState[VKey] = 1 - (rkbd->Flags & RI_KEY_BREAK); - if (rkbd->Flags & RI_KEY_BREAK) return; - - SetKey(sc_Pause, 1); - - if (keypresscallback) - keypresscallback(sc_Pause, 1); - return; - } - - KeyboardState[VKey] = 1 - (rkbd->Flags & RI_KEY_BREAK); - - if (OSD_HandleScanCode(key, KeyboardState[VKey] != 0)) - { - SetKey(key, KeyboardState[VKey] != 0); - - if (keypresscallback) - keypresscallback(key, KeyboardState[VKey] != 0); - } - - if (rkbd->Flags & RI_KEY_BREAK) return; - if (((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc) return; - if ((keyasciififoend - keyasciififoplc) > 0) return; - - { - uint8_t buf[2]; - - if (ToAscii(VKey, key, &KeyboardState[0], (LPWORD)&buf[0], 0) != 1) return; - if ((OSD_OSDKey() < 128) && (Btolower(scantoasc[OSD_OSDKey()]) == Btolower(buf[0]))) return; - if (OSD_HandleChar(buf[0]) == 0) return; - - keyasciififo[keyasciififoend] = buf[0]; - keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1)); - } -} - -// keyboard is always captured regardless of what we tell this function -BOOL RI_CaptureInput(BOOL grab, HWND target) -{ - RAWINPUTDEVICE raw[2]; - - raw[0].usUsagePage = 0x01; - raw[0].usUsage = 0x02; - raw[0].dwFlags = grab ? (RIDEV_NOLEGACY | RIDEV_CAPTUREMOUSE) : 0; - raw[0].hwndTarget = grab ? target : NULL; - - raw[1].usUsagePage = 0x01; - raw[1].usUsage = 0x06; - raw[1].dwFlags = 0; - raw[1].hwndTarget = target; - - mousegrab = grab; - - return (RegisterRawInputDevices(raw, 2, sizeof(raw[0])) == FALSE); -} - -void RI_ProcessMessage(MSG *msg) -{ - if (GET_RAWINPUT_CODE_WPARAM(msg->wParam) == RIM_INPUT) - { - UINT dwSize = sizeof(RAWINPUT); - RAWINPUT raw; - - GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, &raw, &dwSize, sizeof(RAWINPUTHEADER)); - - if (raw.header.dwType == RIM_TYPEKEYBOARD) - RI_ProcessKeyboard(&raw.data.keyboard); - else if (raw.header.dwType == RIM_TYPEMOUSE) - RI_ProcessMouse(&raw.data.mouse); - } - - DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam); -} - -void RI_PollDevices(BOOL loop) -{ - int32_t i; - MSG msg; - - if (!rawinput_started) - { - if (RI_CaptureInput(1, (HWND)win_gethwnd())) - return; - rawinput_started = 1; - } - - // snapshot the whole keyboard state so we can translate key presses into ascii later - for (i = 0; i < 256; i++) - KeyboardState[i] = GetAsyncKeyState(i) >> 8; - - MWheel = 0; - - while (loop && PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_REMOVE | PM_QS_INPUT)) - RI_ProcessMessage(&msg); - - if (mousegrab && appactive) - { - // center the cursor in the window - POINT pt = { xdim>>1, ydim>>1 }; - - ClientToScreen((HWND)win_gethwnd(), &pt); - SetCursorPos(pt.x, pt.y); - - // do this here because we only want the wheel to signal once, but hold the state for a moment - if (mousewheel[0] > 0 && getticks() - mousewheel[0] > MouseWheelFakePressTime) - { - if (mousepresscallback) mousepresscallback(5,0); - mousewheel[0] = 0; mouseb &= ~16; - } - if (mousewheel[1] > 0 && getticks() - mousewheel[1] > MouseWheelFakePressTime) - { - if (mousepresscallback) mousepresscallback(6,0); - mousewheel[1] = 0; mouseb &= ~32; - } - } -} - -int32_t initmouse(void) -{ - if (moustat) return 0; - grabmouse(moustat = 1); - return 0; -} - -void uninitmouse(void) -{ - if (!moustat) return; - grabmouse(moustat = 0); -} - -void grabmouse(char a) -{ - static POINT pos; - static int32_t d = 0; - - if (!moustat) return; - - if (!mousegrab || !d) - { - GetCursorPos(&pos); - d++; - } - - ShowCursor(a == 0); - RI_CaptureInput(a, (HWND)win_gethwnd()); - SetCursorPos(pos.x, pos.y); -} - -void readmousexy(int32_t *x, int32_t *y) -{ - if (!moustat || !mousegrab) { *x = *y = 0; return; } - *x = mousex; - mousex = 0; - *y = mousey; - mousey = 0; -} - -void readmousebstatus(int32_t *b) -{ - if (!moustat || !mousegrab) { *b = 0; return; } - *b = mouseb; -} - diff --git a/polymer-perf/eduke32/build/src/scriptfile.c b/polymer-perf/eduke32/build/src/scriptfile.c deleted file mode 100644 index 446303a0e..000000000 --- a/polymer-perf/eduke32/build/src/scriptfile.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * File Tokeniser/Parser/Whatever - * by Jonathon Fowler - * Remixed completely by Ken Silverman - * See the included license file "BUILDLIC.TXT" for license info. - */ - -#include "compat.h" -#include "scriptfile.h" -#include "baselayer.h" -#include "compat.h" -#include "cache1d.h" -#include - - -#define ISWS(x) ((x == ' ') || (x == '\t') || (x == '\r') || (x == '\n')) -static void skipoverws(scriptfile *sf) { if ((sf->textptr < sf->eof) && (!sf->textptr[0])) sf->textptr++; } -static void skipovertoken(scriptfile *sf) { while ((sf->textptr < sf->eof) && (sf->textptr[0])) sf->textptr++; } - -char *scriptfile_gettoken(scriptfile *sf) -{ - char *start; - - skipoverws(sf); - if (sf->textptr >= sf->eof) return NULL; - - start = sf->ltextptr = sf->textptr; - skipovertoken(sf); - return start; -} - -int32_t scriptfile_getstring(scriptfile *sf, char **retst) -{ - (*retst) = scriptfile_gettoken(sf); - if (*retst == NULL) - { - initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); - return(-2); - } - return(0); -} - -int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num) -{ - skipoverws(sf); - if (sf->textptr >= sf->eof) - { - initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); - return -1; - } - - while ((sf->textptr[0] == '0') && (sf->textptr[1] >= '0') && (sf->textptr[1] <= '9')) - sf->textptr++; //hack to treat octal numbers like decimal - - sf->ltextptr = sf->textptr; - (*num) = strtol((const char *)sf->textptr,&sf->textptr,0); - if (!ISWS(*sf->textptr) && *sf->textptr) - { - char *p = sf->textptr; - skipovertoken(sf); - initprintf("Error on line %s:%d: expecting int32_t, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p); - return -2; - } - return 0; -} - -static double parsedouble(char *ptr, char **end) -{ - int32_t beforedecimal = 1, negative = 0, dig; - int32_t exposgn = 0, expo = 0; - double num = 0.0, decpl = 0.1; - char *p; - - p = ptr; - if (*p == '-') negative = 1, p++; - else if (*p == '+') p++; - for (;; p++) - { - if (*p >= '0' && *p <= '9') - { - dig = *p - '0'; - if (beforedecimal) num = num * 10.0 + dig; - else if (exposgn) expo = expo*10 + dig; - else - { - num += (double)dig * decpl; - decpl /= 10.0; - } - } - else if (*p == '.') - { - if (beforedecimal) beforedecimal = 0; - else break; - } - else if ((*p == 'E') || (*p == 'e')) - { - exposgn = 1; - if (p[1] == '-') { exposgn = -1; p++; } - else if (p[1] == '+') p++; - } - else break; - } - - if (end) *end = p; - if (exposgn) num *= pow(10.0,(double)(expo*exposgn)); - return negative ? -num : num; -} - -int32_t scriptfile_getdouble(scriptfile *sf, double *num) -{ - skipoverws(sf); - if (sf->textptr >= sf->eof) - { - initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); - return -1; - } - - sf->ltextptr = sf->textptr; - - // On Linux, locale settings interfere with interpreting x.y format numbers - //(*num) = strtod((const char *)sf->textptr,&sf->textptr); - (*num) = parsedouble(sf->textptr, &sf->textptr); - - if (!ISWS(*sf->textptr) && *sf->textptr) - { - char *p = sf->textptr; - skipovertoken(sf); - initprintf("Error on line %s:%d: expecting float, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),p); - return -2; - } - return 0; -} - -int32_t scriptfile_getsymbol(scriptfile *sf, int32_t *num) -{ - char *t, *e; - int32_t v; - - t = scriptfile_gettoken(sf); - if (!t) return -1; - - v = Bstrtol(t, &e, 10); - if (*e) - { - // looks like a string, so find it in the symbol table - if (scriptfile_getsymbolvalue(t, num)) return 0; - initprintf("Error on line %s:%d: expecting symbol, got \"%s\"\n",sf->filename,scriptfile_getlinum(sf,sf->ltextptr),t); - return -2; // not found - } - - *num = v; - return 0; -} - -int32_t scriptfile_getbraces(scriptfile *sf, char **braceend) -{ - int32_t bracecnt; - char *bracestart; - - skipoverws(sf); - if (sf->textptr >= sf->eof) - { - initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); - return -1; - } - - if (sf->textptr[0] != '{') - { - initprintf("Error on line %s:%d: expecting '{'\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); - return -1; - } - bracestart = ++sf->textptr; bracecnt = 1; - while (1) - { - if (sf->textptr >= sf->eof) return(0); - if (sf->textptr[0] == '{') bracecnt++; - if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; } - sf->textptr++; - } - (*braceend) = sf->textptr; - sf->textptr = bracestart; - return 0; -} - - -int32_t scriptfile_getlinum(scriptfile *sf, char *ptr) -{ - int32_t i, stp; - intptr_t ind; - - //for(i=0;ilinenum;i++) if (sf->lineoffs[i] >= ind) return(i+1); //brute force algo - - ind = ((intptr_t)ptr) - ((intptr_t)sf->textbuf); - - for (stp=1; stp+stplinenum; stp+=stp); //stp = highest power of 2 less than sf->linenum - for (i=0; stp; stp>>=1) - if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp; - return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers -} - -void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen) -{ - int32_t i, cr, numcr, nflen, ws, cs, inquote; - - //Count number of lines - numcr = 1; - for (i=0; ilinenum = numcr; - sf->lineoffs = (int32_t *)Bmalloc(sf->linenum*sizeof(int32_t)); - - //Preprocess file for comments (// and /*...*/, and convert all whitespace to single spaces) - nflen = 0; ws = 0; cs = 0; numcr = 0; inquote = 0; - for (i=0; ilineoffs[numcr++] = nflen; - if (cs == 1) cs = 0; - ws = 1; continue; //strip CR/LF - } - - if ((!inquote) && ((tx[i] == ' ') || (tx[i] == '\t'))) { ws = 1; continue; } //strip Space/Tab - if ((tx[i] == '/') && (tx[i+1] == '/') && (!cs)) cs = 1; - if ((tx[i] == '/') && (tx[i+1] == '*') && (!cs)) { ws = 1; cs = 2; } - if ((tx[i] == '*') && (tx[i+1] == '/') && (cs == 2)) { cs = 0; i++; continue; } - if (cs) continue; - - if (ws) { tx[nflen++] = 0; ws = 0; } - - //quotes inside strings: \" - if ((tx[i] == '\\') && (tx[i+1] == '\"')) { i++; tx[nflen++] = '\"'; continue; } - if (tx[i] == '\"') { inquote ^= 1; continue; } - tx[nflen++] = tx[i]; - } - tx[nflen++] = 0; sf->lineoffs[numcr] = nflen; - tx[nflen++] = 0; - -#if 0 - //for debugging only: - printf("pre-parsed file:flen=%d,nflen=%d\n",flen,nflen); - for (i=0; ilinenum); - for (i=0; ilinenum; i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]); -#endif - flen = nflen; - - sf->textbuf = sf->textptr = tx; - sf->textlength = nflen; - sf->eof = &sf->textbuf[nflen-1]; -} - -scriptfile *scriptfile_fromfile(const char *fn) -{ - int32_t fp; - scriptfile *sf; - char *tx; - uint32_t flen; - - fp = kopen4load(fn,0); - if (fp<0) return NULL; - - flen = kfilelength(fp); - tx = (char *) Bmalloc(flen + 2); - if (!tx) - { - kclose(fp); - return NULL; - } - - sf = (scriptfile *) Bmalloc(sizeof(scriptfile)); - if (!sf) - { - kclose(fp); - Bfree(tx); - return NULL; - } - - kread(fp, tx, flen); - tx[flen] = tx[flen+1] = 0; - - kclose(fp); - - scriptfile_preparse(sf,tx,flen); - sf->filename = Bstrdup(fn); - - return sf; -} - -scriptfile *scriptfile_fromstring(const char *string) -{ - scriptfile *sf; - char *tx; - uint32_t flen; - - if (!string) return NULL; - - flen = strlen(string); - - tx = (char *) Bmalloc(flen + 2); - if (!tx) return NULL; - - sf = (scriptfile *) Bmalloc(sizeof(scriptfile)); - if (!sf) - { - Bfree(tx); - return NULL; - } - - Bmemcpy(tx, string, flen); - tx[flen] = tx[flen+1] = 0; - - scriptfile_preparse(sf,tx,flen); - sf->filename = NULL; - - return sf; -} - -void scriptfile_close(scriptfile *sf) -{ - if (!sf) return; - if (sf->lineoffs) Bfree(sf->lineoffs); - if (sf->textbuf) Bfree(sf->textbuf); - if (sf->filename) Bfree(sf->filename); - sf->textbuf = NULL; - sf->filename = NULL; - Bfree(sf); -} - -int32_t scriptfile_eof(scriptfile *sf) -{ - skipoverws(sf); - if (sf->textptr >= sf->eof) return 1; - return 0; -} - -#define SYMBTABSTARTSIZE 256 -static int32_t symbtablength=0, symbtaballoclength=0; -static char *symbtab = NULL; - -static char *getsymbtabspace(int32_t reqd) -{ - char *pos,*np; - int32_t i; - - if (symbtablength + reqd > symbtaballoclength) - { - for (i=max(symbtaballoclength,SYMBTABSTARTSIZE); symbtablength+reqd>i; i<<=1); - np = (char *)Brealloc(symbtab, i); if (!np) return NULL; - symbtab = np; symbtaballoclength = i; - } - - pos = &symbtab[symbtablength]; - symbtablength += reqd; - return pos; -} - -int32_t scriptfile_getsymbolvalue(char *name, int32_t *val) -{ - char *scanner = symbtab; - - if (!symbtab) return 0; - while (scanner - symbtab < symbtablength) - { - if (!Bstrcasecmp(name, scanner)) - { - *val = *(int32_t *)(scanner + strlen(scanner) + 1); - return 1; - } - - scanner += strlen(scanner) + 1 + sizeof(int32_t); - } - - return 0; -} - -int32_t scriptfile_addsymbolvalue(char *name, int32_t val) -{ - char *sp; - // if (scriptfile_getsymbolvalue(name, &x)) return -1; // already exists - - if (symbtab) - { - char *scanner = symbtab; - while (scanner - symbtab < symbtablength) - { - if (!Bstrcasecmp(name, scanner)) - { - *(int32_t *)(scanner + strlen(scanner) + 1) = val; - return 1; - } - - scanner += strlen(scanner) + 1 + sizeof(int32_t); - } - } - - sp = getsymbtabspace(strlen(name) + 1 + sizeof(int32_t)); - if (!sp) return 0; - strcpy(sp, name); - sp += strlen(name)+1; - *(int32_t *)sp = val; - return 1; // added -} - -void scriptfile_clearsymbols(void) -{ - if (symbtab) Bfree(symbtab); - symbtab = NULL; - symbtablength = 0; - symbtaballoclength = 0; -} diff --git a/polymer-perf/eduke32/build/src/sdlayer.c b/polymer-perf/eduke32/build/src/sdlayer.c deleted file mode 100644 index 24a2d40f8..000000000 --- a/polymer-perf/eduke32/build/src/sdlayer.c +++ /dev/null @@ -1,2200 +0,0 @@ -// SDL interface layer -// for the Build Engine -// by Jonathon Fowler (jonof@edgenetwk.com) -// -// Use SDL 1.2 or 1.3 from http://www.libsdl.org - -#include -#include -#include -#include "sdl_inc.h" -#include "compat.h" -#include "sdlayer.h" -#include "cache1d.h" -#include "pragmas.h" -#include "a.h" -#include "build.h" -#include "osd.h" - -#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2 -// for SDL_WaitEventTimeout defined below -#include -#endif - -#ifdef USE_OPENGL -# include "glbuild.h" -#endif - -#if defined __APPLE__ -# include "osxbits.h" -#elif defined HAVE_GTK2 -# include "gtkbits.h" -#else -int32_t startwin_open(void) { return 0; } -int32_t startwin_close(void) { return 0; } -int32_t startwin_puts(const char *s) { s=s; return 0; } -int32_t startwin_idle(void *s) { s=s; return 0; } -int32_t startwin_settitle(const char *s) { s=s; return 0; } -#endif - -/// These can be useful for debugging sometimes... -//#define SDL_WM_GrabInput(x) SDL_WM_GrabInput(SDL_GRAB_OFF) -//#define SDL_ShowCursor(x) SDL_ShowCursor(SDL_ENABLE) - -#define SURFACE_FLAGS (SDL_SWSURFACE|SDL_HWPALETTE|SDL_HWACCEL) - -// undefine to restrict windowed resolutions to conventional sizes -#define ANY_WINDOWED_SIZE - -// fix for mousewheel -#define MWHEELTICKS 10 -static uint32_t mwheelup, mwheeldown; - -int32_t _buildargc = 1; -const char **_buildargv = NULL; -extern int32_t app_main(int32_t argc, const char *argv[]); - -char quitevent=0, appactive=1, novideo=0; - -// video -static SDL_Surface *sdl_surface; -int32_t xres=-1, yres=-1, bpp=0, fullscreen=0, bytesperline, imageSize; -intptr_t frameplace=0; -int32_t lockcount=0; -char modechange=1; -char offscreenrendering=0; -char videomodereset = 0; -char nofog=0; -static uint16_t sysgamma[3][256]; -extern int32_t curbrightness, gammabrightness; -#ifdef USE_OPENGL -// OpenGL stuff -char nogl=0; -#endif -int32_t vsync=0; - -#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) -static char keytranslation[SDLK_LAST]; -#else -static char keytranslation[SDL_NUM_SCANCODES]; -#endif -static int32_t buildkeytranslationtable(void); - -//static SDL_Surface * loadtarga(const char *fn); // for loading the icon -static SDL_Surface *appicon = NULL; -static SDL_Surface *loadappicon(void); - -static mutex_t m_initprintf; - -// Joystick dead and saturation zones -uint16_t *joydead, *joysatur; - -int32_t wm_msgbox(char *name, char *fmt, ...) -{ - char buf[2048]; - va_list va; - - UNREFERENCED_PARAMETER(name); - - va_start(va,fmt); - vsprintf(buf,fmt,va); - va_end(va); - -#if defined(__APPLE__) - return osx_msgbox(name, buf); -#elif defined HAVE_GTK2 - if (gtkbuild_msgbox(name, buf) >= 0) return 1; -#endif - puts(buf); - puts(" (press Return or Enter to continue)"); - getchar(); - - return 0; -} - -int32_t wm_ynbox(char *name, char *fmt, ...) -{ - char buf[2048]; - char c; - va_list va; -#if (!defined(__APPLE__) && defined(HAVE_GTK2)) - int32_t r; -#endif - - UNREFERENCED_PARAMETER(name); - - va_start(va,fmt); - vsprintf(buf,fmt,va); - va_end(va); - -#if defined __APPLE__ - return osx_ynbox(name, buf); -#elif defined HAVE_GTK2 - if ((r = gtkbuild_ynbox(name, buf)) >= 0) return r; -#endif - puts(buf); - puts(" (type 'Y' or 'N', and press Return or Enter to continue)"); - do c = getchar(); while (c != 'Y' && c != 'y' && c != 'N' && c != 'n'); - if (c == 'Y' || c == 'y') return 1; - - return 0; -} - -void wm_setapptitle(char *name) -{ - if (name) - { - Bstrncpy(apptitle, name, sizeof(apptitle)-1); - apptitle[ sizeof(apptitle)-1 ] = 0; - } - - SDL_WM_SetCaption(apptitle, NULL); - - startwin_settitle(apptitle); -} - - -// -// -// --------------------------------------- -// -// System -// -// --------------------------------------- -// -// - -int32_t main(int32_t argc, char *argv[]) -{ - int32_t r; - char *argp; - FILE *fp; - -#ifdef NEDMALLOC - nedcreatepool(SYSTEM_POOL_SIZE, -1); - // atexit(neddestroysyspool); -#endif - - buildkeytranslationtable(); - -#ifdef HAVE_GTK2 - gtkbuild_init(&argc, &argv); -#endif - startwin_open(); - - _buildargc = argc; - _buildargv = (const char **)argv; - - // pipe standard outputs to files - if ((argp = Bgetenv("BUILD_LOGSTDOUT")) != NULL) - if (!Bstrcasecmp(argp, "TRUE")) - { - fp = freopen("stdout.txt", "w", stdout); - - if (!fp) - fp = fopen("stdout.txt", "w"); - - if (fp) - { - setvbuf(fp, 0, _IONBF, 0); - *stdout = *fp; - *stderr = *fp; - } - } - -#ifdef USE_OPENGL - if ((argp = Bgetenv("BUILD_NOFOG")) != NULL) - nofog = Batol(argp); -#endif - - baselayer_init(); - r = app_main(_buildargc, _buildargv); - - startwin_close(); -#ifdef HAVE_GTK2 - gtkbuild_exit(r); -#endif - return r; -} - -#ifdef USE_OPENGL -void setvsync(int32_t sync) -{ - if (vsync == sync) return; - vsync = sync; - resetvideomode(); - if (setgamemode(fullscreen,xdim,ydim,bpp)) - OSD_Printf("restartvid: Reset failed...\n"); -} -#endif - -static void attach_debugger_here(void) {} - -#ifdef __GNUC__ -# define PRINTSTACKONSEGV 1 -# include -#endif - -static void sighandler(int signum) -{ - UNREFERENCED_PARAMETER(signum); -// if (signum==SIGSEGV) - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - SDL_ShowCursor(SDL_ENABLE); -#if PRINTSTACKONSEGV - { - void *addr[32]; - int32_t errfd = fileno(stderr); - int32_t n=backtrace(addr, sizeof(addr)/sizeof(addr[0])); - backtrace_symbols_fd(addr, n, errfd); - } - // This is useful for attaching the debugger post-mortem. For those pesky - // cases where the program runs through happily when inspected from the start. -// usleep(15000000); -#endif - attach_debugger_here(); - uninitsystem(); - exit(8); - } -} - -// -// initsystem() -- init SDL systems -// -int32_t initsystem(void) -{ - /* - #ifdef DEBUGGINGAIDS - const SDL_VideoInfo *vid; - #endif - */ - const SDL_version *linked = SDL_Linked_Version(); - SDL_version compiled; - char drvname[32]; - - SDL_VERSION(&compiled); - - mutex_init(&m_initprintf); - - initprintf("Initializing SDL system interface " - "(compiled against SDL version %d.%d.%d, found version %d.%d.%d)\n", - compiled.major, compiled.minor, compiled.patch, - linked->major, linked->minor, linked->patch); - - if (SDL_VERSIONNUM(linked->major,linked->minor,linked->patch) < SDL_REQUIREDVERSION) - { - /*reject running under SDL versions older than what is stated in sdl_inc.h */ - initprintf("You need at least v%d.%d.%d of SDL to run this game\n",SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z); - return -1; - } - - if (SDL_Init(SDL_INIT_VIDEO //| SDL_INIT_TIMER -#ifdef NOSDLPARACHUTE - | SDL_INIT_NOPARACHUTE -#endif - )) - { - initprintf("Initialization failed! (%s)\nNon-interactive mode enabled\n", SDL_GetError()); - /* if (SDL_Init(0)) - { - initprintf("Initialization failed! (%s)\n", SDL_GetError()); - return -1; - } - else - */ - novideo = 1; -#ifdef USE_OPENGL - nogl = 1; -#endif - } - - signal(SIGSEGV, sighandler); - signal(SIGABRT, sighandler); - signal(SIGFPE, sighandler); - - atexit(uninitsystem); - - frameplace = 0; - lockcount = 0; - -#ifdef USE_OPENGL - if (!novideo && loadgldriver(getenv("BUILD_GLDRV"))) - { - initprintf("Failed loading OpenGL driver. GL modes will be unavailable.\n"); - nogl = 1; - } -#endif - -#ifndef __APPLE__ - - //icon = loadtarga("icon.tga"); - - if (!novideo) - { - appicon = loadappicon(); - if (appicon) - SDL_WM_SetIcon(appicon, 0); - } -#endif - - if (!novideo) - if (SDL_VideoDriverName(drvname, 32)) - initprintf("Using \"%s\" video driver\n", drvname); - - /* - // dump a quick summary of the graphics hardware - #ifdef DEBUGGINGAIDS - vid = SDL_GetVideoInfo(); - initprintf("Video device information:\n"); - initprintf(" Can create hardware surfaces? %s\n", (vid->hw_available)?"Yes":"No"); - initprintf(" Window manager available? %s\n", (vid->wm_available)?"Yes":"No"); - initprintf(" Accelerated hardware blits? %s\n", (vid->blit_hw)?"Yes":"No"); - initprintf(" Accelerated hardware colourkey blits? %s\n", (vid->blit_hw_CC)?"Yes":"No"); - initprintf(" Accelerated hardware alpha blits? %s\n", (vid->blit_hw_A)?"Yes":"No"); - initprintf(" Accelerated software blits? %s\n", (vid->blit_sw)?"Yes":"No"); - initprintf(" Accelerated software colourkey blits? %s\n", (vid->blit_sw_CC)?"Yes":"No"); - initprintf(" Accelerated software alpha blits? %s\n", (vid->blit_sw_A)?"Yes":"No"); - initprintf(" Accelerated colour fills? %s\n", (vid->blit_fill)?"Yes":"No"); - initprintf(" Total video memory: %dKB\n", vid->video_mem); - #endif - */ - return 0; -} - - -// -// uninitsystem() -- uninit SDL systems -// -void uninitsystem(void) -{ - uninitinput(); - uninitmouse(); - uninittimer(); - - if (appicon) - { - SDL_FreeSurface(appicon); - appicon = NULL; - } - - SDL_Quit(); - -#ifdef USE_OPENGL - unloadgldriver(); -#endif -} - - -// -// initprintf() -- prints a string to the intitialization window -// -void initprintf(const char *f, ...) -{ - va_list va; - char buf[2048]; - static char dabuf[2048]; - - va_start(va, f); - Bvsnprintf(buf, sizeof(buf), f, va); - va_end(va); - - OSD_Printf("%s", buf); -// Bprintf("%s", buf); - - mutex_lock(&m_initprintf); - if (Bstrlen(dabuf) + Bstrlen(buf) > 1022) - { - startwin_puts(dabuf); - Bmemset(dabuf, 0, sizeof(dabuf)); - } - - Bstrcat(dabuf,buf); - - if (flushlogwindow || Bstrlen(dabuf) > 768) - { - startwin_puts(dabuf); - startwin_idle(NULL); - Bmemset(dabuf, 0, sizeof(dabuf)); - } - mutex_unlock(&m_initprintf); -} - -// -// debugprintf() -- prints a debug string to stderr -// -void debugprintf(const char *f, ...) -{ -#ifdef DEBUGGINGAIDS - va_list va; - - va_start(va,f); - Bvfprintf(stderr, f, va); - va_end(va); -#else - UNREFERENCED_PARAMETER(f); -#endif -} - - -// -// -// --------------------------------------- -// -// All things Input -// -// --------------------------------------- -// -// - -static char mouseacquired=0,moustat=0; -// static int32_t joyblast=0; -static SDL_Joystick *joydev = NULL; - -// -// initinput() -- init input system -// -int32_t initinput(void) -{ - int32_t i,j; - -#ifdef __APPLE__ - // force OS X to operate in >1 button mouse mode so that LMB isn't adulterated - if (!getenv("SDL_HAS3BUTTONMOUSE")) putenv("SDL_HAS3BUTTONMOUSE=1"); -#endif - if (!remapinit) - for (i=0; i<256; i++) - remap[i]=i; - remapinit=1; - - if (SDL_EnableKeyRepeat(250, 30)) // doesn't do anything in 1.3 - initprintf("Error enabling keyboard repeat.\n"); - inputdevices = 1|2; // keyboard (1) and mouse (2) - mouseacquired = 0; - - SDL_EnableUNICODE(1); // let's hope this doesn't hit us too hard - - memset(key_names,0,sizeof(key_names)); -#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) - for (i=0; i (unsigned)joynumaxes) return NULL; - Bsprintf(tmp,"Axis %d",num); - return (char *)tmp; - - case 1: // button - if ((unsigned)num > (unsigned)joynumbuttons) return NULL; - Bsprintf(tmp,"Button %d",num); - return (char *)tmp; - - case 2: // hat - if ((unsigned)num > (unsigned)joynumhats) return NULL; - Bsprintf(tmp,"Hat %d",num); - return (char *)tmp; - - default: - return NULL; - } -} - - -// -// initmouse() -- init mouse input -// -int32_t initmouse(void) -{ - moustat=1; - grabmouse(1); // FIXME - SA - return 0; -} - -// -// uninitmouse() -- uninit mouse input -// -void uninitmouse(void) -{ - grabmouse(0); - moustat=0; -} - - -// -// grabmouse() -- show/hide mouse cursor -// -void grabmouse(char a) -{ - if (appactive && moustat) - { - if (a != mouseacquired) - { -#ifndef DEBUGGINGAIDS - SDL_GrabMode g; - - g = SDL_WM_GrabInput(a ? SDL_GRAB_ON : SDL_GRAB_OFF); - mouseacquired = (g == SDL_GRAB_ON); - - SDL_ShowCursor(mouseacquired ? SDL_DISABLE : SDL_ENABLE); -#else - mouseacquired = a; -#endif - } - } - else - { - mouseacquired = a; - } - mousex = mousey = 0; -} - - -// -// readmousexy() -- return mouse motion information -// -void readmousexy(int32_t *x, int32_t *y) -{ - if (!mouseacquired || !appactive || !moustat) { *x = *y = 0; return; } - -// if (mousex|mousey)printf("r:%d,%d\n",mousex,mousey); /// - - *x = mousex; - *y = mousey; - mousex = mousey = 0; -} - -// -// readmousebstatus() -- return mouse button information -// -void readmousebstatus(int32_t *b) -{ - if (!mouseacquired || !appactive || !moustat) *b = 0; - else *b = mouseb; -} - -// -// setjoydeadzone() -- sets the dead and saturation zones for the joystick -// -void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur) -{ - joydead[axis] = dead; - joysatur[axis] = satur; -} - - -// -// getjoydeadzone() -- gets the dead and saturation zones for the joystick -// -void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur) -{ - *dead = joydead[axis]; - *satur = joysatur[axis]; -} - - -// -// releaseallbuttons() -// -void releaseallbuttons(void) -{} - - -// -// -// --------------------------------------- -// -// All things Timer -// Ken did this -// -// --------------------------------------- -// -// - -static Uint32 timerfreq=0; -static Uint32 timerlastsample=0; -Uint32 timerticspersec=0; -static void(*usertimercallback)(void) = NULL; - -// -// inittimer() -- initialize timer -// -int32_t inittimer(int32_t tickspersecond) -{ - if (timerfreq) return 0; // already installed - -// initprintf("Initializing timer\n"); - - timerfreq = 1000; - timerticspersec = tickspersecond; - timerlastsample = SDL_GetTicks() * timerticspersec / timerfreq; - - usertimercallback = NULL; - - return 0; -} - -// -// uninittimer() -- shut down timer -// -void uninittimer(void) -{ - if (!timerfreq) return; - - timerfreq=0; -} - -// -// sampletimer() -- update totalclock -// -void sampletimer(void) -{ - Uint32 i; - int32_t n; - - if (!timerfreq) return; - - i = SDL_GetTicks(); - n = (int32_t)(i * timerticspersec / timerfreq) - timerlastsample; - if (n>0) - { - totalclock += n; - timerlastsample += n; - } - - if (usertimercallback) for (; n>0; n--) usertimercallback(); -} - -// -// getticks() -- returns the sdl ticks count -// -uint32_t getticks(void) -{ - return (uint32_t)SDL_GetTicks(); -} - - -// -// gettimerfreq() -- returns the number of ticks per second the timer is configured to generate -// -int32_t gettimerfreq(void) -{ - return timerticspersec; -} - - -// -// installusertimercallback() -- set up a callback function to be called when the timer is fired -// -void(*installusertimercallback(void(*callback)(void)))(void) -{ - void(*oldtimercallback)(void); - - oldtimercallback = usertimercallback; - usertimercallback = callback; - - return oldtimercallback; -} - - - -// -// -// --------------------------------------- -// -// All things Video -// -// --------------------------------------- -// -// - - -// -// getvalidmodes() -- figure out what video modes are available -// -static int32_t sortmodes(const struct validmode_t *a, const struct validmode_t *b) -{ - int32_t x; - - if ((x = a->fs - b->fs) != 0) return x; - if ((x = a->bpp - b->bpp) != 0) return x; - if ((x = a->xdim - b->xdim) != 0) return x; - if ((x = a->ydim - b->ydim) != 0) return x; - - return 0; -} -static char modeschecked=0; -void getvalidmodes(void) -{ - static int32_t cdepths[] = - { - 8, -#ifdef USE_OPENGL - 16,24,32, -#endif - 0 - }; - SDL_Rect **modes; - SDL_PixelFormat pf; - - pf.palette = NULL; - pf.BitsPerPixel = 8; - pf.BytesPerPixel = 1; - - int32_t i, j, maxx=0, maxy=0; - - if (modeschecked || novideo) return; - - validmodecnt=0; -// initprintf("Detecting video modes:\n"); - -#define ADDMODE(x,y,c,f) do { \ - if (validmodecnt 8) continue; -#endif - pf.BitsPerPixel = cdepths[j]; - pf.BytesPerPixel = cdepths[j] >> 3; - - modes = SDL_ListModes(&pf, SURFACE_FLAGS -// #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) - | SDL_FULLSCREEN // not implemented/working in SDL 1.3 SDL_compat.c -//#endif - ); - - if (modes == (SDL_Rect **)0) - { - if (cdepths[j] > 8) cdepths[j] = -1; - continue; - } - - if (modes == (SDL_Rect **)-1) - { - for (i=0; defaultres[i][0]; i++) - ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1); - } - else - { - for (i=0; modes[i]; i++) - { - if ((modes[i]->w > MAXXDIM) || (modes[i]->h > MAXYDIM)) continue; - - ADDMODE(modes[i]->w, modes[i]->h, cdepths[j], 1); - - if ((modes[i]->w > maxx) && (modes[i]->h > maxy)) - { - maxx = modes[i]->w; - maxy = modes[i]->h; - } - } - } - } - - if (maxx == 0 && maxy == 0) - { - initprintf("No fullscreen modes available!\n"); - maxx = MAXXDIM; maxy = MAXYDIM; - } - - // add windowed modes next - for (j=0; cdepths[j]; j++) - { -#ifdef USE_OPENGL - if (nogl && cdepths[j] > 8) continue; -#endif - if (cdepths[j] < 0) continue; - for (i=0; defaultres[i][0]; i++) - CHECK(defaultres[i][0],defaultres[i][1]) - ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0); - } - -#undef CHECK -#undef ADDMODE - - qsort((void *)validmode, validmodecnt, sizeof(struct validmode_t), (int32_t( *)(const void *,const void *))sortmodes); - - modeschecked=1; -} - - -// -// checkvideomode() -- makes sure the video mode passed is legal -// -int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced) -{ - int32_t i, nearest=-1, dx, dy, odx=9999, ody=9999; - - getvalidmodes(); - - if (c>8 -#ifdef USE_OPENGL - && nogl -#endif - ) return -1; - - // fix up the passed resolution values to be multiples of 8 - // and at least 320x200 or at most MAXXDIMxMAXYDIM - if (*x < 320) *x = 320; - if (*y < 200) *y = 200; - if (*x > MAXXDIM) *x = MAXXDIM; - if (*y > MAXYDIM) *y = MAXYDIM; -// *x &= 0xfffffff8l; - - for (i=0; i 8 && sdl_surface) polymost_glreset(); -#endif - - // restore gamma before we change video modes if it was changed - if (sdl_surface && gammabrightness) - { - SDL_SetGammaRamp(sysgamma[0], sysgamma[1], sysgamma[2]); - gammabrightness = 0; // redetect on next mode switch - } - -#ifdef USE_OPENGL - if (c > 8) - { - int32_t i, j, multisamplecheck = (glmultisample > 0); - struct - { - SDL_GLattr attr; - int32_t value; - } - attributes[] = - { -#if 0 - { SDL_GL_RED_SIZE, 8 }, - { SDL_GL_GREEN_SIZE, 8 }, - { SDL_GL_BLUE_SIZE, 8 }, - { SDL_GL_ALPHA_SIZE, 8 }, - { SDL_GL_BUFFER_SIZE, c }, - { SDL_GL_STENCIL_SIZE, 0 }, - { SDL_GL_ACCUM_RED_SIZE, 0 }, - { SDL_GL_ACCUM_GREEN_SIZE, 0 }, - { SDL_GL_ACCUM_BLUE_SIZE, 0 }, - { SDL_GL_ACCUM_ALPHA_SIZE, 0 }, - { SDL_GL_DEPTH_SIZE, 24 }, -#endif - { SDL_GL_DOUBLEBUFFER, 1 }, - { SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 }, - { SDL_GL_MULTISAMPLESAMPLES, glmultisample }, - { SDL_GL_STENCIL_SIZE, 1 }, -#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) - { SDL_GL_SWAP_CONTROL, vsync }, -#endif - }; - - if (nogl) return -1; - - initprintf("Setting video mode %dx%d (%d-bpp %s)\n", - x,y,c, ((fs&1) ? "fullscreen" : "windowed")); - do - { - for (i=0; i < (int32_t)(sizeof(attributes)/sizeof(attributes[0])); i++) - { - j = attributes[i].value; - if (!multisamplecheck && - (attributes[i].attr == SDL_GL_MULTISAMPLEBUFFERS || - attributes[i].attr == SDL_GL_MULTISAMPLESAMPLES) - ) - { - j = 0; - } - SDL_GL_SetAttribute(attributes[i].attr, j); - } - - /* HACK: changing SDL GL attribs only works before surface creation, - so we have to create a new surface in a different format first - to force the surface we WANT to be recreated instead of reused. */ -#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) - if (vsync != ovsync) - { - if (sdl_surface) - { - SDL_FreeSurface(sdl_surface); - sdl_surface = SDL_SetVideoMode(1, 1, 8, SDL_NOFRAME | SURFACE_FLAGS | ((fs&1)?SDL_FULLSCREEN:0)); - SDL_FreeSurface(sdl_surface); - } - ovsync = vsync; - } -#endif - sdl_surface = SDL_SetVideoMode(x, y, c, SDL_OPENGL | ((fs&1)?SDL_FULLSCREEN:0)); - if (!sdl_surface) - { - if (multisamplecheck) - { - initprintf("Multisample mode not possible. Retrying without multisampling.\n"); - glmultisample = 0; - continue; - } - initprintf("Unable to set video mode!\n"); - return -1; - } - } - while (multisamplecheck--); - } - else -#endif - { - initprintf("Setting video mode %dx%d (%d-bpp %s)\n", - x,y,c, ((fs&1) ? "fullscreen" : "windowed")); - sdl_surface = SDL_SetVideoMode(x, y, c, SURFACE_FLAGS | ((fs&1)?SDL_FULLSCREEN:0)); - if (!sdl_surface) - { - initprintf("Unable to set video mode!\n"); - return -1; - } - } - -#if 0 - { - char flags[512] = ""; -#define FLAG(x,y) if ((sdl_surface->flags & x) == x) { strcat(flags, y); strcat(flags, " "); } - FLAG(SDL_HWSURFACE, "HWSURFACE") else - FLAG(SDL_SWSURFACE, "SWSURFACE") - FLAG(SDL_ASYNCBLIT, "ASYNCBLIT") - FLAG(SDL_ANYFORMAT, "ANYFORMAT") - FLAG(SDL_HWPALETTE, "HWPALETTE") - FLAG(SDL_DOUBLEBUF, "DOUBLEBUF") - FLAG(SDL_FULLSCREEN, "FULLSCREEN") - FLAG(SDL_OPENGL, "OPENGL") - FLAG(SDL_OPENGLBLIT, "OPENGLBLIT") - FLAG(SDL_RESIZABLE, "RESIZABLE") - FLAG(SDL_HWACCEL, "HWACCEL") - FLAG(SDL_SRCCOLORKEY, "SRCCOLORKEY") - FLAG(SDL_RLEACCEL, "RLEACCEL") - FLAG(SDL_SRCALPHA, "SRCALPHA") - FLAG(SDL_PREALLOC, "PREALLOC") -#undef FLAG - initprintf("SDL Surface flags: %s\n", flags); - } -#endif - - { - //static char t[384]; - //sprintf(t, "%s (%dx%d %s)", apptitle, x, y, ((fs) ? "fullscreen" : "windowed")); - SDL_WM_SetCaption(apptitle, 0); - } - -#ifdef USE_OPENGL - if (c > 8) - { - char *p,*p2,*p3; - - polymost_glreset(); - - bglEnable(GL_TEXTURE_2D); - bglShadeModel(GL_SMOOTH); //GL_FLAT - bglClearColor(0,0,0,0.5); //Black Background - bglHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); //Use FASTEST for ortho! - bglHint(GL_LINE_SMOOTH_HINT,GL_NICEST); - bglDisable(GL_DITHER); - - glinfo.vendor = (const char *)bglGetString(GL_VENDOR); - glinfo.renderer = (const char *)bglGetString(GL_RENDERER); - glinfo.version = (const char *)bglGetString(GL_VERSION); - glinfo.extensions = (const char *)bglGetString(GL_EXTENSIONS); - -#ifdef POLYMER - if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc.")) - { - pr_ati_fboworkaround = 1; - initprintf("Enabling ATI FBO color attachment workaround.\n"); - - if (Bstrstr(glinfo.renderer,"Radeon X1")) - { - pr_ati_nodepthoffset = 1; - initprintf("Enabling ATI R520 polygon offset workaround.\n"); - } - else - pr_ati_nodepthoffset = 0; -#ifdef __APPLE__ - //See bug description at http://lists.apple.com/archives/mac-opengl/2005/Oct/msg00169.html - if (!Bstrncmp(glinfo.renderer,"ATI Radeon 9600", 15)) - { - pr_ati_textureformat_one = 1; - initprintf("Enabling ATI Radeon 9600 texture format workaround.\n"); - } - else - pr_ati_textureformat_one = 0; -#endif - } - else - pr_ati_fboworkaround = 0; -#endif - - glinfo.maxanisotropy = 1.0; - glinfo.bgra = 0; - glinfo.texcompr = 0; - - // process the extensions string and flag stuff we recognize - p = Bstrdup(glinfo.extensions); - p3 = p; - while ((p2 = Bstrtoken(p3==p?p:NULL, " ", (char **)&p3, 1)) != NULL) - { - if (!Bstrcmp(p2, "GL_EXT_texture_filter_anisotropic")) - { - // supports anisotropy. get the maximum anisotropy level - bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy); - } - else if (!Bstrcmp(p2, "GL_EXT_texture_edge_clamp") || - !Bstrcmp(p2, "GL_SGIS_texture_edge_clamp")) - { - // supports GL_CLAMP_TO_EDGE or GL_CLAMP_TO_EDGE_SGIS - glinfo.clamptoedge = 1; - } - else if (!Bstrcmp(p2, "GL_EXT_bgra")) - { - // support bgra textures - glinfo.bgra = 1; - } - else if (!Bstrcmp(p2, "GL_ARB_texture_compression")) - { - // support texture compression - glinfo.texcompr = 1; - } - else if (!Bstrcmp(p2, "GL_ARB_texture_non_power_of_two")) - { - // support non-power-of-two texture sizes - glinfo.texnpot = 1; - } - else if (!Bstrcmp(p2, "WGL_3DFX_gamma_control")) - { - // 3dfx cards have issues with fog - nofog = 1; - if (!(warnonce&1)) initprintf("3dfx card detected: OpenGL fog disabled\n"); - warnonce |= 1; - } - else if (!Bstrcmp(p2, "GL_ARB_multisample")) - { - // supports multisampling - glinfo.multisample = 1; - } - else if (!Bstrcmp(p2, "GL_NV_multisample_filter_hint")) - { - // supports nvidia's multisample hint extension - glinfo.nvmultisamplehint = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_fragment_program")) - { - glinfo.arbfp = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_depth_texture")) - { - glinfo.depthtex = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_shadow")) - { - glinfo.shadow = 1; - } - else if (!Bstrcmp((char *)p2, "GL_EXT_framebuffer_object")) - { - glinfo.fbos = 1; - } - else if (!Bstrcmp((char *)p2, "GL_NV_texture_rectangle") || - !Bstrcmp((char *)p2, "GL_EXT_texture_rectangle")) - { - glinfo.rect = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_multitexture")) - { - glinfo.multitex = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_texture_env_combine")) - { - glinfo.envcombine = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_vertex_buffer_object")) - { - glinfo.vbos = 1; - } - else if (!Bstrcmp((char *)p2, "GL_EXT_gpu_shader4")) - { - glinfo.sm4 = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_occlusion_query")) - { - glinfo.occlusionqueries = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_shader_objects")) - { - glinfo.glsl = 1; - } - } - Bfree(p); - - if (!glinfo.dumped) - { - int32_t oldbpp = bpp; - bpp = 32; - osdcmd_glinfo(NULL); - glinfo.dumped = 1; - bpp = oldbpp; - } - } -#endif - - xres = x; - yres = y; - bpp = c; - fullscreen = fs; - //bytesperline = sdl_surface->pitch; - //imageSize = bytesperline*yres; - numpages = c>8?2:1; - frameplace = 0; - lockcount = 0; - modechange=1; - videomodereset = 0; - OSD_ResizeDisplay(xres,yres); - - // save the current system gamma to determine if gamma is available - if (!gammabrightness) - { -// float f = 1.0 + ((float)curbrightness / 10.0); - if (SDL_GetGammaRamp(sysgamma[0], sysgamma[1], sysgamma[2]) >= 0) - gammabrightness = 1; - - // see if gamma really is working by trying to set the brightness - if (gammabrightness && setgamma() < 0) - gammabrightness = 0; // nope - } - - // setpalettefade will set the palette according to whether gamma worked - setpalettefade(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta); - - //if (c==8) setpalette(0,256,0); - //baselayer_onvideomodechange(c>8); - - if (regrab) grabmouse(1); - - return 0; -} - - -// -// resetvideomode() -- resets the video system -// -void resetvideomode(void) -{ - videomodereset = 1; - modeschecked = 0; -} - - -// -// begindrawing() -- locks the framebuffer for drawing -// -void begindrawing(void) -{ - int32_t i,j; - - if (bpp > 8) - { - if (offscreenrendering) return; - frameplace = 0; - bytesperline = 0; - imageSize = 0; - modechange = 0; - return; - } - - // lock the frame - if (lockcount++ > 0) - return; - - if (offscreenrendering) return; - - if (SDL_MUSTLOCK(sdl_surface)) SDL_LockSurface(sdl_surface); - frameplace = (intptr_t)sdl_surface->pixels; - - if (sdl_surface->pitch != bytesperline || modechange) - { - bytesperline = sdl_surface->pitch; - imageSize = bytesperline*yres; - setvlinebpl(bytesperline); - - j = 0; - for (i=0; i<=ydim; i++) ylookup[i] = j, j += bytesperline; - modechange=0; - } -} - - -// -// enddrawing() -- unlocks the framebuffer -// -void enddrawing(void) -{ - if (bpp > 8) - { - if (!offscreenrendering) frameplace = 0; - return; - } - - if (!frameplace) return; - if (lockcount > 1) { lockcount--; return; } - if (!offscreenrendering) frameplace = 0; - if (lockcount == 0) return; - lockcount = 0; - - if (offscreenrendering) return; - - if (SDL_MUSTLOCK(sdl_surface)) SDL_UnlockSurface(sdl_surface); -} - - -// -// showframe() -- update the display -// -void showframe(int32_t w) -{ -// int32_t i,j; - UNREFERENCED_PARAMETER(w); - -#ifdef USE_OPENGL - if (bpp > 8) - { - if (palfadedelta) - { - bglMatrixMode(GL_PROJECTION); - bglPushMatrix(); - bglLoadIdentity(); - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - bglLoadIdentity(); - - bglDisable(GL_DEPTH_TEST); - bglDisable(GL_ALPHA_TEST); - bglDisable(GL_TEXTURE_2D); - - bglEnable(GL_BLEND); - bglColor4ub(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta); - - bglBegin(GL_TRIANGLES); - bglVertex2f(-2.5f, 1.f); - bglVertex2f(2.5f, 1.f); - bglVertex2f(.0f, -2.5f); - bglEnd(); - - bglDisable(GL_BLEND); - - bglPopMatrix(); - bglMatrixMode(GL_PROJECTION); - bglPopMatrix(); - } - - SDL_GL_SwapBuffers(); - return; - } -#endif - - if (offscreenrendering) return; - - if (lockcount) - { - printf("Frame still locked %d times when showframe() called.\n", lockcount); - while (lockcount) enddrawing(); - } - - SDL_Flip(sdl_surface); -} - - -// -// setpalette() -- set palette values -// -int32_t setpalette(int32_t start, int32_t num) -{ - SDL_Color pal[256]; - int32_t i,n; - - if (bpp > 8) return 0; // no palette in opengl - - copybuf(curpalettefaded, pal, 256); - - for (i=start, n=num; n>0; i++, n--) - curpalettefaded[i].f = pal[i].unused = 0; - - //return SDL_SetPalette(sdl_surface, SDL_LOGPAL|SDL_PHYSPAL, pal, 0, 256); - - return sdl_surface ? SDL_SetColors(sdl_surface, pal, 0, 256) : 0; -} - -// -// getpalette() -- get palette values -// -/* -int32_t getpalette(int32_t start, int32_t num, char *dapal) -{ - int32_t i; - SDL_Palette *pal; - - // we shouldn't need to lock the surface to get the palette - pal = sdl_surface->format->palette; - - for (i=num; i>0; i--, start++) { - dapal[0] = pal->colors[start].b >> 2; - dapal[1] = pal->colors[start].g >> 2; - dapal[2] = pal->colors[start].r >> 2; - dapal += 4; - } - - return 1; -} -*/ - -// -// setgamma -// -int32_t setgamma(void) -{ - int32_t i; - uint16_t gammaTable[768]; - float gamma = max(0.1f,min(4.f,vid_gamma)); - float contrast = max(0.1f,min(3.f,vid_contrast)); - float bright = max(-0.8f,min(0.8f,vid_brightness)); - - double invgamma = 1 / gamma; - double norm = pow(255., invgamma - 1); - - if (novideo) return 0; - - // This formula is taken from Doomsday - - for (i = 0; i < 256; i++) - { - double val = i * contrast - (contrast - 1) * 127; - if (gamma != 1) val = pow(val, invgamma) / norm; - val += bright * 128; - - gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (uint16_t)max(0.f,(double)min(0xffff,val*256)); - } - return SDL_SetGammaRamp(&gammaTable[0],&gammaTable[256],&gammaTable[512]); -} - -#ifndef __APPLE__ -extern struct sdlappicon sdlappicon; -static SDL_Surface *loadappicon(void) -{ - SDL_Surface *surf; - - surf = SDL_CreateRGBSurfaceFrom((void *)sdlappicon.pixels, - sdlappicon.width, sdlappicon.height, 32, sdlappicon.width*4, - 0xffl,0xff00l,0xff0000l,0xff000000l); - - return surf; -} -#endif - -// -// -// --------------------------------------- -// -// Miscellany -// -// --------------------------------------- -// -// - - -// -// handleevents() -- process the SDL message queue -// returns !0 if there was an important event worth checking (like quitting) -// - -int32_t handleevents(void) -{ - int32_t code, rv=0, j; - SDL_Event ev; - - while (SDL_PollEvent(&ev)) - { - switch (ev.type) - { -#if (SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2) - case SDL_TEXTINPUT: - j = 0; - do - { - code = ev.text.text[j]; - - if (code != scantoasc[OSD_OSDKey()] && ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc) - { -// printf("got char %d\n",code); - - if (OSD_HandleChar(code)) - { - keyasciififo[keyasciififoend] = code; - keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1)); - } - } - } - while (j < SDL_TEXTINPUTEVENT_TEXT_SIZE && ev.text.text[++j]); - break; - - case SDL_KEYDOWN: - case SDL_KEYUP: - code = keytranslation[ev.key.keysym.scancode]; -// printf("got key %d, %d\n",ev.key.keysym.scancode,code); - - // hook in the osd - if (OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN)) == 0) - break; - - if (ev.key.type == SDL_KEYDOWN) - { - if (!keystatus[code]) - { - SetKey(code, 1); - if (keypresscallback) - keypresscallback(code, 1); - } - } - else - { - SetKey(code, 0); - if (keypresscallback) - keypresscallback(code, 0); - } - break; - case SDL_WINDOWEVENT: - switch (ev.window.event) - { - case SDL_WINDOWEVENT_FOCUS_GAINED: - appactive = 1; -#ifndef DEBUGGINGAIDS - if (mouseacquired && moustat) - { - SDL_WM_GrabInput(SDL_GRAB_ON); - SDL_ShowCursor(SDL_DISABLE); - } -#endif - break; - case SDL_WINDOWEVENT_FOCUS_LOST: - appactive = 0; -#ifndef DEBUGGINGAIDS - if (mouseacquired && moustat) - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - SDL_ShowCursor(SDL_ENABLE); - } -#endif - break; - } - break; - /* - case SDL_MOUSEWHEEL: - initprintf("wheel y %d\n",ev.wheel.y); - if (ev.wheel.y > 0) - { - mwheelup = totalclock; - mouseb |= 16; - if (mousepresscallback) - mousepresscallback(5, 1); - } - if (ev.wheel.y < 0) - { - mwheeldown = totalclock; - mouseb |= 32; - if (mousepresscallback) - mousepresscallback(6, 1); - } - break; - */ -// #print "Using SDL 1.3" -#else // SDL 1.3 ^^^ | vvv SDL 1.2 -// #print "Using SDL 1.2" - case SDL_KEYDOWN: - case SDL_KEYUP: - code = keytranslation[ev.key.keysym.sym]; - - if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN && - (ev.key.keysym.unicode & 0xff80) == 0 && - ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc) - { -// if (ev.type==SDL_KEYDOWN) -// printf("got char %d\n",ev.key.keysym.unicode & 0x7f); - if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f)) - { - keyasciififo[keyasciififoend] = ev.key.keysym.unicode & 0x7f; - keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1)); - } - } - - // hook in the osd -// if (ev.type==SDL_KEYDOWN) -// printf("got key %d\n",code); - if (OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN)) == 0) - break; - - if (ev.key.type == SDL_KEYDOWN) - { - if (!keystatus[code]) - { - SetKey(code, 1); - if (keypresscallback) - keypresscallback(code, 1); - } - } - else - { - SetKey(code, 0); - if (keypresscallback) - keypresscallback(code, 0); - } - break; - - case SDL_ACTIVEEVENT: - if (ev.active.state & SDL_APPINPUTFOCUS) - { - appactive = ev.active.gain; -#ifndef DEBUGGINGAIDS - if (mouseacquired && moustat) - { - if (appactive) - { - SDL_WM_GrabInput(SDL_GRAB_ON); - SDL_ShowCursor(SDL_DISABLE); - } - else - { - SDL_WM_GrabInput(SDL_GRAB_OFF); - SDL_ShowCursor(SDL_ENABLE); - } - } -#endif - rv=-1; - } - break; -#endif - - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - switch (ev.button.button) - { - // some of these get reordered to match winlayer - default: - j = -1; break; - case SDL_BUTTON_LEFT: - j = 0; break; - case SDL_BUTTON_RIGHT: - j = 1; break; - case SDL_BUTTON_MIDDLE: - j = 2; break; - case SDL_BUTTON_WHEELUP: - case SDL_BUTTON_WHEELDOWN: - j = ev.button.button; break; - } - if (j<0) break; - - if (ev.button.state == SDL_PRESSED) - { - if (ev.button.button == SDL_BUTTON_WHEELUP) - { - mwheelup = totalclock; - } - if (ev.button.button == SDL_BUTTON_WHEELDOWN) - { - mwheeldown = totalclock; - } - mouseb |= (1< -joydead[ev.jaxis.axis])) - joyaxis[ev.jaxis.axis] = 0; - else if (joyaxis[ev.jaxis.axis] >= joysatur[ev.jaxis.axis]) - joyaxis[ev.jaxis.axis] = 10000; - else if (joyaxis[ev.jaxis.axis] <= -joysatur[ev.jaxis.axis]) - joyaxis[ev.jaxis.axis] = -10000; - else - joyaxis[ev.jaxis.axis] = joyaxis[ev.jaxis.axis] * - 10000 / joysatur[ev.jaxis.axis]; - } - break; - - case SDL_JOYHATMOTION: - { - int32_t hatvals[16] = - { - -1, // centre - 0, // up 1 - 9000, // right 2 - 4500, // up+right 3 - 18000, // down 4 - -1, // down+up!! 5 - 13500, // down+right 6 - -1, // down+right+up!! 7 - 27000, // left 8 - 27500, // left+up 9 - -1, // left+right!! 10 - -1, // left+right+up!! 11 - 22500, // left+down 12 - -1, // left+down+up!! 13 - -1, // left+down+right!! 14 - -1, // left+down+right+up!! 15 - }; - if (appactive && ev.jhat.hat < joynumhats) - joyhat[ ev.jhat.hat ] = hatvals[ ev.jhat.value & 15 ]; - break; - } - - case SDL_JOYBUTTONDOWN: - case SDL_JOYBUTTONUP: - if (appactive && ev.jbutton.button < joynumbuttons) - { - if (ev.jbutton.state == SDL_PRESSED) - joyb |= 1 << ev.jbutton.button; - else - joyb &= ~(1 << ev.jbutton.button); - } - break; - - case SDL_QUIT: - quitevent = 1; - rv=-1; - break; - - default: - //OSD_Printf("Got event (%d)\n", ev.type); - break; - } - } - -// if (mousex|mousey) printf("%d,%d\n",mousex,mousey); /// - - sampletimer(); - - if (moustat) - { - if ((mwheelup) && (mwheelup <= (unsigned)(totalclock - MWHEELTICKS))) - { - mouseb &= ~16; - mwheelup = 0; - } - if ((mwheeldown) && (mwheeldown <= (unsigned)(totalclock - MWHEELTICKS))) - { - mouseb &= ~32; - mwheeldown = 0; - } - } - - startwin_idle(NULL); - -#undef SetKey - - if (after_handleevents_hook) - after_handleevents_hook(); - - return rv; -} - -inline void idle(void) -{ - usleep(1000); -} - -inline void idle_waitevent(void) -{ - SDL_WaitEvent(NULL); -} - -#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2 -// from SDL HG, modified -static int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout) -{ - uint32_t expiration = 0; - - if (timeout > 0) - expiration = SDL_GetTicks() + timeout; - - for (;;) - { - SDL_PumpEvents(); - switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, ~0)) //SDL_FIRSTEVENT, SDL_LASTEVENT)) { - { - case -1: - return 0; - case 1: - return 1; - case 0: - if (timeout == 0) - { - /* Polling and no events, just return */ - return 0; - } - if (timeout > 0 && ((int32_t)(SDL_GetTicks() - expiration) >= 0)) - { - /* Timeout expired and no events */ - return 0; - } - SDL_Delay(10); - break; - } - } -} -#endif - -inline void idle_waitevent_timeout(uint32_t timeout) -{ - SDL_WaitEventTimeout(NULL, timeout); -} - -#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2 -static int32_t buildkeytranslationtable(void) -{ - memset(keytranslation,0,sizeof(keytranslation)); - -#define MAP(x,y) keytranslation[x] = y - MAP(SDLK_BACKSPACE, 0xe); - MAP(SDLK_TAB, 0xf); - MAP(SDLK_RETURN, 0x1c); - MAP(SDLK_PAUSE, 0x59); // 0x1d + 0x45 + 0x9d + 0xc5 - MAP(SDLK_ESCAPE, 0x1); - MAP(SDLK_SPACE, 0x39); - MAP(SDLK_EXCLAIM, 0x2); // '1' - MAP(SDLK_QUOTEDBL, 0x28); // ''' - MAP(SDLK_HASH, 0x4); // '3' - MAP(SDLK_DOLLAR, 0x5); // '4' - MAP(37, 0x6); // '5' <-- where's the keysym SDL guys? - MAP(SDLK_AMPERSAND, 0x8); // '7' - MAP(SDLK_QUOTE, 0x28); // ''' - MAP(SDLK_LEFTPAREN, 0xa); // '9' - MAP(SDLK_RIGHTPAREN, 0xb); // '0' - MAP(SDLK_ASTERISK, 0x9); // '8' - MAP(SDLK_PLUS, 0xd); // '=' - MAP(SDLK_COMMA, 0x33); - MAP(SDLK_MINUS, 0xc); - MAP(SDLK_PERIOD, 0x34); - MAP(SDLK_SLASH, 0x35); - MAP(SDLK_0, 0xb); - MAP(SDLK_1, 0x2); - MAP(SDLK_2, 0x3); - MAP(SDLK_3, 0x4); - MAP(SDLK_4, 0x5); - MAP(SDLK_5, 0x6); - MAP(SDLK_6, 0x7); - MAP(SDLK_7, 0x8); - MAP(SDLK_8, 0x9); - MAP(SDLK_9, 0xa); - MAP(SDLK_COLON, 0x27); - MAP(SDLK_SEMICOLON, 0x27); - MAP(SDLK_LESS, 0x33); - MAP(SDLK_EQUALS, 0xd); - MAP(SDLK_GREATER, 0x34); - MAP(SDLK_QUESTION, 0x35); - MAP(SDLK_AT, 0x3); // '2' - MAP(SDLK_LEFTBRACKET, 0x1a); - MAP(SDLK_BACKSLASH, 0x2b); - MAP(SDLK_RIGHTBRACKET, 0x1b); - MAP(SDLK_CARET, 0x7); // '7' - MAP(SDLK_UNDERSCORE, 0xc); - MAP(SDLK_BACKQUOTE, 0x29); - MAP(SDLK_a, 0x1e); - MAP(SDLK_b, 0x30); - MAP(SDLK_c, 0x2e); - MAP(SDLK_d, 0x20); - MAP(SDLK_e, 0x12); - MAP(SDLK_f, 0x21); - MAP(SDLK_g, 0x22); - MAP(SDLK_h, 0x23); - MAP(SDLK_i, 0x17); - MAP(SDLK_j, 0x24); - MAP(SDLK_k, 0x25); - MAP(SDLK_l, 0x26); - MAP(SDLK_m, 0x32); - MAP(SDLK_n, 0x31); - MAP(SDLK_o, 0x18); - MAP(SDLK_p, 0x19); - MAP(SDLK_q, 0x10); - MAP(SDLK_r, 0x13); - MAP(SDLK_s, 0x1f); - MAP(SDLK_t, 0x14); - MAP(SDLK_u, 0x16); - MAP(SDLK_v, 0x2f); - MAP(SDLK_w, 0x11); - MAP(SDLK_x, 0x2d); - MAP(SDLK_y, 0x15); - MAP(SDLK_z, 0x2c); - MAP(SDLK_DELETE, 0xd3); - MAP(SDLK_KP0, 0x52); - MAP(SDLK_KP1, 0x4f); - MAP(SDLK_KP2, 0x50); - MAP(SDLK_KP3, 0x51); - MAP(SDLK_KP4, 0x4b); - MAP(SDLK_KP5, 0x4c); - MAP(SDLK_KP6, 0x4d); - MAP(SDLK_KP7, 0x47); - MAP(SDLK_KP8, 0x48); - MAP(SDLK_KP9, 0x49); - MAP(SDLK_KP_PERIOD, 0x53); - MAP(SDLK_KP_DIVIDE, 0xb5); - MAP(SDLK_KP_MULTIPLY, 0x37); - MAP(SDLK_KP_MINUS, 0x4a); - MAP(SDLK_KP_PLUS, 0x4e); - MAP(SDLK_KP_ENTER, 0x9c); - //MAP(SDLK_KP_EQUALS, ); - MAP(SDLK_UP, 0xc8); - MAP(SDLK_DOWN, 0xd0); - MAP(SDLK_RIGHT, 0xcd); - MAP(SDLK_LEFT, 0xcb); - MAP(SDLK_INSERT, 0xd2); - MAP(SDLK_HOME, 0xc7); - MAP(SDLK_END, 0xcf); - MAP(SDLK_PAGEUP, 0xc9); - MAP(SDLK_PAGEDOWN, 0xd1); - MAP(SDLK_F1, 0x3b); - MAP(SDLK_F2, 0x3c); - MAP(SDLK_F3, 0x3d); - MAP(SDLK_F4, 0x3e); - MAP(SDLK_F5, 0x3f); - MAP(SDLK_F6, 0x40); - MAP(SDLK_F7, 0x41); - MAP(SDLK_F8, 0x42); - MAP(SDLK_F9, 0x43); - MAP(SDLK_F10, 0x44); - MAP(SDLK_F11, 0x57); - MAP(SDLK_F12, 0x58); - MAP(SDLK_NUMLOCK, 0x45); - MAP(SDLK_CAPSLOCK, 0x3a); - MAP(SDLK_SCROLLOCK, 0x46); - MAP(SDLK_RSHIFT, 0x36); - MAP(SDLK_LSHIFT, 0x2a); - MAP(SDLK_RCTRL, 0x9d); - MAP(SDLK_LCTRL, 0x1d); - MAP(SDLK_RALT, 0xb8); - MAP(SDLK_LALT, 0x38); - MAP(SDLK_LSUPER, 0xdb); // win l - MAP(SDLK_RSUPER, 0xdc); // win r - MAP(SDLK_PRINT, -2); // 0xaa + 0xb7 - MAP(SDLK_SYSREQ, 0x54); // alt+printscr - MAP(SDLK_BREAK, 0xb7); // ctrl+pause - MAP(SDLK_MENU, 0xdd); // win menu? -#undef MAP - - return 0; -} -#else // if SDL 1.3 -static int32_t buildkeytranslationtable(void) -{ - memset(keytranslation,0,sizeof(keytranslation)); - -#define MAP(x,y) keytranslation[x] = y - printf("%d\n",SDL_SCANCODE_BACKSPACE); - MAP(SDL_SCANCODE_BACKSPACE, 0xe); - MAP(SDL_SCANCODE_TAB, 0xf); - MAP(SDL_SCANCODE_RETURN, 0x1c); - MAP(SDL_SCANCODE_PAUSE, 0x59); // 0x1d + 0x45 + 0x9d + 0xc5 - MAP(SDL_SCANCODE_ESCAPE, 0x1); - MAP(SDL_SCANCODE_SPACE, 0x39); - MAP(SDL_SCANCODE_COMMA, 0x33); - MAP(SDL_SCANCODE_MINUS, 0xc); - MAP(SDL_SCANCODE_PERIOD, 0x34); - MAP(SDL_SCANCODE_SLASH, 0x35); - MAP(SDL_SCANCODE_0, 0xb); - MAP(SDL_SCANCODE_1, 0x2); - MAP(SDL_SCANCODE_2, 0x3); - MAP(SDL_SCANCODE_3, 0x4); - MAP(SDL_SCANCODE_4, 0x5); - MAP(SDL_SCANCODE_5, 0x6); - MAP(SDL_SCANCODE_6, 0x7); - MAP(SDL_SCANCODE_7, 0x8); - MAP(SDL_SCANCODE_8, 0x9); - MAP(SDL_SCANCODE_9, 0xa); - MAP(SDL_SCANCODE_SEMICOLON, 0x27); - MAP(SDL_SCANCODE_EQUALS, 0xd); - MAP(SDL_SCANCODE_LEFTBRACKET, 0x1a); - MAP(SDL_SCANCODE_BACKSLASH, 0x2b); - MAP(SDL_SCANCODE_RIGHTBRACKET, 0x1b); - MAP(SDL_SCANCODE_A, 0x1e); - MAP(SDL_SCANCODE_B, 0x30); - MAP(SDL_SCANCODE_C, 0x2e); - MAP(SDL_SCANCODE_D, 0x20); - MAP(SDL_SCANCODE_E, 0x12); - MAP(SDL_SCANCODE_F, 0x21); - MAP(SDL_SCANCODE_G, 0x22); - MAP(SDL_SCANCODE_H, 0x23); - MAP(SDL_SCANCODE_I, 0x17); - MAP(SDL_SCANCODE_J, 0x24); - MAP(SDL_SCANCODE_K, 0x25); - MAP(SDL_SCANCODE_L, 0x26); - MAP(SDL_SCANCODE_M, 0x32); - MAP(SDL_SCANCODE_N, 0x31); - MAP(SDL_SCANCODE_O, 0x18); - MAP(SDL_SCANCODE_P, 0x19); - MAP(SDL_SCANCODE_Q, 0x10); - MAP(SDL_SCANCODE_R, 0x13); - MAP(SDL_SCANCODE_S, 0x1f); - MAP(SDL_SCANCODE_T, 0x14); - MAP(SDL_SCANCODE_U, 0x16); - MAP(SDL_SCANCODE_V, 0x2f); - MAP(SDL_SCANCODE_W, 0x11); - MAP(SDL_SCANCODE_X, 0x2d); - MAP(SDL_SCANCODE_Y, 0x15); - MAP(SDL_SCANCODE_Z, 0x2c); - MAP(SDL_SCANCODE_DELETE, 0xd3); - MAP(SDL_SCANCODE_KP_0, 0x52); - MAP(SDL_SCANCODE_KP_1, 0x4f); - MAP(SDL_SCANCODE_KP_2, 0x50); - MAP(SDL_SCANCODE_KP_3, 0x51); - MAP(SDL_SCANCODE_KP_4, 0x4b); - MAP(SDL_SCANCODE_KP_5, 0x4c); - MAP(SDL_SCANCODE_KP_6, 0x4d); - MAP(SDL_SCANCODE_KP_7, 0x47); - MAP(SDL_SCANCODE_KP_8, 0x48); - MAP(SDL_SCANCODE_KP_9, 0x49); - MAP(SDL_SCANCODE_KP_PERIOD, 0x53); - MAP(SDL_SCANCODE_KP_DIVIDE, 0xb5); - MAP(SDL_SCANCODE_KP_MULTIPLY, 0x37); - MAP(SDL_SCANCODE_KP_MINUS, 0x4a); - MAP(SDL_SCANCODE_KP_PLUS, 0x4e); - MAP(SDL_SCANCODE_KP_ENTER, 0x9c); - //MAP(SDL_SCANCODE_KP_EQUALS, ); - MAP(SDL_SCANCODE_UP, 0xc8); - MAP(SDL_SCANCODE_DOWN, 0xd0); - MAP(SDL_SCANCODE_RIGHT, 0xcd); - MAP(SDL_SCANCODE_LEFT, 0xcb); - MAP(SDL_SCANCODE_INSERT, 0xd2); - MAP(SDL_SCANCODE_HOME, 0xc7); - MAP(SDL_SCANCODE_END, 0xcf); - MAP(SDL_SCANCODE_PAGEUP, 0xc9); - MAP(SDL_SCANCODE_PAGEDOWN, 0xd1); - MAP(SDL_SCANCODE_F1, 0x3b); - MAP(SDL_SCANCODE_F2, 0x3c); - MAP(SDL_SCANCODE_F3, 0x3d); - MAP(SDL_SCANCODE_F4, 0x3e); - MAP(SDL_SCANCODE_F5, 0x3f); - MAP(SDL_SCANCODE_F6, 0x40); - MAP(SDL_SCANCODE_F7, 0x41); - MAP(SDL_SCANCODE_F8, 0x42); - MAP(SDL_SCANCODE_F9, 0x43); - MAP(SDL_SCANCODE_F10, 0x44); - MAP(SDL_SCANCODE_F11, 0x57); - MAP(SDL_SCANCODE_F12, 0x58); - MAP(SDL_SCANCODE_NUMLOCKCLEAR, 0x45); - MAP(SDL_SCANCODE_CAPSLOCK, 0x3a); - MAP(SDL_SCANCODE_SCROLLLOCK, 0x46); - MAP(SDL_SCANCODE_RSHIFT, 0x36); - MAP(SDL_SCANCODE_LSHIFT, 0x2a); - MAP(SDL_SCANCODE_RCTRL, 0x9d); - MAP(SDL_SCANCODE_LCTRL, 0x1d); - MAP(SDL_SCANCODE_RALT, 0xb8); - MAP(SDL_SCANCODE_LALT, 0x38); - MAP(SDL_SCANCODE_LGUI, 0xdb); // win l - MAP(SDL_SCANCODE_RGUI, 0xdc); // win r - MAP(SDL_SCANCODE_PRINTSCREEN, -2); // 0xaa + 0xb7 - MAP(SDL_SCANCODE_SYSREQ, 0x54); // alt+printscr - MAP(SDL_SCANCODE_PAUSE, 0xb7); // ctrl+pause - MAP(SDL_SCANCODE_MENU, 0xdd); // win menu? - MAP(SDL_SCANCODE_GRAVE, 0x29); // tilde -#undef MAP - - return 0; -} -#endif -#if defined _WIN32 -# define WIN32_LEAN_AND_MEAN -# include -#elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __APPLE__ -# include -#endif - -void makeasmwriteable(void) -{ -#ifndef ENGINE_USING_A_C - extern int32_t dep_begin, dep_end; -# if defined _WIN32 - DWORD oldprot; - if (!VirtualProtect((LPVOID)&dep_begin, (SIZE_T)&dep_end - (SIZE_T)&dep_begin, PAGE_EXECUTE_READWRITE, &oldprot)) - { - initprint("Error making code writeable\n"); - return; - } -# elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __APPLE__ - int32_t pagesize; - size_t dep_begin_page; - pagesize = sysconf(_SC_PAGE_SIZE); - if (pagesize == -1) - { - initprintf("Error getting system page size\n"); - return; - } - dep_begin_page = ((size_t)&dep_begin) & ~(pagesize-1); - if (mprotect((void *)dep_begin_page, (size_t)&dep_end - dep_begin_page, PROT_READ|PROT_WRITE) < 0) - { - initprintf("Error making code writeable (errno=%d)\n", errno); - return; - } -# else -# error "Don't know how to unprotect the self-modifying assembly on this platform!" -# endif -#endif -} diff --git a/polymer-perf/eduke32/build/src/smalltextfont.c b/polymer-perf/eduke32/build/src/smalltextfont.c deleted file mode 100644 index 60d2d4d6a..000000000 --- a/polymer-perf/eduke32/build/src/smalltextfont.c +++ /dev/null @@ -1,180 +0,0 @@ -// SMALLTEXTFONT.C - -// Font created by Ken Silverman -// Generated by BIN2C.EXE by Jonathon Fowler - -char smalltextfont[2048] = -{ - // 2048 bytes - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x24, - 0x3C, 0x18, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3C, 0x24, 0x18, 0x00, 0x00, - 0x00, 0x28, 0x3C, 0x3C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x10, 0x38, 0x3C, - 0x38, 0x10, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x3C, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x3C, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x28, 0x38, 0x38, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x14, 0x14, 0x30, 0x00, 0x00, - 0x00, 0x24, 0x18, 0x3C, 0x18, 0x24, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38, - 0x30, 0x20, 0x00, 0x00, 0x00, 0x08, 0x18, 0x38, 0x18, 0x08, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x10, 0x38, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, - 0x00, 0x28, 0x00, 0x00, 0x00, 0x1C, 0x34, 0x34, 0x14, 0x14, 0x00, 0x00, - 0x00, 0x1C, 0x30, 0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x38, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x38, 0x38, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, - 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3C, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x3C, 0x28, 0x3C, 0x28, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x10, 0x18, 0x30, 0x00, 0x00, 0x00, 0x28, 0x08, 0x10, - 0x20, 0x28, 0x00, 0x00, 0x00, 0x10, 0x28, 0x10, 0x30, 0x38, 0x00, 0x00, - 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x20, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, - 0x00, 0x38, 0x28, 0x28, 0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x38, 0x08, 0x38, 0x20, 0x38, 0x00, 0x00, - 0x00, 0x38, 0x08, 0x38, 0x08, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38, - 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00, - 0x00, 0x38, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, - 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x28, 0x38, 0x00, 0x00, - 0x00, 0x38, 0x28, 0x38, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x20, 0x00, 0x00, - 0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, - 0x38, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, 0x00, - 0x00, 0x30, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, - 0x30, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00, - 0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, - 0x20, 0x18, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x28, 0x30, 0x00, 0x00, - 0x00, 0x38, 0x20, 0x30, 0x20, 0x38, 0x00, 0x00, 0x00, 0x38, 0x20, 0x30, - 0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x20, 0x28, 0x28, 0x38, 0x00, 0x00, - 0x00, 0x28, 0x28, 0x38, 0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x10, 0x10, - 0x10, 0x38, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x28, 0x18, 0x00, 0x00, - 0x00, 0x28, 0x28, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, - 0x20, 0x38, 0x00, 0x00, 0x00, 0x28, 0x38, 0x38, 0x28, 0x28, 0x00, 0x00, - 0x00, 0x28, 0x38, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x38, 0x28, 0x28, - 0x28, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x20, 0x20, 0x00, 0x00, - 0x00, 0x38, 0x28, 0x28, 0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x28, 0x30, - 0x28, 0x28, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x08, 0x38, 0x00, 0x00, - 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, - 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, - 0x00, 0x28, 0x28, 0x38, 0x38, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x10, - 0x28, 0x28, 0x00, 0x00, 0x00, 0x28, 0x28, 0x38, 0x10, 0x10, 0x00, 0x00, - 0x00, 0x38, 0x08, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x30, 0x20, 0x20, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, - 0x00, 0x18, 0x08, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0x10, 0x28, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, - 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, - 0x28, 0x18, 0x00, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x38, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x00, 0x00, 0x00, 0x08, 0x08, 0x38, - 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00, - 0x00, 0x08, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x28, - 0x18, 0x08, 0x30, 0x00, 0x00, 0x20, 0x20, 0x38, 0x28, 0x28, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x10, 0x10, 0x20, 0x00, 0x00, 0x20, 0x20, 0x28, 0x30, 0x28, 0x00, 0x00, - 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x38, - 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, - 0x28, 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, - 0x10, 0x30, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, - 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x28, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, - 0x28, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x18, 0x00, 0x00, - 0x00, 0x18, 0x10, 0x20, 0x10, 0x18, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x30, 0x10, 0x08, 0x10, 0x30, 0x00, 0x00, - 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, - 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x20, 0x18, 0x30, 0x00, - 0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, - 0x38, 0x18, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00, - 0x00, 0x28, 0x00, 0x18, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, - 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x28, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00, 0x38, 0x00, 0x18, - 0x38, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00, - 0x00, 0x30, 0x00, 0x18, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x10, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x28, 0x10, 0x28, - 0x38, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x38, 0x28, 0x00, 0x00, - 0x00, 0x18, 0x00, 0x38, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, - 0x28, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00, - 0x00, 0x38, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x38, - 0x28, 0x38, 0x00, 0x00, 0x00, 0x30, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, - 0x00, 0x38, 0x00, 0x28, 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x28, - 0x28, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x28, 0x18, 0x30, 0x00, - 0x00, 0x28, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, - 0x28, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x20, 0x38, 0x10, 0x00, 0x00, - 0x00, 0x18, 0x14, 0x30, 0x10, 0x3C, 0x00, 0x00, 0x00, 0x28, 0x10, 0x38, - 0x38, 0x10, 0x00, 0x00, 0x00, 0x30, 0x28, 0x3C, 0x28, 0x2C, 0x00, 0x00, - 0x00, 0x18, 0x10, 0x38, 0x10, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, - 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x10, 0x10, 0x00, 0x00, - 0x00, 0x18, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x18, 0x00, 0x28, - 0x28, 0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x28, 0x28, 0x00, 0x00, - 0x00, 0x38, 0x00, 0x28, 0x38, 0x28, 0x00, 0x00, 0x00, 0x18, 0x28, 0x18, - 0x00, 0x38, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x38, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x10, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x20, 0x28, 0x10, 0x38, 0x18, 0x00, 0x00, 0x00, 0x20, 0x28, 0x18, - 0x38, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x14, 0x28, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x14, - 0x28, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x00, - 0x00, 0x14, 0x28, 0x14, 0x28, 0x14, 0x28, 0x00, 0x00, 0x34, 0x1C, 0x34, - 0x1C, 0x34, 0x1C, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x10, 0x10, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30, - 0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x30, - 0x30, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x18, 0x18, 0x00, - 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x38, - 0x38, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x38, 0x38, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x30, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x10, 0x10, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x3C, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x10, 0x10, 0x1C, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x3C, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x3C, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x10, 0x10, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x1C, - 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C, 0x1C, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C, - 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x18, 0x18, 0x00, - 0x00, 0x18, 0x18, 0x1C, 0x1C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3C, - 0x3C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, - 0x00, 0x10, 0x10, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3C, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x10, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x1C, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1C, 0x1C, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1C, - 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x3C, 0x18, 0x18, 0x18, 0x00, - 0x00, 0x10, 0x10, 0x3C, 0x3C, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, - 0x00, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00, 0x3C, 0x3C, 0x3C, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x28, 0x34, 0x00, 0x00, - 0x00, 0x30, 0x28, 0x30, 0x28, 0x30, 0x20, 0x00, 0x00, 0x38, 0x28, 0x20, - 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x38, 0x20, 0x10, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, - 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x30, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x14, 0x28, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x10, 0x28, - 0x10, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x38, 0x28, 0x10, 0x00, 0x00, - 0x00, 0x18, 0x24, 0x24, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x18, 0x10, 0x18, - 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x18, 0x3C, 0x18, 0x20, 0x00, 0x00, 0x00, 0x18, 0x20, 0x30, - 0x20, 0x18, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, - 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x38, 0x10, - 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x08, 0x10, 0x00, 0x38, 0x00, 0x00, - 0x00, 0x10, 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x00, 0x10, 0x28, 0x20, - 0x20, 0x20, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x28, 0x10, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x38, 0x28, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x30, 0x10, 0x00, 0x00, - 0x00, 0x30, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; diff --git a/polymer-perf/eduke32/build/src/startgtk.editor.c b/polymer-perf/eduke32/build/src/startgtk.editor.c deleted file mode 100644 index 7de019d23..000000000 --- a/polymer-perf/eduke32/build/src/startgtk.editor.c +++ /dev/null @@ -1,549 +0,0 @@ -#if defined(LINKED_GTK) -#include -#include -#include -#else -#include "dynamicgtk.h" -#endif - -#include "build.h" -#include "editor.h" -#include "baselayer.h" - -enum -{ - TAB_CONFIG, - TAB_MESSAGES, -}; - -static struct -{ - GtkWidget *startwin; - GtkWidget *hlayout; - GtkWidget *banner; - GtkWidget *vlayout; - GtkWidget *tabs; - GtkWidget *configtlayout; - GtkWidget *vmode2dlabel; - GtkWidget *vmode3dlabel; - GtkWidget *vmode2dcombo; - GtkWidget *vmode3dcombo; - GtkWidget *fullscreencheck; - GtkWidget *emptyhlayout; - GtkWidget *alwaysshowcheck; - GtkWidget *configtab; - GtkWidget *messagesscroll; - GtkWidget *messagestext; - GtkWidget *messagestab; - GtkWidget *buttons; - GtkWidget *cancelbutton; - GtkWidget *cancelbuttonalign; - GtkWidget *cancelbuttonlayout; - GtkWidget *cancelbuttonicon; - GtkWidget *cancelbuttonlabel; - GtkWidget *startbutton; - GtkWidget *startbuttonalign; - GtkWidget *startbuttonlayout; - GtkWidget *startbuttonicon; - GtkWidget *startbuttonlabel; - GtkAccelGroup *accel_group; -} stwidgets; - -static struct -{ - int32_t fullscreen; - int32_t xdim2d, ydim2d; - int32_t xdim3d, ydim3d, bpp3d; - int32_t forcesetup; -} settings; - -static int32_t retval = -1, mode = TAB_MESSAGES; -extern int32_t gtkenabled; -static void PopulateForm(void); - -// -- EVENT CALLBACKS AND CREATION STUFF -------------------------------------- - -static void on_vmode2dcombo_changed(GtkComboBox *combobox, gpointer user_data) -{ - GtkTreeModel *data; - GtkTreeIter iter; - int32_t val; - UNREFERENCED_PARAMETER(user_data); - if (!gtk_combo_box_get_active_iter(combobox, &iter)) return; - if (!(data = gtk_combo_box_get_model(combobox))) return; - gtk_tree_model_get(data, &iter, 1, &val, -1); - settings.xdim2d = validmode[val].xdim; - settings.ydim2d = validmode[val].ydim; -} - -static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data) -{ - GtkTreeModel *data; - GtkTreeIter iter; - int32_t val; - UNREFERENCED_PARAMETER(user_data); - if (!gtk_combo_box_get_active_iter(combobox, &iter)) return; - if (!(data = gtk_combo_box_get_model(combobox))) return; - gtk_tree_model_get(data, &iter, 1, &val, -1); - settings.xdim3d = validmode[val].xdim; - settings.ydim3d = validmode[val].ydim; - settings.bpp3d = validmode[val].bpp; -} - -static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data) -{ - UNREFERENCED_PARAMETER(user_data); - settings.fullscreen = (gtk_toggle_button_get_active(togglebutton) == TRUE); - PopulateForm(); -} - -static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data) -{ - UNREFERENCED_PARAMETER(user_data); - settings.forcesetup = (gtk_toggle_button_get_active(togglebutton) == TRUE); -} - -static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data) -{ - UNREFERENCED_PARAMETER(button); - UNREFERENCED_PARAMETER(user_data); - if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } - else quitevent++; -} - -static void on_startbutton_clicked(GtkButton *button, gpointer user_data) -{ - UNREFERENCED_PARAMETER(button); - UNREFERENCED_PARAMETER(user_data); - retval = 1; - gtk_main_quit(); -} - -static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) -{ - UNREFERENCED_PARAMETER(widget); - UNREFERENCED_PARAMETER(event); - UNREFERENCED_PARAMETER(user_data); - if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } - else quitevent++; - return TRUE; // FALSE would let the event go through. we want the game to decide when to close -} - -// -- SUPPORT FUNCTIONS ------------------------------------------------------- - -static GdkPixbuf *load_banner(void) -{ - extern const GdkPixdata startbanner_pixdata; - return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL); -} - -static void SetPage(int32_t n) -{ - if (!gtkenabled || !stwidgets.startwin) return; - mode = n; - gtk_notebook_set_current_page(GTK_NOTEBOOK(stwidgets.tabs), n); - - // each control in the config page vertical layout plus the start button should be made (in)sensitive - if (n == TAB_CONFIG) n = TRUE; else n = FALSE; - gtk_widget_set_sensitive(stwidgets.startbutton, n); - gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout), - (GtkCallback)gtk_widget_set_sensitive, - (gpointer)&n); -} - -static void PopulateForm(void) -{ - int32_t mode2d, mode3d, i; - GtkListStore *modes2d, *modes3d; - GtkTreeIter iter; - GtkComboBox *box2d, *box3d; - char buf[64]; - - mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); - if (mode2d < 0) mode2d = 0; - if (mode3d < 0) - { - int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 }; - for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } - for (; cd[i]; i++) - { - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); - if (mode3d < 0) continue; - settings.bpp3d = cd[i]; - break; - } - } - - box2d = GTK_COMBO_BOX(stwidgets.vmode2dcombo); - box3d = GTK_COMBO_BOX(stwidgets.vmode3dcombo); - modes2d = GTK_LIST_STORE(gtk_combo_box_get_model(box2d)); - modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d)); - gtk_list_store_clear(modes2d); - gtk_list_store_clear(modes3d); - - for (i=0; i aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); -#if GTK_CHECK_VERSION(2,6,0) - gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); -#else - { - GtkTextIter iter2 = enditer; - gtk_text_iter_backward_cursor_position(&iter2); - //FIXME: this seems be deleting one too many chars somewhere! - if (!gtk_text_iter_equal(&iter2, &enditer)) - gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); - } -#endif - aptr = ++bptr; - break; - case 0: - if (bptr > aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); - aptr = bptr; - break; - case '\r': // FIXME - default: - bptr++; - break; - } - } - - mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1); - gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0); - gtk_text_buffer_delete_mark(textbuffer, mark); - - return 0; -} - -int32_t startwin_settitle(const char *title) -{ - if (!gtkenabled) return 0; - if (!stwidgets.startwin) return 1; - gtk_window_set_title(GTK_WINDOW(stwidgets.startwin), title); - return 0; -} - -int32_t startwin_idle(void *s) -{ - UNREFERENCED_PARAMETER(s); - if (!gtkenabled) return 0; - //if (!stwidgets.startwin) return 1; - gtk_main_iteration_do(FALSE); - return 0; -} - -int32_t startwin_run(void) -{ - if (!gtkenabled) return 1; - if (!stwidgets.startwin) return 1; - - SetPage(TAB_CONFIG); - - settings.fullscreen = fullscreen; - settings.xdim2d = xdim2d; - settings.ydim2d = ydim2d; - settings.xdim3d = xdimgame; - settings.ydim3d = ydimgame; - settings.bpp3d = bppgame; - settings.forcesetup = forcesetup; - PopulateForm(); - - gtk_main(); - - SetPage(TAB_MESSAGES); - if (retval) - { - fullscreen = settings.fullscreen; - xdim2d = settings.xdim2d; - ydim2d = settings.ydim2d; - xdimgame = settings.xdim3d; - ydimgame = settings.ydim3d; - bppgame = settings.bpp3d; - forcesetup = settings.forcesetup; - } - - return retval; -} diff --git a/polymer-perf/eduke32/build/src/startwin.editor.c b/polymer-perf/eduke32/build/src/startwin.editor.c deleted file mode 100644 index 7067718a7..000000000 --- a/polymer-perf/eduke32/build/src/startwin.editor.c +++ /dev/null @@ -1,491 +0,0 @@ -#ifndef RENDERTYPEWIN -#error Only for Windows -#endif - -#include "compat.h" -#include "build.h" -#include "editor.h" -#include "winlayer.h" - -#define WIN32_LEAN_AND_MEAN -#include -#include -#ifndef _WIN32_IE -#define _WIN32_IE 0x0300 -#endif -#include -#include - -#include "startwin.editor.h" - -#define TAB_CONFIG 0 -#define TAB_MESSAGES 1 - -static struct -{ - int32_t fullscreen; - int32_t xdim2d, ydim2d; - int32_t xdim3d, ydim3d, bpp3d; - int32_t forcesetup; -} settings; - -static HWND startupdlg = NULL; -static HWND pages[2] = { NULL, NULL}; -static int32_t done = -1, mode = TAB_CONFIG; - -static void PopulateForm(void) -{ - int32_t i,j; - char buf[64]; - int32_t mode2d, mode3d; - HWND hwnd2d, hwnd3d; - - hwnd2d = GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE); - hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE); - - mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); - if (mode2d < 0) mode2d = 0; - if (mode3d < 0) - { - int32_t cd[] = { 32, 24, 16, 15, 8, 0 }; - for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } - for (; cd[i]; i++) - { - mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); - if (mode3d < 0) continue; - settings.bpp3d = cd[i]; - break; - } - } - - Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); - Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); - - (void)ComboBox_ResetContent(hwnd2d); - (void)ComboBox_ResetContent(hwnd3d); - for (i=0; iidFrom != WIN_STARTWIN_TABCTL) break; - cur = (int32_t)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); - switch (nmhdr->code) - { - case TCN_SELCHANGING: - { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_HIDE); - return TRUE; - } - case TCN_SELCHANGE: - { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_SHOW); - return TRUE; - } - } - break; - } - - case WM_CLOSE: - if (mode == TAB_CONFIG) done = 0; - else quitevent++; - return TRUE; - - case WM_DESTROY: - if (hbmp) - { - DeleteObject(hbmp); - hbmp = NULL; - } - - if (pages[TAB_CONFIG]) - { - DestroyWindow(pages[TAB_CONFIG]); - pages[TAB_CONFIG] = NULL; - } - - startupdlg = NULL; - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case WIN_STARTWIN_CANCEL: - if (mode == TAB_CONFIG) done = 0; - else quitevent++; - return TRUE; - case WIN_STARTWIN_START: - done = 1; return TRUE; - } - return FALSE; - - case WM_CTLCOLORSTATIC: - if ((HWND)lParam == pages[TAB_MESSAGES]) - return (BOOL)GetSysColorBrush(COLOR_WINDOW); - break; - - default: - break; - } - - return FALSE; -} - - -int32_t startwin_open(void) -{ - INITCOMMONCONTROLSEX icc; - if (startupdlg) return 1; - icc.dwSize = sizeof(icc); - icc.dwICC = ICC_TAB_CLASSES; - InitCommonControlsEx(&icc); - startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc); - if (startupdlg) - { - SetPage(TAB_MESSAGES); - EnableConfig(0); - return 0; - } - return -1; -} - -int32_t startwin_close(void) -{ - if (!startupdlg) return 1; - DestroyWindow(startupdlg); - startupdlg = NULL; - return 0; -} - -int32_t startwin_puts(const char *buf) -{ - const char *p = NULL, *q = NULL; - static char workbuf[1024]; - static int32_t newline = 0; - int32_t curlen, linesbefore, linesafter; - HWND edctl; - int32_t vis; - static HWND dactrl = NULL; - - if (!startupdlg) return 1; - - edctl = pages[TAB_MESSAGES]; - if (!edctl) return -1; - - if (!dactrl) dactrl = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL); - - vis = ((int32_t)SendMessage(dactrl, TCM_GETCURSEL,0,0) == TAB_MESSAGES); - - if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0); - curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0); - SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen); - linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0); - p = buf; - while (*p) - { - if (newline) - { - SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n"); - newline = 0; - } - q = p; - while (*q && *q != '\n') q++; - Bmemcpy(workbuf, p, q-p); - if (*q == '\n') - { - if (!q[1]) - { - newline = 1; - workbuf[q-p] = 0; - } - else - { - workbuf[q-p] = '\r'; - workbuf[q-p+1] = '\n'; - workbuf[q-p+2] = 0; - } - p = q+1; - } - else - { - workbuf[q-p] = 0; - p = q; - } - SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf); - } - linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0); - SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore); - if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0); - return 0; -} - -int32_t startwin_settitle(const char *str) -{ - if (!startupdlg) return 1; - SetWindowText(startupdlg, str); - return 0; -} - -int32_t startwin_idle(void *v) -{ - if (!startupdlg || !IsWindow(startupdlg)) return 0; - if (IsDialogMessage(startupdlg, (MSG *)v)) return 1; - return 0; -} - -int32_t startwin_run(void) -{ - MSG msg; - if (!startupdlg) return 1; - - done = -1; - - SetPage(TAB_CONFIG); - EnableConfig(1); - - settings.fullscreen = fullscreen; - settings.xdim2d = xdim2d; - settings.ydim2d = ydim2d; - settings.xdim3d = xdimgame; - settings.ydim3d = ydimgame; - settings.bpp3d = bppgame; - settings.forcesetup = forcesetup; - PopulateForm(); - - while (done < 0) - { - switch (GetMessage(&msg, NULL, 0,0)) - { - case 0: - done = 1; break; - case -1: - return -1; - default: - if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; - TranslateMessage(&msg); - DispatchMessage(&msg); - break; - } - } - - SetPage(TAB_MESSAGES); - EnableConfig(0); - if (done) - { - fullscreen = settings.fullscreen; - xdim2d = settings.xdim2d; - ydim2d = settings.ydim2d; - xdimgame = settings.xdim3d; - ydimgame = settings.ydim3d; - bppgame = settings.bpp3d; - forcesetup = settings.forcesetup; - } - - return done; -} - diff --git a/polymer-perf/eduke32/build/src/textfont.c b/polymer-perf/eduke32/build/src/textfont.c deleted file mode 100644 index 8e2027f40..000000000 --- a/polymer-perf/eduke32/build/src/textfont.c +++ /dev/null @@ -1,261 +0,0 @@ -// TEXTFONT.C - -char textfont[2048] = -{ - 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF, // . - 0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x81, 0x7E, 0x00, // . - 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xFF, 0x7E, 0x00, // . - 0x36, 0x7F, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00, // . - 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08, 0x00, // . - 0x1C, 0x1C, 0x08, 0x6B, 0x7F, 0x6B, 0x08, 0x1C, // . - 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x08, 0x1C, 0x3E, // . - 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, // . - 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, // . - 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, // . - 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, // . - 0x0F, 0x07, 0x0D, 0x3C, 0x66, 0x66, 0x66, 0x3C, // . - 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, // . - 0x30, 0x38, 0x3C, 0x36, 0x34, 0x70, 0xF0, 0xE0, // . - 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, // . - 0x18, 0xDB, 0x7E, 0x66, 0x66, 0x7E, 0xDB, 0x18, // . - 0x40, 0x70, 0x7C, 0x7F, 0x7C, 0x70, 0x40, 0x00, // . - 0x01, 0x07, 0x1F, 0x7F, 0x1F, 0x07, 0x01, 0x00, // . - 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, // . - 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, // . - 0x3F, 0x7A, 0x7A, 0x3A, 0x0A, 0x0A, 0x0A, 0x00, // . - 0x1E, 0x33, 0x1C, 0x36, 0x36, 0x1C, 0x66, 0x3C, // . - 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, // . - 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0x7E, // . - 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, // . - 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, // . - 0x00, 0x0C, 0x0E, 0x7F, 0x0E, 0x0C, 0x00, 0x00, // . - 0x00, 0x18, 0x38, 0x7F, 0x38, 0x18, 0x00, 0x00, // . - 0x00, 0x00, 0x60, 0x60, 0x60, 0x7F, 0x00, 0x00, // . - 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, // . - 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, // . - 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, // - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ! - 0x06, 0x0E, 0x0C, 0x18, 0x10, 0x00, 0x20, 0x00, // " - 0x6C, 0x6C, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, // # - 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, // $ - 0x10, 0x7C, 0xD0, 0x7C, 0x16, 0x7C, 0x10, 0x00, // % - 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, // & - 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, // ' - 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, // ( - 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, // ) - 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, // * - 0x00, 0x6C, 0x38, 0xFE, 0x38, 0x6C, 0x00, 0x00, // + - 0x00, 0x18, 0x18, 0x7E, 0x7E, 0x18, 0x18, 0x00, // , - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x10, // - - 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, // / - 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, // 0 - 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, // 1 - 0x0C, 0x1C, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, // 2 - 0x3C, 0x66, 0x06, 0x1C, 0x30, 0x60, 0x7E, 0x00, // 3 - 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, 0x00, // 4 - 0x1C, 0x3C, 0x6C, 0xCC, 0xFF, 0x0C, 0x0C, 0x00, // 5 - 0x7E, 0x60, 0x60, 0x7C, 0x06, 0x66, 0x3C, 0x00, // 6 - 0x3C, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00, // 7 - 0x7E, 0x06, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x00, // 8 - 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00, // 9 - 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x3C, 0x00, // : - 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, // ; - 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x08, 0x10, // < - 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x00, // = - 0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00, // > - 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00, // ? - 0x3C, 0x66, 0x06, 0x0C, 0x18, 0x00, 0x18, 0x00, // @ - 0x3C, 0x66, 0x6E, 0x6E, 0x6C, 0x60, 0x3C, 0x00, // A - 0x1C, 0x36, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x00, // B - 0x1C, 0x36, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00, // C - 0x1C, 0x36, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x00, // D - 0x78, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00, // E - 0x1E, 0x30, 0x60, 0x7C, 0x60, 0x60, 0x7E, 0x00, // F - 0x1E, 0x30, 0x60, 0x7C, 0x60, 0x60, 0x60, 0x00, // G - 0x1C, 0x36, 0x60, 0x6E, 0x66, 0x66, 0x3C, 0x00, // H - 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00, // I - 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, // J - 0x06, 0x06, 0x06, 0x06, 0x66, 0x6C, 0x38, 0x00, // K - 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, 0x00, // L - 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x3E, 0x00, // M - 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, // N - 0x26, 0x76, 0x7E, 0x6E, 0x66, 0x66, 0x66, 0x00, // O - 0x1C, 0x36, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, // P - 0x1C, 0x36, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x00, // Q - 0x1C, 0x36, 0x66, 0x66, 0x66, 0x6E, 0x3C, 0x06, // R - 0x1C, 0x36, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x00, // S - 0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, 0x00, // T - 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // U - 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, // V - 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, // W - 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0xEE, 0xC6, 0x00, // X - 0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00, // Y - 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00, // Z - 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00, // [ - 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, // - 0x80, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, // ] - 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, // ^ - 0x18, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, // _ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, // ` - 0x18, 0x18, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, // a - 0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x6C, 0x36, 0x00, // b - 0x30, 0x30, 0x3C, 0x36, 0x36, 0x36, 0x5C, 0x00, // c - 0x00, 0x00, 0x38, 0x64, 0x60, 0x64, 0x38, 0x00, // d - 0x0C, 0x0C, 0x3C, 0x6C, 0x6C, 0x6C, 0x36, 0x00, // e - 0x00, 0x00, 0x38, 0x64, 0x7C, 0x60, 0x38, 0x00, // f - 0x18, 0x34, 0x30, 0x7C, 0x30, 0x30, 0x30, 0x00, // g - 0x00, 0x00, 0x3C, 0x68, 0x38, 0x7C, 0x4C, 0x38, // h - 0x60, 0x60, 0x78, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, // i - 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x00, // j - 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x58, 0x30, // k - 0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0x00, // l - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x00, // m - 0x00, 0x00, 0xEC, 0xD6, 0xD6, 0xD6, 0xC6, 0x00, // n - 0x00, 0x00, 0xB8, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, // o - 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x6C, 0x38, 0x00, // p - 0x00, 0x00, 0x5C, 0x36, 0x36, 0x3C, 0x30, 0x30, // q - 0x00, 0x00, 0x3A, 0x6C, 0x6C, 0x3C, 0x0C, 0x0E, // r - 0x00, 0x00, 0x5C, 0x3A, 0x30, 0x30, 0x30, 0x00, // s - 0x00, 0x00, 0x38, 0x60, 0x38, 0x0C, 0x78, 0x00, // t - 0x30, 0x30, 0x7C, 0x30, 0x30, 0x34, 0x18, 0x00, // u - 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x6C, 0x36, 0x00, // v - 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x38, 0x10, 0x00, // w - 0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xD6, 0x6C, 0x00, // x - 0x00, 0x00, 0x62, 0x34, 0x18, 0x1C, 0x66, 0x00, // y - 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x3E, 0x2C, 0x38, // z - 0x00, 0x00, 0x7C, 0x0C, 0x18, 0x30, 0x7C, 0x00, // { - 0x1C, 0x30, 0x30, 0x60, 0x30, 0x30, 0x1C, 0x00, // | - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, // } - 0x38, 0x0C, 0x0C, 0x06, 0x0C, 0x0C, 0x38, 0x00, // ~ - 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x18, 0x3C, 0x66, 0x66, 0x7E, 0x00, // . - 0x3F, 0x61, 0x63, 0xF8, 0x60, 0xF9, 0x61, 0x3F, // . - 0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, // . - 0x0E, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, // . - 0x3C, 0x66, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // . - 0x66, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // . - 0x70, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // . - 0x1C, 0x1C, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // . - 0x00, 0x00, 0x3E, 0x60, 0x60, 0x3E, 0x18, 0x30, // . - 0x3C, 0x66, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, // . - 0x66, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, // . - 0x70, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, // . - 0x66, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // . - 0x3C, 0x66, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // . - 0x70, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // . - 0xC6, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, // . - 0x1C, 0x1C, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x00, // . - 0x0C, 0x18, 0x7C, 0x60, 0x78, 0x60, 0x7C, 0x00, // . - 0x00, 0x00, 0x7E, 0x1A, 0x7E, 0xD8, 0x7E, 0x00, // . - 0x3E, 0x78, 0xD8, 0xDE, 0xF8, 0xD8, 0xDE, 0x00, // . - 0x3C, 0x66, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, // . - 0x66, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, // . - 0x70, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, // . - 0x3C, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x00, // . - 0x70, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, // . - 0x66, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x3C, // . - 0x66, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, // . - 0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, // . - 0x0C, 0x0C, 0x3E, 0x60, 0x60, 0x3E, 0x0C, 0x0C, // . - 0x38, 0x6C, 0x60, 0xF0, 0x60, 0x66, 0xFC, 0x00, // . - 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x7E, 0x18, // . - 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x6F, 0x66, 0x63, // . - 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0x78, 0x30, // . - 0x0E, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // . - 0x0E, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // . - 0x0E, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, // . - 0x0E, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, // . - 0x3B, 0x6E, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x00, // . - 0x3B, 0x6E, 0x00, 0x66, 0x76, 0x7E, 0x6E, 0x66, // . - 0x3E, 0x66, 0x66, 0x3E, 0x00, 0x7E, 0x00, 0x00, // . - 0x3C, 0x66, 0x66, 0x3C, 0x00, 0x7E, 0x00, 0x00, // . - 0x18, 0x00, 0x18, 0x30, 0x60, 0x66, 0x3C, 0x00, // . - 0x00, 0x00, 0x00, 0x7E, 0x60, 0x60, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x7E, 0x06, 0x06, 0x00, 0x00, // . - 0xC6, 0xCC, 0xD8, 0x3E, 0x63, 0xC6, 0x0C, 0x1F, // . - 0xC6, 0xCC, 0xD8, 0x36, 0x6E, 0xD6, 0x1F, 0x06, // . - 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // . - 0x00, 0x36, 0x6C, 0xD8, 0x6C, 0x36, 0x00, 0x00, // . - 0x00, 0xD8, 0x6C, 0x36, 0x6C, 0xD8, 0x00, 0x00, // . - 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, // . - 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, // . - 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, // . - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, // . - 0x08, 0x08, 0x08, 0x08, 0xF8, 0x08, 0x08, 0x08, // . - 0x08, 0x08, 0x08, 0xF8, 0xF8, 0x08, 0x08, 0x08, // . - 0x1C, 0x1C, 0x1C, 0x1C, 0xFC, 0x1C, 0x1C, 0x1C, // . - 0x00, 0x00, 0x00, 0x00, 0xFC, 0x1C, 0x1C, 0x1C, // . - 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x08, // . - 0x1C, 0x1C, 0x1C, 0xFC, 0xFC, 0x1C, 0x1C, 0x1C, // . - 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, // . - 0x00, 0x00, 0x00, 0xFC, 0xFC, 0x1C, 0x1C, 0x1C, // . - 0x1C, 0x1C, 0x1C, 0xFC, 0xFC, 0x00, 0x00, 0x00, // . - 0x1C, 0x1C, 0x1C, 0x1C, 0xFC, 0x00, 0x00, 0x00, // . - 0x08, 0x08, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x00, 0xF8, 0x08, 0x08, 0x08, // . - 0x08, 0x08, 0x08, 0x08, 0x0F, 0x00, 0x00, 0x00, // . - 0x08, 0x08, 0x08, 0x08, 0xFF, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x00, 0xFF, 0x08, 0x08, 0x08, // . - 0x08, 0x08, 0x08, 0x08, 0x0F, 0x08, 0x08, 0x08, // . - 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, // . - 0x08, 0x08, 0x08, 0x08, 0xFF, 0x08, 0x08, 0x08, // . - 0x08, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08, 0x08, // . - 0x1C, 0x1C, 0x1C, 0x1C, 0x1F, 0x1C, 0x1C, 0x1C, // . - 0x1C, 0x1C, 0x1C, 0x1F, 0x1F, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1C, 0x1C, 0x1C, // . - 0x1C, 0x1C, 0x1C, 0xFF, 0xFF, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x1C, 0x1C, 0x1C, // . - 0x1C, 0x1C, 0x1C, 0x1F, 0x1F, 0x1C, 0x1C, 0x1C, // . - 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, // . - 0x1C, 0x1C, 0x1C, 0xFF, 0xFF, 0x1C, 0x1C, 0x1C, // . - 0x08, 0x08, 0x08, 0xFF, 0xFF, 0x00, 0x00, 0x00, // . - 0x1C, 0x1C, 0x1C, 0x1C, 0xFF, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x08, 0x08, 0x08, // . - 0x00, 0x00, 0x00, 0x00, 0xFF, 0x1C, 0x1C, 0x1C, // . - 0x1C, 0x1C, 0x1C, 0x1C, 0x1F, 0x00, 0x00, 0x00, // . - 0x08, 0x08, 0x08, 0x0F, 0x0F, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x08, // . - 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1C, 0x1C, 0x1C, // . - 0x1C, 0x1C, 0x1C, 0x1C, 0xFF, 0x1C, 0x1C, 0x1C, // . - 0x08, 0x08, 0x08, 0xFF, 0xFF, 0x08, 0x08, 0x08, // . - 0x08, 0x08, 0x08, 0x08, 0xF8, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x00, 0x0F, 0x08, 0x08, 0x08, // . - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, // . - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, // . - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, // . - 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, // . - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0x76, 0x00, // . - 0x3C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x60, // . - 0x7E, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, // . - 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x66, 0x00, // . - 0x7E, 0x66, 0x30, 0x18, 0x30, 0x66, 0x7E, 0x00, // . - 0x00, 0x00, 0x3E, 0x6C, 0x6C, 0x6C, 0x38, 0x00, // . - 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7F, 0xC0, // . - 0x00, 0x00, 0x7E, 0xD8, 0x18, 0x18, 0x0C, 0x00, // . - 0x7C, 0x38, 0x7C, 0xD6, 0xD6, 0x7C, 0x38, 0x7C, // . - 0x7C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x7C, 0x00, // . - 0x7C, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00, // . - 0x1E, 0x30, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x00, // . - 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00, // . - 0x03, 0x06, 0x3E, 0x6B, 0x73, 0x3E, 0x60, 0xC0, // . - 0x1E, 0x30, 0x60, 0x7E, 0x60, 0x30, 0x1E, 0x00, // . - 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, // . - 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, // . - 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00, // . - 0x30, 0x18, 0x0C, 0x18, 0x30, 0x00, 0x7E, 0x00, // . - 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x00, 0x7E, 0x00, // . - 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18, // . - 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70, // . - 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00, // . - 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00, // . - 0x3C, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // . - 0x1E, 0x18, 0x18, 0x18, 0x18, 0xD8, 0x78, 0x38, // . - 0x78, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, // . - 0x38, 0x0C, 0x18, 0x30, 0x3C, 0x00, 0x00, 0x00, // . - 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, // . - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00 -}; diff --git a/polymer-perf/eduke32/build/src/tmp/keep.me b/polymer-perf/eduke32/build/src/tmp/keep.me deleted file mode 100644 index e69de29bb..000000000 diff --git a/polymer-perf/eduke32/build/src/util/ase_import.py b/polymer-perf/eduke32/build/src/util/ase_import.py deleted file mode 100755 index f97e0ce78..000000000 --- a/polymer-perf/eduke32/build/src/util/ase_import.py +++ /dev/null @@ -1,452 +0,0 @@ -#!BPY - -""" -Name: 'ASCII Scene (.ase) v0.16' -Blender: 249 -Group: 'Import' -Tooltip: 'ASCII Scene import (*.ase)' -""" -__author__ = "Goofos & Plagman" -__version__ = "0.16" - -# goofos at epruegel.de -# -# ***** BEGIN GPL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# ***** END GPL LICENCE BLOCK ***** - -import string, time, sys as osSys -import Blender -from Blender import Draw, Mesh, Window, Object, Scene, NMesh, Key, Ipo, IpoCurve -#import meshtools - - -def read_main(filename): - - global counts - counts = {'verts': 0, 'tris': 0} - - start = time.clock() - file = open(filename, "r") - - print_boxed("----------------start-----------------") - print 'Import Patch: ', filename - - editmode = Window.EditMode() # are we in edit mode? If so ... - if editmode: Window.EditMode(0) # leave edit mode before getting the mesh - - lines= file.readlines() - read_file(file, lines) - - Blender.Window.DrawProgressBar(1.0, '') # clear progressbar - file.close() - print "----------------end-----------------" - end = time.clock() - seconds = " in %.2f %s" % (end-start, "seconds") - totals = "Verts: %i Tris: %i " % (counts['verts'], counts['tris']) - print_boxed(totals) - message = "Successfully imported " + Blender.sys.basename(filename) + seconds - #meshtools.print_boxed(message) - print_boxed(message) - - -def print_boxed(text): #Copy/Paste from meshtools, only to remove the beep :) - lines = text.splitlines() - maxlinelen = max(map(len, lines)) - if osSys.platform[:3] == "win": - print chr(218)+chr(196) + chr(196)*maxlinelen + chr(196)+chr(191) - for line in lines: - print chr(179) + ' ' + line.ljust(maxlinelen) + ' ' + chr(179) - print chr(192)+chr(196) + chr(196)*maxlinelen + chr(196)+chr(217) - else: - print '+-' + '-'*maxlinelen + '-+' - for line in lines: print '| ' + line.ljust(maxlinelen) + ' |' - print '+-' + '-'*maxlinelen + '-+' - #print '\a\r', # beep when done - - -class ase_obj: - - def __init__(self): - self.name = 'Name' - self.objType = None - self.row0x = None - self.row0y = None - self.row0z = None - self.row1x = None - self.row1y = None - self.row1z = None - self.row2x = None - self.row2y = None - self.row2z = None - self.row3x = None - self.row3y = None - self.row3z = None - self.parent = None - self.obj = None - self.objName = 'Name' - -class ase_mesh: - - def __init__(self): - self.name = '' - self.vCount = 0 - self.fCount = 0 - self.frames = [] - self.verts = [] - self.faces = [] - self.animated = 0 - self.frameCount = -1 - -class mesh_vert: - - def __init__(self): - self.x = 0.0 - self.y = 0.0 - self.z = 0.0 - self.u = 0.0 - self.v = 0.0 - self.nx = 0.0 - self.ny = 0.0 - self.nz = 0.0 - self.origi = 0 - def make_tuple(self): - return (self.x, self.y, self.z, self.u, self.v, self.nx, self.ny, self.nz) - -class mesh_face: - - def __init__(self): - self.v1 = mesh_vert() - self.v2 = mesh_vert() - self.v3 = mesh_vert() - self.i1 = 0 - self.i2 = 0 - self.i3 = 0 - -def read_file(file, lines): - - objects = [] - objIdx = 0 - objCheck = -1 #needed to skip helper objects - PBidx = 0.0 - lineCount = float(len(lines)) - processed_indices = [] - curFaceID = 0 - faceVertID = 0 - - print 'Read file' - Blender.Window.DrawProgressBar(0.0, "Read File...") - - for line in lines: - words = string.split(line) - - if (PBidx % 10000) == 0.0: - Blender.Window.DrawProgressBar(PBidx / lineCount, "Read File...") - - if not words: - continue - elif objIdx > 0 and me.animated == 1: - # I don't know how to make empty statements, this is to skip everything else - me.animated = me.animated - elif words[0] == '*GEOMOBJECT': - objCheck = 0 - newObj = ase_obj() - objects.append(newObj) - obj = objects[objIdx] - objIdx += 1 - - obj.objType = 'Mesh' - obj.obj = ase_mesh() - me = obj.obj - elif words[0] == '*NODE_NAME' and objCheck != -1: - if objCheck == 0: - obj.name = words[1] - objCheck = 1 - elif objCheck == 1: - obj.objName = words[1] - elif words[0] == '*TM_ROW0' and objCheck != -1: - obj.row0x = float(words[1]) - obj.row0y = float(words[2]) - obj.row0z = float(words[3]) - elif words[0] == '*TM_ROW1' and objCheck != -1: - obj.row1x = float(words[1]) - obj.row1y = float(words[2]) - obj.row1z = float(words[3]) - elif words[0] == '*TM_ROW2' and objCheck != -1: - obj.row2x = float(words[1]) - obj.row2y = float(words[2]) - obj.row2z = float(words[3]) - elif words[0] == '*TM_ROW3' and objCheck != -1: - obj.row3x = float(words[1]) - obj.row3y = float(words[2]) - obj.row3z = float(words[3]) - objCheck = -1 - elif words[0] == '*MESH_NUMVERTEX': - me.vCount = int(words[1]) - for i in range(me.vCount): - me.verts.append(mesh_vert()) - elif words[0] == '*MESH_NUMFACES': - me.fCount = int(words[1]) - for i in range(me.fCount): - me.faces.append(mesh_face()) - elif words[0] == '*MESH_VERTEX': - i = int(words[1]) - me.verts[i].x = float(words[2]); - me.verts[i].y = float(words[3]); - me.verts[i].z = float(words[4]); - elif words[0] == '*MESH_FACE': - i = int(words[1].rstrip(":")) # looks like "13:" - v1 = int(words[3]); - v2 = int(words[5]); - v3 = int(words[7]); - me.faces[i].v1.x = me.verts[v1].x; - me.faces[i].v1.y = me.verts[v1].y; - me.faces[i].v1.z = me.verts[v1].z; - me.faces[i].v1.origi = v1 - - me.faces[i].v2.x = me.verts[v2].x; - me.faces[i].v2.y = me.verts[v2].y; - me.faces[i].v2.z = me.verts[v2].z; - me.faces[i].v2.origi = v2 - - me.faces[i].v3.x = me.verts[v3].x; - me.faces[i].v3.y = me.verts[v3].y; - me.faces[i].v3.z = me.verts[v3].z; - me.faces[i].v3.origi = v3 - elif words[0] == '*MESH_NUMTVERTEX': - del me.verts[:] - uvCount = int(words[1]) - for i in range(uvCount): - me.verts.append(mesh_vert()) - elif words[0] == '*MESH_TVERT': - i = int(words[1]) - me.verts[i].u = float(words[2]); - me.verts[i].v = float(words[3]); - elif words[0] == '*MESH_TFACE': - i = int(words[1]) - uv1 = int(words[2]); - uv2 = int(words[3]); - uv3 = int(words[4]); - - me.faces[i].v1.u = me.verts[uv1].u; - me.faces[i].v1.v = me.verts[uv1].v; - - me.faces[i].v2.u = me.verts[uv2].u; - me.faces[i].v2.v = me.verts[uv2].v; - - me.faces[i].v3.u = me.verts[uv3].u; - me.faces[i].v3.v = me.verts[uv3].v; - elif words[0] == '*MESH_FACENORMAL': - curFaceID = int(words[1]) # global, vertexnormal needs this - faceVertID = 0 # same - elif words[0] == '*MESH_VERTEXNORMAL': - nx = float(words[2]) - ny = float(words[3]) - nz = float(words[4]) - - if (faceVertID == 0): - me.faces[curFaceID].v1.nx = nx; - me.faces[curFaceID].v1.ny = ny; - me.faces[curFaceID].v1.nz = nz; - elif (faceVertID == 1): - me.faces[curFaceID].v2.nx = nx; - me.faces[curFaceID].v2.ny = ny; - me.faces[curFaceID].v2.nz = nz; - elif (faceVertID == 2): - me.faces[curFaceID].v3.nx = nx; - me.faces[curFaceID].v3.ny = ny; - me.faces[curFaceID].v3.nz = nz; - - faceVertID = faceVertID + 1; - elif words[0] == '*MESH_ANIMATION': - me.animated = 1 - - # now the loop for animation frames - if objIdx > 0 and me.animated == 1: - if words[0] == '*MESH_VERTEX_LIST': - me.frameCount += 1 - me.frames.append([]) - elif words[0] == '*MESH_VERTEX': - me.frames[me.frameCount].append(mesh_vert()) - i = int(words[1]) - me.frames[me.frameCount][i].x = float(words[2]); - me.frames[me.frameCount][i].y = float(words[3]); - me.frames[me.frameCount][i].z = float(words[4]); - - PBidx += 1.0 - - spawn_main(objects) - - Blender.Redraw() - -def spawn_main(objects): - - PBidx = 0.0 - objCount = float(len(objects)) - - print 'Import Objects' - Blender.Window.DrawProgressBar(0.0, "Importing Objects...") - - for obj in objects: - - Blender.Window.DrawProgressBar(PBidx / objCount, "Importing Objects...") - - if obj.objType == 'Mesh': - spawn_mesh(obj) - - PBidx += 1.0 - -import random - -def spawn_mesh(obj): - - objMe = obj.obj - #normal_flag = 1 - - row0 = obj.row0x, obj.row0y, obj.row0z - row1 = obj.row1x, obj.row1y, obj.row1z - row2 = obj.row2x, obj.row2y, obj.row2z - row3 = obj.row3x, obj.row3y, obj.row3z - - newMatrix = Blender.Mathutils.Matrix(row0, row1, row2, row3) - newMatrix.resize4x4() - - newObj = Blender.Object.New(obj.objType, obj.name) - newObj.setMatrix(newMatrix) - Blender.Scene.getCurrent().link(newObj) - - - newMesh = Blender.Mesh.New(obj.objName) - newMesh.getFromObject(newObj.name) - - newMesh.vertexUV = 1 - newObj.link(newMesh) - - del objMe.verts[:] - objMe.vCount = 0 - - vertDict = {} - - #for face in objMe.faces: - #objMe.verts.append(face.v1) - #objMe.verts.append(face.v2) - #objMe.verts.append(face.v3) - #face.i1 = objMe.vCount - #objMe.vCount = objMe.vCount + 1 - #face.i2 = objMe.vCount - #objMe.vCount = objMe.vCount + 1 - #face.i3 = objMe.vCount - #objMe.vCount = objMe.vCount + 1 - - for face in objMe.faces: - if not face.v1.make_tuple() in vertDict: - vertDict[face.v1.make_tuple()] = objMe.vCount - objMe.verts.append(face.v1) - objMe.vCount = objMe.vCount + 1 - if not face.v2.make_tuple() in vertDict: - vertDict[face.v2.make_tuple()] = objMe.vCount - objMe.verts.append(face.v2) - objMe.vCount = objMe.vCount + 1 - if not face.v3.make_tuple() in vertDict: - vertDict[face.v3.make_tuple()] = objMe.vCount - objMe.verts.append(face.v3) - objMe.vCount = objMe.vCount + 1 - face.i1 = vertDict[face.v1.make_tuple()] - face.i2 = vertDict[face.v2.make_tuple()] - face.i3 = vertDict[face.v3.make_tuple()] - - # Verts - for i in range(objMe.vCount): - xyz = Blender.Mathutils.Vector(objMe.verts[i].x, objMe.verts[i].y, objMe.verts[i].z) - newMesh.verts.extend(xyz) - - for i in range(objMe.vCount): - xyz = Blender.Mathutils.Vector(objMe.verts[i].x, objMe.verts[i].y, objMe.verts[i].z) - uv = Blender.Mathutils.Vector(objMe.verts[i].u, objMe.verts[i].v) - norm = Blender.Mathutils.Vector(objMe.verts[i].nx, objMe.verts[i].ny, objMe.verts[i].nz) - newMesh.verts[i].co = xyz; - newMesh.verts[i].uvco = uv; - newMesh.verts[i].no = norm; - - if objMe.animated: - objMe.frameCount -= 1 # do we always get an extra frame at the end? - for frame in objMe.frames: - for i in range(objMe.vCount): - xyz = Blender.Mathutils.Vector(frame[objMe.verts[i].origi].x, frame[objMe.verts[i].origi].y, frame[objMe.verts[i].origi].z) - - newMesh.verts[i].co = xyz; - newObj.insertShapeKey() - - for key in Key.Get() : - key.ipo = Ipo.New('Key', "bleh" + "_ipo") - index = 1 - for curveName in key.ipo.curveConsts : - # print curveName - key.ipo.addCurve(curveName) - key.ipo[curveName].interpolation = IpoCurve.InterpTypes.CONST - key.ipo[curveName].addBezier((0, 0)) - key.ipo[curveName].addBezier((index, 1)) - key.ipo[curveName].addBezier((index + 1, 0)) - index+=1 - - # Faces - for i in range(objMe.fCount): - face = [objMe.faces[i].i1, objMe.faces[i].i2, objMe.faces[i].i3] - newMesh.faces.extend(face) - - # UV - #if guiTable['UV'] == 1 and objMe.hasFUV == 1: - #newMesh.faceUV = 1 - #for f in objMe.uvFaces: - #uv1 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv1].u), float(objMe.uvVerts[f.uv1].v)) - #uv2 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv2].u), float(objMe.uvVerts[f.uv2].v)) - #uv3 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv3].u), float(objMe.uvVerts[f.uv3].v)) - #newMesh.faces[f.index].uv = [uv1, uv2, uv3] - ## normals - #vertices = [coords for n, coords in sorted(objMe.normals)] - - #random.seed() - - #i = 0 - #for v in newMesh.verts: - #no = Blender.Mathutils.Vector(vertices[i][0], vertices[i][1], vertices[i][2]) - #v.no = no - #print 'vertice ', i, 'normal : ', v.no - ##v.no[0] = vertices[i][0] - ##v.no[1] = vertices[i][1] - ##v.no[2] = vertices[i][2] - #i = i + 1 - - newMesh.transform((newObj.getMatrix('worldspace').invert()), 1) - - Blender.Set("curframe", objMe.frameCount + 1) - - counts['verts'] += objMe.vCount - counts['tris'] += objMe.fCount - print 'Imported Mesh-Object: ', obj.name - - - -def read_ui(filename): - Window.WaitCursor(1) - - read_main(filename) - - Window.WaitCursor(0) - - -Blender.Window.FileSelector(read_ui, "Import ASE") \ No newline at end of file diff --git a/polymer-perf/eduke32/build/src/util/bin2c.cpp b/polymer-perf/eduke32/build/src/util/bin2c.cpp deleted file mode 100644 index dd4a277c0..000000000 --- a/polymer-perf/eduke32/build/src/util/bin2c.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// BIN2C.CPP -// by Jonathon Fowler (jonof@edgenetwork.org) - -// Converts a binary file to C source -// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1 - - -#include -#include -#include -#include -#include -#include - - -char defsrcext[] = ".DAT"; -char defoutext[] = ".C"; - -char source[MAXPATH], output[MAXPATH], bytesize; - - -int PathAddExt(char *path, char *ext); - - -void main(int argc, char *argv[]) -{ - printf("BIN2C - Binary to C data converter\n" - "Copyright (c) 1999 Jonathon Fowler\n\n"); - - if (argc < 4) - { - printf("Usage:\n" - " BIN2C source<.DAT> output<.C> b|w\n\n" - " source<.DAT> Binary source file\n" - " output<.C> Output C code file\n" - " b|w Byte or word-sized data\n\n"); - exit(0); - } - - int arg; - FILE *in, *out; - char datab1, datab2; - int across=0, maxacross; - int length, written=0; - - - // get the source file - strcpy(source, argv[1]); - strupr(source); - PathAddExt(source, defsrcext); - printf("þ Source file: %s\n", source); - - // get the output file - strcpy(output, argv[2]); - strupr(output); - PathAddExt(output, defoutext); - printf("þ Output file: %s\n", output); - - // get byte/word data - switch (tolower(argv[3][0])) - { - case 'b': - printf("þ Byte data.\n"); - bytesize=1; - break; - - case 'w': - printf("þ Word data.\n"); - bytesize=0; - break; - - default: - printf("þ Unknown data size specified. Defaulting to byte.\n"); - bytesize=1; - break; - } - - // open the input file - in = fopen(source, "rb"); - if (!in) - { - printf("Error opening %s\n", source); - exit(1); - } - - // open the output file - out = fopen(output, "w+t"); - if (!out) - { - printf("Error creating %s\n", output); - exit(1); - } - - length = filelength(fileno(in)); - - // write a header out to the output file - fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output); - - // start a data block - fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length); - - if (bytesize) - maxacross = 12; - else - maxacross = 9; - across = maxacross; - - // convert the data - for (written=0; written1) ? ',' : '\n'); - } else { - datab1 = fgetc(in); - datab2 = fgetc(in); - fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n'); - } - - across++; - - if (!bytesize) written++; - } - - - fprintf(out, " };"); - - fclose(out); - fclose(in); -} - - -// Add an extention to a path if one doesn't exist -int PathAddExt(char *path, char *ext) -{ - char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT]; - int flags; - - flags = fnsplit(path, drive, dir, name, extn); - - if (!(flags & EXTENSION)) // tack on an extension - strcat(path, ext); - - return ((flags & EXTENSION) == 0); -} diff --git a/polymer-perf/eduke32/build/src/util/cacheinfo.c b/polymer-perf/eduke32/build/src/util/cacheinfo.c deleted file mode 100644 index 251cbe1b1..000000000 --- a/polymer-perf/eduke32/build/src/util/cacheinfo.c +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include -#include -#include -#include "compat.h" - -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 - -typedef struct { - char magic[8]; // 'Polymost' - int xdim, ydim; // of image, unpadded - int flags; // 1 = !2^x, 2 = has alpha, 4 = lzw compressed -} texcacheheader; -typedef struct { - int size; - int format; - int xdim, ydim; // of mipmap (possibly padded) - int border, depth; -} texcachepicture; - -int main(int argc, char **argv) -{ - DIR *dir; - struct dirent *dirent; - struct stat st; - FILE *fp; - texcacheheader head; - texcachepicture mip; - - dir = opendir("."); - while ((dirent = readdir(dir))) { - if (stat(dirent->d_name, &st)) { - printf("%s: failed to stat\n", dirent->d_name); - continue; - } - if (!(st.st_mode&S_IFREG)) { - printf("%s: not a regular file\n", dirent->d_name); - continue; - } - - fp = fopen(dirent->d_name,"rb"); - if (!fp) { - printf("%s: failed to open\n", dirent->d_name); - continue; - } - - if (fread(&head, sizeof(head), 1, fp) != 1) { - fclose(fp); - printf("%s: failed to read header\n", dirent->d_name); - continue; - } - head.xdim = B_LITTLE32(head.xdim); - head.ydim = B_LITTLE32(head.ydim); - head.flags = B_LITTLE32(head.flags); - if (fread(&mip, sizeof(mip), 1, fp) != 1) { - fclose(fp); - printf("%s: failed to read mipmap header\n", dirent->d_name); - continue; - } - mip.format = B_LITTLE32(mip.format); - fclose(fp); - if (memcmp(head.magic, "Polymost", 8)) { - printf("%s: bad signature\n", dirent->d_name); - continue; - } - else { - char *format; - char flags[4] = "", flagsc = 0; - switch (mip.format) { - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: format = "RGB DXT1"; break; - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: format = "RGBA DXT1"; break; - case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: format = "RGBA DXT3"; break; - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: format = "RGBA DXT5"; break; - default: format = "Unknown"; break; - } - if (head.flags&1) flags[flagsc++] = '2'; - if (head.flags&2) flags[flagsc++] = 'A'; - if (head.flags&4) flags[flagsc++] = 'L'; - flags[flagsc++] = 0; - - printf("%s: flags=%s format=%s\n", dirent->d_name, flags, format); - } - } - closedir(dir); - - return 0; -} \ No newline at end of file diff --git a/polymer-perf/eduke32/build/src/util/generateicon.c b/polymer-perf/eduke32/build/src/util/generateicon.c deleted file mode 100644 index 3356dc381..000000000 --- a/polymer-perf/eduke32/build/src/util/generateicon.c +++ /dev/null @@ -1,111 +0,0 @@ -#include "inttypes.h" -#include "kplib.h" -#include "compat.h" - -struct icon { - int width,height; - unsigned int *pixels; - unsigned char *mask; -}; - -int writeicon(FILE *fp, struct icon *ico) -{ - int i; - - fprintf(fp, - "#include \"sdlayer.h\"\n" - "\n" - ); - fprintf(fp,"static unsigned int sdlappicon_pixels[] = {\n"); - for (i=0;iwidth*ico->height;i++) { - if ((i%6) == 0) fprintf(fp,"\t"); - else fprintf(fp," "); - fprintf(fp, "0x%08x,", B_LITTLE32(ico->pixels[i])); - if ((i%6) == 5) fprintf(fp,"\n"); - } - if ((i%16) > 0) fprintf(fp, "\n"); - fprintf(fp, "};\n\n"); - - fprintf(fp,"static unsigned char sdlappicon_mask[] = {\n"); - for (i=0;i<((ico->width+7)/8)*ico->height;i++) { - if ((i%14) == 0) fprintf(fp,"\t"); - else fprintf(fp," "); - fprintf(fp, "%3d,", ico->mask[i]); - if ((i%14) == 13) fprintf(fp,"\n"); - } - if ((i%16) > 0) fprintf(fp, "\n"); - fprintf(fp, "};\n\n"); - - fprintf(fp, - "struct sdlappicon sdlappicon = {\n" - " %d,%d, // width,height\n" - " sdlappicon_pixels,\n" - " sdlappicon_mask\n" - "};\n", - ico->width, ico->height - ); - - return 0; -} - -int main(int argc, char **argv) -{ - struct icon icon; - int bpl, xsiz, ysiz; - int i,j,k,c; - unsigned char *mask, *maskp, bm, *pp; - - if (argc<2) { - fprintf(stderr, "generateicon \n"); - return 1; - } - - memset(&icon, 0, sizeof(icon)); - - kpzload(argv[1], (int*)&icon.pixels, &bpl, (int*)&icon.width, (int*)&icon.height); - if (!icon.pixels) { - fprintf(stderr, "Failure loading %s\n", argv[1]); - return 1; - } - - if (bpl != icon.width * 4) { - fprintf(stderr, "bpl != icon.width * 4\n"); - free(icon.pixels); - return 1; - } - - icon.mask = (unsigned char *)calloc(icon.height, (icon.width+7)/8); - if (!icon.mask) { - fprintf(stderr, "Out of memory\n"); - free(icon.pixels); - return 1; - } - - maskp = icon.mask; - bm = 1; - pp = (unsigned char *)icon.pixels; - for (i=0; i 0) *maskp |= bm; - - bm <<= 1; - pp += 4; - } - - writeicon(stdout, &icon); - - free(icon.pixels); - free(icon.mask); - - return 0; -} - diff --git a/polymer-perf/eduke32/build/src/util/highpalookupmaker.py b/polymer-perf/eduke32/build/src/util/highpalookupmaker.py deleted file mode 100644 index c28f23420..000000000 --- a/polymer-perf/eduke32/build/src/util/highpalookupmaker.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/python - -def makehighpalookuppixel(pal, rgb): - hsv = list(colorsys.rgb_to_hsv(*rgb)) - if pal == 0: - # no-op, pass through - return rgb - # frozen, blue light - elif pal == 1: - # make everything blueish - hsv[0] = 0.66 - return list(colorsys.hsv_to_rgb(*hsv)) - # nightvision - elif pal == 6: - # make everything green and reverse brightness - hsv[0] = 0.33 - hsv[2] = 1.0 - hsv[2] - #hsv[1] = 0.5 - return list(colorsys.hsv_to_rgb(*hsv)) - # pal 20 - elif pal == 20: - # blue to gray by removing all saturation - if (hsv[0] > 0.6 and hsv[0] < 0.7): - hsv[1] = 0 - # orange and brown to blue - if (hsv[0] > 0.04 and hsv[0] < 0.13): - hsv[0] = 0.66 - # purple and reddish to blue - if (hsv[0] > 0.7 and hsv[0] < 0.9): - hsv[0] = 0.66 - # green to blue - if (hsv[0] > 0.30 and hsv[0] < 0.36): - hsv[0] = 0.66 - return list(colorsys.hsv_to_rgb(*hsv)) - else: - print "unknown pal!" - sys.exit() - -import colorsys -import sys -import struct - -if (len(sys.argv) != 3): - print "Usage: python highpalookupmaker.py palnum outfile" - sys.exit() - -# bit depth per dimension -xbits = 7 -ybits = 7 -zbits = 7 - -xdim = 1 << xbits -ydim = 1 << ybits -zdim = 1 << zbits - -palnum = int(sys.argv[1]) - -pixels = [] -pixelcount = xdim * ydim * zdim -curpix = 0.0 - -fo = open(sys.argv[2], "w") - -# throw in a TGA header in there, this way they'll be able to directly edit it if they feel like it -fo.write(struct.pack("=BBBHHBHHHHBB", 0, 0, 2, 0, 0, 0, 0, 0, 16384, 128, 32, 0)) - -print "Creating highpalookup map %s for palette %d with depth %d:%d:%d..." % (sys.argv[2], palnum, xbits, ybits, zbits) - -for k in range(zdim): - for j in range(ydim): - for i in range(xdim): - rgb = [float(i) / (xdim - 1), float(j) / (ydim - 1), float(k) / (zdim - 1)] - rgb = makehighpalookuppixel(palnum, rgb) - # save as BGRA as that's what TGA uses - pixels.append(struct.pack('BBBB', int(rgb[2] * 255), int(rgb[1] * 255), int(rgb[0] * 255), 255)) - curpix += 1 - if (curpix % 128 == 0): - print "\r%f%% done." % (curpix * 100 / pixelcount), - -fo.writelines(pixels) -fo.close() - -print "\n" diff --git a/polymer-perf/eduke32/build/src/util/kextract.c b/polymer-perf/eduke32/build/src/util/kextract.c deleted file mode 100644 index af45e82ad..000000000 --- a/polymer-perf/eduke32/build/src/util/kextract.c +++ /dev/null @@ -1,148 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. -// -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - -#include "compat.h" - -#define MAXFILES 4096 - -static char buf[65536]; - -static int numfiles, anyfiles4extraction; -static char marked4extraction[MAXFILES]; -static char filelist[MAXFILES][16]; -static int fileoffs[MAXFILES+1], fileleng[MAXFILES]; - -void findfiles(const char *dafilespec) -{ - char t[13]; - int i; - - for(i=numfiles-1;i>=0;i--) - { - memcpy(t,filelist[i],12); - t[12] = 0; - - if (Bwildmatch(t,dafilespec)) { - marked4extraction[i] = 1; - anyfiles4extraction = 1; - } - } -} - -int main(int argc, char **argv) -{ - int i, j, k, l, fil, fil2; - - if (argc < 3) - { - printf("KEXTRACT [grouped file][@file or filespec...] by Kenneth Silverman\n"); - printf(" This program extracts files from a previously grouped group file.\n"); - printf(" You can extract files using the ? and * wildcards.\n"); - printf(" Ex: kextract stuff.dat tiles000.art nukeland.map palette.dat\n"); - printf(" (stuff.dat is the group file, the rest are the files to extract)\n"); - return(0); - } - - if ((fil = Bopen(argv[1],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1) - { - printf("Error: %s could not be opened\n",argv[1]); - return(0); - } - - Bread(fil,buf,16); - if ((buf[0] != 'K') || (buf[1] != 'e') || (buf[2] != 'n') || - (buf[3] != 'S') || (buf[4] != 'i') || (buf[5] != 'l') || - (buf[6] != 'v') || (buf[7] != 'e') || (buf[8] != 'r') || - (buf[9] != 'm') || (buf[10] != 'a') || (buf[11] != 'n')) - { - Bclose(fil); - printf("Error: %s not a valid group file\n",argv[1]); - return(0); - } - numfiles = *((int*)&buf[12]); numfiles = B_LITTLE32(numfiles); - - Bread(fil,filelist,numfiles<<4); - - j = 0; - for(i=0;i1;i--) - { - if (argv[i][0] == '@') - { - if ((fil2 = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1) - { - l = Bread(fil2,buf,65536); - j = 0; - while ((j < l) && (buf[j] <= 32)) j++; - while (j < l) - { - k = j; - while ((k < l) && (buf[k] > 32)) k++; - - buf[k] = 0; - findfiles(&buf[j]); - j = k+1; - - while ((j < l) && (buf[j] <= 32)) j++; - } - Bclose(fil2); - } - } - else - findfiles(argv[i]); - } - - if (anyfiles4extraction == 0) - { - Bclose(fil); - printf("No files found in group file with those names\n"); - return(0); - } - - for(i=0;imode & BS_IFDIR) return 0; // is a directory - if (a->namlen > 12) return 0; // name too long - return Bwildmatch(a->name, matchstr); -} - -int filesize(const char *path, const char *name) -{ - char p[BMAX_PATH]; - struct stat st; - - strcpy(p, path); - strcat(p, "/"); - strcat(p, name); - - if (!stat(p, &st)) return st.st_size; - return 0; -} - -void findfiles(const char *dafilespec) -{ - struct Bdirent *name; - int daspeclen; - char daspec[128], *dir; - BDIR *di; - - strcpy(daspec,dafilespec); - daspeclen=strlen(daspec); - while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--; - if (daspeclen > 0) { - daspec[daspeclen]=0; - dir = daspec; - matchstr = &daspec[daspeclen+1]; - } else { - dir = "."; - matchstr = daspec; - } - - di = Bopendir(dir); - if (!di) return; - - while ((name = Breaddir(di))) { - if (!checkmatch(name)) continue; - - strcpy(&filelist[numfiles][0],name->name); - jstrupr(&filelist[numfiles][0]); - fileleng[numfiles] = name->size; - filelist[numfiles][12] = (char)(fileleng[numfiles]&255); - filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255); - filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255); - filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255); - - strcpy(filespec[numfiles],dir); - strcat(filespec[numfiles], "/"); - strcat(filespec[numfiles],name->name); - - numfiles++; - if (numfiles > MAXFILES) - { - printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n"); - exit(0); - } - } - - Bclosedir(di); -} - -int main(int argc, char **argv) -{ - int i, j, k, l, fil, fil2; - - if (argc < 3) - { - printf("KGROUP [grouped file][@file or filespec...] by Kenneth Silverman\n"); - printf(" This program collects many files into 1 big uncompressed file called a\n"); - printf(" group file\n"); - printf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n"); - printf(" (stuff.dat is the group file, the rest are the files to add)\n"); - exit(0); - } - - numfiles = 0; - for(i=argc-1;i>1;i--) - { - if (argv[i][0] == '@') - { - if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1) - { - l = Bread(fil,buf,65536); - j = 0; - while ((j < l) && (buf[j] <= 32)) j++; - while (j < l) - { - k = j; - while ((k < l) && (buf[k] > 32)) k++; - - buf[k] = 0; - findfiles(&buf[j]); - j = k+1; - - while ((j < l) && (buf[j] <= 32)) j++; - } - Bclose(fil); - } - } - else - findfiles(argv[i]); - } - - if ((fil = Bopen(argv[1],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) - { - printf("Error: %s could not be opened\n",argv[1]); - exit(0); - } - Bwrite(fil,"KenSilverman",12); - Bwrite(fil,&numfiles,4); - Bwrite(fil,filelist,numfiles<<4); - - for(i=0;i -#include -#include - -typedef struct { float x, y, z; } point3d; - -typedef struct -{ int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8 - int numskins, numverts, numuv, numtris, numglcmds, numframes; - int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each) -} md2typ; - -typedef struct { point3d mul, add; } frametyp; - -int main (int argc, char **argv) -{ - FILE *fil; - int i, leng; - char *fbuf; - md2typ *head; - frametyp *fptr; - - if (argc != 4) { puts("KMD2TOOL [MD2 in file] [MD2 out file] [z offset] by Ken Silverman"); return(0); } - if (!stricmp(argv[1],argv[2])) { puts("input&output filenames can't be same"); return(0); } - - fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); } - leng = filelength(_fileno(fil)); - fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); } - fread(fbuf,leng,1,fil); - fclose(fil); - - head = (md2typ *)fbuf; - if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2" - for(i=0;inumframes;i++) - { - fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i]; - printf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z); - fptr->add.z += atof(argv[3]); - } - - fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); } - fwrite(fbuf,leng,1,fil); - fclose(fil); - - free(fbuf); - - return(0); -} - -#if 0 -!endif -#endif diff --git a/polymer-perf/eduke32/build/src/util/md2tool.c b/polymer-perf/eduke32/build/src/util/md2tool.c deleted file mode 100644 index 97999bf7b..000000000 --- a/polymer-perf/eduke32/build/src/util/md2tool.c +++ /dev/null @@ -1,249 +0,0 @@ - -#include "compat.h" -#include "build.h" -#include "glbuild.h" -#include "mdsprite.h" - -#include -#include - - -static md2head_t head; - - -static void quit(int32_t status) -{ - exit(status); -} - -static md2model_t *md2load(int *fd, const char *filename, int32_t ronly) -{ - md2model_t *m; - int fil; - - fil = Bopen(filename, ronly?BO_RDONLY:BO_RDWR); - if (fil<0) - { - fprintf(stderr, "Couldn't open `%s': %s\n", filename, strerror(errno)); - quit(2); - } - - m = (md2model_t *)Bcalloc(1,sizeof(md2model_t)); if (!m) quit(1); - m->mdnum = 2; m->scale = .01f; - - Bread(fil,(char *)&head,sizeof(md2head_t)); - - head.id = B_LITTLE32(head.id); head.vers = B_LITTLE32(head.vers); - head.skinxsiz = B_LITTLE32(head.skinxsiz); head.skinysiz = B_LITTLE32(head.skinysiz); - head.framebytes = B_LITTLE32(head.framebytes); head.numskins = B_LITTLE32(head.numskins); - head.numverts = B_LITTLE32(head.numverts); head.numuv = B_LITTLE32(head.numuv); - head.numtris = B_LITTLE32(head.numtris); head.numglcmds = B_LITTLE32(head.numglcmds); - head.numframes = B_LITTLE32(head.numframes); head.ofsskins = B_LITTLE32(head.ofsskins); - head.ofsuv = B_LITTLE32(head.ofsuv); head.ofstris = B_LITTLE32(head.ofstris); - head.ofsframes = B_LITTLE32(head.ofsframes); head.ofsglcmds = B_LITTLE32(head.ofsglcmds); - head.ofseof = B_LITTLE32(head.ofseof); - - if ((head.id != 0x32504449) || (head.vers != 8)) - { - fprintf(stderr, "File `%s' is not an md2 file.\n", filename); - quit(3); - } //"IDP2" - - m->numskins = head.numskins; - m->numframes = head.numframes; - m->numverts = head.numverts; - m->numglcmds = head.numglcmds; - m->framebytes = head.framebytes; - - m->frames = (char *)Bmalloc(m->numframes*m->framebytes); if (!m->frames) quit(1); - m->tris = (md2tri_t *)Bmalloc(head.numtris*sizeof(md2tri_t)); if (!m->tris) quit(1); - m->uv = (md2uv_t *)Bmalloc(head.numuv*sizeof(md2uv_t)); if (!m->uv) quit(1); - - Blseek(fil,head.ofsframes,SEEK_SET); - if (Bread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes) - quit(1); - - Blseek(fil,head.ofstris,SEEK_SET); - if (Bread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t))) - quit(1); - - Blseek(fil,head.ofsuv,SEEK_SET); - if (Bread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t))) - quit(1); - -#if B_BIG_ENDIAN != 0 - { - char *f = (char *)m->frames; - int32_t *l,i,j; - md2frame_t *fr; - - for (i = m->numframes-1; i>=0; i--) - { - fr = (md2frame_t *)f; - l = (int32_t *)&fr->mul; - for (j=5; j>=0; j--) l[j] = B_LITTLE32(l[j]); - f += m->framebytes; - } - - for (i = head.numtris-1; i>=0; i--) - { - m->tris[i].v[0] = B_LITTLE16(m->tris[i].v[0]); - m->tris[i].v[1] = B_LITTLE16(m->tris[i].v[1]); - m->tris[i].v[2] = B_LITTLE16(m->tris[i].v[2]); - m->tris[i].u[0] = B_LITTLE16(m->tris[i].u[0]); - m->tris[i].u[1] = B_LITTLE16(m->tris[i].u[1]); - m->tris[i].u[2] = B_LITTLE16(m->tris[i].u[2]); - } - for (i = head.numuv-1; i>=0; i--) - { - m->uv[i].u = B_LITTLE16(m->uv[i].u); - m->uv[i].v = B_LITTLE16(m->uv[i].v); - } - } -#endif - - *fd = fil; - return(m); -} - - -static void usage_and_quit() -{ - fprintf(stderr, - "Usage:\n" - " md2tool .md2: display info about model\n" - " md2tool -minmax ,,:,, .md2:\n" - " modify `scale' and `translate' fields of MD2 (in-place) to produce given bounds\n" - ); - quit(1); -} - -int main(int argc, char **argv) -{ - char *fn=NULL, *cp; - int32_t fd=-1, i, j, slen; - - int32_t doinfo=1; - - // md2 mul[x,y,z], add[x,y,z] - float mx,my,mz, ax,ay,az; - - // desired model bounds - float dminx=0,dminy=0,dminz=0, dmaxx=1,dmaxy=1,dmaxz=1; - - // md2 uint8-coordinate bounds - uint8_t maxv[3]={0,0,0}; - uint8_t minv[3]={255,255,255}; - - md2frame_t *fr; - uint8_t *vp; - - md2model_t *m; - - if (argc<=1) - usage_and_quit(); - - for (i=1; i= argc) - usage_and_quit(); - if (sscanf(argv[i+1], "%f,%f,%f:%f,%f,%f", &dminx,&dminy,&dminz, &dmaxx,&dmaxy,&dmaxz)!=6) - usage_and_quit(); - i++; - } - else - { - fprintf(stderr, "unrecognized option `%s'\n", cp); - quit(2); - } - } - else - fn = cp; - } - - if (!fn) - usage_and_quit(); - - m = md2load(&fd, fn, doinfo); - - fr = (md2frame_t *)m->frames; - mx=fr->mul.x; my=fr->mul.y; mz=fr->mul.z; - ax=fr->add.x; ay=fr->add.y; az=fr->add.z; - - for (i=0, vp=fr->verts->v; inumverts; i++, vp+=sizeof(md2vert_t)) - { - for (j=0; j<3; j++) - { - maxv[j] = max(maxv[j], vp[j]); - minv[j] = min(minv[j], vp[j]); - } - } - - if (doinfo) - { - printf("------ %s ------\n", fn); - printf("numframes: %d\n", m->numframes); - printf("numverts: %d\n", m->numverts); - printf("numtris: %d\n", head.numtris); - printf("\n"); - printf("ofsframes: %x\n", head.ofsframes); - printf("framebytes: %d\n", head.framebytes); -// printf("framebytes: %d, calculated=%d\n", head.framebytes, sizeof(md2frame_t)+(m->numverts-1)*sizeof(md2vert_t)); - printf("\n"); - - printf("mul=%f %f %f\n", mx, my, mz); - printf("add=%f %f %f\n", ax, ay, az); - - printf("min xyz (s+t) = %f %f %f\n", minv[0]*mx+ax, minv[1]*my+ay, minv[2]*mz+az); - printf("max xyz (s+t) = %f %f %f\n", maxv[0]*mx+ax, maxv[1]*my+ay, maxv[2]*mz+az); - - printf("\n"); - } - else - { - if (maxv[0]-minv[0]>0) mx = (dmaxx-dminx)/(maxv[0]-minv[0]); else mx=0; - if (maxv[1]-minv[1]>0) my = (dmaxy-dminy)/(maxv[1]-minv[1]); else my=0; - if (maxv[2]-minv[2]>0) mz = (dmaxz-dminz)/(maxv[2]-minv[2]); else mz=0; - - if (mx==0||my==0||mz==0) - { - fprintf(stderr, "max[x,y,z]-min[x,y,z] must each be grater 0!\n"); - quit(2); - } - - ax = dmaxx-maxv[0]*mx; - ay = dmaxy-maxv[1]*my; - az = dmaxz-maxv[2]*mz; - -#define ISNAN(x) ((x)!=(x)) -#define ISINF(x) ((x!=0)&&(x/2==x)) - - if (ISNAN(mx)||ISNAN(my)||ISNAN(mz)||ISNAN(ax)||ISNAN(ay)||ISNAN(az)|| - ISINF(mx)||ISINF(my)||ISINF(mz)||ISINF(ax)||ISINF(ay)||ISINF(az)) - { - fprintf(stderr, "Calculation resulted in NaN or Inf.\n"); - quit(2); - } - - Blseek(fd,head.ofsframes,SEEK_SET); - if (Bwrite(fd, &mx, sizeof(mx))!=sizeof(mx)) { perror("write"); quit(3); } - if (Bwrite(fd, &my, sizeof(my))!=sizeof(my)) { perror("write"); quit(3); } - if (Bwrite(fd, &mz, sizeof(mz))!=sizeof(mz)) { perror("write"); quit(3); } - if (Bwrite(fd, &ax, sizeof(ax))!=sizeof(ax)) { perror("write"); quit(3); } - if (Bwrite(fd, &ay, sizeof(ay))!=sizeof(ay)) { perror("write"); quit(3); } - if (Bwrite(fd, &az, sizeof(az))!=sizeof(az)) { perror("write"); quit(3); } - Bclose(fd); - - printf("wrote scale and translate of `%s'.\n", fn); - } - - return 0; -} diff --git a/polymer-perf/eduke32/build/src/util/md3_export.py b/polymer-perf/eduke32/build/src/util/md3_export.py deleted file mode 100644 index 6a21e4513..000000000 --- a/polymer-perf/eduke32/build/src/util/md3_export.py +++ /dev/null @@ -1,1219 +0,0 @@ -#!BPY - -""" -Name: 'Quake3 (.md3)...' -Blender: 242 -Group: 'Export' -Tooltip: 'Export to Quake3 file format. (.md3)' -""" -__author__ = "PhaethonH, Bob Holcomb, Damien McGinnes, Robert (Tr3B) Beckebans" -__url__ = ("http://xreal.sourceforge.net") -__version__ = "0.7 2006-11-12" - -__bpydoc__ = """\ -This script exports a Quake3 file (MD3). - -Supported:
- Surfaces, Materials and Tags. - -Missing:
- None. - -Known issues:
- None. - -Notes:
- TODO -""" - -import sys, os, os.path, struct, string, math - -import Blender -from Blender import * -from Blender.Draw import * -from Blender.BGL import * -from Blender.Window import * - -import types - -import textwrap - -import logging -reload(logging) - -import sys, struct, string, math -from types import * - -import os -from os import path - -GAMEDIR = 'D:/Games/XreaL_testing/base/' -#GAMEDIR = '/opt/XreaL/base/' -MAX_QPATH = 64 - -import sys, struct, string, math -from types import * - -import os -from os import path - -import q_shared -from q_shared import * - -MD3_IDENT = "IDP3" -MD3_VERSION = 15 -MD3_MAX_TAGS = 16 -MD3_MAX_SURFACES = 32 -MD3_MAX_FRAMES = 1024 -MD3_MAX_SHADERS = 256 -MD3_MAX_VERTICES = 4096 -MD3_MAX_TRIANGLES = 8192 -MD3_XYZ_SCALE = (1.0 / 64.0) -MD3_BLENDER_SCALE = (1.0 / 1.0) - - -class md3Vert: - xyz = [] - normal = 0 - binaryFormat = "<3hh" - - def __init__(self): - self.xyz = [0, 0, 0] - self.normal = 0 - - def GetSize(self): - return struct.calcsize(self.binaryFormat) - - # copied from PhaethonH md3.py - def Decode(self, latlng): - lat = (latlng >> 8) & 0xFF; - lng = (latlng) & 0xFF; - lat *= math.pi / 128; - lng *= math.pi / 128; - x = math.cos(lat) * math.sin(lng) - y = math.sin(lat) * math.sin(lng) - z = math.cos(lng) - retval = [ x, y, z ] - return retval - - # copied from PhaethonH md3.py - def Encode(self, normal): - x, y, z = normal - - # normalise - l = math.sqrt((x*x) + (y*y) + (z*z)) - if l == 0: - return 0 - x = x/l - y = y/l - z = z/l - - if (x == 0.0) & (y == 0.0) : - if z > 0.0: - return 0 - else: - return (128 << 8) - - # Encode a normal vector into a 16-bit latitude-longitude value - #lng = math.acos(z) - #lat = math.acos(x / math.sin(lng)) - #retval = ((lat & 0xFF) << 8) | (lng & 0xFF) - lng = math.acos(z) * 255 / (2 * math.pi) - lat = math.atan2(y, x) * 255 / (2 * math.pi) - retval = ((int(lat) & 0xFF) << 8) | (int(lng) & 0xFF) - return retval - - def Load(self, file): - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - self.xyz[0] = data[0] * MD3_XYZ_SCALE - self.xyz[1] = data[1] * MD3_XYZ_SCALE - self.xyz[2] = data[2] * MD3_XYZ_SCALE - self.normal = data[3] - return self - - def Save(self, file): - tmpData = [0] * 4 - tmpData[0] = self.xyz[0] / MD3_XYZ_SCALE - tmpData[1] = self.xyz[1] / MD3_XYZ_SCALE - tmpData[2] = self.xyz[2] / MD3_XYZ_SCALE - tmpData[3] = self.normal - data = struct.pack(self.binaryFormat, tmpData[0], tmpData[1], tmpData[2], tmpData[3]) - file.write(data) - #print "Wrote MD3 Vertex: ", data - - def Dump(self): - log.info("MD3 Vertex") - log.info("X: %s", self.xyz[0]) - log.info("Y: %s", self.xyz[1]) - log.info("Z: %s", self.xyz[2]) - log.info("Normal: %s", self.normal) - log.info("") - -class md3TexCoord: - u = 0.0 - v = 0.0 - - binaryFormat = "<2f" - - def __init__(self): - self.u = 0.0 - self.v = 0.0 - - def GetSize(self): - return struct.calcsize(self.binaryFormat) - - def Load(self, file): - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - # for some reason quake3 texture maps are upside down, flip that - self.u = data[0] - self.v = 1.0 - data[1] - return self - - def Save(self, file): - tmpData = [0] * 2 - tmpData[0] = self.u - tmpData[1] = 1.0 - self.v - data = struct.pack(self.binaryFormat, tmpData[0], tmpData[1]) - file.write(data) - #print "wrote MD3 texture coordinate structure: ", data - - def Dump(self): - log.info("MD3 Texture Coordinates") - log.info("U: %s", self.u) - log.info("V: %s", self.v) - log.info("") - - -class md3Triangle: - indexes = [] - - binaryFormat = "<3i" - - def __init__(self): - self.indexes = [ 0, 0, 0 ] - - def GetSize(self): - return struct.calcsize(self.binaryFormat) - - def Load(self, file): - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - self.indexes[0] = data[0] - self.indexes[1] = data[2] # reverse - self.indexes[2] = data[1] # reverse - return self - - def Save(self, file): - tmpData = [0] * 3 - tmpData[0] = self.indexes[0] - tmpData[1] = self.indexes[2] # reverse - tmpData[2] = self.indexes[1] # reverse - data = struct.pack(self.binaryFormat,tmpData[0], tmpData[1], tmpData[2]) - file.write(data) - #print "wrote MD3 face structure: ",data - - def Dump(self, log): - log.info("MD3 Triangle") - log.info("Indices: %s", self.indexes) - log.info("") - - -class md3Shader: - name = "" - index = 0 - - binaryFormat = "<%dsi" % MAX_QPATH - - def __init__(self): - self.name = "" - self.index = 0 - - def GetSize(self): - return struct.calcsize(self.binaryFormat) - - def Load(self, file): - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - self.name = asciiz(data[0]) - self.index = data[1] - return self - - def Save(self, file): - tmpData = [0] * 2 - tmpData[0] = self.name - tmpData[1] = self.index - data = struct.pack(self.binaryFormat, tmpData[0], tmpData[1]) - file.write(data) - #print "wrote MD3 shader structure: ",data - - def Dump(self, log): - log.info("MD3 Shader") - log.info("Name: %s", self.name) - log.info("Index: %s", self.index) - log.info("") - - -class md3Surface: - ident = "" - name = "" - flags = 0 - numFrames = 0 - numShaders = 0 - numVerts = 0 - numTriangles = 0 - ofsTriangles = 0 - ofsShaders = 0 - ofsUV = 0 - ofsVerts = 0 - ofsEnd = 0 - shaders = [] - triangles = [] - uv = [] - verts = [] - - binaryFormat = "<4s%ds10i" % MAX_QPATH # 1 int, name, then 10 ints - - def __init__(self): - self.ident = "" - self.name = "" - self.flags = 0 - self.numFrames = 0 - self.numShaders = 0 - self.numVerts = 0 - self.numTriangles = 0 - self.ofsTriangles = 0 - self.ofsShaders = 0 - self.ofsUV = 0 - self.ofsVerts = 0 - self.ofsEnd - self.shaders = [] - self.triangles = [] - self.uv = [] - self.verts = [] - - def GetSize(self): - sz = struct.calcsize(self.binaryFormat) - self.ofsTriangles = sz - for t in self.triangles: - sz += t.GetSize() - self.ofsShaders = sz - for s in self.shaders: - sz += s.GetSize() - self.ofsUV = sz - for u in self.uv: - sz += u.GetSize() - self.ofsVerts = sz - for v in self.verts: - sz += v.GetSize() - self.ofsEnd = sz - return self.ofsEnd - - def Load(self, file, log): - # where are we in the file (for calculating real offsets) - ofsBegin = file.tell() - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - self.ident = data[0] - self.name = asciiz(data[1]) - self.flags = data[2] - self.numFrames = data[3] - self.numShaders = data[4] - self.numVerts = data[5] - self.numTriangles = data[6] - self.ofsTriangles = data[7] - self.ofsShaders = data[8] - self.ofsUV = data[9] - self.ofsVerts = data[10] - self.ofsEnd = data[11] - - # load the tri info - file.seek(ofsBegin + self.ofsTriangles, 0) - for i in range(0, self.numTriangles): - self.triangles.append(md3Triangle()) - self.triangles[i].Load(file) - #self.triangles[i].Dump(log) - - # load the shader info - file.seek(ofsBegin + self.ofsShaders, 0) - for i in range(0, self.numShaders): - self.shaders.append(md3Shader()) - self.shaders[i].Load(file) - #self.shaders[i].Dump(log) - - # load the uv info - file.seek(ofsBegin + self.ofsUV, 0) - for i in range(0, self.numVerts): - self.uv.append(md3TexCoord()) - self.uv[i].Load(file) - #self.uv[i].Dump(log) - - # load the verts info - file.seek(ofsBegin + self.ofsVerts, 0) - for i in range(0, self.numFrames): - for j in range(0, self.numVerts): - self.verts.append(md3Vert()) - #i*self.numVerts+j=where in the surface vertex list the vert position for this frame is - self.verts[(i * self.numVerts) + j].Load(file) - #self.verts[j].Dump(log) - - # go to the end of this structure - file.seek(ofsBegin+self.ofsEnd, 0) - - return self - - def Save(self, file): - self.GetSize() - tmpData = [0] * 12 - tmpData[0] = self.ident - tmpData[1] = self.name - tmpData[2] = self.flags - tmpData[3] = self.numFrames - tmpData[4] = self.numShaders - tmpData[5] = self.numVerts - tmpData[6] = self.numTriangles - tmpData[7] = self.ofsTriangles - tmpData[8] = self.ofsShaders - tmpData[9] = self.ofsUV - tmpData[10] = self.ofsVerts - tmpData[11] = self.ofsEnd - data = struct.pack(self.binaryFormat, tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6],tmpData[7],tmpData[8],tmpData[9],tmpData[10],tmpData[11]) - file.write(data) - - # write the tri data - for t in self.triangles: - t.Save(file) - - # save the shader coordinates - for s in self.shaders: - s.Save(file) - - # save the uv info - for u in self.uv: - u.Save(file) - - # save the verts - for v in self.verts: - v.Save(file) - - def Dump(self, log): - log.info("MD3 Surface") - log.info("Ident: %s", self.ident) - log.info("Name: %s", self.name) - log.info("Flags: %s", self.flags) - log.info("Number of Frames: %s", self.numFrames) - log.info("Number of Shaders: %s", self.numShaders) - log.info("Number of Verts: %s", self.numVerts) - log.info("Number of Triangles: %s", self.numTriangles) - log.info("Offset to Triangles: %s", self.ofsTriangles) - log.info("Offset to Shaders: %s", self.ofsShaders) - log.info("Offset to UV: %s", self.ofsUV) - log.info("Offset to Verts: %s", self.ofsVerts) - log.info("Offset to end: %s", self.ofsEnd) - log.info("") - - -class md3Tag: - name = "" - origin = [] - axis = [] - - binaryFormat="<%ds3f9f" % MAX_QPATH - - def __init__(self): - self.name = "" - self.origin = [0, 0, 0] - self.axis = [0, 0, 0, 0, 0, 0, 0, 0, 0] - - def GetSize(self): - return struct.calcsize(self.binaryFormat) - - def Load(self, file): - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - self.name = asciiz(data[0]) - self.origin[0] = data[1] - self.origin[1] = data[2] - self.origin[2] = data[3] - self.axis[0] = data[4] - self.axis[1] = data[5] - self.axis[2] = data[6] - self.axis[3] = data[7] - self.axis[4] = data[8] - self.axis[5] = data[9] - self.axis[6] = data[10] - self.axis[7] = data[11] - self.axis[8] = data[12] - return self - - def Save(self, file): - tmpData = [0] * 13 - tmpData[0] = self.name - tmpData[1] = float(self.origin[0]) - tmpData[2] = float(self.origin[1]) - tmpData[3] = float(self.origin[2]) - tmpData[4] = float(self.axis[0]) - tmpData[5] = float(self.axis[1]) - tmpData[6] = float(self.axis[2]) - tmpData[7] = float(self.axis[3]) - tmpData[8] = float(self.axis[4]) - tmpData[9] = float(self.axis[5]) - tmpData[10] = float(self.axis[6]) - tmpData[11] = float(self.axis[7]) - tmpData[12] = float(self.axis[8]) - data = struct.pack(self.binaryFormat, tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6], tmpData[7], tmpData[8], tmpData[9], tmpData[10], tmpData[11], tmpData[12]) - file.write(data) - #print "wrote MD3 Tag structure: ",data - - def Dump(self, log): - log.info("MD3 Tag") - log.info("Name: %s", self.name) - log.info("Origin: %s", self.origin) - log.info("Axis: %s", self.axis) - log.info("") - -class md3Frame: - mins = 0 - maxs = 0 - localOrigin = 0 - radius = 0.0 - name = "" - - binaryFormat="<3f3f3ff16s" - - def __init__(self): - self.mins = [0, 0, 0] - self.maxs = [0, 0, 0] - self.localOrigin = [0, 0, 0] - self.radius = 0.0 - self.name = "" - - def GetSize(self): - return struct.calcsize(self.binaryFormat) - - def Load(self, file): - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - self.mins[0] = data[0] - self.mins[1] = data[1] - self.mins[2] = data[2] - self.maxs[0] = data[3] - self.maxs[1] = data[4] - self.maxs[2] = data[5] - self.localOrigin[0] = data[6] - self.localOrigin[1] = data[7] - self.localOrigin[2] = data[8] - self.radius = data[9] - self.name = asciiz(data[10]) - return self - - def Save(self, file): - tmpData = [0] * 11 - tmpData[0] = self.mins[0] - tmpData[1] = self.mins[1] - tmpData[2] = self.mins[2] - tmpData[3] = self.maxs[0] - tmpData[4] = self.maxs[1] - tmpData[5] = self.maxs[2] - tmpData[6] = self.localOrigin[0] - tmpData[7] = self.localOrigin[1] - tmpData[8] = self.localOrigin[2] - tmpData[9] = self.radius - tmpData[10] = self.name - data = struct.pack(self.binaryFormat, tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6],tmpData[7], tmpData[8], tmpData[9], tmpData[10]) - file.write(data) - #print "wrote MD3 frame structure: ",data - - def Dump(self, log): - log.info("MD3 Frame") - log.info("Min Bounds: %s", self.mins) - log.info("Max Bounds: %s", self.maxs) - log.info("Local Origin: %s", self.localOrigin) - log.info("Radius: %s", self.radius) - log.info("Name: %s", self.name) - log.info("") - -class md3Object: - # header structure - ident = "" # this is used to identify the file (must be IDP3) - version = 0 # the version number of the file (Must be 15) - name = "" - flags = 0 - numFrames = 0 - numTags = 0 - numSurfaces = 0 - numSkins = 0 - ofsFrames = 0 - ofsTags = 0 - ofsSurfaces = 0 - ofsEnd = 0 - frames = [] - tags = [] - surfaces = [] - - binaryFormat="<4si%ds9i" % MAX_QPATH # little-endian (<), 17 integers (17i) - - def __init__(self): - self.ident = 0 - self.version = 0 - self.name = "" - self.flags = 0 - self.numFrames = 0 - self.numTags = 0 - self.numSurfaces = 0 - self.numSkins = 0 - self.ofsFrames = 0 - self.ofsTags = 0 - self.ofsSurfaces = 0 - self.ofsEnd = 0 - self.frames = [] - self.tags = [] - self.surfaces = [] - - def GetSize(self): - self.ofsFrames = struct.calcsize(self.binaryFormat) - self.ofsTags = self.ofsFrames - for f in self.frames: - self.ofsTags += f.GetSize() - self.ofsSurfaces += self.ofsTags - for t in self.tags: - self.ofsSurfaces += t.GetSize() - self.ofsEnd = self.ofsSurfaces - for s in self.surfaces: - self.ofsEnd += s.GetSize() - return self.ofsEnd - - def Load(self, file, log): - tmpData = file.read(struct.calcsize(self.binaryFormat)) - data = struct.unpack(self.binaryFormat, tmpData) - - self.ident = data[0] - self.version = data[1] - - if(self.ident != "IDP3" or self.version != 15): - log.error("Not a valid MD3 file") - log.error("Ident: %s", self.ident) - log.error("Version: %s", self.version) - Exit() - - self.name = asciiz(data[2]) - self.flags = data[3] - self.numFrames = data[4] - self.numTags = data[5] - self.numSurfaces = data[6] - self.numSkins = data[7] - self.ofsFrames = data[8] - self.ofsTags = data[9] - self.ofsSurfaces = data[10] - self.ofsEnd = data[11] - - # load the frame info - file.seek(self.ofsFrames, 0) - for i in range(0, self.numFrames): - self.frames.append(md3Frame()) - self.frames[i].Load(file) - #self.frames[i].Dump(log) - - # load the tags info - file.seek(self.ofsTags, 0) - for i in range(0, self.numFrames): - for j in range(0, self.numTags): - tag = md3Tag() - tag.Load(file) - #tag.Dump(log) - self.tags.append(tag) - - # load the surface info - file.seek(self.ofsSurfaces, 0) - for i in range(0, self.numSurfaces): - self.surfaces.append(md3Surface()) - self.surfaces[i].Load(file, log) - self.surfaces[i].Dump(log) - return self - - def Save(self, file): - self.GetSize() - tmpData = [0] * 12 - tmpData[0] = self.ident - tmpData[1] = self.version - tmpData[2] = self.name - tmpData[3] = self.flags - tmpData[4] = self.numFrames - tmpData[5] = self.numTags - tmpData[6] = self.numSurfaces - tmpData[7] = self.numSkins - tmpData[8] = self.ofsFrames - tmpData[9] = self.ofsTags - tmpData[10] = self.ofsSurfaces - tmpData[11] = self.ofsEnd - - data = struct.pack(self.binaryFormat, tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6],tmpData[7], tmpData[8], tmpData[9], tmpData[10], tmpData[11]) - file.write(data) - - for f in self.frames: - f.Save(file) - - for t in self.tags: - t.Save(file) - - for s in self.surfaces: - s.Save(file) - - def Dump(self, log): - log.info("Header Information") - log.info("Ident: %s", self.ident) - log.info("Version: %s", self.version) - log.info("Name: %s", self.name) - log.info("Flags: %s", self.flags) - log.info("Number of Frames: %s",self.numFrames) - log.info("Number of Tags: %s", self.numTags) - log.info("Number of Surfaces: %s", self.numSurfaces) - log.info("Number of Skins: %s", self.numSkins) - log.info("Offset Frames: %s", self.ofsFrames) - log.info("Offset Tags: %s", self.ofsTags) - log.info("Offset Surfaces: %s", self.ofsSurfaces) - log.info("Offset end: %s", self.ofsEnd) - log.info("") - -def asciiz(s): - n = 0 - while(ord(s[n]) != 0): - n = n + 1 - return s[0:n] - -# strips the slashes from the back of a string -def StripPath(path): - for c in range(len(path), 0, -1): - if path[c-1] == "/" or path[c-1] == "\\": - path = path[c:] - break - return path - -# strips the model from path -def StripModel(path): - for c in range(len(path), 0, -1): - if path[c-1] == "/" or path[c-1] == "\\": - path = path[:c] - break - return path - -# strips file type extension -def StripExtension(name): - n = 0 - best = len(name) - while(n != -1): - n = name.find('.',n+1) - if(n != -1): - best = n - name = name[0:best] - return name - -# strips gamedir -def StripGamePath(name): - gamepath = GAMEDIR.replace( '\\', '/' ) - namepath = name.replace( '\\', '/' ) - if namepath[0:len(gamepath)] == gamepath: - namepath= namepath[len(gamepath):len(namepath)] - return namepath - -import sys, struct, string, math - -def ANGLE2SHORT(x): - return int((x * 65536 / 360) & 65535) - -def SHORT2ANGLE(x): - return x * (360.0 / 65536.0) - -def DEG2RAD(a): - return (a * math.pi) / 180.0 - -def RAD2DEG(a): - return (a * 180.0) / math.pi - -def DotProduct(x, y): - return x[0] * y[0] + x[1] * y[1] + x[2] * y[2] - -def CrossProduct(a,b): - return [a[1]*b[2] - a[2]*b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0]] - -def VectorLength(v): - return math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]) - -def VectorSubtract(a, b): - return [a[0] - b[0], a[1] - b[1], a[2] - b[2]] - -def VectorAdd(a, b): - return [a[0] + b[0], a[1] + b[1], a[2] + b[2]] - -def VectorCopy(v): - return [v[0], v[1], v[2]] - -def VectorInverse(v): - return [-v[0], -v[1], -v[2]] - -#define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2]) -#define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s)) -#define VectorMA(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s)) - -def RadiusFromBounds(mins, maxs): - corner = [0, 0, 0] - a = 0 - b = 0 - - for i in range(0, 3): - a = abs(mins[i]) - b = abs(maxs[i]) - if a > b: - corner[i] = a - else: - corner[i] = b - - return VectorLength(corner) - - -# NOTE: Tr3B - matrix is in column-major order -def MatrixIdentity(): - return [[1.0, 0.0, 0.0, 0.0], - [0.0, 1.0, 0.0, 0.0], - [0.0, 0.0, 1.0, 0.0], - [0.0, 0.0, 0.0, 1.0]] - -def MatrixFromAngles(pitch, yaw, roll): - sp = math.sin(DEG2RAD(pitch)) - cp = math.cos(DEG2RAD(pitch)) - - sy = math.sin(DEG2RAD(yaw)) - cy = math.cos(DEG2RAD(yaw)) - - sr = math.sin(DEG2RAD(roll)) - cr = math.cos(DEG2RAD(roll)) - -# return [[cp * cy, (sr * sp * cy + cr * -sy), (cr * sp * cy + -sr * -sy), 0.0], -# [cp * sy, (sr * sp * sy + cr * cy), (cr * sp * sy + -sr * cy), 0.0], -# [-sp, sr * cp, cr * cp, 0.0], -# [0.0, 0.0, 0.0, 1.0]] - - return [[cp * cy, cp * sy, -sp, 0.0], - [(sr * sp * cy + cr * -sy), (sr * sp * sy + cr * cy), sr * cp, 0.0], - [(cr * sp * cy + -sr * -sy), (cr * sp * sy + -sr * cy), cr * cp, 0.0], - [0.0, 0.0, 0.0, 1.0]] - -def MatrixTransformPoint(m, p): - return [m[0][0] * p[0] + m[1][0] * p[1] + m[2][0] * p[2] + m[3][0], - m[0][1] * p[0] + m[1][1] * p[1] + m[2][1] * p[2] + m[3][1], - m[0][2] * p[0] + m[1][2] * p[1] + m[2][2] * p[2] + m[3][2]] - - -def MatrixTransformNormal(m, p): - return [m[0][0] * p[0] + m[1][0] * p[1] + m[2][0] * p[2], - m[0][1] * p[0] + m[1][1] * p[1] + m[2][1] * p[2], - m[0][2] * p[0] + m[1][2] * p[1] + m[2][2] * p[2]] - -def MatrixMultiply(b, a): - return [[ - a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0], - a[0][0] * b[0][1] + a[0][1] * b[1][1] + a[0][2] * b[2][1], - a[0][0] * b[0][2] + a[0][1] * b[1][2] + a[0][2] * b[2][2], - 0.0, - ],[ - a[1][0] * b[0][0] + a[1][1] * b[1][0] + a[1][2] * b[2][0], - a[1][0] * b[0][1] + a[1][1] * b[1][1] + a[1][2] * b[2][1], - a[1][0] * b[0][2] + a[1][1] * b[1][2] + a[1][2] * b[2][2], - 0.0, - ],[ - a[2][0] * b[0][0] + a[2][1] * b[1][0] + a[2][2] * b[2][0], - a[2][0] * b[0][1] + a[2][1] * b[1][1] + a[2][2] * b[2][1], - a[2][0] * b[0][2] + a[2][1] * b[1][2] + a[2][2] * b[2][2], - 0.0, - ],[ - a[3][0] * b[0][0] + a[3][1] * b[1][0] + a[3][2] * b[2][0] + b[3][0], - a[3][0] * b[0][1] + a[3][1] * b[1][1] + a[3][2] * b[2][1] + b[3][1], - a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2] + b[3][2], - 1.0, - ]] - -def MatrixSetupTransform(forward, left, up, origin): - return [[forward[0], forward[1], forward[2], origin[0]], - [left[0], left[1], left[2], origin[1]], - [up[0], up[1], up[2], origin[2]], - [0.0, 0.0, 0.0, 1.0]] - -# our own logger class. it works just the same as a normal logger except -# all info messages get show. -class Logger(logging.Logger): - def __init__(self, name,level = logging.NOTSET): - logging.Logger.__init__(self, name, level) - - self.has_warnings = False - self.has_errors = False - self.has_critical = False - - def info(self, msg, *args, **kwargs): - apply(self._log,(logging.INFO, msg, args), kwargs) - - def warning(self, msg, *args, **kwargs): - logging.Logger.warning(self, msg, *args, **kwargs) - self.has_warnings = True - - def error(self, msg, *args, **kwargs): - logging.Logger.error(self, msg, *args, **kwargs) - self.has_errors = True - - def critical(self, msg, *args, **kwargs): - logging.Logger.critical(self, msg, *args, **kwargs) - self.has_errors = True - -# should be able to make this print to stdout in realtime and save MESSAGES -# as well. perhaps also have a log to file option -class LogHandler(logging.StreamHandler): - def __init__(self): - logging.StreamHandler.__init__(self, sys.stdout) - - if "md3_export_log" not in Blender.Text.Get(): - self.outtext = Blender.Text.New("md3_export_log") - else: - self.outtext = Blender.Text.Get('md3_export_log') - self.outtext.clear() - - self.lastmsg = '' - - def emit(self, record): - # print to stdout and to a new blender text object - msg = self.format(record) - - if msg == self.lastmsg: - return - - self.lastmsg = msg - self.outtext.write("%s\n" %msg) - - logging.StreamHandler.emit(self, record) - -logging.setLoggerClass(Logger) -log = logging.getLogger('md3_export') - -handler = LogHandler() -formatter = logging.Formatter('%(levelname)s %(message)s') -handler.setFormatter(formatter) - -log.addHandler(handler) -# set this to minimum output level. eg. logging.DEBUG, logging.WARNING, logging.ERROR -# logging.CRITICAL. logging.INFO will make little difference as these always get -# output'd -log.setLevel(logging.WARNING) - - -class BlenderGui: - def __init__(self): - text = """A log has been written to a blender text window. Change this window type to -a text window and you will be able to select the file md3_export_log.""" - - text = textwrap.wrap(text,40) - text += [''] - - if log.has_critical: - text += ['There were critical errors!!!!'] - - elif log.has_errors: - text += ['There were errors!'] - - elif log.has_warnings: - text += ['There were warnings'] - - # add any more text before here - text.reverse() - - self.msg = text - - Blender.Draw.Register(self.gui, self.event, self.button_event) - - def gui(self,): - quitbutton = Blender.Draw.Button("Exit", 1, 0, 0, 100, 20, "Close Window") - - y = 35 - - for line in self.msg: - BGL.glRasterPos2i(10,y) - Blender.Draw.Text(line) - y+=15 - - def event(self,evt, val): - if evt == Blender.Draw.ESCKEY: - Blender.Draw.Exit() - return - - def button_event(self,evt): - if evt == 1: - Blender.Draw.Exit() - return - - -def ApplyTransform(vert, matrix): - return vert * matrix - - -def UpdateFrameBounds(v, f): - for i in range(0, 3): - f.mins[i] = min(v[i], f.mins[i]) - for i in range(0, 3): - f.maxs[i] = max(v[i], f.maxs[i]) - - -def UpdateFrameRadius(f): - f.radius = RadiusFromBounds(f.mins, f.maxs) - - -def ProcessSurface(scene, blenderObject, md3, pathName, modelName): - # because md3 doesnt suppoort faceUVs like blender, we need to duplicate - # any vertex that has multiple uv coords - - vertDict = {} - indexDict = {} # maps a vertex index to the revised index after duplicating to account for uv - vertList = [] # list of vertices ordered by revised index - numVerts = 0 - uvList = [] # list of tex coords ordered by revised index - faceList = [] # list of faces (they index into vertList) - numFaces = 0 - - scene.makeCurrent() - Blender.Set("curframe", 1) - Blender.Window.Redraw() - - # get the object (not just name) and the Mesh, not NMesh - mesh = blenderObject.getData(False, True) - matrix = blenderObject.getMatrix('worldspace') - - surf = md3Surface() - surf.numFrames = md3.numFrames - surf.name = blenderObject.getName() - surf.ident = MD3_IDENT - - # create shader for surface - surf.shaders.append(md3Shader()) - surf.numShaders += 1 - surf.shaders[0].index = 0 - - log.info("Materials: %s", mesh.materials) - # :P - #shaderpath=Blender.Draw.PupStrInput("shader path for "+blenderObject.name+":", "", MAX_QPATH ) - shaderpath="" - if shaderpath == "" : - if not mesh.materials: - surf.shaders[0].name = pathName + blenderObject.name - else: - surf.shaders[0].name = pathName + mesh.materials[0].name - else: - if not mesh.materials: - surf.shaders[0].name = shaderpath + blenderObject.name - else: - surf.shaders[0].name = shaderpath + mesh.materials[0].name - - # process each face in the mesh - for face in mesh.faces: - - tris_in_this_face = [] #to handle quads and up... - - # this makes a list of indices for each tri in this face. a quad will be [[0,1,1],[0,2,3]] - for vi in range(1, len(face.v)-1): - tris_in_this_face.append([0, vi, vi + 1]) - - # loop across each tri in the face, then each vertex in the tri - for this_tri in tris_in_this_face: - numFaces += 1 - tri = md3Triangle() - tri_ind = 0 - for i in this_tri: - # get the vertex index, coords and uv coords - index = face.v[i].index - v = face.v[i].co - if mesh.faceUV == True: - uv = (face.uv[i][0], face.uv[i][1]) - elif mesh.vertexUV: - uv = (face.v[i].uvco[0], face.v[i].uvco[1]) - else: - uv = (0.0, 0.0) # handle case with no tex coords - - - if vertDict.has_key((index, uv)): - # if we've seen this exact vertex before, simply add it - # to the tris list of vertex indices - tri.indexes[tri_ind] = vertDict[(index, uv)] - else: - # havent seen this tri before - # (or its uv coord is different, so we need to duplicate it) - - vertDict[(index, uv)] = numVerts - - # put the uv coord into the list - # (uv coord are directly related to each vertex) - tex = md3TexCoord() - tex.u = uv[0] - tex.v = uv[1] - uvList.append(tex) - - tri.indexes[tri_ind] = numVerts - - # now because we have created a new index, - # we need a way to link it to the index that - # blender returns for NMVert.index - if indexDict.has_key(index): - # already there - each of the entries against - # this key represents the same vertex with a - # different uv value - ilist = indexDict[index] - ilist.append(numVerts) - indexDict[index] = ilist - else: - # this is a new one - indexDict[index] = [numVerts] - - numVerts += 1 - tri_ind +=1 - faceList.append(tri) - - # we're done with faces and uv coords - for t in uvList: - surf.uv.append(t) - - for f in faceList: - surf.triangles.append(f) - - surf.numTriangles = len(faceList) - surf.numVerts = numVerts - - # now vertices are stored as frames - - # all vertices for frame 1, all vertices for frame 2...., all vertices for frame n - # so we need to iterate across blender's frames, and copy out each vertex - for frameNum in range(1, md3.numFrames + 1): - Blender.Set("curframe", frameNum) - Blender.Window.Redraw() - - m = NMesh.GetRawFromObject(blenderObject.name) - - vlist = [0] * numVerts - for vertex in m.verts: - try: - vindices = indexDict[vertex.index] - except: - log.warning("Found a vertex in %s that is not part of a face", blenderObject.name) - continue - - vTx = ApplyTransform(vertex.co, matrix) - nTx = ApplyTransform(vertex.no, matrix) - UpdateFrameBounds(vTx, md3.frames[frameNum - 1]) - vert = md3Vert() - #vert.xyz = vertex.co[0:3] - #vert.normal = vert.Encode(vertex.no[0:3]) - vert.xyz = vTx[0:3] - vert.normal = vert.Encode(vertex.no[0:3]) - #print vertex.no - for ind in vindices: # apply the position to all the duplicated vertices - vlist[ind] = vert - - UpdateFrameRadius(md3.frames[frameNum - 1]) - - for vl in vlist: - surf.verts.append(vl) - - surf.Dump(log) - md3.surfaces.append(surf) - md3.numSurfaces += 1 - - -def Export(fileName): - if(fileName.find('.md3', -4) <= 0): - fileName += '.md3' - - log.info("Starting ...") - - log.info("Exporting MD3 format to: %s", fileName) - - pathName = StripGamePath(StripModel(fileName)) - log.info("Shader path name: %s", pathName) - - modelName = StripExtension(StripPath(fileName)) - log.info("Model name: %s", modelName) - - md3 = md3Object() - md3.ident = MD3_IDENT - md3.version = MD3_VERSION - - tagList = [] - - # get the scene - scene = Blender.Scene.getCurrent() - context = scene.getRenderingContext() - - scene.makeCurrent() - md3.numFrames = Blender.Get("curframe") - Blender.Set("curframe", 1) - - # create a bunch of blank frames, they'll be filled in by 'ProcessSurface' - for i in range(1, md3.numFrames + 1): - frame = md3Frame() - frame.name = "frame_" + str(i) - md3.frames.append(frame) - - # export all selected objects - objlist = Blender.Object.GetSelected() - - # process each object for the export - for obj in objlist: - # check if it's a mesh object - if obj.getType() == "Mesh": - log.info("Processing surface: %s", obj.name) - if len(md3.surfaces) == MD3_MAX_SURFACES: - log.warning("Hit md3 limit (%i) for number of surfaces, skipping ...", MD3_MAX_SURFACES, obj.getName()) - else: - ProcessSurface(scene, obj, md3, pathName, modelName) - elif obj.getType() == "Empty": # for tags, we just put em in a list so we can process them all together - if obj.name[0:4] == "tag_": - log.info("Processing tag: %s", obj.name) - tagList.append(obj) - md3.numTags += 1 - else: - log.info("Skipping object: %s", obj.name) - - - # work out the transforms for the tags for each frame of the export - for i in range(1, md3.numFrames + 1): - - # needed to update IPO's value, but probably not the best way for that... - scene.makeCurrent() - Blender.Set("curframe", i) - Blender.Window.Redraw() - for tag in tagList: - t = md3Tag() - matrix = tag.getMatrix('worldspace') - t.origin[0] = matrix[3][0] - t.origin[1] = matrix[3][1] - t.origin[2] = matrix[3][2] - - t.axis[0] = matrix[0][0] - t.axis[1] = matrix[0][1] - t.axis[2] = matrix[0][2] - - t.axis[3] = matrix[1][0] - t.axis[4] = matrix[1][1] - t.axis[5] = matrix[1][2] - - t.axis[6] = matrix[2][0] - t.axis[7] = matrix[2][1] - t.axis[8] = matrix[2][2] - t.name = tag.name - #t.Dump(log) - md3.tags.append(t) - - # export! - file = open(fileName, "wb") - md3.Save(file) - file.close() - md3.Dump(log) - -def FileSelectorCallback(fileName): - Export(fileName) - - BlenderGui() - -Blender.Window.FileSelector(FileSelectorCallback, "Export Quake3 MD3") \ No newline at end of file diff --git a/polymer-perf/eduke32/build/src/util/prhighpal.py b/polymer-perf/eduke32/build/src/util/prhighpal.py deleted file mode 100755 index 6947bd8e7..000000000 --- a/polymer-perf/eduke32/build/src/util/prhighpal.py +++ /dev/null @@ -1,300 +0,0 @@ -#!/usr/bin/python - -import sys; - -from numpy import array, zeros, ones, arange, uint32 -from numpy import vstack, hstack, hsplit, dstack, dsplit - -from PIL.Image import frombuffer - - -NBITS = 7; -RESIDBITS = 8-NBITS; -DIM = 1<>(i*8))&255; - - return imbyte; - - -def getdispimg(im): - "Get a reshaped version of the palette image IM suitable for viewing." - # 2^NBITS x 2^NBITS*2^NBITS --> 2^(NBITS + NBITS/2) x 2^NBITS*2^(NBITS - NBITS/2) - - if (im.shape != (DIM, DIM*DIM, 3)): - raise ValueError("image must have shape (DIM, DIM*DIM, 3)"); - - dimfactor = 1<<(NBITS/2); - return vstack(hsplit(im, dimfactor)); - - -def getPILimg(im): - sz = im.shape; - return frombuffer("RGB", [sz[1], sz[0]], im, "raw", "RGB", 0, 1); - - -def saveimage(im, filename): - getPILimg(im).save(filename); - -def showpalimg(im): - getPILimg(getdispimg(im)).show(); - - -### utility functions - -## port of Octave's rbg2hsv -def rgb2hsv(im): - if (im.dtype=='uint8'): - im = imitof(im); - - r, g, b = im[..., 0], im[..., 1], im[..., 2]; - s, v = im.min(2), im.max(2); - dif = v-s; - - colored = (s != v); - - h = zeros(r.shape, im.dtype); - - # blue hue - idx = ((v==b) & colored); - h[idx] = 2./3 + 1./6*(r[idx]-g[idx])/dif[idx]; - - # green hue - idx = ((v==g) & colored); - h[idx] = 1./3 + 1./6*(b[idx]-r[idx])/dif[idx]; - - # red hue - idx = ((v==r) & colored); - h[idx] = 1./6*(g[idx]-b[idx])/dif[idx]; - h[idx] %= 1; - - s[~colored] = 0; - s[colored] = 1.0 - s[colored]/v[colored]; - - return dstack((h,s,v)); - - -## port of Octave's hsv2rbg -def hsv2rgb(imh): - imh[imh<0] = 0; - imh[imh>1] = 1; - - h, s, v = imh[..., 0], imh[..., 1], imh[..., 2]; - - rgb = v*(1.0-s); - rgb = dstack((rgb, rgb, rgb)); - - hue = dstack((h-2./3, h, h-1./3))%1; - f = s*v; - f = dstack((f, f, f)); - - rgb += f * (6.0 * (hue < 1./6)*hue - + ((hue >= 1./6) & (hue < 1./2)) - + ((hue >= 1./2) & (hue < 2./3))*(4.0 - 6.0*hue)); - - return imftoi(rgb); - - -def imftoi(im): - im = im.copy(); - if (im.dtype=='uint8'): - return im - im *= CONVFACT; - im[im>255] = 255; - return im.astype('uint8'); - -def imitof(im): - if (im.dtype=='float32'): - return im.copy(); - return im.astype('float32')/CONVFACT; - - -### -def genpal(basepal, basepalhsv, pal): - "Generate a highpalookup image for palette number PAL. \ -BASEPALHSV should the precomputed HSV representation of BASEPAL." - - if (basepal.dtype != 'uint8'): - raise TypeError('BASEPAL should be uint8.'); - - if (pal==0): - return basepal; - - bph = basepalhsv; - h,s,v = bph[..., 0], bph[..., 1], bph[..., 2]; - - bluemask = (h>0.52) & (h<0.8) & (s>0.2); - - # all true mask will be used unless overridden - mask = ones(h.shape, 'bool'); - - -## PHRP r176 defs: -# -# tint { pal 1 red 100 green 120 blue 148 flags 1 } -# tint { pal 2 red 255 green 48 blue 0 flags 0 } -# tint { pal 4 red 0 green 0 blue 0 flags 0 } -# tint { pal 6 red 224 green 255 blue 112 flags 3 } -# tint { pal 7 red 172 green 157 blue 140 flags 0 } -# tint { pal 8 red 199 green 226 blue 113 flags 1 } -# -# bit 1: greyscale (max) -# bit 2: invert (255-x) -# colorization: min(int(C*C')/64, 255) - - if (pal in [1,2,4,6,7,8]): - rgbf = { 1: [100, 120, 148, 1], - 2: [255, 48, 0, 0], - 4: [0, 0, 0, 0], - 6: [224, 255, 112, 3], - 7: [172, 157, 140, 0], - 8: [199, 226, 113, 1]} - - newrgb = basepal.astype('uint32'); - - flags = rgbf[pal][3] - - if (flags&1): # greyscale - newrgb = newrgb.max(2); - newrgb = dstack((newrgb, newrgb, newrgb)).copy(); - - if (flags&2): # invert - newrgb = 255-newrgb; - - # colorize - for i in range(3): - newrgb[:,:,i] *= rgbf[pal][i] - newrgb[:,:,i] /= 255 - newrgb[newrgb>255] = 255 - - return newrgb.astype('uint8'); - -# plagman: -# if (pal==1): -# h[:] = 0.66; - -# elif (pal==6): -# h[:] = 0.33; -# v = 1.0 - v; - - elif (pal==20): - m1 = ((h>0.6) & (h<0.7)); - m2 = ((h>0.04) & (h<0.13)); - m3 = ((h>0.7) & (h<0.9)); - m4 = ((h>0.3) & (h<0.36)); - mask = m1 | m2 | m3 | m4; - - # blue to gray by removing all saturation - s[m1] = 0.0; - # orange and brown to blue - h[m2] = 0.66; - # purple and reddish to blue - h[m3] = 0.66 - # green to blue - h[m4] = 0.66; - -# helixhorned: - elif (pal==11): - mask = bluemask; - h[mask] = green; - s[mask] += 0.1; - - elif (pal==12): - mask = bluemask; - h[mask] = 0.0; - s[mask] = 0.0; - - elif (pal==13): - mask = bluemask; - h[mask] = 0.0; - s[mask] = 0.0; - v[mask] *= 0.7; - - elif (pal==16): - mask = bluemask; - s[mask] += 0.1; - v[mask] -= 0.1; - - elif (pal==21): - mask = bluemask; - h[mask] = red; - s[mask] += 0.3; - - elif (pal==23): - mask = bluemask; - h[mask] = yellow; - s[mask] += 0.12; - v[mask] *= 1.15; - - elif (pal==99): - mask = bluemask; - v[mask] = 0; - -# user: -# ... - - else: - raise ValueError("unknown pal {0}!".format(pal)); - - # --- - newrgb = hsv2rgb(dstack((h, s, v))); - - nmask = ~mask; - - r = mask*newrgb[:,:,0] + nmask*basepal[:,:,0]; - g = mask*newrgb[:,:,1] + nmask*basepal[:,:,1]; - b = mask*newrgb[:,:,2] + nmask*basepal[:,:,2]; - - # PIL doesn't seem to like views/shallow copies - return dstack((r, g, b)).copy(); - - -## main -if (__name__ == "__main__"): - - argc = len(sys.argv); - if (argc == 1): - print "Usage: python prhighpal.py (palnums ...)" - sys.exit(); - - print "Generating base palette..." - bp = genbasepal(); - bph = rgb2hsv(bp); - - for i in xrange(1, argc): - palnum = int(sys.argv[i]); - filename = "hipal{0}_gen.png".format(palnum); - print "Generating palnum", palnum, "image ..."; - palimg = genpal(bp.copy(), bph.copy(), palnum); - print "Writing", filename, "..."; - saveimage(palimg, filename); - - print "\nDEF code:\n" - for i in xrange(1, argc): - palnum = int(sys.argv[i]); - if (palnum==0): - continue; - filename = "hipal{0}_gen.png".format(palnum); - print "highpalookup { pal", palnum, "file", filename, "}"; diff --git a/polymer-perf/eduke32/build/src/util/transpal.c b/polymer-perf/eduke32/build/src/util/transpal.c deleted file mode 100644 index 1f3456365..000000000 --- a/polymer-perf/eduke32/build/src/util/transpal.c +++ /dev/null @@ -1,270 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. -// -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - -#include "compat.h" -#include "pragmas.h" - -#define MAXPALOOKUPS 256 - -static int numpalookups, transratio; -static char palettefilename[13], origpalookup[MAXPALOOKUPS<<8]; -static char palette[768], palookup[MAXPALOOKUPS<<8], transluc[65536]; -static char closestcol[64][64][64]; - -#define FASTPALGRIDSIZ 8 -static int rdist[129], gdist[129], bdist[129]; -static char colhere[((FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2))>>3]; -static char colhead[(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)]; -static int colnext[256]; -static char coldist[8] = {0,1,2,3,4,3,2,1}; -static int colscan[27]; - - - -char getclosestcol(int r, int g, int b) -{ - int i, j, k, dist, mindist, retcol; - int *rlookup, *glookup, *blookup; - char *ptr; - - if (closestcol[r][g][b] != 255) return(closestcol[r][g][b]); - - j = (r>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(g>>3)*FASTPALGRIDSIZ+(b>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1; - mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]); - mindist = min(mindist,bdist[coldist[b&7]+64+8]); - mindist++; - - rlookup = (int *)&rdist[64-r]; - glookup = (int *)&gdist[64-g]; - blookup = (int *)&bdist[64-b]; - - retcol = -1; - for(k=26;k>=0;k--) - { - i = colscan[k]+j; if ((colhere[i>>3]&(1<<(i&7))) == 0) continue; - for(i=colhead[i];i>=0;i=colnext[i]) - { - ptr = (char *)&palette[i*3]; - dist = glookup[ptr[1]]; if (dist >= mindist) continue; - dist += rlookup[ptr[0]]; if (dist >= mindist) continue; - dist += blookup[ptr[2]]; if (dist >= mindist) continue; - mindist = dist; retcol = i; - } - } - if (retcol < 0) - { - mindist = 0x7fffffff; - ptr = (char *)&palette[768-3]; - for(i=255;i>=0;i--,ptr-=3) - { - dist = glookup[ptr[1]]; if (dist >= mindist) continue; - dist += rlookup[ptr[0]]; if (dist >= mindist) continue; - dist += blookup[ptr[2]]; if (dist >= mindist) continue; - mindist = dist; retcol = i; - } - } - ptr = (char *)&closestcol[r][g][b]; - *ptr = retcol; - if ((r >= 4) && (ptr[(-2)<<12] == retcol)) ptr[(-3)<<12] = retcol, ptr[(-2)<<12] = retcol, ptr[(-1)<<12] = retcol; - if ((g >= 4) && (ptr[(-2)<<6] == retcol)) ptr[(-3)<<6] = retcol, ptr[(-2)<<6] = retcol, ptr[(-1)<<6] = retcol; - if ((b >= 4) && (ptr[(-2)] == retcol)) ptr[(-3)] = retcol, ptr[(-2)] = retcol, ptr[(-1)] = retcol; - if ((r < 64-4) && (ptr[(2)<<12] == retcol)) ptr[(3)<<12] = retcol, ptr[(2)<<12] = retcol, ptr[(1)<<12] = retcol; - if ((g < 64-4) && (ptr[(2)<<6] == retcol)) ptr[(3)<<6] = retcol, ptr[(2)<<6] = retcol, ptr[(1)<<6] = retcol; - if ((b < 64-4) && (ptr[(2)] == retcol)) ptr[(3)] = retcol, ptr[(2)] = retcol, ptr[(1)] = retcol; - if ((r >= 2) && (ptr[(-1)<<12] == retcol)) ptr[(-1)<<12] = retcol; - if ((g >= 2) && (ptr[(-1)<<6] == retcol)) ptr[(-1)<<6] = retcol; - if ((b >= 2) && (ptr[(-1)] == retcol)) ptr[(-1)] = retcol; - if ((r < 64-2) && (ptr[(1)<<12] == retcol)) ptr[(1)<<12] = retcol; - if ((g < 64-2) && (ptr[(1)<<6] == retcol)) ptr[(1)<<6] = retcol; - if ((b < 64-2) && (ptr[(1)] == retcol)) ptr[(1)] = retcol; - return(retcol); -} - -char getpalookup(char dashade, char dacol) -{ - int r, g, b, t; - char *ptr; - - ptr = (char *)&palette[dacol*3]; - t = divscale16(numpalookups-dashade,numpalookups); - r = ((ptr[0]*t+32768)>>16); - g = ((ptr[1]*t+32768)>>16); - b = ((ptr[2]*t+32768)>>16); - return(getclosestcol(r,g,b)); -} - -char gettrans(char dat1, char dat2, int datransratio) -{ - int r, g, b; - char *ptr, *ptr2; - - ptr = (char *)&palette[dat1*3]; - ptr2 = (char *)&palette[dat2*3]; - r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8); - g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8); - b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8); - return(getclosestcol(r,g,b)); -} - -void initfastcolorlookup(int rscale, int gscale, int bscale) -{ - int i, j, x, y, z; - char *ptr; - - j = 0; - for(i=64;i>=0;i--) - { - //j = (i-64)*(i-64); - rdist[i] = rdist[128-i] = j*rscale; - gdist[i] = gdist[128-i] = j*gscale; - bdist[i] = bdist[128-i] = j*bscale; - j += 129-(i<<1); - } - - clearbufbyte(FP_OFF(colhere),sizeof(colhere),0L); - clearbufbyte(FP_OFF(colhead),sizeof(colhead),0L); - - ptr = (char *)&palette[768-3]; - for(i=255;i>=0;i--,ptr-=3) - { - j = (ptr[0]>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(ptr[1]>>3)*FASTPALGRIDSIZ+(ptr[2]>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1; - if (colhere[j>>3]&(1<<(j&7))) colnext[i] = colhead[j]; else colnext[i] = -1; - colhead[j] = i; - colhere[j>>3] |= (1<<(j&7)); - } - - i = 0; - for(x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ) - for(y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ) - for(z=-1;z<=1;z++) - colscan[i++] = x+y+z; - i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i; -} - -int main(int argc, char **argv) -{ - char col, ch; - short orignumpalookups; - int fil, i, j, rscale, gscale, bscale; - char buf[65536]; - - ch = 13; - if (argc>1) { - if (argv[1][0] == '-') { - if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); } - argc--; - argv++; - } - } - - if ((argc != 3) && (argc != 6)) - { - printf("TRANSPAL [-t] [numshades][trans#(0-inv,256-opa)][r][g][b] by Kenneth Silverman\n"); - printf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n"); - printf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n"); - printf(" Ex #2: transpal 64 160\n\n"); - printf("Once tables are generated, the optional -t switch determines what to save:\n"); - printf(" Exclude -t to update both the shade table and transluscent table\n"); - printf(" Include -t to update the transluscent table ONLY\n"); - exit(0); - } - - strcpy(palettefilename,"palette.dat"); - numpalookups = atol(argv[1]); - transratio = atol(argv[2]); - - if (argc == 6) - { - rscale = atol(argv[3]); - gscale = atol(argv[4]); - bscale = atol(argv[5]); - } - else - { - rscale = 30; - gscale = 59; - bscale = 11; - } - - if ((numpalookups < 1) || (numpalookups > 256)) - { printf("Invalid number of shades\n"); exit(0); } - if ((transratio < 0) || (transratio > 256)) - { printf("Invalid transluscent ratio\n"); exit(0); } - - if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1) - { - printf("%s not found",palettefilename); - return(0); - } - Bread(fil,palette,768); - Bread(fil,&orignumpalookups,2); orignumpalookups = B_LITTLE16(orignumpalookups); - orignumpalookups = min(max(orignumpalookups,1),256); - Bread(fil,origpalookup,(int)orignumpalookups<<8); - Bclose(fil); - - clearbuf(buf,65536>>2,0L); - - initfastcolorlookup(rscale,gscale,bscale); - clearbuf(closestcol,262144>>2,0xffffffff); - - for(i=0;i>2)+buf,(int)col); - drawpixel(((((i<<1)+1)*320+(j+8))>>2)+buf,(int)col); - } - - for(i=0;i<256;i++) - for(j=0;j<6;j++) - { - drawpixel((((j+132+0)*320+(i+8))>>2)+buf,i); - - drawpixel((((i+132+8)*320+(j+0))>>2)+buf,i); - } - - for(i=0;i<256;i++) - for(j=0;j<256;j++) - { - col = gettrans((char)i,(char)j,transratio); - transluc[(i<<8)+j] = col; - - drawpixel((((j+132+8)*320+(i+8))>>2)+buf,(int)col); - } - - if (ch == 13) - { - short s; - if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) - { printf("Couldn't save file %s",palettefilename); return(0); } - Bwrite(fil,palette,768); - s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2); - Bwrite(fil,palookup,numpalookups<<8); - Bwrite(fil,transluc,65536); - Bclose(fil); - printf("Shade table AND transluscent table updated\n"); - } - else if (ch == 32) - { - short s; - if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) - { printf("Couldn't save file %s",palettefilename); return(0); } - Bwrite(fil,palette,768); - s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2); - Bwrite(fil,origpalookup,(int)orignumpalookups<<8); - Bwrite(fil,transluc,65536); - Bclose(fil); - printf("Transluscent table updated\n"); - } - else - printf("Palette file wasn't touched\n"); - - return 0; -} - diff --git a/polymer-perf/eduke32/build/src/util/vgafont.cpp b/polymer-perf/eduke32/build/src/util/vgafont.cpp deleted file mode 100644 index 9e1b000bc..000000000 --- a/polymer-perf/eduke32/build/src/util/vgafont.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// VGA Font Grabber -// Copyright (c) 1997 Jonathon Fowler -// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1 - - -#include -#include - -void main(void) -{ - int font, width, height, numchars; - struct REGPACK r; - FILE *fp; - - printf("VGA Font Grabber\n" - "Copyright (c) 1997 Jonathon Fowler\n"); - - do { - printf("\nSelect which font to grab:\n" - " 1. 8-by-8 ROM\n" - " 2. 8-by-14 ROM\n" - " 3. 8-by-16 ROM\n" - " 4. 9-by-16 ROM\n" - " 5. 9-by-14 ROM\n" - " 6. Quit\n" - " > "); - scanf("%d",&font); - - switch (font) { - case 1: - printf("Getting 8-by-8 ROM font..."); - - if ((fp = fopen("88vga.dat", "wb")) != NULL) { - width = 8; - height = 8; - numchars = 256; - - r.r_ax = 0x1130; // locate the font (1st half) - r.r_bx = 0x0300; - intr(0x10, &r); - - fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp); - - r.r_ax = 0x1130; // locate the font (2nd half) - r.r_bx = 0x0400; - intr(0x10, &r); - - fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp); - - fclose(fp); - } - - printf("Done\n"); - break; - case 2: - printf("Getting 8-by-14 ROM font..."); - - if ((fp = fopen("814vga.dat", "wb")) != NULL) { - width = 8; - height = 14; - numchars = 256; - - r.r_ax = 0x1130; // locate the font - r.r_bx = 0x0200; - intr(0x10, &r); - - fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp); - - fclose(fp); - } - - printf("Done\n"); - break; - case 3: - printf("Getting 8-by-16 ROM font..."); - - if ((fp = fopen("816vga.dat", "wb")) != NULL) { - width = 8; - height = 16; - numchars = 256; - - r.r_ax = 0x1130; // locate the font - r.r_bx = 0x0600; - intr(0x10, &r); - - fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp); - - fclose(fp); - } - - printf("Done\n"); - break; - case 4: - printf("Getting 9-by-16 ROM font..."); - - if ((fp = fopen("916vga.dat", "wb")) != NULL) { - width = 9; - height = 16; - numchars = 256; - - r.r_ax = 0x1130; // locate the font - r.r_bx = 0x0700; - intr(0x10, &r); - - fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp); - - fclose(fp); - } - - printf("Done\n"); - break; - case 5: - printf("Getting 9-by-14 ROM font..."); - - if ((fp = fopen("914vga.dat", "wb")) != NULL) { - width = 9; - height = 16; - numchars = 256; - - r.r_ax = 0x1130; // locate the font - r.r_bx = 0x0500; - intr(0x10, &r); - - fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp); - - fclose(fp); - } - - printf("Done\n"); - break; - case 6: - break; - default: - printf("Please try again\n"); - break; - } - } while (font != 6); - -} diff --git a/polymer-perf/eduke32/build/src/util/wad2art.c b/polymer-perf/eduke32/build/src/util/wad2art.c deleted file mode 100644 index 4de10dc76..000000000 --- a/polymer-perf/eduke32/build/src/util/wad2art.c +++ /dev/null @@ -1,283 +0,0 @@ -// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman -// Ken Silverman's official web site: "http://www.advsys.net/ken" -// See the included license file "BUILDLIC.TXT" for license info. -// -// This file has been modified from Ken Silverman's original release -// by Jonathon Fowler (jonof@edgenetwk.com) - -#include "compat.h" -#include "pragmas.h" - -#define MAXWADS 4096 - -static int artversion, localtilestart, localtileend; -static int fil1, fil2; -static char wadata[MAXWADS][8]; -static int wadplc[MAXWADS], wadlen[MAXWADS], numwads; -static int xoffses[1024], ylookup[256], picanm[MAXWADS]; -static short tilesizx[MAXWADS], tilesizy[MAXWADS]; -static char pal[768], palookup[8192]; -static char screen[65536], tempbuf[131072]; - - -void loadwadheader(void) -{ - int i, j; - - Bread(fil1,&tempbuf[0],12); - numwads = ((int)tempbuf[4])+(((int)tempbuf[5])<<8)+(((int)tempbuf[6])<<16)+(((int)tempbuf[7])<<24); - i = ((int)tempbuf[8])+(((int)tempbuf[9])<<8)+(((int)tempbuf[10])<<16)+(((int)tempbuf[11])<<24); - Blseek(fil1,i,BSEEK_SET); - Bread(fil1,&tempbuf[0],numwads*16); - j = 0; - for(i=0;i>= 2; - - i = 0; - while (Bstrncasecmp(wadata[i],"COLORMAP",8) != 0) i++; - Blseek(fil1,wadplc[i],BSEEK_SET); - Bread(fil1,palookup,8192); - - if ((fil3 = Bopen("palette.dat",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) - { printf("Cannot save palette.dat\n"); exit(0); } - Bwrite(fil3,pal,768); - danumshades = 32; - Bwrite(fil3,&danumshades,2); - Bwrite(fil3,palookup,8192); - Bclose(fil3); -} - -void saveart (short tilenum, short xlen, short ylen) -{ - int i, x, p, pend; - - pend = ylookup[ylen]; - - tilesizx[tilenum] = xlen; - tilesizy[tilenum] = ylen; - i = 0; - for(x=0;x= 10000) buffer[j++] = ((i/10000)%10)+48; - if (i >= 1000) buffer[j++] = ((i/1000)%10)+48; - if (i >= 100) buffer[j++] = ((i/100)%10)+48; - if (i >= 10) buffer[j++] = ((i/10)%10)+48; - buffer[j++] = (i%10)+48; - - buffer[j++] = 13; - buffer[j++] = 10; - Bwrite(fil3,&buffer[0],j); - } - - Bclose(fil3); -} - -void showart (char *part) -{ - char yoff, ylen; - short xsiz, ysiz; - int i, j, z, zx, zzx, x, y, p, pend, junk, curplc; - - curplc = -1; - if ((Bstrncasecmp(part,"L_START",7) == 0) || (Bstrncasecmp(part,"S_START",7) == 0) || (Bstrncasecmp(part,"P_START",7) == 0)) - { - if (Bstrncasecmp(part,"L_START",7) == 0) - z = 462; - else - { - z = 0; - while (Bstrncasecmp(wadata[z],part,7) != 0) z++; - z++; - } - - do - { - if (Bstrncasecmp(wadata[z],"P1_START",8) == 0) z++; - if (Bstrncasecmp(wadata[z],"P1_END",6) == 0) z++; - if (Bstrncasecmp(wadata[z],"P2_START",8) == 0) z++; - if (Bstrncasecmp(wadata[z],"S_START",7) == 0) break; - if (Bstrncasecmp(wadata[z],"S_END",5) == 0) break; - if (Bstrncasecmp(wadata[z],"P_END",5) == 0) break; - - if (curplc != wadplc[z]) Blseek(fil1,wadplc[z],BSEEK_SET); - read(fil1,&tempbuf[0],wadlen[z]); - curplc = wadplc[z]+wadlen[z]; - - xsiz = (int)tempbuf[0]+(((int)tempbuf[1])<<8); - ysiz = (int)tempbuf[2]+(((int)tempbuf[3])<<8); - if ((xsiz <= 0) || (ysiz <= 0) || (xsiz > 320) || (ysiz > 200)) goto skipit; - i = 8; - for(zx=0;zx>2,0xffffffff); - - for(x=0;x> 24) + 4096]; - else c = shlookup[a >> 12]; - a >>= c&0xff; - a = (a&0xffff0000)|(sqrtable[a]); - a >>= ((c&0xff00) >> 8); - - return a; -} - -static inline int msqrtasm(unsigned int c) -{ - unsigned int a,b; - - a = 0x40000000l; - b = 0x20000000l; - do { - if (c >= a) { - c -= a; - a += b*4; - } - a -= b; - a >>= 1; - b >>= 2; - } while (b); - if (c >= a) a++; - a >>= 1; - return a; -} - -static void initksqrt(void) -{ - int i, j, k; - - j = 1; k = 0; - for(i=0;i<4096;i++) - { - if (i >= j) { j <<= 2; k++; } - sqrtable[i] = (unsigned short)(msqrtasm((i<<18)+131072)<<1); - shlookup[i] = (k<<1)+((10-k)<<8); - if (i < 256) shlookup[i+4096] = ((k+6)<<1)+((10-(k+6))<<8); - } -} - - -int inside(int x, int y, short sectnum) -{ - walltype *wal; - int i, x1, y1, x2, y2; - char cnt; - - cnt = 0; - - wal = &wall[sector[sectnum].wallptr]; - for(i=sector[sectnum].wallnum;i>0;i--) - { - y1 = wal->y-y; y2 = wall[wal->point2].y-y; - if ((y1^y2) < 0) - { - x1 = wal->x-x; x2 = wall[wal->point2].x-x; - - if ((x1^x2) < 0) - cnt ^= (x1*y2= 0) - cnt ^= 1; - } - wal++; - } - return(cnt); -} - -int readbyte(void) -{ - if (filpos >= fileng) return(-1); - if ((filpos&16383) == 0) Bread(filhandle,filebuf,16384); - filpos++; - return((int)filebuf[(filpos-1)&16383]); -} - -int readline(void) -{ - int i, ch; - - do - { - do - { - ch = readbyte(); - if (ch < 0) return(0); - } while ((ch == 13) || (ch == 10)); - - i = 0; tempbuf[0] = 0; - while ((ch != 13) && (ch != 10)) - { - if (ch < 0) return(0); - if (ch == ';') - { - do - { - if (ch < 0) return(0); - ch = readbyte(); - } while ((ch != 13) && (ch != 10)); - break; - } - if ((ch == 32) || (ch == 9)) ch = ','; - if ((ch != ',') || (i == 0) || (tempbuf[i-1] != ',')) - { tempbuf[i++] = ch; tempbuf[i] = 0; } - ch = readbyte(); - } - if ((i > 0) && (tempbuf[i-1] == ',')) tempbuf[i-1] = 0; - } while (i <= 0); - return(i); -} - -void parsescript(void) -{ - int i, j, k, l, lasti, breakout, tstart, tend, textnum, frontbackstat; - int spritenumstat, slen; - char ch; - - clearbufbyte(FP_OFF(sectspri),MAXSECTS*8*sizeof(short),0xffffffff); - - if (scriptname[0] == 0) - { - for(i=0;i<4096;i++) texturelookup[i] = i; - return; - } - - if ((filhandle = Bopen(scriptname,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1) - { - printf("Could not find %s\n",scriptname); - exit(0); - } - filpos = 0; fileng = Bfilelength(filhandle); - while (readline() != 0) - { - i = 0; j = 0; lasti = 0; - while (1) - { - if ((tempbuf[i] == ',') || (tempbuf[i] == 0)) - { - if (tempbuf[i] == 0) { breakout = 1; } - else { breakout = 0, tempbuf[i] = 0; } - - if (j == 0) - { - if (tempbuf[lasti] == '[') - { - definemode = 0; - thingtypemode = 0; - texturelookupmode = 0; - tagtypemode = 0; - sectypemode = 0; - } - - if (Bstrcasecmp(&tempbuf[lasti],"#define") == 0) - definemode = 1; - - if (thingtypemode == 1) - { - thingoff[numthings] = thingopnum; - - k = lasti; - while ((tempbuf[k] != 0) && (tempbuf[k] != '-')) k++; - - if (tempbuf[k] == '-') - { - tempbuf[k] = 0; - thingnum[numthings] = atol(&tempbuf[lasti]); - thingnum2[numthings] = atol(&tempbuf[k+1]); - } - else - { - thingnum[numthings] = atol(&tempbuf[lasti]); - thingnum2[numthings] = thingnum[numthings]; - } - - numthings++; - } - else if (Bstrcasecmp(&tempbuf[lasti],"[THINGTYPES]") == 0) - thingtypemode = 1; - - if (texturelookupmode == 1) - { - textnum = 0; - if ((tempbuf[lasti] >= 48) && (tempbuf[lasti] <= 57)) - { - k = lasti; - while ((tempbuf[k] != 0) && (tempbuf[k] != '-')) k++; - - if (tempbuf[k] == '-') - { - tempbuf[k] = 0; - tstart = atol(&tempbuf[lasti]); - tend = atol(&tempbuf[k+1]); - for(k=tstart;k<=tend;k++) - tempshort[textnum++] = k; - } - else - tempshort[textnum++] = atol(&tempbuf[lasti]); - } - else - { - slen = 0; - while (tempbuf[lasti+slen] != 0) - { - ch = tempbuf[lasti+slen]; - if ((ch >= 97) && (ch <= 122)) tempbuf[lasti+slen] -= 32; - slen++; - } - if (slen > 0) - for(k=inumwads-1;k>=0;k--) - if ((iwadata[k][slen] == 0) || (iwadata[k][slen] == 32)) - if ((iwadata[k][slen-1] != 0) && (iwadata[k][slen-1] != 32)) - { - for(l=slen-1;l>=0;l--) - if (tempbuf[lasti+l] != '?') - { - ch = iwadata[k][l]; - if ((ch >= 97) && (ch <= 122)) ch -= 32; - if (tempbuf[lasti+l] != ch) break; - } - if (l < 0) tempshort[textnum++] = k; - } - } - } - else if (Bstrcasecmp(&tempbuf[lasti],"[TEXTURELOOKUPS]") == 0) - texturelookupmode = 1; - - if (tagtypemode == 1) - { - tagoff[numtags] = tagopnum; - - k = lasti; - while ((tempbuf[k] != 0) && (tempbuf[k] != '-')) k++; - - if (tempbuf[k] == '-') - { - tempbuf[k] = 0; - tagnum[numtags] = atol(&tempbuf[lasti]); - tagnum2[numtags] = atol(&tempbuf[k+1]); - } - else - { - tagnum[numtags] = atol(&tempbuf[lasti]); - tagnum2[numtags] = tagnum[numtags]; - } - - numtags++; - } - else if (Bstrcasecmp(&tempbuf[lasti],"[TAGCONVERSIONS]") == 0) - tagtypemode = 1; - - if (sectypemode == 1) - { - secoff[numsecs] = secopnum; - - k = lasti; - while ((tempbuf[k] != 0) && (tempbuf[k] != '-')) k++; - - if (tempbuf[k] == '-') - { - tempbuf[k] = 0; - secnum[numsecs] = atol(&tempbuf[lasti]); - secnum2[numsecs] = atol(&tempbuf[k+1]); - } - else - { - secnum[numsecs] = atol(&tempbuf[lasti]); - secnum2[numsecs] = secnum[numsecs]; - } - numsecs++; - } - else if (Bstrcasecmp(&tempbuf[lasti],"[SECTORCONVERSIONS]") == 0) - sectypemode = 1; - - } - else if (j > 0) - { - if (definemode == 1) - { - defineptr[numdefines] = (char *)(&define[definecnt]); - for(k=lasti;k= 48) && (tempbuf[k+1] <= 57)) - thingval[thingopnum] = atol(&tempbuf[k+1]); - else - { - for(l=0;l= 48) && (tempbuf[lasti] <= 57)) - l = atol(&tempbuf[lasti]); - else - { - for(l=0;l=0;k--) texturelookup[tempshort[k]] = l; - } - - if (tagtypemode == 1) - { - for(k=lasti;k= 48) && (tempbuf[lasti] <= 57)) //1 DIGIT ONLY! - { - spritenumstat = tempbuf[lasti]-48; - lasti++; - } - - if (Bstrcasecmp(&tempbuf[lasti],"sprite.x") == 0) tagfield[tagopnum] = 0; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.y") == 0) tagfield[tagopnum] = 1; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.z") == 0) tagfield[tagopnum] = 2; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.cstat") == 0) tagfield[tagopnum] = 3; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.shade") == 0) tagfield[tagopnum] = 4; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.pal") == 0) tagfield[tagopnum] = 5; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.clipdist") == 0) tagfield[tagopnum] = 6; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.xrepeat") == 0) tagfield[tagopnum] = 7; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.yrepeat") == 0) tagfield[tagopnum] = 8; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.xoffset") == 0) tagfield[tagopnum] = 9; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.yoffset") == 0) tagfield[tagopnum] = 10; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.picnum") == 0) tagfield[tagopnum] = 11; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.ang") == 0) tagfield[tagopnum] = 12; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.xvel") == 0) tagfield[tagopnum] = 13; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.yvel") == 0) tagfield[tagopnum] = 14; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.zvel") == 0) tagfield[tagopnum] = 15; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.owner") == 0) tagfield[tagopnum] = 16; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.sectnum") == 0) tagfield[tagopnum] = 17; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.statnum") == 0) tagfield[tagopnum] = 18; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.lotag") == 0) tagfield[tagopnum] = 19; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.hitag") == 0) tagfield[tagopnum] = 20; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.extra") == 0) tagfield[tagopnum] = 21; - - if (Bstrcasecmp(&tempbuf[lasti],"sector.wallptr") == 0) tagfield[tagopnum] = 32; - if (Bstrcasecmp(&tempbuf[lasti],"sector.wallnum") == 0) tagfield[tagopnum] = 33; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingpicnum") == 0) tagfield[tagopnum] = 34; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorpicnum") == 0) tagfield[tagopnum] = 35; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingheinum") == 0) tagfield[tagopnum] = 36; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorheinum") == 0) tagfield[tagopnum] = 37; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingz") == 0) tagfield[tagopnum] = 38; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorz") == 0) tagfield[tagopnum] = 39; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingshade") == 0) tagfield[tagopnum] = 40; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorshade") == 0) tagfield[tagopnum] = 41; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingxpanning") == 0) tagfield[tagopnum] = 42; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorxpanning") == 0) tagfield[tagopnum] = 43; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingypanning") == 0) tagfield[tagopnum] = 44; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorypanning") == 0) tagfield[tagopnum] = 45; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingstat") == 0) tagfield[tagopnum] = 46; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorstat") == 0) tagfield[tagopnum] = 47; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingpal") == 0) tagfield[tagopnum] = 48; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorpal") == 0) tagfield[tagopnum] = 49; - if (Bstrcasecmp(&tempbuf[lasti],"sector.visibility") == 0) tagfield[tagopnum] = 50; - if (Bstrcasecmp(&tempbuf[lasti],"sector.lotag") == 0) tagfield[tagopnum] = 51; - if (Bstrcasecmp(&tempbuf[lasti],"sector.hitag") == 0) tagfield[tagopnum] = 52; - if (Bstrcasecmp(&tempbuf[lasti],"sector.extra") == 0) tagfield[tagopnum] = 53; - - if (Bstrcasecmp(&tempbuf[lasti],"wall.x") == 0) tagfield[tagopnum] = 64; - if (Bstrcasecmp(&tempbuf[lasti],"wall.y") == 0) tagfield[tagopnum] = 65; - if (Bstrcasecmp(&tempbuf[lasti],"wall.point2") == 0) tagfield[tagopnum] = 66; - if (Bstrcasecmp(&tempbuf[lasti],"wall.nextsector") == 0) tagfield[tagopnum] = 67; - if (Bstrcasecmp(&tempbuf[lasti],"wall.nextwall") == 0) tagfield[tagopnum] = 68; - if (Bstrcasecmp(&tempbuf[lasti],"wall.picnum") == 0) tagfield[tagopnum] = 69; - if (Bstrcasecmp(&tempbuf[lasti],"wall.overpicnum") == 0) tagfield[tagopnum] = 70; - if (Bstrcasecmp(&tempbuf[lasti],"wall.shade") == 0) tagfield[tagopnum] = 71; - if (Bstrcasecmp(&tempbuf[lasti],"wall.pal") == 0) tagfield[tagopnum] = 72; - if (Bstrcasecmp(&tempbuf[lasti],"wall.cstat") == 0) tagfield[tagopnum] = 73; - if (Bstrcasecmp(&tempbuf[lasti],"wall.xrepeat") == 0) tagfield[tagopnum] = 74; - if (Bstrcasecmp(&tempbuf[lasti],"wall.yrepeat") == 0) tagfield[tagopnum] = 75; - if (Bstrcasecmp(&tempbuf[lasti],"wall.xpanning") == 0) tagfield[tagopnum] = 76; - if (Bstrcasecmp(&tempbuf[lasti],"wall.ypanning") == 0) tagfield[tagopnum] = 77; - if (Bstrcasecmp(&tempbuf[lasti],"wall.lotag") == 0) tagfield[tagopnum] = 78; - if (Bstrcasecmp(&tempbuf[lasti],"wall.hitag") == 0) tagfield[tagopnum] = 79; - if (Bstrcasecmp(&tempbuf[lasti],"wall.extra") == 0) tagfield[tagopnum] = 80; - - tagfield[tagopnum] += (frontbackstat<<7) + (spritenumstat<<8); - - if ((tempbuf[k+1] >= 48) && (tempbuf[k+1] <= 57)) - tagval[tagopnum] = atol(&tempbuf[k+1]); - else if (Bstrcasecmp("tag",&tempbuf[k+1]) == 0) - tagval[tagopnum] = 0x80000000; - else - { - for(l=0;l= 48) && (tempbuf[lasti] <= 57)) //1 DIGIT ONLY! - { - spritenumstat = tempbuf[lasti]-48; - lasti++; - } - - if (Bstrcasecmp(&tempbuf[lasti],"sprite.x") == 0) secfield[secopnum] = 0; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.y") == 0) secfield[secopnum] = 1; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.z") == 0) secfield[secopnum] = 2; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.cstat") == 0) secfield[secopnum] = 3; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.shade") == 0) secfield[secopnum] = 4; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.pal") == 0) secfield[secopnum] = 5; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.clipdist") == 0) secfield[secopnum] = 6; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.xrepeat") == 0) secfield[secopnum] = 7; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.yrepeat") == 0) secfield[secopnum] = 8; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.xoffset") == 0) secfield[secopnum] = 9; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.yoffset") == 0) secfield[secopnum] = 10; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.picnum") == 0) secfield[secopnum] = 11; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.ang") == 0) secfield[secopnum] = 12; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.xvel") == 0) secfield[secopnum] = 13; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.yvel") == 0) secfield[secopnum] = 14; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.zvel") == 0) secfield[secopnum] = 15; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.owner") == 0) secfield[secopnum] = 16; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.sectnum") == 0) secfield[secopnum] = 17; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.statnum") == 0) secfield[secopnum] = 18; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.lotag") == 0) secfield[secopnum] = 19; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.hitag") == 0) secfield[secopnum] = 20; - if (Bstrcasecmp(&tempbuf[lasti],"sprite.extra") == 0) secfield[secopnum] = 21; - - if (Bstrcasecmp(&tempbuf[lasti],"sector.wallptr") == 0) secfield[secopnum] = 32; - if (Bstrcasecmp(&tempbuf[lasti],"sector.wallnum") == 0) secfield[secopnum] = 33; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingpicnum") == 0) secfield[secopnum] = 34; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorpicnum") == 0) secfield[secopnum] = 35; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingheinum") == 0) secfield[secopnum] = 36; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorheinum") == 0) secfield[secopnum] = 37; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingz") == 0) secfield[secopnum] = 38; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorz") == 0) secfield[secopnum] = 39; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingshade") == 0) secfield[secopnum] = 40; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorshade") == 0) secfield[secopnum] = 41; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingxpanning") == 0) secfield[secopnum] = 42; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorxpanning") == 0) secfield[secopnum] = 43; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingypanning") == 0) secfield[secopnum] = 44; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorypanning") == 0) secfield[secopnum] = 45; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingstat") == 0) secfield[secopnum] = 46; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorstat") == 0) secfield[secopnum] = 47; - if (Bstrcasecmp(&tempbuf[lasti],"sector.ceilingpal") == 0) secfield[secopnum] = 48; - if (Bstrcasecmp(&tempbuf[lasti],"sector.floorpal") == 0) secfield[secopnum] = 49; - if (Bstrcasecmp(&tempbuf[lasti],"sector.visibility") == 0) secfield[secopnum] = 50; - if (Bstrcasecmp(&tempbuf[lasti],"sector.lotag") == 0) secfield[secopnum] = 51; - if (Bstrcasecmp(&tempbuf[lasti],"sector.hitag") == 0) secfield[secopnum] = 52; - if (Bstrcasecmp(&tempbuf[lasti],"sector.extra") == 0) secfield[secopnum] = 53; - - secfield[secopnum] += (spritenumstat<<8); - - if ((tempbuf[k+1] >= 48) && (tempbuf[k+1] <= 57)) - secval[secopnum] = atol(&tempbuf[k+1]); - else if (Bstrcasecmp("tag",&tempbuf[k+1]) == 0) - secval[secopnum] = 0x80000000; - else - { - for(l=0;l0;j>>=1) - if (i+j < inumwads) - if (Bstrcasecmp(iwadata[slist[i+j]],nam) <= 0) i += j; - if (Bstrcasecmp(iwadata[slist[i]],nam) == 0) return(slist[i]); - return(-1); -} - -int main(int argc, char **argv) -{ - char argstring[5][80]; - char iwadfil[80], pwadfil[80], doommap[16], buildmap[16], picstr[16]; - int w, numwads, numtexts, startnumtexts, danumtexts, numpnames; - int x, y, z, zz, zzz, zzx, zx, cx, cy, gap, p, pp, i, j, k, l, offs; - int dnumpoints, dnumlines, dnumsides, dnumsectors, dnumthings, good; - int minx, maxx, miny, maxy, numsectors, numwalls, wadtype; - int startnumwalls, l1, l2, startpoint2, dapoint2, area; - int fil, ifil, pfil, x1, y1, x2, y2, startwall, endwall; - int mapversion, posx, posy, posz, tempint, cnt, boardwadindex; - short ang, cursectnum; - - printf("Wad2Map! Copyright 1995 by Ken Silverman\n"); - - if ((argc < 3) || (argc > 5)) - { - printf("Command line parameters: Wad2Map (PWADName) IWADName MapName (ScriptName)\n"); - printf(" Ex #1: wad2map c:\\doom\\doom.wad e1m1\n"); - printf(" Ex #2: wad2map c:\\doom\\doom.wad e1m1 kenbuild.txt\n"); - printf(" Ex #3: wad2map c:\\doom\\mypwad.wad c:\\doom\\doom.wad e1m1\n"); - printf(" Ex #4: wad2map c:\\doom\\mypwad.wad c:\\doom\\doom.wad e1m1 kenbuild.txt\n"); - exit(0); - } - - for(i=1;i>1);gap>0;gap>>=1) - for(z=0;z=0;zz-=gap) - { - if (Bstrcasecmp(iwadata[slist[zz]],iwadata[slist[zz+gap]]) <= 0) break; - i = slist[zz]; slist[zz] = slist[zz+gap]; slist[zz+gap] = i; - } - - if (ifil != pfil) - { - Bread(pfil,&pnumwads,4); - Bread(pfil,&pwadstart,4); - Blseek(pfil,pwadstart,SEEK_SET); - for(z=0;z= 0) - { - Blseek(ifil,iwadplc[w],BSEEK_SET); - startnumtexts = numtexts; - Bread(ifil,&danumtexts,4); numtexts += danumtexts; - Bread(ifil,&textoffs[startnumtexts],(numtexts-startnumtexts)*sizeof(int)); - for(z=startnumtexts;z=boardwadindex;w--) - { - Blseek(pfil,pwadplc[w],BSEEK_SET); - - if (Bstrcasecmp(pwadata[w],"VERTEXES") == 0) - { - dnumpoints = (pwadlen[w]>>2); - Bread(pfil,tempbuf,pwadlen[w]); - offs = 0; - for(z=0;z maxx) maxx = x; - if (y < miny) miny = y; - if (y > maxy) maxy = y; - } - cx = (((minx+maxx)>>1)&0xffffffc0); - cy = (((miny+maxy)>>1)&0xffffffc0); - - numwalls = 0; - - for(z=0;z= 0) && (z == side[line[zz].side2].sect)) - { - wx[numwalls] = px[line[zz].p2]; wy[numwalls] = py[line[zz].p2]; - wx2[numwalls] = px[line[zz].p1]; wy2[numwalls] = py[line[zz].p1]; - picindex[numwalls] = line[zz].side2; linindex[numwalls++] = zz; - } - } - - startpoint2 = startnumwalls; - for(zz=startnumwalls;zz 0)) j = 2; - else if ((wx2[zz+1]-x)*(wy2[zzz]-y) > (wy2[zz+1]-y)*(wx2[zzz]-x)) j = 2; - - if (j == 2) - { - i = wx[zz+1]; wx[zz+1] = wx[zzz]; wx[zzz] = i; - i = wy[zz+1]; wy[zz+1] = wy[zzz]; wy[zzz] = i; - i = wx2[zz+1]; wx2[zz+1] = wx2[zzz]; wx2[zzz] = i; - i = wy2[zz+1]; wy2[zz+1] = wy2[zzz]; wy2[zzz] = i; - i = picindex[zz+1]; picindex[zz+1] = picindex[zzz]; picindex[zzz] = i; - i = linindex[zz+1]; linindex[zz+1] = linindex[zzz]; linindex[zzz] = i; - } - } - point2[zz] = zz+1; - } - if (j == 0) point2[zz] = startpoint2, startpoint2 = zz+1; - } - - sector[z].wallptr = startnumwalls; - sector[z].wallnum = numwalls-startnumwalls; - } - - //Collect sectors - for(z=0;z>3); - if ((sector[z].ceilingstat&1) == 0) sector[z].ceilingshade = j; - if ((sector[z].floorstat&1) == 0) sector[z].floorshade = j; - for(i=startwall;i>1);gap>0;gap>>=1) - for(z=0;z=0;zz-=gap) - { - if (wx[slist[zz]] <= wx[slist[zz+gap]]) break; - i = slist[zz]; slist[zz] = slist[zz+gap]; slist[zz+gap] = i; - } - - for(z=0;z>= 1; - if ((zz+zzz < numwalls) && (wx[slist[zz+zzz]] < x2)) zz += zzz; - zzz >>= 1; - } while (zzz > 0); - - do - { - zzx = slist[zz]; - if (wx[zzx] > x2) break; - if (wy[zzx] == y2) - if ((wx[point2[zzx]] == x1) && (wy[point2[zzx]] == y1)) - { - wall[z].nextwall = zzx; - wall[z].nextsector = sectorofwall[zzx]; - break; - } - zz++; - } while (zz < numwalls); - - if (wall[z].nextwall < 0) - { - wall[z].picnum = sidemidpic[picindex[z]]; - wall[z].overpicnum = 0; - } - else - { - wall[z].picnum = sidetoppic[picindex[z]]; - if (wall[z].picnum <= 0) wall[z].picnum = sidebotpic[picindex[z]]; - if ((wall[z].picnum <= 0) && (wall[z].nextwall >= 0)) - { - zx = picindex[wall[z].nextwall]; - wall[z].picnum = sidetoppic[zx]; - if (wall[z].picnum <= 0) wall[z].picnum = sidebotpic[zx]; - } - wall[z].overpicnum = sidemidpic[picindex[z]]; - if (wall[z].overpicnum >= 0) wall[z].cstat |= (1+4+16); - } - wall[z].xrepeat = 8; - wall[z].yrepeat = 8; - wall[z].xpanning = (char)((-side[picindex[z]].xoffset)&255); - wall[z].ypanning = (char)(((side[picindex[z]].yoffset<<1))&255); - - if (line[linindex[z]].flags&1) wall[z].cstat |= 1; - //if (wall[z].nextwall >= 0) wall[z].cstat |= 4; - //if ((line[linindex[z]].flags&24) && (wall[z].nextwall >= 0)) - // wall[z].cstat |= 4; - } - - for(z=0;z= thingnum[i]) && (thing[z].type <= thingnum2[i])) - for(j=thingoff[i];j tagnum2[i])) continue; - - for(j=tagoff[i];j= 0) - if ((tagfield[j]&128) ^ (picindex[zx] == line[z].side1)) - l = wall[zx].nextsector; - - zzz = sectspri[l][(tagfield[j]>>8)&7]; - if (zzz < 0) - { - zzz = dnumthings++; - sectspri[l][(tagfield[j]>>8)&7] = zzz; - zzx = sector[l].wallptr; x1 = wall[zzx].x; y1 = wall[zzx].y; - zzx = wall[zzx].point2; x2 = wall[zzx].x; y2 = wall[zzx].y; - sprite[zzz].x = ((x1+x2)>>1) + ksgn(y1-y2); - sprite[zzz].y = ((y1+y2)>>1) + ksgn(x2-x1); - sprite[zzz].sectnum = l; - sprite[zzz].z = sector[l].floorz; - sprite[zzz].clipdist = 32; - sprite[zzz].xrepeat = 64; - sprite[zzz].yrepeat = 64; - } - - switch(tagop[j]) - { - case 0: setspritefield(zzz,k,zz); break; - case 1: setspritefield(zzz,k,getspritefield(zzz,k)+zz); break; - case 2: setspritefield(zzz,k,getspritefield(zzz,k)-zz); break; - case 3: setspritefield(zzz,k,getspritefield(zzz,k)|zz); break; - case 4: setspritefield(zzz,k,getspritefield(zzz,k)&zz); break; - case 5: setspritefield(zzz,k,getspritefield(zzz,k)^zz); break; - } - } - else if (k < 64) - { - l = sectorofwall[zx]; - if (wall[zx].nextsector >= 0) - if ((tagfield[j]&128) ^ (picindex[zx] == line[z].side1)) - l = wall[zx].nextsector; - - switch(tagop[j]) - { - case 0: setsectorfield(l,k,zz); break; - case 1: setsectorfield(l,k,getsectorfield(l,k)+zz); break; - case 2: setsectorfield(l,k,getsectorfield(l,k)-zz); break; - case 3: setsectorfield(l,k,getsectorfield(l,k)|zz); break; - case 4: setsectorfield(l,k,getsectorfield(l,k)&zz); break; - case 5: setsectorfield(l,k,getsectorfield(l,k)^zz); break; - } - } - else if (k < 96) - { - l = zx; - if (wall[zx].nextwall >= 0) - if ((tagfield[j]&128) ^ (picindex[zx] == line[z].side1)) - l = wall[zx].nextwall; - - switch(tagop[j]) - { - case 0: setwallfield(l,k,zz); break; - case 1: setwallfield(l,k,getwallfield(l,k)+zz); break; - case 2: setwallfield(l,k,getwallfield(l,k)-zz); break; - case 3: setwallfield(l,k,getwallfield(l,k)|zz); break; - case 4: setwallfield(l,k,getwallfield(l,k)&zz); break; - case 5: setwallfield(l,k,getwallfield(l,k)^zz); break; - } - } - } - } - } - - for(l=0;l= secnum[i]) && (sect[l].type <= secnum2[i])) - { - for(j=secoff[i];j>8)&7]; - if (zzz < 0) - { - zzz = dnumthings++; - sectspri[l][(secfield[j]>>8)&7] = zzz; - zzx = sector[l].wallptr; x1 = wall[zzx].x; y1 = wall[zzx].y; - zzx = wall[zzx].point2; x2 = wall[zzx].x; y2 = wall[zzx].y; - sprite[zzz].x = ((x1+x2)>>1) + ksgn(y1-y2); - sprite[zzz].y = ((y1+y2)>>1) + ksgn(x2-x1); - sprite[zzz].sectnum = l; - sprite[zzz].z = sector[l].floorz; - sprite[zzz].clipdist = 32; - sprite[zzz].xrepeat = 64; - sprite[zzz].yrepeat = 64; - } - - switch(secop[j]) - { - case 0: setspritefield(zzz,k,zz); break; - case 1: setspritefield(zzz,k,getspritefield(zzz,k)+zz); break; - case 2: setspritefield(zzz,k,getspritefield(zzz,k)-zz); break; - case 3: setspritefield(zzz,k,getspritefield(zzz,k)|zz); break; - case 4: setspritefield(zzz,k,getspritefield(zzz,k)&zz); break; - case 5: setspritefield(zzz,k,getspritefield(zzz,k)^zz); break; - } - } - else if (k < 64) - { - switch(secop[j]) - { - case 0: setsectorfield(l,k,zz); break; - case 1: setsectorfield(l,k,getsectorfield(l,k)+zz); break; - case 2: setsectorfield(l,k,getsectorfield(l,k)-zz); break; - case 3: setsectorfield(l,k,getsectorfield(l,k)|zz); break; - case 4: setsectorfield(l,k,getsectorfield(l,k)&zz); break; - case 5: setsectorfield(l,k,getsectorfield(l,k)^zz); break; - } - } - } - } - - for(z=0;z= 32768) || (klabs(y) >= 32768)) - wall[z].xrepeat = 255; - else - { - zx = mulscale10(ksqrtasm(x*x+y*y),wall[z].yrepeat); - wall[z].xrepeat = (char)min(max(zx,1),255); - } - - wall[z].picnum = texturelookup[wall[z].picnum]; - wall[z].overpicnum = texturelookup[wall[z].overpicnum]; - } - - mapversion = 7; posx = 0; posy = 0; posz = 0; ang = 1536; cursectnum = 0; - - //WATCH OUT THAT FOR DNUMTHINGS BEING HIGHER THAN NUMBER ON DOOM MAP! - for(i=0;i -#include -#include -#ifndef DIK_PAUSE -# define DIK_PAUSE 0xC5 -#endif -#include - -#ifdef _MSC_VER -#include -#endif - -#include "dxdidf.h" // comment this out if c_dfDI* is being reported as multiply defined -#include -#include -#include - -#ifdef USE_OPENGL -#include "glbuild.h" -#endif - -#include "compat.h" -#include "winlayer.h" -#include "pragmas.h" -#include "build.h" -#include "a.h" -#include "osd.h" -#include "rawinput.h" -#include "nedmalloc.h" -#include "mutex.h" - -// undefine to restrict windowed resolutions to conventional sizes -#define ANY_WINDOWED_SIZE - -static mutex_t m_initprintf; - -int32_t _buildargc = 0; -const char **_buildargv = NULL; -static char *argvbuf = NULL; -extern int32_t app_main(int32_t argc, const char *argv[]); -extern void app_crashhandler(void); - -// Windows crud -static HINSTANCE hInstance = 0; -static HWND hWindow = 0; -#define WINDOW_STYLE (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX) -#define WindowClass "buildapp" -static BOOL window_class_registered = FALSE; -static HANDLE instanceflag = NULL; - -int32_t backgroundidle = 1; - -static WORD sysgamma[3][256]; -extern int32_t curbrightness, gammabrightness; - -#ifdef USE_OPENGL -// OpenGL stuff -static HGLRC hGLRC = 0; -char nofog=0; -char nogl=0; -char forcegl=0; -#endif - -static LPTSTR GetWindowsErrorMsg(DWORD code); -static const char *GetDDrawError(HRESULT code); -static const char *GetDInputError(HRESULT code); -static void ShowErrorBox(const char *m); -static void ShowDDrawErrorBox(const char *m, HRESULT r); -static void ShowDInputErrorBox(const char *m, HRESULT r); -static inline BOOL CheckWinVersion(void); -static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -static BOOL InitDirectDraw(void); -static void UninitDirectDraw(void); -static int32_t RestoreDirectDrawMode(void); -static void ReleaseDirectDrawSurfaces(void); -static BOOL InitDirectInput(void); -static void UninitDirectInput(void); -static void GetKeyNames(void); -static void AcquireInputDevices(char acquire); -static inline void DI_PollJoysticks(void); -static int32_t SetupDirectDraw(int32_t width, int32_t height); -static void UninitDIB(void); -static int32_t SetupDIB(int32_t width, int32_t height); -static void ReleaseOpenGL(void); -static void UninitOpenGL(void); -static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp); -static BOOL RegisterWindowClass(void); -static BOOL CreateAppWindow(int32_t modenum); -static void DestroyAppWindow(void); - -// video -static int32_t desktopxdim=0; -static int32_t desktopydim=0; -static int32_t desktopbpp=0; -static int32_t modesetusing=-1; -static int32_t curvidmode = -1; -static int32_t customxdim = 640; -static int32_t customydim = 480; -static int32_t custombpp = 8; -static int32_t customfs = 0; -static uint32_t modeschecked=0; -int32_t xres=-1; -int32_t yres=-1; -int32_t fullscreen=0; -int32_t bpp=0; -int32_t bytesperline=0; -int32_t imageSize=0; -int32_t lockcount=0; -int32_t glcolourdepth=32; -int32_t vsync=0; -uint32_t maxrefreshfreq=60; -intptr_t frameplace=0; -char modechange=1; -char repaintneeded=0; -char offscreenrendering=0; -char videomodereset = 0; -char silentvideomodeswitch = 0; - -// input and events -char quitevent=0; -char appactive=1; -char realfs=0; -char regrabmouse=0; -uint32_t mousewheel[2] = { 0,0 }; - -static char taskswitching=1; - -static OSVERSIONINFOEX osv; - -#ifdef NEDMALLOC -extern int32_t largepagesavailable; -#else -static HMODULE nedhandle = NULL; -#endif - - -//------------------------------------------------------------------------------------------------- -// DINPUT (JOYSTICK) -//================================================================================================= - -#define JOYSTICK 0 - -static HMODULE hDInputDLL = NULL; -static LPDIRECTINPUT7A lpDI = NULL; -static LPDIRECTINPUTDEVICE7A lpDID = NULL; -#define INPUT_BUFFER_SIZE 32 -static GUID guidDevs; - -char di_disabled = 0; -static char di_devacquired; -static HANDLE di_inputevt = 0; -static int32_t joyblast=0; -volatile uint8_t moustat = 0, mousegrab = 0; - -static struct -{ - char *name; - LPDIRECTINPUTDEVICE7A *did; - const DIDATAFORMAT *df; -} devicedef = { "joystick", &lpDID, &c_dfDIJoystick }; - -static struct _joydef -{ - const char *name; - uint32_t ofs; // directinput 'dwOfs' value -} *axisdefs = NULL, *buttondefs = NULL, *hatdefs = NULL; - - - -//------------------------------------------------------------------------------------------------- -// MAIN CRAP -//================================================================================================= - - -// -// win_gethwnd() -- gets the window handle -// -int32_t win_gethwnd(void) -{ - return (int32_t)hWindow; -} - - -// -// win_gethinstance() -- gets the application instance -// -int32_t win_gethinstance(void) -{ - return (int32_t)hInstance; -} - - -// -// win_allowtaskswitching() -- captures/releases alt+tab hotkeys -// -void win_allowtaskswitching(int32_t onf) -{ - if (onf == taskswitching) return; - - if (onf) - { - UnregisterHotKey(0,0); - UnregisterHotKey(0,1); - } - else - { - RegisterHotKey(0,0,MOD_ALT,VK_TAB); - RegisterHotKey(0,1,MOD_ALT|MOD_SHIFT,VK_TAB); - } - - taskswitching = onf; -} - - -// -// win_checkinstance() -- looks for another instance of a Build app -// -int32_t win_checkinstance(void) -{ - if (!instanceflag) return 0; - return (WaitForSingleObject(instanceflag,0) == WAIT_TIMEOUT); -} - - -// -// wm_msgbox/wm_ynbox() -- window-manager-provided message boxes -// -int32_t wm_msgbox(char *name, char *fmt, ...) -{ - char buf[2048]; - va_list va; - - va_start(va,fmt); - vsprintf(buf,fmt,va); - va_end(va); - - MessageBox(hWindow,buf,name,MB_OK|MB_TASKMODAL); - return 0; -} - - -int32_t wm_ynbox(char *name, char *fmt, ...) -{ - char buf[2048]; - va_list va; - int32_t r; - - va_start(va,fmt); - vsprintf(buf,fmt,va); - va_end(va); - - r = MessageBox((HWND)win_gethwnd(),buf,name,MB_YESNO|MB_ICONQUESTION|MB_TASKMODAL); - if (r==IDYES) return 1; - return 0; -} - -// -// wm_setapptitle() -- changes the window title -// -void wm_setapptitle(char *name) -{ - if (name) - { - Bstrncpy(apptitle, name, sizeof(apptitle)-1); - apptitle[ sizeof(apptitle)-1 ] = 0; - } - - if (hWindow) SetWindowText(hWindow, apptitle); - startwin_settitle(apptitle); -} - -static int32_t setgammaramp(WORD gt[3][256]); - -// -// SignalHandler() -- called when we've sprung a leak -// -static void SignalHandler(int32_t signum) -{ - switch (signum) - { - case SIGSEGV: - OSD_Printf("Fatal Signal caught: SIGSEGV. Bailing out.\n"); - if (gammabrightness) - setgammaramp(sysgamma); - gammabrightness = 0; - app_crashhandler(); - uninitsystem(); - if (stdout) fclose(stdout); - break; - default: - break; - } -} - -// -// WinMain() -- main Windows entry point -// -int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int32_t nCmdShow) -{ - int32_t r; - char *argp; - FILE *fp; - HDC hdc; - - UNREFERENCED_PARAMETER(lpCmdLine); - UNREFERENCED_PARAMETER(nCmdShow); - - hInstance = hInst; - -#ifdef _MSC_VER - _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF); -#endif - - if (!CheckWinVersion() || hPrevInst) - { - MessageBox(0, "This application requires Windows XP or better to run.", - apptitle, MB_OK|MB_ICONSTOP); - return -1; - } - -#ifdef NEDMALLOC - /* Attempt to enable SeLockMemoryPrivilege, 2003/Vista/7 only */ - if (Bgetenv("BUILD_NOLARGEPAGES") == NULL && - (osv.dwMajorVersion >= 6 || (osv.dwMajorVersion == 5 && osv.dwMinorVersion == 2))) - { - HANDLE token; - if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token)) - { - TOKEN_PRIVILEGES privs; - privs.PrivilegeCount = 1; - if (LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME, &privs.Privileges[0].Luid)) - { - privs.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED; - - if (!AdjustTokenPrivileges(token, FALSE, &privs, 0, NULL, NULL) || GetLastError() != S_OK) - { - // failure... - largepagesavailable = 0; - } - } - CloseHandle(token); - } - } - - nedcreatepool(SYSTEM_POOL_SIZE, -1); - // atexit(neddestroysyspool); -#else - // don't want to mix msvcrt with msvcrtd! -#ifndef DEBUGGINGAIDS - if ((nedhandle = LoadLibrary("nedmalloc.dll"))) - { - nedpool *(WINAPI *nedcreatepool)(size_t, int); - - if ((nedcreatepool = (void *)GetProcAddress(nedhandle, "nedcreatepool"))) - nedcreatepool(SYSTEM_POOL_SIZE, -1); - } -#endif -#endif - -#ifdef DEBUGGINGAIDS - LoadLibraryA("backtrace.dll"); -#endif - - hdc = GetDC(NULL); - r = GetDeviceCaps(hdc, BITSPIXEL); - ReleaseDC(NULL, hdc); - if (r < 8) - { - MessageBox(0, "This application requires a desktop color depth of 256-colors or better.", - apptitle, MB_OK|MB_ICONSTOP); - return -1; - } - - // carve up the commandline into more recognizable pieces - argvbuf = Bstrdup(GetCommandLine()); - _buildargc = 0; - if (argvbuf) - { - char quoted = 0, instring = 0, swallownext = 0; - char *p,*wp; int32_t i; - for (p=wp=argvbuf; *p; p++) - { - if (*p == ' ') - { - if (instring && !quoted) - { - // end of a string - *(wp++) = 0; - instring = 0; - } - else if (instring) - { - *(wp++) = *p; - } - } - else if (*p == '"' && !swallownext) - { - if (instring && quoted) - { - // end of a string - if (p[1] == ' ') - { - *(wp++) = 0; - instring = 0; - quoted = 0; - } - else - { - quoted = 0; - } - } - else if (instring && !quoted) - { - quoted = 1; - } - else if (!instring) - { - instring = 1; - quoted = 1; - _buildargc++; - } - } - else if (*p == '\\' && p[1] == '"' && !swallownext) - { - swallownext = 1; - } - else - { - if (!instring) _buildargc++; - instring = 1; - *(wp++) = *p; - swallownext = 0; - } - } - *wp = 0; - - _buildargv = (const char **)Bmalloc(sizeof(char *)*_buildargc); - wp = argvbuf; - for (i=0; i<_buildargc; i++,wp++) - { - _buildargv[i] = wp; - while (*wp) wp++; - } - } - - // pipe standard outputs to files - if ((argp = Bgetenv("BUILD_LOGSTDOUT")) != NULL) - if (!Bstrcasecmp(argp, "TRUE")) - { - fp = freopen("stdout.txt", "w", stdout); - if (!fp) - { - fp = fopen("stdout.txt", "w"); - } - if (fp) setvbuf(fp, 0, _IONBF, 0); - *stdout = *fp; - *stderr = *fp; - } - -#ifdef USE_OPENGL - if ((argp = Bgetenv("BUILD_NOFOG")) != NULL) - nofog = Batol(argp); - if (Bgetenv("BUILD_FORCEGL") != NULL) - forcegl = 1; -#endif - - // install signal handlers -#if !defined(_MSC_VER) || !defined(DEBUGGINGAIDS) - signal(SIGSEGV, SignalHandler); -#endif - - if (RegisterWindowClass()) return -1; - -#ifdef DISCLAIMER - MessageBox(0, - DISCLAIMER, - "Notice", - MB_OK|MB_ICONINFORMATION); -#endif - - // atexit(uninitsystem); - - instanceflag = CreateSemaphore(NULL, 1,1, WindowClass); - - startwin_open(); - baselayer_init(); - - r = app_main(_buildargc, _buildargv); - - fclose(stdout); - - if (r) Sleep(3000); - - startwin_close(); - if (instanceflag) CloseHandle(instanceflag); - - if (argvbuf) Bfree(argvbuf); - - return r; -} - - -static int32_t set_maxrefreshfreq(const osdfuncparm_t *parm) -{ - int32_t freq; - if (parm->numparms == 0) - { - if (maxrefreshfreq == 0) - OSD_Printf("\"maxrefreshfreq\" is \"No maximum\"\n"); - else - OSD_Printf("\"maxrefreshfreq\" is \"%d\"\n",maxrefreshfreq); - return OSDCMD_OK; - } - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - freq = Batol(parm->parms[0]); - if (freq < 0) return OSDCMD_SHOWHELP; - - maxrefreshfreq = (unsigned)freq; - modeschecked = 0; - - return OSDCMD_OK; -} - -static int32_t set_windowpos(const osdfuncparm_t *parm) -{ - if (parm->numparms == 0) - { - OSD_Printf("\"r_windowpositioning\" is \"%d\"\n",windowpos); - return OSDCMD_OK; - } - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - windowpos = Batol(parm->parms[0])>0; - OSD_Printf("r_windowpositioning %d\n",windowpos); - - return OSDCMD_OK; -} - -// -// initsystem() -- init systems -// - -static void win_printversion(void) -{ - const char *ver = ""; - - switch (osv.dwPlatformId) - { - case VER_PLATFORM_WIN32_NT: - if (osv.dwMajorVersion == 5) - { - switch (osv.dwMinorVersion) - { - case 1: - ver = "XP"; - break; - case 2: - ver = osv.wProductType == VER_NT_WORKSTATION ? "XP x64" : "Server 2003"; - break; - } - break; - } - - if (osv.dwMajorVersion == 6) - { - switch (osv.dwMinorVersion) - { - case 0: - ver = osv.wProductType == VER_NT_WORKSTATION ? "Vista" : "Server 2008"; - break; - case 1: - ver = osv.wProductType == VER_NT_WORKSTATION ? "7" : "Server 2008 R2"; - break; - } - break; - } - break; - } - - initprintf("Windows %s (build %lu.%lu.%lu) %s", ver, - osv.dwMajorVersion, osv.dwMinorVersion, osv.dwBuildNumber, osv.szCSDVersion); - -#ifdef NEDMALLOC - initprintf("\n"); - - if (largepagesavailable) - initprintf("Large page support available\n"); -#else - initprintf(nedhandle ? "\nInitialized nedmalloc\n" : "\n"); -#endif - -} - - -int32_t initsystem(void) -{ - DEVMODE desktopmode; - - // initprintf("Initializing Windows DirectX/GDI system interface\n"); - - mutex_init(&m_initprintf); - - // get the desktop dimensions before anything changes them - ZeroMemory(&desktopmode, sizeof(DEVMODE)); - desktopmode.dmSize = sizeof(DEVMODE); - EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&desktopmode); - - desktopxdim = desktopmode.dmPelsWidth; - desktopydim = desktopmode.dmPelsHeight; - desktopbpp = desktopmode.dmBitsPerPel; - - memset(curpalette, 0, sizeof(palette_t) * 256); - - atexit(uninitsystem); - - frameplace=0; - lockcount=0; - - win_printversion(); - -#ifdef USE_OPENGL - if (loadgldriver(getenv("BUILD_GLDRV"))) - { - initprintf("Failure loading OpenGL. GL modes are unavailable.\n"); - nogl = 1; - } -#endif - - // try and start DirectDraw - if (InitDirectDraw()) - initprintf("DirectDraw initialization failed. Fullscreen modes will be unavailable.\n"); - - OSD_RegisterFunction("maxrefreshfreq", "maxrefreshfreq: maximum display frequency to set for OpenGL Polymost modes (0=no maximum)", set_maxrefreshfreq); - OSD_RegisterFunction("r_windowpositioning", "r_windowpositioning: enable/disable window position memory", set_windowpos); - return 0; -} - - -// -// uninitsystem() -- uninit systems -// -void uninitsystem(void) -{ - DestroyAppWindow(); - - startwin_close(); - - uninitinput(); - uninittimer(); - - win_allowtaskswitching(1); - -#ifdef USE_OPENGL - unloadgldriver(); -#endif - -#ifndef NEDMALLOC - // if (nedhandle) FreeLibrary(nedhandle), nedhandle = NULL; -#endif -} - - -// -// initprintf() -- prints a string to the intitialization window -// -void initprintf(const char *f, ...) -{ - va_list va; - char buf[2048]; - static char dabuf[2048]; - - va_start(va, f); - Bvsnprintf(buf, sizeof(buf), f, va); - va_end(va); - - OSD_Printf(buf); - - mutex_lock(&m_initprintf); - if ((Bstrlen(dabuf) + Bstrlen(buf) + 2) > sizeof(dabuf)) - { - startwin_puts(dabuf); - Bmemset(dabuf, 0, sizeof(dabuf)); - } - - Bstrcat(dabuf,buf); - - if (flushlogwindow || Bstrlen(dabuf) > 768) - { - startwin_puts(dabuf); - handleevents(); - Bmemset(dabuf, 0, sizeof(dabuf)); - } - mutex_unlock(&m_initprintf); -} - - -// -// debugprintf() -- sends a debug string to the debugger -// -void debugprintf(const char *f, ...) -{ -#if 0 // def DEBUGGINGAIDS - va_list va; - char buf[1024]; - - if (!IsDebuggerPresent()) return; - - va_start(va,f); - Bvsnprintf(buf, 1024, f, va); - va_end(va); - - OutputDebugString(buf); -#else - UNREFERENCED_PARAMETER(f); -#endif -} - - -// -// handleevents() -- process the Windows message queue -// returns !0 if there was an important event worth checking (like quitting) -// -int32_t handleevents(void) -{ - int32_t rv=0; - MSG msg; - - //if (frameplace && fullscreen) printf("Offscreen buffer is locked!\n"); - - RI_PollDevices(TRUE); - - if (hDInputDLL) - DI_PollJoysticks(); - - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - switch (msg.message) - { - case WM_QUIT: - quitevent = 1; - continue; - case WM_INPUT: - // this call to RI_PollDevices() probably isn't necessary - // RI_PollDevices(FALSE); - RI_ProcessMessage(&msg); - continue; - } - - if (startwin_idle((void *)&msg) > 0) continue; - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if (!appactive || quitevent) rv = -1; - - sampletimer(); - - if (after_handleevents_hook) - after_handleevents_hook(); - - return rv; -} - - -// -// initinput() -- init input system -// -int32_t initinput(void) -{ - int32_t i; - char layoutname[KL_NAMELENGTH]; - - moustat=0; - memset(keystatus, 0, sizeof(keystatus)); - - if (!remapinit) - for (i=0; i<256; i++) - remap[i]=i; - - remapinit=1; - keyfifoplc = keyfifoend = 0; - keyasciififoplc = keyasciififoend = 0; - - inputdevices = 1|2; - joyisgamepad = joynumaxes = joynumbuttons = joynumhats=0; - - // 00000409 is "American English" - - GetKeyboardLayoutName(layoutname); - if (Bstrcmp(layoutname, "00000409")) - { - initprintf("Switching kb layout from %s ",layoutname); - LoadKeyboardLayout("00000409", KLF_ACTIVATE|KLF_SETFORPROCESS|KLF_SUBSTITUTE_OK); - GetKeyboardLayoutName(layoutname); - initprintf("to %s\n",layoutname); - } - - GetKeyNames(); - InitDirectInput(); - - return 0; -} - - -// -// uninitinput() -- uninit input system -// -void uninitinput(void) -{ - uninitmouse(); - UninitDirectInput(); -} - - -inline void idle_waitevent_timeout(uint32_t timeout) -{ - // timeout becomes a completion deadline - timeout += getticks(); - - do - { - MSG msg; - - if (PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_QS_INPUT)) - { - RI_PollDevices(TRUE); - return; - } - - Sleep(10); - } - while (timeout > (getticks() + 10)); -} - -inline void idle_waitevent(void) -{ - idle_waitevent_timeout(100); -} - -inline void idle(void) -{ - idle_waitevent(); -} - -// -// setjoydeadzone() -- sets the dead and saturation zones for the joystick -// -void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur) -{ - DIPROPDWORD dipdw; - HRESULT result; - - if (!lpDID) return; - - if (dead > 10000) dead = 10000; - if (satur > 10000) satur = 10000; - if (dead >= satur) dead = satur-100; - if (axis >= joynumaxes) return; - - memset(&dipdw, 0, sizeof(dipdw)); - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - if (axis < 0) - { - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - } - else - { - dipdw.diph.dwObj = axisdefs[axis].ofs; - dipdw.diph.dwHow = DIPH_BYOFFSET; - } - dipdw.dwData = dead; - - result = IDirectInputDevice7_SetProperty(lpDID, DIPROP_DEADZONE, &dipdw.diph); - if (FAILED(result)) - { - //ShowDInputErrorBox("Failed setting joystick dead zone", result); - initprintf("Failed setting joystick dead zone: %s\n", GetDInputError(result)); - return; - } - - dipdw.dwData = satur; - - result = IDirectInputDevice7_SetProperty(lpDID, DIPROP_SATURATION, &dipdw.diph); - if (FAILED(result)) - { - //ShowDInputErrorBox("Failed setting joystick saturation point", result); - initprintf("Failed setting joystick saturation point: %s\n", GetDInputError(result)); - return; - } -} - - -// -// getjoydeadzone() -- gets the dead and saturation zones for the joystick -// -void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur) -{ - DIPROPDWORD dipdw; - HRESULT result; - - if (!dead || !satur) return; - if (!lpDID) { *dead = *satur = 0; return; } - if (axis >= joynumaxes) { *dead = *satur = 0; return; } - - memset(&dipdw, 0, sizeof(dipdw)); - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - if (axis < 0) - { - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - } - else - { - dipdw.diph.dwObj = axisdefs[axis].ofs; - dipdw.diph.dwHow = DIPH_BYOFFSET; - } - - result = IDirectInputDevice7_GetProperty(lpDID, DIPROP_DEADZONE, &dipdw.diph); - if (FAILED(result)) - { - //ShowDInputErrorBox("Failed getting joystick dead zone", result); - initprintf("Failed getting joystick dead zone: %s\n", GetDInputError(result)); - return; - } - - *dead = dipdw.dwData; - - result = IDirectInputDevice7_GetProperty(lpDID, DIPROP_SATURATION, &dipdw.diph); - if (FAILED(result)) - { - //ShowDInputErrorBox("Failed getting joystick saturation point", result); - initprintf("Failed getting joystick saturation point: %s\n", GetDInputError(result)); - return; - } - - *satur = dipdw.dwData; -} - - -void releaseallbuttons(void) -{ - int32_t i; - - if (mousepresscallback) - { - if (mouseb & 1) mousepresscallback(1, 0); - if (mouseb & 2) mousepresscallback(2, 0); - if (mouseb & 4) mousepresscallback(3, 0); - if (mouseb & 8) mousepresscallback(4, 0); - if (mousewheel[0]>0) mousepresscallback(5,0); - if (mousewheel[1]>0) mousepresscallback(6,0); - } - mousewheel[0]=mousewheel[1]=0; - mouseb = 0; - - if (joypresscallback) - { - for (i=0; i<32; i++) - if (joyb & (1<dwDevType&0xff) != DIDEVTYPE_JOYSTICK) - return DIENUM_CONTINUE; - - inputdevices |= 4; - joyisgamepad = ((lpddi->dwDevType & (DIDEVTYPEJOYSTICK_GAMEPAD<<8)) != 0); - d = joyisgamepad ? "GAMEPAD" : "JOYSTICK"; - Bmemcpy(&guidDevs, &lpddi->guidInstance, sizeof(GUID)); - - initprintf(" * %s: %s\n", d, lpddi->tszProductName); - - return DIENUM_CONTINUE; -} - -static BOOL CALLBACK InitDirectInput_enumobjects(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) -{ - int32_t *typecounts = (int32_t *)pvRef; - - if (lpddoi->dwType & DIDFT_AXIS) - { - //initprintf(" Axis: %s (dwOfs=%d)\n", lpddoi->tszName, lpddoi->dwOfs); - - axisdefs[ typecounts[0] ].name = Bstrdup(lpddoi->tszName); - axisdefs[ typecounts[0] ].ofs = lpddoi->dwOfs; - - typecounts[0]++; - } - else if (lpddoi->dwType & DIDFT_BUTTON) - { - //initprintf(" Button: %s (dwOfs=%d)\n", lpddoi->tszName, lpddoi->dwOfs); - - buttondefs[ typecounts[1] ].name = Bstrdup(lpddoi->tszName); - buttondefs[ typecounts[1] ].ofs = lpddoi->dwOfs; - - typecounts[1]++; - } - else if (lpddoi->dwType & DIDFT_POV) - { - //initprintf(" POV: %s (dwOfs=%d)\n", lpddoi->tszName, lpddoi->dwOfs); - - hatdefs[ typecounts[2] ].name = Bstrdup(lpddoi->tszName); - hatdefs[ typecounts[2] ].ofs = lpddoi->dwOfs; - - typecounts[2]++; - } - - return DIENUM_CONTINUE; -} - -#define HorribleDInputDeath( x, y ) \ - ShowDInputErrorBox(x,y); \ - UninitDirectInput(); \ - return TRUE - -static BOOL InitDirectInput(void) -{ - HRESULT result; - HRESULT(WINAPI *aDirectInputCreateA)(HINSTANCE, DWORD, LPDIRECTINPUT7A *, LPUNKNOWN); - DIPROPDWORD dipdw; - LPDIRECTINPUTDEVICE7A dev; - LPDIRECTINPUTDEVICE7A dev2; - DIDEVCAPS didc; - - if (hDInputDLL || di_disabled) return FALSE; - - initprintf("Initializing DirectInput...\n"); - - if (!hDInputDLL) - { - // initprintf(" - Loading DINPUT.DLL\n"); - hDInputDLL = LoadLibrary("DINPUT.DLL"); - if (!hDInputDLL) - { - ShowErrorBox("Error loading DINPUT.DLL"); - return TRUE; - } - } - - aDirectInputCreateA = (void *)GetProcAddress(hDInputDLL, "DirectInputCreateA"); - if (!aDirectInputCreateA) ShowErrorBox("Error fetching DirectInputCreateA()"); - - result = aDirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &lpDI, NULL); - if (FAILED(result)) { HorribleDInputDeath("DirectInputCreateA() failed", result); } - else if (result != DI_OK) initprintf(" Created DirectInput object with warning: %s\n",GetDInputError(result)); - - initprintf(" - Enumerating attached game controllers\n"); - inputdevices = 1|2; - result = IDirectInput7_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, InitDirectInput_enum, NULL, DIEDFL_ATTACHEDONLY); - if (FAILED(result)) { HorribleDInputDeath("Failed enumerating attached game controllers", result); } - else if (result != DI_OK) initprintf(" Enumerated game controllers with warning: %s\n",GetDInputError(result)); - - if (inputdevices == (1|2)) - { - initprintf(" - No game controllers found\n"); - UninitDirectInput(); - return TRUE; - } - - *devicedef.did = NULL; - - // initprintf(" - Creating %s device\n", devicedef.name); - result = IDirectInput7_CreateDeviceEx(lpDI, &guidDevs, &IID_IDirectInputDevice7, (void *)&dev, NULL); - if (FAILED(result)) { HorribleDInputDeath("Failed creating device", result); } - else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result)); - - result = IDirectInputDevice7_QueryInterface(dev, &IID_IDirectInputDevice7, (LPVOID *)&dev2); - IDirectInputDevice7_Release(dev); - if (FAILED(result)) { HorribleDInputDeath("Failed querying DirectInput7 interface for device", result); } - else if (result != DI_OK) initprintf(" Queried IDirectInputDevice7 interface with warning: %s\n",GetDInputError(result)); - - result = IDirectInputDevice7_SetDataFormat(dev2, devicedef.df); - if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting data format", result); } - else if (result != DI_OK) initprintf(" Set data format with warning: %s\n",GetDInputError(result)); - - di_inputevt = CreateEvent(NULL, FALSE, FALSE, NULL); - - if (di_inputevt == NULL) - { - IDirectInputDevice7_Release(dev2); - ShowErrorBox("Couldn't create event object"); - UninitDirectInput(); - return TRUE; - } - - result = IDirectInputDevice7_SetEventNotification(dev2, di_inputevt); - if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting event object", result); } - else if (result != DI_OK) initprintf(" Set event object with warning: %s\n",GetDInputError(result)); - - IDirectInputDevice7_Unacquire(dev2); - - memset(&dipdw, 0, sizeof(dipdw)); - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = INPUT_BUFFER_SIZE; - - result = IDirectInputDevice7_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph); - if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting buffering", result); } - else if (result != DI_OK) initprintf(" Set buffering with warning: %s\n",GetDInputError(result)); - - // set up device - { - int32_t typecounts[3] = {0,0,0}; - - memset(&didc, 0, sizeof(didc)); - didc.dwSize = sizeof(didc); - result = IDirectInputDevice7_GetCapabilities(dev2, &didc); - if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller capabilities", result); } - else if (result != DI_OK) initprintf(" Fetched controller capabilities with warning: %s\n",GetDInputError(result)); - - joynumaxes = (uint8_t)didc.dwAxes; - joynumbuttons = min(32,(uint8_t)didc.dwButtons); - joynumhats = (uint8_t)didc.dwPOVs; - initprintf("Controller has %d axes, %d buttons, and %d hat(s).\n",joynumaxes,joynumbuttons,joynumhats); - - axisdefs = (struct _joydef *)Bcalloc(didc.dwAxes, sizeof(struct _joydef)); - buttondefs = (struct _joydef *)Bcalloc(didc.dwButtons, sizeof(struct _joydef)); - hatdefs = (struct _joydef *)Bcalloc(didc.dwPOVs, sizeof(struct _joydef)); - - joyaxis = (int32_t *)Bcalloc(didc.dwAxes, sizeof(int32_t)); - joyhat = (int32_t *)Bcalloc(didc.dwPOVs, sizeof(int32_t)); - - result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL); - if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller features", result); } - else if (result != DI_OK) initprintf(" Fetched controller features with warning: %s\n",GetDInputError(result)); - } - - *devicedef.did = dev2; - - di_devacquired = 0; - - return FALSE; -} - - -// -// UninitDirectInput() -- clean up DirectInput -// -static void UninitDirectInput(void) -{ - int32_t i; - - if (hDInputDLL) initprintf("Uninitializing DirectInput...\n"); - - AcquireInputDevices(0); - - if (axisdefs) - { - for (i=joynumaxes-1; i>=0; i--) if (axisdefs[i].name) Bfree((void *)axisdefs[i].name); - Bfree(axisdefs); axisdefs = NULL; - } - if (buttondefs) - { - for (i=joynumbuttons-1; i>=0; i--) if (buttondefs[i].name) Bfree((void *)buttondefs[i].name); - Bfree(buttondefs); buttondefs = NULL; - } - if (hatdefs) - { - for (i=joynumhats-1; i>=0; i--) if (hatdefs[i].name) Bfree((void *)hatdefs[i].name); - Bfree(hatdefs); hatdefs = NULL; - } - - if (di_inputevt) - { - CloseHandle(di_inputevt); - di_inputevt = NULL; - } - - if (*devicedef.did) - { - IDirectInputDevice7_Release(*devicedef.did); - *devicedef.did = NULL; - } - - if (lpDI) - { - IDirectInput7_Release(lpDI); - lpDI = NULL; - } - - if (hDInputDLL) - { - FreeLibrary(hDInputDLL); - hDInputDLL = NULL; - } -} - - -// -// GetKeyNames() -- retrieves the names for all the keys on the keyboard -// -static void GetKeyNames(void) -{ - int32_t i; - char tbuf[MAX_PATH]; - - memset(key_names,0,sizeof(key_names)); - - for (i=0; i<256; i++) - { - tbuf[0] = 0; - GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(key_names[i])-1); - Bstrncpy(&key_names[i][0], tbuf, sizeof(key_names[i])-1); - } -} - -const char *getjoyname(int32_t what, int32_t num) -{ - switch (what) - { - case 0: // axis - return ((unsigned)num > (unsigned)joynumaxes) ? NULL : (char *)axisdefs[num].name; - case 1: // button - return ((unsigned)num > (unsigned)joynumbuttons) ? NULL : (char *)buttondefs[num].name; - case 2: // hat - return ((unsigned)num > (unsigned)joynumhats) ? NULL : (char *)hatdefs[num].name; - default: - return NULL; - } -} - -// -// AcquireInputDevices() -- (un)acquires the input devices -// -static void AcquireInputDevices(char acquire) -{ - DWORD flags; - HRESULT result; - - if (!hDInputDLL) return; - if (!hWindow) return; - - if (acquire) - { - // if (!appactive) return; // why acquire when inactive? - - if (! *devicedef.did) return; - - IDirectInputDevice7_Unacquire(*devicedef.did); - - flags = DISCL_FOREGROUND|DISCL_NONEXCLUSIVE; - - result = IDirectInputDevice7_SetCooperativeLevel(*devicedef.did, hWindow, flags); - if (FAILED(result)) - initprintf("IDirectInputDevice7_SetCooperativeLevel(%s): %s\n", - devicedef.name, GetDInputError(result)); - - if (SUCCEEDED(IDirectInputDevice7_Acquire(*devicedef.did))) - di_devacquired = 1; - else - di_devacquired = 0; - - return; - } - - di_devacquired = 0; - - releaseallbuttons(); - - if (! *devicedef.did) return; - - IDirectInputDevice7_Unacquire(*devicedef.did); - - result = IDirectInputDevice7_SetCooperativeLevel(*devicedef.did, hWindow, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE); - if (FAILED(result)) - initprintf("IDirectInputDevice7_SetCooperativeLevel(%s): %s\n", - devicedef.name, GetDInputError(result)); -} - -// -// ProcessInputDevices() -- processes the input devices -// -static inline void DI_PollJoysticks(void) -{ - DWORD dwElements = INPUT_BUFFER_SIZE; - HRESULT result; - DIDEVICEOBJECTDATA didod[INPUT_BUFFER_SIZE]; - int32_t i, ev; - - if (*devicedef.did) - { - result = IDirectInputDevice7_Poll(*devicedef.did); - - if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) - { - if (SUCCEEDED(IDirectInputDevice7_Acquire(*devicedef.did))) - { - di_devacquired = 1; - IDirectInputDevice7_Poll(*devicedef.did); - } - else di_devacquired = 0; - } - - if (di_devacquired) - { - // use event objects so that we can quickly get indication of when data is ready - // to be read and input events processed - ev = WaitForSingleObject(di_inputevt, 0); - - if (ev != WAIT_OBJECT_0 || !lpDID) - return; - - result = IDirectInputDevice7_GetDeviceData(lpDID, sizeof(DIDEVICEOBJECTDATA), - (LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0); - - if (result != DI_OK || !dwElements) return; - - for (i=dwElements-1; i>=0; i--) - { - int32_t j; - - // check axes - for (j=0; j0; n--) usertimercallback(); -} - - -// -// getticks() -- returns the windows ticks count -// -uint32_t getticks(void) -{ - int64_t i; - if (timerfreq == 0) return 0; - QueryPerformanceCounter((LARGE_INTEGER *)&i); - return (uint32_t)(i*longlong(1000)/timerfreq); -} - - -// -// gettimerfreq() -- returns the number of ticks per second the timer is configured to generate -// -int32_t gettimerfreq(void) -{ - return timerticspersec; -} - - - - -//------------------------------------------------------------------------------------------------- -// VIDEO -//================================================================================================= - -// DirectDraw objects -static HMODULE hDDrawDLL = NULL; -static LPDIRECTDRAW lpDD = NULL; -static LPDIRECTDRAWSURFACE lpDDSPrimary = NULL; -static LPDIRECTDRAWSURFACE lpDDSBack = NULL; -static char *lpOffscreen = NULL; -static LPDIRECTDRAWPALETTE lpDDPalette = NULL; -static BOOL bDDrawInited = FALSE; -static DWORD DDdwCaps = 0, DDdwCaps2 = 0; - -// DIB stuff -static HDC hDC = NULL; // opengl shares this -static HDC hDCSection = NULL; -static HBITMAP hDIBSection = NULL; -static HPALETTE hPalette = NULL; -static VOID *lpPixels = NULL; - -static int32_t setgammaramp(WORD gt[3][256]); -static int32_t getgammaramp(WORD gt[3][256]); - -static void ToggleDesktopComposition(BOOL compEnable) -{ - static HMODULE hDWMApiDLL = NULL; - static HRESULT(WINAPI *aDwmEnableComposition)(UINT); - - if (!hDWMApiDLL && (hDWMApiDLL = LoadLibrary("DWMAPI.DLL"))) - aDwmEnableComposition = (void *)GetProcAddress(hDWMApiDLL, "DwmEnableComposition"); - - if (aDwmEnableComposition) - { - aDwmEnableComposition(compEnable); - if (!silentvideomodeswitch) - initprintf("%sabling desktop composition...\n", (compEnable) ? "En" : "Dis"); - } -} - -// -// checkvideomode() -- makes sure the video mode passed is legal -// -int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced) -{ - int32_t i, nearest=-1, dx, dy, odx=9999, ody=9999; - - getvalidmodes(); - - // fix up the passed resolution values to be multiples of 8 - // and at least 320x200 or at most MAXXDIMxMAXYDIM - if (*x < 320) *x = 320; - if (*y < 200) *y = 200; - if (*x > MAXXDIM) *x = MAXXDIM; - if (*y > MAXYDIM) *y = MAXYDIM; - // *x &= 0xfffffff8l; - - for (i=0; i= 6) - ToggleDesktopComposition(c < 16); - - if (!silentvideomodeswitch) - initprintf("Setting video mode %dx%d (%d-bit %s)\n", - x,y,c, ((fs&1) ? "fullscreen" : "windowed")); - - if (CreateAppWindow(modenum)) return -1; - - if (!gammabrightness) - { - // float f = 1.0 + ((float)curbrightness / 10.0); - if (getgammaramp(sysgamma) >= 0) gammabrightness = 1; - if (gammabrightness && setgamma() < 0) gammabrightness = 0; - } - -#ifdef USE_OPENGL - if (hGLWindow && glinfo.vsync) bwglSwapIntervalEXT(vsync); -#endif - if (inp) AcquireInputDevices(1); - modechange=1; - videomodereset = 0; - OSD_ResizeDisplay(xres,yres); - //baselayer_onvideomodechange(c>8); - - return 0; -} - - -// -// getvalidmodes() -- figure out what video modes are available -// -#define ADDMODE(x,y,c,f,n) if (validmodecnt 8) - { - for (i=0; i modes[i].freq && maxrefreshfreq > 0) || - (dm.dmDisplayFrequency > modes[i].freq && maxrefreshfreq == 0)) - { - if (i==nmodes) nmodes++; - - modes[i].x = dm.dmPelsWidth; - modes[i].y = dm.dmPelsHeight; - modes[i].bpp = dm.dmBitsPerPel; - modes[i].freq = dm.dmDisplayFrequency; - } - } - - j++; - ZeroMemory(&dm,sizeof(DEVMODE)); - dm.dmSize = sizeof(DEVMODE); - } - - for (i=0; iddpfPixelFormat.dwRGBBitCount == 8) - { - CHECK(ddsd->dwWidth, ddsd->dwHeight) - ADDMODE(ddsd->dwWidth, ddsd->dwHeight, ddsd->ddpfPixelFormat.dwRGBBitCount, 1,-1); - } - - return(DDENUMRET_OK); -} - -static int32_t sortmodes(const struct validmode_t *a, const struct validmode_t *b) -{ - int32_t x; - - if ((x = a->fs - b->fs) != 0) return x; - if ((x = a->bpp - b->bpp) != 0) return x; - if ((x = a->xdim - b->xdim) != 0) return x; - if ((x = a->ydim - b->ydim) != 0) return x; - - return 0; -} -void getvalidmodes(void) -{ - int32_t cdepths[2] = { 8, 0 }; - int32_t i, j, maxx=0, maxy=0; - HRESULT result; - -#ifdef USE_OPENGL - if (desktopbpp > 8 && !nogl) cdepths[1] = desktopbpp; - else cdepths[1] = 0; -#endif - - if (modeschecked) return; - - validmodecnt=0; - // initprintf("Detecting video modes:\n"); - - if (bDDrawInited) - { - // if DirectDraw initialization didn't fail enumerate fullscreen modes - - result = IDirectDraw_EnumDisplayModes(lpDD, 0, NULL, 0, getvalidmodes_enum); - if (result != DD_OK) - { - initprintf("Unable to enumerate fullscreen modes. Using default list.\n"); - for (j=0; j < 2; j++) - { - if (cdepths[j] == 0) continue; - for (i=0; defaultres[i][0]; i++) - ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1,-1) - } - } - } -#ifdef USE_OPENGL - cdsenummodes(); -#endif - - // windowed modes cant be bigger than the current desktop resolution - maxx = desktopxdim-1; - maxy = desktopydim-1; - - // add windowed modes next - for (j=0; j < 2; j++) - { - if (cdepths[j] == 0) continue; - for (i=0; defaultres[i][0]; i++) - CHECK(defaultres[i][0],defaultres[i][1]) - ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0,-1) - } - - qsort((void *)validmode, validmodecnt, sizeof(struct validmode_t), (int32_t( *)(const void *,const void *))sortmodes); - - modeschecked=1; -} - -#undef CHECK -#undef ADDMODE - - -// -// resetvideomode() -- resets the video system -// -void resetvideomode(void) -{ - videomodereset = 1; - modeschecked = 0; -} - - -// -// begindrawing() -- locks the framebuffer for drawing -// -void begindrawing(void) -{ - if (bpp > 8) - { - if (offscreenrendering) return; - frameplace = 0; - bytesperline = 0; - imageSize = 0; - modechange = 0; - return; - } - - if (lockcount++ > 0) - return; // already locked - - if (offscreenrendering) return; - - frameplace = fullscreen ? (intptr_t)lpOffscreen : (intptr_t)lpPixels; - - if (!modechange) return; - - modechange=0; - - if (!fullscreen) - { - bytesperline = xres|4; - } - else - { - bytesperline = xres|1; - } - - imageSize = bytesperline*yres; - setvlinebpl(bytesperline); - - { - int32_t i = 0, j = 0; - for (; i<=ydim; i++) - ylookup[i] = j, j += bytesperline; - } -} - - -// -// enddrawing() -- unlocks the framebuffer -// -void enddrawing(void) -{ - if (bpp > 8) - { - if (!offscreenrendering) frameplace = 0; - return; - } - - if (!frameplace) return; - if (lockcount > 1) { lockcount--; return; } - if (!offscreenrendering) frameplace = 0; - lockcount = 0; -} - - -// -// showframe() -- update the display -// -void showframe(int32_t w) -{ - HRESULT result; - DDSURFACEDESC ddsd; - char *p,*q; - int32_t i,j; - -#ifdef USE_OPENGL - if (bpp > 8) - { - if (palfadedelta) - { - bglMatrixMode(GL_PROJECTION); - bglPushMatrix(); - bglLoadIdentity(); - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - bglLoadIdentity(); - - bglDisable(GL_DEPTH_TEST); - bglDisable(GL_ALPHA_TEST); - bglDisable(GL_TEXTURE_2D); - - bglEnable(GL_BLEND); - bglColor4ub(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta); - - bglBegin(GL_TRIANGLES); - bglVertex2f(-2.5f, 1.f); - bglVertex2f(2.5f, 1.f); - bglVertex2f(.0f, -2.5f); - bglEnd(); - - bglDisable(GL_BLEND); - - bglPopMatrix(); - bglMatrixMode(GL_PROJECTION); - bglPopMatrix(); - } - - bwglSwapBuffers(hDC); - return; - } -#endif - - // w = 1; // wait regardless. ken thinks it's better to do so. - - if (offscreenrendering) return; - - if (lockcount) - { - initprintf("Frame still locked %d times when showframe() called.\n", lockcount); - while (lockcount) enddrawing(); - } - - if (!fullscreen) - { - BitBlt(hDC, 0, 0, xres, yres, hDCSection, 0, 0, SRCCOPY); - return; - } - - if (!w && (IDirectDrawSurface_GetBltStatus(lpDDSBack, DDGBS_CANBLT) == DDERR_WASSTILLDRAWING || - IDirectDrawSurface_GetFlipStatus(lpDDSPrimary, DDGFS_CANFLIP) == DDERR_WASSTILLDRAWING)) - return; - - // lock the backbuffer surface - Bmemset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - - result = IDirectDrawSurface_Lock(lpDDSBack, NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL); - - if (result == DDERR_SURFACELOST) - { - if (!appactive) - return; // not in a position to restore display anyway - - IDirectDrawSurface_Restore(lpDDSPrimary); - result = IDirectDrawSurface_Lock(lpDDSBack, NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL); - } - if (result != DD_OK) - { - if (result != DDERR_WASSTILLDRAWING) - initprintf("Failed locking back-buffer surface: %s\n", GetDDrawError(result)); - return; - } - - // copy each scanline - p = (char *)ddsd.lpSurface; - q = (char *)lpOffscreen; - j = xres >> 2; - - for (i=0; i 8) return 0; // no palette in opengl - - Bmemcpy(lpal.palPalEntry, curpalettefaded, sizeof(lpal.palPalEntry)); - for (i=start, n=num-1; n>0; i++, n--) - curpalettefaded[i].f = lpal.palPalEntry[i].peFlags = PC_NOCOLLAPSE; - - if (fullscreen) - { - if (!lpDDPalette) return -1; - result = IDirectDrawPalette_SetEntries(lpDDPalette, 0, 0, 256, (LPPALETTEENTRY)lpal.palPalEntry); - if (result != DD_OK) - { - initprintf("Palette set failed: %s\n", GetDDrawError(result)); - return -1; - } - - return 0; - } - - if (num > 0) - { - rgb = (RGBQUAD *)Bmalloc(sizeof(RGBQUAD)*num); - for (i=start, n=0; n0; i--, start++) { -dapal[0] = curpalette[start].b >> 2; -dapal[1] = curpalette[start].g >> 2; -dapal[2] = curpalette[start].r >> 2; -dapal += 4; -} - -return 0; -}*/ - - -// -// setgamma -// -static int32_t setgammaramp(WORD gt[3][256]) -{ - if (!fullscreen || bpp > 8) - { - // GL and windowed mode use DIB method - int32_t i; - HDC hDC = GetDC(hWindow); - i = SetDeviceGammaRamp(hDC, gt) ? 0 : -1; - ReleaseDC(hWindow, hDC); - return i; - } - else if (appactive) - { - // fullscreen uses DirectX - LPDIRECTDRAWGAMMACONTROL gam; - HRESULT hr; - - if (!(DDdwCaps2 & DDCAPS2_PRIMARYGAMMA)) return -1; - - hr = IDirectDrawSurface_QueryInterface(lpDDSPrimary, &IID_IDirectDrawGammaControl, (LPVOID)&gam); - if (hr != DD_OK) - { - // ShowDDrawErrorBox("Error querying gamma control", hr); - initprintf("Error querying gamma control: %s\n",GetDDrawError(hr)); - return -1; - } - - hr = IDirectDrawGammaControl_SetGammaRamp(gam, 0, (LPDDGAMMARAMP)gt); - if (hr != DD_OK) - { - IDirectDrawGammaControl_Release(gam); - initprintf("Error setting gamma ramp: %s\n",GetDDrawError(hr)); - // ShowDDrawErrorBox("Error setting gamma ramp", hr); - return -1; - } - - IDirectDrawGammaControl_Release(gam); - return 0; - } - else return 0; -} - -int32_t setgamma(void) -{ - int32_t i; - WORD gammaTable[3][256]; - float gamma = max(0.1f,min(4.f,vid_gamma)); - float contrast = max(0.1f,min(3.f,vid_contrast)); - float bright = max(-0.8f,min(0.8f,vid_brightness)); - - double invgamma = 1 / gamma; - double norm = pow(255., invgamma - 1); - - if (!hWindow) return -1; - - // This formula is taken from Doomsday - - for (i = 0; i < 256; i++) - { - double val = i * contrast - (contrast - 1) * 127; - if (gamma != 1) val = pow(val, invgamma) / norm; - val += bright * 128; - - gammaTable[0][i] = gammaTable[1][i] = gammaTable[2][i] = (WORD)max(0.f,(double)min(0xffff,val*256)); - } - return setgammaramp(gammaTable); -} - -static int32_t getgammaramp(WORD gt[3][256]) -{ - if (!hWindow) return -1; - if (!fullscreen || bpp > 8) - { - int32_t i; - HDC hDC = GetDC(hWindow); - i = GetDeviceGammaRamp(hDC, gt) ? 0 : -1; - ReleaseDC(hWindow, hDC); - return i; - } - else - { - LPDIRECTDRAWGAMMACONTROL gam; - HRESULT hr; - - if (!(DDdwCaps2 & DDCAPS2_PRIMARYGAMMA)) return -1; - - hr = IDirectDrawSurface_QueryInterface(lpDDSPrimary, &IID_IDirectDrawGammaControl, (LPVOID)&gam); - if (hr != DD_OK) - { - ShowDDrawErrorBox("Error querying gamma control", hr); - return -1; - } - - hr = IDirectDrawGammaControl_GetGammaRamp(gam, 0, (LPDDGAMMARAMP)gt); - if (hr != DD_OK) - { - IDirectDrawGammaControl_Release(gam); - ShowDDrawErrorBox("Error getting gamma ramp", hr); - return -1; - } - - IDirectDrawGammaControl_Release(gam); - - return 0; - } -} - -// -// InitDirectDraw() -- get DirectDraw started -// - -// device enumerator -static BOOL WINAPI InitDirectDraw_enum(GUID *lpGUID, LPSTR lpDesc, LPSTR lpName, LPVOID lpContext) -{ - UNREFERENCED_PARAMETER(lpGUID); - UNREFERENCED_PARAMETER(lpName); - UNREFERENCED_PARAMETER(lpContext); - UNREFERENCED_PARAMETER(lpDesc); - // initprintf(" * %s\n", lpDesc); - return 1; -} - -static BOOL InitDirectDraw(void) -{ - HRESULT result; - HRESULT(WINAPI *aDirectDrawCreate)(GUID *, LPDIRECTDRAW *, IUnknown *); - HRESULT(WINAPI *aDirectDrawEnumerate)(LPDDENUMCALLBACK, LPVOID); - DDCAPS ddcaps; - - if (bDDrawInited) return FALSE; - - initprintf("Initializing DirectDraw...\n"); - - // load up the DirectDraw DLL - if (!hDDrawDLL) - { - // initprintf(" - Loading DDRAW.DLL\n"); - hDDrawDLL = LoadLibrary("DDRAW.DLL"); - if (!hDDrawDLL) - { - ShowErrorBox("Error loading DDRAW.DLL"); - return TRUE; - } - } - - // get the pointer to DirectDrawEnumerate - aDirectDrawEnumerate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA"); - if (!aDirectDrawEnumerate) - { - ShowErrorBox("Error fetching DirectDrawEnumerate()"); - UninitDirectDraw(); - return TRUE; - } - - // enumerate the devices to make us look fancy - // initprintf(" - Enumerating display devices\n"); - aDirectDrawEnumerate(InitDirectDraw_enum, NULL); - - // get the pointer to DirectDrawCreate - aDirectDrawCreate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawCreate"); - if (!aDirectDrawCreate) - { - ShowErrorBox("Error fetching DirectDrawCreate()"); - UninitDirectDraw(); - return TRUE; - } - - // create a new DirectDraw object - // initprintf(" - Creating DirectDraw object\n"); - result = aDirectDrawCreate(NULL, &lpDD, NULL); - if (result != DD_OK) - { - ShowDDrawErrorBox("DirectDrawCreate() failed", result); - UninitDirectDraw(); - return TRUE; - } - - // fetch capabilities - // initprintf(" - Checking capabilities\n"); - ddcaps.dwSize = sizeof(DDCAPS); - result = IDirectDraw_GetCaps(lpDD, &ddcaps, NULL); - if (result != DD_OK) - { - initprintf(" Unable to get capabilities.\n"); - } - else - { - DDdwCaps = ddcaps.dwCaps; - DDdwCaps2 = ddcaps.dwCaps2; - } - - bDDrawInited = TRUE; - - return FALSE; -} - - -// -// UninitDirectDraw() -- clean up DirectDraw -// -static void UninitDirectDraw(void) -{ - if (bDDrawInited) initprintf("Uninitializing DirectDraw...\n"); - - ReleaseDirectDrawSurfaces(); - - RestoreDirectDrawMode(); - - if (lpDD) - { - // initprintf(" - Releasing DirectDraw object\n"); - IDirectDraw_Release(lpDD); - lpDD = NULL; - } - - if (hDDrawDLL) - { - // initprintf(" - Unloading DDRAW.DLL\n"); - FreeLibrary(hDDrawDLL); - hDDrawDLL = NULL; - } - - bDDrawInited = FALSE; -} - - -// -// RestoreDirectDrawMode() -- resets the screen mode -// -static int32_t RestoreDirectDrawMode(void) -{ - HRESULT result; - - if (fullscreen == 0 || /*bpp > 8 ||*/ !bDDrawInited) return FALSE; - - if (modesetusing == 1) ChangeDisplaySettings(NULL,0); - else if (modesetusing == 0) - { - // restore previous display mode and set to normal cooperative level - result = IDirectDraw_RestoreDisplayMode(lpDD); - if (result != DD_OK) - { - ShowDDrawErrorBox("Error restoring display mode", result); - UninitDirectDraw(); - return TRUE; - } - - result = IDirectDraw_SetCooperativeLevel(lpDD, hWindow, DDSCL_NORMAL); - if (result != DD_OK) - { - ShowDDrawErrorBox("Error setting cooperative level", result); - UninitDirectDraw(); - return TRUE; - } - } - modesetusing = -1; - - return FALSE; -} - - -// -// ReleaseDirectDrawSurfaces() -- release the front and back buffers -// -static void ReleaseDirectDrawSurfaces(void) -{ - if (lpDDPalette) - { - // initprintf(" - Releasing palette\n"); - IDirectDrawPalette_Release(lpDDPalette); - lpDDPalette = NULL; - } - - if (lpDDSBack) - { - // initprintf(" - Releasing back-buffer surface\n"); - IDirectDrawSurface_Release(lpDDSBack); - lpDDSBack = NULL; - } - - if (lpDDSPrimary) - { - // initprintf(" - Releasing primary surface\n"); - IDirectDrawSurface_Release(lpDDSPrimary); - lpDDSPrimary = NULL; - } - - if (lpOffscreen) - { - // initprintf(" - Freeing offscreen buffer\n"); - Bfree(lpOffscreen); - lpOffscreen = NULL; - } -} - - -// -// SetupDirectDraw() -- sets up DirectDraw rendering -// -static int32_t SetupDirectDraw(int32_t width, int32_t height) -{ - HRESULT result; - DDSURFACEDESC ddsd; - int32_t i; - - // now create the DirectDraw surfaces - ZeroMemory(&ddsd, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; - ddsd.dwBackBufferCount = 2; // triple-buffer - - // initprintf(" - Creating primary surface\n"); - result = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSPrimary, NULL); - if (result != DD_OK) - { - ShowDDrawErrorBox("Failure creating primary surface", result); - UninitDirectDraw(); - return TRUE; - } - - ZeroMemory(&ddsd.ddsCaps, sizeof(ddsd.ddsCaps)); - ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; - numpages = 1; // KJS 20031225 - - // initprintf(" - Getting back buffer\n"); - result = IDirectDrawSurface_GetAttachedSurface(lpDDSPrimary, &ddsd.ddsCaps, &lpDDSBack); - if (result != DD_OK) - { - ShowDDrawErrorBox("Failure fetching back-buffer surface", result); - UninitDirectDraw(); - return TRUE; - } - - // initprintf(" - Allocating offscreen buffer\n"); - lpOffscreen = (char *)Bmalloc((width|1)*height); - if (!lpOffscreen) - { - ShowErrorBox("Failure allocating offscreen buffer"); - UninitDirectDraw(); - return TRUE; - } - - // attach a palette to the primary surface - // initprintf(" - Creating palette\n"); - for (i=0; i<256; i++) - curpalettefaded[i].f = PC_NOCOLLAPSE; - result = IDirectDraw_CreatePalette(lpDD, DDPCAPS_8BIT | DDPCAPS_ALLOW256, (LPPALETTEENTRY)curpalettefaded, &lpDDPalette, NULL); - if (result != DD_OK) - { - ShowDDrawErrorBox("Failure creating palette", result); - UninitDirectDraw(); - return TRUE; - } - - result = IDirectDrawSurface_SetPalette(lpDDSPrimary, lpDDPalette); - if (result != DD_OK) - { - ShowDDrawErrorBox("Failure setting palette", result); - UninitDirectDraw(); - return TRUE; - } - - return FALSE; -} - - -// -// UninitDIB() -- clean up the DIB renderer -// -static void UninitDIB(void) -{ - if (hPalette) - { - DeleteObject(hPalette); - hPalette = NULL; - } - - if (hDCSection) - { - DeleteDC(hDCSection); - hDCSection = NULL; - } - - if (hDIBSection) - { - DeleteObject(hDIBSection); - hDIBSection = NULL; - } - - if (hDC) - { - ReleaseDC(hWindow, hDC); - hDC = NULL; - } -} - - -// -// SetupDIB() -- sets up DIB rendering -// -static int32_t SetupDIB(int32_t width, int32_t height) -{ - struct binfo - { - BITMAPINFOHEADER header; - RGBQUAD colours[256]; - } dibsect; - int32_t i; - - if (!hDC) - { - hDC = GetDC(hWindow); - if (!hDC) - { - ShowErrorBox("Error getting device context"); - return TRUE; - } - } - - if (hDCSection) - { - DeleteDC(hDCSection); - hDCSection = NULL; - } - - // destroy the previous DIB section if it existed - if (hDIBSection) - { - DeleteObject(hDIBSection); - hDIBSection = NULL; - } - - // create the new DIB section - memset(&dibsect, 0, sizeof(dibsect)); - numpages = 1; // KJS 20031225 - dibsect.header.biSize = sizeof(dibsect.header); - dibsect.header.biWidth = width|1; // Ken did this - dibsect.header.biHeight = -height; - dibsect.header.biPlanes = 1; - dibsect.header.biBitCount = 8; - dibsect.header.biCompression = BI_RGB; - dibsect.header.biClrUsed = 256; - dibsect.header.biClrImportant = 256; - for (i=0; i<256; i++) - { - dibsect.colours[i].rgbBlue = curpalette[i].b; - dibsect.colours[i].rgbGreen = curpalette[i].g; - dibsect.colours[i].rgbRed = curpalette[i].r; - } - - hDIBSection = CreateDIBSection(hDC, (BITMAPINFO *)&dibsect, DIB_RGB_COLORS, &lpPixels, NULL, 0); - if (!hDIBSection) - { - ReleaseDC(hWindow, hDC); - hDC = NULL; - - ShowErrorBox("Error creating DIB section"); - return TRUE; - } - - memset(lpPixels, 0, width*height); - - // create a compatible memory DC - hDCSection = CreateCompatibleDC(hDC); - if (!hDCSection) - { - ReleaseDC(hWindow, hDC); - hDC = NULL; - - ShowErrorBox("Error creating compatible DC"); - return TRUE; - } - - // select the DIB section into the memory DC - if (!SelectObject(hDCSection, hDIBSection)) - { - ReleaseDC(hWindow, hDC); - hDC = NULL; - DeleteDC(hDCSection); - hDCSection = NULL; - - ShowErrorBox("Error creating compatible DC"); - return TRUE; - } - - return FALSE; -} - -#ifdef USE_OPENGL -// -// ReleaseOpenGL() -- cleans up OpenGL rendering stuff -// - -static void ReleaseOpenGL(void) -{ - if (hGLRC) - { - polymost_glreset(); - if (!bwglMakeCurrent(0,0)) { } - if (!bwglDeleteContext(hGLRC)) { } - hGLRC = NULL; - } - if (hGLWindow) - { - if (hDC) - { - ReleaseDC(hGLWindow, hDC); - hDC = NULL; - } - - DestroyWindow(hGLWindow); - hGLWindow = NULL; - } -} - - -// -// UninitOpenGL() -- unitializes any openGL libraries -// -static void UninitOpenGL(void) -{ - ReleaseOpenGL(); -} - - -// -// SetupOpenGL() -- sets up opengl rendering -// -static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp) -{ - PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), - 1, //Version Number - PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER, //Must Support these - PFD_TYPE_RGBA, //Request An RGBA Format - 0, //Select Our Color Depth - 0,0,0,0,0,0, //Color Bits Ignored - 0, //No Alpha Buffer - 0, //Shift Bit Ignored - 0, //No Accumulation Buffer - 0,0,0,0, //Accumulation Bits Ignored - 32, //16/24/32 Z-Buffer depth - 1, //No Stencil Buffer - 0, //No Auxiliary Buffer - PFD_MAIN_PLANE, //Main Drawing Layer - 0, //Reserved - 0,0,0 //Layer Masks Ignored - }; - GLuint PixelFormat; - int32_t minidriver; - int32_t err; - pfd.cColorBits = bitspp; - - hGLWindow = CreateWindow( - WindowClass, - "OpenGL Window", - WS_CHILD|WS_VISIBLE, - 0,0, - width,height, - hWindow, - (HMENU)0, - hInstance, - NULL); - if (!hGLWindow) - { - ShowErrorBox("Error creating OpenGL child window."); - return TRUE; - } - - hDC = GetDC(hGLWindow); - if (!hDC) - { - ReleaseOpenGL(); - ShowErrorBox("Error getting device context"); - return TRUE; - } - - minidriver = Bstrcasecmp(gldriver,"opengl32.dll"); - - if (minidriver) PixelFormat = bwglChoosePixelFormat(hDC,&pfd); - else PixelFormat = ChoosePixelFormat(hDC,&pfd); - if (!PixelFormat) - { - ReleaseOpenGL(); - ShowErrorBox("Can't choose pixel format"); - return TRUE; - } - - if (minidriver) err = bwglSetPixelFormat(hDC, PixelFormat, &pfd); - else err = SetPixelFormat(hDC, PixelFormat, &pfd); - if (!err) - { - ReleaseOpenGL(); - ShowErrorBox("Can't set pixel format"); - return TRUE; - } - - hGLRC = bwglCreateContext(hDC); - if (!hGLRC) - { - ReleaseOpenGL(); - ShowErrorBox("Can't create GL RC"); - return TRUE; - } - - if (!bwglMakeCurrent(hDC, hGLRC)) - { - ReleaseOpenGL(); - ShowErrorBox("Can't activate GL RC"); - return TRUE; - } - - polymost_glreset(); - - bglEnable(GL_TEXTURE_2D); - bglShadeModel(GL_SMOOTH); //GL_FLAT - bglClearColor(0,0,0,0.5); //Black Background - bglHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); //Use FASTEST for ortho! - bglHint(GL_LINE_SMOOTH_HINT,GL_NICEST); - bglHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST); - bglDisable(GL_DITHER); - - { - GLubyte *p,*p2,*p3; - int32_t err = 0; - - glinfo.vendor = (char *)bglGetString(GL_VENDOR); - glinfo.renderer = (char *)bglGetString(GL_RENDERER); - glinfo.version = (char *)bglGetString(GL_VERSION); - glinfo.extensions = (char *)bglGetString(GL_EXTENSIONS); - - // GL driver blacklist - - if (!Bstrcmp(glinfo.vendor,"Microsoft Corporation")) err = 1; - else if (!Bstrcmp(glinfo.vendor,"SiS")) err = 1; - else if (!Bstrcmp(glinfo.vendor,"3Dfx Interactive Inc.")) err = 1; - else if (!Bstrcmp(glinfo.vendor,"Intel")) - { - if (!Bstrncmp(glinfo.renderer,"Intel 8", 7)) // 845G and 865G confirmed to work - err = 0; - else if (!Bstrncmp(glinfo.renderer,"Intel 9", 7)) // 915G, 945GM, 965/963 GMA confirmed to work - err = 0; - else if (!Bstrcmp(glinfo.renderer,"Intel Cantiga")) - err = 0; - else if (!Bstrcmp(glinfo.renderer,"Mobile Intel(R) 4 Series Express Chipset Family")) - err = 0; - else if (!Bstrcmp(glinfo.renderer,"Intel Brookdale-G")) - err = 0; - else err = 1; - } - else - { - if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc.")) - { -#ifdef POLYMER - pr_ati_fboworkaround = 1; - initprintf("Enabling ATI FBO color attachment workaround.\n"); -#endif - if (Bstrstr(glinfo.renderer,"Radeon X1")) - { - r_vbos = 0; -#ifdef POLYMER - pr_ati_nodepthoffset = 1; - initprintf("Enabling ATI R520 polygon offset workaround.\n"); -#endif - } -#ifdef POLYMER - else - pr_ati_nodepthoffset = 0; -#endif - } -#ifdef POLYMER - else - pr_ati_fboworkaround = 0; -#endif - } - - if (!forcegl && err) - { - OSD_Printf("Unsupported OpenGL driver detected. GL modes will be unavailable. Use -forcegl to override.\n"); - wm_msgbox("Unsupported OpenGL driver", "Unsupported OpenGL driver detected. GL modes will be unavailable."); - ReleaseOpenGL(); - unloadgldriver(); - nogl = 1; - modeschecked = 0; - getvalidmodes(); - return TRUE; - } - - glinfo.maxanisotropy = 1.0; - glinfo.bgra = 0; - glinfo.texcompr = 0; - - // process the extensions string and flag stuff we recognize - p = (GLubyte *)Bstrdup(glinfo.extensions); - p3 = p; - while ((p2 = (GLubyte *)Bstrtoken(p3==p?(char *)p:NULL, " ", (char **)&p3, 1)) != NULL) - { - if (!Bstrcmp((char *)p2, "GL_EXT_texture_filter_anisotropic")) - { - // supports anisotropy. get the maximum anisotropy level - bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy); - } - else if (!Bstrcmp((char *)p2, "GL_EXT_texture_edge_clamp") || - !Bstrcmp((char *)p2, "GL_SGIS_texture_edge_clamp")) - { - // supports GL_CLAMP_TO_EDGE or GL_CLAMP_TO_EDGE_SGIS - glinfo.clamptoedge = 1; - } - else if (!Bstrcmp((char *)p2, "GL_EXT_bgra")) - { - // support bgra textures - glinfo.bgra = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor,"ATI Technologies Inc.")) - { - // support texture compression - glinfo.texcompr = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_texture_non_power_of_two")) - { - // support non-power-of-two texture sizes - glinfo.texnpot = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_fragment_program")) - { - glinfo.arbfp = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_depth_texture")) - { - glinfo.depthtex = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_shadow")) - { - glinfo.shadow = 1; - } - else if (!Bstrcmp((char *)p2, "GL_EXT_framebuffer_object")) - { - glinfo.fbos = 1; - } - else if (!Bstrcmp((char *)p2, "GL_NV_texture_rectangle") || - !Bstrcmp((char *)p2, "GL_EXT_texture_rectangle")) - { - glinfo.rect = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_multitexture")) - { - glinfo.multitex = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_texture_env_combine")) - { - glinfo.envcombine = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_vertex_buffer_object")) - { - glinfo.vbos = 1; - } - else if (!Bstrcmp((char *)p2, "WGL_EXT_swap_control")) - { - glinfo.vsync = 1; - } - else if (!Bstrcmp((char *)p2, "GL_EXT_gpu_shader4")) - { - glinfo.sm4 = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_occlusion_query")) - { - glinfo.occlusionqueries = 1; - } - else if (!Bstrcmp((char *)p2, "GL_ARB_shader_objects")) - { - glinfo.glsl = 1; - } - } - Bfree(p); - } - numpages = 2; // KJS 20031225: tell rotatesprite that it's double buffered! - - if (!glinfo.dumped) - { - int32_t oldbpp = bpp; - bpp = 32; - osdcmd_glinfo(NULL); - glinfo.dumped = TRUE; - bpp = oldbpp; - } - - return FALSE; -} -#endif - -// -// CreateAppWindow() -- create the application window -// -static BOOL CreateAppWindow(int32_t modenum) -{ - RECT rect; - int32_t w, h, x, y, stylebits = 0, stylebitsex = 0; - int32_t width, height, fs, bitspp; - - HRESULT result; - - if (modenum == 0x7fffffff) - { - width = customxdim; - height = customydim; - fs = customfs; - bitspp = custombpp; - } - else - { - width = validmode[modenum].xdim; - height = validmode[modenum].ydim; - fs = validmode[modenum].fs; - bitspp = validmode[modenum].bpp; - } - - if (width == xres && height == yres && fs == fullscreen && bitspp == bpp && !videomodereset) return FALSE; - - if (hWindow) - { - if (bpp > 8) - { -#ifdef USE_OPENGL - ReleaseOpenGL(); -#endif - } - else - { - ReleaseDirectDrawSurfaces(); - } - - if (!fs && fullscreen) - { - // restore previous display mode and set to normal cooperative level - RestoreDirectDrawMode(); -#ifdef USE_OPENGL - } - else if (fs && fullscreen) - { - // using CDS for GL modes, so restore from DirectDraw - if (bpp != bitspp) RestoreDirectDrawMode(); -#endif - } - - - ShowWindow(hWindow, SW_HIDE); // so Windows redraws what's behind if the window shrinks - } - - if (fs) - { - stylebitsex = WS_EX_TOPMOST; - stylebits = WS_POPUP; - } - else - { - stylebitsex = 0; - stylebits = WINDOW_STYLE; - } - - if (!hWindow) - { - hWindow = CreateWindowEx( - stylebitsex, - WindowClass, - apptitle, - stylebits, - CW_USEDEFAULT, - CW_USEDEFAULT, - 320, - 200, - NULL, - NULL, - hInstance, - 0); - if (!hWindow) - { - ShowErrorBox("Unable to create window"); - return TRUE; - } - - startwin_close(); - } - else - { - SetWindowLong(hWindow,GWL_EXSTYLE,stylebitsex); - SetWindowLong(hWindow,GWL_STYLE,stylebits); - } - - // resize the window - if (!fs) - { - rect.left = 0; - rect.top = 0; - rect.right = width-1; - rect.bottom = height-1; - AdjustWindowRect(&rect, stylebits, FALSE); - - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = (desktopxdim - w) / 2; - y = (desktopydim - h) / 2; - } - else - { - x=y=0; - w=width; - h=height; - } - - if (windowx == -1) - windowx = x; - - if (windowy == -1) - windowy = y; - - SetWindowText(hWindow, apptitle); - ShowWindow(hWindow, SW_SHOWNORMAL); - SetForegroundWindow(hWindow); - SetFocus(hWindow); - - SetWindowPos(hWindow, HWND_TOP, windowpos?windowx:x, windowpos?windowy:y, w, h, 0); - - // fullscreen? - if (!fs) - { - if (bitspp > 8) - { -#ifdef USE_OPENGL - // yes, start up opengl - if (SetupOpenGL(width,height,bitspp)) - return TRUE; -#endif - } - else if (SetupDIB(width,height)) // use DIB section - return TRUE; - - modesetusing = -1; - } - else - { - // yes, set up DirectDraw - - // clean up after the DIB renderer if it was being used - UninitDIB(); - - if (!bDDrawInited) - { - DestroyWindow(hWindow); - hWindow = NULL; - return TRUE; - } - -#ifdef USE_OPENGL - if (bitspp > 8) - { - DEVMODE dmScreenSettings; - - ZeroMemory(&dmScreenSettings, sizeof(DEVMODE)); - dmScreenSettings.dmSize = sizeof(DEVMODE); - dmScreenSettings.dmPelsWidth = width; - dmScreenSettings.dmPelsHeight = height; - dmScreenSettings.dmBitsPerPel = bitspp; - dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; - if (modenum != 0x7fffffff) - { - dmScreenSettings.dmDisplayFrequency = validmode[modenum].extra; - dmScreenSettings.dmFields |= DM_DISPLAYFREQUENCY; - } - - if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) - { - ShowErrorBox("Video mode not supported"); - return TRUE; - } - - ShowWindow(hWindow, SW_SHOWNORMAL); - SetForegroundWindow(hWindow); - SetFocus(hWindow); - - modesetusing = 1; - } - else -#endif - { - // set exclusive cooperative level - result = IDirectDraw_SetCooperativeLevel(lpDD, hWindow, DDSCL_ALLOWMODEX|DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN); - if (result != DD_OK) - { - ShowDDrawErrorBox("Error setting cooperative level", result); - UninitDirectDraw(); - return TRUE; - } - - result = IDirectDraw_SetDisplayMode(lpDD, width, height, bitspp); - if (result != DD_OK) - { - ShowDDrawErrorBox("Error setting display mode", result); - UninitDirectDraw(); - return TRUE; - } - - modesetusing = 0; - } - - if (bitspp > 8) - { -#ifdef USE_OPENGL - // we want an opengl mode - if (SetupOpenGL(width,height,bitspp)) - { - return TRUE; - } -#endif - } - else - { - // we want software - if (SetupDirectDraw(width,height)) - { - return TRUE; - } - } - } - -#ifdef USE_OPENGL - if (bitspp > 8) loadglextensions(); -#endif - - xres = width; - yres = height; - bpp = bitspp; - fullscreen = fs; - curvidmode = modenum; - - frameplace = 0; - lockcount = 0; - - // bytesperline is set when framebuffer is locked - //bytesperline = width; - //imageSize = bytesperline*yres; - - modechange = 1; - OSD_ResizeDisplay(xres,yres); - - UpdateWindow(hWindow); - - return FALSE; -} - - -// -// DestroyAppWindow() -- destroys the application window -// -static void DestroyAppWindow(void) -{ - if (hWindow && gammabrightness) - { - setgammaramp(sysgamma); - gammabrightness = 0; - } - -#ifdef USE_OPENGL - UninitOpenGL(); -#endif - UninitDirectDraw(); - UninitDIB(); - - if (hWindow) - { - DestroyWindow(hWindow); - hWindow = NULL; - } -} - - -// -// ShowDDrawErrorBox() -- shows an error message box for a DirectDraw error -// -static void ShowDDrawErrorBox(const char *m, HRESULT r) -{ - TCHAR msg[1024]; - - wsprintf(msg, "%s: %s", m, GetDDrawError(r)); - MessageBox(0, msg, apptitle, MB_OK|MB_ICONSTOP); -} - - -// -// GetDDrawError() -- stinking huge list of error messages since MS didn't want to include -// them in the DLL -// -static const char *GetDDrawError(HRESULT code) -{ - switch (code) - { - case DD_OK: - return "DD_OK"; - case DDERR_ALREADYINITIALIZED: - return "DDERR_ALREADYINITIALIZED"; - case DDERR_BLTFASTCANTCLIP: - return "DDERR_BLTFASTCANTCLIP"; - case DDERR_CANNOTATTACHSURFACE: - return "DDERR_CANNOTATTACHSURFACE"; - case DDERR_CANNOTDETACHSURFACE: - return "DDERR_CANNOTDETACHSURFACE"; - case DDERR_CANTCREATEDC: - return "DDERR_CANTCREATEDC"; - case DDERR_CANTDUPLICATE: - return "DDERR_CANTDUPLICATE"; - case DDERR_CANTLOCKSURFACE: - return "DDERR_CANTLOCKSURFACE"; - case DDERR_CANTPAGELOCK: - return "DDERR_CANTPAGELOCK"; - case DDERR_CANTPAGEUNLOCK: - return "DDERR_CANTPAGEUNLOCK"; - case DDERR_CLIPPERISUSINGHWND: - return "DDERR_CLIPPERISUSINGHWND"; - case DDERR_COLORKEYNOTSET: - return "DDERR_COLORKEYNOTSET"; - case DDERR_CURRENTLYNOTAVAIL: - return "DDERR_CURRENTLYNOTAVAIL"; - case DDERR_DCALREADYCREATED: - return "DDERR_DCALREADYCREATED"; - case DDERR_DEVICEDOESNTOWNSURFACE: - return "DDERR_DEVICEDOESNTOWNSURFACE"; - case DDERR_DIRECTDRAWALREADYCREATED: - return "DDERR_DIRECTDRAWALREADYCREATED"; - case DDERR_EXCEPTION: - return "DDERR_EXCEPTION"; - case DDERR_EXCLUSIVEMODEALREADYSET: - return "DDERR_EXCLUSIVEMODEALREADYSET"; - case DDERR_EXPIRED: - return "DDERR_EXPIRED"; - case DDERR_GENERIC: - return "DDERR_GENERIC"; - case DDERR_HEIGHTALIGN: - return "DDERR_HEIGHTALIGN"; - case DDERR_HWNDALREADYSET: - return "DDERR_HWNDALREADYSET"; - case DDERR_HWNDSUBCLASSED: - return "DDERR_HWNDSUBCLASSED"; - case DDERR_IMPLICITLYCREATED: - return "DDERR_IMPLICITLYCREATED"; - case DDERR_INCOMPATIBLEPRIMARY: - return "DDERR_INCOMPATIBLEPRIMARY"; - case DDERR_INVALIDCAPS: - return "DDERR_INVALIDCAPS"; - case DDERR_INVALIDCLIPLIST: - return "DDERR_INVALIDCLIPLIST"; - case DDERR_INVALIDDIRECTDRAWGUID: - return "DDERR_INVALIDDIRECTDRAWGUID"; - case DDERR_INVALIDMODE: - return "DDERR_INVALIDMODE"; - case DDERR_INVALIDOBJECT: - return "DDERR_INVALIDOBJECT"; - case DDERR_INVALIDPARAMS: - return "DDERR_INVALIDPARAMS"; - case DDERR_INVALIDPIXELFORMAT: - return "DDERR_INVALIDPIXELFORMAT"; - case DDERR_INVALIDPOSITION: - return "DDERR_INVALIDPOSITION"; - case DDERR_INVALIDRECT: - return "DDERR_INVALIDRECT"; - case DDERR_INVALIDSTREAM: - return "DDERR_INVALIDSTREAM"; - case DDERR_INVALIDSURFACETYPE: - return "DDERR_INVALIDSURFACETYPE"; - case DDERR_LOCKEDSURFACES: - return "DDERR_LOCKEDSURFACES"; - case DDERR_MOREDATA: - return "DDERR_MOREDATA"; - case DDERR_NO3D: - return "DDERR_NO3D"; - case DDERR_NOALPHAHW: - return "DDERR_NOALPHAHW"; - case DDERR_NOBLTHW: - return "DDERR_NOBLTHW"; - case DDERR_NOCLIPLIST: - return "DDERR_NOCLIPLIST"; - case DDERR_NOCLIPPERATTACHED: - return "DDERR_NOCLIPPERATTACHED"; - case DDERR_NOCOLORCONVHW: - return "DDERR_NOCOLORCONVHW"; - case DDERR_NOCOLORKEY: - return "DDERR_NOCOLORKEY"; - case DDERR_NOCOLORKEYHW: - return "DDERR_NOCOLORKEYHW"; - case DDERR_NOCOOPERATIVELEVELSET: - return "DDERR_NOCOOPERATIVELEVELSET"; - case DDERR_NODC: - return "DDERR_NODC"; - case DDERR_NODDROPSHW: - return "DDERR_NODDROPSHW"; - case DDERR_NODIRECTDRAWHW: - return "DDERR_NODIRECTDRAWHW"; - case DDERR_NODIRECTDRAWSUPPORT: - return "DDERR_NODIRECTDRAWSUPPORT"; - case DDERR_NOEMULATION: - return "DDERR_NOEMULATION"; - case DDERR_NOEXCLUSIVEMODE: - return "DDERR_NOEXCLUSIVEMODE"; - case DDERR_NOFLIPHW: - return "DDERR_NOFLIPHW"; - case DDERR_NOFOCUSWINDOW: - return "DDERR_NOFOCUSWINDOW"; - case DDERR_NOGDI: - return "DDERR_NOGDI"; - case DDERR_NOHWND: - return "DDERR_NOHWND"; - case DDERR_NOMIPMAPHW: - return "DDERR_NOMIPMAPHW"; - case DDERR_NOMIRRORHW: - return "DDERR_NOMIRRORHW"; - case DDERR_NONONLOCALVIDMEM: - return "DDERR_NONONLOCALVIDMEM"; - case DDERR_NOOPTIMIZEHW: - return "DDERR_NOOPTIMIZEHW"; - case DDERR_NOOVERLAYDEST: - return "DDERR_NOOVERLAYDEST"; - case DDERR_NOOVERLAYHW: - return "DDERR_NOOVERLAYHW"; - case DDERR_NOPALETTEATTACHED: - return "DDERR_NOPALETTEATTACHED"; - case DDERR_NOPALETTEHW: - return "DDERR_NOPALETTEHW"; - case DDERR_NORASTEROPHW: - return "DDERR_NORASTEROPHW"; - case DDERR_NOROTATIONHW: - return "DDERR_NOROTATIONHW"; - case DDERR_NOSTRETCHHW: - return "DDERR_NOSTRETCHHW"; - case DDERR_NOT4BITCOLOR: - return "DDERR_NOT4BITCOLOR"; - case DDERR_NOT4BITCOLORINDEX: - return "DDERR_NOT4BITCOLORINDEX"; - case DDERR_NOT8BITCOLOR: - return "DDERR_NOT8BITCOLOR"; - case DDERR_NOTAOVERLAYSURFACE: - return "DDERR_NOTAOVERLAYSURFACE"; - case DDERR_NOTEXTUREHW: - return "DDERR_NOTEXTUREHW"; - case DDERR_NOTFLIPPABLE: - return "DDERR_NOTFLIPPABLE"; - case DDERR_NOTFOUND: - return "DDERR_NOTFOUND"; - case DDERR_NOTINITIALIZED: - return "DDERR_NOTINITIALIZED"; - case DDERR_NOTLOADED: - return "DDERR_NOTLOADED"; - case DDERR_NOTLOCKED: - return "DDERR_NOTLOCKED"; - case DDERR_NOTPAGELOCKED: - return "DDERR_NOTPAGELOCKED"; - case DDERR_NOTPALETTIZED: - return "DDERR_NOTPALETTIZED"; - case DDERR_NOVSYNCHW: - return "DDERR_NOVSYNCHW"; - case DDERR_NOZBUFFERHW: - return "DDERR_NOZBUFFERHW"; - case DDERR_NOZOVERLAYHW: - return "DDERR_NOZOVERLAYHW"; - case DDERR_OUTOFCAPS: - return "DDERR_OUTOFCAPS"; - case DDERR_OUTOFMEMORY: - return "DDERR_OUTOFMEMORY"; - case DDERR_OUTOFVIDEOMEMORY: - return "DDERR_OUTOFVIDEOMEMORY"; - case DDERR_OVERLAPPINGRECTS: - return "DDERR_OVERLAPPINGRECTS"; - case DDERR_OVERLAYCANTCLIP: - return "DDERR_OVERLAYCANTCLIP"; - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: - return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"; - case DDERR_OVERLAYNOTVISIBLE: - return "DDERR_OVERLAYNOTVISIBLE"; - case DDERR_PALETTEBUSY: - return "DDERR_PALETTEBUSY"; - case DDERR_PRIMARYSURFACEALREADYEXISTS: - return "DDERR_PRIMARYSURFACEALREADYEXISTS"; - case DDERR_REGIONTOOSMALL: - return "DDERR_REGIONTOOSMALL"; - case DDERR_SURFACEALREADYATTACHED: - return "DDERR_SURFACEALREADYATTACHED"; - case DDERR_SURFACEALREADYDEPENDENT: - return "DDERR_SURFACEALREADYDEPENDENT"; - case DDERR_SURFACEBUSY: - return "DDERR_SURFACEBUSY"; - case DDERR_SURFACEISOBSCURED: - return "DDERR_SURFACEISOBSCURED"; - case DDERR_SURFACELOST: - return "DDERR_SURFACELOST"; - case DDERR_SURFACENOTATTACHED: - return "DDERR_SURFACENOTATTACHED"; - case DDERR_TOOBIGHEIGHT: - return "DDERR_TOOBIGHEIGHT"; - case DDERR_TOOBIGSIZE: - return "DDERR_TOOBIGSIZE"; - case DDERR_TOOBIGWIDTH: - return "DDERR_TOOBIGWIDTH"; - case DDERR_UNSUPPORTED: - return "DDERR_UNSUPPORTED"; - case DDERR_UNSUPPORTEDFORMAT: - return "DDERR_UNSUPPORTEDFORMAT"; - case DDERR_UNSUPPORTEDMASK: - return "DDERR_UNSUPPORTEDMASK"; - case DDERR_UNSUPPORTEDMODE: - return "DDERR_UNSUPPORTEDMODE"; - case DDERR_VERTICALBLANKINPROGRESS: - return "DDERR_VERTICALBLANKINPROGRESS"; - case DDERR_VIDEONOTACTIVE: - return "DDERR_VIDEONOTACTIVE"; - case DDERR_WASSTILLDRAWING: - return "DDERR_WASSTILLDRAWING"; - case DDERR_WRONGMODE: - return "DDERR_WRONGMODE"; - case DDERR_XALIGN: - return "DDERR_XALIGN"; - default: - break; - } - return "Unknown error"; -} - - - - - - -//------------------------------------------------------------------------------------------------- -// MOSTLY STATIC INTERNAL WINDOWS THINGS -//================================================================================================= - -// -// ShowErrorBox() -- shows an error message box -// -static void ShowErrorBox(const char *m) -{ - TCHAR msg[1024]; - - wsprintf(msg, "%s: %s", m, GetWindowsErrorMsg(GetLastError())); - MessageBox(0, msg, apptitle, MB_OK|MB_ICONSTOP); -} - - -// -// CheckWinVersion() -- check to see what version of Windows we happen to be running under -// -static inline BOOL CheckWinVersion(void) -{ - ZeroMemory(&osv, sizeof(osv)); - osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - - // we don't like anything older than Windows XP - - if (!GetVersionEx((LPOSVERSIONINFOA)&osv)) return FALSE; - - if (osv.dwMajorVersion >= 6) return TRUE; - if (osv.dwMajorVersion == 5 && osv.dwMinorVersion >= 1) return TRUE; - - return FALSE; -} - - -// -// WndProcCallback() -- the Windows window callback -// -static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - /* RECT rect; - POINT pt; - HRESULT result; */ - -#ifdef USE_OPENGL - if (hWnd == hGLWindow) return DefWindowProc(hWnd,uMsg,wParam,lParam); -#endif - - switch (uMsg) - { - case WM_SYSCOMMAND: - // don't let the monitor fall asleep or let the screensaver activate - if (wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER) return 0; - - // Since DirectInput won't let me set an exclusive-foreground - // keyboard for some unknown reason I just have to tell Windows to - // rack off with its keyboard accelerators. - if (wParam == SC_KEYMENU || wParam == SC_HOTKEY) return 0; - break; - - case WM_ACTIVATEAPP: - { - appactive = wParam; -#ifdef USE_OPENGL - if (hGLWindow) - { - if (!appactive && fullscreen) - { - if (mousegrab) - { - grabmouse(0); - regrabmouse = 1; - } - realfs = fullscreen; - silentvideomodeswitch = 1; - setgamemode(!fullscreen,xdim,ydim,bpp); - ShowWindow(hWindow, SW_MINIMIZE); - } - else if (appactive && realfs) - { - if (regrabmouse) - { - grabmouse(1); - regrabmouse = 0; - } - ShowWindow(hWindow, SW_RESTORE); - SetForegroundWindow(hWindow); - SetFocus(hWindow); - setgamemode(realfs,xdim,ydim,bpp); - silentvideomodeswitch = 0; - realfs = 0; - } - } -#endif - - if (backgroundidle) - SetPriorityClass(GetCurrentProcess(), - appactive ? NORMAL_PRIORITY_CLASS : IDLE_PRIORITY_CLASS); - - if (appactive) - { - SetForegroundWindow(hWindow); - SetFocus(hWindow); - } - - Bmemset(keystatus, 0, sizeof(keystatus)); - AcquireInputDevices(appactive); - break; - } - - case WM_ACTIVATE: - if (appactive) - { - SetForegroundWindow(hWindow); - SetFocus(hWindow); - } - - Bmemset(keystatus, 0, sizeof(keystatus)); - AcquireInputDevices(appactive); - break; - - case WM_SIZE: - if (wParam == SIZE_MAXHIDE || wParam == SIZE_MINIMIZED) appactive = 0; - else appactive = 1; - AcquireInputDevices(appactive); - break; - - case WM_PALETTECHANGED: - // someone stole the palette so try and steal it back - if (bDDrawInited && bpp == 8 && fullscreen) - { - int32_t result = IDirectDrawSurface_SetPalette(lpDDSPrimary, lpDDPalette); - if (result != DD_OK) - { - initprintf("Palette set failed: %s\n", GetDDrawError(result)); - break; - } - setpalette(0,256); - break; - } - if (appactive && (HWND)wParam != hWindow) setpalette(0,256); - break; - - case WM_DISPLAYCHANGE: - // desktop settings changed so adjust our world-view accordingly - desktopxdim = LOWORD(lParam); - desktopydim = HIWORD(lParam); - desktopbpp = wParam; - getvalidmodes(); - break; - - case WM_PAINT: - repaintneeded=1; - break; - - // don't draw the frame if fullscreen - //case WM_NCPAINT: - //if (!fullscreen) break; - //return 0; - - case WM_ERASEBKGND: - return TRUE; - - case WM_MOVE: - // windowx = LOWORD(lParam); - // windowy = HIWORD(lParam); - return 0; - - case WM_MOVING: - { - RECT *RECTYMcRECT = (LPRECT)lParam; - - windowx = RECTYMcRECT->left; - windowy = RECTYMcRECT->top; - return 0; - } - case WM_CLOSE: - quitevent = 1; - return 0; - - case WM_ENTERMENULOOP: - case WM_ENTERSIZEMOVE: - AcquireInputDevices(0); - return 0; - case WM_EXITMENULOOP: - case WM_EXITSIZEMOVE: - AcquireInputDevices(1); - return 0; - - case WM_DESTROY: - hWindow = 0; - //PostQuitMessage(0); // JBF 20040115: not anymore - return 0; - - default: - break; - } - - return DefWindowProc(hWnd, uMsg, wParam, lParam); -} - - -// -// RegisterWindowClass() -- register the window class -// -static BOOL RegisterWindowClass(void) -{ - WNDCLASSEX wcx; - - if (window_class_registered) return FALSE; - - //initprintf("Registering window class\n"); - - wcx.cbSize = sizeof(wcx); - wcx.style = CS_OWNDC; - wcx.lpfnWndProc = WndProcCallback; - wcx.cbClsExtra = 0; - wcx.cbWndExtra = 0; - wcx.hInstance = hInstance; - wcx.hIcon = LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON, - GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); - wcx.hCursor = LoadCursor(NULL, IDC_ARROW); - wcx.hbrBackground = (HBRUSH)COLOR_GRAYTEXT; - wcx.lpszMenuName = NULL; - wcx.lpszClassName = WindowClass; - wcx.hIconSm = LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); - if (!RegisterClassEx(&wcx)) - { - ShowErrorBox("Failed to register window class"); - return TRUE; - } - - window_class_registered = TRUE; - - return FALSE; -} - - -// -// GetWindowsErrorMsg() -- gives a pointer to a static buffer containing the Windows error message -// -static LPTSTR GetWindowsErrorMsg(DWORD code) -{ - static TCHAR lpMsgBuf[1024]; - - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)lpMsgBuf, 1024, NULL); - - return lpMsgBuf; -} - -// -// makeasmwriteable() -- removes write protection from the self-modifying assembly code -// -void makeasmwriteable(void) -{ -#ifndef ENGINE_USING_A_C - extern int32_t dep_begin, dep_end; - DWORD oldprot; - - if (!VirtualProtect((LPVOID)&dep_begin, (SIZE_T)&dep_end - (SIZE_T)&dep_begin, PAGE_EXECUTE_READWRITE, &oldprot)) - { - ShowErrorBox("Problem making code writeable"); - } -#endif -} - diff --git a/polymer-perf/eduke32/buildlic.txt b/polymer-perf/eduke32/buildlic.txt deleted file mode 100644 index 3a3985bb6..000000000 --- a/polymer-perf/eduke32/buildlic.txt +++ /dev/null @@ -1,71 +0,0 @@ -BUILD SOURCE CODE LICENSE TERMS: 06/20/2000 - -[1] I give you permission to make modifications to my Build source and - distribute it, BUT: - -[2] Any derivative works based on my Build source may be distributed ONLY - through the INTERNET. - -[3] Distribution of any derivative works MUST be done completely FREE of - charge - no commercial exploitation whatsoever. - -[4] Anything you distribute which uses a part of my Build Engine source - code MUST include: - - [A] The following message somewhere in the archive: - - // "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman - // Ken Silverman's official web site: "http://www.advsys.net/ken" - // See the included license file "BUILDLIC.TXT" for license info. - - [B] This text file "BUILDLIC.TXT" along with it. - - [C] Any source files that you modify must include this message as well: - - // This file has been modified from Ken Silverman's original release - -[5] The use of the Build Engine for commercial purposes will require an - appropriate license arrangement with me. Contact information is - on my web site. - -[6] I take no responsibility for damage to your system. - -[7] Technical support: Before contacting me with questions, please read - and do ALL of the following! - - [A] Look through ALL of my text files. There are 7 of them (including this - one). I like to think that I wrote them for a reason. You will find - many of your answers in the history section of BUILD.TXT and - BUILD2.TXT (they're located inside SRC.ZIP). - - [B] If that doesn't satisfy you, then try going to: - - "http://www.advsys.net/ken/buildsrc" - - where I will maintain a Build Source Code FAQ (or perhaps I might - just provide a link to a good FAQ). - - [C] I am willing to respond to questions, but ONLY if they come at a rate - that I can handle. - - PLEASE TRY TO AVOID ASKING DUPLICATE QUESTIONS! - - As my line of defense, I will post my current policy about - answering Build source questions (right below the E-mail address - on my web site.) You can check there to see if I'm getting - overloaded with questions or not. - - If I'm too busy, it might say something like this: - - I'm too busy to answer Build source questions right now. - Sorry, but don't expect a reply from me any time soon. - - If I'm open for Build source questions, please state your question - clearly and don't include any unsolicited attachments unless - they're really small (like less than 50k). Assume that I have - a 28.8k modem. Also, don't leave out important details just - to make your question appear shorter - making me guess what - you're asking doesn't save me time! - ----------------------------------------------------------------------------- --Ken S. (official web site: http://www.advsys.net/ken) diff --git a/polymer-perf/eduke32/eduke32.sln b/polymer-perf/eduke32/eduke32.sln deleted file mode 100644 index 21e3be812..000000000 --- a/polymer-perf/eduke32/eduke32.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eduke32", "eduke32.vcxproj", "{8E7A6179-0B72-4073-8A4C-E8682D481DAE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Debug|Win32.ActiveCfg = Debug|Win32 - {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Debug|Win32.Build.0 = Debug|Win32 - {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Release|Win32.ActiveCfg = Release|Win32 - {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/polymer-perf/eduke32/eduke32.vcproj b/polymer-perf/eduke32/eduke32.vcproj deleted file mode 100644 index 23febdbe7..000000000 --- a/polymer-perf/eduke32/eduke32.vcproj +++ /dev/null @@ -1,848 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/polymer-perf/eduke32/eduke32.vcxproj b/polymer-perf/eduke32/eduke32.vcxproj deleted file mode 100644 index 49ecf215a..000000000 --- a/polymer-perf/eduke32/eduke32.vcxproj +++ /dev/null @@ -1,281 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {8E7A6179-0B72-4073-8A4C-E8682D481DAE} - eduke32 - MakeFileProj - - - - Makefile - - - Makefile - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(Configuration)\ - $(Configuration)\ - nmake /f Makefile.msvc DEBUG=1 - nmake /f Makefile.msvc veryclean all DEBUG=1 - nmake /f Makefile.msvc veryclean - eduke32.exe - WIN32;_DEBUG;SUPERBUILD;POLYMOST;POLYMER;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN;$(NMakePreprocessorDefinitions) - $(NMakeIncludeSearchPath);build\include;source\jmact;source\jaudiolib\include;source\enet\include; - $(NMakeForcedIncludes) - $(NMakeAssemblySearchPath) - $(NMakeForcedUsingAssemblies) - $(Configuration)\ - $(Configuration)\ - nmake /f Makefile.msvc - nmake /f Makefile.msvc veryclean all - nmake /f Makefile.msvc veryclean - eduke32.exe - WIN32;_DEBUG;SUPERBUILD;POLYMOST;POLYMER;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN;$(NMakePreprocessorDefinitions) - $(NMakeIncludeSearchPath);build\include;source\jmact;source\jaudiolib\include;source\enet\include; - $(NMakeForcedIncludes) - $(NMakeAssemblySearchPath) - $(NMakeForcedUsingAssemblies) - u:\SDKs\oggvorbis-win32sdk-1.0.1\include;$(IncludePath) - $(SourcePath) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/polymer-perf/eduke32/eduke32.vcxproj.filters b/polymer-perf/eduke32/eduke32.vcxproj.filters deleted file mode 100644 index 0a92d2d8e..000000000 --- a/polymer-perf/eduke32/eduke32.vcxproj.filters +++ /dev/null @@ -1,653 +0,0 @@ - - - - - {be808922-2ddf-4835-a57d-42e2f8d6e6d1} - - - {6b639a6d-6609-479e-bf61-3e2d3e4323e6} - - - {84e51a60-037b-40c6-933a-7001d46906ab} - - - {eb6a8145-04f6-4b81-b8eb-508836cfdc91} - - - {7f1918c8-1b71-43db-b2af-aefaf13d21ac} - - - {447f3e7e-c01b-4ec3-8427-36441da24049} - - - {da5afe7a-2de4-4594-b07f-69cd3d29cc1b} - - - {4386b181-dad1-4aaa-9395-b5b57e49bca1} - - - {647e88f0-5d39-46cc-9822-460f2db9dfe6} - - - {766da152-470f-4b3b-8c8c-8289206d0d4e} - - - {df162924-c116-4c59-a0f3-589ebfb0ca27} - - - {dd93df66-1ed9-4b54-bd54-18abf46d2773} - - - {82d4000f-cd8c-4737-88dc-4ada5775a68e} - - - {65030203-c837-4739-a552-281c7535372f} - - - {607ab16a-c3a5-4dad-b6ba-3393e6309d23} - - - {8a6aad55-a3bc-4e4f-a61d-4652c29d8b92} - - - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers\MSVC - - - build\headers\MSVC - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jaudiolib\headers - - - jmact\headers - - - jmact\headers - - - jmact\headers - - - jmact\headers - - - jmact\headers - - - jmact\headers - - - jmact\headers - - - jmact\headers - - - jmact\headers - - - enet\headers - - - enet\headers - - - enet\headers - - - enet\headers - - - enet\headers - - - enet\headers - - - enet\headers - - - enet\headers - - - enet\headers - - - build\headers - - - build\headers - - - build\headers - - - build\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - eduke32\headers - - - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - build\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - eduke32\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jaudiolib\source - - - jmact\source - - - jmact\source - - - jmact\source - - - jmact\source - - - jmact\source - - - jmact\source - - - jmact\source - - - enet\source - - - enet\source - - - enet\source - - - enet\source - - - enet\source - - - enet\source - - - enet\source - - - enet\source - - - build\source - - - build\source - - - eduke32\source - - - eduke32\source - - - - - eduke32 - - - build - - - \ No newline at end of file diff --git a/polymer-perf/eduke32/eduke32.vcxproj.user b/polymer-perf/eduke32/eduke32.vcxproj.user deleted file mode 100644 index 695b5c78b..000000000 --- a/polymer-perf/eduke32/eduke32.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/polymer-perf/eduke32/eobj/keep.me b/polymer-perf/eduke32/eobj/keep.me deleted file mode 100644 index e69de29bb..000000000 diff --git a/polymer-perf/eduke32/eobj_win/keep.me b/polymer-perf/eduke32/eobj_win/keep.me deleted file mode 100644 index e69de29bb..000000000 diff --git a/polymer-perf/eduke32/installer/eduke32.nsi b/polymer-perf/eduke32/installer/eduke32.nsi deleted file mode 100644 index fe1119087..000000000 --- a/polymer-perf/eduke32/installer/eduke32.nsi +++ /dev/null @@ -1,179 +0,0 @@ -; Script generated by the HM NIS Edit Script Wizard. - -; HM NIS Edit Wizard helper defines -!define PRODUCT_NAME "EDuke32" -!define PRODUCT_VERSION "1.4.0 beta 3" -!define PRODUCT_PUBLISHER "EDuke32 Team" -!define PRODUCT_WEB_SITE "http://www.eduke32.com" -!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" -!define PRODUCT_UNINST_ROOT_KEY "HKLM" -!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" - -SetCompressor /SOLID lzma - -; MUI 1.67 compatible ------ -!include "MUI.nsh" - -; MUI Settings -!define MUI_ABORTWARNING -!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\box-install.ico" -!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\box-uninstall.ico" -!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp" - -; Welcome page -!define MUI_WELCOMEPAGE_TEXT "$(MUI_WELCOMEPAGE_TEXT)" -LangString MUI_WELCOMEPAGE_TEXT {LANG_ENGLSH} "This wizard will guide you through the installation of ${PRODUCT_NAME} ${PRODUCT_VERSION}\n\nClick next to continue." -!insertmacro MUI_PAGE_WELCOME - -; License page -!insertmacro MUI_PAGE_LICENSE "..\GNU.TXT" -; Components page -!insertmacro MUI_PAGE_COMPONENTS -; Directory page -!define MUI_DIRECTORYPAGE_TEXT_TOP "$(MUI_DIRECTORYPAGE_TEXT_TOP)" -LangString MUI_DIRECTORYPAGE_TEXT_TOP {LANG_ENGLSH} "Please select your Duke Nukem 3D directory." -!insertmacro MUI_PAGE_DIRECTORY -; Start menu page -var ICONS_GROUP -!define MUI_STARTMENUPAGE_NODISABLE -!define MUI_STARTMENUPAGE_DEFAULTFOLDER "EDuke32" -!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" -!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" -!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" -!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP -; Instfiles page -!insertmacro MUI_PAGE_INSTFILES -; Finish page -!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\ChangeLog.html" -!insertmacro MUI_PAGE_FINISH - -; Uninstaller pages -!insertmacro MUI_UNPAGE_INSTFILES - -; Language files -!insertmacro MUI_LANGUAGE "English" - -; Reserve files -!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - -; MUI end ------ - -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "eduke32-${PRODUCT_VERSION}.exe" -InstallDir "" -InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" -ShowInstDetails show -ShowUnInstDetails show - -Section "!Game" SEC_GAME - SetOutPath "$INSTDIR" - SetOverwrite ifnewer - File "..\eduke32.exe" - CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\EDuke32.lnk" "$INSTDIR\eduke32.exe" - File "..\GNU.TXT" - File "..\buildlic.txt" - File "..\ChangeLog.html" - File "..\ChangeLog" -SectionEnd - -Section "Level editor" SEC_EDITOR - SetOutPath "$INSTDIR" - SetOverwrite ifnewer - File "..\mapster32.exe" - File "..\STHELP.HLP" - File "..\SEHELP.HLP" - File "..\names.h" - CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Mapster32.lnk" "$INSTDIR\mapster32.exe" -SectionEnd - -Section /o "Dukester X 1.5 support" SEC_DX - SetOutPath "$INSTDIR" - SetOverwrite ifdiff - File "..\duke3d_w32.exe" -SectionEnd - -Section /o "Samples" SEC_SAMPLES - SetOutPath "$INSTDIR" - SetOverwrite ifnewer - File "..\duke3d.def.sample" - File "..\enhance.con.sample" - SetOutPath "$INSTDIR" -SectionEnd - -Section -AdditionalIcons - WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\EDuke32 Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" -SectionEnd - -Section -Post - WriteUninstaller "$INSTDIR\uninst.exe" - WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\eduke32.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\eduke32.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}" "$ICONS_GROUP" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" -SectionEnd - -; Section descriptions -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SEC_GAME} "The main EDuke32 game components (required to play EDuke enhanced mods)" - !insertmacro MUI_DESCRIPTION_TEXT ${SEC_EDITOR} "The enhanced Mapster32 editor (optional)" - !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DX} "Support for Dukester X 1.5 (optional)" - !insertmacro MUI_DESCRIPTION_TEXT ${SEC_SAMPLES} "Sample enhancement definition files (optional)" -!insertmacro MUI_FUNCTION_DESCRIPTION_END - - -Function un.onUninstSuccess - HideWindow - MessageBox MB_ICONINFORMATION|MB_OK "EDuke32 was successfully removed from your computer." -FunctionEnd - -Function un.onInit - MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove EDuke32 and all of its components?" IDYES +2 - Abort -FunctionEnd - -Section Uninstall - ReadRegStr $ICONS_GROUP ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}" - Delete "$INSTDIR\${PRODUCT_NAME}.url" - Delete "$INSTDIR\uninst.exe" - Delete "$INSTDIR\duke3d.def.sample" - Delete "$INSTDIR\enhance.con.sample" - Delete "$INSTDIR\mapster32.exe" - Delete "$INSTDIR\ChangeLog.html" - Delete "$INSTDIR\ChangeLog" - Delete "$INSTDIR\GNU.TXT" - Delete "$INSTDIR\buildlic.txt" - Delete "$INSTDIR\eduke32.exe" - Delete "$INSTDIR\duke3d_w32.exe" -; Delete "$INSTDIR\datainst.exe" - -; Delete "$INSTDIR\duke3d.grp" -; Delete "$INSTDIR\duke3d.cfg" - - Delete "$INSTDIR\STHELP.HLP" - Delete "$INSTDIR\SEHELP.HLP" - Delete "$INSTDIR\names.h" - - Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\EDuke32 Website.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\Mapster32.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\Setup.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\EDuke32.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\Game Data Installer.lnk" - - RMDir "$SMPROGRAMS\$ICONS_GROUP" - RMDir "$INSTDIR" - - DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" - DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" - SetAutoClose true -SectionEnd diff --git a/polymer-perf/eduke32/libiconv2.dll b/polymer-perf/eduke32/libiconv2.dll deleted file mode 100644 index 747073f1b..000000000 Binary files a/polymer-perf/eduke32/libiconv2.dll and /dev/null differ diff --git a/polymer-perf/eduke32/libintl3.dll b/polymer-perf/eduke32/libintl3.dll deleted file mode 100644 index ec11e6b19..000000000 Binary files a/polymer-perf/eduke32/libintl3.dll and /dev/null differ diff --git a/polymer-perf/eduke32/m32help.hlp b/polymer-perf/eduke32/m32help.hlp deleted file mode 100644 index e5e8dd28f..000000000 --- a/polymer-perf/eduke32/m32help.hlp +++ /dev/null @@ -1,564 +0,0 @@ - *** Mapster32 Help: Table of contents *** -1. 2D mode mouse reference -2. 2D mode keyboard reference -3. 3D mode mouse reference -4. 3D mode keyboard reference -5. 3D mode tile selector refrence -6. Sector effector reference -7. Sector tag reference -8. Long SE reference -9. Colors -^P -The purpose of mouse in 2D mode is pointing, selecting and -moving objects in a map. - -^3Every time mouse is pointing at one of these: -1. Nothing -2. Sector -3. Sector and wall -4. Sector and sprite -5. Wall (wall without sector - map is corrupt) -6. Sprite (sprite without sector - map is corrupt) - -Some commands work differently depending on the currently selected object. -Press ALT to work with a wall or sprite instead of any adjacent sectors. - -^14RSHIFT^O Select vertex/sprites -^14RALT^O Select sectors -^14WHEEL^O Zoom -^14WHEEL+ALT^O Move camera and zoom -^14LEFT BUTTON^O Drag sectors/vertex/sprites -^14RIGHT BUTTON^O Move camera -^14RIGHT MIDDLE^O Move camera -^P -LSHIFT Show coordinates -F1 Show help -F9 Show the Sector Tags help -M Set extra of sector -M+ALT Set extra of wall/sprite -/ Reset panning, size and flags to defaults -/+SHIFT Make square - set xrepeat to yrepeat - -KP_4 Scaling sprite horizontally -KP_6 Scaling sprite horizontally -KP_2 Scaling sprite vertically -KP_8 Scaling sprite vertically -+KP_5 Speed up - -R Cycle sprite alignment -' S Set sprite size -' F Function menu -F7+ALT Search sector lotag -F8+ALT Search wall/sprite lotag -[ Search backward -] Search forward -G Cycle grid size -G+SHIFT Cycle grid size backward -' L Set sprite/wall coordinates -' 3 Cycle modes of showing object's name -' 7 Swap lotag and hitag of wall/sprite -' J Goto X,Y - -X Flip selected sectors in x -Y Flip selected sectors in y -X+ALT Mirror selected sectors in x -Y+ALT Mirror selected sectors in y - -F12 Screenshot -F12+SHIFT Inverted screenshot - -B Toggle blocking -B+SHIFT Toggle one-sided blocking for a wall -F+ALT Set the first wall of a sector -O Ornament sprite flat onto wall - -, Rotate sprite/selected sectors -. Rotate sprite/selected sectors -< Slowly rotate sprite/selected sectors -> Slowly rotate sprite/selected sectors - -SCROLL LOCK Set starting position -F5 Show item count -F6 Show actor count -F6 Show Sector Effector help when pointed at sprite -F7 Edit sector data -F8 Edit wall/sprite data - -T Set sector lotag -T+ALT Set wall/sprite lotag -T+CTRL Toggle show tags - -H Set sector hitag -H+ALT Set wall/sprite hitag -H+CTRL Toggle hitscan sensitivity - -P Set sector palette -E Set sprite status list -TAB Show sector data -TAB+SHIFT Show wall/sprite data -TAB+CTRL Show wall/sprite data - -LCTRL+RSHIFT Select all walls of the current sector - (point at a wall and, holding CTRL, press SHIFT) - -A Zoom in -Z Zoom out -L Toggle grid lock -J Join sectors -S Insert sprite (see samples/tiles.cfg for customization) -S+ALT Make inner sector -C Duplicate sectors/sprites -C Start circle attached to a wall -KP_+ Increase amount of walls in circle -KP_- Decrease amount of walls in circle -SPACE Start/end drawing of sector, end drawing of circle -LENTER Check all pointers for the current sector -LSHIFT+LCTRL+LENTER Check ALL pointers (manual attempt to recover map) -BACKSPACE Remove the last wall during drawing sector -DEL Delete sprite -DEL+CTRL Delete sector -INS Duplicate sectors/sprites -INS Start circle attached to a wall -INS Add vertex to wall -RENTER Switch to 3D mode -ESC Menu - -' A Toggle autosave (every 3 minutes) -' N Toggle clipping -S+CTRL Save map -L+CTRL Load map -^P -^3The mouse pointer always points at one of these objects: -1. wall -2. ceiling of sector -3. floor of sector -4. sprite -5. masked wall (non-transparent or semi-transparent wall between sectors) - -It's important to understand this concept. -Some commands work differently depending on the "current object", -the object the mouse points at. -Some commands only manipulate the "current object", but other commands -manipulate the sprites and sectors which are "selected" in 2D mode. -Other commands work globally. - -^3Mouse buttons: -^14LEFT^O Lock the current object. The current object won't - change as long as the button is pressed. -^14LEFT+MIDDLE^O Toggle mouselook -^14WHEEL^O Change shade/visibility -^14LEFT+WHEEL^O Change tile -^14RIGHT+WHEEL^O Move object up/down - -Additionally, there is UnrealEd-style mouse navigation in 3D mode -(toggle it with ^14F5^O) with the following bindings: -^14RIGHT^O mouselook -^14LEFT^O x: turning, y: move forward/back -^14LEFT+RIGHT^O x: strafe left/right, y: move up/down -^14MIDDLE^O y: move in viewing direction - The console variable 'pk_uedaccel' changes the speed - of navigation exponentially (valid values are 0-5). - -^14LEFT+ALT^O Move object up/down -^14LEFT+SHIFT^O Pan ceiling/floor/wall -^14LEFT+SHIFT^O Move sprite in horizontal plane -^14LEFT+CTRL^O Scale wall texture or size of sprite -^14LEFT+CTRL^O Change slope of sector -^P -UP Move forward -DOWN Move backward -LEFT+RCTRL Move left -RIGHT+RCTRL Move right -A Move up -Z Move down -F4+ALT Toggle showing the first wall -+LSHIFT Speed up movements - -LEFT Turn left -RIGHT Turn right -A+CTRL Look down -Z+CTRL Look up - -' V Set sector visibility -; V Set sector visibility on all selected sectors -V Choose tile -3 Toggle "sector over sector". -F3 Toggle mouselook -' BACKSPACE Clear all flags for wall/sprite -' P Paste palette to all selected sectors -; P Paste palette to all selected sectors & sprites -DEL Delete sprite -F6 Toggle automatic Sector Effector help -F7 Toggle automatic sector tag help - -, Rotate sprite -. Rotate sprite -< Slowly rotate sprite -> Slowly rotate sprite -. Search & fix panning of the wall to the right - -' L Change the coordinates of the current object -CAPS LOCK Cycle zmode -' Z Cycle zmode -' M Set the extra of the current object -1 Toggle one-sided flag of sprite/wall -2 Toggle bottom wall swapping -O Set top or bottom orientation of wall -O Ornament sprite flat onto wall -M Toggle masked wall -H Toggle hitscan sensitivity -H+SHIFT Toggle one side hitscan sensitivity for the wall -' H Set hitag of the current object - -KP_MINUS Darkens shade of individual sector/wall/sprite or selected sectors -KP_MINUS+ALT Decreases visibility of sector or selected sectors -KP_MINUS+ALT+SHIFT Slowly decreases visibility of sector or selected sectors -KP_MINUS+ALT+CTRL Decreases global visibility -KP_PLUS Lightens shade individual sector/wall/sprite or selected sectors -KP_PLUS+ALT Increases visibility of sector or selected sectors -KP_PLUS+ALT+SHIFT Slowly increases visibility of sector or selected sectors -KP_PLUS+ALT+CTRL Increases global visibility -^3Note: ALT, CTRL, SHIFT are modifiers so they work with mouse too. - -+/- Cycle tile -E Toggle sector texture expansion -R Toggle sector texture relativity alignment -R Cycle sprite aligment between: wall aligned, floor aligned, view aligned -'R Toggle framerate -F Flip the current object -F+ALT Set the first wall of sector - -PAGE UP Move selected sprites or sectors up -PAGE DN Move selected sprites or sectors down -PAGE UP+CTRL Move selected sprites to ceiling -PAGE DN+CTRL Move selected sprites to floor -+CTRL Speed up movement -+END Slow down movement -+HOME Slow down movement even more -^3Note: CTRL, HOME, END are modifiers, so they work with the mouse too. - -' D Cycle skill level -' X Toggle sprite shade preview -' W Toggle sprite display -' Y Toggle purple background -' C Copy shade from the clipboard to all objects in the map which are the same - tile as the tile of the object in the clipboard. It works separately for - sectors/walls/sprites depending on the current object. -' T Set lotag -' H Set hitag -' S Set shade -F2 Toggle clipboard preview -TAB Copy to the clipboard -F1 Toggle help -G Set picnum -B Toggle blocking -B+SHIFT Toggle one side blocking for the wall -T Cycles translucence for sprites/masked walls - -LENTER+CTRL+SHIFT Autoshade wall -' LENTER Paste picnum only -LENTER+SHIFT Paste shade and palette onto the current object -LENTER+CTRL Paste picnum, shading, and palette onto the current object -LENTER Paste all properties onto the current object - -' A Toggle autosave. The interval is configurable in the .cfg. - (by default: every 3 minutes) - -' N Toggle clipping for the camera -N+CTRL Toggle clipping for sprites - -S+CTRL Save map -L+CTRL Load map - -ESC Quit -F11 Brightness -F12 Screenshot -F12+SHIFT Inverted screenshot -F9 Reload and activate maphacks -F10 Disable maphacks - -C Toggle center sprite (cstat 128) -ALT+C Replace all tiles in the map with the clipboard - -[ Increases slope quickly -[+RSHIFT Increases slope with medium speed -[+LSHIFT Increases slope slowly -[+ALT Align slope to the floor of an adjoining sector -] Decreases slope quickly -]+RSHIFT Decreases slope with medium speed -]+LSHIFT Decreases slope slowly -]+ALT Align slope to the ceiling of an adjoining sector - -KP_4 Pan floor/ceiling horizontally -KP_6 Pan floor/ceiling horizontally -KP_2 Pan floor/ceiling vertically -KP_8 Pan floor/ceiling vertically -KP_4 Scale wall/sprite horizontally -KP_6 Scale wall/sprite horizontally -KP_2 Scale wall/sprite vertically -KP_8 Scale wall/sprite vertically -+SHIFT Force panning (for walls) -+KP_5 Increase speed - -/ Reset panning, size and flags to defaults -/+SHIFT Make square - set xrepeat to yrepeat - -P Enable/disable parallax -P+CTRL Change parallax type (only in 8-bit classic renderer) -P+ALT Change palette of sector/wall/sprite -D+ALT Adjust clipping distance of the sprite -T Translucence for sprites/masked walls -S Insert sprite -KP_ENTER Switch to 2D mode -^P -After pressing V in 3D mode, the editor enters tile browsing. - -^3Keys: -KP_/ Zoom in -KP_* Zoom out -UP/DOWN/LEFT/RIGHT/PAGE UP/PAGE DOWN movements -G Go to specified tile -U Go to start of user defined art (3584) -A Go to start of Atomic edition's art (4096) -E Go to start of extended art (6144, 9216) - -V Select from all tiles -T Select from pre-defined tileset (tiles.cfg) -Z Tile zoom -ESC Cancel -ENTER Accept - -^3Mouse: -LEFT select -CTRL+WHEEL zoom -WHEEL scroll -RIGHT smooth scrolling -^P - 0 : Rotating Sector - 1 : Pivot Sprite for SE 0 - 2 : Earthquake - 3 : Random Lights After Shot Out - 4 : Random Lights - 6 : Subway - 7 : Teleporter - 8 : Up Open Door Lights - 9 : Down Open Door Lights - 10 : Door Auto Close (Hitag = Delay) - 11 : Rotate Sector Door - 12 : Light Switch - 13 : C-9 Explosive - 14 : Subway Car - 15 : Slide Door (ST 25) - 16 : Rotate Reactor Sector - 17 : Elevator Transport (ST 15) - 18 : Incremental Sector Rise/Fall - 19 : Explosion Lowers Ceiling - 20 : Stretch (ST 27) - 21 : Drop Floor (ST 28) - 22 : Teeth Door Prong (ST 29) - 23 : One-Way Teleporter Destination - 24 : Conveyor Belt or Water Current - 25 : Engine Piston - 27 : Demo Camera - 28 : Lightning - 29 : Float (for Waves) - 30 : Two-Way Train (ST 31) - 31 : Floor Rise/Fall - 32 : Ceiling Rise/Fall - 33 : Earthquake Debris - 36 : Projectile Shooter -^P - 1 : Above Water (SE 7) - 2 : Underwater (SE 7) - 9 : Sliding Star Trek Doors - 15 : Elevator Transport (SE 17) - 16 : Elevator Platform Down - 17 : Elevator Platform Up - 18 : Elevator Down - 19 : Elevator Up - 20 : Ceiling Door - 21 : Floor Door - 22 : Splitting Door - 23 : Swinging Door - 25 : Sliding Door (SE 15) - 26 : Splitting Star Trek Door - 27 : Stretch (SE 20) - 28 : Drop Floor (SE 21) - 29 : Teeth Door Prong (SE 22) - 30 : Rotate and Rise Bridge - 31 : Two-Way Train (SE 30) - 10+++ : One-Time Sound - 32767 : Secret Room - 65534 : End Of Level with Message (sector hitag: sound #) - 65535 : End Of Level -^P -^3SE 0/1: ROTATED SECTOR - SE1: pivot - Ang: up--clockwise, down--counterclockwise - SE0: a sector to rotate - Hi = SE1 Hi - -^3SE 2: EARTHQUAKE - In quake sector, modeled as after the quake, insert additionally: - MASTERSWITCH - Lo=X - In other sector: - TOUCHPLATE - Lo=X - Anywhere: - SE33: scraps - Hi=X - -^3SE 3: RANDOM LIGHTS AFTER SHOT OUT - Light is wall: - 2-way, blockable? - Lo=X - Light is ceiling: - sector Hi=X - SE 3 in affected sector: - Hi=X - Shades: - sectors/walls: when off - SE: when on - -^3SE 4: RANDOM LIGHTS - Hi: random blink num. ^0(research!) - Shades: - sectors/walls: when off - SE: when on - -^3SE 5: ? - -^3SE 6/14: SUBWAY - subway sectors: - Hi=unique per train - SE 6: SUBWAY FRONT CAR - Ang: direction of first movement - GPSPEED: - Lo: speed (default: 256) - SE 14: SUBWAY PULLED CARS - Locators: - starting with Lo=0, ascending - Hi=1: train stops here - -^3SE 7: TRANSPORT - Hi=X link - -^3SE 8: UP OPEN DOOR LIGHTS (with ST 20) - SE 8 also in door sector - Hi=X links with other SE8 sprites - Shades: - sectors/walls: when closed - SE: when open - Walls: - Hi=1 means exclude this wall from changing shade - -^3SE 9: DOWN OPEN DOOR LIGHTS (with ST 21) - analogous SE 8 - -^3SE 10: ? - -^3SE 11: ROTATE SECTOR DOOR - Ang: up--clockwise, down--counterclockwise - Hi: link doors to be opened simulataneously - ST=23 - -^3SE 12: LIGHT SWITCH (preview with 'X) - Hi=X - Shades: - sectors/walls: when off - SE: when on - [switch]: - Lo=X - -^3SEENINE: C-9 BARREL - Hi=X - Lo=delay ^0(>0? game ticks?) - In all sectors with SEENINEs: - MASTERSWITCH Lo=X - [switch]: - Lo=X - -^3SE 13: C-9 EXPLOSIVE/BLASTABLE WALL - CRACKs/SEENINEs: Hi=X - SE 13: Hi=X - other SEENINEs: - Hi=X - Lo=delay - -^3SE 15: SLIDING DOOR (ST=25) - Ang: opposite of direction of first movement - GPSPEED: - 2*Lo: how far (BUILD units) - -^3SE 17: ELEVATOR TRANSPORT - Shade: darker on SE of starting sector - Sectors: - ST=15 - Top floor sector Hi=1 - -^3SE 18: INCREMENTAL SECTOR RISE/FALL - Hi: units moved per activation (min: 1024?) - Ang: - up--floor affected - down--ceiling affected - Pal: - 0: start at floor/ceiling height - not 0: start at SE height - [switch] & ACTIVATOR ^0(in same sector as SE?): - Lo=X - -^3SE 19: SHOT TOUCHPLATE CIELING DOWN - -^3SE 20: BRIDGE/STRETCH SECTOR (ST 27) - Ang: direction - ACTIVATOR - Hi = SE Hi = [switch] Lo - GPSPEED - Lo: how far (BUILD units) - -^3SE 21: DROP FLOOR (ST 28) - Ang: - up: drop ceiling - down: drop floor - z: end z ^0(()) - Sector: - z: start z ^0(()) - GPSPEED - Lo: rate ^0(units?) - ACTIVATOR - Lo = [switch] Lo - -^3SE 24: CONVEYOR BELT - Ang: direction - GPSPEED: - Lo=speed - -^3SE 25: ENGINE PISTON (CRUSHER) - z: starting z - Sector: - piston travels between ceiling z and floor z - -^3SE 27: CAMERA FOR PLAYBACK - Hi: radius (BUILD units?) - -^3SE 28: LIGHTNING - Hi = tile #4890 Hi - -^3SE 29: WAVES - Hi: start height (phase) - GPSPEED Lo: amplitude (default: 256) - -^0 Based on -^0 * MAP EDITING FAQ v1.3 BY JONAH BISHOP -^0 * The Duke Nukem 3D Informational Suite by Ryan Lennox -^0 * code research -^P -Foreground colors: -^0,15 0 ^1,0 1 ^2 2 ^3 3 ^4 4 ^5 5 ^6 6 ^7 7 -^8 8 ^9 9 ^10 10^11 11^12 12^13 13^14 14^15 15 - -Background colors: -^15,0 0 ^0,1 1 ^0,2 2 ^0,3 3 ^0,4 4 ^0,5 5 ^0,6 6 ^0,7 7 -^0,8 8 ^0,9 9 ^0,10 10^0,11 11^0,12 12^0,13 13^0,14 14^0,15 15 - diff --git a/polymer-perf/eduke32/names.h b/polymer-perf/eduke32/names.h deleted file mode 100644 index 2d794ee29..000000000 --- a/polymer-perf/eduke32/names.h +++ /dev/null @@ -1,765 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- - -#define SECTOREFFECTOR 1 -#define ACTIVATOR 2 -#define TOUCHPLATE 3 -#define ACTIVATORLOCKED 4 -#define MUSICANDSFX 5 -#define LOCATORS 6 -#define CYCLER 7 -#define MASTERSWITCH 8 -#define RESPAWN 9 -#define GPSPEED 10 -#define FOF 13 -#define ARROW 20 -#define FIRSTGUNSPRITE 21 -#define CHAINGUNSPRITE 22 -#define RPGSPRITE 23 -#define FREEZESPRITE 24 -#define SHRINKERSPRITE 25 -#define HEAVYHBOMB 26 -#define TRIPBOMBSPRITE 27 -#define SHOTGUNSPRITE 28 -#define DEVISTATORSPRITE 29 -#define HEALTHBOX 30 -#define AMMOBOX 31 -#define GROWSPRITEICON 32 -#define INVENTORYBOX 33 -#define FREEZEAMMO 37 -#define AMMO 40 -#define BATTERYAMMO 41 -#define DEVISTATORAMMO 42 -#define RPGAMMO 44 -#define GROWAMMO 45 -#define CRYSTALAMMO 46 -#define HBOMBAMMO 47 -#define AMMOLOTS 48 -#define SHOTGUNAMMO 49 -#define COLA 51 -#define SIXPAK 52 -#define FIRSTAID 53 -#define SHIELD 54 -#define STEROIDS 55 -#define AIRTANK 56 -#define JETPACK 57 -#define HEATSENSOR 59 -#define ACCESSCARD 60 -#define BOOTS 61 -#define MIRRORBROKE 70 -#define CLOUDYOCEAN 78 -#define CLOUDYSKIES 79 -#define MOONSKY1 80 -#define MOONSKY2 81 -#define MOONSKY3 82 -#define MOONSKY4 83 -#define BIGORBIT1 84 -#define BIGORBIT2 85 -#define BIGORBIT3 86 -#define BIGORBIT4 87 -#define BIGORBIT5 88 -#define LA 89 -#define REDSKY1 98 -#define REDSKY2 99 -#define ATOMICHEALTH 100 -#define TECHLIGHT2 120 -#define TECHLIGHTBUST2 121 -#define TECHLIGHT4 122 -#define TECHLIGHTBUST4 123 -#define WALLLIGHT4 124 -#define WALLLIGHTBUST4 125 -#define ACCESSSWITCH 130 -#define SLOTDOOR 132 -#define LIGHTSWITCH 134 -#define SPACEDOORSWITCH 136 -#define SPACELIGHTSWITCH 138 -#define FRANKENSTINESWITCH 140 -#define NUKEBUTTON 142 -#define MULTISWITCH 146 -#define DOORTILE5 150 -#define DOORTILE6 151 -#define DOORTILE1 152 -#define DOORTILE2 153 -#define DOORTILE3 154 -#define DOORTILE4 155 -#define DOORTILE7 156 -#define DOORTILE8 157 -#define DOORTILE9 158 -#define DOORTILE10 159 -#define DOORSHOCK 160 -#define DIPSWITCH 162 -#define DIPSWITCH2 164 -#define TECHSWITCH 166 -#define DIPSWITCH3 168 -#define ACCESSSWITCH2 170 -#define REFLECTWATERTILE 180 -#define FLOORSLIME 200 -#define BIGFORCE 230 -#define EPISODE 247 -#define MASKWALL9 255 -#define W_LIGHT 260 -#define SCREENBREAK1 263 -#define SCREENBREAK2 264 -#define SCREENBREAK3 265 -#define SCREENBREAK4 266 -#define SCREENBREAK5 267 -#define SCREENBREAK6 268 -#define SCREENBREAK7 269 -#define SCREENBREAK8 270 -#define SCREENBREAK9 271 -#define SCREENBREAK10 272 -#define SCREENBREAK11 273 -#define SCREENBREAK12 274 -#define SCREENBREAK13 275 -#define MASKWALL1 285 -#define W_TECHWALL1 293 -#define W_TECHWALL2 297 -#define W_TECHWALL15 299 -#define W_TECHWALL3 301 -#define W_TECHWALL4 305 -#define W_TECHWALL10 306 -#define W_TECHWALL16 307 -#define WATERTILE2 336 -#define BPANNEL1 341 -#define PANNEL1 342 -#define PANNEL2 343 -#define WATERTILE 344 -#define STATIC 351 -#define W_SCREENBREAK 357 -#define W_HITTECHWALL3 360 -#define W_HITTECHWALL4 361 -#define W_HITTECHWALL2 362 -#define W_HITTECHWALL1 363 -#define MASKWALL10 387 -#define MASKWALL11 391 -#define DOORTILE22 395 -#define FANSPRITE 407 -#define FANSPRITEBROKE 411 -#define FANSHADOW 412 -#define FANSHADOWBROKE 416 -#define DOORTILE18 447 -#define DOORTILE19 448 -#define DOORTILE20 449 -// #define SPACESHUTTLE 487 -#define SATELLITE 489 -#define VIEWSCREEN2 499 -#define VIEWSCREENBROKE 501 -#define VIEWSCREEN 502 -#define GLASS 503 -#define GLASS2 504 -#define STAINGLASS1 510 -#define MASKWALL5 514 -#define SATELITE 516 -#define FUELPOD 517 -#define SLIMEPIPE 538 -#define CRACK1 546 -#define CRACK2 547 -#define CRACK3 548 -#define CRACK4 549 -#define FOOTPRINTS 550 -#define DOMELITE 551 -#define CAMERAPOLE 554 -#define CHAIR1 556 -#define CHAIR2 557 -#define BROKENCHAIR 559 -#define MIRROR 560 -#define WATERFOUNTAIN 563 -#define WATERFOUNTAINBROKE 567 -#define FEMMAG1 568 -#define TOILET 569 -#define STALL 571 -#define STALLBROKE 573 -#define FEMMAG2 577 -#define REACTOR2 578 -#define REACTOR2BURNT 579 -#define REACTOR2SPARK 580 -#define GRATE1 595 -#define BGRATE1 596 -#define SOLARPANNEL 602 -#define NAKED1 603 -#define ANTENNA 607 -#define MASKWALL12 609 -#define TOILETBROKE 615 -#define PIPE2 616 -#define PIPE1B 617 -#define PIPE3 618 -#define PIPE1 619 -#define CAMERA1 621 -#define BRICK 626 -#define SPLINTERWOOD 630 -#define PIPE2B 633 -#define BOLT1 634 -#define W_NUMBERS 640 -#define WATERDRIP 660 -#define WATERBUBBLE 661 -#define WATERBUBBLEMAKER 662 -#define W_FORCEFIELD 663 -#define VACUUM 669 -#define FOOTPRINTS2 672 -#define FOOTPRINTS3 673 -#define FOOTPRINTS4 674 -#define EGG 675 -#define SCALE 678 -#define CHAIR3 680 -#define CAMERALIGHT 685 -#define MOVIECAMERA 686 -#define IVUNIT 689 -#define POT1 694 -#define POT2 695 -#define POT3 697 -#define PIPE3B 700 -#define WALLLIGHT3 701 -#define WALLLIGHTBUST3 702 -#define WALLLIGHT1 703 -#define WALLLIGHTBUST1 704 -#define WALLLIGHT2 705 -#define WALLLIGHTBUST2 706 -#define LIGHTSWITCH2 712 -#define WAITTOBESEATED 716 -#define DOORTILE14 717 -#define STATUE 753 -#define MIKE 762 -#define VASE 765 -#define SUSHIPLATE1 768 -#define SUSHIPLATE2 769 -#define SUSHIPLATE3 774 -#define SUSHIPLATE4 779 -#define DOORTILE16 781 -#define SUSHIPLATE5 792 -#define OJ 806 -#define MASKWALL13 830 -#define HURTRAIL 859 -#define POWERSWITCH1 860 -#define LOCKSWITCH1 862 -#define POWERSWITCH2 864 -#define ATM 867 -#define STATUEFLASH 869 -#define ATMBROKE 888 -#define BIGHOLE2 893 -#define STRIPEBALL 901 -#define QUEBALL 902 -#define POCKET 903 -#define WOODENHORSE 904 -#define TREE1 908 -#define TREE2 910 -#define CACTUS 911 -#define MASKWALL2 913 -#define MASKWALL3 914 -#define MASKWALL4 915 -#define FIREEXT 916 -#define TOILETWATER 921 -#define NEON1 925 -#define NEON2 926 -#define CACTUSBROKE 939 -#define BOUNCEMINE 940 -#define BROKEFIREHYDRENT 950 -#define BOX 951 -#define BULLETHOLE 952 -#define BOTTLE1 954 -#define BOTTLE2 955 -#define BOTTLE3 956 -#define BOTTLE4 957 -#define FEMPIC5 963 -#define FEMPIC6 964 -#define FEMPIC7 965 -#define HYDROPLANT 969 -#define OCEANSPRITE1 971 -#define OCEANSPRITE2 972 -#define OCEANSPRITE3 973 -#define OCEANSPRITE4 974 -#define OCEANSPRITE5 975 -#define GENERICPOLE 977 -#define CONE 978 -#define HANGLIGHT 979 -#define HYDRENT 981 -#define MASKWALL14 988 -#define TIRE 990 -#define PIPE5 994 -#define PIPE6 995 -#define PIPE4 996 -#define PIPE4B 997 -#define BROKEHYDROPLANT 1003 -#define PIPE5B 1005 -#define NEON3 1007 -#define NEON4 1008 -#define NEON5 1009 -#define BOTTLE5 1012 -#define BOTTLE6 1013 -#define BOTTLE8 1014 -#define SPOTLITE 1020 -#define HANGOOZ 1022 -#define MASKWALL15 1024 -#define BOTTLE7 1025 -#define HORSEONSIDE 1026 -#define GLASSPIECES 1031 -#define HORSELITE 1034 -#define DONUTS 1045 -#define NEON6 1046 -#define MASKWALL6 1059 -#define CLOCK 1060 -#define RUBBERCAN 1062 -#define BROKENCLOCK 1067 -#define PLUG 1069 -#define OOZFILTER 1079 -#define FLOORPLASMA 1082 -#define REACTOR 1088 -#define REACTORSPARK 1092 -#define REACTORBURNT 1096 -#define DOORTILE15 1102 -#define HANDSWITCH 1111 -#define CIRCLEPANNEL 1113 -#define CIRCLEPANNELBROKE 1114 -#define PULLSWITCH 1122 -#define MASKWALL8 1124 -#define BIGHOLE 1141 -#define ALIENSWITCH 1142 -#define DOORTILE21 1144 -#define HANDPRINTSWITCH 1155 -#define BOTTLE10 1157 -#define BOTTLE11 1158 -#define BOTTLE12 1159 -#define BOTTLE13 1160 -#define BOTTLE14 1161 -#define BOTTLE15 1162 -#define BOTTLE16 1163 -#define BOTTLE17 1164 -#define BOTTLE18 1165 -#define BOTTLE19 1166 -#define DOORTILE17 1169 -#define MASKWALL7 1174 -#define JAILBARBREAK 1175 -#define DOORTILE11 1178 -#define DOORTILE12 1179 -#define VENDMACHINE 1212 -#define VENDMACHINEBROKE 1214 -#define COLAMACHINE 1215 -#define COLAMACHINEBROKE 1217 -#define CRANEPOLE 1221 -#define CRANE 1222 -#define BARBROKE 1225 -#define BLOODPOOL 1226 -#define NUKEBARREL 1227 -#define NUKEBARRELDENTED 1228 -#define NUKEBARRELLEAKED 1229 -#define CANWITHSOMETHING 1232 -#define MONEY 1233 -#define BANNER 1236 -#define EXPLODINGBARREL 1238 -#define EXPLODINGBARREL2 1239 -#define FIREBARREL 1240 -#define SEENINE 1247 -#define SEENINEDEAD 1248 -#define STEAM 1250 -#define CEILINGSTEAM 1255 -#define PIPE6B 1260 -#define TRANSPORTERBEAM 1261 -#define RAT 1267 -#define TRASH 1272 -#define FEMPIC1 1280 -#define FEMPIC2 1289 -#define BLANKSCREEN 1293 -#define PODFEM1 1294 -#define FEMPIC3 1298 -#define FEMPIC4 1306 -#define FEM1 1312 -#define FEM2 1317 -#define FEM3 1321 -#define FEM5 1323 -#define BLOODYPOLE 1324 -#define FEM4 1325 -#define FEM6 1334 -#define FEM6PAD 1335 -#define FEM8 1336 -#define HELECOPT 1346 -#define FETUSJIB 1347 -#define HOLODUKE 1348 -#define SPACEMARINE 1353 -#define INDY 1355 -#define FETUS 1358 -#define FETUSBROKE 1359 -#define MONK 1352 -#define LUKE 1354 -#define COOLEXPLOSION1 1360 -#define WATERSPLASH2 1380 -#define FIREVASE 1390 -#define SCRATCH 1393 -#define FEM7 1395 -#define APLAYERTOP 1400 -#define APLAYER 1405 -#define PLAYERONWATER 1420 -#define DUKELYINGDEAD 1518 -#define DUKETORSO 1520 -#define DUKEGUN 1528 -#define DUKELEG 1536 -#define SHARK 1550 -#define BLOOD 1620 -#define FIRELASER 1625 -#define TRANSPORTERSTAR 1630 -#define SPIT 1636 -#define LOOGIE 1637 -#define FIST 1640 -#define FREEZEBLAST 1641 -#define DEVISTATORBLAST 1642 -#define SHRINKSPARK 1646 -#define TONGUE 1647 -#define MORTER 1650 -#define SHRINKEREXPLOSION 1656 -#define RADIUSEXPLOSION 1670 -#define FORCERIPPLE 1671 -#define LIZTROOP 1680 -#define LIZTROOPRUNNING 1681 -#define LIZTROOPSTAYPUT 1682 -#define LIZTOP 1705 -#define LIZTROOPSHOOT 1715 -#define LIZTROOPJETPACK 1725 -#define LIZTROOPDSPRITE 1734 -#define LIZTROOPONTOILET 1741 -#define LIZTROOPJUSTSIT 1742 -#define LIZTROOPDUCKING 1744 -#define HEADJIB1 1768 -#define ARMJIB1 1772 -#define LEGJIB1 1776 -#define CANNONBALL 1817 -#define OCTABRAIN 1820 -#define OCTABRAINSTAYPUT 1821 -#define OCTATOP 1845 -#define OCTADEADSPRITE 1855 -#define INNERJAW 1860 -#define DRONE 1880 -#define EXPLOSION2 1890 -#define COMMANDER 1920 -#define COMMANDERSTAYPUT 1921 -#define RECON 1960 -#define TANK 1975 -#define PIGCOP 2000 -#define PIGCOPSTAYPUT 2001 -#define PIGCOPDIVE 2045 -#define PIGCOPDEADSPRITE 2060 -#define PIGTOP 2061 -#define LIZMAN 2120 -#define LIZMANSTAYPUT 2121 -#define LIZMANSPITTING 2150 -#define LIZMANFEEDING 2160 -#define LIZMANJUMP 2165 -#define LIZMANDEADSPRITE 2185 -#define FECES 2200 -#define LIZMANHEAD1 2201 -#define LIZMANARM1 2205 -#define LIZMANLEG1 2209 -#define EXPLOSION2BOT 2219 -#define USERWEAPON 2235 -#define HEADERBAR 2242 -#define JIBS1 2245 -#define JIBS2 2250 -#define JIBS3 2255 -#define JIBS4 2260 -#define JIBS5 2265 -#define BURNING 2270 -#define FIRE 2271 -#define JIBS6 2286 -#define BLOODSPLAT1 2296 -#define BLOODSPLAT3 2297 -#define BLOODSPLAT2 2298 -#define BLOODSPLAT4 2299 -#define OOZ 2300 -#define OOZ2 2309 -#define WALLBLOOD1 2301 -#define WALLBLOOD2 2302 -#define WALLBLOOD3 2303 -#define WALLBLOOD4 2304 -#define WALLBLOOD5 2305 -#define WALLBLOOD6 2306 -#define WALLBLOOD7 2307 -#define WALLBLOOD8 2308 -#define BURNING2 2310 -#define FIRE2 2311 -#define CRACKKNUCKLES 2324 -#define SMALLSMOKE 2329 -#define SMALLSMOKEMAKER 2330 -#define FLOORFLAME 2333 -#define ROTATEGUN 2360 -#define GREENSLIME 2370 -#define WATERDRIPSPLASH 2380 -#define SCRAP6 2390 -#define SCRAP1 2400 -#define SCRAP2 2404 -#define SCRAP3 2408 -#define SCRAP4 2412 -#define SCRAP5 2416 -#define ORGANTIC 2420 -#define BETAVERSION 2440 -#define PLAYERISHERE 2442 -#define PLAYERWASHERE 2443 -#define SELECTDIR 2444 -#define F1HELP 2445 -#define NOTCHON 2446 -#define NOTCHOFF 2447 -#define GROWSPARK 2448 -#define DUKEICON 2452 -#define BADGUYICON 2453 -#define FOODICON 2454 -#define GETICON 2455 -#define MENUSCREEN 2456 -#define MENUBAR 2457 -#define KILLSICON 2458 -#define FIRSTAID_ICON 2460 -#define HEAT_ICON 2461 -#define BOTTOMSTATUSBAR 2462 -#define BOOT_ICON 2463 -#define FRAGBAR 2465 -#define JETPACK_ICON 2467 -#define AIRTANK_ICON 2468 -#define STEROIDS_ICON 2469 -#define HOLODUKE_ICON 2470 -#define ACCESS_ICON 2471 -#define DIGITALNUM 2472 -#define DUKECAR 2491 -#define CAMCORNER 2482 -#define CAMLIGHT 2484 -#define LOGO 2485 -#define TITLE 2486 -#define NUKEWARNINGICON 2487 -#define MOUSECURSOR 2488 -#define SLIDEBAR 2489 -#define DREALMS 2492 -#define BETASCREEN 2493 -#define WINDOWBORDER1 2494 -#define TEXTBOX 2495 -#define WINDOWBORDER2 2496 -#define DUKENUKEM 2497 -#define THREEDEE 2498 -#define INGAMEDUKETHREEDEE 2499 -#define TENSCREEN 2500 -#define PLUTOPAKSPRITE 2501 -#define DEVISTATOR 2510 -#define KNEE 2521 -#define CROSSHAIR 2523 -#define FIRSTGUN 2524 -#define FIRSTGUNRELOAD 2528 -#define FALLINGCLIP 2530 -#define CLIPINHAND 2531 -#define HAND 2532 -#define SHELL 2533 -#define SHOTGUNSHELL 2535 -#define CHAINGUN 2536 -#define RPGGUN 2544 -#define RPGMUZZLEFLASH 2545 -#define FREEZE 2548 -#define CATLITE 2552 -#define SHRINKER 2556 -#define HANDHOLDINGLASER 2563 -#define TRIPBOMB 2566 -#define LASERLINE 2567 -#define HANDHOLDINGACCESS 2568 -#define HANDREMOTE 2570 -#define HANDTHROW 2573 -#define TIP 2576 -#define GLAIR 2578 -#define SCUBAMASK 2581 -#define SPACEMASK 2584 -#define FORCESPHERE 2590 -#define SHOTSPARK1 2595 -#define RPG 2605 -#define LASERSITE 2612 -#define SHOTGUN 2613 -#define BOSS1 2630 -#define BOSS1STAYPUT 2631 -#define BOSS1SHOOT 2660 -#define BOSS1LOB 2670 -#define BOSSTOP 2696 -#define BOSS2 2710 -#define BOSS3 2760 -#define SPINNINGNUKEICON 2813 -#define BIGFNTCURSOR 2820 -#define SMALLFNTCURSOR 2821 -#define STARTALPHANUM 2822 -#define ENDALPHANUM 2915 -#define BIGALPHANUM 2940 -#define BIGPERIOD 3002 -#define BIGCOMMA 3003 -#define BIGX 3004 -#define BIGQ 3005 -#define BIGSEMI 3006 -#define BIGCOLIN 3007 -#define THREEBYFIVE 3010 -#define BIGAPPOS 3022 -#define BLANK 3026 -#define MINIFONT 3072 -#define BUTTON1 3164 -#define GLASS3 3187 -#define RESPAWNMARKERRED 3190 -#define RESPAWNMARKERYELLOW 3200 -#define RESPAWNMARKERGREEN 3210 -#define BONUSSCREEN 3240 -#define VIEWBORDER 3250 -#define VICTORY1 3260 -#define ORDERING 3270 -#define TEXTSTORY 3280 -#define LOADSCREEN 3281 -#define BORNTOBEWILDSCREEN 3370 -#define BLIMP 3400 -#define FEM9 3450 -#define FOOTPRINT 3701 -#define FRAMEEFFECT1_13 3999 -#define POOP 4094 -#define FRAMEEFFECT1 4095 -#define PANNEL3 4099 -#define SCREENBREAK14 4120 -#define SCREENBREAK15 4123 -#define SCREENBREAK19 4125 -#define SCREENBREAK16 4127 -#define SCREENBREAK17 4128 -#define SCREENBREAK18 4129 -#define W_TECHWALL11 4130 -#define W_TECHWALL12 4131 -#define W_TECHWALL13 4132 -#define W_TECHWALL14 4133 -#define W_TECHWALL5 4134 -#define W_TECHWALL6 4136 -#define W_TECHWALL7 4138 -#define W_TECHWALL8 4140 -#define W_TECHWALL9 4142 -#define BPANNEL3 4100 -#define W_HITTECHWALL16 4144 -#define W_HITTECHWALL10 4145 -#define W_HITTECHWALL15 4147 -#define W_MILKSHELF 4181 -#define W_MILKSHELFBROKE 4203 -#define PURPLELAVA 4240 -#define LAVABUBBLE 4340 -#define DUKECUTOUT 4352 -#define TARGET 4359 -#define GUNPOWDERBARREL 4360 -#define DUCK 4361 -#define HATRACK 4367 -#define DESKLAMP 4370 -#define COFFEEMACHINE 4372 -#define CUPS 4373 -#define GAVALS 4374 -#define GAVALS2 4375 -#define POLICELIGHTPOLE 4377 -#define FLOORBASKET 4388 -#define PUKE 4389 -#define DOORTILE23 4391 -#define TOPSECRET 4396 -#define SPEAKER 4397 -#define TEDDYBEAR 4400 -#define ROBOTDOG 4402 -#define ROBOTPIRATE 4404 -#define ROBOTMOUSE 4407 -#define MAIL 4410 -#define MAILBAG 4413 -#define HOTMEAT 4427 -#define COFFEEMUG 4438 -#define DONUTS2 4440 -#define TRIPODCAMERA 4444 -#define METER 4453 -#define DESKPHONE 4454 -#define GUMBALLMACHINE 4458 -#define GUMBALLMACHINEBROKE 4459 -#define PAPER 4460 -#define MACE 4464 -#define GENERICPOLE2 4465 -#define XXXSTACY 4470 -#define WETFLOOR 4495 -#define BROOM 4496 -#define MOP 4497 -#define LETTER 4502 -#define PIRATE1A 4510 -#define PIRATE4A 4511 -#define PIRATE2A 4512 -#define PIRATE5A 4513 -#define PIRATE3A 4514 -#define PIRATE6A 4515 -#define PIRATEHALF 4516 -#define CHESTOFGOLD 4520 -#define SIDEBOLT1 4525 -#define FOODOBJECT1 4530 -#define FOODOBJECT2 4531 -#define FOODOBJECT3 4532 -#define FOODOBJECT4 4533 -#define FOODOBJECT5 4534 -#define FOODOBJECT6 4535 -#define FOODOBJECT7 4536 -#define FOODOBJECT8 4537 -#define FOODOBJECT9 4538 -#define FOODOBJECT10 4539 -#define FOODOBJECT11 4540 -#define FOODOBJECT12 4541 -#define FOODOBJECT13 4542 -#define FOODOBJECT14 4543 -#define FOODOBJECT15 4544 -#define FOODOBJECT16 4545 -#define FOODOBJECT17 4546 -#define FOODOBJECT18 4547 -#define FOODOBJECT19 4548 -#define FOODOBJECT20 4549 -#define HEADLAMP 4550 -#define TAMPON 4557 -#define SKINNEDCHICKEN 4554 -#define FEATHEREDCHICKEN 4555 -#define ROBOTDOG2 4560 -#define JOLLYMEAL 4569 -#define DUKEBURGER 4570 -#define SHOPPINGCART 4576 -#define CANWITHSOMETHING2 4580 -#define CANWITHSOMETHING3 4581 -#define CANWITHSOMETHING4 4582 -#define SNAKEP 4590 -#define DOLPHIN1 4591 -#define DOLPHIN2 4592 -#define NEWBEAST 4610 -#define NEWBEASTSTAYPUT 4611 -#define NEWBEASTJUMP 4690 -#define NEWBEASTHANG 4670 -#define NEWBEASTHANGDEAD 4671 -#define BOSS4 4740 -#define BOSS4STAYPUT 4741 -#define FEM10 4864 -#define TOUGHGAL 4866 -#define MAN 4871 -#define MAN2 4872 -#define WOMAN 4874 -#define PLEASEWAIT 4887 -#define NATURALLIGHTNING 4890 -#define WEATHERWARN 4893 -#define DUKETAG 4900 -#define SIGN1 4909 -#define SIGN2 4912 -#define JURYGUY 4943 - -// These tile positions are reserved! -#define RESERVEDSLOT1 6132 -#define RESERVEDSLOT2 6133 -#define RESERVEDSLOT3 6134 -#define RESERVEDSLOT4 6135 -#define RESERVEDSLOT5 6136 -#define RESERVEDSLOT6 6137 -#define RESERVEDSLOT7 6138 -#define RESERVEDSLOT8 6139 -#define RESERVEDSLOT9 6140 -#define RESERVEDSLOT10 6141 -#define RESERVEDSLOT11 6142 -#define RESERVEDSLOT12 6143 diff --git a/polymer-perf/eduke32/nedmalloc.dll b/polymer-perf/eduke32/nedmalloc.dll deleted file mode 100644 index 4952fe2bf..000000000 Binary files a/polymer-perf/eduke32/nedmalloc.dll and /dev/null differ diff --git a/polymer-perf/eduke32/obj/keep.me b/polymer-perf/eduke32/obj/keep.me deleted file mode 100644 index e69de29bb..000000000 diff --git a/polymer-perf/eduke32/obj_win/keep.me b/polymer-perf/eduke32/obj_win/keep.me deleted file mode 100644 index e69de29bb..000000000 diff --git a/polymer-perf/eduke32/psd/game2.psd b/polymer-perf/eduke32/psd/game2.psd deleted file mode 100644 index 3b7c1fbf2..000000000 Binary files a/polymer-perf/eduke32/psd/game2.psd and /dev/null differ diff --git a/polymer-perf/eduke32/psd/game3.psd b/polymer-perf/eduke32/psd/game3.psd deleted file mode 100644 index dc6eaefe9..000000000 Binary files a/polymer-perf/eduke32/psd/game3.psd and /dev/null differ diff --git a/polymer-perf/eduke32/rsrc/build.bmp b/polymer-perf/eduke32/rsrc/build.bmp deleted file mode 100644 index e6ee6fc6d..000000000 Binary files a/polymer-perf/eduke32/rsrc/build.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/rsrc/build_icon.bmp b/polymer-perf/eduke32/rsrc/build_icon.bmp deleted file mode 100644 index fdb5e8899..000000000 Binary files a/polymer-perf/eduke32/rsrc/build_icon.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/rsrc/build_icon.c b/polymer-perf/eduke32/rsrc/build_icon.c deleted file mode 100644 index aff10f26d..000000000 --- a/polymer-perf/eduke32/rsrc/build_icon.c +++ /dev/null @@ -1,417 +0,0 @@ -#include "sdlayer.h" - -static unsigned int sdlappicon_pixels[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01ff0101, 0x28ff8b19, - 0x5fff8b19, 0x92ff8b19, 0xb8ff8b19, 0xd1ff8b19, 0xe3ff8b19, 0xedff8b19, - 0xedff8b19, 0xe3ff8b19, 0xd1ff8b19, 0xb8ff8b19, 0x92ff8b19, 0x5fff8b19, - 0x28ff8b19, 0x01ff0101, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x1eff8b19, 0x73ff8b19, 0xc4ff8b19, 0xf5ff8b19, - 0xffff9e3f, 0xfffeb166, 0xffffc185, 0xfffed1a6, 0xffffe1c3, 0xffffe2c5, - 0xffffe0c1, 0xffffd5ab, 0xffffc287, 0xfffeb268, 0xffffa54d, 0xffff9731, - 0xf5ff8b19, 0xc4ff8b19, 0x73ff8b19, 0x1eff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x26ff911b, 0x92ff8b19, 0xecff8b19, 0xffffa145, 0xfffecc9c, 0xffffefe1, - 0xfffffbf7, 0xfffffefd, 0xfffffefd, 0xfffffcf9, 0xfffff7ef, 0xfffff1e3, - 0xffffeddd, 0xffffe8d1, 0xfffedfc0, 0xfffedcba, 0xfffedcba, 0xffffd6ad, - 0xfffecea0, 0xfffeb874, 0xffff9935, 0xecff8b19, 0x92ff8b19, 0x26ff911b, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0cff8315, 0x7cff8b19, - 0xecff8b19, 0xffffa751, 0xfffeddbc, 0xfffff5eb, 0xfffffaf5, 0xfffffaf5, - 0xfffffcf9, 0xfffff9f3, 0xfffffaf5, 0xfffffaf5, 0xfffff5eb, 0xffffefe1, - 0xfffeecda, 0xffffe6cd, 0xfffeddbc, 0xffffdab5, 0xffffd7af, 0xfffed2a8, - 0xfffed1a6, 0xfffed4aa, 0xffffdab5, 0xfffecfa2, 0xffffa44b, 0xecff8b19, - 0x7cff8b19, 0x0cff8315, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x34ff8b19, 0xc5ff8b19, 0xffff9935, - 0xfffecd9e, 0xfffee5cc, 0xffffebd7, 0xffffefe1, 0xfffff5eb, 0xfffff8f1, - 0xfffffbf7, 0xfffffcf9, 0xfffffcf9, 0xfffffdfb, 0xfffffcf9, 0xfffffcf9, - 0xfffffbf7, 0xfffff7ef, 0xfffff1e3, 0xffffead5, 0xfffeddbc, 0xfffed0a4, - 0xfffed0a4, 0xfffed2a8, 0xffffdab5, 0xffffe2c5, 0xfffee5cc, 0xffffd7af, - 0xffff9c3b, 0xc5ff8b19, 0x34ff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x5aff8b19, 0xeeff8b19, 0xffffa44b, 0xfffed0a4, - 0xffffd9b3, 0xfffedebe, 0xfffee5cc, 0xfffeecda, 0xfffff5eb, 0xfffffbf7, - 0xfffffefd, 0xffffeddd, 0xffffd5ab, 0xffffc389, 0xfffeb670, 0xfffeab5a, - 0xffffa853, 0xfffead5e, 0xfffeb874, 0xfffecc9c, 0xffffebd7, 0xfffffaf5, - 0xffffebd7, 0xfffeddbc, 0xfffedfc0, 0xffffe2c5, 0xfffee4ca, 0xffffead5, - 0xfffff1e3, 0xfffeb46c, 0xeeff8b19, 0x5aff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x71ff8b19, 0xfcff8b19, 0xfffead5e, 0xffffc995, 0xffffcb99, - 0xfffed1a6, 0xffffdbb7, 0xffffebd7, 0xfffff9f3, 0xffffead5, 0xffffc68f, - 0xffffa751, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9935, 0xffff962f, - 0xffff9227, 0xffff8d1d, 0xffff8813, 0xffff8711, 0xffff850d, 0xffff9125, - 0xfffeba78, 0xffffe7cf, 0xfffff7ef, 0xfffeecda, 0xffffe7cf, 0xffffeddb, - 0xfffff4e9, 0xfffff6ed, 0xffffca97, 0xfcff8b19, 0x71ff8b19, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x71ff8b19, 0xffff8813, 0xfffead5e, 0xffffc389, 0xffffc389, 0xffffc791, - 0xfffed2a8, 0xffffeddb, 0xfffee9d4, 0xfffeae60, 0xffff942b, 0xffff9731, - 0xffff9b39, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff962f, - 0xffff9329, 0xffff8c1b, 0xffff8813, 0xffff8711, 0xffff8309, 0xffff8207, - 0xffff840b, 0xffff8a17, 0xfffead5e, 0xffffead5, 0xfffff7ef, 0xfffff2e5, - 0xfffff5eb, 0xfffff4e9, 0xfffff6ed, 0xffffd7af, 0xffff8e1f, 0x71ff8b19, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5aff8b19, - 0xfcff8b19, 0xfffeab5a, 0xfffebd7e, 0xfffebc7c, 0xffffc083, 0xffffd7af, - 0xfffffdfb, 0xfffeba78, 0xffff860f, 0xffff8c1b, 0xffff9125, 0xffff962f, - 0xffff9a37, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff9731, - 0xffff9329, 0xffff8c1b, 0xffff8813, 0xffff860f, 0xffff8309, 0xffff8207, - 0xffff860f, 0xffff8b19, 0xffff8d1d, 0xffff9023, 0xffffc58d, 0xfffffefd, - 0xfffff7ef, 0xfffff4e9, 0xfffff1e3, 0xffffefe1, 0xfffed0a4, 0xfcff8b19, - 0x5aff8b19, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x31ff8c1b, 0xedff8b19, - 0xffffa751, 0xfffebe80, 0xfffeb874, 0xfffeba78, 0xffffdbb7, 0xfffff5eb, - 0xffff9e3f, 0xffff7f01, 0xffff8309, 0xffff8813, 0xffff8f21, 0xffff942b, - 0xffff9833, 0xffff9b39, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff9731, - 0xffff9227, 0xffff8c1b, 0xffff8813, 0xffff850d, 0xffff8207, 0xffff8309, - 0xffff8915, 0xffff8d1d, 0xffff8e1f, 0xffff942b, 0xffff9731, 0xfffeb46c, - 0xfffff8f1, 0xfffff7ef, 0xffffeddb, 0xffffe7cf, 0xfffee5cc, 0xffffbf81, - 0xedff8b19, 0x31ff8c1b, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0bff8f17, 0xc8ff8b19, 0xffff9d3d, - 0xffffc68f, 0xffffc083, 0xfffebd7e, 0xffffdbb7, 0xfffeecda, 0xffff8915, - 0xfff07700, 0xfff87b00, 0xffff7f01, 0xffff840b, 0xffff8c1b, 0xffff9227, - 0xffff9731, 0xffff9b39, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff9731, - 0xffff9227, 0xffff8c1b, 0xffff8711, 0xffff850d, 0xffff8207, 0xffff850d, - 0xffff8b19, 0xffff8d1d, 0xffff9125, 0xffff9731, 0xffff9833, 0xffff9833, - 0xffffa54d, 0xffffefe1, 0xfffff2e5, 0xffffe0c1, 0xfffeddbc, 0xffffe1c3, - 0xffffa955, 0xc8ff8b19, 0x0bff8f17, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x7cff8b19, 0xffff9023, 0xffffcb99, - 0xffffc995, 0xffffc48b, 0xffffdab5, 0xfffff1e3, 0xffff8309, 0xffec7500, - 0xffee7600, 0xfff27800, 0xfffa7c00, 0xffff942b, 0xffffd7af, 0xffff9731, - 0xffff952d, 0xffff9935, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9731, - 0xffff9227, 0xffff8a17, 0xffff8711, 0xffff840b, 0xffff8309, 0xffff8813, - 0xffff8d1d, 0xfffeba78, 0xffffa64f, 0xffff9833, 0xffff9833, 0xffff962f, - 0xffff942b, 0xffff9b39, 0xfffff3e7, 0xffffead5, 0xffffdbb7, 0xffffdbb7, - 0xffffd7af, 0xffff9227, 0x7cff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x22ff8a17, 0xeeff8b19, 0xffffc083, 0xfffed2a8, - 0xfffecc9c, 0xfffed1a6, 0xfffffcf9, 0xffff942b, 0xffec7500, 0xffea7400, - 0xffea7400, 0xffee7600, 0xffff9f41, 0xfffff9f3, 0xffffead5, 0xfffecfa2, - 0xffff9227, 0xffff8d1d, 0xffff7f01, 0xffe06f00, 0xffc66200, 0xffb45900, - 0xffb45900, 0xffc05f00, 0xffd06700, 0xffe27000, 0xfffc7d00, 0xffff8a17, - 0xffff9d3d, 0xfffffdfb, 0xfffffaf5, 0xfffeb56e, 0xffff9731, 0xffff942b, - 0xffff8f21, 0xffff8b19, 0xffffa145, 0xfffffcf9, 0xfffedebe, 0xffffd5ab, - 0xfffed0a4, 0xffffc287, 0xeeff8b19, 0x22ff8a17, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x92ff8b19, 0xffff9c3b, 0xfffedcba, 0xffffd5ab, - 0xfffed2a8, 0xffffebd7, 0xfffeb670, 0xfffa7c00, 0xfff47900, 0xfff07700, - 0xffea7400, 0xfffeaa58, 0xfffffdfb, 0xffffd5ab, 0xffffcb99, 0xfffffcf9, - 0xffff860f, 0xffae5600, 0xffaa5400, 0xffa65200, 0xffa25000, 0xffa04f00, - 0xffa04f00, 0xffa25000, 0xffa65200, 0xffaa5400, 0xffae5600, 0xffe47100, - 0xffffd6ad, 0xfffff8f1, 0xfffff8f1, 0xfffffefd, 0xfffebd7e, 0xffff8f21, - 0xffff8c1b, 0xffff8a17, 0xffff8711, 0xfffeba78, 0xfffeecda, 0xfffecd9e, - 0xfffecc9c, 0xfffecea0, 0xffff9b39, 0x92ff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x1eff8b19, 0xedff8b19, 0xfffecc9c, 0xffffe0c1, 0xffffdab5, - 0xfffee5cc, 0xffffe8d1, 0xffff8309, 0xffff8003, 0xffff7f01, 0xfff67a00, - 0xffff9f41, 0xfffffdfb, 0xffffc893, 0xfffebe80, 0xfffeb36a, 0xffffc68f, - 0xfffecc9c, 0xffa25000, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa25000, 0xffe87300, - 0xffffeddb, 0xffffd6ad, 0xfffff3e7, 0xffffefe1, 0xfffffefd, 0xfffead5e, - 0xffff8a17, 0xffff8711, 0xffff8309, 0xffff8207, 0xffffe7cf, 0xfffedcba, - 0xffffc893, 0xffffc995, 0xffffc083, 0xedff8b19, 0x1eff8b19, 0x00000000, - 0x00000000, 0x71ff8b19, 0xffff9833, 0xffffe6cd, 0xffffe2c5, 0xfffedfc0, - 0xfffff6ed, 0xffffa853, 0xffff860f, 0xffff840b, 0xffff8207, 0xffff942b, - 0xfffff7ef, 0xfffed2a8, 0xfffeba78, 0xffffa955, 0xffffa853, 0xfffeddbc, - 0xffffffff, 0xffff8207, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffecd9e, - 0xffffead5, 0xffffa853, 0xffffc995, 0xffffe2c5, 0xffffe7cf, 0xfffff8f1, - 0xffff9833, 0xffff8207, 0xffff8003, 0xffff7f01, 0xffffa145, 0xfffff1e3, - 0xffffc995, 0xffffca97, 0xfffecea0, 0xffff952d, 0x71ff8b19, 0x00000000, - 0x03ff5b01, 0xc5ff8b19, 0xfffebb7a, 0xffffe2c5, 0xfffedebe, 0xffffe6cd, - 0xffffe8d1, 0xffff8b19, 0xffff8a17, 0xffff8915, 0xffff8711, 0xffffdbb7, - 0xfffee4ca, 0xffffc893, 0xfffeb166, 0xffffa853, 0xfffee5cc, 0xffffffff, - 0xffffffff, 0xffffe6cd, 0xffa85300, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffa7c00, 0xffffffff, - 0xffffffff, 0xfffee5cc, 0xffffa853, 0xffffc58d, 0xffffdab5, 0xffffe7cf, - 0xffffdbb7, 0xffff8003, 0xffff7f01, 0xfffc7d00, 0xfffc7d00, 0xfffee5cc, - 0xffffd6ad, 0xffffcb99, 0xfffecd9e, 0xfffeb268, 0xc5ff8b19, 0x03ff5b01, - 0x27ff8c1b, 0xf6ff8b19, 0xffffd6ad, 0xfffedcba, 0xfffeddbc, 0xfffff2e5, - 0xfffeb976, 0xffff8c1b, 0xffff8c1b, 0xffff8c1b, 0xffffa751, 0xfffff6ed, - 0xffffd8b1, 0xffffc893, 0xffff9a37, 0xfffeddbc, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffa145, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffedcba, 0xffffffff, - 0xffffffff, 0xffffffff, 0xfffeddbc, 0xffff9a37, 0xffffc791, 0xfffecc9c, - 0xfffff2e5, 0xffff9e3f, 0xffff7f01, 0xffff7f01, 0xffff8003, 0xfffeb268, - 0xffffead5, 0xffffca97, 0xffffca97, 0xffffc893, 0xf6ff8b19, 0x27ff8c1b, - 0x5fff8b19, 0xffff9833, 0xfffedcba, 0xffffdbb7, 0xffffdbb7, 0xfffffefd, - 0xffff9125, 0xffff8a17, 0xffff8a17, 0xffff8c1b, 0xffffe1c3, 0xffffead5, - 0xfffedebe, 0xfffeb36a, 0xffffc58d, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xfffff7ef, 0xffc66200, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffff8915, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffc58d, 0xfffeaa58, 0xffffca97, - 0xfffeddbc, 0xfffedebe, 0xffff7f01, 0xffff7f01, 0xffff7f01, 0xffff8711, - 0xfffffdfb, 0xfffecd9e, 0xfffecd9e, 0xfffed1a6, 0xffff962f, 0x5fff8b19, - 0x92ff8b19, 0xffffa44b, 0xfffedcba, 0xffffd9b3, 0xffffe1c3, 0xfffee4ca, - 0xffff8813, 0xffff8813, 0xffff8813, 0xffff9731, 0xfffffefd, 0xfffedfc0, - 0xfffed1a6, 0xffff9f41, 0xfffef0e0, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffc083, 0xffda6c00, 0xfffeaa58, - 0xfffeb874, 0xffff9329, 0xffbc5d00, 0xffffe6cd, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffef0e0, 0xffff9f41, 0xffffc185, - 0xffffcb99, 0xfffffdfb, 0xffff8d1d, 0xffff7f01, 0xffff8003, 0xffff8105, - 0xffffe3c7, 0xffffdbb7, 0xfffed0a4, 0xffffd6ad, 0xffffa247, 0x92ff8b19, - 0xbaff8b19, 0xfffeb36a, 0xffffdbb7, 0xffffd8b1, 0xffffead5, 0xffffc995, - 0xffff8813, 0xffff8813, 0xffff8813, 0xfffeb46c, 0xfffff1e3, 0xffffdbb7, - 0xfffeb874, 0xfffebd7e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffebd7e, 0xfffeaf62, - 0xfffecd9e, 0xffffeddb, 0xfffeb166, 0xffff8207, 0xffff8207, 0xffff8309, - 0xffffc893, 0xffffe6cd, 0xfffed1a6, 0xfffed4aa, 0xfffeb56e, 0xbaff8b19, - 0xd1ff8b19, 0xffffc287, 0xfffeddbc, 0xffffdab5, 0xfffff1e3, 0xfffeb772, - 0xffff8813, 0xffff8711, 0xffff8711, 0xfffecc9c, 0xfffee9d4, 0xffffd8b1, - 0xffffa54d, 0xffffd8b1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffd8b1, 0xffffa349, - 0xfffed0a4, 0xfffee5cc, 0xffffca97, 0xffff8309, 0xffff8309, 0xffff8309, - 0xfffeb56e, 0xffffeddd, 0xfffed4aa, 0xffffd6ad, 0xffffc48b, 0xd1ff8b19, - 0xe3ff8b19, 0xfffed1a6, 0xfffeddbc, 0xffffdbb7, 0xfffff5eb, 0xfffeab5a, - 0xffff8915, 0xffff8813, 0xffff8813, 0xfffedebe, 0xfffee4ca, 0xffffd9b3, - 0xffff9833, 0xfffeecda, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffd8b1, 0xffde6e00, - 0xffa04f00, 0xffff8003, 0xffffead5, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffeecda, 0xffff9731, - 0xfffed4aa, 0xfffedfc0, 0xffffe0c1, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffa955, 0xfffff3e7, 0xffffd6ad, 0xffffd7af, 0xffffca97, 0xe3ff8b19, - 0xedff8b19, 0xffffdbb7, 0xffffe3c7, 0xffffe0c1, 0xfffff8f1, 0xffffa751, - 0xffff8c1b, 0xffff8c1b, 0xffff8c1b, 0xffffe7cf, 0xffffe6cd, 0xfffee5cc, - 0xffffa54d, 0xfffffbf7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffdfb, 0xffc66200, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffff7f01, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffbf7, 0xffffa44b, - 0xfffedfc0, 0xfffedfc0, 0xffffe6cd, 0xffff860f, 0xffff860f, 0xffff860f, - 0xffffa247, 0xfffff6ed, 0xffffd7af, 0xffffd8b1, 0xfffed2a8, 0xedff8b19, - 0xedff8b19, 0xfffeddbc, 0xffffe6cd, 0xfffee5cc, 0xfffff9f3, 0xffffa955, - 0xffff8f21, 0xffff8f21, 0xffff8f21, 0xffffd7af, 0xfffee9d4, 0xfffee9d4, - 0xfffedebe, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, - 0xfffedcba, 0xfffff1e3, 0xffffffff, 0xfffee4ca, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffb05700, 0xffffffff, 0xffffffff, 0xffffead5, - 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedebe, - 0xffffe7cf, 0xffffe7cf, 0xfffed2a8, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffa145, 0xfffff5eb, 0xffffd6ad, 0xffffd7af, 0xfffed2a8, 0xedff8b19, - 0xe3ff8b19, 0xfffeddbc, 0xffffead5, 0xffffe8d1, 0xfffff8f1, 0xfffeb166, - 0xffff9125, 0xffff9227, 0xffff9227, 0xffff9227, 0xffff9227, 0xffff9227, - 0xffc46100, 0xffa25000, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffffa853, 0xffffffff, 0xfffff9f3, 0xffb85b00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffea7400, 0xffffffff, 0xffffffff, 0xffff8915, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa25000, 0xffbe5e00, - 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffa955, 0xfffff3e7, 0xffffd6ad, 0xffffd6ad, 0xfffecea0, 0xe3ff8b19, - 0xd1ff8b19, 0xfffed1a6, 0xffffeddb, 0xffffebd7, 0xfffff7ef, 0xfffebd7e, - 0xffff9227, 0xffff942b, 0xffff942b, 0xffff942b, 0xffff942b, 0xffff9329, - 0xffda6c00, 0xffa65200, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffff8d1d, 0xffffffff, 0xffffffff, 0xffffcb99, 0xffb85b00, - 0xffa04f00, 0xffd26800, 0xffffe2c5, 0xffffffff, 0xffffffff, 0xffd26800, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa65200, 0xffd06700, - 0xffff860f, 0xffff860f, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, - 0xfffeb56e, 0xfffeeee0, 0xffffd6ad, 0xffffd8b1, 0xffffc48b, 0xd1ff8b19, - 0xbaff8b19, 0xffffc083, 0xfffeeee0, 0xffffeddb, 0xfffff4e9, 0xfffecea0, - 0xffff9329, 0xffff942b, 0xffff9329, 0xffff9329, 0xffff9125, 0xffff9125, - 0xfff07700, 0xffaa5400, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffac5500, 0xffffe6cd, 0xffffffff, 0xffffffff, 0xffffffff, - 0xfffff3e7, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffecd9e, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffaa5400, 0xffe67200, - 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff860f, - 0xffffc893, 0xfffee9d4, 0xffffd7af, 0xffffd9b3, 0xfffeb772, 0xbaff8b19, - 0x92ff8b19, 0xfffead5e, 0xfffeeee0, 0xffffeddb, 0xffffefe1, 0xffffe6cd, - 0xffff9227, 0xffff9125, 0xffff9125, 0xffff8f21, 0xffff8e1f, 0xffff8d1d, - 0xffff8309, 0xffae5600, 0xffa25000, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffd66a00, 0xfffee4ca, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffecfa2, 0xffbc5d00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa25000, 0xffae5600, 0xfffa7c00, - 0xffff840b, 0xffff840b, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffe3c7, 0xffffe0c1, 0xffffd8b1, 0xffffdab5, 0xffffa54d, 0x92ff8b19, - 0x5fff8b19, 0xffff9b39, 0xffffeddd, 0xffffebd7, 0xfffee9d4, 0xfffffefd, - 0xffff9833, 0xffff8f21, 0xffff8d1d, 0xffff8c1b, 0xffff8c1b, 0xffff8915, - 0xffff860f, 0xffdc6d00, 0xffa85300, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffeb670, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffff9329, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa85300, 0xffda6c00, 0xffff8105, - 0xffff8207, 0xffff8309, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff8e1f, - 0xfffffefd, 0xffffd7af, 0xffffd7af, 0xffffdab5, 0xffff9731, 0x5fff8b19, - 0x27ff8c1b, 0xf6ff8b19, 0xffffe1c3, 0xffffe6cd, 0xfffee4ca, 0xfffff4e9, - 0xfffeb976, 0xffff8c1b, 0xffff8a17, 0xffff8915, 0xffff860f, 0xffff8207, - 0xffff8003, 0xfff67a00, 0xffae5600, 0xffa45100, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffea7400, 0xfffffdfb, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff3e7, 0xffb85b00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa45100, 0xffae5600, 0xfff27800, 0xffff7f01, - 0xffff8003, 0xffff8105, 0xffff8207, 0xffff8309, 0xffff8309, 0xfffeb36a, - 0xfffeeee0, 0xffffd5ab, 0xffffd6ad, 0xfffed4aa, 0xf6ff8b19, 0x27ff8c1b, - 0x03ff5b01, 0xc5ff8b19, 0xffffbf81, 0xfffee5cc, 0xffffe2c5, 0xffffe7cf, - 0xffffe6cd, 0xffff8813, 0xffff850d, 0xffff8309, 0xffff8105, 0xffff7f01, - 0xffff7f01, 0xffff8003, 0xffea7400, 0xffac5500, 0xffa45100, 0xffa04f00, - 0xffa04f00, 0xffa45100, 0xfffedebe, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffc083, 0xffa04f00, - 0xffa04f00, 0xffa45100, 0xffac5500, 0xffe87300, 0xfffa7c00, 0xfffa7c00, - 0xfffc7d00, 0xffff7f01, 0xffff8003, 0xffff8207, 0xffff8309, 0xfffee5cc, - 0xfffedcba, 0xfffed2a8, 0xffffd6ad, 0xfffeb874, 0xc5ff8b19, 0x03ff5b01, - 0x00000000, 0x71ff8b19, 0xffff9731, 0xfffee4ca, 0xfffeddbc, 0xffffd9b3, - 0xfffff4e9, 0xffffa44b, 0xffff8105, 0xffff7f01, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xffff7f01, 0xffe27000, 0xffac5500, 0xffa45100, - 0xffa04f00, 0xffffa145, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffa7c00, - 0xffa45100, 0xffac5500, 0xffe47100, 0xffff7f01, 0xffff7f01, 0xfffc7d00, - 0xfffc7d00, 0xfffa7c00, 0xffff7f01, 0xffff7f01, 0xffffa145, 0xfffff3e7, - 0xfffed0a4, 0xfffed2a8, 0xffffd7af, 0xffff962f, 0x71ff8b19, 0x00000000, - 0x00000000, 0x1eff8b19, 0xedff8b19, 0xffffc791, 0xffffd9b3, 0xfffed4aa, - 0xfffedebe, 0xffffe7cf, 0xffff8003, 0xffff7f01, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xfffc7d00, 0xffff7f01, 0xffec7500, 0xffae5600, - 0xffd86b00, 0xfffff7ef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff4e9, 0xffffe7cf, - 0xffb65a00, 0xffee7600, 0xffff8003, 0xffff7f01, 0xffff8003, 0xffff7f01, - 0xfffc7d00, 0xfffa7c00, 0xfffa7c00, 0xffff7f01, 0xffffe7cf, 0xfffeddbc, - 0xfffecc9c, 0xfffed1a6, 0xffffc68f, 0xedff8b19, 0x1eff8b19, 0x00000000, - 0x00000000, 0x00000000, 0x92ff8b19, 0xffff9731, 0xfffed4aa, 0xfffecc9c, - 0xffffcb99, 0xffffead5, 0xfffeb772, 0xffff7f01, 0xffff7f01, 0xffff7f01, - 0xfffc7d00, 0xfffc7d00, 0xffff7f01, 0xffff8207, 0xffff8309, 0xffff8003, - 0xffffd7af, 0xffffca97, 0xfffebd7e, 0xffffd8b1, 0xfffeecda, 0xfffffaf5, - 0xfffffaf5, 0xfffeecda, 0xffffd8b1, 0xfffebd7e, 0xffff9f41, 0xfffeddbc, - 0xffffc287, 0xffff850d, 0xffff8309, 0xffff8003, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xfffc7d00, 0xfffeb56e, 0xffffe8d1, 0xffffc791, - 0xffffca97, 0xfffed0a4, 0xffff9e3f, 0x92ff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x22ff8a17, 0xeeff8b19, 0xfffeba78, 0xfffecc9c, - 0xffffcb99, 0xffffd5ab, 0xfffffcf9, 0xffff9731, 0xffff7f01, 0xfffc7d00, - 0xfffc7d00, 0xffff7f01, 0xffff8105, 0xffff8309, 0xffff850d, 0xfffeb166, - 0xfffff4e9, 0xfffed1a6, 0xfffeba78, 0xffffa751, 0xffff9935, 0xffff8f21, - 0xffff8f21, 0xffff9935, 0xffffa64f, 0xfffeb874, 0xfffecd9e, 0xffffdab5, - 0xfffffcf9, 0xffff9935, 0xffff850d, 0xffff8207, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xffff9731, 0xfffffcf9, 0xfffecfa2, 0xffffc68f, - 0xffffc995, 0xffffbf81, 0xeeff8b19, 0x22ff8a17, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x7cff8b19, 0xffff8d1d, 0xfffecc9c, - 0xfffecd9e, 0xfffecc9c, 0xffffe0c1, 0xfffff1e3, 0xffff8c1b, 0xfffc7d00, - 0xffff7f01, 0xffff8003, 0xffff8207, 0xffff840b, 0xffff8e1f, 0xfffff5eb, - 0xffffead5, 0xffffe0c1, 0xfffeddbc, 0xfffeddbc, 0xffffe1c3, 0xfffee5cc, - 0xffffe6cd, 0xffffe1c3, 0xfffedcba, 0xffffdbb7, 0xffffdbb7, 0xffffe6cd, - 0xfffff4e9, 0xffffc58d, 0xffff850d, 0xffff8309, 0xffff8105, 0xffff7f01, - 0xffff7f01, 0xffff8c1b, 0xfffff2e5, 0xffffe0c1, 0xffffc893, 0xffffc893, - 0xffffca97, 0xffff942b, 0x7cff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0bff8f17, 0xc8ff8b19, 0xffff9c3b, - 0xfffecfa2, 0xffffca97, 0xffffc995, 0xffffe3c7, 0xffffeddb, 0xffff9023, - 0xffff8003, 0xffff8105, 0xffff8309, 0xffff850d, 0xffff8813, 0xffffa955, - 0xffffe0c1, 0xfffffdfb, 0xfffff3e7, 0xffffebd7, 0xffffeddb, 0xffffebd7, - 0xfffeecda, 0xffffeddb, 0xffffebd7, 0xfffff2e5, 0xfffffcf9, 0xfffedfc0, - 0xffffa54d, 0xffff8309, 0xffff840b, 0xffff850d, 0xffff840b, 0xffff8105, - 0xffff9023, 0xffffeddb, 0xfffee5cc, 0xffffcb99, 0xffffca97, 0xffffcb99, - 0xffffa64f, 0xc8ff8b19, 0x0bff8f17, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x31ff8c1b, 0xedff8b19, - 0xfffeac5c, 0xffffcb99, 0xffffc995, 0xffffc893, 0xffffe2c5, 0xfffff6ed, - 0xffffa145, 0xffff8207, 0xffff850d, 0xffff8711, 0xffff8a17, 0xffff8c1b, - 0xffff8c1b, 0xffff9227, 0xfffeb268, 0xfffed0a4, 0xffffd6ad, 0xfffee9d4, - 0xfffee9d4, 0xffffd6ad, 0xfffed0a4, 0xfffeb268, 0xffff9023, 0xffff8813, - 0xffff8711, 0xffff850d, 0xffff840b, 0xffff850d, 0xffff850d, 0xffffa145, - 0xfffff6ed, 0xffffe2c5, 0xffffcb99, 0xffffcb99, 0xfffecd9e, 0xfffeb772, - 0xedff8b19, 0x31ff8c1b, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5aff8b19, - 0xfcff8b19, 0xfffeb772, 0xfffecc9c, 0xffffca97, 0xfffecc9c, 0xffffe0c1, - 0xfffffefd, 0xfffebd7e, 0xffff860f, 0xffff8813, 0xffff8a17, 0xffff8b19, - 0xffff8b19, 0xffff8a17, 0xffff8915, 0xffff8b19, 0xffff8d1d, 0xffff8f21, - 0xffff9023, 0xffff8d1d, 0xffff8a17, 0xffff8813, 0xffff8813, 0xffff8813, - 0xffff8813, 0xffff860f, 0xffff840b, 0xffff840b, 0xfffebd7e, 0xfffffefd, - 0xffffe1c3, 0xfffecd9e, 0xffffcb99, 0xfffecd9e, 0xffffc083, 0xfcff8b19, - 0x5aff8b19, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x71ff8b19, 0xffff8a17, 0xfffeb976, 0xfffecea0, 0xfffecfa2, 0xfffed0a4, - 0xffffd9b3, 0xfffeeee0, 0xfffee9d4, 0xffffa64f, 0xffff8c1b, 0xffff8c1b, - 0xffff8a17, 0xffff8a17, 0xffff8915, 0xffff8c1b, 0xffff8d1d, 0xffff8f21, - 0xffff8f21, 0xffff8e1f, 0xffff8b19, 0xffff8813, 0xffff8813, 0xffff8813, - 0xffff8813, 0xffff860f, 0xffffa247, 0xffffe8d1, 0xffffeddd, 0xffffdab5, - 0xfffed2a8, 0xfffed4aa, 0xfffecfa2, 0xffffc185, 0xffff8f21, 0x71ff8b19, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x71ff8b19, 0xfcff8b19, 0xfffeb46c, 0xfffed0a4, 0xffffd5ab, - 0xffffd5ab, 0xffffd8b1, 0xffffe7cf, 0xfffff7ef, 0xffffe6cd, 0xffffbf81, - 0xffff9833, 0xffff8915, 0xffff8a17, 0xffff8c1b, 0xffff8e1f, 0xffff9023, - 0xffff8f21, 0xffff8e1f, 0xffff8c1b, 0xffff8a17, 0xffff8813, 0xffff962f, - 0xfffebd7e, 0xffffe6cd, 0xfffff5eb, 0xffffe3c7, 0xfffed4aa, 0xffffd6ad, - 0xffffd6ad, 0xffffd5ab, 0xfffebb7a, 0xfcff8b19, 0x71ff8b19, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x5aff8b19, 0xeeff8b19, 0xffffa54d, 0xffffd7af, - 0xffffdbb7, 0xffffdbb7, 0xfffeddbc, 0xfffedfc0, 0xffffe7cf, 0xfffff1e3, - 0xfffffbf7, 0xffffead5, 0xfffed0a4, 0xfffebe80, 0xfffeba78, 0xffffa955, - 0xffffa955, 0xfffebb7a, 0xfffebe80, 0xfffecfa2, 0xffffead5, 0xfffffbf7, - 0xfffeeee0, 0xffffe3c7, 0xffffd7af, 0xffffd5ab, 0xfffed4aa, 0xffffd9b3, - 0xffffd8b1, 0xfffeaa58, 0xeeff8b19, 0x5aff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x34ff8b19, 0xc5ff8b19, 0xffff952d, - 0xffffc995, 0xfffedfc0, 0xffffe1c3, 0xffffe1c3, 0xfffedfc0, 0xfffedebe, - 0xffffdbb7, 0xffffe2c5, 0xffffebd7, 0xfffff2e5, 0xfffff3e7, 0xfffff9f3, - 0xfffff9f3, 0xfffff4e9, 0xfffff2e5, 0xffffebd7, 0xffffe2c5, 0xfffedcba, - 0xfffedcba, 0xffffdab5, 0xffffdbb7, 0xffffd9b3, 0xffffd7af, 0xffffc995, - 0xffff9833, 0xc5ff8b19, 0x34ff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0cff8315, 0x7cff8b19, - 0xecff8b19, 0xffff9f41, 0xfffecfa2, 0xfffee4ca, 0xffffe1c3, 0xfffedebe, - 0xfffedcba, 0xfffedcba, 0xfffedebe, 0xffffe1c3, 0xffffe2c5, 0xffffe6cd, - 0xffffe7cf, 0xfffee5cc, 0xffffe1c3, 0xfffeddbc, 0xfffedcba, 0xffffdbb7, - 0xffffdbb7, 0xfffedebe, 0xfffedcba, 0xfffecfa2, 0xffffa349, 0xecff8b19, - 0x7cff8b19, 0x0cff8315, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x26ff911b, 0x92ff8b19, 0xecff8b19, 0xffff952d, 0xfffebb7a, 0xffffd8b1, - 0xffffe1c3, 0xffffe2c5, 0xffffe1c3, 0xffffe3c7, 0xfffee4ca, 0xffffe8d1, - 0xfffee9d4, 0xffffe7cf, 0xfffee4ca, 0xffffe1c3, 0xffffe0c1, 0xfffeddbc, - 0xffffd7af, 0xfffebe80, 0xffff9a37, 0xecff8b19, 0x92ff8b19, 0x26ff911b, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x1eff8b19, 0x73ff8b19, 0xc4ff8b19, 0xf5ff8b19, - 0xffff962f, 0xffffa54d, 0xfffeb772, 0xffffc893, 0xffffd7af, 0xfffedcba, - 0xfffedcba, 0xffffd8b1, 0xffffc995, 0xfffeb976, 0xffffa853, 0xffff9731, - 0xf5ff8b19, 0xc4ff8b19, 0x73ff8b19, 0x1eff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01ff0101, 0x28ff8b19, - 0x5fff8b19, 0x92ff8b19, 0xb8ff8b19, 0xd1ff8b19, 0xe3ff8b19, 0xedff8b19, - 0xedff8b19, 0xe3ff8b19, 0xd1ff8b19, 0xb8ff8b19, 0x92ff8b19, 0x5fff8b19, - 0x28ff8b19, 0x01ff0101, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static unsigned char sdlappicon_mask[] = { - 0, 0, 255, 255, 0, 0, 0, 192, 255, 255, 3, 0, 0, 240, - 255, 255, 15, 0, 0, 252, 255, 255, 63, 0, 0, 254, 255, 255, - 127, 0, 0, 255, 255, 255, 255, 0, 128, 255, 255, 255, 255, 1, - 192, 255, 255, 255, 255, 3, 224, 255, 255, 255, 255, 7, 240, 255, - 255, 255, 255, 15, 248, 255, 255, 255, 255, 31, 248, 255, 255, 255, - 255, 31, 252, 255, 255, 255, 255, 63, 252, 255, 255, 255, 255, 63, - 254, 255, 255, 255, 255, 127, 254, 255, 255, 255, 255, 127, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, - 255, 127, 254, 255, 255, 255, 255, 127, 252, 255, 255, 255, 255, 63, - 252, 255, 255, 255, 255, 63, 248, 255, 255, 255, 255, 31, 248, 255, - 255, 255, 255, 31, 240, 255, 255, 255, 255, 15, 224, 255, 255, 255, - 255, 7, 192, 255, 255, 255, 255, 3, 128, 255, 255, 255, 255, 1, - 0, 255, 255, 255, 255, 0, 0, 254, 255, 255, 127, 0, 0, 252, - 255, 255, 63, 0, 0, 240, 255, 255, 15, 0, 0, 192, 255, 255, - 3, 0, 0, 0, 255, 255, 0, 0,}; - -struct sdlappicon sdlappicon = { - 48,48, // width,height - sdlappicon_pixels, - sdlappicon_mask -}; diff --git a/polymer-perf/eduke32/rsrc/build_icon.ico b/polymer-perf/eduke32/rsrc/build_icon.ico deleted file mode 100644 index 67eaeae9a..000000000 Binary files a/polymer-perf/eduke32/rsrc/build_icon.ico and /dev/null differ diff --git a/polymer-perf/eduke32/rsrc/game.bmp b/polymer-perf/eduke32/rsrc/game.bmp deleted file mode 100644 index ee05428d2..000000000 Binary files a/polymer-perf/eduke32/rsrc/game.bmp and /dev/null differ diff --git a/polymer-perf/eduke32/rsrc/game_icon.c b/polymer-perf/eduke32/rsrc/game_icon.c deleted file mode 100644 index aff10f26d..000000000 --- a/polymer-perf/eduke32/rsrc/game_icon.c +++ /dev/null @@ -1,417 +0,0 @@ -#include "sdlayer.h" - -static unsigned int sdlappicon_pixels[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01ff0101, 0x28ff8b19, - 0x5fff8b19, 0x92ff8b19, 0xb8ff8b19, 0xd1ff8b19, 0xe3ff8b19, 0xedff8b19, - 0xedff8b19, 0xe3ff8b19, 0xd1ff8b19, 0xb8ff8b19, 0x92ff8b19, 0x5fff8b19, - 0x28ff8b19, 0x01ff0101, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x1eff8b19, 0x73ff8b19, 0xc4ff8b19, 0xf5ff8b19, - 0xffff9e3f, 0xfffeb166, 0xffffc185, 0xfffed1a6, 0xffffe1c3, 0xffffe2c5, - 0xffffe0c1, 0xffffd5ab, 0xffffc287, 0xfffeb268, 0xffffa54d, 0xffff9731, - 0xf5ff8b19, 0xc4ff8b19, 0x73ff8b19, 0x1eff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x26ff911b, 0x92ff8b19, 0xecff8b19, 0xffffa145, 0xfffecc9c, 0xffffefe1, - 0xfffffbf7, 0xfffffefd, 0xfffffefd, 0xfffffcf9, 0xfffff7ef, 0xfffff1e3, - 0xffffeddd, 0xffffe8d1, 0xfffedfc0, 0xfffedcba, 0xfffedcba, 0xffffd6ad, - 0xfffecea0, 0xfffeb874, 0xffff9935, 0xecff8b19, 0x92ff8b19, 0x26ff911b, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0cff8315, 0x7cff8b19, - 0xecff8b19, 0xffffa751, 0xfffeddbc, 0xfffff5eb, 0xfffffaf5, 0xfffffaf5, - 0xfffffcf9, 0xfffff9f3, 0xfffffaf5, 0xfffffaf5, 0xfffff5eb, 0xffffefe1, - 0xfffeecda, 0xffffe6cd, 0xfffeddbc, 0xffffdab5, 0xffffd7af, 0xfffed2a8, - 0xfffed1a6, 0xfffed4aa, 0xffffdab5, 0xfffecfa2, 0xffffa44b, 0xecff8b19, - 0x7cff8b19, 0x0cff8315, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x34ff8b19, 0xc5ff8b19, 0xffff9935, - 0xfffecd9e, 0xfffee5cc, 0xffffebd7, 0xffffefe1, 0xfffff5eb, 0xfffff8f1, - 0xfffffbf7, 0xfffffcf9, 0xfffffcf9, 0xfffffdfb, 0xfffffcf9, 0xfffffcf9, - 0xfffffbf7, 0xfffff7ef, 0xfffff1e3, 0xffffead5, 0xfffeddbc, 0xfffed0a4, - 0xfffed0a4, 0xfffed2a8, 0xffffdab5, 0xffffe2c5, 0xfffee5cc, 0xffffd7af, - 0xffff9c3b, 0xc5ff8b19, 0x34ff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x5aff8b19, 0xeeff8b19, 0xffffa44b, 0xfffed0a4, - 0xffffd9b3, 0xfffedebe, 0xfffee5cc, 0xfffeecda, 0xfffff5eb, 0xfffffbf7, - 0xfffffefd, 0xffffeddd, 0xffffd5ab, 0xffffc389, 0xfffeb670, 0xfffeab5a, - 0xffffa853, 0xfffead5e, 0xfffeb874, 0xfffecc9c, 0xffffebd7, 0xfffffaf5, - 0xffffebd7, 0xfffeddbc, 0xfffedfc0, 0xffffe2c5, 0xfffee4ca, 0xffffead5, - 0xfffff1e3, 0xfffeb46c, 0xeeff8b19, 0x5aff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x71ff8b19, 0xfcff8b19, 0xfffead5e, 0xffffc995, 0xffffcb99, - 0xfffed1a6, 0xffffdbb7, 0xffffebd7, 0xfffff9f3, 0xffffead5, 0xffffc68f, - 0xffffa751, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9935, 0xffff962f, - 0xffff9227, 0xffff8d1d, 0xffff8813, 0xffff8711, 0xffff850d, 0xffff9125, - 0xfffeba78, 0xffffe7cf, 0xfffff7ef, 0xfffeecda, 0xffffe7cf, 0xffffeddb, - 0xfffff4e9, 0xfffff6ed, 0xffffca97, 0xfcff8b19, 0x71ff8b19, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x71ff8b19, 0xffff8813, 0xfffead5e, 0xffffc389, 0xffffc389, 0xffffc791, - 0xfffed2a8, 0xffffeddb, 0xfffee9d4, 0xfffeae60, 0xffff942b, 0xffff9731, - 0xffff9b39, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff962f, - 0xffff9329, 0xffff8c1b, 0xffff8813, 0xffff8711, 0xffff8309, 0xffff8207, - 0xffff840b, 0xffff8a17, 0xfffead5e, 0xffffead5, 0xfffff7ef, 0xfffff2e5, - 0xfffff5eb, 0xfffff4e9, 0xfffff6ed, 0xffffd7af, 0xffff8e1f, 0x71ff8b19, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5aff8b19, - 0xfcff8b19, 0xfffeab5a, 0xfffebd7e, 0xfffebc7c, 0xffffc083, 0xffffd7af, - 0xfffffdfb, 0xfffeba78, 0xffff860f, 0xffff8c1b, 0xffff9125, 0xffff962f, - 0xffff9a37, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff9731, - 0xffff9329, 0xffff8c1b, 0xffff8813, 0xffff860f, 0xffff8309, 0xffff8207, - 0xffff860f, 0xffff8b19, 0xffff8d1d, 0xffff9023, 0xffffc58d, 0xfffffefd, - 0xfffff7ef, 0xfffff4e9, 0xfffff1e3, 0xffffefe1, 0xfffed0a4, 0xfcff8b19, - 0x5aff8b19, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x31ff8c1b, 0xedff8b19, - 0xffffa751, 0xfffebe80, 0xfffeb874, 0xfffeba78, 0xffffdbb7, 0xfffff5eb, - 0xffff9e3f, 0xffff7f01, 0xffff8309, 0xffff8813, 0xffff8f21, 0xffff942b, - 0xffff9833, 0xffff9b39, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff9731, - 0xffff9227, 0xffff8c1b, 0xffff8813, 0xffff850d, 0xffff8207, 0xffff8309, - 0xffff8915, 0xffff8d1d, 0xffff8e1f, 0xffff942b, 0xffff9731, 0xfffeb46c, - 0xfffff8f1, 0xfffff7ef, 0xffffeddb, 0xffffe7cf, 0xfffee5cc, 0xffffbf81, - 0xedff8b19, 0x31ff8c1b, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0bff8f17, 0xc8ff8b19, 0xffff9d3d, - 0xffffc68f, 0xffffc083, 0xfffebd7e, 0xffffdbb7, 0xfffeecda, 0xffff8915, - 0xfff07700, 0xfff87b00, 0xffff7f01, 0xffff840b, 0xffff8c1b, 0xffff9227, - 0xffff9731, 0xffff9b39, 0xffff9c3b, 0xffff9c3b, 0xffff9b39, 0xffff9731, - 0xffff9227, 0xffff8c1b, 0xffff8711, 0xffff850d, 0xffff8207, 0xffff850d, - 0xffff8b19, 0xffff8d1d, 0xffff9125, 0xffff9731, 0xffff9833, 0xffff9833, - 0xffffa54d, 0xffffefe1, 0xfffff2e5, 0xffffe0c1, 0xfffeddbc, 0xffffe1c3, - 0xffffa955, 0xc8ff8b19, 0x0bff8f17, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x7cff8b19, 0xffff9023, 0xffffcb99, - 0xffffc995, 0xffffc48b, 0xffffdab5, 0xfffff1e3, 0xffff8309, 0xffec7500, - 0xffee7600, 0xfff27800, 0xfffa7c00, 0xffff942b, 0xffffd7af, 0xffff9731, - 0xffff952d, 0xffff9935, 0xffff9c3b, 0xffff9c3b, 0xffff9c3b, 0xffff9731, - 0xffff9227, 0xffff8a17, 0xffff8711, 0xffff840b, 0xffff8309, 0xffff8813, - 0xffff8d1d, 0xfffeba78, 0xffffa64f, 0xffff9833, 0xffff9833, 0xffff962f, - 0xffff942b, 0xffff9b39, 0xfffff3e7, 0xffffead5, 0xffffdbb7, 0xffffdbb7, - 0xffffd7af, 0xffff9227, 0x7cff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x22ff8a17, 0xeeff8b19, 0xffffc083, 0xfffed2a8, - 0xfffecc9c, 0xfffed1a6, 0xfffffcf9, 0xffff942b, 0xffec7500, 0xffea7400, - 0xffea7400, 0xffee7600, 0xffff9f41, 0xfffff9f3, 0xffffead5, 0xfffecfa2, - 0xffff9227, 0xffff8d1d, 0xffff7f01, 0xffe06f00, 0xffc66200, 0xffb45900, - 0xffb45900, 0xffc05f00, 0xffd06700, 0xffe27000, 0xfffc7d00, 0xffff8a17, - 0xffff9d3d, 0xfffffdfb, 0xfffffaf5, 0xfffeb56e, 0xffff9731, 0xffff942b, - 0xffff8f21, 0xffff8b19, 0xffffa145, 0xfffffcf9, 0xfffedebe, 0xffffd5ab, - 0xfffed0a4, 0xffffc287, 0xeeff8b19, 0x22ff8a17, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x92ff8b19, 0xffff9c3b, 0xfffedcba, 0xffffd5ab, - 0xfffed2a8, 0xffffebd7, 0xfffeb670, 0xfffa7c00, 0xfff47900, 0xfff07700, - 0xffea7400, 0xfffeaa58, 0xfffffdfb, 0xffffd5ab, 0xffffcb99, 0xfffffcf9, - 0xffff860f, 0xffae5600, 0xffaa5400, 0xffa65200, 0xffa25000, 0xffa04f00, - 0xffa04f00, 0xffa25000, 0xffa65200, 0xffaa5400, 0xffae5600, 0xffe47100, - 0xffffd6ad, 0xfffff8f1, 0xfffff8f1, 0xfffffefd, 0xfffebd7e, 0xffff8f21, - 0xffff8c1b, 0xffff8a17, 0xffff8711, 0xfffeba78, 0xfffeecda, 0xfffecd9e, - 0xfffecc9c, 0xfffecea0, 0xffff9b39, 0x92ff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x1eff8b19, 0xedff8b19, 0xfffecc9c, 0xffffe0c1, 0xffffdab5, - 0xfffee5cc, 0xffffe8d1, 0xffff8309, 0xffff8003, 0xffff7f01, 0xfff67a00, - 0xffff9f41, 0xfffffdfb, 0xffffc893, 0xfffebe80, 0xfffeb36a, 0xffffc68f, - 0xfffecc9c, 0xffa25000, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa25000, 0xffe87300, - 0xffffeddb, 0xffffd6ad, 0xfffff3e7, 0xffffefe1, 0xfffffefd, 0xfffead5e, - 0xffff8a17, 0xffff8711, 0xffff8309, 0xffff8207, 0xffffe7cf, 0xfffedcba, - 0xffffc893, 0xffffc995, 0xffffc083, 0xedff8b19, 0x1eff8b19, 0x00000000, - 0x00000000, 0x71ff8b19, 0xffff9833, 0xffffe6cd, 0xffffe2c5, 0xfffedfc0, - 0xfffff6ed, 0xffffa853, 0xffff860f, 0xffff840b, 0xffff8207, 0xffff942b, - 0xfffff7ef, 0xfffed2a8, 0xfffeba78, 0xffffa955, 0xffffa853, 0xfffeddbc, - 0xffffffff, 0xffff8207, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffecd9e, - 0xffffead5, 0xffffa853, 0xffffc995, 0xffffe2c5, 0xffffe7cf, 0xfffff8f1, - 0xffff9833, 0xffff8207, 0xffff8003, 0xffff7f01, 0xffffa145, 0xfffff1e3, - 0xffffc995, 0xffffca97, 0xfffecea0, 0xffff952d, 0x71ff8b19, 0x00000000, - 0x03ff5b01, 0xc5ff8b19, 0xfffebb7a, 0xffffe2c5, 0xfffedebe, 0xffffe6cd, - 0xffffe8d1, 0xffff8b19, 0xffff8a17, 0xffff8915, 0xffff8711, 0xffffdbb7, - 0xfffee4ca, 0xffffc893, 0xfffeb166, 0xffffa853, 0xfffee5cc, 0xffffffff, - 0xffffffff, 0xffffe6cd, 0xffa85300, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffa7c00, 0xffffffff, - 0xffffffff, 0xfffee5cc, 0xffffa853, 0xffffc58d, 0xffffdab5, 0xffffe7cf, - 0xffffdbb7, 0xffff8003, 0xffff7f01, 0xfffc7d00, 0xfffc7d00, 0xfffee5cc, - 0xffffd6ad, 0xffffcb99, 0xfffecd9e, 0xfffeb268, 0xc5ff8b19, 0x03ff5b01, - 0x27ff8c1b, 0xf6ff8b19, 0xffffd6ad, 0xfffedcba, 0xfffeddbc, 0xfffff2e5, - 0xfffeb976, 0xffff8c1b, 0xffff8c1b, 0xffff8c1b, 0xffffa751, 0xfffff6ed, - 0xffffd8b1, 0xffffc893, 0xffff9a37, 0xfffeddbc, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffa145, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffedcba, 0xffffffff, - 0xffffffff, 0xffffffff, 0xfffeddbc, 0xffff9a37, 0xffffc791, 0xfffecc9c, - 0xfffff2e5, 0xffff9e3f, 0xffff7f01, 0xffff7f01, 0xffff8003, 0xfffeb268, - 0xffffead5, 0xffffca97, 0xffffca97, 0xffffc893, 0xf6ff8b19, 0x27ff8c1b, - 0x5fff8b19, 0xffff9833, 0xfffedcba, 0xffffdbb7, 0xffffdbb7, 0xfffffefd, - 0xffff9125, 0xffff8a17, 0xffff8a17, 0xffff8c1b, 0xffffe1c3, 0xffffead5, - 0xfffedebe, 0xfffeb36a, 0xffffc58d, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xfffff7ef, 0xffc66200, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffff8915, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffc58d, 0xfffeaa58, 0xffffca97, - 0xfffeddbc, 0xfffedebe, 0xffff7f01, 0xffff7f01, 0xffff7f01, 0xffff8711, - 0xfffffdfb, 0xfffecd9e, 0xfffecd9e, 0xfffed1a6, 0xffff962f, 0x5fff8b19, - 0x92ff8b19, 0xffffa44b, 0xfffedcba, 0xffffd9b3, 0xffffe1c3, 0xfffee4ca, - 0xffff8813, 0xffff8813, 0xffff8813, 0xffff9731, 0xfffffefd, 0xfffedfc0, - 0xfffed1a6, 0xffff9f41, 0xfffef0e0, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffc083, 0xffda6c00, 0xfffeaa58, - 0xfffeb874, 0xffff9329, 0xffbc5d00, 0xffffe6cd, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffef0e0, 0xffff9f41, 0xffffc185, - 0xffffcb99, 0xfffffdfb, 0xffff8d1d, 0xffff7f01, 0xffff8003, 0xffff8105, - 0xffffe3c7, 0xffffdbb7, 0xfffed0a4, 0xffffd6ad, 0xffffa247, 0x92ff8b19, - 0xbaff8b19, 0xfffeb36a, 0xffffdbb7, 0xffffd8b1, 0xffffead5, 0xffffc995, - 0xffff8813, 0xffff8813, 0xffff8813, 0xfffeb46c, 0xfffff1e3, 0xffffdbb7, - 0xfffeb874, 0xfffebd7e, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffebd7e, 0xfffeaf62, - 0xfffecd9e, 0xffffeddb, 0xfffeb166, 0xffff8207, 0xffff8207, 0xffff8309, - 0xffffc893, 0xffffe6cd, 0xfffed1a6, 0xfffed4aa, 0xfffeb56e, 0xbaff8b19, - 0xd1ff8b19, 0xffffc287, 0xfffeddbc, 0xffffdab5, 0xfffff1e3, 0xfffeb772, - 0xffff8813, 0xffff8711, 0xffff8711, 0xfffecc9c, 0xfffee9d4, 0xffffd8b1, - 0xffffa54d, 0xffffd8b1, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffd8b1, 0xffffa349, - 0xfffed0a4, 0xfffee5cc, 0xffffca97, 0xffff8309, 0xffff8309, 0xffff8309, - 0xfffeb56e, 0xffffeddd, 0xfffed4aa, 0xffffd6ad, 0xffffc48b, 0xd1ff8b19, - 0xe3ff8b19, 0xfffed1a6, 0xfffeddbc, 0xffffdbb7, 0xfffff5eb, 0xfffeab5a, - 0xffff8915, 0xffff8813, 0xffff8813, 0xfffedebe, 0xfffee4ca, 0xffffd9b3, - 0xffff9833, 0xfffeecda, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffd8b1, 0xffde6e00, - 0xffa04f00, 0xffff8003, 0xffffead5, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffeecda, 0xffff9731, - 0xfffed4aa, 0xfffedfc0, 0xffffe0c1, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffa955, 0xfffff3e7, 0xffffd6ad, 0xffffd7af, 0xffffca97, 0xe3ff8b19, - 0xedff8b19, 0xffffdbb7, 0xffffe3c7, 0xffffe0c1, 0xfffff8f1, 0xffffa751, - 0xffff8c1b, 0xffff8c1b, 0xffff8c1b, 0xffffe7cf, 0xffffe6cd, 0xfffee5cc, - 0xffffa54d, 0xfffffbf7, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffdfb, 0xffc66200, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffff7f01, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffffbf7, 0xffffa44b, - 0xfffedfc0, 0xfffedfc0, 0xffffe6cd, 0xffff860f, 0xffff860f, 0xffff860f, - 0xffffa247, 0xfffff6ed, 0xffffd7af, 0xffffd8b1, 0xfffed2a8, 0xedff8b19, - 0xedff8b19, 0xfffeddbc, 0xffffe6cd, 0xfffee5cc, 0xfffff9f3, 0xffffa955, - 0xffff8f21, 0xffff8f21, 0xffff8f21, 0xffffd7af, 0xfffee9d4, 0xfffee9d4, - 0xfffedebe, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, - 0xfffedcba, 0xfffff1e3, 0xffffffff, 0xfffee4ca, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffb05700, 0xffffffff, 0xffffffff, 0xffffead5, - 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedcba, 0xfffedebe, - 0xffffe7cf, 0xffffe7cf, 0xfffed2a8, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffa145, 0xfffff5eb, 0xffffd6ad, 0xffffd7af, 0xfffed2a8, 0xedff8b19, - 0xe3ff8b19, 0xfffeddbc, 0xffffead5, 0xffffe8d1, 0xfffff8f1, 0xfffeb166, - 0xffff9125, 0xffff9227, 0xffff9227, 0xffff9227, 0xffff9227, 0xffff9227, - 0xffc46100, 0xffa25000, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffffa853, 0xffffffff, 0xfffff9f3, 0xffb85b00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffea7400, 0xffffffff, 0xffffffff, 0xffff8915, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa25000, 0xffbe5e00, - 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffa955, 0xfffff3e7, 0xffffd6ad, 0xffffd6ad, 0xfffecea0, 0xe3ff8b19, - 0xd1ff8b19, 0xfffed1a6, 0xffffeddb, 0xffffebd7, 0xfffff7ef, 0xfffebd7e, - 0xffff9227, 0xffff942b, 0xffff942b, 0xffff942b, 0xffff942b, 0xffff9329, - 0xffda6c00, 0xffa65200, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffff8d1d, 0xffffffff, 0xffffffff, 0xffffcb99, 0xffb85b00, - 0xffa04f00, 0xffd26800, 0xffffe2c5, 0xffffffff, 0xffffffff, 0xffd26800, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa65200, 0xffd06700, - 0xffff860f, 0xffff860f, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, - 0xfffeb56e, 0xfffeeee0, 0xffffd6ad, 0xffffd8b1, 0xffffc48b, 0xd1ff8b19, - 0xbaff8b19, 0xffffc083, 0xfffeeee0, 0xffffeddb, 0xfffff4e9, 0xfffecea0, - 0xffff9329, 0xffff942b, 0xffff9329, 0xffff9329, 0xffff9125, 0xffff9125, - 0xfff07700, 0xffaa5400, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffac5500, 0xffffe6cd, 0xffffffff, 0xffffffff, 0xffffffff, - 0xfffff3e7, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffecd9e, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffaa5400, 0xffe67200, - 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff860f, - 0xffffc893, 0xfffee9d4, 0xffffd7af, 0xffffd9b3, 0xfffeb772, 0xbaff8b19, - 0x92ff8b19, 0xfffead5e, 0xfffeeee0, 0xffffeddb, 0xffffefe1, 0xffffe6cd, - 0xffff9227, 0xffff9125, 0xffff9125, 0xffff8f21, 0xffff8e1f, 0xffff8d1d, - 0xffff8309, 0xffae5600, 0xffa25000, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffd66a00, 0xfffee4ca, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffecfa2, 0xffbc5d00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa25000, 0xffae5600, 0xfffa7c00, - 0xffff840b, 0xffff840b, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff850d, - 0xffffe3c7, 0xffffe0c1, 0xffffd8b1, 0xffffdab5, 0xffffa54d, 0x92ff8b19, - 0x5fff8b19, 0xffff9b39, 0xffffeddd, 0xffffebd7, 0xfffee9d4, 0xfffffefd, - 0xffff9833, 0xffff8f21, 0xffff8d1d, 0xffff8c1b, 0xffff8c1b, 0xffff8915, - 0xffff860f, 0xffdc6d00, 0xffa85300, 0xffa04f00, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xfffeb670, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffff9329, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa04f00, 0xffa85300, 0xffda6c00, 0xffff8105, - 0xffff8207, 0xffff8309, 0xffff850d, 0xffff850d, 0xffff850d, 0xffff8e1f, - 0xfffffefd, 0xffffd7af, 0xffffd7af, 0xffffdab5, 0xffff9731, 0x5fff8b19, - 0x27ff8c1b, 0xf6ff8b19, 0xffffe1c3, 0xffffe6cd, 0xfffee4ca, 0xfffff4e9, - 0xfffeb976, 0xffff8c1b, 0xffff8a17, 0xffff8915, 0xffff860f, 0xffff8207, - 0xffff8003, 0xfff67a00, 0xffae5600, 0xffa45100, 0xffa04f00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffea7400, 0xfffffdfb, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff3e7, 0xffb85b00, 0xffa04f00, - 0xffa04f00, 0xffa04f00, 0xffa45100, 0xffae5600, 0xfff27800, 0xffff7f01, - 0xffff8003, 0xffff8105, 0xffff8207, 0xffff8309, 0xffff8309, 0xfffeb36a, - 0xfffeeee0, 0xffffd5ab, 0xffffd6ad, 0xfffed4aa, 0xf6ff8b19, 0x27ff8c1b, - 0x03ff5b01, 0xc5ff8b19, 0xffffbf81, 0xfffee5cc, 0xffffe2c5, 0xffffe7cf, - 0xffffe6cd, 0xffff8813, 0xffff850d, 0xffff8309, 0xffff8105, 0xffff7f01, - 0xffff7f01, 0xffff8003, 0xffea7400, 0xffac5500, 0xffa45100, 0xffa04f00, - 0xffa04f00, 0xffa45100, 0xfffedebe, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffc083, 0xffa04f00, - 0xffa04f00, 0xffa45100, 0xffac5500, 0xffe87300, 0xfffa7c00, 0xfffa7c00, - 0xfffc7d00, 0xffff7f01, 0xffff8003, 0xffff8207, 0xffff8309, 0xfffee5cc, - 0xfffedcba, 0xfffed2a8, 0xffffd6ad, 0xfffeb874, 0xc5ff8b19, 0x03ff5b01, - 0x00000000, 0x71ff8b19, 0xffff9731, 0xfffee4ca, 0xfffeddbc, 0xffffd9b3, - 0xfffff4e9, 0xffffa44b, 0xffff8105, 0xffff7f01, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xffff7f01, 0xffe27000, 0xffac5500, 0xffa45100, - 0xffa04f00, 0xffffa145, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffa7c00, - 0xffa45100, 0xffac5500, 0xffe47100, 0xffff7f01, 0xffff7f01, 0xfffc7d00, - 0xfffc7d00, 0xfffa7c00, 0xffff7f01, 0xffff7f01, 0xffffa145, 0xfffff3e7, - 0xfffed0a4, 0xfffed2a8, 0xffffd7af, 0xffff962f, 0x71ff8b19, 0x00000000, - 0x00000000, 0x1eff8b19, 0xedff8b19, 0xffffc791, 0xffffd9b3, 0xfffed4aa, - 0xfffedebe, 0xffffe7cf, 0xffff8003, 0xffff7f01, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xfffc7d00, 0xffff7f01, 0xffec7500, 0xffae5600, - 0xffd86b00, 0xfffff7ef, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff4e9, 0xffffe7cf, - 0xffb65a00, 0xffee7600, 0xffff8003, 0xffff7f01, 0xffff8003, 0xffff7f01, - 0xfffc7d00, 0xfffa7c00, 0xfffa7c00, 0xffff7f01, 0xffffe7cf, 0xfffeddbc, - 0xfffecc9c, 0xfffed1a6, 0xffffc68f, 0xedff8b19, 0x1eff8b19, 0x00000000, - 0x00000000, 0x00000000, 0x92ff8b19, 0xffff9731, 0xfffed4aa, 0xfffecc9c, - 0xffffcb99, 0xffffead5, 0xfffeb772, 0xffff7f01, 0xffff7f01, 0xffff7f01, - 0xfffc7d00, 0xfffc7d00, 0xffff7f01, 0xffff8207, 0xffff8309, 0xffff8003, - 0xffffd7af, 0xffffca97, 0xfffebd7e, 0xffffd8b1, 0xfffeecda, 0xfffffaf5, - 0xfffffaf5, 0xfffeecda, 0xffffd8b1, 0xfffebd7e, 0xffff9f41, 0xfffeddbc, - 0xffffc287, 0xffff850d, 0xffff8309, 0xffff8003, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xfffc7d00, 0xfffeb56e, 0xffffe8d1, 0xffffc791, - 0xffffca97, 0xfffed0a4, 0xffff9e3f, 0x92ff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x22ff8a17, 0xeeff8b19, 0xfffeba78, 0xfffecc9c, - 0xffffcb99, 0xffffd5ab, 0xfffffcf9, 0xffff9731, 0xffff7f01, 0xfffc7d00, - 0xfffc7d00, 0xffff7f01, 0xffff8105, 0xffff8309, 0xffff850d, 0xfffeb166, - 0xfffff4e9, 0xfffed1a6, 0xfffeba78, 0xffffa751, 0xffff9935, 0xffff8f21, - 0xffff8f21, 0xffff9935, 0xffffa64f, 0xfffeb874, 0xfffecd9e, 0xffffdab5, - 0xfffffcf9, 0xffff9935, 0xffff850d, 0xffff8207, 0xffff7f01, 0xffff7f01, - 0xffff7f01, 0xffff7f01, 0xffff9731, 0xfffffcf9, 0xfffecfa2, 0xffffc68f, - 0xffffc995, 0xffffbf81, 0xeeff8b19, 0x22ff8a17, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x7cff8b19, 0xffff8d1d, 0xfffecc9c, - 0xfffecd9e, 0xfffecc9c, 0xffffe0c1, 0xfffff1e3, 0xffff8c1b, 0xfffc7d00, - 0xffff7f01, 0xffff8003, 0xffff8207, 0xffff840b, 0xffff8e1f, 0xfffff5eb, - 0xffffead5, 0xffffe0c1, 0xfffeddbc, 0xfffeddbc, 0xffffe1c3, 0xfffee5cc, - 0xffffe6cd, 0xffffe1c3, 0xfffedcba, 0xffffdbb7, 0xffffdbb7, 0xffffe6cd, - 0xfffff4e9, 0xffffc58d, 0xffff850d, 0xffff8309, 0xffff8105, 0xffff7f01, - 0xffff7f01, 0xffff8c1b, 0xfffff2e5, 0xffffe0c1, 0xffffc893, 0xffffc893, - 0xffffca97, 0xffff942b, 0x7cff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x0bff8f17, 0xc8ff8b19, 0xffff9c3b, - 0xfffecfa2, 0xffffca97, 0xffffc995, 0xffffe3c7, 0xffffeddb, 0xffff9023, - 0xffff8003, 0xffff8105, 0xffff8309, 0xffff850d, 0xffff8813, 0xffffa955, - 0xffffe0c1, 0xfffffdfb, 0xfffff3e7, 0xffffebd7, 0xffffeddb, 0xffffebd7, - 0xfffeecda, 0xffffeddb, 0xffffebd7, 0xfffff2e5, 0xfffffcf9, 0xfffedfc0, - 0xffffa54d, 0xffff8309, 0xffff840b, 0xffff850d, 0xffff840b, 0xffff8105, - 0xffff9023, 0xffffeddb, 0xfffee5cc, 0xffffcb99, 0xffffca97, 0xffffcb99, - 0xffffa64f, 0xc8ff8b19, 0x0bff8f17, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x31ff8c1b, 0xedff8b19, - 0xfffeac5c, 0xffffcb99, 0xffffc995, 0xffffc893, 0xffffe2c5, 0xfffff6ed, - 0xffffa145, 0xffff8207, 0xffff850d, 0xffff8711, 0xffff8a17, 0xffff8c1b, - 0xffff8c1b, 0xffff9227, 0xfffeb268, 0xfffed0a4, 0xffffd6ad, 0xfffee9d4, - 0xfffee9d4, 0xffffd6ad, 0xfffed0a4, 0xfffeb268, 0xffff9023, 0xffff8813, - 0xffff8711, 0xffff850d, 0xffff840b, 0xffff850d, 0xffff850d, 0xffffa145, - 0xfffff6ed, 0xffffe2c5, 0xffffcb99, 0xffffcb99, 0xfffecd9e, 0xfffeb772, - 0xedff8b19, 0x31ff8c1b, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x5aff8b19, - 0xfcff8b19, 0xfffeb772, 0xfffecc9c, 0xffffca97, 0xfffecc9c, 0xffffe0c1, - 0xfffffefd, 0xfffebd7e, 0xffff860f, 0xffff8813, 0xffff8a17, 0xffff8b19, - 0xffff8b19, 0xffff8a17, 0xffff8915, 0xffff8b19, 0xffff8d1d, 0xffff8f21, - 0xffff9023, 0xffff8d1d, 0xffff8a17, 0xffff8813, 0xffff8813, 0xffff8813, - 0xffff8813, 0xffff860f, 0xffff840b, 0xffff840b, 0xfffebd7e, 0xfffffefd, - 0xffffe1c3, 0xfffecd9e, 0xffffcb99, 0xfffecd9e, 0xffffc083, 0xfcff8b19, - 0x5aff8b19, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x71ff8b19, 0xffff8a17, 0xfffeb976, 0xfffecea0, 0xfffecfa2, 0xfffed0a4, - 0xffffd9b3, 0xfffeeee0, 0xfffee9d4, 0xffffa64f, 0xffff8c1b, 0xffff8c1b, - 0xffff8a17, 0xffff8a17, 0xffff8915, 0xffff8c1b, 0xffff8d1d, 0xffff8f21, - 0xffff8f21, 0xffff8e1f, 0xffff8b19, 0xffff8813, 0xffff8813, 0xffff8813, - 0xffff8813, 0xffff860f, 0xffffa247, 0xffffe8d1, 0xffffeddd, 0xffffdab5, - 0xfffed2a8, 0xfffed4aa, 0xfffecfa2, 0xffffc185, 0xffff8f21, 0x71ff8b19, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x71ff8b19, 0xfcff8b19, 0xfffeb46c, 0xfffed0a4, 0xffffd5ab, - 0xffffd5ab, 0xffffd8b1, 0xffffe7cf, 0xfffff7ef, 0xffffe6cd, 0xffffbf81, - 0xffff9833, 0xffff8915, 0xffff8a17, 0xffff8c1b, 0xffff8e1f, 0xffff9023, - 0xffff8f21, 0xffff8e1f, 0xffff8c1b, 0xffff8a17, 0xffff8813, 0xffff962f, - 0xfffebd7e, 0xffffe6cd, 0xfffff5eb, 0xffffe3c7, 0xfffed4aa, 0xffffd6ad, - 0xffffd6ad, 0xffffd5ab, 0xfffebb7a, 0xfcff8b19, 0x71ff8b19, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x5aff8b19, 0xeeff8b19, 0xffffa54d, 0xffffd7af, - 0xffffdbb7, 0xffffdbb7, 0xfffeddbc, 0xfffedfc0, 0xffffe7cf, 0xfffff1e3, - 0xfffffbf7, 0xffffead5, 0xfffed0a4, 0xfffebe80, 0xfffeba78, 0xffffa955, - 0xffffa955, 0xfffebb7a, 0xfffebe80, 0xfffecfa2, 0xffffead5, 0xfffffbf7, - 0xfffeeee0, 0xffffe3c7, 0xffffd7af, 0xffffd5ab, 0xfffed4aa, 0xffffd9b3, - 0xffffd8b1, 0xfffeaa58, 0xeeff8b19, 0x5aff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x34ff8b19, 0xc5ff8b19, 0xffff952d, - 0xffffc995, 0xfffedfc0, 0xffffe1c3, 0xffffe1c3, 0xfffedfc0, 0xfffedebe, - 0xffffdbb7, 0xffffe2c5, 0xffffebd7, 0xfffff2e5, 0xfffff3e7, 0xfffff9f3, - 0xfffff9f3, 0xfffff4e9, 0xfffff2e5, 0xffffebd7, 0xffffe2c5, 0xfffedcba, - 0xfffedcba, 0xffffdab5, 0xffffdbb7, 0xffffd9b3, 0xffffd7af, 0xffffc995, - 0xffff9833, 0xc5ff8b19, 0x34ff8b19, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0cff8315, 0x7cff8b19, - 0xecff8b19, 0xffff9f41, 0xfffecfa2, 0xfffee4ca, 0xffffe1c3, 0xfffedebe, - 0xfffedcba, 0xfffedcba, 0xfffedebe, 0xffffe1c3, 0xffffe2c5, 0xffffe6cd, - 0xffffe7cf, 0xfffee5cc, 0xffffe1c3, 0xfffeddbc, 0xfffedcba, 0xffffdbb7, - 0xffffdbb7, 0xfffedebe, 0xfffedcba, 0xfffecfa2, 0xffffa349, 0xecff8b19, - 0x7cff8b19, 0x0cff8315, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x26ff911b, 0x92ff8b19, 0xecff8b19, 0xffff952d, 0xfffebb7a, 0xffffd8b1, - 0xffffe1c3, 0xffffe2c5, 0xffffe1c3, 0xffffe3c7, 0xfffee4ca, 0xffffe8d1, - 0xfffee9d4, 0xffffe7cf, 0xfffee4ca, 0xffffe1c3, 0xffffe0c1, 0xfffeddbc, - 0xffffd7af, 0xfffebe80, 0xffff9a37, 0xecff8b19, 0x92ff8b19, 0x26ff911b, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x1eff8b19, 0x73ff8b19, 0xc4ff8b19, 0xf5ff8b19, - 0xffff962f, 0xffffa54d, 0xfffeb772, 0xffffc893, 0xffffd7af, 0xfffedcba, - 0xfffedcba, 0xffffd8b1, 0xffffc995, 0xfffeb976, 0xffffa853, 0xffff9731, - 0xf5ff8b19, 0xc4ff8b19, 0x73ff8b19, 0x1eff8b19, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01ff0101, 0x28ff8b19, - 0x5fff8b19, 0x92ff8b19, 0xb8ff8b19, 0xd1ff8b19, 0xe3ff8b19, 0xedff8b19, - 0xedff8b19, 0xe3ff8b19, 0xd1ff8b19, 0xb8ff8b19, 0x92ff8b19, 0x5fff8b19, - 0x28ff8b19, 0x01ff0101, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static unsigned char sdlappicon_mask[] = { - 0, 0, 255, 255, 0, 0, 0, 192, 255, 255, 3, 0, 0, 240, - 255, 255, 15, 0, 0, 252, 255, 255, 63, 0, 0, 254, 255, 255, - 127, 0, 0, 255, 255, 255, 255, 0, 128, 255, 255, 255, 255, 1, - 192, 255, 255, 255, 255, 3, 224, 255, 255, 255, 255, 7, 240, 255, - 255, 255, 255, 15, 248, 255, 255, 255, 255, 31, 248, 255, 255, 255, - 255, 31, 252, 255, 255, 255, 255, 63, 252, 255, 255, 255, 255, 63, - 254, 255, 255, 255, 255, 127, 254, 255, 255, 255, 255, 127, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, - 255, 127, 254, 255, 255, 255, 255, 127, 252, 255, 255, 255, 255, 63, - 252, 255, 255, 255, 255, 63, 248, 255, 255, 255, 255, 31, 248, 255, - 255, 255, 255, 31, 240, 255, 255, 255, 255, 15, 224, 255, 255, 255, - 255, 7, 192, 255, 255, 255, 255, 3, 128, 255, 255, 255, 255, 1, - 0, 255, 255, 255, 255, 0, 0, 254, 255, 255, 127, 0, 0, 252, - 255, 255, 63, 0, 0, 240, 255, 255, 15, 0, 0, 192, 255, 255, - 3, 0, 0, 0, 255, 255, 0, 0,}; - -struct sdlappicon sdlappicon = { - 48,48, // width,height - sdlappicon_pixels, - sdlappicon_mask -}; diff --git a/polymer-perf/eduke32/rsrc/game_icon.ico b/polymer-perf/eduke32/rsrc/game_icon.ico deleted file mode 100644 index 67eaeae9a..000000000 Binary files a/polymer-perf/eduke32/rsrc/game_icon.ico and /dev/null differ diff --git a/polymer-perf/eduke32/rsrc/manifest.build.xml b/polymer-perf/eduke32/rsrc/manifest.build.xml deleted file mode 100644 index 7eca5865e..000000000 --- a/polymer-perf/eduke32/rsrc/manifest.build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - -Mapster32 for EDuke32 - - - - - - diff --git a/polymer-perf/eduke32/rsrc/manifest.game.xml b/polymer-perf/eduke32/rsrc/manifest.game.xml deleted file mode 100644 index ae2e29158..000000000 --- a/polymer-perf/eduke32/rsrc/manifest.game.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - -EDuke32 - - - - - - diff --git a/polymer-perf/eduke32/samples/_clipshape0.map b/polymer-perf/eduke32/samples/_clipshape0.map deleted file mode 100644 index c1a3b7afb..000000000 Binary files a/polymer-perf/eduke32/samples/_clipshape0.map and /dev/null differ diff --git a/polymer-perf/eduke32/samples/a.m32 b/polymer-perf/eduke32/samples/a.m32 deleted file mode 100644 index 860be045d..000000000 --- a/polymer-perf/eduke32/samples/a.m32 +++ /dev/null @@ -1,1145 +0,0 @@ -// m32 script editor extensions. -// to load, enter "include samples/a" (without quotes) in the console -// or into a file named m32_autoexec.cfg for automatic loading on startup. -// to enable all events, "enableevent all" - -////////// USER SETTINGS ////////// - -// settings for the tweaking of Polymer pr_override*-variables with the keypad keys -define MINPARALLAXSCALE -10 // minimum pr_parallaxscale value -define MAXPARALLAXSCALE 10 -define MINPARALLAXBIAS -10 -define MAXPARALLAXBIAS 10 -define PSCALESTEPS 1000 // 0..1 is mapped to 0..PSCALESTEPS -define PBIASSTEPS 1000 - -define MINSPECULARPOWER -10 -define MAXSPECULARPOWER 1000 -define MINSPECULARFACTOR -10 -define MAXSPECULARFACTOR 1000 -define SPOWERSTEPS 100 -define SFACTORSTEPS 100 - -// color of various drawing enhancements -define PREVIEW_DRAW_COLOR 11 -gamevar showpal 0 0 - -// whether to use overridden aspect/range values when entering 3d mode (software/Polymost). -// tweak with keys 7,8,9,0 on the top row -gamevar use_custom_aspect 0 0 // this is now the same as r_usenewaspect -gamevar davr 65536 0 -gamevar dayx 65536 0 - - -// see end of file for more user settings and examples - -////////// END USER SETTINGS ////////// - - -include names.h - -// flag 1: per-block (top-level, event, or state) variable -gamevar i 0 1 -gamevar j 0 1 -gamevar k 0 1 - -gamevar p 0 1 -gamevar r 0 1 - -gamevar x 0 0 -gamevar y 0 0 -gamevar z 0 0 - -gamevar dx 0 0 -gamevar dy 0 0 -gamevar dz 0 0 -gamevar dang 0 0 - -gamevar tmp 0 0 -gamevar cnt 0 0 - -gamevar drawcol 9 0 - - -define TQUOTE 0 -definequote TQUOTE >>> write on me! <<< - -//light -define LIGHTQUOTE 1 -// x y z r g b mins maxs -definequote LIGHTQUOTE light %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d -// sec range radius fade ang horiz prio tile - - -define PRSCALE 1000 -define MAXSPECULAR 100000 - -define TMPARLEN 128 -gamearray ar TMPARLEN -gamearray xx TMPARLEN -gamearray yy TMPARLEN - -gamearray parm 8 - -// prints out maphack light definitions based on SE lights in map -defstate printlights - var flags - - print "--PRLIGHTS--" - for i allsprites, ifactor SECTOREFFECTOR, ifge .lotag 49, ifle .lotag 50 - { - ife .lotag 50 - { - set j 128, sub j .shade, shiftl j 1 - set k j, mul k 3, div k 4 - } - else - { - set j 0, set k 0 - } - - set flags 0 - ifand .cstat 2 - { - ifand .cstat 512 - set flags 4 - else - set flags 2 - } - // range r g b - qsprintf TQUOTE LIGHTQUOTE .sectnum .x .y .z .hitag .xvel .yvel .zvel - j k .ang .extra .xoffset .yoffset flags .owner - // radius fade horiz minshade maxshade prio tile - print TQUOTE - } - print "--ENDPRLIGHTS--" -ends - -// convenient polymer SE light manipulation with keypad keys -// when aiming at light SE (49 or 50): -// KP 4,5,6,8: angle/horiz -// KP 7,9: range -// KP+/-: radius -// KP 1,2,3: RGB color (Shift inverts) -// -// when aiming at wall or sector: -// ----Alt-KP/ enable/disable parallax override /// none, toggle them manually in the OSD -// ----Alt-KP* enable/disable bias override /// none, toggle them manually in the OSD -// when the respective overrides are on: -// KP 5,8: parallaxscale -// KP 4,6: parallaxbias -// KP /,*: specularfactor -// KP 7,9: specularpower -// -// Also try Shift and/or Ctrl modifiers for different increments -defstate fiddlewithlights - var minval maxval -/* - ifaimingsprite nullop else - { - ifeithershift ifhitkey KEY_gSLASH - { - xor pr_overrideparallax 1, and pr_overrideparallax 1 - ife pr_overrideparallax 1 - quote "OVERRIDE POLYMER PARALLAX: ON" - else - quote "OVERRIDE POLYMER PARALLAX: OFF" - } - else ifeithershift ifhitkey KEY_gSTAR - { - xor pr_overridespecular 1, and pr_overridespecular 1 - ife pr_overridespecular 1 - quote "OVERRIDE POLYMER SPECULAR: ON" - else - quote "OVERRIDE POLYMER SPECULAR: OFF" - } - } -*/ - // if aiming at sector or wall - ifaimingsprite nullop - else ifn pr_overrideparallax 0 - { - set j 0 set k 0 - - ifhitkey KEY_KP5 set j -1, ifhitkey KEY_KP8 set j 1 - ifn j 0 set k 1 - - ifhitkey KEY_KP4 set j -1, ifhitkey KEY_KP6 set j 1 - ife k 0 ifn j 0 set k 2 - - ifeitheralt mul j 10 - ifeitherctrl mul j 10 - - switch k - // "break" breaks too far or there's something wrong with the switch -- needs to be looked at -// case 0: break; - case 1: - { - set k pr_parallaxscale - ftoi k PSCALESTEPS // must convert to scaled integer, maps 0..1 to 0..PARALLAXSTEPS - set minval MINPARALLAXSCALE, mul minval PSCALESTEPS - set maxval MAXPARALLAXSCALE, mul maxval PSCALESTEPS - add k j, clamp k minval maxval - itof k PSCALESTEPS // convert back - qsprintf TQUOTE "PARALLAX SCALE: %f" k, quote TQUOTE - set pr_parallaxscale k - break; - } - case 2: - { - set k pr_parallaxbias - ftoi k PBIASSTEPS - set minval MINPARALLAXBIAS, mul minval PBIASSTEPS - set maxval MAXPARALLAXBIAS, mul maxval PBIASSTEPS - add k j, clamp k minval maxval - itof k PBIASSTEPS - qsprintf TQUOTE "PARALLAX BIAS: %f" k, quote TQUOTE - set pr_parallaxbias k - break; - } - endswitch -//quote "zxczxc" - } -//quote "asdasd" - // if aiming at sector or wall - ifaimingsprite nullop - else ifn pr_overridespecular 0 - { - set j 0 set k 0 - - ifhitkey KEY_gSLASH set j -1, ifhitkey KEY_gSTAR set j 1 - ifn j 0 set k 3 - - ifhitkey KEY_KP7 set j -1, ifhitkey KEY_KP9 set j 1 - ife k 0 ifn j 0 set k 4 - - ifeitheralt mul j 10 - ifeitherctrl mul j 10 - - switch k -// case 0: break; - case 3: - { - set k pr_specularfactor - ftoi k SFACTORSTEPS - set minval MINSPECULARFACTOR, mul minval SFACTORSTEPS - set maxval MAXSPECULARFACTOR, mul maxval SFACTORSTEPS - add k j, clamp k minval maxval - itof k SFACTORSTEPS - qsprintf TQUOTE "SPECULAR FACTOR: %f" k, quote TQUOTE - set pr_specularfactor k - break; - } - case 4: - { - set k pr_specularpower - ftoi k SPOWERSTEPS - set minval MINSPECULARPOWER, mul minval SPOWERSTEPS - set maxval MAXSPECULARPOWER, mul maxval SPOWERSTEPS - add k j, clamp k minval maxval - itof k SPOWERSTEPS - qsprintf TQUOTE "SPECULAR POWER: %f" k, quote TQUOTE - set pr_specularpower k - break; - } - endswitch - } - -//quote "qweqwe" - // if aiming at a sprite that's not a Polymer light - ifaimingsprite set k 1 else set k 0 - - ife k 1 ife sprite[searchwall].picnum SECTOREFFECTOR - ifge sprite[searchwall].lotag 49 ifle sprite[searchwall].lotag 50 - set k 0 - - ife k 1 - { - seti searchwall - - // [xyz]vel / owner - ifeitheralt - { - ifhitkey KEY_KP1 - { - getnumber256 .xvel "XVEL: " 0 - getnumber256 .yvel "YVEL: " 0 - getnumber256 .zvel "ZVEL: " 0 - } - else ifhitkey KEY_KP2 - { - getnumber256 .owner "OWNER: " 0 - ifl .owner 0 set .owner -1 - } - } - } - - - // if aiming at an SE with lotag 49 or 50 (Polymer light) - ifaimingsprite ife sprite[searchwall].picnum SECTOREFFECTOR - ifge sprite[searchwall].lotag 49 ifle sprite[searchwall].lotag 50 - { - set i searchwall, seti i // set current sprite = targeted sprite - - ife .lotag 50 - { - // horiz - ifeithershift set j 1 else set j 10 - ifhitkey KEY_gUP add .extra j - else ifhitkey KEY_gKP5 sub .extra j - clamp .extra -500 500 - - // angle - set j 128 - ifeitherctrl set j 4 - ifeithershift { ifeitherctrl set j 1 else set j 32 } - ifhitkey KEY_gLEFT sub .ang j - else ifhitkey KEY_gRIGHT add .ang j - - // radius - ifeitherctrl - { - ifholdkey KEY_gMINUS add .shade 9 - else ifholdkey KEY_gPLUS sub .shade 9 - - clamp .shade -118 117 - } - } - - // range - ifeithershift set j 10 - else ifeitherctrl set j 1000 - else set j 100 - ifhitkey KEY_KP9 add .hitag j - else ifhitkey KEY_KP7 sub .hitag j - clamp .hitag 0 16000 - - // min/max shade - ifeithershift set j -1 else set j 1 - ifeitherctrl - { - ifhitkey KEY_gSLASH - { - set .xoffset 0 - set .yoffset 0 - quote "Reset X and Y OFFSET (min/max shade) to 0" - } - } - else - { - set k 0 - ifhitkey KEY_gSLASH { add .xoffset j, set k 1 } - else ifhitkey KEY_gSTAR { add .yoffset j, set k 1 } - - ife k 1 - { - qsprintf TQUOTE "XY OFFSET (min/max shade): %d %d" .xoffset .yoffset - quote TQUOTE - } - } - - // color/picnum - ifeitheralt - { - ifhitkey KEY_KP1 - { - getnumber256 .xvel "XVEL (red): " 255 - getnumber256 .yvel "YVEL (green): " 255 - getnumber256 .zvel "ZVEL (blue): " 255 - } - else ifhitkey KEY_KP2 - { - getnumber256 .owner "OWNER (projection picnum): " -MAXTILES - ifl .owner 0 set .owner -1 - } - } - else - { - ifeitherctrl set j 1 else set j 10 - ifeithershift inv j - - set k 0 - ifhitkey KEY_B { add .xvel j, set k 1 } - ifhitkey KEY_N { add .yvel j, set k 1 } - ifhitkey KEY_M { add .zvel j, set k 1 } - - ifhitkey KEY_KP1 { add .xvel j, set k 1 } - ifhitkey KEY_KP2 { add .yvel j, set k 1 } - ifhitkey KEY_KP3 { add .zvel j, set k 1 } - - ife k 1 - { - clamp .xvel 1 255 - clamp .yvel 1 255 - clamp .zvel 1 255 - - qsprintf TQUOTE "XYZ VEL (RGB color): %d %d %d" .xvel .yvel .zvel - quote TQUOTE - } - } - } -ends - -// forward refs -defstate userkeys_3d ends -defstate userdrawlabel ends - -onevent EVENT_PREKEYS3D -// state testkeyavail - state fiddlewithlights - state userkeys_3d -endevent - - -// rotate highlighted sprites around selected (closest to mouse) sprite -// global parameter: dang -defstate rotselspr - ifg highlightcnt 0 - ifge pointhighlight 16384, ifl pointhighlight 32768 - { - ife dang 0 return - - set p pointhighlight, and p 16383 - - add sprite[p].ang dang - - for i selsprites, ifn i p - { - rotatepoint sprite[p].x sprite[p].y .x .y dang (x y) - add .ang dang - bsetsprite I x y .z - } - } -ends - -onevent EVENT_PREKEYS2D -// state testkeyavail - - set j 0 - ifeitherctrl - { - ifhitkey KEY_COMMA set j -1 - ifhitkey KEY_PERIOD set j 1 - } - - ifn j 0 - { - mul j 512 - set dang j - state rotselspr - } -endevent - -gamevar fyx 0 0 -gamevar fvr 0 0 - -defstate setas - set fyx dayx - mul fyx 4 mul fyx 100 // the correction factor 100/107 has been found - div fyx 3 div fyx 107 // out experimentally. squares ftw! - set fvr davr - mul fvr xdim mul fvr 3 - div fvr ydim div fvr 4 - setaspect fvr fyx //davr dayx -ends - -onevent EVENT_ENTER3DMODE - ifn use_custom_aspect 0 - state setas -endevent - - -defstate cmp_by_lotag // comparator subroutine for sorting - set RETURN sprite[SV2].lotag - sub RETURN sprite[SV1].lotag -ends - -defstate connectlocators - // connect LOCATORS in a sector with lines - getarraysize ar tmp - set j 0 - for i spritesofsector cursectnum - { - ifge j tmp nullop else - ifactor LOCATORS - { - set ar[j] i - add j 1 - } - } - - set tmp j - sort ar tmp cmp_by_lotag - - sub tmp 1 - for i range tmp - { - set j ar[i] - set k i, add k 1, set k ar[k] - drawline16z sprite[j].x sprite[j].y sprite[j].z sprite[k].x sprite[k].y sprite[k].z drawcol - } -ends - -defstate draw_prlightprojections -////////// polymer light 2d projections ////////// - var c d h r x2 y2 oldpat - - array xx 2 - array yy 2 - - set oldpat drawlinepat - set drawlinepat 0x11111111 - for i spritesofsector cursectnum - { - ifactor SECTOREFFECTOR - { - ife .lotag 49 // point light - { - set d .hitag // light distance - mul d d, mul d 2, sqrt d d, div d 2 - - getclosestcol .xvel .yvel .zvel c // light color - inv c - - set x .x, set x2 .x, set y .y, set y2 .y - add x d, add y d, sub x2 d, sub y2 d - drawline16z x y .z x2 y2 .z c - - set x .x, set x2 .x, set y .y, set y2 .y - add x d, sub y d, sub x2 d, add y2 d - drawline16z x y .z x2 y2 .z c - drawcircle16z .x .y .z .hitag c - } - else ife .lotag 50 // spot light - { - set d .hitag // light distance - and d 65535 - set r 128, sub r .shade, shiftl r 1 // light cone radius (BUILD angles) - getclosestcol .xvel .yvel .zvel c // light color - inv c - - set x .x, set y .y, add x d - rotatepoint .x .y x y .ang x y - - set h .extra // horiz - sub h 100 - set tmp h, mul tmp tmp, add tmp 40000 - sqrt tmp tmp - divscale h 200 tmp 15 // h: horizontal distance fraction - - set dx .x, sub dx x - set dy .y, sub dy y - set tmp 32768, sub tmp h - mulscale dx dx tmp 15 - mulscale dy dy tmp 15 - - set tmp 0, sub tmp r - rotatepoint .x .y x y tmp xx[0] yy[0] - set tmp 0, add tmp r - rotatepoint .x .y x y tmp xx[1] yy[1] - - add xx[0] dx, add yy[0] dy - add xx[1] dx, add yy[1] dy - - drawline16z .x .y .z xx[0] yy[0] .z c - drawline16z .x .y .z xx[1] yy[1] .z c - } - } - } - set drawlinepat oldpat -ends - -defstate previewdoors2d - // preview swinging and sliding doors in 2d mode - var valid sect lo - var i j w numw ang trange dx dy - - set valid 0 - set sect searchsector - - ifge sect 0 ifl sect numsectors - { - set lo sector[sect].lotag - ife lo 23 set valid 1 - else ife lo 25 set valid 1 - } - - ife valid 1 - { - set valid 0 - for i spritesofsector sect - ifactor SECTOREFFECTOR - { - ife .lotag 11 ife lo 23 set valid 1 // swinging door - ife .lotag 15 ife lo 25 set valid 1 // slide door - ife valid 1 { set j i, break } - } - - ife valid 1 - seti j - else return - - ife .lotag 15 - { - set trange 256 - for i spritesofsector sect - ifactor GPSPEED { set trange .lotag, break } - mul trange 2 // now equals distance of sliding door to travel - } - - set i 0 - for w loopofwall sector[sect].wallptr - { - ifge i TMPARLEN break - set xx[i] wall[w].x - set yy[i] wall[w].y - add i 1 - } - ifl i TMPARLEN - { - set xx[i] xx[0] - set yy[i] yy[0] - add i 1 - } - set numw i - - ife .lotag 11 - { - ifg .ang 1024 set ang -512 else set ang 512 - for i range numw - rotatepoint .x .y xx[i] yy[i] ang xx[i] yy[i] - } - else // if .lotag 15 - { - set ang .ang, add ang 1024 - a2xy ang dx dy - mulscale dx trange dx 14 - mulscale dy trange dy 14 - - for i range numw - { - add xx[i] dx - add yy[i] dy - } - } - - set drawlinepat 0x33333333 - sub numw 1 - for i range numw - { - set j i, add j 1 - drawline16z xx[i] yy[i] sector[sect].floorz xx[j] yy[j] sector[sect].floorz PREVIEW_DRAW_COLOR - } - set drawlinepat 0xffffffff - } -ends - - -// LOCATORS auto-incrementer -onevent EVENT_INSERTSPRITE2D - set k I - set j -1 - for i spritesofsector .sectnum - { - ifn i k, ifactor LOCATORS, ifg .lotag j - set j .lotag - } - ifg j -1 - { - add j 1 - set .lotag j - } -endevent - - -//////////////////// SPRITE DUPLICATORS //////////////////// - -defstate transcnt - ifle cnt 0 { inv cnt, add cnt 128 } -ends - -define DUP_ROT_MAGIC 123 - -// duplicates and rotates selected sprites around -// pivot sprite with fields -// .extra=123 (magic) -// .ang: angle delta -// .yrepeat*32: z delta (positive if pal!=0, i.e. going down) -// .shade: count (-128 to 0 -> 255 to 128) -defstate duprot - ifaimingsprite nullop else return - ifn sprite[searchwall].extra DUP_ROT_MAGIC return - - set p searchwall // pivot sprite - set cnt sprite[p].shade, state transcnt - - set sprite[p].extra -1 - - for i range cnt - { - for j selsprites, ifn j p - { - dupsprite j // duplicate sprite j, I becomes index of newly created sprite - - set dang i, add dang 1, mul dang sprite[p].ang - rotatepoint sprite[p].x sprite[p].y .x .y dang (x y) - add .ang dang - - set z i, add z 1, mul z sprite[p].yrepeat, shiftl z 5 - ife sprite[p].pal 0, inv z - add z .z - - bsetsprite I x y z - } - } -ends - -// same as above but with tsprite[], as a kind of preview -defstate tduprot - ifaimingsprite nullop else return - ifl searchwall 0 return - ifn sprite[searchwall].extra DUP_ROT_MAGIC return - - set p searchwall // pivot sprite - set cnt sprite[p].shade, state transcnt - - for i range cnt - { - for j selsprites, ifn j p - { - set k spritesortcnt - tdupsprite j - - set dang i, add dang 1, mul dang sprite[p].ang - rotatepoint sprite[p].x sprite[p].y tsprite[k].x tsprite[k].y dang (x y) - add tsprite[k].ang dang - - set z i, add z 1, mul z sprite[p].yrepeat, shiftl z 5 - ife sprite[p].pal 0 inv z - add z tsprite[k].z - - set tsprite[k].x x - set tsprite[k].y y - set tsprite[k].z z - - or tsprite[k].cstat 514 - } - } -ends - -define DUP_LIN_MAGIC 234 -define DUP_LIN_MAGIC2 345 - -// duplicates and translates selected sprites in the direction between two -// reference sprites with fields -// .extra=234 (1st sprite), =345 (2nd, aimed at sprite) -// .shade: count (-128 to 0 -> 255 to 128) -defstate duplin - ifaimingsprite nullop else return - ifn sprite[searchwall].extra DUP_LIN_MAGIC2 return - - set r searchwall // 2nd reference point - - set cnt sprite[r].shade, state transcnt - - set p -1 // 1st reference point - for i selsprites, ifn i r - { - ife .extra DUP_LIN_MAGIC { set p i, break } - } - ifl p 0 return - - set sprite[p].extra -1 - set sprite[r].extra -1 - - set dx sprite[r].x, sub dx sprite[p].x - set dy sprite[r].y, sub dy sprite[p].y - set dz sprite[r].z, sub dz sprite[p].z - - for i range cnt - { - for j selsprites, ifn j r - { - dupsprite j - - set x i, add x 1, mul x dx, add x .x - set y i, add y 1, mul y dy, add y .y - set z i, add z 1, mul z dz, add z .z - bsetsprite I x y z - } - } -ends - -defstate tduplin - ifaimingsprite nullop else return - ifn sprite[searchwall].extra DUP_LIN_MAGIC2 return - - set r searchwall // 2nd reference point - - set cnt sprite[r].shade, state transcnt - - set p -1 // 1st reference point - for i selsprites, ifn i r - { - ife .extra DUP_LIN_MAGIC { set p i, break } - } - ifl p 0 return - - set dx sprite[r].x, sub dx sprite[p].x - set dy sprite[r].y, sub dy sprite[p].y - set dz sprite[r].z, sub dz sprite[p].z - - for i range cnt - { - for j selsprites, ifn j r - { - set k spritesortcnt - tdupsprite j - - set tmp i, add tmp 1, mul tmp dx - add tsprite[k].x tmp - set tmp i, add tmp 1, mul tmp dy - add tsprite[k].y tmp - set tmp i, add tmp 1, mul tmp dz - add tsprite[k].z tmp - - or tsprite[k].cstat 514 -// bsetsprite I x y z - } - } -ends - -onevent EVENT_ANALYZESPRITES - state tduprot - state tduplin -endevent - -onevent EVENT_KEYS3D - var l m - - // door sound tester - ifaimingwall - ifholdkey KEY_SPACE - { - set k wall[searchwall].nextsector - ifl k 0 set k searchsector - - ife sector[k].lotag 0 return - - for i spritesofsector k - { - ifactor MUSICANDSFX - ifge .lotag 0 ifl .lotag MAXSOUNDS - { - getsoundflags .lotag m - ifand m 1 nullop else soundonce .lotag - } - } - } - - // swinging doors tester -- hit space on a door wall - ifaimingwall - ifhitkey KEY_SPACE // SE11 ST23 up:ccw - { - set k wall[searchwall].nextsector - ifl k 0 return - ifn sector[k].lotag 23 return - set tmp 0 - for i loopofwall searchwall - { - ifl wall[i].nextsector 0 set tmp 1 else - ifn wall[i].nextsector k set tmp 1 - } -// a weaker condition -// for i loopofwall wall[searchwall].nextwall -// { -// ifl wall[i].nextsector 0 set tmp 1 else -// ifn wall[i].nextsector searchsector set tmp 1 -// } - ifn tmp 0 - { - quote "door sector not an island sector!" - return - } - - set l -1 - for i spritesofsector k - { - ifactor SECTOREFFECTOR ife sprite[i].lotag 11 - { - set l i - ifn sprite[i].ang 512 ifn sprite[i].ang 1024 ifn sprite[i].ang 1536 set l -1 - } - } - ifl l 0 - { - quote "door sector has no SE sprite!" - return - } - - for tmp wallsofsector k - { - rotatepoint (sprite[l].x sprite[l].y) (wall[tmp].x wall[tmp].y) sprite[l].ang (i j) - dragpoint tmp i j - } - for tmp spritesofsector k - { - ifn tmp l - { - rotatepoint (sprite[l].x sprite[l].y) (sprite[tmp].x sprite[tmp].y) sprite[l].ang (i j) - bsetsprite tmp i j sprite[tmp].z - } - } - inv sprite[l].ang - } - - // teleporter -- works on SE7 and SE17 (elevator) - ifaimingsprite - ifhitkey KEY_SPACE - { - ife sprite[searchwall].picnum SECTOREFFECTOR - { - set tmp 0 - ife sprite[searchwall].lotag 7 set tmp 1 - ife sprite[searchwall].lotag 17 set tmp 1 - ife tmp 0 return - - for i allsprites - { - ifn i searchwall, ifactor SECTOREFFECTOR, ife sprite[i].lotag sprite[searchwall].lotag - ife sprite[i].hitag sprite[searchwall].hitag - { - add posx sprite[i].x, sub posx sprite[searchwall].x - add posy sprite[i].y, sub posy sprite[searchwall].y - add posz sprite[i].z, sub posz sprite[searchwall].z - - updatecursectnum - - return - } - } - } - else ife sprite[searchwall].extra DUP_ROT_MAGIC - { - state duprot - } - else ife sprite[searchwall].extra DUP_LIN_MAGIC2 - { - state duplin - } - } - - - set j 0 - - set k 0 - ifholdkey KEY_7 set k -1 - ifholdkey KEY_0 set k 1 - ifn k 0 - { - set j 1 - ifeithershift nullop else mul k 256 - add davr k - ifl davr 32768 set davr 32768 - ifg davr 256000 set davr 256000 - } - - set k 0 - ifholdkey KEY_8 set k -1 - ifholdkey KEY_9 set k 1 - ifn k 0 - { - set j 1 - ifeithershift nullop else mul k 256 - add dayx k - ifl dayx 32768 set dayx 32768 - ifg dayx 256000 set dayx 256000 - } - ife j 1 - { -// setaspect davr dayx - state setas - qsprintf TQUOTE "ASPECT: davr=%d, dayx=%d | FVR=%d, FYX=%d" davr dayx fvr fyx - quote TQUOTE - } -endevent - -defstate replacestuff - for i spritesofsector searchsector -// ife sprite[i].picnum AMMO set sprite[i].picnum BATTERYAMMO - ifactor parm[0] cactor parm[1] -ends - -defstate convlights // convert (0,0,0) lights to (255,255,255)-ones - for i allsprites ifactor 1 ifge .lotag 49 ifle .lotag 50 ife .xvel 0 ife .yvel 0 ife .zvel 0 - { set .xvel 255 set .yvel 255 set .zvel 255 } -ends - -defstate resetallws // reset all sprites and walls to default repeat/panning - for i allsprites - { - set .xrepeat 64 - set .yrepeat 64 - } - for i allwalls - { - set wall[i].cstat 0 - set wall[i].xpanning 0 - set wall[i].ypanning 0 - set wall[i].yrepeat 8 - fixrepeats i - } -ends - -defstate js // jump to current sprite - set posx .x - set posy .y - set posz .z - updatecursectnum -ends - -var sec 0 0 -var wal 0 0 - -defstate jumptowal // (wal) - ifge wal 0 ifl wal numwalls nullop else return - set posx wall[wal].x - set posy wall[wal].y - updatecursectnum -ends - -defstate jumptosec // (sec) - ifge sec 0 ifl sec numsectors nullop else return - set wal sector[sec].wallptr - state jumptowal -ends - - -onevent EVENT_DRAW2DSCREEN - var tmp - var xx - - state userdrawlabel - - ifge cursectnum 0 - { - state connectlocators - state draw_prlightprojections - } - - state previewdoors2d - - ifn showpal 0 - { - set xx 100 - for tmp range 256 - { - drawline16 xx 100 xx 200 -tmp - add xx 1 - drawline16 xx 100 xx 200 -tmp - add xx 1 - ifge tmp 240 - { - drawline16 xx 100 xx 200 -tmp - add xx 1 - drawline16 xx 100 xx 200 -tmp - add xx 1 - } - } - } -endevent - - -defstate mkterrain - var w2 w3 idx bit tmp sec - var warned - - set warned 0 - - for i selwalls - { - sectorofwall j i - set tmp 0, ifand sector[j].floorstat 2, set tmp 1 // already handled - ife tmp 0 ife sector[j].wallnum 3 - { - set w2 wall[i].point2 - set idx w2, shiftr idx 3 - set tmp w2, and tmp 7, set bit 1, shiftl bit tmp - ifand show2dwall[idx] bit - { - setfirstwall j i - - set z 0x7ffffff - ifin3dmode - { - ife searchstat 2 // floor - set z sector[searchsector].floorz - } - else - { - for k allsectors - { - ifinside mousxplc mousyplc k - { - set z sector[k].floorz - break - } - } - } - - ife z 0x7ffffff - { - ife warned 0 - { - quote "Mouse pointer must be aiming at sector floor." - set warned 1 - } - } - else - { - set w3 wall[w2].point2 - set sec wall[i].nextsector - ifge sec 0 - set sector[j].floorz sector[sec].floorz - alignflorslope j wall[w3].x wall[w3].y z - } - } - } - } -ends - -defstate chselshade - for i selsectors - { - set sector[i].floorshade tempshade - set sector[i].ceilingshade tempshade - - for j spritesofsector i - set .shade tempshade - - for j wallsofsector i - set wall[j].shade tempshade - } -ends - - -////////// USER AREA ////////// - -// key settings -defstate userkeys_3d - ifholdkey KEY_SEMI ifhitkey KEY_C state chselshade -ends - -/* -// example for custom labels -defstate userdrawlabel - for i allsprites - { - ifactor 2978 - { - qsprintf TQUOTE "MOVABLE EX:%d OW:%d", sprite[i].owner, sprite[i].extra - drawlabel TQUOTE .x .y .z 0 31 - } - } -ends -*/ diff --git a/polymer-perf/eduke32/samples/duke3d.def.sample b/polymer-perf/eduke32/samples/duke3d.def.sample deleted file mode 100644 index 7a3c2ef61..000000000 --- a/polymer-perf/eduke32/samples/duke3d.def.sample +++ /dev/null @@ -1,69 +0,0 @@ -// Duke Nukem 3D Sample Defs file -// -// For an explanation of the contents of this file, read releasenotes.html -// in the section titled "DEF-file Language" - -include DEFS.CON - -// These entries define Hightile tints -// definetint -definetint 1 110 110 255 1 -definetint 2 255 110 80 1 -definetint 4 0 0 0 0 -definetint 6 192 255 138 3 -definetint 7 228 200 172 0 -definetint 8 180 255 200 0 - -// This entry defines a texture replacement -// definetexture 0 0 -1 -1 -//definetexture FEMPIC7 0 0 0 -1 -1 "textures/rikaa.png" - -// These entries demonstrate replacing the Pig Cop character with a model - // Editart tile indices: - // walk 2000-2019 - // pump 2025-2027 - // stand 2030-2034 - // shoot 2035-2037 - // dive 2040-2044 - // dived 2045-2049 - // dshoot 2050-2052 - // hit 2055 - // die 2056-2059 - // dead 2060 -// definemodel -// defineskin -// definemodelanim -// definemodelframe -definemodel "models/pigcop.md2" 1.30 0 -definemodelskin 0 "models/pigcop.jpg" - -definemodelanim "walk0" "walk13" 20 0 -definemodelframe "walk0" 2000 2019 - -definemodelanim "pump0" "pump2" 10 1 -definemodelframe "pump0" 2025 2027 - -definemodelframe "stand" 2030 2034 - -definemodelanim "shoot0" "shoot2" 10 1 -definemodelframe "shoot0" 2035 2037 - -definemodelanim "dive0" "dive3" 8 1 -definemodelframe "dive0" 2040 2044 -definemodelframe "dive3" 2045 2049 - -definemodelanim "dshoot0" "dshoot2" 10 1 -definemodelframe "dshoot0" 2050 2052 - -definemodelframe "die0" 2055 2055 -definemodelanim "die1" "dead" 13 1 -definemodelframe "die1" 2056 2059 -definemodelframe "dead" 2060 2060 - - -// These entries demonstrate voxel replacements -// definevoxel -// definevoxeltiles -//definevoxel "voxels/barstool.kvx" -//definevoxeltiles 1006 1006 - diff --git a/polymer-perf/eduke32/samples/enhance.con.sample b/polymer-perf/eduke32/samples/enhance.con.sample deleted file mode 100644 index ce784df47..000000000 --- a/polymer-perf/eduke32/samples/enhance.con.sample +++ /dev/null @@ -1,389 +0,0 @@ -// include this file at the top of your game.con or eduke.con - -// Game Events - -// SYNTAX: -// -// onevent -// { -// ... actions -// } -// endevent - -// Internal event IDs - -/* -enum events { - EVENT_INIT, - EVENT_ENTERLEVEL, - EVENT_RESETWEAPONS, - EVENT_RESETINVENTORY, - EVENT_HOLSTER, - EVENT_LOOKLEFT, - EVENT_LOOKRIGHT, - EVENT_SOARUP, - EVENT_SOARDOWN, - EVENT_CROUCH, - EVENT_JUMP, - EVENT_RETURNTOCENTER, - EVENT_LOOKUP, - EVENT_LOOKDOWN, - EVENT_AIMUP, - EVENT_FIRE, - EVENT_CHANGEWEAPON, - EVENT_GETSHOTRANGE, - EVENT_GETAUTOAIMANGLE, - EVENT_GETLOADTILE, - EVENT_CHEATGETSTEROIDS, - EVENT_CHEATGETHEAT, - EVENT_CHEATGETBOOT, - EVENT_CHEATGETSHIELD, - EVENT_CHEATGETSCUBA, - EVENT_CHEATGETHOLODUKE, - EVENT_CHEATGETJETPACK, - EVENT_CHEATGETFIRSTAID, - EVENT_QUICKKICK, - EVENT_INVENTORY, - EVENT_USENIGHTVISION, - EVENT_USESTEROIDS, - EVENT_INVENTORYLEFT, - EVENT_INVENTORYRIGHT, - EVENT_HOLODUKEON, - EVENT_HOLODUKEOFF, - EVENT_USEMEDKIT, - EVENT_USEJETPACK, - EVENT_TURNAROUND, - EVENT_DISPLAYWEAPON, - EVENT_FIREWEAPON, - EVENT_SELECTWEAPON, - EVENT_MOVEFORWARD, - EVENT_MOVEBACKWARD, - EVENT_TURNLEFT, - EVENT_TURNRIGHT, - EVENT_STRAFELEFT, - EVENT_STRAFERIGHT, - EVENT_WEAPKEY1, - EVENT_WEAPKEY2, - EVENT_WEAPKEY3, - EVENT_WEAPKEY4, - EVENT_WEAPKEY5, - EVENT_WEAPKEY6, - EVENT_WEAPKEY7, - EVENT_WEAPKEY8, - EVENT_WEAPKEY9, - EVENT_WEAPKEY10, - EVENT_DRAWWEAPON, - EVENT_DISPLAYCROSSHAIR, - EVENT_DISPLAYREST, - EVENT_RESETPLAYER, - EVENT_INCURDAMAGE, - EVENT_AIMDOWN, - EVENT_GAME, - EVENT_PREVIOUSWEAPON, - EVENT_NEXTWEAPON, - EVENT_SWIMUP, - EVENT_SWIMDOWN, - EVENT_GETMENUTILE, - EVENT_SPAWN, - EVENT_LOGO, - EVENT_EGS, - EVENT_DOFIRE, - EVENT_PRESSEDFIRE, - EVENT_USE, - EVENT_PROCESSINPUT -}; -*/ - -// Internal projectile stuff - -/* -enum projectilelabels { - PROJ_WORKSLIKE, - PROJ_SPAWNS, - PROJ_SXREPEAT, - PROJ_SYREPEAT, - PROJ_SOUND, - PROJ_ISOUND, - PROJ_VEL, - PROJ_EXTRA, - PROJ_DECAL, - PROJ_TRAIL, - PROJ_TXREPEAT, - PROJ_TYREPEAT, - PROJ_TOFFSET, - PROJ_TNUM, - PROJ_DROP, - PROJ_CSTAT, - PROJ_CLIPDIST, - PROJ_SHADE, - PROJ_XREPEAT, - PROJ_YREPEAT, - PROJ_PAL, - PROJ_EXTRA_RAND, - PROJ_HITRADIUS, - PROJ_VEL_MULT, - PROJ_OFFSET, - PROJ_BOUNCES, - PROJ_BSOUND, - PROJ_RANGE -}; -*/ - -// Variable definition Flags - -#define GAMEVAR_FLAG_GLOBAL 0 // global variable (default) -#define GAMEVAR_FLAG_PERPLAYER 1 // per-player variable -#define GAMEVAR_FLAG_PERACTOR 2 // per-actor variable - -// Weapon Flags -// 1 Holstering Clears Clip -// 2 Glows -// 4 Automatic -// 8 Fire Every other frame -// 16 Fire Every third frame -// 32 Random restart on automatic -// 64 Use Ammo per burst -// 128 Is a Bomb trigger -// 256 Using does NOT cause player to become 'visible' -// 512 Use 'throws' the 'shoots' item -// 1024 Check weapon availability at 'reload' time -// 2048 player should stop jumping -// 0 Spawn Type 1 (pistol shells) -// 4096 Spawn Type 2 (Shotgun shells) -// 8192 Spawn Type 3 (CHAINGUN shells) -// 16384 Semi-automatic -// 32768 Pistol reload sound hack -// 65536 Cycle kickback_pic back to 1 if fire is held down, else set to 0 - -// TRIPBOMB_CONTROL -// 1 Tripwire. Trip Bomb works with tripwire. -// 2 On timer. Trip Bomb works on timer - -// PIPEBOMB_CONTROL -// 1 Detonator. Pipe Bomb works with detonator. -// 2 On timer. Pipe Bomb works on timer - -gamevar WEAPON0_WORKSLIKE 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_RELOAD 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_FIREDELAY 7 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_TOTALTIME 14 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_FLAGS 292 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_SHOOTS 2521 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON0_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON1_WORKSLIKE 1 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_CLIP 12 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_RELOAD 27 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_FLAGS 32768 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_SHOOTS 2595 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_SPAWNTIME 2 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_SPAWN 2533 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_FIRESOUND 3 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON1_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON2_WORKSLIKE 2 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_RELOAD 13 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_TOTALTIME 30 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_FLAGS 1024 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_SHOOTS 2613 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_SPAWNTIME 24 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_SPAWN 2535 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_SHOTSPERBURST 7 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_FIRESOUND 109 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_SOUND2TIME 15 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_SOUND2SOUND 169 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON2_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON3_WORKSLIKE 3 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_RELOAD 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_TOTALTIME 12 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_HOLDDELAY 3 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_FLAGS 73812 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_SHOOTS 2536 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_SPAWNTIME 1 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_SPAWN 2533 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_FIRESOUND 6 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON3_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON4_WORKSLIKE 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_RELOAD 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_TOTALTIME 20 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_FLAGS 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_SHOOTS 2605 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON4_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON5_WORKSLIKE 5 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_RELOAD 30 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_FIREDELAY 6 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_TOTALTIME 19 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_HOLDDELAY 12 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_FLAGS 512 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_SHOOTS 26 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON5_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON6_WORKSLIKE 6 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_RELOAD 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_FIREDELAY 10 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_TOTALTIME 12 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_FLAGS 2 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_SHOOTS 2556 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_INITIALSOUND 11 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON6_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON7_WORKSLIKE 7 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_RELOAD 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_TOTALTIME 6 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_HOLDDELAY 5 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_FLAGS 72 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_SHOOTS 2605 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_SHOTSPERBURST 2 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON7_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON8_WORKSLIKE 8 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_RELOAD 16 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_TOTALTIME 16 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_HOLDDELAY 7 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_FLAGS 3072 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_SHOOTS 2563 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON8_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON9_WORKSLIKE 9 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_RELOAD 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_FIREDELAY 3 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_FLAGS 65536 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_SHOOTS 1641 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_INITIALSOUND 10 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_FIRESOUND 10 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON9_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON10_WORKSLIKE 10 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_RELOAD 10 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_FIREDELAY 2 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_TOTALTIME 10 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_FLAGS 384 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_SHOOTS 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_FIRESOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON10_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar WEAPON11_WORKSLIKE 11 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_CLIP 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_RELOAD 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_FIREDELAY 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_TOTALTIME 5 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_HOLDDELAY 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_FLAGS 2 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_SHOOTS 2448 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_SPAWNTIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_SPAWN 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_SHOTSPERBURST 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_INITIALSOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_FIRESOUND 388 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_SOUND2TIME 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_SOUND2SOUND 0 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_RELOADSOUND1 4 GAMEVAR_FLAG_PERPLAYER -gamevar WEAPON11_RELOADSOUND2 5 GAMEVAR_FLAG_PERPLAYER - -gamevar GRENADE_LIFETIME 120 GAMEVAR_FLAG_PERPLAYER -gamevar GRENADE_LIFETIME_VAR 30 GAMEVAR_FLAG_PERPLAYER - -gamevar STICKYBOMB_LIFETIME 120 GAMEVAR_FLAG_PERPLAYER -gamevar STICKYBOMB_LIFETIME_VAR 30 GAMEVAR_FLAG_PERPLAYER - -gamevar TRIPBOMB_CONTROL 1 GAMEVAR_FLAG_PERPLAYER // set value to 2 for timed bomb -gamevar PIPEBOMB_CONTROL 1 GAMEVAR_FLAG_PERPLAYER // set value to 2 for grenade behavior diff --git a/polymer-perf/eduke32/samples/m32script_ex.map b/polymer-perf/eduke32/samples/m32script_ex.map deleted file mode 100644 index 87e571ee1..000000000 Binary files a/polymer-perf/eduke32/samples/m32script_ex.map and /dev/null differ diff --git a/polymer-perf/eduke32/samples/ror.map b/polymer-perf/eduke32/samples/ror.map deleted file mode 100644 index 684ec6ae9..000000000 Binary files a/polymer-perf/eduke32/samples/ror.map and /dev/null differ diff --git a/polymer-perf/eduke32/samples/spriteclip.txt b/polymer-perf/eduke32/samples/spriteclip.txt deleted file mode 100644 index 253caeaf1..000000000 --- a/polymer-perf/eduke32/samples/spriteclip.txt +++ /dev/null @@ -1,66 +0,0 @@ - - Sector-like clipping for sprites - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Sprite picnums can be assigned to a bunch of connected sectors so that -clipping against these sprites will work as if it is carried out on the -associated sectors. For this, files named _clipshapeX.map (where X is -in 0..9) should be present at program start time. Every such map must be -built to certain rules, and loading many of them has the same effect as -loading a single map with all sectors/walls/sprites thrown together. - -* Every sector that contains at least one white wall is considered an "outer" sector. - Conversely, sectors with only red walls are "inner" (clipping) sectors. - -* Sprites in outer sectors are ignored. - -* To associate a picnum with a bunch of sectors, place a sprite with that picnum in - some inner sector of the lot. At the end stage of editing, align the sprite so that - the model matches the sectors well. See samples/_clipshape_.map for examples. - -* A picnum may be associated with many "layers" (called "indices" in the code) of - sectorwork. This serves two purposes: one is to enable more complex shapes than - would be possible using only one sector. The other reason is that a sprite may differ - in orientation in such a way that it is not possible to calculate one from another. - In particular, floor-aligned sprites and face/wall sprites should have their own - sector versions (of course only if they are intended to be used in a particular - orientation). - -* The sprites in inner sectors should point northward and should not have any orientation- - changing bits like x-flip or y-flip set. Setting centering and a custom size is permitted, - though. - -* A set of picnums can be aliased to a layer. This is useful if "secondary" picnums - are going to be used as decoration, for example. For this, set lotags and/or hitags - of any wall of an inner sector to the picnums to be aliased to layer containing the wall. - If only one of them is set, it is taken as a picnum, otherwise as a both-sided inclusive - range, the order doesn't matter. The pigcop tank is present as an example in - samples/_clipshape_.map. If a picnum has multiple layers, it is advisable to set the same - lotags/hitags for each layer. Note that you do not need to set tags unless you intend to - have more than one picnum to share a clipping shape. - -* The inner sectors of a given layer must be all interconnected (not necessarily directly) - and for a layer there must be a unique outer sector. - -* Making the floor or ceiling of a sector parallaxed will disable clipping on it in certain - ways. Normally, there are four horizontal clipping planes per inner sector (see the round - table for an example). Making the ceiling parallaxed disables the upper two, and analogously - for the floor. - -* Making a sprite transparent will disable rotation around its origin to match a given sprite's - angle. Use it on models with rotational symmetry. - - -Notes: ------- - -* The clipping will not change with rendering modes or options. - - -Predicted bugs: ---------------- - -* Clipping may not work across playing map sector boundaries, especially with large sprites. - - - --Helixhorned diff --git a/polymer-perf/eduke32/samples/tests.m32 b/polymer-perf/eduke32/samples/tests.m32 deleted file mode 100644 index d804746d8..000000000 --- a/polymer-perf/eduke32/samples/tests.m32 +++ /dev/null @@ -1,177 +0,0 @@ - -// load a.m32 first - -defstate testkeyavail - for i range 27 - { - ifholdkey alphakeys[i] - { - qsprintf TQUOTE "ALPHA KEY: %d (SCANCODE: %d)" i alphakeys[i] - quote TQUOTE - } - } - - for i range 10 - { - ifholdkey numberkeys[i] - { - qsprintf TQUOTE "NUMBER KEY: %d (SCANCODE: %d)" i numberkeys[i] - quote TQUOTE - } - } -ends - - -// various tests of m32-script features - -defstate arraytest - getarraysize ar tmp - resizearray ar 65536 - getticks parm[2] - for j range 65536 - set ar[j] j - set i 0 - for j range 65536 - add i ar[j] - getticks parm[3] - resizearray ar tmp - ife i 2147450880 quote "OK" else quote "DAMN" - sub parm[3] parm[2] - qsprintf TQUOTE "time: %d ms" parm[3] - quote TQUOTE -ends - -defstate itertest - var gi gj gk - // iteration and break test - - for i range 10 - { - addlogvar i - ife i 5 break - } - ife i 5 quote "OK" else quote "DAMN" - - quote "FLOAT ACCESS TEST" - set tmp pr_parallaxscale - - set gi tmp set gj tmp set gk tmp - al gi al gj al gk - ftoi gi 20 ftoi gj 200 ftoi gk 2000 - al gi al gj al gk - mul gk 2 - itof gk 2000 -ends - -define TEST_ZERO 0 -define TEST_PLUS_ONE 1 -define TEST_MINUS_ONE -1 - -define MOST_POSITIVE_DIRECT 32767 -define MOST_NEGATIVE_DIRECT -32768 -define LEAST_POSITIVE_INDIRECT 32768 -define LEAST_NEGATIVE_INDIRECT -32769 - -define HEX_MOST_POSITIVE_DIRECT 0x7fff -define HEX_MOST_NEGATIVE_DIRECT 0xffff8000 -define HEX_LEAST_POSITIVE_INDIRECT 0x8000 -define HEX_LEAST_NEGATIVE_INDIRECT 0xffff7fff - -define MAX_CONSTANT 2147483647 -define MIN_CONSTANT -2147483648 - -// tests various combinations of constants and labels -defstate consttest - quote " --- Constants test ---", quote " " - - quote "Should be 0:" - set i 0, set j TEST_ZERO - qsprintf TQUOTE "%d %d %d %d" 0 TEST_ZERO i j - quote TQUOTE, quote " " - - quote "Should be 1:" - set i 1, set j TEST_PLUS_ONE - qsprintf TQUOTE "%d %d %d %d" 1 TEST_PLUS_ONE i j - quote TQUOTE, quote " " - - quote "Should be -1:" - set i -1, set j TEST_MINUS_ONE - qsprintf TQUOTE "%d %d %d %d" -1 TEST_MINUS_ONE i j - quote TQUOTE, quote " " - - - quote "Should be 32767:" - set i 32767, set j MOST_POSITIVE_DIRECT - qsprintf TQUOTE "%d %d %d %d" 32767 MOST_POSITIVE_DIRECT i j - quote TQUOTE, quote " " - - quote "Should be -32768:" - set i -32768, set j MOST_NEGATIVE_DIRECT - qsprintf TQUOTE "%d %d %d %d" -32768 MOST_NEGATIVE_DIRECT i j - quote TQUOTE, quote " " - - quote "Should be 32768:" - set i 32768, set j LEAST_POSITIVE_INDIRECT - qsprintf TQUOTE "%d %d %d %d" 32768 LEAST_POSITIVE_INDIRECT i j - quote TQUOTE, quote " " - - quote "Should be -32769:" - set i -32769, set j LEAST_NEGATIVE_INDIRECT - qsprintf TQUOTE "%d %d %d %d" -32769 LEAST_NEGATIVE_INDIRECT i j - quote TQUOTE, quote " " - - quote "Hex tests:" - quote "Should be 32767:" - set i 0x7fff, set j HEX_MOST_POSITIVE_DIRECT - qsprintf TQUOTE "%d %d %d %d" 0x7fff HEX_MOST_POSITIVE_DIRECT i j - quote TQUOTE, quote " " - - quote "Should be -32768:" - set i 0xffff8000, set j HEX_MOST_NEGATIVE_DIRECT - qsprintf TQUOTE "%d %d %d %d" 0xffff8000 HEX_MOST_NEGATIVE_DIRECT i j - quote TQUOTE, quote " " - - quote "Should be 32768:" - set i 0x8000, set j HEX_LEAST_POSITIVE_INDIRECT - qsprintf TQUOTE "%d %d %d %d" 0x8000 HEX_LEAST_POSITIVE_INDIRECT i j - quote TQUOTE, quote " " - - quote "Should be -32769:" - set i 0xffff7fff, set j HEX_LEAST_NEGATIVE_INDIRECT - qsprintf TQUOTE "%d %d %d %d" 0xffff7fff HEX_LEAST_NEGATIVE_INDIRECT i j - quote TQUOTE, quote " " - - quote "min/max tests:" - quote "Should be 2147483647:" - set i 2147483647, set j MAX_CONSTANT - qsprintf TQUOTE "%d %d %d %d" 2147483647 MAX_CONSTANT i j - quote TQUOTE, quote " " - - quote "Should be -2147483648:" - set i -2147483648, set j MIN_CONSTANT - qsprintf TQUOTE "%d %d %d %d" -2147483648 MIN_CONSTANT i j - quote TQUOTE, quote " " -ends - -defstate anmtest - var yo - - for i range MAXTILES - { - set j tilesizx[i], or j tilesizy[i] - - ifn j 0 - { - set yo picanm[i] - shiftl yo 8, shiftr yo 24 // sign-extend - - ifl yo 0, inv yo - - ifge yo tilesizy[i] - { - qsprintf TQUOTE "Tile %d's y offset >= y size" i - quote TQUOTE - } - } - } -ends diff --git a/polymer-perf/eduke32/samples/tiles.cfg b/polymer-perf/eduke32/samples/tiles.cfg deleted file mode 100644 index a69fbeda7..000000000 --- a/polymer-perf/eduke32/samples/tiles.cfg +++ /dev/null @@ -1,215 +0,0 @@ -// Mapster32 tile grouping configuration file -// Press T on the tile selection screen to access the tileset selection menu - -#include "names.h" - -tilegroup "Actors" -{ - hotkey "A" - - colors 31 31 - - tiles - { - LIZTROOP LIZTROOPRUNNING LIZTROOPSTAYPUT LIZTROOPSHOOT LIZTROOPJETPACK - LIZTROOPONTOILET LIZTROOPJUSTSIT LIZTROOPDUCKING - PIGCOP PIGCOPSTAYPUT PIGCOPDIVE - LIZMAN LIZMANSTAYPUT LIZMANSPITTING LIZMANFEEDING LIZMANJUMP - COMMANDER COMMANDERSTAYPUT - OCTABRAIN OCTABRAINSTAYPUT - ORGANTIC - DRONE - NEWBEAST NEWBEASTSTAYPUT NEWBEASTHANG NEWBEASTJUMP - EGG GREENSLIME ROTATEGUN RECON TANK BOUNCEMINE - FLOORFLAME - // FEMS - FEM1 FEM2 FEM3 FEM4 FEM5 FEM6 FEM7 FEM8 FEM9 FEM10 NAKED1 - // Lil' critters - SHARK - // BIG critters - BOSS1 BOSS1STAYPUT BOSS1SHOOT BOSS1LOB - BOSS2 - BOSS3 - BOSS4 BOSS4STAYPUT - } -} - -tilegroup "Doors" -{ - hotkey "D" - - tiles - { - DOORTILE1 DOORTILE2 DOORTILE3 DOORTILE4 DOORTILE5 - DOORTILE6 DOORTILE7 DOORTILE8 DOORTILE9 DOORTILE10 - 312 313 314 345 - DOORTILE22 DOORTILE18 DOORTILE19 DOORTILE20 - 450 455 457 458 459 469 470 477 - DOORTILE14 - 719 735 771 - DOORTILE16 - 843 858 883 - DOORTILE15 DOORTILE21 - 1173 - DOORTILE11 DOORTILE12 - 353 355 - // Related items - DOORSHOCK ACCESSCARD - } -} - -tilegroup "Effectors" -{ - hotkey "E" - - colors 15 15 - - tilerange 1 10 -} - -tilegroup "Items" -{ - hotkey "I" - - colors 24 24 - - tiles - { - // Ammo - AMMO SHOTGUNAMMO BATTERYAMMO RPGAMMO HEAVYHBOMB FREEZEAMMO GROWAMMO CRYSTALAMMO - DEVISTATORAMMO HBOMBAMMO - - // Items (healthetc) - COLA SIXPAK FIRSTAID SHIELD STEROIDS AIRTANK JETPACK HEATSENSOR ACCESSCARD - BOOTS ATOMICHEALTH HOLODUKE - - // Weapons - FIRSTGUNSPRITE CHAINGUNSPRITE RPGSPRITE FREEZESPRITE SHRINKERSPRITE - TRIPBOMBSPRITE SHOTGUNSPRITE DEVISTATORSPRITE - } -} - -tilegroup "Letters and numbers" -{ - hotkey "L" - - tilerange 2822 2915 - tilerange 2929 3022 - tilerange 3072 3135 - tilerange 3162 3165 - tilerange 640 649 - tilerange 2472 2481 -} - -tilegroup "Player" -{ - hotkey "P" - - // Colors are the colors for Blocking OFF and Blocking ON. - colors 2 2 - - tile APLAYER -} - -tilegroup "Respawn triggers" -{ - hotkey "R" - - tiles - { - CANWITHSOMETHING CANWITHSOMETHING2 CANWITHSOMETHING3 CANWITHSOMETHING4 - // FEMS - FEM1 FEM2 FEM3 FEM4 FEM5 FEM6 FEM7 FEM8 FEM9 FEM10 NAKED1 - } -} - -tilegroup "Switches" -{ - hotkey "S" - - tiles - { - ACCESSSWITCH ACCESSSWITCH2 ACCESSCARD SLOTDOOR LIGHTSWITCH SPACEDOORSWITCH SPACELIGHTSWITCH - FRANKENSTINESWITCH MULTISWITCH - DIPSWITCH DIPSWITCH2 DIPSWITCH3 TECHSWITCH - LIGHTSWITCH2 713 // LIGHTSWITCH2+1 - POWERSWITCH1 LOCKSWITCH1 POWERSWITCH2 HANDSWITCH PULLSWITCH - ALIENSWITCH HANDPRINTSWITCH NUKEBUTTON - TARGET - 4083 4954 // Busted switches (Atomic) - } -} - -tilegroup "Exploding stuff" -{ - hotkey "X" - - tiles - { - CRACK1 CRACK2 CRACK3 CRACK4 - FIREEXT SEENINE OOZFILTER - EXPLODINGBARREL EXPLODINGBARREL2 FIREBARREL GUNPOWDERBARREL - REACTOR2SPARK BOLT1 SIDEBOLT1 - CEILINGSTEAM - FIREVASE 2066 BURNING FIRE BURNING2 FIRE2 - } -} - -// Alphabet configuration for text entry tool in 3D mode -// (press Ctrl-T on a wall-aligned letter) -// 32 alphabets max. - -alphabet // blue font -{ - maprange 33 126 STARTALPHANUM - - offseta "^" 0 2 - offseta "qQ;" 0 -1 -} - -alphabet -{ - maprange 33 126 MINIFONT - maprangea "a" "z" 3104 - -// offset "\\" 0 3 doesn't work - offset 92 0 3 - offseta "qQ" 0 -1 - offseta ":" 0 1 - offseta "'\"" 0 3 -} - -alphabet // red font -{ - maprangea "0" "9" 2930 - maprangea "A" "Z" BIGALPHANUM - maprangea "a" "z" BIGALPHANUM - mapa "-" 2929 - mapa ".,!?;:/%" 3002 - mapa "'" 3022 -} - -alphabet // silver font -{ - maprangea "0" "9" 2992 - maprangea "A" "Z" 2966 - maprangea "a" "z" 2966 -} - -alphabet // yellow numbers 3x5 -{ - maprangea "0" "9" THREEBYFIVE - mapa ":/" 3020 - offseta ":" 0 1 -} - -alphabet // silver numbers -{ - maprangea "1" "9" W_NUMBERS - mapa "0" 649 -} - -alphabet -{ - maprangea "0" "9" DIGITALNUM -} diff --git a/polymer-perf/eduke32/source/GNU.TXT b/polymer-perf/eduke32/source/GNU.TXT deleted file mode 100644 index 2f3289afb..000000000 --- a/polymer-perf/eduke32/source/GNU.TXT +++ /dev/null @@ -1,87 +0,0 @@ -GNU GENERAL PUBLIC LICENSE -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -Preamble -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - -a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. - -b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. - -c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - -a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - -b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - -c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) -The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. -If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - -END OF TERMS AND CONDITIONS diff --git a/polymer-perf/eduke32/source/_functio.h b/polymer-perf/eduke32/source/_functio.h deleted file mode 100644 index 097fe3de9..000000000 --- a/polymer-perf/eduke32/source/_functio.h +++ /dev/null @@ -1,384 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -// _functio.h - -// file created by makehead.exe -// these headers contain default key assignments, as well as -// default button assignments and game function names -// axis defaults are also included - - -#ifndef _function_private_ -#define _function_private_ -#ifdef __cplusplus -extern "C" { -#endif -char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] = - { - "Move_Forward", - "Move_Backward", - "Turn_Left", - "Turn_Right", - "Strafe", - "Fire", - "Open", - "Run", - "AutoRun", - "Jump", - "Crouch", - "Look_Up", - "Look_Down", - "Look_Left", - "Look_Right", - "Strafe_Left", - "Strafe_Right", - "Aim_Up", - "Aim_Down", - "Weapon_1", - "Weapon_2", - "Weapon_3", - "Weapon_4", - "Weapon_5", - "Weapon_6", - "Weapon_7", - "Weapon_8", - "Weapon_9", - "Weapon_10", - "Inventory", - "Inventory_Left", - "Inventory_Right", - "Holo_Duke", - "Jetpack", - "NightVision", - "MedKit", - "TurnAround", - "SendMessage", - "Map", - "Shrink_Screen", - "Enlarge_Screen", - "Center_View", - "Holster_Weapon", - "Show_Opponents_Weapon", - "Map_Follow_Mode", - "See_Coop_View", - "Mouse_Aiming", - "Toggle_Crosshair", - "Steroids", - "Quick_Kick", - "Next_Weapon", - "Previous_Weapon", - "Show_Console", - "Show_DukeMatch_Scores", - "Dpad_Select", - "Dpad_Aiming" - }; - -#ifdef __SETUP__ - -#define NUMKEYENTRIES 56 - -char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] = - { - "Move_Forward", "W", "Kpad8", - "Move_Backward", "S", "Kpad2", - "Turn_Left", "Left", "Kpad4", - "Turn_Right", "Right", "KPad6", - "Strafe", "LAlt", "RAlt", - "Fire", "", "RCtrl", - "Open", "E", "", - "Run", "LShift", "RShift", - "AutoRun", "CapLck", "", - "Jump", "Space", "/", - "Crouch", "LCtrl", "", - "Look_Up", "PgUp", "Kpad9", - "Look_Down", "PgDn", "Kpad3", - "Look_Left", "Insert", "Kpad0", - "Look_Right", "Delete", "Kpad.", - "Strafe_Left", "A", "", - "Strafe_Right", "D", "", - "Aim_Up", "Home", "KPad7", - "Aim_Down", "End", "Kpad1", - "Weapon_1", "1", "", - "Weapon_2", "2", "", - "Weapon_3", "3", "", - "Weapon_4", "4", "", - "Weapon_5", "5", "", - "Weapon_6", "6", "", - "Weapon_7", "7", "", - "Weapon_8", "8", "", - "Weapon_9", "9", "", - "Weapon_10", "0", "", - "Inventory", "Enter", "KpdEnt", - "Inventory_Left", "[", "", - "Inventory_Right", "]", "", - "Holo_Duke", "H", "", - "Jetpack", "J", "", - "NightVision", "N", "", - "MedKit", "M", "", - "TurnAround", "BakSpc", "", - "SendMessage", "T", "", - "Map", "Tab", "", - "Shrink_Screen", "-", "Kpad-", - "Enlarge_Screen", "=", "Kpad+", - "Center_View", "KPad5", "", - "Holster_Weapon", "ScrLck", "", - "Show_Opponents_Weapon", "Y", "", - "Map_Follow_Mode", "F", "", - "See_Coop_View", "K", "", - "Mouse_Aiming", "U", "", - "Toggle_Crosshair", "I", "", - "Steroids", "R", "", - "Quick_Kick", "Q", "", - "Next_Weapon", "'", "", - "Previous_Weapon", ";", "", - "Show_Console", "`", "", - "Show_DukeMatch_Scores", "", "", - "Dpad_Select", "", "", - "Dpad_Aiming", "", "", - }; - -const char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] = - { - "Move_Forward", "Up", "Kpad8", - "Move_Backward", "Down", "Kpad2", - "Turn_Left", "Left", "Kpad4", - "Turn_Right", "Right", "KPad6", - "Strafe", "LAlt", "RAlt", - "Fire", "LCtrl", "RCtrl", - "Open", "Space", "", - "Run", "LShift", "RShift", - "AutoRun", "CapLck", "", - "Jump", "A", "/", - "Crouch", "Z", "", - "Look_Up", "PgUp", "Kpad9", - "Look_Down", "PgDn", "Kpad3", - "Look_Left", "Insert", "Kpad0", - "Look_Right", "Delete", "Kpad.", - "Strafe_Left", ",", "", - "Strafe_Right", ".", "", - "Aim_Up", "Home", "KPad7", - "Aim_Down", "End", "Kpad1", - "Weapon_1", "1", "", - "Weapon_2", "2", "", - "Weapon_3", "3", "", - "Weapon_4", "4", "", - "Weapon_5", "5", "", - "Weapon_6", "6", "", - "Weapon_7", "7", "", - "Weapon_8", "8", "", - "Weapon_9", "9", "", - "Weapon_10", "0", "", - "Inventory", "Enter", "KpdEnt", - "Inventory_Left", "[", "", - "Inventory_Right", "]", "", - "Holo_Duke", "H", "", - "Jetpack", "J", "", - "NightVision", "N", "", - "MedKit", "M", "", - "TurnAround", "BakSpc", "", - "SendMessage", "T", "", - "Map", "Tab", "", - "Shrink_Screen", "-", "Kpad-", - "Enlarge_Screen", "=", "Kpad+", - "Center_View", "KPad5", "", - "Holster_Weapon", "ScrLck", "", - "Show_Opponents_Weapon", "W", "", - "Map_Follow_Mode", "F", "", - "See_Coop_View", "K", "", - "Mouse_Aiming", "U", "", - "Toggle_Crosshair", "I", "", - "Steroids", "R", "", - "Quick_Kick", "`", "", - "Next_Weapon", "'", "", - "Previous_Weapon", ";", "", - "Show_Console", "`", "", - "Show_DukeMatch_Scores", "", "", - "Dpad_Select", "", "", - "Dpad_Aiming", "", "", - }; - -static char * mousedefaults[] = - { - "Fire", - "MedKit", - "Jetpack", - "", - "Previous_Weapon", - "Next_Weapon", - "", - "", - "", - "" - }; - - -static char * mouseclickeddefaults[] = - { - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - }; - - -static char * joystickdefaults[] = - { - "Fire", - "Strafe", - "Run", - "Open", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "Aim_Down", - "Look_Right", - "Aim_Up", - "Look_Left", - }; - - -static char * joystickclickeddefaults[] = - { - "", - "Inventory", - "Jump", - "Crouch", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - }; - - -static char * mouseanalogdefaults[] = - { - "analog_turning", - "analog_moving", - }; - - -static char * mousedigitaldefaults[] = - { - "", - "", - "", - "", - }; - - -static char * joystickanalogdefaults[] = - { - "analog_turning", - "analog_moving", - "analog_strafing", - "", - "", - "", - "", - "", - }; - - -static char * joystickdigitaldefaults[] = - { - "", - "", - "", - "", - "", - "", - "Run", - "", - "", - "", - "", - "", - "", - "", - "", - "", - }; -#endif -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/_midi.h b/polymer-perf/eduke32/source/_midi.h deleted file mode 100644 index f2c41ab04..000000000 --- a/polymer-perf/eduke32/source/_midi.h +++ /dev/null @@ -1,282 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) - -*/ -/********************************************************************** - module: _MIDI.H - - author: James R. Dose - date: May 25, 1994 - - Private header for MIDI.C. Midi song file playback routines. - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#ifndef ___MIDI_H -#define ___MIDI_H -#include "compat.h" - -#define RELATIVE_BEAT( measure, beat, tick ) \ - ( ( tick ) + ( ( beat ) << 9 ) + ( ( measure ) << 16 ) ) - -//Bobby Prince thinks this may be 100 -//#define GENMIDI_DefaultVolume 100 -#define GENMIDI_DefaultVolume 90 - -#define MAX_FORMAT 1 - -#define NUM_MIDI_CHANNELS 16 - -#define TIME_PRECISION 16 - -#define MIDI_HEADER_SIGNATURE 0x6468544d // "MThd" -#define MIDI_TRACK_SIGNATURE 0x6b72544d // "MTrk" - -#define MIDI_VOLUME 7 -#define MIDI_PAN 10 -#define MIDI_DETUNE 94 -#define MIDI_RHYTHM_CHANNEL 9 -#define MIDI_RPN_MSB 100 -#define MIDI_RPN_LSB 101 -#define MIDI_DATAENTRY_MSB 6 -#define MIDI_DATAENTRY_LSB 38 -#define MIDI_PITCHBEND_MSB 0 -#define MIDI_PITCHBEND_LSB 0 -#define MIDI_RUNNING_STATUS 0x80 -#define MIDI_NOTE_OFF 0x8 -#define MIDI_NOTE_ON 0x9 -#define MIDI_POLY_AFTER_TCH 0xA -#define MIDI_CONTROL_CHANGE 0xB -#define MIDI_PROGRAM_CHANGE 0xC -#define MIDI_AFTER_TOUCH 0xD -#define MIDI_PITCH_BEND 0xE -#define MIDI_SPECIAL 0xF -#define MIDI_SYSEX 0xF0 -#define MIDI_SYSEX_CONTINUE 0xF7 -#define MIDI_META_EVENT 0xFF -#define MIDI_END_OF_TRACK 0x2F -#define MIDI_TEMPO_CHANGE 0x51 -#define MIDI_TIME_SIGNATURE 0x58 -#define MIDI_RESET_ALL_CONTROLLERS 0x79 -#define MIDI_ALL_NOTES_OFF 0x7b -#define MIDI_MONO_MODE_ON 0x7E -#define MIDI_SYSTEM_RESET 0xFF - -#define GET_NEXT_EVENT( track, data ) \ - ( data ) = *( track )->pos; \ - ( track )->pos += 1 - -#define GET_MIDI_CHANNEL( event ) ( ( event ) & 0xf ) -#define GET_MIDI_COMMAND( event ) ( ( event ) >> 4 ) - -#define EMIDI_INFINITE -1 -#define EMIDI_END_LOOP_VALUE 127 -#define EMIDI_ALL_CARDS 127 -#define EMIDI_INCLUDE_TRACK 110 -#define EMIDI_EXCLUDE_TRACK 111 -#define EMIDI_PROGRAM_CHANGE 112 -#define EMIDI_VOLUME_CHANGE 113 -#define EMIDI_CONTEXT_START 114 -#define EMIDI_CONTEXT_END 115 -#define EMIDI_LOOP_START 116 -#define EMIDI_LOOP_END 117 -#define EMIDI_SONG_LOOP_START 118 -#define EMIDI_SONG_LOOP_END 119 - -#define EMIDI_GeneralMIDI 0 - -#define EMIDI_AffectsCurrentCard( c, type ) \ - ( ( ( c ) == EMIDI_ALL_CARDS ) || ( ( c ) == ( type ) ) ) - - -#define EMIDI_NUM_CONTEXTS 7 -typedef struct - { - char *pos; - char *loopstart; - int16_t loopcount; - int16_t RunningStatus; - unsigned time; - int32_t FPSecondsPerTick; - int16_t tick; - int16_t beat; - int16_t measure; - int16_t BeatsPerMeasure; - int16_t TicksPerBeat; - int16_t TimeBase; - int32_t delay; - int16_t active; - } songcontext; - -typedef struct - { - char *start; - char *pos; - - int32_t delay; - int16_t active; - int16_t RunningStatus; - - int16_t currentcontext; - songcontext context[ EMIDI_NUM_CONTEXTS ]; - - char EMIDI_IncludeTrack; - char EMIDI_ProgramChange; - char EMIDI_VolumeChange; - } track; - -static int32_t _MIDI_ReadNumber( void *from, size_t size ); -static int32_t _MIDI_ReadDelta( track *ptr ); -static void _MIDI_ResetTracks( void ); -static void _MIDI_AdvanceTick( void ); -static void _MIDI_MetaEvent( track *Track ); -static void _MIDI_SysEx( track *Track ); -static int32_t _MIDI_InterpretControllerInfo( track *Track, int32_t TimeSet, - int32_t channel, int32_t c1, int32_t c2 ); -static int32_t _MIDI_SendControlChange( int32_t channel, int32_t c1, int32_t c2 ); -static void _MIDI_SetChannelVolume( int32_t channel, int32_t volume ); -static void _MIDI_SendChannelVolumes( void ); -static int32_t _MIDI_ProcessNextTick( void ); -static void _MIDI_InitEMIDI( void ); - -/* - if ( c1 == EMIDI_LOOP_START ) - { - if ( c2 == 0 ) - { - Track->context[ 0 ].loopcount = EMIDI_INFINITE; - } - else - { - Track->context[ 0 ].loopcount = c2; - } - - Track->context[ 0 ].pos = Track->pos; - Track->context[ 0 ].loopstart = Track->pos; - Track->context[ 0 ].RunningStatus = Track->RunningStatus; - Track->context[ 0 ].time = _MIDI_Time; - Track->context[ 0 ].FPSecondsPerTick = _MIDI_FPSecondsPerTick; - Track->context[ 0 ].tick = _MIDI_Tick; - Track->context[ 0 ].beat = _MIDI_Beat; - Track->context[ 0 ].measure = _MIDI_Measure; - Track->context[ 0 ].BeatsPerMeasure = _MIDI_BeatsPerMeasure; - Track->context[ 0 ].TicksPerBeat = _MIDI_TicksPerBeat; - Track->context[ 0 ].TimeBase = _MIDI_TimeBase; - break; - } - - if ( ( c1 == EMIDI_LOOP_END ) && - ( c2 == EMIDI_END_LOOP_VALUE ) ) - { - if ( ( Track->context[ 0 ].loopstart != NULL ) && - ( Track->context[ 0 ].loopcount != 0 ) ) - { - if ( Track->context[ 0 ].loopcount != EMIDI_INFINITE ) - { - Track->context[ 0 ].loopcount--; - } - - Track->pos = Track->context[ 0 ].loopstart; - Track->RunningStatus = Track->context[ 0 ].RunningStatus; - - if ( !TimeSet ) - { - _MIDI_Time = Track->context[ 0 ].time; - _MIDI_FPSecondsPerTick = Track->context[ 0 ].FPSecondsPerTick; - _MIDI_Tick = Track->context[ 0 ].tick; - _MIDI_Beat = Track->context[ 0 ].beat; - _MIDI_Measure = Track->context[ 0 ].measure; - _MIDI_BeatsPerMeasure = Track->context[ 0 ].BeatsPerMeasure; - _MIDI_TicksPerBeat = Track->context[ 0 ].TicksPerBeat; - _MIDI_TimeBase = Track->context[ 0 ].TimeBase; - TimeSet = TRUE; - } - } - break; - } - - if ( c1 == MIDI_MONO_MODE_ON ) - { - Track->pos++; - } - - if ( ( c1 == MIDI_VOLUME ) && ( !Track->EMIDI_VolumeChange ) ) - { - _MIDI_SetChannelVolume( channel, c2 ); - break; - } - else if ( ( c1 == EMIDI_VOLUME_CHANGE ) && - ( Track->EMIDI_VolumeChange ) ) - { - _MIDI_SetChannelVolume( channel, c2 ); - break; - } - - if ( ( c1 == EMIDI_PROGRAM_CHANGE ) && - ( Track->EMIDI_ProgramChange ) ) - { - _MIDI_Funcs->ProgramChange( channel, MIDI_PatchMap[ c2 & 0x7f ] ); - break; - } - - if ( c1 == EMIDI_CONTEXT_START ) - { - break; - } - - if ( c1 == EMIDI_CONTEXT_END ) - { - if ( ( Track->currentcontext != _MIDI_Context ) || - ( Track->context[ _MIDI_Context ].pos == NULL ) - { - break; - } - - Track->currentcontext = _MIDI_Context; - Track->context[ 0 ].loopstart = Track->context[ _MIDI_Context ].loopstart; - Track->context[ 0 ].loopcount = Track->context[ _MIDI_Context ].loopcount; - Track->pos = Track->context[ _MIDI_Context ].pos; - Track->RunningStatus = Track->context[ _MIDI_Context ].RunningStatus; - - if ( TimeSet ) - { - break; - } - - _MIDI_Time = Track->context[ _MIDI_Context ].time; - _MIDI_FPSecondsPerTick = Track->context[ _MIDI_Context ].FPSecondsPerTick; - _MIDI_Tick = Track->context[ _MIDI_Context ].tick; - _MIDI_Beat = Track->context[ _MIDI_Context ].beat; - _MIDI_Measure = Track->context[ _MIDI_Context ].measure; - _MIDI_BeatsPerMeasure = Track->context[ _MIDI_Context ].BeatsPerMeasure; - _MIDI_TicksPerBeat = Track->context[ _MIDI_Context ].TicksPerBeat; - _MIDI_TimeBase = Track->context[ _MIDI_Context ].TimeBase; - TimeSet = TRUE; - break; - } - - if ( _MIDI_Funcs->ControlChange ) - { - _MIDI_Funcs->ControlChange( channel, c1, c2 ); - } - */ - -#endif diff --git a/polymer-perf/eduke32/source/_rts.h b/polymer-perf/eduke32/source/_rts.h deleted file mode 100644 index 5caa989ea..000000000 --- a/polymer-perf/eduke32/source/_rts.h +++ /dev/null @@ -1,50 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __rts_private__ -#define __rts_private__ - -//=============== -// TYPES -//=============== - -typedef struct - { - char name[8]; - int32_t handle,position,size; - } lumpinfo_t; - -typedef struct - { - char identification[4]; // should be IWAD - int32_t numlumps; - int32_t infotableofs; - } wadinfo_t; - -typedef struct - { - int32_t filepos; - int32_t size; - char name[8]; - } filelump_t; - -#endif diff --git a/polymer-perf/eduke32/source/actors.c b/polymer-perf/eduke32/source/actors.c deleted file mode 100644 index 3e40ec692..000000000 --- a/polymer-perf/eduke32/source/actors.c +++ /dev/null @@ -1,8218 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "duke3d.h" -#include "actors.h" -#include "gamedef.h" -#include "gameexec.h" - -#if KRANDDEBUG -# define ACTOR_INLINE -# define ACTOR_STATIC -#else -# define ACTOR_INLINE inline -# define ACTOR_STATIC static -#endif - -#define KILLIT(KX) { deletesprite(KX); goto BOLT; } - -extern int32_t g_numEnvSoundsPlaying; -extern int32_t g_noEnemies; -extern int32_t ticrandomseed; - -inline void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings -{ - int32_t i=g_numInterpolations-1; - for (; i>=0; i--) oldipos[i] = *curipos[i]; -} - -void G_SetInterpolation(int32_t *posptr) -{ - int32_t i=g_numInterpolations-1; - - if (g_numInterpolations >= MAXINTERPOLATIONS) return; - for (; i>=0; i--) - if (curipos[i] == posptr) return; - curipos[g_numInterpolations] = posptr; - oldipos[g_numInterpolations] = *posptr; - g_numInterpolations++; -} - -void G_StopInterpolation(int32_t *posptr) -{ - int32_t i=g_numInterpolations-1; - - for (; i>=startofdynamicinterpolations; i--) - if (curipos[i] == posptr) - { - g_numInterpolations--; - oldipos[i] = oldipos[g_numInterpolations]; - bakipos[i] = bakipos[g_numInterpolations]; - curipos[i] = curipos[g_numInterpolations]; - } -} - -void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of drawscreen -{ - int32_t i=g_numInterpolations-1, j = 0, odelta, ndelta = 0; - - if (g_interpolationLock++) - { - return; - } - - for (; i>=0; i--) - { - bakipos[i] = *curipos[i]; - odelta = ndelta; - ndelta = (*curipos[i])-oldipos[i]; - if (odelta != ndelta) j = mulscale16(ndelta,smoothratio); - *curipos[i] = oldipos[i]+j; - } -} - -inline void G_RestoreInterpolations(void) //Stick at end of drawscreen -{ - int32_t i=g_numInterpolations-1; - - if (--g_interpolationLock) - return; - - for (; i>=0; i--) *curipos[i] = bakipos[i]; -} - -inline int32_t G_CheckForSpaceCeiling(int32_t sectnum) -{ - return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && (sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1)?1:0); -} - -inline int32_t G_CheckForSpaceFloor(int32_t sectnum) -{ - return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0); -} - -void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4) -{ - spritetype *s=&sprite[i],*sj; - walltype *wal; - int32_t d, q, x1, y1; - int32_t sectcnt, sectend, dasect, startwall, endwall, nextsect; - int32_t j,k,p,x,nextj; - int16_t sect=-1; - char statlist[] = {STAT_DEFAULT,STAT_ACTOR,STAT_STANDABLE, - STAT_PLAYER,STAT_FALLER,STAT_ZOMBIEACTOR,STAT_MISC - }; - int16_t *tempshort = (int16_t *)tempbuf; - - if (s->picnum == RPG && s->xrepeat < 11) goto SKIPWALLCHECK; - - if (s->picnum != SHRINKSPARK) - { - tempshort[0] = s->sectnum; - dasect = s->sectnum; - sectcnt = 0; - sectend = 1; - - do - { - dasect = tempshort[sectcnt++]; - if (((sector[dasect].ceilingz-s->z)>>8) < r) - { - d = klabs(wall[sector[dasect].wallptr].x-s->x)+klabs(wall[sector[dasect].wallptr].y-s->y); - if (d < r) - Sect_DamageCeiling(dasect); - else - { - d = klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x-s->x)+klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].y-s->y); - if (d < r) - Sect_DamageCeiling(dasect); - } - } - - startwall = sector[dasect].wallptr; - endwall = startwall+sector[dasect].wallnum; - for (x=startwall,wal=&wall[startwall]; xx-s->x)+klabs(wal->y-s->y)) < r) - { - nextsect = wal->nextsector; - if (nextsect >= 0) - { - for (dasect=sectend-1; dasect>=0; dasect--) - if (tempshort[dasect] == nextsect) break; - if (dasect < 0) tempshort[sectend++] = nextsect; - } - x1 = (((wal->x+wall[wal->point2].x)>>1)+s->x)>>1; - y1 = (((wal->y+wall[wal->point2].y)>>1)+s->y)>>1; - updatesector(x1,y1,§); - if (sect >= 0 && cansee(x1,y1,s->z,sect,s->x,s->y,s->z,s->sectnum)) - { - vec3_t tmpvect; - - Bmemcpy(&tmpvect, wal, sizeof(int32_t) * 2); - tmpvect.z = s->z; - - A_DamageWall(i,x,&tmpvect,s->picnum); - } - } - } - while (sectcnt < sectend); - } - -SKIPWALLCHECK: - - q = -(16<<8)+(krand()&((32<<8)-1)); - - for (x = 0; x<7; x++) - { - j = headspritestat[(uint8_t)statlist[x]]; - while (j >= 0) - { - nextj = nextspritestat[j]; - sj = &sprite[j]; - - if (x == 0 || x >= 5 || AFLAMABLE(sj->picnum)) - { - if (s->picnum != SHRINKSPARK || (sj->cstat&257)) - if (dist(s, sj) < r) - { - if (A_CheckEnemySprite(sj) && !cansee(sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum)) - goto BOLT; - A_DamageObject(j, i); - } - } - else if (sj->extra >= 0 && sj != s && (sj->picnum == TRIPBOMB || A_CheckEnemySprite(sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD)) - { - if (s->picnum == SHRINKSPARK && sj->picnum != SHARK && (j == s->owner || sj->xrepeat < 24)) - { - j = nextj; - continue; - } - if (s->picnum == MORTER && j == s->owner) - { - j = nextj; - continue; - } - - if (sj->picnum == APLAYER) sj->z -= PHEIGHT; - d = dist(s, sj); - if (sj->picnum == APLAYER) sj->z += PHEIGHT; - - if (d < r && cansee(sj->x, sj->y, sj->z-(8<<8), sj->sectnum, s->x, s->y, s->z-(12<<8), s->sectnum)) - { - actor[j].ang = getangle(sj->x-s->x,sj->y-s->y); - - if (s->picnum == RPG && sj->extra > 0) - actor[j].picnum = RPG; - else if (A_CheckSpriteFlags(i,SPRITE_PROJECTILE) && SpriteProjectile[i].workslike & PROJECTILE_RADIUS_PICNUM && sj->extra > 0) - actor[j].picnum = s->picnum; - else - { - if (s->picnum == SHRINKSPARK) - actor[j].picnum = SHRINKSPARK; - else actor[j].picnum = RADIUSEXPLOSION; - } - - if (s->picnum != SHRINKSPARK) - { - k = (r/3); - if (d < k) - { - if (hp4 == hp3) hp4++; - actor[j].extra = hp3 + (krand()%(hp4-hp3)); - } - else if (d < (k*2)) - { - if (hp3 == hp2) hp3++; - actor[j].extra = hp2 + (krand()%(hp3-hp2)); - } - else if (d < r) - { - if (hp2 == hp1) hp2++; - actor[j].extra = hp1 + (krand()%(hp2-hp1)); - } - - if (sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && sprite[j].picnum != BOSS1 && sprite[j].picnum != BOSS2 && sprite[j].picnum != BOSS3 && sprite[j].picnum != BOSS4) - { - if (sj->xvel < 0) sj->xvel = 0; - sj->xvel += (s->extra<<2); - } - - if (sj->picnum == PODFEM1 || sj->picnum == FEM1 || - sj->picnum == FEM2 || sj->picnum == FEM3 || - sj->picnum == FEM4 || sj->picnum == FEM5 || - sj->picnum == FEM6 || sj->picnum == FEM7 || - sj->picnum == FEM8 || sj->picnum == FEM9 || - sj->picnum == FEM10 || sj->picnum == STATUE || - sj->picnum == STATUEFLASH || sj->picnum == SPACEMARINE || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL) - A_DamageObject(j, i); - } - else if (s->extra == 0) actor[j].extra = 0; - - if (sj->picnum != RADIUSEXPLOSION && - s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS) - { - if (sj->picnum == APLAYER) - { - p = sj->yvel; - if (g_player[p].ps->newowner >= 0) - { - g_player[p].ps->newowner = -1; - g_player[p].ps->pos.x = g_player[p].ps->opos.x; - g_player[p].ps->pos.y = g_player[p].ps->opos.y; - g_player[p].ps->pos.z = g_player[p].ps->opos.z; - g_player[p].ps->ang = g_player[p].ps->oang; - updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&g_player[p].ps->cursectnum); - P_UpdateScreenPal(g_player[p].ps); - - k = headspritestat[STAT_ACTOR]; - while (k >= 0) - { - if (sprite[k].picnum==CAMERA1) - sprite[k].yvel = 0; - k = nextspritestat[k]; - } - } - } - actor[j].owner = s->owner; - } - } - } -BOLT: - j = nextj; - } - } -} - -int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) -{ - spritetype *spr = &sprite[spritenum]; - int32_t retval, daz; - int16_t dasectnum, cd; - int32_t bg = A_CheckEnemySprite(spr); - int32_t oldx = spr->x, oldy = spr->y; - /*int32_t osectnum = spr->sectnum;*/ - - - if (spr->statnum == STAT_MISC || (bg && spr->xrepeat < 4)) - { - spr->x += (change->x*TICSPERFRAME)>>2; - spr->y += (change->y*TICSPERFRAME)>>2; - spr->z += (change->z*TICSPERFRAME)>>2; - if (bg) - setsprite(spritenum,(vec3_t *)spr); - return 0; - } - - dasectnum = spr->sectnum; - - daz = spr->z - ((tilesizy[spr->picnum]*spr->yrepeat)<<1); - - if (bg) - { - if (spr->xrepeat > 60) - { - int32_t oz = spr->z; - spr->z = daz; - retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); - daz = spr->z; - spr->z = oz; - } - else - { - int32_t oz = spr->z; - - if (spr->picnum == LIZMAN) - cd = 292L; - else if ((ActorType[spr->picnum]&3)) - cd = spr->clipdist<<2; - else - cd = 192L; - - spr->z = daz; - retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype); - daz = spr->z; - spr->z = oz; - } - - if (dasectnum < 0 || (dasectnum >= 0 && - ((actor[spritenum].actorstayput >= 0 && actor[spritenum].actorstayput != dasectnum) || - ((spr->picnum == BOSS2) && spr->pal == 0 && sector[dasectnum].lotag != 3) || - ((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == 1) /*|| - (sector[dasectnum].lotag == 1 && (spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))*/ - )) - ) - { - spr->x = oldx; - spr->y = oldy; - /* - if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && spr->picnum == LIZMAN) - spr->ang = (krand()&2047); - else if ((Actor[spritenum].t_data[0]&3) == 1 && spr->picnum != COMMANDER) - spr->ang = (krand()&2047); - */ - setsprite(spritenum,(vec3_t *)spr); - if (dasectnum < 0) dasectnum = 0; - return (16384+dasectnum); - } - if ((retval&49152) >= 32768 && (actor[spritenum].cgg==0)) spr->ang += 768; - } - else - { - int32_t oz = spr->z; - spr->z = daz; - - if (spr->statnum == STAT_PROJECTILE && (SpriteProjectile[spritenum].workslike & PROJECTILE_REALCLIPDIST) == 0) - retval = - clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype); - else - retval = - clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(spr->clipdist<<2),(4<<8),(4<<8),cliptype); - daz = spr->z; - spr->z = oz; - } - - if (dasectnum == -1) - { - dasectnum = spr->sectnum; -// OSD_Printf("%s:%d wtf\n",__FILE__,__LINE__); - } - - if ((dasectnum != spr->sectnum)) - { - changespritesect(spritenum,dasectnum); - A_GetZLimits(spritenum); - } - - daz = spr->z + ((change->z*TICSPERFRAME)>>3); - - bg = (tilesizy[spr->picnum]*spr->yrepeat)>>1; - if ((daz > actor[spritenum].ceilingz) && (daz <= actor[spritenum].floorz)/* - && - (osectnum == dasectnum || cansee(oldx, oldy, spr->z - bg, osectnum, spr->x, spr->y, daz - bg, dasectnum))*/ - ) - spr->z = daz; - else if (retval == 0) retval = 16384+dasectnum; - - if (retval == (16384+dasectnum)) - if (spr->statnum == STAT_PROJECTILE) - { - int32_t i, nexti; - - TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRANSPORT], i, nexti) - if (sprite[i].sectnum == dasectnum) - { - switch (sector[dasectnum].lotag) - { - case 1: - if (daz >= actor[spritenum].floorz) - { - if (totalclock > actor[spritenum].lasttransport) - { - actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); - - spr->x += (sprite[OW].x-SX); - spr->y += (sprite[OW].y-SY); - spr->z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz; - - Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t)); - changespritesect(spritenum,sprite[OW].sectnum); - } - - return 0; - } - case 2: - if (daz <= actor[spritenum].ceilingz) - { - if (totalclock > actor[spritenum].lasttransport) - { - actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); - spr->x += (sprite[OW].x-SX); - spr->y += (sprite[OW].y-SY); - spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz; - - Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t)); - changespritesect(spritenum,sprite[OW].sectnum); - } - - return 0; - } - } - } - } - - return(retval); -} - -ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype) -{ - vec3_t davect = {(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, - (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14, - sprite[i].zvel - }; - return (A_MoveSprite(i,&davect,cliptype)==0); -} - -int32_t block_deletesprite = 0; - -// all calls to deletesprite() from the game are wrapped by this function -void A_DeleteSprite(int32_t s) -{ - if (block_deletesprite) - { - OSD_Printf(OSD_ERROR "A_DeleteSprite(): tried to remove sprite %d in EVENT_EGS\n",s); - return; - } - - if (apScriptGameEvent[EVENT_KILLIT]) - { - int32_t p, pl=A_FindPlayer(&sprite[s],&p); - - aGameVars[g_iReturnVarID].val.lValue = 0; - VM_OnEvent(EVENT_KILLIT, s, pl, p); - if (aGameVars[g_iReturnVarID].val.lValue) - return; - } - -#ifdef POLYMER - if (getrendermode() == 4 && actor[s].lightptr != NULL) - { - polymer_deletelight(actor[s].lightId); - actor[s].lightId = -1; - actor[s].lightptr = NULL; - } -#endif - -#undef deletesprite - deletesprite(s); -#define deletesprite A_DeleteSprite -} - -void A_AddToDeleteQueue(int32_t i) -{ - if (g_netClientPeer || g_spriteDeleteQueueSize == 0) - { - deletesprite(i); - return; - } - - if (SpriteDeletionQueue[g_spriteDeleteQueuePos] >= 0) - sprite[SpriteDeletionQueue[g_spriteDeleteQueuePos]].xrepeat = 0; - SpriteDeletionQueue[g_spriteDeleteQueuePos] = i; - g_spriteDeleteQueuePos = (g_spriteDeleteQueuePos+1)%g_spriteDeleteQueueSize; -} - -void A_SpawnMultiple(int32_t sp, int32_t pic, int32_t n) -{ - int32_t j; - spritetype *s = &sprite[sp]; - - for (; n>0; n--) - { - j = A_InsertSprite(s->sectnum,s->x,s->y,s->z-(krand()%(47<<8)),pic,-32,8,8,krand()&2047,0,0,sp,5); - A_Spawn(-1, j); - sprite[j].cstat = krand()&12; - } -} - -void A_DoGuts(int32_t sp, int32_t gtype, int32_t n) -{ - int32_t gutz,floorz; - int32_t i,a,j,sx = 32,sy = 32; -// int32_t pal; - spritetype *s = &sprite[sp]; - - if (A_CheckEnemySprite(s) && s->xrepeat < 16) - sx = sy = 8; - - gutz = s->z-(8<<8); - floorz = getflorzofslope(s->sectnum,s->x,s->y); - - if (gutz > (floorz-(8<<8))) - gutz = floorz-(8<<8); - - if (s->picnum == COMMANDER) - gutz -= (24<<8); - -// if (A_CheckEnemySprite(s) && s->pal == 6) -// pal = 6; -// else pal = 0; - - for (j=n; j>0; j--) - { - a = krand()&2047; - i = A_InsertSprite(s->sectnum,s->x+(krand()&255)-128,s->y+(krand()&255)-128,gutz-(krand()&8191),gtype,-32,sx,sy,a,48+(krand()&31),-512-(krand()&2047),sp,5); - if (PN == JIBS2) - { - sprite[i].xrepeat >>= 2; - sprite[i].yrepeat >>= 2; - } -// if (pal == 6) -// sprite[i].pal = 6; - sprite[i].pal = s->pal; - } -} - -void A_DoGutsDir(int32_t sp, int32_t gtype, int32_t n) -{ - int32_t gutz,floorz; - int32_t i,a,j,sx = 32,sy = 32; - spritetype *s = &sprite[sp]; - - if (A_CheckEnemySprite(s) && s->xrepeat < 16) - sx = sy = 8; - - gutz = s->z-(8<<8); - floorz = getflorzofslope(s->sectnum,s->x,s->y); - - if (gutz > (floorz-(8<<8))) - gutz = floorz-(8<<8); - - if (s->picnum == COMMANDER) - gutz -= (24<<8); - - for (j=n; j>0; j--) - { - a = krand()&2047; - i = A_InsertSprite(s->sectnum,s->x,s->y,gutz,gtype,-32,sx,sy,a,256+(krand()&127),-512-(krand()&2047),sp,5); - sprite[i].pal = s->pal; - } -} - -void Sect_SetInterpolation(int32_t i) -{ - int32_t k, j = sector[SECT].wallptr, endwall = j+sector[SECT].wallnum; - - for (; j= 0) - { - G_SetInterpolation(&wall[k].x); - G_SetInterpolation(&wall[k].y); - k = wall[k].point2; - G_SetInterpolation(&wall[k].x); - G_SetInterpolation(&wall[k].y); - } - } -} - -void Sect_ClearInterpolation(int32_t i) -{ - int32_t k, j = sector[SECT].wallptr, endwall = j+sector[SECT].wallnum; - - for (; j= 0) - { - G_StopInterpolation(&wall[k].x); - G_StopInterpolation(&wall[k].y); - k = wall[k].point2; - G_StopInterpolation(&wall[k].x); - G_StopInterpolation(&wall[k].y); - } - } -} - -static void A_MoveSector(int32_t i) -{ - //T1,T2 and T3 are used for all the sector moving stuff!!! - - int32_t tx,ty; - spritetype *s = &sprite[i]; - int32_t j = T2, k = T3; - - s->x += (s->xvel*(sintable[(s->ang+512)&2047]))>>14; - s->y += (s->xvel*(sintable[s->ang&2047]))>>14; - - { - int32_t x = sector[s->sectnum].wallptr, endwall = x+sector[s->sectnum].wallnum; - - for (; xx+tx,s->y+ty); - - j++; - } - } -} - -// this is the same crap as in game.c's tspr manipulation. puke. -#define LIGHTRAD (s->yrepeat * tilesizy[s->picnum+(T5?(*(intptr_t *)T5) + *(((intptr_t *)T5)+2) * T4:0)]) -#define LIGHTRAD2 (((s->yrepeat) + (rand()%(s->yrepeat>>2))) * tilesizy[s->picnum+(T5?(*(intptr_t *)T5) + *(((intptr_t *)T5)+2) * T4:0)]) - -void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority) -{ -#ifdef POLYMER - spritetype *s = &sprite[srcsprite]; - - if (getrendermode() != 4) - return; - - if (actor[srcsprite].lightptr == NULL) - { -#pragma pack(push,1) - _prlight mylight; -#pragma pack(pop) - - mylight.sector = s->sectnum; - mylight.x = s->x; - mylight.y = s->y; - mylight.z = s->z-zoffset; - mylight.color[0] = color&255; - mylight.color[1] = (color>>8)&255; - mylight.color[2] = (color>>16)&255; - mylight.radius = radius; - actor[srcsprite].lightmaxrange = mylight.range = range; - - mylight.priority = priority; - mylight.tilenum = 0; - - actor[srcsprite].lightId = polymer_addlight(&mylight); - if (actor[srcsprite].lightId >= 0) - actor[srcsprite].lightptr = &prlights[actor[srcsprite].lightId]; - return; - } - - s->z -= zoffset; - - if (range < actor[srcsprite].lightmaxrange>>1) - actor[srcsprite].lightmaxrange = 0; - - if (range > actor[srcsprite].lightmaxrange || - priority != actor[srcsprite].lightptr->priority || - Bmemcmp(&sprite[srcsprite], actor[srcsprite].lightptr, sizeof(int32_t) * 3)) - { - if (range > actor[srcsprite].lightmaxrange) - actor[srcsprite].lightmaxrange = range; - - Bmemcpy(actor[srcsprite].lightptr, &sprite[srcsprite], sizeof(int32_t) * 3); - actor[srcsprite].lightptr->sector = s->sectnum; - actor[srcsprite].lightptr->flags.invalidate = 1; - } - - actor[srcsprite].lightptr->priority = priority; - actor[srcsprite].lightptr->range = range; - actor[srcsprite].lightptr->color[0] = color&255; - actor[srcsprite].lightptr->color[1] = (color>>8)&255; - actor[srcsprite].lightptr->color[2] = (color>>16)&255; - - s->z += zoffset; - -#else - UNREFERENCED_PARAMETER(radius); - UNREFERENCED_PARAMETER(srcsprite); - UNREFERENCED_PARAMETER(zoffset); - UNREFERENCED_PARAMETER(range); - UNREFERENCED_PARAMETER(color); - UNREFERENCED_PARAMETER(priority); -#endif -} - -// sleeping monsters, etc -ACTOR_STATIC void G_MoveZombieActors(void) -{ - int32_t x, px, py, sx, sy; - int32_t i = headspritestat[STAT_ZOMBIEACTOR], j, p, nexti; - int16_t psect, ssect; - spritetype *s; - - while (i >= 0) - { - nexti = nextspritestat[i]; - - s = &sprite[i]; - p = A_FindPlayer(s,&x); - - ssect = psect = s->sectnum; - - if (sprite[g_player[p].ps->i].extra > 0) - { - if (x < 30000) - { - actor[i].timetosleep++; - if (actor[i].timetosleep >= (x>>8)) - { - if (A_CheckEnemySprite(s)) - { - px = g_player[p].ps->opos.x+64-(krand()&127); - py = g_player[p].ps->opos.y+64-(krand()&127); - updatesector(px,py,&psect); - if (psect == -1) - { - i = nexti; - continue; - } - sx = s->x+64-(krand()&127); - sy = s->y+64-(krand()&127); - updatesector(px,py,&ssect); - if (ssect == -1) - { - i = nexti; - continue; - } - j = cansee(sx,sy,s->z-(krand()%(52<<8)),s->sectnum,px,py,g_player[p].ps->opos.z-(krand()%(32<<8)),g_player[p].ps->cursectnum); - } - else - j = cansee(s->x,s->y,s->z-((krand()&31)<<8),s->sectnum,g_player[p].ps->opos.x,g_player[p].ps->opos.y,g_player[p].ps->opos.z-((krand()&31)<<8),g_player[p].ps->cursectnum); - - // j = 1; - - if (j) switch (DynamicTileMap[s->picnum]) - { - case RUBBERCAN__STATIC: - case EXPLODINGBARREL__STATIC: - case WOODENHORSE__STATIC: - case HORSEONSIDE__STATIC: - case CANWITHSOMETHING__STATIC: - case CANWITHSOMETHING2__STATIC: - case CANWITHSOMETHING3__STATIC: - case CANWITHSOMETHING4__STATIC: - case FIREBARREL__STATIC: - case FIREVASE__STATIC: - case NUKEBARREL__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case TRIPBOMB__STATIC: - if (sector[s->sectnum].ceilingstat&1 && A_CheckSpriteFlags(j,SPRITE_NOSHADE) == 0) - s->shade = sector[s->sectnum].ceilingshade; - else s->shade = sector[s->sectnum].floorshade; - - actor[i].timetosleep = 0; - changespritestat(i,6); - break; - case RECON__STATIC: - CS |= 257; - default: - if (A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384) - break; - actor[i].timetosleep = 0; - A_PlayAlertSound(i); - changespritestat(i, STAT_ACTOR); - break; - } - else actor[i].timetosleep = 0; - } - } - if (A_CheckEnemySprite(s) && A_CheckSpriteFlags(i,SPRITE_NOSHADE) == 0) - { - if (sector[s->sectnum].ceilingstat&1) - s->shade = sector[s->sectnum].ceilingshade; - else s->shade = sector[s->sectnum].floorshade; - } - } - i = nexti; - } -} - -static inline int32_t ifhitsectors(int32_t sectnum) -{ - int32_t i = headspritestat[STAT_MISC]; - while (i >= 0) - { - if (PN == EXPLOSION2 && sectnum == SECT) - return i; - i = nextspritestat[i]; - } - return -1; -} - -#define IFHITSECT j=ifhitsectors(s->sectnum);if(j >= 0) - -int32_t A_IncurDamage(int32_t sn) -{ - int32_t j,p; - spritetype *npc; - - if (actor[sn].extra >= 0) - { - if (sprite[sn].extra >= 0) - { - npc = &sprite[sn]; - - if (npc->picnum == APLAYER) - { - if (ud.god && actor[sn].picnum != SHRINKSPARK) return -1; - - p = npc->yvel; - j = actor[sn].owner; - - if (j >= 0 && - sprite[j].picnum == APLAYER && - (GametypeFlags[ud.coop] & GAMETYPE_PLAYERSFRIENDLY) && - ud.ffire == 0) - return -1; - - if (j >= 0 && - sprite[j].picnum == APLAYER && - (GametypeFlags[ud.coop] & GAMETYPE_TDM) && - g_player[p].ps->team == g_player[sprite[j].yvel].ps->team && - ud.ffire == 0) - return -1; - - npc->extra -= actor[sn].extra; - - if (j >= 0) - { - if (npc->extra <= 0 && actor[sn].picnum != FREEZEBLAST) - { - npc->extra = 0; - - g_player[p].ps->wackedbyactor = j; - - if (sprite[actor[sn].owner].picnum == APLAYER && p != sprite[actor[sn].owner].yvel) - g_player[p].ps->frag_ps = sprite[j].yvel; - - actor[sn].owner = g_player[p].ps->i; - } - } - - if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE) && (SpriteProjectile[sn].workslike & PROJECTILE_RPG)) - { - g_player[p].ps->vel.x += - actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2; - g_player[p].ps->vel.y += - actor[sn].extra*(sintable[actor[sn].ang&2047])<<2; - } - else if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE)) - { - g_player[p].ps->vel.x += - actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1; - g_player[p].ps->vel.y += - actor[sn].extra*(sintable[actor[sn].ang&2047])<<1; - } - - switch (DynamicTileMap[actor[sn].picnum]) - { - case RADIUSEXPLOSION__STATIC: - case RPG__STATIC: - case HYDRENT__STATIC: - case HEAVYHBOMB__STATIC: - case SEENINE__STATIC: - case OOZFILTER__STATIC: - case EXPLODINGBARREL__STATIC: - g_player[p].ps->vel.x += - actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2; - g_player[p].ps->vel.y += - actor[sn].extra*(sintable[actor[sn].ang&2047])<<2; - break; - default: - g_player[p].ps->vel.x += - actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1; - g_player[p].ps->vel.y += - actor[sn].extra*(sintable[actor[sn].ang&2047])<<1; - break; - } - } - else - { - if (actor[sn].extra == 0) - if (actor[sn].picnum == SHRINKSPARK && npc->xrepeat < 24) - return -1; - - npc->extra -= actor[sn].extra; - if (npc->picnum != RECON && npc->owner >= 0 && sprite[npc->owner].statnum < MAXSTATUS) - npc->owner = actor[sn].owner; - } - - actor[sn].extra = -1; - return actor[sn].picnum; - } - } - - actor[sn].extra = -1; - return -1; -} - -void A_MoveCyclers(void) -{ - int32_t q, j, x, t, s, cshade; - int16_t *c; - walltype *wal; - - for (q=g_numCyclers-1; q>=0; q--) - { - - c = &cyclers[q][0]; - s = c[0]; - - t = c[3]; - j = t+(sintable[c[1]&2047]>>10); - cshade = c[2]; - - if (j < cshade) j = cshade; - else if (j > t) j = t; - - c[1] += sector[s].extra; - if (c[5]) - { - wal = &wall[sector[s].wallptr]; - for (x = sector[s].wallnum; x>0; x--,wal++) - if (wal->hitag != 1) - { - wal->shade = j; - - if ((wal->cstat&2) && wal->nextwall >= 0) - wall[wal->nextwall].shade = j; - - } - sector[s].floorshade = sector[s].ceilingshade = j; - } - } -} - -void A_MoveDummyPlayers(void) -{ - int32_t i = headspritestat[STAT_DUMMYPLAYER], p, nexti; - - while (i >= 0) - { - nexti = nextspritestat[i]; - - p = sprite[OW].yvel; - - if (g_player[p].ps->on_crane >= 0 || (g_player[p].ps->cursectnum >= 0 && sector[g_player[p].ps->cursectnum].lotag != 1) || sprite[g_player[p].ps->i].extra <= 0) - { - g_player[p].ps->dummyplayersprite = -1; - KILLIT(i); - } - else - { - if (g_player[p].ps->on_ground && g_player[p].ps->on_warping_sector == 1 && sector[g_player[p].ps->cursectnum].lotag == 1) - { - CS = 257; - SZ = sector[SECT].ceilingz+(27<<8); - SA = g_player[p].ps->ang; - if (T1 == 8) - T1 = 0; - else T1++; - } - else - { - if (sector[SECT].lotag != 2) SZ = sector[SECT].floorz; - CS = (int16_t) 32768; - } - } - - SX += (g_player[p].ps->pos.x-g_player[p].ps->opos.x); - SY += (g_player[p].ps->pos.y-g_player[p].ps->opos.y); - setsprite(i,(vec3_t *)&sprite[i]); - -BOLT: - - i = nexti; - } -} - -int32_t otherp; - -ACTOR_STATIC void G_MovePlayers(void) -{ - int32_t i = headspritestat[STAT_PLAYER], nexti; - int32_t otherx; - spritetype *s; - DukePlayer_t *p; - - while (i >= 0) - { - nexti = nextspritestat[i]; - - s = &sprite[i]; - p = g_player[s->yvel].ps; - if (s->owner >= 0) - { - if (p->newowner >= 0) //Looking thru the camera - { - s->x = p->opos.x; - s->y = p->opos.y; - actor[i].bposz = s->z = p->opos.z+PHEIGHT; - s->ang = p->oang; - setsprite(i,(vec3_t *)s); - } - else - { - if (g_netServer || (g_netServer || ud.multimode > 1)) - otherp = P_FindOtherPlayer(s->yvel,&otherx); - else - { - otherp = s->yvel; - otherx = 0; - } - - if (actorscrptr[sprite[i].picnum]) - A_Execute(i,s->yvel,otherx); - - if (g_netServer || (g_netServer || ud.multimode > 1)) - if (sprite[g_player[otherp].ps->i].extra > 0) - { - if (s->yrepeat > 32 && sprite[g_player[otherp].ps->i].yrepeat < 32) - { - if (otherx < 1400 && p->knee_incs == 0) - { - p->knee_incs = 1; - p->weapon_pos = -1; - p->actorsqu = g_player[otherp].ps->i; - } - } - } - if (ud.god) - { - s->extra = p->max_player_health; - s->cstat = 257; - p->inv_amount[GET_JETPACK] = 1599; - } - - - if (s->extra > 0) - { - actor[i].owner = i; - - if (ud.god == 0) - if (G_CheckForSpaceCeiling(s->sectnum) || G_CheckForSpaceFloor(s->sectnum)) - P_QuickKill(p); - } - else - { - - p->pos.x = s->x; - p->pos.y = s->y; - p->pos.z = s->z-(20<<8); - - p->newowner = -1; - - if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS) - { - p->ang += G_GetAngleDelta(p->ang,getangle(sprite[p->wackedbyactor].x-p->pos.x,sprite[p->wackedbyactor].y-p->pos.y))>>1; - p->ang &= 2047; - } - - } - s->ang = p->ang; - } - } - else - { - if (p->holoduke_on == -1) - KILLIT(i); - - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); - s->cstat = 0; - - if (s->xrepeat < 42) - { - s->xrepeat += 4; - s->cstat |= 2; - } - else s->xrepeat = 42; - if (s->yrepeat < 36) - s->yrepeat += 4; - else - { - s->yrepeat = 36; - if (sector[s->sectnum].lotag != 2) - A_Fall(i); - if (s->zvel == 0 && sector[s->sectnum].lotag == 1) - s->z += (32<<8); - } - - if (s->extra < 8) - { - s->xvel = 128; - s->ang = p->ang; - s->extra++; - A_SetSprite(i,CLIPMASK0); - } - else - { - s->ang = 2047-p->ang; - setsprite(i,(vec3_t *)s); - } - } - - if (sector[s->sectnum].ceilingstat&1) - s->shade += (sector[s->sectnum].ceilingshade-s->shade)>>1; - else - s->shade += (sector[s->sectnum].floorshade-s->shade)>>1; - -BOLT: - i = nexti; - } -} - -ACTOR_STATIC void G_MoveFX(void) -{ - int32_t i = headspritestat[STAT_FX], j, nexti, p; - int32_t x, ht; - spritetype *s; - - while (i >= 0) - { - s = &sprite[i]; - - nexti = nextspritestat[i]; - - switch (DynamicTileMap[s->picnum]) - { - case RESPAWN__STATIC: - if (sprite[i].extra == 66) - { - j = A_Spawn(i,SHT); - // sprite[j].pal = sprite[i].pal; - KILLIT(i); - } - else if (sprite[i].extra > (66-13)) - sprite[i].extra++; - break; - - case MUSICANDSFX__STATIC: - - ht = s->hitag; - - if (T2 != ud.config.SoundToggle) - { - T2 = ud.config.SoundToggle; - T1 = 0; - } - - if (s->lotag >= 1000 && s->lotag < 2000) - { - x = ldist(&sprite[g_player[screenpeek].ps->i],s); - if (x < ht && T1 == 0) - { - FX_SetReverb(s->lotag - 1000); - T1 = 1; - } - if (x >= ht && T1 == 1) - { - FX_SetReverb(0); - FX_SetReverbDelay(0); - T1 = 0; - } - } - else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && ud.config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) - { - if ((g_sounds[s->lotag].m&2)) - { - x = dist(&sprite[g_player[screenpeek].ps->i],s); - if (x < ht && T1 == 0 && FX_VoiceAvailable(g_sounds[s->lotag].pr-1)) - { - if (g_numEnvSoundsPlaying == ud.config.NumVoices) - { - j = headspritestat[STAT_FX]; - while (j >= 0) - { - if (PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 && actor[j].t_data[0] == 1 && dist(&sprite[j],&sprite[g_player[screenpeek].ps->i]) > x) - { - S_StopEnvSound(sprite[j].lotag,j); - break; - } - j = nextspritestat[j]; - } - if (j == -1) goto BOLT; - } - A_PlaySound(s->lotag,i); - T1 = 1; - } - if (x >= ht && T1 == 1) - { - // T1 = 0; - S_StopEnvSound(s->lotag,i); - } - } - if ((g_sounds[s->lotag].m&16)) - { - if (T5 > 0) T5--; - else - TRAVERSE_CONNECT(p) - if (p == myconnectindex && g_player[p].ps->cursectnum == s->sectnum) - { - j = s->lotag+((unsigned)g_globalRandom%(s->hitag+1)); - S_PlaySound(j); - T5 = GAMETICSPERSEC*40 + (g_globalRandom%(GAMETICSPERSEC*40)); - } - } - } - break; - } -BOLT: - i = nexti; - } -} - -ACTOR_STATIC void G_MoveFallers(void) -{ - int32_t i = headspritestat[STAT_FALLER], nexti, sect, j; - spritetype *s; - int32_t x; - - while (i >= 0) - { - nexti = nextspritestat[i]; - s = &sprite[i]; - - sect = s->sectnum; - - if (T1 == 0) - { - s->z -= (16<<8); - T2 = s->ang; - x = s->extra; - if ((j = A_IncurDamage(i)) >= 0) - { - if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER) - { - if (s->extra <= 0) - { - T1 = 1; - j = headspritestat[STAT_FALLER]; - while (j >= 0) - { - if (sprite[j].hitag == SHT) - { - actor[j].t_data[0] = 1; - sprite[j].cstat &= (65535-64); - if (sprite[j].picnum == CEILINGSTEAM || sprite[j].picnum == STEAM) - sprite[j].cstat |= 32768; - } - j = nextspritestat[j]; - } - } - } - else - { - actor[i].extra = 0; - s->extra = x; - } - } - s->ang = T2; - s->z += (16<<8); - } - else if (T1 == 1) - { - if (s->lotag > 0) - { - s->lotag-=3; - if (s->lotag <= 0) - { - s->xvel = (32+(krand()&63)); - s->zvel = -(1024+(krand()&1023)); - } - } - else - { - if (s->xvel > 0) - { - s->xvel -= 8; - A_SetSprite(i,CLIPMASK0); - } - - if (G_CheckForSpaceFloor(s->sectnum)) - x = 0; - else - { - if (G_CheckForSpaceCeiling(s->sectnum)) - x = g_spriteGravity/6; - else - x = g_spriteGravity; - } - - if (s->z < (sector[sect].floorz-ZOFFSET)) - { - s->zvel += x; - if (s->zvel > 6144) - s->zvel = 6144; - s->z += s->zvel; - } - if ((sector[sect].floorz-s->z) < (16<<8)) - { - j = 1+(krand()&7); - for (x=0; x= 0) - { - nexti = nextspritestat[i]; - - t = &actor[i].t_data[0]; - s = &sprite[i]; - sect = s->sectnum; - - if (sect < 0) KILLIT(i); - - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); - - IFWITHIN(CRANE,CRANE+3) - { - //t[0] = state - //t[1] = checking sector number - - if (s->xvel) A_GetZLimits(i); - - if (t[0] == 0) //Waiting to check the sector - { - j = headspritesect[t[1]]; - while (j>=0) - { - nextj = nextspritesect[j]; - switch (sprite[j].statnum) - { - case STAT_ACTOR: - case STAT_ZOMBIEACTOR: - case STAT_STANDABLE: - case STAT_PLAYER: - { - vec3_t vect; - - vect.x = msx[t[4]+1]; - vect.y = msy[t[4]+1]; - vect.z = sprite[j].z; - s->ang = getangle(msx[t[4]+1]-s->x,msy[t[4]+1]-s->y); - setsprite(j,&vect); - t[0]++; - goto BOLT; - - } - } - j = nextj; - } - } - - else if (t[0]==1) - { - if (s->xvel < 184) - { - s->picnum = CRANE+1; - s->xvel += 8; - } - A_SetSprite(i,CLIPMASK0); - if (sect == t[1]) - t[0]++; - } - else if (t[0]==2 || t[0]==7) - { - s->z += (1024+512); - - if (t[0]==2) - { - if ((sector[sect].floorz - s->z) < (64<<8)) - if (s->picnum > CRANE) s->picnum--; - - if ((sector[sect].floorz - s->z) < (4096+1024)) - t[0]++; - } - if (t[0]==7) - { - if ((sector[sect].floorz - s->z) < (64<<8)) - { - if (s->picnum > CRANE) s->picnum--; - else - { - if (s->owner==-2) - { - p = A_FindPlayer(s,&x); - A_PlaySound(DUKE_GRUNT,g_player[p].ps->i); - if (g_player[p].ps->on_crane == i) - g_player[p].ps->on_crane = -1; - } - t[0]++; - s->owner = -1; - } - } - } - } - else if (t[0]==3) - { - s->picnum++; - if (s->picnum == (CRANE+2)) - { - p = G_CheckPlayerInSector(t[1]); - if (p >= 0 && g_player[p].ps->on_ground) - { - s->owner = -2; - g_player[p].ps->on_crane = i; - A_PlaySound(DUKE_GRUNT,g_player[p].ps->i); - g_player[p].ps->ang = s->ang+1024; - } - else - { - j = headspritesect[t[1]]; - while (j>=0) - { - switch (sprite[j].statnum) - { - case STAT_ACTOR: - case STAT_STANDABLE: - s->owner = j; - break; - } - j = nextspritesect[j]; - } - } - - t[0]++;//Grabbed the sprite - t[2]=0; - goto BOLT; - } - } - else if (t[0]==4) //Delay before going up - { - t[2]++; - if (t[2] > 10) - t[0]++; - } - else if (t[0]==5 || t[0] == 8) - { - if (t[0]==8 && s->picnum < (CRANE+2)) - if ((sector[sect].floorz-s->z) > 8192) - s->picnum++; - - if (s->z < msx[t[4]+2]) - { - t[0]++; - s->xvel = 0; - } - else - s->z -= (1024+512); - } - else if (t[0]==6) - { - if (s->xvel < 192) - s->xvel += 8; - s->ang = getangle(msx[t[4]]-s->x,msy[t[4]]-s->y); - A_SetSprite(i,CLIPMASK0); - if (((s->x-msx[t[4]])*(s->x-msx[t[4]])+(s->y-msy[t[4]])*(s->y-msy[t[4]])) < (128*128)) - t[0]++; - } - - else if (t[0]==9) - t[0] = 0; - - { - vec3_t vect; - Bmemcpy(&vect,s,sizeof(vec3_t)); - vect.z -= (34<<8); - setsprite(msy[t[4]+2],&vect); - } - - - if (s->owner != -1) - { - p = A_FindPlayer(s,&x); - - if ((j = A_IncurDamage(i)) >= 0) - { - if (s->owner == -2) - if (g_player[p].ps->on_crane == i) - g_player[p].ps->on_crane = -1; - s->owner = -1; - s->picnum = CRANE; - goto BOLT; - } - - if (s->owner >= 0) - { - setsprite(s->owner,(vec3_t *)s); - - Bmemcpy(&actor[s->owner].bposx, s, sizeof(vec3_t)); - - s->zvel = 0; - } - else if (s->owner == -2) - { - g_player[p].ps->opos.x = g_player[p].ps->pos.x = s->x-(sintable[(g_player[p].ps->ang+512)&2047]>>6); - g_player[p].ps->opos.y = g_player[p].ps->pos.y = s->y-(sintable[g_player[p].ps->ang&2047]>>6); - g_player[p].ps->opos.z = g_player[p].ps->pos.z = s->z+(2<<8); - - setsprite(g_player[p].ps->i,(vec3_t *)g_player[p].ps); - g_player[p].ps->cursectnum = sprite[g_player[p].ps->i].sectnum; - } - } - - goto BOLT; - } - - IFWITHIN(WATERFOUNTAIN,WATERFOUNTAIN+3) - { - if (t[0] > 0) - { - if (t[0] < 20) - { - t[0]++; - - s->picnum++; - - if (s->picnum == (WATERFOUNTAIN+3)) - s->picnum = WATERFOUNTAIN+1; - } - else - { - p = A_FindPlayer(s,&x); - - if (x > 512) - { - t[0] = 0; - s->picnum = WATERFOUNTAIN; - } - else t[0] = 1; - } - } - goto BOLT; - } - - if (AFLAMABLE(s->picnum)) - { - if (T1 == 1) - { - T2++; - if ((T2&3) > 0) goto BOLT; - - if (s->picnum == TIRE && T2 == 32) - { - s->cstat = 0; - j = A_Spawn(i,BLOODPOOL); - sprite[j].shade = 127; - } - else - { - if (s->shade < 64) s->shade++; - else KILLIT(i); - } - - j = s->xrepeat-(krand()&7); - if (j < 10) - { - KILLIT(i); - } - - s->xrepeat = j; - - j = s->yrepeat-(krand()&7); - if (j < 4) - { - KILLIT(i); - } - s->yrepeat = j; - } - if (s->picnum == BOX) - { - A_Fall(i); - actor[i].ceilingz = sector[s->sectnum].ceilingz; - } - goto BOLT; - } - - if (s->picnum == TRIPBOMB) - { - if (actor[i].t_data[6] == 1) - { - - if (actor[i].t_data[7] >= 1) - { - actor[i].t_data[7]--; - } - - if (actor[i].t_data[7] <= 0) - { - T3=16; - actor[i].t_data[6]=3; - A_PlaySound(LASERTRIP_ARMING,i); - } - // we're on a timer.... - } - if (T3 > 0 && actor[i].t_data[6] == 3) - { - T3--; - - if (T3 == 8) - { - for (j=0; j<5; j++) RANDOMSCRAP; - x = s->extra; - A_RadiusDamage(i, g_tripbombBlastRadius, x>>2,x>>1,x-(x>>2),x); - - j = A_Spawn(i,EXPLOSION2); - A_PlaySound(LASERTRIP_EXPLODE,j); - sprite[j].ang = s->ang; - sprite[j].xvel = 348; - A_SetSprite(j,CLIPMASK0); - - j = headspritestat[STAT_MISC]; - while (j >= 0) - { - if (sprite[j].picnum == LASERLINE && s->hitag == sprite[j].hitag) - sprite[j].xrepeat = sprite[j].yrepeat = 0; - j = nextspritestat[j]; - } - KILLIT(i); - } - goto BOLT; - } - else - { - x = s->extra; - s->extra = 1; - l = s->ang; - if ((j = A_IncurDamage(i)) >= 0) { actor[i].t_data[6] = 3; - T3 = 16; - } - s->extra = x; - s->ang = l; - } - - switch (T1) - { - default: - p = A_FindPlayer(s,&x); - if (x > 768 || T1 > 16) T1++; - break; - - case 32: - l = s->ang; - s->ang = T6; - - T4 = s->x; - T5 = s->y; - - s->x += sintable[(T6+512)&2047]>>9; - s->y += sintable[(T6)&2047]>>9; - s->z -= (3<<8); - - setsprite(i,(vec3_t *)s); - - x = A_CheckHitSprite(i,&m); - - actor[i].lastvx = x; - - s->ang = l; - - k = 0; - - // if(lTripBombControl & TRIPBOMB_TRIPWIRE) - if (actor[i].t_data[6] != 1) - { - // we're on a trip wire - - while (x > 0) - { - j = A_Spawn(i,LASERLINE); - setsprite(j,(vec3_t *)&sprite[j]); - sprite[j].hitag = s->hitag; - actor[j].t_data[1] = sprite[j].z; - - s->x += sintable[(T6+512)&2047]>>4; - s->y += sintable[(T6)&2047]>>4; - - if (x < 1024) - { - sprite[j].xrepeat = x>>5; - break; - } - x -= 1024; - } - } - - T1++; - - s->x = T4; - s->y = T5; - s->z += (3<<8); - - setsprite(i,(vec3_t *)s); - T4 = T3 = 0; - - if (m >= 0 && actor[i].t_data[6] != 1) - { - actor[i].t_data[6] = 3; - T3 = 13; - A_PlaySound(LASERTRIP_ARMING,i); - } - break; - - case 33: - T2++; - - T4 = s->x; - T5 = s->y; - - s->x += sintable[(T6+512)&2047]>>9; - s->y += sintable[(T6)&2047]>>9; - s->z -= (3<<8); - - setsprite(i,(vec3_t *)s); - - x = A_CheckHitSprite(i,&m); - - s->x = T4; - s->y = T5; - s->z += (3<<8); - setsprite(i,(vec3_t *)s); - - // if( Actor[i].lastvx != x && lTripBombControl & TRIPBOMB_TRIPWIRE) - if (actor[i].lastvx != x && actor[i].t_data[6] != 1) - { - actor[i].t_data[6] = 3; - T3 = 13; - A_PlaySound(LASERTRIP_ARMING,i); - } - break; - } - - goto BOLT; - } - - if (s->picnum >= CRACK1 && s->picnum <= CRACK4) - { - if (s->hitag > 0) - { - t[0] = s->cstat; - t[1] = s->ang; - j = A_IncurDamage(i); - if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER) - { - j = headspritestat[STAT_STANDABLE]; - while (j >= 0) - { - if (s->hitag == sprite[j].hitag && (sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE)) - if (sprite[j].shade != -32) - sprite[j].shade = -32; - j = nextspritestat[j]; - } - - goto DETONATE; - } - else - { - s->cstat = t[0]; - s->ang = t[1]; - s->extra = 0; - } - } - goto BOLT; - } - - if (s->picnum == FIREEXT) - { - j = A_IncurDamage(i); - if (j == -1) goto BOLT; - - for (k=0; k<16; k++) - { - j = A_InsertSprite(SECT,SX,SY,SZ-(krand()%(48<<8)),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5); - sprite[j].pal = 2; - } - - j = A_Spawn(i,EXPLOSION2); - A_PlaySound(PIPEBOMB_EXPLODE,j); - A_PlaySound(GLASS_HEAVYBREAK,j); - - if (s->hitag > 0) - { - j = headspritestat[STAT_STANDABLE]; - while (j >= 0) - { - if (s->hitag == sprite[j].hitag && (sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE)) - if (sprite[j].shade != -32) - sprite[j].shade = -32; - j = nextspritestat[j]; - } - - x = s->extra; - A_RadiusDamage(i, g_pipebombBlastRadius,x>>2, x-(x>>1),x-(x>>2), x); - j = A_Spawn(i,EXPLOSION2); - A_PlaySound(PIPEBOMB_EXPLODE,j); - - goto DETONATE; - } - else - { - A_RadiusDamage(i,g_seenineBlastRadius,10,15,20,25); - KILLIT(i); - } - goto BOLT; - } - - if (s->picnum == OOZFILTER || s->picnum == SEENINE || s->picnum == SEENINEDEAD || s->picnum == (SEENINEDEAD+1)) - { - if (s->shade != -32 && s->shade != -33) - { - if (s->xrepeat) - j = (A_IncurDamage(i) >= 0); - else - j = 0; - - if (j || s->shade == -31) - { - if (j) s->lotag = 0; - - t[3] = 1; - - j = headspritestat[STAT_STANDABLE]; - while (j >= 0) - { - if (s->hitag == sprite[j].hitag && (sprite[j].picnum == SEENINE || sprite[j].picnum == OOZFILTER)) - sprite[j].shade = -32; - j = nextspritestat[j]; - } - } - } - else - { - if (s->shade == -32) - { - if (s->lotag > 0) - { - s->lotag-=3; - if (s->lotag <= 0) s->lotag = -99; - } - else - s->shade = -33; - } - else - { - if (s->xrepeat > 0) - { - T3++; - if (T3 == 3) - { - if (s->picnum == OOZFILTER) - { - T3 = 0; - goto DETONATE; - } - if (s->picnum != (SEENINEDEAD+1)) - { - T3 = 0; - - if (s->picnum == SEENINEDEAD) s->picnum++; - else if (s->picnum == SEENINE) - s->picnum = SEENINEDEAD; - } - else goto DETONATE; - } - goto BOLT; - } - -DETONATE: - - g_earthquakeTime = 16; - - j = headspritestat[STAT_EFFECTOR]; - while (j >= 0) - { - if (s->hitag == sprite[j].hitag) - { - if (sprite[j].lotag == 13) - { - if (actor[j].t_data[2] == 0) - actor[j].t_data[2] = 1; - } - else if (sprite[j].lotag == 8) - actor[j].t_data[4] = 1; - else if (sprite[j].lotag == 18) - { - if (actor[j].t_data[0] == 0) - actor[j].t_data[0] = 1; - } - else if (sprite[j].lotag == 21) - actor[j].t_data[0] = 1; - } - j = nextspritestat[j]; - } - - s->z -= (32<<8); - - if (s->xrepeat) - for (x=0; x<8; x++) RANDOMSCRAP; - - if ((t[3] == 1 && s->xrepeat) || s->lotag == -99) - { - int32_t j = A_Spawn(i,EXPLOSION2); - x = s->extra; - A_RadiusDamage(i,g_seenineBlastRadius,x>>2, x-(x>>1),x-(x>>2), x); - A_PlaySound(PIPEBOMB_EXPLODE,j); - } - - KILLIT(i); - } - } - goto BOLT; - } - - if (s->picnum == MASTERSWITCH) - { - if (s->yvel == 1) - { - s->hitag--; - if (s->hitag <= 0) - { - G_OperateSectors(sect,i); - - j = headspritesect[sect]; - while (j >= 0) - { - if (sprite[j].statnum == STAT_EFFECTOR) - { - switch (sprite[j].lotag) - { - case 2: - case 21: - case 31: - case 32: - case 36: - actor[j].t_data[0] = 1; - break; - case 3: - actor[j].t_data[4] = 1; - break; - } - } - else if (sprite[j].statnum == STAT_STANDABLE) - { - switch (DynamicTileMap[sprite[j].picnum]) - { - case SEENINE__STATIC: - case OOZFILTER__STATIC: - sprite[j].shade = -31; - break; - } - } - j = nextspritesect[j]; - } - KILLIT(i); - } - } - goto BOLT; - } - switchpicnum = s->picnum; - if ((s->picnum > SIDEBOLT1) && (s->picnum <= SIDEBOLT1+3)) - { - switchpicnum = SIDEBOLT1; - } - if ((s->picnum > BOLT1) && (s->picnum <= BOLT1+3)) - { - switchpicnum = BOLT1; - } - - switch (DynamicTileMap[switchpicnum]) - { - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: - - if (s->xrepeat == 0) KILLIT(i); - - p = A_FindPlayer(s, &x); - - if (x < 2048) - { - if (SP == 1) - camsprite = i; - } - else if (camsprite != -1 && T1 == 1) - { - camsprite = -1; - T1 = 0; - //loadtile(s->picnum); - //invalidatetile(s->picnum,-1,255); - walock[TILE_VIEWSCR] = 199; - } - - goto BOLT; - - case TRASH__STATIC: - - if (s->xvel == 0) s->xvel = 1; - if (A_SetSprite(i, CLIPMASK0)) - { - A_Fall(i); - if (krand()&1) s->zvel -= 256; - if (klabs(s->xvel) < 48) - s->xvel += (krand()&3); - } - else KILLIT(i); - break; - - case SIDEBOLT1__STATIC: - // case SIDEBOLT1+1: - // case SIDEBOLT1+2: - // case SIDEBOLT1+3: - p = A_FindPlayer(s, &x); - if (x > 20480) goto BOLT; - -CLEAR_THE_BOLT2: - if (t[2]) - { - t[2]--; - goto BOLT; - } - if ((s->xrepeat|s->yrepeat) == 0) - { - s->xrepeat=t[0]; - s->yrepeat=t[1]; - } - if ((krand()&8) == 0) - { - t[0]=s->xrepeat; - t[1]=s->yrepeat; - t[2] = g_globalRandom&4; - s->xrepeat=s->yrepeat=0; - goto CLEAR_THE_BOLT2; - } - s->picnum++; - - if (l&1) s->cstat ^= 2; - - if ((krand()&1) && sector[sect].floorpicnum == HURTRAIL) - A_PlaySound(SHORT_CIRCUIT,i); - - if (s->picnum == SIDEBOLT1+4) s->picnum = SIDEBOLT1; - - goto BOLT; - - case BOLT1__STATIC: - // case BOLT1+1: - // case BOLT1+2: - // case BOLT1+3: - p = A_FindPlayer(s, &x); - if (x > 20480) goto BOLT; - - if (t[3] == 0) - t[3]=sector[sect].floorshade; - -CLEAR_THE_BOLT: - if (t[2]) - { - t[2]--; - sector[sect].floorshade = 20; - sector[sect].ceilingshade = 20; - goto BOLT; - } - if ((s->xrepeat|s->yrepeat) == 0) - { - s->xrepeat=t[0]; - s->yrepeat=t[1]; - } - else if ((krand()&8) == 0) - { - t[0]=s->xrepeat; - t[1]=s->yrepeat; - t[2] = g_globalRandom&4; - s->xrepeat=s->yrepeat=0; - goto CLEAR_THE_BOLT; - } - s->picnum++; - - l = g_globalRandom&7; - s->xrepeat=l+8; - - if (l&1) s->cstat ^= 2; - - if (s->picnum == (BOLT1+1) && (krand()&7) == 0 && sector[sect].floorpicnum == HURTRAIL) - A_PlaySound(SHORT_CIRCUIT,i); - - if (s->picnum==BOLT1+4) s->picnum=BOLT1; - - if (s->picnum&1) - { - sector[sect].floorshade = 0; - sector[sect].ceilingshade = 0; - } - else - { - sector[sect].floorshade = 20; - sector[sect].ceilingshade = 20; - } - goto BOLT; - - case WATERDRIP__STATIC: - - if (t[1]) - { - if (--t[1] == 0) - s->cstat &= 32767; - } - else - { - A_Fall(i); - A_SetSprite(i,CLIPMASK0); - if (s->xvel > 0) s->xvel -= 2; - - if (s->zvel == 0) - { - s->cstat |= 32768; - - if (s->pal != 2 && s->hitag == 0) - A_PlaySound(SOMETHING_DRIPPING,i); - - if (sprite[s->owner].picnum != WATERDRIP) - { - KILLIT(i); - } - else - { - actor[i].bposz = s->z = t[0]; - t[1] = 48+(krand()&31); - } - } - } - - - goto BOLT; - - case DOORSHOCK__STATIC: - j = klabs(sector[sect].ceilingz-sector[sect].floorz)>>9; - s->yrepeat = j+4; - s->xrepeat = 16; - s->z = sector[sect].floorz; - goto BOLT; - - case TOUCHPLATE__STATIC: - if (t[1] == 1 && s->hitag >= 0) //Move the sector floor - { - x = sector[sect].floorz; - - if (t[3] == 1) - { - if (x >= t[2]) - { - sector[sect].floorz = x; - t[1] = 0; - } - else - { - sector[sect].floorz += sector[sect].extra; - p = G_CheckPlayerInSector(sect); - if (p >= 0) g_player[p].ps->pos.z += sector[sect].extra; - } - } - else - { - if (x <= s->z) - { - sector[sect].floorz = s->z; - t[1] = 0; - } - else - { - sector[sect].floorz -= sector[sect].extra; - p = G_CheckPlayerInSector(sect); - if (p >= 0) - g_player[p].ps->pos.z -= sector[sect].extra; - } - } - goto BOLT; - } - - if (t[5] == 1) goto BOLT; - - p = G_CheckPlayerInSector(sect); - if (p >= 0 && (g_player[p].ps->on_ground || s->ang == 512)) - { - if (t[0] == 0 && !G_CheckActivatorMotion(s->lotag)) - { - t[0] = 1; - t[1] = 1; - t[3] = !t[3]; - G_OperateMasterSwitches(s->lotag); - G_OperateActivators(s->lotag,p); - if (s->hitag > 0) - { - s->hitag--; - if (s->hitag == 0) t[5] = 1; - } - } - } - else t[0] = 0; - - if (t[1] == 1) - { - j = headspritestat[STAT_STANDABLE]; - while (j >= 0) - { - if (j != i && sprite[j].picnum == TOUCHPLATE && sprite[j].lotag == s->lotag) - { - actor[j].t_data[1] = 1; - actor[j].t_data[3] = t[3]; - } - j = nextspritestat[j]; - } - } - goto BOLT; - - case CANWITHSOMETHING__STATIC: - case CANWITHSOMETHING2__STATIC: - case CANWITHSOMETHING3__STATIC: - case CANWITHSOMETHING4__STATIC: - A_Fall(i); - if ((j = A_IncurDamage(i)) >= 0) - { - A_PlaySound(VENT_BUST,i); - - for (j=9; j>=0; j--) - RANDOMSCRAP; - - if (s->lotag) A_Spawn(i,s->lotag); - - KILLIT(i); - } - goto BOLT; - - case FLOORFLAME__STATIC: - case FIREBARREL__STATIC: - case FIREVASE__STATIC: - case EXPLODINGBARREL__STATIC: - case WOODENHORSE__STATIC: - case HORSEONSIDE__STATIC: - case NUKEBARREL__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case TOILETWATER__STATIC: - case RUBBERCAN__STATIC: - case STEAM__STATIC: - case CEILINGSTEAM__STATIC: - if (!actorscrptr[sprite[i].picnum]) - goto BOLT; - p = A_FindPlayer(s, &x); - A_Execute(i,p,x); - goto BOLT; - case WATERBUBBLEMAKER__STATIC: - if (!actorscrptr[sprite[i].picnum]) - goto BOLT; - p = A_FindPlayer(s, &x); - A_Execute(i,p,x); - goto BOLT; - } - -BOLT: - i = nexti; - } -} - -ACTOR_STATIC void A_DoProjectileBounce(int32_t i) -{ - int32_t dax, day, daz = 4096; - spritetype *s = &sprite[i]; - int32_t hitsect = s->sectnum; - int32_t k = sector[hitsect].wallptr; - int32_t l = wall[k].point2; - - int32_t xvect = mulscale10(s->xvel,sintable[(s->ang+512)&2047]); - int32_t yvect = mulscale10(s->xvel,sintable[s->ang&2047]); - int32_t zvect = s->zvel; - - int32_t daang = getangle(wall[l].x-wall[k].x,wall[l].y-wall[k].y); - - if (s->z < (actor[i].floorz+actor[i].ceilingz)>>1) - k = sector[hitsect].ceilingheinum; - else - k = sector[hitsect].floorheinum; - - dax = mulscale14(k,sintable[(daang)&2047]); - day = mulscale14(k,sintable[(daang+1536)&2047]); - - k = xvect*dax+yvect*day+zvect*daz; - l = dax*dax+day*day+daz*daz; - if ((klabs(k)>>14) < l) - { - k = divscale17(k,l); - xvect -= mulscale16(dax,k); - yvect -= mulscale16(day,k); - zvect -= mulscale16(daz,k); - } - - s->zvel = zvect; - s->xvel = ksqrt(dmulscale8(xvect,xvect,yvect,yvect)); - s->ang = getangle(xvect,yvect); -} - -ACTOR_STATIC void G_MoveWeapons(void) -{ - int32_t i = headspritestat[STAT_PROJECTILE], j=0, k, f, nexti, p, q; - vec3_t davect; - int32_t x, ll; - uint32_t qq; - spritetype *s; - - while (i >= 0) - { - nexti = nextspritestat[i]; - s = &sprite[i]; - - if (s->sectnum < 0) KILLIT(i); - - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); - // here - - if (A_CheckSpriteFlags(i,SPRITE_PROJECTILE)) - { - /* Custom projectiles. This is a big hack. */ - - if (SpriteProjectile[i].pal >= 0) - s->pal=SpriteProjectile[i].pal; - - if (SpriteProjectile[i].workslike & PROJECTILE_KNEE) - KILLIT(i); - - if (SpriteProjectile[i].workslike & PROJECTILE_RPG) - { - // if (SpriteProjectile[i].workslike & COOLEXPLOSION1) - // if( g_sounds[WIERDSHOT_FLY].num == 0 ) - // A_PlaySound(WIERDSHOT_FLY,i); - - Bmemcpy(&davect,s,sizeof(vec3_t)); - - if (SpriteProjectile[i].flashcolor) - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, SpriteProjectile[i].flashcolor,PR_LIGHT_PRIO_LOW_GAME); - - if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS) - { - /* if(s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) - Did this cause the bug with prematurely exploding projectiles? */ - if (s->yvel < 1) - { - - if (SpriteProjectile[i].spawns >= 0) - { - k = A_Spawn(i,SpriteProjectile[i].spawns); - -// Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - /* - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; - */ - - if (SpriteProjectile[i].sxrepeat > 4) - sprite[k].xrepeat=SpriteProjectile[i].sxrepeat; - if (SpriteProjectile[i].syrepeat > 4) - sprite[k].yrepeat=SpriteProjectile[i].syrepeat; - } - if (SpriteProjectile[i].isound >= 0) - A_PlaySound(SpriteProjectile[i].isound,i); - - s->extra=SpriteProjectile[i].extra; - - if (SpriteProjectile[i].extra_rand > 0) - s->extra += (krand()&SpriteProjectile[i].extra_rand); - - x = s->extra; - A_RadiusDamage(i,SpriteProjectile[i].hitradius, x>>2,x>>1,x-(x>>2),x); - - KILLIT(i); - } - } - - p = -1; - - if (SpriteProjectile[i].workslike & PROJECTILE_COOLEXPLOSION1) - { - s->shade++; - if (s->shade >= 40) KILLIT(i); - } - - if (SpriteProjectile[i].drop) - s->zvel -= SpriteProjectile[i].drop; - - if (SpriteProjectile[i].workslike & PROJECTILE_SPIT) - if (s->zvel < 6144) - s->zvel += g_spriteGravity-112; - - k = s->xvel; - ll = s->zvel; - - if (sector[s->sectnum].lotag == 2) - { - k = s->xvel>>1; - ll = s->zvel>>1; - } - - A_GetZLimits(i); - qq = CLIPMASK1; - - if (SpriteProjectile[i].trail >= 0) - { - for (f=0; f<=SpriteProjectile[i].tnum; f++) - { - j = A_Spawn(i,SpriteProjectile[i].trail); - if (SpriteProjectile[i].toffset != 0) - sprite[j].z += (SpriteProjectile[i].toffset<<8); - if (SpriteProjectile[i].txrepeat >= 0) - sprite[j].xrepeat=SpriteProjectile[i].txrepeat; - if (SpriteProjectile[i].tyrepeat >= 0) - sprite[j].yrepeat=SpriteProjectile[i].tyrepeat; - } - } - - for (f=1; f<=SpriteProjectile[i].velmult; f++) - { - vec3_t tmpvect; - Bmemcpy(&davect,s,sizeof(vec3_t)); - - tmpvect.x = (k*(sintable[(s->ang+512)&2047]))>>14; - tmpvect.y = (k*(sintable[s->ang&2047]))>>14; - tmpvect.z = ll; - - j = A_MoveSprite(i,&tmpvect,qq); - if (j) - break; - } - - if (!(SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS) && - s->yvel >= 0 && sprite[s->yvel].sectnum != MAXSECTORS) - if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) - j = 49152|s->yvel; - - actor[i].movflag = j; - - if (s->sectnum < 0) - { - KILLIT(i); - } - - if (SpriteProjectile[i].workslike & PROJECTILE_TIMED && SpriteProjectile[i].range > 0) - { - if (!(actor[i].t_data[8])) - actor[i].t_data[8] = 1; - else - actor[i].t_data[8]++; - - if (actor[i].t_data[8] > SpriteProjectile[i].range) - { - if (SpriteProjectile[i].workslike & PROJECTILE_EXPLODEONTIMER) - { - if (SpriteProjectile[i].spawns >= 0) - { - k = A_Spawn(i,SpriteProjectile[i].spawns); - - Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - - if (SpriteProjectile[i].sxrepeat > 4) - sprite[k].xrepeat=SpriteProjectile[i].sxrepeat; - if (SpriteProjectile[i].syrepeat > 4) - sprite[k].yrepeat=SpriteProjectile[i].syrepeat; - } - if (SpriteProjectile[i].isound >= 0) - A_PlaySound(SpriteProjectile[i].isound,i); - - s->extra=SpriteProjectile[i].extra; - - if (SpriteProjectile[i].extra_rand > 0) - s->extra += (krand()&SpriteProjectile[i].extra_rand); - - x = s->extra; - A_RadiusDamage(i,SpriteProjectile[i].hitradius, x>>2,x>>1,x-(x>>2),x); - } - KILLIT(i); - } - } - - if ((j&49152) != 49152) - if (!(SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS)) - { - if (s->z < actor[i].ceilingz) - { - j = 16384|(s->sectnum); - s->zvel = -1; - } - else if ((s->z > actor[i].floorz && sector[s->sectnum].lotag != 1) || - (s->z > actor[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1)) - { - j = 16384|(s->sectnum); - if (sector[s->sectnum].lotag != 1) - s->zvel = 1; - } - } - - if (SpriteProjectile[i].workslike & PROJECTILE_WATERBUBBLES && - sector[s->sectnum].lotag == 2 && rnd(140)) - A_Spawn(i,WATERBUBBLE); - - if (j != 0) - { - if (SpriteProjectile[i].workslike & PROJECTILE_COOLEXPLOSION1) - { - s->xvel = 0; - s->zvel = 0; - } - - if ((j&49152) == 49152) - { - j &= (MAXSPRITES-1); - - if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFSPRITES) - { - s->yvel--; - - k = getangle(sprite[j].x-s->x,sprite[j].y-s->y)+(sprite[j].cstat&16?0:512); - s->ang = ((k<<1) - s->ang)&2047; - - if (SpriteProjectile[i].bsound >= 0) - A_PlaySound(SpriteProjectile[i].bsound,i); - - if (SpriteProjectile[i].workslike & PROJECTILE_LOSESVELOCITY) - { - s->xvel=s->xvel>>1; - s->zvel=s->zvel>>1; - } - if (!(SpriteProjectile[i].workslike & PROJECTILE_FORCEIMPACT))goto BOLT; - } - - A_DamageObject(j,i); - - if (sprite[j].picnum == APLAYER) - { - p = sprite[j].yvel; - A_PlaySound(PISTOL_BODYHIT,j); - - if (SpriteProjectile[i].workslike & PROJECTILE_SPIT) - { - g_player[p].ps->horiz += 32; - g_player[p].ps->return_to_center = 8; - - if (g_player[p].ps->loogcnt == 0) - { - if (!A_CheckSoundPlaying(g_player[p].ps->i, DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN,g_player[p].ps->i); - - j = 3+(krand()&3); - g_player[p].ps->numloogs = j; - g_player[p].ps->loogcnt = 24*4; - for (x=0; x < j; x++) - { - g_player[p].ps->loogiex[x] = krand()%xdim; - g_player[p].ps->loogiey[x] = krand()%ydim; - } - } - } - } - - if (SpriteProjectile[i].workslike & PROJECTILE_RPG_IMPACT) - { - - actor[j].owner = s->owner; - actor[j].picnum = s->picnum; - actor[j].extra += SpriteProjectile[i].extra; - - if (SpriteProjectile[i].spawns >= 0) - { - k = A_Spawn(i,SpriteProjectile[i].spawns); - Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - - if (SpriteProjectile[i].sxrepeat > 4) - sprite[k].xrepeat=SpriteProjectile[i].sxrepeat; - if (SpriteProjectile[i].syrepeat > 4) - sprite[k].yrepeat=SpriteProjectile[i].syrepeat; - } - - if (SpriteProjectile[i].isound >= 0) - A_PlaySound(SpriteProjectile[i].isound,i); - - if (!(SpriteProjectile[i].workslike & PROJECTILE_FORCEIMPACT)) - KILLIT(i); - - } - if (SpriteProjectile[i].workslike & PROJECTILE_FORCEIMPACT) - goto BOLT; - - } - else if ((j&49152) == 32768) - { - j &= (MAXWALLS-1); - - if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFMIRRORS && - (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR)) - { - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - s->ang = ((k<<1) - s->ang)&2047; - s->owner = i; - A_Spawn(i,TRANSPORTERSTAR); - goto BOLT; - } - else - { - setsprite(i,&davect); - A_DamageWall(i,j,(vec3_t *)s,s->picnum); - - if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS) - { - if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR) - s->yvel--; - - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - s->ang = ((k<<1) - s->ang)&2047; - - if (SpriteProjectile[i].bsound >= 0) - A_PlaySound(SpriteProjectile[i].bsound,i); - - if (SpriteProjectile[i].workslike & PROJECTILE_LOSESVELOCITY) - { - s->xvel=s->xvel>>1; - s->zvel=s->zvel>>1; - } - goto BOLT; - } - } - } - else if ((j&49152) == 16384) - { - setsprite(i,&davect); - - if (s->zvel < 0) - { - if (sector[s->sectnum].ceilingstat&1 && sector[s->sectnum].ceilingpal == 0) - KILLIT(i); - - Sect_DamageCeiling(s->sectnum); - } - - if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS) - { - A_DoProjectileBounce(i); - A_SetSprite(i,qq); - - s->yvel--; - - if (SpriteProjectile[i].bsound >= 0) - A_PlaySound(SpriteProjectile[i].bsound,i); - - if (SpriteProjectile[i].workslike & PROJECTILE_LOSESVELOCITY) - { - s->xvel=s->xvel>>1; - s->zvel=s->zvel>>1; - } - - goto BOLT; - } - } - - if (SpriteProjectile[i].workslike & PROJECTILE_HITSCAN) - { - if (!actorscrptr[sprite[i].picnum]) - goto BOLT; - p = A_FindPlayer(s,&x); - A_Execute(i,p,x); - goto BOLT; - } - - if (SpriteProjectile[i].workslike & PROJECTILE_RPG) - { - if (SpriteProjectile[i].spawns > 0) - { - k = A_Spawn(i,SpriteProjectile[i].spawns); - Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - - if (SpriteProjectile[i].sxrepeat > 4) - sprite[k].xrepeat=SpriteProjectile[i].sxrepeat; - if (SpriteProjectile[i].syrepeat > 4) - sprite[k].yrepeat=SpriteProjectile[i].syrepeat; - } - - if (SpriteProjectile[i].isound >= 0) - A_PlaySound(SpriteProjectile[i].isound,i); - - s->extra=SpriteProjectile[i].extra; - if (SpriteProjectile[i].extra_rand > 0) - s->extra += (krand()&SpriteProjectile[i].extra_rand); - - A_RadiusDamage(i,SpriteProjectile[i].hitradius, - s->extra>>2,s->extra>>1,s->extra-(s->extra>>2),s->extra); - KILLIT(i); - } - } - goto BOLT; - } - } - else - { - - // here - switch (DynamicTileMap[s->picnum]) - { - case RADIUSEXPLOSION__STATIC: - case KNEE__STATIC: - KILLIT(i); - case TONGUE__STATIC: - T1 = sintable[(T2)&2047]>>9; - T2 += 32; - if (T2 > 2047) KILLIT(i); - - if (sprite[s->owner].statnum == MAXSTATUS) - if (A_CheckEnemySprite(&sprite[s->owner]) == 0) - KILLIT(i); - - s->ang = sprite[s->owner].ang; - s->x = sprite[s->owner].x; - s->y = sprite[s->owner].y; - if (sprite[s->owner].picnum == APLAYER) - s->z = sprite[s->owner].z-(34<<8); - for (k=0; ksectnum, - s->x+((k*sintable[(s->ang+512)&2047])>>9), - s->y+((k*sintable[s->ang&2047])>>9), - s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),TONGUE,-40+(k<<1), - 8,8,0,0,0,i,5); - sprite[q].cstat = 128; - sprite[q].pal = 8; - } - q = A_InsertSprite(s->sectnum, - s->x+((k*sintable[(s->ang+512)&2047])>>9), - s->y+((k*sintable[s->ang&2047])>>9), - s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),INNERJAW,-40, - 32,32,0,0,0,i,5); - sprite[q].cstat = 128; - if (T2 > 512 && T2 < (1024)) - sprite[q].picnum = INNERJAW+1; - - goto BOLT; - - case FREEZEBLAST__STATIC: - if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) - { - j = A_Spawn(i,TRANSPORTERSTAR); - sprite[j].pal = 1; - sprite[j].xrepeat = 32; - sprite[j].yrepeat = 32; - KILLIT(i); - } - case SHRINKSPARK__STATIC: - case RPG__STATIC: - case FIRELASER__STATIC: - case SPIT__STATIC: - case COOLEXPLOSION1__STATIC: - - if (s->picnum == COOLEXPLOSION1) - if (!S_CheckSoundPlaying(i,WIERDSHOT_FLY)) - A_PlaySound(WIERDSHOT_FLY,i); - - p = -1; - - k = s->xvel; - ll = s->zvel; - - if (s->picnum == RPG && sector[s->sectnum].lotag == 2) - { - k = s->xvel>>1; - ll = s->zvel>>1; - } - - Bmemcpy(&davect,s,sizeof(vec3_t)); - - A_GetZLimits(i); - qq = CLIPMASK1; - - switch (DynamicTileMap[s->picnum]) - { - case RPG__STATIC: - if (DynamicTileMap[s->picnum] == RPG__STATIC && actor[i].picnum != BOSS2 && - s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) - { - j = A_Spawn(i,SMALLSMOKE); - sprite[j].z += (1<<8); - } - break; - } - - { - vec3_t tmpvect; - - tmpvect.x = (k*(sintable[(s->ang+512)&2047]))>>14; - tmpvect.y = (k*(sintable[s->ang&2047]))>>14; - tmpvect.z = ll; - j = A_MoveSprite(i,&tmpvect,qq); - } - - - if (s->picnum == RPG && s->yvel >= 0) - if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) - j = 49152|s->yvel; - - actor[i].movflag = j; - - if (s->sectnum < 0) - KILLIT(i); - - if ((j&49152) != 49152) - if (s->picnum != FREEZEBLAST) - { - if (s->z < actor[i].ceilingz) - { - j = 16384|(s->sectnum); - s->zvel = -1; - } - else if ((s->z > actor[i].floorz && sector[s->sectnum].lotag != 1) || - (s->z > actor[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1)) - { - j = 16384|(s->sectnum); - if (sector[s->sectnum].lotag != 1) - s->zvel = 1; - } - } - - if (s->picnum == FIRELASER) - { - for (k=-3; k<2; k++) - { - x = A_InsertSprite(s->sectnum, - s->x+((k*sintable[(s->ang+512)&2047])>>9), - s->y+((k*sintable[s->ang&2047])>>9), - s->z+((k*ksgn(s->zvel))*klabs(s->zvel/24)),FIRELASER,-40+(k<<2), - s->xrepeat,s->yrepeat,0,0,0,s->owner,5); - - sprite[x].cstat = 128; - sprite[x].pal = s->pal; - } - } - else if (s->picnum == SPIT) if (s->zvel < 6144) - s->zvel += g_spriteGravity-112; - - if (j != 0) - { - if (s->picnum == COOLEXPLOSION1) - { - if ((j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER) - goto COOLEXPLOSION; - s->xvel = 0; - s->zvel = 0; - } - - if ((j&49152) == 49152) - { - j &= (MAXSPRITES-1); - - if (s->picnum == FREEZEBLAST && sprite[j].pal == 1) - if (A_CheckEnemySprite(&sprite[j]) || sprite[j].picnum == APLAYER) - { - j = A_Spawn(i,TRANSPORTERSTAR); - sprite[j].pal = 1; - sprite[j].xrepeat = 32; - sprite[j].yrepeat = 32; - - KILLIT(i); - } - - A_DamageObject(j,i); - - if (sprite[j].picnum == APLAYER) - { - p = sprite[j].yvel; - A_PlaySound(PISTOL_BODYHIT,j); - - if (s->picnum == SPIT) - { - g_player[p].ps->horiz += 32; - g_player[p].ps->return_to_center = 8; - - if (g_player[p].ps->loogcnt == 0) - { - if (!A_CheckSoundPlaying(g_player[p].ps->i, DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN,g_player[p].ps->i); - - j = 3+(krand()&3); - g_player[p].ps->numloogs = j; - g_player[p].ps->loogcnt = 24*4; - for (x=0; x < j; x++) - { - g_player[p].ps->loogiex[x] = krand()%xdim; - g_player[p].ps->loogiey[x] = krand()%ydim; - } - } - } - } - } - else if ((j&49152) == 32768) - { - j &= (MAXWALLS-1); - - if (s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT && (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR)) - { - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - s->ang = ((k<<1) - s->ang)&2047; - s->owner = i; - A_Spawn(i,TRANSPORTERSTAR); - goto BOLT; - } - else - { - setsprite(i,&davect); - A_DamageWall(i,j,(vec3_t *)s,s->picnum); - - if (s->picnum == FREEZEBLAST) - { - if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR) - { - s->extra >>= 1; - s->yvel--; - } - - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - s->ang = ((k<<1) - s->ang)&2047; - goto BOLT; - } - } - } - else if ((j&49152) == 16384) - { - setsprite(i,&davect); - - if (s->zvel < 0) - { - if (sector[s->sectnum].ceilingstat&1) - if (sector[s->sectnum].ceilingpal == 0) - KILLIT(i); - - Sect_DamageCeiling(s->sectnum); - } - - if (s->picnum == FREEZEBLAST) - { - A_DoProjectileBounce(i); - A_SetSprite(i,qq); - s->extra >>= 1; - if (s->xrepeat > 8) - s->xrepeat -= 2; - if (s->yrepeat > 8) - s->yrepeat -= 2; - s->yvel--; - goto BOLT; - } - } - - if (s->picnum != SPIT) - { - if (s->picnum == RPG) - { - k = A_Spawn(i,EXPLOSION2); - A_PlaySound(RPG_EXPLODE,k); - Bmemcpy(&sprite[k],&davect,sizeof(vec3_t)); - - if (s->xrepeat < 10) - { - sprite[k].xrepeat = 6; - sprite[k].yrepeat = 6; - } - else if ((j&49152) == 16384) - { - if (s->zvel > 0) - A_Spawn(i,EXPLOSION2BOT); - else - { - sprite[k].cstat |= 8; - sprite[k].z += (48<<8); - } - - } - - if (s->xrepeat >= 10) - { - x = s->extra; - A_RadiusDamage(i,g_rpgBlastRadius, x>>2,x>>1,x-(x>>2),x); - } - else - { - x = s->extra+(g_globalRandom&3); - A_RadiusDamage(i,(g_rpgBlastRadius>>1),x>>2,x>>1,x-(x>>2),x); - } - } - else if (s->picnum == SHRINKSPARK) - { - A_Spawn(i,SHRINKEREXPLOSION); - A_PlaySound(SHRINKER_HIT,i); - A_RadiusDamage(i,g_shrinkerBlastRadius,0,0,0,0); - } - else if (s->picnum != COOLEXPLOSION1 && s->picnum != FREEZEBLAST && s->picnum != FIRELASER) - { - k = A_Spawn(i,EXPLOSION2); - sprite[k].xrepeat = sprite[k].yrepeat = s->xrepeat>>1; - if ((j&49152) == 16384) - { - if (s->zvel < 0) - { - sprite[k].cstat |= 8; - sprite[k].z += (72<<8); - } - - } - } - } - if (s->picnum != COOLEXPLOSION1) KILLIT(i); - } - if (s->picnum == COOLEXPLOSION1) - { -COOLEXPLOSION: - s->shade++; - if (s->shade >= 40) KILLIT(i); - } - else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) - A_Spawn(i,WATERBUBBLE); - - goto BOLT; - - case SHOTSPARK1__STATIC: - if (!actorscrptr[sprite[i].picnum]) - goto BOLT; - p = A_FindPlayer(s,&x); - A_Execute(i,p,x); - goto BOLT; - } - } -BOLT: - i = nexti; - } -} - -ACTOR_STATIC void G_MoveTransports(void) -{ - int32_t warpspriteto; - int32_t i = headspritestat[STAT_TRANSPORT], j, k, l, p, sect, sectlotag, nexti, nextj; - int32_t ll,onfloorz,q; - - while (i >= 0) - { - sect = SECT; - sectlotag = sector[sect].lotag; - - nexti = nextspritestat[i]; - - if (OW == i) - { - i = nexti; - continue; - } - - onfloorz = T5; - - if (T1 > 0) T1--; - - j = headspritesect[sect]; - while (j >= 0) - { - nextj = nextspritesect[j]; - - switch (sprite[j].statnum) - { - case STAT_PLAYER: - - if (sprite[j].owner != -1) - { - p = sprite[j].yvel; - - g_player[p].ps->on_warping_sector = 1; - - if (g_player[p].ps->transporter_hold == 0 && g_player[p].ps->jumping_counter == 0) - { - if (g_player[p].ps->on_ground && sectlotag == 0 && onfloorz && g_player[p].ps->jetpack_on == 0) - { - if (sprite[i].pal == 0) - { - A_Spawn(i,TRANSPORTERBEAM); - A_PlaySound(TELEPORTER,i); - } - - TRAVERSE_CONNECT(k) - if (g_player[k].ps->cursectnum == sprite[OW].sectnum) - { - g_player[k].ps->frag_ps = p; - sprite[g_player[k].ps->i].extra = 0; - } - - g_player[p].ps->ang = sprite[OW].ang; - - if (sprite[OW].owner != OW) - { - T1 = 13; - actor[OW].t_data[0] = 13; - g_player[p].ps->transporter_hold = 13; - } - - g_player[p].ps->bobposx = g_player[p].ps->opos.x = g_player[p].ps->pos.x = sprite[OW].x; - g_player[p].ps->bobposy = g_player[p].ps->opos.y = g_player[p].ps->pos.y = sprite[OW].y; - g_player[p].ps->opos.z = g_player[p].ps->pos.z = sprite[OW].z-PHEIGHT; - - changespritesect(j,sprite[OW].sectnum); - g_player[p].ps->cursectnum = sprite[j].sectnum; - - if (sprite[i].pal == 0) - { - k = A_Spawn(OW,TRANSPORTERBEAM); - A_PlaySound(TELEPORTER,k); - } - - break; - } - } - else if (!(sectlotag == 1 && g_player[p].ps->on_ground == 1)) break; - - if (onfloorz == 0 && klabs(SZ-g_player[p].ps->pos.z) < 6144) - if ((g_player[p].ps->jetpack_on == 0) || (g_player[p].ps->jetpack_on && TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP)) || - (g_player[p].ps->jetpack_on && TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH))) - { - g_player[p].ps->opos.x = g_player[p].ps->pos.x += sprite[OW].x-SX; - g_player[p].ps->opos.y = g_player[p].ps->pos.y += sprite[OW].y-SY; - - if (g_player[p].ps->jetpack_on && (TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP) || g_player[p].ps->jetpack_on < 11)) - g_player[p].ps->pos.z = sprite[OW].z-6144; - else g_player[p].ps->pos.z = sprite[OW].z+6144; - g_player[p].ps->opos.z = g_player[p].ps->pos.z; - - actor[g_player[p].ps->i].bposx = g_player[p].ps->pos.x; - actor[g_player[p].ps->i].bposy = g_player[p].ps->pos.y; - actor[g_player[p].ps->i].bposz = g_player[p].ps->pos.z; - - changespritesect(j,sprite[OW].sectnum); - g_player[p].ps->cursectnum = sprite[OW].sectnum; - - break; - } - - k = 0; - - if (onfloorz && sectlotag == 1 && g_player[p].ps->on_ground && - g_player[p].ps->pos.z >= sector[sect].floorz && - (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH) || g_player[p].ps->vel.z > 2048)) - // if( onfloorz && sectlotag == 1 && g_player[p].ps->pos.z > (sector[sect].floorz-(6<<8)) ) - { - k = 1; - if (screenpeek == p) - { - FX_StopAllSounds(); - S_ClearSoundLocks(); - } - if (sprite[g_player[p].ps->i].extra > 0) - A_PlaySound(DUKE_UNDERWATER,j); - g_player[p].ps->opos.z = g_player[p].ps->pos.z = - sector[sprite[OW].sectnum].ceilingz; - - /* - g_player[p].ps->vel.x = 4096-(krand()&8192); - g_player[p].ps->vel.y = 4096-(krand()&8192); - */ - if (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH)) - g_player[p].ps->vel.z += 512; - } - - if (onfloorz && sectlotag == 2 && g_player[p].ps->pos.z <= sector[sect].ceilingz /*&& g_player[p].ps->vel.z == 0*/) - { - k = 1; - // if( sprite[j].extra <= 0) break; - if (screenpeek == p) - { - FX_StopAllSounds(); - S_ClearSoundLocks(); - } - A_PlaySound(DUKE_GASP,j); - - g_player[p].ps->opos.z = g_player[p].ps->pos.z = - sector[sprite[OW].sectnum].floorz; - - g_player[p].ps->jumping_toggle = 1; - g_player[p].ps->jumping_counter = 0; - g_player[p].ps->vel.z = 0; - // g_player[p].ps->vel.z += 1024; - } - - if (k == 1) - { - vec3_t vect; - g_player[p].ps->bobposx = g_player[p].ps->opos.x = g_player[p].ps->pos.x += sprite[OW].x-SX; - g_player[p].ps->bobposy = g_player[p].ps->opos.y = g_player[p].ps->pos.y += sprite[OW].y-SY; - - if (sprite[OW].owner != OW) - g_player[p].ps->transporter_hold = -2; - g_player[p].ps->cursectnum = sprite[OW].sectnum; - - changespritesect(j,sprite[OW].sectnum); - - vect.x = g_player[p].ps->pos.x; - vect.y = g_player[p].ps->pos.y; - vect.z = g_player[p].ps->pos.z+PHEIGHT; - - setsprite(g_player[p].ps->i,&vect); - - P_UpdateScreenPal(g_player[p].ps); - - if ((krand()&255) < 32) - A_Spawn(j,WATERSPLASH2); - - if (sectlotag == 1) - for (l = 0; l < 9; l++) - { - q = A_Spawn(g_player[p].ps->i,WATERBUBBLE); - sprite[q].z += krand()&16383; - } - } - } - break; - - case STAT_PROJECTILE: - if (sectlotag != 0) goto JBOLT; - case STAT_ACTOR: - if ((sprite[j].picnum == SHARK) || (sprite[j].picnum == COMMANDER) || (sprite[j].picnum == OCTABRAIN) - || ((sprite[j].picnum >= GREENSLIME) && (sprite[j].picnum <= GREENSLIME+7))) - { - if (sprite[j].extra > 0) - goto JBOLT; - } - case STAT_MISC: - case STAT_FALLER: - case STAT_DUMMYPLAYER: - - ll = klabs(sprite[j].zvel); - - if (totalclock > actor[j].lasttransport) - { - warpspriteto = 0; - if (ll && sectlotag == 2 && sprite[j].z < (sector[sect].ceilingz+ll)) - warpspriteto = 1; - - if (ll && sectlotag == 1 && sprite[j].z > (sector[sect].floorz-ll)) - warpspriteto = 1; - - if (sectlotag == 0 && (onfloorz || klabs(sprite[j].z-SZ) < 4096)) - { - if (sprite[OW].owner != OW && onfloorz && T1 > 0 && sprite[j].statnum != STAT_MISC) - { - T1++; - goto BOLT; - } - warpspriteto = 1; - } - - if (warpspriteto && A_CheckSpriteFlags(j,SPRITE_DECAL)) goto JBOLT; - - if (warpspriteto) switch (DynamicTileMap[sprite[j].picnum]) - { - case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - case TRIPBOMB__STATIC: - case BULLETHOLE__STATIC: - case WATERSPLASH2__STATIC: - case BURNING__STATIC: - case BURNING2__STATIC: - case FIRE__STATIC: - case FIRE2__STATIC: - case TOILETWATER__STATIC: - case LASERLINE__STATIC: - goto JBOLT; - case PLAYERONWATER__STATIC: - if (sectlotag == 2) - { - sprite[j].cstat &= 32768; - break; - } - default: - if (sprite[j].statnum == STAT_MISC && !(sectlotag == 1 || sectlotag == 2)) - break; - - case WATERBUBBLE__STATIC: - // if( rnd(192) && sprite[j].picnum == WATERBUBBLE) - // break; - - if (sectlotag > 0) - { - k = A_Spawn(j,WATERSPLASH2); - if (sectlotag == 1 && sprite[j].statnum == STAT_PROJECTILE) - { - sprite[k].xvel = sprite[j].xvel>>1; - sprite[k].ang = sprite[j].ang; - A_SetSprite(k,CLIPMASK0); - } - } - - switch (sectlotag) - { - case 0: - if (onfloorz) - { - if (sprite[j].statnum == STAT_PROJECTILE || - (G_CheckPlayerInSector(sect) == -1 && G_CheckPlayerInSector(sprite[OW].sectnum) == -1)) - { - sprite[j].x += (sprite[OW].x-SX); - sprite[j].y += (sprite[OW].y-SY); - sprite[j].z -= SZ - sector[sprite[OW].sectnum].floorz; - sprite[j].ang = sprite[OW].ang; - - Bmemcpy(&actor[j].bposx, &sprite[j], sizeof(vec3_t)); - - if (sprite[i].pal == 0) - { - k = A_Spawn(i,TRANSPORTERBEAM); - A_PlaySound(TELEPORTER,k); - - k = A_Spawn(OW,TRANSPORTERBEAM); - A_PlaySound(TELEPORTER,k); - } - - if (sprite[OW].owner != OW) - { - T1 = 13; - actor[OW].t_data[0] = 13; - } - - changespritesect(j,sprite[OW].sectnum); - } - } - else - { - sprite[j].x += (sprite[OW].x-SX); - sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sprite[OW].z+4096; - - Bmemcpy(&actor[j].bposx, &sprite[j], sizeof(vec3_t)); - - changespritesect(j,sprite[OW].sectnum); - } - break; - case 1: - actor[j].lasttransport = totalclock + (TICSPERFRAME<<2); - - sprite[j].x += (sprite[OW].x-SX); - sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sector[sprite[OW].sectnum].ceilingz; - - - Bmemcpy(&actor[j].bposx, &sprite[j], sizeof(vec3_t)); - - changespritesect(j,sprite[OW].sectnum); - - break; - case 2: - actor[j].lasttransport = totalclock + (TICSPERFRAME<<2); - sprite[j].x += (sprite[OW].x-SX); - sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sector[sprite[OW].sectnum].floorz; - - Bmemcpy(&actor[j].bposx, &sprite[j], sizeof(vec3_t)); - - changespritesect(j,sprite[OW].sectnum); - - break; - } - - break; - } - } - break; - - } -JBOLT: - j = nextj; - } -BOLT: - i = nexti; - } -} - -static int16_t A_FindLocator(int32_t n,int32_t sn) -{ - int32_t i = headspritestat[STAT_LOCATOR]; - - while (i >= 0) - { - if ((sn == -1 || sn == SECT) && n == SLT) - return i; - i = nextspritestat[i]; - } - return -1; -} - -ACTOR_STATIC void G_MoveActors(void) -{ - int32_t x, m, l; - intptr_t *t; - int32_t a, j, nexti, nextj, sect, p, switchpicnum, k; - spritetype *s; - int32_t i = headspritestat[STAT_ACTOR]; - - while (i >= 0) - { - nexti = nextspritestat[i]; - - s = &sprite[i]; - - sect = s->sectnum; - - if (s->xrepeat == 0 || sect < 0 || sect >= MAXSECTORS) - KILLIT(i); - - t = &actor[i].t_data[0]; - - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); - - switchpicnum=s->picnum; - if ((s->picnum > GREENSLIME)&&(s->picnum <= GREENSLIME+7)) - { - switchpicnum = GREENSLIME; - } - switch (DynamicTileMap[switchpicnum]) - { - case DUCK__STATIC: - case TARGET__STATIC: - if (s->cstat&32) - { - t[0]++; - if (t[0] > 60) - { - t[0] = 0; - s->cstat = 128+257+16; - s->extra = 1; - } - } - else - { - j = A_IncurDamage(i); - if (j >= 0) - { - s->cstat = 32+128; - k = 1; - - j = headspritestat[STAT_ACTOR]; - while (j >= 0) - { - if (sprite[j].lotag == s->lotag && - sprite[j].picnum == s->picnum) - { - if ((sprite[j].hitag && !(sprite[j].cstat&32)) || - (!sprite[j].hitag && (sprite[j].cstat&32)) - ) - { - k = 0; - break; - } - } - - j = nextspritestat[j]; - } - - if (k == 1) - { - G_OperateActivators(s->lotag,-1); - G_OperateForceFields(i,s->lotag); - G_OperateMasterSwitches(s->lotag); - } - } - } - goto BOLT; - - case RESPAWNMARKERRED__STATIC: - case RESPAWNMARKERYELLOW__STATIC: - case RESPAWNMARKERGREEN__STATIC: - if (++T1 > g_itemRespawnTime) - KILLIT(i); - - if (T1 >= (g_itemRespawnTime>>1) && T1 < ((g_itemRespawnTime>>1)+(g_itemRespawnTime>>2))) - PN = RESPAWNMARKERYELLOW; - else if (T1 > ((g_itemRespawnTime>>1)+(g_itemRespawnTime>>2))) - PN = RESPAWNMARKERGREEN; - - A_Fall(i); - break; - - case HELECOPT__STATIC: - case DUKECAR__STATIC: - - s->z += s->zvel; - t[0]++; - - if (t[0] == 4) A_PlaySound(WAR_AMBIENCE2,i); - - if (t[0] > (GAMETICSPERSEC*8)) - { - S_PlaySound(RPG_EXPLODE); - for (j=0; j<32; j++) RANDOMSCRAP; - g_earthquakeTime = 16; - KILLIT(i); - } - else if ((t[0]&3) == 0) - A_Spawn(i,EXPLOSION2); - A_SetSprite(i,CLIPMASK0); - break; - case RAT__STATIC: - A_Fall(i); - if (A_SetSprite(i, CLIPMASK0)) - { - if ((krand()&255) < 3) A_PlaySound(RATTY,i); - s->ang += (krand()&31)-15+(sintable[(t[0]<<8)&2047]>>11); - } - else - { - T1++; - if (T1 > 1) - { - KILLIT(i); - } - else s->ang = (krand()&2047); - } - if (s->xvel < 128) - s->xvel+=2; - s->ang += (krand()&3)-6; - break; - case QUEBALL__STATIC: - case STRIPEBALL__STATIC: - if (s->xvel) - { - j = headspritestat[STAT_DEFAULT]; - while (j >= 0) - { - nextj = nextspritestat[j]; - if (sprite[j].picnum == POCKET && ldist(&sprite[j],s) < 52) KILLIT(i); - j = nextj; - } - - j = clipmove((vec3_t *)s,&s->sectnum, - (((s->xvel*(sintable[(s->ang+512)&2047]))>>14)*TICSPERFRAME)<<11, - (((s->xvel*(sintable[s->ang&2047]))>>14)*TICSPERFRAME)<<11, - 24L,(4<<8),(4<<8),CLIPMASK1); - - if (j&49152) - { - if ((j&49152) == 32768) - { - j &= (MAXWALLS-1); - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - s->ang = ((k<<1) - s->ang)&2047; - } - else if ((j&49152) == 49152) - { - j &= (MAXSPRITES-1); - A_DamageObject(i,j); - } - } - s->xvel --; - if (s->xvel < 0) s->xvel = 0; - if (s->picnum == STRIPEBALL) - { - s->cstat = 257; - s->cstat |= (4 & s->xvel) | (8 & s->xvel); - } - } - else - { - p = A_FindPlayer(s,&x); - - if (x < 1596) - { - // if(s->pal == 12) - { - j = G_GetAngleDelta(g_player[p].ps->ang,getangle(s->x-g_player[p].ps->pos.x,s->y-g_player[p].ps->pos.y)); - if (j > -64 && j < 64 && TEST_SYNC_KEY(g_player[p].sync->bits, SK_OPEN)) - if (g_player[p].ps->toggle_key_flag == 1) - { - a = headspritestat[STAT_ACTOR]; - while (a >= 0) - { - if (sprite[a].picnum == QUEBALL || sprite[a].picnum == STRIPEBALL) - { - j = G_GetAngleDelta(g_player[p].ps->ang,getangle(sprite[a].x-g_player[p].ps->pos.x,sprite[a].y-g_player[p].ps->pos.y)); - if (j > -64 && j < 64) - { - A_FindPlayer(&sprite[a],&l); - if (x > l) break; - } - } - a = nextspritestat[a]; - } - if (a == -1) - { - if (s->pal == 12) - s->xvel = 164; - else s->xvel = 140; - s->ang = g_player[p].ps->ang; - g_player[p].ps->toggle_key_flag = 2; - } - } - } - } - if (x < 512 && s->sectnum == g_player[p].ps->cursectnum) - { - s->ang = getangle(s->x-g_player[p].ps->pos.x,s->y-g_player[p].ps->pos.y); - s->xvel = 48; - } - } - - break; - case FORCESPHERE__STATIC: - - if (s->yvel == 0) - { - s->yvel = 1; - - for (l=512; l<(2048-512); l+= 128) - for (j=0; j<2048; j += 128) - { - k = A_Spawn(i,FORCESPHERE); - sprite[k].cstat = 257+128; - sprite[k].clipdist = 64; - sprite[k].ang = j; - sprite[k].zvel = sintable[l&2047]>>5; - sprite[k].xvel = sintable[(l+512)&2047]>>9; - sprite[k].owner = i; - } - } - - if (t[3] > 0) - { - if (s->zvel < 6144) - s->zvel += 192; - s->z += s->zvel; - if (s->z > sector[sect].floorz) - s->z = sector[sect].floorz; - t[3]--; - if (t[3] == 0) - KILLIT(i); - } - else if (t[2] > 10) - { - j = headspritestat[STAT_MISC]; - while (j >= 0) - { - if (sprite[j].owner == i && sprite[j].picnum == FORCESPHERE) - actor[j].t_data[1] = 1+(krand()&63); - j = nextspritestat[j]; - } - t[3] = 64; - } - - goto BOLT; - - case RECON__STATIC: - - A_GetZLimits(i); - - if (sector[s->sectnum].ceilingstat&1) - s->shade += (sector[s->sectnum].ceilingshade-s->shade)>>1; - else s->shade += (sector[s->sectnum].floorshade-s->shade)>>1; - - if (s->z < sector[sect].ceilingz+(32<<8)) - s->z = sector[sect].ceilingz+(32<<8); - -#ifdef POLYMER - /* - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].y = s->y; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].z = s->z + 10248; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range = 8192; - - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].angle = s->ang; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].horiz = 100; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].radius = 256; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].faderadius = 200; - - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[0] = 255; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[1] = 255; - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[2] = 255; - - gamelights[gamelightcount&(PR_MAXLIGHTS-1)].priority = PR_LIGHT_PRIO_MAX_GAME; - - if (gamelightcount < PR_MAXLIGHTS) - gamelightcount++; - */ -#endif // POLYMER - - if (!g_netServer && ud.multimode < 2) - { - if (g_noEnemies == 1) - { - s->cstat = (int16_t)32768; - goto BOLT; - } - else if (g_noEnemies == 2) s->cstat = 257; - } - if ((j = A_IncurDamage(i)) >= 0) - { - if (s->extra < 0 && t[0] != -1) - { - t[0] = -1; - s->extra = 0; - } - A_PlaySound(RECO_PAIN,i); - RANDOMSCRAP; - } - - if (t[0] == -1) - { - s->z += 1024; - t[2]++; - if ((t[2]&3) == 0) A_Spawn(i,EXPLOSION2); - A_GetZLimits(i); - s->ang += 96; - s->xvel = 128; - j = A_SetSprite(i,CLIPMASK0); - if (j != 1 || s->z > actor[i].floorz) - { - for (l=0; l<16; l++) - RANDOMSCRAP; - j = A_Spawn(i,EXPLOSION2); - A_PlaySound(LASERTRIP_EXPLODE,j); - A_Spawn(i,PIGCOP); - g_player[myconnectindex].ps->actors_killed++; - KILLIT(i); - } - goto BOLT; - } - else - { - if (s->z > actor[i].floorz-(48<<8)) - s->z = actor[i].floorz-(48<<8); - } - - p = A_FindPlayer(s,&x); - j = s->owner; - - // 3 = findplayerz, 4 = shoot - - if (t[0] >= 4) - { - t[2]++; - if ((t[2]&15) == 0) - { - a = s->ang; - s->ang = actor[i].tempang; - A_PlaySound(RECO_ATTACK,i); - A_Shoot(i,FIRELASER); - s->ang = a; - } - if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, g_player[p].ps->pos.x,g_player[p].ps->pos.y,g_player[p].ps->pos.z,g_player[p].ps->cursectnum)) - { - t[0] = 0; - t[2] = 0; - } - else actor[i].tempang += - G_GetAngleDelta(actor[i].tempang,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))/3; - } - else if (t[0] == 2 || t[0] == 3) - { - t[3] = 0; - if (s->xvel > 0) s->xvel -= 16; - else s->xvel = 0; - - if (t[0] == 2) - { - l = g_player[p].ps->pos.z-s->z; - if (klabs(l) < (48<<8)) t[0] = 3; - else s->z += ksgn(g_player[p].ps->pos.z-s->z)<<10; - } - else - { - t[2]++; - if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, g_player[p].ps->pos.x,g_player[p].ps->pos.y,g_player[p].ps->pos.z,g_player[p].ps->cursectnum)) - { - t[0] = 1; - t[2] = 0; - } - else if ((t[2]&15) == 0) - { - A_PlaySound(RECO_ATTACK,i); - A_Shoot(i,FIRELASER); - } - } - s->ang += G_GetAngleDelta(s->ang,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>2; - } - - if (t[0] != 2 && t[0] != 3) - { - l = ldist(&sprite[j],s); - if (l <= 1524) - { - a = s->ang; - s->xvel >>= 1; - } - else a = getangle(sprite[j].x-s->x,sprite[j].y-s->y); - - if (t[0] == 1 || t[0] == 4) // Found a locator and going with it - { - l = dist(&sprite[j],s); - - if (l <= 1524) - { - if (t[0] == 1) t[0] = 0; - else t[0] = 5; - } - else - { - // Control speed here - if (l > 1524) - { - if (s->xvel < 256) s->xvel += 32; - } - else - { - if (s->xvel > 0) s->xvel -= 16; - else s->xvel = 0; - } - } - - if (t[0] < 2) t[2]++; - - if (x < 6144 && t[0] < 2 && t[2] > (GAMETICSPERSEC*4)) - { - t[0] = 2+(krand()&2); - t[2] = 0; - actor[i].tempang = s->ang; - } - } - - if (t[0] == 0 || t[0] == 5) - { - if (t[0] == 0) - t[0] = 1; - else t[0] = 4; - j = s->owner = A_FindLocator(s->hitag,-1); - if (j == -1) - { - s->hitag = j = actor[i].t_data[5]; - s->owner = A_FindLocator(j,-1); - j = s->owner; - if (j == -1) KILLIT(i); - } - else s->hitag++; - } - - t[3] = G_GetAngleDelta(s->ang,a); - s->ang += t[3]>>3; - - if ((s->z - sprite[j].z) < -512) - s->z += 512; - else if ((s->z - sprite[j].z) > 512) - s->z -= 512; - else s->z = sprite[j].z; - } - - if (!A_CheckSoundPlaying(i,RECO_ROAM)) - A_PlaySound(RECO_ROAM,i); - - A_SetSprite(i,CLIPMASK0); - - goto BOLT; - - case OOZ__STATIC: - case OOZ2__STATIC: - - A_GetZLimits(i); - - j = (actor[i].floorz-actor[i].ceilingz)>>9; - if (j > 255) j = 255; - - x = 25-(j>>1); - if (x < 8) x = 8; - else if (x > 48) x = 48; - - s->yrepeat = j; - s->xrepeat = x; - s->z = actor[i].floorz; - - goto BOLT; - - case GREENSLIME__STATIC: - // case GREENSLIME+1: - // case GREENSLIME+2: - // case GREENSLIME+3: - // case GREENSLIME+4: - // case GREENSLIME+5: - // case GREENSLIME+6: - // case GREENSLIME+7: - - // #ifndef VOLUMEONE - if (g_netServer && (!g_netServer && ud.multimode < 2)) - { - if (g_noEnemies == 1) - { - s->cstat = (int16_t)32768; - goto BOLT; - } - else if (g_noEnemies == 2) s->cstat = 257; - } - // #endif - - t[1]+=128; - - if (sector[sect].floorstat&1) - KILLIT(i); - - p = A_FindPlayer(s,&x); - - if (x > 20480) - { - actor[i].timetosleep++; - if (actor[i].timetosleep > SLEEPTIME) - { - actor[i].timetosleep = 0; - changespritestat(i, STAT_ZOMBIEACTOR); - goto BOLT; - } - } - - if (t[0] == -5) // FROZEN - { - t[3]++; - if (t[3] > 280) - { - s->pal = 0; - t[0] = 0; - goto BOLT; - } - A_Fall(i); - s->cstat = 257; - s->picnum = GREENSLIME+2; - s->extra = 1; - s->pal = 1; - if ((j = A_IncurDamage(i)) >= 0) - { - if (j == FREEZEBLAST) goto BOLT; - for (j=16; j >= 0 ; j--) - { - k = A_InsertSprite(SECT,SX,SY,SZ,GLASSPIECES+(j%3),-32,36,36,krand()&2047,32+(krand()&63),1024-(krand()&1023),i,5); - sprite[k].pal = 1; - } - A_PlaySound(GLASS_BREAKING,i); - KILLIT(i); - } - else if (x < 1024 && g_player[p].ps->quick_kick == 0) - { - j = G_GetAngleDelta(g_player[p].ps->ang,getangle(SX-g_player[p].ps->pos.x,SY-g_player[p].ps->pos.y)); - if (j > -128 && j < 128) - g_player[p].ps->quick_kick = 14; - } - - goto BOLT; - } - - if (x < 1596) - s->cstat = 0; - else s->cstat = 257; - - if (t[0] == -4) //On the player - { - if (sprite[g_player[p].ps->i].extra < 1) - { - t[0] = 0; - goto BOLT; - } - - setsprite(i,(vec3_t *)s); - - s->ang = g_player[p].ps->ang; - - if ((TEST_SYNC_KEY(g_player[p].sync->bits, SK_FIRE) || (g_player[p].ps->quick_kick > 0)) && sprite[g_player[p].ps->i].extra > 0) - if (g_player[p].ps->quick_kick > 0 || (g_player[p].ps->curr_weapon != HANDREMOTE_WEAPON && g_player[p].ps->curr_weapon != HANDBOMB_WEAPON && g_player[p].ps->curr_weapon != TRIPBOMB_WEAPON && g_player[p].ps->ammo_amount[g_player[p].ps->curr_weapon] >= 0)) - { - for (x=0; x<8; x++) - { - j = A_InsertSprite(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(s->zvel>>2),i,5); - sprite[j].pal = 6; - } - - A_PlaySound(SLIM_DYING,i); - A_PlaySound(SQUISHED,i); - if ((krand()&255) < 32) - { - j = A_Spawn(i,BLOODPOOL); - sprite[j].pal = 0; - } - g_player[p].ps->actors_killed ++; - t[0] = -3; - if (g_player[p].ps->somethingonplayer == i) - g_player[p].ps->somethingonplayer = -1; - KILLIT(i); - } - - s->z = g_player[p].ps->pos.z+g_player[p].ps->pyoff-t[2]+(8<<8); - - s->z += (100-g_player[p].ps->horiz)<<4; - - if (t[2] > 512) - t[2] -= 128; - - if (t[2] < 348) - t[2] += 128; - - if (g_player[p].ps->newowner >= 0) - { - g_player[p].ps->newowner = -1; - g_player[p].ps->pos.x = g_player[p].ps->opos.x; - g_player[p].ps->pos.y = g_player[p].ps->opos.y; - g_player[p].ps->pos.z = g_player[p].ps->opos.z; - g_player[p].ps->ang = g_player[p].ps->oang; - - updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&g_player[p].ps->cursectnum); - P_UpdateScreenPal(g_player[p].ps); - - j = headspritestat[STAT_ACTOR]; - while (j >= 0) - { - if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; - j = nextspritestat[j]; - } - } - - if (t[3]>0) - { - static char frames[] = {5,5,6,6,7,7,6,5}; - - s->picnum = GREENSLIME+frames[t[3]]; - - if (t[3] == 5) - { - sprite[g_player[p].ps->i].extra += -(5+(krand()&3)); - A_PlaySound(SLIM_ATTACK,i); - } - - if (t[3] < 7) t[3]++; - else t[3] = 0; - - } - else - { - s->picnum = GREENSLIME+5; - if (rnd(32)) - t[3] = 1; - } - - s->xrepeat = 20+(sintable[t[1]&2047]>>13); - s->yrepeat = 15+(sintable[t[1]&2047]>>13); - - s->x = g_player[p].ps->pos.x + (sintable[(g_player[p].ps->ang+512)&2047]>>7); - s->y = g_player[p].ps->pos.y + (sintable[g_player[p].ps->ang&2047]>>7); - - goto BOLT; - } - - else if (s->xvel < 64 && x < 768) - { - if (g_player[p].ps->somethingonplayer == -1) - { - g_player[p].ps->somethingonplayer = i; - if (t[0] == 3 || t[0] == 2) //Falling downward - t[2] = (12<<8); - else t[2] = -(13<<8); //Climbing up duke - t[0] = -4; - } - } - - if ((j = A_IncurDamage(i)) >= 0) - { - A_PlaySound(SLIM_DYING,i); - - g_player[p].ps->actors_killed ++; - if (g_player[p].ps->somethingonplayer == i) - g_player[p].ps->somethingonplayer = -1; - - if (j == FREEZEBLAST) - { - A_PlaySound(SOMETHINGFROZE,i); - t[0] = -5 ; - t[3] = 0 ; - goto BOLT; - } - - if ((krand()&255) < 32) - { - j = A_Spawn(i,BLOODPOOL); - sprite[j].pal = 0; - } - - for (x=0; x<8; x++) - { - j = A_InsertSprite(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(s->zvel>>2),i,5); - sprite[j].pal = 6; - } - t[0] = -3; - KILLIT(i); - } - // All weap - if (t[0] == -1) //Shrinking down - { - A_Fall(i); - - s->cstat &= 65535-8; - s->picnum = GREENSLIME+4; - - // if(s->yrepeat > 62) - // A_DoGuts(s,JIBS6,5,myconnectindex); - - if (s->xrepeat > 32) s->xrepeat -= krand()&7; - if (s->yrepeat > 16) s->yrepeat -= krand()&7; - else - { - s->xrepeat = 40; - s->yrepeat = 16; - t[5] = -1; - t[0] = 0; - } - - goto BOLT; - } - else if (t[0] != -2) A_GetZLimits(i); - - if (t[0] == -2) //On top of somebody - { - A_Fall(i); - sprite[t[5]].xvel = 0; - - l = sprite[t[5]].ang; - - s->z = sprite[t[5]].z; - s->x = sprite[t[5]].x+(sintable[(l+512)&2047]>>11); - s->y = sprite[t[5]].y+(sintable[l&2047]>>11); - - s->picnum = GREENSLIME+2+(g_globalRandom&1); - - if (s->yrepeat < 64) s->yrepeat+=2; - else - { - if (s->xrepeat < 32) s->xrepeat += 4; - else - { - t[0] = -1; - x = ldist(s,&sprite[t[5]]); - if (x < 768) - { - sprite[t[5]].xrepeat = 0; - - // JBF 20041129: a slimer eating another enemy really ought - // to decrease the maximum kill count by one. - if (sprite[t[5]].extra > 0) g_player[myconnectindex].ps->max_actors_killed--; - } - } - } - - goto BOLT; - } - - //Check randomly to see of there is an actor near - if (rnd(32)) - { - j = headspritesect[sect]; - while (j>=0) - { - switch (DynamicTileMap[sprite[j].picnum]) - { - case LIZTROOP__STATIC: - case LIZMAN__STATIC: - case PIGCOP__STATIC: - case NEWBEAST__STATIC: - if (ldist(s,&sprite[j]) < 768 && (klabs(s->z-sprite[j].z)<8192)) //Gulp them - { - t[5] = j; - t[0] = -2; - t[1] = 0; - goto BOLT; - } - } - - j = nextspritesect[j]; - } - } - - //Moving on the ground or ceiling - - if (t[0] == 0 || t[0] == 2) - { - s->picnum = GREENSLIME; - - if ((krand()&511) == 0) - A_PlaySound(SLIM_ROAM,i); - - if (t[0]==2) - { - s->zvel = 0; - s->cstat &= (65535-8); - - if ((sector[sect].ceilingstat&1) || (actor[i].ceilingz+6144) < s->z) - { - s->z += 2048; - t[0] = 3; - goto BOLT; - } - } - else - { - s->cstat |= 8; - A_Fall(i); - } - - if (everyothertime&1) A_SetSprite(i,CLIPMASK0); - - if (s->xvel > 96) - { - s->xvel -= 2; - goto BOLT; - } - else - { - if (s->xvel < 32) s->xvel += 4; - s->xvel = 64 - (sintable[(t[1]+512)&2047]>>9); - - s->ang += G_GetAngleDelta(s->ang, - getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>3; - // TJR - } - - s->xrepeat = 36 + (sintable[(t[1]+512)&2047]>>11); - s->yrepeat = 16 + (sintable[t[1]&2047]>>13); - - if (rnd(4) && (sector[sect].ceilingstat&1) == 0 && - klabs(actor[i].floorz-actor[i].ceilingz) - < (192<<8)) - { - s->zvel = 0; - t[0]++; - } - - } - - if (t[0]==1) - { - s->picnum = GREENSLIME; - if (s->yrepeat < 40) s->yrepeat+=8; - if (s->xrepeat > 8) s->xrepeat-=4; - if (s->zvel > -(2048+1024)) - s->zvel -= 348; - s->z += s->zvel; - if (s->z < actor[i].ceilingz+4096) - { - s->z = actor[i].ceilingz+4096; - s->xvel = 0; - t[0] = 2; - } - } - - if (t[0]==3) - { - s->picnum = GREENSLIME+1; - - A_Fall(i); - - if (s->z > actor[i].floorz-(8<<8)) - { - s->yrepeat-=4; - s->xrepeat+=2; - } - else - { - if (s->yrepeat < (40-4)) s->yrepeat+=8; - if (s->xrepeat > 8) s->xrepeat-=4; - } - - if (s->z > actor[i].floorz-2048) - { - s->z = actor[i].floorz-2048; - t[0] = 0; - s->xvel = 0; - } - } - goto BOLT; - - case BOUNCEMINE__STATIC: - case MORTER__STATIC: - j = A_Spawn(i,(PLUTOPAK?FRAMEEFFECT1:FRAMEEFFECT1_13)); - actor[j].t_data[0] = 3; - - case HEAVYHBOMB__STATIC: - - if ((s->cstat&32768)) - { - t[2]--; - if (t[2] <= 0) - { - A_PlaySound(TELEPORTER,i); - A_Spawn(i,TRANSPORTERSTAR); - s->cstat = 257; - } - goto BOLT; - } - - p = A_FindPlayer(s,&x); - - if (x < 1220) s->cstat &= ~257; - else s->cstat |= 257; - - if (t[3] == 0) - { - j = A_IncurDamage(i); - if (j >= 0) - { - t[3] = 1; - t[2] = 0; - l = 0; - s->xvel = 0; - goto DETONATEB; - } - } - - if (s->picnum != BOUNCEMINE) - { - A_Fall(i); - - if ((sector[sect].lotag != 1 || actor[i].floorz != sector[sect].floorz) && s->z >= actor[i].floorz-(ZOFFSET) && s->yvel < 3) - { - if (s->yvel > 0 || (s->yvel == 0 && actor[i].floorz == sector[sect].floorz)) - A_PlaySound(PIPEBOMB_BOUNCE,i); - s->zvel = -((4-s->yvel)<<8); - if (sector[s->sectnum].lotag== 2) - s->zvel >>= 2; - s->yvel++; - } - if (s->z < actor[i].ceilingz) // && sector[sect].lotag != 2 ) - { - s->z = actor[i].ceilingz+(3<<8); - s->zvel = 0; - } - } - - { - vec3_t tmpvect; - - tmpvect.x = (s->xvel*(sintable[(s->ang+512)&2047]))>>14; - tmpvect.y = (s->xvel*(sintable[s->ang&2047]))>>14; - tmpvect.z = s->zvel; - j = A_MoveSprite(i,&tmpvect,CLIPMASK0); - } - - actor[i].movflag = j; - - if (sector[SECT].lotag == 1 && s->zvel == 0 && actor[i].floorz == sector[sect].floorz) - { - s->z += (32<<8); - if (t[5] == 0) - { - t[5] = 1; - A_Spawn(i,WATERSPLASH2); - } - } - else t[5] = 0; - - if (t[3] == 0 && (s->picnum == BOUNCEMINE || s->picnum == MORTER) && (j || x < 844)) - { - t[3] = 1; - t[2] = 0; - l = 0; - s->xvel = 0; - goto DETONATEB; - } - - if (sprite[s->owner].picnum == APLAYER) - l = sprite[s->owner].yvel; - else l = -1; - - if (s->xvel > 0) - { - s->xvel -= 5; - if (sector[sect].lotag == 2) - s->xvel -= 10; - - if (s->xvel < 0) - s->xvel = 0; - if (s->xvel&8) s->cstat ^= 4; - } - - if ((j&49152) == 32768) - { - vec3_t davect; - - j &= (MAXWALLS-1); - - Bmemcpy(&davect, s, sizeof(vec3_t)); - A_DamageWall(i,j,&davect,s->picnum); - - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - - s->ang = ((k<<1) - s->ang)&2047; - s->xvel >>= 1; - } - - // int32_t lPipeBombControl=Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, -1); - -DETONATEB: - - // if(lPipeBombControl & PIPEBOMB_TIMER) - // { - - if (s->picnum == HEAVYHBOMB && t[6] == 1) - { - /* if(s->extra >= 1) - { - s->extra--; - } - - if(s->extra <= 0) - s->lotag=911; - */ - - if (t[7] > 0) - t[7]--; - - if (t[7] == 0) - t[6] = 3; - } - // } - - if ((l >= 0 && g_player[l].ps->hbomb_on == 0 && t[6] == 2) || t[3] == 1) - t[6] = 3; - - if (t[6] == 3) - { - t[2]++; - - if (t[2] == 2) - { - int32_t j; - - x = s->extra; - m = 0; - switch (DynamicTileMap[s->picnum]) - { - case HEAVYHBOMB__STATIC: - m = g_pipebombBlastRadius; - break; - case MORTER__STATIC: - m = g_morterBlastRadius; - break; - case BOUNCEMINE__STATIC: - m = g_bouncemineBlastRadius; - break; - } - - A_RadiusDamage(i, m,x>>2,x>>1,x-(x>>2),x); - j = A_Spawn(i,EXPLOSION2); - A_PlaySound(PIPEBOMB_EXPLODE,j); - if (s->zvel == 0) - A_Spawn(i,EXPLOSION2BOT); - for (x=0; x<8; x++) - RANDOMSCRAP; - } - - if (s->yrepeat) - { - s->yrepeat = 0; - goto BOLT; - } - - if (t[2] > 20) - { - if (s->owner != i || ud.respawn_items == 0) - { - KILLIT(i); - } - else - { - t[2] = g_itemRespawnTime; - A_Spawn(i,RESPAWNMARKERRED); - s->cstat = (int16_t) 32768; - s->yrepeat = 9; - goto BOLT; - } - } - } - else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0) - if (cansee(s->x,s->y,s->z-(8<<8),s->sectnum,g_player[p].ps->pos.x,g_player[p].ps->pos.y,g_player[p].ps->pos.z,g_player[p].ps->cursectnum)) - if (g_player[p].ps->ammo_amount[HANDBOMB_WEAPON] < g_player[p].ps->max_ammo_amount[HANDBOMB_WEAPON]) - { - if ((GametypeFlags[ud.coop] & GAMETYPE_WEAPSTAY) && s->owner == i) - { - for (j=0; jweapreccnt; j++) - if (g_player[p].ps->weaprecs[j] == s->picnum) - goto BOLT; - - if (g_player[p].ps->weapreccnt < MAX_WEAPONS) - g_player[p].ps->weaprecs[g_player[p].ps->weapreccnt++] = s->picnum; - } - - P_AddAmmo(HANDBOMB_WEAPON,g_player[p].ps,1); - A_PlaySound(DUKE_GET,g_player[p].ps->i); - - if ((g_player[p].ps->gotweapon & (1<owner == g_player[p].ps->i) - { - /* P_AddWeapon(g_player[p].ps,HANDBOMB_WEAPON); */ - if (!(g_player[p].ps->weaponswitch & 1) && *aplWeaponWorksLike[g_player[p].ps->curr_weapon] != HANDREMOTE_WEAPON) - P_AddWeaponNoSwitch(g_player[p].ps,HANDBOMB_WEAPON); - else P_AddWeapon(g_player[p].ps,HANDBOMB_WEAPON); - } - - if (sprite[s->owner].picnum != APLAYER) - { - g_player[p].ps->pals.r = 0; - g_player[p].ps->pals.g = 32; - g_player[p].ps->pals.b = 0; - g_player[p].ps->pals.f = 32; - } - - if (s->owner != i || ud.respawn_items == 0) - { - if (s->owner == i && (GametypeFlags[ud.coop] & GAMETYPE_WEAPSTAY)) - goto BOLT; - KILLIT(i); - } - else - { - t[2] = g_itemRespawnTime; - A_Spawn(i,RESPAWNMARKERRED); - s->cstat = (int16_t) 32768; - } - } - - if (t[0] < 8) t[0]++; - goto BOLT; - - case REACTORBURNT__STATIC: - case REACTOR2BURNT__STATIC: - goto BOLT; - - case REACTOR__STATIC: - case REACTOR2__STATIC: - - if (t[4] == 1) - { - j = headspritesect[sect]; - while (j >= 0) - { - switch (DynamicTileMap[sprite[j].picnum]) - { - case SECTOREFFECTOR__STATIC: - if (sprite[j].lotag == 1) - { - sprite[j].lotag = (int16_t) 65535; - sprite[j].hitag = (int16_t) 65535; - } - break; - case REACTOR__STATIC: - sprite[j].picnum = REACTORBURNT; - break; - case REACTOR2__STATIC: - sprite[j].picnum = REACTOR2BURNT; - break; - case REACTORSPARK__STATIC: - case REACTOR2SPARK__STATIC: - sprite[j].cstat = (int16_t) 32768; - break; - } - j = nextspritesect[j]; - } - goto BOLT; - } - - if (t[1] >= 20) - { - t[4] = 1; - goto BOLT; - } - - p = A_FindPlayer(s,&x); - - t[2]++; - if (t[2] == 4) t[2]=0; - - if (x < 4096) - { - if ((krand()&255) < 16) - { - if (!A_CheckSoundPlaying(g_player[p].ps->i, DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN,g_player[p].ps->i); - - A_PlaySound(SHORT_CIRCUIT,i); - - sprite[g_player[p].ps->i].extra --; - g_player[p].ps->pals.f = 32; - g_player[p].ps->pals.r = 32; - g_player[p].ps->pals.g = 0; - g_player[p].ps->pals.b = 0; - } - t[0] += 128; - if (t[3] == 0) - t[3] = 1; - } - else t[3] = 0; - - if (t[1]) - { - t[1]++; - - t[4] = s->z; - s->z = sector[sect].floorz-(krand()%(sector[sect].floorz-sector[sect].ceilingz)); - - switch (t[1]) - { - case 3: - //Turn on all of those flashing sectoreffector. - A_RadiusDamage(i, 4096, - g_impactDamage<<2, - g_impactDamage<<2, - g_impactDamage<<2, - g_impactDamage<<2); - /* - j = headspritestat[STAT_EFFECTOR]; - while(j>=0) - { - if( sprite[j].lotag == 3 ) - Actor[j].t_data[4]=1; - else if(sprite[j].lotag == 12) - { - Actor[j].t_data[4] = 1; - sprite[j].lotag = 3; - sprite[j].owner = 0; - Actor[j].t_data[0] = s->shade; - } - j = nextspritestat[j]; - } - */ - j = headspritestat[STAT_STANDABLE]; - while (j >= 0) - { - if (sprite[j].picnum == MASTERSWITCH) - if (sprite[j].hitag == s->hitag) - if (sprite[j].yvel == 0) - sprite[j].yvel = 1; - j = nextspritestat[j]; - } - break; - - case 4: - case 7: - case 10: - case 15: - j = headspritesect[sect]; - while (j >= 0) - { - l = nextspritesect[j]; - - if (j != i) - { - deletesprite(j); - break; - } - j = l; - } - break; - } - for (x=0; x<16; x++) - RANDOMSCRAP; - - s->z = t[4]; - t[4] = 0; - - } - else - { - if ((j = A_IncurDamage(i)) >= 0) - { - for (x=0; x<32; x++) - RANDOMSCRAP; - if (s->extra < 0) - t[1] = 1; - } - } - goto BOLT; - - case CAMERA1__STATIC: - - if (t[0] == 0) - { - t[1]+=8; - if (g_damageCameras) - { - if ((j = A_IncurDamage(i)) >= 0) - { - t[0] = 1; // static - s->cstat = (int16_t)32768; - for (x=0; x<5; x++) RANDOMSCRAP; - goto BOLT; - } - } - - if (s->hitag > 0) - { - if (t[1]hitag) - s->ang+=8; - else if (t[1]<(s->hitag*3)) - s->ang-=8; - else if (t[1] < (s->hitag<<2)) - s->ang+=8; - else - { - t[1]=8; - s->ang+=16; - } - } - } - goto BOLT; - } - - if (!g_netServer && (!g_netServer && ud.multimode < 2) && A_CheckEnemySprite(s)) - { - if (g_noEnemies == 1) - { - s->cstat = (int16_t)32768; - goto BOLT; - } - else if (g_noEnemies == 2) - { - s->cstat = 0; - if (s->extra) - s->cstat = 257; - } - } - - if (!actorscrptr[sprite[i].picnum]) - goto BOLT; - p = A_FindPlayer(s,&x); - A_Execute(i,p,x); -BOLT: - i = nexti; - } - -} - -ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 -{ - int16_t i, j, nexti, sect, p; - int32_t l, x; - intptr_t *t; - spritetype *s; - int32_t switchpicnum; - - i = headspritestat[STAT_MISC]; - while (i >= 0) - { - nexti = nextspritestat[i]; - - t = &actor[i].t_data[0]; - s = &sprite[i]; - sect = s->sectnum; - - if (sect < 0 || s->xrepeat == 0) KILLIT(i); - - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); - - switchpicnum = s->picnum; - if ((s->picnum > NUKEBUTTON)&&(s->picnum <= NUKEBUTTON+3)) - { - switchpicnum = NUKEBUTTON; - } - if ((s->picnum > GLASSPIECES)&&(s->picnum <= GLASSPIECES+2)) - { - switchpicnum = GLASSPIECES; - } - if (s->picnum ==INNERJAW+1) - { - switchpicnum--; - } - if ((s->picnum == MONEY+1) || (s->picnum == MAIL+1) || (s->picnum == PAPER+1)) - actor[i].floorz = s->z = getflorzofslope(s->sectnum,s->x,s->y); - else switch (DynamicTileMap[switchpicnum]) - { - case APLAYER__STATIC: - s->cstat = 32768; - goto BOLT; - case NEON1__STATIC: - case NEON2__STATIC: - case NEON3__STATIC: - case NEON4__STATIC: - case NEON5__STATIC: - case NEON6__STATIC: - - if ((g_globalRandom/(s->lotag+1)&31) > 4) s->shade = -127; - else s->shade = 127; - goto BOLT; - - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: - - if (t[0] == 7*GAMETICSPERSEC) goto BOLT; - s->z += 16+(krand()&15); - t[0]++; - if ((t[0]%9) == 0) s->yrepeat++; - goto BOLT; - - case NUKEBUTTON__STATIC: - // case NUKEBUTTON+1: - // case NUKEBUTTON+2: - // case NUKEBUTTON+3: - - if (t[0]) - { - t[0]++; - if (t[0] == 8) s->picnum = NUKEBUTTON+1; - else if (t[0] == 16) - { - s->picnum = NUKEBUTTON+2; - g_player[sprite[s->owner].yvel].ps->fist_incs = 1; - } - if (g_player[sprite[s->owner].yvel].ps->fist_incs == GAMETICSPERSEC) - s->picnum = NUKEBUTTON+3; - } - goto BOLT; - - case FORCESPHERE__STATIC: - - l = s->xrepeat; - if (t[1] > 0) - { - t[1]--; - if (t[1] == 0) - { - KILLIT(i); - } - } - if (actor[s->owner].t_data[1] == 0) - { - if (t[0] < 64) - { - t[0]++; - l += 3; - } - } - else if (t[0] > 64) - { - t[0]--; - l -= 3; - } - - s->x = sprite[s->owner].x; - s->y = sprite[s->owner].y; - s->z = sprite[s->owner].z; - s->ang += actor[s->owner].t_data[0]; - - if (l > 64) l = 64; - else if (l < 1) l = 1; - - s->xrepeat = l; - s->yrepeat = l; - s->shade = (l>>1)-48; - - for (j=t[0]; j > 0; j--) - A_SetSprite(i,CLIPMASK0); - goto BOLT; - case WATERSPLASH2__STATIC: - - t[0]++; - if (t[0] == 1) - { - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) - KILLIT(i); - /* else - { - l = getflorzofslope(sect,s->x,s->y)-s->z; - if( l > (16<<8) ) KILLIT(i); - } - else */ - if (!S_CheckSoundPlaying(i,ITEM_SPLASH)) - A_PlaySound(ITEM_SPLASH,i); - } - if (t[0] == 3) - { - t[0] = 0; - t[1]++; - } - if (t[1] == 5) - deletesprite(i); - goto BOLT; - case FRAMEEFFECT1_13__STATIC: - if (PLUTOPAK) goto BOLT; // JBF: ideally this should never happen... - case FRAMEEFFECT1__STATIC: - - if (s->owner >= 0) - { - t[0]++; - - if (t[0] > 7) - { - KILLIT(i); - } - else if (t[0] > 4) - s->cstat |= 512+2; - else if (t[0] > 2) - s->cstat |= 2; - s->xoffset = sprite[s->owner].xoffset; - s->yoffset = sprite[s->owner].yoffset; - } - goto BOLT; - case INNERJAW__STATIC: - // case INNERJAW+1: - - p = A_FindPlayer(s,&x); - if (x < 512) - { - g_player[p].ps->pals.f = 32; - g_player[p].ps->pals.r = 32; - g_player[p].ps->pals.g = 0; - g_player[p].ps->pals.b = 0; - sprite[g_player[p].ps->i].extra -= 4; - } - - case FIRELASER__STATIC: - if (s->extra != 5) - s->extra = 5; - else KILLIT(i); - break; - case TONGUE__STATIC: - KILLIT(i); - - case MONEY__STATIC: - case MAIL__STATIC: - case PAPER__STATIC: - - s->xvel = (krand()&7)+(sintable[T1&2047]>>9); - T1 += (krand()&63); - if ((T1&2047) > 512 && (T1&2047) < 1596) - { - if (sector[sect].lotag == 2) - { - if (s->zvel < 64) - s->zvel += (g_spriteGravity>>5)+(krand()&7); - } - else if (s->zvel < 144) - s->zvel += (g_spriteGravity>>5)+(krand()&7); - } - - A_SetSprite(i,CLIPMASK0); - - if ((krand()&3) == 0) - setsprite(i,(vec3_t *)s); - - if (s->sectnum == -1) KILLIT(i); - l = getflorzofslope(s->sectnum,s->x,s->y); - - if (s->z > l) - { - s->z = l; - - A_AddToDeleteQueue(i); - PN ++; - - j = headspritestat[STAT_MISC]; - while (j >= 0) - { - if (sprite[j].picnum == BLOODPOOL) - if (ldist(s,&sprite[j]) < 348) - { - s->pal = 2; - break; - } - j = nextspritestat[j]; - } - } - - break; - - case JIBS1__STATIC: - case JIBS2__STATIC: - case JIBS3__STATIC: - case JIBS4__STATIC: - case JIBS5__STATIC: - case JIBS6__STATIC: - case HEADJIB1__STATIC: - case ARMJIB1__STATIC: - case LEGJIB1__STATIC: - case LIZMANHEAD1__STATIC: - case LIZMANARM1__STATIC: - case LIZMANLEG1__STATIC: - case DUKETORSO__STATIC: - case DUKEGUN__STATIC: - case DUKELEG__STATIC: - - if (s->xvel > 0) s->xvel--; - else s->xvel = 0; - - if (++t[5] == (30*10)) - KILLIT(i); - - if (s->zvel > 1024 && s->zvel < 1280) - { - setsprite(i,(vec3_t *)s); - sect = s->sectnum; - } - - getzsofslope(sect,s->x,s->y,&x,&l); - if (x == l || sect < 0 || sect >= MAXSECTORS) KILLIT(i); - - if (s->z < l-(2<<8)) - { - if (t[1] < 2) t[1]++; - else if (sector[sect].lotag != 2) - { - t[1] = 0; - if (s->picnum == DUKELEG || s->picnum == DUKETORSO || s->picnum == DUKEGUN) - { - if (t[0] > 6) t[0] = 0; - else t[0]++; - } - else - { - if (t[0] > 2) - t[0] = 0; - else t[0]++; - } - } - - if (s->zvel < 6144) - { - if (sector[sect].lotag == 2) - { - if (s->zvel < 1024) - s->zvel += 48; - else s->zvel = 1024; - } - else s->zvel += g_spriteGravity-50; - } - - s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14; - s->y += (s->xvel*sintable[s->ang&2047])>>14; - s->z += s->zvel; - - } - else - { - if (t[2] == 0) - { - if (s->sectnum == -1) - { - KILLIT(i); - } - if ((sector[s->sectnum].floorstat&2)) - { - KILLIT(i); - } - t[2]++; - } - l = getflorzofslope(s->sectnum,s->x,s->y); - - s->z = l-(2<<8); - s->xvel = 0; - - if (s->picnum == JIBS6) - { - t[1]++; - if ((t[1]&3) == 0 && t[0] < 7) - t[0]++; - if (t[1] > 20) KILLIT(i); - } - else - { - s->picnum = JIBS6; - t[0] = 0; - t[1] = 0; - } - - } - goto BOLT; - - case BLOODPOOL__STATIC: - case PUKE__STATIC: - - if (t[0] == 0) - { - t[0] = 1; - if (sector[sect].floorstat&2) - { - KILLIT(i); - } - else A_AddToDeleteQueue(i); - } - - A_Fall(i); - - p = A_FindPlayer(s,&x); - - s->z = actor[i].floorz-(ZOFFSET); - - if (t[2] < 32) - { - t[2]++; - if (actor[i].picnum == TIRE) - { - if (s->xrepeat < 64 && s->yrepeat < 64) - { - s->xrepeat += krand()&3; - s->yrepeat += krand()&3; - } - } - else - { - if (s->xrepeat < 32 && s->yrepeat < 32) - { - s->xrepeat += krand()&3; - s->yrepeat += krand()&3; - } - } - } - - if (x < 844 && s->xrepeat > 6 && s->yrepeat > 6) - { - if (s->pal == 0 && (krand()&255) < 16 && s->picnum != PUKE) - { - if (g_player[p].ps->inv_amount[GET_BOOTS] > 0) - g_player[p].ps->inv_amount[GET_BOOTS]--; - else - { - if (!A_CheckSoundPlaying(g_player[p].ps->i,DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN,g_player[p].ps->i); - sprite[g_player[p].ps->i].extra --; - g_player[p].ps->pals.f = 32; - g_player[p].ps->pals.r = 16; - g_player[p].ps->pals.g = 0; - g_player[p].ps->pals.b = 0; - } - } - - if (t[1] == 1) goto BOLT; - t[1] = 1; - - if (actor[i].picnum == TIRE) - g_player[p].ps->footprintcount = 10; - else g_player[p].ps->footprintcount = 3; - - g_player[p].ps->footprintpal = s->pal; - g_player[p].ps->footprintshade = s->shade; - - if (t[2] == 32) - { - s->xrepeat -= 6; - s->yrepeat -= 6; - } - } - else t[1] = 0; - goto BOLT; - - case BURNING__STATIC: - case BURNING2__STATIC: - case FECES__STATIC: - case WATERBUBBLE__STATIC: - case SMALLSMOKE__STATIC: - case EXPLOSION2__STATIC: - case SHRINKEREXPLOSION__STATIC: - case EXPLOSION2BOT__STATIC: - case BLOOD__STATIC: - case LASERSITE__STATIC: - case FORCERIPPLE__STATIC: - case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - { - if (!actorscrptr[sprite[i].picnum]) - goto BOLT; - p = A_FindPlayer(s,&x); - A_Execute(i,p,x); - goto BOLT; - } - - case SHELL__STATIC: - case SHOTGUNSHELL__STATIC: - - A_SetSprite(i,CLIPMASK0); - - if (sect < 0 || (sector[sect].floorz + 256) < s->z) KILLIT(i); - - if (sector[sect].lotag == 2) - { - t[1]++; - if (t[1] > 8) - { - t[1] = 0; - t[0]++; - t[0] &= 3; - } - if (s->zvel < 128) s->zvel += (g_spriteGravity/13); // 8 - else s->zvel -= 64; - if (s->xvel > 0) - s->xvel -= 4; - else s->xvel = 0; - } - else - { - t[1]++; - if (t[1] > 3) - { - t[1] = 0; - t[0]++; - t[0] &= 3; - } - if (s->zvel < 512) s->zvel += (g_spriteGravity/3); // 52; - if (s->xvel > 0) - s->xvel --; - // else KILLIT(i); - } - - goto BOLT; - - case GLASSPIECES__STATIC: - // case GLASSPIECES+1: - // case GLASSPIECES+2: - - A_Fall(i); - - if (s->zvel > 4096) s->zvel = 4096; - if (sect < 0) KILLIT(i); - - if (s->z == actor[i].floorz-(ZOFFSET) && t[0] < 3) - { - s->zvel = -((3-t[0])<<8)-(krand()&511); - if (sector[sect].lotag == 2) - s->zvel >>= 1; - s->xrepeat >>= 1; - s->yrepeat >>= 1; - if (rnd(96)) - setsprite(i,(vec3_t *)s); - t[0]++;//Number of bounces - } - else if (t[0] == 3) KILLIT(i); - - if (s->xvel > 0) - { - s->xvel -= 2; - s->cstat = ((s->xvel&3)<<2); - } - else s->xvel = 0; - - A_SetSprite(i,CLIPMASK0); - - goto BOLT; - } - - IFWITHIN(SCRAP6,SCRAP5+3) - { - if (s->xvel > 0) - s->xvel--; - else s->xvel = 0; - - if (s->zvel > 1024 && s->zvel < 1280) - { - setsprite(i,(vec3_t *)s); - sect = s->sectnum; - } - - if (s->z < sector[sect].floorz-(2<<8)) - { - if (t[1] < 1) t[1]++; - else - { - t[1] = 0; - - if (s->picnum < SCRAP6+8) - { - if (t[0] > 6) - t[0] = 0; - else t[0]++; - } - else - { - if (t[0] > 2) - t[0] = 0; - else t[0]++; - } - } - if (s->zvel < 4096) s->zvel += g_spriteGravity-50; - s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14; - s->y += (s->xvel*sintable[s->ang&2047])>>14; - s->z += s->zvel; - } - else - { - if (s->picnum == SCRAP1 && s->yvel > 0) - { - j = A_Spawn(i,s->yvel); - setsprite(j,(vec3_t *)s); - A_GetZLimits(j); - sprite[j].hitag = sprite[j].lotag = 0; - } - KILLIT(i); - } - goto BOLT; - } - -BOLT: - i = nexti; - } -} - -ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 -{ - int32_t q=0, m, x, st, j; - intptr_t *t,l; - int32_t i = headspritestat[STAT_EFFECTOR], nexti, nextk, p, sh, nextj; - int16_t k; - spritetype *s; - sectortype *sc; - walltype *wal; - - fricxv = fricyv = 0; - - while (i >= 0) - { - nexti = nextspritestat[i]; - s = &sprite[i]; - - sc = §or[s->sectnum]; - st = s->lotag; - sh = s->hitag; - - t = &actor[i].t_data[0]; - - switch (st) - { - case 0: - { - int32_t zchange = 0; - - zchange = 0; - - j = s->owner; - - if (sprite[j].lotag == (int16_t) 65535) - KILLIT(i); - - q = sc->extra>>3; - l = 0; - - if (sc->lotag == 30) - { - q >>= 2; - - if (sprite[i].extra == 1) - { - if (actor[i].tempang < 256) - { - actor[i].tempang += 4; - if (actor[i].tempang >= 256) - A_CallSound(s->sectnum,i); - if (s->clipdist) l = 1; - else l = -1; - } - else actor[i].tempang = 256; - - if (sc->floorz > s->z) //z's are touching - { - sc->floorz -= 512; - zchange = -512; - if (sc->floorz < s->z) - sc->floorz = s->z; - } - - else if (sc->floorz < s->z) //z's are touching - { - sc->floorz += 512; - zchange = 512; - if (sc->floorz > s->z) - sc->floorz = s->z; - } - } - else if (sprite[i].extra == 3) - { - if (actor[i].tempang > 0) - { - actor[i].tempang -= 4; - if (actor[i].tempang <= 0) - A_CallSound(s->sectnum,i); - if (s->clipdist) l = -1; - else l = 1; - } - else actor[i].tempang = 0; - - if (sc->floorz > T4) //z's are touching - { - sc->floorz -= 512; - zchange = -512; - if (sc->floorz < T4) - sc->floorz = T4; - } - - else if (sc->floorz < T4) //z's are touching - { - sc->floorz += 512; - zchange = 512; - if (sc->floorz > T4) - sc->floorz = T4; - } - } - - s->ang += (l*q); - t[2] += (l*q); - } - else - { - if (actor[j].t_data[0] == 0) break; - if (actor[j].t_data[0] == 2) KILLIT(i); - - if (sprite[j].ang > 1024) - l = -1; - else l = 1; - if (t[3] == 0) - t[3] = ldist(s,&sprite[j]); - s->xvel = t[3]; - s->x = sprite[j].x; - s->y = sprite[j].y; - s->ang += (l*q); - t[2] += (l*q); - } - - if (l && (sc->floorstat&64)) - { - TRAVERSE_CONNECT(p) - { - if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground == 1) - { - - g_player[p].ps->ang += (l*q); - g_player[p].ps->ang &= 2047; - - g_player[p].ps->pos.z += zchange; - - rotatepoint(sprite[j].x,sprite[j].y,g_player[p].ps->pos.x,g_player[p].ps->pos.y,(q*l),&m,&x); - - g_player[p].ps->bobposx += m-g_player[p].ps->pos.x; - g_player[p].ps->bobposy += x-g_player[p].ps->pos.y; - - g_player[p].ps->pos.x = m; - g_player[p].ps->pos.y = x; - - if (sprite[g_player[p].ps->i].extra <= 0) - { - sprite[g_player[p].ps->i].x = m; - sprite[g_player[p].ps->i].y = x; - } - } - } - - p = headspritesect[s->sectnum]; - while (p >= 0) - { - if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE) - if (sprite[p].picnum != LASERLINE) - { - if (sprite[p].picnum == APLAYER && sprite[p].owner >= 0) - { - p = nextspritesect[p]; - continue; - } - - sprite[p].ang += (l*q); - sprite[p].ang &= 2047; - - sprite[p].z += zchange; - - rotatepoint(sprite[j].x,sprite[j].y,sprite[p].x,sprite[p].y,(q*l),&sprite[p].x,&sprite[p].y); - } - p = nextspritesect[p]; - } - - } - - A_MoveSector(i); - } - - break; - case 1: //Nothing for now used as the pivot - if (s->owner == -1) //Init - { - s->owner = i; - - j = headspritestat[STAT_EFFECTOR]; - while (j >= 0) - { - if (sprite[j].lotag == 19 && sprite[j].hitag == sh) - { - t[0] = 0; - break; - } - j = nextspritestat[j]; - } - } - - break; - case 6: - k = sc->extra; - - if (t[4] > 0) - { - t[4]--; - if (t[4] >= (k-(k>>3))) - s->xvel -= (k>>5); - if (t[4] > ((k>>1)-1) && t[4] < (k-(k>>3))) - s->xvel = 0; - if (t[4] < (k>>1)) - s->xvel += (k>>5); - if (t[4] < ((k>>1)-(k>>3))) - { - t[4] = 0; - s->xvel = k; - } - } - else s->xvel = k; - - j = headspritestat[STAT_EFFECTOR]; - while (j >= 0) - { - if ((sprite[j].lotag == 14) && (sh == sprite[j].hitag) && (actor[j].t_data[0] == t[0])) - { - sprite[j].xvel = s->xvel; - // if( t[4] == 1 ) - { - if (actor[j].t_data[5] == 0) - actor[j].t_data[5] = dist(&sprite[j],s); - x = ksgn(dist(&sprite[j],s)-actor[j].t_data[5]); - if (sprite[j].extra) - x = -x; - s->xvel += x; - } - actor[j].t_data[4] = t[4]; - } - j = nextspritestat[j]; - } - x = 0; - - - case 14: - if (s->owner==-1) - s->owner = A_FindLocator((int16_t)t[3],(int16_t)t[0]); - - if (s->owner == -1) - { - Bsprintf(tempbuf,"Could not find any locators for SE# 6 and 14 with a hitag of %" PRIdPTR ".\n",t[3]); - G_GameExit(tempbuf); - } - - j = ldist(&sprite[s->owner],s); - - if (j < 1024L) - { - if (st==6) - if (sprite[s->owner].hitag&1) - t[4]=sc->extra; //Slow it down - t[3]++; - s->owner = A_FindLocator(t[3],t[0]); - if (s->owner==-1) - { - t[3]=0; - s->owner = A_FindLocator(0,t[0]); - } - } - - if (s->xvel) - { - x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - q = G_GetAngleDelta(s->ang,x)>>3; - - t[2] += q; - s->ang += q; - - if (s->xvel == sc->extra) - { - if ((sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0) - { - if (!S_CheckSoundPlaying(i,actor[i].lastvx)) - A_PlaySound(actor[i].lastvx,i); - } - else if (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat&1) && rnd(8)) - { - p = A_FindPlayer(s,&x); - if (x < 20480) - { - j = s->ang; - s->ang = getangle(s->x-g_player[p].ps->pos.x,s->y-g_player[p].ps->pos.y); - A_Shoot(i,RPG); - s->ang = j; - } - } - } - - if (s->xvel <= 64 && (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0) - S_StopEnvSound(actor[i].lastvx,i); - - if ((sc->floorz-sc->ceilingz) < (108<<8)) - { - if (ud.clipping == 0 && s->xvel >= 192) - TRAVERSE_CONNECT(p) - if (sprite[g_player[p].ps->i].extra > 0) - { - k = g_player[p].ps->cursectnum; - updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum)) - { - g_player[p].ps->pos.x = s->x; - g_player[p].ps->pos.y = s->y; - g_player[p].ps->cursectnum = s->sectnum; - - setsprite(g_player[p].ps->i,(vec3_t *)s); - P_QuickKill(g_player[p].ps); - } - } - } - - m = (s->xvel*sintable[(s->ang+512)&2047])>>14; - x = (s->xvel*sintable[s->ang&2047])>>14; - - TRAVERSE_CONNECT(p) - if (sector[g_player[p].ps->cursectnum].lotag != 2) - { - if (g_playerSpawnPoints[p].os == s->sectnum) - { - g_playerSpawnPoints[p].ox += m; - g_playerSpawnPoints[p].oy += x; - } - - if (s->sectnum == sprite[g_player[p].ps->i].sectnum) - { - rotatepoint(s->x,s->y,g_player[p].ps->pos.x,g_player[p].ps->pos.y,q,&g_player[p].ps->pos.x,&g_player[p].ps->pos.y); - - g_player[p].ps->pos.x += m; - g_player[p].ps->pos.y += x; - - g_player[p].ps->bobposx += m; - g_player[p].ps->bobposy += x; - - g_player[p].ps->ang += q; - - if (g_netServer || numplayers > 1) - { - g_player[p].ps->opos.x = g_player[p].ps->pos.x; - g_player[p].ps->opos.y = g_player[p].ps->pos.y; - } - if (sprite[g_player[p].ps->i].extra <= 0) - { - sprite[g_player[p].ps->i].x = g_player[p].ps->pos.x; - sprite[g_player[p].ps->i].y = g_player[p].ps->pos.y; - } - } - } - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].statnum != STAT_PLAYER && sector[sprite[j].sectnum].lotag != 2 && - (sprite[j].picnum != SECTOREFFECTOR || - (sprite[j].picnum == SECTOREFFECTOR && (sprite[j].lotag == 49||sprite[j].lotag == 50))) - && sprite[j].picnum != LOCATORS) - { - rotatepoint(s->x,s->y,sprite[j].x,sprite[j].y,q,&sprite[j].x,&sprite[j].y); - - sprite[j].x+= m; - sprite[j].y+= x; - - sprite[j].ang+=q; - - if (g_netServer || numplayers > 1) - { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; - } - } - j = nextspritesect[j]; - } - - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - - if ((sc->floorz-sc->ceilingz) < (108<<8)) - { - if (ud.clipping == 0 && s->xvel >= 192) - TRAVERSE_CONNECT(p) - if (sprite[g_player[p].ps->i].extra > 0) - { - k = g_player[p].ps->cursectnum; - updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum)) - { - g_player[p].ps->opos.x = g_player[p].ps->pos.x = s->x; - g_player[p].ps->opos.y = g_player[p].ps->pos.y = s->y; - g_player[p].ps->cursectnum = s->sectnum; - - setsprite(g_player[p].ps->i,(vec3_t *)s); - P_QuickKill(g_player[p].ps); - } - } - - j = headspritesect[sprite[OW].sectnum]; - while (j >= 0) - { - l = nextspritesect[j]; - if (sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]) && - sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) - { - k = sprite[j].sectnum; - updatesector(sprite[j].x,sprite[j].y,&k); - if (sprite[j].extra >= 0 && k == s->sectnum) - { - A_DoGutsDir(j,JIBS6,72); - A_PlaySound(SQUISHED,i); - deletesprite(j); - } - } - j = l; - } - } - } - - break; - - case 30: - if (s->owner == -1) - { - t[3] = !t[3]; - s->owner = A_FindLocator(t[3],t[0]); - } - else - { - - if (t[4] == 1) // Starting to go - { - if (ldist(&sprite[s->owner],s) < (2048-128)) - t[4] = 2; - else - { - if (s->xvel == 0) - G_OperateActivators(s->hitag+(!t[3]),-1); - if (s->xvel < 256) - s->xvel += 16; - } - } - if (t[4] == 2) - { - l = FindDistance2D(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - - if (l <= 128) - s->xvel = 0; - - if (s->xvel > 0) - s->xvel -= 16; - else - { - s->xvel = 0; - G_OperateActivators(s->hitag+(int16_t)t[3],-1); - s->owner = -1; - s->ang += 1024; - t[4] = 0; - G_OperateForceFields(i,s->hitag); - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) - { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; - } - j = nextspritesect[j]; - } - - } - } - } - - if (s->xvel) - { - l = (s->xvel*sintable[(s->ang+512)&2047])>>14; - x = (s->xvel*sintable[s->ang&2047])>>14; - - if ((sc->floorz-sc->ceilingz) < (108<<8)) - if (ud.clipping == 0) - TRAVERSE_CONNECT(p) - if (sprite[g_player[p].ps->i].extra > 0) - { - k = g_player[p].ps->cursectnum; - updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum)) - { - g_player[p].ps->pos.x = s->x; - g_player[p].ps->pos.y = s->y; - g_player[p].ps->cursectnum = s->sectnum; - - setsprite(g_player[p].ps->i,(vec3_t *)s); - P_QuickKill(g_player[p].ps); - } - } - - TRAVERSE_CONNECT(p) - { - if (sprite[g_player[p].ps->i].sectnum == s->sectnum) - { - g_player[p].ps->pos.x += l; - g_player[p].ps->pos.y += x; - - if (g_netServer || numplayers > 1) - { - g_player[p].ps->opos.x = g_player[p].ps->pos.x; - g_player[p].ps->opos.y = g_player[p].ps->pos.y; - } - - g_player[p].ps->bobposx += l; - g_player[p].ps->bobposy += x; - } - - if (g_playerSpawnPoints[p].os == s->sectnum) - { - g_playerSpawnPoints[p].ox += l; - g_playerSpawnPoints[p].oy += x; - } - } - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) - { - if (numplayers < 2 && !g_netServer) - { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; - } - - sprite[j].x += l; - sprite[j].y += x; - - if (g_netServer || numplayers > 1) - { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; - } - } - j = nextspritesect[j]; - } - - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - - if ((sc->floorz-sc->ceilingz) < (108<<8)) - { - if (ud.clipping == 0) - TRAVERSE_CONNECT(p) - if (sprite[g_player[p].ps->i].extra > 0) - { - k = g_player[p].ps->cursectnum; - updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum)) - { - g_player[p].ps->pos.x = s->x; - g_player[p].ps->pos.y = s->y; - - g_player[p].ps->opos.x = g_player[p].ps->pos.x; - g_player[p].ps->opos.y = g_player[p].ps->pos.y; - - g_player[p].ps->cursectnum = s->sectnum; - - setsprite(g_player[p].ps->i,(vec3_t *)s); - P_QuickKill(g_player[p].ps); - } - } - - j = headspritesect[sprite[OW].sectnum]; - while (j >= 0) - { - l = nextspritesect[j]; - if (sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]) && - sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) - { - // if(sprite[j].sectnum != s->sectnum) - { - k = sprite[j].sectnum; - updatesector(sprite[j].x,sprite[j].y,&k); - if (sprite[j].extra >= 0 && k == s->sectnum) - { - A_DoGutsDir(j,JIBS6,24); - A_PlaySound(SQUISHED,j); - deletesprite(j); - } - } - - } - j = l; - } - } - } - - break; - - - case 2://Quakes - if (t[4] > 0 && t[0] == 0) - { - if (t[4] < sh) - t[4]++; - else t[0] = 1; - } - - if (t[0] > 0) - { - t[0]++; - - s->xvel = 3; - - if (t[0] > 96) - { - t[0] = -1; //Stop the quake - t[4] = -1; - KILLIT(i); - } - else - { - if ((t[0]&31) == 8) - { - g_earthquakeTime = 48; - A_PlaySound(EARTHQUAKE,g_player[screenpeek].ps->i); - } - - if (klabs(sc->floorheinum-t[5]) < 8) - sc->floorheinum = t[5]; - else sc->floorheinum += (ksgn(t[5]-sc->floorheinum)<<4); - } - - m = (s->xvel*sintable[(s->ang+512)&2047])>>14; - x = (s->xvel*sintable[s->ang&2047])>>14; - - - TRAVERSE_CONNECT(p) - if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground) - { - g_player[p].ps->pos.x += m; - g_player[p].ps->pos.y += x; - - g_player[p].ps->bobposx += m; - g_player[p].ps->bobposy += x; - } - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - nextj = nextspritesect[j]; - - if (sprite[j].picnum != SECTOREFFECTOR) - { - sprite[j].x+=m; - sprite[j].y+=x; - setsprite(j,(vec3_t *)&sprite[j]); - } - j = nextj; - } - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - } - break; - - //Flashing sector lights after reactor EXPLOSION2 - - case 3: - - if (t[4] == 0) break; - p = A_FindPlayer(s,&x); - - // if(t[5] > 0) { t[5]--; break; } - - if ((g_globalRandom/(sh+1)&31) < 4 && !t[2]) - { - // t[5] = 4+(g_globalRandom&7); - sc->ceilingpal = s->owner>>8; - sc->floorpal = s->owner&0xff; - t[0] = s->shade + (g_globalRandom&15); - } - else - { - // t[5] = 4+(g_globalRandom&3); - sc->ceilingpal = s->pal; - sc->floorpal = s->pal; - t[0] = t[3]; - } - - sc->ceilingshade = t[0]; - sc->floorshade = t[0]; - - wal = &wall[sc->wallptr]; - - for (x=sc->wallnum; x > 0; x--,wal++) - { - if (wal->hitag != 1) - { - wal->shade = t[0]; - if ((wal->cstat&2) && wal->nextwall >= 0) - { - wall[wal->nextwall].shade = wal->shade; - } - } - } - - break; - - case 4: - - if ((g_globalRandom/(sh+1)&31) < 4) - { - t[1] = s->shade + (g_globalRandom&15);//Got really bright - t[0] = s->shade + (g_globalRandom&15); - sc->ceilingpal = s->owner>>8; - sc->floorpal = s->owner&0xff; - j = 1; - } - else - { - t[1] = t[2]; - t[0] = t[3]; - - sc->ceilingpal = s->pal; - sc->floorpal = s->pal; - - j = 0; - } - - sc->floorshade = t[1]; - sc->ceilingshade = t[1]; - - wal = &wall[sc->wallptr]; - - for (x=sc->wallnum; x > 0; x--,wal++) - { - if (j) wal->pal = (s->owner&0xff); - else wal->pal = s->pal; - - if (wal->hitag != 1) - { - wal->shade = t[0]; - if ((wal->cstat&2) && wal->nextwall >= 0) - wall[wal->nextwall].shade = wal->shade; - } - } - - j = headspritesect[SECT]; - while (j >= 0) - { - if (sprite[j].cstat&16 && A_CheckSpriteFlags(j,SPRITE_NOSHADE) == 0) - { - if (sc->ceilingstat&1) - sprite[j].shade = sc->ceilingshade; - else sprite[j].shade = sc->floorshade; - } - - j = nextspritesect[j]; - } - - if (t[4]) KILLIT(i); - - break; - - //BOSS - case 5: - p = A_FindPlayer(s,&x); - if (x < 8192) - { - j = s->ang; - s->ang = getangle(s->x-g_player[p].ps->pos.x,s->y-g_player[p].ps->pos.y); - A_Shoot(i,FIRELASER); - s->ang = j; - } - - if (s->owner==-1) //Start search - { - t[4]=0; - l = 0x7fffffff; - while (1) //Find the shortest dist - { - s->owner = A_FindLocator((int16_t)t[4],-1); //t[0] hold sectnum - - if (s->owner==-1) break; - - m = ldist(&sprite[g_player[p].ps->i],&sprite[s->owner]); - - if (l > m) - { - q = s->owner; - l = m; - } - - t[4]++; - } - - s->owner = q; - s->zvel = ksgn(sprite[q].z-s->z)<<4; - } - - if (ldist(&sprite[s->owner],s) < 1024) - { - int16_t ta; - ta = s->ang; - s->ang = getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y); - s->ang = ta; - s->owner = -1; - goto BOLT; - - } - else s->xvel=256; - - x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - q = G_GetAngleDelta(s->ang,x)>>3; - s->ang += q; - - if (rnd(32)) - { - t[2]+=q; - sc->ceilingshade = 127; - } - else - { - t[2] += G_GetAngleDelta(t[2]+512,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>2; - sc->ceilingshade = 0; - } - - if ((j = A_IncurDamage(i)) >= 0) - { - if (++t[3] == 5) - { - s->zvel += 1024; - P_DoQuote(QUOTE_WASTED, g_player[myconnectindex].ps); - } - } - - s->z += s->zvel; - sc->ceilingz += s->zvel; - sector[t[0]].ceilingz += s->zvel; - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - break; - - - case 8: - case 9: - - // work only if its moving - - j = -1; - - if (actor[i].t_data[4]) - { - actor[i].t_data[4]++; - if (actor[i].t_data[4] > 8) KILLIT(i); - j = 1; - } - else j = GetAnimationGoal(&sc->ceilingz); - - if (j >= 0) - { - int16_t sn; - - if ((sc->lotag&0x8000) || actor[i].t_data[4]) - x = -t[3]; - else - x = t[3]; - - if (st == 9) x = -x; - - j = headspritestat[STAT_EFFECTOR]; - while (j >= 0) - { - if (((sprite[j].lotag) == st) && (sprite[j].hitag) == sh) - { - sn = sprite[j].sectnum; - m = sprite[j].shade; - - wal = &wall[sector[sn].wallptr]; - - for (l=sector[sn].wallnum; l>0; l--,wal++) - { - if (wal->hitag != 1) - { - wal->shade+=x; - - if (wal->shade < m) - wal->shade = m; - else if (wal->shade > actor[j].t_data[2]) - wal->shade = actor[j].t_data[2]; - - if (wal->nextwall >= 0) - if (wall[wal->nextwall].hitag != 1) - wall[wal->nextwall].shade = wal->shade; - } - } - - sector[sn].floorshade += x; - sector[sn].ceilingshade += x; - - if (sector[sn].floorshade < m) - sector[sn].floorshade = m; - else if (sector[sn].floorshade > actor[j].t_data[0]) - sector[sn].floorshade = actor[j].t_data[0]; - - if (sector[sn].ceilingshade < m) - sector[sn].ceilingshade = m; - else if (sector[sn].ceilingshade > actor[j].t_data[1]) - sector[sn].ceilingshade = actor[j].t_data[1]; - - } - j = nextspritestat[j]; - } - } - break; - case 10: - - if ((sc->lotag&0xff) == 27 || (sc->floorz > sc->ceilingz && (sc->lotag&0xff) != 23) || sc->lotag == (int16_t) 32791) - { - j = 1; - - if ((sc->lotag&0xff) != 27) - TRAVERSE_CONNECT(p) - if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0) - if (s->sectnum == sprite[g_player[p].ps->i].sectnum) - j = 0; - - if (j == 1) - { - if (t[0] > sh) - switch (sector[s->sectnum].lotag) - { - case 20: - case 21: - case 22: - case 26: - if (GetAnimationGoal(§or[s->sectnum].ceilingz) >= 0) - break; - default: - G_ActivateBySector(s->sectnum,i); - t[0] = 0; - break; - } - else t[0]++; - } - } - else t[0]=0; - break; - case 11: //Swingdoor - - if (t[5] > 0) - { - t[5]--; - break; - } - - if (t[4]) - { - int32_t endwall = sc->wallptr+sc->wallnum; - - for (j=sc->wallptr; j= 0) - { - if (sprite[k].extra > 0 && A_CheckEnemySprite(&sprite[k]) && clipinsidebox(sprite[k].x,sprite[k].y,j,256L) == 1) - goto BOLT; - k = nextspritestat[k]; - } - - k = headspritestat[STAT_PLAYER]; - while (k >= 0) - { - if (sprite[k].owner >= 0 && clipinsidebox(sprite[k].x,sprite[k].y,j,144L) == 1) - { - t[5] = 8; // Delay - k = (SP>>3)*t[3]; - t[2]-=k; - t[4]-=k; - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - goto BOLT; - } - k = nextspritestat[k]; - } - } - - k = (SP>>3)*t[3]; - t[2]+=k; - t[4]+=k; - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - - if (t[4] <= -511 || t[4] >= 512) - { - t[4] = 0; - t[2] &= 0xffffff00; - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - break; - } - } - break; - case 12: - if (t[0] == 3 || t[3] == 1) //Lights going off - { - sc->floorpal = 0; - sc->ceilingpal = 0; - - wal = &wall[sc->wallptr]; - for (j = sc->wallnum; j > 0; j--, wal++) - if (wal->hitag != 1) - { - wal->shade = t[1]; - wal->pal = 0; - } - - sc->floorshade = t[1]; - sc->ceilingshade = t[2]; - t[0]=0; - - j = headspritesect[SECT]; - while (j >= 0) - { - if (sprite[j].cstat&16 && A_CheckSpriteFlags(j,SPRITE_NOSHADE) == 0) - { - if (sc->ceilingstat&1) - sprite[j].shade = sc->ceilingshade; - else sprite[j].shade = sc->floorshade; - } - j = nextspritesect[j]; - - } - - if (t[3] == 1) KILLIT(i); - } - if (t[0] == 1) //Lights flickering on - { - if (sc->floorshade > s->shade) - { - sc->floorpal = s->pal; - sc->ceilingpal = s->pal; - - sc->floorshade -= 2; - sc->ceilingshade -= 2; - - wal = &wall[sc->wallptr]; - for (j=sc->wallnum; j>0; j--,wal++) - if (wal->hitag != 1) - { - wal->pal = s->pal; - wal->shade -= 2; - } - } - else t[0] = 2; - - j = headspritesect[SECT]; - while (j >= 0) - { - if (sprite[j].cstat&16) - { - if (sc->ceilingstat&1 && A_CheckSpriteFlags(j,SPRITE_NOSHADE) == 0) - sprite[j].shade = sc->ceilingshade; - else sprite[j].shade = sc->floorshade; - } - j = nextspritesect[j]; - } - } - break; - - - case 13: - if (t[2]) - { - j = (SP<<5)|1; - - if (s->ang == 512) - { - if (s->owner) - { - if (klabs(t[0]-sc->ceilingz) >= j) - sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; - else sc->ceilingz = t[0]; - } - else - { - if (klabs(t[1]-sc->floorz) >= j) - sc->floorz += ksgn(t[1]-sc->floorz)*j; - else sc->floorz = t[1]; - } - } - else - { - if (klabs(t[1]-sc->floorz) >= j) - sc->floorz += ksgn(t[1]-sc->floorz)*j; - else sc->floorz = t[1]; - if (klabs(t[0]-sc->ceilingz) >= j) - sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; - sc->ceilingz = t[0]; - } - - if (t[3] == 1) - { - //Change the shades - - t[3]++; - sc->ceilingstat ^= 1; - - if (s->ang == 512) - { - wal = &wall[sc->wallptr]; - for (j=sc->wallnum; j>0; j--,wal++) - wal->shade = s->shade; - - sc->floorshade = s->shade; - - if (g_player[0].ps->one_parallax_sectnum >= 0) - { - sc->ceilingpicnum = - sector[g_player[0].ps->one_parallax_sectnum].ceilingpicnum; - sc->ceilingshade = - sector[g_player[0].ps->one_parallax_sectnum].ceilingshade; - } - } - } - t[2]++; - if (t[2] > 256) - KILLIT(i); - } - - - if (t[2] == 4 && s->ang != 512) - for (x=0; x<7; x++) RANDOMSCRAP; - break; - - - case 15: - - if (t[4]) - { - s->xvel = 16; - - if (t[4] == 1) //Opening - { - if (t[3] >= (SP>>3)) - { - t[4] = 0; //Turn off the sliders - A_CallSound(s->sectnum,i); - break; - } - t[3]++; - } - else if (t[4] == 2) - { - if (t[3]<1) - { - t[4] = 0; - A_CallSound(s->sectnum,i); - break; - } - t[3]--; - } - - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - } - break; - - case 16: //Reactor - - t[2]+=32; - if (sc->floorzceilingz) s->shade=0; - - else if (sc->ceilingz < t[3]) - { - - //The following code check to see if - //there is any other sprites in the sector. - //If there isn't, then kill this sectoreffector - //itself..... - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum == REACTOR || sprite[j].picnum == REACTOR2) - break; - j = nextspritesect[j]; - } - if (j == -1) - { - KILLIT(i); - } - else s->shade=1; - } - - if (s->shade) sc->ceilingz+=1024; - else sc->ceilingz-=512; - - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - - break; - - case 17: - - q = t[0]*(SP<<2); - - sc->ceilingz += q; - sc->floorz += q; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].statnum == STAT_PLAYER && sprite[j].owner >= 0) - { - p = sprite[j].yvel; - if (numplayers < 2 && !g_netServer) - g_player[p].ps->opos.z = g_player[p].ps->pos.z; - g_player[p].ps->pos.z += q; - g_player[p].ps->truefz += q; - g_player[p].ps->truecz += q; - if (g_netServer || numplayers > 1) - g_player[p].ps->opos.z = g_player[p].ps->pos.z; - } - if (sprite[j].statnum != STAT_EFFECTOR) - { - actor[j].bposz = sprite[j].z; - sprite[j].z += q; - } - - actor[j].floorz = sc->floorz; - actor[j].ceilingz = sc->ceilingz; - - j = nextspritesect[j]; - } - - if (t[0]) //If in motion - { - if (klabs(sc->floorz-t[2]) <= SP) - { - G_ActivateWarpElevators(i,0); - break; - } - - if (t[0]==-1) - { - if (sc->floorz > t[3]) - break; - } - else if (sc->ceilingz < t[4]) break; - - if (t[1] == 0) break; - t[1] = 0; - - j = headspritestat[STAT_EFFECTOR]; - while (j >= 0) - { - if (i != j && (sprite[j].lotag) == 17) - if ((sc->hitag-t[0]) == - (sector[sprite[j].sectnum].hitag) - && sh == (sprite[j].hitag)) - break; - j = nextspritestat[j]; - } - - if (j == -1) break; - - k = headspritesect[s->sectnum]; - while (k >= 0) - { - nextk = nextspritesect[k]; - - if (sprite[k].statnum == STAT_PLAYER && sprite[k].owner >= 0) - { - p = sprite[k].yvel; - - g_player[p].ps->pos.x += sprite[j].x-s->x; - g_player[p].ps->pos.y += sprite[j].y-s->y; - g_player[p].ps->pos.z = sector[sprite[j].sectnum].floorz-(sc->floorz-g_player[p].ps->pos.z); - - actor[k].floorz = sector[sprite[j].sectnum].floorz; - actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz; - - g_player[p].ps->bobposx = g_player[p].ps->opos.x = g_player[p].ps->pos.x; - g_player[p].ps->bobposy = g_player[p].ps->opos.y = g_player[p].ps->pos.y; - g_player[p].ps->opos.z = g_player[p].ps->pos.z; - - g_player[p].ps->truefz = actor[k].floorz; - g_player[p].ps->truecz = actor[k].ceilingz; - g_player[p].ps->bobcounter = 0; - - changespritesect(k,sprite[j].sectnum); - g_player[p].ps->cursectnum = sprite[j].sectnum; - } - else if (sprite[k].statnum != STAT_EFFECTOR) - { - sprite[k].x += - sprite[j].x-s->x; - sprite[k].y += - sprite[j].y-s->y; - sprite[k].z = sector[sprite[j].sectnum].floorz- - (sc->floorz-sprite[k].z); - - Bmemcpy(&actor[k].bposx, &sprite[k], sizeof(vec3_t)); - - changespritesect(k,sprite[j].sectnum); - setsprite(k,(vec3_t *)&sprite[k]); - - actor[k].floorz = sector[sprite[j].sectnum].floorz; - actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz; - - } - k = nextk; - } - } - break; - - case 18: - if (t[0]) - { - if (s->pal) - { - if (s->ang == 512) - { - sc->ceilingz -= sc->extra; - if (sc->ceilingz <= t[1]) - { - sc->ceilingz = t[1]; - KILLIT(i); - } - } - else - { - sc->floorz += sc->extra; - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (g_player[sprite[j].yvel].ps->on_ground == 1) - g_player[sprite[j].yvel].ps->pos.z += sc->extra; - if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) - { - actor[j].bposz = sprite[j].z += sc->extra; - actor[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - if (sc->floorz >= t[1]) - { - sc->floorz = t[1]; - KILLIT(i); - } - } - } - else - { - if (s->ang == 512) - { - sc->ceilingz += sc->extra; - if (sc->ceilingz >= s->z) - { - sc->ceilingz = s->z; - KILLIT(i); - } - } - else - { - sc->floorz -= sc->extra; - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (g_player[sprite[j].yvel].ps->on_ground == 1) - g_player[sprite[j].yvel].ps->pos.z -= sc->extra; - if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) - { - actor[j].bposz = sprite[j].z -= sc->extra; - actor[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - if (sc->floorz <= s->z) - { - sc->floorz = s->z; - KILLIT(i); - } - } - } - - t[2]++; - if (t[2] >= s->hitag) - { - t[2] = 0; - t[0] = 0; - } - } - break; - - case 19: //Battlestar galactia shields - - if (t[0]) - { - if (t[0] == 1) - { - t[0]++; - x = sc->wallptr; - q = x+sc->wallnum; - for (j=x; j= 0) - { - wall[wall[j].nextwall].overpicnum = 0; - wall[wall[j].nextwall].cstat &= (128+32+8+4+2); - } - } - } - - if (sc->ceilingz < sc->floorz) - sc->ceilingz += SP; - else - { - sc->ceilingz = sc->floorz; - - j = headspritestat[STAT_EFFECTOR]; - while (j >= 0) - { - if (sprite[j].lotag == 0 && sprite[j].hitag==sh) - { - q = sprite[sprite[j].owner].sectnum; - sector[sprite[j].sectnum].floorpal = sector[sprite[j].sectnum].ceilingpal = - sector[q].floorpal; - sector[sprite[j].sectnum].floorshade = sector[sprite[j].sectnum].ceilingshade = - sector[q].floorshade; - - actor[sprite[j].owner].t_data[0] = 2; - } - j = nextspritestat[j]; - } - KILLIT(i); - } - } - else //Not hit yet - { - IFHITSECT - { - P_DoQuote(QUOTE_UNLOCKED,g_player[myconnectindex].ps); - - l = headspritestat[STAT_EFFECTOR]; - while (l >= 0) - { - x = sprite[l].lotag&0x7fff; - switch (x) - { - case 0: - if (sprite[l].hitag == sh) - { - q = sprite[l].sectnum; - sector[q].floorshade = - sector[q].ceilingshade = - sprite[sprite[l].owner].shade; - sector[q].floorpal = - sector[q].ceilingpal = - sprite[sprite[l].owner].pal; - } - break; - - case 1: - case 12: - // case 18: - case 19: - - if (sh == sprite[l].hitag) - if (actor[l].t_data[0] == 0) - { - actor[l].t_data[0] = 1; //Shut them all on - sprite[l].owner = i; - } - - break; - } - l = nextspritestat[l]; - } - } - } - - break; - - case 20: //Extend-o-bridge - - if (t[0] == 0) break; - if (t[0] == 1) s->xvel = 8; - else s->xvel = -8; - - if (s->xvel) //Moving - { - x = (s->xvel*sintable[(s->ang+512)&2047])>>14; - l = (s->xvel*sintable[s->ang&2047])>>14; - - t[3] += s->xvel; - - s->x += x; - s->y += l; - - if (t[3] <= 0 || (t[3]>>6) >= (SP>>6)) - { - s->x -= x; - s->y -= l; - t[0] = 0; - A_CallSound(s->sectnum,i); - break; - } - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - nextj = nextspritesect[j]; - - if (sprite[j].statnum != STAT_EFFECTOR && sprite[j].zvel == 0) - { - sprite[j].x += x; - sprite[j].y += l; - setsprite(j,(vec3_t *)&sprite[j]); - if (sector[sprite[j].sectnum].floorstat&2) - if (sprite[j].statnum == STAT_ZOMBIEACTOR) - A_Fall(j); - } - j = nextj; - } - - dragpoint((int16_t)t[1],wall[t[1]].x+x,wall[t[1]].y+l); - dragpoint((int16_t)t[2],wall[t[2]].x+x,wall[t[2]].y+l); - - TRAVERSE_CONNECT(p) - if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground) - { - g_player[p].ps->pos.x += x; - g_player[p].ps->pos.y += l; - - g_player[p].ps->opos.x = g_player[p].ps->pos.x; - g_player[p].ps->opos.y = g_player[p].ps->pos.y; - - g_player[p].ps->pos.z += PHEIGHT; - setsprite(g_player[p].ps->i,(vec3_t *)g_player[p].ps); - g_player[p].ps->pos.z -= PHEIGHT; - } - - sc->floorxpanning-=x>>3; - sc->floorypanning-=l>>3; - - sc->ceilingxpanning-=x>>3; - sc->ceilingypanning-=l>>3; - } - - break; - - case 21: // Cascading effect - - if (t[0] == 0) break; - - if (s->ang == 1536) - l = (intptr_t) &sc->ceilingz; - else - l = (intptr_t) &sc->floorz; - - if (t[0] == 1) //Decide if the s->sectnum should go up or down - { - s->zvel = ksgn(s->z-*(int32_t *)l) * (SP<<4); - t[0]++; - } - - if (sc->extra == 0) - { - *(int32_t *)l += s->zvel; - - if (klabs(*(int32_t *)l-s->z) < 1024) - { - *(int32_t *)l = s->z; - KILLIT(i); //All done - } - } - else sc->extra--; - break; - - case 22: - - if (t[1]) - { - if (GetAnimationGoal(§or[t[0]].ceilingz) >= 0) - sc->ceilingz += sc->extra*9; - else t[1] = 0; - } - break; - - case 24: - case 34: - - if (t[4]) break; - - x = (SP*sintable[(s->ang+512)&2047])>>18; - l = (SP*sintable[s->ang&2047])>>18; - - k = 0; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - nextj = nextspritesect[j]; - if (sprite[j].zvel >= 0) - switch (sprite[j].statnum) - { - case STAT_MISC: - switch (DynamicTileMap[sprite[j].picnum]) - { - case BLOODPOOL__STATIC: - case PUKE__STATIC: - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - case BULLETHOLE__STATIC: - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: - sprite[j].xrepeat = sprite[j].yrepeat = 0; - j = nextj; - continue; - case LASERLINE__STATIC: - j = nextj; - continue; - } - case STAT_STANDABLE: - if (sprite[j].picnum == TRIPBOMB) break; - case STAT_ACTOR: - case STAT_DEFAULT: - if ( - sprite[j].picnum == BOLT1 || - sprite[j].picnum == BOLT1+1 || - sprite[j].picnum == BOLT1+2 || - sprite[j].picnum == BOLT1+3 || - sprite[j].picnum == SIDEBOLT1 || - sprite[j].picnum == SIDEBOLT1+1 || - sprite[j].picnum == SIDEBOLT1+2 || - sprite[j].picnum == SIDEBOLT1+3 || - A_CheckSwitchTile(j) - ) - break; - - if (!(sprite[j].picnum >= CRANE && sprite[j].picnum <= (CRANE+3))) - { - if (sprite[j].z > (actor[j].floorz-(16<<8))) - { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; - - sprite[j].x += x>>2; - sprite[j].y += l>>2; - - setsprite(j,(vec3_t *)&sprite[j]); - - if (sector[sprite[j].sectnum].floorstat&2) - if (sprite[j].statnum == STAT_ZOMBIEACTOR) - A_Fall(j); - } - } - break; - } - j = nextj; - } - - p = myconnectindex; - if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground) - if (klabs(g_player[p].ps->pos.z-g_player[p].ps->truefz) < PHEIGHT+(9<<8)) - { - fricxv += x<<3; - fricyv += l<<3; - } - - sc->floorxpanning += SP>>7; - - break; - - case 35: - if (sc->ceilingz > s->z) - for (j = 0; j < 8; j++) - { - s->ang += krand()&511; - k = A_Spawn(i,SMALLSMOKE); - sprite[k].xvel = 96+(krand()&127); - A_SetSprite(k,CLIPMASK0); - setsprite(k,(vec3_t *)&sprite[k]); - if (rnd(16)) - A_Spawn(i,EXPLOSION2); - } - - switch (t[0]) - { - case 0: - sc->ceilingz += s->yvel; - if (sc->ceilingz > sc->floorz) - sc->floorz = sc->ceilingz; - if (sc->ceilingz > s->z+(32<<8)) - t[0]++; - break; - case 1: - sc->ceilingz-=(s->yvel<<2); - if (sc->ceilingz < t[4]) - { - sc->ceilingz = t[4]; - t[0] = 0; - } - break; - } - break; - - case 25: //PISTONS - - if (t[4] == 0) break; - - if (sc->floorz <= sc->ceilingz) - s->shade = 0; - else if (sc->ceilingz <= t[3]) - s->shade = 1; - - if (s->shade) - { - sc->ceilingz += SP<<4; - if (sc->ceilingz > sc->floorz) - sc->ceilingz = sc->floorz; - } - else - { - sc->ceilingz -= SP<<4; - if (sc->ceilingz < t[3]) - sc->ceilingz = t[3]; - } - - break; - - case 26: - - s->xvel = 32; - l = (s->xvel*sintable[(s->ang+512)&2047])>>14; - x = (s->xvel*sintable[s->ang&2047])>>14; - - s->shade++; - if (s->shade > 7) - { - s->x = t[3]; - s->y = t[4]; - sc->floorz -= ((s->zvel*s->shade)-s->zvel); - s->shade = 0; - } - else - sc->floorz += s->zvel; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - nextj = nextspritesect[j]; - if (sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PLAYER) - { - actor[j].bposx = sprite[j].x; - actor[j].bposy = sprite[j].y; - - sprite[j].x += l; - sprite[j].y += x; - - sprite[j].z += s->zvel; - setsprite(j,(vec3_t *)&sprite[j]); - } - j = nextj; - } - - p = myconnectindex; - if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground) - { - fricxv += l<<5; - fricyv += x<<5; - } - - TRAVERSE_CONNECT(p) - if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground) - g_player[p].ps->pos.z += s->zvel; - - A_MoveSector(i); - setsprite(i,(vec3_t *)s); - - break; - - - case 27: - - if (ud.recstat == 0 || !ud.democams) break; - - actor[i].tempang = s->ang; - - p = A_FindPlayer(s,&x); - if (sprite[g_player[p].ps->i].extra > 0 && myconnectindex == screenpeek) - { - if (t[0] < 0) - { - ud.camerasprite = i; - t[0]++; - } - else if (ud.recstat == 2 && g_player[p].ps->newowner == -1) - { - if (cansee(s->x,s->y,s->z,SECT,g_player[p].ps->pos.x,g_player[p].ps->pos.y,g_player[p].ps->pos.z,g_player[p].ps->cursectnum)) - { - if (x < (int32_t)((unsigned)sh)) - { - ud.camerasprite = i; - t[0] = 999; - s->ang += G_GetAngleDelta(s->ang,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>3; - SP = 100+((s->z-g_player[p].ps->pos.z)/257); - - } - else if (t[0] == 999) - { - if (ud.camerasprite == i) - t[0] = 0; - else t[0] = -10; - ud.camerasprite = i; - - } - } - else - { - s->ang = getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y); - - if (t[0] == 999) - { - if (ud.camerasprite == i) - t[0] = 0; - else t[0] = -20; - ud.camerasprite = i; - } - } - } - } - break; - case 28: - if (t[5] > 0) - { - t[5]--; - break; - } - - if (T1 == 0) - { - p = A_FindPlayer(s,&x); - if (x > 15500) - break; - T1 = 1; - T2 = 64 + (krand()&511); - T3 = 0; - } - else - { - T3++; - if (T3 > T2) - { - T1 = 0; - g_player[screenpeek].ps->visibility = ud.const_visibility; - break; - } - else if (T3 == (T2>>1)) - A_PlaySound(THUNDER,i); - else if (T3 == (T2>>3)) - A_PlaySound(LIGHTNING_SLAP,i); - else if (T3 == (T2>>2)) - { - j = headspritestat[STAT_DEFAULT]; - while (j >= 0) - { - if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) - sprite[j].cstat |= 32768; - j = nextspritestat[j]; - } - } - else if (T3 > (T2>>3) && T3 < (T2>>2)) - { - if (cansee(s->x,s->y,s->z,s->sectnum,g_player[screenpeek].ps->pos.x,g_player[screenpeek].ps->pos.y,g_player[screenpeek].ps->pos.z,g_player[screenpeek].ps->cursectnum)) - j = 1; - else j = 0; - - if (rnd(192) && (T3&1)) - { - if (j) - g_player[screenpeek].ps->visibility = 0; - } - else if (j) - g_player[screenpeek].ps->visibility = ud.const_visibility; - - j = headspritestat[STAT_DEFAULT]; - while (j >= 0) - { - if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) - { - if (rnd(32) && (T3&1)) - { - sprite[j].cstat &= 32767; - A_Spawn(j,SMALLSMOKE); - - p = A_FindPlayer(s,&x); - x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (x < 768) - { - if (!A_CheckSoundPlaying(g_player[p].ps->i,DUKE_LONGTERM_PAIN)) - A_PlaySound(DUKE_LONGTERM_PAIN,g_player[p].ps->i); - A_PlaySound(SHORT_CIRCUIT,g_player[p].ps->i); - sprite[g_player[p].ps->i].extra -= 8+(krand()&7); - g_player[p].ps->pals.f = 32; - g_player[p].ps->pals.r = 16; - g_player[p].ps->pals.g = 0; - g_player[p].ps->pals.b = 0; - } - break; - } - else sprite[j].cstat |= 32768; - } - - j = nextspritestat[j]; - } - } - } - break; - case 29: - s->hitag += 64; - l = mulscale12((int32_t)s->yvel,sintable[s->hitag&2047]); - sc->floorz = s->z + l; - break; - case 31: // True Drop Floor - if (t[0] == 1) - { - // Choose dir - - if (t[3] > 0) - { - t[3]--; - break; - } - - if (t[2] == 1) // Retract - { - if (SA != 1536) - { - if (klabs(sc->floorz - s->z) < SP) - { - sc->floorz = s->z; - t[2] = 0; - t[0] = 0; - t[3] = s->hitag; - A_CallSound(s->sectnum,i); - } - else - { - l = ksgn(s->z-sc->floorz)*SP; - sc->floorz += l; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (g_player[sprite[j].yvel].ps->on_ground == 1) - g_player[sprite[j].yvel].ps->pos.z += l; - if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) - { - actor[j].bposz = sprite[j].z += l; - actor[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - } - } - else - { - if (klabs(sc->floorz - t[1]) < SP) - { - sc->floorz = t[1]; - A_CallSound(s->sectnum,i); - t[2] = 0; - t[0] = 0; - t[3] = s->hitag; - } - else - { - l = ksgn(t[1]-sc->floorz)*SP; - sc->floorz += l; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (g_player[sprite[j].yvel].ps->on_ground == 1) - g_player[sprite[j].yvel].ps->pos.z += l; - if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) - { - actor[j].bposz = sprite[j].z += l; - actor[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - } - } - break; - } - - if ((s->ang&2047) == 1536) - { - if (klabs(s->z-sc->floorz) < SP) - { - A_CallSound(s->sectnum,i); - t[0] = 0; - t[2] = 1; - t[3] = s->hitag; - } - else - { - l = ksgn(s->z-sc->floorz)*SP; - sc->floorz += l; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (g_player[sprite[j].yvel].ps->on_ground == 1) - g_player[sprite[j].yvel].ps->pos.z += l; - if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) - { - actor[j].bposz = sprite[j].z += l; - actor[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - } - } - else - { - if (klabs(sc->floorz-t[1]) < SP) - { - t[0] = 0; - A_CallSound(s->sectnum,i); - t[2] = 1; - t[3] = s->hitag; - } - else - { - l = ksgn(s->z-t[1])*SP; - sc->floorz -= l; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (g_player[sprite[j].yvel].ps->on_ground == 1) - g_player[sprite[j].yvel].ps->pos.z -= l; - if (sprite[j].zvel == 0 && sprite[j].statnum != STAT_EFFECTOR && sprite[j].statnum != STAT_PROJECTILE) - { - actor[j].bposz = sprite[j].z -= l; - actor[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - } - } - } - break; - - case 32: // True Drop Ceiling - if (t[0] == 1) - { - // Choose dir - - if (t[2] == 1) // Retract - { - if (SA != 1536) - { - if (klabs(sc->ceilingz - s->z) < - (SP<<1)) - { - sc->ceilingz = s->z; - A_CallSound(s->sectnum,i); - t[2] = 0; - t[0] = 0; - } - else sc->ceilingz += - ksgn(s->z-sc->ceilingz)*SP; - } - else - { - if (klabs(sc->ceilingz - t[1]) < - (SP<<1)) - { - sc->ceilingz = t[1]; - A_CallSound(s->sectnum,i); - t[2] = 0; - t[0] = 0; - } - else sc->ceilingz += - ksgn(t[1]-sc->ceilingz)*SP; - } - break; - } - - if ((s->ang&2047) == 1536) - { - if (klabs(sc->ceilingz-s->z) < - (SP<<1)) - { - t[0] = 0; - t[2] = !t[2]; - A_CallSound(s->sectnum,i); - sc->ceilingz = s->z; - } - else sc->ceilingz += - ksgn(s->z-sc->ceilingz)*SP; - } - else - { - if (klabs(sc->ceilingz-t[1]) < (SP<<1)) - { - t[0] = 0; - t[2] = !t[2]; - A_CallSound(s->sectnum,i); - } - else sc->ceilingz -= ksgn(s->z-t[1])*SP; - } - } - break; - - case 33: - if (g_earthquakeTime > 0 && (krand()&7) == 0) - RANDOMSCRAP; - break; - case 36: - - if (t[0]) - { - if (t[0] == 1) - A_Shoot(i,sc->extra); - else if (t[0] == GAMETICSPERSEC*5) - t[0] = 0; - t[0]++; - } - break; - - case 128: //SE to control glass breakage - - wal = &wall[t[2]]; - - if (wal->cstat|32) - { - wal->cstat &= (255-32); - wal->cstat |= 16; - if (wal->nextwall >= 0) - { - wall[wal->nextwall].cstat &= (255-32); - wall[wal->nextwall].cstat |= 16; - } - } - else break; - - wal->overpicnum++; - if (wal->nextwall >= 0) - wall[wal->nextwall].overpicnum++; - - if (t[0] < t[1]) t[0]++; - else - { - wal->cstat &= (128+32+8+4+2); - if (wal->nextwall >= 0) - wall[wal->nextwall].cstat &= (128+32+8+4+2); - KILLIT(i); - } - break; - - case 130: - if (t[0] > 80) - { - KILLIT(i); - } - else t[0]++; - - x = sc->floorz-sc->ceilingz; - - if (rnd(64)) - { - k = A_Spawn(i,EXPLOSION2); - sprite[k].xrepeat = sprite[k].yrepeat = 2+(krand()&7); - sprite[k].z = sc->floorz-(krand()%x); - sprite[k].ang += 256-(krand()%511); - sprite[k].xvel = krand()&127; - A_SetSprite(k,CLIPMASK0); - } - break; - case 131: - if (t[0] > 40) - { - KILLIT(i); - } - else t[0]++; - - x = sc->floorz-sc->ceilingz; - - if (rnd(32)) - { - k = A_Spawn(i,EXPLOSION2); - sprite[k].xrepeat = sprite[k].yrepeat = 2+(krand()&3); - sprite[k].z = sc->floorz-(krand()%x); - sprite[k].ang += 256-(krand()%511); - sprite[k].xvel = krand()&127; - A_SetSprite(k,CLIPMASK0); - } - break; -#ifdef POLYMER - case 49: - { - if (!A_CheckSpriteFlags(i, SPRITE_NOLIGHT) && getrendermode() == 4 && - !(A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384)) - { - if (actor[i].lightptr == NULL) - { -#pragma pack(push,1) - _prlight mylight; -#pragma pack(pop) - mylight.sector = SECT; - Bmemcpy(&mylight, &sprite[i], sizeof(int32_t) * 3); - mylight.range = SHT; - mylight.color[0] = sprite[i].xvel; - mylight.color[1] = sprite[i].yvel; - mylight.color[2] = sprite[i].zvel; - mylight.radius = 0; - mylight.angle = SA; - mylight.horiz = SH; - mylight.minshade = sprite[i].xoffset; - mylight.maxshade = sprite[i].yoffset; - mylight.tilenum = 0; - - if (CS & 2) - { - if (CS & 512) - mylight.priority = PR_LIGHT_PRIO_LOW; - else - mylight.priority = PR_LIGHT_PRIO_HIGH; - } - else - mylight.priority = PR_LIGHT_PRIO_MAX; - - actor[i].lightId = polymer_addlight(&mylight); - if (actor[i].lightId >= 0) - actor[i].lightptr = &prlights[actor[i].lightId]; - break; - } - - if (Bmemcmp(&sprite[i], actor[i].lightptr, sizeof(int32_t) * 3)) - { - Bmemcpy(actor[i].lightptr, &sprite[i], sizeof(int32_t) * 3); - actor[i].lightptr->sector = sprite[i].sectnum; - actor[i].lightptr->flags.invalidate = 1; - } - if (SHT != actor[i].lightptr->range) - { - actor[i].lightptr->range = SHT; - actor[i].lightptr->flags.invalidate = 1; - } - if ((sprite[i].xvel != actor[i].lightptr->color[0]) || - (sprite[i].yvel != actor[i].lightptr->color[1]) || - (sprite[i].zvel != actor[i].lightptr->color[2])) - { - actor[i].lightptr->color[0] = sprite[i].xvel; - actor[i].lightptr->color[1] = sprite[i].yvel; - actor[i].lightptr->color[2] = sprite[i].zvel; - } - } - break; - } - case 50: - { - if (!A_CheckSpriteFlags(i, SPRITE_NOLIGHT) && getrendermode() == 4 && - !(A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384)) - { - if (actor[i].lightptr == NULL) - { -#pragma pack(push,1) - _prlight mylight; -#pragma pack(pop) - - mylight.sector = SECT; - Bmemcpy(&mylight, &sprite[i], sizeof(int32_t) * 3); - mylight.range = SHT; - mylight.color[0] = sprite[i].xvel; - mylight.color[1] = sprite[i].yvel; - mylight.color[2] = sprite[i].zvel; - mylight.radius = (256-(SS+128))<<1; - mylight.faderadius = (int16_t)(mylight.radius * 0.75f); - mylight.angle = SA; - mylight.horiz = SH; - mylight.minshade = sprite[i].xoffset; - mylight.maxshade = sprite[i].yoffset; - mylight.tilenum = actor[i].picnum; - - if (CS & 2) - { - if (CS & 512) - mylight.priority = PR_LIGHT_PRIO_LOW; - else - mylight.priority = PR_LIGHT_PRIO_HIGH; - } - else - mylight.priority = PR_LIGHT_PRIO_MAX; - - actor[i].lightId = polymer_addlight(&mylight); - if (actor[i].lightId >= 0) - actor[i].lightptr = &prlights[actor[i].lightId]; - break; - } - - if (Bmemcmp(&sprite[i], actor[i].lightptr, sizeof(int32_t) * 3)) - { - Bmemcpy(actor[i].lightptr, &sprite[i], sizeof(int32_t) * 3); - actor[i].lightptr->sector = sprite[i].sectnum; - actor[i].lightptr->flags.invalidate = 1; - } - if (SHT != actor[i].lightptr->range) - { - actor[i].lightptr->range = SHT; - actor[i].lightptr->flags.invalidate = 1; - } - if ((sprite[i].xvel != actor[i].lightptr->color[0]) || - (sprite[i].yvel != actor[i].lightptr->color[1]) || - (sprite[i].zvel != actor[i].lightptr->color[2])) - { - actor[i].lightptr->color[0] = sprite[i].xvel; - actor[i].lightptr->color[1] = sprite[i].yvel; - actor[i].lightptr->color[2] = sprite[i].zvel; - } - if (((256-(SS+128))<<1) != actor[i].lightptr->radius) - { - actor[i].lightptr->radius = (256-(SS+128))<<1; - actor[i].lightptr->faderadius = (int16_t)(actor[i].lightptr->radius * 0.75f); - actor[i].lightptr->flags.invalidate = 1; - } - if (SA != actor[i].lightptr->angle) - { - actor[i].lightptr->angle = SA; - actor[i].lightptr->flags.invalidate = 1; - } - if (SH != actor[i].lightptr->horiz) - { - actor[i].lightptr->horiz = SH; - actor[i].lightptr->flags.invalidate = 1; - } - actor[i].lightptr->tilenum = actor[i].picnum; - } - - break; - } -#endif // POLYMER - - } -BOLT: - i = nexti; - } - - //Sloped sin-wave floors! - for (i=headspritestat[STAT_EFFECTOR]; i>=0; i=nextspritestat[i]) - { - s = &sprite[i]; - if (s->lotag != 29) continue; - sc = §or[s->sectnum]; - if (sc->wallnum != 4) continue; - wal = &wall[sc->wallptr+2]; - alignflorslope(s->sectnum,wal->x,wal->y,sector[wal->nextsector].floorz); - } -} - -void A_PlayAlertSound(int32_t i) -{ - if (sprite[i].extra > 0) - switch (DynamicTileMap[PN]) - { - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: - A_PlaySound(PRED_RECOG,i); - break; - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: - A_PlaySound(CAPT_RECOG,i); - break; - case PIGCOP__STATIC: - case PIGCOPDIVE__STATIC: - A_PlaySound(PIG_RECOG,i); - break; - case RECON__STATIC: - A_PlaySound(RECO_RECOG,i); - break; - case DRONE__STATIC: - A_PlaySound(DRON_RECOG,i); - break; - case COMMANDER__STATIC: - case COMMANDERSTAYPUT__STATIC: - A_PlaySound(COMM_RECOG,i); - break; - case ORGANTIC__STATIC: - A_PlaySound(TURR_RECOG,i); - break; - case OCTABRAIN__STATIC: - case OCTABRAINSTAYPUT__STATIC: - A_PlaySound(OCTA_RECOG,i); - break; - case BOSS1__STATIC: - S_PlaySound(BOS1_RECOG); - break; - case BOSS2__STATIC: - if (sprite[i].pal == 1) - S_PlaySound(BOS2_RECOG); - else S_PlaySound(WHIPYOURASS); - break; - case BOSS3__STATIC: - if (sprite[i].pal == 1) - S_PlaySound(BOS3_RECOG); - else S_PlaySound(RIPHEADNECK); - break; - case BOSS4__STATIC: - case BOSS4STAYPUT__STATIC: - if (sprite[i].pal == 1) - S_PlaySound(BOS4_RECOG); - S_PlaySound(BOSS4_FIRSTSEE); - break; - case GREENSLIME__STATIC: - A_PlaySound(SLIM_RECOG,i); - break; - } -} - -int32_t A_CheckEnemyTile(int32_t pn) -{ - //this case can't be handled by the dynamictostatic system because it adds - //stuff to the value from names.h so handling separately - if ((pn >= GREENSLIME) && (pn <= GREENSLIME+7)) return 1; - - if (A_CheckSpriteTileFlags(pn,SPRITE_BADGUY)) return 1; - - if (ActorType[pn]) return 1; - - switch (DynamicTileMap[pn]) - { - case SHARK__STATIC: - case RECON__STATIC: - case DRONE__STATIC: - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSTAYPUT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: - case OCTABRAIN__STATIC: - case COMMANDER__STATIC: - case COMMANDERSTAYPUT__STATIC: - case PIGCOP__STATIC: - case EGG__STATIC: - case PIGCOPSTAYPUT__STATIC: - case PIGCOPDIVE__STATIC: - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: - case ORGANTIC__STATIC: - case BOSS1__STATIC: - case BOSS2__STATIC: - case BOSS3__STATIC: - case BOSS4__STATIC: - //case GREENSLIME: - //case GREENSLIME+1: - //case GREENSLIME+2: - //case GREENSLIME+3: - //case GREENSLIME+4: - //case GREENSLIME+5: - //case GREENSLIME+6: - //case GREENSLIME+7: - case RAT__STATIC: - case ROTATEGUN__STATIC: - return 1; - } - return 0; -} - -inline int32_t A_CheckEnemySprite(spritetype *s) -{ - return(A_CheckEnemyTile(s->picnum)); -} - -int32_t A_CheckSwitchTile(int32_t i) -{ - int32_t j; - //MULTISWITCH has 4 states so deal with it separately - if ((PN >= MULTISWITCH) && (PN <=MULTISWITCH+3)) return 1; - // ACCESSSWITCH and ACCESSSWITCH2 are only active in 1 state so deal with them separately - if ((PN == ACCESSSWITCH) || (PN == ACCESSSWITCH2)) return 1; - //loop to catch both states of switches - for (j=1; j>=0; j--) - { - switch (DynamicTileMap[PN-j]) - { - case HANDPRINTSWITCH__STATIC: - //case HANDPRINTSWITCH+1: - case ALIENSWITCH__STATIC: - //case ALIENSWITCH+1: - case MULTISWITCH__STATIC: - //case MULTISWITCH+1: - //case MULTISWITCH+2: - //case MULTISWITCH+3: - //case ACCESSSWITCH: - //case ACCESSSWITCH2: - case PULLSWITCH__STATIC: - //case PULLSWITCH+1: - case HANDSWITCH__STATIC: - //case HANDSWITCH+1: - case SLOTDOOR__STATIC: - //case SLOTDOOR+1: - case LIGHTSWITCH__STATIC: - //case LIGHTSWITCH+1: - case SPACELIGHTSWITCH__STATIC: - //case SPACELIGHTSWITCH+1: - case SPACEDOORSWITCH__STATIC: - //case SPACEDOORSWITCH+1: - case FRANKENSTINESWITCH__STATIC: - //case FRANKENSTINESWITCH+1: - case LIGHTSWITCH2__STATIC: - //case LIGHTSWITCH2+1: - case POWERSWITCH1__STATIC: - //case POWERSWITCH1+1: - case LOCKSWITCH1__STATIC: - //case LOCKSWITCH1+1: - case POWERSWITCH2__STATIC: - //case POWERSWITCH2+1: - case DIPSWITCH__STATIC: - //case DIPSWITCH+1: - case DIPSWITCH2__STATIC: - //case DIPSWITCH2+1: - case TECHSWITCH__STATIC: - //case TECHSWITCH+1: - case DIPSWITCH3__STATIC: - //case DIPSWITCH3+1: - return 1; - } - } - return 0; -} - -void G_MoveWorld(void) -{ - G_MoveZombieActors(); //ST 2 - G_MoveWeapons(); //ST 4 - G_MoveTransports(); //ST 9 - - G_MovePlayers(); //ST 10 - G_MoveFallers(); //ST 12 - G_MoveMisc(); //ST 5 - - G_MoveActors(); //ST 1 - G_MoveEffectors(); //ST 3 - - G_MoveStandables(); //ST 6 - - { - int32_t i, p, j, k = MAXSTATUS-1, pl; - - do - { - i = headspritestat[k]; - - while (i >= 0) - { -#ifdef POLYMER - if (getrendermode() == 4) - { - spritetype *s = &sprite[i]; - - if ((sprite[i].picnum != SECTOREFFECTOR && (s->cstat & 32768)) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || - (A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384)) - { - if (actor[i].lightptr != NULL) - { - polymer_deletelight(actor[i].lightId); - actor[i].lightId = -1; - actor[i].lightptr = NULL; - } - } - else - { - - if (actor[i].lightptr != NULL && actor[i].lightcount) - { - if (!(--actor[i].lightcount)) - { - polymer_deletelight(actor[i].lightId); - actor[i].lightId = -1; - actor[i].lightptr = NULL; - } - } - - switch (DynamicTileMap[sprite[i].picnum-1]) - { - case DIPSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - case PULLSWITCH__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case TECHSWITCH__STATIC: - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - { - int32_t x, y; - - if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || - !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) - { - if (actor[i].lightptr != NULL) - { - polymer_deletelight(actor[i].lightId); - actor[i].lightId = -1; - actor[i].lightptr = NULL; - } - break; - } - - x = ((sintable[(s->ang+512)&2047])>>7); - y = ((sintable[(s->ang)&2047])>>7); - - s->x += x; - s->y += y; - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 48+(255<<8)+(48<<16),PR_LIGHT_PRIO_LOW); - s->x -= x; - s->y -= y; - } - break; - } - - switch (DynamicTileMap[sprite[i].picnum]) - { - case DIPSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - case PULLSWITCH__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case TECHSWITCH__STATIC: - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - { - int32_t x, y; - - if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) || - !inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) - { - if (actor[i].lightptr != NULL) - { - polymer_deletelight(actor[i].lightId); - actor[i].lightId = -1; - actor[i].lightptr = NULL; - } - break; - } - - x = ((sintable[(s->ang+512)&2047])>>7); - y = ((sintable[(s->ang)&2047])>>7); - - s->x += x; - s->y += y; - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 768, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW); - s->x -= x; - s->y -= y; - } - break; - - case ATOMICHEALTH__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2 * 3, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case FIRE__STATIC: - case FIRE2__STATIC: - case BURNING__STATIC: - case BURNING2__STATIC: - { - uint32_t color; - /* - if (Actor[i].floorz - Actor[i].ceilingz < 128) break; - if (s->z > Actor[i].floorz+2048) break; - */ - - switch (s->pal) - { - case 1: color = 128+(128<<8)+(255<<16); break; - case 2: color = 255+(48<<8)+(48<<16); break; - case 8: color = 48+(255<<8)+(48<<16); break; - default: color = 255+(95<<8); break; - } - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, color, PR_LIGHT_PRIO_HIGH_GAME); - } - break; - - case OOZFILTER__STATIC: - if (s->xrepeat > 4) - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - case FLOORFLAME__STATIC: - case FIREBARREL__STATIC: - case FIREVASE__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); - break; - - case EXPLOSION2__STATIC: - if (!actor[i].lightcount) - { - int32_t x = ((sintable[(s->ang+512)&2047])>>6); - int32_t y = ((sintable[(s->ang)&2047])>>6); - - s->x -= x; - s->y -= y; - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8), - s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME); - - s->x += x; - s->y += y; - } - break; - case FORCERIPPLE__STATIC: - case TRANSPORTERBEAM__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME); - break; - case GROWSPARK__STATIC: - { - int32_t x = ((sintable[(s->ang+512)&2047])>>6); - int32_t y = ((sintable[(s->ang)&2047])>>6); - - s->x -= x; - s->y -= y; - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME); - - s->x += x; - s->y += y; - } - break; - case SHRINKEREXPLOSION__STATIC: - { - int32_t x = ((sintable[(s->ang+512)&2047])>>6); - int32_t y = ((sintable[(s->ang)&2047])>>6); - - s->x -= x; - s->y -= y; - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); - - s->x += x; - s->y += y; - } - break; - case FREEZEBLAST__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - case COOLEXPLOSION1__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD<<2, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - case SHRINKSPARK__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 128+(255<<8)+(128<<16),PR_LIGHT_PRIO_HIGH_GAME); - break; - case FIRELASER__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); - break; - case RPG__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 128 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); - break; - case SHOTSPARK1__STATIC: - if (actor[i].t_data[2] == 0) // check for first frame of action - { - int32_t x = ((sintable[(s->ang+512)&2047])>>7); - int32_t y = ((sintable[(s->ang)&2047])>>7); - - s->x -= x; - s->y -= y; - - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 16 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME); - actor[i].lightcount = 1; - - s->x += x; - s->y += y; - } - break; - } - } - } -#endif - if (!apScriptGameEvent[EVENT_GAME] || A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE)) - { - i = nextspritestat[i]; - continue; - } - - j = nextspritestat[i]; - - pl = A_FindPlayer(&sprite[i],&p); - VM_OnEvent(EVENT_GAME,i, pl, p); - i = j; - } - } - while (k--); - } - - G_DoSectorAnimations(); - G_MoveFX(); //ST 11 -} - diff --git a/polymer-perf/eduke32/source/actors.h b/polymer-perf/eduke32/source/actors.h deleted file mode 100644 index 2185067fd..000000000 --- a/polymer-perf/eduke32/source/actors.h +++ /dev/null @@ -1,202 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __actors_h__ -#define __actors_h__ - -#define MAXSLEEPDIST 16384 -#define SLEEPTIME 1536 -#define ZOFFSET (1<<8) - -#define STAT_DEFAULT 0 -#define STAT_ACTOR 1 -#define STAT_ZOMBIEACTOR 2 -#define STAT_EFFECTOR 3 -#define STAT_PROJECTILE 4 -#define STAT_MISC 5 -#define STAT_STANDABLE 6 -#define STAT_LOCATOR 7 -#define STAT_ACTIVATOR 8 -#define STAT_TRANSPORT 9 -#define STAT_PLAYER 10 -#define STAT_FX 11 -#define STAT_FALLER 12 -#define STAT_DUMMYPLAYER 13 - -// Defines the motion characteristics of an actor -enum amoveflags_t { - face_player = 1, - geth = 2, - getv = 4, - random_angle = 8, - face_player_slow = 16, - spin = 32, - face_player_smart = 64, - fleeenemy = 128, - jumptoplayer = 257, - seekplayer = 512, - furthestdir = 1024, - dodgebullet = 4096 -}; - -// Defines for 'useractor' keyword -enum uactortypes_t { - notenemy, - enemy, - enemystayput -}; - -#pragma pack(push,1) -typedef struct { - int32_t workslike, cstat; // 8b - int32_t hitradius, range, flashcolor; // 12b - int16_t spawns, sound, isound, vel; // 8b - int16_t decal, trail, tnum, drop; // 8b - int16_t offset, bounces, bsound; // 6b - int16_t toffset; // 2b - int16_t extra, extra_rand; // 4b - int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b - int8_t shade, xrepeat, yrepeat, pal; // 4b - int8_t velmult; // 1b - uint8_t clipdist; // 1b - int8_t filler[6]; // 6b -} projectile_t; - -typedef struct { - intptr_t t_data[10]; // 40b/80b sometimes used to hold pointers to con code - - int16_t picnum,ang,extra,owner; //8b - int16_t movflag,tempang,timetosleep; //6b - - int32_t flags, bposx,bposy,bposz; //16b - int32_t floorz,ceilingz,lastvx,lastvy; //16b - int32_t lasttransport; //4b - - int16_t lightId, lightcount, lightmaxrange, cgg; //8b - int16_t actorstayput, dispicnum, shootzvel; // 6b - -#ifdef POLYMER - _prlight *lightptr; //4b/8b -#else - void *lightptr; -#endif - - projectile_t *projectile; //4b/8b - - int8_t filler[16]; // pad struct to 128 bytes -} actor_t; - -// this struct needs to match the beginning of actor_t above -typedef struct { - intptr_t t_data[10]; // 40b/80b sometimes used to hold pointers to con code - - int16_t picnum,ang,extra,owner; //8b - int16_t movflag,tempang,timetosleep; // 6b - - int32_t flags; // 4b -} netactor_t; -#pragma pack(pop) - -enum sflags_t { - SPRITE_SHADOW = 0x00000001, - SPRITE_NVG = 0x00000002, - SPRITE_NOSHADE = 0x00000004, - SPRITE_PROJECTILE = 0x00000008, - SPRITE_DECAL = 0x00000010, - SPRITE_BADGUY = 0x00000020, - SPRITE_NOPAL = 0x00000040, - SPRITE_NOEVENTCODE = 0x00000080, - SPRITE_NOLIGHT = 0x00000100, - SPRITE_USEACTIVATOR = 0x00000200, - SPRITE_NULL = 0x00000400, // null sprite in multiplayer -}; - -// custom projectiles -enum pflags_t { - PROJECTILE_HITSCAN = 0x00000001, - PROJECTILE_RPG = 0x00000002, - PROJECTILE_BOUNCESOFFWALLS = 0x00000004, - PROJECTILE_BOUNCESOFFMIRRORS = 0x00000008, - PROJECTILE_KNEE = 0x00000010, - PROJECTILE_WATERBUBBLES = 0x00000020, - PROJECTILE_TIMED = 0x00000040, - PROJECTILE_BOUNCESOFFSPRITES = 0x00000080, - PROJECTILE_SPIT = 0x00000100, - PROJECTILE_COOLEXPLOSION1 = 0x00000200, - PROJECTILE_BLOOD = 0x00000400, - PROJECTILE_LOSESVELOCITY = 0x00000800, - PROJECTILE_NOAIM = 0x00001000, - PROJECTILE_RANDDECALSIZE = 0x00002000, - PROJECTILE_EXPLODEONTIMER = 0x00004000, - PROJECTILE_RPG_IMPACT = 0x00008000, - PROJECTILE_RADIUS_PICNUM = 0x00010000, - PROJECTILE_ACCURATE_AUTOAIM = 0x00020000, - PROJECTILE_FORCEIMPACT = 0x00040000, - PROJECTILE_REALCLIPDIST = 0x00080000, - PROJECTILE_ACCURATE = 0x00100000, -}; - -extern actor_t actor[MAXSPRITES]; -extern char ActorType[MAXTILES]; -extern int16_t SpriteCacheList[MAXTILES][3]; -extern int32_t SpriteFlags[MAXTILES]; -extern int32_t block_deletesprite; -extern int32_t g_noEnemies; -extern int32_t otherp; -extern int32_t ticrandomseed; -extern intptr_t *actorLoadEventScrptr[MAXTILES]; -extern intptr_t *actorscrptr[MAXTILES]; -extern intptr_t *g_parsingActorPtr; -extern projectile_t DefaultProjectileData[MAXTILES]; -extern projectile_t ProjectileData[MAXTILES]; -extern projectile_t SpriteProjectile[MAXSPRITES]; - -void A_AddToDeleteQueue(int32_t i); -int32_t A_CheckEnemySprite(spritetype *s); -int32_t A_CheckEnemyTile(int32_t pn); -int32_t A_CheckSwitchTile(int32_t i); -void A_DeleteSprite(int32_t s); -void A_DoGuts(int32_t sp,int32_t gtype,int32_t n); -void A_DoGutsDir(int32_t sp,int32_t gtype,int32_t n); -int32_t A_IncurDamage(int32_t sn); -void A_MoveCyclers(void); -void A_MoveDummyPlayers(void); -int32_t A_MoveSprite(int32_t spritenum,const vec3_t *change,uint32_t cliptype); -void A_PlayAlertSound(int32_t i); -void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4); -int32_t A_SetSprite(int32_t i,uint32_t cliptype); -void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n); - -void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority); -int32_t G_CheckForSpaceCeiling(int32_t sectnum); -int32_t G_CheckForSpaceFloor(int32_t sectnum); -void G_DoInterpolations(int32_t smoothratio); -void G_MoveWorld(void); -extern inline void G_RestoreInterpolations(void); -void G_SetInterpolation(int32_t *posptr); -void G_StopInterpolation(int32_t *posptr); -extern inline void G_UpdateInterpolations(void); - -void Sect_ClearInterpolation(int32_t i); -void Sect_SetInterpolation(int32_t i); - -#endif diff --git a/polymer-perf/eduke32/source/anim.c b/polymer-perf/eduke32/source/anim.c deleted file mode 100644 index 71824e6ad..000000000 --- a/polymer-perf/eduke32/source/anim.c +++ /dev/null @@ -1,312 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "duke3d.h" -#include "animlib.h" -#include "mouse.h" -#include "compat.h" - -void endanimsounds(int32_t fr) -{ - switch (ud.volume_number) - { - case 0: - break; - case 1: - switch (fr) - { - case 1: - S_PlaySound(WIND_AMBIENCE); - break; - case 26: - S_PlaySound(ENDSEQVOL2SND1); - break; - case 36: - S_PlaySound(ENDSEQVOL2SND2); - break; - case 54: - S_PlaySound(THUD); - break; - case 62: - S_PlaySound(ENDSEQVOL2SND3); - break; - case 75: - S_PlaySound(ENDSEQVOL2SND4); - break; - case 81: - S_PlaySound(ENDSEQVOL2SND5); - break; - case 115: - S_PlaySound(ENDSEQVOL2SND6); - break; - case 124: - S_PlaySound(ENDSEQVOL2SND7); - break; - } - break; - case 2: - switch (fr) - { - case 1: - S_PlaySound(WIND_REPEAT); - break; - case 98: - S_PlaySound(DUKE_GRUNT); - break; - case 82+20: - S_PlaySound(THUD); - S_PlaySound(SQUISHED); - break; - case 104+20: - S_PlaySound(ENDSEQVOL3SND3); - break; - case 114+20: - S_PlaySound(ENDSEQVOL3SND2); - break; - case 158: - S_PlaySound(PIPEBOMB_EXPLODE); - break; - } - break; - } -} - -void logoanimsounds(int32_t fr) -{ - switch (fr) - { - case 1: - S_PlaySound(FLY_BY); - break; - case 19: - S_PlaySound(PIPEBOMB_EXPLODE); - break; - } -} - -void intro4animsounds(int32_t fr) -{ - switch (fr) - { - case 1: - S_PlaySound(INTRO4_B); - break; - case 12: - case 34: - S_PlaySound(SHORT_CIRCUIT); - break; - case 18: - S_PlaySound(INTRO4_5); - break; - } -} - -void first4animsounds(int32_t fr) -{ - switch (fr) - { - case 1: - S_PlaySound(INTRO4_1); - break; - case 12: - S_PlaySound(INTRO4_2); - break; - case 7: - S_PlaySound(INTRO4_3); - break; - case 26: - S_PlaySound(INTRO4_4); - break; - } -} - -void intro42animsounds(int32_t fr) -{ - switch (fr) - { - case 10: - S_PlaySound(INTRO4_6); - break; - } -} - -void endanimvol41(int32_t fr) -{ - switch (fr) - { - case 3: - S_PlaySound(DUKE_UNDERWATER); - break; - case 35: - S_PlaySound(VOL4ENDSND1); - break; - } -} - -void endanimvol42(int32_t fr) -{ - switch (fr) - { - case 11: - S_PlaySound(DUKE_UNDERWATER); - break; - case 20: - S_PlaySound(VOL4ENDSND1); - break; - case 39: - S_PlaySound(VOL4ENDSND2); - break; - case 50: - FX_StopAllSounds(); - break; - } -} - -void endanimvol43(int32_t fr) -{ - switch (fr) - { - case 1: - S_PlaySound(BOSS4_DEADSPEECH); - break; - case 40: - S_PlaySound(VOL4ENDSND1); - S_PlaySound(DUKE_UNDERWATER); - break; - case 50: - S_PlaySound(BIGBANG); - break; - } -} - -void G_PlayAnim(const char *fn,char t) -{ - char *animbuf; - int32_t i, length=0, numframes=0; -#ifdef USE_OPENGL - int32_t ogltexfiltermode=gltexfiltermode; -#endif - int32_t handle=-1; - int32_t frametime = 0; - - // return; - - if (t != 7 && t != 9 && t != 10 && t != 11) - KB_FlushKeyboardQueue(); - - if (KB_KeyWaiting()) - { - FX_StopAllSounds(); - goto ENDOFANIMLOOP; - } - - handle = kopen4load((char *)fn,0); - if (handle == -1) return; - length = kfilelength(handle); - - walock[TILE_ANIM] = 219+t; - - allocache((intptr_t *)&animbuf,length+1,&walock[TILE_ANIM]); - - tilesizx[TILE_ANIM] = 200; - tilesizy[TILE_ANIM] = 320; - - kread(handle,animbuf,length); - kclose(handle); - - ANIM_LoadAnim(animbuf); - numframes = ANIM_NumFrames(); - anim_pal = ANIM_GetPalette(); - - basepaltable[ANIMPAL] = anim_pal; - - //setpalette(0L,256L,tempbuf); - //setbrightness(ud.brightness>>2,tempbuf,2); - P_SetGamePalette(g_player[myconnectindex].ps,ANIMPAL,10); - -#ifdef USE_OPENGL - gltexfiltermode = 0; - gltexapplyprops(); -#endif - - ototalclock = totalclock + 10; - - for (i=1; i 4 && totalclock > frametime + 60) - { - OSD_Printf("WARNING: slowdown in %s, skipping playback\n",fn); - goto ENDOFANIMLOOP; - } - - frametime = totalclock; - - waloff[TILE_ANIM] = (intptr_t)ANIM_DrawFrame(i); - invalidatetile(TILE_ANIM, 0, 1<<4); // JBF 20031228 - - while (totalclock < ototalclock) - { - handleevents(); - Net_GetPackets(); - - if (KB_KeyWaiting() || MOUSE_GetButtons()&LEFT_MOUSE) - goto ENDOFANIMLOOP; - - if (g_restorePalette == 1) - { - P_SetGamePalette(g_player[myconnectindex].ps,ANIMPAL,0); - g_restorePalette = 0; - } - - rotatesprite(0<<16,0<<16,65536L,512,TILE_ANIM,0,0,2+4+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - nextpage(); - } - - if (t == 10) ototalclock += 14; - else if (t == 9) ototalclock += 10; - else if (t == 7) ototalclock += 18; - else if (t == 6) ototalclock += 14; - else if (t == 5) ototalclock += 9; - else if (ud.volume_number == 3) ototalclock += 10; - else if (ud.volume_number == 2) ototalclock += 10; - else if (ud.volume_number == 1) ototalclock += 18; - else ototalclock += 10; - - if (t == 8) endanimvol41(i); - else if (t == 10) endanimvol42(i); - else if (t == 11) endanimvol43(i); - else if (t == 9) intro42animsounds(i); - else if (t == 7) intro4animsounds(i); - else if (t == 6) first4animsounds(i); - else if (t == 5) logoanimsounds(i); - else if (t < 4) endanimsounds(i); - } - -ENDOFANIMLOOP: -#ifdef USE_OPENGL - gltexfiltermode = ogltexfiltermode; - gltexapplyprops(); -#endif - MOUSE_ClearButton(LEFT_MOUSE); - ANIM_FreeAnim(); - walock[TILE_ANIM] = 1; -} diff --git a/polymer-perf/eduke32/source/anim.h b/polymer-perf/eduke32/source/anim.h deleted file mode 100644 index 6e68be0e9..000000000 --- a/polymer-perf/eduke32/source/anim.h +++ /dev/null @@ -1,35 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __anim_h__ -#define __anim_h__ - -void G_PlayAnim(const char *fn,char t); -void endanimvol43(int32_t fr); -void endanimvol42(int32_t fr); -void endanimvol41(int32_t fr); -void intro42animsounds(int32_t fr); -void first4animsounds(int32_t fr); -void intro4animsounds(int32_t fr); -void logoanimsounds(int32_t fr); -void endanimsounds(int32_t fr); -#endif diff --git a/polymer-perf/eduke32/source/astub.c b/polymer-perf/eduke32/source/astub.c deleted file mode 100644 index 5eeff82d1..000000000 --- a/polymer-perf/eduke32/source/astub.c +++ /dev/null @@ -1,11497 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "compat.h" -#include "build.h" -#include "editor.h" -#include "pragmas.h" -#include "baselayer.h" -#include "names.h" -#include "osd.h" -#include "osdfuncs.h" -#include "cache1d.h" - -#include "mapster32.h" -#include "keys.h" - -#include "keyboard.h" -#include "scriptfile.h" -#include "crc32.h" - -#include "sounds_mapster32.h" -#include "fx_man.h" - -#include "macros.h" -#include "quicklz.h" - -#include "m32script.h" -#include "m32def.h" - -#include "rev.h" - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#include -#endif - -#include - -static int32_t floor_over_floor; - -// static char *startwin_labeltext = "Starting Mapster32..."; -static char setupfilename[]= "mapster32.cfg"; -static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp"; -static char *g_grpNamePtr = defaultduke3dgrp; -static int32_t fixmapbeforesaving = 0; -static int32_t lastsave = -180*60; -static int32_t NoAutoLoad = 0; -static int32_t spnoclip=1; - -static char default_tiles_cfg[] = "tiles.cfg"; -static int32_t pathsearchmode_oninit; - -// Sound in Mapster32 -static char defaultgamecon[] = "game.con"; -static char *gamecon = defaultgamecon; - -#pragma pack(push,1) -sound_t g_sounds[MAXSOUNDS]; -#pragma pack(pop) - -static int16_t g_definedsndnum[MAXSOUNDS]; // maps parse order index to g_sounds index -static int16_t g_sndnum[MAXSOUNDS]; // maps current order index to g_sounds index -int32_t g_numsounds = 0; -static int32_t lastupdate, mousecol, mouseadd = 1, bstatus; - -#if !defined(_WIN32) -static int32_t usecwd = 0; -#endif - -static struct strllist -{ - struct strllist *next; - char *str; -} -*CommandPaths = NULL, *CommandGrps = NULL; - -const char *scripthist[SCRIPTHISTSIZ]; -int32_t scripthistend = 0; - -int32_t showambiencesounds=2; - -int32_t autocorruptcheck = 0; -static int32_t corruptchecktimer; -static int32_t curcorruptthing=-1; - -int32_t corruptlevel=0, numcorruptthings=0, corruptthings[MAXCORRUPTTHINGS]; - -static uint32_t templenrepquot=1; - -//////////////////// Key stuff //////////////////// - -#define eitherALT (keystatus[KEYSC_LALT] || keystatus[KEYSC_RALT]) -#define eitherCTRL (keystatus[KEYSC_LCTRL] || keystatus[KEYSC_RCTRL]) -#define eitherSHIFT (keystatus[KEYSC_LSHIFT] || keystatus[KEYSC_RSHIFT]) - -#define PRESSED_KEYSC(Key) (keystatus[KEYSC_##Key] && !(keystatus[KEYSC_##Key]=0)) - - -//////////////////// Aiming //////////////////// -static const char *Typestr[] = { "Wall", "Ceiling", "Floor", "Sprite", "Wall" }; -static const char *typestr[] = { "wall", "ceiling", "floor", "sprite", "wall" }; -static const char *Typestr_wss[] = { "Wall", "Sector", "Sector", "Sprite", "Wall" }; -/*static const char *typestr_wss[] = { "wall", "sector", "sector", "sprite", "wall" };*/ - -/** The following macros multiplex between identically named fields of sector/wall/sprite, - * based on a macro parameter or the currently aimed at object (AIMED_ versions). - * They can be used on either side of an assignment. */ - -// select wall, only makes a difference with walls that have 'swap bottom of walls' bit set -#define SELECT_WALL() (AIMING_AT_WALL ? searchbottomwall : searchwall) - -#define SECFLD(i, Field) (sector[i].Field) -#define WALFLD(i, Field) (wall[i].Field) -#define SPRFLD(i, Field) (sprite[i].Field) - -// valid fields: z, stat, picnum, heinum, shade, pal, xpanning, ypanning -#define CEILINGFLOOR(iSec, Field) (*(AIMING_AT_CEILING ? &(sector[iSec].ceiling##Field) : &(sector[iSec].floor##Field))) -#define AIMED_CEILINGFLOOR(Field) CEILINGFLOOR(searchsector, Field) - -#define AIMED_SEL_WALL(Field) WALFLD(SELECT_WALL(), Field) - -// selects from wall proper or its mask -#define OVR_WALL(iWal, Field) (*(AIMING_AT_WALL ? &WALFLD(iWal, Field) : &(wall[iWal].over##Field))) -#define AIMED_SELOVR_WALL(Field) OVR_WALL(SELECT_WALL(), Field) - -// the base macro to construct field multiplexing macros: wall and sector cases undetermined -#define MUXBASE(Field, SectorCase, WallCase) (*(AIMING_AT_CEILING_OR_FLOOR ? (SectorCase) : \ - (AIMING_AT_WALL_OR_MASK ? (WallCase) : \ - &SPRFLD(searchwall, Field)))) - -#define SFBASE_CF(Field, WallCase) MUXBASE(Field, &AIMED_CEILINGFLOOR(Field), WallCase) - -#define SFBASE_(Field, WallCase) MUXBASE(Field, &SECFLD(searchsector,Field), WallCase) - -#define AIMED(Field) SFBASE_(Field, &WALFLD(searchwall, Field)) -#define AIMED_SEL(Field) SFBASE_(Field, &AIMED_SEL_WALL(Field)) -//#define AIMED_CF(Field) SFBASE_CF(Field, &WALFLD(searchwall,Field)) -#define AIMED_CF_SEL(Field) SFBASE_CF(Field, &AIMED_SEL_WALL(Field)) - -// OVR makes sense only with picnum -//#define AIMED_OVR_PICNUM SFBASE_CF(picnum, &OVR_WALL(searchwall, picnum)) -#define AIMED_SELOVR_PICNUM SFBASE_CF(picnum, &AIMED_SELOVR_WALL(picnum)) - - -static const char *ONOFF_[] = {"OFF","ON"}; -#define ONOFF(b) (ONOFF_[!!(b)]) - - -static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL; -static int32_t numdirs=0, numfiles=0; -static int32_t currentlist=0; -static int32_t tsign, mouseaction=0, mouseax=0, mouseay=0; -static int32_t repeatcountx, repeatcounty; -static int32_t infobox=3; // bit0: current window, bit1: mouse pointer, the variable should be renamed - -static char wallshades[MAXWALLS]; -static char sectorshades[MAXSECTORS][2]; -static char spriteshades[MAXSPRITES]; -static char wallpals[MAXWALLS]; -static char sectorpals[MAXSECTORS][2]; -static char spritepals[MAXSPRITES]; -static char wallflag[MAXWALLS]; - -// tile marking in tile selector for custom creation of tile groups -static int16_t tilemarked[(MAXTILES+7)>>3]; - -#ifdef POLYMER -static int16_t spritelightid[MAXSPRITES]; -_prlight *spritelightptr[MAXSPRITES]; - -static void DeletePolymerLights() -{ - int32_t i; - for (i=0; i0; i++,col--) - CLEARLINES2D(i, 1, (col<<24)|(col<<16)|(col<<8)|col); - CLEARLINES2D(i, ydim-i, 0); - enddrawing(); -} - -void message(const char *fmt, ...) -{ - char tmpstr[256]; - va_list va; - - va_start(va, fmt); - Bvsnprintf(tmpstr, 256, fmt, va); - va_end(va); - - Bstrcpy(getmessage,tmpstr); - - getmessageleng = Bstrlen(getmessage); - getmessagetimeoff = totalclock+120*2; - lastmessagetime = totalclock; - - if (!mouseaction) - OSD_Printf("%s\n", tmpstr); -} - -typedef struct _mapundo -{ - int32_t numsectors; - int32_t numwalls; - int32_t numsprites; - - sectortype *sectors; - walltype *walls; - spritetype *sprites; - - int32_t revision; - - uint32_t sectcrc, wallcrc, spritecrc; - uint32_t sectsiz, wallsiz, spritesiz; - - struct _mapundo *next; // 'redo' loads this - struct _mapundo *prev; // 'undo' loads this -} mapundo_t; - -mapundo_t *mapstate = NULL; - -int32_t map_revision = 1; - -#define QADDNSZ 400 - -void create_map_snapshot(void) -{ - int32_t j; - uint32_t tempcrc; - - /* - if (mapstate->prev == NULL && mapstate->next != NULL) // should be the first map version - mapstate = mapstate->next; - */ - - if (mapstate == NULL) - { - mapstate = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t)); - mapstate->revision = map_revision = 1; - mapstate->prev = mapstate->next = NULL; - } - else - { - if (mapstate->next != NULL) - { - mapundo_t *cur = mapstate->next; - cur->prev = NULL; - - while (cur->next) - cur = cur->next; - - do - { - if (cur->sectors && (cur->prev == NULL || (cur->sectcrc != cur->prev->sectcrc))) - Bfree(cur->sectors); - if (cur->walls && (cur->prev == NULL || (cur->wallcrc != cur->prev->wallcrc))) - Bfree(cur->walls); - if (cur->sprites && (cur->prev == NULL || (cur->spritecrc != cur->prev->spritecrc))) - Bfree(cur->sprites); - if (!cur->prev) - { - Bfree(cur); - break; - } - - cur = cur->prev; - Bfree(cur->next); - } - while (cur); - } - - mapstate->next = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t)); - mapstate->next->prev = mapstate; - - mapstate = mapstate->next; - mapstate->revision = ++map_revision; - } - - fixspritesectors(); - updatenumsprites(); - - mapstate->numsectors = numsectors; - mapstate->numwalls = numwalls; - mapstate->numsprites = numsprites; - - tempcrc = crc32once((uint8_t *)§or[0],sizeof(sectortype) * numsectors); - - - if (numsectors) - { - if (mapstate->prev && mapstate->prev->sectcrc == tempcrc) - { - mapstate->sectors = mapstate->prev->sectors; - mapstate->sectsiz = mapstate->prev->sectsiz; - mapstate->sectcrc = tempcrc; - /* OSD_Printf("found a match between undo sectors\n"); */ - } - else - { - mapstate->sectors = (sectortype *)Bcalloc(1, sizeof(sectortype) * numsectors + QADDNSZ); - mapstate->sectsiz = j = qlz_compress(§or[0], (char *)&mapstate->sectors[0], - sizeof(sectortype) * numsectors, state_compress); - mapstate->sectors = (sectortype *)Brealloc(mapstate->sectors, j); - mapstate->sectcrc = tempcrc; - } - - if (numwalls) - { - tempcrc = crc32once((uint8_t *)&wall[0],sizeof(walltype) * numwalls); - - - if (mapstate->prev && mapstate->prev->wallcrc == tempcrc) - { - mapstate->walls = mapstate->prev->walls; - mapstate->wallsiz = mapstate->prev->wallsiz; - mapstate->wallcrc = tempcrc; - /* OSD_Printf("found a match between undo walls\n"); */ - } - else - { - mapstate->walls = (walltype *)Bcalloc(1, sizeof(walltype) * numwalls + QADDNSZ); - mapstate->wallsiz = j = qlz_compress(&wall[0], (char *)&mapstate->walls[0], - sizeof(walltype) * numwalls, state_compress); - mapstate->walls = (walltype *)Brealloc(mapstate->walls, j); - mapstate->wallcrc = tempcrc; - } - } - - if (numsprites) - { - tempcrc = crc32once((uint8_t *)&sprite[0],sizeof(spritetype) * MAXSPRITES); - - if (mapstate->prev && mapstate->prev->spritecrc == tempcrc) - { - mapstate->sprites = mapstate->prev->sprites; - mapstate->spritesiz = mapstate->prev->spritesiz; - mapstate->spritecrc = tempcrc; - /*OSD_Printf("found a match between undo sprites\n");*/ - } - else - { - int32_t i = 0; - spritetype *tspri = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites + 1), - *spri = &tspri[0]; - mapstate->sprites = (spritetype *)Bcalloc(1, sizeof(spritetype) * numsprites + QADDNSZ); - - for (j=0; jspritesiz = j = qlz_compress(&tspri[0], (char *)&mapstate->sprites[0], - sizeof(spritetype) * numsprites, state_compress); - mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j); - mapstate->spritecrc = tempcrc; - Bfree(tspri); - } - } - } - - CheckMapCorruption(6, 0); -} - -void map_undoredo_free(void) -{ - if (mapstate) - { - while (mapstate->next) - mapstate = mapstate->next; - - while (mapstate->prev) - { - mapundo_t *state = mapstate->prev; - if (mapstate->sectors && (mapstate->sectcrc != mapstate->prev->sectcrc)) Bfree(mapstate->sectors); - if (mapstate->walls && (mapstate->wallcrc != mapstate->prev->wallcrc)) Bfree(mapstate->walls); - if (mapstate->sprites && (mapstate->spritecrc != mapstate->prev->spritecrc)) Bfree(mapstate->sprites); - Bfree(mapstate); - mapstate = state; - } - - if (mapstate->sectors) Bfree(mapstate->sectors); - if (mapstate->walls) Bfree(mapstate->walls); - if (mapstate->sprites) Bfree(mapstate->sprites); - - Bfree(mapstate); - mapstate = NULL; - } - - map_revision = 1; -} - -int32_t map_undoredo(int32_t dir) -{ - int32_t i; - - if (mapstate == NULL) return 1; - - if (dir) - { - if (mapstate->next == NULL || !mapstate->next->numsectors) return 1; - - // while (map_revision+1 != mapstate->revision && mapstate->next) - mapstate = mapstate->next; - } - else - { - if (mapstate->prev == NULL || !mapstate->prev->numsectors) return 1; - - // while (map_revision-1 != mapstate->revision && mapstate->prev) - mapstate = mapstate->prev; - } - - numsectors = mapstate->numsectors; - numwalls = mapstate->numwalls; - numsprites = mapstate->numsprites; - map_revision = mapstate->revision; - - initspritelists(); - - Bmemset(show2dsector, 0, sizeof(show2dsector)); - Bmemset(show2dsprite, 0, sizeof(show2dsprite)); - Bmemset(show2dwall, 0, sizeof(show2dwall)); - Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap)); - - if (mapstate->numsectors) - { - qlz_decompress((const char *)&mapstate->sectors[0], §or[0], state_decompress); - - if (mapstate->numwalls) - qlz_decompress((const char *)&mapstate->walls[0], &wall[0], state_decompress); - - if (mapstate->numsprites) - qlz_decompress((const char *)&mapstate->sprites[0], &sprite[0], state_decompress); - } - - updatenumsprites(); - - for (i=0; inext) numdirs++; - for (r = findfiles; r; r=r->next) numfiles++; - - finddirshigh = finddirs; - findfileshigh = findfiles; - currentlist = 0; - if (findfileshigh) currentlist = 1; - - return(0); -} - -const char *ExtGetVer(void) -{ - return s_buildRev; -} - -void ExtLoadMap(const char *mapname) -{ - int32_t i; - int32_t sky=0; - - getmessageleng = 0; - getmessagetimeoff = 0; - - Bstrcpy(levelname,mapname); - pskyoff[0]=0; - for (i=0; i<8; i++) pskyoff[i]=0; - - for (i=0; i= MAX_TILE_GROUPS || s_TileGroups[group].szText == NULL) - { - // group isn't valid. - return 0; - } - for (temp=0; temp 10000 && lotag < 32767) - Bsprintf(tempbuf,"1 TIME SOUND"); - // else Bsprintf(tempbuf,"%hu",lotag); - break; - } - return(tempbuf); -} - -const char *ExtGetSectorCaption(int16_t sectnum) -{ - static char tempbuf[64]; - - Bmemset(tempbuf, 0, sizeof(tempbuf)); - - if (qsetmode != 200 && ((onnames!=1 && onnames!=4 && onnames!=7) || onnames==8)) - return tempbuf; - - if (qsetmode == 200 || (sector[sectnum].lotag|sector[sectnum].hitag)) - { - Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag)); - if (qsetmode != 200) - Bsprintf(tempbuf,"%hu,%hu %s", sector[sectnum].hitag, sector[sectnum].lotag, lo); - else - Bsprintf(tempbuf,"%hu %s", sector[sectnum].lotag, lo); - } - return(tempbuf); -} - -const char *ExtGetWallCaption(int16_t wallnum) -{ - static char tempbuf[64]; - - Bmemset(tempbuf,0,sizeof(tempbuf)); - - if (wall[wallnum].cstat & (1<<14)) - { - Bsprintf(tempbuf,"%d", wallength(wallnum)); - wall[wallnum].cstat &= ~(1<<14); - return(tempbuf); - } - - if (!(onnames==2 || onnames==4)) - { - tempbuf[0] = 0; - return(tempbuf); - } - - // HERE - - if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0) - tempbuf[0] = 0; - else - Bsprintf(tempbuf, "%hu,%hu", wall[wallnum].hitag, wall[wallnum].lotag); - - return(tempbuf); -} //end - -const char *SectorEffectorTagText(int32_t lotag) -{ - static char tempbuf[64]; - - static const char *tags[] = - { - "ROTATED SECTOR", // 0 - "PIVOT SPRITE FOR SE 0", - "EARTHQUAKE", - "RANDOM LIGHTS AFTER SHOT OUT", - "RANDOM LIGHTS", - "(UNKNOWN)", // 5 - "SUBWAY", - "TRANSPORT", - "UP OPEN DOOR LIGHTS", - "DOWN OPEN DOOR LIGHTS", - "DOOR AUTO CLOSE (H=DELAY)", // 10 - "ROTATE SECTOR DOOR", - "LIGHT SWITCH", - "EXPLOSIVE", - "SUBWAY CAR", - "SLIDE DOOR (ST 25)", // 15 - "ROTATE REACTOR SECTOR", - "ELEVATOR TRANSPORT (ST 15)", - "INCREMENTAL SECTOR RISE/FALL", - "CEILING FALL ON EXPLOSION", - "BRIDGE (ST 27)", // 20 - "DROP FLOOR (ST 28)", - "TEETH DOOR (ST 29)", - "1-WAY SE7 DESTINATION (H=SE 7)", - "CONVAYER BELT", - "ENGINE", // 25 - "(UNKNOWN)", - "CAMERA FOR PLAYBACK", - "LIGHTNING (H= TILE#4890)", - "FLOAT", - "2 WAY TRAIN (ST=31)", // 30 - "FLOOR RISE", - "CEILING FALL", - "SPAWN JIB W/QUAKE", - }; - - Bmemset(tempbuf,0,sizeof(tempbuf)); - - if (lotag>=0 && lotag<(int32_t)(sizeof(tags)/sizeof(tags[0]))) - Bsprintf(tempbuf, "%d: %s", lotag, tags[lotag]); - else - switch (lotag) - { - case 36: - Bsprintf(tempbuf,"%d: SKRINK RAY SHOOTER",lotag); - break; - case 49: - Bsprintf(tempbuf,"%d: POINT LIGHT",lotag); - break; - case 50: - Bsprintf(tempbuf,"%d: SPOTLIGHT",lotag); - break; - default: - Bsprintf(tempbuf,"%d: (UNKNOWN)",lotag); - break; - } - - return (tempbuf); -} - -const char *MusicAndSFXTagText(int32_t lotag) -{ - static char tempbuf[16]; - - Bmemset(tempbuf, 0, sizeof(tempbuf)); - - if (g_numsounds <= 0) - return tempbuf; - - if (lotag>0 && lotag<999 && g_sounds[lotag].definedname) - return g_sounds[lotag].definedname; - - if (lotag>=1000 && lotag<2000) - Bsprintf(tempbuf, "REVERB"); - return tempbuf; -} - -const char *SectorEffectorText(int32_t spritenum) -{ - static char tempbuf[64]; - - Bmemset(tempbuf, 0, sizeof(tempbuf)); - Bmemset(lo, 0, sizeof(lo)); - - Bstrcpy(lo, SectorEffectorTagText(sprite[spritenum].lotag)); - if (!lo[5]) // tags are 5 chars or less - SpriteName(spritenum, tempbuf); - else - Bsprintf(tempbuf, "SE %s",lo); - - return (tempbuf); -} - -const char *ExtGetSpriteCaption(int16_t spritenum) -{ - static char tempbuf[1024]; - int32_t retfast = 0; - - Bmemset(tempbuf,0,sizeof(tempbuf)); - - if (!(onnames>=3 && onnames<=8) || (onnames==7 && sprite[spritenum].picnum!=SECTOREFFECTOR)) - retfast = 1; - if (onnames==5 && !tileInGroup(tilegroupItems, sprite[spritenum].picnum)) - retfast = 1; - if (onnames==6 && sprite[spritenum].picnum != sprite[cursprite].picnum) - retfast = 1; - - if (retfast) - return(tempbuf); - - if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0) - { - SpriteName(spritenum,lo); - if (lo[0]!=0) - { - if (sprite[spritenum].pal==1) Bsprintf(tempbuf,"%s (MULTIPLAYER)",lo); - else Bsprintf(tempbuf,"%s",lo); - } - } - else if (sprite[spritenum].picnum==SECTOREFFECTOR) - { - if (onnames!=8) - { - Bsprintf(lo,"%s",SectorEffectorText(spritenum)); - Bsprintf(tempbuf,"%s, %hu",lo,sprite[spritenum].hitag); - } - } - else - { - SpriteName(spritenum,lo); - if (sprite[spritenum].extra != -1) - Bsprintf(tempbuf,"%hu,%hu,%d %s",sprite[spritenum].hitag,sprite[spritenum].lotag,sprite[spritenum].extra,lo); - else - Bsprintf(tempbuf,"%hu,%hu %s",sprite[spritenum].hitag,sprite[spritenum].lotag,lo); - } - - return(tempbuf); - -} //end - -//printext16 parameters: -//printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, -// char name[82], char fontsize) -// xpos 0-639 (top left) -// ypos 0-479 (top left) -// col 0-15 -// backcol 0-15, -1 is transparent background -// name -// fontsize 0=8*8, 1=3*5 - -//drawline16 parameters: -// drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) -// x1, x2 0-639 -// y1, y2 0-143 (status bar is 144 high, origin is top-left of STATUS BAR) -// col 0-15 - -static void PrintStatus(const char *string, int32_t num, int32_t x, int32_t y, int32_t color) -{ - Bsprintf(tempbuf, "%s %d", string, num); - printext16(x*8, ydim-STATUS2DSIZ+y*8, editorcolors[color], -1, tempbuf, 0); -} - -void ExtShowSectorData(int16_t sectnum) //F5 -{ - int32_t x,x2,y; - int32_t i,yi; - int32_t secrets=0; - int32_t totalactors1=0,totalactors2=0,totalactors3=0,totalactors4=0; - int32_t totalrespawn=0; - - UNREFERENCED_PARAMETER(sectnum); - if (qsetmode==200) - return; - - for (i=0; i=0 && sprite[i].picnum=MAXTILES) - continue; - - switch (pic) - { - case CASES_LIZTROOP: - numsprite[LIZTROOP]++; - break; - case PIGCOP: case PIGCOPSTAYPUT: case PIGCOPDIVE: - numsprite[PIGCOP]++; - break; - case LIZMAN: case LIZMANSTAYPUT: case LIZMANSPITTING: case LIZMANFEEDING: case LIZMANJUMP: - numsprite[LIZMAN]++; - break; - case CASES_BOSS1: - if (runi==0 || sprite[i].pal==0) - numsprite[BOSS1]++; - else - multisprite[BOSS1]++; - break; - case COMMANDER: - case COMMANDERSTAYPUT: - numsprite[COMMANDER]++; - break; - case OCTABRAIN: - case OCTABRAINSTAYPUT: - numsprite[OCTABRAIN]++; - break; - case RECON: case DRONE: case ROTATEGUN: case EGG: case ORGANTIC: case GREENSLIME: - case BOSS2: case BOSS3: case TANK: case NEWBEAST: case NEWBEASTSTAYPUT: case BOSS4: - numsprite[pic]++; - break; - default: - break; - } - } - -#undef CASES_LIZTROOP -#undef CASES_BOSS1 - - total=0; - for (i=0; ixmax) xmax=x; - } - tempbuf[x]=0; - - if (do3d) - printext256(xx*4,(y*6)+2,whitecol,-1,tempbuf,1); - else - printext16(xx*4,ydim-STATUS2DSIZ+(y*6)+2,editorcolors[11],-1,tempbuf,1); - - x=0; - y++; - if (y>18) - { - col++; - y=6; - xx+=xmax; - xmax=0; - } - } - enddrawing(); - - kclose(fp); - -}// end ShowFileText - -// PK_ vvvv -typedef struct helppage_ -{ - int32_t numlines; - char line[][80]; // C99 flexible array member -} helppage_t; - -static helppage_t **helppage=NULL; -static int32_t numhelppages=0; - -static int32_t emptyline(const char *start) -{ - int32_t i; - for (i=0; i<80; i++) - { - if (start[i]=='\n' || !start[i]) break; - if (start[i]!=' ' && start[i]!='\t' && start[i]!='\r') - return 0; - } - return 1; -} - -static int32_t newpage(const char *start) -{ - int32_t i; - for (i=80-1; i>=0; i--) - { - if (start[i] == '^' && start[i+1] == 'P') - return 1; - } - return 0; -} - -#define IHELP_INITPAGES 32 -#define IHELP_INITLINES 16 - -static void ReadHelpFile(const char *name) -{ - BFILE *fp; - int32_t i, j, k, numallocpages; - int32_t pos, charsread=0; - helppage_t *hp; - char skip=0; - - initprintf("Loading \"%s\"\n",name); - - if ((fp=fopenfrompath(name,"rb")) == NULL) - { - initprintf("Error initializing integrated help: file \"%s\" not found.\n", name); - return; - } - - helppage=Bmalloc(IHELP_INITPAGES * sizeof(helppage_t *)); - numallocpages=IHELP_INITPAGES; - if (!helppage) goto HELPFILE_ERROR; - - i=0; - while (!Bfeof(fp) && !ferror(fp)) - { - while (!Bfeof(fp)) // skip empty lines - { - pos = ftell(fp); - if (Bfgets(tempbuf, 80, fp) == NULL) break; - charsread = ftell(fp)-pos; - if (!newpage(tempbuf)) - { - break; - } - } - - if (Bfeof(fp) || charsread<=0) break; - - hp=Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80); - if (!hp) goto HELPFILE_ERROR; - hp->numlines = IHELP_INITLINES; - - if (charsread == 79 && tempbuf[78]!='\n') skip=1; - j=0; - - do - { - if (j >= hp->numlines) - { - hp=Brealloc(hp, sizeof(helppage_t) + 2*hp->numlines*80); - if (!hp) goto HELPFILE_ERROR; - hp->numlines *= 2; - } - - // limit the line length to 78 chars and probably get rid of the CR - if (charsread>0) - { - tempbuf[charsread-1]=0; - if (tempbuf[charsread-2]==0x0d) tempbuf[charsread-2]=0; - } - - Bmemcpy(hp->line[j], tempbuf, 80); - - for (k=charsread; k<80; k++) hp->line[j][k]=0; - - if (skip) - { - while (fgetc(fp)!='\n' && !Bfeof(fp)) /*skip rest of line*/; - skip=0; - } - - pos = ftell(fp); - if (Bfgets(tempbuf, 80, fp) == NULL) break; - charsread = ftell(fp)-pos; - if (charsread == 79 && tempbuf[78]!='\n') skip=1; - - j++; - - } - while (!newpage(tempbuf) && !Bfeof(fp) && charsread>0); - - hp=Brealloc(hp, sizeof(helppage_t) + j*80); - if (!hp) goto HELPFILE_ERROR; - hp->numlines=j; - - if (i >= numallocpages) - { - helppage = Brealloc(helppage, 2*numallocpages*sizeof(helppage_t *)); - numallocpages *= 2; - if (!helppage) goto HELPFILE_ERROR; - } - helppage[i] = hp; - i++; - } - - helppage = Brealloc(helppage, i*sizeof(helppage_t *)); - if (!helppage) goto HELPFILE_ERROR; - numhelppages = i; - - Bfclose(fp); - return; - -HELPFILE_ERROR: - - Bfclose(fp); - initprintf("ReadHelpFile(): ERROR allocating memory.\n"); - return; -} - -// why can't MSVC allocate an array of variable size?! -#define IHELP_NUMDISPLINES 110 // ((overridepm16y>>4)+(overridepm16y>>5)+(overridepm16y>>7)-2) -#define IHELP_PATLEN 45 -extern int32_t overridepm16y; // influences clearmidstatbar16() - -static void IntegratedHelp() -{ - if (!helppage) return; - - overridepm16y = ydim;//3*STATUS2DSIZ; - - { - int32_t i, j; - static int32_t curhp=0, curline=0; - int32_t highlighthp=-1, highlightline=-1, lasthighlighttime=0; - char disptext[IHELP_NUMDISPLINES][80]; - char oldpattern[IHELP_PATLEN+1]; - - Bmemset(oldpattern, 0, sizeof(char)); - // clearmidstatbar16(); - - while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F1]==0) - { - begindrawing(); - CLEARLINES2D(0, ydim, 0); - enddrawing(); - - idle_waitevent(); - if (handleevents()) - quitevent = 0; - - // printmessage16("Help mode, press to exit"); - - if (PRESSED_KEYSC(T)) // goto table of contents - { - curhp=0; - curline=0; - } - else if (PRESSED_KEYSC(G)) // goto arbitrary page - { - curhp=getnumber16("Goto page: ", 0, numhelppages-1, 0); - curline=0; - } - else if (PRESSED_KEYSC(UP)) // scroll up - { - if (curline>0) curline--; - } - else if (PRESSED_KEYSC(DOWN)) // scroll down - { - if (curline + 32/*+IHELP_NUMDISPLINES*/ < helppage[curhp]->numlines) curline++; - } - else if (PRESSED_KEYSC(PGUP)) // scroll one page up - { - i=IHELP_NUMDISPLINES; - while (i>0 && curline>0) i--, curline--; - } - else if (PRESSED_KEYSC(PGDN)) // scroll one page down - { - i=IHELP_NUMDISPLINES; - while (i>0 && curline + 32/*+IHELP_NUMDISPLINES*/ < helppage[curhp]->numlines) i--, curline++; - } - else if (PRESSED_KEYSC(SPACE)) // goto next paragraph - { - for (i=curline, j=0; i < helppage[curhp]->numlines; i++) - { - if (emptyline(helppage[curhp]->line[i])) { j=1; continue; } - if (j==1 && !emptyline(helppage[curhp]->line[i])) { j=2; break; } - } - if (j==2) - { - if (i + 32 /*+IHELP_NUMDISPLINES*/ < helppage[curhp]->numlines) - curline=i; - else if (helppage[curhp]->numlines - 32/*-IHELP_NUMDISPLINES*/ > curline) - curline = helppage[curhp]->numlines - 32/*-IHELP_NUMDISPLINES*/; - } - } - else if (PRESSED_KEYSC(BS)) // goto prev paragraph - { - for (i=curline-1, j=0; i>=0; i--) - { - if (!emptyline(helppage[curhp]->line[i])) { j=1; continue; } - if (j==1 && emptyline(helppage[curhp]->line[i])) { j=2; break; } - } - if (j==2 || i==-1) curline=i+1; - } - else if (PRESSED_KEYSC(HOME)) // goto beginning of page - { - curline=0; - } - else if (PRESSED_KEYSC(END)) // goto end of page - { - if ((curline=helppage[curhp]->numlines - 32/*-IHELP_NUMDISPLINES*/) >= 0) /**/; - else curline=0; - } - else if (PRESSED_KEYSC(LEFT) || PRESSED_KEYSC(LBRACK)) // prev page - { - if (curhp>0) - { - curhp--; - curline=0; - } - } - else if (PRESSED_KEYSC(RIGHT) || PRESSED_KEYSC(RBRACK)) // next page - { - if (curhp 0) - { - if (i > 0 && (ch == 8 || ch == 127)) - { - i--; - pattern[i] = 0; - } - else if (i < IHELP_PATLEN && ch >= 32 && ch < 128) - { - pattern[i++] = ch; - pattern[i] = 0; - } - } - } - - if (bad==1) - { - keystatus[KEYSC_ESC] = keystatus[KEYSC_Q] = keystatus[KEYSC_F1] = 0; - } - - if (bad==2) - { - keystatus[KEYSC_ENTER] = 0; - - for (i=curhp; inumlines; j++) - { - // entering an empty pattern will search with the last used pattern - if (strstr(helppage[i]->line[j], pattern[0]?pattern:oldpattern)) - { - curhp = i; - - if ((curline=j) <= helppage[i]->numlines - 32 /*-IHELP_NUMDISPLINES*/) /**/; - else if ((curline=helppage[i]->numlines- 32 /*-IHELP_NUMDISPLINES*/) >= 0) /**/; - else curline=0; - - highlighthp = i; - highlightline = j; - lasthighlighttime = totalclock; - goto ENDFOR1; - } - } - } -ENDFOR1: - if (pattern[0]) - Bmemcpy(oldpattern, pattern, IHELP_PATLEN+1); - } - } - else // '1'-'0' on the upper row - { - for (i=2; i<=11; i++) - if (keystatus[i]) break; - if (i--<12 && inumlines) - _printmessage16("%s", helppage[0]->line[curhp]); - else - _printmessage16("%d. (Untitled page)", curhp); - - for (i=0; j=(curhp==0)?(i+curline+1):(i+curline), - inumlines; i++) - { - if (ydim-overridepm16y+28+i*9+32 >= ydim) - break; - Bmemcpy(disptext[i], helppage[curhp]->line[j], 80); - printext16(8, ydim-overridepm16y+28+i*9, editorcolors[10], - (j==highlightline && curhp==highlighthp - && totalclock-lasthighlighttime<120*5) ? - editorcolors[1] : -1, - disptext[i], 0); - } - - showframe(1); - } - - overridepm16y = -1; - // i=ydim16; - // ydim16=ydim; - // drawline16(0,ydim-STATUS2DSIZ,xdim-1,ydim-STATUS2DSIZ,editorcolors[1]); - // ydim16=i; - // // printmessage16(""); - // showframe(1); - - keystatus[KEYSC_ESC] = keystatus[KEYSC_Q] = keystatus[KEYSC_F1] = 0; - } -} - -#define SOUND_NUMDISPLINES IHELP_NUMDISPLINES -//extern char SoundToggle; - -static int32_t compare_sounds_s(int16_t k1, int16_t k2) -{ - return (int32_t)k1 - (int32_t)k2; -} -static int32_t compare_sounds_d(int16_t k1, int16_t k2) -{ - sound_t *s1 = &g_sounds[k1], *s2 = &g_sounds[k2]; - char *n1 = s1->definedname, *n2 = s2->definedname; - - if (!n1 && !n2) return 0; - if (!n1) return -1; - if (!n2) return 1; - return Bstrcasecmp(n1, n2); -} -static int32_t compare_sounds_f(int16_t k1, int16_t k2) -{ - sound_t *s1 = &g_sounds[k1], *s2 = &g_sounds[k2]; - char *n1 = s1->filename, *n2 = s2->filename; - - if (!n1 && !n2) return 0; - if (!n1) return -1; - if (!n2) return 1; - return Bstrcasecmp(n1, n2); -} -static int32_t compare_sounds_1(int16_t k1, int16_t k2) -{ - return (g_sounds[k2].m&1) - (g_sounds[k1].m&1); -} -static int32_t compare_sounds_2(int16_t k1, int16_t k2) -{ - return (g_sounds[k2].m&2) - (g_sounds[k1].m&2); -} -static int32_t compare_sounds_3(int16_t k1, int16_t k2) -{ - return (g_sounds[k2].m&4) - (g_sounds[k1].m&4); -} -static int32_t compare_sounds_4(int16_t k1, int16_t k2) -{ - return (g_sounds[k2].m&8) - (g_sounds[k1].m&8); -} -static int32_t compare_sounds_5(int16_t k1, int16_t k2) -{ - return (g_sounds[k2].m&16) - (g_sounds[k1].m&16); -} - - -static int32_t sort_sounds(int32_t how) -{ - int32_t (*compare_sounds)(int16_t, int16_t) = NULL; - - int32_t ms, ofs, l, lb, r, rb, d, n, k1, k2; - int16_t *src, *dst, *source, *dest, *tmp; - - n = g_numsounds; - src = source = g_sndnum; - dest = Bmalloc(sizeof(int16_t) * n); - dst = dest; - if (!dest) return -1; - - switch (how) - { - case 'g': // restore original order - Bmemcpy(g_sndnum, g_definedsndnum, sizeof(int16_t)*n); - return 0; - case 's': - compare_sounds = compare_sounds_s; - break; - case 'd': - compare_sounds = compare_sounds_d; - break; - case 'f': - compare_sounds = compare_sounds_f; - break; - case '1': - compare_sounds = compare_sounds_1; - break; - case '2': - compare_sounds = compare_sounds_2; - break; - case '3': - compare_sounds = compare_sounds_3; - break; - case '4': - compare_sounds = compare_sounds_4; - break; - case '5': - compare_sounds = compare_sounds_5; - break; - default: - return -2; - } - - for (ms=1; ms= lb) - { - dst[d++] = src[r++]; - continue; - } - if (r >= rb) - { - dst[d++] = src[l++]; - continue; - } - k1 = src[l]; - k2 = src[r]; - if (compare_sounds(k1, k2) <= 0) - { - dst[d++] = src[l++]; - continue; - } - dst[d++] = src[r++]; - } - } - tmp = src; - src = dst; - dst = tmp; - } - if (src != source) - Bmemcpy(source, src, sizeof(int16_t) * n); - - Bfree(dest); - return 0; -} - -static void SoundDisplay() -{ - if (g_numsounds <= 0) return; - - overridepm16y = ydim;//3*STATUS2DSIZ; - - { - int32_t i, j; - // cursnd is the first displayed line, cursnd+curofs is where the cursor is - static int32_t cursnd=0, curofs=0; - char disptext[SOUND_NUMDISPLINES][80]; - - // SoundToggle = 1; - - while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0 - && keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode - { - begindrawing(); - CLEARLINES2D(0, ydim16, 0); - enddrawing(); - - idle_waitevent(); - if (handleevents()) - quitevent = 0; - -// drawgradient(); - - begindrawing(); - printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Sound Index", 0); - printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -1, "Sound Index", 0); - printext16(8 + 11*8 + 2*8, ydim2d-overridepm16y+8, editorcolors[15], -1, "(SPACE:play, S:sort)", 0); - enddrawing(); - - if (PRESSED_KEYSC(G)) // goto specified sound# - { - _printmessage16(" "); - j = getnumber16("Goto sound#: ", 0, g_numsounds-1, 0); - for (i=0; i=g_numsounds- 32/*SOUND_NUMDISPLINES*/) - cursnd = g_numsounds-32/*SOUND_NUMDISPLINES*/, curofs = i-cursnd; - else - curofs = 32/*SOUND_NUMDISPLINES*//2, cursnd = i-curofs; - } - } - else if (PRESSED_KEYSC(UP)) // scroll up - { - if (curofs>0) curofs--; - else if (cursnd>0) cursnd--; - } - else if (PRESSED_KEYSC(DOWN)) // scroll down - { - if (curofs<32/*SOUND_NUMDISPLINES*/-1 && cursnd+curofs0 && curofs>0) - i--, curofs--; - while (i>0 && cursnd>0) - i--, cursnd--; - } - else if (PRESSED_KEYSC(PGDN)) // scroll one page down - { - i=SOUND_NUMDISPLINES; - - while (i>0 && curofs<32/*SOUND_NUMDISPLINES*/-1 && cursnd+curofs0 && cursnd+32/*SOUND_NUMDISPLINES*/ < g_numsounds) - i--, cursnd++; - } - else if (PRESSED_KEYSC(SPACE) || PRESSED_KEYSC(ENTER)) // play/stop sound - { - int32_t j = cursnd+curofs; - int32_t k = g_sndnum[j]; - - if (S_CheckSoundPlaying(0, k) > 0) - S_StopSound(k); - else - S_PlaySound(k); - } - else if (PRESSED_KEYSC(HOME)) // goto first sound# - { - cursnd = curofs = 0; - } - else if (PRESSED_KEYSC(END)) // goto last sound# - { - if ((cursnd=g_numsounds-32/*SOUND_NUMDISPLINES*/) >= 0) - curofs=32/*SOUND_NUMDISPLINES*/-1; - else - { - cursnd = 0; - curofs = g_numsounds-1; - } - } - - _printmessage16(" FILE NAME PITCH RANGE PRI FLAGS VOLUME"); - for (i=0; j=cursnd+i, i= ydim) break; - - Bsprintf(disptext[i], - "%4d .................... ................ %6d:%-6d %3d %c%c%c%c%c %6d", - // 5678901234567890X23456789012345678901234567 - k, snd->ps, snd->pe, snd->pr, - snd->m&1 ? 'R':'-', snd->m&2 ? 'M':'-', snd->m&4 ? 'D':'-', - snd->m&8 ? 'P':'-', snd->m&16 ? 'G':'-', snd->vo); - for (l = Bsnprintf(disptext[i]+5, 20, "%s", snd->definedname); l<20; l++) - disptext[i][5+l] = ' '; - if (snd->filename) - { - l = Bstrlen(snd->filename); - if (l<=16) - cp = snd->filename; - else - cp = snd->filename + l-15; - for (m = Bsnprintf(disptext[i]+26, 16, "%s", cp); m<16; m++) - disptext[i][26+m] = ' '; - if (l>16) - disptext[i][26] = disptext[i][27] = disptext[i][28] = '.'; - } - - printext16(8, ydim-overridepm16y+28+i*9, - keystatus[KEYSC_S]?editorcolors[8] : (S_CheckSoundPlaying(-1, k) ? editorcolors[2] : editorcolors[10]), - j==cursnd+curofs ? editorcolors[1] : -1, - disptext[i], 0); - } - - if (keystatus[KEYSC_S]) // sorting - { - - char ch, bad=0; - - _printmessage16("Sort by: (S)oundnum (D)ef (F)ile ori(g) or flags (12345)"); - showframe(1); - - i=0; - bflushchars(); - while (bad == 0) - { - idle_waitevent(); - if (handleevents()) - quitevent = 0; - - ch = bgetchar(); - - if (keystatus[1]) bad = 1; - - else if (ch == 's' || ch == 'd' || ch == 'f' || ch == 'g' || - ch == '1' || ch == '2' || ch == '3' || ch == '4' || ch == '5') - { - bad = 2; - sort_sounds(ch); - } - } - - if (bad==1) - { - keystatus[KEYSC_ESC] = keystatus[KEYSC_Q] = keystatus[KEYSC_F2] = 0; - } - - if (bad==2) - { - keystatus[KEYSC_S] = keystatus[KEYSC_D] = keystatus[KEYSC_F] = 0; - keystatus[KEYSC_G] = keystatus[KEYSC_1] = keystatus[KEYSC_2] = 0; - keystatus[KEYSC_3] = keystatus[KEYSC_4] = keystatus[KEYSC_5] = 0; - } - } - else - showframe(1); - } - - overridepm16y = -1; - // i=ydim16; - // ydim16=ydim; - // drawline16(0,ydim-STATUS2DSIZ,xdim-1,ydim-STATUS2DSIZ,editorcolors[1]); - // ydim16=i; - // // printmessage16(""); - // showframe(1); - - FX_StopAllSounds(); - S_ClearSoundLocks(); - // SoundToggle = 0; - - keystatus[KEYSC_ESC] = keystatus[KEYSC_Q] = keystatus[KEYSC_F2] = 0; - } -} -// PK_ ^^^^ - -// from sector.c -static int32_t dist(spritetype *s1,spritetype *s2) -{ - int32_t x = klabs(s1->x-s2->x); - int32_t y = klabs(s1->y-s2->y); - int32_t z = klabs((s1->z-s2->z)>>4); - - if (x>4) + (t>>2) + (t>>3)); - } -} - -extern int32_t NumVoices; -extern int32_t g_numEnvSoundsPlaying; -int32_t AmbienceToggle = 1; //SoundToggle; -int32_t ParentalLock = 0; -#undef T1 -#define T1 (s->filler) - -// adapted from actors.c -static void M32_MoveFX(void) -{ - int32_t i, j; - int32_t x, ht; - spritetype *s; - - for (i=headspritestat[0]; i>=0; i=nextspritestat[i]) - { - s = &sprite[i]; - - if (s->picnum != MUSICANDSFX) - { - if (T1&1) - { - T1 &= (~1); - S_StopEnvSound(s->lotag, i); - } - } - else if (s->sectnum>=0) - { - ht = s->hitag; - - if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && - AmbienceToggle && sector[s->sectnum].floorz != sector[s->sectnum].ceilingz) - { - if ((g_sounds[s->lotag].m&2)) - { - x = dist((spritetype *)&pos,s); - if (x < ht && (T1&1) == 0 && FX_VoiceAvailable(g_sounds[s->lotag].pr-1)) - { - if (g_numEnvSoundsPlaying == NumVoices) - { - for (j = headspritestat[0]; j >= 0; j = nextspritestat[j]) - { - if (s->picnum == MUSICANDSFX && j != i && sprite[j].lotag < 999 && - (sprite[j].filler&1) == 1 && dist(&sprite[j],(spritetype *)&pos) > x) - { - S_StopEnvSound(sprite[j].lotag,j); - break; - } - - } - if (j == -1) continue; - } - A_PlaySound(s->lotag,i); - T1 |= 1; - } - if (x >= ht && (T1&1) == 1) - { - T1 &= (~1); - S_StopEnvSound(s->lotag,i); - } - } - } - } - } -} -#undef T1 - - -///__ShowHelpText__ - -void ExtShowSpriteData(int16_t spritenum) //F6 -{ - UNREFERENCED_PARAMETER(spritenum); - if (qsetmode != 200) - ShowFileText("sehelp.hlp", 0); - /* if (qsetmode == 200) // In 3D mode - return; - - while (KEY_PRESSED(KEYSC_F6)); - ResetKeys(); - ContextHelp(spritenum); // Get context sensitive help */ -}// end ExtShowSpriteData - -// Floor Over Floor (duke3d) - -// If standing in sector with SE42 or SE44 -// then draw viewing to SE41 and raise all =hi SE43 cielings. - -// If standing in sector with SE43 or SE45 -// then draw viewing to SE40 and lower all =hi SE42 floors. - -static int32_t fofsizex = -1; -static int32_t fofsizey = -1; -#if 0 -static void ResetFOFSize() -{ - if (fofsizex != -1) tilesizx[FOF] = fofsizex; - if (fofsizey != -1) tilesizy[FOF] = fofsizey; -} -#endif -static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,int16_t h) -{ - static int32_t tempsectorz[MAXSECTORS]; - static int32_t tempsectorpicnum[MAXSECTORS]; - - int32_t i=0,j=0,k=0; - int32_t floor1=0,floor2=0,ok=0,fofmode=0,draw_both=0; - int32_t offx,offy,offz; - - if (sprite[spnum].ang!=512) return; - - // Things are a little different now, as we allow for masked transparent - // floors and ceilings. So the FOF textures is no longer required - // if (!(gotpic[FOF>>3]&(1<<(FOF&7)))) - // return; - // gotpic[FOF>>3] &= ~(1<<(FOF&7)); - - if (tilesizx[562]) - { - fofsizex = tilesizx[562]; - tilesizx[562] = 0; - } - if (tilesizy[562]) - { - fofsizey = tilesizy[562]; - tilesizy[562] = 0; - } - - floor1=spnum; - - if (sprite[spnum].lotag==42) fofmode=40; - if (sprite[spnum].lotag==43) fofmode=41; - if (sprite[spnum].lotag==44) fofmode=40; - if (sprite[spnum].lotag==45) fofmode=41; - - // fofmode=sprite[spnum].lotag-2; - - // sectnum=sprite[j].sectnum; - // sectnum=cursectnum; - ok++; - - /* recursive? - for(j=0;j= 1024) - offz = sprite[floor2].z; - else if (fofmode==41) - offz = SPRITESEC(floor2).floorz; - else - offz = SPRITESEC(floor2).ceilingz; - - if (sprite[floor1].ang >= 1024) - offz -= sprite[floor1].z; - else if (fofmode==40) - offz -= SPRITESEC(floor1).floorz; - else - offz -= SPRITESEC(floor1).ceilingz; - - // if(ok==2) { Message("no floor2",RED); return; } - - for (j=0; j lastupdate) - { - mousecol += mouseadd; - if (mousecol >= 30 || mousecol <= 0) - { - mouseadd = -mouseadd; - mousecol += mouseadd; - } - lastupdate = totalclock + 3; - } - - switch (whitecol) - { - case 1: // Shadow Warrior - col = whitecol+mousecol; - break; - case 31: // Duke Nukem 3D - col = whitecol-mousecol; - break; - default: - col = whitecol; - break; - } - - if (col != whitecol) - { - for (i=((xdim > 640)?3:2); i<=((xdim > 640)?7:3); i++) - { - plotpixel(searchx+i,searchy,col); - plotpixel(searchx-i,searchy,col); - plotpixel(searchx,searchy-i,col); - plotpixel(searchx,searchy+i,col); - } - - for (i=1; i<=((xdim > 640)?2:1); i++) - { - plotpixel(searchx+i,searchy,whitecol); - plotpixel(searchx-i,searchy,whitecol); - plotpixel(searchx,searchy-i,whitecol); - plotpixel(searchx,searchy+i,whitecol); - } - - i = (xdim > 640)?8:4; - - plotpixel(searchx+i,searchy,0); - plotpixel(searchx-i,searchy,0); - plotpixel(searchx,searchy-i,0); - plotpixel(searchx,searchy+i,0); - } - - if (xdim > 640) - { - for (i=1; i<=4; i++) - { - plotpixel(searchx+i,searchy,whitecol); - plotpixel(searchx-i,searchy,whitecol); - plotpixel(searchx,searchy-i,whitecol); - plotpixel(searchx,searchy+i,whitecol); - } - } -} - -static int32_t AskIfSure(const char *text) -{ - int32_t retval=1; - - if (qsetmode == 200) - { - begindrawing(); //{{{ - printext256(0,0,whitecol,0,text?text:"Are you sure you want to proceed?",0); - enddrawing(); //}}} - } - else - { - _printmessage16("%s", text?text:"Are you sure you want to proceed?"); - } - - showframe(1); - - while ((keystatus[KEYSC_ESC]|keystatus[KEYSC_ENTER]|keystatus[KEYSC_SPACE]|keystatus[KEYSC_N]) == 0) - { - idle_waitevent(); - - if (handleevents()) - { - if (quitevent) - { - retval = 1; - break; - } - } - - if (PRESSED_KEYSC(Y) || PRESSED_KEYSC(ENTER)) - { - retval = 0; - break; - } - } - - if (PRESSED_KEYSC(ESC)) - retval = 1; - - return(retval); -} - -static int32_t IsValidTile(int32_t idTile) -{ - return (idTile>=0 && idTile= 0) - { - int32_t tempint; - - tempint = localartfreq[temp]; - localartfreq[temp] = localartfreq[temp+gap]; - localartfreq[temp+gap] = tempint; - - tempint = localartlookup[temp]; - localartlookup[temp] = localartlookup[temp+gap]; - localartlookup[temp+gap] = tempint; - - if (iTile == temp) - iTile = temp + gap; - else if (iTile == temp + gap) - iTile = temp; - - temp -= gap; - } - } - gap >>= 1; - } - while (gap > 0); - - // - // Set up count of number of used tiles - // - - localartlookupnum = 0; - while (localartfreq[localartlookupnum] > 0) - localartlookupnum++; - - // - // Check : If no tiles used at all then switch to displaying all tiles - // - - if (!localartfreq[0]) - { - localartlookupnum = MAXTILES; - - for (i = 0; i < MAXTILES; i++) - { - localartlookup[i] = i; - localartfreq[i] = 0; // Terrible bodge : zero tilefreq's not displayed in tile view. Still, when in Rome ... :-) - } - - iTile = idInitialTile; - } - - // - // - // - - iTopLeftTile = iTile - (iTile % nXTiles); - iTopLeftTile = clamp(iTopLeftTile, 0, MAXTILES-nDisplayedTiles); - - zoomsz = ZoomToThumbSize[s_Zoom]; - - searchx = ((iTile-iTopLeftTile)%nXTiles)*zoomsz + zoomsz/2; - searchy = ((iTile-iTopLeftTile)/nXTiles)*zoomsz + zoomsz/2; - - //////////////////////////////// - // Start of key handling code // - //////////////////////////////// - - while ((keystatus[KEYSC_ENTER]|keystatus[KEYSC_ESC]|(bstatus&1)) == 0) // <- Presumably one of these is escape key ?? - { - zoomsz = ZoomToThumbSize[s_Zoom]; - - DrawTiles(iTopLeftTile, (iTile >= localartlookupnum) ? localartlookupnum-1 : iTile, - nXTiles, nYTiles, zoomsz, moffset, - (tilesel_showerr && (iTile==iLastTile || (tilesel_showerr=0)))); - - iLastTile = iTile; - - idle_waitevent_timeout(500); - // SDL seems to miss mousewheel events when rotated slowly. - // These kludgy things seem to make it better, but I'm not sure. - - if (handleevents()) - quitevent = 0; - - getmousevalues(&mousedx,&mousedy,&bstatus); - searchx += mousedx; - searchy += mousedy; - - if (bstatus&2) - { - moffset += mousedy*2; - searchy += mousedy; - searchx -= mousedx; - - if ((moffset < 0 && iTopLeftTile > localartlookupnum-nDisplayedTiles-1) - || (moffset > 0 && iTopLeftTile==0)) - { - moffset=0; - searchy -= mousedy*2; - } - - while (moffset > zoomsz) - { - iTopLeftTile -= nXTiles; - moffset -= zoomsz; - } - while (moffset < -zoomsz) - { - iTopLeftTile += nXTiles; - moffset += zoomsz; - } - } - - // Keep the pointer visible at all times. - temp = min(zoomsz/2, 12); - searchx = clamp(searchx, temp, xdim-temp); - searchy = clamp(searchy, temp, ydim-temp); - - scrollmode = !(eitherCTRL^revertCTRL); - if (bstatus&16 && scrollmode && iTopLeftTile > 0) - { - mouseb &= ~16; - iTopLeftTile -= (nXTiles*scrollamount); - } - else if (bstatus&32 && scrollmode && iTopLeftTile < localartlookupnum-nDisplayedTiles-1) - { - mouseb &= ~32; - iTopLeftTile += (nXTiles*scrollamount); - } - - mtile = iTile = searchx/zoomsz + ((searchy-moffset)/zoomsz)*nXTiles + iTopLeftTile; - while (iTile >= iTopLeftTile + nDisplayedTiles) - { - iTile -= nXTiles; - mtile = iTile; - } - - // These two lines are so obvious I don't need to comment them ...;-) - synctics = totalclock-lockclock; - lockclock += synctics; - - // Zoom in / out using numeric key pad's / and * keys - if (((keystatus[KEYSC_gSLASH] || (!scrollmode && bstatus&16)) && s_Zoom<(signed)(NUM_ZOOMS-1)) - || ((keystatus[KEYSC_gSTAR] || (!scrollmode && bstatus&32)) && s_Zoom>0)) - { - if (PRESSED_KEYSC(gSLASH) || (!scrollmode && bstatus&16)) - { - mouseb &= ~16; - bstatus &= ~16; - - // Watch out : If editor window is small, then the next zoom level - // might get so large that even one tile might not fit ! - if (ZoomToThumbSize[s_Zoom+1]<=xdim && ZoomToThumbSize[s_Zoom+1]<=ydim) - { - // Phew, plenty of room. - s_Zoom++; - } - } - else - { - keystatus[KEYSC_gSTAR] = 0; - mouseb &= ~32; - bstatus &= ~32; - s_Zoom--; - } - - zoomsz = ZoomToThumbSize[s_Zoom]; - - if (iTile >= localartlookupnum) - iTile = localartlookupnum-1; - - // Calculate new num of tiles to display - nXTiles = xdim / zoomsz; - nYTiles = ydim / zoomsz; - // Refuse to draw less than half of a row. - if (zoomsz/2 < 12) - nYTiles--; - nDisplayedTiles = nXTiles * nYTiles; - - // Determine if the top-left displayed tile needs to - // alter in order to display selected tile - iTopLeftTile = iTile - (iTile % nXTiles); - iTopLeftTile = clamp(iTopLeftTile, 0, MAXTILES - nDisplayedTiles); - - // scroll window so mouse points the same tile as it was before zooming - iTopLeftTile -= searchx/zoomsz + ((searchy-moffset)/zoomsz)*nXTiles + iTopLeftTile-iTile; - } - - if (PRESSED_KEYSC(LEFT)) - { - if (eitherCTRL) // same as HOME, for consistency with CTRL-UP/DOWN - iTile = (iTile/nXTiles)*nXTiles; - else - iTile--; - } - - if (PRESSED_KEYSC(RIGHT)) - { - if (eitherCTRL) // same as END, for consistency with CTRL-UP/DOWN - iTile = ((iTile+nXTiles)/nXTiles)*nXTiles - 1; - else - iTile++; - } - - if (PRESSED_KEYSC(UP)) - { - if (eitherCTRL) - while (iTile-nXTiles >= iTopLeftTile) - iTile -= nXTiles; - else - iTile -= nXTiles; - } - - if (PRESSED_KEYSC(DOWN)) - { - if (eitherCTRL) - while (iTile+nXTiles < iTopLeftTile + nDisplayedTiles) - iTile += nXTiles; - else - iTile += nXTiles; - } - - if (PRESSED_KEYSC(PGUP)) - { - if (eitherCTRL) - iTile = 0; - else - iTile -= nDisplayedTiles; - } - - if (PRESSED_KEYSC(PGDN)) - { - if (eitherCTRL) - iTile = localartlookupnum-1; - else - iTile += nDisplayedTiles; - } - - if (PRESSED_KEYSC(HOME)) - { - if (eitherCTRL) - iTile = iTopLeftTile; - else - iTile = (iTile/nXTiles)*nXTiles; - } - - if (PRESSED_KEYSC(END)) - { - if (eitherCTRL) - iTile = iTopLeftTile + nDisplayedTiles - 1; - else - iTile = ((iTile+nXTiles)/nXTiles)*nXTiles - 1; - } - - // 'V' KEYPRESS - if (PRESSED_KEYSC(V)) - iTile = SelectAllTiles(iTile); - - // 'G' KEYPRESS - Goto frame - if (PRESSED_KEYSC(G)) - { - if (eitherCTRL) - { - if (OnSaveTileGroup() == 0) - { -// iTile = SelectAllTiles(iTile); - Bmemset(tilemarked, 0, sizeof(tilemarked)); - mark_lastk = -1; - noTilesMarked = 1; - } - } - else - iTile = OnGotoTile(iTile); - } - - // 'U' KEYPRESS : go straight to user defined art - if (PRESSED_KEYSC(U)) - { - SelectAllTiles(iTile); - iTile = FIRST_USER_ART_TILE; - } - - // 'A' KEYPRESS : Go straight to start of Atomic edition's art - if (PRESSED_KEYSC(A)) - { - SelectAllTiles(iTile); - iTile = FIRST_ATOMIC_TILE; - } - - // 'E' KEYPRESS : Go straight to start of extended art - if (PRESSED_KEYSC(E)) - { - SelectAllTiles(iTile); - - if (iTile == FIRST_EXTENDED_TILE) - iTile = SECOND_EXTENDED_TILE; - else iTile = FIRST_EXTENDED_TILE; - } - - // 'T' KEYPRESS = Select from pre-defined tileset - if (PRESSED_KEYSC(T)) - iTile = OnSelectTile(iTile); - - if (PRESSED_KEYSC(Z)) - s_TileZoom = !s_TileZoom; - - // - // Ensure tilenum is within valid range - // - iTile = clamp(iTile, 0, min(MAXTILES-1, localartlookupnum+nDisplayedTiles-1)); - - // 'S' KEYPRESS: search for named tile - if (PRESSED_KEYSC(S)) - { - static char laststr[25] = ""; - const char *searchstr = getstring_simple("Search for tile name: ", laststr, MAXTILES-1); - static char buf[2][25]; - - if (searchstr && searchstr[0]) - { - int32_t i, i0, slen=Bstrlen(searchstr)-1; - - Bstrncpy(laststr, searchstr, 25); - laststr[24] = 0; - i0 = localartlookup[iTile]; - - Bmemcpy(buf[0], laststr, 25); - Bstrupr(buf[0]); - - for (i=(i0+1)%MAXTILES; i!=i0; i=(i+1)%MAXTILES) - { - Bmemcpy(buf[1], names[i], 25); - buf[1][24]=0; - Bstrupr(buf[1]); - - if ((searchstr[0]=='^' && !Bstrncmp(buf[1], buf[0]+1, slen)) || - (searchstr[0]!='^' && strstr(buf[1], buf[0]))) - { - SelectAllTiles(i); - iTile = i; - break; - } - } - } - } - - // - // Adjust top-left to ensure tilenum is within displayed range of tiles - // - - while (iTile < iTopLeftTile - (moffset<0)?nXTiles:0) - iTopLeftTile -= nXTiles; - - while (iTile >= iTopLeftTile + nDisplayedTiles) - iTopLeftTile += nXTiles; - - iTopLeftTile = clamp(iTopLeftTile, 0, MAXTILES - nDisplayedTiles); - - - // SPACE keypress: mark/unmark selected tile - if (PRESSED_KEYSC(SPACE)) - { - if (iTile < localartlookupnum && IsValidTile(localartlookup[iTile])) - { - if (keystatus[KEYSC_LCTRL] && keystatus[KEYSC_RSHIFT]) - { - Bmemset(tilemarked, 0, sizeof(tilemarked)); - mark_lastk = -1; - noTilesMarked = 1; - } - else - { - int32_t k=iTile, kend, dir; - - if (noTilesMarked) - { - noTilesMarked = 0; - TMPERRMSG_PRINT("Beginning marking tiles. To group, press Ctrl-G. To reset, press LCtrl-RShift-SPACE."); - } - - if (mark_lastk>=0 && eitherCTRL) - { - kend = mark_lastk; - dir = ksgn(mark_lastk-k); - } - else - { - kend = k; - dir = 0; - } - - mark_lastk = k; - - for (; dir==0 || dir*(kend-k)>=1; k+=dir) - { - tilemarked[localartlookup[k]>>3] ^= (1<<(localartlookup[k]&7)); - if (dir==0) - break; - } - } - } - } - - if ((keystatus[KEYSC_ENTER] || (bstatus&1)) == 0) // uh ? Not escape key ? - { - idSelectedTile = idInitialTile; - } - else - { - if (iTile < localartlookupnum) - { - // Convert tile num from index to actual tile num - idSelectedTile = localartlookup[iTile]; - - // Check : if invalid tile selected, return original tile num - if (!IsValidTile(idSelectedTile)) - idSelectedTile = idInitialTile; - } - else - { - idSelectedTile = idInitialTile; - } - } - if (mtile!=iTile) // if changed by keyboard, update mouse cursor - { - searchx = ((iTile-iTopLeftTile)%nXTiles) * zoomsz + zoomsz/2; - searchy = ((iTile-iTopLeftTile)/nXTiles) * zoomsz + zoomsz/2 + moffset; - } - } - - searchx=omousex; - searchy=omousey; - - keystatus[KEYSC_ESC] = 0; - keystatus[KEYSC_ENTER] = 0; - - return idSelectedTile; -} - -// Dir = 0 (zoom out) or 1 (zoom in) -//void OnZoomInOut( int32_t *pZoom, int32_t Dir /*0*/ ) -//{ -//} - -static int32_t OnSaveTileGroup() -{ - int32_t i, n=0; - char hotkey; - const char *cp, *name; - - if (tile_groups==MAX_TILE_GROUPS) - TMPERRMSG_RETURN("Cannot save tile group: maximum number of groups (%d) exceeded.", MAX_TILE_GROUPS); - - for (i=0; i>3]&(1<<(i&7))); - - if (n==0) - TMPERRMSG_RETURN("Cannot save tile group: no tiles marked."); - else if (n > MAX_TILE_GROUP_ENTRIES) - TMPERRMSG_RETURN("Cannot save tile group: too many tiles in group. Have %d, max is %d.", - n, MAX_TILE_GROUP_ENTRIES); - - cp = getstring_simple("Hotkey for new group: ", "", 1); - if (!cp || !*cp) - return 1; - - hotkey = Btoupper(cp[0]); - if (!isalpha(hotkey)) - TMPERRMSG_RETURN("Hotkey must be alphabetic."); - - for (i=0; i>3]&(1<<((i)&7)))) - Bfprintf(fp, "\n"); - Bfprintf(fp, "tilegroup \"%s\"\n{\n", name); - Bfprintf(fp, TTAB "hotkey \"%c\"\n\n", hotkey); - - if (!(s_TileGroups[tile_groups].pIds = Bmalloc(n * sizeof(s_TileGroups[tile_groups].pIds[0])))) - TMPERRMSG_RETURN("Out of memory."); - - j = 0; - // tileranges for consecutive runs of 3 or more tiles - for (i=0; i=0 && !TBITCHK(i)) - { - if (names[lasti][0] && names[i-1][0]) - Bfprintf(fp, TTAB "tilerange %s %s\n", names[lasti], names[i-1]); - else - Bfprintf(fp, TTAB "tilerange %d %d\n", lasti, i-1); - - for (k=lasti; k>3] &= ~(1<<(k&7)); - } - - lasti = -1; - } - else if (lasti==-1 && TBITCHK(i)) - { - if (TBITCHK(i+1) && TBITCHK(i+2)) - { - lasti = i; - i += 2; - } - } - } - if (lasti>=0 && lasti<=MAXTILES-3) - { - for (k=lasti; k>3] &= ~(1<<(k&7)); - } - Bfprintf(fp, TTAB "tilerange %d %d\n", lasti, MAXTILES-1); - } - Bfprintf(fp, "\n"); - - // throw them all in a tiles{...} group else - Bfprintf(fp, TTAB "tiles\n" TTAB "{\n"); - for (i=0; i80) - { - Bfprintf(fp, "\n"); - col = 0; - } - } - } - if (col>0) - Bfprintf(fp, "\n"); - Bfprintf(fp, TTAB "}\n"); -#undef TBITCHK -#undef TTAB - Bfprintf(fp, "}\n"); - - Bfclose(fp); - - if (!(s_TileGroups[tile_groups].szText = Bstrdup(name))) - { - Bfree(s_TileGroups[tile_groups].pIds); - TMPERRMSG_RETURN("Out of memory."); - } - - s_TileGroups[tile_groups].nIds = n; - s_TileGroups[tile_groups].key1 = Btoupper(hotkey); - s_TileGroups[tile_groups].key2 = Btolower(hotkey); - s_TileGroups[tile_groups].color1 = s_TileGroups[tile_groups].color2 = 0; - tile_groups++; - - TMPERRMSG_PRINT("Wrote and installed new tile group."); - } - - return 0; -} - - -static int32_t OnGotoTile(int32_t iTile) -{ - int32_t iTemp, iNewTile; - char ch; - char szTemp[128]; - - //Automatically press 'V' - iTile = SelectAllTiles(iTile); - - bflushchars(); - - iNewTile = iTemp = 0; //iTile; //PK - - while (keystatus[KEYSC_ESC] == 0) - { - if (handleevents()) - quitevent = 0; - - idle_waitevent(); - - ch = bgetchar(); - - Bsprintf(szTemp, "Goto tile: %d_ ", iNewTile); - printext256(0, 0, whitecol, 0, szTemp, 0); - showframe(1); - - if (ch >= '0' && ch <= '9') - { - iTemp = (iNewTile*10) + (ch-'0'); - if (iTemp < MAXTILES) - iNewTile = iTemp; - } - else if (ch == 8) - { - iNewTile /= 10; - } - else if (ch == 13) - { - iTile = iNewTile; - break; - } - } - - clearkeys(); - - return iTile; -} - - -static int32_t LoadTileSet(const int32_t idCurrentTile, const int32_t *pIds, const int32_t nIds) -{ - int32_t iNewTile = 0; - int32_t i; - - localartlookupnum = nIds; - - for (i = 0; i < localartlookupnum; i++) - { - localartlookup[i] = pIds[i]; - // REM : Could we still utilise localartfreq[] to mark - // which tiles are currently used in the map ? Set to 0xFFFF perhaps ? - localartfreq[i] = 0; - - if (idCurrentTile == pIds[i]) - iNewTile = i; - } - - return iNewTile; -} - -static int32_t OnSelectTile(int32_t iTile) -{ - int32_t bDone = 0; - int32_t i; - char ch; - - if (tile_groups <= 0) - { - TMPERRMSG_PRINT("No tile groups loaded. Check for existence of `%s'.", default_tiles_cfg); - return iTile; - } - - SelectAllTiles(iTile); - - bflushchars(); - - setpolymost2dview(); - clearview(0); - - // - // Await appropriate selection keypress. - // - - bDone = 0; - - while (keystatus[KEYSC_ESC] == 0 && !bDone) - { - if (handleevents()) - quitevent = 0; - - idle_waitevent(); - - // - // Display the description strings for each available tile group - // - for (i = 0; i < tile_groups; i++) - { - if (s_TileGroups[i].szText != NULL) - { - if ((i+2)*16 > ydimgame) break; - Bsprintf(tempbuf,"(%c) %s",s_TileGroups[i].key1,s_TileGroups[i].szText); - printext256(10L, (i+1)*16, whitecol, -1, tempbuf, 0); - } - } - showframe(1); - - ch = bgetchar(); - - for (i = 0; i < tile_groups; i++) - { - if (s_TileGroups[i].pIds != NULL && s_TileGroups[i].key1) - if ((ch == s_TileGroups[i].key1) || (ch == s_TileGroups[i].key2)) - { - iTile = LoadTileSet(iTile, s_TileGroups[i].pIds, s_TileGroups[i].nIds); - bDone = 1; - } - } - } - - showframe(1); - - clearkeys(); - - return iTile; -} - -static const char *GetTilePixels(int32_t idTile) -{ - char *pPixelData = 0; - - if (idTile >= 0 && idTile < MAXTILES) - { - if (!waloff[idTile]) - loadtile(idTile); - - if (IsValidTile(idTile)) - pPixelData = (char *)waloff[idTile]; - } - - return pPixelData; -} - -static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, int32_t nYTiles, - int32_t TileDim, int32_t offset, int32_t showmsg) -{ - int32_t XTile, YTile; - int32_t iTile, idTile; - int32_t XPos, YPos; - int32_t XOffset, YOffset; - int32_t i, marked; - const char *pRawPixels; - int32_t TileSizeX, TileSizeY; - int32_t DivInc,MulInc; - char *pScreen; - char szT[128]; - - begindrawing(); - - setpolymost2dview(); - - clearview(0); - - for (YTile = 0-(offset>0); YTile < nYTiles+(offset<0)+1; YTile++) - { - for (XTile = 0; XTile < nXTiles; XTile++) - { - iTile = iTopLeft + XTile + (YTile * nXTiles); - - if (iTile>=0 && iTile < localartlookupnum) - { - idTile = localartlookup[ iTile ]; - - // Get pointer to tile's raw pixel data - pRawPixels = GetTilePixels(idTile); - - if (pRawPixels != NULL) - { - XPos = XTile * TileDim; - YPos = YTile * TileDim+offset; - - if (polymost_drawtilescreen(XPos, YPos, idTile, TileDim, s_TileZoom)) - { - TileSizeX = tilesizx[ idTile ]; - TileSizeY = tilesizy[ idTile ]; - - DivInc = 1; - MulInc = 1; - - while ((TileSizeX/DivInc > TileDim) || (TileSizeY/DivInc) > TileDim) - { - DivInc++; - } - - if (DivInc == 1 && s_TileZoom) - { - while ((TileSizeX*(MulInc+1)) <= TileDim && (TileSizeY*(MulInc+1)) <= TileDim) - { - MulInc++; - } - } - - TileSizeX = (TileSizeX / DivInc) * MulInc; - TileSizeY = (TileSizeY / DivInc) * MulInc; - - for (YOffset = 0; YOffset < TileSizeY; YOffset++) - { - int32_t y=YPos+YOffset; - if (y>=0 && y= 0 && YPos <= ydim-20) - { - Bsprintf(szT, "%d", localartfreq[iTile]); - printext256(XPos, YPos, whitecol, -1, szT, 1); - } - } - - marked = (IsValidTile(idTile) && tilemarked[idTile>>3]&(1<<(idTile&7))); - - // - // Draw white box around currently selected tile or marked tile - // p1=(x1, y1), p2=(x1+TileDim-1, y1+TileDim-1) - // - if (iTile == iSelected || marked) - { - int32_t x1 = ((iTile-iTopLeft) % nXTiles)*TileDim; - int32_t y1 = ((iTile - ((iTile-iTopLeft) % nXTiles) - iTopLeft)/nXTiles)*TileDim + offset; - int32_t x2 = x1+TileDim-1; - int32_t y2 = y1+TileDim-1; - - char markedcol = editorcolors[14]; - - setpolymost2dview(); - - y1=max(y1, 0); - y2=min(y2, ydim-1); - - { - // box - int32_t xx[] = {x1, x1, x2, x2, x1}; - int32_t yy[] = {y1, y2, y2, y1, y1}; - plotlines2d(xx, yy, 5, iTile==iSelected ? whitecol : markedcol); - } - - // cross - if (marked) - { - int32_t xx[] = {x1, x2}; - int32_t yy[] = {y1, y2}; - - plotlines2d(xx, yy, 2, markedcol); - swaplong(&yy[0], &yy[1]); - plotlines2d(xx, yy, 2, markedcol); - } - } - } - } - } - - if (iSelected < 0 || iSelected >= MAXTILES) - { - enddrawing(); - return 1; - } - - idTile = localartlookup[ iSelected ]; - - // Draw info bar at bottom. - - // Clear out behind the text for improved visibility. - //drawline256(0, (ydim-12)<<12, xdim<<12, (ydim-12)<<12, whitecol); - for (i=ydim-12; i>2,ydim-10,whitecol,-1,szT,0); - - // EditArt offset flags. - Bsprintf(szT,"%d, %d", (int8_t)((picanm[idTile]>>8)&0xFF), (int8_t)((picanm[idTile]>>16)&0xFF)); - printext256((xdim>>2)+100,ydim-10,whitecol,-1,szT,0); - - // EditArt animation flags. - if (picanm[idTile]&0xc0) - { - static const char *anmtype[] = {"", "Osc", "Fwd", "Bck"}; - - Bsprintf(szT,"%s %d", anmtype[(picanm[idTile]&0xc0)>>6], picanm[idTile]&0x3f); - printext256((xdim>>2)+100+14*8,ydim-10,whitecol,-1,szT,0); - } - - if (showmsg) - TMPERRMSG_SHOW(0); - - m32_showmouse(); - - enddrawing(); - showframe(1); - - return(0); - -} - -#undef TMPERRMSG_SHOW -#undef TMPERRMSG_PRINT -#undef TMPERRMSG_RETURN - - -static int32_t spriteonceilingz(int32_t searchwall) -{ -// int32_t z=sprite[searchwall].z; - - int32_t z = getceilzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); - int32_t tmphei = spriteheight(searchwall, NULL); - - if (sprite[searchwall].cstat&128) - z -= tmphei>>1; - if ((sprite[searchwall].cstat&48) != 32) - z += tmphei; - return z; -} - -static int32_t spriteongroundz(int32_t searchwall) -{ -// int32_t z=sprite[searchwall].z; - - int32_t z = getflorzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); - - if (sprite[searchwall].cstat&128) - z -= spriteheight(searchwall, NULL)>>1; - return z; -} - -#define WIND1X 3 -#define WIND1Y 150 - -static void tileinfo_doprint(int32_t x, int32_t y, char *buf, const char *label, int32_t value, int32_t pos) -{ - int32_t small = (xdimgame<=640), i = ydimgame>>6; - Bsprintf(buf,"%s:%4d",label,value); - printext256(x+2, y+2+i*pos, 0, -1, buf, small); - printext256(x, y+i*pos, whitecol, -1, buf, small); -} - -static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,int32_t shade,int32_t pal,int32_t cstat,int32_t lotag,int32_t hitag,int32_t extra) -{ - char buf[64]; - int32_t small = (xdimgame<=640); - int32_t scale=65536; - int32_t x1; - int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; - - x1 = x+80; - if (small) - x1 /= 2; - - x1 *= 320.0/xdimgame; - scale /= (max(tilesizx[picnum],tilesizy[picnum])/24.0); - - setaspect(65536L, (int32_t)divscale16(ydim*320L,xdim*200L)); - // +1024: prevents rotatesprite from setting aspect itself - rotatesprite((x1+13)<<16,(y+11)<<16,scale,0, picnum,shade,pal, 2+1024, 0,0,xdim-1,ydim-1); - setaspect(oviewingrange, oyxaspect); - - x *= xdimgame/320.0; - y *= ydimgame/200.0; - - begindrawing(); - printext256(x+2,y+2,0,-1,title,small); - printext256(x,y,255-13,-1,title,small); - - tileinfo_doprint(x, y, buf, "Pic", picnum, 1); - tileinfo_doprint(x, y, buf, "Shd", shade, 2); - tileinfo_doprint(x, y, buf, "Pal", pal, 3); - tileinfo_doprint(x, y, buf, "Cst", cstat, 4); - tileinfo_doprint(x, y, buf, "Lot", lotag, 5); - tileinfo_doprint(x, y, buf, "Hit", hitag, 6); - tileinfo_doprint(x, y, buf, "Ext", extra, 7); - - enddrawing(); -} -//int32_t snap=0; -//int32_t saveval1,saveval2,saveval3; - -static inline void getnumber_dochar(char *ptr, int32_t num) -{ - *ptr = (char) num; -} - -static inline void getnumber_doint16_t(int16_t *ptr, int32_t num) -{ - *ptr = (int16_t) num; -} - -static inline void getnumber_doint32(int32_t *ptr, int32_t num) -{ - *ptr = (int32_t) num; -} - -static inline void getnumber_doint64(int64_t *ptr, int32_t num) -{ - *ptr = (int64_t) num; -} - -static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int32_t maxnumber, char sign, void *(func)(int32_t)) -{ - char buffer[80], ch; - int32_t n, danum = 0, oldnum; - - switch (bytes) - { - case 1: - danum = *(char *)num; - break; - case 2: - danum = *(int16_t *)num; - break; - case 4: - danum = *(int32_t *)num; - break; - case 8: - danum = *(int64_t *)num; - break; - } - - oldnum = danum; - bflushchars(); - while (keystatus[0x1] == 0) - { - if (handleevents()) - quitevent = 0; - - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif - - ch = bgetchar(); - - if (keystatus[0x1]) break; - - clearkeys(); - - mouseb = 0; - searchx = osearchx; - searchy = osearchy; - - ExtCheckKeys(); - - Bsprintf(buffer,"%s%d",namestart,danum); - if (totalclock & 32) Bstrcat(buffer,"_ "); - printmessage256(0, 0, buffer); - if (func != NULL) - { - Bsprintf(buffer,"%s",(char *)func((int32_t)danum)); - printmessage256(0, 9, buffer); - } - showframe(1); - - if (ch >= '0' && ch <= '9') - { - if (danum >= 0) - { - n = (danum*10)+(ch-'0'); - if (n <= maxnumber) danum = n; - } - else if (sign) - { - n = (danum*10)-(ch-'0'); - if (n >= -maxnumber) danum = n; - } - } - else if (ch == 8 || ch == 127) // backspace - { - danum /= 10; - } - else if (ch == 13) - { - if (danum != oldnum) - asksave = 1; - oldnum = danum; - break; - } - else if (ch == '-' && sign) // negate - { - danum = -danum; - } - switch (bytes) - { - case 1: - getnumber_dochar(num, danum); - break; - case 2: - getnumber_doint16_t(num, danum); - break; - case 4: - getnumber_doint32(num, danum); - break; - case 8: - getnumber_doint64(num, danum); - break; - } - } - clearkeys(); - - lockclock = totalclock; //Reset timing - - switch (bytes) - { - case 1: - getnumber_dochar(num, oldnum); - break; - case 2: - getnumber_doint16_t(num, oldnum); - break; - case 4: - getnumber_doint32(num, oldnum); - break; - case 8: - getnumber_doint64(num, oldnum); - break; - } -} - -#if 0 -int64_t ldistsqr(spritetype *s1,spritetype *s2) -{ - return (((int64_t)(s2->x - s1->x))*((int64_t)(s2->x - s1->x)) + - ((int64_t)(s2->y - s1->y))*((int64_t)(s2->y - s1->y))); -} -#endif - -static void TextEntryMode(int16_t startspr) -{ - char ch, buffer[80], doingspace=0; - int16_t daang = 0, t, alphidx, basetile, linebegspr, curspr, cursor; - int32_t i, j, k, dax = 0, day = 0; - static uint8_t hgap=0, vgap=4; - static uint8_t spcgap[MAX_ALPHABETS], firstrun=1; - spritetype *sp; - - int16_t *spritenums; - int32_t stackallocsize=32, numletters=0; - - if (firstrun) - { - firstrun=0; - for (i=0; i=MAXSPRITES || - sprite[startspr].statnum == MAXSTATUS) - return; - - if (numalphabets == 0) - { - message("Alphabet configuration not read."); - return; - } - - if ((sprite[startspr].cstat&16) == 0) - { - message("Must point at a wall-aligned text sprite."); - return; - } - - t = sprite[startspr].picnum; - alphidx = -1; - for (i=0; i>8)&255); - sprite[startspr].yoffset = -(((picanm[t])>>16)&255); - - spritenums = Bmalloc(stackallocsize * sizeof(int16_t)); - if (!spritenums) goto ERROR_NOMEMORY; - - cursor = insertsprite(sprite[startspr].sectnum,0); - if (cursor < 0) goto ERROR_TOOMANYSPRITES; - - updatenumsprites(); - - sp = &sprite[cursor]; - Bmemcpy(sp, &sprite[startspr], sizeof(spritetype)); - sp->yoffset = 0; - sp->picnum = SMALLFNTCURSOR; - sp->xrepeat = clamp(sp->xrepeat/tilesizx[sp->picnum], 2, 255); - sp->yrepeat = clamp((sp->yrepeat*tilesizy[sprite[startspr].picnum])/tilesizy[sp->picnum], 4, 255); - sp->pal = 0; - sp->cstat = 18; - - bflushchars(); - while (keystatus[0x1] == 0) - { - if (handleevents()) - quitevent = 0; - - - if (PRESSED_KEYSC(UP)) // vertical gap in pixels (32 x-units) - vgap += (vgap<255); - - if (PRESSED_KEYSC(DOWN)) - vgap -= (vgap>0); - - if (PRESSED_KEYSC(RIGHT)) // horizontal gap in half pixels - hgap += (hgap<255); - - if (PRESSED_KEYSC(LEFT)) - hgap -= (hgap>0); - - if (PRESSED_KEYSC(INSERT)) // space gap in half pixels - spcgap[alphidx] += (spcgap[alphidx]<255); - - if (PRESSED_KEYSC(DELETE)) - spcgap[alphidx] -= (spcgap[alphidx]>1); - - if (PRESSED_KEYSC(HOME)) // shade - sprite[linebegspr].shade += (sprite[linebegspr].shade<127); - - if (PRESSED_KEYSC(END)) - sprite[linebegspr].shade -= (sprite[linebegspr].shade>-128); - - if (PRESSED_KEYSC(PGUP)) // pal - sprite[linebegspr].pal += (sprite[linebegspr].pal<255); - - if (PRESSED_KEYSC(PGDN)) - sprite[linebegspr].pal -= (sprite[linebegspr].pal>0); - - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); -#ifdef POLYMER - if (rendmode == 4 && searchit == 2) - { - polymer_editorpick(); - drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); - ExtAnalyzeSprites(); - drawmasks(); - } -#endif - - ch = bgetchar(); - - if (keystatus[0x1]) break; - - clearkeys(); - - mouseb = 0; - searchx = osearchx; - searchy = osearchy; - - ExtCheckKeys(); - - printmessage256(0,0,"^251Text entry mode.^31 Navigation keys change vars."); - Bsprintf(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d", - hgap, vgap, spcgap[alphidx], sprite[linebegspr].shade, sprite[linebegspr].pal); - printmessage256(0, 9, buffer); - showframe(1); - - // --- - sp = &sprite[curspr]; - if (!doingspace) - { - dax = sp->x; day = sp->y; - daang = sp->ang; - } - - j = sp->xrepeat*(hgap+tilesizx[sp->picnum]+2); - { - vec3_t vect; - vect.x = dax + ((j*sintable[daang])>>17); - vect.y = day - ((j*sintable[(daang+512)&2047])>>17); - vect.z = sp->z; - setsprite(cursor,&vect); - } - - if (ch>=33 && ch<=126 && alphabets[alphidx].pic[ch-33] >= 0) - { - int16_t sect; - - // mapping char->tilenum - t = alphabets[alphidx].pic[ch-33]; - j = sp->xrepeat*(hgap+tilesizx[sp->picnum]+tilesizx[t]); - - dax += (j*sintable[daang])>>17; - day -= (j*sintable[(daang+512)&2047])>>17; - dax += (j*sintable[(sprite[curspr].ang+2560)&2047])>>17; - day += (j*sintable[(sprite[curspr].ang+2048)&2047])>>17; - - sect = sprite[curspr].sectnum; - updatesector(dax,day,§); - if (numsprites < MAXSPRITES && sect >= 0) - { - i = insertsprite(sect,0); - Bmemcpy(&sprite[i], &sprite[linebegspr], sizeof(spritetype)); - sprite[i].sectnum = sect; - - sprite[i].x = dax, sprite[i].y = day; - sprite[i].picnum = t; - sprite[i].ang = daang; - - sprite[i].xoffset = -(((picanm[sprite[i].picnum])>>8)&255); - sprite[i].yoffset = -(((picanm[sprite[i].picnum])>>16)&255); - sprite[i].xoffset += alphabets[alphidx].xofs[(int32_t)ch-33]; - sprite[i].yoffset += alphabets[alphidx].yofs[(int32_t)ch-33]; - - DoSpriteOrnament(i); - - for (k=0; k= stackallocsize) - { - stackallocsize *= 2; - spritenums = Brealloc(spritenums, stackallocsize*sizeof(int16_t)); - if (!spritenums) goto ERROR_NOMEMORY; - } - spritenums[numletters++] = i; - } - } - else if (ch == 32) - { - dax += ((sp->xrepeat*spcgap[alphidx]*sintable[daang])>>17); - day -= ((sp->xrepeat*spcgap[alphidx]*sintable[(daang+512)&2047])>>17); - doingspace = 1; - } - else if (ch == 8) // backspace - { - if (doingspace) - doingspace = 0; - else if (numletters > 0) - { - int16_t last = spritenums[numletters-1]; - - if (sprite[last].z != sprite[linebegspr].z) // only "delete" line break - { - sprite[linebegspr].z = sprite[last].z; - curspr = last; - } - else if (numletters > 1) - { - int16_t sectolast = spritenums[numletters-2]; - - if (sprite[last].z == sprite[sectolast].z) - curspr = sectolast; - else // if we delete the first letter on the line - curspr = linebegspr; - - numletters--; - deletesprite(last); - - updatenumsprites(); - asksave = 1; - } - else - { - numletters--; - deletesprite(last); - curspr = linebegspr; - updatenumsprites(); - asksave = 1; - } - } - else - { - sprite[linebegspr].z -= ((sprite[linebegspr].yrepeat*(vgap+tilesizy[basetile]))<<2); - asksave = 1; - } - } - else if (ch == 13) // enter - { - sprite[linebegspr].z += ((sprite[linebegspr].yrepeat*(vgap+tilesizy[basetile]))<<2); - curspr = linebegspr; - doingspace = 0; - asksave = 1; - } - } - -ERROR_TOOMANYSPRITES: - if (cursor < 0) message("Too many sprites in map!"); - else deletesprite(cursor); - updatenumsprites(); - -ERROR_NOMEMORY: - if (spritenums) Bfree(spritenums); - else message("Out of memory!"); - - clearkeys(); - - lockclock = totalclock; //Reset timing -} - -static void mouseaction_movesprites(int32_t *sumxvect, int32_t *sumyvect, int32_t yangofs, int32_t mousexory) -{ - int32_t xvect,yvect, daxvect,dayvect, ii, spi; - int32_t units, gridlock = (eitherCTRL && grid > 0 && grid < 9); - spritetype *sp = &sprite[searchwall]; - int16_t tsect = sp->sectnum; - vec3_t tvec = { sp->x, sp->y, sp->z }; - - xvect = -((mousexory*(int32_t)sintable[(ang+yangofs+512)&2047])<<3); - yvect = -((mousexory*(int32_t)sintable[(ang+yangofs)&2047])<<3); - - if (gridlock) - { - units = 1<<(11-grid); - - if ((tvec.x & (units-1)) || (tvec.y & (units-1))) - { - daxvect = ((tvec.x & ~(units-1)) - tvec.x)<<14; - dayvect = ((tvec.y & ~(units-1)) - tvec.y)<<14; - } - else - { - units <<= 14; - - *sumxvect += xvect; - *sumyvect += yvect; - - if (klabs(*sumxvect) >= units) - { - daxvect = ((*sumxvect)/units)*units; - *sumxvect %= units; - } - else - daxvect = 0; - - if (klabs(*sumyvect) >= units) - { - dayvect = ((*sumyvect)/units)*units; - *sumyvect %= units; - } - else - dayvect = 0; - } - } - else - { - daxvect = xvect; - dayvect = yvect; - } - - if (highlightcnt<=0 || (show2dsprite[searchwall>>3] & (1<<(searchwall&7)))==0) - { - clipmove(&tvec, &tsect, daxvect,dayvect, sp->clipdist,64<<4,64<<4, spnoclip?1:CLIPMASK0); - setsprite(searchwall, &tvec); - } - else - { - xvect = daxvect; - yvect = dayvect; - - // test run - for (ii=0; ii 0 && AmbienceToggle) - { - M32_MoveFX(); - S_Update(); - } - - if (usedcount && !helpon) - { -#if 0 - if (!AIMING_AT_SPRITE) - { - count=0; - for (i=0; i -1 && searchsector < numsectors) - { - char lines[8][64]; - int32_t dist, height1=0,height2=0,height3=0, num=0; - int32_t x,y; - int16_t w; - - if (infobox&1) - { - height2 = sector[searchsector].floorz - sector[searchsector].ceilingz; - - switch (searchstat) - { - case SEARCH_WALL: - case SEARCH_MASKWALL: - w = SELECT_WALL(); - drawtileinfo("Current", WIND1X,WIND1Y, - AIMING_AT_WALL ? wall[w].picnum : wall[w].overpicnum, - wall[w].shade, wall[w].pal, wall[searchwall].cstat, - wall[searchwall].lotag, wall[searchwall].hitag,wall[searchwall].extra); - - dist = wallength(searchwall); - - if (wall[searchwall].nextsector >= 0 && wall[searchwall].nextsector < numsectors) - { - int32_t nextsect = wall[searchwall].nextsector; - height1 = sector[searchsector].floorz - sector[nextsect].floorz; - height2 = sector[nextsect].floorz - sector[nextsect].ceilingz; - height3 = sector[nextsect].ceilingz - sector[searchsector].ceilingz; - } - - Bsprintf(lines[num++],"Panning: %d, %d", wall[w].xpanning, wall[w].ypanning); - Bsprintf(lines[num++],"Repeat: %d, %d", wall[searchwall].xrepeat, wall[searchwall].yrepeat); - Bsprintf(lines[num++],"Overpic: %d", wall[searchwall].overpicnum); - lines[num++][0]=0; - - if (getmessageleng) - break; - - Bsprintf(lines[num++],"^251Wall %d^31", searchwall); - - if (wall[searchwall].nextsector!=-1) - Bsprintf(lines[num++],"LoHeight:%d, HiHeight:%d, Length:%d",height1,height3,dist); - else - Bsprintf(lines[num++],"Height:%d, Length:%d",height2,dist); - break; - - case SEARCH_CEILING: - case SEARCH_FLOOR: - drawtileinfo("Current", WIND1X, WIND1Y, AIMED_CEILINGFLOOR(picnum), AIMED_CEILINGFLOOR(shade), - AIMED_CEILINGFLOOR(pal), AIMED_CEILINGFLOOR(stat), - sector[searchsector].lotag, sector[searchsector].hitag, sector[searchsector].extra); - - Bsprintf(lines[num++],"Panning: %d, %d", AIMED_CEILINGFLOOR(xpanning), AIMED_CEILINGFLOOR(ypanning)); - Bsprintf(lines[num++],"%sZ: %d", Typestr[searchstat], AIMED_CEILINGFLOOR(z)); - Bsprintf(lines[num++],"Slope: %d", AIMED_CEILINGFLOOR(heinum)); - lines[num++][0]=0; - - if (getmessageleng) - break; - - Bsprintf(lines[num++],"^251Sector %d^31 %s, Lotag:%s", searchsector, typestr[searchstat], ExtGetSectorCaption(searchsector)); - Bsprintf(lines[num++],"Height: %d, Visibility:%d", height2, sector[searchsector].visibility); - break; - - case SEARCH_SPRITE: - drawtileinfo("Current", WIND1X, WIND1Y, sprite[searchwall].picnum, sprite[searchwall].shade, - sprite[searchwall].pal, sprite[searchwall].cstat, sprite[searchwall].lotag, - sprite[searchwall].hitag, sprite[searchwall].extra); - - Bsprintf(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat); - Bsprintf(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y, - sprite[searchwall].xoffset|sprite[searchwall].yoffset ? " ^251*":""); - Bsprintf(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character - lines[num++][0]=0; - - if (getmessageleng) - break; - - if (sprite[searchwall].picnum<0 || sprite[searchwall].picnum>=MAXTILES) - break; - - if (names[sprite[searchwall].picnum][0]) - { - if (sprite[searchwall].picnum==SECTOREFFECTOR) - Bsprintf(lines[num++],"^251Sprite %d^31 %s", searchwall, SectorEffectorText(searchwall)); - else - Bsprintf(lines[num++],"^251Sprite %d^31 %s", searchwall, names[sprite[searchwall].picnum]); - } - else Bsprintf(lines[num++],"^251Sprite %d^31, picnum %d", searchwall, sprite[searchwall].picnum); - - Bsprintf(lines[num++], "Elevation:%d", - getflorzofslope(searchsector, sprite[searchwall].x, sprite[searchwall].y) - sprite[searchwall].z); - break; - } - } - - x = WIND1X*(xdimgame/320.); - y = WIND1Y*(ydimgame/200.); - y += (ydimgame>>6)*8; - - if (getmessageleng) - { - while (num < 4) - lines[num++][0] = 0; - Bsprintf(lines[num++],"^251%s",getmessage); - } - - begindrawing(); - for (i=0; i>6; - } - enddrawing(); - } - - VM_OnEvent(EVENT_PREKEYS3D, -1); - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(V)) // ' V - { - if (AIMING_AT_CEILING_OR_FLOOR) - getnumberptr256("Sector visibility: ", §or[searchsector].visibility, sizeof(sector[0].visibility), 255, 0, NULL); - } - - if (keystatus[KEYSC_SEMI] && PRESSED_KEYSC(V)) // ; V - { - int16_t currsector; - uint8_t visval; - - if (highlightsectorcnt == -1) - { - message("You didn't select any sectors!"); - return; - } - - visval = getnumber256("Visibility of selected sectors: ", sector[searchsector].visibility, 255, 0); - - if (AskIfSure(0)) - return; - - for (i=0; i= 0) - NEXTWALL(searchwall).overpicnum = tempint; - - if (AIMING_AT_SPRITE) - correct_sprite_yoffset(searchwall); - - if (oldtile != tempint) - asksave = 1; - } - } - - if (PRESSED_KEYSC(3)) /* 3 (toggle floor-over-floor (cduke3d only) */ - { - floor_over_floor = !floor_over_floor; - // if (!floor_over_floor) ResetFOFSize(); - message("Floor-over-floor display %s",floor_over_floor?"enabled":"disabled"); - } - - if (PRESSED_KEYSC(F3)) - { - mlook = !mlook; - message("Mouselook: %s",mlook?"enabled":"disabled"); - } - - if (PRESSED_KEYSC(F4)) - { - AmbienceToggle = !AmbienceToggle; - message("Ambience sounds: %s",AmbienceToggle?"enabled":"disabled"); - if (!AmbienceToggle) - { - FX_StopAllSounds(); - S_ClearSoundLocks(); - } - } - - // PK - if (PRESSED_KEYSC(F5)) - { - unrealedlook = !unrealedlook; - message("UnrealEd mouse navigation: %s",unrealedlook?"enabled":"disabled"); - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(DELETE)) // ' del - { - if (AIMING_AT_WALL_OR_MASK) - { - wall[searchwall].cstat = 0; - message("Wall %d cstat = 0", searchwall); - } - else if (AIMING_AT_SPRITE) - { - sprite[searchwall].cstat = 0; - message("Sprite %d cstat = 0", searchwall); - } - } - - // 'P and ;P - Will copy palette to all sectors/walls/sprites highlighted with R-Alt key - if ((keystatus[KEYSC_QUOTE] || keystatus[KEYSC_SEMI]) && PRESSED_KEYSC(P)) // ' P ; P - { - int16_t w, start_wall, end_wall, currsector; - int8_t pal[4]; - - if (highlightsectorcnt == -1) - { - message("You didn't select any sectors!"); - return; - } - - if (keystatus[KEYSC_QUOTE]) - { - pal[0] = getnumber256("Ceiling palette: ", -1, MAXPALOOKUPS-1, 1); - pal[1] = getnumber256("Floor palette: ", -1, MAXPALOOKUPS-1, 1); - pal[2] = getnumber256("Wall palette: ", -1, MAXPALOOKUPS-1, 1); - pal[3] = getnumber256("Sprite palette: ", -1, MAXPALOOKUPS-1, 1); - } - else - { - pal[0] = getnumber256("Global palette: ", 0, MAXPALOOKUPS-1, 0); - pal[1] = pal[2] = pal[3] = pal[0]; - } - - if (AskIfSure(0)) return; - - for (i = 0; i < highlightsectorcnt; i++) - { - currsector = highlightsector[i]; - - if (pal[0] > -1) - sector[currsector].ceilingpal = pal[0]; - if (pal[1] > -1) - sector[currsector].floorpal = pal[1]; - - // Do all the walls in the sector - start_wall = sector[currsector].wallptr; - end_wall = start_wall + sector[currsector].wallnum; - - if (pal[2] > -1) - for (w = start_wall; w < end_wall; w++) - wall[w].pal = pal[2]; - - if (pal[3] > -1) - { - for (k=0; k= 0) - { - j = nextspritesect[w]; - sprite[w].pal = pal[3]; - w = j; - } - } - } - } - - message("Palettes changed"); - } - - if (PRESSED_KEYSC(DELETE)) - { - if (AIMING_AT_SPRITE) - { - deletesprite(searchwall); - updatenumsprites(); - message("Sprite %d deleted",searchwall); - if (AmbienceToggle) - { - sprite[searchwall].filler &= (~1); - S_StopEnvSound(sprite[searchwall].lotag, searchwall); - } - asksave = 1; - } - } - - if (PRESSED_KEYSC(F6)) //F6 - { - autospritehelp = !autospritehelp; - message("Automatic SECTOREFFECTOR help %s", autospritehelp?"enabled":"disabled"); - } - if (PRESSED_KEYSC(F7)) //F7 - { - autosecthelp = !autosecthelp; - message("Automatic sector tag help %s", autosecthelp?"enabled":"disabled"); - } - - if (autospritehelp && helpon==0) - { - if (AIMING_AT_SPRITE && sprite[searchwall].picnum==SECTOREFFECTOR) - ShowFileText("sehelp.hlp", 1); - else if (AIMING_AT_CEILING_OR_FLOOR) - ShowFileText("sthelp.hlp", 1); - } - - if (AIMING_AT_WALL_OR_MASK && PRESSED_KEYSC(PERIOD)) - { - AutoAlignWalls(searchwall, 0); - message("Wall %d autoalign", searchwall); - } - - - tsign = 0; - tsign -= PRESSED_KEYSC(COMMA); - tsign += PRESSED_KEYSC(PERIOD); - - if (tsign) // , . Search & fix panning to the left/right (3D) - { - if (AIMING_AT_SPRITE) - { - sprite[searchwall].ang += tsign<<(!eitherSHIFT*7); - sprite[searchwall].ang &= 2047; - message("Sprite %d angle: %d", searchwall, sprite[searchwall].ang); - } - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(L)) // ' L - { - i = noclip; - noclip = 1; - - switch (searchstat) - { - case SEARCH_CEILING: - getnumberptr256("Sector ceilingz: ", §or[searchsector].ceilingz, - sizeof(sector[0].ceilingz), BZ_MAX, 1, NULL); - if (!(sector[searchsector].ceilingstat&2)) - { - sector[searchsector].ceilingstat |= 2; - sector[searchsector].ceilingheinum = 0; - } - getnumberptr256("Sector ceiling slope: ", §or[searchsector].ceilingheinum, - sizeof(sector[0].ceilingheinum), 32767, 1, NULL); - break; - case SEARCH_FLOOR: - getnumberptr256("Sector floorz: ", §or[searchsector].floorz, - sizeof(sector[0].floorz), BZ_MAX, 1, NULL); - if (!(sector[searchsector].floorstat&2)) - { - sector[searchsector].floorheinum = 0; - sector[searchsector].floorstat |= 2; - } - getnumberptr256("Sector floor slope: ", §or[searchsector].floorheinum, - sizeof(sector[0].floorheinum), 32767, 1, NULL); - break; - - case SEARCH_SPRITE: - getnumberptr256("Sprite x: ", &sprite[searchwall].x, sizeof(sprite[0].x), editorgridextent-1, 1, NULL); - getnumberptr256("Sprite y: ", &sprite[searchwall].y, sizeof(sprite[0].y), editorgridextent-1, 1, NULL); - getnumberptr256("Sprite z: ", &sprite[searchwall].z, sizeof(sprite[0].z), BZ_MAX, 1, NULL); - getnumberptr256("Sprite angle: ", &sprite[searchwall].ang, sizeof(sprite[0].ang), 2047, 0, NULL); - break; - } - - if (sector[searchsector].ceilingheinum == 0) - sector[searchsector].ceilingstat &= ~2; - else - sector[searchsector].ceilingstat |= 2; - - if (sector[searchsector].floorheinum == 0) - sector[searchsector].floorstat &= ~2; - else - sector[searchsector].floorstat |= 2; - - asksave = 1; - noclip = i; - } - - - getzrange(&pos, cursectnum, &hiz, &hihit, &loz, &lohit, 128L, CLIPMASK0); - - if (PRESSED_KEYSC(CAPS) || (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(Z))) // CAPS LOCK - { - zmode = (zmode+1)%3; - if (zmode == 1) - zlock = (loz-pos.z)&0xfffffc00; - switch (zmode) - { - case 0: message("Zmode = Gravity"); break; - case 1: message("Zmode = Locked/Sector"); break; - case 2: message("Zmode = Locked/Free"); break; - } - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(M)) // 'M - { - if (ASSERT_AIMING) - { - Bsprintf(tempbuf, "%s extra: ", Typestr_wss[searchstat]); - getnumberptr256(tempbuf, &AIMED(extra), sizeof(int16_t), BTAG_MAX, 1, NULL); - asksave = 1; - } - } - - if (PRESSED_KEYSC(1) && ASSERT_AIMING) // 1 (make 1-way wall) - { - if (!AIMING_AT_SPRITE) - { - wall[searchwall].cstat ^= 32; - message("Wall %d one side masking bit %s", searchwall, ONOFF(wall[searchwall].cstat&32)); - } - else - { - i = sprite[searchwall].cstat; - i ^= 64; - if ((i&48) == 32) - { - i &= ~8; - if ((i&64) && pos.z>sprite[searchwall].z) - i |= 8; - } - message("Sprite %d one sided bit %s", searchwall, ONOFF(i&64)); - sprite[searchwall].cstat = i; - } - asksave = 1; - } - - if (PRESSED_KEYSC(2)) // 2 (bottom wall swapping) - { - if (searchstat != SEARCH_SPRITE) - { - wall[searchwall].cstat ^= 2; - message("Wall %d bottom texture swap bit %s", searchwall, ONOFF(wall[searchwall].cstat&2)); - asksave = 1; - } - } - - if (PRESSED_KEYSC(O)) // O (top/bottom orientation - for doors) - { - if (AIMING_AT_WALL_OR_MASK) - { - int16_t w = SELECT_WALL(); - wall[w].cstat ^= 4; - message("Wall %d %s orientation", w, wall[w].cstat&4?"bottom":"top"); - asksave = 1; - } - else if (AIMING_AT_SPRITE) // O (ornament onto wall) (2D) - { - DoSpriteOrnament(searchwall); - message("Sprite %d ornament onto wall", searchwall); - asksave = 1; - } - } - - if (PRESSED_KEYSC(M)) // M (masking walls) - { - if (!AIMING_AT_SPRITE && ASSERT_AIMING) - { - int16_t next = wall[searchwall].nextwall; - - if (next >= 0) - { - wall[searchwall].cstat ^= 16; - message("Wall %d masking bit %s", searchwall, ONOFF(wall[searchwall].cstat&16)); - - wall[searchwall].cstat &= ~8; - - if (wall[searchwall].cstat&16) - { - if (!eitherSHIFT) - { - wall[next].cstat |= 8; //auto other-side flip - wall[next].cstat |= 16; - wall[next].overpicnum = wall[searchwall].overpicnum; - } - } - else - { - if (!eitherSHIFT) - { - wall[next].cstat &= ~8; //auto other-side unflip - wall[next].cstat &= ~16; - } - } - - wall[searchwall].cstat &= ~32; - if (!eitherSHIFT) - wall[next].cstat &= ~32; - - asksave = 1; - } - } - } - - if (PRESSED_KEYSC(H)) // H (hitscan sensitivity) - { - if (keystatus[KEYSC_QUOTE]) - { - if (ASSERT_AIMING) - { - Bsprintf(tempbuf, "%s hitag: ", Typestr_wss[searchstat]); - getnumberptr256(tempbuf, &AIMED(hitag), sizeof(int16_t), BTAG_MAX, 0, NULL); - } - } - else - { - if (AIMING_AT_SPRITE) - { - sprite[searchwall].cstat ^= 256; - message("Sprite %d hitscan sensitivity bit %s", searchwall, ONOFF(sprite[searchwall].cstat&256)); - asksave = 1; - } - else - { - wall[searchwall].cstat ^= 64; - - if (wall[searchwall].nextwall >= 0 && !eitherSHIFT) - { - NEXTWALL(searchwall).cstat &= ~64; - NEXTWALL(searchwall).cstat |= (wall[searchwall].cstat&64); - } - message("Wall %d hitscan sensitivity bit %s", searchwall, ONOFF(wall[searchwall].cstat&64)); - - asksave = 1; - } - } - } - - smooshyalign = keystatus[KEYSC_gKP5]; - repeatpanalign = eitherSHIFT || eitherALT || (bstatus&2); - - { - static int32_t omlook; - - if (mlook == 2) - { - mlook = omlook; - } - else if (!unrealedlook && (bstatus&4)) - { - omlook = mlook; - mlook = 2; - } - } - - // PK: no btn: wheel changes shade - if ((bstatus&(16|32) && !(bstatus&(1|2|4))) || keystatus[KEYSC_gMINUS] || keystatus[KEYSC_gPLUS]) - { - // if (bstatus&1) - // mlook = 2; - tsign = 0; - if (bstatus&32 || PRESSED_KEYSC(gMINUS)) // - - tsign = 1; - if (bstatus&16 || PRESSED_KEYSC(gPLUS)) // + - tsign = -1; - - if (tsign) - { - mouseb &= ~(16|32); - bstatus &= ~(16|32); - - if (eitherALT) //ALT - { - if (eitherCTRL) //CTRL - { - if (tsign==1) - visibility <<= (visibility < 16384); - else - visibility >>= (visibility > 32); - message("Global visibility %d", visibility); - } - else - { - k=eitherSHIFT?1:16; - - if (highlightsectorcnt >= 0) - for (i=0; i 0) - { - for (i=0; i 0) - { - sector[searchsector].visibility += tsign; - - if (tsign==1) - { - if (sector[searchsector].visibility == 240) - sector[searchsector].visibility = 239; - } - else if (sector[searchsector].visibility == 239) - sector[searchsector].visibility = 240; - k--; - } - message("Sector %d visibility %d",searchsector,sector[searchsector].visibility); - asksave = 1; - } - } - else // if !eitherALT - { - k = 0; - if (highlightsectorcnt >= 0) - { - for (i=0; i1->3->2->0 - - i = wall[searchbottomwall].cstat; - i = ((i>>3)&1)+((i>>7)&2); //3-x,8-y - - i = next[i]; - message("Wall %d flip %d",searchwall,i); - - i = ((i&1)<<3)+((i&2)<<7); - wall[searchbottomwall].cstat &= ~0x0108; - wall[searchbottomwall].cstat |= i; - asksave = 1; - } - else if (AIMING_AT_CEILING_OR_FLOOR) //8-way ceiling/floor flipping (bits 2,4,5) - { - static const int32_t next[8] = { 6, 7, 4, 5, 0, 1, 3, 2 }; // 0->6->3->5->1->7->2->4->0 - int16_t *stat = AIMING_AT_CEILING ? §or[searchsector].ceilingstat : §or[searchsector].floorstat; - - i = *stat; - i = (i&0x4)+((i>>4)&3); - i = next[i]; - message("Sector %d flip %d", searchsector, i); - i = (i&0x4)+((i&3)<<4); - *stat &= ~0x34; - *stat |= i; - asksave = 1; - } - else if (AIMING_AT_SPRITE) - { - i = sprite[searchwall].cstat; - if (((i&48) == 32) && ((i&64) == 0)) - { - sprite[searchwall].cstat &= ~0xc; - sprite[searchwall].cstat |= ((i&4)^4); - message("Sprite %d flip bit %s",searchwall, ONOFF(sprite[searchwall].cstat&4)); - } - else - { - int32_t next[4] = { 1, 3, 0, 2 }; // 0->1->3->2->0 - i = ((i>>2)&3); - - i = next[i]; - message("Sprite %d flip %d",searchwall,i); - - sprite[searchwall].cstat &= ~0xc; - sprite[searchwall].cstat |= (i<<2); - } - asksave = 1; - } - } - } - - - if (keystatus[KEYSC_HOME]) - updownunits = 256; - else if (keystatus[KEYSC_END]) - updownunits = 512; - else - updownunits = 1024; - - mouseaction=0; - if (eitherALT && (bstatus&1)) - { - mousex=0; mskip=1; - if (mousey!=0) - { - updownunits=klabs(mousey*128); - mouseaction=1; - } - } - - - tsign = 0; - if (ASSERT_AIMING) - { - // PK: PGUP/PGDN, rmb only & mwheel - tsign -= (PRESSED_KEYSC(PGUP) || (mouseaction && mousey<0) || ((bstatus&18)==18 && !(bstatus&1))); - tsign += (PRESSED_KEYSC(PGDN) || (mouseaction && mousey>0) || ((bstatus&34)==34 && !(bstatus&1))); - } - - if (tsign) - { - k = 0; - if (highlightsectorcnt >= 0) - { - for (i=0; i=0 && (eitherALT && !(bstatus&1))) ? - wall[searchwall].nextsector : searchsector); - int32_t tmphei; - - for (j=0; j<(k?k:1); j++, sect=highlightsector[j]) - { - for (i=headspritesect[sect]; i!=-1; i=nextspritesect[i]) - { - tmphei = spriteheight(i, NULL); - - tempint = getceilzofslope(sect, sprite[i].x, sprite[i].y); - tempint += tmphei; - - if (sprite[i].cstat&128) - tempint += tmphei>>1; - - if (sprite[i].z == tempint) - sprite[i].z += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128 - } - - sector[sect].ceilingz += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128 - message("Sector %d ceilingz = %d", sect, sector[sect].ceilingz); - } - } - else if (AIMING_AT_FLOOR) - { - int16_t sect = k ? highlightsector[0] : searchsector; - - for (j=0; j<(k?k:1); j++, sect=highlightsector[j]) - { - for (i=headspritesect[sect]; i!=-1; i=nextspritesect[i]) - { - tempint = getflorzofslope(sect,sprite[i].x,sprite[i].y); - - if (sprite[i].cstat&128) - tempint += spriteheight(i, NULL)>>1; - - if (sprite[i].z == tempint) - sprite[i].z += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128 - } - - sector[sect].floorz += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128 - message("Sector %d floorz = %d",sect,sector[sect].floorz); - } - } - - if (sector[searchsector].floorz < sector[searchsector].ceilingz) - { - if (tsign==-1) - sector[searchsector].floorz = sector[searchsector].ceilingz; - else - sector[searchsector].ceilingz = sector[searchsector].floorz; - } - - if (AIMING_AT_SPRITE) - { - if (eitherCTRL && !eitherALT) //CTRL - put sprite on ceiling/floor - { - if (tsign==-1) - sprite[searchwall].z = spriteonceilingz(searchwall); - else - sprite[searchwall].z = spriteongroundz(searchwall); - } - else - { - k = 0; - if (highlightcnt >= 0) - for (i=0; i= 0) - { - int32_t thisSec = ms/1000; - int32_t x = (xdim <= 640); - int32_t chars = Bsprintf(tempbuf, "%2u ms (%3u fps)", howlong, LastCount); - - if (!x) - { - printext256(windowx2-(chars<<3)+1,windowy1+2,0,-1,tempbuf,x); - printext256(windowx2-(chars<<3),windowy1+1,COLOR_WHITE,-1,tempbuf,x); - } - else - { - printext256(windowx2-(chars<<2)+1,windowy1+2,0,-1,tempbuf,x); - printext256(windowx2-(chars<<2),windowy1+1,COLOR_WHITE,-1,tempbuf,x); - } - - if (LastSec < thisSec) - { - LastCount = FrameCount / (thisSec - LastSec); - LastSec = thisSec; - FrameCount = 0; - } - FrameCount++; - } - LastMS = ms; - } - - tempbuf[0] = 0; - - if ((bstatus&(4|2|1))==4 && !unrealedlook) //PK - Bsprintf(tempbuf,"VIEW"); - else if ((bstatus&(2|1))==2) - Bsprintf(tempbuf,"Z%s", keystatus[KEYSC_HOME]?" 256":keystatus[KEYSC_END]?" 512":""); - else if ((bstatus&(2|1))==1) - Bsprintf(tempbuf,"LOCK"); - - if (bstatus&1) - { - Bsprintf(tempbuf,"LOCK"); - switch (searchstat) - { - case SEARCH_WALL: - case SEARCH_MASKWALL: - if (eitherALT) - Bsprintf(tempbuf,"CEILING Z %s", eitherCTRL?"512":""); - else if (eitherSHIFT) - Bsprintf(tempbuf,"PAN %s", eitherCTRL?"8":""); - else if (eitherCTRL) - Bsprintf(tempbuf,"SCALE"); - break; - case SEARCH_CEILING: - case SEARCH_FLOOR: - if (eitherALT) - Bsprintf(tempbuf,"%s Z %s", AIMING_AT_CEILING?"CEILING":"FLOOR", eitherCTRL?"512":""); - else if (eitherSHIFT) - Bsprintf(tempbuf,"PAN"); - else if (eitherCTRL) - Bsprintf(tempbuf,"SLOPE"); - break; - case SEARCH_SPRITE: - if (eitherALT) - Bsprintf(tempbuf,"MOVE Z %s", eitherCTRL?"1024":""); - else if (eitherSHIFT) - Bsprintf(tempbuf,"MOVE XY %s", eitherCTRL?"GRID":""); - else if (eitherCTRL) - Bsprintf(tempbuf,"SIZE"); - break; - } - } - - if (tempbuf[0] != 0) - { - i = (Bstrlen(tempbuf)<<3)+6; - i = max((searchx+i)-(xdim-1), 0); - - j = max((searchy+16)-(ydim-1), 0); - - // printext16(searchx+6-i,searchy+6-j,11,-1,tempbuf,0); - printext256(searchx+4+2-i, searchy+4+2-j, 0,-1,tempbuf,!(xdimgame > 640)); - printext256(searchx+4-i, searchy+4-j, whitecol,-1,tempbuf,!(xdimgame > 640)); - - // printext256(searchx+4+2,searchy+4+2,0,-1,tempbuf,!(xdimgame > 640)); - // printext256(searchx+4,searchy+4,whitecol,-1,tempbuf,!(xdimgame > 640)); - } - if (helpon==1) - { - int32_t small = !(xdimgame > 640); - for (i=0; i=0 && sector[cursectnum].lotag==2) - { - if (sector[cursectnum].ceilingpicnum==FLOORSLIME) - SetSLIMEPalette(); - else - SetWATERPalette(); - } - else SetGAMEPalette(); - - if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter - { - SetGAMEPalette(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - -#ifdef POLYMER - DeletePolymerLights(); -#endif - } - - //Stick this in 3D part of ExtCheckKeys - //Also choose your own key scan codes - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(D)) // ' d - /* { ShowHelpText("SectorEffector"); } */ - { - skill = (skill+1)%MAXSKILL; - message("%s", SKILLMODE[skill]); - // printext256(1*4,1*8,11,-1,tempbuf,0); - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(I)) // ' i - { - showinvisibility = !showinvisibility; - message("Invisible sprite preview %s", showinvisibility?"enabled":"disabled"); - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(X)) // ' x - { - shadepreview = !shadepreview; - message("Map shade preview %s", shadepreview?"enabled":"disabled"); - -#ifdef POLYMER - DeletePolymerLights(); -#endif - } - - - /* if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_G]) // ' g - { - keystatus[KEYSC_G] = 0; - tabgraphic++; - if (tabgraphic > 2) tabgraphic = 0; - if (tabgraphic) message("Graphics ON"); - else message("Graphics OFF"); - }*/ - - /* if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_R]) // ' r - { - keystatus[KEYSC_R] = 0; - framerateon=!framerateon; - if (framerateon) message("Framerate ON"); - else message("Framerate OFF"); - }*/ - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(W)) // ' w - { - nosprites = (nosprites+1)%MAXNOSPRITES; - message("%s", SPRDSPMODE[nosprites]); - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(Y)) // ' y - { - purpleon = !purpleon; - if (nosprites>3) nosprites=0; - message("Purple %s", ONOFF(purpleon)); - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(C)) // ' C - { - if (AIMING_AT_WALL_OR_MASK) - { - for (i=0; i= 0) && !eitherSHIFT) - { - NEXTWALL(searchwall).cstat &= ~(1+64); - NEXTWALL(searchwall).cstat |= (wall[searchwall].cstat&1); - } - - message("Wall %d blocking bit %s", searchwall, ONOFF(wall[searchwall].cstat&1)); - asksave = 1; - } - } - - // N (set "spritenoshade" bit) - if (PRESSED_KEYSC(N) && !eitherCTRL && !keystatus[KEYSC_QUOTE]) - { - if (AIMING_AT_SPRITE) - { - sprite[searchwall].cstat ^= 2048; - message("Sprite %d spritenoshade bit: %s", searchwall, ONOFF(sprite[searchwall].cstat&2048)); - } - } - - if (PRESSED_KEYSC(T)) // T (transluscence for sprites/masked walls) - { - if (AIMING_AT_CEILING_OR_FLOOR) //Set masked/transluscent ceilings/floors - { - int32_t nexti[4] = { 128, 256, 384, 0 }; - int16_t *stat = &AIMED_CEILINGFLOOR(stat); - i = (*stat&(128+256))>>7; - i = nexti[i]; - *stat &= ~(128+256); - *stat |= i; - asksave = 1; - } - - if (keystatus[KEYSC_QUOTE]) - { - if (ASSERT_AIMING) - { - Bsprintf(tempbuf, "%s lotag: ", Typestr_wss[searchstat]); - AIMED(lotag) = getnumber256(tempbuf, AIMED(lotag), BTAG_MAX, 0); - } - } - else if (eitherCTRL) - { - if (AIMING_AT_SPRITE) - TextEntryMode(searchwall); - } - else - { - if (AIMING_AT_SPRITE) - { - if ((sprite[searchwall].cstat&2) == 0) - sprite[searchwall].cstat |= 2; - else if ((sprite[searchwall].cstat&512) == 0) - sprite[searchwall].cstat |= 512; - else - sprite[searchwall].cstat &= ~(2+512); - asksave = 1; - } - else if (AIMING_AT_MASKWALL) - { - if ((wall[searchwall].cstat&128) == 0) - wall[searchwall].cstat |= 128; - else if ((wall[searchwall].cstat&512) == 0) - wall[searchwall].cstat |= 512; - else - wall[searchwall].cstat &= ~(128+512); - - if (wall[searchwall].nextwall >= 0) - { - NEXTWALL(searchwall).cstat &= ~(128+512); - NEXTWALL(searchwall).cstat |= (wall[searchwall].cstat&(128+512)); - } - asksave = 1; - } - } - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(ENTER)) // ' ENTER - { - AIMED_SELOVR_PICNUM = temppicnum; - message("Pasted picnum only"); - - if (AIMING_AT_SPRITE) - correct_sprite_yoffset(searchwall); - } - - i = 512; - if (keystatus[KEYSC_RSHIFT]) i = 8; - if (keystatus[KEYSC_LSHIFT]) i = 1; - mouseaction=0; - - if (eitherCTRL && !eitherSHIFT && (bstatus&1) && AIMING_AT_CEILING_OR_FLOOR) - { - mousex=0; mskip=1; - if (mousey) - { - i=klabs(mousey*2); - mouseaction=1; - } - } - - tsign = 0; - if (ASSERT_AIMING) - { - tsign -= (PRESSED_KEYSC(LBRACK) || (mouseaction && mousey<0)); // [ - tsign += (PRESSED_KEYSC(RBRACK) || (mouseaction && mousey>0)); // ] - } - - if (tsign) - { - if (eitherALT) - { - int32_t ns=wall[searchwall].nextsector, sx=wall[searchwall].x, sy=wall[searchwall].y; - - if (ns >= 0 && !mouseaction) - { - if (AIMING_AT_CEILING || (tsign < 0 && AIMING_AT_WALL_OR_MASK)) - { - alignceilslope(searchsector, sx, sy, getceilzofslope(ns, sx, sy)); - message("Sector %d align ceiling to wall %d", searchsector, searchwall); - } - if (AIMING_AT_FLOOR || (tsign > 0 && AIMING_AT_WALL_OR_MASK)) - { - alignflorslope(searchsector, sx, sy, getflorzofslope(ns, sx, sy)); - message("Sector %d align floor to wall %d", searchsector, searchwall); - } - } - } - else - { - if (AIMING_AT_CEILING_OR_FLOOR) - { - if (!(AIMED_CEILINGFLOOR(stat)&2)) - AIMED_CEILINGFLOOR(heinum) = 0; - - AIMED_CEILINGFLOOR(heinum) = clamp(AIMED_CEILINGFLOOR(heinum) + tsign*i, -32768, 32767); - - message("Sector %d ceiling slope = %d",searchsector,AIMED_CEILINGFLOOR(heinum)); - } - } - - if (sector[searchsector].ceilingheinum == 0) - sector[searchsector].ceilingstat &= ~2; - else - sector[searchsector].ceilingstat |= 2; - - if (sector[searchsector].floorheinum == 0) - sector[searchsector].floorstat &= ~2; - else - sector[searchsector].floorstat |= 2; - asksave = 1; - } - - - if ((bstatus&1) && eitherSHIFT) - mskip=1; - - if ((bstatus&1) && eitherSHIFT && AIMING_AT_CEILING_OR_FLOOR && (mousex|mousey)) - { - int32_t fw,x1,y1,x2,y2,stat,ma,a=0; - - stat = AIMING_AT_FLOOR ? sector[searchsector].floorstat : sector[searchsector].ceilingstat; - if (stat&64) // align to first wall - { - fw=sector[searchsector].wallptr; - x1=wall[fw].x,y1=wall[fw].y; - x2=POINT2(fw).x,y2=POINT2(fw).y; - a=getangle(x1-x2,y1-y2); - } - mouseax+=mousex; mouseay+=mousey; - ma=getangle(mouseax,mouseay); - ma+=ang-a; - - i = stat; - i = (i&0x4)+((i>>4)&3); - if (stat&64) // align to first wall - switch (i) - { - case 0:break; - case 1:ma=-ma; break; - case 2:ma=1024-ma; break; - case 3:ma+=1024; break; - case 4:ma=-512-ma; break; - case 5:ma+=512; break; - case 6:ma-=512; break; - case 7:ma=512-ma; break; - } - else - switch (i) - { - case 0:ma=-ma; break; - case 1:break; - case 2:ma+=1024; break; - case 3:ma=1024-ma; break; - case 4:ma-=512; break; - case 5:ma=512-ma; break; - case 6:ma=-512-ma; break; - case 7:ma+=512; break; - } - - a = ksqrt(mouseax*mouseax + mouseay*mouseay); - if (a) - { - int32_t mult = (stat&8) ? 8192 : 8192*2; - x1 = -a*sintable[(ma+2048)&2047]/mult; - y1 = -a*sintable[(ma+1536)&2047]/mult; - - if (x1||y1) - { - mouseax=0; - mouseay=0; - - if (AIMING_AT_CEILING_OR_FLOOR) - { - changedir = 1-2*(x1<0); - x1 = klabs(x1); - - while (x1--) - AIMED_CEILINGFLOOR(xpanning) = changechar(AIMED_CEILINGFLOOR(xpanning),changedir,0,0); - - changedir = 1-2*(y1<0); - y1 = klabs(y1); - - while (y1--) - AIMED_CEILINGFLOOR(ypanning) = changechar(AIMED_CEILINGFLOOR(ypanning),changedir,0,0); - - message("Sector %d %s panning: %d, %d", searchsector, typestr[searchstat], - AIMED_CEILINGFLOOR(xpanning), AIMED_CEILINGFLOOR(ypanning)); - } - asksave=1; - } - } - mousex=0; - mousey=0; - } - - - smooshyalign = keystatus[KEYSC_gKP5]; - repeatpanalign = eitherSHIFT || eitherALT; - - //////////////////// - updownunits=1; - mouseaction=0; - - if (!mouseb) - { - mouseax=0; - mouseay=0; - } - - if ((bstatus&1) && !AIMING_AT_CEILING_OR_FLOOR) - { - if (eitherSHIFT) - { - mskip=1; - if (mousex) - { - mouseaction = 1; - mouseax += mousex; - updownunits = klabs(mouseax/2); - if (updownunits) - mouseax=0; - } - } - else if (eitherCTRL && !eitherALT) - { - mskip=1; - if (mousex) - { - mouseaction = 2; - repeatpanalign = 0; - updownunits = klabs(mouseax+=mousex)/(16 - 12*AIMING_AT_SPRITE); - if (updownunits) - mouseax=0; - } - } - } - - if (keystatus[KEYSC_gLEFT] || keystatus[KEYSC_gRIGHT] || mouseaction) // 4 & 6 (keypad) - { - if (repeatcountx == 0 || repeatcountx > 32 || mouseaction) - { - changedir = 0; - if (keystatus[KEYSC_gLEFT] || mousex>0) - changedir = -1; - if (keystatus[KEYSC_gRIGHT] || mousex<0) - changedir = 1; - - if (AIMING_AT_WALL_OR_MASK) - { - if (repeatpanalign == 0) - { - while (updownunits--) - wall[searchwall].xrepeat = changechar(wall[searchwall].xrepeat, changedir, smooshyalign, 1); - message("Wall %d repeat: %d, %d", searchwall, wall[searchwall].xrepeat, wall[searchwall].yrepeat); - } - else - { - int16_t w = SELECT_WALL(); - - if (mouseaction) - { - i = wall[w].cstat; - i &= (8|256); - - if (i==8 || i==256) - changedir*=-1; - - if (eitherCTRL) - updownunits *= 8; - } - - while (updownunits--) - wall[w].xpanning = changechar(wall[w].xpanning, changedir, smooshyalign, 0); - message("Wall %d panning: %d, %d", w, wall[w].xpanning, wall[w].ypanning); - } - asksave = 1; - } - else if (AIMING_AT_CEILING_OR_FLOOR) - { - while (updownunits--) - AIMED_CEILINGFLOOR(xpanning) = changechar(AIMED_CEILINGFLOOR(xpanning), changedir, smooshyalign, 0); - message("Sector %d %s panning: %d, %d", searchsector, typestr[searchstat], - AIMED_CEILINGFLOOR(xpanning), AIMED_CEILINGFLOOR(ypanning)); - asksave = 1; - } - else if (AIMING_AT_SPRITE) - { - static int32_t sumxvect=0, sumyvect=0; - - if (mouseaction==1) - mouseaction_movesprites(&sumxvect, &sumyvect, 1536, mousex); - else - { - sumxvect = sumyvect = 0; - if (mouseaction==2) - changedir *= -1; - while (updownunits--) - sprite[searchwall].xrepeat = changechar(sprite[searchwall].xrepeat, changedir, smooshyalign, 1); - if (sprite[searchwall].xrepeat < 4) - sprite[searchwall].xrepeat = 4; - message("Sprite %d repeat: %d, %d", searchwall, sprite[searchwall].xrepeat, sprite[searchwall].yrepeat); - } - } - asksave = 1; - repeatcountx = max(1,repeatcountx-2); - } - repeatcountx += synctics; - } - else - repeatcountx = 0; - - - //////////////////// - updownunits=1; - mouseaction=0; - - if ((bstatus&1) && !AIMING_AT_CEILING_OR_FLOOR) - { - if (eitherSHIFT) - { - mskip=1; - if (mousey) - { - mouseaction = 1; - updownunits = klabs(mousey); - - if (!AIMING_AT_SPRITE) - updownunits = klabs((int32_t)(mousey*128./tilesizy[wall[searchwall].picnum])); - } - } - else if (eitherCTRL && !eitherALT) - { - mskip=1; - if (mousey) - { - mouseaction = 2; - repeatpanalign = 0; - mouseay += mousey; - updownunits = klabs(mouseay)/(32 - 28*AIMING_AT_SPRITE); - if (updownunits) - mouseay=0; - } - } - } - - if (!mouseb) - { - mouseax=0; - mouseay=0; - } - - if (keystatus[KEYSC_gUP] || keystatus[KEYSC_gDOWN] || mouseaction) // 2 & 8 (keypad) - { - if (repeatcounty == 0 || repeatcounty > 32 || mouseaction) - { - changedir = 0; - if (keystatus[KEYSC_gUP] || mousey>0) - changedir = -1; - if (keystatus[KEYSC_gDOWN] || mousey<0) - changedir = 1; - - if (AIMING_AT_WALL_OR_MASK) - { - if (repeatpanalign == 0) - { - while (updownunits--) - wall[searchwall].yrepeat = changechar(wall[searchwall].yrepeat, changedir, smooshyalign, 1); - message("Wall %d repeat: %d, %d", searchwall, wall[searchwall].xrepeat, wall[searchwall].yrepeat); - } - else - { - int16_t w = AIMING_AT_WALL?searchbottomwall:searchwall; - if (mouseaction && eitherCTRL) - updownunits *= 8; - while (updownunits--) - wall[w].ypanning = changechar(wall[w].ypanning, changedir, smooshyalign, 0); - message("Wall %d panning: %d, %d", w, wall[w].xpanning, wall[w].ypanning); - } - } - else if (AIMING_AT_CEILING_OR_FLOOR) - { - while (updownunits--) - AIMED_CEILINGFLOOR(ypanning) = changechar(AIMED_CEILINGFLOOR(ypanning), changedir, smooshyalign, 0); - message("Sector %d %s panning: %d, %d", searchsector, typestr[searchstat], - AIMED_CEILINGFLOOR(xpanning), AIMED_CEILINGFLOOR(ypanning)); - asksave = 1; - } - else if (AIMING_AT_SPRITE) - { - static int32_t sumxvect=0, sumyvect=0; - - if (mouseaction==1) - mouseaction_movesprites(&sumxvect, &sumyvect, 2048, mousey); - else - { - sumxvect = sumyvect = 0; - while (updownunits--) - sprite[searchwall].yrepeat = changechar(sprite[searchwall].yrepeat, changedir, smooshyalign, 1); - if (sprite[searchwall].yrepeat < 4) - sprite[searchwall].yrepeat = 4; - message("Sprite %d repeat: %d, %d", searchwall, sprite[searchwall].xrepeat, sprite[searchwall].yrepeat); - } - } - asksave = 1; - repeatcounty = max(1,repeatcounty-2); - } - repeatcounty += synctics; - } - else - repeatcounty = 0; - - //////////////////// - - if (PRESSED_KEYSC(F11)) //F11 - brightness - { - static int16_t brightness = -1; - - if (brightness==-1) - brightness = ((int16_t)((vid_gamma-1.0)*10.0))&15; - - brightness = brightness + (1-2*eitherSHIFT); - brightness &= 15; - - vid_gamma = 1.0 + ((float)brightness / 10.0); - setbrightness(brightness, 0, 0); - message("Brightness: %d/16", brightness+1); - } - - if (PRESSED_KEYSC(TAB)) //TAB - { - if (ASSERT_AIMING) - { - tempshade = AIMED_CF_SEL(shade); - temppal = AIMED_CF_SEL(pal); - templotag = AIMED_SEL(lotag); - temphitag = AIMED_SEL(hitag); - tempextra = AIMED_SEL(extra); - - if (AIMING_AT_WALL_OR_MASK) - { - temppicnum = AIMED_SELOVR_WALL(picnum); - tempxrepeat = AIMED_SEL_WALL(xrepeat); - tempxrepeat = max(1, tempxrepeat); - tempyrepeat = AIMED_SEL_WALL(yrepeat); - tempcstat = AIMED_SEL_WALL(cstat); - templenrepquot = divscale12(wallength(searchwall), tempxrepeat); - } - else if (AIMING_AT_CEILING_OR_FLOOR) - { - temppicnum = AIMED_CEILINGFLOOR(picnum); - tempvis = sector[searchsector].visibility; - tempxrepeat = AIMED_CEILINGFLOOR(xpanning); - tempyrepeat = AIMED_CEILINGFLOOR(ypanning); - tempcstat = AIMED_CEILINGFLOOR(stat); - } - else if (AIMING_AT_SPRITE) - { - temppicnum = sprite[searchwall].picnum; - tempxrepeat = sprite[searchwall].xrepeat; - tempyrepeat = sprite[searchwall].yrepeat; - tempcstat = sprite[searchwall].cstat; - tempxvel = sprite[searchwall].xvel; - tempyvel = sprite[searchwall].yvel; - tempzvel = sprite[searchwall].zvel; - } - - somethingintab = searchstat; - } - } - - if (PRESSED_KEYSC(ENTER)) // ENTER -- paste clipboard contents - { - extern char pskysearch[MAXSECTORS]; - int16_t daang; - int32_t dashade[2]; - - if (eitherSHIFT) - { - if (AIMING_AT_WALL_OR_MASK && eitherCTRL) //Ctrl-shift Enter (auto-shade) - { - dashade[0] = 127; - dashade[1] = -128; - - i = searchwall; - do - { - if (dashade[0] > (int32_t)wall[i].shade) - dashade[0] = wall[i].shade; - if (dashade[1] < (int32_t)wall[i].shade) - dashade[1] = wall[i].shade; - - i = wall[i].point2; - } - while (i != searchwall); - - daang = getangle(POINT2(searchwall).x-wall[searchwall].x, POINT2(searchwall).y-wall[searchwall].y); - - i = searchwall; - do - { - j = getangle(POINT2(i).x-wall[i].x,POINT2(i).y-wall[i].y); - k = (j+2048-daang)&2047; - if (k > 1024) - k = 2048-k; - - wall[i].shade = dashade[0]+mulscale10(k, dashade[1]-dashade[0]); - - i = wall[i].point2; - } - while (i != searchwall); - - message("Wall %d auto-shaded", searchwall); - } - else if (somethingintab < 255) - { - if (ASSERT_AIMING) - { - AIMED_CF_SEL(shade) = tempshade; - AIMED_CF_SEL(pal) = temppal; - - if (AIMING_AT_CEILING_OR_FLOOR) - { - if (somethingintab == SEARCH_CEILING || somethingintab == SEARCH_FLOOR) - sector[searchsector].visibility = tempvis; - } - - message("Pasted shading+pal"); - asksave = 1; - } - } - } - else if (AIMING_AT_WALL_OR_MASK && eitherCTRL && somethingintab < 255) //Either ctrl key - { - i = searchwall; - do - { - wall[i].picnum = temppicnum; - wall[i].shade = tempshade; - wall[i].pal = temppal; - - if (somethingintab == SEARCH_WALL || somethingintab == SEARCH_MASKWALL) - { - wall[i].xrepeat = tempxrepeat; - wall[i].yrepeat = tempyrepeat; - wall[i].cstat = tempcstat; - fixxrepeat(i, templenrepquot); - } - - i = wall[i].point2; - } - while (i != searchwall); - - message("Pasted picnum+shading+pal"); - asksave = 1; - } - else if (AIMING_AT_CEILING_OR_FLOOR && eitherCTRL && somethingintab < 255) //Either ctrl key - { - Bmemset(pskysearch, 0, numsectors); - - i = searchsector; - if (CEILINGFLOOR(i, stat)&1) - pskysearch[i] = 1; - - while (pskysearch[i] == 1) - { - CEILINGFLOOR(i, picnum) = temppicnum; - CEILINGFLOOR(i, shade) = tempshade; - CEILINGFLOOR(i, pal) = temppal; - - if (somethingintab == SEARCH_CEILING || somethingintab == SEARCH_FLOOR) - { - CEILINGFLOOR(i, xpanning) = tempxrepeat; - CEILINGFLOOR(i, ypanning) = tempyrepeat; - CEILINGFLOOR(i, stat) = tempcstat; - } - pskysearch[i] = 2; - - startwall = sector[i].wallptr; - endwall = startwall + sector[i].wallnum - 1; - - for (j=startwall; j<=endwall; j++) - { - k = wall[j].nextsector; - if (k >= 0) - if ((CEILINGFLOOR(k, stat)&1) > 0) - if (pskysearch[k] == 0) - pskysearch[k] = 1; - } - - for (j=0; j= 0) - NEXTWALL(searchwall).overpicnum = temppicnum; - - wall[searchwall].shade = tempshade; - wall[searchwall].pal = temppal; - - if (somethingintab == SEARCH_MASKWALL) - { - wall[searchwall].xrepeat = tempxrepeat; - wall[searchwall].yrepeat = tempyrepeat; - wall[searchwall].cstat = tempcstat; - wall[searchwall].lotag = templotag; - wall[searchwall].hitag = temphitag; - wall[searchwall].extra = tempextra; - fixxrepeat(searchwall, templenrepquot); - } - asksave = 1; - } - else if (AIMING_AT_CEILING_OR_FLOOR) - { - AIMED_CEILINGFLOOR(picnum) = temppicnum; - AIMED_CEILINGFLOOR(shade) = tempshade; - AIMED_CEILINGFLOOR(pal) = temppal; - - if (somethingintab == SEARCH_CEILING || somethingintab == SEARCH_FLOOR) - { - AIMED_CEILINGFLOOR(xpanning) = tempxrepeat; - AIMED_CEILINGFLOOR(ypanning) = tempyrepeat; - AIMED_CEILINGFLOOR(stat) = tempcstat; - - sector[searchsector].visibility = tempvis; - sector[searchsector].lotag = templotag; - sector[searchsector].hitag = temphitag; - sector[searchsector].extra = tempextra; - } - asksave = 1; - } - else if (AIMING_AT_SPRITE) - { - sprite[searchwall].picnum = temppicnum; - - if (tilesizx[temppicnum] <= 0 || tilesizy[temppicnum] <= 0) - { - j = 0; - for (k=0; k 0 && tilesizy[k] > 0) - { - j = k; - break; - } - sprite[searchwall].picnum = j; - } - - sprite[searchwall].shade = tempshade; - sprite[searchwall].pal = temppal; - - if (somethingintab == SEARCH_SPRITE) - { - sprite[searchwall].xrepeat = max(tempxrepeat, 1); - sprite[searchwall].yrepeat = max(tempyrepeat, 1); - sprite[searchwall].cstat = tempcstat; - sprite[searchwall].lotag = templotag; - sprite[searchwall].hitag = temphitag; - sprite[searchwall].extra = tempextra; - sprite[searchwall].xvel = tempxvel; - sprite[searchwall].yvel = tempyvel; - sprite[searchwall].zvel = tempzvel; - } - else - correct_sprite_yoffset(searchwall); - } - message("Pasted clipboard"); - asksave = 1; - } - } - - if (PRESSED_KEYSC(C)) - { - if (eitherALT) // Alt-C picnum replacer - { - if (somethingintab < 255) - { - switch (searchstat) - { - case SEARCH_WALL: - j = wall[searchbottomwall].picnum; - for (i=0; i=0: forwards -{ - char did_wrap = 0, outofgrid=0; - int32_t i, j, k = 0; - - dir = 1-2*(dir<0); - - for (gs_cursprite += dir;; gs_cursprite += dir) - { - if (gs_cursprite < 0 || gs_cursprite >= MAXSPRITES) - { - if (did_wrap) - break; - - did_wrap = 1; - gs_cursprite &= (MAXSPRITES-1); - } - - if (sprite[gs_cursprite].statnum == MAXSTATUS) continue; - - for (i=0; i<3; i++) - for (j=0; i==1 ? j<6 : j<7; j++) - { - if (!gs_spriteTagInterested[i][j]) continue; - - if (i==0) - { - switch (j) - { - case 0: k = sprite[gs_cursprite].x; break; - case 1: k = sprite[gs_cursprite].y; break; - case 2: k = sprite[gs_cursprite].z; break; - case 3: k = sprite[gs_cursprite].sectnum; break; - case 4: k = sprite[gs_cursprite].statnum; break; - case 5: k = (uint16_t)sprite[gs_cursprite].hitag; break; - case 6: k = (uint16_t)sprite[gs_cursprite].lotag; break; - } - } - else if (i==1) - { - switch (j) - { - case 0: - k = sprite[gs_cursprite].cstat; - k &= gs_spriteTagValue[1][0]; - break; - case 1: k = sprite[gs_cursprite].shade; break; - case 2: k = sprite[gs_cursprite].pal; break; - case 3: - k = gs_spriteTagValue[1][3]; - if (k != sprite[gs_cursprite].xrepeat && - k != sprite[gs_cursprite].yrepeat) - goto NEXTSPRITE; - break; - case 4: - k = gs_spriteTagValue[1][4]; - if (k != sprite[gs_cursprite].xoffset && - k != sprite[gs_cursprite].yoffset) - goto NEXTSPRITE; - break; - case 5: k = sprite[gs_cursprite].picnum; break; - } - } - else if (i==2) - { - switch (j) - { - case 0: k = sprite[gs_cursprite].ang; break; - case 1: k = (uint16_t)sprite[gs_cursprite].xvel; break; - case 2: k = (uint16_t)sprite[gs_cursprite].yvel; break; - case 3: k = (uint16_t)sprite[gs_cursprite].zvel; break; - case 4: k = (uint16_t)sprite[gs_cursprite].owner; break; - case 5: k = sprite[gs_cursprite].clipdist; break; - case 6: k = sprite[gs_cursprite].extra; break; - } - } - - if (k != gs_spriteTagValue[i][j]) goto NEXTSPRITE; - } - - // found matching sprite - if (pos.x >= -editorgridextent && pos.x <= editorgridextent && - pos.y >= -editorgridextent && pos.y <= editorgridextent) - { - pos.x = sprite[gs_cursprite].x; - pos.y = sprite[gs_cursprite].y; - if (pos.z >= -editorgridextent<<4 && pos.z <= editorgridextent<<4) - pos.z = sprite[gs_cursprite].z; - ang = sprite[gs_cursprite].ang; - } - else - outofgrid = 1; - - printmessage16("%s Sprite seach%s: found sprite %d%s", dir<0 ? "<" : ">", - did_wrap ? " (wrap)" : "", gs_cursprite, outofgrid?"(outside grid)":""); - did_wrap = 0; - return; - -NEXTSPRITE: - ; - } - printmessage16("%s Sprite search: none found", dir<0 ? "<" : ">"); -} - -extern int32_t graphicsmode; - -static void Keys2d(void) -{ - int32_t i=0, j, k; - int32_t smooshy, changedir; - static int32_t repeatcnt[2] = {0,0}; // was repeatcountx, repeatcounty - int32_t tcursectornum; - -// for(i=0;i<0x50;i++) if(keystatus[i]==1) Bsprintf(tempbuf,"key %d",i); printmessage16(tempbuf); - - tcursectornum = -1; - for (i=0; i= 16384) - { - drawgradient(); - showspritedata(pointhighlight&16383, 0); - } - else if (linehighlight >= 0 /* && ((bstatus&1) || sectorofwall(linehighlight)==tcursectornum)*/) - { - drawgradient(); - showwalldata(linehighlight, 0); - } - } - else if (tcursectornum >= 0) - { - drawgradient(); - showsectordata(tcursectornum, 0); - } - } - else if (!(keystatus[KEYSC_F5]|keystatus[KEYSC_F6]|keystatus[KEYSC_F7]|keystatus[KEYSC_F8]) && !eitherSHIFT) - { - static int32_t counter = 0; - static int32_t omx = 0, omy = 0; - /* - static int32_t opointhighlight, olinehighlight, ocursectornum; - if (pointhighlight == opointhighlight && linehighlight == olinehighlight && tcursectornum == ocursectornum) - */ - if (omx == mousxplc && omy == mousyplc) - { - if (counter < 6) - counter++; - } - else if (counter > 0) - counter--; - - omx = mousxplc; - omy = mousyplc; - - /* - opointhighlight = pointhighlight; - olinehighlight = linehighlight; - ocursectornum = tcursectornum; - */ - - if (totalclock < lastpm16time + 120*2) - _printmessage16("%s", lastpm16buf); - else if (counter >= 2 && totalclock >= 120*6) - { - if (pointhighlight >= 16384) - { - i = pointhighlight-16384; - showspritedata(i, 1); - - if (sprite[i].picnum==SECTOREFFECTOR) - _printmessage16("^10%s", SectorEffectorText(i)); - } - else if (linehighlight >= 0 && ((bstatus&1) || sectorofwall(linehighlight)==tcursectornum)) - showwalldata(linehighlight, 1); - else if (tcursectornum >= 0) - showsectordata(tcursectornum, 1); - } - } - -///__bigcomment__ - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(Z)) // ' z - { - editorzrange[0] = getnumber16("Upper Z range: ", editorzrange[0], INT32_MAX, 1); - editorzrange[1] = getnumber16("Lower Z range: ", editorzrange[1], INT32_MAX, 1); - // printmessage16(""); - } - - if (PRESSED_KEYSC(T)) // T (tag) - { - char buffer[80]; - - if (eitherCTRL) //Ctrl-T - { - extern int32_t showtags; - - showtags ^= 1; - printmessage16("Show tags %s", ONOFF(showtags)); - } - else if (eitherALT) //ALT - { - if (pointhighlight >= 16384) - { - i = pointhighlight-16384; - Bsprintf(buffer,"Sprite (%d) Lo-tag: ", i); - sprite[i].lotag = _getnumber16(buffer, sprite[i].lotag, BTAG_MAX, 0, sprite[i].picnum==SECTOREFFECTOR ? - (void *)SectorEffectorTagText : NULL); - } - else if (linehighlight >= 0) - { - i = linehighlight; - Bsprintf(buffer,"Wall (%d) Lo-tag: ", i); - wall[i].lotag = getnumber16(buffer, wall[i].lotag, BTAG_MAX, 0); - } - } - else - { - for (i=0; i0) - { - m32_setkeyfilter(0); - IntegratedHelp(); - m32_setkeyfilter(1); - } - else - printmessage16("m32help.hlp invalid or not found!"); - } - - if (PRESSED_KEYSC(F2)) - if (g_numsounds > 0) - { - m32_setkeyfilter(0); - SoundDisplay(); - m32_setkeyfilter(1); - } - - // F3: side view toggle (handled in build.c) - - getpoint(searchx,searchy, &mousxplc,&mousyplc); - ppointhighlight = getpointhighlight(mousxplc,mousyplc, ppointhighlight); - - if ((ppointhighlight&0xc000) == 16384) - { - // sprite[ppointhighlight&16383].cstat ^= 1; - cursprite = ppointhighlight&16383; - } - - if (keystatus[KEYSC_F9]) // F9 f1=3b - ShowFileText("sthelp.hlp", 0); - - /* start Mapster32 */ - - if (PRESSED_KEYSC(F4)) - { - showfirstwall = !showfirstwall; - message("Sector firstwall highlight %s", showfirstwall?"enabled":"disabled"); - } - - if (PRESSED_KEYSC(M)) // M (tag) - { - if (eitherALT) //ALT - { - if (pointhighlight >= 16384) - { - i = pointhighlight-16384; - Bsprintf(tempbuf, "Sprite %d Extra: ", i); - sprite[i].extra = getnumber16(tempbuf, sprite[i].extra, BTAG_MAX, 1); - } - else if (linehighlight >= 0) - { - i = linehighlight; - Bsprintf(tempbuf,"Wall %d Extra: ",i); - wall[i].extra = getnumber16(tempbuf,wall[i].extra,BTAG_MAX,1); - } - } - else - { - for (i=0; i 32) - { - changedir = 1-(j&2); - - if ((ppointhighlight&0xc000) == 16384 && (sprite[cursprite].cstat & 48)) - { - uint8_t *repeat = (k==0) ? &sprite[cursprite].xrepeat : &sprite[cursprite].yrepeat; - *repeat = max(4, changechar(*repeat, changedir, smooshy, 1)); - message("Sprite %d repeat: %d, %d", cursprite, sprite[cursprite].xrepeat, sprite[cursprite].yrepeat); - } - else - { - for (i=0; i= 16384) - { - const char *aligntype[4] = { "view", "wall", "floor", "???" }; - - i = sprite[cursprite].cstat; - if ((i&48) < 32) - i += 16; - else - i &= ~48; - sprite[cursprite].cstat = i; - - message("Sprite %d now %s aligned", cursprite, aligntype[(i&48)/16]); - asksave = 1; - } - } - - if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_S]) // ' S - { - if (pointhighlight >= 16384) - { - keystatus[KEYSC_S] = 0; - Bsprintf(tempbuf, "Sprite %d xrepeat: ", cursprite); - sprite[cursprite].xrepeat = getnumber16(tempbuf, sprite[cursprite].xrepeat, 255, 0); - Bsprintf(tempbuf, "Sprite %d yrepeat: ", cursprite); - sprite[cursprite].yrepeat = getnumber16(tempbuf, sprite[cursprite].yrepeat, 255, 0); - printmessage16("Sprite %d updated", i); - } - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(F)) // ' F - { - FuncMenu(); - } - - tsign = 0; - if (PRESSED_KEYSC(LBRACK)) // [ search backward - tsign = -1; - if (PRESSED_KEYSC(RBRACK)) // ] search forward - tsign = +1; - - if (tsign) - { - if (eitherALT && numcorruptthings>0) - { - int32_t wrap=0, x, y, z; - - if (curcorruptthing<0 || curcorruptthing>=numcorruptthings) - curcorruptthing = 0; - else - { - curcorruptthing += tsign; - wrap = (curcorruptthing<0 || curcorruptthing>=numcorruptthings); - curcorruptthing += numcorruptthings; - curcorruptthing %= numcorruptthings; - } - - k = corruptthings[curcorruptthing]; - j = -1; - switch (k&CORRUPT_MASK) - { - case 0: - printmessage16("MAP LIMITS EXCEEDED!"); - x = y = z = 0; - break; - case CORRUPT_SECTOR: - i = k&(MAXSECTORS-1); - j = 0; - x = wall[sector[i].wallptr].x; - y = wall[sector[i].wallptr].y; - z = pos.z; - break; - case CORRUPT_WALL: - i = k&(MAXWALLS-1); - j = 1; - x = wall[i].x; - y = wall[i].y; - z = pos.z; - break; - case CORRUPT_SPRITE: - i = k&(MAXSPRITES-1); - j = 2; - x = sprite[i].x; - y = sprite[i].y; - z = sprite[i].z; - break; - default: - k = 0; - x = y = z = 0; - break; - } - - if (k) - { - static const char *secwalspr[3] = {"sector", "wall", "sprite"}; - if (x>=-editorgridextent && x<=editorgridextent && - y>=-editorgridextent && y<=editorgridextent) - { - pos.x = x; - pos.y = y; - pos.z = z; - } - else x=editorgridextent+1; - - printmessage16("#%d: %s Corrupt %s %d%s", curcorruptthing+1, tsign<0?"<":">", secwalspr[j], - i, (x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : "")); - } - } - else if (wallsprite==0) - { - SearchSectors(tsign); - } - else if (wallsprite==1) - { - if ((tsign<0 && curwallnum>0) || (tsign>0 && curwallnum=0 && i"); - return; - } - curwallnum--; - } - printmessage16("%s Wall search: none found", tsign<0?"<":">"); - } - else if (wallsprite==2) - DoSpriteSearch(tsign); - -///__old_sprite_search_1__ - -///__old_sprite_search_2__ - - } - - if (PRESSED_KEYSC(G)) // G (grid on/off) - { - if (autogrid) - { - grid = 8*eitherSHIFT; - - autogrid = 0; - } - else - { - grid += (1-2*eitherSHIFT); - if (grid == -1 || grid == 9) - { - autogrid = 1; - grid = 0; - } - } - - if (autogrid) - printmessage16("Grid size: 9 (autosize)"); - else if (!grid) - printmessage16("Grid off"); - else - printmessage16("Grid size: %d (%d units)", grid, 2048>>grid); - } - - if (autogrid) - { - grid = min(zoom+512, 65536); - grid = scale(grid, 6, 6144); - grid = clamp(grid, 0, 7); - } - - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(L)) // ' L (set sprite/wall coordinates) - { - if (pointhighlight >= 16384) - { - i = pointhighlight - 16384; - Bsprintf(tempbuf, "Sprite %d x: ", i); - sprite[i].x = getnumber16(tempbuf, sprite[i].x, editorgridextent-1, 1); - Bsprintf(tempbuf, "Sprite %d y: ", i); - sprite[i].y = getnumber16(tempbuf, sprite[i].y, editorgridextent-1, 1); - Bsprintf(tempbuf, "Sprite %d z: ", i); - sprite[i].z = getnumber16(tempbuf, sprite[i].z, BZ_MAX, 1); - Bsprintf(tempbuf, "Sprite %d angle: ", i); - sprite[i].ang = getnumber16(tempbuf, sprite[i].ang, 2048, 1); - sprite[i].ang &= 2047; - printmessage16("Sprite %d updated", i); - } - else if (pointhighlight >= 0) - { - i = linehighlight; - j = wall[i].x; - k = wall[i].y; - - Bsprintf(tempbuf, "Wall %d x: ", i); - j = getnumber16(tempbuf, j, editorgridextent, 1); - Bsprintf(tempbuf, "Wall %d y: ", i); - k = getnumber16(tempbuf, k, editorgridextent, 1); - dragpoint(i, j, k); - printmessage16("Wall %d updated", i); - } - } - - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(3)) // ' 3 - { - onnames = (onnames+1)%8; - printmessage16("Mode %d %s", onnames, SpriteMode[onnames]); - // clearmidstatbar16(); - // for(i=0;i= 16384) - { - swapshort(&sprite[cursprite].lotag, &sprite[cursprite].hitag); - printmessage16("Sprite %d tags swapped", cursprite); - } - else if (linehighlight >= 0) - { - swapshort(&wall[linehighlight].lotag, &wall[linehighlight].hitag); - printmessage16("Wall %d tags swapped", linehighlight); - } - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(J)) // ' J - { - pos.x = getnumber16("X-coordinate: ", pos.x, editorgridextent, 1); - pos.y = getnumber16("Y-coordinate: ", pos.y, editorgridextent, 1); - printmessage16("Current pos now (%d, %d)", pos.x, pos.y); - } -}// end key2d - -static void InitCustomColors(void) -{ - /* blue */ - /* vgapal16[9*4+0] = 63; - vgapal16[9*4+1] = 31; - vgapal16[9*4+2] = 7; */ - int32_t i; - palette_t *edcol; - /* - - char vgapal16[4*256] = - { - 00,00,00,00, 42,00,00,00, 00,42,00,00, 42,42,00,00, 00,00,42,00, - 42,00,42,00, 00,21,42,00, 42,42,42,00, 21,21,21,00, 63,21,21,00, - 21,63,21,00, 63,63,21,00, 21,21,63,00, 63,21,63,00, 21,63,63,00, - 63,63,63,00 - }; - */ - /* editorcolors[0] = getclosestcol(0,0,0); - editorcolors[1] = getclosestcol(0,0,42); - editorcolors[2] = getclosestcol(0,42,0); - editorcolors[3] = getclosestcol(0,42,42); - editorcolors[4] = getclosestcol(42,0,0); - editorcolors[5] = getclosestcol(0,0,0); - */ - - vgapal16[9*4+0] = 63; - vgapal16[9*4+1] = 31; - vgapal16[9*4+2] = 7; - - /* orange */ - vgapal16[31*4+0] = 20; // blue - vgapal16[31*4+1] = 45; // green - vgapal16[31*4+2] = 60; // red - - vgapal16[39*4+0] = 36; - vgapal16[39*4+1] = 53; - vgapal16[39*4+2] = 63; - - - /* light yellow */ - vgapal16[22*4+0] = 51; - vgapal16[22*4+1] = 63; - vgapal16[22*4+2] = 63; - - /* grey */ - vgapal16[23*4+0] = 45; - vgapal16[23*4+1] = 45; - vgapal16[23*4+2] = 45; - - /* blue */ - vgapal16[24*4+0] = 51; - vgapal16[24*4+1] = 41; - vgapal16[24*4+2] = 12; - - vgapal16[32*4+0] = 60; - vgapal16[32*4+1] = 50; - vgapal16[32*4+2] = 21; - - // grid color - vgapal16[25*4+0] = 19; - vgapal16[25*4+1] = 17; - vgapal16[25*4+2] = 17; - - vgapal16[26*4+0] = 24; - vgapal16[26*4+1] = 24; - vgapal16[26*4+2] = 24; - - vgapal16[33*4+0] = 0;//15; // blue - vgapal16[33*4+1] = 0;//30; // green - vgapal16[33*4+2] = 48;//45; // red - - vgapal16[41*4+0] = 0;//24; - vgapal16[41*4+1] = 0;//40; - vgapal16[41*4+2] = 63;//48; - - for (i = 0; i<256; i++) - { - edcol = (palette_t *)&vgapal16[4*i]; - editorcolors[i] = getclosestcol(edcol->b,edcol->g,edcol->r); - } -} - -void ExtPreSaveMap(void) -{ - if (fixmapbeforesaving) - { - int32_t i, startwall, j, endwall; - - for (i=0; i=0; i--) - sector[i].wallnum = sector[i+1].wallptr-sector[i].wallptr; - sector[numsectors-1].wallnum = numwalls - sector[numsectors-1].wallptr; - - for (i=0; i\t\tOverride NAMES.H\n" -#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) - "-setup\t\tDisplays the configuration dialog\n" -#endif -#if !defined(_WIN32) - "-usecwd\t\tRead game data and configuration file from working directory\n" -#endif - "\n-?, -help, --help\tDisplay this help message and exit" - ; - Bsprintf(tempbuf, "Mapster32 %s %s", VERSION, s_buildRev); - wm_msgbox(tempbuf, "%s", s); -} - -static void AddGamePath(const char *buffer) -{ - struct strllist *s; - s = (struct strllist *)Bcalloc(1,sizeof(struct strllist)); - s->str = Bstrdup(buffer); - - if (CommandPaths) - { - struct strllist *t; - for (t = CommandPaths; t->next; t=t->next) ; - t->next = s; - return; - } - CommandPaths = s; -} - -static void G_AddGroup(const char *buffer) -{ - struct strllist *s; - s = (struct strllist *)Bcalloc(1,sizeof(struct strllist)); - s->str = Bstrdup(buffer); - if (Bstrchr(s->str,'.') == 0) - Bstrcat(s->str,".grp"); - - if (CommandGrps) - { - struct strllist *t; - for (t = CommandGrps; t->next; t=t->next) ; - t->next = s; - return; - } - CommandGrps = s; -} - -#define COPYARG(i) \ - Bmemcpy(&testplay_addparam[j], argv[i], lengths[i]); \ - j += lengths[i]; \ - testplay_addparam[j++] = ' '; - -#if defined(RENDERTYPEWIN) && defined(USE_OPENGL) -extern char forcegl; -#endif - -static void G_CheckCommandLine(int32_t argc, const char **argv) -{ - int32_t i = 1, j, maxlen=0, *lengths; - char *c, *k; - - mapster32_fullpath = (char *)argv[0]; - - if (argc > 1) - { - lengths = Bmalloc(argc*sizeof(int32_t)); - for (j=1; j i+1) - { - G_AddGroup(argv[i+1]); - COPYARG(i); - COPYARG(i+1); - i++; - } - i++; - continue; - } - - if (!Bstrcasecmp(c+1,"game_dir")) - { - if (argc > i+1) - { -#ifdef USE_OPENGL - extern char TEXCACHEFILE[BMAX_PATH]; - - Bsprintf(tempbuf,"%s/%s",argv[i+1],TEXCACHEFILE); - Bstrcpy(TEXCACHEFILE,tempbuf); -#endif - AddGamePath(argv[i+1]); - - COPYARG(i); - COPYARG(i+1); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"cfg")) - { - if (argc > i+1) - { - Bstrcpy(setupfilename,argv[i+1]); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"gamegrp")) - { - if (argc > i+1) - { - Bstrcpy(defaultduke3dgrp,argv[i+1]); - COPYARG(i); - COPYARG(i+1); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"nam")) - { - Bstrcpy(g_grpNamePtr, "nam.grp"); - COPYARG(i); - i++; - continue; - } - if (!Bstrcasecmp(c+1,"namesfile")) - { - g_namesFileName = argv[i+1]; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"ww2gi")) - { - Bstrcpy(g_grpNamePtr, "ww2gi.grp"); - COPYARG(i); - i++; - continue; - } - if (!Bstrcasecmp(c+1,"check")) - { - initprintf("Map pointer checking on saving enabled\n"); - fixmapbeforesaving = 1; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"nocheck")) - { - initprintf("Map pointer checking disabled\n"); - fixmapbeforesaving = 0; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"noautoload")) - { - initprintf("Autoload disabled\n"); - NoAutoLoad = 1; - COPYARG(i); - i++; - continue; - } -#if !defined(_WIN32) - if (!Bstrcasecmp(c+1,"usecwd")) - { - usecwd = 1; - COPYARG(i); - i++; - continue; - } -#endif -#if defined(RENDERTYPEWIN) && defined(USE_OPENGL) - if (!Bstrcasecmp(c+1,"forcegl")) - { - forcegl = 1; - i++; - continue; - } -#endif - } - - if ((*c == '-') -#ifdef _WIN32 - || (*c == '/') -#endif -) - { - c++; - switch (*c) - { - case 'h': - case 'H': - c++; - if (*c) - { - defsfilename = c; - COPYARG(i); - initprintf("Using DEF file: %s.\n",defsfilename); - } - break; - case 'j': - case 'J': - c++; - if (!*c) break; - AddGamePath(c); - COPYARG(i); - break; - case 'g': - case 'G': - c++; - if (!*c) break; - G_AddGroup(c); - COPYARG(i); - break; - case 'x': - case 'X': - c++; - if (!*c) break; - gamecon = c; - COPYARG(i); - break; - } - } - else - { - k = Bstrrchr(c,'.'); - if (k) - { - if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip")) - { - COPYARG(i); - G_AddGroup(argv[i++]); - continue; - } - else if (!Bstrcasecmp(k,".def")) - { - COPYARG(i); - defsfilename = (char *)argv[i++]; - initprintf("Using DEF file: %s.\n",defsfilename); - continue; - } - else if (!Bstrcasecmp(k,".con")) - { - COPYARG(i); - gamecon = (char *)argv[i++]; - continue; - } - } - } - i++; - } - - Bfree(lengths); - - if (j > 0) - { - testplay_addparam[j-1] = 0; - testplay_addparam = Brealloc(testplay_addparam, j*sizeof(char)); - } - else - { - Bfree(testplay_addparam); - testplay_addparam = NULL; - } - } -} -#undef COPYARG - -int32_t ExtPreInit(int32_t argc,const char **argv) -{ - wm_setapptitle("Mapster32"); - -#ifdef _WIN32 - tempbuf[GetModuleFileName(NULL,tempbuf,BMAX_PATH)] = 0; - Bcorrectfilename(tempbuf,1); - //chdir(tempbuf); -#endif - - OSD_SetLogFile("mapster32.log"); - OSD_SetVersion("Mapster32" " " VERSION,0,2); - initprintf("Mapster32 %s %s\n", VERSION, s_buildRev); - initprintf("Compiled %s\n", __DATE__" "__TIME__); - // initprintf("Copyright (c) 2008 EDuke32 team\n"); - - G_CheckCommandLine(argc,argv); - - return 0; -} - -static int32_t atoi_safe(const char *str) -{ - return (int32_t)strtol(str, NULL, 10); -} - -static int32_t osdcmd_quit(const osdfuncparm_t *parm) -{ - UNREFERENCED_PARAMETER(parm); - clearfilenames(); - ExtUnInit(); - uninitengine(); - - exit(0); -} - -static int32_t osdcmd_editorgridextent(const osdfuncparm_t *parm) -{ - int32_t i; - extern int32_t editorgridextent; - - if (parm->numparms == 0) - { - OSD_Printf("\"editorgridextent\" is \"%d\"\n", editorgridextent); - return OSDCMD_SHOWHELP; - } - else if (parm->numparms != 1) - return OSDCMD_SHOWHELP; - - i = Batol(parm->parms[0]); - - if (i >= 65536 && i <= BXY_MAX) - { - editorgridextent = i; - OSD_Printf("editorgridextent %d\n", editorgridextent); - } - else - OSD_Printf("editorgridextent: value out of range (65536 to %d)\n", BXY_MAX); - - return OSDCMD_OK; -} - -static int32_t osdcmd_addpath(const osdfuncparm_t *parm) -{ - char pathname[BMAX_PATH]; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - Bstrcpy(pathname,parm->parms[0]); - addsearchpath(pathname); - return OSDCMD_OK; -} - -static int32_t osdcmd_initgroupfile(const osdfuncparm_t *parm) -{ - char file[BMAX_PATH]; - - if (parm->numparms != 1) return OSDCMD_SHOWHELP; - - Bstrcpy(file,parm->parms[0]); - initgroupfile(file); - return OSDCMD_OK; -} - -static int32_t osdcmd_sensitivity(const osdfuncparm_t *parm) -{ - if (parm->numparms != 1) - { - OSD_Printf("\"sensitivity\" is \"%.2f\"\n",msens); - return OSDCMD_SHOWHELP; - } - msens = atof(parm->parms[0]); - OSD_Printf("sensitivity %.2f\n",msens); - return OSDCMD_OK; -} - -static int32_t osdcmd_noclip(const osdfuncparm_t *parm) -{ - UNREFERENCED_PARAMETER(parm); - noclip = !noclip; - OSD_Printf("Clipping %s\n", noclip?"disabled":"enabled"); - - return OSDCMD_OK; -} - -static int32_t osdcmd_testplay_addparam(const osdfuncparm_t *parm) -{ - int32_t slen; - - if (parm->numparms != 1) - { - OSD_Printf("additional parameters for test playing: %s%s%s\n", - testplay_addparam ? "\"" : "", - testplay_addparam ? testplay_addparam : "", - testplay_addparam ? "\"" : ""); - return OSDCMD_OK; - } - - slen = Bstrlen(parm->parms[0]); - - if (slen > 0) - { - if (!testplay_addparam) - testplay_addparam = Bmalloc(slen+1); - else - testplay_addparam = Brealloc(testplay_addparam, slen+1); - - Bmemcpy(testplay_addparam, parm->parms[0], slen); - testplay_addparam[slen] = 0; - } - else - { - if (testplay_addparam) - { - Bfree(testplay_addparam); - testplay_addparam = NULL; - } - } - - return OSDCMD_OK; -} - - -//PK vvv ------------ -static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm) -{ - int32_t showval = (parm->numparms < 1); - - // this is something of a misnomer, since it's actually accel+decel - if (!Bstrcasecmp(parm->name, "pk_turnaccel")) - { - if (showval) - OSD_Printf("Turning acceleration+declaration is %d\n", pk_turnaccel); - else - { - pk_turnaccel = atoi_safe(parm->parms[0]); - pk_turnaccel = pk_turnaccel<=pk_turndecel ? (pk_turndecel+1):pk_turnaccel; - pk_turnaccel = pk_turnaccel>256 ? 256:pk_turnaccel; - } - } - else if (!Bstrcasecmp(parm->name, "pk_turndecel")) - { - if (showval) - OSD_Printf("Turning deceleration is %d\n", pk_turndecel); - else - { - pk_turndecel = atoi_safe(parm->parms[0]); - pk_turndecel = pk_turndecel<=0 ? 1:pk_turndecel; - pk_turndecel = pk_turndecel>=pk_turnaccel ? (pk_turnaccel-1):pk_turndecel; - pk_turndecel = pk_turndecel>128 ? 128:pk_turndecel; - } - } - else if (!Bstrcasecmp(parm->name, "pk_quickmapcycling")) - { - OSD_Printf("Quick map cycling ((LShift-)Ctrl-X): %s\n", - (quickmapcycling = !quickmapcycling) ? "enabled":"disabled"); - } - else if (!Bstrcasecmp(parm->name, "pk_uedaccel")) - { - if (parm->numparms==1) - { - pk_uedaccel = atoi_safe(parm->parms[0]); - pk_uedaccel = pk_uedaccel<0 ? 0:pk_uedaccel; - pk_uedaccel = pk_uedaccel>5 ? 5:pk_uedaccel; - } - - if (parm->numparms <= 1) - OSD_Printf("UnrealEd mouse navigation acceleration is %d\n", pk_uedaccel); - else - return OSDCMD_SHOWHELP; - } - else if (!Bstrcasecmp(parm->name, "osd_tryscript")) - { - m32_osd_tryscript = !m32_osd_tryscript; - OSD_Printf("Try M32 script execution on invalid OSD command: %s\n", m32_osd_tryscript?"on":"off"); - } - else if (!Bstrcasecmp(parm->name, "sideview_reversehorizrot")) - { - sideview_reversehrot = !sideview_reversehrot; - OSD_Printf("Side view reverse horizontal rotation: %s\n", sideview_reversehrot?"on":"off"); - } - else if (!Bstrcasecmp(parm->name, "script_expertmode")) - { - m32_script_expertmode = !m32_script_expertmode; - if (m32_script_expertmode) - OSD_Printf("M32 Script expert mode ENABLED. Be sure to know what you are doing!\n"); - else - OSD_Printf("M32 Script expert mode DISABLED.\n"); - } - else if (!Bstrcasecmp(parm->name, "show_heightindicators")) - { - static const char *how[3] = {"none", "two-sided walls only", "all"}; - - if (parm->numparms == 1) - showheightindicators = clamp(atoi_safe(parm->parms[0]), 0, 2); - - if (parm->numparms <= 1) - OSD_Printf("height indicators: %s\n", how[showheightindicators]); - else - return OSDCMD_SHOWHELP; - } - else if (!Bstrcasecmp(parm->name, "show_ambiencesounds")) - { - static const char *how[3] = {"none", "current sector only", "all"}; - - if (parm->numparms == 1) - showambiencesounds = clamp(atoi_safe(parm->parms[0]), 0, 2); - - if (parm->numparms <= 1) - OSD_Printf("ambience sound circles: %s\n", how[showambiencesounds]); - else - return OSDCMD_SHOWHELP; - } - else if (!Bstrcasecmp(parm->name, "corruptcheck")) - { - int32_t tryfix = parm->numparms>=1 && !Bstrcasecmp(parm->parms[0], "tryfix"); - - if (parm->numparms == 1 || tryfix) - { - if (!Bstrcasecmp(parm->parms[0], "now")) - { - if (CheckMapCorruption(1, 0)==0) - OSD_Printf("All OK.\n"); - return OSDCMD_OK; - } - else if (tryfix) - { - uint64_t whicherrs = parm->numparms==1 ? 0xffffffffffffffffull : 0; - - if (whicherrs==0) - { - int32_t i, n, m; - char *endptr; - for (i=1; inumparms; i++) - { - n = (int32_t)Bstrtol(parm->parms[i], &endptr, 10); - if (endptr != parm->parms[i]) - { - if (*endptr=='-') - { - m = (int32_t)Bstrtol(endptr+1, NULL, 10); - if (n>=1 && n<=m && m<=MAXCORRUPTTHINGS) - { - uint64_t mask = 0xffffffffffffffffull; - m = m-n+1; - mask >>= (MAXCORRUPTTHINGS-m); - mask <<= (n-1); - - whicherrs |= mask; - } - } - else - { - if (n>=1 && n<=MAXCORRUPTTHINGS) - whicherrs |= (1ull<<(n-1)); - } - } - } - } - - CheckMapCorruption(3, whicherrs); - return OSDCMD_OK; - } - else if (isdigit(parm->parms[0][0])) - { - autocorruptcheck = clamp(atoi_safe(parm->parms[0]), 0, 3600); - corruptchecktimer = totalclock + 120*autocorruptcheck; - } - } - - if (parm->numparms <= 1) - { - if (autocorruptcheck) - OSD_Printf("auto corruption check: %d seconds\n", autocorruptcheck); - else - OSD_Printf("auto corruption check: off\n"); - } - else if (!tryfix) - return OSDCMD_SHOWHELP; - } - - return OSDCMD_OK; -} - -#ifdef USE_OPENGL -static int32_t osdcmd_tint(const osdfuncparm_t *parm) -{ - int32_t i; - palette_t *p; - - if (parm->numparms==1) - { - i = atoi_safe(parm->parms[0]); - if (i>=0 && ir, p->g, p->b, p->f); - } - } - else if (parm->numparms==0) - { - OSD_Printf("Hightile tintings:\n"); - for (i=0,p=&hictinting[0]; ir, p->g, p->b, p->f); - } - else if (parm->numparms>=2) - { - i = atoi_safe(parm->parms[0]); - if (i<0 || i>=MAXPALOOKUPS-RESERVEDPALS) - return OSDCMD_SHOWHELP; - - p = &hictinting[i]; - p->r = atoi_safe(parm->parms[1]); - p->g = (parm->numparms>=3) ? atoi_safe(parm->parms[2]) : 255; - p->b = (parm->numparms>=4) ? atoi_safe(parm->parms[3]) : 255; - p->f = (parm->numparms>=5) ? atoi_safe(parm->parms[4])&HICEFFECTMASK : 0; - } - return OSDCMD_OK; -} -#endif - -// M32 script vvv -static int32_t osdcmd_include(const osdfuncparm_t *parm) -{ - if (parm->numparms != 1) - return OSDCMD_SHOWHELP; - C_Compile(parm->parms[0], 1); - return OSDCMD_OK; -} - -static int32_t osdcmd_scriptinfo(const osdfuncparm_t *parm) -{ - UNREFERENCED_PARAMETER(parm); - C_CompilationInfo(); - return OSDCMD_OK; -} - -#ifdef DEBUGGINGAIDS -extern void X_Disasm(ofstype beg, int32_t size); - -static int32_t osdcmd_disasm(const osdfuncparm_t *parm) -{ - int32_t i; - - if (parm->numparms != 2) - return OSDCMD_SHOWHELP; - - if (!isdigit(parm->parms[1][0])) - return OSDCMD_SHOWHELP; - - i=atoi_safe(parm->parms[1]); - - if (parm->parms[0][0]=='s') - { - if (i>=0 && i=0 && i=0) - X_Disasm(aEventOffsets[i], aEventSizes[i]); - } - return OSDCMD_OK; -} -#endif - -static int32_t osdcmd_do(const osdfuncparm_t *parm) -{ - intptr_t oscrofs; - char *tp; - int32_t i, j, slen, ofs; - int32_t onumconstants=g_numSavedConstants; - - if (parm->numparms==0) - return OSDCMD_SHOWHELP; - - oscrofs = (g_scriptPtr-script); - - ofs = 2*(parm->numparms>0); // true if "do" command - slen = Bstrlen(parm->raw+ofs); - tp = Bmalloc(slen+2); - if (!tp) goto OUTOFMEM; - Bmemcpy(tp, parm->raw+ofs, slen); - - // needed so that subsequent commands won't execute old stuff. - tp[slen] = '\n'; - tp[slen+1] = '\0'; - - g_didDefineSomething = 0; - - C_Compile(tp, 0); - - if (parm->numparms>=0) - Bfree(tp); - - if (g_numCompilerErrors) - { -// g_scriptPtr = script + oscrofs; // handled in C_Compile() - return OSDCMD_OK; - } - - for (i=0,j=0; i=0) - j++; - - if (g_didDefineSomething == 0) - { - g_numSavedConstants = onumconstants; - - *g_scriptPtr = CON_RETURN + (g_lineNumber<<12); - g_scriptPtr = script + oscrofs; - - insptr = script + oscrofs; - Bmemcpy(&vm, &vm_default, sizeof(vmstate_t)); - - if (qsetmode==200 && AIMING_AT_SPRITE) - { - vm.g_i = searchwall; - vm.g_sp = &sprite[vm.g_i]; - } - - VM_Execute(0); - - if (vm.updatehighlight) - { - update_highlight(); - vm.updatehighlight = 0; - } - - if (!(vm.flags&VMFLAG_ERROR)) - { - int32_t idx, dosave=1; - - for (i=1; i<=4; i++) - { - idx = (scripthistend-i)&(SCRIPTHISTSIZ-1); - if (!scripthist[idx]) - break; - else if (!Bstrcmp(scripthist[idx], parm->raw)) - { - dosave = 0; - break; - } - } - - if (dosave) - { - if (scripthist[scripthistend]) - Bfree((void *)scripthist[scripthistend]); - scripthist[scripthistend] = Bstrdup(parm->raw); - scripthistend++; - scripthistend %= SCRIPTHISTSIZ; - } - } -// asksave = 1; // handled in Access(Sprite|Sector|Wall) - } - - return OSDCMD_OK; -OUTOFMEM: - message("OUT OF MEMORY!\n"); - return OSDCMD_OK; -} - -void M32RunScript(const char *s) -{ - osdfuncparm_t parm; - - parm.numparms = -1; - parm.raw = s; - - osdcmd_do(&parm); -} - -static int32_t osdcmd_endisableevent(const osdfuncparm_t *parm) -{ - int32_t i, j, enable; - - if (!label) return OSDCMD_OK; - - if (parm->numparms < 1) - { - OSD_Printf("--- Defined events:\n"); - for (i=0; i= 0) - OSD_Printf("%s (%d): %s\n", label+(i*MAXLABELLEN), i, aEventEnabled[i]?"on":"off"); - return OSDCMD_OK; - } - - enable = !Bstrcasecmp(parm->name, "enableevent"); - - if (parm->numparms == 1) - { - if (!Bstrcasecmp(parm->parms[0], "all") || !Bstrcasecmp(parm->parms[0], "a")) - { - for (i=0; inumparms; i++) - { - char buf[64] = "EVENT_", buf2[64]; - - if (isdigit(parm->parms[i][0])) - { - j = atoi_safe(parm->parms[i]); - Bsprintf(buf2, "event %d", j); - } - else if (!Bstrncmp(parm->parms[i], "EVENT_", 6)) - { - j = hash_find(&h_labels, parm->parms[i]); - Bstrncpy(buf2, parm->parms[i], sizeof(buf2)); - buf2[sizeof(buf2)-1] = '\0'; - } - else - { - Bstrncat(buf, parm->parms[i], sizeof(buf)-6-1); - j = hash_find(&h_labels, buf); - Bmemcpy(buf2, buf, sizeof(buf2)); - } - - if (j>=0 && j: adds path to game filesystem", osdcmd_addpath); - - OSD_RegisterFunction("editorgridextent","editorgridextent: sets the size of the 2D mode editing grid",osdcmd_editorgridextent); - - OSD_RegisterFunction("initgroupfile","initgroupfile : adds a grp file into the game filesystem", osdcmd_initgroupfile); - - OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip); - - OSD_RegisterFunction("quit","quit: exits the editor immediately", osdcmd_quit); - OSD_RegisterFunction("exit","exit: exits the editor immediately", osdcmd_quit); - - OSD_RegisterFunction("sensitivity","sensitivity : changes the mouse sensitivity", osdcmd_sensitivity); - - //PK - OSD_RegisterFunction("pk_turnaccel", "pk_turnaccel : sets turning acceleration+deceleration", osdcmd_vars_pk); - OSD_RegisterFunction("pk_turndecel", "pk_turndecel : sets turning deceleration", osdcmd_vars_pk); - OSD_RegisterFunction("pk_uedaccel", "pk_uedaccel : sets UnrealEd movement speed factor (0-5, exponentially)", osdcmd_vars_pk); - OSD_RegisterFunction("pk_quickmapcycling", "pk_quickmapcycling: toggles quick cycling of maps with (Shift-)Ctrl-X", osdcmd_vars_pk); - OSD_RegisterFunction("testplay_addparam", "testplay_addparam \"string\": sets additional parameters for test playing", osdcmd_testplay_addparam); - OSD_RegisterFunction("show_heightindicators", "show_heightindicators {0, 1 or 2}: sets display of height indicators in 2D mode", osdcmd_vars_pk); - OSD_RegisterFunction("show_ambiencesounds", "show_ambiencesounds {0, 1 or 2}>: sets display of MUSICANDSFX circles in 2D mode", osdcmd_vars_pk); - OSD_RegisterFunction("corruptcheck", "corruptcheck {|now|tryfix}: sets auto corruption check interval if given, otherwise as indicated", osdcmd_vars_pk); -#ifdef USE_OPENGL - OSD_RegisterFunction("tint", "tint : queries or sets hightile tinting", osdcmd_tint); -#endif - - // M32 script - OSD_RegisterFunction("include", "include : compiles one or more M32 script files", osdcmd_include); - OSD_RegisterFunction("do", "do (m32 script ...): executes M32 script statements", osdcmd_do); - OSD_RegisterFunction("script_info", "script_info: shows information about compiled M32 script", osdcmd_scriptinfo); - OSD_RegisterFunction("script_expertmode", "script_expertmode: toggles M32 script expert mode", osdcmd_vars_pk); - OSD_RegisterFunction("enableevent", "enableevent {all|EVENT_...|(event number)}", osdcmd_endisableevent); - OSD_RegisterFunction("disableevent", "disableevent {all|EVENT_...|(event number)}", osdcmd_endisableevent); - OSD_RegisterFunction("osd_tryscript", "osd_tryscript: toggles execution of M32 script on invalid OSD command", osdcmd_vars_pk); - OSD_RegisterFunction("sideview_reversehorizrot", "sideview_reversehorizrot: toggles reversion of Q and W keys in side view mode", osdcmd_vars_pk); -#ifdef DEBUGGINGAIDS - OSD_RegisterFunction("disasm", "disasm [s|e] ", osdcmd_disasm); -#endif - return 0; -} - -#define DUKEOSD -#ifdef DUKEOSD -#if 0 -void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal) -{ - int32_t ac; - - if (ch == 32) return; - ac = ch-'!'+STARTALPHANUM; - if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; - - rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1); -} - -void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade, int32_t pal) -{ - int32_t ac; - - for (x = (x<<3)+x; len>0; len--, ch++, x++) - { - if (*ch == 32) - { - x+=5; - continue; - } - ac = *ch-'!'+STARTALPHANUM; - if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; - - rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1); - if (*ch >= '0' && *ch <= '9') x+=8; - else x += tilesizx[ac]; - } -} -#endif - -static int32_t GetTime(void) -{ - return totalclock; -} - -#if 0 -void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress) -{ - int32_t ac; - - if (type) ac = SMALLFNTCURSOR; - else ac = '_'-'!'+STARTALPHANUM; - - if (!((GetTime()-lastkeypress) & 0x40l)) - rotatesprite(((x<<3)+x)<<16, ((y<<3)+(type?-1:2))<<16, 65536l, 0, ac, 0, 8, 8|16, 0, 0, xdim-1, ydim-1); -} - -int32_t GAME_getcolumnwidth(int32_t w) -{ - return w/9; -} - -int32_t GAME_getrowheight(int32_t w) -{ - return w>>3; -} -#endif - -//#define BGTILE 311 -//#define BGTILE 1156 -#define BGTILE 1141 // BIGHOLE -#define BORDTILE 3250 // VIEWBORDER -#define BITSTH 1+32+8+16 // high translucency -#define BITSTL 1+8+16 // low translucency -#define BITS 8+16+64 // solid -#define SHADE 16 -#define PALETTE 4 -void GAME_clearbackground(int32_t numcols, int32_t numrows) -{ - UNREFERENCED_PARAMETER(numcols); - -#ifdef USE_OPENGL -// if (getrendermode() < 3) bits = BITS; -// else - if (rendmode>=3 && qsetmode==200) - { - int32_t x, y, xsiz, ysiz, tx2, ty2; - int32_t daydim, bits; - - bits = BITSTL; - - daydim = numrows<<3; - - xsiz = tilesizx[BGTILE]; - tx2 = xdim/xsiz; - ysiz = tilesizy[BGTILE]; - ty2 = daydim/ysiz; - - setpolymost2dview(); - - for (x=0; x<=tx2; x++) - for (y=0; y<=ty2; y++) - rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim); - - xsiz = tilesizy[BORDTILE]; - tx2 = xdim/xsiz; - ysiz = tilesizx[BORDTILE]; - - for (x=0; x<=tx2; x++) - rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536, - BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1); - - return; - } -#endif - - CLEARLINES2D(0, min(ydim, numrows*8+8), editorcolors[16]); -} - -static void m32_osdsetfunctions() -{ - OSD_SetFunctions( -/* - GAME_drawosdchar, - GAME_drawosdstr, - GAME_drawosdcursor, - GAME_getcolumnwidth, - GAME_getrowheight, -*/ - 0,0,0,0,0, - GAME_clearbackground, - /*(int32_t( *)(void))*/GetTime, - NULL - ); -} - - -#endif - -enum -{ - T_EOF = -2, - T_ERROR = -1, - T_INCLUDE = 0, - T_DEFINE = 1, - T_LOADGRP, - T_TILEGROUP, - T_TILE, - T_TILERANGE, - T_HOTKEY, - T_TILES, - T_NOAUTOLOAD, - T_COLORS, - - T_ALPHABET, - T_MAP, - T_MAPA, - T_MAPRANGE, - T_MAPRANGEA, - T_OFFSET, - T_OFFSETA, - - T_DEFINESOUND, -}; - -typedef struct -{ - const char *text; - int32_t tokenid; -} -tokenlist; - -static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens) -{ - char *tok; - int32_t i; - - if (!sf) return T_ERROR; - tok = scriptfile_gettoken(sf); - if (!tok) return T_EOF; - - for (i=0; iname); - initprintf("Using group file '%s'.\n", tempbuf); - initgroupfile(tempbuf); - findfiles = findfiles->next; - } - } -} - -int32_t parsegroupfiles(scriptfile *script) -{ - int32_t tokn; - char *cmdtokptr; - - tokenlist grptokens[] = - { - { "include", T_INCLUDE }, - { "#include", T_INCLUDE }, - { "loadgrp", T_LOADGRP }, - { "noautoload", T_NOAUTOLOAD } - }; - - while (1) - { - tokn = getatoken(script,grptokens,sizeof(grptokens)/sizeof(tokenlist)); - cmdtokptr = script->ltextptr; - switch (tokn) - { - case T_LOADGRP: - { - char *fn; - - pathsearchmode = 1; - if (!scriptfile_getstring(script,&fn)) - { - int32_t j = initgroupfile(fn); - - if (j == -1) - initprintf("Could not find group file '%s'.\n",fn); - else - { - initprintf("Using group file '%s'.\n",fn); - if (!NoAutoLoad) - DoAutoload(fn); - } - - } - pathsearchmode = 0; - } - break; - case T_INCLUDE: - { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included; - - included = scriptfile_fromfile(fn); - if (!included) - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - parsegroupfiles(included); - scriptfile_close(included); - } - } - break; - } - break; - case T_NOAUTOLOAD: - NoAutoLoad = 1; - break; - case T_EOF: - return(0); - default: - break; - } - } - return 0; -} - -int32_t loadgroupfiles(const char *fn) -{ - scriptfile *script; - - script = scriptfile_fromfile(fn); - if (!script) return -1; - - parsegroupfiles(script); - - scriptfile_close(script); - scriptfile_clearsymbols(); - - return 0; -} - -int32_t parsetilegroups(scriptfile *script) -{ - int32_t tokn; - char *cmdtokptr; - - tokenlist tgtokens[] = - { - { "include", T_INCLUDE }, - { "#include", T_INCLUDE }, - { "define", T_DEFINE }, - { "#define", T_DEFINE }, - { "tilegroup", T_TILEGROUP }, - { "spritehotkey", T_HOTKEY }, - { "alphabet", T_ALPHABET }, - }; - - while (1) - { - tokn = getatoken(script,tgtokens,sizeof(tgtokens)/sizeof(tokenlist)); - cmdtokptr = script->ltextptr; - switch (tokn) - { - case T_HOTKEY: - { - int32_t i, j; - if (scriptfile_getsymbol(script,&i)) break; - if (scriptfile_getsymbol(script,&j)) break; - if (i < 0 || i > 9 || j < 0 || j >= MAXTILES) break; - prefixtiles[i] = j; - break; - } - case T_INCLUDE: - { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included; - - included = scriptfile_fromfile(fn); - if (!included) - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - parsetilegroups(included); - scriptfile_close(included); - } - } - break; - } - case T_DEFINE: - { - char *name; - int32_t number; - - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getsymbol(script,&number)) break; - if (scriptfile_addsymbolvalue(name,number) < 0) - initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", - name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); - break; - } - case T_TILEGROUP: - { - char *end, *name; - int32_t i; - - if (tile_groups >= MAX_TILE_GROUPS) break; - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getbraces(script,&end)) break; - - s_TileGroups[tile_groups].pIds = Bcalloc(MAX_TILE_GROUP_ENTRIES, sizeof(int32_t)); - s_TileGroups[tile_groups].szText = Bstrdup(name); - - while (script->textptr < end) - { - tokenlist tgtokens2[] = - { - { "tilegroup", T_TILEGROUP }, - { "tile", T_TILE }, - { "tilerange", T_TILERANGE }, - { "hotkey", T_HOTKEY }, - { "tiles", T_TILES }, - { "colors", T_COLORS }, - }; - - int32_t token = getatoken(script,tgtokens2,sizeof(tgtokens2)/sizeof(tokenlist)); - switch (token) - { - case T_TILE: - { - if (scriptfile_getsymbol(script,&i)) break; - if (i >= 0 && i < MAXTILES && s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES) - s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i; - // OSD_Printf("added tile %d to group %d\n",i,g); - break; - } - case T_TILERANGE: - { - int32_t j; - if (scriptfile_getsymbol(script,&i)) break; - if (scriptfile_getsymbol(script,&j)) break; - if (i < 0 || i >= MAXTILES || j < 0 || j >= MAXTILES) break; - while (s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES && i <= j) - { - s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i++; - // OSD_Printf("added tile %d to group %d\n",i,g); - } - break; - } - case T_COLORS: - { - int32_t j; - if (scriptfile_getsymbol(script, &i)) break; - if (scriptfile_getsymbol(script, &j)) break; - if (i < 0 || i >= 256 || j < 0 || j >= 256) break; - s_TileGroups[tile_groups].color1 = i; - s_TileGroups[tile_groups].color2 = j; - break; - } - case T_HOTKEY: - { - char *c; - if (scriptfile_getstring(script,&c)) break; - s_TileGroups[tile_groups].key1 = Btoupper(c[0]); - s_TileGroups[tile_groups].key2 = Btolower(c[0]); - break; - } - case T_TILES: - { - char *end2; - if (scriptfile_getbraces(script,&end2)) break; - while (script->textptr < end2-1) - { - if (!scriptfile_getsymbol(script,&i)) - { - if (i >= 0 && i < MAXTILES && s_TileGroups[tile_groups].nIds < MAX_TILE_GROUP_ENTRIES) - s_TileGroups[tile_groups].pIds[s_TileGroups[tile_groups].nIds++] = i; - // OSD_Printf("added tile %d to group %d\n",i,g); - } - } - break; - } - } - } - - s_TileGroups[tile_groups].pIds = Brealloc(s_TileGroups[tile_groups].pIds, - s_TileGroups[tile_groups].nIds*sizeof(int32_t)); - tile_groups++; - break; - } - case T_ALPHABET: - { - char *end; - int32_t i, j, k; - - if (numalphabets >= MAX_ALPHABETS) - { - OSD_Printf("Too many alphabet definitions (max: %d).\n", MAX_ALPHABETS); - break; - } - - if (scriptfile_getbraces(script,&end)) break; - - for (i=0; itextptr < end) - { - tokenlist alphtokens2[] = - { - { "map", T_MAP }, - { "mapa", T_MAPA }, - { "maprange", T_MAPRANGE }, - { "maprangea", T_MAPRANGEA }, - { "offset", T_OFFSET }, - { "offseta", T_OFFSETA }, - }; - - int32_t token = getatoken(script,alphtokens2,sizeof(alphtokens2)/sizeof(tokenlist)); - switch (token) - { - case T_MAP: // map , e.g. map 46 3002 - { - if (scriptfile_getnumber(script,&i)) break; - if (scriptfile_getsymbol(script,&j)) break; - - if (i>=33 && i<=126 && j>= 0 && j , e.g. map ".,!?" 3002 - { - char *s; - if (scriptfile_getstring(script,&s)) break; - if (scriptfile_getsymbol(script,&i)) break; - - for (; *s; s++, i++) - { - if (*s>=33 && *s<=126 && i>= 0 && i , e.g. map 33 126 STARTALPHANUM - // maprangea , e.g. map "!" "~" STARTALPHANUM - case T_MAPRANGE: - case T_MAPRANGEA: - { - if (token==T_MAPRANGE) - { - if (scriptfile_getnumber(script,&i)) break; - if (scriptfile_getnumber(script,&j)) break; - } - else - { - char *c1, *c2; - if (scriptfile_getstring(script,&c1)) break; - if (scriptfile_getstring(script,&c2)) break; - i=*c1; - j=*c2; - } - if (scriptfile_getsymbol(script,&k)) break; - - if (i>126 || j<33) break; - for (; i<=j && k=33 && i<=126) - alphabets[numalphabets].pic[i-33] = k; - } - break; - } - case T_OFFSET: // offset - { - if (scriptfile_getnumber(script, &i)) break; - if (scriptfile_getnumber(script, &j)) break; - if (scriptfile_getnumber(script, &k)) break; - - if (i >= 33 && i <= 126) - { - alphabets[numalphabets].xofs[i-33] = j; - alphabets[numalphabets].yofs[i-33] = k; - } - break; - } - case T_OFFSETA: // offseta - { - char *s; - if (scriptfile_getstring(script, &s)) break; - if (scriptfile_getnumber(script, &i)) break; - if (scriptfile_getnumber(script, &j)) break; - - for (; *s; s++) - if (*s >= 33 && *s <= 126) - { - alphabets[numalphabets].xofs[(*s)-33] = i; - alphabets[numalphabets].yofs[(*s)-33] = j; - } - break; - } - } - } - numalphabets++; - break; - } - case T_EOF: - return(0); - default: - break; - } - } - return 0; -} - -static int32_t loadtilegroups(const char *fn) -{ - int32_t i, j; - scriptfile *script; - TileGroup blank = { NULL, 0, NULL, 0, 0, 0, 0}; - - script = scriptfile_fromfile(fn); - if (!script) return -1; - - for (i=0; i= 0 ; j--) - { - // Apply the colors to all tiles in the group. - spritecol2d[s_TileGroups[i].pIds[j]][0] = s_TileGroups[i].color1; - spritecol2d[s_TileGroups[i].pIds[j]][1] = s_TileGroups[i].color2; - } - } - } - - return 0; -} - -/// vvv Parse CON files partially to get sound definitions -static int32_t parseconsounds(scriptfile *script) -{ - int32_t tokn; - char *cmdtokptr; - int32_t num_invalidsounds=0; - - tokenlist cstokens[] = - { - { "include", T_INCLUDE }, - { "#include", T_INCLUDE }, - { "define", T_DEFINE }, - { "#define", T_DEFINE }, - { "definesound", T_DEFINESOUND }, - }; - - while (1) - { - tokn = getatoken(script,cstokens,sizeof(cstokens)/sizeof(tokenlist)); - cmdtokptr = script->ltextptr; - switch (tokn) - { - case T_INCLUDE: - { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included; - - included = scriptfile_fromfile(fn); - if (!included) - { - initprintf("Warning: Failed including %s on line %s:%d\n", - fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - int32_t tmp = parseconsounds(included); - scriptfile_close(included); - if (tmp < 0) return tmp; - } - } - break; - } - case T_DEFINE: - { - char *name; - int32_t number; - - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getsymbol(script,&number)) break; - if (scriptfile_addsymbolvalue(name,number) < 0) - initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", - name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); - break; - } - case T_DEFINESOUND: - { - char *definedname, *filename; - int32_t sndnum, ps, pe, pr, m, vo; - int32_t slen; - - if (scriptfile_getsymbol(script, &sndnum)) break; - - definedname = Bstrdup(script->ltextptr); - if (!definedname) return -1; - - if (sndnum < 0 || sndnum >= MAXSOUNDS) - { - initprintf("Warning: invalid sound definition %s (sound number < 0 or >= MAXSOUNDS) on line %s:%d\n", - definedname, script->filename,scriptfile_getlinum(script,cmdtokptr)); - num_invalidsounds++; - break; - } - - if (scriptfile_getstring(script, &filename)) - { - Bfree(definedname); - num_invalidsounds++; - break; - } - - slen = Bstrlen(filename); - if (slen >= BMAX_PATH) - { - initprintf("Warning: invalid sound definition %s (filename too long) on line %s:%d\n", - definedname, script->filename,scriptfile_getlinum(script,cmdtokptr)); - Bfree(definedname); - num_invalidsounds++; - break; - } - - if (g_sounds[sndnum].filename == NULL) - g_sounds[sndnum].filename = Bcalloc(slen+1,sizeof(uint8_t)); - // Hopefully noone does memcpy(..., g_sounds[].filename, BMAX_PATH) - if (!g_sounds[sndnum].filename) - { - Bfree(definedname); - return -1; - } - Bmemcpy(g_sounds[sndnum].filename, filename, slen+1); - - if (scriptfile_getnumber(script, &ps)) goto BAD; - if (scriptfile_getnumber(script, &pe)) goto BAD; - if (scriptfile_getnumber(script, &pr)) goto BAD; - if (scriptfile_getnumber(script, &m)) goto BAD; - if (ParentalLock && (m&8)) goto BAD; - if (scriptfile_getnumber(script, &vo)) goto BAD; - if (0) - { -BAD: - Bfree(definedname); - Bfree(g_sounds[sndnum].filename); - g_sounds[sndnum].filename = NULL; - num_invalidsounds++; - break; - } - - g_sounds[sndnum].definedname = definedname; // we want to keep it for display purposes - g_sounds[sndnum].ps = ps; - g_sounds[sndnum].pe = pe; - g_sounds[sndnum].pr = pr; - g_sounds[sndnum].m = m; - g_sounds[sndnum].vo = vo; - g_sndnum[g_numsounds] = g_definedsndnum[g_numsounds] = sndnum; - g_numsounds++; - if (g_numsounds == MAXSOUNDS) - goto END; - break; - } - case T_EOF: - goto END; - default: - break; - } - } -END: - return g_numsounds; -} - -static int32_t loadconsounds(const char *fn) -{ - scriptfile *script; - int32_t ret; - - initprintf("Loading sounds from '%s'\n",fn); - - script = scriptfile_fromfile(fn); - if (!script) - { - initprintf("Error loading sounds: file '%s' not found.\n", fn); - return -1; - } - ret = parseconsounds(script); - if (ret < 0) - initprintf("There was an error parsing '%s'.\n", fn); - else if (ret == 0) - initprintf("'%s' doesn't contain sound definitions. No sounds loaded.\n", fn); - else - initprintf("Loaded %d sound definitions.\n", ret); - - scriptfile_close(script); - scriptfile_clearsymbols(); - return ret; -} - -void ExtPreLoadMap(void) -{ -} - -/// ^^^ - -static void m32script_interrupt_handler(int signo) -{ - if (signo==SIGINT) - { - vm.flags |= VMFLAG_ERROR; - OSD_Printf("M32 script execution interrupted.\n"); - Bmemset(aEventEnabled, 0, sizeof(aEventEnabled)); - } -} - -int32_t ExtInit(void) -{ - int32_t rv = 0; - int32_t i; - char cwd[BMAX_PATH]; - -#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) - addsearchpath("/usr/share/games/jfduke3d"); - addsearchpath("/usr/local/share/games/jfduke3d"); - addsearchpath("/usr/share/games/eduke32"); - addsearchpath("/usr/local/share/games/eduke32"); -#elif defined(__APPLE__) - addsearchpath("/Library/Application Support/JFDuke3D"); - addsearchpath("/Library/Application Support/EDuke32"); -#endif - - if (getcwd(cwd,BMAX_PATH)) - { -#if defined(__APPLE__) - /* Dirty hack on OS X to also look for gamedata inside the application bundle - rhoenie 08/08 */ - char seekinappcontainer[BMAX_PATH]; - Bsnprintf(seekinappcontainer,sizeof(seekinappcontainer),"%s/EDuke32.app/", cwd); - addsearchpath(seekinappcontainer); -#endif - addsearchpath(cwd); - Bstrcpy(program_origcwd, cwd); - } - else - program_origcwd[0] = '\0'; - - if (CommandPaths) - { - struct strllist *s; - while (CommandPaths) - { - s = CommandPaths->next; - addsearchpath(CommandPaths->str); - - Bfree(CommandPaths->str); - Bfree(CommandPaths); - CommandPaths = s; - } - } - -#if defined(_WIN32) - if (!access("user_profiles_enabled", F_OK)) -#else - if (usecwd == 0 && access("user_profiles_disabled", F_OK)) -#endif - { - char *homedir; - int32_t asperr; - - if ((homedir = Bgethomedir())) - { - Bsnprintf(cwd,sizeof(cwd),"%s/" -#if defined(_WIN32) - "EDuke32 Settings" -#elif defined(__APPLE__) - "Library/Application Support/EDuke32" -#else - ".eduke32" -#endif - ,homedir); - asperr = addsearchpath(cwd); - if (asperr == -2) - { - if (Bmkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd); - else asperr = -1; - } - if (asperr == 0) - chdir(cwd); - Bfree(homedir); - } - } - - // JBF 20031220: Because it's annoying renaming GRP files whenever I want to test different game data - if (getenv("DUKE3DGRP")) - { - g_grpNamePtr = getenv("DUKE3DGRP"); - initprintf("Using %s as main GRP file\n", g_grpNamePtr); - } - - i = initgroupfile(g_grpNamePtr); - - if (!NoAutoLoad) - { - static const char *extensions[3] = { "*.grp", "*.zip", "*.pk3" }; - int32_t exti; - - for (exti=0; exti<3; exti++) - { - getfilenames("autoload", extensions[exti]); - while (findfiles) - { - Bsprintf(tempbuf,"autoload/%s",findfiles->name); - initprintf("Using group file '%s'.\n",tempbuf); - initgroupfile(tempbuf); - findfiles = findfiles->next; - } - } - - if (i != -1) - DoAutoload(g_grpNamePtr); - } - - if (getenv("DUKE3DDEF")) - { - defsfilename = getenv("DUKE3DDEF"); - initprintf("Using '%s' as definitions file\n", defsfilename); - } - loadgroupfiles(defsfilename); - - { - struct strllist *s; - int32_t j; - - pathsearchmode = 1; - while (CommandGrps) - { - s = CommandGrps->next; - j = initgroupfile(CommandGrps->str); - if (j == -1) initprintf("Could not find group file '%s'.\n",CommandGrps->str); - else - { - initprintf("Using group file '%s'.\n",CommandGrps->str); - if (!NoAutoLoad) - DoAutoload(CommandGrps->str); - } - - Bfree(CommandGrps->str); - Bfree(CommandGrps); - CommandGrps = s; - } - pathsearchmode = 0; - } - - bpp = 32; - -#ifdef USE_OPENGL - glusetexcache = -1; - - if (Bstrcmp(setupfilename, "mapster32.cfg")) - initprintf("Using config file '%s'.\n",setupfilename); - - if (loadsetup(setupfilename) < 0) - initprintf("Configuration file not found, using defaults.\n"), rv = 1; - - if (glusetexcache == -1) - { - int32_t i; -#if 0 - i=wm_ynbox("Texture Cache", - "Would you like to enable the on-disk texture cache?\n\n" - "You generally want to say 'yes' here, especially if using the HRP."); -#else - i = 1; -#endif - if (i) - glusetexcompr = 1, glusetexcache = 2; - else glusetexcache = 0; - } -#endif - - Bmemcpy(buildkeys, default_buildkeys, NUMBUILDKEYS); //Trick to make build use setup.dat keys - - if (initengine()) - { - initprintf("There was a problem initializing the engine.\n"); - return -1; - } - - setbasepaltable(basepaltable, BASEPALCOUNT); - - kensplayerheight = 40; //32 - zmode = 2; - zlock = kensplayerheight<<8; - - ReadGamePalette(); - // InitWater(); - - InitCustomColors(); - - getmessageleng = 0; - getmessagetimeoff = 0; - - Bsprintf(apptitle, "Mapster32 %s %s", VERSION, s_buildRev); - autosavetimer = totalclock+120*autosave; - -#if defined(DUKEOSD) - m32_osdsetfunctions(); -#endif - - OSD_SetParameters(0,2, 0,0, 4,0); - registerosdcommands(); - - // backup pathsearchmode so that a later open - // will hopefully be the same file - pathsearchmode_oninit = pathsearchmode; - loadtilegroups(default_tiles_cfg); - - ReadHelpFile("m32help.hlp"); - - signal(SIGINT, m32script_interrupt_handler); - - return rv; -} - -#ifdef RENDERTYPEWIN -void app_crashhandler(void) -{ - if (levelname[0]) - { - char *f = strstr(levelname,".map"); - - if (f) - Bstrcpy(f,"_crash.map"); - else Bstrcat(f,"_crash.map"); - - SaveBoard(f, 1); - } -} -#endif - -void ExtUnInit(void) -{ - int32_t i; - // setvmode(0x03); - writesetup(setupfilename); - - S_SoundShutdown(); - uninitgroupfile(); - - for (i = MAX_TILE_GROUPS-1; i >= 0; i--) - { - if (s_TileGroups[i].pIds != NULL) - Bfree(s_TileGroups[i].pIds); - if (s_TileGroups[i].szText != NULL) - Bfree(s_TileGroups[i].szText); - } - for (i = numhelppages-1; i >= 0; i--) Bfree(helppage[i]); - if (helppage) Bfree(helppage); -} - -void ExtPreCheckKeys(void) // just before drawrooms -{ - int32_t i = 0, ii; - int32_t radius, xp1, yp1; - int32_t col; - int32_t picnum, frames; - int32_t ang = 0, flags, shade; - - if (qsetmode == 200) //In 3D mode - { - if (shadepreview) - { - int32_t i = 0; - for (i=0; i= 0) - { - if (!wallflag[wall[w].nextwall]) - { - wallshades[wall[w].nextwall] = NEXTWALL(w).shade; - NEXTWALL(w).shade = sprite[i].shade; - wallpals[wall[w].nextwall] = NEXTWALL(w).pal; - NEXTWALL(w).pal = sprite[i].pal; - wallflag[wall[w].nextwall] = 1; - } - } */ - } - sectorshades[isec][0] = sector[isec].floorshade; - sectorshades[isec][1] = sector[isec].ceilingshade; - sector[isec].floorshade = sprite[i].shade; - sector[isec].ceilingshade = sprite[i].shade; - sectorpals[isec][0] = sector[isec].floorpal; - sectorpals[isec][1] = sector[isec].ceilingpal; - sector[isec].floorpal = sprite[i].pal; - sector[isec].ceilingpal = sprite[i].pal; - w = headspritesect[isec]; - while (w >= 0) - { - if (w == i) { w = nextspritesect[w]; continue; } - spriteshades[w] = sprite[w].shade; - sprite[w].shade = sprite[i].shade; - spritepals[w] = sprite[w].pal; - sprite[w].pal = sprite[i].pal; - w = nextspritesect[w]; - } - } - else if (sprite[i].picnum == SECTOREFFECTOR && (sprite[i].lotag == 49 || sprite[i].lotag == 50)) - { -#ifdef POLYMER - if (sprite[i].lotag == 49) - { - if (getrendermode() == 4) - { - if (spritelightptr[i] == NULL) - { -#pragma pack(push,1) - _prlight mylight; -#pragma pack(pop) - mylight.sector = SECT; - Bmemcpy(&mylight, &sprite[i], sizeof(vec3_t)); - mylight.range = SHT; - mylight.color[0] = sprite[i].xvel; - mylight.color[1] = sprite[i].yvel; - mylight.color[2] = sprite[i].zvel; - mylight.radius = 0; - mylight.angle = SA; - mylight.horiz = SH; - mylight.minshade = sprite[i].xoffset; - mylight.maxshade = sprite[i].yoffset; - mylight.tilenum = 0; - - if (CS & 2) - { - if (CS & 512) - mylight.priority = PR_LIGHT_PRIO_LOW; - else - mylight.priority = PR_LIGHT_PRIO_HIGH; - } - else - mylight.priority = PR_LIGHT_PRIO_MAX; - - spritelightid[i] = polymer_addlight(&mylight); - if (spritelightid[i] >= 0) - spritelightptr[i] = &prlights[spritelightid[i]]; - } - else - { - if (Bmemcmp(&sprite[i], spritelightptr[i], sizeof(vec3_t))) - { - Bmemcpy(spritelightptr[i], &sprite[i], sizeof(vec3_t)); - spritelightptr[i]->sector = sprite[i].sectnum; - spritelightptr[i]->flags.invalidate = 1; - } - if (SHT != spritelightptr[i]->range) - { - spritelightptr[i]->range = SHT; - spritelightptr[i]->flags.invalidate = 1; - } - if ((sprite[i].xvel != spritelightptr[i]->color[0]) || - (sprite[i].yvel != spritelightptr[i]->color[1]) || - (sprite[i].zvel != spritelightptr[i]->color[2])) - { - spritelightptr[i]->color[0] = sprite[i].xvel; - spritelightptr[i]->color[1] = sprite[i].yvel; - spritelightptr[i]->color[2] = sprite[i].zvel; - } - } - } - } - if (sprite[i].lotag == 50) - { - if (getrendermode() == 4) - { - if (spritelightptr[i] == NULL) - { -#pragma pack(push,1) - _prlight mylight; -#pragma pack(pop) - - mylight.sector = SECT; - Bmemcpy(&mylight, &sprite[i], sizeof(vec3_t)); - mylight.range = SHT; - mylight.color[0] = sprite[i].xvel; - mylight.color[1] = sprite[i].yvel; - mylight.color[2] = sprite[i].zvel; - mylight.radius = (256-(SS+128))<<1; - mylight.faderadius = (int16_t)(mylight.radius * 0.75f); - mylight.angle = SA; - mylight.horiz = SH; - mylight.minshade = sprite[i].xoffset; - mylight.maxshade = sprite[i].yoffset; - mylight.tilenum = OW; - - if (CS & 2) - { - if (CS & 512) - mylight.priority = PR_LIGHT_PRIO_LOW; - else - mylight.priority = PR_LIGHT_PRIO_HIGH; - } - else - mylight.priority = PR_LIGHT_PRIO_MAX; - - spritelightid[i] = polymer_addlight(&mylight); - if (spritelightid[i] >= 0) - spritelightptr[i] = &prlights[spritelightid[i]]; - } - else - { - if (Bmemcmp(&sprite[i], spritelightptr[i], sizeof(vec3_t))) - { - Bmemcpy(spritelightptr[i], &sprite[i], sizeof(vec3_t)); - spritelightptr[i]->sector = sprite[i].sectnum; - spritelightptr[i]->flags.invalidate = 1; - } - if (SHT != spritelightptr[i]->range) - { - spritelightptr[i]->range = SHT; - spritelightptr[i]->flags.invalidate = 1; - } - if ((sprite[i].xvel != spritelightptr[i]->color[0]) || - (sprite[i].yvel != spritelightptr[i]->color[1]) || - (sprite[i].zvel != spritelightptr[i]->color[2])) - { - spritelightptr[i]->color[0] = sprite[i].xvel; - spritelightptr[i]->color[1] = sprite[i].yvel; - spritelightptr[i]->color[2] = sprite[i].zvel; - } - if (((256-(SS+128))<<1) != spritelightptr[i]->radius) - { - spritelightptr[i]->radius = (256-(SS+128))<<1; - spritelightptr[i]->faderadius = (int16_t)(spritelightptr[i]->radius * 0.75f); - spritelightptr[i]->flags.invalidate = 1; - } - if (SA != spritelightptr[i]->angle) - { - spritelightptr[i]->angle = SA; - spritelightptr[i]->flags.invalidate = 1; - } - if (SH != spritelightptr[i]->horiz) - { - spritelightptr[i]->horiz = SH; - spritelightptr[i]->flags.invalidate = 1; - } - spritelightptr[i]->tilenum = OW; - } - } - } -#endif // POLYMER - } - } - } - - if (floor_over_floor) SE40Code(pos.x,pos.y,pos.z,ang,horiz); - if (purpleon) clearview(255); - - return; - } - - - begindrawing(); //{{{ - - // if (cursectornum >= 0) - // fillsector(cursectornum, 31); - - if (graphicsmode && !m32_sideview && zoom >= 256) - { - for (i=ii=0; ix-pos.x,tspr->y-pos.y); - k = (((sprite[i].ang+3072+128-k)&2047)>>8)&7; - //This guy has only 5 pictures for 8 angles (3 are x-flipped) - if (k <= 4) - { - picnum += k; - ang = 0; - flags &= ~4; - } - else - { - picnum += 8-k; - ang = 1024; - flags |= 4; - } - } - - if (graphicsmode == 2) - { - if (frames==2) picnum+=((((4-(totalclock>>5)))&1)*5); - if (frames==4) picnum+=((((4-(totalclock>>5)))&3)*5); - if (frames==5) picnum+=(((totalclock>>5)%5))*5; - } - - if (tilesizx[picnum] == 0) - picnum -= 5; //Hack, for actors - } - break; - default: - break; - } - - xp1 = mulscale14(sprite[i].x-pos.x,zoom); - yp1 = mulscale14(sprite[i].y-pos.y-(tilesizy[picnum]<<2),zoom); - if (i+16384 != pointhighlight || !(totalclock&32)) - { - shade = sprite[i].shade; - if (shade < 6) - shade = 6; - } - - xp1 += halfxdim16; - yp1 += midydim16; - - ydim16 = ydim-STATUS2DSIZ2; - - if (xp1 < 4 || xp1 > xdim-6 || yp1 < 4 || yp1 > ydim16-6) - continue; - rotatesprite(xp1<<16,yp1<<16,zoom<<5,ang,picnum, - shade,sprite[i].pal,flags,0,0,xdim-1,ydim16-1); - } - } - - if (showambiencesounds) - { - for (ii=0; ii=0; i=nextspritesect[i]) - { - if (sprite[i].picnum != MUSICANDSFX /*|| zoom < 256*/ ) - continue; - - if (showambiencesounds==1 && sprite[i].sectnum!=cursectnum) - continue; - - screencoords(&xp1,&yp1, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); - if (m32_sideview) - yp1 += getscreenvdisp(sprite[i].z-pos.z, zoom); - - radius = mulscale14(sprite[i].hitag,zoom); - col = 6; - if (i+16384 == pointhighlight) - if (totalclock & 32) col += (2<<2); - drawlinepat = 0xf0f0f0f0; - drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, scalescreeny(16384), editorcolors[(int32_t)col]); - drawlinepat = 0xffffffff; - // radius = mulscale15(sprite[i].hitag,zoom); - // drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, col); - } - } - - enddrawing(); //}}} -} - -void ExtAnalyzeSprites(void) -{ - int32_t i, k; - spritetype *tspr; - int32_t frames=0, l; - - for (i=0,tspr=&tsprite[0]; ipicnum<11) tspr->xrepeat=0; - - if (nosprites==1||nosprites==3) - switch (tspr->picnum) - { - case SEENINE : - tspr->xrepeat=0; - } - - if (showinvisibility && (tspr->cstat&32768)) - { - tspr->pal = 6; - tspr->cstat &= ~32768; - tspr->cstat |= 2+512; - } - - if (shadepreview && !(tspr->cstat & 16)) - { - if (tspr->sectnum<0) - continue; - - if (sector[tspr->sectnum].ceilingstat&1) - { - l = sector[tspr->sectnum].ceilingshade; - if (sector[tspr->sectnum].ceilingpal != 0 && sector[tspr->sectnum].ceilingpal < num_tables) - tspr->pal=sector[tspr->sectnum].ceilingpal; - } - else - { - l = sector[tspr->sectnum].floorshade; - if (sector[tspr->sectnum].floorpal != 0 && sector[tspr->sectnum].floorpal < num_tables) - tspr->pal=sector[tspr->sectnum].floorpal; - } - - if ((tspr->owner>=0 && (sprite[tspr->owner].cstat&2048)==0)) - { - l = clamp(l, -127, 127); -// tspr->shade = l; - } - } - - switch (tspr->picnum) - { - // 5-frame walk - case 1550 : // Shark - frames=5; - // 2-frame walk - case 1445 : // duke kick - case LIZTROOPDUCKING : - case 2030 : // pig shot - case OCTABRAIN : - case PIGCOPDIVE : - case 2190 : // liz capt shot - case BOSS1SHOOT : - case BOSS1LOB : - case LIZTROOPSHOOT : - if (frames==0) frames=2; - - // 4-frame walk - case 1491 : // duke crawl - case LIZTROOP : - case LIZTROOPRUNNING : - case PIGCOP : - case LIZMAN : - case BOSS1 : - case BOSS2 : - case BOSS3 : - case BOSS4 : - case NEWBEAST: - if (frames==0) frames=4; - case LIZTROOPJETPACK : - case DRONE : - case COMMANDER : - case TANK : - case RECON : - if (frames==0) frames = 10; - case ROTATEGUN : - case CAMERA1: - case APLAYER : - if (frames==0) frames=1; - case GREENSLIME : - case PIGCOPSTAYPUT : - case LIZMANSTAYPUT: - case LIZTROOPSTAYPUT : - case LIZMANSPITTING : - case LIZMANFEEDING : - case LIZMANJUMP : - case NEWBEASTSTAYPUT : - case BOSS1STAYPUT : - if (skill!=4) - { - if (tspr->lotag>skill+1) - { - tspr->xrepeat=0; - tspr->cstat=32768; - break; - } - } - if (nosprites==2||nosprites==3) - { - tspr->xrepeat=0; - tspr->cstat=32768; - } - // else tspr->cstat&=32767; - -#ifdef USE_OPENGL - if (!usemodels || md_tilehasmodel(tspr->picnum,tspr->pal) < 0) -#endif - { - if (frames!=0) - { - if (frames==10) frames=0; - k = getangle(tspr->x-pos.x,tspr->y-pos.y); - k = (((tspr->ang+3072+128-k)&2047)>>8)&7; - //This guy has only 5 pictures for 8 angles (3 are x-flipped) - if (k <= 4) - { - tspr->picnum += k; - tspr->cstat &= ~4; //clear x-flipping bit - } - else - { - tspr->picnum += 8-k; - tspr->cstat |= 4; //set x-flipping bit - } - } - - if (frames==2) tspr->picnum += (((4-(totalclock>>5)))&1)*5; - if (frames==4) tspr->picnum += (((4-(totalclock>>5)))&3)*5; - if (frames==5) tspr->picnum += ((totalclock>>5)%5)*5; - - if (tilesizx[tspr->picnum] == 0) - tspr->picnum -= 5; //Hack, for actors - } - break; - default: - break; - - } - } - - VM_OnEvent(EVENT_ANALYZESPRITES, -1); -} - -#define MESSAGEX 3 // (xdimgame>>1) -#define MESSAGEY 3 // ((i/charsperline)<<3)+(ydimgame-(ydimgame>>3))-(((getmessageleng-1)/charsperline)<<3) - -static void Keys2d3d(void) -{ - int32_t i; - - if (mapstate == NULL) - { - // map_revision = 0; - create_map_snapshot(); // initial map state - // Bfree(mapstate->next); - // mapstate = mapstate->prev; - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(A)) // 'A - { - if (qsetmode == 200) - autosave = autosave?0:getnumber256("Autosave interval, in seconds: ",180,3600,0); - else - autosave = autosave?0:getnumber16("Autosave interval, in seconds: ",180,3600,0); - - if (autosave) message("Autosave enabled, interval: %d seconds",autosave); - else message("Autosave disabled"); - } - - if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(N)) // 'N - { - noclip = !noclip; - message("Clipping %s", noclip?"disabled":"enabled"); - } - - if (eitherCTRL && PRESSED_KEYSC(N)) // CTRL+N - { - spnoclip = !spnoclip; - message("Sprite clipping %s", spnoclip?"disabled":"enabled"); - } - - if (eitherCTRL) //CTRL - { - if (PRESSED_KEYSC(P)) // Ctrl-P: Map playtesting - { - if (qsetmode != 200) - test_map(eitherALT); - } - - if (keystatus[KEYSC_S]) // S - { - if (levelname[0]) - { - keystatus[KEYSC_S] = 0; - - i = CheckMapCorruption(4, 0); - if (i<4) - { - SaveBoard(levelname, 0); - - message("Board saved"); - asksave = 0; - lastsave=totalclock; - } - else - message("Map is heavily corrupted, not saving. See OSD for details."); - } - } - if (keystatus[KEYSC_L]) // L - { - if (totalclock < (lastsave + 120*10) || !AskIfSure("Are you sure you want to load the last saved map?")) - { - int32_t sposx=pos.x,sposy=pos.y,sposz=pos.z,sang=ang; - char *f; - - if (pathsearchmode) f = levelname; - else - { - // virtual filesystem mode can't save to directories so drop the file into - // the current directory - f = Bstrrchr(levelname, '/'); - if (!f) f = levelname; else f++; - } - - lastsave=totalclock; - // sectorhighlightstat = -1; - // newnumwalls = -1; - // joinsector[0] = -1; - // circlewall = -1; - // circlepoints = 7; - - if (LoadBoard(f, 0)) - message("Invalid map format."); - - pos.x=sposx; pos.y=sposy; pos.z=sposz; ang=sang; - updatesectorz(pos.x, pos.y, pos.z, &cursectnum); - - keystatus[KEYSC_L] = 0; - } - } - } - - if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter - { - getmessageleng = 0; - getmessagetimeoff = 0; -#if defined(DUKEOSD) - m32_osdsetfunctions(); -#endif - } - - if (getmessageleng > 0) - { - if (qsetmode != 200) - printmessage16("%s", getmessage); - if (totalclock > getmessagetimeoff) - getmessageleng = 0; - } - -} -#undef EDUKE32_EXEC -#undef EDUKE32_LOCALEXEC - -void ExtCheckKeys(void) -{ - static int32_t soundinit = 0; - static int32_t lastbstatus = 0; - - if (!soundinit) - { - g_numsounds = 0; - loadconsounds(gamecon); - if (g_numsounds > 0) - { - if (S_SoundStartup() != 0) - S_SoundShutdown(); - } - soundinit = 1; - } - - if (qsetmode == 200 && shadepreview) - { - int32_t i = 0; - int32_t w, isec, start_wall, end_wall; - - for (i=0; i= 0) - { - if (wallflag[wall[w].nextwall]) - { - NEXTWALL(w).shade = wallshades[wall[w].nextwall]; - NEXTWALL(w).pal = wallpals[wall[w].nextwall]; - wallflag[wall[w].nextwall] = 0; - } - } -#endif - } - sector[isec].floorshade = sectorshades[isec][0]; - sector[isec].ceilingshade = sectorshades[isec][1]; - sector[isec].floorpal = sectorpals[isec][0]; - sector[isec].ceilingpal = sectorpals[isec][1]; - - for (w=headspritesect[isec]; w>=0; w=nextspritesect[w]) - { - if (w == i) - continue; - sprite[w].shade = spriteshades[w]; - sprite[w].pal = spritepals[w]; - w = nextspritesect[w]; - } - - } - } - - lastbstatus = bstatus; - readmousebstatus(&bstatus); - - Keys2d3d(); - - if (qsetmode == 200) //In 3D mode - { - Keys3d(); - editinput(); - if (infobox&2) - m32_showmouse(); - } - else - { - Keys2d(); - - if (autocorruptcheck>0 && totalclock > corruptchecktimer) - { - if (CheckMapCorruption(3, 0)>=3) - printmessage16("Corruption detected. See OSD for details."); - corruptchecktimer = totalclock + 120*autocorruptcheck; - } - } - - if (asksave == 1) - asksave++; - else if (asksave == 2 && (bstatus + lastbstatus) == 0 && mapstate) - { - int32_t i; - // check keys so that e.g. bulk deletions won't produce - // as much revisions as deleted sprites - for (i=sizeof(keystatus)/sizeof(keystatus[0])-1; i>=0; i--) - if (keystatus[i]) - break; - if (i==-1) - { - create_map_snapshot(); - asksave++; - } - } - else if (asksave == 3) - asksave++; - - if (totalclock > autosavetimer && autosave) - { - if (asksave == 4) - { - if (CheckMapCorruption(6, 0)>=4) - { - SaveBoard("autosave_corrupt.map", 1); - message("Board autosaved to AUTOSAVE_CORRUPT.MAP"); - } - else - { - SaveBoard("autosave.map", 0); - message("Board autosaved to AUTOSAVE.MAP"); - } - - asksave++; - } - autosavetimer = totalclock+120*autosave; - } - - if (PRESSED_KEYSC(F12)) //F12 - { - screencapture("captxxxx.tga", keystatus[KEYSC_LSHIFT]|keystatus[KEYSC_RSHIFT]); - message("Saved screenshot %04d", capturecount-1); - } -} - - -//// port of a.m32's corruptchk //// -// returns value from 0 (all OK) to 5 (panic!) -#define CCHK_PANIC OSDTEXT_DARKRED "PANIC!!!^O " -//#define CCHKPREF OSDTEXT_RED "^O" -#define CCHK_CORRECTED OSDTEXT_GREEN " -> " - -#define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \ -{ \ - bad = max(bad, errlev); \ - if (numcorruptthings>=MAXCORRUPTTHINGS) \ - goto too_many_errors; \ - corruptthings[numcorruptthings++] = what; \ - if (errlev >= printfromlev) \ - OSD_Printf("#%d: " fmt "\n", numcorruptthings, ## __VA_ARGS__); \ -} while (0) - -static int32_t walls_are_consistent(int32_t nw, int32_t j) -{ - return (wall[j].x==POINT2(nw).x && wall[j].y==POINT2(nw).y - && POINT2(j).x==wall[nw].x && POINT2(j).y==wall[nw].y); -} - -static void suggest_nextsector_correction(int32_t nw, int32_t j) -{ - if (nw>=0 && nw=0 && nwMAXSECTORS) - CORRUPTCHK_PRINT(5, 0, CCHK_PANIC "SECTOR LIMIT EXCEEDED (MAXSECTORS=%d)!!!", MAXSECTORS); - - if (numwalls>MAXWALLS) - CORRUPTCHK_PRINT(5, 0, CCHK_PANIC "WALL LIMIT EXCEEDED (MAXWALLS=%d)!!!", MAXWALLS); - - if (numsectors>MAXSECTORS || numwalls>MAXWALLS) - { - corruptlevel = bad; - return bad; - } - - seen_nextwalls = Bcalloc((numwalls+7)>>3,1); - if (!seen_nextwalls) return 5; - lastnextwallsource = Bmalloc(numwalls*sizeof(lastnextwallsource[0])); - if (!lastnextwallsource) { Bfree(seen_nextwalls); return 5; } - - for (i=0; i numwalls) - CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d out of range (numwalls=%d)", i, w0, numw); - - if (w0 != ewall) - CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d].WALLPTR=%d inconsistent, expected %d", i, w0, ewall); - - if (numw <= 1) - CORRUPTCHK_PRINT(5, CORRUPT_SECTOR|i, CCHK_PANIC "SECTOR[%d].WALLNUM=%d INVALID!!!", i, numw); - else if (numw==2) - CORRUPTCHK_PRINT(3, CORRUPT_SECTOR|i, "SECTOR[%d].WALLNUM=2, expected at least 3", i); - - ewall += numw; - - endwall = w0 + numw; - if (endwall > numwalls) - CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls); - - errlevel = max(errlevel, bad); - - if (bad<4) - { - endwall--; - - for (j=w0; j<=endwall; j++) - { - bad = 0; - - if (wall[j].point2 < w0 || wall[j].point2 > endwall) - { - if (wall[j].point2 < 0 || wall[j].point2 >= MAXWALLS) - CORRUPTCHK_PRINT(5, CORRUPT_WALL|j, CCHK_PANIC "WALL[%d].POINT2=%d INVALID!!!", - j, wall[j].point2); - else - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].POINT2=%d out of range [%d, %d]", - j, wall[j].point2, w0, endwall); - } - - nw = wall[j].nextwall; - ns = wall[j].nextsector; - - if (nw >= numwalls) - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of range: numwalls=%d", - j, nw, numwalls); - - if (ns >= numsectors) - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d", - j, ns, numsectors); - - if (nw>=w0 && nw<=endwall) - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL is its own sector's wall", j); - - if (ns == i) - { - if (!bad) - { - int32_t onumct = numcorruptthings; - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR is its own sector", j); - if (onumct < MAXCORRUPTTHINGS) - { - if (tryfixing & (1ull<=printfromlev) - suggest_nextsector_correction(nw, j); - } - } - } - - if (nw>=0 && nw>3]&(1<<(nw&7))) - { - int16_t nwnw, lnws; - int32_t onumct = numcorruptthings; - - lnws = lastnextwallsource[nw]; - CORRUPTCHK_PRINT(3, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d already referenced from wall %d", - j, nw, lnws); - nwnw = wall[nw].nextwall; - if (onumct < MAXCORRUPTTHINGS && (nwnw==j || nwnw==lnws)) - { - int32_t walltoclear = nwnw==j ? lnws : j; - if (tryfixing & (1ull<= printfromlev) - OSD_Printf(" wall[%d].nextwall=%d, suggest clearing wall %d's nextwall and nextsector tags to -1\n", - nw, nwnw, walltoclear); - } - } - else - { - seen_nextwalls[nw>>3] |= 1<<(nw&7); - lastnextwallsource[nw] = j; - } - } - - if (bad<4) - { - int32_t onumct = numcorruptthings; - if ((ns^nw)<0) - { - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d and .NEXTWALL=%d inconsistent:" - " missing one next pointer", j, ns, nw); - if (onumct < MAXCORRUPTTHINGS) - { - if (tryfixing & (1ull<=printfromlev) - suggest_nextsector_correction(nw, j); - } - } - else if (ns>=0) - { - if (nw=sector[ns].wallptr+sector[ns].wallnum) - { - CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of .NEXTSECTOR=%d's bounds", - j, nw, ns); - if (onumct < MAXCORRUPTTHINGS) - { - if (tryfixing & (1ull<= printfromlev) - { - OSD_Printf(" sector %d's walls: [%d .. %d]\n", ns, - sector[ns].wallptr, sector[ns].wallptr+sector[ns].wallnum-1); - suggest_nextsector_correction(nw, j); - } - } - } -#if 0 - // this one usually appears together with the "already referenced" corruption - else if (wall[nw].nextsector != i || wall[nw].nextwall != j) - { - CORRUPTCHK_PRINT(4, CORRUPT_WALL|nw, "WALL %d nextwall's backreferences inconsistent. Expected nw=%d, ns=%d; got nw=%d, ns=%d", - nw, i, j, wall[nw].nextsector, wall[nw].nextwall); - } -#endif - } - } - - errlevel = max(errlevel, bad); - } - } - } - - bad = 0; - for (i=0; i=numsectors) - CORRUPTCHK_PRINT(2, CORRUPT_SPRITE|i, "SPRITE[%d].SECTNUM=%d. Expect problems!", i, sprite[i].sectnum); - - if (sprite[i].picnum<0 || sprite[i].picnum>=MAXTILES) - { - sprite[i].picnum = 0; - CORRUPTCHK_PRINT(0, CORRUPT_SPRITE|i, "SPRITE[%d].PICNUM=%d out of range, resetting to 0", i, sprite[i].picnum); - } - } - - if (0) - { -too_many_errors: - if (printfromlev<=errlevel) - OSD_Printf("!! too many errors, stopping. !!\n"); - } - - errlevel = max(errlevel, bad); - - if (errlevel) - { - if (printfromlev<=errlevel) - OSD_Printf("-- corruption level: %d\n", errlevel); - } - - if (seen_nextwalls) - { - Bfree(seen_nextwalls); - Bfree(lastnextwallsource); - } - - corruptlevel = errlevel; - - return errlevel; -} -//// - -void faketimerhandler(void) -{ - sampletimer(); -} - -void SetBOSS1Palette(void) -{ - if (acurpalette==3) return; - acurpalette=3; - setbrightness(GAMMA_CALC,5,0); -} - -void SetSLIMEPalette(void) -{ - if (acurpalette==2) return; - acurpalette=2; - setbrightness(GAMMA_CALC,2,0); -} - -void SetWATERPalette(void) -{ - if (acurpalette==1) return; - acurpalette=1; - setbrightness(GAMMA_CALC,1,0); -} - -void SetGAMEPalette(void) -{ - if (acurpalette==0) return; - acurpalette=0; - setbrightness(GAMMA_CALC,6,0); -} - -static void SearchSectors(int32_t dir) // <0: backwards, >=0: forwards -{ - int32_t ii=0; - dir = 1-2*(dir<0); - - if (cursector_lotag!=0) - { - if ((dir>0 && cursectornum=0)) - cursectornum += dir; - - for (ii=cursectornum; ii>=0 && ii"); - cursectornum = ii; - return; - } - } - } - printmessage16("%s Sector search: none found", dir<0?"<":">"); -} - - -//////////////////// manual editing //////////////////// -// Build edit originally by Ed Coolidge - -static char med_disptext[80]; -static char med_edittext[80]; -static const char *med_typename=""; -static int32_t med_dispwidth=24; -static int32_t med_editval=0; -static int32_t med_thenum=-1; - -static void handlemed(int32_t dohex, const char *disp_membername, const char *edit_membername, - void *themember, int32_t thesizeof, int32_t themax, int32_t sign) -{ - int32_t i, val; - - if (thesizeof==sizeof(int8_t)) - { - if (sign) - val = *(int8_t *)themember; - else - val = *(uint8_t *)themember; - } - else if (thesizeof==sizeof(int16_t)) - val = *(int16_t *)themember; - else //if (thesizeof==sizeof(int32_t)) - val = *(int32_t *)themember; - - if (dohex) - i=Bsprintf(med_disptext,"%s: %x", disp_membername, val); - else - i=Bsprintf(med_disptext,"%s: %d", disp_membername, val); - - for (; i to exit"); - - if (PRESSED_KEYSC(DOWN)) - { - if (*row < rowmax) - { - med_printcurline(xpos, ypos, *row, 0); - (*row)++; - } - } - - if (PRESSED_KEYSC(UP)) - { - if (*row > 0) - { - med_printcurline(xpos, ypos, *row, 0); - (*row)--; - } - } - - if (PRESSED_KEYSC(ENTER)) - med_editval = 1; -} - -static void EditSectorData(int16_t sectnum) -{ - int32_t col=1, row=0, rowmax = 6, i = -1; - int32_t xpos = 208, ypos = ydim-STATUS2DSIZ+48; - - med_editval = 0; - - med_dispwidth = 24; - med_disptext[med_dispwidth] = 0; - - med_typename = "Sector"; - med_thenum = sectnum; - - drawgradient(); - - showsectordata(sectnum, 0); - - while (keystatus[KEYSC_ESC] == 0) - { - med_handlecommon(xpos, ypos, &row, rowmax); - - if (PRESSED_KEYSC(LEFT)) - { - if (col == 2) - { - med_printcurline(xpos, ypos, row, 0); - col = 1; - xpos = 208; - rowmax = 6; - med_dispwidth = 24; - med_disptext[med_dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - } - if (PRESSED_KEYSC(RIGHT)) - { - if (col == 1) - { - med_printcurline(xpos, ypos, row, 0); - col = 2; - xpos = 408; - rowmax = 6; - med_dispwidth = 24; - med_disptext[med_dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - } - - if (col == 1) - { - switch (row) - { - case 0: - handlemed(1, "Flags (hex)", "Ceiling Flags", §or[sectnum].ceilingstat, - sizeof(sector[sectnum].ceilingstat), 65535, 0); - break; - case 1: - for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); i < med_dispwidth; i++) med_disptext[i] = ' '; - if (med_editval) - { - Bsprintf(med_edittext,"Sector %d Ceiling X Pan: ",sectnum); - printmessage16("%s", med_edittext); - sector[sectnum].ceilingxpanning = (char)getnumber16(med_edittext,(int32_t)sector[sectnum].ceilingxpanning,256L,0); - Bsprintf(med_edittext,"Sector %d Ceiling Y Pan: ",sectnum); - printmessage16("%s", med_edittext); - sector[sectnum].ceilingypanning = (char)getnumber16(med_edittext,(int32_t)sector[sectnum].ceilingypanning,256L,0); - } - break; - case 2: - handlemed(0, "Shade byte", "Ceiling Shade", §or[sectnum].ceilingshade,sizeof(sector[sectnum].ceilingshade), 128L, 1); - break; - case 3: - handlemed(0, "Z-coordinate", "Ceiling Z-coordinate", §or[sectnum].ceilingz, - sizeof(sector[sectnum].ceilingz), BZ_MAX, 1); - break; - case 4: - handlemed(0, "Tile number", "Ceiling Tile Number", §or[sectnum].ceilingpicnum, - sizeof(sector[sectnum].ceilingpicnum), MAXTILES, 0); - break; - case 5: - handlemed(0, "Ceiling heinum", "Ceiling Heinum", §or[sectnum].ceilingheinum, - sizeof(sector[sectnum].ceilingheinum), 32767, 1); - break; - case 6: - handlemed(0, "Palookup number", "Ceiling Palookup Number", §or[sectnum].ceilingpal, - sizeof(sector[sectnum].ceilingpal), MAXPALOOKUPS-1, 0); - break; - } - } - else if (col == 2) - { - switch (row) - { - case 0: - handlemed(1, "Flags (hex)", "Floor Flags", §or[sectnum].floorstat, - sizeof(sector[sectnum].floorstat), 65535, 0); - break; - - case 1: - for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning); i < med_dispwidth; i++) med_disptext[i] = ' '; - if (med_editval) - { - Bsprintf(med_edittext,"Sector %d Floor X Pan: ",sectnum); - printmessage16("%s", med_edittext); - sector[sectnum].floorxpanning = (char)getnumber16(med_edittext,(int32_t)sector[sectnum].floorxpanning,256,0); - Bsprintf(med_edittext,"Sector %d Floor Y Pan: ",sectnum); - printmessage16("%s", med_edittext); - sector[sectnum].floorypanning = (char)getnumber16(med_edittext,(int32_t)sector[sectnum].floorypanning,256,0); - } - break; - - case 2: - handlemed(0, "Shade byte", "Floor Shade", §or[sectnum].floorshade, - sizeof(sector[sectnum].floorshade), 128, 1); - break; - case 3: - handlemed(0, "Z-coordinate", "Floor Z-coordinate", §or[sectnum].floorz, - sizeof(sector[sectnum].floorz), BZ_MAX, 1); //2147483647L,-2147483648L - break; - case 4: - handlemed(0, "Tile number", "Floor Tile Number", §or[sectnum].floorpicnum, - sizeof(sector[sectnum].floorpicnum), MAXTILES, 0); - break; - case 5: - handlemed(0, "Floor heinum", "Floor Heinum", §or[sectnum].floorheinum, - sizeof(sector[sectnum].floorheinum), 32767, 1); - break; - case 6: - handlemed(0, "Palookup number", "Floor Palookup Number", §or[sectnum].floorpal, - sizeof(sector[sectnum].floorpal), MAXPALOOKUPS-1, 0); - break; - } - } - - med_printcurline(xpos, ypos, row, 1); - if (med_editval) - med_editval = 0; - - showframe(1); - } - - med_printcurline(xpos, ypos, row, 0); - // printmessage16(""); - - showframe(1); - keystatus[KEYSC_ESC] = 0; -} - -static void EditWallData(int16_t wallnum) -{ - int32_t row=0, i = -1; - int32_t xpos = 208, ypos = ydim-STATUS2DSIZ+48; - - med_editval = 0; - - med_dispwidth = 24; - med_disptext[med_dispwidth] = 0; - - med_typename = "Wall"; - med_thenum = wallnum; - - drawgradient(); - - showwalldata(wallnum, 0); - - while (keystatus[KEYSC_ESC] == 0) - { - med_handlecommon(xpos, ypos, &row, 6); - - switch (row) - { - case 0: - handlemed(1, "Flags (hex)", "Flags", &wall[wallnum].cstat, - sizeof(wall[wallnum].cstat), 65535, 0); - break; - case 1: - handlemed(0, "Shade", "Shade", &wall[wallnum].shade, - sizeof(wall[wallnum].shade), 128, 1); - break; - case 2: - handlemed(0, "Pal", "Pal", &wall[wallnum].pal, - sizeof(wall[wallnum].pal), MAXPALOOKUPS-1, 0); - break; - case 3: - for (i=Bsprintf(med_disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat); i < med_dispwidth; i++) med_disptext[i] = ' '; - if (med_editval) - { - Bsprintf(med_edittext,"Wall %d X Repeat: ",wallnum); - printmessage16("%s", med_edittext); - wall[wallnum].xrepeat = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].xrepeat,255,0); - Bsprintf(med_edittext,"Wall %d Y Repeat: ",wallnum); - printmessage16("%s", med_edittext); - wall[wallnum].yrepeat = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].yrepeat,255,0); - } - break; - case 4: - for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning); i < med_dispwidth; i++) med_disptext[i] = ' '; - if (med_editval) - { - Bsprintf(med_edittext,"Wall %d X Pan: ",wallnum); - printmessage16("%s", med_edittext); - wall[wallnum].xpanning = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].xpanning,255,0); - Bsprintf(med_edittext,"Wall %d Y Pan: ",wallnum); - printmessage16("%s", med_edittext); - wall[wallnum].ypanning = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].ypanning,255,0); - } - break; - case 5: - handlemed(0, "Tile number", "Tile number", &wall[wallnum].picnum, - sizeof(wall[wallnum].picnum), MAXTILES, 0); - break; - - case 6: - handlemed(0, "OverTile number", "OverTile number", &wall[wallnum].overpicnum, - sizeof(wall[wallnum].overpicnum), MAXTILES, 0); - break; - } - - med_printcurline(xpos, ypos, row, 1); - if (med_editval) - { - med_editval = 0; - //showwalldata(wallnum, 0); - //// printmessage16(""); - } - - showframe(1); - } - - med_printcurline(xpos, ypos, row, 0); - // printmessage16(""); - - showframe(1); - keystatus[KEYSC_ESC] = 0; -} - -static void EditSpriteData(int16_t spritenum) -{ - int32_t col=0, row=0, rowmax=4, i = -1; - int32_t xpos = 8, ypos = ydim-STATUS2DSIZ+48; - - med_editval = 0; - - med_dispwidth = 24; - med_disptext[med_dispwidth] = 0; - - med_typename = "Sprite"; - med_thenum = spritenum; - - drawgradient(); - - // clearmidstatbar16(); - - showspritedata(spritenum, 0); - - while (keystatus[KEYSC_ESC] == 0) - { - med_handlecommon(xpos, ypos, &row, rowmax); - - if (PRESSED_KEYSC(LEFT)) - { - switch (col) - { - case 1: - { - med_printcurline(xpos, ypos, row, 0); - col = 0; - xpos = 8; - rowmax = 4; - med_dispwidth = 23; - med_disptext[med_dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; - case 2: - { - med_printcurline(xpos, ypos, row, 0); - col = 1; - xpos = 208; - rowmax = 5; - med_dispwidth = 24; - med_disptext[med_dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; - } - } - if (PRESSED_KEYSC(RIGHT)) - { - switch (col) - { - case 0: - { - med_printcurline(xpos, ypos, row, 0); - col = 1; - xpos = 208; - rowmax = 5; - med_dispwidth = 24; - med_disptext[med_dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; - case 1: - { - med_printcurline(xpos, ypos, row, 0); - col = 2; - xpos = 408; - rowmax = 6; - med_dispwidth = 26; - med_disptext[med_dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; - } - } - - switch (col) - { - case 0: - { - switch (row) - { - case 0: - handlemed(0, "X-coordinate", "X-coordinate", &sprite[spritenum].x, - sizeof(sprite[spritenum].x), 131072, 1); - break; - case 1: - handlemed(0, "Y-coordinate", "Y-coordinate", &sprite[spritenum].y, - sizeof(sprite[spritenum].y), 131072, 1); - break; - case 2: - handlemed(0, "Z-coordinate", "Z-coordinate", &sprite[spritenum].z, - sizeof(sprite[spritenum].z), BZ_MAX, 1); //2147483647L,-2147483648L - break; - case 3: - i = sprite[spritenum].sectnum; - handlemed(0, "Sectnum", "Sectnum", &sprite[spritenum].sectnum, - sizeof(sprite[spritenum].sectnum), numsectors-1, 0); - if (i != sprite[spritenum].sectnum) - { - swapshort(&i, &sprite[spritenum].sectnum); - changespritesect(spritenum,i); - } - break; - case 4: - i = sprite[spritenum].statnum; - handlemed(0, "Statnum", "Statnum", &sprite[spritenum].statnum, - sizeof(sprite[spritenum].statnum), MAXSTATUS-1, 0); - if (i != sprite[spritenum].statnum) - { - swapshort(&i, &sprite[spritenum].statnum); - changespritestat(spritenum,i); - } - break; - } - } - break; - case 1: - { - switch (row) - { - case 0: - handlemed(1, "Flags (hex)", "Flags", &sprite[spritenum].cstat, - sizeof(sprite[spritenum].cstat), 65535, 0); - break; - case 1: - handlemed(0, "Shade", "Shade", &sprite[spritenum].shade, - sizeof(sprite[spritenum].shade), 128, 1); - break; - case 2: - handlemed(0, "Pal", "Pal", &sprite[spritenum].pal, - sizeof(sprite[spritenum].pal), MAXPALOOKUPS-1, 0); - break; - case 3: - { - for (i=Bsprintf(med_disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < med_dispwidth; i++) med_disptext[i] = ' '; - if (med_editval) - { - Bsprintf(med_edittext,"Sprite %d X Repeat: ",spritenum); - printmessage16("%s", med_edittext); - sprite[spritenum].xrepeat = (char)getnumber16(med_edittext,(int32_t)sprite[spritenum].xrepeat,255,0); - Bsprintf(med_edittext,"Sprite %d Y Repeat: ",spritenum); - printmessage16("%s", med_edittext); - sprite[spritenum].yrepeat = (char)getnumber16(med_edittext,(int32_t)sprite[spritenum].yrepeat,255,0); - } - } - break; - case 4: - { - for (i=Bsprintf(med_disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < med_dispwidth; i++) med_disptext[i] = ' '; - if (med_editval) - { - Bsprintf(med_edittext,"Sprite %d X Offset: ",spritenum); - printmessage16("%s", med_edittext); - sprite[spritenum].xoffset = (char)getnumber16(med_edittext,(int32_t)sprite[spritenum].xoffset,128,1); - Bsprintf(med_edittext,"Sprite %d Y Offset: ",spritenum); - printmessage16("%s", med_edittext); - sprite[spritenum].yoffset = (char)getnumber16(med_edittext,(int32_t)sprite[spritenum].yoffset,128,1); - } - } - break; - case 5: - handlemed(0, "Tile number", "Tile number", &sprite[spritenum].picnum, - sizeof(sprite[spritenum].picnum), MAXTILES-1, 0); - break; - } - } - break; - case 2: - { - switch (row) - { - case 0: - handlemed(0, "Angle (2048 degrees)", "Angle", &sprite[spritenum].ang, - sizeof(sprite[spritenum].ang), 2048, 1); - if (med_editval) - sprite[spritenum].ang &= 2047; - break; - case 1: - handlemed(0, "X-Velocity", "X-Velocity", &sprite[spritenum].xvel, - sizeof(sprite[spritenum].xvel), 65535, 1); - break; - case 2: - handlemed(0, "Y-Velocity", "Y-Velocity", &sprite[spritenum].yvel, - sizeof(sprite[spritenum].yvel), 65535, 1); - break; - case 3: - handlemed(0, "Z-Velocity", "Z-Velocity", &sprite[spritenum].zvel, - sizeof(sprite[spritenum].zvel), 65535, 1); - break; - case 4: - handlemed(0, "Owner", "Owner", &sprite[spritenum].owner, - sizeof(sprite[spritenum].owner), MAXSPRITES-1, 1); - break; - case 5: - handlemed(0, "Clipdist", "Clipdist", &sprite[spritenum].clipdist, - sizeof(sprite[spritenum].clipdist), 255, 0); - break; - case 6: - handlemed(0, "Extra", "Extra", &sprite[spritenum].extra, - sizeof(sprite[spritenum].extra), BTAG_MAX, 1); - break; - } - } - break; - } - - med_printcurline(xpos, ypos, row, 1); - if (med_editval) - med_editval = 0; - - showframe(1); - } - - med_printcurline(xpos, ypos, row, 0); - // printmessage16(""); - showframe(1); - - keystatus[KEYSC_ESC] = 0; -} - -#define TWENTYFIVE_BLANKS " " - -static void GenericSpriteSearch() -{ - char disptext[80]; - char edittext[80]; - static int32_t col=0, row=0; - int32_t i, j, k; - int32_t rowmax[3]= {6,5,6}, dispwidth[3] = {24,24,28}; - int32_t xpos[3] = {8,200,400}, ypos = ydim-STATUS2DSIZ+48; - - static const char *labels[7][3] = - { - {"X-coordinate", "Flags (hex)", "Angle (2048 degrees)"}, - {"Y-coordinate", "Shade", "X-Velocity"}, - {"Z-coordinate", "Pal", "Y-Velocity"}, - {"Sectnum", "(X/Y)repeat", "Z-Velocity"}, - {"Statnum", "(X/Y)offset", "Owner"}, - {"Hitag", "Tile number", "Clipdist"}, - {"Lotag", "", "Extra"} - }; - - static int32_t maxval[7][3] = - { - { BXY_MAX , 65535 , 2048 }, - { BXY_MAX , 128 , 65535 }, - { BZ_MAX , MAXPALOOKUPS-1, 65535 }, - { MAXSECTORS-1, 128 , 65535 }, - { MAXSTATUS-1 , 128 , MAXSPRITES-1 }, - { BTAG_MAX , MAXTILES-1 , 256 }, - { BTAG_MAX , 0 , BTAG_MAX } - }; - - static char sign[7][3] = - { - {1, 0, 1}, - {1, 1, 1}, - {1, 0, 1}, - {0, 0, 1}, - {0, 1, 0}, - {0, 0, 0}, - {0, 0, 1} - }; - - clearmidstatbar16(); - - drawgradient(); - - printext16(xpos[0], ypos-2*8, editorcolors[10], editorcolors[0], "Sprite search", 0); - - for (i=0; i<3; i++) - for (j=0; j<=rowmax[i]; j++) - { - if (gs_spriteTagInterested[i][j]) - k=Bsprintf(disptext, "%s: %d", labels[j][i], gs_spriteTagValue[i][j]); - else - k=Bsprintf(disptext, "%s: ^7any", labels[j][i]); -// for (; k to exit"); - - if (PRESSED_KEYSC(DOWN)) - { - if (row < rowmax[col]) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - row++; - } - } - if (PRESSED_KEYSC(UP)) - { - if (row > 0) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - row--; - } - } - if (PRESSED_KEYSC(LEFT)) - { - if (col > 0) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col--; - disptext[dispwidth[col]] = 0; - if (row > rowmax[col]) row = rowmax[col]; - } - } - if (PRESSED_KEYSC(RIGHT)) - { - if (col < 2) - { - printext16(xpos[col],ypos+row*8,editorcolors[11],editorcolors[0],disptext,0); - col++; - disptext[dispwidth[col]] = 0; - if (row > rowmax[col]) row = rowmax[col]; - } - } - if (PRESSED_KEYSC(ENTER)) - { - Bsprintf(edittext, "%s: ", labels[row][col]); - printmessage16("%s", edittext); - i = getnumber16(edittext, gs_spriteTagInterested[col][row] ? gs_spriteTagValue[col][row] : 0, - maxval[row][col], sign[row][col]); - if (col == 2 && row == 0) i = (i+2048)&2047; // angle - gs_spriteTagValue[col][row] = i; - gs_spriteTagInterested[col][row] = 1; - - if (col == 1 && row == 5) // picnum - { - printext16(xpos[1], ypos-2*8, editorcolors[14], editorcolors[0], TWENTYFIVE_BLANKS, 0); - if (names[i][0]) - printext16(xpos[1], ypos-2*8, editorcolors[14], editorcolors[0], names[i], 0); - } - } - if (PRESSED_KEYSC(BS) || PRESSED_KEYSC(DELETE)) - { - gs_spriteTagInterested[col][row] = 0; - - if (col == 1 && row == 5) // picnum - printext16(xpos[1], ypos-2*8, editorcolors[14], editorcolors[0], TWENTYFIVE_BLANKS, 0); - } - - i = gs_spriteTagInterested[col][row]; - if (i) - { - if (col == 1 && row == 0) // flags - k = Bsprintf(disptext, "%s: %x", labels[row][col], gs_spriteTagValue[col][row]); - else - k = Bsprintf(disptext, "%s: %d", labels[row][col], gs_spriteTagValue[col][row]); - } - else - k = Bsprintf(disptext, "%s: ^7any", labels[row][col]); - // v-------^^ - for (; k x2_max) x2_max = x2; - y += MENU_Y_SPACING; - } - while (++i < numopts); - // drawline16(x-1,y,x2_max+1,y,1); - // drawline16(x-1,MENU_BASE_Y-4,x-1,y,1); - - // x2 = - printext16(x,MENU_BASE_Y,editorcolors[11],-1,"Special functions",0); - // drawline16(x-1,MENU_BASE_Y-4,x2+1,MENU_BASE_Y-4,1); - // drawline16(x2_max+1,MENU_BASE_Y+16-4,x2_max+1,y-1,1); - //drawline16(x2+1,MENU_BASE_Y+16-1,x2_max+1,MENU_BASE_Y+16-1,1); -} - -static void FuncMenu(void) -{ - char disptext[80]; - int32_t col=0, row=0, rowmax=7, dispwidth = 24, editval = 0, i = -1, j; - int32_t xpos = 8, ypos = MENU_BASE_Y+16; - - drawgradient(); - - disptext[dispwidth] = 0; - // clearmidstatbar16(); - - FuncMenuOpts(); - - while (!editval && keystatus[KEYSC_ESC] == 0) - { - idle_waitevent(); - if (handleevents()) - quitevent = 0; - - _printmessage16("Select an option, press to exit"); - if (PRESSED_KEYSC(DOWN)) - { - if (row < rowmax) - { - printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[0],disptext,0); - row++; - } - } - if (PRESSED_KEYSC(UP)) - { - if (row > 0) - { - printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[0],disptext,0); - row--; - } - } -#if 0 - if (PRESSED_KEYSC(LEFT)) - { - /* if (col == 2) - { - printext16(xpos,ypos+row*8,editorcolors[11],0,disptext,0); - col = 1; - xpos = 200; - rowmax = 6; - dispwidth = 24; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - else */ - if (col == 1) - { - printext16(xpos,ypos+row*8,editorcolors[11],0,disptext,0); - col = 0; - xpos = 8; - rowmax = 7; - dispwidth = 24; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - } - - if (PRESSED_KEYSC(RIGHT)) - { - if (col == 0) - { - printext16(xpos,ypos+row*8,editorcolors[11],0,disptext,0); - col = 1; - xpos = 200; - rowmax = 0; - dispwidth = 24; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - /* else if (col == 1) - { - printext16(xpos,ypos+row*8,editorcolors[11],0,disptext,0); - col = 2; - xpos = 400; - rowmax = 6; - dispwidth = 26; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } */ - } -#endif - if (PRESSED_KEYSC(ENTER)) - editval = 1; - - switch (col) - { - case 0: - switch (row) - { - case 0: - { - for (i=Bsprintf(disptext,"%s",FuncMenuStrings[row]); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - j = 0; - for (i=0; i= 0) - { - int32_t k = 0; - for (j=0; j= 0) - { - sprite[w].x = (int32_t)(sprite[w].x*size); - sprite[w].y = (int32_t)(sprite[w].y*size); - sprite[w].z = (int32_t)(sprite[w].z*size); - sprite[w].xrepeat = min(max((int32_t)(sprite[w].xrepeat*size),1),255); - sprite[w].yrepeat = min(max((int32_t)(sprite[w].yrepeat*size),1),255); - w = nextspritesect[w]; - } - } - printmessage16("Map scaled"); - } - else printmessage16("Aborted"); - } - } - break; - case 6: - { - for (i=Bsprintf(disptext,"%s",FuncMenuStrings[row]); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - j=getnumber16("Shade divisor: ",1,128,1); - if (j!=1) - { - for (i=0; i>4)/j; - } - printmessage16("Visibility adjusted"); - } - else printmessage16("Aborted"); - } - } - break; - } - break; - } - printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[1],disptext,0); - - showframe(1); - } - - printext16(xpos,ypos+row*MENU_Y_SPACING,editorcolors[11],editorcolors[0],disptext,0); - /*clearmidstatbar16();*/ - - showframe(1); - keystatus[KEYSC_ESC] = 0; -} diff --git a/polymer-perf/eduke32/source/config.c b/polymer-perf/eduke32/source/config.c deleted file mode 100644 index 7f3127b31..000000000 --- a/polymer-perf/eduke32/source/config.c +++ /dev/null @@ -1,1065 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -/* -#include -#include -#include -#include -#include -*/ - -#include "baselayer.h" -#include "duke3d.h" -#include "scriplib.h" -#include "osd.h" -#include "osdcmds.h" -#include "osdfuncs.h" - -// we load this in to get default button and key assignments -// as well as setting up function mappings - -#define __SETUP__ // JBF 20031211 -#include "_functio.h" - -/* -=================== -= -= CONFIG_FunctionNameToNum -= -=================== -*/ - -hashtable_t h_gamefuncs = { NUMGAMEFUNCTIONS<<1, NULL }; - -int32_t CONFIG_FunctionNameToNum(char *func) -{ - int32_t i; - - i = hash_find(&h_gamefuncs,func); - - if (i < 0) - { - char *str = Bstrtolower(Bstrdup(func)); - i = hash_find(&h_gamefuncs,str); - Bfree(str); - - return i; - } - - return i; -} - -/* -=================== -= -= CONFIG_FunctionNumToName -= -=================== -*/ - -char *CONFIG_FunctionNumToName(int32_t func) -{ - if ((unsigned)func >= (unsigned)NUMGAMEFUNCTIONS) - return NULL; - return gamefunctions[func]; -} - -/* -=================== -= -= CONFIG_AnalogNameToNum -= -=================== -*/ - - -int32_t CONFIG_AnalogNameToNum(char *func) -{ - - if (!Bstrcasecmp(func,"analog_turning")) - { - return analog_turning; - } - if (!Bstrcasecmp(func,"analog_strafing")) - { - return analog_strafing; - } - if (!Bstrcasecmp(func,"analog_moving")) - { - return analog_moving; - } - if (!Bstrcasecmp(func,"analog_lookingupanddown")) - { - return analog_lookingupanddown; - } - - return -1; -} - - -char *CONFIG_AnalogNumToName(int32_t func) -{ - switch (func) - { - case analog_turning: - return "analog_turning"; - case analog_strafing: - return "analog_strafing"; - case analog_moving: - return "analog_moving"; - case analog_lookingupanddown: - return "analog_lookingupanddown"; - } - - return NULL; -} - - -/* -=================== -= -= CONFIG_SetDefaults -= -=================== -*/ - -void CONFIG_SetDefaultKeys(int32_t type) -{ - int32_t i,f; - - Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys)); - Bmemset(&KeyBindings,0,sizeof(KeyBindings)); - Bmemset(&MouseBindings,0,sizeof(MouseBindings)); - - if (type == 1) - { - for (i=0; i < (int32_t)(sizeof(oldkeydefaults)/sizeof(oldkeydefaults[0])); i+=3) - { - f = CONFIG_FunctionNameToNum((char *)oldkeydefaults[i+0]); - if (f == -1) continue; - ud.config.KeyboardKeys[f][0] = KB_StringToScanCode((char *)oldkeydefaults[i+1]); - ud.config.KeyboardKeys[f][1] = KB_StringToScanCode((char *)oldkeydefaults[i+2]); - - if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]); - else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0); - } - return; - } - - for (i=0; i < (int32_t)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3) - { - f = CONFIG_FunctionNameToNum(keydefaults[i+0]); - if (f == -1) continue; - ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]); - ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]); - - if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]); - else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0); - } -} - -void CONFIG_SetDefaults(void) -{ - // JBF 20031211 - int32_t i; - - ud.config.scripthandle = -1; - ud.config.ScreenWidth = 1024; - ud.config.ScreenHeight = 768; - ud.config.ScreenMode = 0; -#ifdef USE_OPENGL - ud.config.ScreenBPP = 32; -#else - ud.config.ScreenBPP = 8; -#endif - ud.config.useprecache = 1; - ud.config.ForceSetup = 1; - ud.config.NoAutoLoad = 1; - ud.config.AmbienceToggle = 1; - ud.config.AutoAim = 1; - ud.config.FXDevice = 0; - ud.config.FXVolume = 225; -#if defined(_WIN32) - ud.config.MixRate = 44100; -#else - ud.config.MixRate = 48000; -#endif - ud.config.MouseBias = 0; - ud.config.MouseDeadZone = 0; - ud.config.MusicDevice = 0; - ud.config.MusicToggle = 1; - ud.config.MusicVolume = 195; - g_myAimMode = g_player[0].ps->aim_mode = 1; - ud.config.NumBits = 16; - ud.config.NumChannels = 2; - ud.config.NumVoices = 32; - ud.config.ReverseStereo = 0; - ud.auto_run = 1; - ud.config.ShowOpponentWeapons = 0; - ud.config.SmoothInput = 1; - ud.config.SoundToggle = 1; - ud.althud = 1; - ud.automsg = 0; - ud.autovote = 0; - ud.brightness = 8; - ud.camerasprite = -1; - ud.color = 0; - ud.crosshair = 1; - ud.crosshairscale = 50; - ud.obituaries = 1; - ud.democams = 1; - ud.detail = 1; - ud.drawweapon = 1; - ud.idplayers = 1; - ud.levelstats = 0; - ud.lockout = 0; - ud.m_ffire = 1; - ud.m_marker = 1; - ud.mouseaiming = 0; - ud.mouseflip = 1; - ud.msgdisptime = 120; - ud.pwlockout[0] = '\0'; - ud.runkey_mode = 0; - ud.screen_size = 4; - ud.screen_tilting = 1; - ud.shadows = 1; - ud.statusbarmode = 0; - ud.statusbarscale = 100; - ud.team = 0; - ud.viewbob = 1; - ud.weaponsway = 1; - ud.weaponswitch = 3; // new+empty - ud.angleinterpolation = 0; - ud.config.UseJoystick = 0; - ud.config.UseMouse = 1; - ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM - ud.display_bonus_screen = 1; - ud.show_level_text = 1; - ud.configversion = 0; - ud.weaponscale = 100; - ud.textscale = 100; - - ud.config.CheckForUpdates = 1; - - Bstrcpy(ud.rtsname, "DUKE.RTS"); - Bstrcpy(szPlayerName, "Duke"); - - Bstrcpy(ud.ridecule[0], "An inspiration for birth control."); - Bstrcpy(ud.ridecule[1], "You're gonna die for that!"); - Bstrcpy(ud.ridecule[2], "It hurts to be you."); - Bstrcpy(ud.ridecule[3], "Lucky Son of a Bitch."); - Bstrcpy(ud.ridecule[4], "Hmmm....Payback time."); - Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker."); - Bstrcpy(ud.ridecule[6], "Damn, you're ugly."); - Bstrcpy(ud.ridecule[7], "Ha ha ha...Wasted!"); - Bstrcpy(ud.ridecule[8], "You suck!"); - Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!"); - - // JBF 20031211 - - CONFIG_SetDefaultKeys(0); - - memset(ud.config.MouseFunctions, -1, sizeof(ud.config.MouseFunctions)); - for (i=0; i=4) continue; - ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]); - CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse); - } - - memset(ud.config.MouseDigitalFunctions, -1, sizeof(ud.config.MouseDigitalFunctions)); - for (i=0; i=0; i--) - { - if (ud.config.KeyboardKeys[i][0] == ii[k] || ud.config.KeyboardKeys[i][1] == ii[k]) - { - Bsprintf(buf,"gamefunc_%s; ",CONFIG_FunctionNumToName(i)); - Bstrcat(tempbuf,buf); - } - } - Bstrncpy(KeyBindings[ii[k]].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); - - i = Bstrlen(KeyBindings[ii[k]].cmd); - if (i) - KeyBindings[ii[k]].cmd[i-2] = 0; // cut off the trailing "; " - } -} - -/* -=================== -= -= CONFIG_SetupMouse -= -=================== -*/ - -void CONFIG_SetupMouse(void) -{ - int32_t i; - char str[80]; - char temp[80]; - int32_t scale; - - if (ud.config.scripthandle < 0) return; - - for (i=0; i= 0) - { - char dummybuf[64]; - - for (dummy = 0; dummy < 10; dummy++) - { - commmacro[13] = dummy+'0'; - SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]); - } - - SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); - - while (Bstrlen(OSD_StripColors(dummybuf,tempbuf)) > 10) - tempbuf[Bstrlen(tempbuf)-1] = '\0'; - - Bstrncpy(szPlayerName,tempbuf,sizeof(szPlayerName)-1); - szPlayerName[sizeof(szPlayerName)-1] = '\0'; - - SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]); - - SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ConfigVersion",&ud.configversion); - SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ForceSetup",&ud.config.ForceSetup); - SCRIPT_GetNumber(ud.config.scripthandle, "Setup","NoAutoLoad",&ud.config.NoAutoLoad); - -// #ifdef _WIN32 - if (g_noSetup == 0 && g_modDir[0] == '/') - { - struct stat st; - SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]); - - if (Bstat(g_modDir, &st)) - { - if ((st.st_mode & S_IFDIR) != S_IFDIR) - { - initprintf("Invalid mod dir in cfg!\n"); - Bsprintf(g_modDir,"/"); - } - } - } -// #endif - - { - extern char defaultduke3dgrp[BMAX_PATH]; - if (!Bstrcmp(defaultduke3dgrp,"duke3d.grp")) - SCRIPT_GetString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]); - } - - if (!NAM) - { - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout); - SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]); - } - - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",&ud.config.ScreenHeight); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth); - -#ifdef RENDERTYPEWIN - { - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos); - windowx = -1; - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx); - windowy = -1; - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy); - } -#endif - - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); - if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; - -#ifdef POLYMER - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy); - if (dummy > 0 && ud.config.ScreenBPP >= 16) glrendmode = 4; - else glrendmode = 3; -#endif - - /* - - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color); - G_CheckPlayerColor((int32_t *)&ud.color,-1); - g_player[0].ps->palookup = g_player[0].pcolor = ud.color; - tempbuf[0] = 0; - SCRIPT_GetString(ud.config.scripthandle, "Misc", "CrosshairColor",&tempbuf[0]); - if (tempbuf[0]) - { - char *ptr = strtok(tempbuf,","); - palette_t temppal; - char *palptr = (char *)&temppal; - - i = 0; - while (ptr != NULL && i < 3) - { - palptr[i++] = atoi(ptr); - ptr = strtok(NULL,","); - } - if (i == 3) - { - Bmemcpy(&CrosshairColors,&temppal,sizeof(palette_t)); - DefaultCrosshairColors.f = 1; - } - } - */ - - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions); - - // weapon choices are defaulted in G_CheckCommandLine, which may override them - if (!g_forceWeaponChoice) - for (i=0; i<10; i++) - { - Bsprintf(buf,"WeaponChoice%d",i); - dummy = -1; - SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy); - if (dummy >= 0) g_player[0].wchoice[i] = dummy; - } - -#ifdef _WIN32 - SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates); - SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck); -#endif - - } - -// CONFIG_ReadKeys(); - - //CONFIG_SetupMouse(ud.config.scripthandle); - //CONFIG_SetupJoystick(ud.config.scripthandle); - ud.config.setupread = 1; - return 0; -} - -/* -=================== -= -= CONFIG_WriteSetup -= -=================== -*/ - -void CONFIG_WriteBinds(void) // save binds and aliases to _settings.cfg -{ - int32_t i; - FILE *fp; - char *ptr = Bstrdup(setupfilename); - char tempbuf[128]; - - if (!Bstrcmp(setupfilename, SETUPFILENAME)) - Bsprintf(tempbuf, "settings.cfg"); - else Bsprintf(tempbuf, "%s_settings.cfg", strtok(ptr, ".")); - - fp = fopen(tempbuf, "wt"); - - if (fp) - { - symbol_t *symb; - - fprintf(fp,"// this file automatically generated by EDuke32\n"); - fprintf(fp,"// these settings take precedence over your main cfg file\n"); - fprintf(fp,"// do not modify if you lack common sense\n"); - - fprintf(fp,"unbindall\n"); - - for (i=0; inext) - if (symb->func == (void *)OSD_ALIAS) - fprintf(fp,"alias \"%s\" \"%s\"\n", symb->name, symb->help); - - /* for (i = 0; i < sizeof(cvar)/sizeof(cvarmappings); i++) - if (!(cvar[i].type&CVAR_NOSAVE)) - fprintf(fp,"%s \"%d\"\n",cvar[i].name,*(int32_t*)cvar[i].var); - */ - OSD_WriteCvars(fp); - fclose(fp); - if (!Bstrcmp(setupfilename, SETUPFILENAME)) - OSD_Printf("Wrote settings.cfg\n"); - else OSD_Printf("Wrote %s_settings.cfg\n",ptr); - - Bfree(ptr); - return; - } - - if (!Bstrcmp(setupfilename, SETUPFILENAME)) - OSD_Printf("Error writing settings.cfg: %s\n", strerror(errno)); - else OSD_Printf("Error writing %s_settings.cfg: %s\n",ptr,strerror(errno)); - - Bfree(ptr); -} - -void CONFIG_WriteSetup(uint32_t flags) -{ - int32_t dummy; - char tempbuf[1024]; - - if (!ud.config.setupread) return; - - if (ud.config.scripthandle < 0) - ud.config.scripthandle = SCRIPT_Init(setupfilename); - - SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,FALSE,FALSE); - - SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,FALSE,FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE); - -#ifdef POLYMER - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4 && bpp > 8,FALSE,FALSE); -#endif - - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523 - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",ud.config.ScreenHeight,FALSE,FALSE); // JBF 20031206 - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",ud.config.ScreenMode,FALSE,FALSE); // JBF 20031206 - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206 - - - SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]); - - if (g_noSetup == 0) - SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]); - - // exit early after only updating the values that can be changed from the startup window - if (flags & 1) - { - SCRIPT_Save(ud.config.scripthandle, setupfilename); - SCRIPT_Free(ud.config.scripthandle); - OSD_Printf("Updated %s\n",setupfilename); - - return; - } - -#ifdef RENDERTYPEWIN - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE); -#endif - - for (dummy=0; dummy<10; dummy++) - { - Bsprintf(buf,"WeaponChoice%d",dummy); - SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE); - } - - if (!NAM) - { - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE); - SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout); - } - -#ifdef _WIN32 - SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE); - SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE); -#endif - - for (dummy=0; dummy= (MAXMOUSEBUTTONS-2)) continue; - - if (CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])) - { - Bsprintf(buf,"MouseButtonClicked%d",dummy); - SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])); - } - } - - for (dummy=0; dummygm |= MODE_MENU; - else g_player[myconnectindex].ps->gm &= ~MODE_MENU; - g_player[myconnectindex].ps->gm &= ~MODE_GAME; - g_player[myconnectindex].ps->gm |= MODE_DEMO; -} - -void demo_preparewarp(void) -{ - if (!g_demo_paused) - { - g_demo_soundToggle = ud.config.SoundToggle; - ud.config.SoundToggle = 0; - } - FX_StopAllSounds(); - S_ClearSoundLocks(); -} - -extern int32_t sv_loadsnapshot(int32_t fil, int32_t *ret_hasdiffs, int32_t *ret_demoticcnt, int32_t *ret_synccompress); - -int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine -{ - char d[14]; - int32_t i; - - Bstrcpy(d, "edemo_.edm"); - - if (g_whichDemo == 10) - d[5] = 'x'; - else - d[5] = '0' + g_whichDemo; - - if (g_whichDemo == 1 && firstdemofile[0] != 0) - { - if ((g_demo_recFilePtr = kopen4loadfrommod(firstdemofile,g_loadFromGroupOnly)) == -1) return(0); - } - else if ((g_demo_recFilePtr = kopen4loadfrommod(d,g_loadFromGroupOnly)) == -1) return(0); - - i=sv_loadsnapshot(g_demo_recFilePtr, &demo_hasdiffs, &g_demo_totalCnt, &demo_synccompress); - if (i==0) - { - demo_hasseeds = demo_synccompress&2; - demo_synccompress &= 1; - - i = g_demo_totalCnt/(TICRATE/TICSPERFRAME); - OSD_Printf("demo duration: %d min %d sec\n", i/60, i%60); - - g_demo_cnt=1; - ud.reccnt = 0; - - ud.god = ud.cashman = ud.eog = ud.showallmap = 0; - ud.clipping = ud.scrollmode = ud.overhead_on = 0; //= ud.pause_on = 0; - - // G_NewGame(ud.volume_number,ud.level_number,ud.player_skill); - // G_ResetTimers(); - totalclock = ototalclock = lockclock = 0; - - return 1; - } - else - { - OSD_Printf(OSD_ERROR "There were errors opening demo %d (code: %d).\n", g_whichDemo, i); - kclose(g_demo_recFilePtr); - return 0; - } -#if 0 -corrupt: - OSD_Printf(OSD_ERROR "Demo %d header is corrupt.\n",g_whichDemo); - ud.reccnt = 0; - kclose(g_demo_recFilePtr); - return 0; -#endif -} - -#if KRANDDEBUG -extern void krd_enable(int32_t which); -extern int32_t krd_print(const char *filename); -#endif - -void G_OpenDemoWrite(void) -{ - char d[14]; - int32_t i, demonum=1; - extern int32_t sv_saveandmakesnapshot(FILE* fil, int32_t recdiffs, int32_t diffcompress, int32_t synccompress); - - if (ud.recstat == 2) kclose(g_demo_recFilePtr); - - if ((g_player[myconnectindex].ps->gm&MODE_GAME) && g_player[myconnectindex].ps->dead_flag) - { - Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "CANNOT START DEMO RECORDING WHEN DEAD!"); - P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps); - ud.recstat = ud.m_recstat = 0; - return; - } - - if (demorec_diffs_cvar && !demorec_force_cvar) - for (i=1; i>12) && script[i+1]>=0 && script[i+1]>24); - - TRAVERSE_CONNECT(i) - { - Bmemcpy(&recsync[ud.reccnt], g_player[i].sync, sizeof(input_t)); - ud.reccnt++; - } - - if (ud.reccnt > RECSYNCBUFSIZ-MAXPLAYERS || (demorec_diffs && (g_demo_cnt%demorec_difftics == 0))) - dowritesync(); -} - -void G_CloseDemoWrite(void) -{ - extern void sv_freemem(); - - if (ud.recstat == 1) - { - if (ud.reccnt > 0) - dowritesync(); - - fwrite("EnD!", 4, 1, g_demo_filePtr); - - if (fseek(g_demo_filePtr, 20, SEEK_SET)) - perror("G_CloseDemoWrite: fseek"); - else - fwrite(&g_demo_cnt, sizeof(g_demo_cnt), 1, g_demo_filePtr); - - ud.recstat = ud.m_recstat = 0; - fclose(g_demo_filePtr); - - sv_freemem(); - - Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "DEMO RECORDING STOPPED"); - P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps); - } -#if KRANDDEBUG - krd_print("krandrec.log"); -#endif -} - -static int32_t g_whichDemo = 1; -extern int32_t sv_updatestate(int32_t frominit); - -static int32_t doupdatestate(int32_t frominit) -{ - int32_t j,k; - j = g_player[myconnectindex].ps->gm&MODE_MENU; - k = sv_updatestate(frominit); - // tmpdifftime = g_demo_cnt+12; - dorestoremodes(j); - if (k) OSD_Printf("sv_updatestate() returned %d.\n", k); - return k; -} - -#define CORRUPT(code) do { corruptcode=code; goto corrupt; } while(0) - -#define DOREADSYNC(code) do \ -{ \ - uint16_t si; \ - int32_t i; \ - if (kread(g_demo_recFilePtr, &si, sizeof(uint16_t)) != (int32_t)sizeof(uint16_t)) CORRUPT(code); \ - i = si; \ - if (demo_hasseeds) \ -{ \ - if (kread(g_demo_recFilePtr, g_demo_seedbuf, i) != i) CORRUPT(code); \ -} \ - if (demo_synccompress) \ -{ \ - if (kdfread(recsync, sizeof(input_t), i, g_demo_recFilePtr) != i) CORRUPT(code+1); \ -} \ - else \ - if (kread(g_demo_recFilePtr, recsync, sizeof(input_t)*i) != (int32_t)sizeof(input_t)*i) CORRUPT(code+2); \ - ud.reccnt = i; \ -} while (0) - - -int32_t G_PlaybackDemo(void) -{ - int32_t bigi, j, k, initsyncofs = 0, lastsyncofs = 0, lastsynctic = 0, lastsyncclock = 0; - int32_t foundemo = 0, corruptcode, outofsync=0; - static int32_t in_menu = 0; - // static int32_t tmpdifftime=0; - - if (ready2send) return 0; - -RECHECK: - -#if KRANDDEBUG - if (foundemo) - krd_print("krandplay.log"); -#endif - - in_menu = g_player[myconnectindex].ps->gm&MODE_MENU; - - pub = NUMPAGES; - pus = NUMPAGES; - - flushperms(); - if ((!g_netServer && ud.multimode < 2)) foundemo = G_OpenDemoRead(g_whichDemo); - if (foundemo == 0) - { - if (g_whichDemo > 1) - { - g_whichDemo = 1; - goto RECHECK; - } - fadepal(0,0,0, 0,63,7); - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 - G_DrawBackground(); - M_DisplayMenus(); - //g_player[myconnectindex].ps->palette = palette; - nextpage(); - fadepal(0,0,0, 63,0,-7); - ud.reccnt = 0; - } - else - { - ud.recstat = 2; - g_whichDemo++; - if (g_whichDemo == 10) g_whichDemo = 1; - - g_player[myconnectindex].ps->gm &= ~MODE_GAME; - g_player[myconnectindex].ps->gm |= MODE_DEMO; - - // if (G_EnterLevel(MODE_DEMO)) - // { - // OSD_Printf("G_PlaybackDemo: G_EnterLevel\n"); - // ud.recstat = foundemo = 0; - // } - // - lastsyncofs = ktell(g_demo_recFilePtr); - initsyncofs = lastsyncofs; - lastsynctic = g_demo_cnt; - lastsyncclock = totalclock; - outofsync = 0; -#if KRANDDEBUG - krd_enable(2); -#endif - } - - if (foundemo == 0 || in_menu || KB_KeyWaiting() || numplayers > 1) - { - FX_StopAllSounds(); - S_ClearSoundLocks(); - g_player[myconnectindex].ps->gm |= MODE_MENU; - } - - ready2send = 0; - bigi = 0; - - KB_FlushKeyboardQueue(); - - // OSD_Printf("ticcnt=%d, total=%d\n", g_demo_cnt, g_demo_totalCnt); - while (g_demo_cnt < g_demo_totalCnt || foundemo==0) - { - if (foundemo && (!g_demo_paused || g_demo_goalCnt)) - { - if (g_demo_goalCnt>0 && g_demo_goalCnt < g_demo_cnt) // rewind - { - k = g_player[myconnectindex].ps->gm&MODE_MENU; - if (g_demo_goalCnt > lastsynctic) - { - if (doupdatestate(0)==0) - { - g_demo_cnt = lastsynctic; - klseek(g_demo_recFilePtr, lastsyncofs, SEEK_SET); - ud.reccnt = 0; - - totalclock = ototalclock = lockclock = lastsyncclock; - } - else CORRUPT(-1); - } - else - { - //loadfrombeg: - // j = sv_loadsnapshot(g_demo_recFilePtr, &g_demo_totalCnt); - j = doupdatestate(1); - if (!j) - { - klseek(g_demo_recFilePtr, initsyncofs, SEEK_SET); - g_levelTextTime = 0; - - g_demo_cnt = 1; - ud.reccnt = 0; - - // ud.god = ud.cashman = ud.eog = ud.showallmap = 0; - // ud.clipping = ud.scrollmode = ud.overhead_on = ud.pause_on = 0; - - totalclock = ototalclock = lockclock = 0; - } - else CORRUPT(0); - } - dorestoremodes(k); - } - - while (totalclock >= (lockclock+TICSPERFRAME) - // || (ud.reccnt > (TICRATE/TICSPERFRAME)*2 && ud.pause_on) - || (g_demo_goalCnt>0 && g_demo_cnt0 && ud.reccnt/ud.multimode >= g_demo_goalCnt-g_demo_cnt)) - { - doupdatestate(0); - } - } - } - else if (Bmemcmp(tmpbuf, "EnD!", 4)==0) - goto nextdemo; - else CORRUPT(12); - - if (0) - { -corrupt: - OSD_Printf(OSD_ERROR "Demo %d is corrupt (code %d).\n", g_whichDemo-1, corruptcode); -nextdemo: - foundemo = 0; - ud.reccnt = 0; - kclose(g_demo_recFilePtr); - g_player[myconnectindex].ps->gm |= MODE_MENU; - if (g_demo_goalCnt>0) - { - g_demo_goalCnt=0; - ud.config.SoundToggle = g_demo_soundToggle; - } - goto RECHECK; - } - } - - if (demo_hasseeds) - outofsync = (uint8_t)(randomseed>>24) != g_demo_seedbuf[bigi]; - - TRAVERSE_CONNECT(j) - { - copybufbyte(&recsync[bigi], &inputfifo[0][j], sizeof(input_t)); - bigi++; - ud.reccnt--; - } - g_demo_cnt++; - - if (!g_demo_paused) - { - // assumption that ud.multimode doesn't change in a demo may not be true - // sometime in the future v v v v v v v v v - if (g_demo_goalCnt==0 || !demo_hasdiffs || ud.reccnt/ud.multimode>=g_demo_goalCnt-g_demo_cnt) - G_DoMoveThings(); // increases lockclock by TICSPERFRAME - else - lockclock += TICSPERFRAME; - } - else - { - k = ud.config.SoundToggle; - ud.config.SoundToggle = 0; - G_DoMoveThings(); - ud.config.SoundToggle = k; - } - - ototalclock += TICSPERFRAME; - - if (g_demo_goalCnt > 0) - { - totalclock += TICSPERFRAME; - - // OSD_Printf("t:%d, l+T:%d; cnt:%d, goal:%d%s", totalclock, (lockclock+TICSPERFRAME), - // g_demo_cnt, g_demo_goalCnt, g_demo_cnt>=g_demo_goalCnt?" ":"\n"); - if (g_demo_cnt>=g_demo_goalCnt) - { - g_demo_goalCnt = 0; - ud.config.SoundToggle = g_demo_soundToggle; - } - } - } - } - else if (foundemo && g_demo_paused) - { - totalclock = lockclock; - } - - if (foundemo == 0) - G_DrawBackground(); - else - { - G_HandleLocalKeys(); - - // j = min(max((totalclock-lockclock)*(65536/TICSPERFRAME),0),65536); - - j = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); - if (g_demo_paused && g_demo_rewind) - j = 65536-j; - - G_DrawRooms(screenpeek,j); - G_DisplayRest(j); - - if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0) - { - if (demoplay_showsync && outofsync) - gametext(160,100,"OUT OF SYNC",0,2+8+16); - - if (g_demo_showStats) - { - // if (g_demo_cnt 1) && g_player[myconnectindex].ps->gm) - Net_GetPackets(); - - if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex) - gametext(160,60,"PRESS F1 TO ACCEPT, F2 TO DECLINE",0,2+8+16); - } - - if ((g_player[myconnectindex].ps->gm&MODE_MENU) && (g_player[myconnectindex].ps->gm&MODE_EOL)) - goto RECHECK; - - if (KB_KeyPressed(sc_Escape) && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && (g_player[myconnectindex].ps->gm&MODE_TYPE) == 0) - { - KB_ClearKeyDown(sc_Escape); - FX_StopAllSounds(); - S_ClearSoundLocks(); - g_player[myconnectindex].ps->gm |= MODE_MENU; - ChangeToMenu(0); - S_MenuSound(); - } - - if (g_player[myconnectindex].ps->gm&MODE_TYPE) - { - Net_EnterMessage(); - if ((g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE) - g_player[myconnectindex].ps->gm = MODE_MENU; - } - else - { - if (ud.recstat != 2) - M_DisplayMenus(); - if ((g_netServer || ud.multimode > 1) && g_currentMenu != 20003 && g_currentMenu != 20005 && g_currentMenu != 210) - { - ControlInfo noshareinfo; - CONTROL_GetInput(&noshareinfo); - if (BUTTON(gamefunc_SendMessage)) - { - KB_FlushKeyboardQueue(); - CONTROL_ClearButton(gamefunc_SendMessage); - g_player[myconnectindex].ps->gm = MODE_TYPE; - typebuf[0] = 0; - inputloc = 0; - } - } - } - - G_PrintGameQuotes(); - - if (ud.last_camsprite != ud.camerasprite) - { - ud.last_camsprite = ud.camerasprite; - ud.camera_time = totalclock+(TICRATE*2); - } - - if (VOLUMEONE) - { - if (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) - rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1); - } - handleevents(); - Net_GetPackets(); - nextpage(); - - if (g_player[myconnectindex].ps->gm == MODE_GAME) - { - if (foundemo) - { -#if KRANDDEBUG - krd_print("krandplay.log"); -#endif - kclose(g_demo_recFilePtr); - } - return 0; - } - } - ud.multimode = numplayers; // fixes 2 infinite loops after watching demo - kclose(g_demo_recFilePtr); - -#if 0 - { - uint32_t crcv; - // sync checker - + initcrc32table(); - crc32init(&crcv); - crc32block(&crcv, (char *)wall, sizeof(wall)); - crc32block(&crcv, (char *)sector, sizeof(sector)); - crc32block(&crcv, (char *)sprite, sizeof(sprite)); - crc32finish(&crcv); - initprintf("Checksum = %08X\n",crcv); - } -#endif - - if (g_player[myconnectindex].ps->gm&MODE_MENU) goto RECHECK; -#if KRANDDEBUG - if (foundemo) - krd_print("krandplay.log"); -#endif - return 1; -} diff --git a/polymer-perf/eduke32/source/demo.h b/polymer-perf/eduke32/source/demo.h deleted file mode 100644 index 93d5bad88..000000000 --- a/polymer-perf/eduke32/source/demo.h +++ /dev/null @@ -1,60 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __demo_h__ -#define __demo_h__ - -extern FILE *g_demo_filePtr; -extern char firstdemofile[80]; - -extern int32_t demoplay_diffs; -extern int32_t demoplay_showsync; -extern int32_t demorec_diffcompress_cvar; -extern int32_t demorec_diffs_cvar; -extern int32_t demorec_difftics_cvar; -extern int32_t demorec_force_cvar; -extern int32_t demorec_seeds_cvar; -extern int32_t demorec_synccompress_cvar; -extern int32_t g_demo_cnt; -extern int32_t g_demo_goalCnt; -extern int32_t g_demo_paused; -extern int32_t g_demo_recFilePtr; -extern int32_t g_demo_rewind; -extern int32_t g_demo_showStats; -extern int32_t g_demo_soundToggle; -extern int32_t g_demo_totalCnt; - -int32_t G_OpenDemoRead(int32_t g_whichDemo); -int32_t G_PlaybackDemo(void); -int32_t sv_loadsnapshot(int32_t fil,int32_t *ret_hasdiffs,int32_t *ret_demoticcnt,int32_t *ret_synccompress); -int32_t sv_updatestate(int32_t frominit); -void demo_preparewarp(void); -void G_CloseDemoWrite(void); -void G_DemoRecord(void); -void G_OpenDemoWrite(void); - -#if KRANDDEBUG -int32_t krd_print(const char *filename); -void krd_enable(int32_t which); -#endif - -#endif diff --git a/polymer-perf/eduke32/source/duke3d.h b/polymer-perf/eduke32/source/duke3d.h deleted file mode 100644 index b926975d6..000000000 --- a/polymer-perf/eduke32/source/duke3d.h +++ /dev/null @@ -1,128 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __duke3d_h__ -#define __duke3d_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -// JBF -#include "compat.h" -#include "a.h" -#include "build.h" - -#ifdef POLYMER - #include "polymer.h" -#else -#ifdef USE_OPENGL - #include "polymost.h" -#endif -#endif - -#include "cache1d.h" -#include "pragmas.h" -#include "baselayer.h" -#include "file_lib.h" -#include "keyboard.h" -#include "mathutil.h" -#include "fx_man.h" - -#define APPNAME "EDuke32" -#define VERSION "2.0.0devel" -#define HEAD2 APPNAME" "VERSION - -#define GAME_DUKE 0 -#define GAME_NAM 1 -#define GAME_WW2 3 - -#define VOLUMEALL (g_Shareware == 0) -#define PLUTOPAK (g_scriptVersion == 14) -#define VOLUMEONE (g_Shareware == 1) - -#define NAM (g_gameType & GAME_NAM) -#define WW2GI (g_gameType & GAME_WW2) - -// increase by 3, because atomic GRP adds 1, and Shareware adds 2 -#define BYTEVERSION_JF 198 -#define BYTEVERSION_13 27 -#define BYTEVERSION_14 116 -#define BYTEVERSION_15 117 -#define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1))) - -#define NUMPAGES 1 - -#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3 -#define MOVEFIFOSIZ 2 - -#define MAXVOLUMES 7 -#define MAXLEVELS 32 -#define MAXGAMETYPES 16 - -// used as a constant to satisfy all of the calculations written with ticrate = 26 in mind -#define GAMETICSPERSEC 26 -#define REALGAMETICSPERSEC 30 -// this used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated to 4 by integer division -#define TICSPERFRAME 4 -#define TICRATE 120 - -#define NO 0 -#define YES 1 - -#define PACKBUF_SIZE 2048 - -#define TILE_SAVESHOT (MAXTILES-1) -#define TILE_LOADSHOT (MAXTILES-3) -#define TILE_TILT (MAXTILES-2) -#define TILE_ANIM (MAXTILES-4) -#define TILE_VIEWSCR (MAXTILES-5) - -// JBF 20040604: sync is a function on some platforms -#define sync dsync - -#include "namesdyn.h" -#include "function.h" -#include "macros.h" -#include "gamedefs.h" -#include "config.h" -#include "sounds.h" -#include "control.h" -#include "_rts.h" -#include "rts.h" -#include "soundefs.h" -#include "music.h" -#include "player.h" -#include "actors.h" -#include "quotes.h" -#include "global.h" -#include "sector.h" -#include "net.h" -#include "game.h" -#include "gamedef.h" -#include "gameexec.h" -#include "gamevars.h" - -#ifdef __cplusplus -} -#endif -#endif diff --git a/polymer-perf/eduke32/source/enet/Makefile b/polymer-perf/eduke32/source/enet/Makefile deleted file mode 100644 index b6620ebd7..000000000 --- a/polymer-perf/eduke32/source/enet/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -include ../../Makefile.common -include ../../$(EROOT)/Makefile.shared - -OBJ=obj -OBJNAME=libenet.a -SRC=src -INC=include - -CFLAGS=$(BASECFLAGS) $(F_NO_STACK_PROTECTOR) -# for BUILD_ECHOFLAGS: -OURCFLAGS=$(CFLAGS) -CPPFLAGS=-I$(INC) -I$(SRC) -I../../$(EROOT)/include - - -OBJECTS=$(OBJ)/callbacks.o \ - $(OBJ)/host.o \ - $(OBJ)/list.o \ - $(OBJ)/packet.o \ - $(OBJ)/peer.o \ - $(OBJ)/protocol.o \ - $(OBJ)/compress.o - -ifeq ($(PLATFORM),WINDOWS) - OBJECTS+= $(OBJ)/win32.o - OBJNAME=libenet_win32.a - OBJ=obj_win -else - OBJECTS+= $(OBJ)/unix.o -endif - -# OBJECTS=$(SOURCES:%.c=$(OBJ)/%.o) - -$(OBJNAME): $(OBJECTS) - $(BUILD_ECHOFLAGS) - $(ARCHIVE_STATUS) - if $(AR) cr $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi - -$(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c $(INC)/enet/*.h - -mkdir -p $(OBJ) - $(COMPILE_STATUS) - if $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -ifeq ($(PRETTY_OUTPUT),1) -.SILENT: -endif -.PHONY: clean -clean: - -rm -f $(OBJECTS) $(OBJNAME) diff --git a/polymer-perf/eduke32/source/enet/Makefile.msvc b/polymer-perf/eduke32/source/enet/Makefile.msvc deleted file mode 100644 index 6fc69b565..000000000 --- a/polymer-perf/eduke32/source/enet/Makefile.msvc +++ /dev/null @@ -1,46 +0,0 @@ -OBJ=obj.msc -INC=include -SRC=src -ENETLIB=libenet.lib - -!ifdef DEBUG -# debugging options -flags_cl=/Od /Zi -flags_link=/DEBUG -flags_lib= -!else -# release options -flags_cl=/Ox /GL /arch:SSE -flags_link=/RELEASE /LTCG -flags_lib=/LTCG -!endif - -CC=cl -LINK=link /opt:ref /nologo - -CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(SRC) -!ifdef DEBUG -CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS -!endif - -CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /D "_CRT_SECURE_NO_DEPRECATE" /W2 /Iinclude/msvc /DWIN32 - -OBJECTS=$(OBJ)\callbacks.o \ - $(OBJ)\host.o \ - $(OBJ)\list.o \ - $(OBJ)\packet.o \ - $(OBJ)\peer.o \ - $(OBJ)\protocol.o \ - $(OBJ)\win32.o \ - $(OBJ)\compress.o - -{$(SRC)}.c{$(OBJ)}.o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -enet: $(ENETLIB) -$(ENETLIB): $(OBJECTS) - lib $(flags_lib) /out:$@ /nologo $** - -clean: - -del /Q $(OBJ)\* $(ENETLIB) - diff --git a/polymer-perf/eduke32/source/enet/include/enet/callbacks.h b/polymer-perf/eduke32/source/enet/include/enet/callbacks.h deleted file mode 100644 index 340a4a989..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/callbacks.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - @file callbacks.h - @brief ENet callbacks -*/ -#ifndef __ENET_CALLBACKS_H__ -#define __ENET_CALLBACKS_H__ - -#include - -typedef struct _ENetCallbacks -{ - void * (ENET_CALLBACK * malloc) (size_t size); - void (ENET_CALLBACK * free) (void * memory); - void (ENET_CALLBACK * no_memory) (void); -} ENetCallbacks; - -/** @defgroup callbacks ENet internal callbacks - @{ - @ingroup private -*/ -extern void * enet_malloc (size_t); -extern void enet_free (void *); - -/** @} */ - -#endif /* __ENET_CALLBACKS_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/enet.h b/polymer-perf/eduke32/source/enet/include/enet/enet.h deleted file mode 100644 index b572590ec..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/enet.h +++ /dev/null @@ -1,540 +0,0 @@ -/** - @file enet.h - @brief ENet public header file -*/ -#ifndef __ENET_ENET_H__ -#define __ENET_ENET_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include - -#ifdef WIN32 -#include "enet/win32.h" -#else -#include "enet/unix.h" -#endif - -#include "enet/types.h" -#include "enet/protocol.h" -#include "enet/list.h" -#include "enet/callbacks.h" - -#define ENET_VERSION_MAJOR 1 -#define ENET_VERSION_MINOR 3 -#define ENET_VERSION_PATCH 1 -#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch)) -#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH) - -typedef enet_uint32 ENetVersion; - -typedef enum _ENetSocketType -{ - ENET_SOCKET_TYPE_STREAM = 1, - ENET_SOCKET_TYPE_DATAGRAM = 2 -} ENetSocketType; - -typedef enum _ENetSocketWait -{ - ENET_SOCKET_WAIT_NONE = 0, - ENET_SOCKET_WAIT_SEND = (1 << 0), - ENET_SOCKET_WAIT_RECEIVE = (1 << 1) -} ENetSocketWait; - -typedef enum _ENetSocketOption -{ - ENET_SOCKOPT_NONBLOCK = 1, - ENET_SOCKOPT_BROADCAST = 2, - ENET_SOCKOPT_RCVBUF = 3, - ENET_SOCKOPT_SNDBUF = 4, - ENET_SOCKOPT_REUSEADDR = 5 -} ENetSocketOption; - -enum -{ - ENET_HOST_ANY = 0, /**< specifies the default server host */ - ENET_HOST_BROADCAST = 0xFFFFFFFF, /**< specifies a subnet-wide broadcast */ - - ENET_PORT_ANY = 0 /**< specifies that a port should be automatically chosen */ -}; - -/** - * Portable internet address structure. - * - * The host must be specified in network byte-order, and the port must be in host - * byte-order. The constant ENET_HOST_ANY may be used to specify the default - * server host. The constant ENET_HOST_BROADCAST may be used to specify the - * broadcast address (255.255.255.255). This makes sense for enet_host_connect, - * but not for enet_host_create. Once a server responds to a broadcast, the - * address is updated from ENET_HOST_BROADCAST to the server's actual IP address. - */ -typedef struct _ENetAddress -{ - enet_uint32 host; - enet_uint16 port; -} ENetAddress; - -/** - * Packet flag bit constants. - * - * The host must be specified in network byte-order, and the port must be in - * host byte-order. The constant ENET_HOST_ANY may be used to specify the - * default server host. - - @sa ENetPacket -*/ -typedef enum _ENetPacketFlag -{ - /** packet must be received by the target peer and resend attempts should be - * made until the packet is delivered */ - ENET_PACKET_FLAG_RELIABLE = (1 << 0), - /** packet will not be sequenced with other packets - * not supported for reliable packets - */ - ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1), - /** packet will not allocate data, and user must supply it instead */ - ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2) -} ENetPacketFlag; - -struct _ENetPacket; -typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket *); - -/** - * ENet packet structure. - * - * An ENet data packet that may be sent to or received from a peer. The shown - * fields should only be read and never modified. The data field contains the - * allocated data for the packet. The dataLength fields specifies the length - * of the allocated data. The flags field is either 0 (specifying no flags), - * or a bitwise-or of any combination of the following flags: - * - * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer - * and resend attempts should be made until the packet is delivered - * - * ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets - * (not supported for reliable packets) - * - * ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead - - @sa ENetPacketFlag - */ -typedef struct _ENetPacket -{ - size_t referenceCount; /**< internal use only */ - enet_uint32 flags; /**< bitwise-or of ENetPacketFlag constants */ - enet_uint8 * data; /**< allocated data for packet */ - size_t dataLength; /**< length of data */ - ENetPacketFreeCallback freeCallback; /**< function to be called when the packet is no longer in use */ -} ENetPacket; - -typedef struct _ENetAcknowledgement -{ - ENetListNode acknowledgementList; - enet_uint32 sentTime; - ENetProtocol command; -} ENetAcknowledgement; - -typedef struct _ENetOutgoingCommand -{ - ENetListNode outgoingCommandList; - enet_uint16 reliableSequenceNumber; - enet_uint16 unreliableSequenceNumber; - enet_uint32 sentTime; - enet_uint32 roundTripTimeout; - enet_uint32 roundTripTimeoutLimit; - enet_uint32 fragmentOffset; - enet_uint16 fragmentLength; - enet_uint16 sendAttempts; - ENetProtocol command; - ENetPacket * packet; -} ENetOutgoingCommand; - -typedef struct _ENetIncomingCommand -{ - ENetListNode incomingCommandList; - enet_uint16 reliableSequenceNumber; - enet_uint16 unreliableSequenceNumber; - ENetProtocol command; - enet_uint32 fragmentCount; - enet_uint32 fragmentsRemaining; - enet_uint32 * fragments; - ENetPacket * packet; -} ENetIncomingCommand; - -typedef enum _ENetPeerState -{ - ENET_PEER_STATE_DISCONNECTED = 0, - ENET_PEER_STATE_CONNECTING = 1, - ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2, - ENET_PEER_STATE_CONNECTION_PENDING = 3, - ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4, - ENET_PEER_STATE_CONNECTED = 5, - ENET_PEER_STATE_DISCONNECT_LATER = 6, - ENET_PEER_STATE_DISCONNECTING = 7, - ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8, - ENET_PEER_STATE_ZOMBIE = 9 -} ENetPeerState; - -#ifndef ENET_BUFFER_MAXIMUM -#define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS) -#endif - -enum -{ - ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024, - ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024, - ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000, - ENET_HOST_DEFAULT_MTU = 1400, - - ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500, - ENET_PEER_DEFAULT_PACKET_THROTTLE = 32, - ENET_PEER_PACKET_THROTTLE_SCALE = 32, - ENET_PEER_PACKET_THROTTLE_COUNTER = 7, - ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2, - ENET_PEER_PACKET_THROTTLE_DECELERATION = 2, - ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000, - ENET_PEER_PACKET_LOSS_SCALE = (1 << 16), - ENET_PEER_PACKET_LOSS_INTERVAL = 10000, - ENET_PEER_WINDOW_SIZE_SCALE = 64 * 1024, - ENET_PEER_TIMEOUT_LIMIT = 32, - ENET_PEER_TIMEOUT_MINIMUM = 5000, - ENET_PEER_TIMEOUT_MAXIMUM = 30000, - ENET_PEER_PING_INTERVAL = 500, - ENET_PEER_UNSEQUENCED_WINDOWS = 64, - ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 1024, - ENET_PEER_FREE_UNSEQUENCED_WINDOWS = 32, - ENET_PEER_RELIABLE_WINDOWS = 16, - ENET_PEER_RELIABLE_WINDOW_SIZE = 0x1000, - ENET_PEER_FREE_RELIABLE_WINDOWS = 8 -}; - -typedef struct _ENetChannel -{ - enet_uint16 outgoingReliableSequenceNumber; - enet_uint16 outgoingUnreliableSequenceNumber; - enet_uint16 usedReliableWindows; - enet_uint16 reliableWindows [ENET_PEER_RELIABLE_WINDOWS]; - enet_uint16 incomingReliableSequenceNumber; - ENetList incomingReliableCommands; - ENetList incomingUnreliableCommands; -} ENetChannel; - -/** - * An ENet peer which data packets may be sent or received from. - * - * No fields should be modified unless otherwise specified. - */ -typedef struct _ENetPeer -{ - ENetListNode dispatchList; - struct _ENetHost * host; - enet_uint16 outgoingPeerID; - enet_uint16 incomingPeerID; - enet_uint32 connectID; - enet_uint8 outgoingSessionID; - enet_uint8 incomingSessionID; - ENetAddress address; /**< Internet address of the peer */ - void * data; /**< Application private data, may be freely modified */ - ENetPeerState state; - ENetChannel * channels; - size_t channelCount; /**< Number of channels allocated for communication with peer */ - enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the client in bytes/second */ - enet_uint32 outgoingBandwidth; /**< Upstream bandwidth of the client in bytes/second */ - enet_uint32 incomingBandwidthThrottleEpoch; - enet_uint32 outgoingBandwidthThrottleEpoch; - enet_uint32 incomingDataTotal; - enet_uint32 outgoingDataTotal; - enet_uint32 lastSendTime; - enet_uint32 lastReceiveTime; - enet_uint32 nextTimeout; - enet_uint32 earliestTimeout; - enet_uint32 packetLossEpoch; - enet_uint32 packetsSent; - enet_uint32 packetsLost; - enet_uint32 packetLoss; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */ - enet_uint32 packetLossVariance; - enet_uint32 packetThrottle; - enet_uint32 packetThrottleLimit; - enet_uint32 packetThrottleCounter; - enet_uint32 packetThrottleEpoch; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; - enet_uint32 packetThrottleInterval; - enet_uint32 lastRoundTripTime; - enet_uint32 lowestRoundTripTime; - enet_uint32 lastRoundTripTimeVariance; - enet_uint32 highestRoundTripTimeVariance; - enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */ - enet_uint32 roundTripTimeVariance; - enet_uint32 mtu; - enet_uint32 windowSize; - enet_uint32 reliableDataInTransit; - enet_uint16 outgoingReliableSequenceNumber; - ENetList acknowledgements; - ENetList sentReliableCommands; - ENetList sentUnreliableCommands; - ENetList outgoingReliableCommands; - ENetList outgoingUnreliableCommands; - ENetList dispatchedCommands; - int needsDispatch; - enet_uint16 incomingUnsequencedGroup; - enet_uint16 outgoingUnsequencedGroup; - enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; - enet_uint32 eventData; -} ENetPeer; - -/** An ENet packet compressor for compressing UDP packets before socket sends or receives. - */ -typedef struct _ENetCompressor -{ - /** Context data for the compressor. Must be non-NULL. */ - void * context; - /** Compresses from inBuffers[0:inBufferCount-1], containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */ - size_t (ENET_CALLBACK * compress) (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit); - /** Decompresses from inData, containing inLimit bytes, to outData, outputting at most outLimit bytes. Should return 0 on failure. */ - size_t (ENET_CALLBACK * decompress) (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit); - /** Destroys the context when compression is disabled or the host is destroyed. May be NULL. */ - void (ENET_CALLBACK * destroy) (void * context); -} ENetCompressor; - -/** Callback that computes the checksum of the data held in buffers[0:bufferCount-1] */ -typedef enet_uint32 (ENET_CALLBACK * ENetChecksumCallback) (const ENetBuffer * buffers, size_t bufferCount); - -/** An ENet host for communicating with peers. - * - * No fields should be modified unless otherwise stated. - - @sa enet_host_create() - @sa enet_host_destroy() - @sa enet_host_connect() - @sa enet_host_service() - @sa enet_host_flush() - @sa enet_host_broadcast() - @sa enet_host_compress() - @sa enet_host_compress_with_range_coder() - @sa enet_host_channel_limit() - @sa enet_host_bandwidth_limit() - @sa enet_host_bandwidth_throttle() - */ -typedef struct _ENetHost -{ - ENetSocket socket; - ENetAddress address; /**< Internet address of the host */ - enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */ - enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */ - enet_uint32 bandwidthThrottleEpoch; - enet_uint32 mtu; - enet_uint32 randomSeed; - int recalculateBandwidthLimits; - ENetPeer * peers; /**< array of peers allocated for this host */ - size_t peerCount; /**< number of peers allocated for this host */ - size_t channelLimit; /**< maximum number of channels allowed for connected peers */ - enet_uint32 serviceTime; - ENetList dispatchQueue; - int continueSending; - size_t packetSize; - enet_uint16 headerFlags; - ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS]; - size_t commandCount; - ENetBuffer buffers [ENET_BUFFER_MAXIMUM]; - size_t bufferCount; - ENetChecksumCallback checksum; /**< callback the user can set to enable packet checksums for this host */ - ENetCompressor compressor; - enet_uint8 packetData [2][ENET_PROTOCOL_MAXIMUM_MTU]; - ENetAddress receivedAddress; - enet_uint8 * receivedData; - size_t receivedDataLength; - enet_uint32 totalSentData; /**< total data sent, user should reset to 0 as needed to prevent overflow */ - enet_uint32 totalSentPackets; /**< total UDP packets sent, user should reset to 0 as needed to prevent overflow */ - enet_uint32 totalReceivedData; /**< total data received, user should reset to 0 as needed to prevent overflow */ - enet_uint32 totalReceivedPackets; /**< total UDP packets received, user should reset to 0 as needed to prevent overflow */ -} ENetHost; - -/** - * An ENet event type, as specified in @ref ENetEvent. - */ -typedef enum _ENetEventType -{ - /** no event occurred within the specified time limit */ - ENET_EVENT_TYPE_NONE = 0, - - /** a connection request initiated by enet_host_connect has completed. - * The peer field contains the peer which successfully connected. - */ - ENET_EVENT_TYPE_CONNECT = 1, - - /** a peer has disconnected. This event is generated on a successful - * completion of a disconnect initiated by enet_pper_disconnect, if - * a peer has timed out, or if a connection request intialized by - * enet_host_connect has timed out. The peer field contains the peer - * which disconnected. The data field contains user supplied data - * describing the disconnection, or 0, if none is available. - */ - ENET_EVENT_TYPE_DISCONNECT = 2, - - /** a packet has been received from a peer. The peer field specifies the - * peer which sent the packet. The channelID field specifies the channel - * number upon which the packet was received. The packet field contains - * the packet that was received; this packet must be destroyed with - * enet_packet_destroy after use. - */ - ENET_EVENT_TYPE_RECEIVE = 3 -} ENetEventType; - -/** - * An ENet event as returned by enet_host_service(). - - @sa enet_host_service - */ -typedef struct _ENetEvent -{ - ENetEventType type; /**< type of the event */ - ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */ - enet_uint8 channelID; /**< channel on the peer that generated the event, if appropriate */ - enet_uint32 data; /**< data associated with the event, if appropriate */ - ENetPacket * packet; /**< packet associated with the event, if appropriate */ -} ENetEvent; - -/** @defgroup global ENet global functions - @{ -*/ - -/** - Initializes ENet globally. Must be called prior to using any functions in - ENet. - @returns 0 on success, < 0 on failure -*/ -ENET_API int enet_initialize (void); - -/** - Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. Make sure the ENetCallbacks structure is zeroed out so that any additional callbacks added in future versions will be properly ignored. - - @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use - @param inits user-overriden callbacks where any NULL callbacks will use ENet's defaults - @returns 0 on success, < 0 on failure -*/ -ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits); - -/** - Shuts down ENet globally. Should be called when a program that has - initialized ENet exits. -*/ -ENET_API void enet_deinitialize (void); - -/** @} */ - -/** @defgroup private ENet private implementation functions */ - -/** - Returns the wall-time in milliseconds. Its initial value is unspecified - unless otherwise set. - */ -ENET_API enet_uint32 enet_time_get (void); -/** - Sets the current wall-time in milliseconds. - */ -ENET_API void enet_time_set (enet_uint32); - -/** @defgroup socket ENet socket functions - @{ -*/ -ENET_API ENetSocket enet_socket_create (ENetSocketType); -ENET_API int enet_socket_bind (ENetSocket, const ENetAddress *); -ENET_API int enet_socket_listen (ENetSocket, int); -ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *); -ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *); -ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t); -ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t); -ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32); -ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int); -ENET_API void enet_socket_destroy (ENetSocket); -ENET_API int enet_socketset_select (ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32); - -/** @} */ - -/** @defgroup Address ENet address functions - @{ -*/ -/** Attempts to resolve the host named by the parameter hostName and sets - the host field in the address parameter if successful. - @param address destination to store resolved address - @param hostName host name to lookup - @retval 0 on success - @retval < 0 on failure - @returns the address of the given hostName in address on success -*/ -ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName); - -/** Gives the printable form of the ip address specified in the address parameter. - @param address address printed - @param hostName destination for name, must not be NULL - @param nameLength maximum length of hostName. - @returns the null-terminated name of the host in hostName on success - @retval 0 on success - @retval < 0 on failure -*/ -ENET_API int enet_address_get_host_ip (const ENetAddress * address, char * hostName, size_t nameLength); - -/** Attempts to do a reverse lookup of the host field in the address parameter. - @param address address used for reverse lookup - @param hostName destination for name, must not be NULL - @param nameLength maximum length of hostName. - @returns the null-terminated name of the host in hostName on success - @retval 0 on success - @retval < 0 on failure -*/ -ENET_API int enet_address_get_host (const ENetAddress * address, char * hostName, size_t nameLength); - -/** @} */ - -ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32); -ENET_API void enet_packet_destroy (ENetPacket *); -ENET_API int enet_packet_resize (ENetPacket *, size_t); -extern enet_uint32 enet_crc32 (const ENetBuffer *, size_t); - -ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32); -ENET_API void enet_host_destroy (ENetHost *); -ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t, enet_uint32); -ENET_API int enet_host_check_events (ENetHost *, ENetEvent *); -ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32); -ENET_API void enet_host_flush (ENetHost *); -ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *); -ENET_API void enet_host_compress (ENetHost *, const ENetCompressor *); -ENET_API int enet_host_compress_with_range_coder (ENetHost * host); -ENET_API void enet_host_channel_limit (ENetHost *, size_t); -ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32); -extern void enet_host_bandwidth_throttle (ENetHost *); - -ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *); -ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8 * channelID); -ENET_API void enet_peer_ping (ENetPeer *); -ENET_API void enet_peer_reset (ENetPeer *); -ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32); -ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uint32); -ENET_API void enet_peer_disconnect_later (ENetPeer *, enet_uint32); -ENET_API void enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32); -extern int enet_peer_throttle (ENetPeer *, enet_uint32); -extern void enet_peer_reset_queues (ENetPeer *); -extern void enet_peer_setup_outgoing_command (ENetPeer *, ENetOutgoingCommand *); -extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16); -extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32); -extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16); -extern void enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *); -extern void enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *); - -ENET_API void * enet_range_coder_create (void); -ENET_API void enet_range_coder_destroy (void *); -ENET_API size_t enet_range_coder_compress (void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t); -ENET_API size_t enet_range_coder_decompress (void *, const enet_uint8 *, size_t, enet_uint8 *, size_t); - -extern size_t enet_protocol_command_size (enet_uint8); - -#ifdef __cplusplus -} -#endif - -#endif /* __ENET_ENET_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/list.h b/polymer-perf/eduke32/source/enet/include/enet/list.h deleted file mode 100644 index d7b260084..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/list.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - @file list.h - @brief ENet list management -*/ -#ifndef __ENET_LIST_H__ -#define __ENET_LIST_H__ - -#include - -typedef struct _ENetListNode -{ - struct _ENetListNode * next; - struct _ENetListNode * previous; -} ENetListNode; - -typedef ENetListNode * ENetListIterator; - -typedef struct _ENetList -{ - ENetListNode sentinel; -} ENetList; - -extern void enet_list_clear (ENetList *); - -extern ENetListIterator enet_list_insert (ENetListIterator, void *); -extern void * enet_list_remove (ENetListIterator); -extern ENetListIterator enet_list_move (ENetListIterator, void *, void *); - -extern size_t enet_list_size (ENetList *); - -#define enet_list_begin(list) ((list) -> sentinel.next) -#define enet_list_end(list) (& (list) -> sentinel) - -#define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list)) - -#define enet_list_next(iterator) ((iterator) -> next) -#define enet_list_previous(iterator) ((iterator) -> previous) - -#define enet_list_front(list) ((void *) (list) -> sentinel.next) -#define enet_list_back(list) ((void *) (list) -> sentinel.previous) - -#endif /* __ENET_LIST_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/protocol.h b/polymer-perf/eduke32/source/enet/include/enet/protocol.h deleted file mode 100644 index 19f7e45de..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/protocol.h +++ /dev/null @@ -1,196 +0,0 @@ -/** - @file protocol.h - @brief ENet protocol -*/ -#ifndef __ENET_PROTOCOL_H__ -#define __ENET_PROTOCOL_H__ - -#include "enet/types.h" - -enum -{ - ENET_PROTOCOL_MINIMUM_MTU = 576, - ENET_PROTOCOL_MAXIMUM_MTU = 4096, - ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32, - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096, - ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768, - ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1, - ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255, - ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xFFF -}; - -typedef enum _ENetProtocolCommand -{ - ENET_PROTOCOL_COMMAND_NONE = 0, - ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1, - ENET_PROTOCOL_COMMAND_CONNECT = 2, - ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3, - ENET_PROTOCOL_COMMAND_DISCONNECT = 4, - ENET_PROTOCOL_COMMAND_PING = 5, - ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6, - ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7, - ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8, - ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9, - ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10, - ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11, - ENET_PROTOCOL_COMMAND_COUNT = 12, - - ENET_PROTOCOL_COMMAND_MASK = 0x0F -} ENetProtocolCommand; - -typedef enum _ENetProtocolFlag -{ - ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7), - ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6), - - ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 << 14), - ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15), - ENET_PROTOCOL_HEADER_FLAG_MASK = ENET_PROTOCOL_HEADER_FLAG_COMPRESSED | ENET_PROTOCOL_HEADER_FLAG_SENT_TIME, - - ENET_PROTOCOL_HEADER_SESSION_MASK = (3 << 12), - ENET_PROTOCOL_HEADER_SESSION_SHIFT = 12 -} ENetProtocolFlag; - -#ifdef _MSC_VER_ -#pragma pack(push, 1) -#define ENET_PACKED -#elif defined(__GNUC__) -#define ENET_PACKED __attribute__ ((packed)) -#else -#define ENET_PACKED -#endif - -typedef struct _ENetProtocolHeader -{ - enet_uint16 peerID; - enet_uint16 sentTime; -} ENET_PACKED ENetProtocolHeader; - -typedef struct _ENetProtocolCommandHeader -{ - enet_uint8 command; - enet_uint8 channelID; - enet_uint16 reliableSequenceNumber; -} ENET_PACKED ENetProtocolCommandHeader; - -typedef struct _ENetProtocolAcknowledge -{ - ENetProtocolCommandHeader header; - enet_uint16 receivedReliableSequenceNumber; - enet_uint16 receivedSentTime; -} ENET_PACKED ENetProtocolAcknowledge; - -typedef struct _ENetProtocolConnect -{ - ENetProtocolCommandHeader header; - enet_uint16 outgoingPeerID; - enet_uint8 incomingSessionID; - enet_uint8 outgoingSessionID; - enet_uint32 mtu; - enet_uint32 windowSize; - enet_uint32 channelCount; - enet_uint32 incomingBandwidth; - enet_uint32 outgoingBandwidth; - enet_uint32 packetThrottleInterval; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; - enet_uint32 connectID; - enet_uint32 data; -} ENET_PACKED ENetProtocolConnect; - -typedef struct _ENetProtocolVerifyConnect -{ - ENetProtocolCommandHeader header; - enet_uint16 outgoingPeerID; - enet_uint8 incomingSessionID; - enet_uint8 outgoingSessionID; - enet_uint32 mtu; - enet_uint32 windowSize; - enet_uint32 channelCount; - enet_uint32 incomingBandwidth; - enet_uint32 outgoingBandwidth; - enet_uint32 packetThrottleInterval; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; - enet_uint32 connectID; -} ENET_PACKED ENetProtocolVerifyConnect; - -typedef struct _ENetProtocolBandwidthLimit -{ - ENetProtocolCommandHeader header; - enet_uint32 incomingBandwidth; - enet_uint32 outgoingBandwidth; -} ENET_PACKED ENetProtocolBandwidthLimit; - -typedef struct _ENetProtocolThrottleConfigure -{ - ENetProtocolCommandHeader header; - enet_uint32 packetThrottleInterval; - enet_uint32 packetThrottleAcceleration; - enet_uint32 packetThrottleDeceleration; -} ENET_PACKED ENetProtocolThrottleConfigure; - -typedef struct _ENetProtocolDisconnect -{ - ENetProtocolCommandHeader header; - enet_uint32 data; -} ENET_PACKED ENetProtocolDisconnect; - -typedef struct _ENetProtocolPing -{ - ENetProtocolCommandHeader header; -} ENET_PACKED ENetProtocolPing; - -typedef struct _ENetProtocolSendReliable -{ - ENetProtocolCommandHeader header; - enet_uint16 dataLength; -} ENET_PACKED ENetProtocolSendReliable; - -typedef struct _ENetProtocolSendUnreliable -{ - ENetProtocolCommandHeader header; - enet_uint16 unreliableSequenceNumber; - enet_uint16 dataLength; -} ENET_PACKED ENetProtocolSendUnreliable; - -typedef struct _ENetProtocolSendUnsequenced -{ - ENetProtocolCommandHeader header; - enet_uint16 unsequencedGroup; - enet_uint16 dataLength; -} ENET_PACKED ENetProtocolSendUnsequenced; - -typedef struct _ENetProtocolSendFragment -{ - ENetProtocolCommandHeader header; - enet_uint16 startSequenceNumber; - enet_uint16 dataLength; - enet_uint32 fragmentCount; - enet_uint32 fragmentNumber; - enet_uint32 totalLength; - enet_uint32 fragmentOffset; -} ENET_PACKED ENetProtocolSendFragment; - -typedef union _ENetProtocol -{ - ENetProtocolCommandHeader header; - ENetProtocolAcknowledge acknowledge; - ENetProtocolConnect connect; - ENetProtocolVerifyConnect verifyConnect; - ENetProtocolDisconnect disconnect; - ENetProtocolPing ping; - ENetProtocolSendReliable sendReliable; - ENetProtocolSendUnreliable sendUnreliable; - ENetProtocolSendUnsequenced sendUnsequenced; - ENetProtocolSendFragment sendFragment; - ENetProtocolBandwidthLimit bandwidthLimit; - ENetProtocolThrottleConfigure throttleConfigure; -} ENET_PACKED ENetProtocol; - -#ifdef _MSC_VER_ -#pragma pack(pop) -#endif - -#endif /* __ENET_PROTOCOL_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/time.h b/polymer-perf/eduke32/source/enet/include/enet/time.h deleted file mode 100644 index c82a54603..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/time.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - @file time.h - @brief ENet time constants and macros -*/ -#ifndef __ENET_TIME_H__ -#define __ENET_TIME_H__ - -#define ENET_TIME_OVERFLOW 86400000 - -#define ENET_TIME_LESS(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW) -#define ENET_TIME_GREATER(a, b) ((b) - (a) >= ENET_TIME_OVERFLOW) -#define ENET_TIME_LESS_EQUAL(a, b) (! ENET_TIME_GREATER (a, b)) -#define ENET_TIME_GREATER_EQUAL(a, b) (! ENET_TIME_LESS (a, b)) - -#define ENET_TIME_DIFFERENCE(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW ? (b) - (a) : (a) - (b)) - -#endif /* __ENET_TIME_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/types.h b/polymer-perf/eduke32/source/enet/include/enet/types.h deleted file mode 100644 index ab010a4b1..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/types.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - @file types.h - @brief type definitions for ENet -*/ -#ifndef __ENET_TYPES_H__ -#define __ENET_TYPES_H__ - -typedef unsigned char enet_uint8; /**< unsigned 8-bit type */ -typedef unsigned short enet_uint16; /**< unsigned 16-bit type */ -typedef unsigned int enet_uint32; /**< unsigned 32-bit type */ - -#endif /* __ENET_TYPES_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/unix.h b/polymer-perf/eduke32/source/enet/include/enet/unix.h deleted file mode 100644 index 087015e51..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/unix.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - @file unix.h - @brief ENet Unix header -*/ -#ifndef __ENET_UNIX_H__ -#define __ENET_UNIX_H__ - -#include -#include -#include -#include -#include - -typedef int ENetSocket; - -enum -{ - ENET_SOCKET_NULL = -1 -}; - -#define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */ -#define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */ - -#define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */ -#define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */ - -typedef struct -{ - void * data; - size_t dataLength; -} ENetBuffer; - -#define ENET_CALLBACK - -#define ENET_API extern - -typedef fd_set ENetSocketSet; - -#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) -#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) -#define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) -#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) - -#endif /* __ENET_UNIX_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/utility.h b/polymer-perf/eduke32/source/enet/include/enet/utility.h deleted file mode 100644 index e48a476be..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/utility.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - @file utility.h - @brief ENet utility header -*/ -#ifndef __ENET_UTILITY_H__ -#define __ENET_UTILITY_H__ - -#define ENET_MAX(x, y) ((x) > (y) ? (x) : (y)) -#define ENET_MIN(x, y) ((x) < (y) ? (x) : (y)) - -#endif /* __ENET_UTILITY_H__ */ - diff --git a/polymer-perf/eduke32/source/enet/include/enet/win32.h b/polymer-perf/eduke32/source/enet/include/enet/win32.h deleted file mode 100644 index a20fb24dd..000000000 --- a/polymer-perf/eduke32/source/enet/include/enet/win32.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - @file win32.h - @brief ENet Win32 header -*/ -#ifndef __ENET_WIN32_H__ -#define __ENET_WIN32_H__ - -#ifdef ENET_BUILDING_LIB -#ifdef _MSC_VER -#pragma warning (disable: 4996) // 'strncpy' was declared deprecated -#pragma warning (disable: 4267) // size_t to int conversion -#pragma warning (disable: 4244) // 64bit to 32bit int -#pragma warning (disable: 4018) // signed/unsigned mismatch -#endif -#endif - -#include -#include - -typedef SOCKET ENetSocket; - -enum -{ - ENET_SOCKET_NULL = INVALID_SOCKET -}; - -#define ENET_HOST_TO_NET_16(value) (htons (value)) -#define ENET_HOST_TO_NET_32(value) (htonl (value)) - -#define ENET_NET_TO_HOST_16(value) (ntohs (value)) -#define ENET_NET_TO_HOST_32(value) (ntohl (value)) - -typedef struct -{ - size_t dataLength; - void * data; -} ENetBuffer; - -#define ENET_CALLBACK __cdecl - -#if defined ENET_DLL -#if defined ENET_BUILDING_LIB -#define ENET_API __declspec( dllexport ) -#else -#define ENET_API __declspec( dllimport ) -#endif /* ENET_BUILDING_LIB */ -#else /* !ENET_DLL */ -#define ENET_API extern -#endif /* ENET_DLL */ - -typedef fd_set ENetSocketSet; - -#define ENET_SOCKETSET_EMPTY(sockset) FD_ZERO (& (sockset)) -#define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) -#define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) -#define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) - -#endif /* __ENET_WIN32_H__ */ - - diff --git a/polymer-perf/eduke32/source/enet/src/callbacks.c b/polymer-perf/eduke32/source/enet/src/callbacks.c deleted file mode 100644 index f94128256..000000000 --- a/polymer-perf/eduke32/source/enet/src/callbacks.c +++ /dev/null @@ -1,47 +0,0 @@ -/** - @file callbacks.c - @brief ENet callback functions -*/ -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -static ENetCallbacks callbacks = { malloc, free, abort }; - -int -enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits) -{ - if (version < ENET_VERSION_CREATE (1, 3, 0)) - return -1; - - if (inits -> malloc != NULL || inits -> free != NULL) - { - if (inits -> malloc == NULL || inits -> free == NULL) - return -1; - - callbacks.malloc = inits -> malloc; - callbacks.free = inits -> free; - } - - if (inits -> no_memory != NULL) - callbacks.no_memory = inits -> no_memory; - - return enet_initialize (); -} - -void * -enet_malloc (size_t size) -{ - void * memory = callbacks.malloc (size); - - if (memory == NULL) - callbacks.no_memory (); - - return memory; -} - -void -enet_free (void * memory) -{ - callbacks.free (memory); -} - diff --git a/polymer-perf/eduke32/source/enet/src/compress.c b/polymer-perf/eduke32/source/enet/src/compress.c deleted file mode 100644 index 784489a78..000000000 --- a/polymer-perf/eduke32/source/enet/src/compress.c +++ /dev/null @@ -1,654 +0,0 @@ -/** - @file compress.c - @brief An adaptive order-2 PPM range coder -*/ -#define ENET_BUILDING_LIB 1 -#include -#include "enet/enet.h" - -typedef struct _ENetSymbol -{ - /* binary indexed tree of symbols */ - enet_uint8 value; - enet_uint8 count; - enet_uint16 under; - enet_uint16 left, right; - - /* context defined by this symbol */ - enet_uint16 symbols; - enet_uint16 escapes; - enet_uint16 total; - enet_uint16 parent; -} ENetSymbol; - -/* adaptation constants tuned aggressively for small packet sizes rather than large file compression */ -enum -{ - ENET_RANGE_CODER_TOP = 1<<24, - ENET_RANGE_CODER_BOTTOM = 1<<16, - - ENET_CONTEXT_SYMBOL_DELTA = 3, - ENET_CONTEXT_SYMBOL_MINIMUM = 1, - ENET_CONTEXT_ESCAPE_MINIMUM = 1, - - ENET_SUBCONTEXT_ORDER = 2, - ENET_SUBCONTEXT_SYMBOL_DELTA = 2, - ENET_SUBCONTEXT_ESCAPE_DELTA = 5 -}; - -/* context exclusion roughly halves compression speed, so disable for now */ -#undef ENET_CONTEXT_EXCLUSION - -typedef struct _ENetRangeCoder -{ - /* only allocate enough symbols for reasonable MTUs, would need to be larger for large file compression */ - ENetSymbol symbols[4096]; -} ENetRangeCoder; - -void * -enet_range_coder_create (void) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) enet_malloc (sizeof (ENetRangeCoder)); - if (rangeCoder == NULL) - return NULL; - - return rangeCoder; -} - -void -enet_range_coder_destroy (void * context) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; - if (rangeCoder == NULL) - return; - - enet_free (rangeCoder); -} - -#define ENET_SYMBOL_CREATE(symbol, value_, count_) \ -{ \ - symbol = & rangeCoder -> symbols [nextSymbol ++]; \ - symbol -> value = value_; \ - symbol -> count = count_; \ - symbol -> under = count_; \ - symbol -> left = 0; \ - symbol -> right = 0; \ - symbol -> symbols = 0; \ - symbol -> escapes = 0; \ - symbol -> total = 0; \ - symbol -> parent = 0; \ -} - -#define ENET_CONTEXT_CREATE(context, escapes_, minimum) \ -{ \ - ENET_SYMBOL_CREATE (context, 0, 0); \ - (context) -> escapes = escapes_; \ - (context) -> total = escapes_ + 256*minimum; \ - (context) -> symbols = 0; \ -} - -static enet_uint16 -enet_symbol_rescale (ENetSymbol * symbol) -{ - enet_uint16 total = 0; - for (;;) - { - symbol -> count -= symbol->count >> 1; - symbol -> under = symbol -> count; - if (symbol -> left) - symbol -> under += enet_symbol_rescale (symbol + symbol -> left); - total += symbol -> under; - if (! symbol -> right) break; - symbol += symbol -> right; - } - return total; -} - -#define ENET_CONTEXT_RESCALE(context, minimum) \ -{ \ - (context) -> total = (context) -> symbols ? enet_symbol_rescale ((context) + (context) -> symbols) : 0; \ - (context) -> escapes -= (context) -> escapes >> 1; \ - (context) -> total += (context) -> escapes + 256*minimum; \ -} - -#define ENET_RANGE_CODER_OUTPUT(value) \ -{ \ - if (outData >= outEnd) \ - return 0; \ - * outData ++ = value; \ -} - -#define ENET_RANGE_CODER_ENCODE(under, count, total) \ -{ \ - encodeRange /= (total); \ - encodeLow += (under) * encodeRange; \ - encodeRange *= (count); \ - for (;;) \ - { \ - if((encodeLow ^ (encodeLow + encodeRange)) >= ENET_RANGE_CODER_TOP) \ - { \ - if(encodeRange >= ENET_RANGE_CODER_BOTTOM) break; \ - encodeRange = -encodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \ - } \ - ENET_RANGE_CODER_OUTPUT (encodeLow >> 24); \ - encodeRange <<= 8; \ - encodeLow <<= 8; \ - } \ -} - -#define ENET_RANGE_CODER_FLUSH \ -{ \ - while (encodeLow) \ - { \ - ENET_RANGE_CODER_OUTPUT (encodeLow >> 24); \ - encodeLow <<= 8; \ - } \ -} - -#define ENET_RANGE_CODER_FREE_SYMBOLS \ -{ \ - if (nextSymbol >= sizeof (rangeCoder -> symbols) / sizeof (ENetSymbol) - ENET_SUBCONTEXT_ORDER ) \ - { \ - nextSymbol = 0; \ - ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM); \ - predicted = 0; \ - order = 0; \ - } \ -} - -#define ENET_CONTEXT_ENCODE(context, symbol_, value_, under_, count_, update, minimum) \ -{ \ - under_ = value*minimum; \ - count_ = minimum; \ - if (! (context) -> symbols) \ - { \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - (context) -> symbols = symbol_ - (context); \ - } \ - else \ - { \ - ENetSymbol * node = (context) + (context) -> symbols; \ - for (;;) \ - { \ - if (value_ < node -> value) \ - { \ - node -> under += update; \ - if (node -> left) { node += node -> left; continue; } \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> left = symbol_ - node; \ - } \ - else \ - if (value_ > node -> value) \ - { \ - under_ += node -> under; \ - if (node -> right) { node += node -> right; continue; } \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> right = symbol_ - node; \ - } \ - else \ - { \ - count_ += node -> count; \ - under_ += node -> under - node -> count; \ - node -> under += update; \ - node -> count += update; \ - symbol_ = node; \ - } \ - break; \ - } \ - } \ -} - -#ifdef ENET_CONTEXT_EXCLUSION -static const ENetSymbol emptyContext = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -#define ENET_CONTEXT_WALK(context, body) \ -{ \ - const ENetSymbol * node = (context) + (context) -> symbols; \ - const ENetSymbol * stack [256]; \ - size_t stackSize = 0; \ - while (node -> left) \ - { \ - stack [stackSize ++] = node; \ - node += node -> left; \ - } \ - for (;;) \ - { \ - body; \ - if (node -> right) \ - { \ - node += node -> right; \ - while (node -> left) \ - { \ - stack [stackSize ++] = node; \ - node += node -> left; \ - } \ - } \ - else \ - if (stackSize <= 0) \ - break; \ - else \ - node = stack [-- stackSize]; \ - } \ -} - -#define ENET_CONTEXT_ENCODE_EXCLUDE(context, value_, under, total, minimum) \ -ENET_CONTEXT_WALK(context, { \ - if (node -> value != value_) \ - { \ - enet_uint16 parentCount = rangeCoder -> symbols [node -> parent].count + minimum; \ - if (node -> value < value_) \ - under -= parentCount; \ - total -= parentCount; \ - } \ -}) -#endif - -size_t -enet_range_coder_compress (void * context, const ENetBuffer * inBuffers, size_t inBufferCount, size_t inLimit, enet_uint8 * outData, size_t outLimit) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; - enet_uint8 * outStart = outData, * outEnd = & outData [outLimit]; - const enet_uint8 * inData, * inEnd; - enet_uint32 encodeLow = 0, encodeRange = ~0; - ENetSymbol * root; - enet_uint16 predicted = 0; - size_t order = 0, nextSymbol = 0; - - if (rangeCoder == NULL || inBufferCount <= 0 || inLimit <= 0) - return 0; - - inData = (const enet_uint8 *) inBuffers -> data; - inEnd = & inData [inBuffers -> dataLength]; - inBuffers ++; - inBufferCount --; - - ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM); - - for (;;) - { - ENetSymbol * subcontext, * symbol; -#ifdef ENET_CONTEXT_EXCLUSION - const ENetSymbol * childContext = & emptyContext; -#endif - enet_uint8 value; - enet_uint16 count, under, * parent = & predicted, total; - if (inData >= inEnd) - { - if (inBufferCount <= 0) - break; - inData = (const enet_uint8 *) inBuffers -> data; - inEnd = & inData [inBuffers -> dataLength]; - inBuffers ++; - inBufferCount --; - } - value = * inData ++; - - for (subcontext = & rangeCoder -> symbols [predicted]; - subcontext != root; -#ifdef ENET_CONTEXT_EXCLUSION - childContext = subcontext, -#endif - subcontext = & rangeCoder -> symbols [subcontext -> parent]) - { - ENET_CONTEXT_ENCODE (subcontext, symbol, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0); - * parent = symbol - rangeCoder -> symbols; - parent = & symbol -> parent; - total = subcontext -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > ENET_SUBCONTEXT_SYMBOL_DELTA + ENET_SUBCONTEXT_ESCAPE_DELTA) - ENET_CONTEXT_ENCODE_EXCLUDE (childContext, value, under, total, 0); -#endif - if (count > 0) - { - ENET_RANGE_CODER_ENCODE (subcontext -> escapes + under, count, total); - } - else - { - if (subcontext -> escapes > 0 && subcontext -> escapes < total) - ENET_RANGE_CODER_ENCODE (0, subcontext -> escapes, total); - subcontext -> escapes += ENET_SUBCONTEXT_ESCAPE_DELTA; - subcontext -> total += ENET_SUBCONTEXT_ESCAPE_DELTA; - } - subcontext -> total += ENET_SUBCONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || subcontext -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (subcontext, 0); - if (count > 0) goto nextInput; - } - - ENET_CONTEXT_ENCODE (root, symbol, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM); - * parent = symbol - rangeCoder -> symbols; - parent = & symbol -> parent; - total = root -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > ENET_SUBCONTEXT_SYMBOL_DELTA + ENET_SUBCONTEXT_ESCAPE_DELTA) - ENET_CONTEXT_ENCODE_EXCLUDE (childContext, value, under, total, ENET_CONTEXT_SYMBOL_MINIMUM); -#endif - ENET_RANGE_CODER_ENCODE (root -> escapes + under, count, total); - root -> total += ENET_CONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_CONTEXT_SYMBOL_DELTA + ENET_CONTEXT_SYMBOL_MINIMUM || root -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (root, ENET_CONTEXT_SYMBOL_MINIMUM); - - nextInput: - if (order >= ENET_SUBCONTEXT_ORDER) - predicted = rangeCoder -> symbols [predicted].parent; - else - order ++; - ENET_RANGE_CODER_FREE_SYMBOLS; - } - - ENET_RANGE_CODER_FLUSH; - - return (size_t) (outData - outStart); -} - -#define ENET_RANGE_CODER_SEED \ -{ \ - if (inData < inEnd) decodeCode |= * inData ++ << 24; \ - if (inData < inEnd) decodeCode |= * inData ++ << 16; \ - if (inData < inEnd) decodeCode |= * inData ++ << 8; \ - if (inData < inEnd) decodeCode |= * inData ++; \ -} - -#define ENET_RANGE_CODER_READ(total) ((decodeCode - decodeLow) / (decodeRange /= (total))) - -#define ENET_RANGE_CODER_DECODE(under, count, total) \ -{ \ - decodeLow += (under) * decodeRange; \ - decodeRange *= (count); \ - for (;;) \ - { \ - if((decodeLow ^ (decodeLow + decodeRange)) >= ENET_RANGE_CODER_TOP) \ - { \ - if(decodeRange >= ENET_RANGE_CODER_BOTTOM) break; \ - decodeRange = -decodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \ - } \ - decodeCode <<= 8; \ - if (inData < inEnd) \ - decodeCode |= * inData ++; \ - decodeRange <<= 8; \ - decodeLow <<= 8; \ - } \ -} - -#define ENET_CONTEXT_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, createRoot, visitNode, createRight, createLeft) \ -{ \ - under_ = 0; \ - count_ = minimum; \ - if (! (context) -> symbols) \ - { \ - createRoot; \ - } \ - else \ - { \ - ENetSymbol * node = (context) + (context) -> symbols; \ - for (;;) \ - { \ - enet_uint16 after = under_ + node -> under + (node -> value + 1)*minimum, before = node -> count + minimum; \ - visitNode; \ - if (code >= after) \ - { \ - under_ += node -> under; \ - if (node -> right) { node += node -> right; continue; } \ - createRight; \ - } \ - else \ - if (code < after - before) \ - { \ - node -> under += update; \ - if (node -> left) { node += node -> left; continue; } \ - createLeft; \ - } \ - else \ - { \ - value_ = node -> value; \ - count_ += node -> count; \ - under_ = after - before; \ - node -> under += update; \ - node -> count += update; \ - symbol_ = node; \ - } \ - break; \ - } \ - } \ -} - -#define ENET_CONTEXT_TRY_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, exclude) \ -ENET_CONTEXT_DECODE (context, symbol_, code, value_, under_, count_, update, minimum, return 0, exclude (node -> value, after, before), return 0, return 0) - -#define ENET_CONTEXT_ROOT_DECODE(context, symbol_, code, value_, under_, count_, update, minimum, exclude) \ -ENET_CONTEXT_DECODE (context, symbol_, code, value_, under_, count_, update, minimum, \ - { \ - value_ = code / minimum; \ - under_ = code - code%minimum; \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - (context) -> symbols = symbol_ - (context); \ - }, \ - exclude (node -> value, after, before), \ - { \ - value_ = node->value + 1 + (code - after)/minimum; \ - under_ = code - (code - after)%minimum; \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> right = symbol_ - node; \ - }, \ - { \ - value_ = node->value - 1 - (after - before - code - 1)/minimum; \ - under_ = code - (after - before - code - 1)%minimum; \ - ENET_SYMBOL_CREATE (symbol_, value_, update); \ - node -> left = symbol_ - node; \ - }) \ - -#ifdef ENET_CONTEXT_EXCLUSION -typedef struct _ENetExclude -{ - enet_uint8 value; - enet_uint16 under; -} ENetExclude; - -#define ENET_CONTEXT_DECODE_EXCLUDE(context, total, minimum) \ -{ \ - enet_uint16 under = 0; \ - nextExclude = excludes; \ - ENET_CONTEXT_WALK (context, { \ - under += rangeCoder -> symbols [node -> parent].count + minimum; \ - nextExclude -> value = node -> value; \ - nextExclude -> under = under; \ - nextExclude ++; \ - }); \ - total -= under; \ -} - -#define ENET_CONTEXT_EXCLUDED(value_, after, before) \ -{ \ - size_t low = 0, high = nextExclude - excludes; \ - for(;;) \ - { \ - size_t mid = (low + high) >> 1; \ - const ENetExclude * exclude = & excludes [mid]; \ - if (value_ < exclude -> value) \ - { \ - if (low + 1 < high) \ - { \ - high = mid; \ - continue; \ - } \ - if (exclude > excludes) \ - after -= exclude [-1].under; \ - } \ - else \ - { \ - if (value_ > exclude -> value) \ - { \ - if (low + 1 < high) \ - { \ - low = mid; \ - continue; \ - } \ - } \ - else \ - before = 0; \ - after -= exclude -> under; \ - } \ - break; \ - } \ -} -#endif - -#define ENET_CONTEXT_NOT_EXCLUDED(value_, after, before) - -size_t -enet_range_coder_decompress (void * context, const enet_uint8 * inData, size_t inLimit, enet_uint8 * outData, size_t outLimit) -{ - ENetRangeCoder * rangeCoder = (ENetRangeCoder *) context; - enet_uint8 * outStart = outData, * outEnd = & outData [outLimit]; - const enet_uint8 * inEnd = & inData [inLimit]; - enet_uint32 decodeLow = 0, decodeCode = 0, decodeRange = ~0; - ENetSymbol * root; - enet_uint16 predicted = 0; - size_t order = 0, nextSymbol = 0; -#ifdef ENET_CONTEXT_EXCLUSION - ENetExclude excludes [256]; - ENetExclude * nextExclude = excludes; -#endif - - if (rangeCoder == NULL || inLimit <= 0) - return 0; - - ENET_CONTEXT_CREATE (root, ENET_CONTEXT_ESCAPE_MINIMUM, ENET_CONTEXT_SYMBOL_MINIMUM); - - ENET_RANGE_CODER_SEED; - - for (;;) - { - ENetSymbol * subcontext, * symbol, * patch; -#ifdef ENET_CONTEXT_EXCLUSION - const ENetSymbol * childContext = & emptyContext; -#endif - enet_uint8 value = 0; - enet_uint16 code, under, count, bottom, * parent = & predicted, total; - - for (subcontext = & rangeCoder -> symbols [predicted]; - subcontext != root; -#ifdef ENET_CONTEXT_EXCLUSION - childContext = subcontext, -#endif - subcontext = & rangeCoder -> symbols [subcontext -> parent]) - { - if (subcontext -> escapes <= 0) - continue; - total = subcontext -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - ENET_CONTEXT_DECODE_EXCLUDE (childContext, total, 0); -#endif - if (subcontext -> escapes >= total) - continue; - code = ENET_RANGE_CODER_READ (total); - if (code < subcontext -> escapes) - { - ENET_RANGE_CODER_DECODE (0, subcontext -> escapes, total); - continue; - } - code -= subcontext -> escapes; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - { - ENET_CONTEXT_TRY_DECODE (subcontext, symbol, code, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0, ENET_CONTEXT_EXCLUDED); - } - else -#endif - { - ENET_CONTEXT_TRY_DECODE (subcontext, symbol, code, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0, ENET_CONTEXT_NOT_EXCLUDED); - } - bottom = symbol - rangeCoder -> symbols; - ENET_RANGE_CODER_DECODE (subcontext -> escapes + under, count, total); - subcontext -> total += ENET_SUBCONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || subcontext -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (subcontext, 0); - goto patchContexts; - } - - total = root -> total; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - ENET_CONTEXT_DECODE_EXCLUDE (childContext, total, ENET_CONTEXT_SYMBOL_MINIMUM); -#endif - code = ENET_RANGE_CODER_READ (total); - if (code < root -> escapes) - { - ENET_RANGE_CODER_DECODE (0, root -> escapes, total); - break; - } - code -= root -> escapes; -#ifdef ENET_CONTEXT_EXCLUSION - if (childContext -> total > 0) - { - ENET_CONTEXT_ROOT_DECODE (root, symbol, code, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM, ENET_CONTEXT_EXCLUDED); - } - else -#endif - { - ENET_CONTEXT_ROOT_DECODE (root, symbol, code, value, under, count, ENET_CONTEXT_SYMBOL_DELTA, ENET_CONTEXT_SYMBOL_MINIMUM, ENET_CONTEXT_NOT_EXCLUDED); - } - bottom = symbol - rangeCoder -> symbols; - ENET_RANGE_CODER_DECODE (root -> escapes + under, count, total); - root -> total += ENET_CONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_CONTEXT_SYMBOL_DELTA + ENET_CONTEXT_SYMBOL_MINIMUM || root -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (root, ENET_CONTEXT_SYMBOL_MINIMUM); - - patchContexts: - for (patch = & rangeCoder -> symbols [predicted]; - patch != subcontext; - patch = & rangeCoder -> symbols [patch -> parent]) - { - ENET_CONTEXT_ENCODE (patch, symbol, value, under, count, ENET_SUBCONTEXT_SYMBOL_DELTA, 0); - * parent = symbol - rangeCoder -> symbols; - parent = & symbol -> parent; - if (count <= 0) - { - patch -> escapes += ENET_SUBCONTEXT_ESCAPE_DELTA; - patch -> total += ENET_SUBCONTEXT_ESCAPE_DELTA; - } - patch -> total += ENET_SUBCONTEXT_SYMBOL_DELTA; - if (count > 0xFF - 2*ENET_SUBCONTEXT_SYMBOL_DELTA || patch -> total > ENET_RANGE_CODER_BOTTOM - 0x100) - ENET_CONTEXT_RESCALE (patch, 0); - } - * parent = bottom; - - ENET_RANGE_CODER_OUTPUT (value); - - if (order >= ENET_SUBCONTEXT_ORDER) - predicted = rangeCoder -> symbols [predicted].parent; - else - order ++; - ENET_RANGE_CODER_FREE_SYMBOLS; - } - - return (size_t) (outData - outStart); -} - -/** @defgroup host ENet host functions - @{ -*/ - -/** Sets the packet compressor the host should use to the default range coder. - @param host host to enable the range coder for - @returns 0 on success, < 0 on failure -*/ -int -enet_host_compress_with_range_coder (ENetHost * host) -{ - ENetCompressor compressor; - memset (& compressor, 0, sizeof (compressor)); - compressor.context = enet_range_coder_create(); - if (compressor.context == NULL) - return -1; - compressor.compress = enet_range_coder_compress; - compressor.decompress = enet_range_coder_decompress; - compressor.destroy = enet_range_coder_destroy; - enet_host_compress (host, & compressor); - return 0; -} - -/** @} */ - - diff --git a/polymer-perf/eduke32/source/enet/src/host.c b/polymer-perf/eduke32/source/enet/src/host.c deleted file mode 100644 index 8bb2433fe..000000000 --- a/polymer-perf/eduke32/source/enet/src/host.c +++ /dev/null @@ -1,479 +0,0 @@ -/** - @file host.c - @brief ENet host management functions -*/ -#define ENET_BUILDING_LIB 1 -#include -#include -#include "enet/enet.h" - -/** @defgroup host ENet host functions - @{ -*/ - -/** Creates a host for communicating to peers. - - @param address the address at which other peers may connect to this host. If NULL, then no peers may connect to the host. - @param peerCount the maximum number of peers that should be allocated for the host. - @param channelLimit the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT - @param incomingBandwidth downstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. - @param outgoingBandwidth upstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. - - @returns the host on success and NULL on failure - - @remarks ENet will strategically drop packets on specific sides of a connection between hosts - to ensure the host's bandwidth is not overwhelmed. The bandwidth parameters also determine - the window size of a connection which limits the amount of reliable packets that may be in transit - at any given time. -*/ -ENetHost * -enet_host_create (const ENetAddress * address, size_t peerCount, size_t channelLimit, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) -{ - ENetHost * host; - ENetPeer * currentPeer; - - if (peerCount > ENET_PROTOCOL_MAXIMUM_PEER_ID) - return NULL; - - host = (ENetHost *) enet_malloc (sizeof (ENetHost)); - if (host == NULL) - return NULL; - - host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer)); - if (host -> peers == NULL) - { - enet_free (host); - - return NULL; - } - memset (host -> peers, 0, peerCount * sizeof (ENetPeer)); - - host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM); - if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, address) < 0)) - { - if (host -> socket != ENET_SOCKET_NULL) - enet_socket_destroy (host -> socket); - - enet_free (host -> peers); - enet_free (host); - - return NULL; - } - - enet_socket_set_option (host -> socket, ENET_SOCKOPT_NONBLOCK, 1); - enet_socket_set_option (host -> socket, ENET_SOCKOPT_BROADCAST, 1); - enet_socket_set_option (host -> socket, ENET_SOCKOPT_RCVBUF, ENET_HOST_RECEIVE_BUFFER_SIZE); - enet_socket_set_option (host -> socket, ENET_SOCKOPT_SNDBUF, ENET_HOST_SEND_BUFFER_SIZE); - - if (address != NULL) - host -> address = * address; - - if (! channelLimit || channelLimit > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT; - else - if (channelLimit < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT; - - host -> randomSeed = (enet_uint32) time(NULL) + (enet_uint32) (size_t) host; - host -> randomSeed = (host -> randomSeed << 16) | (host -> randomSeed >> 16); - host -> channelLimit = channelLimit; - host -> incomingBandwidth = incomingBandwidth; - host -> outgoingBandwidth = outgoingBandwidth; - host -> bandwidthThrottleEpoch = 0; - host -> recalculateBandwidthLimits = 0; - host -> mtu = ENET_HOST_DEFAULT_MTU; - host -> peerCount = peerCount; - host -> commandCount = 0; - host -> bufferCount = 0; - host -> checksum = NULL; - host -> receivedAddress.host = ENET_HOST_ANY; - host -> receivedAddress.port = 0; - host -> receivedData = NULL; - host -> receivedDataLength = 0; - - host -> totalSentData = 0; - host -> totalSentPackets = 0; - host -> totalReceivedData = 0; - host -> totalReceivedPackets = 0; - - host -> compressor.context = NULL; - host -> compressor.compress = NULL; - host -> compressor.decompress = NULL; - host -> compressor.destroy = NULL; - - enet_list_clear (& host -> dispatchQueue); - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - currentPeer -> host = host; - currentPeer -> incomingPeerID = currentPeer - host -> peers; - currentPeer -> outgoingSessionID = currentPeer -> incomingSessionID = 0xFF; - currentPeer -> data = NULL; - - enet_list_clear (& currentPeer -> acknowledgements); - enet_list_clear (& currentPeer -> sentReliableCommands); - enet_list_clear (& currentPeer -> sentUnreliableCommands); - enet_list_clear (& currentPeer -> outgoingReliableCommands); - enet_list_clear (& currentPeer -> outgoingUnreliableCommands); - enet_list_clear (& currentPeer -> dispatchedCommands); - - enet_peer_reset (currentPeer); - } - - return host; -} - -/** Destroys the host and all resources associated with it. - @param host pointer to the host to destroy -*/ -void -enet_host_destroy (ENetHost * host) -{ - ENetPeer * currentPeer; - - enet_socket_destroy (host -> socket); - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - enet_peer_reset (currentPeer); - } - - if (host -> compressor.context != NULL && host -> compressor.destroy) - (* host -> compressor.destroy) (host -> compressor.context); - - enet_free (host -> peers); - enet_free (host); -} - -/** Initiates a connection to a foreign host. - @param host host seeking the connection - @param address destination for the connection - @param channelCount number of channels to allocate - @param data user data supplied to the receiving host - @returns a peer representing the foreign host on success, NULL on failure - @remarks The peer returned will have not completed the connection until enet_host_service() - notifies of an ENET_EVENT_TYPE_CONNECT event for the peer. -*/ -ENetPeer * -enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelCount, enet_uint32 data) -{ - ENetPeer * currentPeer; - ENetChannel * channel; - ENetProtocol command; - - if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT) - channelCount = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT; - else - if (channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - channelCount = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT; - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED) - break; - } - - if (currentPeer >= & host -> peers [host -> peerCount]) - return NULL; - - currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel)); - if (currentPeer -> channels == NULL) - return NULL; - currentPeer -> channelCount = channelCount; - currentPeer -> state = ENET_PEER_STATE_CONNECTING; - currentPeer -> address = * address; - currentPeer -> connectID = ++ host -> randomSeed; - - if (host -> outgoingBandwidth == 0) - currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - currentPeer -> windowSize = (host -> outgoingBandwidth / - ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - for (channel = currentPeer -> channels; - channel < & currentPeer -> channels [channelCount]; - ++ channel) - { - channel -> outgoingReliableSequenceNumber = 0; - channel -> outgoingUnreliableSequenceNumber = 0; - channel -> incomingReliableSequenceNumber = 0; - - enet_list_clear (& channel -> incomingReliableCommands); - enet_list_clear (& channel -> incomingUnreliableCommands); - - channel -> usedReliableWindows = 0; - memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows)); - } - - command.header.command = ENET_PROTOCOL_COMMAND_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - command.connect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID); - command.connect.incomingSessionID = currentPeer -> incomingSessionID; - command.connect.outgoingSessionID = currentPeer -> outgoingSessionID; - command.connect.mtu = ENET_HOST_TO_NET_32 (currentPeer -> mtu); - command.connect.windowSize = ENET_HOST_TO_NET_32 (currentPeer -> windowSize); - command.connect.channelCount = ENET_HOST_TO_NET_32 (channelCount); - command.connect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth); - command.connect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); - command.connect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval); - command.connect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration); - command.connect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration); - command.connect.connectID = currentPeer -> connectID; - command.connect.data = ENET_HOST_TO_NET_32 (data); - - enet_peer_queue_outgoing_command (currentPeer, & command, NULL, 0, 0); - - return currentPeer; -} - -/** Queues a packet to be sent to all peers associated with the host. - @param host host on which to broadcast the packet - @param channelID channel on which to broadcast - @param packet packet to broadcast -*/ -void -enet_host_broadcast (ENetHost * host, enet_uint8 channelID, ENetPacket * packet) -{ - ENetPeer * currentPeer; - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state != ENET_PEER_STATE_CONNECTED) - continue; - - enet_peer_send (currentPeer, channelID, packet); - } - - if (packet -> referenceCount == 0) - enet_packet_destroy (packet); -} - -/** Sets the packet compressor the host should use to compress and decompress packets. - @param host host to enable or disable compression for - @param compressor callbacks for for the packet compressor; if NULL, then compression is disabled -*/ -void -enet_host_compress (ENetHost * host, const ENetCompressor * compressor) -{ - if (host -> compressor.context != NULL && host -> compressor.destroy) - (* host -> compressor.destroy) (host -> compressor.context); - - if (compressor) - host -> compressor = * compressor; - else - host -> compressor.context = NULL; -} - -/** Limits the maximum allowed channels of future incoming connections. - @param host host to limit - @param channelLimit the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT -*/ -void -enet_host_channel_limit (ENetHost * host, size_t channelLimit) -{ - if (! channelLimit || channelLimit > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT; - else - if (channelLimit < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT) - channelLimit = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT; - - host -> channelLimit = channelLimit; -} - - -/** Adjusts the bandwidth limits of a host. - @param host host to adjust - @param incomingBandwidth new incoming bandwidth - @param outgoingBandwidth new outgoing bandwidth - @remarks the incoming and outgoing bandwidth parameters are identical in function to those - specified in enet_host_create(). -*/ -void -enet_host_bandwidth_limit (ENetHost * host, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) -{ - host -> incomingBandwidth = incomingBandwidth; - host -> outgoingBandwidth = outgoingBandwidth; - host -> recalculateBandwidthLimits = 1; -} - -void -enet_host_bandwidth_throttle (ENetHost * host) -{ - enet_uint32 timeCurrent = enet_time_get (), - elapsedTime = timeCurrent - host -> bandwidthThrottleEpoch, - peersTotal = 0, - dataTotal = 0, - peersRemaining, - bandwidth, - throttle = 0, - bandwidthLimit = 0; - int needsAdjustment; - ENetPeer * peer; - ENetProtocol command; - - if (elapsedTime < ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL) - return; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - continue; - - ++ peersTotal; - dataTotal += peer -> outgoingDataTotal; - } - - if (peersTotal == 0) - return; - - peersRemaining = peersTotal; - needsAdjustment = 1; - - if (host -> outgoingBandwidth == 0) - bandwidth = ~0; - else - bandwidth = (host -> outgoingBandwidth * elapsedTime) / 1000; - - while (peersRemaining > 0 && needsAdjustment != 0) - { - needsAdjustment = 0; - - if (dataTotal < bandwidth) - throttle = ENET_PEER_PACKET_THROTTLE_SCALE; - else - throttle = (bandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / dataTotal; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - enet_uint32 peerBandwidth; - - if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || - peer -> incomingBandwidth == 0 || - peer -> outgoingBandwidthThrottleEpoch == timeCurrent) - continue; - - peerBandwidth = (peer -> incomingBandwidth * elapsedTime) / 1000; - if ((throttle * peer -> outgoingDataTotal) / ENET_PEER_PACKET_THROTTLE_SCALE <= peerBandwidth) - continue; - - peer -> packetThrottleLimit = (peerBandwidth * - ENET_PEER_PACKET_THROTTLE_SCALE) / peer -> outgoingDataTotal; - - if (peer -> packetThrottleLimit == 0) - peer -> packetThrottleLimit = 1; - - if (peer -> packetThrottle > peer -> packetThrottleLimit) - peer -> packetThrottle = peer -> packetThrottleLimit; - - peer -> outgoingBandwidthThrottleEpoch = timeCurrent; - - - needsAdjustment = 1; - -- peersRemaining; - bandwidth -= peerBandwidth; - dataTotal -= peerBandwidth; - } - } - - if (peersRemaining > 0) - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || - peer -> outgoingBandwidthThrottleEpoch == timeCurrent) - continue; - - peer -> packetThrottleLimit = throttle; - - if (peer -> packetThrottle > peer -> packetThrottleLimit) - peer -> packetThrottle = peer -> packetThrottleLimit; - } - - if (host -> recalculateBandwidthLimits) - { - host -> recalculateBandwidthLimits = 0; - - peersRemaining = peersTotal; - bandwidth = host -> incomingBandwidth; - needsAdjustment = 1; - - if (bandwidth == 0) - bandwidthLimit = 0; - else - while (peersRemaining > 0 && needsAdjustment != 0) - { - needsAdjustment = 0; - bandwidthLimit = bandwidth / peersRemaining; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || - peer -> incomingBandwidthThrottleEpoch == timeCurrent) - continue; - - if (peer -> outgoingBandwidth > 0 && - peer -> outgoingBandwidth >= bandwidthLimit) - continue; - - peer -> incomingBandwidthThrottleEpoch = timeCurrent; - - needsAdjustment = 1; - -- peersRemaining; - bandwidth -= peer -> outgoingBandwidth; - } - } - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - continue; - - command.header.command = ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - command.bandwidthLimit.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); - - if (peer -> incomingBandwidthThrottleEpoch == timeCurrent) - command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (peer -> outgoingBandwidth); - else - command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (bandwidthLimit); - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); - } - } - - host -> bandwidthThrottleEpoch = timeCurrent; - - for (peer = host -> peers; - peer < & host -> peers [host -> peerCount]; - ++ peer) - { - peer -> incomingDataTotal = 0; - peer -> outgoingDataTotal = 0; - } -} - -/** @} */ diff --git a/polymer-perf/eduke32/source/enet/src/list.c b/polymer-perf/eduke32/source/enet/src/list.c deleted file mode 100644 index 1c1a8dfaa..000000000 --- a/polymer-perf/eduke32/source/enet/src/list.c +++ /dev/null @@ -1,75 +0,0 @@ -/** - @file list.c - @brief ENet linked list functions -*/ -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -/** - @defgroup list ENet linked list utility functions - @ingroup private - @{ -*/ -void -enet_list_clear (ENetList * list) -{ - list -> sentinel.next = & list -> sentinel; - list -> sentinel.previous = & list -> sentinel; -} - -ENetListIterator -enet_list_insert (ENetListIterator position, void * data) -{ - ENetListIterator result = (ENetListIterator) data; - - result -> previous = position -> previous; - result -> next = position; - - result -> previous -> next = result; - position -> previous = result; - - return result; -} - -void * -enet_list_remove (ENetListIterator position) -{ - position -> previous -> next = position -> next; - position -> next -> previous = position -> previous; - - return position; -} - -ENetListIterator -enet_list_move (ENetListIterator position, void * dataFirst, void * dataLast) -{ - ENetListIterator first = (ENetListIterator) dataFirst, - last = (ENetListIterator) dataLast; - - first -> previous -> next = last -> next; - last -> next -> previous = first -> previous; - - first -> previous = position -> previous; - last -> next = position; - - first -> previous -> next = first; - position -> previous = last; - - return first; -} - -size_t -enet_list_size (ENetList * list) -{ - size_t size = 0; - ENetListIterator position; - - for (position = enet_list_begin (list); - position != enet_list_end (list); - position = enet_list_next (position)) - ++ size; - - return size; -} - -/** @} */ diff --git a/polymer-perf/eduke32/source/enet/src/packet.c b/polymer-perf/eduke32/source/enet/src/packet.c deleted file mode 100644 index 2fc9a10e8..000000000 --- a/polymer-perf/eduke32/source/enet/src/packet.c +++ /dev/null @@ -1,157 +0,0 @@ -/** - @file packet.c - @brief ENet packet management functions -*/ -#include -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -/** @defgroup Packet ENet packet functions - @{ -*/ - -/** Creates a packet that may be sent to a peer. - @param dataContents initial contents of the packet's data; the packet's data will remain uninitialized if dataContents is NULL. - @param dataLength size of the data allocated for this packet - @param flags flags for this packet as described for the ENetPacket structure. - @returns the packet on success, NULL on failure -*/ -ENetPacket * -enet_packet_create (const void * data, size_t dataLength, enet_uint32 flags) -{ - ENetPacket * packet = (ENetPacket *) enet_malloc (sizeof (ENetPacket)); - if (packet == NULL) - return NULL; - - if (flags & ENET_PACKET_FLAG_NO_ALLOCATE) - packet -> data = (enet_uint8 *) data; - else - { - packet -> data = (enet_uint8 *) enet_malloc (dataLength); - if (packet -> data == NULL) - { - enet_free (packet); - return NULL; - } - - if (data != NULL) - memcpy (packet -> data, data, dataLength); - } - - packet -> referenceCount = 0; - packet -> flags = flags; - packet -> dataLength = dataLength; - packet -> freeCallback = NULL; - - return packet; -} - -/** Destroys the packet and deallocates its data. - @param packet packet to be destroyed -*/ -void -enet_packet_destroy (ENetPacket * packet) -{ - if (packet -> freeCallback != NULL) - (* packet -> freeCallback) (packet); - if (! (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE)) - enet_free (packet -> data); - enet_free (packet); -} - -/** Attempts to resize the data in the packet to length specified in the - dataLength parameter - @param packet packet to resize - @param dataLength new size for the packet data - @returns 0 on success, < 0 on failure -*/ -int -enet_packet_resize (ENetPacket * packet, size_t dataLength) -{ - enet_uint8 * newData; - - if (dataLength <= packet -> dataLength || (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE)) - { - packet -> dataLength = dataLength; - - return 0; - } - - newData = (enet_uint8 *) enet_malloc (dataLength); - if (newData == NULL) - return -1; - - memcpy (newData, packet -> data, packet -> dataLength); - enet_free (packet -> data); - - packet -> data = newData; - packet -> dataLength = dataLength; - - return 0; -} - -static int initializedCRC32 = 0; -static enet_uint32 crcTable [256]; - -static enet_uint32 -reflect_crc (int val, int bits) -{ - int result = 0, bit; - - for (bit = 0; bit < bits; bit ++) - { - if(val & 1) result |= 1 << (bits - 1 - bit); - val >>= 1; - } - - return result; -} - -static void -initialize_crc32 () -{ - int byte; - - for (byte = 0; byte < 256; ++ byte) - { - enet_uint32 crc = reflect_crc (byte, 8) << 24; - int offset; - - for(offset = 0; offset < 8; ++ offset) - { - if (crc & 0x80000000) - crc = (crc << 1) ^ 0x04c11db7; - else - crc <<= 1; - } - - crcTable [byte] = reflect_crc (crc, 32); - } - - initializedCRC32 = 1; -} - -enet_uint32 -enet_crc32 (const ENetBuffer * buffers, size_t bufferCount) -{ - enet_uint32 crc = 0xFFFFFFFF; - - if (! initializedCRC32) initialize_crc32 (); - - while (bufferCount -- > 0) - { - const enet_uint8 * data = (const enet_uint8 *) buffers -> data, - * dataEnd = & data [buffers -> dataLength]; - - while (data < dataEnd) - { - crc = (crc >> 8) ^ crcTable [(crc & 0xFF) ^ *data++]; - } - - ++ buffers; - } - - return ENET_HOST_TO_NET_32 (~ crc); -} - -/** @} */ diff --git a/polymer-perf/eduke32/source/enet/src/peer.c b/polymer-perf/eduke32/source/enet/src/peer.c deleted file mode 100644 index e1c117f89..000000000 --- a/polymer-perf/eduke32/source/enet/src/peer.c +++ /dev/null @@ -1,818 +0,0 @@ -/** - @file peer.c - @brief ENet peer management functions -*/ -#include -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -/** @defgroup peer ENet peer functions - @{ -*/ - -/** Configures throttle parameter for a peer. - - Unreliable packets are dropped by ENet in response to the varying conditions - of the Internet connection to the peer. The throttle represents a probability - that an unreliable packet should not be dropped and thus sent by ENet to the peer. - The lowest mean round trip time from the sending of a reliable packet to the - receipt of its acknowledgement is measured over an amount of time specified by - the interval parameter in milliseconds. If a measured round trip time happens to - be significantly less than the mean round trip time measured over the interval, - then the throttle probability is increased to allow more traffic by an amount - specified in the acceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE - constant. If a measured round trip time happens to be significantly greater than - the mean round trip time measured over the interval, then the throttle probability - is decreased to limit traffic by an amount specified in the deceleration parameter, which - is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. When the throttle has - a value of ENET_PEER_PACKET_THROTTLE_SCALE, on unreliable packets are dropped by - ENet, and so 100% of all unreliable packets will be sent. When the throttle has a - value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable - packets will be sent. Intermediate values for the throttle represent intermediate - probabilities between 0% and 100% of unreliable packets being sent. The bandwidth - limits of the local and foreign hosts are taken into account to determine a - sensible limit for the throttle probability above which it should not raise even in - the best of conditions. - - @param peer peer to configure - @param interval interval, in milliseconds, over which to measure lowest mean RTT; the default value is ENET_PEER_PACKET_THROTTLE_INTERVAL. - @param acceleration rate at which to increase the throttle probability as mean RTT declines - @param deceleration rate at which to decrease the throttle probability as mean RTT increases -*/ -void -enet_peer_throttle_configure (ENetPeer * peer, enet_uint32 interval, enet_uint32 acceleration, enet_uint32 deceleration) -{ - ENetProtocol command; - - peer -> packetThrottleInterval = interval; - peer -> packetThrottleAcceleration = acceleration; - peer -> packetThrottleDeceleration = deceleration; - - command.header.command = ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - - command.throttleConfigure.packetThrottleInterval = ENET_HOST_TO_NET_32 (interval); - command.throttleConfigure.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (acceleration); - command.throttleConfigure.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (deceleration); - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); -} - -int -enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt) -{ - if (peer -> lastRoundTripTime <= peer -> lastRoundTripTimeVariance) - { - peer -> packetThrottle = peer -> packetThrottleLimit; - } - else - if (rtt < peer -> lastRoundTripTime) - { - peer -> packetThrottle += peer -> packetThrottleAcceleration; - - if (peer -> packetThrottle > peer -> packetThrottleLimit) - peer -> packetThrottle = peer -> packetThrottleLimit; - - return 1; - } - else - if (rtt > peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance) - { - if (peer -> packetThrottle > peer -> packetThrottleDeceleration) - peer -> packetThrottle -= peer -> packetThrottleDeceleration; - else - peer -> packetThrottle = 0; - - return -1; - } - - return 0; -} - -/** Queues a packet to be sent. - @param peer destination for the packet - @param channelID channel on which to send - @param packet packet to send - @retval 0 on success - @retval < 0 on failure -*/ -int -enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet) -{ - ENetChannel * channel = & peer -> channels [channelID]; - ENetProtocol command; - size_t fragmentLength; - - if (peer -> state != ENET_PEER_STATE_CONNECTED || - channelID >= peer -> channelCount) - return -1; - - fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment); - if (peer -> host -> checksum != NULL) - fragmentLength -= sizeof(enet_uint32); - - if (packet -> dataLength > fragmentLength) - { - enet_uint16 startSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingReliableSequenceNumber + 1); - enet_uint32 fragmentCount = ENET_HOST_TO_NET_32 ((packet -> dataLength + fragmentLength - 1) / fragmentLength), - fragmentNumber, - fragmentOffset; - ENetList fragments; - ENetOutgoingCommand * fragment; - - enet_list_clear (& fragments); - - for (fragmentNumber = 0, - fragmentOffset = 0; - fragmentOffset < packet -> dataLength; - ++ fragmentNumber, - fragmentOffset += fragmentLength) - { - if (packet -> dataLength - fragmentOffset < fragmentLength) - fragmentLength = packet -> dataLength - fragmentOffset; - - fragment = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand)); - if (fragment == NULL) - { - while (! enet_list_empty (& fragments)) - { - fragment = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (& fragments)); - - enet_free (fragment); - } - - return -1; - } - - fragment -> fragmentOffset = fragmentOffset; - fragment -> fragmentLength = fragmentLength; - fragment -> packet = packet; - fragment -> command.header.command = ENET_PROTOCOL_COMMAND_SEND_FRAGMENT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - fragment -> command.header.channelID = channelID; - fragment -> command.sendFragment.startSequenceNumber = startSequenceNumber; - fragment -> command.sendFragment.dataLength = ENET_HOST_TO_NET_16 (fragmentLength); - fragment -> command.sendFragment.fragmentCount = fragmentCount; - fragment -> command.sendFragment.fragmentNumber = ENET_HOST_TO_NET_32 (fragmentNumber); - fragment -> command.sendFragment.totalLength = ENET_HOST_TO_NET_32 (packet -> dataLength); - fragment -> command.sendFragment.fragmentOffset = ENET_NET_TO_HOST_32 (fragmentOffset); - - enet_list_insert (enet_list_end (& fragments), fragment); - } - - packet -> referenceCount += fragmentNumber; - - while (! enet_list_empty (& fragments)) - { - fragment = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (& fragments)); - - enet_peer_setup_outgoing_command (peer, fragment); - } - - return 0; - } - - command.header.channelID = channelID; - - if (packet -> flags & ENET_PACKET_FLAG_RELIABLE) - { - command.header.command = ENET_PROTOCOL_COMMAND_SEND_RELIABLE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.sendReliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); - } - else - if (packet -> flags & ENET_PACKET_FLAG_UNSEQUENCED) - { - command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; - command.sendUnsequenced.unsequencedGroup = ENET_HOST_TO_NET_16 (peer -> outgoingUnsequencedGroup + 1); - command.sendUnsequenced.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); - } - else - if (channel -> outgoingUnreliableSequenceNumber >= 0xFFFF) - { - command.header.command = ENET_PROTOCOL_COMMAND_SEND_RELIABLE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.sendReliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); - } - else - { - command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE; - command.sendUnreliable.unreliableSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingUnreliableSequenceNumber + 1); - command.sendUnreliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); - } - - if (enet_peer_queue_outgoing_command (peer, & command, packet, 0, packet -> dataLength) == NULL) - return -1; - - return 0; -} - -/** Attempts to dequeue any incoming queued packet. - @param peer peer to dequeue packets from - @param channelID holds the channel ID of the channel the packet was received on success - @returns a pointer to the packet, or NULL if there are no available incoming queued packets -*/ -ENetPacket * -enet_peer_receive (ENetPeer * peer, enet_uint8 * channelID) -{ - ENetIncomingCommand * incomingCommand; - ENetPacket * packet; - - if (enet_list_empty (& peer -> dispatchedCommands)) - return NULL; - - incomingCommand = (ENetIncomingCommand *) enet_list_remove (enet_list_begin (& peer -> dispatchedCommands)); - - if (channelID != NULL) - * channelID = incomingCommand -> command.header.channelID; - - packet = incomingCommand -> packet; - - -- packet -> referenceCount; - - if (incomingCommand -> fragments != NULL) - enet_free (incomingCommand -> fragments); - - enet_free (incomingCommand); - - return packet; -} - -static void -enet_peer_reset_outgoing_commands (ENetList * queue) -{ - ENetOutgoingCommand * outgoingCommand; - - while (! enet_list_empty (queue)) - { - outgoingCommand = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (queue)); - - if (outgoingCommand -> packet != NULL) - { - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (outgoingCommand -> packet); - } - - enet_free (outgoingCommand); - } -} - -static void -enet_peer_reset_incoming_commands (ENetList * queue) -{ - ENetIncomingCommand * incomingCommand; - - while (! enet_list_empty (queue)) - { - incomingCommand = (ENetIncomingCommand *) enet_list_remove (enet_list_begin (queue)); - - if (incomingCommand -> packet != NULL) - { - -- incomingCommand -> packet -> referenceCount; - - if (incomingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (incomingCommand -> packet); - } - - if (incomingCommand -> fragments != NULL) - enet_free (incomingCommand -> fragments); - - enet_free (incomingCommand); - } -} - -void -enet_peer_reset_queues (ENetPeer * peer) -{ - ENetChannel * channel; - - if (peer -> needsDispatch) - { - enet_list_remove (& peer -> dispatchList); - - peer -> needsDispatch = 0; - } - - while (! enet_list_empty (& peer -> acknowledgements)) - enet_free (enet_list_remove (enet_list_begin (& peer -> acknowledgements))); - - enet_peer_reset_outgoing_commands (& peer -> sentReliableCommands); - enet_peer_reset_outgoing_commands (& peer -> sentUnreliableCommands); - enet_peer_reset_outgoing_commands (& peer -> outgoingReliableCommands); - enet_peer_reset_outgoing_commands (& peer -> outgoingUnreliableCommands); - enet_peer_reset_incoming_commands (& peer -> dispatchedCommands); - - if (peer -> channels != NULL && peer -> channelCount > 0) - { - for (channel = peer -> channels; - channel < & peer -> channels [peer -> channelCount]; - ++ channel) - { - enet_peer_reset_incoming_commands (& channel -> incomingReliableCommands); - enet_peer_reset_incoming_commands (& channel -> incomingUnreliableCommands); - } - - enet_free (peer -> channels); - } - - peer -> channels = NULL; - peer -> channelCount = 0; -} - -/** Forcefully disconnects a peer. - @param peer peer to forcefully disconnect - @remarks The foreign host represented by the peer is not notified of the disconnection and will timeout - on its connection to the local host. -*/ -void -enet_peer_reset (ENetPeer * peer) -{ - peer -> outgoingPeerID = ENET_PROTOCOL_MAXIMUM_PEER_ID; - peer -> connectID = 0; - - peer -> state = ENET_PEER_STATE_DISCONNECTED; - - peer -> incomingBandwidth = 0; - peer -> outgoingBandwidth = 0; - peer -> incomingBandwidthThrottleEpoch = 0; - peer -> outgoingBandwidthThrottleEpoch = 0; - peer -> incomingDataTotal = 0; - peer -> outgoingDataTotal = 0; - peer -> lastSendTime = 0; - peer -> lastReceiveTime = 0; - peer -> nextTimeout = 0; - peer -> earliestTimeout = 0; - peer -> packetLossEpoch = 0; - peer -> packetsSent = 0; - peer -> packetsLost = 0; - peer -> packetLoss = 0; - peer -> packetLossVariance = 0; - peer -> packetThrottle = ENET_PEER_DEFAULT_PACKET_THROTTLE; - peer -> packetThrottleLimit = ENET_PEER_PACKET_THROTTLE_SCALE; - peer -> packetThrottleCounter = 0; - peer -> packetThrottleEpoch = 0; - peer -> packetThrottleAcceleration = ENET_PEER_PACKET_THROTTLE_ACCELERATION; - peer -> packetThrottleDeceleration = ENET_PEER_PACKET_THROTTLE_DECELERATION; - peer -> packetThrottleInterval = ENET_PEER_PACKET_THROTTLE_INTERVAL; - peer -> lastRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; - peer -> lowestRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; - peer -> lastRoundTripTimeVariance = 0; - peer -> highestRoundTripTimeVariance = 0; - peer -> roundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; - peer -> roundTripTimeVariance = 0; - peer -> mtu = peer -> host -> mtu; - peer -> reliableDataInTransit = 0; - peer -> outgoingReliableSequenceNumber = 0; - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - peer -> incomingUnsequencedGroup = 0; - peer -> outgoingUnsequencedGroup = 0; - peer -> eventData = 0; - - memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); - - enet_peer_reset_queues (peer); -} - -/** Sends a ping request to a peer. - @param peer destination for the ping request - @remarks ping requests factor into the mean round trip time as designated by the - roundTripTime field in the ENetPeer structure. Enet automatically pings all connected - peers at regular intervals, however, this function may be called to ensure more - frequent ping requests. -*/ -void -enet_peer_ping (ENetPeer * peer) -{ - ENetProtocol command; - - if (peer -> state != ENET_PEER_STATE_CONNECTED) - return; - - command.header.command = ENET_PROTOCOL_COMMAND_PING | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - command.header.channelID = 0xFF; - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); -} - -/** Force an immediate disconnection from a peer. - @param peer peer to disconnect - @param data data describing the disconnection - @remarks No ENET_EVENT_DISCONNECT event will be generated. The foreign peer is not - guarenteed to receive the disconnect notification, and is reset immediately upon - return from this function. -*/ -void -enet_peer_disconnect_now (ENetPeer * peer, enet_uint32 data) -{ - ENetProtocol command; - - if (peer -> state == ENET_PEER_STATE_DISCONNECTED) - return; - - if (peer -> state != ENET_PEER_STATE_ZOMBIE && - peer -> state != ENET_PEER_STATE_DISCONNECTING) - { - enet_peer_reset_queues (peer); - - command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; - command.header.channelID = 0xFF; - command.disconnect.data = ENET_HOST_TO_NET_32 (data); - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); - - enet_host_flush (peer -> host); - } - - enet_peer_reset (peer); -} - -/** Request a disconnection from a peer. - @param peer peer to request a disconnection - @param data data describing the disconnection - @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() - once the disconnection is complete. -*/ -void -enet_peer_disconnect (ENetPeer * peer, enet_uint32 data) -{ - ENetProtocol command; - - if (peer -> state == ENET_PEER_STATE_DISCONNECTING || - peer -> state == ENET_PEER_STATE_DISCONNECTED || - peer -> state == ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT || - peer -> state == ENET_PEER_STATE_ZOMBIE) - return; - - enet_peer_reset_queues (peer); - - command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT; - command.header.channelID = 0xFF; - command.disconnect.data = ENET_HOST_TO_NET_32 (data); - - if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) - command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - else - command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; - - enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); - - if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) - peer -> state = ENET_PEER_STATE_DISCONNECTING; - else - { - enet_host_flush (peer -> host); - enet_peer_reset (peer); - } -} - -/** Request a disconnection from a peer, but only after all queued outgoing packets are sent. - @param peer peer to request a disconnection - @param data data describing the disconnection - @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() - once the disconnection is complete. -*/ -void -enet_peer_disconnect_later (ENetPeer * peer, enet_uint32 data) -{ - if ((peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) && - ! (enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && - enet_list_empty (& peer -> sentReliableCommands))) - { - peer -> state = ENET_PEER_STATE_DISCONNECT_LATER; - peer -> eventData = data; - } - else - enet_peer_disconnect (peer, data); -} - -ENetAcknowledgement * -enet_peer_queue_acknowledgement (ENetPeer * peer, const ENetProtocol * command, enet_uint16 sentTime) -{ - ENetAcknowledgement * acknowledgement; - - if (command -> header.channelID < peer -> channelCount) - { - ENetChannel * channel = & peer -> channels [command -> header.channelID]; - enet_uint16 reliableWindow = command -> header.reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE, - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - - if (command -> header.reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - reliableWindow += ENET_PEER_RELIABLE_WINDOWS; - - if (reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1 && reliableWindow <= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS) - return NULL; - } - - acknowledgement = (ENetAcknowledgement *) enet_malloc (sizeof (ENetAcknowledgement)); - if (acknowledgement == NULL) - return NULL; - - peer -> outgoingDataTotal += sizeof (ENetProtocolAcknowledge); - - acknowledgement -> sentTime = sentTime; - acknowledgement -> command = * command; - - enet_list_insert (enet_list_end (& peer -> acknowledgements), acknowledgement); - - return acknowledgement; -} - -void -enet_peer_setup_outgoing_command (ENetPeer * peer, ENetOutgoingCommand * outgoingCommand) -{ - ENetChannel * channel = & peer -> channels [outgoingCommand -> command.header.channelID]; - - peer -> outgoingDataTotal += enet_protocol_command_size (outgoingCommand -> command.header.command) + outgoingCommand -> fragmentLength; - - if (outgoingCommand -> command.header.channelID == 0xFF) - { - ++ peer -> outgoingReliableSequenceNumber; - - outgoingCommand -> reliableSequenceNumber = peer -> outgoingReliableSequenceNumber; - outgoingCommand -> unreliableSequenceNumber = 0; - } - else - if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) - { - ++ channel -> outgoingReliableSequenceNumber; - channel -> outgoingUnreliableSequenceNumber = 0; - - outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber; - outgoingCommand -> unreliableSequenceNumber = 0; - } - else - if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED) - { - ++ peer -> outgoingUnsequencedGroup; - - outgoingCommand -> reliableSequenceNumber = 0; - outgoingCommand -> unreliableSequenceNumber = 0; - } - else - { - ++ channel -> outgoingUnreliableSequenceNumber; - - outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber; - outgoingCommand -> unreliableSequenceNumber = channel -> outgoingUnreliableSequenceNumber; - } - - outgoingCommand -> sendAttempts = 0; - outgoingCommand -> sentTime = 0; - outgoingCommand -> roundTripTimeout = 0; - outgoingCommand -> roundTripTimeoutLimit = 0; - outgoingCommand -> command.header.reliableSequenceNumber = ENET_HOST_TO_NET_16 (outgoingCommand -> reliableSequenceNumber); - - if (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) - enet_list_insert (enet_list_end (& peer -> outgoingReliableCommands), outgoingCommand); - else - enet_list_insert (enet_list_end (& peer -> outgoingUnreliableCommands), outgoingCommand); -} - -ENetOutgoingCommand * -enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 offset, enet_uint16 length) -{ - ENetOutgoingCommand * outgoingCommand = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand)); - if (outgoingCommand == NULL) - return NULL; - - outgoingCommand -> command = * command; - outgoingCommand -> fragmentOffset = offset; - outgoingCommand -> fragmentLength = length; - outgoingCommand -> packet = packet; - if (packet != NULL) - ++ packet -> referenceCount; - - enet_peer_setup_outgoing_command (peer, outgoingCommand); - - return outgoingCommand; -} - -void -enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * channel) -{ - ENetListIterator currentCommand; - - for (currentCommand = enet_list_begin (& channel -> incomingUnreliableCommands); - currentCommand != enet_list_end (& channel -> incomingUnreliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE && - incomingCommand -> reliableSequenceNumber != channel -> incomingReliableSequenceNumber) - break; - } - - if (currentCommand == enet_list_begin (& channel -> incomingUnreliableCommands)) - return; - - enet_list_move (enet_list_end (& peer -> dispatchedCommands), enet_list_begin (& channel -> incomingUnreliableCommands), enet_list_previous (currentCommand)); - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } -} - -void -enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * channel) -{ - ENetListIterator currentCommand; - - for (currentCommand = enet_list_begin (& channel -> incomingReliableCommands); - currentCommand != enet_list_end (& channel -> incomingReliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - if (incomingCommand -> fragmentsRemaining > 0 || - incomingCommand -> reliableSequenceNumber != (enet_uint16) (channel -> incomingReliableSequenceNumber + 1)) - break; - - channel -> incomingReliableSequenceNumber = incomingCommand -> reliableSequenceNumber; - - if (incomingCommand -> fragmentCount > 0) - channel -> incomingReliableSequenceNumber += incomingCommand -> fragmentCount - 1; - } - - if (currentCommand == enet_list_begin (& channel -> incomingReliableCommands)) - return; - - enet_list_move (enet_list_end (& peer -> dispatchedCommands), enet_list_begin (& channel -> incomingReliableCommands), enet_list_previous (currentCommand)); - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } - - enet_peer_dispatch_incoming_unreliable_commands (peer, channel); -} - -ENetIncomingCommand * -enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 fragmentCount) -{ - static ENetIncomingCommand dummyCommand; - - ENetChannel * channel = & peer -> channels [command -> header.channelID]; - enet_uint32 unreliableSequenceNumber = 0, reliableSequenceNumber; - enet_uint16 reliableWindow, currentWindow; - ENetIncomingCommand * incomingCommand; - ENetListIterator currentCommand; - - if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) - goto freePacket; - - if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED) - { - reliableSequenceNumber = command -> header.reliableSequenceNumber; - reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - - if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - reliableWindow += ENET_PEER_RELIABLE_WINDOWS; - - if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) - goto freePacket; - } - - switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) - { - case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: - case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: - if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber) - goto freePacket; - - for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); - currentCommand != enet_list_end (& channel -> incomingReliableCommands); - currentCommand = enet_list_previous (currentCommand)) - { - incomingCommand = (ENetIncomingCommand *) currentCommand; - - if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - continue; - } - else - if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber <= reliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber) - break; - - goto freePacket; - } - } - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE: - unreliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendUnreliable.unreliableSequenceNumber); - - for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands)); - currentCommand != enet_list_end (& channel -> incomingUnreliableCommands); - currentCommand = enet_list_previous (currentCommand)) - { - incomingCommand = (ENetIncomingCommand *) currentCommand; - - if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE) - continue; - - if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - continue; - } - else - if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber > reliableSequenceNumber) - continue; - - if (incomingCommand -> unreliableSequenceNumber <= unreliableSequenceNumber) - { - if (incomingCommand -> unreliableSequenceNumber < unreliableSequenceNumber) - break; - - goto freePacket; - } - } - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED: - currentCommand = enet_list_end (& channel -> incomingUnreliableCommands); - break; - - default: - goto freePacket; - } - - incomingCommand = (ENetIncomingCommand *) enet_malloc (sizeof (ENetIncomingCommand)); - if (incomingCommand == NULL) - goto notifyError; - - incomingCommand -> reliableSequenceNumber = command -> header.reliableSequenceNumber; - incomingCommand -> unreliableSequenceNumber = unreliableSequenceNumber & 0xFFFF; - incomingCommand -> command = * command; - incomingCommand -> fragmentCount = fragmentCount; - incomingCommand -> fragmentsRemaining = fragmentCount; - incomingCommand -> packet = packet; - incomingCommand -> fragments = NULL; - - if (fragmentCount > 0) - { - incomingCommand -> fragments = (enet_uint32 *) enet_malloc ((fragmentCount + 31) / 32 * sizeof (enet_uint32)); - if (incomingCommand -> fragments == NULL) - { - enet_free (incomingCommand); - - goto notifyError; - } - memset (incomingCommand -> fragments, 0, (fragmentCount + 31) / 32 * sizeof (enet_uint32)); - } - - if (packet != NULL) - ++ packet -> referenceCount; - - enet_list_insert (enet_list_next (currentCommand), incomingCommand); - - switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) - { - case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: - case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: - enet_peer_dispatch_incoming_reliable_commands (peer, channel); - break; - - default: - enet_peer_dispatch_incoming_unreliable_commands (peer, channel); - break; - } - - return incomingCommand; - -freePacket: - if (fragmentCount > 0) - goto notifyError; - - if (packet != NULL && packet -> referenceCount == 0) - enet_packet_destroy (packet); - - return & dummyCommand; - -notifyError: - if (packet != NULL && packet -> referenceCount == 0) - enet_packet_destroy (packet); - - return NULL; -} - -/** @} */ diff --git a/polymer-perf/eduke32/source/enet/src/protocol.c b/polymer-perf/eduke32/source/enet/src/protocol.c deleted file mode 100644 index 39d95bc52..000000000 --- a/polymer-perf/eduke32/source/enet/src/protocol.c +++ /dev/null @@ -1,1710 +0,0 @@ -/** - @file protocol.c - @brief ENet protocol functions -*/ -#include -#include -#define ENET_BUILDING_LIB 1 -#include "enet/utility.h" -#include "enet/time.h" -#include "enet/enet.h" - -#ifndef UNREFERENCED_PARAMETER -# define UNREFERENCED_PARAMETER(x) x=x -#endif - -static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] = -{ - 0, - sizeof (ENetProtocolAcknowledge), - sizeof (ENetProtocolConnect), - sizeof (ENetProtocolVerifyConnect), - sizeof (ENetProtocolDisconnect), - sizeof (ENetProtocolPing), - sizeof (ENetProtocolSendReliable), - sizeof (ENetProtocolSendUnreliable), - sizeof (ENetProtocolSendFragment), - sizeof (ENetProtocolSendUnsequenced), - sizeof (ENetProtocolBandwidthLimit), - sizeof (ENetProtocolThrottleConfigure), -}; - -size_t -enet_protocol_command_size (enet_uint8 commandNumber) -{ - return commandSizes [commandNumber & ENET_PROTOCOL_COMMAND_MASK]; -} - -static int -enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) -{ - while (! enet_list_empty (& host -> dispatchQueue)) - { - ENetPeer * peer = (ENetPeer *) enet_list_remove (enet_list_begin (& host -> dispatchQueue)); - - peer -> needsDispatch = 0; - - switch (peer -> state) - { - case ENET_PEER_STATE_CONNECTION_PENDING: - case ENET_PEER_STATE_CONNECTION_SUCCEEDED: - peer -> state = ENET_PEER_STATE_CONNECTED; - - event -> type = ENET_EVENT_TYPE_CONNECT; - event -> peer = peer; - event -> data = peer -> eventData; - - return 1; - - case ENET_PEER_STATE_ZOMBIE: - host -> recalculateBandwidthLimits = 1; - - event -> type = ENET_EVENT_TYPE_DISCONNECT; - event -> peer = peer; - event -> data = peer -> eventData; - - enet_peer_reset (peer); - - return 1; - - case ENET_PEER_STATE_CONNECTED: - if (enet_list_empty (& peer -> dispatchedCommands)) - continue; - - event -> packet = enet_peer_receive (peer, & event -> channelID); - if (event -> packet == NULL) - continue; - - event -> type = ENET_EVENT_TYPE_RECEIVE; - event -> peer = peer; - - if (! enet_list_empty (& peer -> dispatchedCommands)) - { - peer -> needsDispatch = 1; - - enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList); - } - - return 1; - default: - break; - } - } - - return 0; -} - -static void -enet_protocol_dispatch_state (ENetHost * host, ENetPeer * peer, ENetPeerState state) -{ - peer -> state = state; - - if (! peer -> needsDispatch) - { - enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList); - - peer -> needsDispatch = 1; - } -} - -static void -enet_protocol_notify_connect (ENetHost * host, ENetPeer * peer, ENetEvent * event) -{ - host -> recalculateBandwidthLimits = 1; - - if (event != NULL) - { - peer -> state = ENET_PEER_STATE_CONNECTED; - - event -> type = ENET_EVENT_TYPE_CONNECT; - event -> peer = peer; - event -> data = peer -> eventData; - } - else - enet_protocol_dispatch_state (host, peer, peer -> state == ENET_PEER_STATE_CONNECTING ? ENET_PEER_STATE_CONNECTION_SUCCEEDED : ENET_PEER_STATE_CONNECTION_PENDING); -} - -static void -enet_protocol_notify_disconnect (ENetHost * host, ENetPeer * peer, ENetEvent * event) -{ - if (peer -> state >= ENET_PEER_STATE_CONNECTION_PENDING) - host -> recalculateBandwidthLimits = 1; - - if (peer -> state != ENET_PEER_STATE_CONNECTING && peer -> state < ENET_PEER_STATE_CONNECTION_SUCCEEDED) - enet_peer_reset (peer); - else - if (event != NULL) - { - event -> type = ENET_EVENT_TYPE_DISCONNECT; - event -> peer = peer; - event -> data = 0; - - enet_peer_reset (peer); - } - else - { - peer -> eventData = 0; - - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - } -} - -static void -enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer) -{ - ENetOutgoingCommand * outgoingCommand; - - while (! enet_list_empty (& peer -> sentUnreliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands); - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - - if (outgoingCommand -> packet != NULL) - { - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (outgoingCommand -> packet); - } - - enet_free (outgoingCommand); - } -} - -static ENetProtocolCommand -enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliableSequenceNumber, enet_uint8 channelID) -{ - ENetOutgoingCommand * outgoingCommand; - ENetListIterator currentCommand; - ENetProtocolCommand commandNumber; - int wasSent = 1; - - for (currentCommand = enet_list_begin (& peer -> sentReliableCommands); - currentCommand != enet_list_end (& peer -> sentReliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && - outgoingCommand -> command.header.channelID == channelID) - break; - } - - if (currentCommand == enet_list_end (& peer -> sentReliableCommands)) - { - for (currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); - currentCommand != enet_list_end (& peer -> outgoingReliableCommands); - currentCommand = enet_list_next (currentCommand)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - if (outgoingCommand -> sendAttempts < 1) return ENET_PROTOCOL_COMMAND_NONE; - - if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && - outgoingCommand -> command.header.channelID == channelID) - break; - } - - if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands)) - return ENET_PROTOCOL_COMMAND_NONE; - - wasSent = 0; - } - - if (channelID < peer -> channelCount) - { - ENetChannel * channel = & peer -> channels [channelID]; - enet_uint16 reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - if (channel -> reliableWindows [reliableWindow] > 0) - { - -- channel -> reliableWindows [reliableWindow]; - if (! channel -> reliableWindows [reliableWindow]) - channel -> usedReliableWindows &= ~ (1 << reliableWindow); - } - } - - commandNumber = (ENetProtocolCommand) (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK); - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - - if (outgoingCommand -> packet != NULL) - { - if (wasSent) - peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; - - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (outgoingCommand -> packet); - } - - enet_free (outgoingCommand); - - if (enet_list_empty (& peer -> sentReliableCommands)) - return commandNumber; - - outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentReliableCommands); - - peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; - - return commandNumber; -} - -static ENetPeer * -enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENetProtocol * command) -{ - enet_uint8 incomingSessionID, outgoingSessionID; - enet_uint32 mtu, windowSize; - ENetChannel * channel; - size_t channelCount; - ENetPeer * currentPeer; - ENetProtocol verifyCommand; - - UNREFERENCED_PARAMETER(header); - - channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount); - - if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT || - channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) - return NULL; - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state != ENET_PEER_STATE_DISCONNECTED && - currentPeer -> address.host == host -> receivedAddress.host && - currentPeer -> address.port == host -> receivedAddress.port && - currentPeer -> connectID == command -> connect.connectID) - return NULL; - } - - for (currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED) - break; - } - - if (currentPeer >= & host -> peers [host -> peerCount]) - return NULL; - - if (channelCount > host -> channelLimit) - channelCount = host -> channelLimit; - currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel)); - if (currentPeer -> channels == NULL) - return NULL; - currentPeer -> channelCount = channelCount; - currentPeer -> state = ENET_PEER_STATE_ACKNOWLEDGING_CONNECT; - currentPeer -> connectID = command -> connect.connectID; - currentPeer -> address = host -> receivedAddress; - currentPeer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> connect.outgoingPeerID); - currentPeer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.incomingBandwidth); - currentPeer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.outgoingBandwidth); - currentPeer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleInterval); - currentPeer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleAcceleration); - currentPeer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleDeceleration); - currentPeer -> eventData = ENET_NET_TO_HOST_32 (command -> connect.data); - - incomingSessionID = command -> connect.incomingSessionID == 0xFF ? currentPeer -> outgoingSessionID : command -> connect.incomingSessionID; - incomingSessionID = (incomingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - if (incomingSessionID == currentPeer -> outgoingSessionID) - incomingSessionID = (incomingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - currentPeer -> outgoingSessionID = incomingSessionID; - - outgoingSessionID = command -> connect.outgoingSessionID == 0xFF ? currentPeer -> incomingSessionID : command -> connect.outgoingSessionID; - outgoingSessionID = (outgoingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - if (outgoingSessionID == currentPeer -> incomingSessionID) - outgoingSessionID = (outgoingSessionID + 1) & (ENET_PROTOCOL_HEADER_SESSION_MASK >> ENET_PROTOCOL_HEADER_SESSION_SHIFT); - currentPeer -> incomingSessionID = outgoingSessionID; - - for (channel = currentPeer -> channels; - channel < & currentPeer -> channels [channelCount]; - ++ channel) - { - channel -> outgoingReliableSequenceNumber = 0; - channel -> outgoingUnreliableSequenceNumber = 0; - channel -> incomingReliableSequenceNumber = 0; - - enet_list_clear (& channel -> incomingReliableCommands); - enet_list_clear (& channel -> incomingUnreliableCommands); - - channel -> usedReliableWindows = 0; - memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows)); - } - - mtu = ENET_NET_TO_HOST_32 (command -> connect.mtu); - - if (mtu < ENET_PROTOCOL_MINIMUM_MTU) - mtu = ENET_PROTOCOL_MINIMUM_MTU; - else - if (mtu > ENET_PROTOCOL_MAXIMUM_MTU) - mtu = ENET_PROTOCOL_MAXIMUM_MTU; - - currentPeer -> mtu = mtu; - - if (host -> outgoingBandwidth == 0 && - currentPeer -> incomingBandwidth == 0) - currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - if (host -> outgoingBandwidth == 0 || - currentPeer -> incomingBandwidth == 0) - currentPeer -> windowSize = (ENET_MAX (host -> outgoingBandwidth, currentPeer -> incomingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - currentPeer -> windowSize = (ENET_MIN (host -> outgoingBandwidth, currentPeer -> incomingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - if (host -> incomingBandwidth == 0) - windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - windowSize = (host -> incomingBandwidth / ENET_PEER_WINDOW_SIZE_SCALE) * - ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (windowSize > ENET_NET_TO_HOST_32 (command -> connect.windowSize)) - windowSize = ENET_NET_TO_HOST_32 (command -> connect.windowSize); - - if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - verifyCommand.header.command = ENET_PROTOCOL_COMMAND_VERIFY_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; - verifyCommand.header.channelID = 0xFF; - verifyCommand.verifyConnect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID); - verifyCommand.verifyConnect.incomingSessionID = incomingSessionID; - verifyCommand.verifyConnect.outgoingSessionID = outgoingSessionID; - verifyCommand.verifyConnect.mtu = ENET_HOST_TO_NET_16 (currentPeer -> mtu); - verifyCommand.verifyConnect.windowSize = ENET_HOST_TO_NET_32 (windowSize); - verifyCommand.verifyConnect.channelCount = ENET_HOST_TO_NET_32 (channelCount); - verifyCommand.verifyConnect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth); - verifyCommand.verifyConnect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); - verifyCommand.verifyConnect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval); - verifyCommand.verifyConnect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration); - verifyCommand.verifyConnect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration); - verifyCommand.verifyConnect.connectID = currentPeer -> connectID; - - enet_peer_queue_outgoing_command (currentPeer, & verifyCommand, NULL, 0, 0); - - return currentPeer; -} - -static int -enet_protocol_handle_send_reliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - ENetPacket * packet; - size_t dataLength; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - dataLength = ENET_NET_TO_HOST_16 (command -> sendReliable.dataLength); - * currentData += dataLength; - if (* currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendReliable), - dataLength, - ENET_PACKET_FLAG_RELIABLE); - if (packet == NULL || - enet_peer_queue_incoming_command (peer, command, packet, 0) == NULL) - return -1; - - return 0; -} - -static int -enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - ENetPacket * packet; - enet_uint32 unsequencedGroup, index; - size_t dataLength; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - dataLength = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.dataLength); - * currentData += dataLength; - if (* currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - unsequencedGroup = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.unsequencedGroup); - index = unsequencedGroup % ENET_PEER_UNSEQUENCED_WINDOW_SIZE; - - if (unsequencedGroup < peer -> incomingUnsequencedGroup) - unsequencedGroup += 0x10000; - - if (unsequencedGroup >= (enet_uint32) peer -> incomingUnsequencedGroup + ENET_PEER_FREE_UNSEQUENCED_WINDOWS * ENET_PEER_UNSEQUENCED_WINDOW_SIZE) - return 0; - - unsequencedGroup &= 0xFFFF; - - if (unsequencedGroup - index != peer -> incomingUnsequencedGroup) - { - peer -> incomingUnsequencedGroup = unsequencedGroup - index; - - memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); - } - else - if (peer -> unsequencedWindow [index / 32] & (1 << (index % 32))) - return 0; - - packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnsequenced), - dataLength, - ENET_PACKET_FLAG_UNSEQUENCED); - if (packet == NULL || - enet_peer_queue_incoming_command (peer, command, packet, 0) == NULL) - return -1; - - peer -> unsequencedWindow [index / 32] |= 1 << (index % 32); - - return 0; -} - -static int -enet_protocol_handle_send_unreliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - ENetPacket * packet; - size_t dataLength; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - dataLength = ENET_NET_TO_HOST_16 (command -> sendUnreliable.dataLength); - * currentData += dataLength; - if (* currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnreliable), - dataLength, - 0); - if (packet == NULL || - enet_peer_queue_incoming_command (peer, command, packet, 0) == NULL) - return -1; - - return 0; -} - -static int -enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) -{ - enet_uint32 fragmentNumber, - fragmentCount, - fragmentOffset, - fragmentLength, - startSequenceNumber, - totalLength; - ENetChannel * channel; - enet_uint16 startWindow, currentWindow; - ENetListIterator currentCommand; - ENetIncomingCommand * startCommand = NULL; - - if (command -> header.channelID >= peer -> channelCount || - (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) - return -1; - - fragmentLength = ENET_NET_TO_HOST_16 (command -> sendFragment.dataLength); - * currentData += fragmentLength; - if (* currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; - - channel = & peer -> channels [command -> header.channelID]; - startSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendFragment.startSequenceNumber); - startWindow = startSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - - if (startSequenceNumber < channel -> incomingReliableSequenceNumber) - startWindow += ENET_PEER_RELIABLE_WINDOWS; - - if (startWindow < currentWindow || startWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) - return 0; - - fragmentNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentNumber); - fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount); - fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset); - totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength); - - if (fragmentOffset >= totalLength || - fragmentOffset + fragmentLength > totalLength || - fragmentNumber >= fragmentCount) - return -1; - - for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); - currentCommand != enet_list_end (& channel -> incomingReliableCommands); - currentCommand = enet_list_previous (currentCommand)) - { - ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; - - if (startSequenceNumber >= channel -> incomingReliableSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) - continue; - } - else - if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) - break; - - if (incomingCommand -> reliableSequenceNumber <= startSequenceNumber) - { - if (incomingCommand -> reliableSequenceNumber < startSequenceNumber) - break; - - if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_FRAGMENT || - totalLength != incomingCommand -> packet -> dataLength || - fragmentCount != incomingCommand -> fragmentCount) - return -1; - - startCommand = incomingCommand; - break; - } - } - - if (startCommand == NULL) - { - ENetProtocol hostCommand = * command; - ENetPacket * packet = enet_packet_create (NULL, totalLength, ENET_PACKET_FLAG_RELIABLE); - if (packet == NULL) - return -1; - - hostCommand.header.reliableSequenceNumber = startSequenceNumber; - hostCommand.sendFragment.startSequenceNumber = startSequenceNumber; - hostCommand.sendFragment.dataLength = fragmentLength; - hostCommand.sendFragment.fragmentNumber = fragmentNumber; - hostCommand.sendFragment.fragmentCount = fragmentCount; - hostCommand.sendFragment.fragmentOffset = fragmentOffset; - hostCommand.sendFragment.totalLength = totalLength; - - startCommand = enet_peer_queue_incoming_command (peer, & hostCommand, packet, fragmentCount); - if (startCommand == NULL) - return -1; - } - - if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0) - { - -- startCommand -> fragmentsRemaining; - - startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32)); - - if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength) - fragmentLength = startCommand -> packet -> dataLength - fragmentOffset; - - memcpy (startCommand -> packet -> data + fragmentOffset, - (enet_uint8 *) command + sizeof (ENetProtocolSendFragment), - fragmentLength); - - if (startCommand -> fragmentsRemaining <= 0) - enet_peer_dispatch_incoming_reliable_commands (peer, channel); - } - - return 0; -} - -static int -enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - UNREFERENCED_PARAMETER(host); - UNREFERENCED_PARAMETER(peer); - UNREFERENCED_PARAMETER(command); - - return 0; -} - -static int -enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.incomingBandwidth); - peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.outgoingBandwidth); - - if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0) - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - else - peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (peer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - peer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - else - if (peer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - return 0; -} - -static int -enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - UNREFERENCED_PARAMETER(host); - - peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleInterval); - peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleAcceleration); - peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleDeceleration); - - return 0; -} - -static int -enet_protocol_handle_disconnect (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) -{ - if (peer -> state == ENET_PEER_STATE_ZOMBIE || peer -> state == ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT) - return 0; - - enet_peer_reset_queues (peer); - - if (peer -> state == ENET_PEER_STATE_CONNECTION_SUCCEEDED) - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - else - if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) - { - if (peer -> state == ENET_PEER_STATE_CONNECTION_PENDING) host -> recalculateBandwidthLimits = 1; - - enet_peer_reset (peer); - } - else - if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) - peer -> state = ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT; - else - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - - if (peer -> state != ENET_PEER_STATE_DISCONNECTED) - peer -> eventData = ENET_NET_TO_HOST_32 (command -> disconnect.data); - - return 0; -} - -static int -enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command) -{ - enet_uint32 roundTripTime, - receivedSentTime, - receivedReliableSequenceNumber; - ENetProtocolCommand commandNumber; - - receivedSentTime = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedSentTime); - receivedSentTime |= host -> serviceTime & 0xFFFF0000; - if ((receivedSentTime & 0x8000) > (host -> serviceTime & 0x8000)) - receivedSentTime -= 0x10000; - - if (ENET_TIME_LESS (host -> serviceTime, receivedSentTime)) - return 0; - - peer -> lastReceiveTime = host -> serviceTime; - peer -> earliestTimeout = 0; - - roundTripTime = ENET_TIME_DIFFERENCE (host -> serviceTime, receivedSentTime); - - enet_peer_throttle (peer, roundTripTime); - - peer -> roundTripTimeVariance -= peer -> roundTripTimeVariance / 4; - - if (roundTripTime >= peer -> roundTripTime) - { - peer -> roundTripTime += (roundTripTime - peer -> roundTripTime) / 8; - peer -> roundTripTimeVariance += (roundTripTime - peer -> roundTripTime) / 4; - } - else - { - peer -> roundTripTime -= (peer -> roundTripTime - roundTripTime) / 8; - peer -> roundTripTimeVariance += (peer -> roundTripTime - roundTripTime) / 4; - } - - if (peer -> roundTripTime < peer -> lowestRoundTripTime) - peer -> lowestRoundTripTime = peer -> roundTripTime; - - if (peer -> roundTripTimeVariance > peer -> highestRoundTripTimeVariance) - peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance; - - if (peer -> packetThrottleEpoch == 0 || - ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> packetThrottleEpoch) >= peer -> packetThrottleInterval) - { - peer -> lastRoundTripTime = peer -> lowestRoundTripTime; - peer -> lastRoundTripTimeVariance = peer -> highestRoundTripTimeVariance; - peer -> lowestRoundTripTime = peer -> roundTripTime; - peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance; - peer -> packetThrottleEpoch = host -> serviceTime; - } - - receivedReliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedReliableSequenceNumber); - - commandNumber = enet_protocol_remove_sent_reliable_command (peer, receivedReliableSequenceNumber, command -> header.channelID); - - switch (peer -> state) - { - case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT: - if (commandNumber != ENET_PROTOCOL_COMMAND_VERIFY_CONNECT) - return -1; - - enet_protocol_notify_connect (host, peer, event); - break; - - case ENET_PEER_STATE_DISCONNECTING: - if (commandNumber != ENET_PROTOCOL_COMMAND_DISCONNECT) - return -1; - - enet_protocol_notify_disconnect (host, peer, event); - break; - - case ENET_PEER_STATE_DISCONNECT_LATER: - if (enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && - enet_list_empty (& peer -> sentReliableCommands)) - enet_peer_disconnect (peer, peer -> eventData); - break; - default: - break; - } - - return 0; -} - -static int -enet_protocol_handle_verify_connect (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command) -{ - enet_uint32 mtu, windowSize; - size_t channelCount; - - if (peer -> state != ENET_PEER_STATE_CONNECTING) - return 0; - - channelCount = ENET_NET_TO_HOST_32 (command -> verifyConnect.channelCount); - - if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT || channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT || - ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleInterval) != peer -> packetThrottleInterval || - ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleAcceleration) != peer -> packetThrottleAcceleration || - ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleDeceleration) != peer -> packetThrottleDeceleration || - command -> verifyConnect.connectID != peer -> connectID) - { - peer -> eventData = 0; - - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - - return -1; - } - - enet_protocol_remove_sent_reliable_command (peer, 1, 0xFF); - - if (channelCount < peer -> channelCount) - peer -> channelCount = channelCount; - - peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> verifyConnect.outgoingPeerID); - peer -> incomingSessionID = command -> verifyConnect.incomingSessionID; - peer -> outgoingSessionID = command -> verifyConnect.outgoingSessionID; - - mtu = ENET_NET_TO_HOST_32 (command -> verifyConnect.mtu); - - if (mtu < ENET_PROTOCOL_MINIMUM_MTU) - mtu = ENET_PROTOCOL_MINIMUM_MTU; - else - if (mtu > ENET_PROTOCOL_MAXIMUM_MTU) - mtu = ENET_PROTOCOL_MAXIMUM_MTU; - - if (mtu < peer -> mtu) - peer -> mtu = mtu; - - windowSize = ENET_NET_TO_HOST_32 (command -> verifyConnect.windowSize); - - if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; - - if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) - windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - - if (windowSize < peer -> windowSize) - peer -> windowSize = windowSize; - - peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.incomingBandwidth); - peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.outgoingBandwidth); - - enet_protocol_notify_connect (host, peer, event); - return 0; -} - -static int -enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) -{ - ENetProtocolHeader * header; - ENetProtocol * command; - ENetPeer * peer; - enet_uint8 * currentData; - size_t headerSize; - enet_uint16 peerID, flags; - enet_uint8 sessionID; - - if (host -> receivedDataLength < (size_t) & ((ENetProtocolHeader *) 0) -> sentTime) - return 0; - - header = (ENetProtocolHeader *) host -> receivedData; - - peerID = ENET_NET_TO_HOST_16 (header -> peerID); - sessionID = (peerID & ENET_PROTOCOL_HEADER_SESSION_MASK) >> ENET_PROTOCOL_HEADER_SESSION_SHIFT; - flags = peerID & ENET_PROTOCOL_HEADER_FLAG_MASK; - peerID &= ~ (ENET_PROTOCOL_HEADER_FLAG_MASK | ENET_PROTOCOL_HEADER_SESSION_MASK); - - headerSize = (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME ? sizeof (ENetProtocolHeader) : (size_t) & ((ENetProtocolHeader *) 0) -> sentTime); - if (host -> checksum != NULL) - headerSize += sizeof (enet_uint32); - - if (peerID == ENET_PROTOCOL_MAXIMUM_PEER_ID) - peer = NULL; - else - if (peerID >= host -> peerCount) - return 0; - else - { - peer = & host -> peers [peerID]; - - if (peer -> state == ENET_PEER_STATE_DISCONNECTED || - peer -> state == ENET_PEER_STATE_ZOMBIE || - (host -> receivedAddress.host != peer -> address.host && - peer -> address.host != ENET_HOST_BROADCAST) || - (peer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID && - sessionID != peer -> incomingSessionID)) - return 0; - } - - if (flags & ENET_PROTOCOL_HEADER_FLAG_COMPRESSED) - { - size_t originalSize; - if (host -> compressor.context == NULL || host -> compressor.decompress == NULL) - return 0; - - originalSize = host -> compressor.decompress (host -> compressor.context, - host -> receivedData + headerSize, - host -> receivedDataLength - headerSize, - host -> packetData [1] + headerSize, - sizeof (host -> packetData [1]) - headerSize); - if (originalSize <= 0 || originalSize > sizeof (host -> packetData [1]) - headerSize) - return 0; - - memcpy (host -> packetData [1], header, headerSize); - host -> receivedData = host -> packetData [1]; - host -> receivedDataLength = headerSize + originalSize; - } - - if (host -> checksum != NULL) - { - enet_uint32 * checksum = (enet_uint32 *) & host -> receivedData [headerSize - sizeof (enet_uint32)], - desiredChecksum = * checksum; - ENetBuffer buffer; - - * checksum = peer != NULL ? peer -> connectID : 0; - - buffer.data = host -> receivedData; - buffer.dataLength = host -> receivedDataLength; - - if (host -> checksum (& buffer, 1) != desiredChecksum) - return 0; - } - - if (peer != NULL) - { - peer -> address.host = host -> receivedAddress.host; - peer -> address.port = host -> receivedAddress.port; - peer -> incomingDataTotal += host -> receivedDataLength; - } - - currentData = host -> receivedData + headerSize; - - while (currentData < & host -> receivedData [host -> receivedDataLength]) - { - enet_uint8 commandNumber; - size_t commandSize; - - command = (ENetProtocol *) currentData; - - if (currentData + sizeof (ENetProtocolCommandHeader) > & host -> receivedData [host -> receivedDataLength]) - break; - - commandNumber = command -> header.command & ENET_PROTOCOL_COMMAND_MASK; - if (commandNumber >= ENET_PROTOCOL_COMMAND_COUNT) - break; - - commandSize = commandSizes [commandNumber]; - if (commandSize == 0 || currentData + commandSize > & host -> receivedData [host -> receivedDataLength]) - break; - - currentData += commandSize; - - if (peer == NULL && commandNumber != ENET_PROTOCOL_COMMAND_CONNECT) - break; - - command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> header.reliableSequenceNumber); - - switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) - { - case ENET_PROTOCOL_COMMAND_ACKNOWLEDGE: - if (enet_protocol_handle_acknowledge (host, event, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_CONNECT: - peer = enet_protocol_handle_connect (host, header, command); - if (peer == NULL) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_VERIFY_CONNECT: - if (enet_protocol_handle_verify_connect (host, event, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_DISCONNECT: - if (enet_protocol_handle_disconnect (host, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_PING: - if (enet_protocol_handle_ping (host, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: - if (enet_protocol_handle_send_reliable (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE: - if (enet_protocol_handle_send_unreliable (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED: - if (enet_protocol_handle_send_unsequenced (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: - if (enet_protocol_handle_send_fragment (host, peer, command, & currentData)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT: - if (enet_protocol_handle_bandwidth_limit (host, peer, command)) - goto commandError; - break; - - case ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE: - if (enet_protocol_handle_throttle_configure (host, peer, command)) - goto commandError; - break; - - default: - goto commandError; - } - - if (peer != NULL && - (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) != 0) - { - enet_uint16 sentTime; - - if (! (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME)) - break; - - sentTime = ENET_NET_TO_HOST_16 (header -> sentTime); - - switch (peer -> state) - { - case ENET_PEER_STATE_DISCONNECTING: - case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT: - break; - - case ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT: - if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT) - enet_peer_queue_acknowledgement (peer, command, sentTime); - break; - - default: - enet_peer_queue_acknowledgement (peer, command, sentTime); - break; - } - } - } - -commandError: - if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE) - return 1; - - return 0; -} - -static int -enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) -{ - for (;;) - { - int receivedLength; - ENetBuffer buffer; - - buffer.data = host -> packetData [0]; - buffer.dataLength = sizeof (host -> packetData [0]); - - receivedLength = enet_socket_receive (host -> socket, - & host -> receivedAddress, - & buffer, - 1); - - if (receivedLength < 0) - return -1; - - if (receivedLength == 0) - return 0; - - host -> receivedData = host -> packetData [0]; - host -> receivedDataLength = receivedLength; - - host -> totalReceivedData += receivedLength; - host -> totalReceivedPackets ++; - - switch (enet_protocol_handle_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: - return -1; - - default: - break; - } - } - - return -1; -} - -static void -enet_protocol_send_acknowledgements (ENetHost * host, ENetPeer * peer) -{ - ENetProtocol * command = & host -> commands [host -> commandCount]; - ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; - ENetAcknowledgement * acknowledgement; - ENetListIterator currentAcknowledgement; - - currentAcknowledgement = enet_list_begin (& peer -> acknowledgements); - - while (currentAcknowledgement != enet_list_end (& peer -> acknowledgements)) - { - if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || - buffer >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || - peer -> mtu - host -> packetSize < sizeof (ENetProtocolAcknowledge)) - { - host -> continueSending = 1; - - break; - } - - acknowledgement = (ENetAcknowledgement *) currentAcknowledgement; - - currentAcknowledgement = enet_list_next (currentAcknowledgement); - - buffer -> data = command; - buffer -> dataLength = sizeof (ENetProtocolAcknowledge); - - host -> packetSize += buffer -> dataLength; - - command -> header.command = ENET_PROTOCOL_COMMAND_ACKNOWLEDGE; - command -> header.channelID = acknowledgement -> command.header.channelID; - command -> acknowledge.receivedReliableSequenceNumber = ENET_HOST_TO_NET_16 (acknowledgement -> command.header.reliableSequenceNumber); - command -> acknowledge.receivedSentTime = ENET_HOST_TO_NET_16 (acknowledgement -> sentTime); - - if ((acknowledgement -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT) - enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); - - enet_list_remove (& acknowledgement -> acknowledgementList); - enet_free (acknowledgement); - - ++ command; - ++ buffer; - } - - host -> commandCount = command - host -> commands; - host -> bufferCount = buffer - host -> buffers; -} - -static void -enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * peer) -{ - ENetProtocol * command = & host -> commands [host -> commandCount]; - ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; - ENetOutgoingCommand * outgoingCommand; - ENetListIterator currentCommand; - - currentCommand = enet_list_begin (& peer -> outgoingUnreliableCommands); - - while (currentCommand != enet_list_end (& peer -> outgoingUnreliableCommands)) - { - size_t commandSize; - - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; - - if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || - buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || - peer -> mtu - host -> packetSize < commandSize || - (outgoingCommand -> packet != NULL && - peer -> mtu - host -> packetSize < commandSize + outgoingCommand -> packet -> dataLength)) - { - host -> continueSending = 1; - - break; - } - - currentCommand = enet_list_next (currentCommand); - - if (outgoingCommand -> packet != NULL) - { - peer -> packetThrottleCounter += ENET_PEER_PACKET_THROTTLE_COUNTER; - peer -> packetThrottleCounter %= ENET_PEER_PACKET_THROTTLE_SCALE; - - if (peer -> packetThrottleCounter > peer -> packetThrottle) - { - -- outgoingCommand -> packet -> referenceCount; - - if (outgoingCommand -> packet -> referenceCount == 0) - enet_packet_destroy (outgoingCommand -> packet); - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - enet_free (outgoingCommand); - - continue; - } - } - - buffer -> data = command; - buffer -> dataLength = commandSize; - - host -> packetSize += buffer -> dataLength; - - * command = outgoingCommand -> command; - - enet_list_remove (& outgoingCommand -> outgoingCommandList); - - if (outgoingCommand -> packet != NULL) - { - ++ buffer; - - buffer -> data = outgoingCommand -> packet -> data; - buffer -> dataLength = outgoingCommand -> packet -> dataLength; - - host -> packetSize += buffer -> dataLength; - - enet_list_insert (enet_list_end (& peer -> sentUnreliableCommands), outgoingCommand); - } - else - enet_free (outgoingCommand); - - ++ command; - ++ buffer; - } - - host -> commandCount = command - host -> commands; - host -> bufferCount = buffer - host -> buffers; - - if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER && - enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && - enet_list_empty (& peer -> sentReliableCommands)) - enet_peer_disconnect (peer, peer -> eventData); -} - -static int -enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * event) -{ - ENetOutgoingCommand * outgoingCommand; - ENetListIterator currentCommand, insertPosition; - - currentCommand = enet_list_begin (& peer -> sentReliableCommands); - insertPosition = enet_list_begin (& peer -> outgoingReliableCommands); - - while (currentCommand != enet_list_end (& peer -> sentReliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - currentCommand = enet_list_next (currentCommand); - - if (ENET_TIME_DIFFERENCE (host -> serviceTime, outgoingCommand -> sentTime) < outgoingCommand -> roundTripTimeout) - continue; - - if (peer -> earliestTimeout == 0 || - ENET_TIME_LESS (outgoingCommand -> sentTime, peer -> earliestTimeout)) - peer -> earliestTimeout = outgoingCommand -> sentTime; - - if (peer -> earliestTimeout != 0 && - (ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= ENET_PEER_TIMEOUT_MAXIMUM || - (outgoingCommand -> roundTripTimeout >= outgoingCommand -> roundTripTimeoutLimit && - ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= ENET_PEER_TIMEOUT_MINIMUM))) - { - enet_protocol_notify_disconnect (host, peer, event); - - return 1; - } - - if (outgoingCommand -> packet != NULL) - peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; - - ++ peer -> packetsLost; - - outgoingCommand -> roundTripTimeout *= 2; - - enet_list_insert (insertPosition, enet_list_remove (& outgoingCommand -> outgoingCommandList)); - - if (currentCommand == enet_list_begin (& peer -> sentReliableCommands) && - ! enet_list_empty (& peer -> sentReliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; - } - } - - return 0; -} - -static int -enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) -{ - ENetProtocol * command = & host -> commands [host -> commandCount]; - ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; - ENetOutgoingCommand * outgoingCommand; - ENetListIterator currentCommand; - ENetChannel *channel; - enet_uint16 reliableWindow; - size_t commandSize; - int windowExceeded = 0, windowWrap = 0, canPing = 1; - - currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); - - while (currentCommand != enet_list_end (& peer -> outgoingReliableCommands)) - { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL; - reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - if (channel != NULL) - { - if (! windowWrap && - outgoingCommand -> sendAttempts < 1 && - ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) && - (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE || - channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | - (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow))))) - windowWrap = 1; - if (windowWrap) - { - currentCommand = enet_list_next (currentCommand); - - continue; - } - } - - if (outgoingCommand -> packet != NULL) - { - if (! windowExceeded) - { - enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE; - - if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu)) - windowExceeded = 1; - } - if (windowExceeded) - { - currentCommand = enet_list_next (currentCommand); - - continue; - } - } - - canPing = 0; - - commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; - if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || - buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || - peer -> mtu - host -> packetSize < commandSize || - (outgoingCommand -> packet != NULL && - (enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))) - { - host -> continueSending = 1; - - break; - } - - currentCommand = enet_list_next (currentCommand); - - if (channel != NULL && outgoingCommand -> sendAttempts < 1) - { - channel -> usedReliableWindows |= 1 << reliableWindow; - ++ channel -> reliableWindows [reliableWindow]; - } - - ++ outgoingCommand -> sendAttempts; - - if (outgoingCommand -> roundTripTimeout == 0) - { - outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance; - outgoingCommand -> roundTripTimeoutLimit = ENET_PEER_TIMEOUT_LIMIT * outgoingCommand -> roundTripTimeout; - } - - if (enet_list_empty (& peer -> sentReliableCommands)) - peer -> nextTimeout = host -> serviceTime + outgoingCommand -> roundTripTimeout; - - enet_list_insert (enet_list_end (& peer -> sentReliableCommands), - enet_list_remove (& outgoingCommand -> outgoingCommandList)); - - outgoingCommand -> sentTime = host -> serviceTime; - - buffer -> data = command; - buffer -> dataLength = commandSize; - - host -> packetSize += buffer -> dataLength; - host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_SENT_TIME; - - * command = outgoingCommand -> command; - - if (outgoingCommand -> packet != NULL) - { - ++ buffer; - - buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset; - buffer -> dataLength = outgoingCommand -> fragmentLength; - - host -> packetSize += outgoingCommand -> fragmentLength; - - peer -> reliableDataInTransit += outgoingCommand -> fragmentLength; - } - - ++ peer -> packetsSent; - - ++ command; - ++ buffer; - } - - host -> commandCount = command - host -> commands; - host -> bufferCount = buffer - host -> buffers; - - return canPing; -} - -static int -enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int checkForTimeouts) -{ - enet_uint8 headerData [sizeof (ENetProtocolHeader) + sizeof (enet_uint32)]; - ENetProtocolHeader * header = (ENetProtocolHeader *) headerData; - ENetPeer * currentPeer; - int sentLength; - size_t shouldCompress = 0; - - host -> continueSending = 1; - - while (host -> continueSending) - for (host -> continueSending = 0, - currentPeer = host -> peers; - currentPeer < & host -> peers [host -> peerCount]; - ++ currentPeer) - { - if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED || - currentPeer -> state == ENET_PEER_STATE_ZOMBIE) - continue; - - host -> headerFlags = 0; - host -> commandCount = 0; - host -> bufferCount = 1; - host -> packetSize = sizeof (ENetProtocolHeader); - - if (! enet_list_empty (& currentPeer -> acknowledgements)) - enet_protocol_send_acknowledgements (host, currentPeer); - - if (checkForTimeouts != 0 && - ! enet_list_empty (& currentPeer -> sentReliableCommands) && - ENET_TIME_GREATER_EQUAL (host -> serviceTime, currentPeer -> nextTimeout) && - enet_protocol_check_timeouts (host, currentPeer, event) == 1) - return 1; - - if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) || - enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) && - enet_list_empty (& currentPeer -> sentReliableCommands) && - ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL && - currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing)) - { - enet_peer_ping (currentPeer); - enet_protocol_send_reliable_outgoing_commands (host, currentPeer); - } - - if (! enet_list_empty (& currentPeer -> outgoingUnreliableCommands)) - enet_protocol_send_unreliable_outgoing_commands (host, currentPeer); - - if (host -> commandCount == 0) - continue; - - if (currentPeer -> packetLossEpoch == 0) - currentPeer -> packetLossEpoch = host -> serviceTime; - else - if (ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> packetLossEpoch) >= ENET_PEER_PACKET_LOSS_INTERVAL && - currentPeer -> packetsSent > 0) - { - enet_uint32 packetLoss = currentPeer -> packetsLost * ENET_PEER_PACKET_LOSS_SCALE / currentPeer -> packetsSent; - -#ifdef ENET_DEBUG -#ifdef WIN32 - printf ( -#else - fprintf (stderr, -#endif - "peer %u: %f%%+-%f%% packet loss, %u+-%u ms round trip time, %f%% throttle, %u/%u outgoing, %u/%u incoming\n", currentPeer -> incomingPeerID, currentPeer -> packetLoss / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> packetLossVariance / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> roundTripTime, currentPeer -> roundTripTimeVariance, currentPeer -> packetThrottle / (float) ENET_PEER_PACKET_THROTTLE_SCALE, enet_list_size (& currentPeer -> outgoingReliableCommands), enet_list_size (& currentPeer -> outgoingUnreliableCommands), currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingReliableCommands) : 0, currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingUnreliableCommands) : 0); -#endif - - currentPeer -> packetLossVariance -= currentPeer -> packetLossVariance / 4; - - if (packetLoss >= currentPeer -> packetLoss) - { - currentPeer -> packetLoss += (packetLoss - currentPeer -> packetLoss) / 8; - currentPeer -> packetLossVariance += (packetLoss - currentPeer -> packetLoss) / 4; - } - else - { - currentPeer -> packetLoss -= (currentPeer -> packetLoss - packetLoss) / 8; - currentPeer -> packetLossVariance += (currentPeer -> packetLoss - packetLoss) / 4; - } - - currentPeer -> packetLossEpoch = host -> serviceTime; - currentPeer -> packetsSent = 0; - currentPeer -> packetsLost = 0; - } - - host -> buffers -> data = headerData; - if (host -> headerFlags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME) - { - header -> sentTime = ENET_HOST_TO_NET_16 (host -> serviceTime & 0xFFFF); - - host -> buffers -> dataLength = sizeof (ENetProtocolHeader); - } - else - host -> buffers -> dataLength = (size_t) & ((ENetProtocolHeader *) 0) -> sentTime; - - shouldCompress = 0; - if (host -> compressor.context != NULL && host -> compressor.compress != NULL) - { - size_t originalSize = host -> packetSize - sizeof(ENetProtocolHeader), - compressedSize = host -> compressor.compress (host -> compressor.context, - & host -> buffers [1], host -> bufferCount - 1, - originalSize, - host -> packetData [1], - originalSize); - if (compressedSize > 0 && compressedSize < originalSize) - { - host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_COMPRESSED; - shouldCompress = compressedSize; -#ifdef ENET_DEBUG_COMPRESS -#ifdef WIN32 - printf ( -#else - fprintf (stderr, -#endif - "peer %u: compressed %u -> %u (%u%%)\n", currentPeer -> incomingPeerID, originalSize, compressedSize, (compressedSize * 100) / originalSize); -#endif - } - } - - if (currentPeer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID) - host -> headerFlags |= currentPeer -> outgoingSessionID << ENET_PROTOCOL_HEADER_SESSION_SHIFT; - header -> peerID = ENET_HOST_TO_NET_16 (currentPeer -> outgoingPeerID | host -> headerFlags); - if (host -> checksum != NULL) - { - enet_uint32 * checksum = (enet_uint32 *) & headerData [host -> buffers -> dataLength]; - * checksum = currentPeer -> outgoingPeerID < ENET_PROTOCOL_MAXIMUM_PEER_ID ? currentPeer -> connectID : 0; - host -> buffers -> dataLength += sizeof (enet_uint32); - * checksum = host -> checksum (host -> buffers, host -> bufferCount); - } - - if (shouldCompress > 0) - { - host -> buffers [1].data = host -> packetData [1]; - host -> buffers [1].dataLength = shouldCompress; - host -> bufferCount = 2; - } - - currentPeer -> lastSendTime = host -> serviceTime; - - sentLength = enet_socket_send (host -> socket, & currentPeer -> address, host -> buffers, host -> bufferCount); - - enet_protocol_remove_sent_unreliable_commands (currentPeer); - - if (sentLength < 0) - return -1; - - host -> totalSentData += sentLength; - host -> totalSentPackets ++; - } - - return 0; -} - -/** Sends any queued packets on the host specified to its designated peers. - - @param host host to flush - @remarks this function need only be used in circumstances where one wishes to send queued packets earlier than in a call to enet_host_service(). - @ingroup host -*/ -void -enet_host_flush (ENetHost * host) -{ - host -> serviceTime = enet_time_get (); - - enet_protocol_send_outgoing_commands (host, NULL, 0); -} - -/** Checks for any queued events on the host and dispatches one if available. - - @param host host to check for events - @param event an event structure where event details will be placed if available - @retval > 0 if an event was dispatched - @retval 0 if no events are available - @retval < 0 on failure - @ingroup host -*/ -int -enet_host_check_events (ENetHost * host, ENetEvent * event) -{ - if (event == NULL) return -1; - - event -> type = ENET_EVENT_TYPE_NONE; - event -> peer = NULL; - event -> packet = NULL; - - return enet_protocol_dispatch_incoming_commands (host, event); -} - -/** Waits for events on the host specified and shuttles packets between - the host and its peers. - - @param host host to service - @param event an event structure where event details will be placed if one occurs - if event == NULL then no events will be delivered - @param timeout number of milliseconds that ENet should wait for events - @retval > 0 if an event occurred within the specified time limit - @retval 0 if no event occurred - @retval < 0 on failure - @remarks enet_host_service should be called fairly regularly for adequate performance - @ingroup host -*/ -int -enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout) -{ - enet_uint32 waitCondition; - - if (event != NULL) - { - event -> type = ENET_EVENT_TYPE_NONE; - event -> peer = NULL; - event -> packet = NULL; - - switch (enet_protocol_dispatch_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: - perror ("Error dispatching incoming packets"); - - return -1; - - default: - break; - } - } - - host -> serviceTime = enet_time_get (); - - timeout += host -> serviceTime; - - do - { - if (ENET_TIME_DIFFERENCE (host -> serviceTime, host -> bandwidthThrottleEpoch) >= ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL) - enet_host_bandwidth_throttle (host); - - switch (enet_protocol_send_outgoing_commands (host, event, 1)) - { - case 1: - return 1; - - case -1: - perror ("Error sending outgoing packets"); - - return -1; - - default: - break; - } - - switch (enet_protocol_receive_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: - perror ("Error receiving incoming packets"); - - return -1; - - default: - break; - } - - switch (enet_protocol_send_outgoing_commands (host, event, 1)) - { - case 1: - return 1; - - case -1: - perror ("Error sending outgoing packets"); - - return -1; - - default: - break; - } - - if (event != NULL) - { - switch (enet_protocol_dispatch_incoming_commands (host, event)) - { - case 1: - return 1; - - case -1: - perror ("Error dispatching incoming packets"); - - return -1; - - default: - break; - } - } - - host -> serviceTime = enet_time_get (); - - if (ENET_TIME_GREATER_EQUAL (host -> serviceTime, timeout)) - return 0; - - waitCondition = ENET_SOCKET_WAIT_RECEIVE; - - if (enet_socket_wait (host -> socket, & waitCondition, ENET_TIME_DIFFERENCE (timeout, host -> serviceTime)) != 0) - return -1; - - host -> serviceTime = enet_time_get (); - } while (waitCondition == ENET_SOCKET_WAIT_RECEIVE); - - return 0; -} - diff --git a/polymer-perf/eduke32/source/enet/src/unix.c b/polymer-perf/eduke32/source/enet/src/unix.c deleted file mode 100644 index 3b072490f..000000000 --- a/polymer-perf/eduke32/source/enet/src/unix.c +++ /dev/null @@ -1,438 +0,0 @@ -/** - @file unix.c - @brief ENet Unix system specific functions -*/ -#ifndef WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -#ifdef HAS_FCNTL -#include -#endif - -#ifdef __APPLE__ -#undef HAS_POLL -#endif - -#ifdef HAS_POLL -#include -#endif - -#ifndef __socklen_t_defined -typedef int socklen_t; -#endif - -#ifndef MSG_NOSIGNAL -#define MSG_NOSIGNAL 0 -#endif - -static enet_uint32 timeBase = 0; - -int -enet_initialize (void) -{ - return 0; -} - -void -enet_deinitialize (void) -{ -} - -enet_uint32 -enet_time_get (void) -{ - struct timeval timeVal; - - gettimeofday (& timeVal, NULL); - - return timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - timeBase; -} - -void -enet_time_set (enet_uint32 newTimeBase) -{ - struct timeval timeVal; - - gettimeofday (& timeVal, NULL); - - timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase; -} - -int -enet_address_set_host (ENetAddress * address, const char * name) -{ - struct hostent * hostEntry = NULL; -#ifdef HAS_GETHOSTBYNAME_R - struct hostent hostData; - char buffer [2048]; - int errnum; - -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); -#else - hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum); -#endif -#else - hostEntry = gethostbyname (name); -#endif - - if (hostEntry == NULL || - hostEntry -> h_addrtype != AF_INET) - { -#ifdef HAS_INET_PTON - if (! inet_pton (AF_INET, name, & address -> host)) -#else - if (! inet_aton (name, (struct in_addr *) & address -> host)) -#endif - return -1; - return 0; - } - - address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0]; - - return 0; -} - -int -enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength) -{ -#ifdef HAS_INET_NTOP - if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL) -#else - char * addr = inet_ntoa (* (struct in_addr *) & address -> host); - if (addr != NULL) - strncpy (name, addr, nameLength); - else -#endif - return -1; - return 0; -} - -int -enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength) -{ - struct in_addr in; - struct hostent * hostEntry = NULL; -#ifdef HAS_GETHOSTBYADDR_R - struct hostent hostData; - char buffer [2048]; - int errnum; - - in.s_addr = address -> host; - -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); -#else - hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum); -#endif -#else - in.s_addr = address -> host; - - hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); -#endif - - if (hostEntry == NULL) - return enet_address_get_host_ip (address, name, nameLength); - - strncpy (name, hostEntry -> h_name, nameLength); - - return 0; -} - -int -enet_socket_bind (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - - if (address != NULL) - { - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - } - else - { - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - } - - return bind (socket, - (struct sockaddr *) & sin, - sizeof (struct sockaddr_in)); -} - -int -enet_socket_listen (ENetSocket socket, int backlog) -{ - return listen (socket, backlog < 0 ? SOMAXCONN : backlog); -} - -ENetSocket -enet_socket_create (ENetSocketType type) -{ - return socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0); -} - -int -enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) -{ - int result = -1; - switch (option) - { - case ENET_SOCKOPT_NONBLOCK: -#ifdef HAS_FCNTL - result = fcntl (socket, F_SETFL, O_NONBLOCK | fcntl (socket, F_GETFL)); -#else - result = ioctl (socket, FIONBIO, & value); -#endif - break; - - case ENET_SOCKOPT_BROADCAST: - result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_REUSEADDR: - result = setsockopt (socket, SOL_SOCKET, SO_REUSEADDR, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_RCVBUF: - result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_SNDBUF: - result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); - break; - - default: - break; - } - return result == -1 ? -1 : 0; -} - -int -enet_socket_connect (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - - return connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in)); -} - -ENetSocket -enet_socket_accept (ENetSocket socket, ENetAddress * address) -{ - int result; - struct sockaddr_in sin; - socklen_t sinLength = sizeof (struct sockaddr_in); - - result = accept (socket, - address != NULL ? (struct sockaddr *) & sin : NULL, - address != NULL ? & sinLength : NULL); - - if (result == -1) - return ENET_SOCKET_NULL; - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return result; -} - -void -enet_socket_destroy (ENetSocket socket) -{ - close (socket); -} - -int -enet_socket_send (ENetSocket socket, - const ENetAddress * address, - const ENetBuffer * buffers, - size_t bufferCount) -{ - struct msghdr msgHdr; - struct sockaddr_in sin; - int sentLength; - - memset (& msgHdr, 0, sizeof (struct msghdr)); - - if (address != NULL) - { - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - - msgHdr.msg_name = & sin; - msgHdr.msg_namelen = sizeof (struct sockaddr_in); - } - - msgHdr.msg_iov = (struct iovec *) buffers; - msgHdr.msg_iovlen = bufferCount; - - sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL); - - if (sentLength == -1) - { - if (errno == EWOULDBLOCK) - return 0; - - return -1; - } - - return sentLength; -} - -int -enet_socket_receive (ENetSocket socket, - ENetAddress * address, - ENetBuffer * buffers, - size_t bufferCount) -{ - struct msghdr msgHdr; - struct sockaddr_in sin; - int recvLength; - - memset (& msgHdr, 0, sizeof (struct msghdr)); - - if (address != NULL) - { - msgHdr.msg_name = & sin; - msgHdr.msg_namelen = sizeof (struct sockaddr_in); - } - - msgHdr.msg_iov = (struct iovec *) buffers; - msgHdr.msg_iovlen = bufferCount; - - recvLength = recvmsg (socket, & msgHdr, MSG_NOSIGNAL); - - if (recvLength == -1) - { - if (errno == EWOULDBLOCK) - return 0; - - return -1; - } - -#ifdef HAS_MSGHDR_FLAGS - if (msgHdr.msg_flags & MSG_TRUNC) - return -1; -#endif - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return recvLength; -} - -int -enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocketSet * writeSet, enet_uint32 timeout) -{ - struct timeval timeVal; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - return select (maxSocket + 1, readSet, writeSet, NULL, & timeVal); -} - -int -enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout) -{ -#ifdef HAS_POLL - struct pollfd pollSocket; - int pollCount; - - pollSocket.fd = socket; - pollSocket.events = 0; - - if (* condition & ENET_SOCKET_WAIT_SEND) - pollSocket.events |= POLLOUT; - - if (* condition & ENET_SOCKET_WAIT_RECEIVE) - pollSocket.events |= POLLIN; - - pollCount = poll (& pollSocket, 1, timeout); - - if (pollCount < 0) - return -1; - - * condition = ENET_SOCKET_WAIT_NONE; - - if (pollCount == 0) - return 0; - - if (pollSocket.revents & POLLOUT) - * condition |= ENET_SOCKET_WAIT_SEND; - - if (pollSocket.revents & POLLIN) - * condition |= ENET_SOCKET_WAIT_RECEIVE; - - return 0; -#else - fd_set readSet, writeSet; - struct timeval timeVal; - int selectCount; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - FD_ZERO (& readSet); - FD_ZERO (& writeSet); - - if (* condition & ENET_SOCKET_WAIT_SEND) - FD_SET (socket, & writeSet); - - if (* condition & ENET_SOCKET_WAIT_RECEIVE) - FD_SET (socket, & readSet); - - selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal); - - if (selectCount < 0) - return -1; - - * condition = ENET_SOCKET_WAIT_NONE; - - if (selectCount == 0) - return 0; - - if (FD_ISSET (socket, & writeSet)) - * condition |= ENET_SOCKET_WAIT_SEND; - - if (FD_ISSET (socket, & readSet)) - * condition |= ENET_SOCKET_WAIT_RECEIVE; - - return 0; -#endif -} - -#endif - diff --git a/polymer-perf/eduke32/source/enet/src/win32.c b/polymer-perf/eduke32/source/enet/src/win32.c deleted file mode 100644 index e1fae2330..000000000 --- a/polymer-perf/eduke32/source/enet/src/win32.c +++ /dev/null @@ -1,348 +0,0 @@ -/** - @file win32.c - @brief ENet Win32 system specific functions -*/ -#ifdef WIN32 - -#include -#define ENET_BUILDING_LIB 1 -#include "enet/enet.h" - -static enet_uint32 timeBase = 0; - -int -enet_initialize (void) -{ - WORD versionRequested = MAKEWORD (1, 1); - WSADATA wsaData; - - if (WSAStartup (versionRequested, & wsaData)) - return -1; - - if (LOBYTE (wsaData.wVersion) != 1|| - HIBYTE (wsaData.wVersion) != 1) - { - WSACleanup (); - - return -1; - } - - timeBeginPeriod (1); - - return 0; -} - -void -enet_deinitialize (void) -{ - timeEndPeriod (1); - - WSACleanup (); -} - -enet_uint32 -enet_time_get (void) -{ - return (enet_uint32) timeGetTime () - timeBase; -} - -void -enet_time_set (enet_uint32 newTimeBase) -{ - timeBase = (enet_uint32) timeGetTime () - newTimeBase; -} - -int -enet_address_set_host (ENetAddress * address, const char * name) -{ - struct hostent * hostEntry; - - hostEntry = gethostbyname (name); - if (hostEntry == NULL || - hostEntry -> h_addrtype != AF_INET) - { - unsigned long host = inet_addr (name); - if (host == INADDR_NONE) - return -1; - address -> host = host; - return 0; - } - - address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0]; - - return 0; -} - -int -enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength) -{ - char * addr = inet_ntoa (* (struct in_addr *) & address -> host); - if (addr == NULL) - return -1; - strncpy (name, addr, nameLength); - return 0; -} - -int -enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength) -{ - struct in_addr in; - struct hostent * hostEntry; - - in.s_addr = address -> host; - - hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); - if (hostEntry == NULL) - return enet_address_get_host_ip (address, name, nameLength); - - strncpy (name, hostEntry -> h_name, nameLength); - - return 0; -} - -int -enet_socket_bind (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - - if (address != NULL) - { - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - } - else - { - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - } - - return bind (socket, - (struct sockaddr *) & sin, - sizeof (struct sockaddr_in)) == SOCKET_ERROR ? -1 : 0; -} - -int -enet_socket_listen (ENetSocket socket, int backlog) -{ - return listen (socket, backlog < 0 ? SOMAXCONN : backlog) == SOCKET_ERROR ? -1 : 0; -} - -ENetSocket -enet_socket_create (ENetSocketType type) -{ - return socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0); -} - -int -enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) -{ - int result = SOCKET_ERROR; - switch (option) - { - case ENET_SOCKOPT_NONBLOCK: - { - u_long nonBlocking = (u_long) value; - result = ioctlsocket (socket, FIONBIO, & nonBlocking); - break; - } - - case ENET_SOCKOPT_BROADCAST: - result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_REUSEADDR: - result = setsockopt (socket, SOL_SOCKET, SO_REUSEADDR, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_RCVBUF: - result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int)); - break; - - case ENET_SOCKOPT_SNDBUF: - result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); - break; - - default: - break; - } - return result == SOCKET_ERROR ? -1 : 0; -} - -int -enet_socket_connect (ENetSocket socket, const ENetAddress * address) -{ - struct sockaddr_in sin; - - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - - return connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in)) == SOCKET_ERROR ? -1 : 0; -} - -ENetSocket -enet_socket_accept (ENetSocket socket, ENetAddress * address) -{ - SOCKET result; - struct sockaddr_in sin; - int sinLength = sizeof (struct sockaddr_in); - - result = accept (socket, - address != NULL ? (struct sockaddr *) & sin : NULL, - address != NULL ? & sinLength : NULL); - - if (result == INVALID_SOCKET) - return ENET_SOCKET_NULL; - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return result; -} - -void -enet_socket_destroy (ENetSocket socket) -{ - closesocket (socket); -} - -int -enet_socket_send (ENetSocket socket, - const ENetAddress * address, - const ENetBuffer * buffers, - size_t bufferCount) -{ - struct sockaddr_in sin; - DWORD sentLength; - - if (address != NULL) - { - memset (& sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); - sin.sin_addr.s_addr = address -> host; - } - - if (WSASendTo (socket, - (LPWSABUF) buffers, - (DWORD) bufferCount, - & sentLength, - 0, - address != NULL ? (struct sockaddr *) & sin : 0, - address != NULL ? sizeof (struct sockaddr_in) : 0, - NULL, - NULL) == SOCKET_ERROR) - { - if (WSAGetLastError () == WSAEWOULDBLOCK) - return 0; - - return -1; - } - - return (int) sentLength; -} - -int -enet_socket_receive (ENetSocket socket, - ENetAddress * address, - ENetBuffer * buffers, - size_t bufferCount) -{ - INT sinLength = sizeof (struct sockaddr_in); - DWORD flags = 0, - recvLength; - struct sockaddr_in sin; - - if (WSARecvFrom (socket, - (LPWSABUF) buffers, - (DWORD) bufferCount, - & recvLength, - & flags, - address != NULL ? (struct sockaddr *) & sin : NULL, - address != NULL ? & sinLength : NULL, - NULL, - NULL) == SOCKET_ERROR) - { - switch (WSAGetLastError ()) - { - case WSAEWOULDBLOCK: - case WSAECONNRESET: - return 0; - } - - return -1; - } - - if (flags & MSG_PARTIAL) - return -1; - - if (address != NULL) - { - address -> host = (enet_uint32) sin.sin_addr.s_addr; - address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); - } - - return (int) recvLength; -} - -int -enet_socketset_select (ENetSocket maxSocket, ENetSocketSet * readSet, ENetSocketSet * writeSet, enet_uint32 timeout) -{ - struct timeval timeVal; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - return select (maxSocket + 1, readSet, writeSet, NULL, & timeVal); -} - -int -enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout) -{ - fd_set readSet, writeSet; - struct timeval timeVal; - int selectCount; - - timeVal.tv_sec = timeout / 1000; - timeVal.tv_usec = (timeout % 1000) * 1000; - - FD_ZERO (& readSet); - FD_ZERO (& writeSet); - - if (* condition & ENET_SOCKET_WAIT_SEND) - FD_SET (socket, & writeSet); - - if (* condition & ENET_SOCKET_WAIT_RECEIVE) - FD_SET (socket, & readSet); - - selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal); - - if (selectCount < 0) - return -1; - - * condition = ENET_SOCKET_WAIT_NONE; - - if (selectCount == 0) - return 0; - - if (FD_ISSET (socket, & writeSet)) - * condition |= ENET_SOCKET_WAIT_SEND; - - if (FD_ISSET (socket, & readSet)) - * condition |= ENET_SOCKET_WAIT_RECEIVE; - - return 0; -} - -#endif - diff --git a/polymer-perf/eduke32/source/function.h b/polymer-perf/eduke32/source/function.h deleted file mode 100644 index ce9f79c0e..000000000 --- a/polymer-perf/eduke32/source/function.h +++ /dev/null @@ -1,106 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -// function.h - -// file created by makehead.exe -// these headers contain default key assignments, as well as -// default button assignments and game function names -// axis defaults are also included - - -#ifndef _function_public_ -#define _function_public_ -#ifdef __cplusplus -extern "C" { -#endif - -#define NUMKEYENTRIES 56 -#define NUMGAMEFUNCTIONS 56 -#define MAXGAMEFUNCLEN 32 - -extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN]; -extern char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN]; - -enum GameFunction_t - { - gamefunc_Move_Forward, - gamefunc_Move_Backward, - gamefunc_Turn_Left, - gamefunc_Turn_Right, - gamefunc_Strafe, - gamefunc_Fire, - gamefunc_Open, - gamefunc_Run, - gamefunc_AutoRun, - gamefunc_Jump, - gamefunc_Crouch, - gamefunc_Look_Up, - gamefunc_Look_Down, - gamefunc_Look_Left, - gamefunc_Look_Right, - gamefunc_Strafe_Left, - gamefunc_Strafe_Right, - gamefunc_Aim_Up, - gamefunc_Aim_Down, - gamefunc_Weapon_1, - gamefunc_Weapon_2, - gamefunc_Weapon_3, - gamefunc_Weapon_4, - gamefunc_Weapon_5, - gamefunc_Weapon_6, - gamefunc_Weapon_7, - gamefunc_Weapon_8, - gamefunc_Weapon_9, - gamefunc_Weapon_10, - gamefunc_Inventory, - gamefunc_Inventory_Left, - gamefunc_Inventory_Right, - gamefunc_Holo_Duke, - gamefunc_Jetpack, - gamefunc_NightVision, - gamefunc_MedKit, - gamefunc_TurnAround, - gamefunc_SendMessage, - gamefunc_Map, - gamefunc_Shrink_Screen, - gamefunc_Enlarge_Screen, - gamefunc_Center_View, - gamefunc_Holster_Weapon, - gamefunc_Show_Opponents_Weapon, - gamefunc_Map_Follow_Mode, - gamefunc_See_Coop_View, - gamefunc_Mouse_Aiming, - gamefunc_Toggle_Crosshair, - gamefunc_Steroids, - gamefunc_Quick_Kick, - gamefunc_Next_Weapon, - gamefunc_Previous_Weapon, - gamefunc_Show_Console, - gamefunc_Show_DukeMatch_Scores, - gamefunc_Dpad_Select, - gamefunc_Dpad_Aiming - }; -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/game.c b/polymer-perf/eduke32/source/game.c deleted file mode 100644 index 4a21fd370..000000000 --- a/polymer-perf/eduke32/source/game.c +++ /dev/null @@ -1,11368 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "duke3d.h" - -#include "scriplib.h" -#include "file_lib.h" -#include "mathutil.h" -#include "gamedefs.h" -#include "keyboard.h" -#include "mouse.h" // JBF 20030809 -#include "function.h" -#include "control.h" -#include "fx_man.h" -#include "sounds.h" -#include "config.h" -#include "osd.h" -#include "osdfuncs.h" -#include "osdcmds.h" -#include "scriptfile.h" -#include "grpscan.h" -#include "gamedef.h" -#include "kplib.h" -#include "crc32.h" -#include "hightile.h" -#include "control.h" -#include "quicklz.h" -#include "net.h" -#include "premap.h" -#include "gameexec.h" -#include "menus.h" -#include "savegame.h" -#include "anim.h" -#include "demo.h" - -#define ROTATESPRITE_MAX 2048 - -#if KRANDDEBUG -# define GAME_INLINE -# define GAME_STATIC -#else -# define GAME_INLINE inline -# define GAME_STATIC static -#endif - -#ifdef _WIN32 -#include "winlayer.h" -#define WIN32_LEAN_AND_MEAN -#include -#include -extern int32_t G_GetVersionFromWebsite(char *buffer); -#define UPDATEINTERVAL 604800 // 1w -#else -static int32_t usecwd = 0; -#include -#endif /* _WIN32 */ - -int32_t g_quitDeadline = 0; -int32_t g_scriptSanityChecks = 1; - -int32_t g_cameraDistance = 0, g_cameraClock = 0; -static int32_t g_quickExit; -static int32_t g_commandSetup = 0; -int32_t g_noSetup = 0; -static int32_t g_noAutoLoad = 0; -static int32_t g_noSound = 0; -static int32_t g_noMusic = 0; -static char *CommandMap = NULL; -static char *CommandName = NULL; -int32_t g_forceWeaponChoice = 0; - -static struct strllist -{ - struct strllist *next; - char *str; -} -*CommandPaths = NULL, *CommandGrps = NULL; - -char boardfilename[BMAX_PATH] = {0}, currentboardfilename[BMAX_PATH] = {0}; - -static char g_rootDir[BMAX_PATH]; -char g_modDir[BMAX_PATH] = "/"; - - -uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[768],*anim_pal; - -uint8_t *basepaltable[BASEPALCOUNT] = { palette, water_pal, slime_pal, dre_alms, title_pal, ending_pal, NULL }; - -static int32_t g_skipDefaultCons = 0; - -int32_t voting = -1; -int32_t vote_map = -1, vote_episode = -1; - -static int32_t g_Debug = 0; -static int32_t g_noLogoAnim = 0; -static int32_t g_noLogo = 0; - -char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp"; -static char defaultduke3ddef[BMAX_PATH] = "duke3d.def"; -static char defaultconfilename[BMAX_PATH] = { "EDUKE.CON" }; - -char *g_grpNamePtr = defaultduke3dgrp; -char *g_defNamePtr = defaultduke3ddef; -char *g_scriptNamePtr = defaultconfilename; -char *g_gameNamePtr = NULL; - -extern int32_t lastvisinc; - -int32_t g_Shareware = 0; -int32_t g_gameType = 0; - -#define MAXUSERQUOTES 6 -int32_t quotebot, quotebotgoal; -static int32_t user_quote_time[MAXUSERQUOTES]; -static char user_quote[MAXUSERQUOTES][178]; -// char typebuflen,typebuf[41]; - -// This was 32 for a while, but I think lowering it to 24 will help things like the Dingoo. -// Ideally, we would look at our memory usage on our most cramped platform and figure out -// how much of that is needed for the underlying OS and things like SDL instead of guessing -static int32_t MAXCACHE1DSIZE = (24*1048576); - -int32_t tempwallptr; - -static int32_t nonsharedtimer; - -int32_t ticrandomseed; - -static void G_DrawCameraText(int16_t i); -GAME_STATIC GAME_INLINE int32_t G_MoveLoop(void); -static void G_DoOrderScreen(void); - -extern void computergetinput(int32_t snum, input_t *syn); - -#define quotepulseshade (sintable[(totalclock<<5)&2047]>>11) - -int32_t althud_numbertile = 2930; -int32_t althud_numberpal = 0; -int32_t althud_shadows = 1; -int32_t althud_flashing = 1; -int32_t hud_glowingquotes = 1; -int32_t hud_showmapname = 1; - -int32_t g_levelTextTime = 0; - -int32_t r_maxfps = 0; -uint32_t g_frameDelay = 0; - -#if defined(RENDERTYPEWIN) && defined(USE_OPENGL) -extern char forcegl; -#endif - -void M32RunScript(const char *s) { UNREFERENCED_PARAMETER(s); }; // needed for linking since it's referenced from build/src/osd.c - -int32_t kopen4loadfrommod(const char *filename, char searchfirst) -{ - static char fn[BMAX_PATH]; - int32_t r; - - Bsprintf(fn,"%s/%s",g_modDir,filename); - r = kopen4load(fn,searchfirst); - if (r < 0) - r = kopen4load(filename,searchfirst); - - return r; -} - -enum gametokens -{ - T_EOF = -2, - T_ERROR = -1, - T_INCLUDE = 0, - T_INTERFACE = 0, - T_LOADGRP = 1, - T_MODE = 1, - T_CACHESIZE = 2, - T_ALLOW = 2, - T_NOAUTOLOAD, - T_MUSIC, - T_SOUND, - T_FILE, - T_ID -}; - -typedef struct -{ - char *text; - int32_t tokenid; -} -tokenlist; - -static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens) -{ - char *tok; - int32_t i; - - if (!sf) return T_ERROR; - tok = scriptfile_gettoken(sf); - if (!tok) return T_EOF; - - for (i=ntokens-1; i>=0; i--) - { - if (!Bstrcasecmp(tok, tl[i].text)) - return tl[i].tokenid; - } - return T_ERROR; -} - -inline void G_SetStatusBarScale(int32_t sc) -{ - ud.statusbarscale = min(100,max(10,sc)); - G_UpdateScreenArea(); -} - -static inline int32_t sbarx(int32_t x) -{ - if (ud.screen_size == 4 /*|| ud.statusbarmode == 1*/) return scale(x<<16,ud.statusbarscale,100); - return (((320l<<16) - scale(320l<<16,ud.statusbarscale,100)) >> 1) + scale(x<<16,ud.statusbarscale,100); -} - -static inline int32_t sbarxr(int32_t x) -{ - if (ud.screen_size == 4 /*|| ud.statusbarmode == 1*/) return (320l<<16) - scale(x<<16,ud.statusbarscale,100); - return (((320l<<16) - scale(320l<<16,ud.statusbarscale,100)) >> 1) + scale(x<<16,ud.statusbarscale,100); -} - -static inline int32_t sbary(int32_t y) -{ - return ((200l<<16) - scale(200l<<16,ud.statusbarscale,100) + scale(y<<16,ud.statusbarscale,100)); -} - -static inline int32_t sbarsc(int32_t sc) -{ - return scale(sc,ud.statusbarscale,100); -} - -static inline int32_t textsc(int32_t sc) -{ - // prevent ridiculousness to a degree - if (xdim <= 320) return sc; - else if (xdim <= 640) return scale(sc,min(200,ud.textscale),100); - else if (xdim <= 800) return scale(sc,min(300,ud.textscale),100); - else if (xdim <= 1024) return scale(sc,min(350,ud.textscale),100); - return scale(sc,ud.textscale,100); -} - -static void G_PatchStatusBar(int32_t x1, int32_t y1, int32_t x2, int32_t y2) -{ - int32_t scl, tx, ty; - int32_t clx1,cly1,clx2,cly2,clofx,clofy; - - scl = sbarsc(65536); - tx = sbarx(0); - ty = sbary(200-tilesizy[BOTTOMSTATUSBAR]); - - clx1 = scale(scale(x1,xdim,320),ud.statusbarscale,100); - cly1 = scale(scale(y1,ydim,200),ud.statusbarscale,100); - clx2 = scale(scale(x2,xdim,320),ud.statusbarscale,100); - cly2 = scale(scale(y2,ydim,200),ud.statusbarscale,100); - clofx = (xdim - scale(xdim,ud.statusbarscale,100)) >> 1; - clofy = (ydim - scale(ydim,ud.statusbarscale,100)); - -// if (ud.statusbarmode == 0) - rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1+clofx,cly1+clofy,clx2+clofx-1,cly2+clofy-1); -// else rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1,cly1,clx2+clofx-1,cly2+clofy-1); -} - -void P_SetGamePalette(DukePlayer_t *player, uint8_t palid, int32_t set) -{ - if (palid >= BASEPALCOUNT) - palid = BASEPAL; - - if (player != g_player[screenpeek].ps) - { - player->palette = palid; - return; - } - - player->palette = palid; - - setbrightness(ud.brightness>>2, palid, set); -} - -int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const char *t, - int32_t s, int32_t p, int32_t o, - int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z) -{ - int32_t ac; - char centre; - int32_t squishtext = ((f&2) != 0); - int32_t shift = 16, widthx = 320; - int32_t ox, oy, origx = x, origy = y; - - if (t == NULL) - return -1; - - if (o & ROTATESPRITE_MAX) - { - widthx = 320<<16; - shift = 0; - } - - if ((centre = (x == (widthx>>1)))) - { - const char *oldt = t; - int32_t newx = 0; - - do - { - int32_t i; - - if (*t == 32) - { - newx += ((((f & 8) ? 8 : 5) - squishtext) * z)>>16; - continue; - } - - if (*t == '^' && isdigit(*(t+1))) - { - t += 1 + isdigit(*(t+2)); - continue; - } - - ac = *t - '!' + tile; - - if (ac < tile || ac > (tile + 93)) break; - - newx += i = ((((f & 8) ? 8 : tilesizx[ac]) - squishtext) * z)>>16; - - if (*t >= '0' && *t <= '9') - newx -= i - ((8 * z)>>16); - } - while (*(++t)); - - t = oldt; - - x = (f & 4) ? - (xres>>1)-textsc(newx>>1) : - (widthx>>1)-((o & ROTATESPRITE_MAX)?newx<<15:newx>>1); - } - - ox = x; - oy = y; - - do - { - int32_t i; - - if (*t == 32) - { - x += ((((f & 8) ? 8 : 5) - squishtext) * z)>>16; - continue; - } - - if (*t == '^' && isdigit(*(t+1))) - { - char smallbuf[4]; - - if (!isdigit(*(++t+1))) - { - smallbuf[0] = *(t); - smallbuf[1] = '\0'; - p = atoi(smallbuf); - continue; - } - - smallbuf[0] = *(t++); - smallbuf[1] = *(t); - smallbuf[2] = '\0'; - p = atoi(smallbuf); - continue; - } - - ac = *t - '!' + tile; - - if (ac < tile || ac > (tile + 93)) - break; - - if (o&ROTATESPRITE_MAX) - { - ox = x += (x-ox)<<16; - oy = y += (y-oy)<<16; - } - - if (f&4) - rotatesprite(textsc(x<>16 : - ((tilesizx[ac] - squishtext) * z)>>16; - - if ((*t >= '0' && *t <= '9')) - x -= i - ((8 * z)>>16); - - if ((o&ROTATESPRITE_MAX) == 0) // wrapping long strings doesn't work for precise coordinates due to overflow - { - if (((f&4) ? textsc(x) : x) > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET)) - x = origx, y += (8 * z)>>16; - } - } - while (*(++t)); - - return x; -} - -int32_t G_GameTextLen(int32_t x,const char *t) -{ - int32_t ac; - - if (t == NULL) - return -1; - - do - { - if (*t == 32) - { - x+=5; - continue; - } - - ac = *t - '!' + STARTALPHANUM; - - if (ac < STARTALPHANUM || ac > (STARTALPHANUM + 93)) - break; - - x += (*t >= '0' && *t <= '9') ? 8 : tilesizx[ac]; - } - while (*(++t)); - - return (textsc(x)); -} - -inline int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits) -{ - return(G_PrintGameText(4,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536)); -} - -int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb) -{ - int32_t ac; - char ch, cmode; - - cmode = (sb&ROTATESPRITE_MAX)!=0; - sb &= ROTATESPRITE_MAX-1; - - do - { - if (*t == '^' && isdigit(*(t+1))) - { - char smallbuf[4]; - if (!isdigit(*(++t+1))) - { - smallbuf[0] = *(t); - smallbuf[1] = '\0'; - p = atoi(smallbuf); - continue; - } - smallbuf[0] = *(t++); - smallbuf[1] = *(t); - smallbuf[2] = '\0'; - p = atoi(smallbuf); - continue; - } - ch = Btoupper(*t); - if (ch == 32) - { - x+=5; - continue; - } - else ac = ch - '!' + MINIFONT; - - if (cmode) rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,ac,s,p,sb,0,0,xdim-1,ydim-1); - else rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,sb,0,0,xdim-1,ydim-1); - x += 4; // tilesizx[ac]+1; - - } - while (*(++t)); - - return (x); -} - -void G_AddUserQuote(const char *daquote) -{ - int32_t i; - - for (i=MAXUSERQUOTES-1; i>0; i--) - { - Bstrcpy(user_quote[i],user_quote[i-1]); - user_quote_time[i] = user_quote_time[i-1]; - } - Bstrcpy(user_quote[0],daquote); - OSD_Printf("%s\n",daquote); - - user_quote_time[0] = ud.msgdisptime; - pub = NUMPAGES; -} - -void G_HandleSpecialKeys(void) -{ - // we need CONTROL_GetInput in order to pick up joystick button presses - if (CONTROL_Started && !(g_player[myconnectindex].ps->gm & MODE_GAME)) - { - ControlInfo noshareinfo; - CONTROL_GetInput(&noshareinfo); - } - -// CONTROL_ProcessBinds(); - - if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) - { - if (setgamemode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP)) - { - OSD_Printf(OSD_ERROR "Failed setting fullscreen video mode.\n"); - if (setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP)) - G_GameExit("Failed to recover from failure to set fullscreen video mode.\n"); - } - else ud.config.ScreenMode = !ud.config.ScreenMode; - KB_ClearKeyDown(sc_Enter); - g_restorePalette = 1; - G_UpdateScreenArea(); - } - - if (KB_UnBoundKeyPressed(sc_F12)) - { - KB_ClearKeyDown(sc_F12); - screencapture("duke0000.tga",0); - P_DoQuote(QUOTE_SCREEN_SAVED,g_player[myconnectindex].ps); - } - - // only dispatch commands here when not in a game - if (!(g_player[myconnectindex].ps->gm & MODE_GAME)) - OSD_DispatchQueued(); - - if (g_quickExit == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && (KB_KeyPressed(sc_Delete)||KB_KeyPressed(sc_End))) - { - g_quickExit = 1; - G_GameExit("Quick Exit."); - } -} - -void G_GameQuit(void) -{ - if (numplayers < 2) - G_GameExit(" "); - - if (g_gameQuit == 0) - { - g_gameQuit = 1; - g_quitDeadline = totalclock+120; - g_netDisconnect = 1; - } - - if ((totalclock > g_quitDeadline) && (g_gameQuit == 1)) - G_GameExit("Timed out."); -} - -extern int32_t cacnum; -extern cactype cac[]; - -static void G_ShowCacheLocks(void) -{ - int16_t i,k; - - k = 0; - for (i=cacnum-1; i>=0; i--) - if ((*cac[i].lock) >= 200) - { - Bsprintf(tempbuf,"Locked- %d: Leng:%d, Lock:%d",i,cac[i].leng,*cac[i].lock); - printext256(0L,k,31,-1,tempbuf,1); - k += 6; - } - - k += 6; - - for (i=10; i>=0; i--) - if (rts_lumplockbyte[i] >= 200) - { - Bsprintf(tempbuf,"RTS Locked %d:",i); - printext256(0L,k,31,-1,tempbuf,1); - k += 6; - } -} - -int32_t A_CheckInventorySprite(spritetype *s) -{ - switch (DynamicTileMap[s->picnum]) - { - case FIRSTAID__STATIC: - case STEROIDS__STATIC: - case HEATSENSOR__STATIC: - case BOOTS__STATIC: - case JETPACK__STATIC: - case HOLODUKE__STATIC: - case AIRTANK__STATIC: - return 1; - default: - return 0; - } -} - -void G_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation) -{ - int32_t p = sector[g_player[screenpeek].ps->cursectnum].floorpal, a = 0; - - if (orientation&4) - a = 1024; - - rotatesprite((orientation&ROTATESPRITE_MAX)?x:(x<<16),(orientation&ROTATESPRITE_MAX)?y:(y<<16), - 65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2); -} - -void G_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) -{ - int32_t a = 0; - - if (orientation&4) - a = 1024; - - rotatesprite((orientation&ROTATESPRITE_MAX)?x:(x<<16),(orientation&ROTATESPRITE_MAX)?y:(y<<16), - 65536L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2); -} - -void G_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation) -{ - int32_t p = sector[g_player[screenpeek].ps->cursectnum].floorpal, a = 0; - - if (orientation&4) - a = 1024; - - rotatesprite((orientation&ROTATESPRITE_MAX)?x:(x<<16),(orientation&ROTATESPRITE_MAX)?y:(y<<16), - 32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2); -} - -void G_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p) -{ - int32_t a = 0; - - if (orientation&4) - a = 1024; - - rotatesprite((orientation&ROTATESPRITE_MAX)?x:(x<<16),(orientation&ROTATESPRITE_MAX)?y:(y<<16), - 32768L,a,tilenum,shade,p,2|orientation,windowx1,windowy1,windowx2,windowy2); -} - -#define POLYMOSTTRANS (1) -#define POLYMOSTTRANS2 (1|32) - -// draws inventory numbers in the HUD for both the full and mini status bars -static void G_DrawInvNum(int32_t x,int32_t y,char num1,char ha,int32_t sbits) -{ - char dabuf[80] = {0}; - int32_t shd = (x < 0); - - if (shd) x = -x; - - Bsprintf(dabuf,"%d",num1); - if (num1 > 99) - { - if (shd && ud.screen_size == 4 && getrendermode() >= 3 && althud_shadows) - { - rotatesprite(sbarx(x-4+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,4,POLYMOSTTRANS|sbits,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,4,POLYMOSTTRANS|sbits,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+4+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,4,POLYMOSTTRANS|sbits,0,0,xdim-1,ydim-1); - } - rotatesprite(sbarx(x-4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); - return; - } - if (num1 > 9) - { - if (shd && ud.screen_size == 4 && getrendermode() >= 3 && althud_shadows) - { - rotatesprite(sbarx(x+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,4,POLYMOSTTRANS|sbits,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+4+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,4,POLYMOSTTRANS|sbits,0,0,xdim-1,ydim-1); - } - - rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); - return; - } - rotatesprite(sbarx(x+4+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,4,sbits,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); -} - -static void G_DrawWeapNum(int16_t ind,int32_t x,int32_t y,int32_t num1, int32_t num2,int32_t ha) -{ - char dabuf[80] = {0}; - - rotatesprite(sbarx(x-7),sbary(y),sbarsc(65536L),0,THREEBYFIVE+ind+1,ha-10,7,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x-3),sbary(y),sbarsc(65536L),0,THREEBYFIVE+10,ha,0,10,0,0,xdim-1,ydim-1); - - if (VOLUMEONE && (ind > HANDBOMB_WEAPON || ind < 0)) - { - minitextshade(x+1,y-4,"ORDER",20,11,2+8+16+ROTATESPRITE_MAX); - return; - } - - rotatesprite(sbarx(x+9),sbary(y),sbarsc(65536L),0,THREEBYFIVE+11,ha,0,10,0,0,xdim-1,ydim-1); - - if (num1 > 99) num1 = 99; - if (num2 > 99) num2 = 99; - - Bsprintf(dabuf,"%d",num1); - if (num1 > 9) - { - rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); - } - else rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - - Bsprintf(dabuf,"%d",num2); - if (num2 > 9) - { - rotatesprite(sbarx(x+13),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+17),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); - return; - } - rotatesprite(sbarx(x+13),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); -} - -static void G_DrawWeapNum2(char ind,int32_t x,int32_t y,int32_t num1, int32_t num2,char ha) -{ - char dabuf[80] = {0}; - - rotatesprite(sbarx(x-7),sbary(y),sbarsc(65536L),0,THREEBYFIVE+ind+1,ha-10,7,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x-4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+10,ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+13),sbary(y),sbarsc(65536L),0,THREEBYFIVE+11,ha,0,10,0,0,xdim-1,ydim-1); - - Bsprintf(dabuf,"%d",num1); - if (num1 > 99) - { - rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+8),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,0,10,0,0,xdim-1,ydim-1); - } - else if (num1 > 9) - { - rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+8),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); - } - else rotatesprite(sbarx(x+8),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - - Bsprintf(dabuf,"%d",num2); - if (num2 > 99) - { - rotatesprite(sbarx(x+17),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+21),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+25),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,0,10,0,0,xdim-1,ydim-1); - } - else if (num2 > 9) - { - rotatesprite(sbarx(x+17),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(x+21),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); - return; - } - else - rotatesprite(sbarx(x+25),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); -} - -static void G_DrawWeapAmounts(DukePlayer_t *p,int32_t x,int32_t y,int32_t u) -{ - int32_t cw = p->curr_weapon; - - if (u&4) - { - if (u != -1) G_PatchStatusBar(88,178,88+37,178+6); //original code: (96,178,96+12,178+6); - G_DrawWeapNum2(PISTOL_WEAPON,x,y, - p->ammo_amount[PISTOL_WEAPON],p->max_ammo_amount[PISTOL_WEAPON], - 12-20*(cw == PISTOL_WEAPON)); - } - if (u&8) - { - if (u != -1) G_PatchStatusBar(88,184,88+37,184+6); //original code: (96,184,96+12,184+6); - G_DrawWeapNum2(SHOTGUN_WEAPON,x,y+6, - p->ammo_amount[SHOTGUN_WEAPON],p->max_ammo_amount[SHOTGUN_WEAPON], - (((p->gotweapon & (1<ammo_amount[CHAINGUN_WEAPON],p->max_ammo_amount[CHAINGUN_WEAPON], - (((p->gotweapon & (1<ammo_amount[RPG_WEAPON],p->max_ammo_amount[RPG_WEAPON], - (((p->gotweapon & (1<ammo_amount[HANDBOMB_WEAPON],p->max_ammo_amount[HANDBOMB_WEAPON], - (((!p->ammo_amount[HANDBOMB_WEAPON])|((p->gotweapon & (1<subweapon&(1<ammo_amount[GROW_WEAPON],p->max_ammo_amount[GROW_WEAPON], - (((p->gotweapon & (1<ammo_amount[SHRINKER_WEAPON],p->max_ammo_amount[SHRINKER_WEAPON], - (((p->gotweapon & (1<ammo_amount[DEVISTATOR_WEAPON],p->max_ammo_amount[DEVISTATOR_WEAPON], - (((p->gotweapon & (1<ammo_amount[TRIPBOMB_WEAPON],p->max_ammo_amount[TRIPBOMB_WEAPON], - (((p->gotweapon & (1<ammo_amount[FREEZE_WEAPON],p->max_ammo_amount[FREEZE_WEAPON], - (((p->gotweapon & (1<=0; k--) - { - p = DIGITALNUM+*(b+k)-'0'; - j += tilesizx[p]+1; - } - c = x-(j>>1); - - j = 0; - for (k=0; k=0; k--) - { - p = starttile+*(b+k)-'0'; - j += ((1+tilesizx[p])*z)>>16; - } - if (cs&ROTATESPRITE_MAX) j<<=16; - c = x-(j>>1); - - j = 0; - for (k=0; k>((cs&ROTATESPRITE_MAX)?0:16)); - } -} - -static void G_DrawAltDigiNum(int32_t x,int32_t y,int32_t n,char s,int32_t cs) -{ - int32_t i, j = 0, k, p, c; - char b[10]; - int32_t rev = (x < 0); - int32_t shd = (y < 0); - - if (rev) x = -x; - if (shd) y = -y; - - Bsnprintf(b,10,"%d",n); - i = Bstrlen(b); - - for (k=i-1; k>=0; k--) - { - p = althud_numbertile+*(b+k)-'0'; - j += tilesizx[p]+1; - } - c = x-(j>>1); - - if (rev) - { -// j = 0; - for (k=0; k= 3 && althud_shadows) - rotatesprite(sbarxr(c+j-1),sbary(y+1),sbarsc(65536L),0,p,s,4,cs|POLYMOSTTRANS2,0,0,xdim-1,ydim-1); - rotatesprite(sbarxr(c+j),sbary(y),sbarsc(65536L),0,p,s,althud_numberpal,cs,0,0,xdim-1,ydim-1); - j -= tilesizx[p]+1; - } - return; - } - j = 0; - for (k=0; k= 3 && althud_shadows) - rotatesprite(sbarx(c+j+1),sbary(y+1),sbarsc(65536L),0,p,s,4,cs|POLYMOSTTRANS2,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(c+j),sbary(y),sbarsc(65536L),0,p,s,althud_numberpal,cs,0,0,xdim-1,ydim-1); - j += tilesizx[p]+1; - } -} - -static void G_DrawInventory(DukePlayer_t *p) -{ - int32_t n, j = 0, xoff = 0, y; - - n = (p->inv_amount[GET_JETPACK] > 0)<<3; - if (n&8) j++; - n |= (p->inv_amount[GET_SCUBA] > 0)<<5; - if (n&32) j++; - n |= (p->inv_amount[GET_STEROIDS] > 0)<<1; - if (n&2) j++; - n |= (p->inv_amount[GET_HOLODUKE] > 0)<<2; - if (n&4) j++; - n |= (p->inv_amount[GET_FIRSTAID] > 0); - if (n&1) j++; - n |= (p->inv_amount[GET_HEATS] > 0)<<4; - if (n&16) j++; - n |= (p->inv_amount[GET_BOOTS] > 0)<<6; - if (n&64) j++; - - xoff = 160-(j*11); - - j = 0; - - y = 154; - - while (j <= 9) - { - if (n&(1<inven_icon == j+1) - rotatesprite((xoff-2)<<16,(y+19)<<16,65536L,1024,ARROW,-32,0,2+16,windowx1,windowy1,windowx2,windowy2); - } - - j++; - } -} - -void G_DrawFrags(void) -{ - int32_t i, j = 0; - - TRAVERSE_CONNECT(i) - if (i > j) j = i; - - rotatesprite(0,0,65600L,0,FRAGBAR,0,0,2+8+16+64,0,0,xdim-1,ydim-1); - if (j >= 4) rotatesprite(319,(8)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); - if (j >= 8) rotatesprite(319,(16)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); - if (j >= 12) rotatesprite(319,(24)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); - - TRAVERSE_CONNECT(i) - { - minitext(21+(73*(i&3)),2+((i&28)<<1),&g_player[i].user_name[0],/*sprite[g_player[i].ps->i].pal*/g_player[i].ps->palookup,2+8+16); - Bsprintf(tempbuf,"%d",g_player[i].ps->frag-g_player[i].ps->fraggedself); - minitext(17+50+(73*(i&3)),2+((i&28)<<1),tempbuf,/*sprite[g_player[i].ps->i].pal*/g_player[i].ps->palookup,2+8+16); - } -} - -#define SBY (200-tilesizy[BOTTOMSTATUSBAR]) - -static void G_DrawStatusBar(int32_t snum) -{ - DukePlayer_t *p = g_player[snum].ps; - int32_t i, j, o, ss = ud.screen_size, u; - int32_t permbit = 0; - - if (ss < 4) return; - - if (getrendermode() >= 3) pus = NUMPAGES; // JBF 20040101: always redraw in GL - - if ((g_netServer || (g_netServer || ud.multimode > 1)) && (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)) - { - if (pus) - G_DrawFrags(); - else - { - TRAVERSE_CONNECT(i) - if (g_player[i].ps->frag != sbar.frag[i]) - { - G_DrawFrags(); - break; - } - - } - TRAVERSE_CONNECT(i) - if (i != myconnectindex) - sbar.frag[i] = g_player[i].ps->frag; - } - - if (ss == 4) //DRAW MINI STATUS BAR: - { - if (ud.althud) // althud - { - static int32_t ammo_sprites[MAX_WEAPONS]; - - if (!ammo_sprites[0]) - { - /* this looks stupid but it lets us initialize static memory to dynamic values - these values can be changed from the CONs with dynamic tile remapping - but we don't want to have to recreate the values in memory every time - the HUD is drawn */ - - int32_t asprites[MAX_WEAPONS] = { BOOTS, AMMO, SHOTGUNAMMO, - BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, - TRIPBOMBSPRITE, FREEZEAMMO+1, HBOMBAMMO, GROWAMMO - }; - Bmemcpy(ammo_sprites,asprites,sizeof(ammo_sprites)); - } - -// rotatesprite(sbarx(5+1),sbary(200-25+1),sbarsc(49152L),0,SIXPAK,0,4,10+16+1+32,0,0,xdim-1,ydim-1); -// rotatesprite(sbarx(5),sbary(200-25),sbarsc(49152L),0,SIXPAK,0,0,10+16,0,0,xdim-1,ydim-1); - if (getrendermode() >= 3 && althud_shadows) - rotatesprite(sbarx(2+1),sbary(200-21+1),sbarsc(49152L),0,COLA,0,4,10+16+256+POLYMOSTTRANS2,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(2),sbary(200-21),sbarsc(49152L),0,COLA,0,0,10+16+256,0,0,xdim-1,ydim-1); - - if (sprite[p->i].pal == 1 && p->last_extra < 2) - G_DrawAltDigiNum(40,-(200-22),1,-16,10+16+256); - else if (!althud_flashing || p->last_extra > (p->max_player_health>>2) || totalclock&32) - { - int32_t s = -8; - if (althud_flashing && p->last_extra > p->max_player_health) - s += (sintable[(totalclock<<5)&2047]>>10); - G_DrawAltDigiNum(40,-(200-22),p->last_extra,s,10+16+256); - } - - if (getrendermode() >= 3 && althud_shadows) - rotatesprite(sbarx(62+1),sbary(200-25+1),sbarsc(49152L),0,SHIELD,0,4,10+16+POLYMOSTTRANS2+256,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(62),sbary(200-25),sbarsc(49152L),0,SHIELD,0,0,10+16+256,0,0,xdim-1,ydim-1); - - { - int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum); - if (lAmount == -1) lAmount = p->inv_amount[GET_SHIELD]; - G_DrawAltDigiNum(105,-(200-22),lAmount,-16,10+16+256); - } - - if (getrendermode() >= 3 && althud_shadows) - { - if (p->got_access&1) rotatesprite(sbarxr(39-1),sbary(200-43+1),sbarsc(32768),0,ACCESSCARD,0,4,10+16+POLYMOSTTRANS2+512,0,0,xdim-1,ydim-1); - if (p->got_access&4) rotatesprite(sbarxr(34-1),sbary(200-41+1),sbarsc(32768),0,ACCESSCARD,0,4,10+16+POLYMOSTTRANS2+512,0,0,xdim-1,ydim-1); - if (p->got_access&2) rotatesprite(sbarxr(29-1),sbary(200-39+1),sbarsc(32768),0,ACCESSCARD,0,4,10+16+POLYMOSTTRANS2+512,0,0,xdim-1,ydim-1); - } - - if (p->got_access&1) rotatesprite(sbarxr(39),sbary(200-43),sbarsc(32768),0,ACCESSCARD,0,0,10+16+512,0,0,xdim-1,ydim-1); - if (p->got_access&4) rotatesprite(sbarxr(34),sbary(200-41),sbarsc(32768),0,ACCESSCARD,0,23,10+16+512,0,0,xdim-1,ydim-1); - if (p->got_access&2) rotatesprite(sbarxr(29),sbary(200-39),sbarsc(32768),0,ACCESSCARD,0,21,10+16+512,0,0,xdim-1,ydim-1); - - i = (p->curr_weapon == PISTOL_WEAPON) ? 16384 : 32768; - - if (getrendermode() >= 3 && althud_shadows) - rotatesprite(sbarxr(57-1),sbary(200-15+1),sbarsc(i),0,ammo_sprites[p->curr_weapon],0,4,10+POLYMOSTTRANS2+512,0,0,xdim-1,ydim-1); - rotatesprite(sbarxr(57),sbary(200-15),sbarsc(i),0,ammo_sprites[p->curr_weapon],0,0,10+512,0,0,xdim-1,ydim-1); - - if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; - else i = p->curr_weapon; - - if (p->curr_weapon != KNEE_WEAPON && - (!althud_flashing || totalclock&32 || p->ammo_amount[i] > (p->max_ammo_amount[i]/10))) - G_DrawAltDigiNum(-20,-(200-22),p->ammo_amount[i],-16,10+16+512); - - o = 102; - permbit = 0; - - if (p->inven_icon) - { - switch (p->inven_icon) - { - case 1: - i = FIRSTAID_ICON; - break; - case 2: - i = STEROIDS_ICON; - break; - case 3: - i = HOLODUKE_ICON; - break; - case 4: - i = JETPACK_ICON; - break; - case 5: - i = HEAT_ICON; - break; - case 6: - i = AIRTANK_ICON; - break; - case 7: - i = BOOT_ICON; - break; - default: - i = -1; - } - if (i >= 0) - { - if (getrendermode() >= 3 && althud_shadows) - rotatesprite(sbarx(231-o+1),sbary(200-21-2+1),sbarsc(65536L),0,i,0,4,10+16+permbit+POLYMOSTTRANS2+256,0,0,xdim-1,ydim-1); - rotatesprite(sbarx(231-o),sbary(200-21-2),sbarsc(65536L),0,i,0,0,10+16+permbit+256,0,0,xdim-1,ydim-1); - } - - if (getrendermode() >= 3 && althud_shadows) - minitext(292-30-o+1,190-3+1,"%",4,POLYMOSTTRANS+10+16+permbit+256 + ROTATESPRITE_MAX); - minitext(292-30-o,190-3,"%",6,10+16+permbit+256 + ROTATESPRITE_MAX); - - j = 0x80000000; - switch (p->inven_icon) - { - case 1: - i = p->inv_amount[GET_FIRSTAID]; - break; - case 2: - i = ((p->inv_amount[GET_STEROIDS]+3)>>2); - break; - case 3: - i = ((p->inv_amount[GET_HOLODUKE]+15)/24); - j = p->holoduke_on; - break; - case 4: - i = ((p->inv_amount[GET_JETPACK]+15)>>4); - j = p->jetpack_on; - break; - case 5: - i = p->inv_amount[GET_HEATS]/12; - j = p->heat_on; - break; - case 6: - i = ((p->inv_amount[GET_SCUBA]+63)>>6); - break; - case 7: - i = (p->inv_amount[GET_BOOTS]>>1); - break; - } - G_DrawInvNum(-(284-30-o),200-6-3,(uint8_t)i,0,10+permbit+256); - if (j > 0) - { - if (getrendermode() >= 3 && althud_shadows) - minitext(288-30-o+1,180-3+1,"ON",4,POLYMOSTTRANS+10+16+permbit+256 + ROTATESPRITE_MAX); - minitext(288-30-o,180-3,"ON",0,10+16+permbit+256 + ROTATESPRITE_MAX); - } - else if ((uint32_t)j != 0x80000000) - { - if (getrendermode() >= 3 && althud_shadows) - minitext(284-30-o+1,180-3+1,"OFF",4,POLYMOSTTRANS+10+16+permbit+256 + ROTATESPRITE_MAX); - minitext(284-30-o,180-3,"OFF",2,10+16+permbit+256 + ROTATESPRITE_MAX); - } - - if (p->inven_icon >= 6) - { - if (getrendermode() >= 3 && althud_shadows) - minitext(284-35-o+1,180-3+1,"AUTO",4,POLYMOSTTRANS+10+16+permbit+256 + ROTATESPRITE_MAX); - minitext(284-35-o,180-3,"AUTO",2,10+16+permbit+256 + ROTATESPRITE_MAX); - } - } - return; - } - - rotatesprite(sbarx(5),sbary(200-28),sbarsc(65536L),0,HEALTHBOX,0,21,10+16+256,0,0,xdim-1,ydim-1); - if (p->inven_icon) - rotatesprite(sbarx(69),sbary(200-30),sbarsc(65536L),0,INVENTORYBOX,0,21,10+16+256,0,0,xdim-1,ydim-1); - - if (sprite[p->i].pal == 1 && p->last_extra < 2) // frozen - G_DrawDigiNum(20,200-17,1,-16,10+16+256); - else G_DrawDigiNum(20,200-17,p->last_extra,-16,10+16+256); - - rotatesprite(sbarx(37),sbary(200-28),sbarsc(65536L),0,AMMOBOX,0,21,10+16+256,0,0,xdim-1,ydim-1); - - if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; - else i = p->curr_weapon; - G_DrawDigiNum(53,200-17,p->ammo_amount[i],-16,10+16+256); - - o = 158; - permbit = 0; - if (p->inven_icon) - { - switch (p->inven_icon) - { - case 1: - i = FIRSTAID_ICON; - break; - case 2: - i = STEROIDS_ICON; - break; - case 3: - i = HOLODUKE_ICON; - break; - case 4: - i = JETPACK_ICON; - break; - case 5: - i = HEAT_ICON; - break; - case 6: - i = AIRTANK_ICON; - break; - case 7: - i = BOOT_ICON; - break; - default: - i = -1; - } - if (i >= 0) rotatesprite(sbarx(231-o),sbary(200-21),sbarsc(65536L),0,i,0,0,10+16+permbit+256,0,0,xdim-1,ydim-1); - - minitext(292-30-o,190,"%",6,10+16+permbit+256 + ROTATESPRITE_MAX); - - j = 0x80000000; - switch (p->inven_icon) - { - case 1: - i = p->inv_amount[GET_FIRSTAID]; - break; - case 2: - i = ((p->inv_amount[GET_STEROIDS]+3)>>2); - break; - case 3: - i = ((p->inv_amount[GET_HOLODUKE]+15)/24); - j = p->holoduke_on; - break; - case 4: - i = ((p->inv_amount[GET_JETPACK]+15)>>4); - j = p->jetpack_on; - break; - case 5: - i = p->inv_amount[GET_HEATS]/12; - j = p->heat_on; - break; - case 6: - i = ((p->inv_amount[GET_SCUBA]+63)>>6); - break; - case 7: - i = (p->inv_amount[GET_BOOTS]>>1); - break; - } - G_DrawInvNum(284-30-o,200-6,(uint8_t)i,0,10+permbit+256); - if (j > 0) minitext(288-30-o,180,"ON",0,10+16+permbit+256 + ROTATESPRITE_MAX); - else if ((uint32_t)j != 0x80000000) minitext(284-30-o,180,"OFF",2,10+16+permbit+256 + ROTATESPRITE_MAX); - if (p->inven_icon >= 6) minitext(284-35-o,180,"AUTO",2,10+16+permbit+256 + ROTATESPRITE_MAX); - } - return; - } - - //DRAW/UPDATE FULL STATUS BAR: - - if (pus) - { - pus = 0; - u = -1; - } - else u = 0; - - if (sbar.frag[myconnectindex] != p->frag) - { - sbar.frag[myconnectindex] = p->frag; - u |= 32768; - } - if (sbar.got_access != p->got_access) - { - sbar.got_access = p->got_access; - u |= 16384; - } - - if (sbar.last_extra != p->last_extra) - { - sbar.last_extra = p->last_extra; - u |= 1; - } - - { - int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum); - if (lAmount == -1) - { - if (sbar.inv_amount[GET_SHIELD] != p->inv_amount[GET_SHIELD]) - { - sbar.inv_amount[GET_SHIELD] = p->inv_amount[GET_SHIELD]; - u |= 2; - } - - } - else - { - if (sbar.inv_amount[GET_SHIELD] != lAmount) - { - sbar.inv_amount[GET_SHIELD] = lAmount; - u |= 2; - } - - } - } - - if (sbar.curr_weapon != p->curr_weapon) - { - sbar.curr_weapon = p->curr_weapon; - u |= (4+8+16+32+64+128+256+512+1024+65536L); - } - - for (i=1; iammo_amount[i]) - { - sbar.ammo_amount[i] = p->ammo_amount[i]; - if (i < 9) - u |= ((2<gotweapon & (1<gotweapon & (1<inven_icon) - { - sbar.inven_icon = p->inven_icon; - u |= (2048+4096+8192); - } - if (sbar.holoduke_on != p->holoduke_on) - { - sbar.holoduke_on = p->holoduke_on; - u |= (4096+8192); - } - if (sbar.jetpack_on != p->jetpack_on) - { - sbar.jetpack_on = p->jetpack_on; - u |= (4096+8192); - } - if (sbar.heat_on != p->heat_on) - { - sbar.heat_on = p->heat_on; - u |= (4096+8192); - } - if (sbar.inv_amount[GET_FIRSTAID] != p->inv_amount[GET_FIRSTAID]) - { - sbar.inv_amount[GET_FIRSTAID] = p->inv_amount[GET_FIRSTAID]; - u |= 8192; - } - if (sbar.inv_amount[GET_STEROIDS] != p->inv_amount[GET_STEROIDS]) - { - sbar.inv_amount[GET_STEROIDS] = p->inv_amount[GET_STEROIDS]; - u |= 8192; - } - if (sbar.inv_amount[GET_HOLODUKE] != p->inv_amount[GET_HOLODUKE]) - { - sbar.inv_amount[GET_HOLODUKE] = p->inv_amount[GET_HOLODUKE]; - u |= 8192; - } - if (sbar.inv_amount[GET_JETPACK] != p->inv_amount[GET_JETPACK]) - { - sbar.inv_amount[GET_JETPACK] = p->inv_amount[GET_JETPACK]; - u |= 8192; - } - if (sbar.inv_amount[GET_HEATS] != p->inv_amount[GET_HEATS]) - { - sbar.inv_amount[GET_HEATS] = p->inv_amount[GET_HEATS]; - u |= 8192; - } - if (sbar.inv_amount[GET_SCUBA] != p->inv_amount[GET_SCUBA]) - { - sbar.inv_amount[GET_SCUBA] = p->inv_amount[GET_SCUBA]; - u |= 8192; - } - if (sbar.inv_amount[GET_BOOTS] != p->inv_amount[GET_BOOTS]) - { - sbar.inv_amount[GET_BOOTS] = p->inv_amount[GET_BOOTS]; - u |= 8192; - } - if (u == 0) return; - - //0 - update health - //1 - update armor - //2 - update PISTOL_WEAPON ammo - //3 - update SHOTGUN_WEAPON ammo - //4 - update CHAINGUN_WEAPON ammo - //5 - update RPG_WEAPON ammo - //6 - update HANDBOMB_WEAPON ammo - //7 - update SHRINKER_WEAPON ammo - //8 - update DEVISTATOR_WEAPON ammo - //9 - update TRIPBOMB_WEAPON ammo - //10 - update ammo display - //11 - update inventory icon - //12 - update inventory on/off - //13 - update inventory % - //14 - update keys - //15 - update kills - //16 - update FREEZE_WEAPON ammo - - if (u == -1) - { - G_PatchStatusBar(0,0,320,200); - if ((g_netServer || (g_netServer || ud.multimode > 1)) && (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)) - rotatesprite(sbarx(277+1),sbary(SBY+7-1),sbarsc(65536L),0,KILLSICON,0,0,10+16,0,0,xdim-1,ydim-1); - } - if ((g_netServer || (g_netServer || ud.multimode > 1)) && (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)) - { - if (u&32768) - { - if (u != -1) G_PatchStatusBar(276,SBY+17,299,SBY+17+10); - G_DrawDigiNum(287,SBY+17,max(p->frag-p->fraggedself,0),-16,10+16); - } - } - else - { - if (u&16384) - { - if (u != -1) G_PatchStatusBar(275,SBY+18,299,SBY+18+12); - if (p->got_access&4) rotatesprite(sbarx(275),sbary(SBY+16),sbarsc(65536L),0,ACCESS_ICON,0,23,10+16,0,0,xdim-1,ydim-1); - if (p->got_access&2) rotatesprite(sbarx(288),sbary(SBY+16),sbarsc(65536L),0,ACCESS_ICON,0,21,10+16,0,0,xdim-1,ydim-1); - if (p->got_access&1) rotatesprite(sbarx(281),sbary(SBY+23),sbarsc(65536L),0,ACCESS_ICON,0,0,10+16,0,0,xdim-1,ydim-1); - } - } - if (u&(4+8+16+32+64+128+256+512+65536L)) G_DrawWeapAmounts(p,96,SBY+16,u); - - if (u&1) - { - if (u != -1) G_PatchStatusBar(20,SBY+17,43,SBY+17+11); - if (sprite[p->i].pal == 1 && p->last_extra < 2) - G_DrawDigiNum(32,SBY+17,1,-16,10+16); - else G_DrawDigiNum(32,SBY+17,p->last_extra,-16,10+16); - } - if (u&2) - { - int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum); - if (u != -1) G_PatchStatusBar(52,SBY+17,75,SBY+17+11); - if (lAmount == -1) - G_DrawDigiNum(64,SBY+17,p->inv_amount[GET_SHIELD],-16,10+16); - else - G_DrawDigiNum(64,SBY+17,lAmount,-16,10+16); - } - - if (u&1024) - { - if (u != -1) G_PatchStatusBar(196,SBY+17,219,SBY+17+11); - if (p->curr_weapon != KNEE_WEAPON) - { - if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; - else i = p->curr_weapon; - G_DrawDigiNum(230-22,SBY+17,p->ammo_amount[i],-16,10+16); - } - } - - if (u&(2048+4096+8192)) - { - if (u != -1) - { - if (u&(2048+4096)) - { - G_PatchStatusBar(231,SBY+13,265,SBY+13+18); - } - else - { - G_PatchStatusBar(250,SBY+24,261,SBY+24+6); - } - - } - if (p->inven_icon) - { - o = 0; -// permbit = 128; - - if (u&(2048+4096)) - { - switch (p->inven_icon) - { - case 1: - i = FIRSTAID_ICON; - break; - case 2: - i = STEROIDS_ICON; - break; - case 3: - i = HOLODUKE_ICON; - break; - case 4: - i = JETPACK_ICON; - break; - case 5: - i = HEAT_ICON; - break; - case 6: - i = AIRTANK_ICON; - break; - case 7: - i = BOOT_ICON; - break; - } - rotatesprite(sbarx(231-o),sbary(SBY+13),sbarsc(65536L),0,i,0,0,10+16+permbit,0,0,xdim-1,ydim-1); - minitext(292-30-o,SBY+24,"%",6,10+16+permbit + ROTATESPRITE_MAX); - if (p->inven_icon >= 6) minitext(284-35-o,SBY+14,"AUTO",2,10+16+permbit + ROTATESPRITE_MAX); - } - if (u&(2048+4096)) - { - switch (p->inven_icon) - { - case 3: - j = p->holoduke_on; - break; - case 4: - j = p->jetpack_on; - break; - case 5: - j = p->heat_on; - break; - default: - j = 0x80000000; - } - if (j > 0) minitext(288-30-o,SBY+14,"ON",0,10+16+permbit + ROTATESPRITE_MAX); - else if ((uint32_t)j != 0x80000000) minitext(284-30-o,SBY+14,"OFF",2,10+16+permbit + ROTATESPRITE_MAX); - } - if (u&8192) - { - switch (p->inven_icon) - { - case 1: - i = p->inv_amount[GET_FIRSTAID]; - break; - case 2: - i = ((p->inv_amount[GET_STEROIDS]+3)>>2); - break; - case 3: - i = ((p->inv_amount[GET_HOLODUKE]+15)/24); - break; - case 4: - i = ((p->inv_amount[GET_JETPACK]+15)>>4); - break; - case 5: - i = p->inv_amount[GET_HEATS]/12; - break; - case 6: - i = ((p->inv_amount[GET_SCUBA]+63)>>6); - break; - case 7: - i = (p->inv_amount[GET_BOOTS]>>1); - break; - } - G_DrawInvNum(284-30-o,SBY+28,(uint8_t)i,0,10+permbit); - } - } - } -} - -#define COLOR_RED 248 -#define COLOR_WHITE 31 -#define LOW_FPS 30 - -static void G_PrintFPS(void) -{ - // adapted from ZDoom because I like it better than what we had - // applicable ZDoom code available under GPL from csDoom - static int32_t FrameCount = 0; - static int32_t LastCount = 0; - static int32_t LastSec = 0; - static int32_t LastMS = 0; - int32_t ms = getticks(); - int32_t howlong = ms - LastMS; - if (howlong >= 0) - { - int32_t thisSec = ms/1000; - int32_t x = (xdim <= 640); - - if (ud.tickrate) - { - int32_t chars = Bsprintf(tempbuf, "%d ms (%3u fps)", howlong, LastCount); - - printext256(windowx2-(chars<<(3-x))+1,windowy1+2,0,-1,tempbuf,x); - printext256(windowx2-(chars<<(3-x)),windowy1+1, - (LastCount < LOW_FPS) ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x); - - // lag meter - if (g_netClientPeer) - { - chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2, - (g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2); - - printext256(windowx2-(chars<<(3-x))+1,windowy1+10+2,0,-1,tempbuf,x); - printext256(windowx2-(chars<<(3-x)),windowy1+10+1,g_netClientPeer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x); - } - } - - if (thisSec - LastSec) - { - g_currentFrameRate = LastCount = FrameCount / (thisSec - LastSec); - LastSec = thisSec; - FrameCount = 0; - } - FrameCount++; - } - LastMS = ms; -} - -static void G_PrintCoords(int32_t snum) -{ - int32_t y = 16; - - if ((GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)) - { - if (ud.multimode > 4) - y = 32; - else if (g_netServer || (g_netServer || ud.multimode > 1)) - y = 24; - } - Bsprintf(tempbuf,"XYZ= (%d,%d,%d)",g_player[snum].ps->pos.x,g_player[snum].ps->pos.y,g_player[snum].ps->pos.z); - printext256(250L,y,31,-1,tempbuf,0); - Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz); - printext256(250L,y+9L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"ZV= %d",g_player[snum].ps->vel.z); - printext256(250L,y+18L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"OG= %d",g_player[snum].ps->on_ground); - printext256(250L,y+27L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"SECTL= %d",sector[g_player[snum].ps->cursectnum].lotag); - printext256(250L,y+36L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"SEED= %d",randomseed); - printext256(250L,y+45L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"THOLD= %d",g_player[snum].ps->transporter_hold); - printext256(250L,y+54L+7,31,-1,tempbuf,0); -} - -// this handles both multiplayer and item pickup message type text -// both are passed on to gametext - -void G_PrintGameQuotes(void) -{ - int32_t i, j, k, l; - - k = 1; - if (GTFLAGS(GAMETYPE_FRAGBAR) && ud.screen_size > 0 && (g_netServer || (g_netServer || ud.multimode > 1))) - { - j = 0; - k += 8; - TRAVERSE_CONNECT(i) - if (i > j) j = i; - - if (j >= 4 && j <= 8) k += 8; - else if (j > 8 && j <= 12) k += 16; - else if (j > 12) k += 24; - } - - if (g_player[screenpeek].ps->fta > 1 && (g_player[screenpeek].ps->ftq < QUOTE_RESERVED || g_player[screenpeek].ps->ftq > QUOTE_RESERVED3)) - { - if (g_player[screenpeek].ps->fta > 6) - k += 7; - else k += g_player[screenpeek].ps->fta; - } - - j = k; - - j = scale(j,ydim,200); - for (i=MAXUSERQUOTES-1; i>=0; i--) - { - if (user_quote_time[i] <= 0) continue; - k = user_quote_time[i]; - if (hud_glowingquotes) - { - if (k > 4) { mpgametext(j,user_quote[i],(sintable[((totalclock+(i<<2))<<5)&2047]>>11),2+8+16); j += textsc(8); } - else if (k > 2) { mpgametext(j,user_quote[i],(sintable[((totalclock+(i<<2))<<5)&2047]>>11),2+8+16+1); j += textsc(k<<1); } - else { mpgametext(j,user_quote[i],(sintable[((totalclock+(i<<2))<<5)&2047]>>11),2+8+16+1+32); j += textsc(k<<1); } - } - else - { - if (k > 4) { mpgametext(j,user_quote[i],0,2+8+16); j += textsc(8); } - else if (k > 2) { mpgametext(j,user_quote[i],0,2+8+16+1); j += textsc(k<<1); } - else { mpgametext(j,user_quote[i],0,2+8+16+1+32); j += textsc(k<<1); } - } - l = G_GameTextLen(USERQUOTE_LEFTOFFSET,OSD_StripColors(tempbuf,user_quote[i])); - while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET)) - { - l -= (ud.config.ScreenWidth-USERQUOTE_RIGHTOFFSET); - if (k > 4) j += textsc(8); - else j += textsc(k<<1); - - } - } - - if ((klabs(quotebotgoal-quotebot) <= 16) && (ud.screen_size <= 8)) - quotebot += ksgn(quotebotgoal-quotebot); - else - quotebot = quotebotgoal; - - if (g_player[screenpeek].ps->fta <= 1) return; - - if (ScriptQuotes[g_player[screenpeek].ps->ftq] == NULL) - { - OSD_Printf(OSD_ERROR "%s %d null quote %d\n",__FILE__,__LINE__,g_player[screenpeek].ps->ftq); - return; - } - - k = 0; - - if (g_player[screenpeek].ps->ftq >= QUOTE_RESERVED && g_player[screenpeek].ps->ftq <= QUOTE_RESERVED3) - { - k = 140;//quotebot-8-4; - } - else if (GTFLAGS(GAMETYPE_FRAGBAR) && ud.screen_size > 0 && (g_netServer || ud.multimode > 1)) - { - j = 0; - k = 8; - TRAVERSE_CONNECT(i) - if (i > j) j = i; - - if (j >= 4 && j <= 8) k += 8; - else if (j > 8 && j <= 12) k += 16; - else if (j > 12) k += 24; - } - - j = g_player[screenpeek].ps->fta; - if (!hud_glowingquotes) - { - if (j > 4) gametext(320>>1,k,ScriptQuotes[g_player[screenpeek].ps->ftq],0,2+8+16); - else if (j > 2) gametext(320>>1,k,ScriptQuotes[g_player[screenpeek].ps->ftq],0,2+8+16+1); - else gametext(320>>1,k,ScriptQuotes[g_player[screenpeek].ps->ftq],0,2+8+16+1+32); - return; - } - if (j > 4) gametext(320>>1,k,ScriptQuotes[g_player[screenpeek].ps->ftq],quotepulseshade,2+8+16); - else if (j > 2) gametext(320>>1,k,ScriptQuotes[g_player[screenpeek].ps->ftq],quotepulseshade,2+8+16+1); - else gametext(320>>1,k,ScriptQuotes[g_player[screenpeek].ps->ftq],quotepulseshade,2+8+16+1+32); -} - -void P_DoQuote(int32_t q, DukePlayer_t *p) -{ - int32_t cq = 0; - - if (q & MAXQUOTES) - { - cq = 1; - q &= ~MAXQUOTES; - } - - if (ScriptQuotes[q] == NULL) - { - OSD_Printf(OSD_ERROR "%s %d null quote %d\n",__FILE__,__LINE__,q); - return; - } - - if (ud.fta_on == 0) - return; - - if (p->fta > 0 && q != QUOTE_RESERVED && q != QUOTE_RESERVED2) - if (p->ftq == QUOTE_RESERVED || p->ftq == QUOTE_RESERVED2) return; - - p->fta = 100; - - if (p->ftq != q) - { - if (p == g_player[screenpeek].ps) - { - if (cq) OSD_Printf(OSDTEXT_BLUE "%s\n",ScriptQuotes[q]); - else OSD_Printf("%s\n",ScriptQuotes[q]); - } - - p->ftq = q; - } - pub = NUMPAGES; - pus = NUMPAGES; -} - -void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e) -{ - setpalettefade(r,g,b,e&63); - -// if (getrendermode() >= 3) pus = pub = NUMPAGES; // JBF 20040110: redraw the status bar next time - if ((e&128) == 0) - { - int32_t tc; - nextpage(); - for (tc = totalclock; totalclock < tc + 4; handleevents(), Net_GetPackets()); - } -} - -void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step) -{ - if (step > 0) - { - for (; start < end; start += step) - { - if (KB_KeyPressed(sc_Space)) - { - KB_ClearKeyDown(sc_Space); - return; - } - G_FadePalette(r,g,b,start); - } - } - else for (; start >= end; start += step) - { - if (KB_KeyPressed(sc_Space)) - { - KB_ClearKeyDown(sc_Space); - return; - } - G_FadePalette(r,g,b,start); - } -} - -void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t tile) -{ - if (step > 0) - { - for (; start < end; start += step) - { - if (KB_KeyPressed(sc_Space)) - { - KB_ClearKeyDown(sc_Space); - return; - } - rotatesprite(0,0,65536L,0,tile,0,0,2+8+16+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - G_FadePalette(r,g,b,start); - } - } - else for (; start >= end; start += step) - { - if (KB_KeyPressed(sc_Space)) - { - KB_ClearKeyDown(sc_Space); - return; - } - rotatesprite(0,0,65536L,0,tile,0,0,2+8+16+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - G_FadePalette(r,g,b,start); - } -} - -static void G_DisplayExtraScreens(void) -{ - int32_t flags = Gv_GetVarByLabel("LOGO_FLAGS",255, -1, -1); - - S_StopMusic(); - FX_StopAllSounds(); - - if (!VOLUMEALL || flags & LOGO_SHAREWARESCREENS) - { - setview(0,0,xdim-1,ydim-1); - flushperms(); - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 - fadepal(0,0,0, 0,64,7); - KB_FlushKeyboardQueue(); - rotatesprite(0,0,65536L,0,3291,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepaltile(0,0,0, 63,0,-7, 3291); - while (!KB_KeyWaiting()) - { - handleevents(); - Net_GetPackets(); - } - - fadepaltile(0,0,0, 0,64,7, 3291); - KB_FlushKeyboardQueue(); - rotatesprite(0,0,65536L,0,3290,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepaltile(0,0,0, 63,0,-7,3290); - while (!KB_KeyWaiting()) - { - handleevents(); - Net_GetPackets(); - } - } - - if (flags & LOGO_TENSCREEN) - { - setview(0,0,xdim-1,ydim-1); - flushperms(); - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 - fadepal(0,0,0, 0,64,7); - KB_FlushKeyboardQueue(); - rotatesprite(0,0,65536L,0,TENSCREEN,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepaltile(0,0,0, 63,0,-7,TENSCREEN); - while (!KB_KeyWaiting() && totalclock < 2400) - { - handleevents(); - Net_GetPackets(); - } - } -} - -extern int32_t qsetmode; -extern int32_t g_doQuickSave; - -void G_GameExit(const char *t) -{ - if (*t != 0) g_player[myconnectindex].ps->palette = BASEPAL; - - if (ud.recstat == 1) G_CloseDemoWrite(); - else if (ud.recstat == 2) - { - if (g_demo_filePtr) fclose(g_demo_filePtr); - } // JBF: fixes crash on demo playback - - if (!g_quickExit) - { - if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *t == ' ') - { - G_BonusScreen(1); - setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP); - } - - if (*t != 0 && *(t+1) != 'V' && *(t+1) != 'Y') - G_DisplayExtraScreens(); - } - - if (*t != 0) initprintf("%s\n",t); - - if (qsetmode == 200) - G_Shutdown(); - - if (*t != 0) - { - if (!(t[0] == ' ' && t[1] == 0)) - { - char titlebuf[256]; - Bsprintf(titlebuf,HEAD2 " %s",s_buildRev); - wm_msgbox(titlebuf, "%s", (char *)t); - } - } - - uninitgroupfile(); - - exit(0); -} - -char inputloc = 0; - -int32_t _EnterText(int32_t small,int32_t x,int32_t y,char *t,int32_t dalen,int32_t c) -{ - char ch; - int32_t i; - - while ((ch = KB_Getch()) != 0 || (g_player[myconnectindex].ps->gm&MODE_MENU && MOUSE_GetButtons()&RIGHT_MOUSE)) - { - if (ch == asc_BackSpace) - { - if (inputloc > 0) - { - inputloc--; - *(t+inputloc) = 0; - } - } - else - { - if (ch == asc_Enter) - { - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - return (1); - } - else if (ch == asc_Escape || (g_player[myconnectindex].ps->gm&MODE_MENU && MOUSE_GetButtons()&RIGHT_MOUSE)) - { - KB_ClearKeyDown(sc_Escape); - MOUSE_ClearButton(RIGHT_MOUSE); - return (-1); - } - else if (ch >= 32 && inputloc < dalen && ch < 127) - { - ch = Btoupper(ch); - if (c != 997 || (ch >= '0' && ch <= '9')) - { - // JBF 20040508: so we can have numeric only if we want - *(t+inputloc) = ch; - *(t+inputloc+1) = 0; - inputloc++; - } - } - } - } - - if (c == 999) return(0); - if (c == 998) - { - char b[91],ii; - for (ii=0; iigm&MODE_TYPE) - x = mpgametext(y,b,c,2+8+16); - else x = gametext(x,y,b,c,2+8+16); - } - else - { - if (g_player[myconnectindex].ps->gm&MODE_TYPE) - x = mpgametext(y,t,c,2+8+16); - else x = gametext(x,y,t,c,2+8+16); - } - c = 4-(sintable[(totalclock<<4)&2047]>>11); - - i = G_GameTextLen(USERQUOTE_LEFTOFFSET,OSD_StripColors(tempbuf,t)); - while (i > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET)) - { - i -= (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET); - if (small&1) - y += textsc(6); - y += 8; - } - - if (small&1) - rotatesprite(textsc(x)<<16,(y<<16),32768,0,SPINNINGNUKEICON+((totalclock>>3)%7),c,0,(small&1)?(8|16):2+8,0,0,xdim-1,ydim-1); - else rotatesprite((x+((small&1)?4:8))<<16,((y+((small&1)?0:4))<<16),32768,0,SPINNINGNUKEICON+((totalclock>>3)%7),c,0,(small&1)?(8|16):2+8,0,0,xdim-1,ydim-1); - return (0); -} - - -static inline void G_MoveClouds(void) -{ - int32_t i; - - if (totalclock <= cloudtotalclock || totalclock >= (cloudtotalclock-7)) - return; - - cloudtotalclock = totalclock+6; - - for (i=g_numClouds-1; i>=0; i--) - { - cloudx[i] += (sintable[(g_player[screenpeek].ps->ang+512)&2047]>>9); - cloudy[i] += (sintable[g_player[screenpeek].ps->ang&2047]>>9); - - sector[clouds[i]].ceilingxpanning = cloudx[i]>>6; - sector[clouds[i]].ceilingypanning = cloudy[i]>>6; - } -} - -static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16_t cang) -{ - int32_t i, j, k, l, x1, y1, x2=0, y2=0, x3, y3, x4, y4, ox, oy, xoff, yoff; - int32_t dax, day, cosang, sinang, xspan, yspan, sprx, spry; - int32_t xrepeat, yrepeat, z1, z2, startwall, endwall, tilenum, daang; - int32_t xvect, yvect, xvect2, yvect2; - int16_t p; - char col; - walltype *wal, *wal2; - spritetype *spr; - int32_t oydim=ydim; - - ydim = (int32_t)((double)xdim * 0.625f); - setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); - ydim = oydim; - - xvect = sintable[(-cang)&2047] * czoom; - yvect = sintable[(1536-cang)&2047] * czoom; - xvect2 = mulscale16(xvect,yxaspect); - yvect2 = mulscale16(yvect,yxaspect); - - //Draw red lines - for (i=numsectors-1; i>=0; i--) - { - if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; - - startwall = sector[i].wallptr; - endwall = sector[i].wallptr + sector[i].wallnum; - - z1 = sector[i].ceilingz; - z2 = sector[i].floorz; - - for (j=startwall,wal=&wall[startwall]; jnextwall; - if (k < 0) continue; - - //if ((show2dwall[j>>3]&(1<<(j&7))) == 0) continue; - //if ((k > j) && ((show2dwall[k>>3]&(1<<(k&7))) > 0)) continue; - - if (sector[wal->nextsector].ceilingz == z1) - if (sector[wal->nextsector].floorz == z2) - if (((wal->cstat|wall[wal->nextwall].cstat)&(16+32)) == 0) continue; - - col = 139; //red - if ((wal->cstat|wall[wal->nextwall].cstat)&1) col = 234; //magenta - - if (!(show2dsector[wal->nextsector>>3]&(1<<(wal->nextsector&7)))) - col = 24; - else continue; - - ox = wal->x-cposx; - oy = wal->y-cposy; - x1 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); - y1 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); - - wal2 = &wall[wal->point2]; - ox = wal2->x-cposx; - oy = wal2->y-cposy; - x2 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); - y2 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); - - drawline256(x1,y1,x2,y2,col); - } - } - - //Draw sprites - k = g_player[screenpeek].ps->i; - for (i=numsectors-1; i>=0; i--) - { - if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; - for (j=headspritesect[i]; j>=0; j=nextspritesect[j]) - //if ((show2dsprite[j>>3]&(1<<(j&7))) > 0) - { - spr = &sprite[j]; - - if (j == k || (spr->cstat&0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue; - - col = 71; //cyan - if (spr->cstat&1) col = 234; //magenta - - sprx = spr->x; - spry = spr->y; - - if ((spr->cstat&257) != 0) switch (spr->cstat&48) - { - case 0: -// break; - - ox = sprx-cposx; - oy = spry-cposy; - x1 = dmulscale16(ox,xvect,-oy,yvect); - y1 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = (sintable[(spr->ang+512)&2047]>>7); - oy = (sintable[(spr->ang)&2047]>>7); - x2 = dmulscale16(ox,xvect,-oy,yvect); - y2 = dmulscale16(oy,xvect,ox,yvect); - - x3 = mulscale16(x2,yxaspect); - y3 = mulscale16(y2,yxaspect); - - drawline256(x1-x2+(xdim<<11),y1-y3+(ydim<<11), - x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); - drawline256(x1-y2+(xdim<<11),y1+x3+(ydim<<11), - x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); - drawline256(x1+y2+(xdim<<11),y1-x3+(ydim<<11), - x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); - break; - - case 16: - if (spr->picnum == LASERLINE) - { - x1 = sprx; - y1 = spry; - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - if ((spr->cstat&4) > 0) xoff = -xoff; - k = spr->ang; - l = spr->xrepeat; - dax = sintable[k&2047]*l; - day = sintable[(k+1536)&2047]*l; - l = tilesizx[tilenum]; - k = (l>>1)+xoff; - x1 -= mulscale16(dax,k); - x2 = x1+mulscale16(dax,l); - y1 -= mulscale16(day,k); - y2 = y1+mulscale16(day,l); - - ox = x1-cposx; - oy = y1-cposy; - x1 = dmulscale16(ox,xvect,-oy,yvect); - y1 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = x2-cposx; - oy = y2-cposy; - x2 = dmulscale16(ox,xvect,-oy,yvect); - y2 = dmulscale16(oy,xvect2,ox,yvect2); - - drawline256(x1+(xdim<<11),y1+(ydim<<11), - x2+(xdim<<11),y2+(ydim<<11),col); - } - - break; - - case 32: - - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset); - if ((spr->cstat&4) > 0) xoff = -xoff; - if ((spr->cstat&8) > 0) yoff = -yoff; - - k = spr->ang; - cosang = sintable[(k+512)&2047]; - sinang = sintable[k]; - xspan = tilesizx[tilenum]; - xrepeat = spr->xrepeat; - yspan = tilesizy[tilenum]; - yrepeat = spr->yrepeat; - - dax = ((xspan>>1)+xoff)*xrepeat; - day = ((yspan>>1)+yoff)*yrepeat; - x1 = sprx + dmulscale16(sinang,dax,cosang,day); - y1 = spry + dmulscale16(sinang,day,-cosang,dax); - l = xspan*xrepeat; - x2 = x1 - mulscale16(sinang,l); - y2 = y1 + mulscale16(cosang,l); - l = yspan*yrepeat; - k = -mulscale16(cosang,l); - x3 = x2+k; - x4 = x1+k; - k = -mulscale16(sinang,l); - y3 = y2+k; - y4 = y1+k; - - ox = x1-cposx; - oy = y1-cposy; - x1 = dmulscale16(ox,xvect,-oy,yvect); - y1 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = x2-cposx; - oy = y2-cposy; - x2 = dmulscale16(ox,xvect,-oy,yvect); - y2 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = x3-cposx; - oy = y3-cposy; - x3 = dmulscale16(ox,xvect,-oy,yvect); - y3 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = x4-cposx; - oy = y4-cposy; - x4 = dmulscale16(ox,xvect,-oy,yvect); - y4 = dmulscale16(oy,xvect2,ox,yvect2); - - drawline256(x1+(xdim<<11),y1+(ydim<<11), - x2+(xdim<<11),y2+(ydim<<11),col); - - drawline256(x2+(xdim<<11),y2+(ydim<<11), - x3+(xdim<<11),y3+(ydim<<11),col); - - drawline256(x3+(xdim<<11),y3+(ydim<<11), - x4+(xdim<<11),y4+(ydim<<11),col); - - drawline256(x4+(xdim<<11),y4+(ydim<<11), - x1+(xdim<<11),y1+(ydim<<11),col); - - break; - } - } - } - - //Draw white lines - for (i=numsectors-1; i>=0; i--) - { - if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; - - startwall = sector[i].wallptr; - endwall = sector[i].wallptr + sector[i].wallnum; - - k = -1; - for (j=startwall,wal=&wall[startwall]; jnextwall >= 0) continue; - - //if ((show2dwall[j>>3]&(1<<(j&7))) == 0) continue; - - if (tilesizx[wal->picnum] == 0) continue; - if (tilesizy[wal->picnum] == 0) continue; - - if (j == k) - { - x1 = x2; - y1 = y2; - } - else - { - ox = wal->x-cposx; - oy = wal->y-cposy; - x1 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); - y1 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); - } - - k = wal->point2; - wal2 = &wall[k]; - ox = wal2->x-cposx; - oy = wal2->y-cposy; - x2 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); - y2 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); - - drawline256(x1,y1,x2,y2,24); - } - } - - setaspect_new(); - - TRAVERSE_CONNECT(p) - { - if (ud.scrollmode && p == screenpeek) continue; - - ox = sprite[g_player[p].ps->i].x-cposx; - oy = sprite[g_player[p].ps->i].y-cposy; - daang = (sprite[g_player[p].ps->i].ang-cang)&2047; - if (p == screenpeek) - { - ox = 0; - oy = 0; - daang = 0; - } - x1 = mulscale(ox,xvect,16) - mulscale(oy,yvect,16); - y1 = mulscale(oy,xvect2,16) + mulscale(ox,yvect2,16); - - if (p == screenpeek || GTFLAGS(GAMETYPE_OTHERPLAYERSINMAP)) - { - if (sprite[g_player[p].ps->i].xvel > 16 && g_player[p].ps->on_ground) - i = APLAYERTOP+((totalclock>>4)&3); - else - i = APLAYERTOP; - - j = klabs(g_player[p].ps->truefz-g_player[p].ps->pos.z)>>8; - j = mulscale(czoom*(sprite[g_player[p].ps->i].yrepeat+j),yxaspect,16); - - if (j < 22000) j = 22000; - else if (j > (65536<<1)) j = (65536<<1); - - rotatesprite((x1<<4)+(xdim<<15),(y1<<4)+(ydim<<15),j,daang,i,sprite[g_player[p].ps->i].shade, - (g_player[p].ps->cursectnum > -1)?sector[g_player[p].ps->cursectnum].floorpal:0, - 0,windowx1,windowy1,windowx2,windowy2); - } - } -} - -#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1) - -palette_t CrosshairColors = { 255, 255, 255, 0 }; -palette_t DefaultCrosshairColors = { 0, 0, 0, 0 }; -int32_t g_crosshairSum = 0; - -void G_GetCrosshairColor(void) -{ - // use the brightest color in the original 8-bit tile - int32_t bri = 0, j = 0, i; - int32_t ii; - char *ptr = (char *)waloff[CROSSHAIR]; - - if (DefaultCrosshairColors.f) - return; - - if (waloff[CROSSHAIR] == 0) - { - loadtile(CROSSHAIR); - ptr = (char *)waloff[CROSSHAIR]; - } - - ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR]; - - if (ii <= 0) return; - - do - { - if (*ptr != 255) - { - i = curpalette[(int32_t)*ptr].r+curpalette[(int32_t)*ptr].g+curpalette[(int32_t)*ptr].b; - if (i > j) { j = i; bri = *ptr; } - } - ptr++; - } - while (--ii); - - Bmemcpy(&CrosshairColors, &curpalette[bri], sizeof(palette_t)); - Bmemcpy(&DefaultCrosshairColors, &curpalette[bri], sizeof(palette_t)); - DefaultCrosshairColors.f = 1; // this flag signifies that the color has been detected -} - -void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) -{ - char *ptr = (char *)waloff[CROSSHAIR]; - int32_t i, ii; - - if (DefaultCrosshairColors.f == 0 || g_crosshairSum == r+(g<<1)+(b<<2)) return; - - g_crosshairSum = r+(g<<1)+(b<<2); - CrosshairColors.r = r; - CrosshairColors.g = g; - CrosshairColors.b = b; - - if (waloff[CROSSHAIR] == 0) - { - loadtile(CROSSHAIR); - ptr = (char *)waloff[CROSSHAIR]; - } - - ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR]; - if (ii <= 0) return; - - if (getrendermode() < 3) - i = getclosestcol(CrosshairColors.r>>2, CrosshairColors.g>>2, CrosshairColors.b>>2); - else i = getclosestcol(63, 63, 63); // use white in GL so we can tint it to the right color - - do - { - if (*ptr != 255) - *ptr = i; - ptr++; - } - while (--ii); - - for (i = 255; i >= 0; i--) - tempbuf[i] = i; - - makepalookup(CROSSHAIR_PAL,tempbuf,CrosshairColors.r>>2, CrosshairColors.g>>2, CrosshairColors.b>>2,1); - -#ifdef USE_OPENGL - Bmemcpy(&hictinting[CROSSHAIR_PAL], &CrosshairColors, sizeof(palette_t)); - hictinting[CROSSHAIR_PAL].f = 9; -#endif - invalidatetile(CROSSHAIR, -1, -1); -} - -#define SCORESHEETOFFSET -20 -static void G_ShowScores(void) -{ - int32_t t, i; - - if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) - { - gametext(160,SCORESHEETOFFSET+58+2,"MULTIPLAYER TOTALS",0,2+8+16); - gametext(160,SCORESHEETOFFSET+58+10,MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name,0,2+8+16); - - t = 0; - minitext(70,SCORESHEETOFFSET+80,"NAME",8,2+8+16+ROTATESPRITE_MAX); - minitext(170,SCORESHEETOFFSET+80,"FRAGS",8,2+8+16+ROTATESPRITE_MAX); - minitext(200,SCORESHEETOFFSET+80,"DEATHS",8,2+8+16+ROTATESPRITE_MAX); - minitext(235,SCORESHEETOFFSET+80,"PING",8,2+8+16+ROTATESPRITE_MAX); - - for (i=playerswhenstarted-1; i>=0; i--) - { - if (!g_player[i].playerquitflag) - continue; - - minitext(70,SCORESHEETOFFSET+90+t,g_player[i].user_name,g_player[i].ps->palookup,2+8+16+ROTATESPRITE_MAX); - - Bsprintf(tempbuf,"%-4d",g_player[i].ps->frag); - minitext(170,SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+ROTATESPRITE_MAX); - - Bsprintf(tempbuf,"%-4d", g_player[i].frags[i] + g_player[i].ps->fraggedself); - minitext(200,SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+ROTATESPRITE_MAX); - - Bsprintf(tempbuf,"%-4d",g_player[i].ping); - minitext(235,SCORESHEETOFFSET+90+t,tempbuf,2,2+8+16+ROTATESPRITE_MAX); - - t += 7; - } - } -} -#undef SCORESHEETOFFSET - -void G_DisplayRest(int32_t smoothratio) -{ - int32_t a, i, j; - int32_t applyTint=0; - palette_t tempFade = { 0, 0, 0, 0 }; - palette_t tempTint = { 0, 0, 0, 0 }; - - DukePlayer_t *pp = g_player[screenpeek].ps; - walltype *wal; - int32_t cposx, cposy, cang; - -#ifdef USE_OPENGL - - // this takes care of fullscreen tint for OpenGL - if (getrendermode() >= 3) - { - if (pp->palette == WATERPAL) - { - static palette_t wp = { 224, 192, 255, 0 }; - Bmemcpy(&hictinting[MAXPALOOKUPS-1], &wp, sizeof(palette_t)); - } - else if (pp->palette == SLIMEPAL) - { - static palette_t sp = { 208, 255, 192, 0 }; - Bmemcpy(&hictinting[MAXPALOOKUPS-1], &sp, sizeof(palette_t)); - } - else - { - hictinting[MAXPALOOKUPS-1].r = 255; - hictinting[MAXPALOOKUPS-1].g = 255; - hictinting[MAXPALOOKUPS-1].b = 255; - } - } -#endif /* USE_OPENGL && POLYMOST */ - // this does pain tinting etc from the CON - if (pp->pals.f > 0 && pp->loogcnt == 0) // JBF 20040101: pals.f > 0 now >= 0 - { - Bmemcpy(&tempFade, &pp->pals, sizeof(palette_t)); - g_restorePalette = 1; // JBF 20040101 - applyTint = 1; - } - // reset a normal palette - else if (g_restorePalette) - { - P_SetGamePalette(pp,pp->palette,2); - g_restorePalette = 0; - } - // loogies courtesy of being snotted on - else if (pp->loogcnt > 0) - { - palette_t lp = { 0, 64, 0, pp->loogcnt>>1 }; - Bmemcpy(&tempFade, &lp, sizeof(palette_t)); - applyTint = 1; - } - if (tempFade.f > tempTint.f) - Bmemcpy(&tempTint, &tempFade, sizeof(palette_t)); - - if (ud.show_help) - { - switch (ud.show_help) - { - case 1: - rotatesprite(0,0,65536L,0,TEXTSTORY,0,0,10+16+64, 0,0,xdim-1,ydim-1); - break; - case 2: - rotatesprite(0,0,65536L,0,F1HELP,0,0,10+16+64, 0,0,xdim-1,ydim-1); - break; - } - - if (KB_KeyPressed(sc_Escape) || MOUSE_GetButtons()&RIGHT_MOUSE) - { - KB_ClearKeyDown(sc_Escape); - MOUSE_ClearButton(RIGHT_MOUSE); - ud.show_help = 0; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - G_UpdateScreenArea(); - } - if (tempTint.f > 0 || applyTint) G_FadePalette(tempTint.r,tempTint.g,tempTint.b,tempTint.f|128); - return; - } - - i = pp->cursectnum; - if (i > -1) - { - show2dsector[i>>3] |= (1<<(i&7)); - wal = &wall[sector[i].wallptr]; - for (j=sector[i].wallnum; j>0; j--,wal++) - { - i = wal->nextsector; - if (i < 0) continue; - if (wal->cstat&0x0071) continue; - if (wall[wal->nextwall].cstat&0x0071) continue; - if (sector[i].lotag == 32767) continue; - if (sector[i].ceilingz >= sector[i].floorz) continue; - show2dsector[i>>3] |= (1<<(i&7)); - } - } - - if (ud.camerasprite == -1) - { - if (ud.overhead_on != 2) - { - if (pp->newowner >= 0) - G_DrawCameraText(pp->newowner); - else - { - P_DisplayWeapon(screenpeek); - if (pp->over_shoulder_on == 0) - P_DisplayScuba(screenpeek); - } - G_MoveClouds(); - } - - if (ud.overhead_on > 0) - { - // smoothratio = min(max(smoothratio,0),65536); - smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); - G_DoInterpolations(smoothratio); - if (ud.scrollmode == 0) - { - if (pp->newowner == -1 && !ud.pause_on) - { - cposx = pp->opos.x+mulscale16((int32_t)(pp->pos.x-pp->opos.x),smoothratio); - cposy = pp->opos.y+mulscale16((int32_t)(pp->pos.y-pp->opos.y),smoothratio); - cang = pp->oang+mulscale16((int32_t)(((pp->ang+1024-pp->oang)&2047)-1024),smoothratio); - } - else - { - cposx = pp->opos.x; - cposy = pp->opos.y; - cang = pp->oang; - } - } - else - { - if (!ud.pause_on) - { - ud.fola += ud.folavel>>3; - ud.folx += (ud.folfvel*sintable[(512+2048-ud.fola)&2047])>>14; - ud.foly += (ud.folfvel*sintable[(512+1024-512-ud.fola)&2047])>>14; - } - cposx = ud.folx; - cposy = ud.foly; - cang = ud.fola; - } - - if (ud.overhead_on == 2) - { - clearview(0L); - drawmapview(cposx,cposy,pp->zoom,cang); - } - G_DrawOverheadMap(cposx,cposy,pp->zoom,cang); - - G_RestoreInterpolations(); - - if (ud.overhead_on == 2) - { - if (ud.screen_size > 0) a = 147; - else a = 179; - minitext(5,a+6,EpisodeNames[ud.volume_number],0,2+8+16+256); - minitext(5,a+6+6,MapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name,0,2+8+16+256); - } - } - } - - if (pp->invdisptime > 0) G_DrawInventory(pp); - - aGameVars[g_iReturnVarID].val.lValue = 0; - if (apScriptGameEvent[EVENT_DISPLAYSBAR]) - VM_OnEvent(EVENT_DISPLAYSBAR, g_player[screenpeek].ps->i, screenpeek, -1); - if (aGameVars[g_iReturnVarID].val.lValue == 0) - G_DrawStatusBar(screenpeek); - - G_PrintGameQuotes(); - - if (ud.show_level_text && hud_showmapname && g_levelTextTime > 1) - { - int32_t bits = 10+16; - - if (g_levelTextTime < 3) - bits |= 1+32; - else if (g_levelTextTime < 5) - bits |= 1; - - if (MapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL) - { - if (currentboardfilename[0] != 0 && ud.volume_number == 0 && ud.level_number == 7) - menutext_(160,75,-g_levelTextTime+22/*quotepulseshade*/,0,currentboardfilename,bits); - else menutext_(160,75,-g_levelTextTime+22/*quotepulseshade*/,0,MapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name,bits); - } - } - - if (KB_KeyPressed(sc_Escape) && ud.overhead_on == 0 - && ud.show_help == 0 - && g_player[myconnectindex].ps->newowner == -1) - { - if ((g_player[myconnectindex].ps->gm&MODE_MENU) == MODE_MENU && g_currentMenu < 51) - { - KB_ClearKeyDown(sc_Escape); - g_player[myconnectindex].ps->gm &= ~MODE_MENU; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - g_cameraClock = totalclock; - g_cameraDistance = 65536L; - } - walock[TILE_SAVESHOT] = 199; - G_UpdateScreenArea(); - } - else if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU && - g_player[myconnectindex].ps->newowner == -1 && - (g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE) - { - KB_ClearKeyDown(sc_Escape); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - S_MenuSound(); - - g_player[myconnectindex].ps->gm |= MODE_MENU; - - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) ready2send = 0; - - if (g_player[myconnectindex].ps->gm&MODE_GAME) ChangeToMenu(50); - else ChangeToMenu(0); - screenpeek = myconnectindex; - } - } - - if (apScriptGameEvent[EVENT_DISPLAYREST]) - VM_OnEvent(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek, -1); - - if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1) - { - aGameVars[g_iReturnVarID].val.lValue = 0; - if (apScriptGameEvent[EVENT_DISPLAYCROSSHAIR]) - VM_OnEvent(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, -1); - if (aGameVars[g_iReturnVarID].val.lValue == 0) - rotatesprite((160L-(g_player[myconnectindex].ps->look_ang>>1))<<16,100L<<16,scale(65536,ud.crosshairscale,100), - 0,CROSSHAIR,0,CROSSHAIR_PAL,2+1,windowx1,windowy1,windowx2,windowy2); - } -#if 0 - if (GametypeFlags[ud.coop] & GAMETYPE_TDM) - { - for (i=0; iteam == g_player[myconnectindex].ps->team) - { - j = min(max((G_GetAngleDelta(getangle(g_player[i].ps->pos.x-g_player[myconnectindex].ps->pos.x, - g_player[i].ps->pos.y-g_player[myconnectindex].ps->pos.y),g_player[myconnectindex].ps->ang))>>1,-160),160); - rotatesprite((160-j)<<16,100L<<16,65536L,0,DUKEICON,0,0,2+1,windowx1,windowy1,windowx2,windowy2); - } - } - } -#endif - - if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) - menutext(160,100,0,0,"GAME PAUSED"); - - if (ud.coords) - G_PrintCoords(screenpeek); - -#ifdef USE_OPENGL - { - extern int32_t mdpause; - - mdpause = 0; - if (ud.pause_on || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2)) - mdpause = 1; - } -#endif - - G_PrintFPS(); - - // JBF 20040124: display level stats in screen corner - if ((ud.overhead_on != 2 && ud.levelstats) && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) - { - if (ud.screen_size == 4) - { - i = scale(ud.althud?tilesizy[BIGALPHANUM]+10:tilesizy[INVENTORYBOX]+2,ud.statusbarscale,100); -// j = scale(scale(6,ud.config.ScreenWidth,320),ud.statusbarscale,100); - } - else if (ud.screen_size > 2) - { - i = scale(tilesizy[BOTTOMSTATUSBAR]+1,ud.statusbarscale,100); - // j = scale(2,ud.config.ScreenWidth,320); - } - else - { - i = 2; - // j = scale(2,ud.config.ScreenWidth,320); - } - j = scale(2,ud.config.ScreenWidth,320); - - Bsprintf(tempbuf,"T:^15%d:%02d.%02d", - (g_player[myconnectindex].ps->player_par/(REALGAMETICSPERSEC*60)), - (g_player[myconnectindex].ps->player_par/REALGAMETICSPERSEC)%60, - ((g_player[myconnectindex].ps->player_par%REALGAMETICSPERSEC)*33)/10 - ); - G_PrintGameText(13,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(21),tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536); - - if (ud.player_skill > 3 || ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_PLAYERSFRIENDLY))) - Bsprintf(tempbuf,"K:^15%d",(ud.multimode>1 &&!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY))? - g_player[myconnectindex].ps->frag-g_player[myconnectindex].ps->fraggedself:g_player[myconnectindex].ps->actors_killed); - else - { - if (g_player[myconnectindex].ps->actors_killed >= g_player[myconnectindex].ps->max_actors_killed) - Bsprintf(tempbuf,"K:%d/%d",g_player[myconnectindex].ps->actors_killed, - g_player[myconnectindex].ps->max_actors_killed>g_player[myconnectindex].ps->actors_killed? - g_player[myconnectindex].ps->max_actors_killed:g_player[myconnectindex].ps->actors_killed); - else - Bsprintf(tempbuf,"K:^15%d/%d",g_player[myconnectindex].ps->actors_killed, - g_player[myconnectindex].ps->max_actors_killed>g_player[myconnectindex].ps->actors_killed? - g_player[myconnectindex].ps->max_actors_killed:g_player[myconnectindex].ps->actors_killed); - } - G_PrintGameText(13,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(14),tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536); - - if (g_player[myconnectindex].ps->secret_rooms == g_player[myconnectindex].ps->max_secret_rooms) - Bsprintf(tempbuf,"S:%d/%d", g_player[myconnectindex].ps->secret_rooms,g_player[myconnectindex].ps->max_secret_rooms); - else Bsprintf(tempbuf,"S:^15%d/%d", g_player[myconnectindex].ps->secret_rooms,g_player[myconnectindex].ps->max_secret_rooms); - G_PrintGameText(13,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(7),tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536); - } - - if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex) - { - Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE FOR MAP",g_player[voting].user_name); - gametext(160,40,tempbuf,0,2+8+16); - Bsprintf(tempbuf,"%s (E%dL%d)",MapInfo[vote_episode*MAXLEVELS + vote_map].name,vote_episode+1,vote_map+1); - gametext(160,48,tempbuf,0,2+8+16); - gametext(160,70,"PRESS F1 TO ACCEPT, F2 TO DECLINE",0,2+8+16); - } - - if (BUTTON(gamefunc_Show_DukeMatch_Scores)) G_ShowScores(); - - if (g_Debug) G_ShowCacheLocks(); - - if (VOLUMEONE) - { - if (ud.show_help == 0 && g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) - rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1); - } - - if (g_player[myconnectindex].ps->gm&MODE_TYPE) - Net_EnterMessage(); - else - M_DisplayMenus(); - - if (tempTint.f > 0 || applyTint) - G_FadePalette(tempTint.r,tempTint.g,tempTint.b,tempTint.f|128); -} - -static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, int32_t ang, int32_t horiz) -{ - spritetype *sp = &sprite[pp->i]; - int32_t i, hx, hy; - int32_t daang; - int32_t bakcstat = sp->cstat; - hitdata_t hitinfo; - vec3_t n = { (sintable[(ang+1536)&2047]>>4), - (sintable[(ang+1024)&2047]>>4), - (horiz-100)*128 - }; - - sp->cstat &= (int16_t)~0x101; - - updatesectorz(vect->x,vect->y,vect->z,vsectnum); - hitscan((const vec3_t *)vect,*vsectnum,n.x,n.y,n.z,&hitinfo,CLIPMASK1); - - if (*vsectnum < 0) - { - sp->cstat = bakcstat; - return; - } - - hx = hitinfo.pos.x-(vect->x); - hy = hitinfo.pos.y-(vect->y); - if (klabs(n.x)+klabs(n.y) > klabs(hx)+klabs(hy)) - { - *vsectnum = hitinfo.hitsect; - if (hitinfo.hitwall >= 0) - { - daang = getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x, - wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y); - - i = n.x*sintable[daang]+n.y*sintable[(daang+1536)&2047]; - if (klabs(n.x) > klabs(n.y)) hx -= mulscale28(n.x,i); - else hy -= mulscale28(n.y,i); - } - else if (hitinfo.hitsprite < 0) - { - if (klabs(n.x) > klabs(n.y)) hx -= (n.x>>5); - else hy -= (n.y>>5); - } - if (klabs(n.x) > klabs(n.y)) i = divscale16(hx,n.x); - else i = divscale16(hy,n.y); - if (i < g_cameraDistance) g_cameraDistance = i; - } - vect->x += mulscale16(n.x,g_cameraDistance); - vect->y += mulscale16(n.y,g_cameraDistance); - vect->z += mulscale16(n.z,g_cameraDistance); - - g_cameraDistance = min(g_cameraDistance+((totalclock-g_cameraClock)<<10),65536); - g_cameraClock = totalclock; - - updatesectorz(vect->x,vect->y,vect->z,vsectnum); - - sp->cstat = bakcstat; -} - -//REPLACE FULLY -void G_DrawBackground(void) -{ - int32_t dapicnum; - int32_t x,y,x1,y1,x2,y2,rx; - - flushperms(); - - dapicnum = BIGHOLE; - - if (tilesizx[dapicnum] == 0 || tilesizy[dapicnum] == 0) - { - pus = pub = NUMPAGES; - return; - } - - y1 = 0; - y2 = ydim; - if (g_player[myconnectindex].ps->gm &MODE_GAME || ud.recstat == 2) - { - if (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR) - { - if ((g_netServer || ud.multimode > 1)) y1 += scale(ydim,8,200); - if (ud.multimode > 4) y1 += scale(ydim,8,200); - } - } - else - { - // when not rendering a game, fullscreen wipe -#define MENUTILE (!getrendermode()?MENUSCREEN:LOADSCREEN) -// Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1); - aGameVars[g_iReturnVarID].val.lValue = (tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE); - if (apScriptGameEvent[EVENT_GETMENUTILE]) - VM_OnEvent(EVENT_GETMENUTILE, -1, myconnectindex, -1); - if (Gv_GetVarByLabel("MENU_TILE", tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?0:1, -1, -1)) - { - for (y=y1; y 8) - { - // across top - for (y=0; y= 8 && ud.statusbarmode == 0) - { - /* - y1 = y2; - x2 = (xdim - scale(xdim,ud.statusbarscale,100)) >> 1; - x1 = xdim-x2; - x1 -= x1%tilesizx[dapicnum]; - for (y=y1-y1%tilesizy[dapicnum]; y> 1; - for (y=y2-y2%tilesizy[dapicnum]; y>1; x+=tilesizx[dapicnum]) - { - rotatesprite(x<<16,y<<16,65536L,0,dapicnum,8,0,8+16+64,0,y2,x2,ydim-1); - rotatesprite((xdim-x)<<16,y<<16,65536L,0,dapicnum,8,0,8+16+64,xdim-x2-1,y2,xdim-1,ydim-1); - } - - } - - if (ud.screen_size > 8) - { - y = 0; - if (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR) - { - if ((g_netServer || ud.multimode > 1)) y += 8; - if (ud.multimode > 4) y += 8; - } - - x1 = max(windowx1-4,0); - y1 = max(windowy1-4,y); - x2 = min(windowx2+4,xdim-1); - y2 = min(windowy2+4,scale(ydim,200-scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100),200)-1); - - for (y=y1+4; yyvel; - - if (klabs(sector[sp->sectnum].floorz - sp->z) < klabs(sector[sprite[sprite2].sectnum].floorz - sprite[sprite2].z)) - level = 1; - - x = ud.camera.x - sp->x; - y = ud.camera.y - sp->y; - z = ud.camera.z - (level ? sector[sp->sectnum].floorz : sector[sp->sectnum].ceilingz); - - sect = sprite[sprite2].sectnum; - updatesector(sprite[sprite2].x + x, sprite[sprite2].y + y, §); - - if (sect != -1) - { - int32_t renderz, picnum; - int16_t backupstat[MAXSECTORS]; - int32_t backupz[MAXSECTORS]; - int32_t i; - int32_t pix_diff, newz; - // initprintf("drawing ror\n"); - - if (level) - { - // renderz = sector[sprite[sprite2].sectnum].ceilingz; - renderz = sprite[sprite2].z - (sprite[sprite2].yrepeat * tilesizy[sprite[sprite2].picnum]<<1); - picnum = sector[sprite[sprite2].sectnum].ceilingpicnum; - sector[sprite[sprite2].sectnum].ceilingpicnum = 562; - tilesizx[562] = tilesizy[562] = 0; - - pix_diff = klabs(z) >> 8; - newz = - ((pix_diff / 128) + 1) * (128<<8); - - for (i = 0; i < numsectors; i++) - { - backupstat[i] = sector[i].ceilingstat; - backupz[i] = sector[i].ceilingz; - if (!ror_protectedsectors[i] || (ror_protectedsectors[i] && sp->lotag == 41)) - { - sector[i].ceilingstat = 1; - sector[i].ceilingz += newz; - } - } - } - else - { - // renderz = sector[sprite[sprite2].sectnum].floorz; - renderz = sprite[sprite2].z; - picnum = sector[sprite[sprite2].sectnum].floorpicnum; - sector[sprite[sprite2].sectnum].floorpicnum = 562; - tilesizx[562] = tilesizy[562] = 0; - - pix_diff = klabs(z) >> 8; - newz = ((pix_diff / 128) + 1) * (128<<8); - - for (i = 0; i < numsectors; i++) - { - backupstat[i] = sector[i].floorstat; - backupz[i] = sector[i].floorz; - if (!ror_protectedsectors[i] || (ror_protectedsectors[i] && sp->lotag == 41)) - { - sector[i].floorstat = 1; - sector[i].floorz = +newz; - } - } - } - -#ifdef POLYMER - if (getrendermode() == 4) - polymer_setanimatesprites(G_DoSpriteAnimations, ud.camera.x, ud.camera.y, ud.cameraang, smoothratio); -#endif - - drawrooms(sprite[sprite2].x + x, sprite[sprite2].y + y, - z + renderz, ud.cameraang, ud.camerahoriz, sect); - drawing_ror = 1 + level; - - // dupe the sprites touching the portal to the other sector - - if (drawing_ror == 2) // viewing from top - { - int32_t k = headspritesect[sp->sectnum]; - - while (k != -1) - { - if (sprite[k].picnum != SECTOREFFECTOR && (sprite[k].z >= sp->z)) - { - Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)&sprite[k],sizeof(spritetype)); - - tsprite[spritesortcnt].x += (sprite[sp->yvel].x-sp->x); - tsprite[spritesortcnt].y += (sprite[sp->yvel].y-sp->y); - tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sp->z + actor[sp->yvel].ceilingz; - tsprite[spritesortcnt].sectnum = sprite[sp->yvel].sectnum; - tsprite[spritesortcnt].owner = k; - - //OSD_Printf("duped sprite of pic %d at %d %d %d\n",tsprite[spritesortcnt].picnum,tsprite[spritesortcnt].x,tsprite[spritesortcnt].y,tsprite[spritesortcnt].z); - spritesortcnt++; - } - k = nextspritesect[k]; - } - } - - G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); - drawmasks(); - - if (level) - { - sector[sprite[sprite2].sectnum].ceilingpicnum = picnum; - for (i = 0; i < numsectors; i++) - { - sector[i].ceilingstat = backupstat[i]; - sector[i].ceilingz = backupz[i]; - } - } - else - { - sector[sprite[sprite2].sectnum].floorpicnum = picnum; - - for (i = 0; i < numsectors; i++) - { - sector[i].floorstat = backupstat[i]; - sector[i].floorz = backupz[i]; - } - } - } - } -} - -void G_DrawRooms(int32_t snum, int32_t smoothratio) -{ - int32_t dst,j,fz,cz; - int32_t tposx,tposy,i; - int16_t k; - DukePlayer_t *p = g_player[snum].ps; - int16_t tang; - int32_t tiltcx,tiltcy,tiltcs=0; // JBF 20030807 - - int32_t tmpyx=yxaspect, tmpvr=viewingrange; - - if (g_networkMode == NET_DEDICATED_SERVER) return; - - if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always - { - if (getrendermode() >= 3 || ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100)) - G_DrawBackground(); - pub = 0; - } - - if (ud.overhead_on == 2 || ud.show_help || (p->cursectnum == -1 && getrendermode() < 3)) - return; - - if (r_usenewaspect) - { - newaspect_enable = 1; - setaspect_new(); - } - -// smoothratio = min(max(smoothratio,0),65536); - smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); - - visibility = (int32_t)(p->visibility * (numplayers > 1 ? 1.f : r_ambientlightrecip)); - - if (ud.pause_on || g_player[snum].ps->on_crane > -1) smoothratio = 65536; - - ud.camerasect = p->cursectnum; - - G_DoInterpolations(smoothratio); - G_AnimateCamSprite(); - - if (ud.camerasprite >= 0) - { - spritetype *s = &sprite[ud.camerasprite]; - - if (s->yvel < 0) s->yvel = -100; - else if (s->yvel > 199) s->yvel = 300; - - ud.cameraang = actor[ud.camerasprite].tempang+ - mulscale16((int32_t)(((s->ang+1024-actor[ud.camerasprite].tempang)&2047)-1024),smoothratio); - - G_SE40(smoothratio); - -#ifdef POLYMER - if (getrendermode() == 4) - polymer_setanimatesprites(G_DoSpriteAnimations, s->x, s->y, ud.cameraang, smoothratio); -#endif - - drawrooms(s->x,s->y,s->z-(4<<8),ud.cameraang,s->yvel,s->sectnum); - - G_DoSpriteAnimations(s->x,s->y,ud.cameraang,smoothratio); - - drawmasks(); - } - else - { - i = divscale22(1,sprite[p->i].yrepeat+28); - - if (!r_usenewaspect) - { -// if (i != oyrepeat) - { - oyrepeat = i; - setaspect(oyrepeat,yxaspect); - } - } - else - { - tmpvr = i; - tmpyx = (65536*ydim*8)/(xdim*5); - } - - if (g_screenCapture) - { - walock[TILE_SAVESHOT] = 199; - if (waloff[TILE_SAVESHOT] == 0) - allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); - setviewtotile(TILE_SAVESHOT,200L,320L); - } - else if (getrendermode() == 0 && ((ud.screen_tilting && p->rotscrnang) || ud.detail==0)) - { - if (ud.screen_tilting) tang = p->rotscrnang; - else tang = 0; - - if (xres <= 320 && yres <= 240) - { - // JBF 20030807: Increased tilted-screen quality - tiltcs = 1; - tiltcx = 320; - tiltcy = 200; - } - else - { - tiltcs = 2; - tiltcx = 640; - tiltcy = 400; - } - - walock[TILE_TILT] = 255; - if (waloff[TILE_TILT] == 0) - allocache(&waloff[TILE_TILT],tiltcx*tiltcx,&walock[TILE_TILT]); - if ((tang&1023) == 0) - setviewtotile(TILE_TILT,tiltcy>>(1-ud.detail),tiltcx>>(1-ud.detail)); - else - setviewtotile(TILE_TILT,tiltcx>>(1-ud.detail),tiltcx>>(1-ud.detail)); - if ((tang&1023) == 512) - { - //Block off unscreen section of 90ø tilted screen - j = ((tiltcx-(60*tiltcs))>>(1-ud.detail)); - for (i=((60*tiltcs)>>(1-ud.detail))-1; i>=0; i--) - { - startumost[i] = 1; - startumost[i+j] = 1; - startdmost[i] = 0; - startdmost[i+j] = 0; - } - } - - i = (tang&511); - if (i > 256) i = 512-i; - i = sintable[i+512]*8 + sintable[i]*5L; - setaspect(i>>1,yxaspect); - - tmpvr = i>>1; - tmpyx = (65536*ydim*8)/(xdim*5); - } - else if (getrendermode() > 0 && ud.screen_tilting /*&& (p->rotscrnang || p->orotscrnang)*/) - { -#ifdef USE_OPENGL - setrollangle(p->orotscrnang + mulscale16(((p->rotscrnang - p->orotscrnang + 1024)&2047)-1024,smoothratio)); -#endif - p->orotscrnang = p->rotscrnang; // JBF: save it for next time - } - - { - vec3_t cam = { p->opos.x+mulscale16((int32_t)(p->pos.x-p->opos.x),smoothratio), - p->opos.y+mulscale16((int32_t)(p->pos.y-p->opos.y),smoothratio), - p->opos.z+mulscale16((int32_t)(p->pos.z-p->opos.z),smoothratio) - }; - - Bmemcpy(&ud.camera, &cam, sizeof(vec3_t)); - ud.cameraang = p->oang+mulscale16((int32_t)(((p->ang+1024-p->oang)&2047)-1024),smoothratio); - ud.camerahoriz = p->ohoriz+p->ohorizoff+mulscale16((int32_t)(p->horiz+p->horizoff-p->ohoriz-p->ohorizoff),smoothratio); - } - ud.cameraang += p->look_ang; - - if (p->newowner >= 0) - { - ud.cameraang = p->ang+p->look_ang; - ud.camerahoriz = p->horiz+p->horizoff; - Bmemcpy(&ud.camera, p, sizeof(vec3_t)); - ud.camerasect = sprite[p->newowner].sectnum; - smoothratio = 65536L; - } - else if (ud.viewbob) // if (p->over_shoulder_on == 0) - { - if (p->over_shoulder_on) - ud.camera.z += (p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio))>>3; - else ud.camera.z += p->opyoff+mulscale16((int32_t)(p->pyoff-p->opyoff),smoothratio); - } - if (p->over_shoulder_on) - { - ud.camera.z -= 3072; - G_DoThirdPerson(p,(vec3_t *)&ud,&ud.camerasect,ud.cameraang,ud.camerahoriz); - } - - cz = actor[p->i].ceilingz; - fz = actor[p->i].floorz; - - if (g_earthquakeTime > 0 && p->on_ground == 1) - { - ud.camera.z += 256-(((g_earthquakeTime)&1)<<9); - ud.cameraang += (2-((g_earthquakeTime)&2))<<2; - } - - if (sprite[p->i].pal == 1) ud.camera.z -= (18<<8); - - if (p->newowner >= 0) - ud.camerahoriz = 100+sprite[p->newowner].shade; - else if (p->spritebridge == 0) - { - if (ud.camera.z < (p->truecz + (4<<8))) ud.camera.z = cz + (4<<8); - else if (ud.camera.z > (p->truefz - (4<<8))) ud.camera.z = fz - (4<<8); - } - - if (ud.camerasect >= 0) - { - getzsofslope(ud.camerasect,ud.camera.x,ud.camera.y,&cz,&fz); - if (ud.camera.z < cz+(4<<8)) ud.camera.z = cz+(4<<8); - if (ud.camera.z > fz-(4<<8)) ud.camera.z = fz-(4<<8); - } - - if (ud.camerahoriz > HORIZ_MAX) ud.camerahoriz = HORIZ_MAX; - else if (ud.camerahoriz < HORIZ_MIN) ud.camerahoriz = HORIZ_MIN; - - if (apScriptGameEvent[EVENT_DISPLAYROOMS]) - VM_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek, -1); - - if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0) -#ifdef USE_OPENGL - && (getrendermode() != 4) -#endif - ) - { - dst = 0x7fffffff; - i = 0; - for (k=g_mirrorCount-1; k>=0; k--) - { - j = klabs(wall[g_mirrorWall[k]].x-ud.camera.x); - j += klabs(wall[g_mirrorWall[k]].y-ud.camera.y); - if (j < dst) dst = j, i = k; - } - - if (wall[g_mirrorWall[i]].overpicnum == MIRROR) - { - preparemirror(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,g_mirrorWall[i],g_mirrorSector[i],&tposx,&tposy,&tang); - - j = visibility; - visibility = (j>>1) + (j>>2); - - drawrooms(tposx,tposy,ud.camera.z,tang,ud.camerahoriz,g_mirrorSector[i]+MAXSECTORS); - - display_mirror = 1; - G_DoSpriteAnimations(tposx,tposy,tang,smoothratio); - display_mirror = 0; - - drawmasks(); - completemirror(); //Reverse screen x-wise in this function - visibility = j; - } - gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7)); - } - - G_SE40(smoothratio); - -#ifdef POLYMER - if (getrendermode() == 4) - polymer_setanimatesprites(G_DoSpriteAnimations, ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); -#endif - - drawrooms(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,ud.camerasect); - - // dupe the sprites touching the portal to the other sector - - if (ror_sprite != -1) - { - spritetype *sp = &sprite[ror_sprite]; - - // viewing from bottom - if (drawing_ror == 1) - { - int32_t k = headspritesect[sp->sectnum]; - - while (k != -1) - { - if (sprite[k].picnum != SECTOREFFECTOR && (sprite[k].z >= sp->z)) - { - Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)&sprite[k],sizeof(spritetype)); - - tsprite[spritesortcnt].x += (sprite[sp->yvel].x-sp->x); - tsprite[spritesortcnt].y += (sprite[sp->yvel].y-sp->y); - tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sp->z + actor[sp->yvel].ceilingz; - tsprite[spritesortcnt].sectnum = sprite[sp->yvel].sectnum; - tsprite[spritesortcnt].owner = k; - - //OSD_Printf("duped sprite of pic %d at %d %d %d\n",tsprite[spritesortcnt].picnum,tsprite[spritesortcnt].x,tsprite[spritesortcnt].y,tsprite[spritesortcnt].z); - spritesortcnt++; - } - k = nextspritesect[k]; - } - } - } - - G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); - - drawing_ror = 0; - drawmasks(); - - if (g_screenCapture == 1) - { - setviewback(); - g_screenCapture = 0; - // walock[TILE_SAVESHOT] = 1; - } - else if (getrendermode() == 0 && ((ud.screen_tilting && p->rotscrnang) || ud.detail==0)) - { - if (ud.screen_tilting) tang = p->rotscrnang; - else tang = 0; - - if (getrendermode() == 0) - { - setviewback(); - picanm[TILE_TILT] &= 0xff0000ff; - i = (tang&511); - if (i > 256) i = 512-i; - i = sintable[i+512]*8 + sintable[i]*5L; - if ((1-ud.detail) == 0) i >>= 1; - i>>=(tiltcs-1); // JBF 20030807 - rotatesprite(160<<16,100<<16,i,tang+512,TILE_TILT,0,0,4+2+64,windowx1,windowy1,windowx2,windowy2); - walock[TILE_TILT] = 199; - } - } - } - - G_RestoreInterpolations(); - - if (totalclock < lastvisinc) - { - if (klabs(p->visibility-ud.const_visibility) > 8) - p->visibility += (ud.const_visibility-p->visibility)>>2; - } - else p->visibility = ud.const_visibility; - - if (r_usenewaspect) - { - newaspect_enable = 0; - setaspect(tmpvr, tmpyx); - } -} - -static void G_DumpDebugInfo(void) -{ - int32_t i,j,x; - // FILE * fp=fopen("condebug.log","w"); - - OSD_Printf("Current gamevar values:\n"); - for (i=0; i= 0) - { - OSD_Printf("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum); - for (i=0; ipos.x,&g_player[myconnectindex].ps->pos.y, - &g_player[myconnectindex].ps->pos.z,&g_player[myconnectindex].ps->ang,&g_player[myconnectindex].ps->cursectnum); -} - -int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss) -{ - int32_t p, i = insertsprite(whatsect,s_ss); - spritetype *s = &sprite[i]; - spritetype spr_temp = { s_x, s_y, s_z, 0, s_pn, s_s, 0, 0, 0, s_xr, s_yr, 0, 0, - whatsect, s_ss, s_a, s_ow, s_ve, 0, s_zv, 0, 0, 0 - }; - - if (i < 0) - { - G_DumpDebugInfo(); - OSD_Printf("Failed spawning pic %d spr from pic %d spr %d at x:%d,y:%d,z:%d,sect:%d\n", - s_pn,sprite[s_ow].picnum,s_ow,s_x,s_y,s_z,whatsect); - G_GameExit("Too many sprites spawned."); - } - - Bmemcpy(s, &spr_temp, sizeof(spritetype)); - Bmemset(&actor[i], 0, sizeof(actor_t)); - Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t)); // update bposx/y/z - - actor[i].projectile = &SpriteProjectile[i]; - - if (s_ow > -1 && s_ow < MAXSPRITES) - { - actor[i].picnum = sprite[s_ow].picnum; - actor[i].floorz = actor[s_ow].floorz; - actor[i].ceilingz = actor[s_ow].ceilingz; - } - - actor[i].actorstayput = actor[i].extra = actor[i].lightId = -1; - actor[i].owner = s_ow; - - // sprpos[i].ang = sprpos[i].oldang = sprite[i].ang; - - if (actorscrptr[s_pn]) - { - s->extra = *actorscrptr[s_pn]; - T5 = *(actorscrptr[s_pn]+1); - T2 = *(actorscrptr[s_pn]+2); - s->hitag = *(actorscrptr[s_pn]+3); - } - - if (show2dsector[SECT>>3]&(1<<(SECT&7))) show2dsprite[i>>3] |= (1<<(i&7)); - else show2dsprite[i>>3] &= ~(1<<(i&7)); - - clearbufbyte(&spriteext[i], sizeof(spriteext_t), 0); - clearbufbyte(&spritesmooth[i], sizeof(spritesmooth_t), 0); - - A_ResetVars(i); - - lastupdate[i] = 0; - - if (apScriptGameEvent[EVENT_EGS]) - { - extern int32_t block_deletesprite; - int32_t pl=A_FindPlayer(s, &p); - - block_deletesprite++; - VM_OnEvent(EVENT_EGS, i, pl, p); - block_deletesprite--; - } - - return(i); -} - -int32_t A_Spawn(int32_t j, int32_t pn) -{ - int32_t i, s, startwall, endwall, sect, clostest=0; - int32_t x, y, d, p; - spritetype *sp; - - if (j >= 0) - { - i = A_InsertSprite(sprite[j].sectnum,sprite[j].x,sprite[j].y,sprite[j].z - ,pn,0,0,0,0,0,0,j,0); - actor[i].picnum = sprite[j].picnum; - } - else - { - i = pn; - - Bmemset(&actor[i], 0, sizeof(actor_t)); - Bmemcpy(&actor[i].bposx, &sprite[i], sizeof(vec3_t)); - - actor[i].picnum = PN; - - if (PN == SECTOREFFECTOR && SLT == 50) - actor[i].picnum = OW; - - actor[i].projectile = &SpriteProjectile[i]; - - OW = actor[i].owner = i; - - actor[i].floorz = sector[SECT].floorz; - actor[i].ceilingz = sector[SECT].ceilingz; - - actor[i].actorstayput = actor[i].lightId = actor[i].extra = -1; - - if (PN != SPEAKER && PN != LETTER && PN != DUCK && PN != TARGET && PN != TRIPBOMB && PN != VIEWSCREEN && PN != VIEWSCREEN2 && (CS&48)) - if (!(PN >= CRACK1 && PN <= CRACK4)) - { - if (SS == 127) goto SPAWN_END; - if (A_CheckSwitchTile(i) == 1 && (CS&16)) - { - if (PN != ACCESSSWITCH && PN != ACCESSSWITCH2 && sprite[i].pal) - { - if (((!g_netServer && ud.multimode < 2)) || ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_DMSWITCHES))) - { - sprite[i].xrepeat = sprite[i].yrepeat = 0; - SLT = SHT = 0; - sprite[i].cstat = 32768; - goto SPAWN_END; - } - } - CS |= 257; - if (sprite[i].pal && PN != ACCESSSWITCH && PN != ACCESSSWITCH2) - sprite[i].pal = 0; - goto SPAWN_END; - } - - if (SHT) - { - changespritestat(i,12); - CS |= 257; - SH = g_impactDamage; - goto SPAWN_END; - } - } - - s = PN; - - if (CS&1) CS |= 256; - - if (actorscrptr[s]) - { - SH = *(actorscrptr[s]); - T5 = *(actorscrptr[s]+1); - T2 = *(actorscrptr[s]+2); - if (*(actorscrptr[s]+3) && SHT == 0) - SHT = *(actorscrptr[s]+3); - } - else T2 = T5 = 0; - } - - sp = &sprite[i]; - sect = sp->sectnum; - - //some special cases that can't be handled through the dynamictostatic system. - if (((sp->picnum >= BOLT1)&&(sp->picnum <= BOLT1+3))||((sp->picnum >= SIDEBOLT1)&&(sp->picnum <= SIDEBOLT1+3))) - { - T1 = sp->xrepeat; - T2 = sp->yrepeat; - sp->yvel = 0; - changespritestat(i,6); - } - else if (((sp->picnum >= CAMERA1)&&(sp->picnum <= CAMERA1+3))||(sp->picnum==CAMERAPOLE)||(sp->picnum==GENERICPOLE)) - { - if (sp->picnum != GENERICPOLE) - { - sp->extra = 1; - - if (g_damageCameras) sp->cstat = 257; - else sp->cstat = 0; - } - if ((!g_netServer && ud.multimode < 2) && sp->pal != 0) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - } - else - { - sp->pal = 0; - if (!(sp->picnum == CAMERAPOLE || sp->picnum == GENERICPOLE)) - { - sp->picnum = CAMERA1; - changespritestat(i, STAT_ACTOR); - } - } - } - else switch (DynamicTileMap[sp->picnum]) - { - default: - if (actorscrptr[sp->picnum]) - { - if (j == -1 && sp->lotag > ud.player_skill) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - - // Init the size - if (sp->xrepeat == 0 || sp->yrepeat == 0) - sp->xrepeat = sp->yrepeat = 1; - - if (ActorType[sp->picnum] & 3) - { - if (ud.monsters_off == 1) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - - A_Fall(i); - - if (ActorType[sp->picnum] & 2) - actor[i].actorstayput = sp->sectnum; - - g_player[myconnectindex].ps->max_actors_killed++; - sp->clipdist = 80; - if (j >= 0) - { - if (sprite[j].picnum == RESPAWN) - actor[i].tempang = sprite[i].pal = sprite[j].pal; - changespritestat(i, STAT_ACTOR); - } - else changespritestat(i, STAT_ZOMBIEACTOR); - } - else - { - sp->clipdist = 40; - sp->owner = i; - changespritestat(i, STAT_ACTOR); - } - - actor[i].timetosleep = 0; - - if (j >= 0) - sp->ang = sprite[j].ang; - } - break; - case FOF__STATIC: - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - case WATERSPLASH2__STATIC: - if (j >= 0) - { - setsprite(i,(vec3_t *)&sprite[j]); - sp->xrepeat = sp->yrepeat = 8+(krand()&7); - } - else sp->xrepeat = sp->yrepeat = 16+(krand()&15); - - sp->shade = -16; - sp->cstat |= 128; - if (j >= 0) - { - if (sector[sprite[j].sectnum].lotag == 2) - { - sp->z = getceilzofslope(SECT,SX,SY)+(16<<8); - sp->cstat |= 8; - } - else if (sector[sprite[j].sectnum].lotag == 1) - sp->z = getflorzofslope(SECT,SX,SY); - } - - if (sector[sect].floorpicnum == FLOORSLIME || - sector[sect].ceilingpicnum == FLOORSLIME) - sp->pal = 7; - case DOMELITE__STATIC: - if (sp->picnum == DOMELITE) - sp->cstat |= 257; - case NEON1__STATIC: - case NEON2__STATIC: - case NEON3__STATIC: - case NEON4__STATIC: - case NEON5__STATIC: - case NEON6__STATIC: - if (sp->picnum != WATERSPLASH2) - sp->cstat |= 257; - case NUKEBUTTON__STATIC: - case JIBS1__STATIC: - case JIBS2__STATIC: - case JIBS3__STATIC: - case JIBS4__STATIC: - case JIBS5__STATIC: - case JIBS6__STATIC: - case HEADJIB1__STATIC: - case ARMJIB1__STATIC: - case LEGJIB1__STATIC: - case LIZMANHEAD1__STATIC: - case LIZMANARM1__STATIC: - case LIZMANLEG1__STATIC: - case DUKETORSO__STATIC: - case DUKEGUN__STATIC: - case DUKELEG__STATIC: - changespritestat(i,5); - break; - case TONGUE__STATIC: - if (j >= 0) - sp->ang = sprite[j].ang; - sp->z -= 38<<8; - sp->zvel = 256-(krand()&511); - sp->xvel = 64-(krand()&127); - changespritestat(i,4); - break; - case NATURALLIGHTNING__STATIC: - sp->cstat &= ~257; - sp->cstat |= 32768; - break; - case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - if (j == -1) break; - if (sp->picnum == TRANSPORTERBEAM) - { - sp->xrepeat = 31; - sp->yrepeat = 1; - sp->z = sector[sprite[j].sectnum].floorz-PHEIGHT; - } - else - { - if (sprite[j].statnum == STAT_PROJECTILE) - sp->xrepeat = sp->yrepeat = 8; - else - { - sp->xrepeat = 48; - sp->yrepeat = 64; - if (sprite[j].statnum == STAT_PLAYER || A_CheckEnemySprite(&sprite[j])) - sp->z -= (32<<8); - } - } - - sp->shade = -127; - sp->cstat = 128|2; - sp->ang = sprite[j].ang; - - sp->xvel = 128; - changespritestat(i,5); - A_SetSprite(i,CLIPMASK0); - setsprite(i,(vec3_t *)sp); - break; - - case FRAMEEFFECT1_13__STATIC: - if (PLUTOPAK) break; - case FRAMEEFFECT1__STATIC: - if (j >= 0) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - T2 = sprite[j].picnum; - } - else sp->xrepeat = sp->yrepeat = 0; - - changespritestat(i,5); - - break; - - case LASERLINE__STATIC: - sp->yrepeat = 6; - sp->xrepeat = 32; - - if (g_tripbombLaserMode == 1) - sp->cstat = 16 + 2; - else if (g_tripbombLaserMode == 0 || g_tripbombLaserMode == 2) - sp->cstat = 16; - else - { - sp->xrepeat = 0; - sp->yrepeat = 0; - } - - if (j >= 0) sp->ang = actor[j].t_data[5]+512; - changespritestat(i,5); - break; - - case FORCESPHERE__STATIC: - if (j == -1) - { - sp->cstat = (int16_t) 32768; - changespritestat(i, STAT_ZOMBIEACTOR); - } - else - { - sp->xrepeat = sp->yrepeat = 1; - changespritestat(i,5); - } - break; - - case BLOOD__STATIC: - sp->xrepeat = sp->yrepeat = 16; - sp->z -= (26<<8); - if (j >= 0 && sprite[j].pal == 6) - sp->pal = 6; - changespritestat(i,5); - break; - case BLOODPOOL__STATIC: - case PUKE__STATIC: - { - int16_t s1; - s1 = sp->sectnum; - - updatesector(sp->x+108,sp->y+108,&s1); - if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) - { - updatesector(sp->x-108,sp->y-108,&s1); - if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) - { - updatesector(sp->x+108,sp->y-108,&s1); - if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) - { - updatesector(sp->x-108,sp->y+108,&s1); - if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - - } - else - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - - } - else - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - - } - else - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - - } - - if (sector[SECT].lotag == 1) - { - changespritestat(i,5); - break; - } - - if (j >= 0 && sp->picnum != PUKE) - { - if (sprite[j].pal == 1) - sp->pal = 1; - else if (sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE) - { - if (sprite[j].picnum == FECES) - sp->pal = 7; // Brown - else sp->pal = 2; // Red - } - else sp->pal = 0; // green - - if (sprite[j].picnum == TIRE) - sp->shade = 127; - } - sp->cstat |= 32; - case FECES__STATIC: - if (j >= 0) - sp->xrepeat = sp->yrepeat = 1; - changespritestat(i,5); - break; - - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: - sp->cstat |= 16; - sp->xrepeat = 7+(krand()&7); - sp->yrepeat = 7+(krand()&7); - sp->z -= (16<<8); - if (j >= 0 && sprite[j].pal == 6) - sp->pal = 6; - A_AddToDeleteQueue(i); - changespritestat(i,5); - break; - - case TRIPBOMB__STATIC: - if (sp->lotag > ud.player_skill) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - - sp->xrepeat=4; - sp->yrepeat=5; - - sp->owner = sp->hitag = i; - - sp->xvel = 16; - A_SetSprite(i,CLIPMASK0); - actor[i].t_data[0] = 17; - actor[i].t_data[2] = 0; - actor[i].t_data[5] = sp->ang; - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case SPACEMARINE__STATIC: - sp->extra = 20; - sp->cstat |= 257; - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case HYDRENT__STATIC: - case PANNEL1__STATIC: - case PANNEL2__STATIC: - case SATELITE__STATIC: - case FUELPOD__STATIC: - case SOLARPANNEL__STATIC: - case ANTENNA__STATIC: - case GRATE1__STATIC: - case CHAIR1__STATIC: - case CHAIR2__STATIC: - case CHAIR3__STATIC: - case BOTTLE1__STATIC: - case BOTTLE2__STATIC: - case BOTTLE3__STATIC: - case BOTTLE4__STATIC: - case BOTTLE5__STATIC: - case BOTTLE6__STATIC: - case BOTTLE7__STATIC: - case BOTTLE8__STATIC: - case BOTTLE10__STATIC: - case BOTTLE11__STATIC: - case BOTTLE12__STATIC: - case BOTTLE13__STATIC: - case BOTTLE14__STATIC: - case BOTTLE15__STATIC: - case BOTTLE16__STATIC: - case BOTTLE17__STATIC: - case BOTTLE18__STATIC: - case BOTTLE19__STATIC: - case OCEANSPRITE1__STATIC: - case OCEANSPRITE2__STATIC: - case OCEANSPRITE3__STATIC: - case OCEANSPRITE5__STATIC: - case MONK__STATIC: - case INDY__STATIC: - case LUKE__STATIC: - case JURYGUY__STATIC: - case SCALE__STATIC: - case VACUUM__STATIC: - case FANSPRITE__STATIC: - case CACTUS__STATIC: - case CACTUSBROKE__STATIC: - case HANGLIGHT__STATIC: - case FETUS__STATIC: - case FETUSBROKE__STATIC: - case CAMERALIGHT__STATIC: - case MOVIECAMERA__STATIC: - case IVUNIT__STATIC: - case POT1__STATIC: - case POT2__STATIC: - case POT3__STATIC: - case TRIPODCAMERA__STATIC: - case SUSHIPLATE1__STATIC: - case SUSHIPLATE2__STATIC: - case SUSHIPLATE3__STATIC: - case SUSHIPLATE4__STATIC: - case SUSHIPLATE5__STATIC: - case WAITTOBESEATED__STATIC: - case VASE__STATIC: - case PIPE1__STATIC: - case PIPE2__STATIC: - case PIPE3__STATIC: - case PIPE4__STATIC: - case PIPE5__STATIC: - case PIPE6__STATIC: - sp->clipdist = 32; - sp->cstat |= 257; - case OCEANSPRITE4__STATIC: - changespritestat(i,0); - break; - case FEMMAG1__STATIC: - case FEMMAG2__STATIC: - sp->cstat &= ~257; - changespritestat(i,0); - break; - case DUKETAG__STATIC: - case SIGN1__STATIC: - case SIGN2__STATIC: - if ((!g_netServer && ud.multimode < 2) && sp->pal) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - } - else sp->pal = 0; - break; - case MASKWALL1__STATIC: - case MASKWALL2__STATIC: - case MASKWALL3__STATIC: - case MASKWALL4__STATIC: - case MASKWALL5__STATIC: - case MASKWALL6__STATIC: - case MASKWALL7__STATIC: - case MASKWALL8__STATIC: - case MASKWALL9__STATIC: - case MASKWALL10__STATIC: - case MASKWALL11__STATIC: - case MASKWALL12__STATIC: - case MASKWALL13__STATIC: - case MASKWALL14__STATIC: - case MASKWALL15__STATIC: - j = sp->cstat&60; - sp->cstat = j|1; - changespritestat(i,0); - break; - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - if (j >= 0) - { - int16_t s1 = sp->sectnum; - - updatesector(sp->x+84,sp->y+84,&s1); - if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) - { - updatesector(sp->x-84,sp->y-84,&s1); - if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) - { - updatesector(sp->x+84,sp->y-84,&s1); - if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) - { - updatesector(sp->x-84,sp->y+84,&s1); - if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - } - else - { - sp->xrepeat = sp->yrepeat = 0; - break; - } - } - else - { - sp->xrepeat = sp->yrepeat = 0; - break; - } - } - else - { - sp->xrepeat = sp->yrepeat = 0; - break; - } - - sp->cstat = 32+((g_player[sprite[j].yvel].ps->footprintcount&1)<<2); - sp->ang = sprite[j].ang; - } - - sp->z = sector[sect].floorz; - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) - sp->xrepeat = sp->yrepeat = 32; - - A_AddToDeleteQueue(i); - changespritestat(i,5); - break; - - case PODFEM1__STATIC: - sp->extra <<= 1; - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - case TOUGHGAL__STATIC: - sp->yvel = sp->hitag; - sp->hitag = -1; - case BLOODYPOLE__STATIC: - sp->cstat |= 257; - sp->clipdist = 32; - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case QUEBALL__STATIC: - case STRIPEBALL__STATIC: - sp->cstat = 256; - sp->clipdist = 8; - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case DUKELYINGDEAD__STATIC: - if (j >= 0 && sprite[j].picnum == APLAYER) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - sp->shade = sprite[j].shade; - sp->pal = g_player[sprite[j].yvel].ps->palookup; - } - case DUKECAR__STATIC: - case HELECOPT__STATIC: - // if(sp->picnum == HELECOPT || sp->picnum == DUKECAR) sp->xvel = 1024; - sp->cstat = 0; - sp->extra = 1; - sp->xvel = 292; - sp->zvel = 360; - case BLIMP__STATIC: - sp->cstat |= 257; - sp->clipdist = 128; - changespritestat(i, STAT_ACTOR); - break; - - case RESPAWNMARKERRED__STATIC: - sp->xrepeat = sp->yrepeat = 24; - if (j >= 0) sp->z = actor[j].floorz; // -(1<<4); - changespritestat(i, STAT_ACTOR); - break; - - case MIKE__STATIC: - sp->yvel = sp->hitag; - sp->hitag = 0; - changespritestat(i, STAT_ACTOR); - break; - case WEATHERWARN__STATIC: - changespritestat(i, STAT_ACTOR); - break; - - case SPOTLITE__STATIC: - T1 = sp->x; - T2 = sp->y; - break; - case BULLETHOLE__STATIC: - sp->xrepeat = sp->yrepeat = 3; - sp->cstat = 16+(krand()&12); - A_AddToDeleteQueue(i); - changespritestat(i,5); - break; - - case MONEY__STATIC: - case MAIL__STATIC: - case PAPER__STATIC: - actor[i].t_data[0] = krand()&2047; - sp->cstat = krand()&12; - sp->xrepeat = sp->yrepeat = 8; - sp->ang = krand()&2047; - changespritestat(i,5); - break; - - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: - sp->owner = i; - sp->lotag = sp->extra = 1; - changespritestat(i,6); - break; - - case SHELL__STATIC: //From the player - case SHOTGUNSHELL__STATIC: - if (j >= 0) - { - int32_t snum,a; - - if (sprite[j].picnum == APLAYER) - { - snum = sprite[j].yvel; - a = g_player[snum].ps->ang-(krand()&63)+8; //Fine tune - - T1 = krand()&1; - sp->z = (3<<8)+g_player[snum].ps->pyoff+g_player[snum].ps->pos.z- - ((g_player[snum].ps->horizoff+g_player[snum].ps->horiz-100)<<4); - if (sp->picnum == SHOTGUNSHELL) - sp->z += (3<<8); - sp->zvel = -(krand()&255); - } - else - { - a = sp->ang; - sp->z = sprite[j].z-PHEIGHT+(3<<8); - } - - sp->x = sprite[j].x+(sintable[(a+512)&2047]>>7); - sp->y = sprite[j].y+(sintable[a&2047]>>7); - - sp->shade = -8; - - if (sp->yvel == 1 || NAM) - { - sp->ang = a+512; - sp->xvel = 30; - } - else - { - sp->ang = a-512; - sp->xvel = 20; - } - sp->xrepeat=sp->yrepeat=4; - - changespritestat(i,5); - } - break; - - case RESPAWN__STATIC: - sp->extra = 66-13; - case MUSICANDSFX__STATIC: - if ((!g_netServer && ud.multimode < 2) && sp->pal == 1) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - sp->cstat = (int16_t)32768; - changespritestat(i,11); - break; - - case EXPLOSION2__STATIC: - if (sp->yrepeat > 32) - { - G_AddGameLight(0, i, ((sp->yrepeat*tilesizy[sp->picnum])<<1), 32768, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); - actor[i].lightcount = 2; - } - case EXPLOSION2BOT__STATIC: - case BURNING__STATIC: - case BURNING2__STATIC: - case SMALLSMOKE__STATIC: - case SHRINKEREXPLOSION__STATIC: - case COOLEXPLOSION1__STATIC: - - if (j >= 0) - { - sp->ang = sprite[j].ang; - sp->shade = -64; - sp->cstat = 128|(krand()&4); - } - - if (sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT) - { - sp->xrepeat = sp->yrepeat = 48; - sp->shade = -127; - sp->cstat |= 128; - } - else if (sp->picnum == SHRINKEREXPLOSION) - sp->xrepeat = sp->yrepeat = 32; - else if (sp->picnum == SMALLSMOKE) - { - // 64 "money" - sp->xrepeat = sp->yrepeat = 24; - } - else if (sp->picnum == BURNING || sp->picnum == BURNING2) - sp->xrepeat = sp->yrepeat = 4; - - sp->cstat |= 8192; - - if (j >= 0) - { - x = getflorzofslope(sp->sectnum,sp->x,sp->y); - if (sp->z > x-(12<<8)) - sp->z = x-(12<<8); - } - - changespritestat(i,5); - - break; - - case PLAYERONWATER__STATIC: - if (j >= 0) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - sp->zvel = 128; - if (sector[sp->sectnum].lotag != 2) - sp->cstat |= 32768; - } - changespritestat(i,13); - break; - - case APLAYER__STATIC: - sp->xrepeat = sp->yrepeat = 0; - sp->cstat = 32768; - if ((!g_netServer && ud.multimode < 2) || ((GametypeFlags[ud.coop] & GAMETYPE_COOPSPAWN)/GAMETYPE_COOPSPAWN) != sp->lotag) - changespritestat(i,STAT_MISC); - else - changespritestat(i,STAT_PLAYER); - break; - case WATERBUBBLE__STATIC: - if (j >= 0 && sprite[j].picnum == APLAYER) - sp->z -= (16<<8); - if (sp->picnum == WATERBUBBLE) - { - if (j >= 0) - sp->ang = sprite[j].ang; - sp->xrepeat = sp->yrepeat = 4; - } - else sp->xrepeat = sp->yrepeat = 32; - - changespritestat(i,5); - break; - - case CRANE__STATIC: - - sp->cstat |= 64|257; - - sp->picnum += 2; - sp->z = sector[sect].ceilingz+(48<<8); - T5 = tempwallptr; - - msx[tempwallptr] = sp->x; - msy[tempwallptr] = sp->y; - msx[tempwallptr+2] = sp->z; - - s = headspritestat[STAT_DEFAULT]; - while (s >= 0) - { - if (sprite[s].picnum == CRANEPOLE && SHT == (sprite[s].hitag)) - { - msy[tempwallptr+2] = s; - - T2 = sprite[s].sectnum; - - sprite[s].xrepeat = 48; - sprite[s].yrepeat = 128; - - msx[tempwallptr+1] = sprite[s].x; - msy[tempwallptr+1] = sprite[s].y; - - sprite[s].x = sp->x; - sprite[s].y = sp->y; - sprite[s].z = sp->z; - sprite[s].shade = sp->shade; - - setsprite(s,(vec3_t *)&sprite[s]); - break; - } - s = nextspritestat[s]; - } - - tempwallptr += 3; - sp->owner = -1; - sp->extra = 8; - changespritestat(i,6); - break; - - case TRASH__STATIC: - sp->ang = krand()&2047; - sp->xrepeat = sp->yrepeat = 24; - changespritestat(i,6); - break; - - case WATERDRIP__STATIC: - if (j >= 0 && (sprite[j].statnum == STAT_PLAYER || sprite[j].statnum == STAT_ACTOR)) - { - sp->shade = 32; - if (sprite[j].pal != 1) - { - sp->pal = 2; - sp->z -= (18<<8); - } - else sp->z -= (13<<8); - sp->ang = getangle(g_player[0].ps->pos.x-sp->x,g_player[0].ps->pos.y-sp->y); - sp->xvel = 48-(krand()&31); - A_SetSprite(i,CLIPMASK0); - } - else if (j == -1) - { - sp->z += (4<<8); - T1 = sp->z; - T2 = krand()&127; - } - case WATERDRIPSPLASH__STATIC: - sp->xrepeat = sp->yrepeat = 24; - changespritestat(i,6); - break; - - case PLUG__STATIC: - sp->lotag = 9999; - changespritestat(i,6); - break; - case TOUCHPLATE__STATIC: - T3 = sector[sect].floorz; - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) - sector[sect].floorz = sp->z; - if (sp->pal && (g_netServer || ud.multimode > 1)) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - case WATERBUBBLEMAKER__STATIC: - if (sp->hitag && sp->picnum == WATERBUBBLEMAKER) - { - // JBF 20030913: Pisses off X_Move(), eg. in bobsp2 - OSD_Printf(OSD_ERROR "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n", - i,sp->x,sp->y); - sp->hitag = 0; - } - sp->cstat |= 32768; - changespritestat(i,6); - break; - case MASTERSWITCH__STATIC: - if (sp->picnum == MASTERSWITCH) - sp->cstat |= 32768; - sp->yvel = 0; - changespritestat(i,6); - break; - case TARGET__STATIC: - case DUCK__STATIC: - case LETTER__STATIC: - sp->extra = 1; - sp->cstat |= 257; - changespritestat(i, STAT_ACTOR); - break; - case OCTABRAINSTAYPUT__STATIC: - case LIZTROOPSTAYPUT__STATIC: - case PIGCOPSTAYPUT__STATIC: - case LIZMANSTAYPUT__STATIC: - case BOSS1STAYPUT__STATIC: - case PIGCOPDIVE__STATIC: - case COMMANDERSTAYPUT__STATIC: - case BOSS4STAYPUT__STATIC: - actor[i].actorstayput = sp->sectnum; - case BOSS1__STATIC: - case BOSS2__STATIC: - case BOSS3__STATIC: - case BOSS4__STATIC: - case ROTATEGUN__STATIC: - case GREENSLIME__STATIC: - if (sp->picnum == GREENSLIME) - sp->extra = 1; - case DRONE__STATIC: - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: - case OCTABRAIN__STATIC: - case COMMANDER__STATIC: - case PIGCOP__STATIC: - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: - case ORGANTIC__STATIC: - case RAT__STATIC: - case SHARK__STATIC: - - if (sp->pal == 0) - { - switch (DynamicTileMap[sp->picnum]) - { - case LIZTROOPONTOILET__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOPSTAYPUT__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOP__STATIC: - sp->pal = 22; - break; - } - } - - if (sp->picnum == BOSS4STAYPUT || sp->picnum == BOSS1 || sp->picnum == BOSS2 || sp->picnum == BOSS1STAYPUT || sp->picnum == BOSS3 || sp->picnum == BOSS4) - { - if (j >= 0 && sprite[j].picnum == RESPAWN) - sp->pal = sprite[j].pal; - if (sp->pal) - { - sp->clipdist = 80; - sp->xrepeat = sp->yrepeat = 40; - } - else - { - sp->xrepeat = sp->yrepeat = 80; - sp->clipdist = 164; - } - } - else - { - if (sp->picnum != SHARK) - { - sp->xrepeat = sp->yrepeat = 40; - sp->clipdist = 80; - } - else - { - sp->xrepeat = sp->yrepeat = 60; - sp->clipdist = 40; - } - } - - if (j >= 0) sp->lotag = 0; - - if ((sp->lotag > ud.player_skill) || ud.monsters_off == 1) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - else - { - A_Fall(i); - - if (sp->picnum == RAT) - { - sp->ang = krand()&2047; - sp->xrepeat = sp->yrepeat = 48; - sp->cstat = 0; - } - else - { - sp->cstat |= 257; - - if (sp->picnum != SHARK) - g_player[myconnectindex].ps->max_actors_killed++; - } - - if (sp->picnum == ORGANTIC) sp->cstat |= 128; - - if (j >= 0) - { - actor[i].timetosleep = 0; - A_PlayAlertSound(i); - changespritestat(i, STAT_ACTOR); - } - else changespritestat(i, STAT_ZOMBIEACTOR); - } - - if (sp->picnum == ROTATEGUN) - sp->zvel = 0; - - break; - - case LOCATORS__STATIC: - sp->cstat |= 32768; - changespritestat(i,7); - break; - - case ACTIVATORLOCKED__STATIC: - case ACTIVATOR__STATIC: - sp->cstat = (int16_t) 32768; - if (sp->picnum == ACTIVATORLOCKED) - sector[sp->sectnum].lotag |= 16384; - changespritestat(i,8); - break; - - case DOORSHOCK__STATIC: - sp->cstat |= 1+256; - sp->shade = -12; - changespritestat(i,6); - break; - - case OOZ__STATIC: - case OOZ2__STATIC: - sp->shade = -12; - - if (j >= 0) - { - if (sprite[j].picnum == NUKEBARREL) - sp->pal = 8; - A_AddToDeleteQueue(i); - } - - changespritestat(i, STAT_ACTOR); - - A_GetZLimits(i); - - j = (actor[i].floorz-actor[i].ceilingz)>>9; - - sp->yrepeat = j; - sp->xrepeat = 25-(j>>1); - sp->cstat |= (krand()&4); - - break; - - case REACTOR2__STATIC: - case REACTOR__STATIC: - sp->extra = g_impactDamage; - CS |= 257; - sp->pal = 0; - SS = -17; - - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case HEAVYHBOMB__STATIC: - if (j >= 0) - sp->owner = j; - else sp->owner = i; - - sp->xrepeat = sp->yrepeat = 9; - sp->yvel = 4; - CS |= 257; - - if ((!g_netServer && ud.multimode < 2) && sp->pal != 0) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - sp->pal = 0; - SS = -17; - - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case RECON__STATIC: - - if (sp->lotag > ud.player_skill) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - goto SPAWN_END; - } - g_player[myconnectindex].ps->max_actors_killed++; - actor[i].t_data[5] = 0; - if (ud.monsters_off == 1) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - sp->extra = 130; - CS |= 256; // Make it hitable - - if ((!g_netServer && ud.multimode < 2) && sp->pal != 0) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - sp->pal = 0; - SS = -17; - - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case ATOMICHEALTH__STATIC: - case STEROIDS__STATIC: - case HEATSENSOR__STATIC: - case SHIELD__STATIC: - case AIRTANK__STATIC: - case TRIPBOMBSPRITE__STATIC: - case JETPACK__STATIC: - case HOLODUKE__STATIC: - - case FIRSTGUNSPRITE__STATIC: - case CHAINGUNSPRITE__STATIC: - case SHOTGUNSPRITE__STATIC: - case RPGSPRITE__STATIC: - case SHRINKERSPRITE__STATIC: - case FREEZESPRITE__STATIC: - case DEVISTATORSPRITE__STATIC: - - case SHOTGUNAMMO__STATIC: - case FREEZEAMMO__STATIC: - case HBOMBAMMO__STATIC: - case CRYSTALAMMO__STATIC: - case GROWAMMO__STATIC: - case BATTERYAMMO__STATIC: - case DEVISTATORAMMO__STATIC: - case RPGAMMO__STATIC: - case BOOTS__STATIC: - case AMMO__STATIC: - case AMMOLOTS__STATIC: - case COLA__STATIC: - case FIRSTAID__STATIC: - case SIXPAK__STATIC: - - if (j >= 0) - { - sp->lotag = 0; - sp->z -= (32<<8); - sp->zvel = -1024; - A_SetSprite(i,CLIPMASK0); - sp->cstat = krand()&4; - } - else - { - sp->owner = i; - sp->cstat = 0; - } - - if (((!g_netServer && ud.multimode < 2) && sp->pal != 0) || (sp->lotag > ud.player_skill)) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - - sp->pal = 0; - - case ACCESSCARD__STATIC: - - if (sp->picnum == ATOMICHEALTH) - sp->cstat |= 128; - - if ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_ACCESSCARDSPRITES) && sp->picnum == ACCESSCARD) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - else - { - if (sp->picnum == AMMO) - sp->xrepeat = sp->yrepeat = 16; - else sp->xrepeat = sp->yrepeat = 32; - } - - sp->shade = -17; - - if (j >= 0) changespritestat(i, STAT_ACTOR); - else - { - changespritestat(i, STAT_ZOMBIEACTOR); - A_Fall(i); - } - break; - - case WATERFOUNTAIN__STATIC: - SLT = 1; - - case TREE1__STATIC: - case TREE2__STATIC: - case TIRE__STATIC: - case CONE__STATIC: - case BOX__STATIC: - CS = 257; // Make it hitable - sprite[i].extra = 1; - changespritestat(i,6); - break; - - case FLOORFLAME__STATIC: - sp->shade = -127; - changespritestat(i,6); - break; - - case BOUNCEMINE__STATIC: - sp->owner = i; - sp->cstat |= 1+256; //Make it hitable - sp->xrepeat = sp->yrepeat = 24; - sp->shade = -127; - sp->extra = g_impactDamage<<2; - changespritestat(i, STAT_ZOMBIEACTOR); - break; - - case STEAM__STATIC: - if (j >= 0) - { - sp->ang = sprite[j].ang; - sp->cstat = 16+128+2; - sp->xrepeat=sp->yrepeat=1; - sp->xvel = -8; - A_SetSprite(i,CLIPMASK0); - } - case CEILINGSTEAM__STATIC: - changespritestat(i,6); - break; - - case SECTOREFFECTOR__STATIC: - sp->cstat |= 32768; - sp->xrepeat = sp->yrepeat = 0; - - switch (sp->lotag) - { - case 40: - case 41: - sp->cstat = 32; - sp->xrepeat = sp->yrepeat = 64; - changespritestat(i, STAT_EFFECTOR); - for (j=0; j < MAXSPRITES; j++) - if (sprite[j].picnum == SECTOREFFECTOR && (sprite[j].lotag == 40 || sprite[j].lotag == 41) && - sprite[j].hitag == sp->hitag && i != j) - { -// initprintf("found ror match\n"); - sp->yvel = j; - break; - } - goto SPAWN_END; - break; - case 46: - ror_protectedsectors[sp->sectnum] = 1; - case 49: - case 50: - { - int32_t j, nextj; - - TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], j, nextj) - if (sprite[j].picnum == ACTIVATOR || sprite[j].picnum == ACTIVATORLOCKED) - actor[i].flags |= SPRITE_USEACTIVATOR; - } - changespritestat(i, STAT_EFFECTOR); - goto SPAWN_END; - break; - } - - sp->yvel = sector[sect].extra; - - switch (sp->lotag) - { - case 28: - T6 = 65;// Delay for lightning - break; - case 7: // Transporters!!!! - case 23:// XPTR END - if (sp->lotag != 23) - { - for (j=0; jcstat = 0; - changespritestat(i,9); - goto SPAWN_END; - case 1: - sp->owner = -1; - T1 = 1; - break; - case 18: - - if (sp->ang == 512) - { - T2 = sector[sect].ceilingz; - if (sp->pal) - sector[sect].ceilingz = sp->z; - } - else - { - T2 = sector[sect].floorz; - if (sp->pal) - sector[sect].floorz = sp->z; - } - - sp->hitag <<= 2; - break; - - case 19: - sp->owner = -1; - break; - case 25: // Pistons - T4 = sector[sect].ceilingz; - T5 = 1; - sector[sect].ceilingz = sp->z; - G_SetInterpolation(§or[sect].ceilingz); - break; - case 35: - sector[sect].ceilingz = sp->z; - break; - case 27: - if (ud.recstat == 1) - { - sp->xrepeat=sp->yrepeat=64; - sp->cstat &= 32768; - } - break; - case 12: - - T2 = sector[sect].floorshade; - T3 = sector[sect].ceilingshade; - break; - - case 13: - - T1 = sector[sect].ceilingz; - T2 = sector[sect].floorz; - - if (klabs(T1-sp->z) < klabs(T2-sp->z)) - sp->owner = 1; - else sp->owner = 0; - - if (sp->ang == 512) - { - if (sp->owner) - sector[sect].ceilingz = sp->z; - else - sector[sect].floorz = sp->z; - } - else - sector[sect].ceilingz = sector[sect].floorz = sp->z; - - if (sector[sect].ceilingstat&1) - { - sector[sect].ceilingstat ^= 1; - T4 = 1; - - if (!sp->owner && sp->ang==512) - { - sector[sect].ceilingstat ^= 1; - T4 = 0; - } - - sector[sect].ceilingshade = - sector[sect].floorshade; - - if (sp->ang==512) - { - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - for (j=startwall; j= 0) - if (!(sector[x].ceilingstat&1)) - { - sector[sect].ceilingpicnum = - sector[x].ceilingpicnum; - sector[sect].ceilingshade = - sector[x].ceilingshade; - break; //Leave earily - } - } - } - } - - break; - - case 17: - - T3 = sector[sect].floorz; //Stopping loc - - j = nextsectorneighborz(sect,sector[sect].floorz,-1,-1); - T4 = sector[j].ceilingz; - - j = nextsectorneighborz(sect,sector[sect].ceilingz,1,1); - T5 = sector[j].floorz; - - if (numplayers < 2 && !g_netServer) - { - G_SetInterpolation(§or[sect].floorz); - G_SetInterpolation(§or[sect].ceilingz); - } - - break; - - case 24: - sp->yvel <<= 1; - case 36: - break; - - case 20: - { - int32_t q; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - //find the two most clostest wall x's and y's - q = 0x7fffffff; - - for (s=startwall; sx-x,sp->y-y); - if (d < q) - { - q = d; - clostest = s; - } - } - - T2 = clostest; - - q = 0x7fffffff; - - for (s=startwall; sx-x,sp->y-y); - if (d < q && s != T2) - { - q = d; - clostest = s; - } - } - - T3 = clostest; - } - - break; - - case 3: - - T4=sector[sect].floorshade; - - sector[sect].floorshade = sp->shade; - sector[sect].ceilingshade = sp->shade; - - sp->owner = sector[sect].ceilingpal<<8; - sp->owner |= sector[sect].floorpal; - - //fix all the walls; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - for (s=startwall; sshade; - if ((wall[s].cstat&2) && wall[s].nextwall >= 0) - wall[wall[s].nextwall].shade = sp->shade; - } - break; - - case 31: - T2 = sector[sect].floorz; - // T3 = sp->hitag; - if (sp->ang != 1536) sector[sect].floorz = sp->z; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - for (s=startwall; shitag; - if (sp->ang != 1536) sector[sect].ceilingz = sp->z; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - for (s=startwall; sowner = sector[sect].ceilingpal<<8; - sp->owner |= sector[sect].floorpal; - - for (s=startwall; s T4) - T4 = wall[s].shade; - - break; - - case 9: - if (sector[sect].lotag && - labs(sector[sect].ceilingz-sp->z) > 1024) - sector[sect].lotag |= 32768; //If its open - case 8: - //First, get the ceiling-floor shade - - T1 = sector[sect].floorshade; - T2 = sector[sect].ceilingshade; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - for (s=startwall; s T3) - T3 = wall[s].shade; - - T4 = 1; //Take Out; - - break; - - case 11://Pivitor rotater - if (sp->ang>1024) T4 = 2; - else T4 = -2; - case 0: - case 2://Earthquakemakers - case 5://Boss Creature - case 6://Subway - case 14://Caboos - case 15://Subwaytype sliding door - case 16://That rotating blocker reactor thing - case 26://ESCELATOR - case 30://No rotational subways - - if (sp->lotag == 0) - { - if (sector[sect].lotag == 30) - { - if (sp->pal) sprite[i].clipdist = 1; - else sprite[i].clipdist = 0; - T4 = sector[sect].floorz; - sector[sect].hitag = i; - } - - for (j = MAXSPRITES-1; j>=0; j--) - { - if (sprite[j].statnum < MAXSTATUS) - if (sprite[j].picnum == SECTOREFFECTOR && - sprite[j].lotag == 1 && - sprite[j].hitag == sp->hitag) - { - if (sp->ang == 512) - { - sp->x = sprite[j].x; - sp->y = sprite[j].y; - } - break; - } - } - if (j == -1) - { - OSD_Printf(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y); - changespritestat(i, STAT_ACTOR); - if (apScriptGameEvent[EVENT_SPAWN]) - { - int32_t pl=A_FindPlayer(&sprite[i],&p); - VM_OnEvent(EVENT_SPAWN,i, pl, p); - } - return i; - } - sp->owner = j; - } - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - T2 = tempwallptr; - for (s=startwall; sx; - msy[tempwallptr] = wall[s].y-sp->y; - tempwallptr++; - if (tempwallptr > 2047) - { - Bsprintf(tempbuf,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y); - G_GameExit(tempbuf); - } - } - if (sp->lotag == 30 || sp->lotag == 6 || sp->lotag == 14 || sp->lotag == 5) - { - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - if (sector[sect].hitag == -1) - sp->extra = 0; - else sp->extra = 1; - - sector[sect].hitag = i; - - j = 0; - - for (s=startwall; s= 0 && - sector[ wall[ s ].nextsector].hitag == 0 && - sector[ wall[ s ].nextsector].lotag < 3) - { - s = wall[s].nextsector; - j = 1; - break; - } - } - - if (j == 0) - { - Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y); - G_GameExit(tempbuf); - } - - sp->owner = -1; - T1 = s; - - if (sp->lotag != 30) - T4 = sp->hitag; - } - - else if (sp->lotag == 16) - T4 = sector[sect].ceilingz; - - else if (sp->lotag == 26) - { - T4 = sp->x; - T5 = sp->y; - if (sp->shade==sector[sect].floorshade) //UP - sp->zvel = -256; - else - sp->zvel = 256; - - sp->shade = 0; - } - else if (sp->lotag == 2) - { - T6 = sector[sp->sectnum].floorheinum; - sector[sp->sectnum].floorheinum = 0; - } - } - - switch (sp->lotag) - { - case 6: - case 14: - j = A_CallSound(sect,i); - if (j == -1) j = SUBWAY; - actor[i].lastvx = j; - case 30: - if (g_netServer || numplayers > 1) break; - case 0: - case 1: - case 5: - case 11: - case 15: - case 16: - case 26: - Sect_SetInterpolation(i); - break; - } - - changespritestat(i, STAT_EFFECTOR); - break; - - case SEENINE__STATIC: - case OOZFILTER__STATIC: - sp->shade = -16; - if (sp->xrepeat <= 8) - { - sp->cstat = (int16_t)32768; - sp->xrepeat=sp->yrepeat=0; - } - else sp->cstat = 1+256; - sp->extra = g_impactDamage<<2; - sp->owner = i; - - changespritestat(i,6); - break; - - case CRACK1__STATIC: - case CRACK2__STATIC: - case CRACK3__STATIC: - case CRACK4__STATIC: - case FIREEXT__STATIC: - if (sp->picnum == FIREEXT) - { - sp->cstat = 257; - sp->extra = g_impactDamage<<2; - } - else - { - sp->cstat |= (sp->cstat & 48) ? 1 : 17; - sp->extra = 1; - } - - if ((!g_netServer && ud.multimode < 2) && sp->pal != 0) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - } - - sp->pal = 0; - sp->owner = i; - changespritestat(i,6); - sp->xvel = 8; - A_SetSprite(i,CLIPMASK0); - break; - - case TOILET__STATIC: - case STALL__STATIC: - sp->lotag = 1; - sp->cstat |= 257; - sp->clipdist = 8; - sp->owner = i; - break; - - case CANWITHSOMETHING__STATIC: - case CANWITHSOMETHING2__STATIC: - case CANWITHSOMETHING3__STATIC: - case CANWITHSOMETHING4__STATIC: - case RUBBERCAN__STATIC: - sp->extra = 0; - case EXPLODINGBARREL__STATIC: - case HORSEONSIDE__STATIC: - case FIREBARREL__STATIC: - case NUKEBARREL__STATIC: - case FIREVASE__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case WOODENHORSE__STATIC: - if (j >= 0) - sp->xrepeat = sp->yrepeat = 32; - sp->clipdist = 72; - A_Fall(i); - if (j >= 0) - sp->owner = j; - else sp->owner = i; - case EGG__STATIC: - if (ud.monsters_off == 1 && sp->picnum == EGG) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - } - else - { - if (sp->picnum == EGG) - sp->clipdist = 24; - sp->cstat = 257|(krand()&4); - changespritestat(i, STAT_ZOMBIEACTOR); - } - break; - - case TOILETWATER__STATIC: - sp->shade = -16; - changespritestat(i,6); - break; - } - -SPAWN_END: - if (apScriptGameEvent[EVENT_SPAWN]) - { - int32_t pl=A_FindPlayer(&sprite[i],&p); - VM_OnEvent(EVENT_SPAWN,i, pl, p); - } - - // spawning is technically not allowed to fail in BUILD, so we just hide whatever - // the client spawns with SPRITE_NULL because the server will send it anyway - if (g_netClient && j >= 0) - { - int32_t zz; - for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])); zz++) - if (sprite[i].statnum == g_netStatnums[zz]) - { - actor[i].flags |= SPRITE_NULL; - return i; - } - } - - return i; -} - -#if 0 // def _MSC_VER -// Visual C thought this was a bit too hard to optimise so we'd better -// tell it not to try... such a pussy it is. -//#pragma auto_inline(off) -#pragma optimize("g",off) -#endif -void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) -{ - int32_t i, j, k, p, sect; - intptr_t l, t1,t3,t4; - spritetype *s,*t; - int32_t switchpic; - - if (!spritesortcnt) return; - - ror_sprite = -1; - - for (j=spritesortcnt-1; j>=0; j--) - { - t = &tsprite[j]; - i = t->owner; - s = &sprite[i]; - - switch (DynamicTileMap[s->picnum]) - { - case SECTOREFFECTOR__STATIC: - if (s->lotag == 40 || s->lotag == 41) - { - t->cstat = 32768; - - if (ror_sprite == -1) ror_sprite = i; - } - - if (t->lotag == 27 && ud.recstat == 1) - { - t->picnum = 11+((totalclock>>3)&1); - t->cstat |= 128; - } - else - t->xrepeat = t->yrepeat = 0; - break; - } - } - - for (j=spritesortcnt-1; j>=0; j--) - { - t = &tsprite[j]; - i = t->owner; - s = &sprite[t->owner]; - - if (A_CheckSpriteFlags(i, SPRITE_NULL)) - { - t->xrepeat = t->yrepeat = 0; - continue; - } - - if (t->picnum < GREENSLIME || t->picnum > GREENSLIME+7) - switch (DynamicTileMap[t->picnum]) - { - case BLOODPOOL__STATIC: - case PUKE__STATIC: - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - if (t->shade == 127) continue; - break; - case RESPAWNMARKERRED__STATIC: - case RESPAWNMARKERYELLOW__STATIC: - case RESPAWNMARKERGREEN__STATIC: - if (ud.marker == 0) - t->xrepeat = t->yrepeat = 0; - continue; - case CHAIR3__STATIC: -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - t->cstat &= ~4; - break; - } -#endif - k = (((t->ang+3072+128-a)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - t->picnum = s->picnum+k; - break; - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: - if (ud.lockout) t->xrepeat = t->yrepeat = 0; - else if (t->pal == 6) - { - t->shade = -127; - continue; - } - case BULLETHOLE__STATIC: - case CRACK1__STATIC: - case CRACK2__STATIC: - case CRACK3__STATIC: - case CRACK4__STATIC: - t->shade = 16; - continue; - case NEON1__STATIC: - case NEON2__STATIC: - case NEON3__STATIC: - case NEON4__STATIC: - case NEON5__STATIC: - case NEON6__STATIC: - continue; - //case GREENSLIME: - //case GREENSLIME+1: - //case GREENSLIME+2: - //case GREENSLIME+3: - //case GREENSLIME+4: - //case GREENSLIME+5: - //case GREENSLIME+6: - //case GREENSLIME+7: - // break; - default: - if (((t->cstat&16)) || (A_CheckEnemySprite(t) && t->extra > 0) || t->statnum == STAT_PLAYER) - continue; - } - - if (A_CheckSpriteFlags(t->owner,SPRITE_NOSHADE)) - l = sprite[t->owner].shade; - else - { - if (sector[t->sectnum].ceilingstat&1) - l = sector[t->sectnum].ceilingshade; - else - l = sector[t->sectnum].floorshade; - if (l < -127) l = -127; - if (l > 128) l = 127; - } - t->shade = l; - } - - for (j=spritesortcnt-1; j>=0; j--) //Between drawrooms() and drawmasks() - { - //is the perfect time to animate sprites - t = &tsprite[j]; - i = t->owner; - s = (i < 0 ? &tsprite[j] : &sprite[i]); - - switch (DynamicTileMap[s->picnum]) - { - case NATURALLIGHTNING__STATIC: - t->shade = -127; - t->cstat |= 8192; - break; - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case MAN__STATIC: - case MAN2__STATIC: - case WOMAN__STATIC: - case NAKED1__STATIC: - case PODFEM1__STATIC: - case FEMMAG1__STATIC: - case FEMMAG2__STATIC: - case FEMPIC1__STATIC: - case FEMPIC2__STATIC: - case FEMPIC3__STATIC: - case FEMPIC4__STATIC: - case FEMPIC5__STATIC: - case FEMPIC6__STATIC: - case FEMPIC7__STATIC: - case BLOODYPOLE__STATIC: - case FEM6PAD__STATIC: - case STATUE__STATIC: - case STATUEFLASH__STATIC: - case OOZ__STATIC: - case OOZ2__STATIC: - case WALLBLOOD1__STATIC: - case WALLBLOOD2__STATIC: - case WALLBLOOD3__STATIC: - case WALLBLOOD4__STATIC: - case WALLBLOOD5__STATIC: - case WALLBLOOD7__STATIC: - case WALLBLOOD8__STATIC: - case SUSHIPLATE1__STATIC: - case SUSHIPLATE2__STATIC: - case SUSHIPLATE3__STATIC: - case SUSHIPLATE4__STATIC: - case FETUS__STATIC: - case FETUSJIB__STATIC: - case FETUSBROKE__STATIC: - case HOTMEAT__STATIC: - case FOODOBJECT16__STATIC: - case DOLPHIN1__STATIC: - case DOLPHIN2__STATIC: - case TOUGHGAL__STATIC: - case TAMPON__STATIC: - case XXXSTACY__STATIC: - case 4946: - case 4947: - case 693: - case 2254: - case 4560: - case 4561: - case 4562: - case 4498: - case 4957: - if (ud.lockout) - { - t->xrepeat = t->yrepeat = 0; - continue; - } - } - - if (t->statnum == TSPR_TEMP) continue; - if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && g_player[s->yvel].ps->newowner == -1 && s->owner >= 0) - { - t->x -= mulscale16(65536-smoothratio,g_player[s->yvel].ps->pos.x-g_player[s->yvel].ps->opos.x); - t->y -= mulscale16(65536-smoothratio,g_player[s->yvel].ps->pos.y-g_player[s->yvel].ps->opos.y); - // dirty hack - if (g_player[s->yvel].ps->dead_flag) t->z = g_player[s->yvel].ps->opos.z; - t->z += mulscale16(smoothratio,g_player[s->yvel].ps->pos.z-g_player[s->yvel].ps->opos.z) - - (g_player[s->yvel].ps->dead_flag ? 0 : PHEIGHT) + PHEIGHT; - } - else if ((s->statnum == STAT_DEFAULT && s->picnum != CRANEPOLE) || s->statnum == STAT_PLAYER || - s->statnum == STAT_STANDABLE || s->statnum == STAT_PROJECTILE || s->statnum == STAT_MISC || s->statnum == STAT_ACTOR) - { - t->x -= mulscale16(65536-smoothratio,s->x-actor[i].bposx); - t->y -= mulscale16(65536-smoothratio,s->y-actor[i].bposy); - t->z -= mulscale16(65536-smoothratio,s->z-actor[i].bposz); - } - - sect = s->sectnum; - t1 = T2; - t3 = T4; - t4 = T5; - switchpic = s->picnum; - //some special cases because dynamictostatic system can't handle addition to constants - if ((s->picnum >= SCRAP6)&&(s->picnum<=SCRAP6+7)) - switchpic = SCRAP5; - else if ((s->picnum==MONEY+1)||(s->picnum==MAIL+1)||(s->picnum==PAPER+1)) - switchpic--; - - switch (DynamicTileMap[switchpic]) - { - case DUKELYINGDEAD__STATIC: - t->z += (24<<8); - break; - case BLOODPOOL__STATIC: - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - if (t->pal == 6) - t->shade = -127; - case PUKE__STATIC: - case MONEY__STATIC: - //case MONEY+1__STATIC: - case MAIL__STATIC: - //case MAIL+1__STATIC: - case PAPER__STATIC: - //case PAPER+1__STATIC: - if (ud.lockout && s->pal == 2) - { - t->xrepeat = t->yrepeat = 0; - continue; - } - break; - case TRIPBOMB__STATIC: - continue; - case FORCESPHERE__STATIC: - if (t->statnum == 5) - { - int16_t sqa,sqb; - - sqa = - getangle( - sprite[s->owner].x-g_player[screenpeek].ps->pos.x, - sprite[s->owner].y-g_player[screenpeek].ps->pos.y); - sqb = - getangle( - sprite[s->owner].x-t->x, - sprite[s->owner].y-t->y); - - if (klabs(G_GetAngleDelta(sqa,sqb)) > 512) - if (ldist(&sprite[s->owner],t) < ldist(&sprite[g_player[screenpeek].ps->i],&sprite[s->owner])) - t->xrepeat = t->yrepeat = 0; - } - continue; - case BURNING__STATIC: - case BURNING2__STATIC: - if (sprite[s->owner].statnum == STAT_PLAYER) - { - if (display_mirror == 0 && sprite[s->owner].yvel == screenpeek && g_player[sprite[s->owner].yvel].ps->over_shoulder_on == 0) - t->xrepeat = 0; - else - { - t->ang = getangle(x-t->x,y-t->y); - t->x = sprite[s->owner].x + (sintable[(t->ang+512)&2047]>>10); - t->y = sprite[s->owner].y + (sintable[t->ang&2047]>>10); - } - } - break; - - case ATOMICHEALTH__STATIC: - t->z -= (4<<8); - break; - case CRYSTALAMMO__STATIC: - t->shade = (sintable[(totalclock<<4)&2047]>>10); - continue; - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: - if (camsprite >= 0 && actor[OW].t_data[0] == 1) - { - t->picnum = STATIC; - t->cstat |= (rand()&12); - t->xrepeat += 8; - t->yrepeat += 8; - } - else if (camsprite >= 0 && waloff[TILE_VIEWSCR] && walock[TILE_VIEWSCR] > 200) - { - t->picnum = TILE_VIEWSCR; - } - break; - - case SHRINKSPARK__STATIC: - t->picnum = SHRINKSPARK+((totalclock>>4)&3); - break; - case GROWSPARK__STATIC: - t->picnum = GROWSPARK+((totalclock>>4)&3); - break; - case RPG__STATIC: -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && - !(spriteext[i].flags & SPREXT_NOTMD)) - { - int32_t v = getangle(t->xvel, t->zvel>>4); - - spriteext[i].pitch = (v > 1023 ? v-2048 : v); - t->cstat &= ~4; - break; - } -#endif - k = (((s->ang+3072+128-getangle(s->x-x,s->y-y))&2047)/170); - if (k > 6) - { - k = 12-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - t->picnum = RPG+k; - break; - - case RECON__STATIC: - -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - t->cstat &= ~4; - break; - } -#endif - k = (((s->ang+3072+128-getangle(s->x-x,s->y-y))&2047)/170); - - if (k>6) - { - k = 12-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - - if (klabs(t3) > 64) k += 7; - t->picnum = RECON+k; - - break; - - case APLAYER__STATIC: - - p = s->yvel; - - if (t->pal == 1) t->z -= (18<<8); - - if (g_player[p].ps->over_shoulder_on > 0 && g_player[p].ps->newowner < 0) - { - /* - if (screenpeek == myconnectindex && numplayers >= 2) - { - t->x = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio); - t->y = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio); - t->z = omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio)+PHEIGHT; - t->ang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio); - t->sectnum = mycursectnum; - } - else*/ - t->ang = g_player[p].ps->ang+mulscale16((int32_t)(((g_player[p].ps->ang+1024- g_player[p].ps->oang)&2047)-1024),smoothratio); -#ifdef USE_OPENGL - if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum, t->pal) >= 0) - { - static int32_t targetang = 0; - - if (g_player[p].sync->extbits&(1<<1)) - { - if (g_player[p].sync->extbits&(1<<2))targetang += 16; - else if (g_player[p].sync->extbits&(1<<3)) targetang -= 16; - else if (targetang > 0) targetang -= targetang>>2; - else if (targetang < 0) targetang += (-targetang)>>2; - } - else - { - if (g_player[p].sync->extbits&(1<<2))targetang -= 16; - else if (g_player[p].sync->extbits&(1<<3)) targetang += 16; - else if (targetang > 0) targetang -= targetang>>2; - else if (targetang < 0) targetang += (-targetang)>>2; - } - - targetang = clamp(targetang, -128, 128); - t->ang += targetang; - } - else -#endif - t->cstat |= 2; - } - - if ((g_netServer || ud.multimode > 1) && (display_mirror || screenpeek != p || s->owner == -1)) - { - if (ud.showweapons && sprite[g_player[p].ps->i].extra > 0 && g_player[p].ps->curr_weapon > 0) - { - Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); - - tsprite[spritesortcnt].statnum = TSPR_TEMP; - - /* tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3); - if (t->yrepeat < 4) t->yrepeat = 4; */ - - tsprite[spritesortcnt].shade = t->shade; - tsprite[spritesortcnt].cstat = tsprite[spritesortcnt].pal = 0; - - tsprite[spritesortcnt].picnum = (g_player[p].ps->curr_weapon==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[g_player[p].ps->curr_weapon]); - - if (s->owner >= 0) - tsprite[spritesortcnt].z = g_player[p].ps->pos.z-(12<<8); - else tsprite[spritesortcnt].z = s->z-(51<<8); - - if (tsprite[spritesortcnt].picnum == HEAVYHBOMB) - tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 10; - else - tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 16; - - spritesortcnt++; - } - - if (g_player[p].sync->extbits & (1<<7) && !ud.pause_on) - { - Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); - - tsprite[spritesortcnt].statnum = TSPR_TEMP; - - tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3); - if (tsprite[spritesortcnt].yrepeat < 4) tsprite[spritesortcnt].yrepeat = 4; - - tsprite[spritesortcnt].cstat = 0; - tsprite[spritesortcnt].picnum = RESPAWNMARKERGREEN; - - if (s->owner >= 0) - tsprite[spritesortcnt].z = g_player[p].ps->pos.z-(20<<8); - else - tsprite[spritesortcnt].z = s->z-(96<<8); - - tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 32; - tsprite[spritesortcnt].pal = 20; - spritesortcnt++; - } - } - - if (s->owner == -1) - { -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - k = 0; - t->cstat &= ~4; - } - else -#endif - { - k = (((s->ang+3072+128-a)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - } - - if (sector[s->sectnum].lotag == 2) k += 1795-1405; - else if ((actor[i].floorz-s->z) > (64<<8)) k += 60; - - t->picnum += k; - t->pal = g_player[p].ps->palookup; - - goto PALONLY; - } - - if (g_player[p].ps->on_crane == -1 && (sector[s->sectnum].lotag&0x7ff) != 1) - { - l = s->z-actor[g_player[p].ps->i].floorz+(3<<8); - if (l > 1024 && s->yrepeat > 32 && s->extra > 0) - s->yoffset = (int8_t)(l/(s->yrepeat<<2)); - else s->yoffset=0; - } - - if (g_player[p].ps->newowner > -1) - { - t4 = *(actorscrptr[APLAYER]+1); - t3 = 0; - t1 = *(actorscrptr[APLAYER]+2); - } - - if (ud.camerasprite == -1 && g_player[p].ps->newowner == -1) - if (s->owner >= 0 && display_mirror == 0 && g_player[p].ps->over_shoulder_on == 0) - if ((!g_netServer && ud.multimode < 2) || ((g_netServer || ud.multimode > 1) && p == screenpeek)) - { - if (getrendermode() == 4) - t->cstat |= 16384; - else - { - t->owner = -1; - t->xrepeat = t->yrepeat = 0; - continue; - } - -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - k = 0; - t->cstat &= ~4; - } - else -#endif - { - k = (((s->ang+3072+128-a)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - } - - if (sector[t->sectnum].lotag == 2) k += 1795-1405; - else if ((actor[i].floorz-s->z) > (64<<8)) k += 60; - - t->picnum += k; - t->pal = g_player[p].ps->palookup; - } -PALONLY: - - if (sector[sect].floorpal && sector[sect].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(t->owner,SPRITE_NOPAL)) - t->pal = sector[sect].floorpal; - - if (s->owner == -1) continue; - - if (t->z > actor[i].floorz && t->xrepeat < 32) - t->z = actor[i].floorz; - - break; - - case JIBS1__STATIC: - case JIBS2__STATIC: - case JIBS3__STATIC: - case JIBS4__STATIC: - case JIBS5__STATIC: - case JIBS6__STATIC: - case HEADJIB1__STATIC: - case LEGJIB1__STATIC: - case ARMJIB1__STATIC: - case LIZMANHEAD1__STATIC: - case LIZMANARM1__STATIC: - case LIZMANLEG1__STATIC: - case DUKELEG__STATIC: - case DUKEGUN__STATIC: - case DUKETORSO__STATIC: - if (ud.lockout) - { - t->xrepeat = t->yrepeat = 0; - continue; - } - if (t->pal == 6) t->shade = -120; - case SCRAP1__STATIC: - case SCRAP2__STATIC: - case SCRAP3__STATIC: - case SCRAP4__STATIC: - case SCRAP5__STATIC: - if (actor[i].picnum == BLIMP && t->picnum == SCRAP1 && s->yvel >= 0) - t->picnum = s->yvel; - else t->picnum += T1; - t->shade -= 6; - - if (sector[sect].floorpal && sector[sect].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(t->owner,SPRITE_NOPAL)) - t->pal = sector[sect].floorpal; - break; - - case WATERBUBBLE__STATIC: - if (sector[t->sectnum].floorpicnum == FLOORSLIME) - { - t->pal = 7; - break; - } - default: - if (sector[sect].floorpal && sector[sect].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(t->owner,SPRITE_NOPAL)) - t->pal = sector[sect].floorpal; - break; - } - - if (actorscrptr[s->picnum]) - { - /* - if (ud.angleinterpolation) - { - if (sprpos[i].ang != sprpos[i].oldang) - t->ang = (sprpos[i].oldang + (mulscale16((int32_t)(sprpos[i].angdif),smoothratio) * sprpos[i].angdir)) & 2047; - else - t->ang = sprpos[i].ang; - } - */ - if ((unsigned)((intptr_t *)t4-&script[0]) > (unsigned)(&script[g_scriptSize]-&script[0])) - goto skip; - - l = *(((intptr_t *)t4)+2); //For TerminX: was *(int32_t *)(t4+8) - -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - k = 0; - t->cstat &= ~4; - } - else -#endif - switch (l) - { - case 2: - k = (((s->ang+3072+128-a)&2047)>>8)&1; - break; - - case 3: - case 4: - k = (((s->ang+3072+128-a)&2047)>>7)&7; - if (k > 3) - { - t->cstat |= 4; - k = 7-k; - } - else t->cstat &= ~4; - break; - - case 5: - k = getangle(s->x-x,s->y-y); - k = (((s->ang+3072+128-k)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - break; - case 7: - k = getangle(s->x-x,s->y-y); - k = (((s->ang+3072+128-k)&2047)/170); - if (k>6) - { - k = 12-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - break; - case 8: - k = (((s->ang+3072+128-a)&2047)>>8)&7; - t->cstat &= ~4; - break; - default: - k = 0; - break; - } - - t->picnum += k + (*(intptr_t *)t4) + l * t3; - - if (l > 0) while (tilesizx[t->picnum] == 0 && t->picnum > 0) - t->picnum -= l; //Hack, for actors - - if (actor[i].dispicnum >= 0) - actor[i].dispicnum = t->picnum; - } - else if (display_mirror == 1) - t->cstat |= 4; - -skip: - if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on && - (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER)) - { - t->pal = 6; - t->shade = 0; - } - - if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_SHADOW) || (s->picnum == APLAYER && s->owner >= 0)) - if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE) - if (s->picnum != HOTMEAT) - { - if (actor[i].dispicnum < 0) - { - actor[i].dispicnum++; - continue; - } - else if (ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2) && getrendermode() != 4) - { - int32_t daz,xrep,yrep; - - if ((sector[sect].lotag&0xff) > 2 || s->statnum == STAT_PROJECTILE || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER) - daz = sector[sect].floorz; - else - daz = actor[i].floorz; - - if ((s->z-daz) < (8<<8)) - if (g_player[screenpeek].ps->pos.z < daz) - { - Bmemcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); - - tsprite[spritesortcnt].statnum = TSPR_TEMP; - - tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3); - if (t->yrepeat < 4) t->yrepeat = 4; - - tsprite[spritesortcnt].shade = 127; - tsprite[spritesortcnt].cstat |= 2; - - tsprite[spritesortcnt].z = daz; - xrep = tsprite[spritesortcnt].xrepeat;// - (klabs(daz-t->z)>>11); - tsprite[spritesortcnt].xrepeat = xrep; - tsprite[spritesortcnt].pal = 4; - - yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11); - tsprite[spritesortcnt].yrepeat = yrep; - -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0) - { - tsprite[spritesortcnt].yrepeat = 0; - // 512:trans reverse - //1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues - tsprite[spritesortcnt].cstat |= (512+1024); - } - else if (getrendermode() >= 3) - { - int32_t ii; - - ii = getangle(tsprite[spritesortcnt].x-g_player[screenpeek].ps->pos.x, - tsprite[spritesortcnt].y-g_player[screenpeek].ps->pos.y); - - tsprite[spritesortcnt].x += sintable[(ii+2560)&2047]>>9; - tsprite[spritesortcnt].y += sintable[(ii+2048)&2047]>>9; - } -#endif - spritesortcnt++; - } - } - } - - switch (DynamicTileMap[s->picnum]) - { - case LASERLINE__STATIC: - if (sector[t->sectnum].lotag == 2) t->pal = 8; - t->z = sprite[s->owner].z-(3<<8); - if (g_tripbombLaserMode == 2 && g_player[screenpeek].ps->heat_on == 0) - t->yrepeat = 0; - case EXPLOSION2__STATIC: - case EXPLOSION2BOT__STATIC: - case FREEZEBLAST__STATIC: - case ATOMICHEALTH__STATIC: - case FIRELASER__STATIC: - case SHRINKSPARK__STATIC: - case GROWSPARK__STATIC: - case CHAINGUN__STATIC: - case SHRINKEREXPLOSION__STATIC: - case RPG__STATIC: - case FLOORFLAME__STATIC: - if (t->picnum == EXPLOSION2) - { - g_player[screenpeek].ps->visibility = -127; - lastvisinc = totalclock+32; - //g_restorePalette = 1; // JBF 20040101: why? - } - t->shade = -127; - t->cstat |= 8192; - break; - case FIRE__STATIC: - case FIRE2__STATIC: - t->cstat |= 128; - case BURNING__STATIC: - case BURNING2__STATIC: - if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2) - t->z = sector[t->sectnum].floorz; - t->shade = -127; - case SMALLSMOKE__STATIC: - t->cstat |= 8192; - break; - case COOLEXPLOSION1__STATIC: - t->shade = -127; - t->cstat |= 8192; - t->picnum += (s->shade>>1); - break; - case PLAYERONWATER__STATIC: -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - k = 0; - t->cstat &= ~4; - } - else -#endif - { - k = (((t->ang+3072+128-a)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - } - - t->picnum = s->picnum+k+((T1<4)*5); - t->shade = sprite[s->owner].shade; - - break; - - case WATERSPLASH2__STATIC: - t->picnum = WATERSPLASH2+t1; - break; - case REACTOR2__STATIC: - t->picnum = s->picnum + T3; - break; - case SHELL__STATIC: - t->picnum = s->picnum+(T1&1); - case SHOTGUNSHELL__STATIC: - t->cstat |= 12; - if (T1 > 2) t->cstat &= ~16; - else if (T1 > 1) t->cstat &= ~4; - break; - case FRAMEEFFECT1_13__STATIC: - if (PLUTOPAK) break; - case FRAMEEFFECT1__STATIC: - if (s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS) - { - if (sprite[s->owner].picnum == APLAYER) - if (ud.camerasprite == -1) - if (screenpeek == sprite[s->owner].yvel && display_mirror == 0) - { - t->owner = -1; - break; - } - if ((sprite[s->owner].cstat&32768) == 0) - { - if (!actor[s->owner].dispicnum) - t->picnum = actor[i].t_data[1]; - else t->picnum = actor[s->owner].dispicnum; - t->pal = sprite[s->owner].pal; - t->shade = sprite[s->owner].shade; - t->ang = sprite[s->owner].ang; - t->cstat = 2|sprite[s->owner].cstat; - } - } - break; - - case CAMERA1__STATIC: - case RAT__STATIC: -#ifdef USE_OPENGL - if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) - { - t->cstat &= ~4; - break; - } -#endif - k = (((t->ang+3072+128-a)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - t->picnum = s->picnum+k; - break; - } - - actor[i].dispicnum = t->picnum; - // why? - /* - if (sector[t->sectnum].floorpicnum == MIRROR) - t->xrepeat = t->yrepeat = 0; - */ - } - - if (apScriptGameEvent[EVENT_ANIMATESPRITES]) - { - j = spritesortcnt-1; - do - { - if (display_mirror) tsprite[j].statnum = TSPR_MIRROR; - if (tsprite[j].owner < MAXSPRITES && tsprite[j].owner >= 0 && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) - { - spriteext[tsprite[j].owner].tspr = (spritetype *)&tsprite[j]; - VM_OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1); - } - } - while (j--); - - if (j < 0) return; - - if (display_mirror) tsprite[j].statnum = TSPR_MIRROR; - if (tsprite[j].owner >= 0 && tsprite[j].owner < MAXSPRITES && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) - { - spriteext[tsprite[j].owner].tspr = (spritetype *)&tsprite[j]; - VM_OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1); - } - } -} -#if 0 // def _MSC_VER -//#pragma auto_inline() -#pragma optimize("",on) -#endif - -char CheatStrings[][MAXCHEATLEN] = -{ - "cornholio", // 0 - "stuff", // 1 - "scotty###", // 2 - "coords", // 3 - "view", // 4 - "time", // 5 - "unlock", // 6 - "cashman", // 7 - "items", // 8 - "rate", // 9 - "skill#", // 10 - "beta", // 11 - "hyper", // 12 - "monsters", // 13 - "", // 14 - "", // 15 - "todd", // 16 - "showmap", // 17 - "kroz", // 18 - "allen", // 19 - "clip", // 20 - "weapons", // 21 - "inventory", // 22 - "keys", // 23 - "debug", // 24 - "", // 25 - "cgs", // 26 -}; - -enum cheatindex_t -{ - CHEAT_CORNHOLIO, - CHEAT_STUFF, - CHEAT_SCOTTY, - CHEAT_COORDS, - CHEAT_VIEW, - CHEAT_TIME, - CHEAT_UNLOCK, - CHEAT_CASHMAN, - CHEAT_ITEMS, - CHEAT_RATE, - CHEAT_SKILL, - CHEAT_BETA, - CHEAT_HYPER, - CHEAT_MONSTERS, - CHEAT_RESERVED, - CHEAT_RESERVED2, - CHEAT_TODD, - CHEAT_SHOWMAP, - CHEAT_KROZ, - CHEAT_ALLEN, - CHEAT_CLIP, - CHEAT_WEAPONS, - CHEAT_INVENTORY, - CHEAT_KEYS, - CHEAT_DEBUG, - CHEAT_RESERVED3, - CHEAT_COMEGETSOME, -}; - -void G_CheatGetInv(void) -{ - Gv_SetVar(g_iReturnVarID, 400, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETSTEROIDS, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] = - aGameVars[g_iReturnVarID].val.lValue; - } - - Gv_SetVar(g_iReturnVarID, 1200, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETHEAT, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_HEATS] = - aGameVars[g_iReturnVarID].val.lValue; - } - - Gv_SetVar(g_iReturnVarID, 200, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETBOOT, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_BOOTS] = - aGameVars[g_iReturnVarID].val.lValue; - } - - Gv_SetVar(g_iReturnVarID, 100, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETSHIELD, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_SHIELD] = - aGameVars[g_iReturnVarID].val.lValue; - } - - Gv_SetVar(g_iReturnVarID, 6400, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETSCUBA, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_SCUBA] = - aGameVars[g_iReturnVarID].val.lValue; - } - - Gv_SetVar(g_iReturnVarID, 2400, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETHOLODUKE, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_HOLODUKE] = - aGameVars[g_iReturnVarID].val.lValue; - } - - Gv_SetVar(g_iReturnVarID, 1600, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETJETPACK, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_JETPACK] = - aGameVars[g_iReturnVarID].val.lValue; - } - - Gv_SetVar(g_iReturnVarID, g_player[myconnectindex].ps->max_player_health, g_player[myconnectindex].ps->i, myconnectindex); - VM_OnEvent(EVENT_CHEATGETFIRSTAID, g_player[myconnectindex].ps->i, myconnectindex, -1); - if (aGameVars[g_iReturnVarID].val.lValue >=0) - { - g_player[myconnectindex].ps->inv_amount[GET_FIRSTAID] = - aGameVars[g_iReturnVarID].val.lValue; - } -} - -int8_t cheatbuf[MAXCHEATLEN],cheatbuflen; - -GAME_STATIC void G_DoCheats(void) -{ - int32_t ch, i, j, k=0, weapon; - static int32_t z=0; - char consolecheat = 0; // JBF 20030914 - - if (osdcmd_cheatsinfo_stat.cheatnum != -1) - { - // JBF 20030914 - k = osdcmd_cheatsinfo_stat.cheatnum; - osdcmd_cheatsinfo_stat.cheatnum = -1; - consolecheat = 1; - } - - if (g_player[myconnectindex].ps->gm & (MODE_TYPE|MODE_MENU)) - return; - - if (VOLUMEONE && !z) - { - Bstrcpy(CheatStrings[2],"scotty##"); - Bstrcpy(CheatStrings[6],""); - z=1; - } - - if (consolecheat && numplayers < 2 && ud.recstat == 0) - goto FOUNDCHEAT; - - if (g_player[myconnectindex].ps->cheat_phase == 1) - { - while (KB_KeyWaiting()) - { - ch = Btolower(KB_Getch()); - - if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9'))) - { - g_player[myconnectindex].ps->cheat_phase = 0; - // P_DoQuote(QUOTE_46,g_player[myconnectindex].ps); - return; - } - - cheatbuf[cheatbuflen++] = (int8_t)ch; - cheatbuf[cheatbuflen] = 0; - // KB_ClearKeysDown(); - - if (cheatbuflen > MAXCHEATLEN) - { - g_player[myconnectindex].ps->cheat_phase = 0; - return; - } - - for (k=0; k < NUMCHEATCODES; k++) - { - for (j = 0; j= '0' && ch <= '9')) - { - if (CheatStrings[k][j+1] == 0) goto FOUNDCHEAT; - if (j == cheatbuflen-1) return; - } - else break; - } - } - - g_player[myconnectindex].ps->cheat_phase = 0; - return; - -FOUNDCHEAT: - { - switch (k) - { - case CHEAT_WEAPONS: - j = 0; - - if (VOLUMEONE) - j = 6; - - for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS-j; weapon++) - { - P_AddAmmo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]); - g_player[myconnectindex].ps->gotweapon |= (1<cheat_phase = 0; - P_DoQuote(QUOTE_CHEAT_ALL_WEAPONS, g_player[myconnectindex].ps); - return; - - case CHEAT_INVENTORY: - KB_FlushKeyBoardQueue(); - g_player[myconnectindex].ps->cheat_phase = 0; - G_CheatGetInv(); - P_DoQuote(QUOTE_CHEAT_ALL_INV, g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - return; - - case CHEAT_KEYS: - g_player[myconnectindex].ps->got_access = 7; - KB_FlushKeyBoardQueue(); - g_player[myconnectindex].ps->cheat_phase = 0; - P_DoQuote(QUOTE_CHEAT_ALL_KEYS, g_player[myconnectindex].ps); - return; - - case CHEAT_DEBUG: - g_Debug = 1-g_Debug; - KB_FlushKeyBoardQueue(); - g_player[myconnectindex].ps->cheat_phase = 0; - - G_DumpDebugInfo(); - Bsprintf(tempbuf,"GAMEVARS DUMPED TO LOG"); - G_AddUserQuote(tempbuf); - Bsprintf(tempbuf,"MAP DUMPED TO DEBUG.MAP"); - G_AddUserQuote(tempbuf); - break; - - case CHEAT_CLIP: - ud.clipping = 1-ud.clipping; - KB_FlushKeyBoardQueue(); - g_player[myconnectindex].ps->cheat_phase = 0; - P_DoQuote(QUOTE_CHEAT_NOCLIP-ud.clipping, g_player[myconnectindex].ps); - return; - - case CHEAT_RESERVED2: - g_player[myconnectindex].ps->gm = MODE_EOL; - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_ALLEN: - P_DoQuote(QUOTE_CHEAT_ALLEN,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_ClearKeyDown(sc_N); - return; - - case CHEAT_CORNHOLIO: - case CHEAT_KROZ: - ud.god = 1-ud.god; - - if (ud.god) - { - pus = 1; - pub = 1; - sprite[g_player[myconnectindex].ps->i].cstat = 257; - - actor[g_player[myconnectindex].ps->i].t_data[0] = 0; - actor[g_player[myconnectindex].ps->i].t_data[1] = 0; - actor[g_player[myconnectindex].ps->i].t_data[2] = 0; - actor[g_player[myconnectindex].ps->i].t_data[3] = 0; - actor[g_player[myconnectindex].ps->i].t_data[4] = 0; - actor[g_player[myconnectindex].ps->i].t_data[5] = 0; - - sprite[g_player[myconnectindex].ps->i].hitag = 0; - sprite[g_player[myconnectindex].ps->i].lotag = 0; - sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup; - - P_DoQuote(QUOTE_CHEAT_GODMODE_ON,g_player[myconnectindex].ps); - } - else - { - ud.god = 0; - sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; - actor[g_player[myconnectindex].ps->i].extra = -1; - g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health; - P_DoQuote(QUOTE_CHEAT_GODMODE_OFF,g_player[myconnectindex].ps); - } - - sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; - actor[g_player[myconnectindex].ps->i].extra = 0; - g_player[myconnectindex].ps->cheat_phase = 0; - g_player[myconnectindex].ps->dead_flag = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_COMEGETSOME: - ud.god = 1-ud.god; - - if (ud.god) - { - pus = 1; - pub = 1; - sprite[g_player[myconnectindex].ps->i].cstat = 257; - - actor[g_player[myconnectindex].ps->i].t_data[0] = 0; - actor[g_player[myconnectindex].ps->i].t_data[1] = 0; - actor[g_player[myconnectindex].ps->i].t_data[2] = 0; - actor[g_player[myconnectindex].ps->i].t_data[3] = 0; - actor[g_player[myconnectindex].ps->i].t_data[4] = 0; - actor[g_player[myconnectindex].ps->i].t_data[5] = 0; - - sprite[g_player[myconnectindex].ps->i].hitag = 0; - sprite[g_player[myconnectindex].ps->i].lotag = 0; - sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup; - Bstrcpy(ScriptQuotes[QUOTE_RESERVED4],"COME GET SOME!"); - S_PlaySound(DUKE_GETWEAPON2); - P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps); - G_CheatGetInv(); - for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) - g_player[myconnectindex].ps->gotweapon |= (1<max_ammo_amount[weapon]); - g_player[myconnectindex].ps->got_access = 7; - } - else - { - sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; - actor[g_player[myconnectindex].ps->i].extra = -1; - g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health; - P_DoQuote(QUOTE_CHEAT_GODMODE_OFF, g_player[myconnectindex].ps); - } - - sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health; - actor[g_player[myconnectindex].ps->i].extra = 0; - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_STUFF: - - j = 0; - - if (VOLUMEONE) - j = 6; - - for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS-j; weapon++) - g_player[myconnectindex].ps->gotweapon |= (1<max_ammo_amount[weapon]); - G_CheatGetInv(); - g_player[myconnectindex].ps->got_access = 7; - P_DoQuote(QUOTE_CHEAT_EVERYTHING, g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - - // P_DoQuote(QUOTE_21,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - g_player[myconnectindex].ps->inven_icon = 1; - return; - - case CHEAT_SCOTTY: - case CHEAT_SKILL: - if (k == CHEAT_SCOTTY) - { - i = Bstrlen(CheatStrings[k])-3+VOLUMEONE; - if (!consolecheat) - { - // JBF 20030914 - int16_t volnume,levnume; - if (VOLUMEALL) - { - volnume = cheatbuf[i] - '0'; - levnume = (cheatbuf[i+1] - '0')*10+(cheatbuf[i+2]-'0'); - } - else - { - volnume = cheatbuf[i] - '0'; - levnume = cheatbuf[i+1] - '0'; - } - - volnume--; - levnume--; - - if ((VOLUMEONE && volnume > 0) || volnume > g_numVolumes-1 || - levnume >= MAXLEVELS || MapInfo[volnume *MAXLEVELS+levnume].filename == NULL) - { - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - } - - ud.m_volume_number = ud.volume_number = volnume; - ud.m_level_number = ud.level_number = levnume; - } - else - { - // JBF 20030914 - ud.m_volume_number = ud.volume_number = osdcmd_cheatsinfo_stat.volume; - ud.m_level_number = ud.level_number = osdcmd_cheatsinfo_stat.level; - } - } - else - { - i = Bstrlen(CheatStrings[k])-1; - ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1'; - } - if (numplayers > 1 && g_netServer) - Net_NewGame(ud.m_volume_number,ud.m_level_number); - else g_player[myconnectindex].ps->gm |= MODE_RESTART; - - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_COORDS: - g_player[myconnectindex].ps->cheat_phase = 0; - ud.coords = 1-ud.coords; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_VIEW: - if (g_player[myconnectindex].ps->over_shoulder_on) - g_player[myconnectindex].ps->over_shoulder_on = 0; - else - { - g_player[myconnectindex].ps->over_shoulder_on = 1; - g_cameraDistance = 0; - g_cameraClock = totalclock; - } -// P_DoQuote(QUOTE_CHEATS_DISABLED,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_TIME: - -// P_DoQuote(QUOTE_21,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_UNLOCK: - if (VOLUMEONE) return; - - for (i=numsectors-1; i>=0; i--) //Unlock - { - j = sector[i].lotag; - if (j == -1 || j == 32767) continue; - if ((j & 0x7fff) > 2) - { - if (j&(0xffff-16384)) - sector[i].lotag &= (0xffff-16384); - G_OperateSectors(i,g_player[myconnectindex].ps->i); - } - } - G_OperateForceFields(g_player[myconnectindex].ps->i,-1); - - P_DoQuote(QUOTE_CHEAT_UNLOCK,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_CASHMAN: - ud.cashman = 1-ud.cashman; - KB_ClearKeyDown(sc_N); - g_player[myconnectindex].ps->cheat_phase = 0; - return; - - case CHEAT_ITEMS: - G_CheatGetInv(); - g_player[myconnectindex].ps->got_access = 7; - P_DoQuote(QUOTE_CHEAT_EVERYTHING,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE; - ud.showallmap = 1-ud.showallmap; - if (ud.showallmap) - { - for (i=0; i<(MAXSECTORS>>3); i++) - show2dsector[i] = 255; - for (i=0; i<(MAXWALLS>>3); i++) - show2dwall[i] = 255; - P_DoQuote(QUOTE_SHOW_MAP_ON, g_player[myconnectindex].ps); - } - else - { - for (i=0; i<(MAXSECTORS>>3); i++) - show2dsector[i] = 0; - for (i=0; i<(MAXWALLS>>3); i++) - show2dwall[i] = 0; - P_DoQuote(QUOTE_SHOW_MAP_OFF, g_player[myconnectindex].ps); - } - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_TODD: - P_DoQuote(QUOTE_CHEAT_TODD,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_RATE: - ud.tickrate = !ud.tickrate; - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_BETA: - P_DoQuote(QUOTE_CHEAT_BETA,g_player[myconnectindex].ps); - KB_ClearKeyDown(sc_H); - g_player[myconnectindex].ps->cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_HYPER: - g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] = 399; - g_player[myconnectindex].ps->inv_amount[GET_HEATS] = 1200; - g_player[myconnectindex].ps->cheat_phase = 0; - P_DoQuote(QUOTE_CHEAT_STEROIDS,g_player[myconnectindex].ps); - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_MONSTERS: - { - char *s[] = { "ON", "OFF" }; - - if (++g_noEnemies == 3) - g_noEnemies = 0; - - g_player[screenpeek].ps->cheat_phase = 0; - - Bsprintf(ScriptQuotes[QUOTE_RESERVED4], "MONSTERS: %s", s[g_noEnemies%1]); - P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps); - - KB_FlushKeyBoardQueue(); - return; - } - case CHEAT_RESERVED: - case CHEAT_RESERVED3: - ud.eog = 1; - g_player[myconnectindex].ps->gm |= MODE_EOL; - KB_FlushKeyBoardQueue(); - return; - } - } - } - } - else - { - if (KB_KeyPressed((uint8_t)CheatKeys[0])) - { - if (g_player[myconnectindex].ps->cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0) - { - if (CheatKeys[0] == CheatKeys[1]) - KB_ClearKeyDown((uint8_t)CheatKeys[0]); - g_player[myconnectindex].ps->cheat_phase = -1; - } - } - - if (KB_KeyPressed((uint8_t)CheatKeys[1])) - { - if (g_player[myconnectindex].ps->cheat_phase == -1) - { - if (ud.player_skill == 4) - { - P_DoQuote(QUOTE_CHEATS_DISABLED,g_player[myconnectindex].ps); - g_player[myconnectindex].ps->cheat_phase = 0; - } - else - { - g_player[myconnectindex].ps->cheat_phase = 1; - // P_DoQuote(QUOTE_25,g_player[myconnectindex].ps); - cheatbuflen = 0; - } - KB_FlushKeyboardQueue(); - } - else if (g_player[myconnectindex].ps->cheat_phase != 0) - { - g_player[myconnectindex].ps->cheat_phase = 0; - KB_ClearKeyDown((uint8_t)CheatKeys[0]); - KB_ClearKeyDown((uint8_t)CheatKeys[1]); - } - } - } -} - -void G_HandleLocalKeys(void) -{ - int32_t i,ch; - int32_t j; - -// CONTROL_ProcessBinds(); - - if (ud.recstat == 2) - { - ControlInfo noshareinfo; - CONTROL_GetInput(&noshareinfo); - } - - if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex) - { - if (KB_UnBoundKeyPressed(sc_F1) || KB_UnBoundKeyPressed(sc_F2) || ud.autovote) - { - tempbuf[0] = PACKET_MAP_VOTE; - tempbuf[1] = myconnectindex; - tempbuf[2] = (KB_UnBoundKeyPressed(sc_F1) || ud.autovote ? ud.autovote-1 : 0); - tempbuf[3] = myconnectindex; - - if (g_netClient) - enet_peer_send(g_netClientPeer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE)); - else if (g_netServer) - enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE)); - - - G_AddUserQuote("VOTE CAST"); - g_player[myconnectindex].gotvote = 1; - KB_ClearKeyDown(sc_F1); - KB_ClearKeyDown(sc_F2); - voting = -1; - } - } - - if (!ALT_IS_PRESSED && ud.overhead_on == 0 && (g_player[myconnectindex].ps->gm & MODE_TYPE) == 0) - { - if (BUTTON(gamefunc_Enlarge_Screen)) - { - CONTROL_ClearButton(gamefunc_Enlarge_Screen); - if (!SHIFTS_IS_PRESSED) - { - if (ud.screen_size > 0) - S_PlaySound(THUD); - if (getrendermode() >= 3 && ud.screen_size == 8 && ud.statusbarmode == 0) - ud.statusbarmode = 1; - else ud.screen_size -= 4; - - if (ud.statusbarscale == 100 && ud.statusbarmode == 1) - { - ud.statusbarmode = 0; - ud.screen_size -= 4; - } - } - else - { - ud.statusbarscale += 4; - G_SetStatusBarScale(ud.statusbarscale); - } - G_UpdateScreenArea(); - } - - if (BUTTON(gamefunc_Shrink_Screen)) - { - CONTROL_ClearButton(gamefunc_Shrink_Screen); - if (!SHIFTS_IS_PRESSED) - { - if (ud.screen_size < 64) S_PlaySound(THUD); - if (getrendermode() >= 3 && ud.screen_size == 8 && ud.statusbarmode == 1) - ud.statusbarmode = 0; - else ud.screen_size += 4; - } - else - { - ud.statusbarscale -= 4; - if (ud.statusbarscale < 37) - ud.statusbarscale = 37; - G_SetStatusBarScale(ud.statusbarscale); - } - G_UpdateScreenArea(); - } - } - - if (g_player[myconnectindex].ps->cheat_phase == 1 || (g_player[myconnectindex].ps->gm&(MODE_MENU|MODE_TYPE))) return; - - if (BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2)) - { - CONTROL_ClearButton(gamefunc_See_Coop_View); - screenpeek = connectpoint2[screenpeek]; - if (screenpeek == -1) screenpeek = 0; - g_restorePalette = 1; - } - - if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_Show_Opponents_Weapon)) - { - CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon); - ud.config.ShowOpponentWeapons = ud.showweapons = 1-ud.showweapons; - P_DoQuote(QUOTE_WEAPON_MODE_OFF-ud.showweapons,g_player[screenpeek].ps); - } - - if (BUTTON(gamefunc_Toggle_Crosshair)) - { - CONTROL_ClearButton(gamefunc_Toggle_Crosshair); - ud.crosshair = !ud.crosshair; - P_DoQuote(QUOTE_CROSSHAIR_OFF-ud.crosshair,g_player[screenpeek].ps); - } - - if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode)) - { - CONTROL_ClearButton(gamefunc_Map_Follow_Mode); - ud.scrollmode = 1-ud.scrollmode; - if (ud.scrollmode) - { - ud.folx = g_player[screenpeek].ps->opos.x; - ud.foly = g_player[screenpeek].ps->opos.y; - ud.fola = g_player[screenpeek].ps->oang; - } - P_DoQuote(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode,g_player[myconnectindex].ps); - } - - if (KB_UnBoundKeyPressed(sc_ScrollLock)) - { - KB_ClearKeyDown(sc_ScrollLock); - - switch (ud.recstat) - { - case 0: - G_OpenDemoWrite(); - break; - case 1: - G_CloseDemoWrite(); - break; - } - } - - if (ud.recstat == 2) - { - if (KB_KeyPressed(sc_Space)) - { - KB_ClearKeyDown(sc_Space); - - g_demo_paused = !g_demo_paused; - g_demo_rewind = 0; - - if (g_demo_paused) - { - FX_StopAllSounds(); - S_ClearSoundLocks(); - } - } - - if (KB_KeyPressed(sc_Tab)) - { - KB_ClearKeyDown(sc_Tab); - g_demo_showStats = !g_demo_showStats; - } - -#if 0 - if (KB_KeyPressed(sc_kpad_Plus)) - { - if (g_timerTicsPerSecond != 240) - { - uninittimer(); - inittimer(240); - g_timerTicsPerSecond = 240; - } - } - else if (KB_KeyPressed(sc_kpad_Minus)) - { - if (g_timerTicsPerSecond != 60) - { - uninittimer(); - inittimer(60); - g_timerTicsPerSecond = 60; - } - } - else if (g_timerTicsPerSecond != 120) - { - uninittimer(); - inittimer(120); - g_timerTicsPerSecond = 120; - } -#endif - - if (KB_KeyPressed(sc_kpad_6)) - { - KB_ClearKeyDown(sc_kpad_6); - j = (15< g_demo_totalCnt) - g_demo_goalCnt = 0; - else - demo_preparewarp(); - } - else if (KB_KeyPressed(sc_kpad_4)) - { - KB_ClearKeyDown(sc_kpad_4); - j = (15<gm = MODE_GAME; -// ready2send=0; - screenpeek=myconnectindex; -// g_demo_paused=0; - } -#endif - } - - if (SHIFTS_IS_PRESSED || ALT_IS_PRESSED) - { - i = 0; - j = sc_F1; - - do - { - if (KB_UnBoundKeyPressed(j)) - { - KB_ClearKeyDown(j); - i = j - sc_F1 + 1; - } - } - while (++j < sc_F11); - - if (i) - { - if (SHIFTS_IS_PRESSED) - { - if (i == 5 && g_player[myconnectindex].ps->fta > 0 && g_player[myconnectindex].ps->ftq == QUOTE_MUSIC) - { - i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6); - g_musicIndex = (g_musicIndex+1)%i; - while (MapInfo[(uint8_t)g_musicIndex].musicfn == NULL) - { - g_musicIndex++; - if (g_musicIndex >= i) - g_musicIndex = 0; - } - if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) - { - if (S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex)) - Bsprintf(ScriptQuotes[QUOTE_MUSIC],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); - else - Bsprintf(ScriptQuotes[QUOTE_MUSIC],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]); - P_DoQuote(QUOTE_MUSIC,g_player[myconnectindex].ps); - } - return; - } - - G_AddUserQuote(ud.ridecule[i-1]); - - ch = 0; - - tempbuf[ch] = PACKET_MESSAGE; - tempbuf[ch+1] = 255; - tempbuf[ch+2] = 0; - Bstrcat(tempbuf+2,ud.ridecule[i-1]); - - i = 2+strlen(ud.ridecule[i-1]); - - tempbuf[i++] = myconnectindex; - - if (g_netClient) - enet_peer_send(g_netClientPeer, CHAN_CHAT, enet_packet_create(tempbuf, i, 0)); - else if (g_netServer) - enet_host_broadcast(g_netServer, CHAN_CHAT, enet_packet_create(tempbuf, i, 0)); - - pus = NUMPAGES; - pub = NUMPAGES; - - return; - - } - - if (ud.lockout == 0) - if (ud.config.SoundToggle && ALT_IS_PRESSED && (RTS_NumSounds() > 0) && g_RTSPlaying == 0 && (ud.config.VoiceToggle & 1)) - { - FX_PlayAuto3D((char *)RTS_GetSound(i-1),RTS_SoundLength(i-1),0,0,0,255,-i); - - g_RTSPlaying = 7; - - if ((g_netServer || ud.multimode > 1)) - { - tempbuf[0] = PACKET_RTS; - tempbuf[1] = i; - tempbuf[2] = myconnectindex; - - if (g_netClient) - enet_peer_send(g_netClientPeer, CHAN_CHAT, enet_packet_create(tempbuf, 3, 0)); - else if (g_netServer) - enet_host_broadcast(g_netServer, CHAN_CHAT, enet_packet_create(tempbuf, 3, 0)); - } - - pus = NUMPAGES; - pub = NUMPAGES; - - return; - } - } - } - - if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED) - { - - if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_SendMessage)) - { - KB_FlushKeyboardQueue(); - CONTROL_ClearButton(gamefunc_SendMessage); - g_player[myconnectindex].ps->gm |= MODE_TYPE; - typebuf[0] = 0; - inputloc = 0; - } - - if (KB_UnBoundKeyPressed(sc_F1)/* || (ud.show_help && (KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || MOUSE_GetButtons()&LEFT_MOUSE))*/) - { - KB_ClearKeyDown(sc_F1); - ChangeToMenu(400); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - g_player[myconnectindex].ps->gm |= MODE_MENU; - - if ((!g_netServer && ud.multimode < 2)) - { - ready2send = 0; - totalclock = ototalclock; - screenpeek = myconnectindex; - } - - /* - KB_ClearKeyDown(sc_Space); - KB_ClearKeyDown(sc_kpad_Enter); - KB_ClearKeyDown(sc_Enter); - MOUSE_ClearButton(LEFT_MOUSE); - ud.show_help ++; - - if (ud.show_help > 2) - { - ud.show_help = 0; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) ready2send = 1; - G_UpdateScreenArea(); - } - else - { - setview(0,0,xdim-1,ydim-1); - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - } - */ - } - - // if((!net_server && ud.multimode < 2)) - { - if (ud.recstat != 2 && KB_UnBoundKeyPressed(sc_F2)) - { - KB_ClearKeyDown(sc_F2); - -FAKE_F2: - if (sprite[g_player[myconnectindex].ps->i].extra <= 0) - { - P_DoQuote(QUOTE_SAVE_DEAD,g_player[myconnectindex].ps); - return; - } - ChangeToMenu(350); - g_screenCapture = 1; - G_DrawRooms(myconnectindex,65536); - //savetemp("duke3d.tmp",waloff[TILE_SAVESHOT],160*100); - g_screenCapture = 0; - FX_StopAllSounds(); - S_ClearSoundLocks(); - - // setview(0,0,xdim-1,ydim-1); - g_player[myconnectindex].ps->gm |= MODE_MENU; - - if ((!g_netServer && ud.multimode < 2)) - { - ready2send = 0; - totalclock = ototalclock; - screenpeek = myconnectindex; - } - } - - if (KB_UnBoundKeyPressed(sc_F3)) - { - KB_ClearKeyDown(sc_F3); - -FAKE_F3: - ChangeToMenu(300); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - // setview(0,0,xdim-1,ydim-1); - g_player[myconnectindex].ps->gm |= MODE_MENU; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - screenpeek = myconnectindex; - } - } - - if (KB_UnBoundKeyPressed(sc_F4) && ud.config.FXDevice >= 0) - { - KB_ClearKeyDown(sc_F4); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - g_player[myconnectindex].ps->gm |= MODE_MENU; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - ChangeToMenu(701); - - } - - if ((KB_UnBoundKeyPressed(sc_F6) || g_doQuickSave == 1) && (g_player[myconnectindex].ps->gm&MODE_GAME)) - { - KB_ClearKeyDown(sc_F6); - g_doQuickSave = 0; - - if (g_lastSaveSlot == -1) goto FAKE_F2; - - KB_FlushKeyboardQueue(); - - if (sprite[g_player[myconnectindex].ps->i].extra <= 0) - { - P_DoQuote(QUOTE_SAVE_DEAD,g_player[myconnectindex].ps); - return; - } - g_screenCapture = 1; - G_DrawRooms(myconnectindex,65536); - //savetemp("duke3d.tmp",waloff[TILE_SAVESHOT],160*100); - g_screenCapture = 0; - if (g_lastSaveSlot >= 0) - { - /* inputloc = Bstrlen(&ud.savegame[g_lastSaveSlot][0]); - g_currentMenu = 360+g_lastSaveSlot; - probey = g_lastSaveSlot; */ - if ((g_netServer || ud.multimode > 1)) - G_SavePlayer(-1-(g_lastSaveSlot)); - else G_SavePlayer(g_lastSaveSlot); - } - } - - if (KB_UnBoundKeyPressed(sc_F7)) - { - KB_ClearKeyDown(sc_F7); - if (g_player[myconnectindex].ps->over_shoulder_on) - g_player[myconnectindex].ps->over_shoulder_on = 0; - else - { - g_player[myconnectindex].ps->over_shoulder_on = 1; - g_cameraDistance = 0; - g_cameraClock = totalclock; - } - P_DoQuote(QUOTE_VIEW_MODE_OFF+g_player[myconnectindex].ps->over_shoulder_on,g_player[myconnectindex].ps); - } - - if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0) - { - KB_ClearKeyDown(sc_F5); - if (MapInfo[(uint8_t)g_musicIndex].alt_musicfn != NULL) - Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]); - else if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL) - { - Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]); - Bstrcat(ScriptQuotes[QUOTE_MUSIC],". USE SHIFT-F5 TO CHANGE."); - } - else ScriptQuotes[QUOTE_MUSIC][0] = '\0'; - P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps); - } - - if (KB_UnBoundKeyPressed(sc_F8)) - { - KB_ClearKeyDown(sc_F8); - ud.fta_on = !ud.fta_on; - if (ud.fta_on) P_DoQuote(QUOTE_MESSAGES_ON,g_player[myconnectindex].ps); - else - { - ud.fta_on = 1; - P_DoQuote(QUOTE_MESSAGES_OFF,g_player[myconnectindex].ps); - ud.fta_on = 0; - } - } - - if ((KB_UnBoundKeyPressed(sc_F9) || g_doQuickSave == 2) && (g_player[myconnectindex].ps->gm&MODE_GAME)) - { - KB_ClearKeyDown(sc_F9); - g_doQuickSave = 0; - - if (g_lastSaveSlot == -1) goto FAKE_F3; - - if (g_lastSaveSlot >= 0) - { - KB_FlushKeyboardQueue(); - KB_ClearKeysDown(); - FX_StopAllSounds(); - - if ((g_netServer || ud.multimode > 1)) - { - G_LoadPlayer(-1-g_lastSaveSlot); - g_player[myconnectindex].ps->gm = MODE_GAME; - } - else - { - i = G_LoadPlayer(g_lastSaveSlot); - if (i == 0) - g_player[myconnectindex].ps->gm = MODE_GAME; - } - } - } - - if (KB_UnBoundKeyPressed(sc_F10)) - { - KB_ClearKeyDown(sc_F10); - ChangeToMenu(500); - FX_StopAllSounds(); - S_ClearSoundLocks(); - g_player[myconnectindex].ps->gm |= MODE_MENU; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - } - - if (ud.overhead_on != 0) - { - - j = totalclock-nonsharedtimer; - nonsharedtimer += j; - if (BUTTON(gamefunc_Enlarge_Screen)) - g_player[myconnectindex].ps->zoom += mulscale6(j,max(g_player[myconnectindex].ps->zoom,256)); - if (BUTTON(gamefunc_Shrink_Screen)) - g_player[myconnectindex].ps->zoom -= mulscale6(j,max(g_player[myconnectindex].ps->zoom,256)); - - if ((g_player[myconnectindex].ps->zoom > 2048)) - g_player[myconnectindex].ps->zoom = 2048; - if ((g_player[myconnectindex].ps->zoom < 48)) - g_player[myconnectindex].ps->zoom = 48; - - } - } - - if (KB_KeyPressed(sc_Escape) && ud.overhead_on && g_player[myconnectindex].ps->newowner == -1) - { - KB_ClearKeyDown(sc_Escape); - ud.last_overhead = ud.overhead_on; - ud.overhead_on = 0; - ud.scrollmode = 0; - G_UpdateScreenArea(); - } - - if (BUTTON(gamefunc_AutoRun)) - { - CONTROL_ClearButton(gamefunc_AutoRun); - ud.auto_run = 1-ud.auto_run; - P_DoQuote(QUOTE_RUN_MODE_OFF+ud.auto_run,g_player[myconnectindex].ps); - } - - if (BUTTON(gamefunc_Map)) - { - CONTROL_ClearButton(gamefunc_Map); - if (ud.last_overhead != ud.overhead_on && ud.last_overhead) - { - ud.overhead_on = ud.last_overhead; - ud.last_overhead = 0; - } - else - { - ud.overhead_on++; - if (ud.overhead_on == 3) ud.overhead_on = 0; - ud.last_overhead = ud.overhead_on; - } - g_restorePalette = 1; - G_UpdateScreenArea(); - } - - if (KB_UnBoundKeyPressed(sc_F11)) - { - KB_ClearKeyDown(sc_F11); - ChangeToMenu(232); - FX_StopAllSounds(); - S_ClearSoundLocks(); - g_player[myconnectindex].ps->gm |= MODE_MENU; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 0; - totalclock = ototalclock; - } - } -} - -static void G_ShowParameterHelp(void) -{ - char *s = "Usage: eduke32 [files] [options]\n" - "Example: eduke32 -q4 -a -m -tx -map nukeland.map\n\n" - "Files can be *.grp/zip/con/def\n" - "\n" - "-cfg [file.cfg]\tUse an alternate configuration file\n" - "-connect [host]\tConnect to a multiplayer game\n" - "-c#\t\tUse MP mode #, 1 = Dukematch, 2 = Coop, 3 = Dukematch(no spawn)\n" - "-d[file.dmo]\tPlay a demo\n" - "-g[file.grp]\tUse additional game data\n" - "-h[file.def]\tUse an alternate def\n" - "-j[dir]\t\tAdds a directory to EDuke32's search list\n" - "-l#\t\tWarp to level #, see -v\n" - "-map [file.map]\tLoads a map\n" - "-m\t\tDisable monsters\n" - "-nam\t\tRun in NAM/NAPALM compatibility mode\n" - "-r\t\tRecord demo\n" - "-s#\t\tSet skill level (1-4)\n" - "-server\t\tStart a multiplayer game for other players to join\n" -#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) - "-setup/nosetup\tEnables/disables startup window\n" -#endif - "-t#\t\tSet respawn mode: 1 = Monsters, 2 = Items, 3 = Inventory, x = All\n" -#if !defined(_WIN32) - "-usecwd\t\tRead game data and configuration file from working directory\n" -#endif - "-u#########\tUser's favorite weapon order (default: 3425689071)\n" - "-v#\t\tWarp to volume #, see -l\n" - "-ww2gi\t\tRun in WW2GI compatibility mode\n" - "-x[game.con]\tLoad custom CON script\n" - "-#\t\tLoad and run a game from slot # (0-9)\n" -// "\n-?/--help\tDisplay this help message and exit\n" - "\nSee eduke32 -debughelp for debug parameters" - ; -#if defined RENDERTYPEWIN - Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev); - wm_msgbox(tempbuf,s); -#else - initprintf("%s\n",s); -#endif -} - -static void G_ShowDebugHelp(void) -{ - char *s = "Usage: eduke32 [files] [options]\n" - "\n" - "-a\t\tUse fake player AI (fake multiplayer only)\n" - "-cachesize #\tSets cache size, in Kb\n" - "-game_dir [dir]\tDuke3d_w32 compatibility option, see -j\n" - "-gamegrp \tSelects which file to use as main grp\n" - "-name [name]\tPlayer name in multiplay\n" - "-nD\t\tDump default gamevars to gamevars.txt\n" - "-noautoload\tDisable loading content from autoload dir\n" - "-nodinput\tDisable DirectInput (joystick) support\n" - "-nologo\t\tSkip the logo anim\n" - "-ns/-nm\t\tDisable sound or music\n" - "-q#\t\tFake multiplayer with # (2-8) players\n" - "-z#/-condebug\tEnable line-by-line CON compile debugging at level #\n" - "-conversion YYYYMMDD\tSelects CON script version for compatibility with older mods\n" - ; -#if defined RENDERTYPEWIN - Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev); - wm_msgbox(tempbuf,s); -#else - initprintf("%s\n",s); -#endif -} - -static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL; -static int32_t numdirs=0, numfiles=0; -static int32_t currentlist=0; - -static void clearfilenames(void) -{ - klistfree(finddirs); - klistfree(findfiles); - finddirs = findfiles = NULL; - numfiles = numdirs = 0; -} - -static int32_t getfilenames(const char *path, char kind[]) -{ - CACHE1D_FIND_REC *r; - - clearfilenames(); - finddirs = klistpath(path,"*",CACHE1D_FIND_DIR); - findfiles = klistpath(path,kind,CACHE1D_FIND_FILE); - for (r = finddirs; r; r=r->next) numdirs++; - for (r = findfiles; r; r=r->next) numfiles++; - - finddirshigh = finddirs; - findfileshigh = findfiles; - currentlist = 0; - if (findfileshigh) currentlist = 1; - - return(0); -} - -static char *autoloadmasks[] = { "*.grp", "*.zip", "*.pk3" }; -#define NUMAUTOLOADMASKS (int32_t)(sizeof(autoloadmasks)/sizeof(autoloadmasks[0])) - -static void G_DoAutoload(const char *fn) -{ - int32_t i; - - for (i=0; iname); - initprintf("Using file '%s' as game data.\n",tempbuf); - initgroupfile(tempbuf); - findfiles = findfiles->next; - } - } -} - -static char *S_OggifyFilename(char *destname, char *OGGname, const char *origname) -{ - if (!origname) - return destname; - - destname = (char *)Brealloc(destname, Bstrlen(OGGname) + Bstrlen(origname) + 1); - - if (!destname) - return NULL; - - Bstrcpy(destname, *OGGname ? OGGname : origname); - - if (*OGGname && OGGname[Bstrlen(OGGname)-1] == '/') - { - while (*origname == '/') - origname++; - Bstrcat(destname, origname); - } - - if ((OGGname = Bstrchr(destname, '.'))) - Bstrcpy(OGGname, ".ogg"); - else Bstrcat(destname, ".ogg"); - - return destname; -} - -static int32_t S_DefineSound(int32_t ID,char *name) -{ - if (ID >= MAXSOUNDS) - return 1; - g_sounds[ID].filename1 =S_OggifyFilename(g_sounds[ID].filename1,name,g_sounds[ID].filename); -// initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename); -// S_LoadSound(ID); - return 0; -} - -static int32_t S_DefineMusic(char *ID,char *name) -{ - int32_t lev, ep; - int32_t sel = MAXVOLUMES * MAXLEVELS; - char b1, b2; - - if (!ID) - return 1; - - if (!Bstrcmp(ID,"intro")) - { - ID = EnvMusicFilename[0]; - } - else if (!Bstrcmp(ID,"briefing")) - { - sel++; - ID = EnvMusicFilename[1]; - } - else if (!Bstrcmp(ID,"loading")) - { - sel += 2; - ID = EnvMusicFilename[2]; - } - else - { - sscanf(ID,"%c%d%c%d",&b1,&ep,&b2,&lev); - - if (Btoupper(b1) != 'E' || Btoupper(b2) != 'L' || --lev >= MAXLEVELS || --ep >= MAXVOLUMES) - return 1; - - sel = (ep * MAXLEVELS) + lev; - ID = MapInfo[sel].musicfn; - } - - MapInfo[sel].alt_musicfn = S_OggifyFilename(MapInfo[sel].alt_musicfn,name,ID); -// initprintf("%-15s | ",ID); -// initprintf("%3d %2d %2d | %s\n",sel,ep,lev,MapInfo[sel].alt_musicfn); -// S_PlayMusic(ID,sel); - return 0; -} - -static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload) -{ - int32_t tokn; - char *cmdtokptr; - - static const tokenlist tokens[] = - { - { "include", T_INCLUDE }, - { "#include", T_INCLUDE }, - { "loadgrp", T_LOADGRP }, - { "cachesize", T_CACHESIZE }, - { "noautoload", T_NOAUTOLOAD }, - { "music", T_MUSIC }, - { "sound", T_SOUND }, - }; - - static const tokenlist sound_musictokens[] = - { - { "id", T_ID }, - { "file", T_FILE }, - }; - - while (1) - { - tokn = getatoken(script,tokens,sizeof(tokens)/sizeof(tokenlist)); - cmdtokptr = script->ltextptr; - switch (tokn) - { - case T_LOADGRP: - { - char *fn; - - pathsearchmode = 1; - if (!scriptfile_getstring(script,&fn) && preload) - { - int32_t j = initgroupfile(fn); - - if (j == -1) - initprintf("Could not find file '%s'.\n",fn); - else - { - initprintf("Using file '%s' as game data.\n",fn); - if (!g_noAutoLoad && !ud.config.NoAutoLoad) - G_DoAutoload(fn); - } - - } - pathsearchmode = 0; - } - break; - case T_CACHESIZE: - { - int32_t j; - if (scriptfile_getnumber(script,&j) || !preload) break; - - if (j > 0) MAXCACHE1DSIZE = j<<10; - } - break; - case T_INCLUDE: - { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - scriptfile *included = scriptfile_fromfile(fn); - - if (!included) - { -// initprintf("Warning: Failed including %s on line %s:%d\n", -// fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } - else - { - parsedefinitions_game(included, preload); - scriptfile_close(included); - } - } - break; - } - case T_NOAUTOLOAD: - if (preload) - g_noAutoLoad = 1; - break; - case T_MUSIC: - { - char *tinttokptr = script->ltextptr; - char *ID=NULL,*fn="",*tfn = NULL; - char *musicend; - - if (scriptfile_getbraces(script,&musicend)) break; - while (script->textptr < musicend) - { - switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist))) - { - case T_ID: - scriptfile_getstring(script,&ID); - break; - case T_FILE: - scriptfile_getstring(script,&fn); - break; - } - } - if (!preload) - { - int32_t i; - if (ID==NULL) - { - initprintf("Error: missing ID for music definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr)); - break; - } - - i = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn,&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn); - pathsearchmode = i; - break; - } - } - else Bfree(tfn); - pathsearchmode = i; - - if (S_DefineMusic(ID,fn)) - initprintf("Error: invalid music ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr)); - } - } - break; - - case T_SOUND: - { - char *tinttokptr = script->ltextptr; - char *fn="", *tfn = NULL; - int32_t num=-1; - char *musicend; - - if (scriptfile_getbraces(script,&musicend)) break; - while (script->textptr < musicend) - { - switch (getatoken(script,sound_musictokens,sizeof(sound_musictokens)/sizeof(tokenlist))) - { - case T_ID: - scriptfile_getsymbol(script,&num); - break; - case T_FILE: - scriptfile_getstring(script,&fn); - break; - } - } - if (!preload) - { - int32_t i; - - if (num==-1) - { - initprintf("Error: missing ID for sound definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr)); - break; - } - - i = pathsearchmode; - pathsearchmode = 1; - if (findfrompath(fn,&tfn) < 0) - { - char buf[BMAX_PATH]; - - Bstrcpy(buf,fn); - kzfindfilestart(buf); - if (!kzfindfile(buf)) - { - initprintf("Error: file '%s' does not exist\n",fn); - pathsearchmode = i; - break; - } - } - else Bfree(tfn); - pathsearchmode = i; - - if (S_DefineSound(num,fn)) - initprintf("Error: invalid sound ID on line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr)); - } - } - break; - case T_EOF: - return(0); - default: - break; - } - } - return 0; -} - -static int32_t loaddefinitions_game(const char *fn, int32_t preload) -{ - scriptfile *script; - - script = scriptfile_fromfile((char *)fn); - if (!script) return -1; - - parsedefinitions_game(script, preload); - - scriptfile_close(script); - scriptfile_clearsymbols(); - - return 0; -} - -static void G_AddGroup(const char *buffer) -{ - struct strllist *s; - char buf[BMAX_PATH]; - - s = (struct strllist *)Bcalloc(1,sizeof(struct strllist)); - - Bstrcpy(buf, buffer); - - if (Bstrchr(buf,'.') == 0) - Bstrcat(buf,".grp"); - - s->str = Bstrdup(buf); - - if (CommandGrps) - { - struct strllist *t; - for (t = CommandGrps; t->next; t=t->next) ; - t->next = s; - return; - } - CommandGrps = s; -} - -static void G_AddPath(const char *buffer) -{ - struct strllist *s; - s = (struct strllist *)Bcalloc(1,sizeof(struct strllist)); - s->str = Bstrdup(buffer); - - if (CommandPaths) - { - struct strllist *t; - for (t = CommandPaths; t->next; t=t->next) ; - t->next = s; - return; - } - CommandPaths = s; -} - - -static void G_CheckCommandLine(int32_t argc, const char **argv) -{ - int16_t i = 1, j; - char *c, *k; - - ud.fta_on = 1; - ud.god = 0; - ud.m_respawn_items = 0; - ud.m_respawn_monsters = 0; - ud.m_respawn_inventory = 0; - ud.warp_on = 0; - ud.cashman = 0; - ud.m_player_skill = ud.player_skill = 2; - g_player[0].wchoice[0] = 3; - g_player[0].wchoice[1] = 4; - g_player[0].wchoice[2] = 5; - g_player[0].wchoice[3] = 7; - g_player[0].wchoice[4] = 8; - g_player[0].wchoice[5] = 6; - g_player[0].wchoice[6] = 0; - g_player[0].wchoice[7] = 2; - g_player[0].wchoice[8] = 9; - g_player[0].wchoice[9] = 1; - - if (argc > 1) - { - initprintf("Application parameters: "); - while (i < argc) - initprintf("%s ",argv[i++]); - initprintf("\n"); - - i = 1; - do - { - c = (char *)argv[i]; - if ((*c == '-') -#ifdef _WIN32 - || (*c == '/') -#endif - ) - { - if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help")) - { - G_ShowParameterHelp(); - exit(0); - } - if (!Bstrcasecmp(c+1,"debughelp") || !Bstrcasecmp(c+1,"-debughelp")) - { - G_ShowDebugHelp(); - exit(0); - } - if (!Bstrcasecmp(c+1,"grp") || !Bstrcasecmp(c+1,"g")) - { - if (argc > i+1) - { - G_AddGroup(argv[i+1]); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"game_dir")) - { - if (argc > i+1) - { - Bstrcpy(g_modDir,argv[i+1]); - G_AddPath(argv[i+1]); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"cfg")) - { - if (argc > i+1) - { - Bstrcpy(setupfilename,argv[i+1]); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"gamegrp")) - { - if (argc > i+1) - { - Bstrcpy(defaultduke3dgrp,argv[i+1]); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"nam")) - { - Bsprintf(defaultduke3dgrp, "nam.grp"); - Bsprintf(defaultduke3ddef, "nam.def"); - Bsprintf(defaultconfilename, "nam.con"); - g_gameType = GAME_NAM; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"ww2gi")) - { - Bsprintf(defaultduke3dgrp, "ww2gi.grp"); - Bsprintf(defaultduke3ddef, "ww2gi.def"); - Bsprintf(defaultconfilename, "ww2gi.con"); - g_gameType = GAME_WW2; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"setup")) - { - g_commandSetup = TRUE; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"nosetup")) - { - g_noSetup = 1; - g_commandSetup = 0; - i++; - continue; - } -#ifdef _WIN32 - if (!Bstrcasecmp(c+1,"nodinput")) - { - initprintf("DirectInput (joystick) support disabled\n"); - di_disabled = 1; - i++; - continue; - } -#endif - if (!Bstrcasecmp(c+1,"noautoload")) - { - initprintf("Autoload disabled\n"); - g_noAutoLoad = 1; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"net")) - { - G_GameExit("EDuke32 no longer supports legacy networking.\n\n" - "If using YANG or other launchers that only support legacy netplay, download an older build of EDuke32. " - "Otherwise, run the following:\n\n" - "eduke32 -server\n\n" - "Other clients can then connect by typing \"connect [host]\" in the console.\n\n" - "EDuke32 will now close."); - } - if (!Bstrcasecmp(c+1,"port")) - { - if (argc > i+1) - { - g_netPort = atoi(argv[i+1]); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"server")) - { - g_networkMode = NET_SERVER; - g_noSetup = g_noLogo = TRUE; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"dedicated")) - { - g_networkMode = NET_DEDICATED_SERVER; - g_noSetup = g_noLogo = TRUE; - i++; - continue; - } - if (!Bstrcasecmp(c+1,"connect")) - { - if (argc > i+1) - { - Net_Connect((char *)argv[i+1]); - g_noSetup = g_noLogo = TRUE; - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"password")) - { - if (argc > i+1) - { - Bstrncpy(g_netPassword, (char *)argv[i+1], sizeof(g_netPassword)-1); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"name")) - { - if (argc > i+1) - { - CommandName = (char *)argv[i+1]; - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"map")) - { - if (argc > i+1) - { - CommandMap = (char *)argv[i+1]; - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"condebug")) - { - g_scriptDebug = 1; - i++; - continue; - } - if (!Bstrcasecmp(c+1, "conversion")) - { - if (argc > i+1) - { - uint32_t j = atol((char *)argv[i+1]); - if (j>=10000000 && j<=99999999) - { - g_scriptDateVersion = j; - initprintf("CON script date version: %d\n",j); - } - else - initprintf("CON script date version must be specified as YYYYMMDD, ignoring.\n"); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"nologo")) - { - g_noLogo = 1; - i++; - continue; - } -#if !defined(_WIN32) - if (!Bstrcasecmp(c+1,"usecwd")) - { - usecwd = 1; - i++; - continue; - } -#endif - if (!Bstrcasecmp(c+1,"cachesize")) - { - if (argc > i+1) - { - uint32_t j = atol((char *)argv[i+1]); - MAXCACHE1DSIZE = j<<10; - initprintf("Cache size: %dkB\n",j); - i++; - } - i++; - continue; - } - if (!Bstrcasecmp(c+1,"noinstancechecking")) - { - i++; - continue; - } -#if defined(RENDERTYPEWIN) && defined(USE_OPENGL) - if (!Bstrcasecmp(c+1,"forcegl")) - { - forcegl = 1; - i++; - continue; - } -#endif - } - - if ((*c == '-') -#ifdef _WIN32 - || (*c == '/') -#endif - ) - { - c++; - switch (Btolower(*c)) - { - case 'a': - ud.playerai = 1; - initprintf("Other player AI.\n"); - break; - case 'c': - c++; - ud.m_coop = 0; - while ((*c >= '0')&&(*c <= '9')) - { - ud.m_coop *= 10; - ud.m_coop += *c - '0'; - c++; - } - ud.m_coop--; - break; - case 'd': - c++; - if (strchr(c,'.') == 0) - Bstrcat(c,".dmo"); - initprintf("Play demo %s.\n",c); - Bstrcpy(firstdemofile,c); - break; - case 'g': - c++; - if (!*c) break; - G_AddGroup(c); - break; - case 'h': - c++; - if (*c) - { - g_defNamePtr = c; - initprintf("Using DEF file: %s.\n",g_defNamePtr); - } - break; - case 'j': - c++; - if (!*c) break; - G_AddPath(c); - break; - case 'l': - ud.warp_on = 1; - c++; - ud.m_level_number = ud.level_number = (atoi(c)-1)%MAXLEVELS; - break; - case 'm': - if (*(c+1) != 'a' && *(c+1) != 'A') - { - ud.m_monsters_off = 1; - ud.m_player_skill = ud.player_skill = 0; - initprintf("Monsters off.\n"); - } - break; - case 'n': - c++; - if (*c == 's' || *c == 'S') - { - g_noSound = 2; - initprintf("Sound off.\n"); - } - else if (*c == 'm' || *c == 'M') - { - g_noMusic = 1; - initprintf("Music off.\n"); - } - else - { - G_ShowParameterHelp(); - exit(-1); - } - break; - case 'q': - initprintf("Fake multiplayer mode.\n"); - if (*(++c) == 0) ud.multimode = 1; - else ud.multimode = atoi(c)%17; - ud.m_coop = ud.coop = 0; - ud.m_marker = ud.marker = 1; - ud.m_respawn_monsters = ud.respawn_monsters = 1; - ud.m_respawn_items = ud.respawn_items = 1; - ud.m_respawn_inventory = ud.respawn_inventory = 1; - break; - case 'r': - ud.m_recstat = 1; - initprintf("Demo record mode on.\n"); - break; - case 's': - c++; - ud.m_player_skill = ud.player_skill = (atoi(c)%5); - if (ud.m_player_skill == 4) - ud.m_respawn_monsters = ud.respawn_monsters = 1; - break; - case 't': - c++; - if (*c == '1') ud.m_respawn_monsters = 1; - else if (*c == '2') ud.m_respawn_items = 1; - else if (*c == '3') ud.m_respawn_inventory = 1; - else - { - ud.m_respawn_monsters = 1; - ud.m_respawn_items = 1; - ud.m_respawn_inventory = 1; - } - initprintf("Respawn on.\n"); - break; - case 'u': - g_forceWeaponChoice = 1; - c++; - j = 0; - if (*c) - { - initprintf("Using favorite weapon order(s).\n"); - while (*c) - { - g_player[0].wchoice[j] = *c-'0'; - c++; - j++; - } - while (j < 10) - { - if (j == 9) - g_player[0].wchoice[9] = 1; - else - g_player[0].wchoice[j] = 2; - - j++; - } - } - else - { - initprintf("Using default weapon orders.\n"); - g_player[0].wchoice[0] = 3; - g_player[0].wchoice[1] = 4; - g_player[0].wchoice[2] = 5; - g_player[0].wchoice[3] = 7; - g_player[0].wchoice[4] = 8; - g_player[0].wchoice[5] = 6; - g_player[0].wchoice[6] = 0; - g_player[0].wchoice[7] = 2; - g_player[0].wchoice[8] = 9; - g_player[0].wchoice[9] = 1; - } - break; - case 'v': - c++; - ud.warp_on = 1; - ud.m_volume_number = ud.volume_number = atoi(c)-1; - break; - case 'w': - ud.coords = 1; - break; - case 'x': - c++; - if (*c) - { - g_scriptNamePtr = c; - g_skipDefaultCons = 1; - initprintf("Using CON file '%s'.\n",g_scriptNamePtr); - } - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - ud.warp_on = 2 + (*c) - '0'; - break; - case 'z': - c++; - g_scriptDebug = atoi(c); - if (!g_scriptDebug) - g_scriptDebug = 1; - break; - } - } - else - { - k = Bstrrchr(c,'.'); - if (k) - { - if (!Bstrcasecmp(k,".map")) - { - CommandMap = (char *)argv[i++]; - continue; - } - if (!Bstrcasecmp(k,".grp") || !Bstrcasecmp(k,".zip") || !Bstrcasecmp(k,".pk3")) - { - G_AddGroup(argv[i++]); - continue; - } - if (!Bstrcasecmp(k,".con")) - { - g_scriptNamePtr = (char *)argv[i++]; - g_skipDefaultCons = 1; - initprintf("Using CON file '%s'.\n",g_scriptNamePtr); - continue; - } - if (!Bstrcasecmp(k,".def")) - { - g_defNamePtr = (char *)argv[i++]; - initprintf("Using DEF file: %s.\n",g_defNamePtr); - continue; - } - } - } - i++; - } - while (i < argc); - } -} - -static void G_DisplayLogo(void) -{ - int32_t soundanm = 0; - int32_t logoflags=Gv_GetVarByLabel("LOGO_FLAGS",255, -1, -1); - - ready2send = 0; - - KB_FlushKeyboardQueue(); - KB_ClearKeysDown(); // JBF - - setview(0,0,xdim-1,ydim-1); - clearview(0L); - G_FadePalette(0,0,0,63); - - flushperms(); - nextpage(); - - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); - - S_StopMusic(); - FX_StopAllSounds(); // JBF 20031228 - S_ClearSoundLocks(); // JBF 20031228 - if ((!g_netServer && ud.multimode < 2) && (logoflags & LOGO_ENABLED) && !g_noLogo) - { - if (VOLUMEALL && (logoflags & LOGO_PLAYANIM)) - { - - if (!KB_KeyWaiting() && g_noLogoAnim == 0) - { - Net_GetPackets(); - G_PlayAnim("logo.anm",5); - G_FadePalette(0,0,0,63); - KB_FlushKeyboardQueue(); - KB_ClearKeysDown(); // JBF - } - - clearview(0L); - nextpage(); - } - - if (logoflags & LOGO_PLAYMUSIC) - { - g_musicIndex = -1; // hack - S_PlayMusic(&EnvMusicFilename[0][0],MAXVOLUMES*MAXLEVELS); - } - - if (!NAM) - { - //g_player[myconnectindex].ps->palette = drealms; - //G_FadePalette(0,0,0,63); - if (logoflags & LOGO_3DRSCREEN) - { - P_SetGamePalette(g_player[myconnectindex].ps, DREALMSPAL, 11); // JBF 20040308 - fadepal(0,0,0, 0,64,7); - flushperms(); - rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - nextpage(); - fadepaltile(0,0,0, 63,0,-7,DREALMS); - totalclock = 0; - while (totalclock < (120*7) && !KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - handleevents(); - Net_GetPackets(); - if (g_restorePalette) - { - P_SetGamePalette(g_player[myconnectindex].ps,g_player[myconnectindex].ps->palette,0); - g_restorePalette = 0; - } - nextpage(); - } - fadepaltile(0,0,0, 0,64,7,DREALMS); - } - KB_ClearKeysDown(); // JBF - MOUSE_ClearButton(LEFT_MOUSE); - } - - clearview(0L); - nextpage(); - - if (logoflags & LOGO_TITLESCREEN) - { - //g_player[myconnectindex].ps->palette = titlepal; - P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 11); // JBF 20040308 - flushperms(); - rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16,0,0,xdim-1,ydim-1); - KB_FlushKeyboardQueue(); - fadepaltile(0,0,0, 63,0,-7,BETASCREEN); - totalclock = 0; - - while (totalclock < (860+120) && !KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - if (logoflags & LOGO_DUKENUKEM) - { - if (totalclock > 120 && totalclock < (120+60)) - { - if (soundanm == 0) - { - soundanm++; - S_PlaySound(PIPEBOMB_EXPLODE); - } - rotatesprite(160<<16,104<<16,(totalclock-120)<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); - } - else if (totalclock >= (120+60)) - rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); - } - else soundanm++; - - if (logoflags & LOGO_THREEDEE) - { - if (totalclock > 220 && totalclock < (220+30)) - { - if (soundanm == 1) - { - soundanm++; - S_PlaySound(PIPEBOMB_EXPLODE); - } - - rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); - rotatesprite(160<<16,(129)<<16,(totalclock - 220)<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1); - } - else if (totalclock >= (220+30)) - rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1); - } - else soundanm++; - - if (PLUTOPAK && (logoflags & LOGO_PLUTOPAKSPRITE)) - { - // JBF 20030804 - if (totalclock >= 280 && totalclock < 395) - { - rotatesprite(160<<16,(151)<<16,(410-totalclock)<<12,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1); - if (soundanm == 2) - { - soundanm++; - S_PlaySound(FLY_BY); - } - } - else if (totalclock >= 395) - { - if (soundanm == 3) - { - soundanm++; - S_PlaySound(PIPEBOMB_EXPLODE); - } - rotatesprite(160<<16,(151)<<16,30<<11,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1); - } - } - - VM_OnEvent(EVENT_LOGO, -1, screenpeek, -1); - handleevents(); - Net_GetPackets(); - if (g_restorePalette) - { - P_SetGamePalette(g_player[myconnectindex].ps,g_player[myconnectindex].ps->palette,0); - g_restorePalette = 0; - } - nextpage(); - } - } - KB_ClearKeysDown(); // JBF - MOUSE_ClearButton(LEFT_MOUSE); - } - - flushperms(); - clearview(0L); - nextpage(); - - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 - S_PlaySound(NITEVISION_ONOFF); - - //G_FadePalette(0,0,0,0); - clearview(0L); -} - -static void G_Cleanup(void) -{ - int32_t i; - extern char *bitptr; - - for (i=(MAXLEVELS*(MAXVOLUMES+1))-1; i>=0; i--) // +1 volume for "intro", "briefing" music - { - if (MapInfo[i].name != NULL) Bfree(MapInfo[i].name); - if (MapInfo[i].filename != NULL) Bfree(MapInfo[i].filename); - if (MapInfo[i].musicfn != NULL) Bfree(MapInfo[i].musicfn); - if (MapInfo[i].alt_musicfn != NULL) Bfree(MapInfo[i].alt_musicfn); - if (MapInfo[i].savedstate != NULL) G_FreeMapState(i); - } - - for (i=MAXQUOTES-1; i>=0; i--) - { - if (ScriptQuotes[i] != NULL) Bfree(ScriptQuotes[i]); - if (ScriptQuoteRedefinitions[i] != NULL) Bfree(ScriptQuoteRedefinitions[i]); - } - - for (i=MAXPLAYERS-1; i>=0; i--) - { - if (g_player[i].ps != NULL) Bfree(g_player[i].ps); - if (g_player[i].sync != NULL) Bfree(g_player[i].sync); - } - - for (i=MAXSOUNDS-1; i>=0; i--) - { - if (g_sounds[i].filename != NULL) Bfree(g_sounds[i].filename); - if (g_sounds[i].filename1 != NULL) Bfree(g_sounds[i].filename1); - } - - if (label != NULL && label != (char *)&sprite[0]) Bfree(label); - if (labelcode != NULL && labelcode != (intptr_t *)§or[0]) Bfree(labelcode); - if (script != NULL) Bfree(script); - if (bitptr != NULL) Bfree(bitptr); - -// if (MusicPtr != NULL) Bfree(MusicPtr); - - hash_free(&h_gamevars); - hash_free(&h_arrays); - hash_free(&h_labels); - hash_free(&h_gamefuncs); -} - -/* -=================== -= -= ShutDown -= -=================== -*/ - -void G_Shutdown(void) -{ - CONFIG_WriteSetup(0); - S_SoundShutdown(); - S_MusicShutdown(); - CONTROL_Shutdown(); - KB_Shutdown(); - uninitengine(); - G_Cleanup(); -} - -/* -=================== -= -= G_Startup -= -=================== -*/ - -static void G_CompileScripts(void) -{ - int32_t i, psm = pathsearchmode; - - label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816 - labelcode = (intptr_t *)§or[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240 - labeltype = (intptr_t *)&wall[0]; // V8: 16384*32/4 = 131072 V7: 8192*32/4 = 65536 - - Bcorrectfilename(g_scriptNamePtr,0); - // if we compile for a V7 engine wall[] should be used for label names since it's bigger - pathsearchmode = 1; - if (g_skipDefaultCons == 0) - { - i = kopen4loadfrommod(g_scriptNamePtr,0); - if (i!=-1) - kclose(i); - else Bsprintf(g_scriptNamePtr,"GAME.CON"); - } - C_Compile(g_scriptNamePtr); - - if (g_loadFromGroupOnly) - { - if (g_skipDefaultCons == 0) - { - i = kopen4loadfrommod("EDUKE.CON",1); - if (i!=-1) - { - Bsprintf(g_scriptNamePtr,"EDUKE.CON"); - kclose(i); - } - else Bsprintf(g_scriptNamePtr,"GAME.CON"); - } - C_Compile(g_scriptNamePtr); - } - - if ((uint32_t)g_numLabels > MAXSPRITES*sizeof(spritetype)/64) // see the arithmetic above for why - G_GameExit("Error: too many labels defined!"); - else - { - char *newlabel; - intptr_t *newlabelcode; - - newlabel = (char *)Bmalloc(g_numLabels<<6); - newlabelcode = (intptr_t *)Bmalloc(g_numLabels*sizeof(intptr_t)); - - if (!newlabel || !newlabelcode) - { - G_GameExit("Error: out of memory retaining labels\n"); - } - - copybuf(label, newlabel, (g_numLabels*64)/4); - copybuf(labelcode, newlabelcode, (g_numLabels*sizeof(intptr_t))/4); - - label = newlabel; - labelcode = newlabelcode; - } - clearbufbyte(&sprite[0], sizeof(spritetype) * MAXSPRITES, 0); - clearbufbyte(§or[0], sizeof(sectortype) * MAXSECTORS, 0); - clearbufbyte(&wall[0], sizeof(walltype) * MAXWALLS, 0); - - VM_OnEvent(EVENT_INIT, -1, -1, -1); - pathsearchmode = psm; -} - -static inline void G_CheckGametype(void) -{ - ud.m_coop = clamp(ud.m_coop, 0, g_numGametypes-1); - initprintf("%s\n",GametypeNames[ud.m_coop]); - if (GametypeFlags[ud.m_coop] & GAMETYPE_ITEMRESPAWN) - ud.m_respawn_items = ud.m_respawn_inventory = 1; -} - -static void G_LoadExtraPalettes(void) -{ - int32_t j,fp; - int8_t look_pos; - char *lookfn = "lookup.dat"; - - fp = kopen4loadfrommod(lookfn,0); - if (fp != -1) - kread(fp,(char *)&g_numRealPalettes,1); - else - G_GameExit("\nERROR: File 'lookup.dat' not found."); - -#if defined(__APPLE__) && B_BIG_ENDIAN != 0 - // this is almost as bad as just setting the value to 25 :P - g_numRealPalettes = ((g_numRealPalettes * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32; - -#endif - - for (j = 0; j < 256; j++) - tempbuf[j] = j; - - for (j=g_numRealPalettes+1; j=0; j--) - { - kread(fp,(char *)&look_pos,1); - kread(fp,tempbuf,256); - makepalookup((int32_t)look_pos,tempbuf,0,0,0,1); - } - - for (j = 255; j>=0; j--) - tempbuf[j] = j; - g_numRealPalettes++; - makepalookup(g_numRealPalettes, tempbuf, 15, 15, 15, 1); - makepalookup(g_numRealPalettes + 1, tempbuf, 15, 0, 0, 1); - makepalookup(g_numRealPalettes + 2, tempbuf, 0, 15, 0, 1); - makepalookup(g_numRealPalettes + 3, tempbuf, 0, 0, 15, 1); - - kread(fp,&water_pal[0],768); - kread(fp,&slime_pal[0],768); - kread(fp,&title_pal[0],768); - kread(fp,&dre_alms[0],768); - kread(fp,&ending_pal[0],768); - - palette[765] = palette[766] = palette[767] = 0; - slime_pal[765] = slime_pal[766] = slime_pal[767] = 0; - water_pal[765] = water_pal[766] = water_pal[767] = 0; - - kclose(fp); -} - -extern int32_t startwin_run(void); -static void G_SetupGameButtons(void); - -static void G_Startup(void) -{ - int32_t i; - - inittimer(TICRATE); - - initcrc32table(); - - G_CompileScripts(); - - CONFIG_ReadKeys(); // we re-read the keys after compiling the CONs - - if (initengine()) - { - wm_msgbox("Build Engine Initialization Error", - "There was a problem initializing the Build engine: %s", engineerrstr); - G_Cleanup(); - fprintf(stderr, "G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr); - exit(6); - } - - setbasepaltable(basepaltable, BASEPALCOUNT); - - G_InitDynamicTiles(); - - if ((g_netServer || ud.multimode > 1)) G_CheckGametype(); - - if (g_noSound) ud.config.SoundToggle = 0; - if (g_noMusic) ud.config.MusicToggle = 0; - - if (CommandName) - { - // Bstrncpy(szPlayerName, CommandName, 9); - // szPlayerName[10] = '\0'; - Bstrcpy(tempbuf,CommandName); - - while (Bstrlen(OSD_StripColors(tempbuf,tempbuf)) > 10) - tempbuf[Bstrlen(tempbuf)-1] = '\0'; - - Bstrncpy(szPlayerName,tempbuf,sizeof(szPlayerName)-1); - szPlayerName[sizeof(szPlayerName)-1] = '\0'; - } - - if (CommandMap) - { - if (VOLUMEONE) - { - initprintf("The -map option is available in the registered version only!\n"); - boardfilename[0] = 0; - } - else - { - char *dot, *slash; - - boardfilename[0] = '/'; - boardfilename[1] = 0; - Bstrcat(boardfilename, CommandMap); - - dot = Bstrrchr(boardfilename,'.'); - slash = Bstrrchr(boardfilename,'/'); - if (!slash) slash = Bstrrchr(boardfilename,'\\'); - - if ((!slash && !dot) || (slash && dot < slash)) - Bstrcat(boardfilename,".map"); - - Bcorrectfilename(boardfilename,0); - - i = kopen4loadfrommod(boardfilename,0); - if (i!=-1) - { - initprintf("Using level: '%s'.\n",boardfilename); - kclose(i); - } - else - { - initprintf("Level '%s' not found.\n",boardfilename); - boardfilename[0] = 0; - } - } - } - - if (VOLUMEONE) - { - initprintf("*** You have run Duke Nukem 3D %d times. ***\n\n",ud.executions); - - if (ud.executions >= 50) - { - initprintf("IT IS NOW TIME TO UPGRADE TO THE COMPLETE VERSION!!!\n"); - -#ifdef WIN32 - Bsprintf(tempbuf, "You have run Duke Nukem 3D shareware %d times. It is now time to upgrade to the complete version!\n\n" - "Purchase Duke Nukem 3D for $5.99 now?\n", ud.executions); - - if (wm_ynbox("Upgrade to the full version of Duke Nukem 3D",tempbuf)) - { - SHELLEXECUTEINFOA sinfo; - char *p = "http://www.gog.com/en/gamecard/duke_nukem_3d_atomic_edition/pp/6c1e671f9af5b46d9c1a52067bdf0e53685674f7"; - - Bmemset(&sinfo, 0, sizeof(sinfo)); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SEE_MASK_CLASSNAME; - sinfo.lpVerb = "open"; - sinfo.lpFile = p; - sinfo.nShow = SW_SHOWNORMAL; - sinfo.lpClass = "http"; - - if (!ShellExecuteExA(&sinfo)) - G_GameExit("Error launching default system browser!"); - } -#endif - } - } - - for (i=0; i 1) - initprintf("Multiplayer initialized.\n"); - - { - char *cwd; - - if (g_modDir[0] != '/' && (cwd = (char *)getcwd(NULL, 0))) - { - chdir(g_modDir); -// initprintf("g_rootDir '%s'\nmod '%s'\ncwd '%s'\n",g_rootDir,mod_dir,cwd); - if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) - { - chdir(cwd); - if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) - G_GameExit("Failed loading art."); - } - chdir(cwd); - free(cwd); - } - else if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) - G_GameExit("Failed loading art."); - } - -// initprintf("Loading palette/lookups...\n"); - G_LoadExtraPalettes(); - - ReadSaveGameHeaders(); - - tilesizx[MIRROR] = tilesizy[MIRROR] = 0; - - screenpeek = myconnectindex; -} - -void G_UpdatePlayerFromMenu(void) -{ - if (ud.recstat != 0) - return; - - if (numplayers > 1) - { - Net_SendClientInfo(); - if (sprite[g_player[myconnectindex].ps->i].picnum == APLAYER && sprite[g_player[myconnectindex].ps->i].pal != 1) - sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].pcolor; - } - else - { - /*int32_t j = g_player[myconnectindex].ps->team;*/ - - g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; - g_player[myconnectindex].ps->auto_aim = ud.config.AutoAim; - g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch; - g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = ud.color; - - g_player[myconnectindex].pteam = ud.team; - - if (sprite[g_player[myconnectindex].ps->i].picnum == APLAYER && sprite[g_player[myconnectindex].ps->i].pal != 1) - sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].pcolor; - } -} - -void G_BackToMenu(void) -{ - boardfilename[0] = 0; - if (ud.recstat == 1) G_CloseDemoWrite(); - ud.warp_on = 0; - g_player[myconnectindex].ps->gm = MODE_MENU; - ChangeToMenu(0); - KB_FlushKeyboardQueue(); - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); -} - -int32_t G_EndOfLevel(void) -{ - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); - P_UpdateScreenPal(g_player[myconnectindex].ps); - - if (g_player[myconnectindex].ps->gm&MODE_EOL) - { - G_CloseDemoWrite(); - - ready2send = 0; - - if (ud.display_bonus_screen == 1) - { - int32_t i = ud.screen_size; - ud.screen_size = 0; - G_UpdateScreenArea(); - ud.screen_size = i; - G_BonusScreen(0); - } - if (ud.eog) - { - ud.eog = 0; - if ((!g_netServer && ud.multimode < 2)) - { - extern int32_t probey; - if (!VOLUMEALL) - G_DoOrderScreen(); - g_player[myconnectindex].ps->gm = MODE_MENU; - ChangeToMenu(0); - probey = 0; - return 2; - } - else - { - ud.m_level_number = 0; - ud.level_number = 0; - } - } - } - ud.display_bonus_screen = 1; - ready2send = 0; - if (numplayers > 1) g_player[myconnectindex].ps->gm = MODE_GAME; - if (G_EnterLevel(g_player[myconnectindex].ps->gm)) - { - G_BackToMenu(); - return 2; - } - Net_WaitForServer(); - return 1; - -} - -#ifdef RENDERTYPEWIN -void app_crashhandler(void) -{ - G_CloseDemoWrite(); - VM_ScriptInfo(); - G_GameQuit(); -} -#endif - -int32_t app_main(int32_t argc,const char **argv) -{ - int32_t i = 0, j; - char cwd[BMAX_PATH]; -// extern char datetimestring[]; -#ifdef NEDMALLOC - ENetCallbacks callbacks = { Bmalloc, Bfree, NULL }; -#else - ENetCallbacks callbacks = { NULL, NULL, NULL }; -#endif - -#ifdef RENDERTYPEWIN - if (argc > 1) - { - for (; inext; - addsearchpath(CommandPaths->str); - - Bfree(CommandPaths->str); - Bfree(CommandPaths); - CommandPaths = s; - } - } - -#if defined(_WIN32) - if (!access("user_profiles_enabled", F_OK)) -#else - if (usecwd == 0 && access("user_profiles_disabled", F_OK)) -#endif - { - char *homedir; - int32_t asperr; - - if ((homedir = Bgethomedir())) - { - Bsnprintf(cwd,sizeof(cwd),"%s/" -#if defined(_WIN32) - "EDuke32 Settings" -#elif defined(__APPLE__) - "Library/Application Support/EDuke32" -#else - ".eduke32" -#endif - ,homedir); - asperr = addsearchpath(cwd); - if (asperr == -2) - { - if (Bmkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd); - else asperr = -1; - } - if (asperr == 0) - chdir(cwd); - Bfree(homedir); - } - } - - // used with binds for fast function lookup - hash_init(&h_gamefuncs); - for (i=NUMGAMEFUNCTIONS-1; i>=0; i--) - { - char *str = Bstrtolower(Bstrdup(gamefunctions[i])); - hash_add(&h_gamefuncs,gamefunctions[i],i,0); - hash_add(&h_gamefuncs,str,i,0); - Bfree(str); - } - -#ifdef USE_OPENGL - glusetexcache = -1; -#endif - - i = CONFIG_ReadSetup(); - if (getenv("DUKE3DGRP")) g_grpNamePtr = getenv("DUKE3DGRP"); - -#ifdef _WIN32 - -// initprintf("build %d\n",(uint8_t)atoi(BUILDDATE)); - - if (ud.config.CheckForUpdates == 1) - { - if (time(NULL) - ud.config.LastUpdateCheck > UPDATEINTERVAL) - { - initprintf("Checking for updates...\n"); - if (G_GetVersionFromWebsite(tempbuf)) - { - initprintf("Current version is %d",atoi(tempbuf)); - ud.config.LastUpdateCheck = time(NULL); - - if (atoi(tempbuf) > atoi(s_buildDate)) - { - if (wm_ynbox("EDuke32","A new version of EDuke32 is available. " - "Browse to http://eduke32.sourceforge.net now?")) - { - SHELLEXECUTEINFOA sinfo; - char *p = "http://eduke32.sourceforge.net"; - - Bmemset(&sinfo, 0, sizeof(sinfo)); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SEE_MASK_CLASSNAME; - sinfo.lpVerb = "open"; - sinfo.lpFile = p; - sinfo.nShow = SW_SHOWNORMAL; - sinfo.lpClass = "http"; - - if (!ShellExecuteExA(&sinfo)) - initprintf("update: error launching browser!\n"); - } - } - else initprintf("... no updates available\n"); - } - else initprintf("update: failed to check for updates\n"); - } - } -#endif - -#ifdef USE_OPENGL - if (glusetexcache == -1) - { - ud.config.useprecache = glusetexcompr = 1; - glusetexcache = 2; - } -#endif - - if (preinitengine()) - { - wm_msgbox("Build Engine Initialization Error", - "There was a problem initializing the Build engine: %s", engineerrstr); - fprintf(stderr, "app_main: There was a problem initializing the Build engine: %s\n", engineerrstr); - exit(2); - } - - if (Bstrcmp(setupfilename, SETUPFILENAME)) - initprintf("Using config file '%s'.\n",setupfilename); - - ScanGroups(); - { - // try and identify the 'defaultduke3dgrp' in the set of GRPs. - // if it is found, set up the environment accordingly for the game it represents. - // if it is not found, choose the first GRP from the list - struct grpfile *fg, *first = NULL; - int32_t i; - for (fg = foundgrps; fg; fg=fg->next) - { - for (i = 0; icrcval == grpfiles[i].crcval) break; - if (i == numgrpfiles) continue; // unrecognised grp file - fg->game = grpfiles[i].game; - if (!first) first = fg; - if (!Bstrcasecmp(fg->name, defaultduke3dgrp)) - { - g_gameType = grpfiles[i].game; - g_gameNamePtr = (char *)grpfiles[i].name; - break; - } - } - if (!fg && first) - { - Bstrcpy(defaultduke3dgrp, first->name); - g_gameType = first->game; - g_gameNamePtr = (char *)grpfiles[0].name; - } - else if (!fg) g_gameNamePtr = "Unknown GRP"; - } - -#if (defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)) - if (i < 0 || (!g_noSetup && (ud.configversion != BYTEVERSION_JF || ud.config.ForceSetup)) || g_commandSetup) - { - if (quitevent || !startwin_run()) - { - uninitengine(); - exit(0); - } - } -#endif - - FreeGroups(); - - if (WW2GI || NAM) - { - // overwrite the default GRP and CON so that if the user chooses - // something different, they get what they asked for - Bsprintf(defaultduke3dgrp, WW2GI ? "ww2gi.grp" : "nam.grp"); - Bsprintf(defaultduke3ddef, WW2GI ? "ww2gi.def" : "nam.def"); - Bsprintf(defaultconfilename, WW2GI ? "ww2gi.con" : "nam.con"); - - Bsprintf(GametypeNames[0],"GRUNTMATCH (SPAWN)"); - Bsprintf(GametypeNames[2],"GRUNTMATCH (NO SPAWN)"); - } - - if (g_modDir[0] != '/') - { - char cwd[BMAX_PATH]; - - Bstrcat(g_rootDir,g_modDir); - addsearchpath(g_rootDir); -// addsearchpath(mod_dir); - - if (getcwd(cwd,BMAX_PATH)) - { - Bsprintf(cwd,"%s/%s",cwd,g_modDir); - if (!Bstrcmp(g_rootDir, cwd)) - { - if (addsearchpath(cwd) == -2) - if (Bmkdir(cwd,S_IRWXU) == 0) addsearchpath(cwd); - } - } - -#ifdef USE_OPENGL - Bsprintf(tempbuf,"%s/%s",g_modDir,TEXCACHEFILE); - Bstrcpy(TEXCACHEFILE,tempbuf); -#endif - } - - // shitcan the old cache directory -#if 0 && defined(USE_OPENGL) - { - struct stat st; - char dir[BMAX_PATH]; - - if (g_modDir[0] != '/') - Bsprintf(dir,"%s/",g_modDir); - else dir[0] = '\0'; - - Bsprintf(tempbuf,"%stexcache",dir); - if (Bstat(tempbuf, &st) >= 0) - { - if ((st.st_mode & S_IFDIR) == S_IFDIR) - { - Bsprintf(tempbuf,"EDuke32 has located an obsolete texture cache in the \"%stexcache\" directory.\n\n" - "Would you like EDuke32 to purge the contents of this directory?",dir); - - if (wm_ynbox("Obsolete Texture Cache Detected",tempbuf)) - { - int32_t recursion = 0; - - Bsprintf(tempbuf,"%stexcache",dir); - getfilenames(tempbuf,"*"); -CLEAN_DIRECTORY: - // initprintf("Cleaning '%s'\n",tempbuf); - while (findfiles) - { - Bsprintf(g_szBuf,"%s/%s",tempbuf,findfiles->name); - if (unlink(g_szBuf)) - initprintf("ERROR: couldn't remove '%s': %s\n",g_szBuf,strerror(errno)); - findfiles = findfiles->next; - } - while (finddirs) - { - if (!Bstrcmp(finddirs->name, ".") || !Bstrcmp(finddirs->name, "..")) - { - finddirs = finddirs->next; - continue; - } - Bsprintf(g_szBuf,"%s/%s",tempbuf,finddirs->name); - if (rmdir(g_szBuf)) - { - if (errno == EEXIST || errno == ENOTEMPTY) - { - recursion = 1; - Bstrcpy(tempbuf,g_szBuf); - getfilenames(tempbuf,"*"); - goto CLEAN_DIRECTORY; - } - else - { - initprintf("ERROR: couldn't remove '%s': %s\n",g_szBuf,strerror(errno)); - } - } - else - { - initprintf("Removed '%s'\n",g_szBuf); - finddirs = finddirs->next; - } - } - - if (recursion) - { - Bsprintf(tempbuf,"%stexcache",dir); - getfilenames(tempbuf,"*"); - recursion = 0; - goto CLEAN_DIRECTORY; - } - - Bsprintf(tempbuf,"%stexcache",dir); - if (rmdir(tempbuf)) - initprintf("ERROR: couldn't remove '%s': %s\n",tempbuf,strerror(errno)); - else initprintf("Removed '%s'\n",tempbuf); - } - } - } - } -#endif - - if ((i = initgroupfile(g_grpNamePtr)) == -1) - initprintf("Warning: could not find main data file '%s'!\n",g_grpNamePtr); - else - initprintf("Using '%s' as main game data file.\n", g_grpNamePtr); - - if (!g_noAutoLoad && !ud.config.NoAutoLoad) - { - int32_t ii; - - for (ii=0; iiname); - initprintf("Using file '%s' as game data.\n",tempbuf); - initgroupfile(tempbuf); - findfiles = findfiles->next; - } - } - - if (i != -1) - G_DoAutoload(g_grpNamePtr); - } - - if (g_modDir[0] != '/') - { - int32_t ii; - - for (ii=0; iiname); - initprintf("Using file '%s' as game data.\n",tempbuf); - initgroupfile(tempbuf); - findfiles = findfiles->next; - } - } - } - - flushlogwindow = 0; - loaddefinitions_game(g_defNamePtr, TRUE); -// flushlogwindow = 1; - - { - struct strllist *s; - - pathsearchmode = 1; - while (CommandGrps) - { - s = CommandGrps->next; - - if ((j = initgroupfile(CommandGrps->str)) == -1) - initprintf("Could not find file '%s'.\n",CommandGrps->str); - else - { - g_groupFileHandle = j; - initprintf("Using file '%s' as game data.\n",CommandGrps->str); - if (!g_noAutoLoad && !ud.config.NoAutoLoad) - G_DoAutoload(CommandGrps->str); - } - - Bfree(CommandGrps->str); - Bfree(CommandGrps); - CommandGrps = s; - } - pathsearchmode = 0; - } - - i = kopen4load("DUKESW.BIN",1); // JBF 20030810 - if (i!=-1) - { - g_Shareware = 1; - kclose(i); - } - - // gotta set the proper title after we compile the CONs if this is the full version - - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); - - if (g_scriptDebug) - initprintf("CON debugging activated (level %d).\n",g_scriptDebug); - - if (g_networkMode == NET_SERVER || g_networkMode == NET_DEDICATED_SERVER) - { - ENetAddress address = { ENET_HOST_ANY, g_netPort }; - g_netServer = enet_host_create(&address, MAXPLAYERS, CHAN_MAX, 0, 0); - - if (g_netServer == NULL) - initprintf("An error occurred while trying to create an ENet server host.\n"); - else initprintf("Multiplayer server initialized\n"); - } - - numplayers = 1; - connectpoint2[0] = -1; - - Net_GetPackets(); - - G_Startup(); // a bunch of stuff including compiling cons - - g_player[0].playerquitflag = 1; - - for (i=0; ipalette = BASEPAL; - - i = 1; - for (j=numplayers; jteam = g_player[j].pteam = i; - g_player[j].ps->weaponswitch = 3; - g_player[j].ps->auto_aim = 0; - i = 1-i; - } - - if (quitevent) return 4; - - if (!loaddefinitionsfile(g_defNamePtr)) - { - initprintf("Definitions file '%s' loaded.\n",g_defNamePtr); - loaddefinitions_game(g_defNamePtr, FALSE); - } - - if (numplayers == 1 && boardfilename[0] != 0) - { - ud.m_level_number = 7; - ud.m_volume_number = 0; - ud.warp_on = 1; - } - - // getnames(); - - if ((g_netServer || ud.multimode > 1)) - { - if (ud.warp_on == 0) - { - ud.m_monsters_off = 1; - ud.m_player_skill = 0; - } - } - - playerswhenstarted = ud.multimode; - ud.last_level = 0; - - if (!Bstrcasecmp(ud.rtsname,"DUKE.RTS") || - !Bstrcasecmp(ud.rtsname,"WW2GI.RTS") || - !Bstrcasecmp(ud.rtsname,"NAM.RTS")) - { - // ud.last_level is used as a flag here to reset the string to DUKE.RTS after load - if (WW2GI) - ud.last_level = (Bstrcpy(ud.rtsname, "WW2GI.RTS") == ud.rtsname); - else if (NAM) - ud.last_level = (Bstrcpy(ud.rtsname, "NAM.RTS") == ud.rtsname); - else - ud.last_level = (Bstrcpy(ud.rtsname, "DUKE.RTS") == ud.rtsname); - } - - RTS_Init(ud.rtsname); - - if (rts_numlumps) - initprintf("Using .RTS file '%s'\n",ud.rtsname); - - if (ud.last_level) - Bstrcpy(ud.rtsname, "DUKE.RTS"); - - ud.last_level = -1; - - initprintf("Initializing OSD...\n"); - - Bsprintf(tempbuf, HEAD2 " %s", s_buildRev); - OSD_SetVersion(tempbuf, 10,0); - registerosdcommands(); - - if (g_networkMode != NET_DEDICATED_SERVER) - { - if (CONTROL_Startup(1, &GetTime, TICRATE)) - { - fprintf(stderr, "There was an error initializing the CONTROL system.\n"); - uninitengine(); - exit(5); - } - - G_SetupGameButtons(); - CONFIG_SetupMouse(); - CONFIG_SetupJoystick(); - - CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent); - CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent); - - // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too - for (i=0; i 0) - initprintf("There was an error loading the sprite clipping map (status %d).\n", i); - - OSD_Exec("autoexec.cfg"); - - if (g_networkMode != NET_DEDICATED_SERVER) - { - if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0) - { - int32_t i = 0; - int32_t xres[] = {ud.config.ScreenWidth,800,640,320}; - int32_t yres[] = {ud.config.ScreenHeight,600,480,240}; - int32_t bpp[] = {32,16,8}; - - initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n", - ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.config.ScreenMode?"fullscreen":"windowed"); - -#ifdef USE_OPENGL - { - int32_t j = 0; - while (setgamemode(0,xres[i],yres[i],bpp[j]) < 0) - { - initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],bpp[i]); - - if (++j == 3) - { - if (++i == 4) - G_GameExit("Unable to set failsafe video mode!"); - j = 0; - } - } - } -#else - while (setgamemode(0,xres[i],yres[i],8) < 0) - { - initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],8); - i++; - } -#endif - ud.config.ScreenWidth = xres[i]; - ud.config.ScreenHeight = yres[i]; - ud.config.ScreenBPP = bpp[i]; - } - - setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); - - S_MusicStartup(); - S_SoundStartup(); - } -// loadtmb(); - - if (ud.warp_on > 1 && (!g_netServer && ud.multimode < 2)) - { - clearview(0L); - //g_player[myconnectindex].ps->palette = palette; - //G_FadePalette(0,0,0,0); - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); // JBF 20040308 - rotatesprite(320<<15,200<<15,65536L,0,LOADSCREEN,0,0,2+8+64+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - menutext(160,105,0,0,"LOADING SAVED GAME..."); - nextpage(); - - if (G_LoadPlayer(ud.warp_on-2)) - ud.warp_on = 0; - } - - FX_StopAllSounds(); - S_ClearSoundLocks(); - - // getpackets(); - -MAIN_LOOP_RESTART: - - if (g_networkMode != NET_DEDICATED_SERVER) - { - G_GetCrosshairColor(); - G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); - } - - if (ud.warp_on == 0) - { - if ((g_netServer || ud.multimode > 1) && boardfilename[0] != 0) - { - ud.m_level_number = 7; - ud.m_volume_number = 0; - - if (ud.m_player_skill == 4) - ud.m_respawn_monsters = 1; - else ud.m_respawn_monsters = 0; - - TRAVERSE_CONNECT(i) - { - P_ResetWeapons(i); - P_ResetInventory(i); - } - - G_NewGame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); - - if (G_EnterLevel(MODE_GAME)) G_BackToMenu(); - - Net_WaitForServer(); - } - else if (g_networkMode != NET_DEDICATED_SERVER) - G_DisplayLogo(); - - if (g_networkMode != NET_DEDICATED_SERVER) - { - if (G_PlaybackDemo()) - { - FX_StopAllSounds(); - S_ClearSoundLocks(); - g_noLogoAnim = 1; - goto MAIN_LOOP_RESTART; - } - } - } - else if (ud.warp_on == 1) - { - G_NewGame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); - - if (G_EnterLevel(MODE_GAME)) G_BackToMenu(); - } - else G_UpdateScreenArea(); - -// G_GameExit(" "); /// - -// ud.auto_run = ud.config.RunMode; - ud.showweapons = ud.config.ShowOpponentWeapons; - g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; - g_player[myconnectindex].ps->auto_aim = ud.config.AutoAim; - g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch; - g_player[myconnectindex].pteam = ud.team; - - if (GametypeFlags[ud.coop] & GAMETYPE_TDM) - g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_GetTeamPalette(g_player[myconnectindex].pteam); - else - { - if (ud.color) g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = ud.color; - else g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor; - } - - ud.warp_on = 0; - KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key - - do //main loop - { - static uint32_t nextrender = 0, framewaiting = 0; - uint32_t j; - - if (handleevents() && quitevent) - { - KB_KeyDown[sc_Escape] = 1; - quitevent = 0; - } - - sampletimer(); - Net_GetPackets(); - - // only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo - bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO); - -#ifndef _WIN32 - // stdin -> OSD input for dedicated server - if (g_networkMode == NET_DEDICATED_SERVER) - { - int32_t nb, flag = 1; - char ch; - static uint32_t bufpos = 0; - static char buf[128]; - - ioctl(0, FIONBIO, &flag); - - if ((nb = read(0, &ch, 1)) > 0 && bufpos < sizeof(buf)) - { - if (ch != '\n') - buf[bufpos++] = ch; - - if (ch == '\n' || bufpos >= sizeof(buf)) - { - buf[bufpos] = 0; - OSD_Dispatch(buf); - bufpos = 0; - } - } - } - else -#endif - { - MUSIC_Update(); - G_HandleLocalKeys(); - } - - OSD_DispatchQueued(); - - if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME) - { - if (g_networkMode != NET_DEDICATED_SERVER) - { - CONTROL_ProcessBinds(); - getinput(myconnectindex); - } - - avg.fvel += loc.fvel; - avg.svel += loc.svel; - avg.avel += loc.avel; - avg.horz += loc.horz; - avg.bits |= loc.bits; - avg.extbits |= loc.extbits; - - Bmemcpy(&inputfifo[0][myconnectindex], &avg, sizeof(input_t)); - Bmemset(&avg, 0, sizeof(input_t)); - - /* - if (ud.playerai && (g_netServer || ud.multimode > 1)) - { - TRAVERSE_CONNECT(i) - if (i != myconnectindex) - { - //clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t),0L); - computergetinput(i,&inputfifo[0][i]); - } - } - */ - - do - { - int32_t clockbeforetic; - - sampletimer(); - - if (ready2send == 0) break; - - ototalclock += TICSPERFRAME; - - clockbeforetic = totalclock; - - if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && - (g_player[myconnectindex].ps->gm&MODE_GAME)) - G_MoveLoop(); - - sampletimer(); - - if (totalclock - clockbeforetic >= TICSPERFRAME) - { - // computing a tic takes longer than a tic, so we're slowing - // the game down. rather than tightly spinning here, go draw - // a frame since we're fucked anyway - break; - } - } - while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME); - - } - - G_DoCheats(); - - if (g_player[myconnectindex].ps->gm & (MODE_EOL|MODE_RESTART)) - { - switch (G_EndOfLevel()) - { - case 1: continue; - case 2: goto MAIN_LOOP_RESTART; - } - } - else if (g_netClient && g_multiMapState) - { - for (i=g_gameVarCount-1; i>=0; i--) - { - if (aGameVars[i].dwFlags & GAMEVAR_USER_MASK) - g_multiMapState->vars[i] = NULL; - } - - G_RestoreMapState(g_multiMapState); - g_player[myconnectindex].ps->gm = MODE_GAME; - Bfree(g_multiMapState); - g_multiMapState = NULL; - } - - if (g_networkMode == NET_DEDICATED_SERVER) - { - idle(); - goto skipframe; - } - - if (framewaiting) - { - framewaiting--; - if (ud.statusbarmode == 1 && (ud.statusbarscale == 100 || !getrendermode())) - { - ud.statusbarmode = 0; - G_UpdateScreenArea(); - } - nextpage(); - } - - j = getticks(); - - if (r_maxfps == 0 || j >= nextrender) - { - if (j > nextrender+g_frameDelay) - nextrender = j; - - nextrender += g_frameDelay; - - if ((ud.show_help == 0 && (!g_netServer && ud.multimode < 2) && !(g_player[myconnectindex].ps->gm&MODE_MENU)) || - (g_netServer || ud.multimode > 1) || ud.recstat == 2) - i = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536); - else - i = 65536; - - G_DrawRooms(screenpeek,i); - G_DisplayRest(i); - if (getrendermode() >= 3) - G_DrawBackground(); - - framewaiting++; - } - -skipframe: - if (g_player[myconnectindex].ps->gm&MODE_DEMO) - goto MAIN_LOOP_RESTART; - } - while (1); - - G_GameExit(" "); - return 0; // not reached (duh) -} - -GAME_STATIC GAME_INLINE int32_t G_MoveLoop() -{ - Net_GetPackets(); - - return G_DoMoveThings(); -} - -int32_t G_DoMoveThings(void) -{ - int32_t i; - - ud.camerasprite = -1; - lockclock += TICSPERFRAME; - - //if (g_earthquakeTime > 0) g_earthquakeTime--; moved lower so it is restored correctly by diffs - if (g_RTSPlaying > 0) g_RTSPlaying--; - - for (i=0; i ud.msgdisptime) - user_quote_time[i] = ud.msgdisptime; - if (!user_quote_time[i]) pub = NUMPAGES; - } - - if (ud.idplayers && (g_netServer || ud.multimode > 1)) - { - hitdata_t hitinfo; - - for (i=0; iholoduke_on != -1) - sprite[g_player[i].ps->holoduke_on].cstat ^= 256; - - hitscan((vec3_t *)g_player[screenpeek].ps,g_player[screenpeek].ps->cursectnum, - sintable[(g_player[screenpeek].ps->ang+512)&2047], - sintable[g_player[screenpeek].ps->ang&2047], - (100-g_player[screenpeek].ps->horiz-g_player[screenpeek].ps->horizoff)<<11,&hitinfo,0xffff0030); - - for (i=0; iholoduke_on != -1) - sprite[g_player[i].ps->holoduke_on].cstat ^= 256; - - if ((hitinfo.hitsprite >= 0) && !(g_player[myconnectindex].ps->gm & MODE_MENU) && - sprite[hitinfo.hitsprite].picnum == APLAYER && sprite[hitinfo.hitsprite].yvel != screenpeek && - g_player[sprite[hitinfo.hitsprite].yvel].ps->dead_flag == 0) - { - if (g_player[screenpeek].ps->fta == 0 || g_player[screenpeek].ps->ftq == QUOTE_RESERVED3) - { - if (ldist(&sprite[g_player[screenpeek].ps->i],&sprite[hitinfo.hitsprite]) < 9216) - { - Bsprintf(ScriptQuotes[QUOTE_RESERVED3],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]); - g_player[screenpeek].ps->fta = 12, g_player[screenpeek].ps->ftq = QUOTE_RESERVED3; - } - } - else if (g_player[screenpeek].ps->fta > 2) g_player[screenpeek].ps->fta -= 3; - } - } - - if (g_showShareware > 0) - { - g_showShareware--; - if (g_showShareware == 0) - { - pus = NUMPAGES; - pub = NUMPAGES; - } - } - -// everyothertime++; moved lower so it is restored correctly by diffs - - if (g_netServer || g_netClient) - randomseed = ticrandomseed; - - TRAVERSE_CONNECT(i) - copybufbyte(&inputfifo[(g_netServer && myconnectindex == i) ? 1 : 0][i],g_player[i].sync,sizeof(input_t)); - - G_UpdateInterpolations(); - - /* - j = -1; - TRAVERSE_CONNECT(i) - { - if (g_player[i].playerquitflag == 0 || TEST_SYNC_KEY(g_player[i].sync->bits,SK_GAMEQUIT) == 0) - { - j = i; - continue; - } - - G_CloseDemoWrite(); - - g_player[i].playerquitflag = 0; - } - */ - - g_moveThingsCount++; - - if (ud.recstat == 1) G_DemoRecord(); - - everyothertime++; - if (g_earthquakeTime > 0) g_earthquakeTime--; - - if (ud.pause_on == 0) - { - g_globalRandom = krand(); - A_MoveDummyPlayers();//ST 13 - } - - TRAVERSE_CONNECT(i) - { - if (g_player[i].sync->extbits&(1<<6)) - { - g_player[i].ps->team = g_player[i].pteam; - if (GametypeFlags[ud.coop] & GAMETYPE_TDM) - { - actor[g_player[i].ps->i].picnum = APLAYERTOP; - P_QuickKill(g_player[i].ps); - } - } - if (GametypeFlags[ud.coop] & GAMETYPE_TDM) - g_player[i].ps->palookup = g_player[i].pcolor = G_GetTeamPalette(g_player[i].ps->team); - - if (sprite[g_player[i].ps->i].pal != 1) - sprite[g_player[i].ps->i].pal = g_player[i].pcolor; - - G_HandleSharedKeys(i); - - if (ud.pause_on == 0) - { - P_ProcessInput(i); - P_CheckSectors(i); - } - } - - if (ud.pause_on == 0) - G_MoveWorld(); - -// Net_CorrectPrediction(); - - if (g_netServer) - Net_UpdateClients(); - - if ((everyothertime&1) == 0) - { - G_AnimateWalls(); - A_MoveCyclers(); - - if (g_netServer) - Net_StreamLevel(); - } - - if (g_netClient) //Slave - Net_ClientMove(); - - return 0; -} - -static void G_DoOrderScreen(void) -{ - setview(0,0,xdim-1,ydim-1); - - fadepal(0,0,0, 0,63,7); - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 - KB_FlushKeyboardQueue(); - rotatesprite(0,0,65536L,0,ORDERING,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepal(0,0,0, 63,0,-7); - while (!KB_KeyWaiting()) - { - handleevents(); - Net_GetPackets(); - } - - fadepal(0,0,0, 0,63,7); - KB_FlushKeyboardQueue(); - rotatesprite(0,0,65536L,0,ORDERING+1,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepal(0,0,0, 63,0,-7); - while (!KB_KeyWaiting()) - { - handleevents(); - Net_GetPackets(); - } - - fadepal(0,0,0, 0,63,7); - KB_FlushKeyboardQueue(); - rotatesprite(0,0,65536L,0,ORDERING+2,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepal(0,0,0, 63,0,-7); - while (!KB_KeyWaiting()) - { - handleevents(); - Net_GetPackets(); - } - - fadepal(0,0,0, 0,63,7); - KB_FlushKeyboardQueue(); - rotatesprite(0,0,65536L,0,ORDERING+3,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepal(0,0,0, 63,0,-7); - while (!KB_KeyWaiting()) - { - handleevents(); - Net_GetPackets(); - } -} - -void G_BonusScreen(int32_t bonusonly) -{ - int32_t t, tinc,gfx_offset; - int32_t i, y,xfragtotal,yfragtotal; - int32_t bonuscnt; - int32_t clockpad = 2; - char *lastmapname; - int32_t playerbest = -1; - - int32_t breathe[] = - { - 0, 30,VICTORY1+1,176,59, - 30, 60,VICTORY1+2,176,59, - 60, 90,VICTORY1+1,176,59, - 90, 120,0 ,176,59 - }; - - int32_t bossmove[] = - { - 0, 120,VICTORY1+3,86,59, - 220, 260,VICTORY1+4,86,59, - 260, 290,VICTORY1+5,86,59, - 290, 320,VICTORY1+6,86,59, - 320, 350,VICTORY1+7,86,59, - 350, 380,VICTORY1+8,86,59 - }; - - if (g_networkMode == NET_DEDICATED_SERVER) - return; - - Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr); - wm_setapptitle(tempbuf); - - if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) - { - lastmapname = Bstrrchr(boardfilename,'\\'); - if (!lastmapname) lastmapname = Bstrrchr(boardfilename,'/'); - if (!lastmapname) lastmapname = boardfilename; - } - else - { - lastmapname = MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name; - if (!lastmapname) // this isn't right but it's better than no name at all - lastmapname = MapInfo[(ud.m_volume_number*MAXLEVELS)+ud.last_level-1].name; - } - - bonuscnt = 0; - - fadepal(0,0,0, 0,64,7); - setview(0,0,xdim-1,ydim-1); - clearview(0L); - nextpage(); - flushperms(); - - FX_StopAllSounds(); - S_ClearSoundLocks(); - FX_SetReverb(0L); - bindsenabled = 1; // so you can use your screenshot bind on the score screens - - if (bonusonly) goto FRAGBONUS; - - if (numplayers < 2 && ud.eog && ud.from_bonus == 0) - switch (ud.volume_number) - { - case 0: - if (ud.lockout == 0) - { - P_SetGamePalette(g_player[myconnectindex].ps, ENDINGPAL, 11); // JBF 20040308 - clearview(0L); - rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - nextpage(); - //g_player[myconnectindex].ps->palette = endingpal; - fadepal(0,0,0, 63,0,-1); - - KB_FlushKeyboardQueue(); - totalclock = 0; - tinc = 0; - while (1) - { - clearview(0L); - rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - - // boss - if (totalclock > 390 && totalclock < 780) - for (t=0; t<35; t+=5) if (bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1]) - { - if (t==10 && bonuscnt == 1) - { - S_PlaySound(SHOTGUN_FIRE); - S_PlaySound(SQUISHED); - bonuscnt++; - } - rotatesprite(bossmove[t+3]<<16,bossmove[t+4]<<16,65536L,0,bossmove[t+2],0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - } - - // Breathe - if (totalclock < 450 || totalclock >= 750) - { - if (totalclock >= 750) - { - rotatesprite(86<<16,59<<16,65536L,0,VICTORY1+8,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - if (totalclock >= 750 && bonuscnt == 2) - { - S_PlaySound(DUKETALKTOBOSS); - bonuscnt++; - } - - } - for (t=0; t<20; t+=5) - if (breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1]) - { - if (t==5 && bonuscnt == 0) - { - S_PlaySound(BOSSTALKTODUKE); - bonuscnt++; - } - rotatesprite(breathe[t+3]<<16,breathe[t+4]<<16,65536L,0,breathe[t+2],0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - } - } - handleevents(); - Net_GetPackets(); - nextpage(); - if (KB_KeyWaiting()) break; - } - } - - fadepal(0,0,0, 0,64,1); - - KB_FlushKeyboardQueue(); - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308 - - rotatesprite(0,0,65536L,0,3292,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepal(0,0,0, 63,0,-1); - while (!KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - handleevents(); - Net_GetPackets(); - } - fadepal(0,0,0, 0,64,1); - S_StopMusic(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - break; - case 1: - S_StopMusic(); - clearview(0L); - nextpage(); - - if (ud.lockout == 0) - { - G_PlayAnim("cineov2.anm",1); - KB_FlushKeyBoardQueue(); - clearview(0L); - nextpage(); - } - - S_PlaySound(PIPEBOMB_EXPLODE); - - fadepal(0,0,0, 0,64,1); - setview(0,0,xdim-1,ydim-1); - KB_FlushKeyboardQueue(); - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308 - rotatesprite(0,0,65536L,0,3293,0,0,2+8+16+64+(ud.bgstretch?1024:0), 0,0,xdim-1,ydim-1); - fadepal(0,0,0, 63,0,-1); - while (!KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - handleevents(); - Net_GetPackets(); - } - fadepal(0,0,0, 0,64,1); - - break; - - case 3: - - setview(0,0,xdim-1,ydim-1); - - S_StopMusic(); - clearview(0L); - nextpage(); - - if (ud.lockout == 0) - { - KB_FlushKeyboardQueue(); - G_PlayAnim("vol4e1.anm",8); - clearview(0L); - nextpage(); - G_PlayAnim("vol4e2.anm",10); - clearview(0L); - nextpage(); - G_PlayAnim("vol4e3.anm",11); - clearview(0L); - nextpage(); - } - - FX_StopAllSounds(); - S_ClearSoundLocks(); - S_PlaySound(ENDSEQVOL3SND4); - KB_FlushKeyBoardQueue(); - - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308 - G_FadePalette(0,0,0,63); - clearview(0L); - menutext(160,60,0,0,"THANKS TO ALL OUR"); - menutext(160,60+16,0,0,"FANS FOR GIVING"); - menutext(160,60+16+16,0,0,"US BIG HEADS."); - menutext(160,70+16+16+16,0,0,"LOOK FOR A DUKE NUKEM 3D"); - menutext(160,70+16+16+16+16,0,0,"SEQUEL SOON."); - nextpage(); - - fadepal(0,0,0, 63,0,-3); - KB_FlushKeyboardQueue(); - while (!KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - handleevents(); - Net_GetPackets(); - } - fadepal(0,0,0, 0,64,3); - - clearview(0L); - nextpage(); - MOUSE_ClearButton(LEFT_MOUSE); - - G_PlayAnim("DUKETEAM.ANM",4); - - KB_FlushKeyBoardQueue(); - while (!KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - handleevents(); - Net_GetPackets(); - } - - clearview(0L); - nextpage(); - G_FadePalette(0,0,0,63); - - FX_StopAllSounds(); - S_ClearSoundLocks(); - KB_FlushKeyBoardQueue(); - MOUSE_ClearButton(LEFT_MOUSE); - - break; - - case 2: - - S_StopMusic(); - clearview(0L); - nextpage(); - if (ud.lockout == 0) - { - fadepal(0,0,0, 63,0,-1); - G_PlayAnim("cineov3.anm",2); - KB_FlushKeyBoardQueue(); - ototalclock = totalclock+200; - while (totalclock < ototalclock) - { - handleevents(); - Net_GetPackets(); - } - clearview(0L); - nextpage(); - - FX_StopAllSounds(); - S_ClearSoundLocks(); - } - - G_PlayAnim("RADLOGO.ANM",3); - - if (ud.lockout == 0 && !KB_KeyWaiting() && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - S_PlaySound(ENDSEQVOL3SND5); - while (S_CheckSoundPlaying(-1,ENDSEQVOL3SND5)) - { - handleevents(); - Net_GetPackets(); - } - if (KB_KeyWaiting() || MOUSE_GetButtons()&LEFT_MOUSE || BUTTON(gamefunc_Fire) || BUTTON(gamefunc_Open)) goto ENDANM; - S_PlaySound(ENDSEQVOL3SND6); - while (S_CheckSoundPlaying(-1,ENDSEQVOL3SND6)) - { - handleevents(); - Net_GetPackets(); - } - if (KB_KeyWaiting() || MOUSE_GetButtons()&LEFT_MOUSE || BUTTON(gamefunc_Fire) || BUTTON(gamefunc_Open)) goto ENDANM; - S_PlaySound(ENDSEQVOL3SND7); - while (S_CheckSoundPlaying(-1,ENDSEQVOL3SND7)) - { - handleevents(); - Net_GetPackets(); - } - if (KB_KeyWaiting() || MOUSE_GetButtons()&LEFT_MOUSE || BUTTON(gamefunc_Fire) || BUTTON(gamefunc_Open)) goto ENDANM; - S_PlaySound(ENDSEQVOL3SND8); - while (S_CheckSoundPlaying(-1,ENDSEQVOL3SND8)) - { - handleevents(); - Net_GetPackets(); - } - if (KB_KeyWaiting() || MOUSE_GetButtons()&LEFT_MOUSE || BUTTON(gamefunc_Fire) || BUTTON(gamefunc_Open)) goto ENDANM; - S_PlaySound(ENDSEQVOL3SND9); - while (S_CheckSoundPlaying(-1,ENDSEQVOL3SND9)) - { - handleevents(); - Net_GetPackets(); - } - - } - MOUSE_ClearButton(LEFT_MOUSE); - KB_FlushKeyBoardQueue(); - totalclock = 0; - while (!KB_KeyWaiting() && totalclock < 120 && !MOUSE_GetButtons()&LEFT_MOUSE && !BUTTON(gamefunc_Fire) && !BUTTON(gamefunc_Open)) - { - handleevents(); - Net_GetPackets(); - } - -ENDANM: - MOUSE_ClearButton(LEFT_MOUSE); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - KB_FlushKeyBoardQueue(); - - clearview(0L); - - break; - } - -FRAGBONUS: - - //g_player[myconnectindex].ps->palette = palette; - P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 11); // JBF 20040308 - G_FadePalette(0,0,0,63); // JBF 20031228 - KB_FlushKeyboardQueue(); - totalclock = 0; - tinc = 0; - bonuscnt = 0; - - S_StopMusic(); - FX_StopAllSounds(); - S_ClearSoundLocks(); - - if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET)) - { - if (!(ud.config.MusicToggle == 0 || ud.config.MusicDevice < 0)) - S_PlaySound(BONUSMUSIC); - - rotatesprite(0,0,65536L,0,MENUSCREEN,16,0,2+8+16+64+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - rotatesprite(160<<16,34<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1); - if (PLUTOPAK) // JBF 20030804 - rotatesprite((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8,0,0,xdim-1,ydim-1); - gametext(160,58+2,"MULTIPLAYER TOTALS",0,2+8+16); - gametext(160,58+10,MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name,0,2+8+16); - - gametext(160,165,"PRESS ANY KEY OR BUTTON TO CONTINUE",quotepulseshade,2+8+16); - - t = 0; - minitext(23,80," NAME KILLS",8,2+8+16+128); - for (i=0; ipalookup,2+8+16+128); - - for (y=0; yfraggedself); - minitext(92+(y*23),90+t,tempbuf,2,2+8+16+128); - xfragtotal -= g_player[y].ps->fraggedself; - } - else - { - Bsprintf(tempbuf,"%-4d",g_player[i].frags[y]); - minitext(92+(y*23),90+t,tempbuf,0,2+8+16+128); - xfragtotal += g_player[i].frags[y]; - } - } - - Bsprintf(tempbuf,"%-4d",xfragtotal); - minitext(101+(8*23),90+t,tempbuf,2,2+8+16+128); - - t += 7; - } - - for (y=0; yfraggedself; - yfragtotal += g_player[i].frags[y]; - } - Bsprintf(tempbuf,"%-4d",yfragtotal); - minitext(92+(y*23),96+(8*7),tempbuf,2,2+8+16+128); - } - - minitext(45,96+(8*7),"DEATHS",8,2+8+16+128); - nextpage(); - - fadepal(0,0,0, 63,0,-7); - - KB_FlushKeyboardQueue(); - - { - int32_t tc = totalclock; - while (KB_KeyWaiting()==0) - { - // continue after 10 seconds... - if (totalclock > tc + (120*10)) break; - handleevents(); - Net_GetPackets(); - } - } - - if (bonusonly || (g_netServer || ud.multimode > 1)) return; - - fadepal(0,0,0, 0,64,7); - } - - if (bonusonly || (g_netServer || ud.multimode > 1)) return; - - switch (ud.volume_number) - { - case 1: - gfx_offset = 5; - break; - default: - gfx_offset = 0; - break; - } - - rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - - if (lastmapname) - menutext(160,20-6,0,0,lastmapname); - menutext(160,36-6,0,0,"COMPLETED"); - - gametext(160,192,"PRESS ANY KEY OR BUTTON TO CONTINUE",quotepulseshade,2+8+16); - - if (!(ud.config.MusicToggle == 0 || ud.config.MusicDevice < 0)) - S_PlaySound(BONUSMUSIC); - - nextpage(); - KB_FlushKeyboardQueue(); - fadepal(0,0,0, 63,0,-1); - bonuscnt = 0; - totalclock = 0; - tinc = 0; - - playerbest = CONFIG_GetMapBestTime(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].filename); - - if (g_player[myconnectindex].ps->player_par < playerbest || playerbest < 0) - CONFIG_SetMapBestTime(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].filename, g_player[myconnectindex].ps->player_par); - - { - int32_t ii, ij; - - for (ii=g_player[myconnectindex].ps->player_par/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ; - clockpad = max(clockpad,ij); - if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) - { - for (ii=MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ; - clockpad = max(clockpad,ij); - if (!NAM) - { - for (ii=MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ; - clockpad = max(clockpad,ij); - } - } - if (playerbest > 0) for (ii=playerbest/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ; - clockpad = max(clockpad,ij); - } - - do - { - int32_t yy = 0, zz; - - Net_GetPackets(); - handleevents(); - MUSIC_Update(); - - if (g_player[myconnectindex].ps->gm&MODE_EOL) - { - rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - - if (totalclock > (1000000000L) && totalclock < (1000000320L)) - { - switch ((totalclock>>4)%15) - { - case 0: - if (bonuscnt == 6) - { - bonuscnt++; - S_PlaySound(SHOTGUN_COCK); - switch (rand()&3) - { - case 0: - S_PlaySound(BONUS_SPEECH1); - break; - case 1: - S_PlaySound(BONUS_SPEECH2); - break; - case 2: - S_PlaySound(BONUS_SPEECH3); - break; - case 3: - S_PlaySound(BONUS_SPEECH4); - break; - } - } - case 1: - case 4: - case 5: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+3+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - break; - case 2: - case 3: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+4+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - break; - } - } - else if (totalclock > (10240+120L)) break; - else - { - switch ((totalclock>>5)&3) - { - case 1: - case 3: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+1+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - break; - case 2: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+2+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0),0,0,xdim-1,ydim-1); - break; - } - } - - if (lastmapname) - menutext(160,20-6,0,0,lastmapname); - menutext(160,36-6,0,0,"COMPLETED"); - - gametext(160,192,"PRESS ANY KEY OR BUTTON TO CONTINUE",quotepulseshade,2+8+16); - - if (totalclock > (60*3)) - { - yy = zz = 59; - gametext(10,yy+9,"Your Time:",0,2+8+16); - yy+=10; - if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) - { - gametext(10,yy+9,"Par Time:",0,2+8+16); - yy+=10; - if (!NAM) - { - gametext(10,yy+9,"3D Realms' Time:",0,2+8+16); - yy+=10; - } - - } - if (playerbest > 0) - { - gametext(10,yy+9,g_player[myconnectindex].ps->player_par (60*4)) - { - if (bonuscnt == 1) - { - bonuscnt++; - S_PlaySound(PIPEBOMB_EXPLODE); - } - - Bsprintf(tempbuf,"%0*d:%02d.%02d",clockpad, - (g_player[myconnectindex].ps->player_par/(REALGAMETICSPERSEC*60)), - (g_player[myconnectindex].ps->player_par/REALGAMETICSPERSEC)%60, - ((g_player[myconnectindex].ps->player_par%REALGAMETICSPERSEC)*33)/10 - ); - gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); - if (g_player[myconnectindex].ps->player_par < playerbest) - gametext((320>>2)+89+(clockpad*24),yy+9,"New record!",0,2+8+16); - yy+=10; - - if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) - { - Bsprintf(tempbuf,"%0*d:%02d",clockpad, - (MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/(REALGAMETICSPERSEC*60)), - (MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/REALGAMETICSPERSEC)%60); - gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); - yy+=10; - - if (!NAM) - { - Bsprintf(tempbuf,"%0*d:%02d",clockpad, - (MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/(REALGAMETICSPERSEC*60)), - (MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/REALGAMETICSPERSEC)%60); - gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); - yy+=10; - } - } - - if (playerbest > 0) - { - Bsprintf(tempbuf,"%0*d:%02d.%02d",clockpad, - (playerbest/(REALGAMETICSPERSEC*60)), - (playerbest/REALGAMETICSPERSEC)%60, - ((playerbest%REALGAMETICSPERSEC)*33)/10 - ); - gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); - yy+=10; - } - } - } - - zz = yy += 5; - if (totalclock > (60*6)) - { - gametext(10,yy+9,"Enemies Killed:",0,2+8+16); - yy += 10; - gametext(10,yy+9,"Enemies Left:",0,2+8+16); - yy += 10; - - if (bonuscnt == 2) - { - bonuscnt++; - S_PlaySound(FLY_BY); - } - - yy = zz; - - if (totalclock > (60*7)) - { - if (bonuscnt == 3) - { - bonuscnt++; - S_PlaySound(PIPEBOMB_EXPLODE); - } - Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->actors_killed); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); - yy += 10; - if (ud.player_skill > 3) - { - Bsprintf(tempbuf,"N/A"); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); - yy += 10; - } - else - { - if ((g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed) < 0) - Bsprintf(tempbuf,"%-3d",0); - else Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); - yy += 10; - } - } - } - - zz = yy += 5; - if (totalclock > (60*9)) - { - gametext(10,yy+9,"Secrets Found:",0,2+8+16); - yy += 10; - gametext(10,yy+9,"Secrets Missed:",0,2+8+16); - yy += 10; - if (bonuscnt == 4) bonuscnt++; - - yy = zz; - if (totalclock > (60*10)) - { - if (bonuscnt == 5) - { - bonuscnt++; - S_PlaySound(PIPEBOMB_EXPLODE); - } - Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->secret_rooms); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); - yy += 10; - if (g_player[myconnectindex].ps->secret_rooms > 0) - Bsprintf(tempbuf,"%-3d%%",(100*g_player[myconnectindex].ps->secret_rooms/g_player[myconnectindex].ps->max_secret_rooms)); - Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); - yy += 10; - } - } - - if (totalclock > 10240 && totalclock < 10240+10240) - totalclock = 1024; - - if (((MOUSE_GetButtons()&7) || KB_KeyWaiting() || BUTTON(gamefunc_Fire) || BUTTON(gamefunc_Open)) && totalclock > (60*2)) // JBF 20030809 - { - MOUSE_ClearButton(7); - if (totalclock < (60*13)) - { - KB_FlushKeyboardQueue(); - totalclock = (60*13); - } - else if (totalclock < (1000000000L)) - totalclock = (1000000000L); - } - } - else - break; - - VM_OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); - nextpage(); - } - while (1); -} - -static void G_DrawCameraText(int16_t i) -{ - char flipbits; - int32_t x , y; - - if (!T1) - { - rotatesprite(24<<16,33<<16,65536L,0,CAMCORNER,0,0,2,windowx1,windowy1,windowx2,windowy2); - rotatesprite((320-26)<<16,34<<16,65536L,0,CAMCORNER+1,0,0,2,windowx1,windowy1,windowx2,windowy2); - rotatesprite(22<<16,163<<16,65536L,512,CAMCORNER+1,0,0,2+4,windowx1,windowy1,windowx2,windowy2); - rotatesprite((310-10)<<16,163<<16,65536L,512,CAMCORNER+1,0,0,2,windowx1,windowy1,windowx2,windowy2); - if (totalclock&16) - rotatesprite(46<<16,32<<16,65536L,0,CAMLIGHT,0,0,2,windowx1,windowy1,windowx2,windowy2); - } - else - { - flipbits = (totalclock<<1)&48; - for (x=0; x<394; x+=64) - for (y=0; y<200; y+=64) - rotatesprite(x<<16,y<<16,65536L,0,STATIC,0,0,2+flipbits,windowx1,windowy1,windowx2,windowy2); - } -} - -#if 0 -void vglass(int32_t x,int32_t y,short a,short wn,short n) -{ - int32_t z, zincs; - short sect; - - sect = wall[wn].nextsector; - if (sect == -1) return; - zincs = (sector[sect].floorz-sector[sect].ceilingz) / n; - - for (z = sector[sect].ceilingz; z < sector[sect].floorz; z += zincs) - A_InsertSprite(sect,x,y,z-(krand()&8191),GLASSPIECES+(z&(krand()%3)),-32,36,36,a+128-(krand()&255),16+(krand()&31),0,-1,5); -} -#endif - -void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n) -{ - int32_t j, xv, yv, z, x1, y1; - int16_t sect; - int32_t a; - - sect = -1; - - if (wallnum < 0) - { - for (j=n-1; j >= 0 ; j--) - { - a = SA-256+(krand()&511)+1024; - A_InsertSprite(SECT,SX,SY,SZ,GLASSPIECES+(j%3),-32,36,36,a,32+(krand()&63),1024-(krand()&1023),i,5); - } - return; - } - - j = n+1; - - x1 = wall[wallnum].x; - y1 = wall[wallnum].y; - - xv = wall[wall[wallnum].point2].x-x1; - yv = wall[wall[wallnum].point2].y-y1; - - x1 -= ksgn(yv); - y1 += ksgn(xv); - - xv /= j; - yv /= j; - - for (j=n; j>0; j--) - { - x1 += xv; - y1 += yv; - - updatesector(x1,y1,§); - if (sect >= 0) - { - z = sector[sect].floorz-(krand()&(klabs(sector[sect].ceilingz-sector[sect].floorz))); - if (z < -(32<<8) || z > (32<<8)) - z = SZ-(32<<8)+(krand()&((64<<8)-1)); - a = SA-1024; - A_InsertSprite(SECT,x1,y1,z,GLASSPIECES+(j%3),-32,36,36,a,32+(krand()&63),-(krand()&1023),i,5); - } - } -} - -void A_SpawnGlass(int32_t i,int32_t n) -{ - for (; n>0; n--) - { - int32_t k = A_InsertSprite(SECT,SX,SY,SZ-((krand()&16)<<8),GLASSPIECES+(n%3), - krand()&15,36,36,krand()&2047,32+(krand()&63),-512-(krand()&2047),i,5); - sprite[k].pal = sprite[i].pal; - } -} - -void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n) -{ - int32_t j, xv, yv, z, x1, y1, a,s; - int32_t startwall = sector[sectnum].wallptr; - int32_t endwall = startwall+sector[sectnum].wallnum; - - for (s=startwall; s<(endwall-1); s++) - { - x1 = wall[s].x; - y1 = wall[s].y; - - xv = (wall[s+1].x-x1)/(n+1); - yv = (wall[s+1].y-y1)/(n+1); - - for (j=n; j>0; j--) - { - x1 += xv; - y1 += yv; - a = krand()&2047; - z = sector[sectnum].ceilingz+((krand()&15)<<8); - A_InsertSprite(sectnum,x1,y1,z,GLASSPIECES+(j%3),-32,36,36,a,(krand()&31),0,i,5); - } - } -} - -void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n) -{ - int32_t j, xv, yv, z, x1, y1; - int16_t sect = -1; - int32_t a, k; - - if (wallnum < 0) - { - for (j=n-1; j >= 0 ; j--) - { - a = krand()&2047; - k = A_InsertSprite(SECT,SX,SY,SZ-(krand()&(63<<8)),GLASSPIECES+(j%3),-32,36,36,a,32+(krand()&63),1024-(krand()&2047),i,5); - sprite[k].pal = krand()&15; - } - return; - } - - j = n+1; - x1 = wall[wallnum].x; - y1 = wall[wallnum].y; - - xv = (wall[wall[wallnum].point2].x-wall[wallnum].x)/j; - yv = (wall[wall[wallnum].point2].y-wall[wallnum].y)/j; - - for (j=n; j>0; j--) - { - x1 += xv; - y1 += yv; - - updatesector(x1,y1,§); - z = sector[sect].floorz-(krand()&(klabs(sector[sect].ceilingz-sector[sect].floorz))); - if (z < -(32<<8) || z > (32<<8)) - z = SZ-(32<<8)+(krand()&((64<<8)-1)); - a = SA-1024; - k = A_InsertSprite(SECT,x1,y1,z,GLASSPIECES+(j%3),-32,36,36,a,32+(krand()&63),-(krand()&2047),i,5); - sprite[k].pal = krand()&7; - } -} - -static void G_SetupGameButtons(void) -{ - CONTROL_DefineFlag(gamefunc_Move_Forward,FALSE); - CONTROL_DefineFlag(gamefunc_Move_Backward,FALSE); - CONTROL_DefineFlag(gamefunc_Turn_Left,FALSE); - CONTROL_DefineFlag(gamefunc_Turn_Right,FALSE); - CONTROL_DefineFlag(gamefunc_Strafe,FALSE); - CONTROL_DefineFlag(gamefunc_Fire,FALSE); - CONTROL_DefineFlag(gamefunc_Open,FALSE); - CONTROL_DefineFlag(gamefunc_Run,FALSE); - CONTROL_DefineFlag(gamefunc_AutoRun,FALSE); - CONTROL_DefineFlag(gamefunc_Jump,FALSE); - CONTROL_DefineFlag(gamefunc_Crouch,FALSE); - CONTROL_DefineFlag(gamefunc_Look_Up,FALSE); - CONTROL_DefineFlag(gamefunc_Look_Down,FALSE); - CONTROL_DefineFlag(gamefunc_Look_Left,FALSE); - CONTROL_DefineFlag(gamefunc_Look_Right,FALSE); - CONTROL_DefineFlag(gamefunc_Strafe_Left,FALSE); - CONTROL_DefineFlag(gamefunc_Strafe_Right,FALSE); - CONTROL_DefineFlag(gamefunc_Aim_Up,FALSE); - CONTROL_DefineFlag(gamefunc_Aim_Down,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_1,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_2,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_3,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_4,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_5,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_6,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_7,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_8,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_9,FALSE); - CONTROL_DefineFlag(gamefunc_Weapon_10,FALSE); - CONTROL_DefineFlag(gamefunc_Inventory,FALSE); - CONTROL_DefineFlag(gamefunc_Inventory_Left,FALSE); - CONTROL_DefineFlag(gamefunc_Inventory_Right,FALSE); - CONTROL_DefineFlag(gamefunc_Holo_Duke,FALSE); - CONTROL_DefineFlag(gamefunc_Jetpack,FALSE); - CONTROL_DefineFlag(gamefunc_NightVision,FALSE); - CONTROL_DefineFlag(gamefunc_MedKit,FALSE); - CONTROL_DefineFlag(gamefunc_TurnAround,FALSE); - CONTROL_DefineFlag(gamefunc_SendMessage,FALSE); - CONTROL_DefineFlag(gamefunc_Map,FALSE); - CONTROL_DefineFlag(gamefunc_Shrink_Screen,FALSE); - CONTROL_DefineFlag(gamefunc_Enlarge_Screen,FALSE); - CONTROL_DefineFlag(gamefunc_Center_View,FALSE); - CONTROL_DefineFlag(gamefunc_Holster_Weapon,FALSE); - CONTROL_DefineFlag(gamefunc_Show_Opponents_Weapon,FALSE); - CONTROL_DefineFlag(gamefunc_Map_Follow_Mode,FALSE); - CONTROL_DefineFlag(gamefunc_See_Coop_View,FALSE); - CONTROL_DefineFlag(gamefunc_Mouse_Aiming,FALSE); - CONTROL_DefineFlag(gamefunc_Toggle_Crosshair,FALSE); - CONTROL_DefineFlag(gamefunc_Steroids,FALSE); - CONTROL_DefineFlag(gamefunc_Quick_Kick,FALSE); - CONTROL_DefineFlag(gamefunc_Next_Weapon,FALSE); - CONTROL_DefineFlag(gamefunc_Previous_Weapon,FALSE); -} - -int32_t GetTime(void) -{ - return totalclock; -} diff --git a/polymer-perf/eduke32/source/game.h b/polymer-perf/eduke32/source/game.h deleted file mode 100644 index 7875aef06..000000000 --- a/polymer-perf/eduke32/source/game.h +++ /dev/null @@ -1,338 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __game_h__ -#define __game_h__ - -#define USERQUOTE_LEFTOFFSET 5 -#define USERQUOTE_RIGHTOFFSET 14 - -#define MAXCHEATLEN 20 -#define NUMCHEATCODES (int32_t)(sizeof(CheatStrings)/sizeof(CheatStrings[0])) - -enum GametypeFlags_t { - GAMETYPE_COOP = 0x00000001, - GAMETYPE_WEAPSTAY = 0x00000002, - GAMETYPE_FRAGBAR = 0x00000004, - GAMETYPE_SCORESHEET = 0x00000008, - GAMETYPE_DMSWITCHES = 0x00000010, - GAMETYPE_COOPSPAWN = 0x00000020, - GAMETYPE_ACCESSCARDSPRITES = 0x00000040, - GAMETYPE_COOPVIEW = 0x00000080, - GAMETYPE_COOPSOUND = 0x00000100, - GAMETYPE_OTHERPLAYERSINMAP = 0x00000200, - GAMETYPE_ITEMRESPAWN = 0x00000400, - GAMETYPE_MARKEROPTION = 0x00000800, - GAMETYPE_PLAYERSFRIENDLY = 0x00001000, - GAMETYPE_FIXEDRESPAWN = 0x00002000, - GAMETYPE_ACCESSATSTART = 0x00004000, - GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000, - GAMETYPE_TDM = 0x00010000, - GAMETYPE_TDMSPAWN = 0x00020000 -}; - -// logo control -enum LogoFlags_t { - LOGO_ENABLED = 0x00000001, - LOGO_PLAYANIM = 0x00000002, - LOGO_PLAYMUSIC = 0x00000004, - LOGO_3DRSCREEN = 0x00000008, - LOGO_TITLESCREEN = 0x00000010, - LOGO_DUKENUKEM = 0x00000020, - LOGO_THREEDEE = 0x00000040, - LOGO_PLUTOPAKSPRITE = 0x00000080, - LOGO_SHAREWARESCREENS = 0x00000100, - LOGO_TENSCREEN = 0x00000200 -}; - -typedef enum basepal_ { - BASEPAL = 0, - WATERPAL, - SLIMEPAL, - DREALMSPAL, - TITLEPAL, - ENDINGPAL, - ANIMPAL, - BASEPALCOUNT -} basepal_t; - -#define deletesprite A_DeleteSprite -void A_DeleteSprite(int32_t s); - -typedef struct { - vec3_t camera; - int32_t const_visibility,uw_framerate; - int32_t camera_time,folfvel,folavel,folx,foly,fola; - int32_t reccnt,crosshairscale; - - int32_t runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125 - int32_t democams,color,msgdisptime,statusbarmode; - int32_t m_noexits,noexits,autovote,automsg,idplayers; - int32_t team, viewbob, weaponsway, althud, weaponscale, textscale; - - int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run; - int32_t coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair; - int32_t playerai,angleinterpolation,obituaries; - - int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness; - int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail; - int32_t m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode; - int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip; - - int32_t configversion; - - int16_t cameraang, camerasect, camerahoriz; - int16_t pause_on,from_bonus; - int16_t camerasprite,last_camsprite; - int16_t last_level,secretlevel, bgstretch; - - struct { - int32_t UseJoystick; - int32_t UseMouse; - int32_t AutoAim; - int32_t ShowOpponentWeapons; - int32_t MouseDeadZone,MouseBias; - int32_t SmoothInput; - - // JBF 20031211: Store the input settings because - // (currently) jmact can't regurgitate them - int32_t MouseFunctions[MAXMOUSEBUTTONS][2]; - int32_t MouseDigitalFunctions[MAXMOUSEAXES][2]; - int32_t MouseAnalogueAxes[MAXMOUSEAXES]; - int32_t MouseAnalogueScale[MAXMOUSEAXES]; - int32_t JoystickFunctions[MAXJOYBUTTONS][2]; - int32_t JoystickDigitalFunctions[MAXJOYAXES][2]; - int32_t JoystickAnalogueAxes[MAXJOYAXES]; - int32_t JoystickAnalogueScale[MAXJOYAXES]; - int32_t JoystickAnalogueDead[MAXJOYAXES]; - int32_t JoystickAnalogueSaturate[MAXJOYAXES]; - uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2]; - - // - // Sound variables - // - int32_t FXDevice; - int32_t MusicDevice; - int32_t FXVolume; - int32_t MusicVolume; - int32_t SoundToggle; - int32_t MusicToggle; - int32_t VoiceToggle; - int32_t AmbienceToggle; - - int32_t NumVoices; - int32_t NumChannels; - int32_t NumBits; - int32_t MixRate; - - int32_t ReverseStereo; - - // - // Screen variables - // - - int32_t ScreenMode; - - int32_t ScreenWidth; - int32_t ScreenHeight; - int32_t ScreenBPP; - - int32_t ForceSetup; - int32_t NoAutoLoad; - - int32_t scripthandle; - int32_t setupread; - - int32_t CheckForUpdates; - int32_t LastUpdateCheck; - int32_t useprecache; - } config; - - char overhead_on,last_overhead,showweapons; - char god,warp_on,cashman,eog,showallmap; - char show_help,scrollmode,clipping; - char ridecule[10][40]; - char savegame[10][22]; - char pwlockout[128],rtsname[128]; - char display_bonus_screen; - char show_level_text; -} user_defs; - - -extern cactype cac[]; - -// this is checked against http://eduke32.com/VERSION -extern const char *s_buildDate; -extern char *g_defNamePtr; -extern char *g_gameNamePtr; -extern char *g_gameNamePtr; -extern char *g_grpNamePtr; -extern char *g_grpNamePtr; -extern char *g_scriptNamePtr; -extern char CheatStrings[][MAXCHEATLEN]; -extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH]; -extern char boardfilename[BMAX_PATH]; -extern char defaultduke3dgrp[BMAX_PATH]; -extern char g_modDir[BMAX_PATH]; -extern char g_modDir[BMAX_PATH]; -extern char inputloc; -extern char ror_protectedsectors[MAXSECTORS]; - -extern float r_ambientlight; - -extern int32_t althud_flashing; -extern int32_t althud_numberpal; -extern int32_t althud_numbertile; -extern int32_t althud_shadows; -extern int32_t cacnum; -extern int32_t drawing_ror; -extern int32_t g_Shareware; -extern int32_t g_cameraClock; -extern int32_t g_cameraDistance; -extern int32_t g_cameraDistance; -extern int32_t g_crosshairSum; -extern int32_t g_doQuickSave; -extern int32_t g_forceWeaponChoice; -extern int32_t g_gameType; -extern int32_t g_levelTextTime; -extern int32_t g_noSetup; -extern int32_t g_quitDeadline; -extern int32_t g_restorePalette; -extern int32_t g_scriptSanityChecks; -extern int32_t hud_glowingquotes; -extern int32_t hud_showmapname; -extern int32_t lastvisinc; -extern int32_t rts_numlumps; -extern int32_t qsetmode; -extern int32_t quotebot; -extern int32_t quotebotgoal; -extern int32_t r_maxfps; -extern int32_t tempwallptr; -extern int32_t ticrandomseed; -extern int32_t vote_map; -extern int32_t voting; - -extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen; - -extern palette_t CrosshairColors; -extern palette_t DefaultCrosshairColors; - -extern uint32_t g_frameDelay; - -extern uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[768],*anim_pal; -extern uint8_t *basepaltable[BASEPALCOUNT]; - -extern user_defs ud; - -int32_t A_CheckInventorySprite(spritetype *s); -int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss); -int32_t A_Spawn(int32_t j,int32_t pn); -int32_t G_DoMoveThings(void); -int32_t G_EndOfLevel(void); -int32_t G_GameTextLen(int32_t x,const char *t); -int32_t G_PrintGameText(int32_t f,int32_t tile,int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t o,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z); -int32_t GetTime(void); -int32_t _EnterText(int32_t small,int32_t x,int32_t y,char *t,int32_t dalen,int32_t c); -int32_t kopen4loadfrommod(const char *filename,char searchfirst); -int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb); -extern inline int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits); -int32_t startwin_run(void); - -void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n); -void A_SpawnGlass(int32_t i,int32_t n); -void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n); -void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n); -void G_AddUserQuote(const char *daquote); -void G_BackToMenu(void); -void G_BonusScreen(int32_t bonusonly); -void G_CheatGetInv(void); -void G_DisplayRest(int32_t smoothratio); -void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio); -void G_DrawBackground(void); -void G_DrawFrags(void); -void G_DrawRooms(int32_t snum,int32_t smoothratio); -void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z); -void G_DrawTile(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation); -void G_DrawTilePal(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p); -void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p); -void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation); -void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e); -void G_GameExit(const char *t) ATTRIBUTE((noreturn)); -void G_GameQuit(void); -void G_GetCrosshairColor(void); -void G_HandleLocalKeys(void); -void G_HandleSpecialKeys(void); -void G_PrintGameQuotes(void); -void G_SE40(int32_t smoothratio); -void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); -void G_SetStatusBarScale(int32_t sc); -void G_Shutdown(void); -void G_UpdatePlayerFromMenu(void); -void M32RunScript(const char *s); -void P_DoQuote(int32_t q,DukePlayer_t *p); -void P_SetGamePalette(DukePlayer_t *player,uint8_t palid,int32_t set); -int32_t app_main(int32_t argc,const char **argv); -void computergetinput(int32_t snum,input_t *syn); -void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step); -void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile); -void sendscore(const char *s); - -static inline int32_t G_GetTeamPalette(int32_t team) -{ - int8_t pal[] = { 3, 10, 11, 12 }; - - if (team > (int32_t)(sizeof(pal)/sizeof(pal[0])) || team < 0) - return 0; - - return pal[team]; -} - -#if defined(_WIN32) -int32_t G_GetVersionFromWebsite(char *buffer); -#endif - -#ifdef RENDERTYPEWIN -void app_crashhandler(void); -#ifdef USE_OPENGL -extern char forcegl; -#endif -#endif - -#if KRANDDEBUG -int32_t krd_print(const char *filename); -void krd_enable(int32_t which); -#endif - -#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb) -#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb) -#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)OSD_StripColors(menutextbuf,t),10+16) -#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536) -#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536) -#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536) -#define gametextpalbits(x,y,t,s,p,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536) -#define A_CheckSpriteFlags(iActor, iType) (((SpriteFlags[sprite[iActor].picnum]^actor[iActor].flags) & iType) != 0) -#define A_CheckSpriteTileFlags(iPicnum, iType) ((SpriteFlags[iPicnum] & iType) != 0) -#define G_EnterText(x, y, t, dalen, c) _EnterText(0,x,y,t,dalen,c) -#define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c) -#define S_StopSound(num) S_StopEnvSound(num, -1) - -#endif diff --git a/polymer-perf/eduke32/source/gamedef.c b/polymer-perf/eduke32/source/gamedef.c deleted file mode 100644 index 0fa23a0e0..000000000 --- a/polymer-perf/eduke32/source/gamedef.c +++ /dev/null @@ -1,6443 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "duke3d.h" -#include "gamedef.h" -#include "gameexec.h" - -#include "osd.h" - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#include -#endif - -#define NUMKEYWORDS (int32_t)(sizeof(keyw)/sizeof(keyw[0])) - -int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files -uint32_t g_scriptDateVersion = 99999999; // YYYYMMDD -static uint32_t g_scriptLastKeyword; // = NUMKEYWORDS-1; - -#define NUMKEYWDATES (int32_t)(sizeof(g_keywdate)/sizeof(g_keywdate[0])) -// { keyw, date } means that at the date, all keywords up to keyw inclusive are available -static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = -{ - // beginning of eduke32 svn - { CON_CANSEE, 20060423 }, - { CON_CANSEESPR, 20060424 }, - // some stuff here not representable this way - { CON_FINDNEARSPRITEZVAR, 20060516 }, - { CON_EZSHOOT, 20060701 }, - { CON_EZSHOOTVAR, 20060822 }, - { CON_JUMP, 20060828 }, - { CON_QSTRLEN, 20060930 }, - { CON_QUAKE, 20070105 }, - { CON_SHOWVIEW, 20070208 }, - { CON_NEXTSPRITESECT, 20070819 }, - { CON_GETKEYNAME, 20071024 }, // keyw numbers have been - { CON_SPRITENOPAL, 20071220 }, // shuffled around here - { CON_HITRADIUSVAR, 20080216 }, - { CON_ROTATESPRITE16, 20080314 }, - { CON_SETARRAY, 20080401 }, - { CON_READARRAYFROMFILE, 20080405 }, - { CON_STARTTRACKVAR, 20080510 }, - { CON_QGETSYSSTR, 20080709 }, - { CON_GETTICKS, 20080711 }, - { CON_SETTSPR, 20080713 }, - { CON_CLEARMAPSTATE, 20080716 }, - { CON_SCRIPTSIZE, 20080720 }, - { CON_SETGAMENAME, 20080722 }, - { CON_CMENU, 20080725 }, - { CON_GETTIMEDATE, 20080809 }, - { CON_ACTIVATECHEAT, 20080810 }, - { CON_SETGAMEPALETTE, 20080816 }, - { CON_SETCFGNAME, 20080817 }, - { CON_IFVARVAREITHER, 20080907 }, - { CON_SAVENN, 20080915 }, - { CON_COPY, 20090219 }, -// { CON_INV, 20090619 }, - { CON_QSTRNCAT, 20090712 }, - { CON_STOPACTORSOUND, 20090715 }, - { CON_IFSERVER, 20100722 }, - { CON_CALCHYPOTENUSE, 20100927 }, - { CON_CLIPMOVENOSLIDE, 20101009 }, -}; - -char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling -static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL"; - -int32_t g_totalLines,g_lineNumber; -static int32_t g_checkingIfElse, g_processingState, g_lastKeyword = -1; -char g_szBuf[1024]; - -intptr_t *g_caseScriptPtr=NULL; // the pointer to the start of the case table in a switch statement -// first entry is 'default' code. -static intptr_t *previous_event=NULL; -static int32_t g_numCases = 0; -static int32_t g_checkingSwitch = 0, g_currentEvent = -1; -static int32_t g_labelsOnly = 0, g_skipKeywordCheck = 0, g_dynamicTileMapping = 0; -static int32_t g_numBraces = 0; - -static int32_t C_SetScriptSize(int32_t size); - -int32_t g_numQuoteRedefinitions = 0; - -// pointers to weapon gamevar data -intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine -intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire) -intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire -intptr_t *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none) -intptr_t *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire. -intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon -intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots -intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item -intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn -intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst' -intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like -intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when weapon starts firing. zero for no sound -intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic) -intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time -intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID -intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed -intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted -intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound of weapon being selected -intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Muzzle flash color - -int32_t g_iReturnVarID=-1; // var ID of "RETURN" -int32_t g_iWeaponVarID=-1; // var ID of "WEAPON" -int32_t g_iWorksLikeVarID=-1; // var ID of "WORKSLIKE" -int32_t g_iZRangeVarID=-1; // var ID of "ZRANGE" -int32_t g_iAngRangeVarID=-1; // var ID of "ANGRANGE" -int32_t g_iAimAngleVarID=-1; // var ID of "AUTOAIMANGLE" -int32_t g_iLoTagID=-1; // var ID of "LOTAG" -int32_t g_iHiTagID=-1; // var ID of "HITAG" -int32_t g_iTextureID=-1; // var ID of "TEXTURE" -int32_t g_iThisActorID=-1; // var ID of "THISACTOR" -int32_t g_iSpriteVarID=-1; -int32_t g_iSectorVarID=-1; -int32_t g_iWallVarID=-1; -int32_t g_iPlayerVarID=-1; -int32_t g_iActorVarID=-1; - -intptr_t *actorLoadEventScrptr[MAXTILES]; - -intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; -static intptr_t *g_parsingEventPtr=NULL; - -gamevar_t aGameVars[MAXGAMEVARS]; -gamearray_t aGameArrays[MAXGAMEARRAYS]; -int32_t g_gameVarCount=0; -int32_t g_gameArrayCount=0; - -extern int32_t qsetmode; - -char *textptr; -int32_t g_numCompilerErrors,g_numCompilerWarnings; - -extern char *g_gameNamePtr; -extern char *g_defNamePtr; - -extern int32_t g_maxSoundPos; - -enum ScriptLabel_t -{ - LABEL_ANY = -1, - LABEL_DEFINE = 1, - LABEL_STATE = 2, - LABEL_ACTOR = 4, - LABEL_ACTION = 8, - LABEL_AI = 16, - LABEL_MOVE = 32, -}; - -static const char *LabelTypeText[] = -{ - "define", - "state", - "actor", - "action", - "ai", - "move" -}; - -static const char *C_GetLabelType(int32_t type) -{ - int32_t i; - char x[64]; - - x[0] = 0; - for (i=0; i<6; i++) - { - if (!(type & (1<pals - "sound", // 15 plays a sound that was defined with definesound - "fall", // 16 causes actor to fall to sector floor height - "state", // 17 begins defining a state if used outside a state or actor, otherwise calls a state - "ends", // 18 ends defining a state - "define", // 19 defines a value - "return", // 20 - "ifai", // 21 checks if actor is currently performing a specific ai function - "killit", // 22 kills an actor - "addweapon", // 23 adds a weapon to the closest player - "ai", // 24 sets an ai function to be used by an actor - "addphealth", // 25 adds health to the player - "ifdead", // 26 checks if actor is dead - "ifsquished", // 27 checks if actor has been squished - "sizeto", // 28 gradually increases actor size until it matches parameters given - "{", // 29 used to indicate segments of code - "}", // 30 used to indicate segments of code - "spawn", // 31 spawns an actor - "move", // 32 - "ifwasweapon", // 33 - "ifaction", // 34 - "ifactioncount", // 35 - "resetactioncount", // 36 - "debris", // 37 - "pstomp", // 38 - "", // 39 was previously used to define the start of a comment block - "cstat", // 40 - "ifmove", // 41 - "resetplayer", // 42 - "ifonwater", // 43 - "ifinwater", // 44 - "ifcanshoottarget", // 45 - "ifcount", // 46 - "resetcount", // 47 - "addinventory", // 48 - "ifactornotstayput", // 49 - "hitradius", // 50 - "ifp", // 51 - "count", // 52 - "ifactor", // 53 - "music", // 54 - "include", // 55 - "ifstrength", // 56 - "definesound", // 57 - "guts", // 58 - "ifspawnedby", // 59 - "gamestartup", // 60 - "wackplayer", // 61 - "ifgapzl", // 62 - "ifhitspace", // 63 - "ifoutside", // 64 - "ifmultiplayer", // 65 - "operate", // 66 - "ifinspace", // 67 - "debug", // 68 - "endofgame", // 69 - "ifbulletnear", // 70 - "ifrespawn", // 71 - "iffloordistl", // 72 - "ifceilingdistl", // 73 - "spritepal", // 74 - "ifpinventory", // 75 - "betaname", // 76 - "cactor", // 77 - "ifphealthl", // 78 - "definequote", // 79 - "quote", // 80 - "ifinouterspace", // 81 - "ifnotmoving", // 82 - "respawnhitag", // 83 - "tip", // 84 - "ifspritepal", // 85 - "money", // 86 - "soundonce", // 87 - "addkills", // 88 - "stopsound", // 89 - "ifawayfromwall", // 90 - "ifcanseetarget", // 91 - "globalsound", // 92 - "lotsofglass", // 93 - "ifgotweaponce", // 94 - "getlastpal", // 95 - "pkick", // 96 - "mikesnd", // 97 - "useractor", // 98 - "sizeat", // 99 - "addstrength", // 100 [#] - "cstator", // 101 - "mail", // 102 - "paper", // 103 - "tossweapon", // 104 - "sleeptime", // 105 - "nullop", // 106 - "definevolumename", // 107 - "defineskillname", // 108 - "ifnosounds", // 109 - "clipdist", // 110 - "ifangdiffl", // 111 - "gamevar", // 112 - "ifvarl", // 113 - "ifvarg", // 114 - "setvarvar", // 115 - "setvar", // 116 - "addvarvar", // 117 - "addvar", // 118 - "ifvarvarl", // 119 - "ifvarvarg", // 120 - "addlogvar", // 121 - "addlog", // 122 - "onevent", // 123 - "endevent", // 124 - "ifvare", // 125 - "ifvarvare", // 126 - "spgetlotag", // 127 - "spgethitag", // 128 - "sectgetlotag", // 129 - "sectgethitag", // 130 - "ifsound", // 131 - "gettexturefloor", // 132 - "gettextureceiling", // 133 - "inittimer", // 134 - "starttrack", // 135 - "randvar", // 136 - "enhanced", // 137 - "getangletotarget", // 138 - "getactorangle", // 139 - "setactorangle", // 140 - "mulvar", // 141 - "mulvarvar", // 142 - "divvar", // 143 - "divvarvar", // 144 - "modvar", // 145 - "modvarvar", // 146 - "andvar", // 147 - "andvarvar", // 148 - "orvar", // 149 - "orvarvar", // 150 - "getplayerangle", // 151 - "setplayerangle", // 152 - "lockplayer", // 153 - "setsector", // 154 - "getsector", // 155 - "setactor", // 156 - "getactor", // 157 - "setwall", // 158 - "getwall", // 159 - "findnearactor", // 160 - "findnearactorvar", // 161 - "setactorvar", // 162 - "getactorvar", // 163 - "espawn", // 164 - "getplayer", // 165 - "setplayer", // 166 - "sqrt", // 167 - "eventloadactor", // 168 - "espawnvar", // 169 - "getuserdef", // 170 - "setuserdef", // 171 - "subvarvar", // 172 - "subvar", // 173 - "ifvarn", // 174 - "ifvarvarn", // 175 - "ifvarand", // 176 - "ifvarvarand", // 177 - "myos", // 178 - "myospal", // 179 - "displayrand", // 180 - "sin", // 181 - "xorvarvar", // 182 - "xorvar", // 183 - "randvarvar", // 184 - "myosx", // 185 - "myospalx", // 186 - "gmaxammo", // 187 - "smaxammo", // 188 - "startlevel", // 189 - "eshoot", // 190 - "qspawn", // 191 - "rotatesprite", // 192 - "defineprojectile", // 193 - "spriteshadow", // 194 - "cos", // 195 - "eshootvar", // 196 - "findnearactor3d", // 197 - "findnearactor3dvar", // 198 - "flash", // 199 - "qspawnvar", // 200 - "eqspawn", // 201 - "eqspawnvar", // 202 - "minitext", // 203 - "gametext", // 204 - "digitalnumber", // 205 - "addweaponvar", // 206 - "setprojectile", // 207 - "angoff", // 208 - "updatesector", // 209 - "insertspriteq", // 210 - "angoffvar", // 211 - "whilevarn", // 212 - "switch", // 213 - "case", // 214 - "default", // 215 - "endswitch", // 216 - "shootvar", // 217 - "soundvar", // 218 - "findplayer", // 219 - "findotherplayer", // 220 - "activatebysector", // 221 sectnum, spriteid - "operatesectors", // 222 sectnum, spriteid - "operaterespawns", // 223 lotag - "operateactivators", // 224 lotag, player index - "operatemasterswitches", // 225 lotag - "checkactivatormotion", // 226 lotag - "zshoot", // 227 zvar projnum - "dist", // 228 sprite1 sprite2 - "ldist", // 229 sprite1 sprite2 - "shiftvarl", // 230 - "shiftvarr", // 231 - "spritenvg", // 232 - "getangle", // 233 - "whilevarvarn", // 234 - "hitscan", // 235 - "time", // 236 - "getplayervar", // 237 - "setplayervar", // 238 - "mulscale", // 239 - "setaspect", // 240 - "ezshoot", // 241 - "spritenoshade", // 242 - "movesprite", // 243 - "checkavailweapon", // 244 - "soundoncevar", // 245 - "updatesectorz", // 246 - "stopallsounds", // 247 - "ssp", // 248 - "stopsoundvar", // 249 - "displayrandvar", // 250 - "displayrandvarvar", // 251 - "checkavailinven", // 252 - "globalsoundvar", // 253 - "guniqhudid", // 254 - "getprojectile", // 255 - "getthisprojectile", // 256 - "setthisprojectile", // 257 - "definecheat", // 258 - "cheatkeys", // 259 - "userquote", // 260 - "precache", // 261 - "definegamefuncname", // 262 - "redefinequote", // 263 - "qsprintf", // 264 - "getpname", // 265 - "qstrcat", // 266 - "qstrcpy", // 267 - "setsprite", // 268 - "rotatepoint", // 269 - "dragpoint", // 270 - "getzrange", // 271 - "changespritestat", // 272 - "getceilzofslope", // 273 - "getflorzofslope", // 274 - "neartag", // 275 - "definegametype", // 276 - "changespritesect", // 277 - "spriteflags", // 278 - "savegamevar", // 279 - "readgamevar", // 280 - "findnearsprite", // 281 - "findnearspritevar", // 282 - "findnearsprite3d", // 283 - "findnearsprite3dvar", // 284 - "dynamicremap", // 285 - "setinput", // 286 - "getinput", // 287 - "save", // 288 - "cansee", // 289 - "canseespr", // 290 - "findnearactorz", // 291 - "findnearactorzvar", // 292 - "findnearspritez", // 293 - "findnearspritezvar", // 294 - "zshootvar", // 295 - "ezshootvar", // 296 - "getcurraddress", // 297 - "jump", // 298 - "qstrlen", // 299 - "getincangle", // 300 - "quake", // 301 - "showview", // 302 - "headspritestat", // 303 - "prevspritestat", // 304 - "nextspritestat", // 305 - "headspritesect", // 306 - "prevspritesect", // 307 - "nextspritesect", // 308 - "getkeyname", // 309 - "qsubstr", // 310 - "gametextz", // 311 - "digitalnumberz", // 312 - "spritenopal", // 313 - "hitradiusvar", // 314 - "rotatesprite16", // 315 - "gamearray", // 316 - "setarray", // 317 - "resizearray", // 318 - "writearraytofile", // 319 - "readarrayfromfile", // 320 - "starttrackvar", // 321 - "qgetsysstr", // 322 - "getticks", // 323 - "gettspr", // 324 - "settspr", // 325 - "savemapstate", // 326 - "loadmapstate", // 327 - "clearmapstate", // 328 - "scriptsize", // 329 - "setgamename", // 330 - "cmenu", // 331 - "gettimedate", // 332 - "activatecheat", // 333 - "setgamepalette", // 334 - "setdefname", // 335 - "setcfgname", // 336 - "ifvaror", // 337 - "ifvarvaror", // 338 - "ifvarxor", // 339 - "ifvarvarxor", // 340 - "ifvareither", // 341 - "ifvarvareither", // 342 - "getarraysize", // 343 - "savenn", // 344 - "copy", // 345 - "", // 346 internal inversion function - "sectorofwall", // 347 - "qstrncat", // 348 - "ifactorsound", // 349 - "stopactorsound", // 350 - "ifclient", // 351 - "ifserver", // 352 - "sectsetinterpolation", // 353 - "sectclearinterpolation", // 354 - "clipmove", // 355 - "lineintersect", // 356 - "rayintersect", // 357 - "calchypotenuse", // 358 - "clipmovenoslide", // 359 - "" -}; - -const memberlabel_t SectorLabels[]= -{ - { "wallptr", SECTOR_WALLPTR, 0, 0 }, - { "wallnum", SECTOR_WALLNUM, 0, 0 }, - { "ceilingz", SECTOR_CEILINGZ, 0, 0 }, - { "floorz", SECTOR_FLOORZ, 0, 0 }, - { "ceilingstat", SECTOR_CEILINGSTAT, 0, 0 }, - { "floorstat", SECTOR_FLOORSTAT, 0, 0 }, - { "ceilingpicnum", SECTOR_CEILINGPICNUM, 0, 0 }, - { "ceilingslope", SECTOR_CEILINGSLOPE, 0, 0 }, - { "ceilingshade", SECTOR_CEILINGSHADE, 0, 0 }, - { "ceilingpal", SECTOR_CEILINGPAL, 0, 0 }, - { "ceilingxpanning", SECTOR_CEILINGXPANNING, 0, 0 }, - { "ceilingypanning", SECTOR_CEILINGYPANNING, 0, 0 }, - { "floorpicnum", SECTOR_FLOORPICNUM, 0, 0 }, - { "floorslope", SECTOR_FLOORSLOPE, 0, 0 }, - { "floorshade", SECTOR_FLOORSHADE, 0, 0 }, - { "floorpal", SECTOR_FLOORPAL, 0, 0 }, - { "floorxpanning", SECTOR_FLOORXPANNING, 0, 0 }, - { "floorypanning", SECTOR_FLOORYPANNING, 0, 0 }, - { "visibility", SECTOR_VISIBILITY, 0, 0 }, -// { "filler", SECTOR_ALIGNTO, 0, 0 }, - { "alignto", SECTOR_ALIGNTO, 0, 0 }, // aka filler, not used - { "lotag", SECTOR_LOTAG, 0, 0 }, - { "hitag", SECTOR_HITAG, 0, 0 }, - { "extra", SECTOR_EXTRA, 0, 0 }, - { "", -1, 0, 0 } // END OF LIST -}; - -const memberlabel_t WallLabels[]= -{ - { "x", WALL_X, 0, 0 }, - { "y", WALL_Y, 0, 0 }, - { "point2", WALL_POINT2, 0, 0 }, - { "nextwall", WALL_NEXTWALL, 0, 0 }, - { "nextsector", WALL_NEXTSECTOR, 0, 0 }, - { "cstat", WALL_CSTAT, 0, 0 }, - { "picnum", WALL_PICNUM, 0, 0 }, - { "overpicnum", WALL_OVERPICNUM, 0, 0 }, - { "shade", WALL_SHADE, 0, 0 }, - { "pal", WALL_PAL, 0, 0 }, - { "xrepeat", WALL_XREPEAT, 0, 0 }, - { "yrepeat", WALL_YREPEAT, 0, 0 }, - { "xpanning", WALL_XPANNING, 0, 0 }, - { "ypanning", WALL_YPANNING, 0, 0 }, - { "lotag", WALL_LOTAG, 0, 0 }, - { "hitag", WALL_HITAG, 0, 0 }, - { "extra", WALL_EXTRA, 0, 0 }, - { "", -1, 0, 0 } // END OF LIST -}; - -const memberlabel_t ActorLabels[]= -{ - { "x", ACTOR_X, 0, 0 }, - { "y", ACTOR_Y, 0, 0 }, - { "z", ACTOR_Z, 0, 0 }, - { "cstat", ACTOR_CSTAT, 0, 0 }, - { "picnum", ACTOR_PICNUM, 0, 0 }, - { "shade", ACTOR_SHADE, 0, 0 }, - { "pal", ACTOR_PAL, 0, 0 }, - { "clipdist", ACTOR_CLIPDIST, 0, 0 }, -// { "filler", ACTOR_DETAIL, 0, 0 }, - { "detail", ACTOR_DETAIL, 0, 0 }, // aka filler, not used - { "xrepeat", ACTOR_XREPEAT, 0, 0 }, - { "yrepeat", ACTOR_YREPEAT, 0, 0 }, - { "xoffset", ACTOR_XOFFSET, 0, 0 }, - { "yoffset", ACTOR_YOFFSET, 0, 0 }, - { "sectnum", ACTOR_SECTNUM, 0, 0 }, - { "statnum", ACTOR_STATNUM, 0, 0 }, - { "ang", ACTOR_ANG, 0, 0 }, - { "owner", ACTOR_OWNER, 0, 0 }, - { "xvel", ACTOR_XVEL, 0, 0 }, - { "yvel", ACTOR_YVEL, 0, 0 }, - { "zvel", ACTOR_ZVEL, 0, 0 }, - { "lotag", ACTOR_LOTAG, 0, 0 }, - { "hitag", ACTOR_HITAG, 0, 0 }, - { "extra", ACTOR_EXTRA, 0, 0 }, - - // ActorExtra labels... - { "htcgg", ACTOR_HTCGG, 0, 0 }, - { "htpicnum", ACTOR_HTPICNUM, 0, 0 }, - { "htang", ACTOR_HTANG, 0, 0 }, - { "htextra", ACTOR_HTEXTRA, 0, 0 }, - { "htowner", ACTOR_HTOWNER, 0, 0 }, - { "htmovflag", ACTOR_HTMOVFLAG, 0, 0 }, - { "httempang", ACTOR_HTTEMPANG, 0, 0 }, - { "htactorstayput", ACTOR_HTACTORSTAYPUT, 0, 0 }, - { "htdispicnum", ACTOR_HTDISPICNUM, 0, 0 }, - { "httimetosleep", ACTOR_HTTIMETOSLEEP, 0, 0 }, - { "htfloorz", ACTOR_HTFLOORZ, 0, 0 }, - { "htceilingz", ACTOR_HTCEILINGZ, 0, 0 }, - { "htlastvx", ACTOR_HTLASTVX, 0, 0 }, - { "htlastvy", ACTOR_HTLASTVY, 0, 0 }, - { "htbposx", ACTOR_HTBPOSX, 0, 0 }, - { "htbposy", ACTOR_HTBPOSY, 0, 0 }, - { "htbposz", ACTOR_HTBPOSZ, 0, 0 }, - { "htg_t", ACTOR_HTG_T, LABEL_HASPARM2, 10 }, - - // model flags - - { "angoff", ACTOR_ANGOFF, 0, 0 }, - { "pitch", ACTOR_PITCH, 0, 0 }, - { "roll", ACTOR_ROLL, 0, 0 }, - { "mdxoff", ACTOR_MDXOFF, 0, 0 }, - { "mdyoff", ACTOR_MDYOFF, 0, 0 }, - { "mdzoff", ACTOR_MDZOFF, 0, 0 }, - { "mdflags", ACTOR_MDFLAGS, 0, 0 }, - { "xpanning", ACTOR_XPANNING, 0, 0 }, - { "ypanning", ACTOR_YPANNING, 0, 0 }, - - { "htflags", ACTOR_HTFLAGS, 0, 0 }, - - { "alpha", ACTOR_ALPHA, 0, 0 }, - - { "", -1, 0, 0 } // END OF LIST -}; - -const memberlabel_t TsprLabels[]= -{ - // tsprite access - - { "tsprx", ACTOR_X, 0, 0 }, - { "tspry", ACTOR_Y, 0, 0 }, - { "tsprz", ACTOR_Z, 0, 0 }, - { "tsprcstat", ACTOR_CSTAT, 0, 0 }, - { "tsprpicnum", ACTOR_PICNUM, 0, 0 }, - { "tsprshade", ACTOR_SHADE, 0, 0 }, - { "tsprpal", ACTOR_PAL, 0, 0 }, - { "tsprclipdist", ACTOR_CLIPDIST, 0, 0 }, -// { "tsprfiller", ACTOR_DETAIL, 0, 0 }, - { "tsprdetail", ACTOR_DETAIL, 0, 0 }, // aka filler, not used - { "tsprxrepeat", ACTOR_XREPEAT, 0, 0 }, - { "tspryrepeat", ACTOR_YREPEAT, 0, 0 }, - { "tsprxoffset", ACTOR_XOFFSET, 0, 0 }, - { "tspryoffset", ACTOR_YOFFSET, 0, 0 }, - { "tsprsectnum", ACTOR_SECTNUM, 0, 0 }, - { "tsprstatnum", ACTOR_STATNUM, 0, 0 }, - { "tsprang", ACTOR_ANG, 0, 0 }, - { "tsprowner", ACTOR_OWNER, 0, 0 }, -#if 1 - { "tsprxvel", ACTOR_XVEL, 0, 0 }, - { "tspryvel", ACTOR_YVEL, 0, 0 }, - { "tsprzvel", ACTOR_ZVEL, 0, 0 }, - { "tsprlotag", ACTOR_LOTAG, 0, 0 }, - { "tsprhitag", ACTOR_HITAG, 0, 0 }, - { "tsprextra", ACTOR_EXTRA, 0, 0 }, -#endif - - { "", -1, 0, 0 } // END OF LIST -}; - -const memberlabel_t PlayerLabels[]= -{ - { "zoom", PLAYER_ZOOM, 0, 0 }, - { "exitx", PLAYER_EXITX, 0, 0 }, - { "exity", PLAYER_EXITY, 0, 0 }, - { "loogiex", PLAYER_LOOGIEX, LABEL_HASPARM2, 64 }, - { "loogiey", PLAYER_LOOGIEY, LABEL_HASPARM2, 64 }, - { "numloogs", PLAYER_NUMLOOGS, 0, 0 }, - { "loogcnt", PLAYER_LOOGCNT, 0, 0 }, - { "posx", PLAYER_POSX, 0, 0 }, - { "posy", PLAYER_POSY, 0, 0 }, - { "posz", PLAYER_POSZ, 0, 0 }, - { "horiz", PLAYER_HORIZ, 0, 0 }, - { "ohoriz", PLAYER_OHORIZ, 0, 0 }, - { "ohorizoff", PLAYER_OHORIZOFF, 0, 0 }, - { "invdisptime", PLAYER_INVDISPTIME, 0, 0 }, - { "bobposx", PLAYER_BOBPOSX, 0, 0 }, - { "bobposy", PLAYER_BOBPOSY, 0, 0 }, - { "oposx", PLAYER_OPOSX, 0, 0 }, - { "oposy", PLAYER_OPOSY, 0, 0 }, - { "oposz", PLAYER_OPOSZ, 0, 0 }, - { "pyoff", PLAYER_PYOFF, 0, 0 }, - { "opyoff", PLAYER_OPYOFF, 0, 0 }, - { "posxv", PLAYER_POSXV, 0, 0 }, - { "posyv", PLAYER_POSYV, 0, 0 }, - { "poszv", PLAYER_POSZV, 0, 0 }, - { "last_pissed_time", PLAYER_LAST_PISSED_TIME, 0, 0 }, - { "truefz", PLAYER_TRUEFZ, 0, 0 }, - { "truecz", PLAYER_TRUECZ, 0, 0 }, - { "player_par", PLAYER_PLAYER_PAR, 0, 0 }, - { "visibility", PLAYER_VISIBILITY, 0, 0 }, - { "bobcounter", PLAYER_BOBCOUNTER, 0, 0 }, - { "weapon_sway", PLAYER_WEAPON_SWAY, 0, 0 }, - { "pals_time", PLAYER_PALS_TIME, 0, 0 }, - { "randomflamex", PLAYER_RANDOMFLAMEX, 0, 0 }, - { "crack_time", PLAYER_CRACK_TIME, 0, 0 }, - { "aim_mode", PLAYER_AIM_MODE, 0, 0 }, - { "ang", PLAYER_ANG, 0, 0 }, - { "oang", PLAYER_OANG, 0, 0 }, - { "angvel", PLAYER_ANGVEL, 0, 0 }, - { "cursectnum", PLAYER_CURSECTNUM, 0, 0 }, - { "look_ang", PLAYER_LOOK_ANG, 0, 0 }, - { "last_extra", PLAYER_LAST_EXTRA, 0, 0 }, - { "subweapon", PLAYER_SUBWEAPON, 0, 0 }, - { "ammo_amount", PLAYER_AMMO_AMOUNT, LABEL_HASPARM2, MAX_WEAPONS }, - { "wackedbyactor", PLAYER_WACKEDBYACTOR, 0, 0 }, - { "frag", PLAYER_FRAG, 0, 0 }, - { "fraggedself", PLAYER_FRAGGEDSELF, 0, 0 }, - { "curr_weapon", PLAYER_CURR_WEAPON, 0, 0 }, - { "last_weapon", PLAYER_LAST_WEAPON, 0, 0 }, - { "tipincs", PLAYER_TIPINCS, 0, 0 }, - { "horizoff", PLAYER_HORIZOFF, 0, 0 }, - { "wantweaponfire", PLAYER_WANTWEAPONFIRE, 0, 0 }, - { "holoduke_amount", PLAYER_HOLODUKE_AMOUNT, 0, 0 }, - { "newowner", PLAYER_NEWOWNER, 0, 0 }, - { "hurt_delay", PLAYER_HURT_DELAY, 0, 0 }, - { "hbomb_hold_delay", PLAYER_HBOMB_HOLD_DELAY, 0, 0 }, - { "jumping_counter", PLAYER_JUMPING_COUNTER, 0, 0 }, - { "airleft", PLAYER_AIRLEFT, 0, 0 }, - { "knee_incs", PLAYER_KNEE_INCS, 0, 0 }, - { "access_incs", PLAYER_ACCESS_INCS, 0, 0 }, - { "fta", PLAYER_FTA, 0, 0 }, - { "ftq", PLAYER_FTQ, 0, 0 }, - { "access_wallnum", PLAYER_ACCESS_WALLNUM, 0, 0 }, - { "access_spritenum", PLAYER_ACCESS_SPRITENUM, 0, 0 }, - { "kickback_pic", PLAYER_KICKBACK_PIC, 0, 0 }, - { "got_access", PLAYER_GOT_ACCESS, 0, 0 }, - { "weapon_ang", PLAYER_WEAPON_ANG, 0, 0 }, - { "firstaid_amount", PLAYER_FIRSTAID_AMOUNT, 0, 0 }, - { "somethingonplayer", PLAYER_SOMETHINGONPLAYER, 0, 0 }, - { "on_crane", PLAYER_ON_CRANE, 0, 0 }, - { "i", PLAYER_I, 0, 0 }, - { "one_parallax_sectnum", PLAYER_ONE_PARALLAX_SECTNUM, 0, 0 }, - { "over_shoulder_on", PLAYER_OVER_SHOULDER_ON, 0, 0 }, - { "random_club_frame", PLAYER_RANDOM_CLUB_FRAME, 0, 0 }, - { "fist_incs", PLAYER_FIST_INCS, 0, 0 }, - { "one_eighty_count", PLAYER_ONE_EIGHTY_COUNT, 0, 0 }, - { "cheat_phase", PLAYER_CHEAT_PHASE, 0, 0 }, - { "dummyplayersprite", PLAYER_DUMMYPLAYERSPRITE, 0, 0 }, - { "extra_extra8", PLAYER_EXTRA_EXTRA8, 0, 0 }, - { "quick_kick", PLAYER_QUICK_KICK, 0, 0 }, - { "heat_amount", PLAYER_HEAT_AMOUNT, 0, 0 }, - { "actorsqu", PLAYER_ACTORSQU, 0, 0 }, - { "timebeforeexit", PLAYER_TIMEBEFOREEXIT, 0, 0 }, - { "customexitsound", PLAYER_CUSTOMEXITSOUND, 0, 0 }, - { "weaprecs", PLAYER_WEAPRECS, LABEL_HASPARM2, MAX_WEAPONS }, - { "weapreccnt", PLAYER_WEAPRECCNT, 0, 0 }, - { "interface_toggle_flag", PLAYER_INTERFACE_TOGGLE_FLAG, 0, 0 }, - { "rotscrnang", PLAYER_ROTSCRNANG, 0, 0 }, - { "dead_flag", PLAYER_DEAD_FLAG, 0, 0 }, - { "show_empty_weapon", PLAYER_SHOW_EMPTY_WEAPON, 0, 0 }, - { "scuba_amount", PLAYER_SCUBA_AMOUNT, 0, 0 }, - { "jetpack_amount", PLAYER_JETPACK_AMOUNT, 0, 0 }, - { "steroids_amount", PLAYER_STEROIDS_AMOUNT, 0, 0 }, - { "shield_amount", PLAYER_SHIELD_AMOUNT, 0, 0 }, - { "holoduke_on", PLAYER_HOLODUKE_ON, 0, 0 }, - { "pycount", PLAYER_PYCOUNT, 0, 0 }, - { "weapon_pos", PLAYER_WEAPON_POS, 0, 0 }, - { "frag_ps", PLAYER_FRAG_PS, 0, 0 }, - { "transporter_hold", PLAYER_TRANSPORTER_HOLD, 0, 0 }, - { "last_full_weapon", PLAYER_LAST_FULL_WEAPON, 0, 0 }, - { "footprintshade", PLAYER_FOOTPRINTSHADE, 0, 0 }, - { "boot_amount", PLAYER_BOOT_AMOUNT, 0, 0 }, - { "scream_voice", PLAYER_SCREAM_VOICE, 0, 0 }, - { "gm", PLAYER_GM, 0, 0 }, - { "on_warping_sector", PLAYER_ON_WARPING_SECTOR, 0, 0 }, - { "footprintcount", PLAYER_FOOTPRINTCOUNT, 0, 0 }, - { "hbomb_on", PLAYER_HBOMB_ON, 0, 0 }, - { "jumping_toggle", PLAYER_JUMPING_TOGGLE, 0, 0 }, - { "rapid_fire_hold", PLAYER_RAPID_FIRE_HOLD, 0, 0 }, - { "on_ground", PLAYER_ON_GROUND, 0, 0 }, - { "name", PLAYER_NAME, LABEL_ISSTRING, 32 }, - { "inven_icon", PLAYER_INVEN_ICON, 0, 0 }, - { "buttonpalette", PLAYER_BUTTONPALETTE, 0, 0 }, - { "jetpack_on", PLAYER_JETPACK_ON, 0, 0 }, - { "spritebridge", PLAYER_SPRITEBRIDGE, 0, 0 }, - { "lastrandomspot", PLAYER_LASTRANDOMSPOT, 0, 0 }, - { "scuba_on", PLAYER_SCUBA_ON, 0, 0 }, - { "footprintpal", PLAYER_FOOTPRINTPAL, 0, 0 }, - { "heat_on", PLAYER_HEAT_ON, 0, 0 }, - { "holster_weapon", PLAYER_HOLSTER_WEAPON, 0, 0 }, - { "falling_counter", PLAYER_FALLING_COUNTER, 0, 0 }, - { "gotweapon", PLAYER_GOTWEAPON, LABEL_HASPARM2, MAX_WEAPONS }, - { "refresh_inventory", PLAYER_REFRESH_INVENTORY, 0, 0 }, - { "palette", PLAYER_PALETTE, 0, 0 }, - { "toggle_key_flag", PLAYER_TOGGLE_KEY_FLAG, 0, 0 }, - { "knuckle_incs", PLAYER_KNUCKLE_INCS, 0, 0 }, - { "walking_snd_toggle", PLAYER_WALKING_SND_TOGGLE, 0, 0 }, - { "palookup", PLAYER_PALOOKUP, 0, 0 }, - { "hard_landing", PLAYER_HARD_LANDING, 0, 0 }, - { "max_secret_rooms", PLAYER_MAX_SECRET_ROOMS, 0, 0 }, - { "secret_rooms", PLAYER_SECRET_ROOMS, 0, 0 }, - { "pals", PLAYER_PALS, LABEL_HASPARM2, 3 }, - { "max_actors_killed", PLAYER_MAX_ACTORS_KILLED, 0, 0 }, - { "actors_killed", PLAYER_ACTORS_KILLED, 0, 0 }, - { "return_to_center", PLAYER_RETURN_TO_CENTER, 0, 0 }, - { "runspeed", PLAYER_RUNSPEED, 0, 0 }, - { "sbs", PLAYER_SBS, 0, 0 }, - { "reloading", PLAYER_RELOADING, 0, 0 }, - { "auto_aim", PLAYER_AUTO_AIM, 0, 0 }, - { "movement_lock", PLAYER_MOVEMENT_LOCK, 0, 0 }, - { "sound_pitch", PLAYER_SOUND_PITCH, 0, 0 }, - { "weaponswitch", PLAYER_WEAPONSWITCH, 0, 0 }, - { "team", PLAYER_TEAM, 0, 0 }, - { "max_player_health", PLAYER_MAX_PLAYER_HEALTH, 0, 0 }, - { "max_shield_amount", PLAYER_MAX_SHIELD_AMOUNT, 0, 0 }, - { "max_ammo_amount", PLAYER_MAX_AMMO_AMOUNT, LABEL_HASPARM2, MAX_WEAPONS }, - { "last_quick_kick", PLAYER_LAST_QUICK_KICK, 0, 0 }, - { "", -1, 0, 0 } // END OF LIST -}; - -const memberlabel_t ProjectileLabels[]= -{ - { "workslike", PROJ_WORKSLIKE, 0, 0 }, - { "spawns", PROJ_SPAWNS, 0, 0 }, - { "sxrepeat", PROJ_SXREPEAT, 0, 0 }, - { "syrepeat", PROJ_SYREPEAT, 0, 0 }, - { "sound", PROJ_SOUND, 0, 0 }, - { "isound", PROJ_ISOUND, 0, 0 }, - { "vel", PROJ_VEL, 0, 0 }, - { "extra", PROJ_EXTRA, 0, 0 }, - { "decal", PROJ_DECAL, 0, 0 }, - { "trail", PROJ_TRAIL, 0, 0 }, - { "txrepeat", PROJ_TXREPEAT, 0, 0 }, - { "tyrepeat", PROJ_TYREPEAT, 0, 0 }, - { "toffset", PROJ_TOFFSET, 0, 0 }, - { "tnum", PROJ_TNUM, 0, 0 }, - { "drop", PROJ_DROP, 0, 0 }, - { "cstat", PROJ_CSTAT, 0, 0 }, - { "clipdist", PROJ_CLIPDIST, 0, 0 }, - { "shade", PROJ_SHADE, 0, 0 }, - { "xrepeat", PROJ_XREPEAT, 0, 0 }, - { "yrepeat", PROJ_YREPEAT, 0, 0 }, - { "pal", PROJ_PAL, 0, 0 }, - { "extra_rand", PROJ_EXTRA_RAND, 0, 0 }, - { "hitradius", PROJ_HITRADIUS, 0, 0 }, - { "velmult", PROJ_VEL_MULT, 0, 0 }, - { "offset", PROJ_OFFSET, 0, 0 }, - { "bounces", PROJ_BOUNCES, 0, 0 }, - { "bsound", PROJ_BSOUND, 0, 0 }, - { "range", PROJ_RANGE, 0, 0 }, - { "flashcolor", PROJ_FLASH_COLOR, 0, 0 }, - { "", -1, 0, 0 } // END OF LIST -}; - -const memberlabel_t UserdefsLabels[]= -{ - // { "", 1, 0, 0 }, - { "god", USERDEFS_GOD, 0, 0 }, - { "warp_on", USERDEFS_WARP_ON, 0, 0 }, - { "cashman", USERDEFS_CASHMAN, 0, 0 }, - { "eog", USERDEFS_EOG, 0, 0 }, - { "showallmap", USERDEFS_SHOWALLMAP, 0, 0 }, - { "show_help", USERDEFS_SHOW_HELP, 0, 0 }, - { "scrollmode", USERDEFS_SCROLLMODE, 0, 0 }, - { "clipping", USERDEFS_CLIPPING, 0, 0 }, - { "user_name", USERDEFS_USER_NAME, LABEL_HASPARM2, MAXPLAYERS }, - { "ridecule", USERDEFS_RIDECULE, LABEL_HASPARM2 | LABEL_ISSTRING, 10 }, - { "savegame", USERDEFS_SAVEGAME, LABEL_HASPARM2 | LABEL_ISSTRING, 10 }, - { "pwlockout", USERDEFS_PWLOCKOUT, LABEL_ISSTRING, 128 }, - { "rtsname;", USERDEFS_RTSNAME, LABEL_ISSTRING, 128 }, - { "overhead_on", USERDEFS_OVERHEAD_ON, 0, 0 }, - { "last_overhead", USERDEFS_LAST_OVERHEAD, 0, 0 }, - { "showweapons", USERDEFS_SHOWWEAPONS, 0, 0 }, - - { "pause_on", USERDEFS_PAUSE_ON, 0, 0 }, - { "from_bonus", USERDEFS_FROM_BONUS, 0, 0 }, - { "camerasprite", USERDEFS_CAMERASPRITE, 0, 0 }, - { "last_camsprite", USERDEFS_LAST_CAMSPRITE, 0, 0 }, - { "last_level", USERDEFS_LAST_LEVEL, 0, 0 }, - { "secretlevel", USERDEFS_SECRETLEVEL, 0, 0 }, - - { "const_visibility", USERDEFS_CONST_VISIBILITY, 0, 0 }, - { "uw_framerate", USERDEFS_UW_FRAMERATE, 0, 0 }, - { "camera_time", USERDEFS_CAMERA_TIME, 0, 0 }, - { "folfvel", USERDEFS_FOLFVEL, 0, 0 }, - { "folavel", USERDEFS_FOLAVEL, 0, 0 }, - { "folx", USERDEFS_FOLX, 0, 0 }, - { "foly", USERDEFS_FOLY, 0, 0 }, - { "fola", USERDEFS_FOLA, 0, 0 }, - { "reccnt", USERDEFS_RECCNT, 0, 0 }, - - { "entered_name", USERDEFS_ENTERED_NAME, 0, 0 }, - { "screen_tilting", USERDEFS_SCREEN_TILTING, 0, 0 }, - { "shadows", USERDEFS_SHADOWS, 0, 0 }, - { "fta_on", USERDEFS_FTA_ON, 0, 0 }, - { "executions", USERDEFS_EXECUTIONS, 0, 0 }, - { "auto_run", USERDEFS_AUTO_RUN, 0, 0 }, - { "coords", USERDEFS_COORDS, 0, 0 }, - { "tickrate", USERDEFS_TICKRATE, 0, 0 }, - { "m_coop", USERDEFS_M_COOP, 0, 0 }, - { "coop", USERDEFS_COOP, 0, 0 }, - { "screen_size", USERDEFS_SCREEN_SIZE, 0, 0 }, - { "lockout", USERDEFS_LOCKOUT, 0, 0 }, - { "crosshair", USERDEFS_CROSSHAIR, 0, 0 }, - { "wchoice[MAXPLAYERS][MAX_WEAPONS]", USERDEFS_WCHOICE, 0, 0 }, - { "playerai", USERDEFS_PLAYERAI, 0, 0 }, - { "respawn_monsters", USERDEFS_RESPAWN_MONSTERS, 0, 0 }, - { "respawn_items", USERDEFS_RESPAWN_ITEMS, 0, 0 }, - { "respawn_inventory", USERDEFS_RESPAWN_INVENTORY, 0, 0 }, - { "recstat", USERDEFS_RECSTAT, 0, 0 }, - { "monsters_off", USERDEFS_MONSTERS_OFF, 0, 0 }, - { "brightness", USERDEFS_BRIGHTNESS, 0, 0 }, - { "m_respawn_items", USERDEFS_M_RESPAWN_ITEMS, 0, 0 }, - { "m_respawn_monsters", USERDEFS_M_RESPAWN_MONSTERS, 0, 0 }, - { "m_respawn_inventory", USERDEFS_M_RESPAWN_INVENTORY, 0, 0 }, - { "m_recstat", USERDEFS_M_RECSTAT, 0, 0 }, - { "m_monsters_off", USERDEFS_M_MONSTERS_OFF, 0, 0 }, - { "detail", USERDEFS_DETAIL, 0, 0 }, - { "m_ffire", USERDEFS_M_FFIRE, 0, 0 }, - { "ffire", USERDEFS_FFIRE, 0, 0 }, - { "m_player_skill", USERDEFS_M_PLAYER_SKILL, 0, 0 }, - { "m_level_number", USERDEFS_M_LEVEL_NUMBER, 0, 0 }, - { "m_volume_number", USERDEFS_M_VOLUME_NUMBER, 0, 0 }, - { "multimode", USERDEFS_MULTIMODE, 0, 0 }, - { "player_skill", USERDEFS_PLAYER_SKILL, 0, 0 }, - { "level_number", USERDEFS_LEVEL_NUMBER, 0, 0 }, - { "volume_number", USERDEFS_VOLUME_NUMBER, 0, 0 }, - { "m_marker", USERDEFS_M_MARKER, 0, 0 }, - { "marker", USERDEFS_MARKER, 0, 0 }, - { "mouseflip", USERDEFS_MOUSEFLIP, 0, 0 }, - { "statusbarscale", USERDEFS_STATUSBARSCALE, 0, 0 }, - { "drawweapon", USERDEFS_DRAWWEAPON, 0, 0 }, - { "mouseaiming", USERDEFS_MOUSEAIMING, 0, 0 }, - { "weaponswitch", USERDEFS_WEAPONSWITCH, 0, 0 }, - { "democams", USERDEFS_DEMOCAMS, 0, 0 }, - { "color", USERDEFS_COLOR, 0, 0 }, - { "msgdisptime", USERDEFS_MSGDISPTIME, 0, 0 }, - { "statusbarmode", USERDEFS_STATUSBARMODE, 0, 0 }, - { "m_noexits", USERDEFS_M_NOEXITS, 0, 0 }, - { "noexits", USERDEFS_NOEXITS, 0, 0 }, - { "autovote", USERDEFS_AUTOVOTE, 0, 0 }, - { "automsg", USERDEFS_AUTOMSG, 0, 0 }, - { "idplayers", USERDEFS_IDPLAYERS, 0, 0 }, - { "team", USERDEFS_TEAM, 0, 0 }, - { "viewbob", USERDEFS_VIEWBOB, 0, 0 }, - { "weaponsway", USERDEFS_WEAPONSWAY, 0, 0 }, - { "angleinterpolation", USERDEFS_ANGLEINTERPOLATION, 0, 0 }, - { "obituaries", USERDEFS_OBITUARIES, 0, 0 }, - { "levelstats", USERDEFS_LEVELSTATS, 0, 0 }, - { "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 }, - { "althud", USERDEFS_ALTHUD, 0, 0 }, - { "display_bonus_screen", USERDEFS_DISPLAY_BONUS_SCREEN, 0, 0 }, - { "show_level_text", USERDEFS_SHOW_LEVEL_TEXT, 0, 0 }, - { "weaponscale", USERDEFS_WEAPONSCALE, 0, 0 }, - { "textscale", USERDEFS_TEXTSCALE, 0, 0 }, - { "", -1, 0, 0 } // END OF LIST -}; - -const memberlabel_t InputLabels[]= -{ - { "avel", INPUT_AVEL, 0, 0 }, - { "horz", INPUT_HORZ, 0, 0 }, - { "fvel", INPUT_FVEL, 0, 0 }, - { "svel", INPUT_SVEL, 0, 0 }, - { "bits", INPUT_BITS, 0, 0 }, - { "extbits", INPUT_EXTBITS, 0, 0 }, - { "", -1, 0, 0 } // END OF LIST -}; - -char *bitptr; // pointer to bitmap of which bytecode positions contain pointers -#define BITPTR_POINTER 1 - -hashtable_t h_gamevars = { MAXGAMEVARS>>1, NULL }; -hashtable_t h_arrays = { MAXGAMEARRAYS>>1, NULL }; -hashtable_t h_labels = { 11264>>1, NULL }; -hashtable_t h_keywords = { CON_END>>1, NULL }; - -hashtable_t sectorH = { SECTOR_END>>1, NULL }; -hashtable_t wallH = { WALL_END>>1, NULL }; -hashtable_t userdefH = { USERDEFS_END>>1, NULL }; - -hashtable_t projectileH = { PROJ_END>>1, NULL }; -hashtable_t playerH = { PLAYER_END>>1, NULL }; -hashtable_t inputH = { INPUT_END>>1, NULL }; -hashtable_t actorH = { ACTOR_END>>1, NULL }; -hashtable_t tspriteH = { ACTOR_END>>1, NULL }; - -void inithashnames(); -void freehashnames(); - -void C_InitHashes() -{ - int32_t i; - - hash_init(&h_gamevars); - hash_init(&h_arrays); - hash_init(&h_labels); - inithashnames(); - - hash_init(&h_keywords); - hash_init(§orH); - hash_init(&wallH); - hash_init(&userdefH); - hash_init(&projectileH); - hash_init(&playerH); - hash_init(&inputH); - hash_init(&actorH); - hash_init(&tspriteH); - - g_scriptLastKeyword = NUMKEYWORDS-1; - // determine last CON keyword for backward compatibility with older mods - if (g_scriptDateVersion < g_keywdate[NUMKEYWDATES-1].date) - { - for (i=NUMKEYWDATES-1; i>=0; i--) - { - if (g_scriptDateVersion >= g_keywdate[i].date) - { - g_scriptLastKeyword = g_keywdate[i].keyw; - break; - } - } - - if (i<0) - g_scriptLastKeyword = g_keywdate[0].keyw-1; // may be slightly imprecise - } - - for (i=g_scriptLastKeyword; i>=0; i--) hash_add(&h_keywords,keyw[i],i,0); - for (i=0; SectorLabels[i].lId >= 0; i++) hash_add(§orH,SectorLabels[i].name,i,0); - for (i=0; WallLabels[i].lId >= 0; i++) hash_add(&wallH,WallLabels[i].name,i,0); - for (i=0; UserdefsLabels[i].lId >= 0; i++) hash_add(&userdefH,UserdefsLabels[i].name,i,0); - for (i=0; ProjectileLabels[i].lId >= 0; i++) hash_add(&projectileH,ProjectileLabels[i].name,i,0); - for (i=0; PlayerLabels[i].lId >= 0; i++) hash_add(&playerH,PlayerLabels[i].name,i,0); - for (i=0; InputLabels[i].lId >= 0; i++) hash_add(&inputH,InputLabels[i].name,i,0); - for (i=0; ActorLabels[i].lId >= 0; i++) hash_add(&actorH,ActorLabels[i].name,i,0); - for (i=0; TsprLabels[i].lId >= 0; i++) hash_add(&tspriteH,TsprLabels[i].name,i,0); -} - -// "magic" number for { and }, overrides line number in compiled code for later detection -#define IFELSE_MAGIC 31337 -static int32_t g_ifElseAborted; - -static int32_t C_SetScriptSize(int32_t newsize) -{ - intptr_t oscriptPtr = (unsigned)(g_scriptPtr-script); - intptr_t ocaseScriptPtr = (unsigned)(g_caseScriptPtr-script); - intptr_t oparsingEventPtr = (unsigned)(g_parsingEventPtr-script); - intptr_t oparsingActorPtr = (unsigned)(g_parsingActorPtr-script); - intptr_t *newscript; - intptr_t i, j; - int32_t osize = g_scriptSize; - char *scriptptrs; - char *newbitptr; - - for (i=MAXSECTORS-1; i>=0; i--) - if (labelcode[i] && labeltype[i] != LABEL_DEFINE) - { - j = (intptr_t)labelcode[i]-(intptr_t)&script[0]; - labelcode[i] = (intptr_t)j; - } - - scriptptrs = Bcalloc(1, g_scriptSize * sizeof(uint8_t)); - - for (i=g_scriptSize-1; i>=0; i--) - { - if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) - { - if ((intptr_t)script[i] < (intptr_t)&script[0] || (intptr_t)script[i] >= (intptr_t)&script[g_scriptSize]) - { - g_numCompilerErrors++; - initprintf("Internal compiler error at %"PRIdPTR" (0x%"PRIxPTR")\n",i,i); - } - - scriptptrs[i] = 1; - script[i] -= (intptr_t)&script[0]; - } - else scriptptrs[i] = 0; - } - - for (i=MAXTILES-1; i>=0; i--) - { - if (actorscrptr[i]) - { - j = (intptr_t)actorscrptr[i]-(intptr_t)&script[0]; - actorscrptr[i] = (intptr_t *)j; - } - - if (actorLoadEventScrptr[i]) - { - j = (intptr_t)actorLoadEventScrptr[i]-(intptr_t)&script[0]; - actorLoadEventScrptr[i] = (intptr_t *)j; - } - } - - for (i=MAXGAMEEVENTS-1; i>=0; i--) - if (apScriptGameEvent[i]) - { - j = (intptr_t)apScriptGameEvent[i]-(intptr_t)&script[0]; - apScriptGameEvent[i] = (intptr_t *)j; - } - - initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t)); - - newscript = (intptr_t *)Brealloc(script, newsize * sizeof(intptr_t)); - newbitptr = Bcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t)); - - if (newscript == NULL || newbitptr == NULL) - { - C_ReportError(-1); - initprintf("%s:%d: out of memory: Aborted (%ud)\n",g_szScriptFileName,g_lineNumber,(unsigned)(g_scriptPtr-script)); - initprintf("%s", tempbuf); - g_numCompilerErrors++; - return 1; - } - - if (newsize >= osize) - { - Bmemset(&newscript[0]+osize,0,(newsize-osize) * sizeof(uint8_t)); - Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((osize+7)>>3)); - } - else - Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((newsize+7)>>3)); - - Bfree(bitptr); - bitptr = newbitptr; - if (script != newscript) - { - initprintf("Relocating compiled code from to 0x%lx to 0x%lx\n", (unsigned long)script, (unsigned long)newscript); - script = newscript; - } - - g_scriptSize = newsize; - g_scriptPtr = (intptr_t *)(script+oscriptPtr); - - if (g_caseScriptPtr) - g_caseScriptPtr = (intptr_t *)(script+ocaseScriptPtr); - - if (g_parsingEventPtr) - g_parsingEventPtr = (intptr_t *)(script+oparsingEventPtr); - - if (g_parsingActorPtr) - g_parsingActorPtr = (intptr_t *)(script+oparsingActorPtr); - - for (i=MAXSECTORS-1; i>=0; i--) - { - if (labelcode[i] && labeltype[i] != LABEL_DEFINE) - { - j = (intptr_t)labelcode[i]+(intptr_t)&script[0]; - labelcode[i] = j; - } - } - - for (i=(((newsize>=osize)?osize:newsize))-1; i>=0; i--) - if (scriptptrs[i]) - { - j = (intptr_t)script[i]+(intptr_t)&script[0]; - script[i] = j; - } - - for (i=MAXTILES-1; i>=0; i--) - { - if (actorscrptr[i]) - { - j = (intptr_t)actorscrptr[i]+(intptr_t)&script[0]; - actorscrptr[i] = (intptr_t *)j; - } - if (actorLoadEventScrptr[i]) - { - j = (intptr_t)actorLoadEventScrptr[i]+(intptr_t)&script[0]; - actorLoadEventScrptr[i] = (intptr_t *)j; - } - } - - for (i=MAXGAMEEVENTS-1; i>=0; i--) - if (apScriptGameEvent[i]) - { - j = (intptr_t)apScriptGameEvent[i]+(intptr_t)&script[0]; - apScriptGameEvent[i] = (intptr_t *)j; - } - - Bfree(scriptptrs); - return 0; -} - -static inline int32_t ispecial(const char c) -{ - if (c == ' ' || c == 0x0d || c == '(' || c == ')' || - c == ',' || c == ';' || (c == 0x0a /*&& ++g_lineNumber*/)) - return 1; - - return 0; -} - -#define C_NextLine() while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++ - -static int32_t C_SkipComments(void) -{ - do - { - switch (*textptr) - { - case '\n': - g_lineNumber++; - case ' ': - case '\t': - case '\r': - case 0x1a: - textptr++; - break; - case '/': - switch (textptr[1]) - { - case '/': // C++ style comment - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: got comment.\n",g_szScriptFileName,g_lineNumber); - C_NextLine(); - continue; - case '*': // beginning of a C style comment - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: got start of comment block.\n",g_szScriptFileName,g_lineNumber); - do - { - if (*textptr == '\n') - g_lineNumber++; - textptr++; - } - while (*textptr && (textptr[0] != '*' || textptr[1] != '/')); - - if (!*textptr) - { - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) - initprintf("%s:%d: debug: EOF in comment!\n",g_szScriptFileName,g_lineNumber); - C_ReportError(-1); - initprintf("%s:%d: error: found `/*' with no `*/'.\n",g_szScriptFileName,g_lineNumber); - g_parsingActorPtr = 0; g_processingState = g_numBraces = 0; - g_numCompilerErrors++; - continue; - } - - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: got end of comment block.\n",g_szScriptFileName,g_lineNumber); - - textptr+=2; - continue; - } - continue; - - default: - if (ispecial(*textptr)) - { - textptr++; - continue; - } - case 0: // EOF - return ((g_scriptPtr-script) > (g_scriptSize-32)) ? C_SetScriptSize(g_scriptSize<<1) : 0; - } - } - while (1); -} - -static void C_SetProjectile(int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - switch (lLabelID) - { - case PROJ_WORKSLIKE: - ProjectileData[lVar1].workslike=lVar2; - break; - - case PROJ_SPAWNS: - ProjectileData[lVar1].spawns=lVar2; - break; - - case PROJ_SXREPEAT: - ProjectileData[lVar1].sxrepeat=lVar2; - break; - - case PROJ_SYREPEAT: - ProjectileData[lVar1].syrepeat=lVar2; - break; - - case PROJ_SOUND: - ProjectileData[lVar1].sound=lVar2; - break; - - case PROJ_ISOUND: - ProjectileData[lVar1].isound=lVar2; - break; - - case PROJ_VEL: - ProjectileData[lVar1].vel=lVar2; - break; - - case PROJ_EXTRA: - ProjectileData[lVar1].extra=lVar2; - break; - - case PROJ_DECAL: - ProjectileData[lVar1].decal=lVar2; - break; - - case PROJ_TRAIL: - ProjectileData[lVar1].trail=lVar2; - break; - - case PROJ_TXREPEAT: - ProjectileData[lVar1].txrepeat=lVar2; - break; - - case PROJ_TYREPEAT: - ProjectileData[lVar1].tyrepeat=lVar2; - break; - - case PROJ_TOFFSET: - ProjectileData[lVar1].toffset=lVar2; - break; - - case PROJ_TNUM: - ProjectileData[lVar1].tnum=lVar2; - break; - - case PROJ_DROP: - ProjectileData[lVar1].drop=lVar2; - break; - - case PROJ_CSTAT: - ProjectileData[lVar1].cstat=lVar2; - break; - - case PROJ_CLIPDIST: - ProjectileData[lVar1].clipdist=lVar2; - break; - - case PROJ_SHADE: - ProjectileData[lVar1].shade=lVar2; - break; - - case PROJ_XREPEAT: - ProjectileData[lVar1].xrepeat=lVar2; - break; - - case PROJ_YREPEAT: - ProjectileData[lVar1].yrepeat=lVar2; - break; - - case PROJ_PAL: - ProjectileData[lVar1].pal=lVar2; - break; - - case PROJ_EXTRA_RAND: - ProjectileData[lVar1].extra_rand=lVar2; - break; - - case PROJ_HITRADIUS: - ProjectileData[lVar1].hitradius=lVar2; - break; - - case PROJ_VEL_MULT: - ProjectileData[lVar1].velmult=lVar2; - break; - - case PROJ_OFFSET: - ProjectileData[lVar1].offset=lVar2; - break; - - case PROJ_BOUNCES: - ProjectileData[lVar1].bounces=lVar2; - break; - - case PROJ_BSOUND: - ProjectileData[lVar1].bsound=lVar2; - break; - - case PROJ_RANGE: - ProjectileData[lVar1].range=lVar2; - break; - - default: - break; - } - - // DefaultProjectileData[lVar1] = ProjectileData[lVar1]; - Bmemcpy(&DefaultProjectileData[lVar1], &ProjectileData[lVar1], sizeof(ProjectileData[lVar1])); - - return; -} - -/* -static int32_t C_CheckEventSync(int32_t iEventID) -{ - if (g_parsingEventPtr || g_parsingActorPtr) - { - switch (iEventID) - { - case EVENT_ANIMATESPRITES: - case EVENT_CHEATGETSTEROIDS: - case EVENT_CHEATGETHEAT: - case EVENT_CHEATGETBOOT: - case EVENT_CHEATGETSHIELD: - case EVENT_CHEATGETSCUBA: - case EVENT_CHEATGETHOLODUKE: - case EVENT_CHEATGETJETPACK: - case EVENT_CHEATGETFIRSTAID: - case EVENT_DISPLAYCROSSHAIR: - case EVENT_DISPLAYREST: - case EVENT_DISPLAYBONUSSCREEN: - case EVENT_DISPLAYMENU: - case EVENT_DISPLAYMENUREST: - case EVENT_DISPLAYLOADINGSCREEN: - case EVENT_DISPLAYROOMS: - case EVENT_DISPLAYSBAR: - case EVENT_DISPLAYWEAPON: - case EVENT_DRAWWEAPON: - case EVENT_ENTERLEVEL: - case EVENT_FAKEDOMOVETHINGS: - case EVENT_GETLOADTILE: - case EVENT_GETMENUTILE: - case EVENT_INIT: - case EVENT_LOGO: - return 0; - default: - return 1; - } - } - return 1; -} -*/ - -#define GetDefID(szGameLabel) hash_find(&h_gamevars,szGameLabel) -#define GetADefID(szGameLabel) hash_find(&h_arrays,szGameLabel) - -static inline int32_t isaltok(const char c) -{ - return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '\\' || - c == '*' || c == '-' || c == '_' || c == '.'); -} - -static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz) -{ - // find the label psz in the table pLabel. - // returns the ID for the label, or -1 - - int32_t l=-1; - - l = hash_findcase(tH,psz); - if (l>=0) l= pLabel[l].lId; - - return l; -} - -static inline int32_t C_GetLabelNameOffset(hashtable_t *tH, const char *psz) -{ - // find the label psz in the table pLabel. - // returns the offset in the array for the label, or -1 - - return hash_findcase(tH,psz); -} - -static void C_GetNextLabelName(void) -{ - int32_t i; - - C_SkipComments(); - - i = 0; - while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r') - label[(g_numLabels<<6)+(i++)] = *(textptr++); - - label[(g_numLabels<<6)+i] = 0; - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: got label `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); -} - -static int32_t C_GetKeyword(void) -{ - int32_t i; - char *temptextptr; - - C_SkipComments(); - - if (*textptr == '\0') // EOF - return 0; - - temptextptr = textptr; - - while (isaltok(*temptextptr) == 0) - { - temptextptr++; - if (*temptextptr == 0) - return 0; - } - - i = 0; - while (isaltok(*temptextptr)) - tempbuf[i++] = *(temptextptr++); - tempbuf[i] = 0; - return hash_find(&h_keywords,tempbuf); -} - -static int32_t C_GetNextKeyword(void) //Returns its code # -{ - int32_t i, l; - - C_SkipComments(); - - if (*textptr == 0) // EOF - return -1; - - l = 0; - while (isaltok(*(textptr+l)) && !(*(textptr + l) == '.')) - { - tempbuf[l] = textptr[l]; - l++; - } - while (isaltok(*(textptr+l))) - { - tempbuf[l] = textptr[l]; - l++; - } - tempbuf[l] = 0; - - i = hash_find(&h_keywords,tempbuf); - if (i>=0) - { - if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP) - *g_scriptPtr = i + (IFELSE_MAGIC<<12); - else *g_scriptPtr = i + (g_lineNumber<<12); - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - textptr += l; - g_scriptPtr++; - - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) - initprintf("%s:%d: debug: translating keyword `%s'.\n",g_szScriptFileName,g_lineNumber,keyw[i]); - return i; - } - - textptr += l; - - if (tempbuf[0] == '{' && tempbuf[1] != 0) - { - C_ReportError(-1); - initprintf("%s:%d: error: expected whitespace between `{' and `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf+1); - } - else if (tempbuf[0] == '}' && tempbuf[1] != 0) - { - C_ReportError(-1); - initprintf("%s:%d: error: expected whitespace between `}' and `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf+1); - } - else C_ReportError(ERROR_EXPECTEDKEYWORD); - g_numCompilerErrors++; - return -1; -} - -static void C_GetNextVarType(int32_t type) -{ - int32_t i=0,f=0; - - C_SkipComments(); - - if (!type && !g_labelsOnly && (isdigit(*textptr) || ((*textptr == '-') && (isdigit(*(textptr+1)))))) - { - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) - initprintf("%s:%d: debug: accepted constant %ld in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=MAXGAMEVARS; - if (tolower(textptr[1])=='x') - sscanf(textptr+2,"%" PRIxPTR "",g_scriptPtr); - else - *g_scriptPtr=atoi(textptr); - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - g_scriptPtr++; -#if 1 - while (!ispecial(*textptr) && *textptr != ']') textptr++; -#else - C_GetNextLabelName(); -#endif - return; - } - else if ((*textptr == '-')/* && !isdigit(*(textptr+1))*/) - { - if (!type) - { - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) - initprintf("%s:%d: debug: flagging gamevar as negative.\n",g_szScriptFileName,g_lineNumber); //,atol(textptr)); - f = (MAXGAMEVARS<<1); - } - else - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - C_GetNextLabelName(); - return; - } - - textptr++; - } - C_GetNextLabelName(); - - if (!g_skipKeywordCheck && hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return; - } - - C_SkipComments(); //skip comments and whitespace - if ((*textptr == '[')) //read of array as a gamevar - { - int32_t lLabelID = -1; - - f |= (MAXGAMEVARS<<2); - textptr++; - i=GetADefID(label+(g_numLabels<<6)); - if (i < 0) - { - i=GetDefID(label+(g_numLabels<<6)); - if (i < g_iSpriteVarID || i > g_iActorVarID) - i = -1; - - if (i < 0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEARRAY); - return; - } - f &= ~(MAXGAMEVARS<<2); // not an array - f |= (MAXGAMEVARS<<3); - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=(i|f); - C_GetNextVarType(0); - C_SkipComments(); - - if (*textptr != ']') - { - g_numCompilerErrors++; - C_ReportError(ERROR_GAMEARRAYBNC); - return; - } - textptr++; - - //writing arrays in this way is not supported because it would require too many changes to other code - - if (type) - { - g_numCompilerErrors++; - C_ReportError(ERROR_INVALIDARRAYWRITE); - return; - } - - if (f & (MAXGAMEVARS<<3)) - { - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - - if (*textptr != '.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - /*initprintf("found xxx label of '%s'\n", label+(g_numLabels<<6));*/ - - if (i == g_iSpriteVarID) - lLabelID=C_GetLabelNameOffset(&actorH,Bstrtolower(label+(g_numLabels<<6))); - else if (i == g_iSectorVarID) - lLabelID=C_GetLabelNameOffset(§orH,Bstrtolower(label+(g_numLabels<<6))); - else if (i == g_iWallVarID) - lLabelID=C_GetLabelNameOffset(&wallH,Bstrtolower(label+(g_numLabels<<6))); - else if (i == g_iPlayerVarID) - lLabelID=C_GetLabelNameOffset(&playerH,Bstrtolower(label+(g_numLabels<<6))); - else if (i == g_iActorVarID) - lLabelID=GetDefID(label+(g_numLabels<<6)); - - //printf("LabelID is %d\n",lLabelID); - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return; - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - - if (i == g_iSpriteVarID) - { - *g_scriptPtr++=ActorLabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); - if (ActorLabels[lLabelID].flags & LABEL_HASPARM2) - { - //printf("Member has PARM2\n"); - // get parm2 - // get the ID of the DEF - C_GetNextVarType(0); - } - } - else if (i == g_iSectorVarID) - *g_scriptPtr++=SectorLabels[lLabelID].lId; - else if (i == g_iWallVarID) - *g_scriptPtr++=SectorLabels[lLabelID].lId; - else if (i == g_iPlayerVarID) - { - *g_scriptPtr++=PlayerLabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); - if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) - { - //printf("Member has PARM2\n"); - // get parm2 - // get the ID of the DEF - C_GetNextVarType(0); - } - } - else if (i == g_iActorVarID) - *g_scriptPtr++=lLabelID; - } - return; - } -// initprintf("not an array"); - i=GetDefID(label+(g_numLabels<<6)); - if (i<0) //gamevar not found - { - if (!type && !g_labelsOnly) - { - //try looking for a define instead - Bstrcpy(tempbuf,label+(g_numLabels<<6)); - i = hash_find(&h_labels,tempbuf); - if (i>=0) - { - if (labeltype[i] & LABEL_DEFINE) - { - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) - initprintf("%s:%d: debug: accepted defined label `%s' instead of gamevar.\n",g_szScriptFileName,g_lineNumber,label+(i<<6)); - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=MAXGAMEVARS; - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=labelcode[i]; - return; - } - } - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEVAR); - return; - } - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEVAR); - textptr++; - return; - - } - if (type == GAMEVAR_READONLY && aGameVars[i].dwFlags & GAMEVAR_READONLY) - { - g_numCompilerErrors++; - C_ReportError(ERROR_VARREADONLY); - return; - } - else if (aGameVars[i].dwFlags & type) - { - g_numCompilerErrors++; - C_ReportError(ERROR_VARTYPEMISMATCH); - return; - } -/* - if ((aGameVars[i].dwFlags & GAMEVAR_SYNCCHECK) && g_parsingActorPtr && C_CheckEventSync(g_currentEvent)) - { - C_ReportError(-1); - initprintf("%s:%d: warning: found local gamevar `%s' used within %s; " - "expect multiplayer synchronization issues.\n",g_szScriptFileName, - g_lineNumber,label+(g_numLabels<<6),g_parsingEventPtr?"a synced event":"an actor"); - g_numCompilerWarnings++; - } -*/ - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: accepted gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=(i|f); -} - -#define C_GetNextVar() C_GetNextVarType(0) - -static inline void C_GetManyVarsType(int32_t type, int32_t num) -{ - int32_t i; - for (i=num-1; i>=0; i--) - C_GetNextVarType(type); -} - -#define C_GetManyVars(num) C_GetManyVarsType(0,num) - -static int32_t C_GetNextValue(int32_t type) -{ - int32_t i, l; - - C_SkipComments(); - - if (*textptr == 0) // EOF - return -1; - - l = 0; - while (isaltok(*(textptr+l))) - { - tempbuf[l] = textptr[l]; - l++; - } - tempbuf[l] = 0; - - if (!g_skipKeywordCheck && hash_find(&h_keywords,tempbuf /*label+(g_numLabels<<6)*/)>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - textptr+=l; - } - - i = hash_find(&h_labels,tempbuf); - if (i>=0) - { - char *el,*gl; - - if (labeltype[i] & type) - { - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - { - gl = (char *)C_GetLabelType(labeltype[i]); - initprintf("%s:%d: debug: accepted %s label `%s'.\n",g_szScriptFileName,g_lineNumber,gl,label+(i<<6)); - Bfree(gl); - } - if (labeltype[i] != LABEL_DEFINE && labelcode[i] >= (intptr_t)&script[0] && labelcode[i] < (intptr_t)&script[g_scriptSize]) - bitptr[(g_scriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_scriptPtr-script)&7)); - else bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *(g_scriptPtr++) = labelcode[i]; - textptr += l; - return labeltype[i]; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *(g_scriptPtr++) = 0; - textptr += l; - el = (char *)C_GetLabelType(type); - gl = (char *)C_GetLabelType(labeltype[i]); - C_ReportError(-1); - initprintf("%s:%d: warning: expected %s, found %s.\n",g_szScriptFileName,g_lineNumber,el,gl); - g_numCompilerWarnings++; - Bfree(el); - Bfree(gl); - return -1; // valid label name, but wrong type - } - - if (isdigit(*textptr) == 0 && *textptr != '-') - { - C_ReportError(ERROR_PARAMUNDEFINED); - g_numCompilerErrors++; - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = 0; - g_scriptPtr++; - textptr+=l; - return -1; // error! - } - - if (isdigit(*textptr) && g_labelsOnly) - { - C_ReportError(WARNING_LABELSONLY); - g_numCompilerWarnings++; - } - - i = l-1; - do - { - // FIXME: check for 0-9 A-F for hex - if (textptr[0] == '0' && textptr[1] == 'x') break; // kill the warning for hex - if (!isdigit(textptr[i--])) - { - C_ReportError(-1); - initprintf("%s:%d: warning: invalid character `%c' in definition!\n",g_szScriptFileName,g_lineNumber,textptr[i+1]); - g_numCompilerWarnings++; - break; - } - } - while (i > 0); - - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: accepted constant %ld.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - - if (tolower(textptr[1])=='x') - sscanf(textptr+2,"%" PRIxPTR "",g_scriptPtr); - else - *g_scriptPtr = atol(textptr); - - g_scriptPtr++; - - textptr += l; - - return 0; // literal value -} - -static inline int32_t C_IntPow2(int32_t v) -{ - return ((v!=0) && (v&(v-1))==0); -} - -static inline uint32_t C_Pow2IntLogBase2(int32_t v) -{ - static const uint32_t b[] = {0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, - 0xFF00FF00, 0xFFFF0000 - }; - register uint32_t r = (v & b[0]) != 0; - int32_t i = 4; - - for (; i > 0; i--) - r |= ((v & b[i]) != 0) << i; - - return r; -} - -static int32_t C_CheckMalformedBranch(intptr_t lastScriptPtr) -{ - switch (C_GetKeyword()) - { - case CON_RIGHTBRACE: - case CON_ENDA: - case CON_ENDEVENT: - case CON_ENDS: - case CON_ELSE: - g_scriptPtr = lastScriptPtr + &script[0]; - g_ifElseAborted = 1; - C_ReportError(-1); - g_numCompilerWarnings++; - initprintf("%s:%d: warning: malformed `%s' branch\n",g_szScriptFileName,g_lineNumber, - keyw[*(g_scriptPtr) & 0xFFF]); - return 1; - } - return 0; -} - -static int32_t C_CheckEmptyBranch(int32_t tw, intptr_t lastScriptPtr) -{ - // ifrnd and ifhitweapon actually do something when the condition is executed - if ((Bstrncmp(keyw[tw], "if", 2) && tw != CON_ELSE) || - tw == CON_IFRND || tw == CON_IFHITWEAPON) - { - g_ifElseAborted = 0; - return 0; - } - - if ((*(g_scriptPtr) & 0xFFF) != CON_NULLOP || *(g_scriptPtr)>>12 != IFELSE_MAGIC) - g_ifElseAborted = 0; - - if (g_ifElseAborted) - { - C_ReportError(-1); - g_numCompilerWarnings++; - g_scriptPtr = lastScriptPtr + &script[0]; - initprintf("%s:%d: warning: empty `%s' branch\n",g_szScriptFileName,g_lineNumber, - keyw[*(g_scriptPtr) & 0xFFF]); - *(g_scriptPtr) = (CON_NULLOP + (IFELSE_MAGIC<<12)); - return 1; - } - return 0; -} - -static int32_t C_ParseCommand(void); - -static int32_t C_CountCaseStatements() -{ - int32_t lCount; - char *temptextptr = textptr; - int32_t temp_ScriptLineNumber = g_lineNumber; - intptr_t scriptoffset = (unsigned)(g_scriptPtr-script); - intptr_t caseoffset = (unsigned)(g_caseScriptPtr-script); -// int32_t i; - - g_numCases=0; - g_caseScriptPtr=NULL; - //Bsprintf(g_szBuf,"CSS: %.12s",textptr); - //AddLog(g_szBuf); - while (C_ParseCommand() == 0) - { - //Bsprintf(g_szBuf,"CSSL: %.20s",textptr); - //AddLog(g_szBuf); - ; - } - // since we processed the endswitch, we need to re-increment g_checkingSwitch - g_checkingSwitch++; - - textptr=temptextptr; - g_scriptPtr = (intptr_t *)(script+scriptoffset); - - g_lineNumber = temp_ScriptLineNumber; - - lCount=g_numCases; - g_numCases=0; - g_caseScriptPtr = (intptr_t *)(script+caseoffset); - g_numCases = 0; - return lCount; -} - -static int32_t C_ParseCommand(void) -{ - int32_t i, j=0, k=0, done, tw, otw = g_lastKeyword; - char *temptextptr; - intptr_t *tempscrptr = NULL; - - if (quitevent) - { - initprintf("Aborted.\n"); - G_Shutdown(); - exit(0); - } - - if (g_numCompilerErrors > 63 || (*textptr == '\0') || (*(textptr+1) == '\0')) - return 1; - - if (g_scriptDebug) - C_ReportError(-1); - - if (g_checkingSwitch > 0) - { - //Bsprintf(g_szBuf,"PC(): '%.25s'",textptr); - //AddLog(g_szBuf); - } - g_lastKeyword = tw = C_GetNextKeyword(); - // Bsprintf(tempbuf,"%s",keyw[tw]); - // AddLog(tempbuf); - - if (C_SkipComments()) - return 1; - - switch (tw) - { - default: - case -1: - return 0; //End - case CON_STATE: - if (g_parsingActorPtr == 0 && g_processingState == 0) - { - C_GetNextLabelName(); - g_scriptPtr--; - labelcode[g_numLabels] = (intptr_t) g_scriptPtr; - labeltype[g_numLabels] = LABEL_STATE; - - g_processingState = 1; - Bsprintf(g_szCurrentBlockName,"%s",label+(g_numLabels<<6)); - hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0); - g_numLabels++; - return 0; - } - - C_GetNextLabelName(); - - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - i = hash_find(&h_gamevars,label+(g_numLabels<<6)); - if (i>=0) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_NAMEMATCHESVAR); - } - - j = hash_find(&h_labels,label+(g_numLabels<<6)); - if (j>=0) - { - if (labeltype[j] & LABEL_STATE) - { - if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) - initprintf("%s:%d: debug: accepted state label `%s'.\n",g_szScriptFileName,g_lineNumber,label+(j<<6)); - *g_scriptPtr = labelcode[j]; - if (labelcode[j] >= (intptr_t)&script[0] && labelcode[j] < (intptr_t)&script[g_scriptSize]) - bitptr[(g_scriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_scriptPtr-script)&7)); - else bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - g_scriptPtr++; - return 0; - } - else - { - char *gl = (char *)C_GetLabelType(labeltype[j]); - C_ReportError(-1); - initprintf("%s:%d: warning: expected state, found %s.\n",g_szScriptFileName,g_lineNumber,gl); - g_numCompilerWarnings++; - Bfree(gl); - *(g_scriptPtr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions - bitptr[(g_scriptPtr-script-1)>>3] &= ~(1<<((g_scriptPtr-script-1)&7)); - return 0; // valid label name, but wrong type - } - } - else - { - C_ReportError(-1); - initprintf("%s:%d: error: state `%s' not found.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - g_numCompilerErrors++; - } - g_scriptPtr++; - return 0; - - case CON_ENDS: - if (g_processingState == 0) - { - C_ReportError(-1); - initprintf("%s:%d: error: found `ends' without open `state'.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - } - // else - { - if (g_numBraces > 0) - { - C_ReportError(ERROR_OPENBRACKET); - g_numCompilerErrors++; - } - else if (g_numBraces < 0) - { - C_ReportError(ERROR_CLOSEBRACKET); - g_numCompilerErrors++; - } - if (g_checkingSwitch > 0) - { - C_ReportError(ERROR_NOENDSWITCH); - g_numCompilerErrors++; - - g_checkingSwitch = 0; // can't be checking anymore... - } - - g_processingState = 0; - Bsprintf(g_szCurrentBlockName,"(none)"); - } - return 0; - - case CON_SETTHISPROJECTILE: - case CON_SETPROJECTILE: -/* - if (!C_CheckEventSync(g_currentEvent)) - C_ReportError(WARNING_EVENTSYNC); -*/ - case CON_GETTHISPROJECTILE: - case CON_GETPROJECTILE: - { - int32_t lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while ((*textptr != '[')) - { - textptr++; - } - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - if (tw == CON_SETTHISPROJECTILE) - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameOffset(&projectileH,Bstrtolower(label+(g_numLabels<<6))); - //printf("LabelID is %d\n",lLabelID); - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=ProjectileLabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",PlayerLabels[lLabelID].flags); - - // now at target VAR... - - // get the ID of the DEF - switch (tw) - { - case CON_SETPROJECTILE: - case CON_SETTHISPROJECTILE: - C_GetNextVar(); - break; - default: - C_GetNextVarType(GAMEVAR_READONLY); - break; - } - break; - } - - case CON_GAMEVAR: - // syntax: gamevar - // defines var1 and sets initial value. - // flags are used to define usage - // (see top of this files for flags) - //printf("Got gamedef. Getting Label. '%.20s'\n",textptr); - - if (isdigit(*textptr) || (*textptr == '-')) - { - C_GetNextLabelName(); - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - C_GetNextValue(LABEL_DEFINE); - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr -= 3; // we complete the process anyways just to skip past the fucked up section - return 0; - } - - C_GetNextLabelName(); - //printf("Got Label '%.20s'\n",textptr); - // Check to see it's already defined - - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - //printf("Translating number '%.20s'\n",textptr); - C_GetNextValue(LABEL_DEFINE); // get initial value - //printf("Done Translating number. '%.20s'\n",textptr); - - C_GetNextValue(LABEL_DEFINE); // get flags - //Bsprintf(g_szBuf,"Adding GameVar='%s', val=%l, flags=%lX",label+(g_numLabels<<6), - // *(g_scriptPtr-2), *(g_scriptPtr-1)); - //AddLog(g_szBuf); - if ((*(g_scriptPtr-1)&GAMEVAR_USER_MASK)==3) - { - g_numCompilerWarnings++; - *(g_scriptPtr-1)^=GAMEVAR_PERPLAYER; - C_ReportError(WARNING_BADGAMEVAR); - } - Gv_NewVar(label+(g_numLabels<<6),*(g_scriptPtr-2), - (*(g_scriptPtr-1)) - // can't define default or secret - & (~(GAMEVAR_DEFAULT | GAMEVAR_SECRET)) - ); - //AddLog("Added gamevar"); - g_scriptPtr -= 3; // no need to save in script... - return 0; - - case CON_GAMEARRAY: - if (isdigit(*textptr) || (*textptr == '-')) - { - C_GetNextLabelName(); - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - C_GetNextValue(LABEL_DEFINE); - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr -= 2; // we complete the process anyways just to skip past the fucked up section - return 0; - } - C_GetNextLabelName(); - //printf("Got Label '%.20s'\n",textptr); - // Check to see it's already defined - - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - i = hash_find(&h_gamevars,label+(g_numLabels<<6)); - if (i>=0) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_NAMEMATCHESVAR); - } - - C_GetNextValue(LABEL_DEFINE); - Gv_NewArray(label+(g_numLabels<<6),*(g_scriptPtr-1)); - - g_scriptPtr -= 2; // no need to save in script... - return 0; - - - case CON_DEFINE: - { - //printf("Got definition. Getting Label. '%.20s'\n",textptr); - C_GetNextLabelName(); - //printf("Got label. '%.20s'\n",textptr); - // Check to see it's already defined - - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - i = hash_find(&h_gamevars,label+(g_numLabels<<6)); - if (i>=0) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_NAMEMATCHESVAR); - } - - i = hash_find(&h_labels,label+(g_numLabels<<6)); - if (i>=0) - { - /* if (i >= g_numDefaultLabels) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_DUPLICATEDEFINITION); - } */ - } - - //printf("Translating. '%.20s'\n",textptr); - C_GetNextValue(LABEL_DEFINE); - //printf("Translated. '%.20s'\n",textptr); - if (i == -1) - { - // printf("Defining Definition '%s' to be '%d'\n",label+(g_numLabels<<6),*(g_scriptPtr-1)); - hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0); - labeltype[g_numLabels] = LABEL_DEFINE; - labelcode[g_numLabels++] = *(g_scriptPtr-1); - if (*(g_scriptPtr-1) >= 0 && *(g_scriptPtr-1) < MAXTILES && g_dynamicTileMapping) - G_ProcessDynamicTileMapping(label+((g_numLabels-1)<<6),*(g_scriptPtr-1)); - } - g_scriptPtr -= 2; - return 0; - } - - case CON_PALFROM: - for (j=3; j>=0; j--) - { - if (C_GetKeyword() == -1) - C_GetNextValue(LABEL_DEFINE); - else break; - } - - while (j>-1) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = 0; - g_scriptPtr++; - j--; - } - return 0; - - case CON_MOVE: - if (g_parsingActorPtr || g_processingState) - { -/* - if (!C_CheckEventSync(g_currentEvent)) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_EVENTSYNC); - } -*/ - - if ((C_GetNextValue(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(g_scriptPtr-1) != 0) && (*(g_scriptPtr-1) != 1)) - { - C_ReportError(-1); - bitptr[(g_scriptPtr-script-1)>>3] &= ~(1<<((g_scriptPtr-script-1)&7)); - *(g_scriptPtr-1) = 0; - initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - } - - j = 0; - while (C_GetKeyword() == -1) - { - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j |= *g_scriptPtr; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = j; - - g_scriptPtr++; - } - else - { - g_scriptPtr--; - C_GetNextLabelName(); - // Check to see it's already defined - - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - if (hash_find(&h_gamevars,label+(g_numLabels<<6))>=0) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_NAMEMATCHESVAR); - } - - if ((i = hash_find(&h_labels,label+(g_numLabels<<6))) >= 0) - { - g_numCompilerWarnings++; - initprintf("%s:%d: warning: duplicate move `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - } - - if (i == -1) - { - hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0); - labeltype[g_numLabels] = LABEL_MOVE; - labelcode[g_numLabels++] = (intptr_t) g_scriptPtr; - } - - for (j=1; j>=0; j--) - { - if (C_GetKeyword() >= 0) break; - C_GetNextValue(LABEL_DEFINE); - } - - for (k=j; k>=0; k--) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = 0; - g_scriptPtr++; - } - } - return 0; - - case CON_MUSIC: - { - // NOTE: this doesn't get stored in the PCode... - - // music 1 stalker.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid - // thecall.mid ahgeez.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); // Volume Number (0/4) - g_scriptPtr--; - - k = *g_scriptPtr-1; - - if (k >= 0) // if it's background music - { - i = 0; - // get the file name... - while (C_GetKeyword() == -1) - { - C_SkipComments(); - j = 0; - tempbuf[j] = '/'; - while (isaltok(*(textptr+j))) - { - tempbuf[j+1] = textptr[j]; - j++; - } - tempbuf[j+1] = '\0'; - - if (MapInfo[(k*MAXLEVELS)+i].musicfn == NULL) - MapInfo[(k*MAXLEVELS)+i].musicfn = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t)); - else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[(k*MAXLEVELS)+i].musicfn)) - MapInfo[(k*MAXLEVELS)+i].musicfn = Brealloc(MapInfo[(k*MAXLEVELS)+i].musicfn,(Bstrlen(tempbuf)+1)); - - Bstrcpy(MapInfo[(k*MAXLEVELS)+i].musicfn,tempbuf); - - textptr += j; - if (i > MAXLEVELS-1) break; - i++; - } - } - else - { - i = 0; - while (C_GetKeyword() == -1) - { - C_SkipComments(); - j = 0; - - while (isaltok(*(textptr+j))) - { - EnvMusicFilename[i][j] = textptr[j]; - j++; - } - EnvMusicFilename[i][j] = '\0'; - - textptr += j; - if (i > MAXVOLUMES-1) break; - i++; - } - } - } - return 0; - - case CON_INCLUDE: - g_scriptPtr--; - - C_SkipComments(); - - j = 0; - while (isaltok(*textptr)) - { - tempbuf[j] = *(textptr++); - j++; - } - tempbuf[j] = '\0'; - - { - int32_t temp_ScriptLineNumber; - int32_t temp_ifelse_check; - char *origtptr, *mptr; - char parentScriptFileName[255]; - int32_t fp; - - fp = kopen4loadfrommod(tempbuf,g_loadFromGroupOnly); - if (fp < 0) - { - g_numCompilerErrors++; - initprintf("%s:%d: error: could not find file `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - return 0; - } - - j = kfilelength(fp); - - mptr = (char *)Bmalloc(j+1); - if (!mptr) - { - kclose(fp); - g_numCompilerErrors++; - initprintf("%s:%d: error: could not allocate %d bytes to include `%s'.\n", - g_szScriptFileName,g_lineNumber,j,tempbuf); - return 0; - } - - initprintf("Including: %s (%d bytes)\n",tempbuf, j); - kread(fp, mptr, j); - kclose(fp); - mptr[j] = 0; - - if (*textptr == '"') // skip past the closing quote if it's there so we don't screw up the next line - textptr++; - origtptr = textptr; - - Bstrcpy(parentScriptFileName, g_szScriptFileName); - Bstrcpy(g_szScriptFileName, tempbuf); - temp_ScriptLineNumber = g_lineNumber; - g_lineNumber = 1; - temp_ifelse_check = g_checkingIfElse; - g_checkingIfElse = 0; - - textptr = mptr; - - C_SkipComments(); - - do done = C_ParseCommand(); - while (!done); - - Bstrcpy(g_szScriptFileName, parentScriptFileName); - g_totalLines += g_lineNumber; - g_lineNumber = temp_ScriptLineNumber; - g_checkingIfElse = temp_ifelse_check; - - textptr = origtptr; - - Bfree(mptr); - } - return 0; - - case CON_AI: - if (g_parsingActorPtr || g_processingState) - { -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - C_GetNextValue(LABEL_AI); - } - else - { - g_scriptPtr--; - C_GetNextLabelName(); - - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - i = hash_find(&h_gamevars,label+(g_numLabels<<6)); - if (i>=0) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_NAMEMATCHESVAR); - } - - i = hash_find(&h_labels,label+(g_numLabels<<6)); - if (i>=0) - { - g_numCompilerWarnings++; - initprintf("%s:%d: warning: duplicate ai `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - } - - if (i == -1) - { - labeltype[g_numLabels] = LABEL_AI; - hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0); - labelcode[g_numLabels++] = (intptr_t) g_scriptPtr; - } - - for (j=0; j<3; j++) - { - if (C_GetKeyword() >= 0) break; - if (j == 1) - C_GetNextValue(LABEL_ACTION); - else if (j == 2) - { - if ((C_GetNextValue(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(g_scriptPtr-1) != 0) && (*(g_scriptPtr-1) != 1)) - { - C_ReportError(-1); - bitptr[(g_scriptPtr-script-1)>>3] &= ~(1<<((g_scriptPtr-script-1)&7)); - *(g_scriptPtr-1) = 0; - initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - } - k = 0; - while (C_GetKeyword() == -1) - { - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - k |= *g_scriptPtr; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = k; - g_scriptPtr++; - return 0; - } - } - for (k=j; k<3; k++) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = 0; - g_scriptPtr++; - } - } - return 0; - - case CON_ACTION: - if (g_parsingActorPtr || g_processingState) - { -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - C_GetNextValue(LABEL_ACTION); - } - else - { - g_scriptPtr--; - C_GetNextLabelName(); - // Check to see it's already defined - - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - i = hash_find(&h_gamevars,label+(g_numLabels<<6)); - if (i>=0) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_NAMEMATCHESVAR); - } - - i = hash_find(&h_labels,label+(g_numLabels<<6)); - if (i>=0) - { - g_numCompilerWarnings++; - initprintf("%s:%d: warning: duplicate action `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - } - - if (i == -1) - { - labeltype[g_numLabels] = LABEL_ACTION; - labelcode[g_numLabels] = (intptr_t) g_scriptPtr; - hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0); - g_numLabels++; - } - - for (j=4; j>=0; j--) - { - if (C_GetKeyword() >= 0) break; - C_GetNextValue(LABEL_DEFINE); - } - for (k=j; k>=0; k--) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *(g_scriptPtr++) = 0; - } - } - return 0; - - case CON_ACTOR: - case CON_USERACTOR: - case CON_EVENTLOADACTOR: - if (g_processingState || g_parsingActorPtr) - { - C_ReportError(ERROR_FOUNDWITHIN); - g_numCompilerErrors++; - } - - g_numBraces = 0; - g_scriptPtr--; - g_parsingActorPtr = g_scriptPtr; - - if (tw == CON_USERACTOR) - { - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - } - - C_SkipComments(); - j = 0; - while (isaltok(*(textptr+j))) - { - g_szCurrentBlockName[j] = textptr[j]; - j++; - } - g_szCurrentBlockName[j] = 0; - - if (tw == CON_USERACTOR) - { - j = *g_scriptPtr; - - if (j > 2) - { - C_ReportError(-1); - initprintf("%s:%d: warning: invalid useractor type.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - j = 0; - } - } - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - - if (tw == CON_EVENTLOADACTOR) - { - actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr; - g_checkingIfElse = 0; - return 0; - } - - actorscrptr[*g_scriptPtr] = g_parsingActorPtr; - - if (tw == CON_USERACTOR) - ActorType[*g_scriptPtr] = j; - - for (j=0; j<4; j++) - { - bitptr[(g_parsingActorPtr+j-script)>>3] &= ~(1<<((g_parsingActorPtr+j-script)&7)); - *(g_parsingActorPtr+j) = 0; - if (j == 3) - { - j = 0; - while (C_GetKeyword() == -1) - { - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j |= *g_scriptPtr; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = j; - g_scriptPtr++; - break; - } - else - { - if (C_GetKeyword() >= 0) - { - for (i=4-j; i; i--) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *(g_scriptPtr++) = 0; - } - break; - } - switch (j) - { - case 0: - C_GetNextValue(LABEL_DEFINE); - break; - case 1: - C_GetNextValue(LABEL_ACTION); - break; - case 2: - if ((C_GetNextValue(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(g_scriptPtr-1) != 0) && (*(g_scriptPtr-1) != 1)) - { - C_ReportError(-1); - bitptr[(g_scriptPtr-script-1)>>3] &= ~(1<<((g_scriptPtr-script-1)&7)); - *(g_scriptPtr-1) = 0; - initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - } - break; - } - if (*(g_scriptPtr-1) >= (intptr_t)&script[0] && *(g_scriptPtr-1) < (intptr_t)&script[g_scriptSize]) - bitptr[(g_parsingActorPtr+j-script)>>3] |= (BITPTR_POINTER<<((g_parsingActorPtr+j-script)&7)); - else bitptr[(g_parsingActorPtr+j-script)>>3] &= ~(1<<((g_parsingActorPtr+j-script)&7)); - *(g_parsingActorPtr+j) = *(g_scriptPtr-1); - } - } - g_checkingIfElse = 0; - return 0; - - case CON_ONEVENT: - if (g_processingState || g_parsingActorPtr) - { - C_ReportError(ERROR_FOUNDWITHIN); - g_numCompilerErrors++; - } - - g_numBraces = 0; - g_scriptPtr--; - g_parsingEventPtr = g_scriptPtr; - g_parsingActorPtr = g_scriptPtr; - - C_SkipComments(); - j = 0; - while (isaltok(*(textptr+j))) - { - g_szCurrentBlockName[j] = textptr[j]; - j++; - } - g_szCurrentBlockName[j] = 0; -// g_labelsOnly = 1; - C_GetNextValue(LABEL_DEFINE); - g_labelsOnly = 0; - g_scriptPtr--; - j= *g_scriptPtr; // type of event - g_currentEvent = j; - //Bsprintf(g_szBuf,"Adding Event for %d at %lX",j, g_parsingEventPtr); - //AddLog(g_szBuf); - if (j > MAXGAMEEVENTS-1 || j < 0) - { - initprintf("%s:%d: error: invalid event ID.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - return 0; - } - // if event has already been declared then store previous script location - if (apScriptGameEvent[j]) - { - previous_event =apScriptGameEvent[j]; - } - apScriptGameEvent[j]=g_parsingEventPtr; - - g_checkingIfElse = 0; - - return 0; - - case CON_INSERTSPRITEQ: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - return 0; - - case CON_QSPRINTF: - C_GetManyVars(2); - - j = 0; - - while (C_GetKeyword() == -1 && j < 32) - C_GetNextVar(), j++; - - *g_scriptPtr++ = CON_NULLOP + (g_lineNumber<<12); - return 0; - - case CON_ESPAWN: - case CON_ESHOOT: - case CON_QSPAWN: - case CON_EQSPAWN: - case CON_STRENGTH: - case CON_SHOOT: - case CON_ADDPHEALTH: - case CON_SPAWN: - case CON_CSTAT: - case CON_COUNT: - case CON_ENDOFGAME: - case CON_SPRITEPAL: - case CON_CACTOR: - case CON_MONEY: - case CON_ADDKILLS: - case CON_DEBUG: - case CON_ADDSTRENGTH: - case CON_CSTATOR: - case CON_MAIL: - case CON_PAPER: - case CON_SLEEPTIME: - case CON_CLIPDIST: - case CON_LOTSOFGLASS: - case CON_SAVENN: - case CON_SAVE: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_ANGOFF: - case CON_QUOTE: - case CON_SOUND: - case CON_GLOBALSOUND: - case CON_SOUNDONCE: - case CON_STOPSOUND: - C_GetNextValue(LABEL_DEFINE); - if (tw == CON_CSTAT) - { - if (*(g_scriptPtr-1) == 32767) - { - *(g_scriptPtr-1) = 32768; - C_ReportError(-1); - initprintf("%s:%d: warning: tried to set cstat 32767, using 32768 instead.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - } - else if ((*(g_scriptPtr-1) & 32) && (*(g_scriptPtr-1) & 16)) - { - i = *(g_scriptPtr-1); - *(g_scriptPtr-1) ^= 48; - C_ReportError(-1); - initprintf("%s:%d: warning: tried to set cstat %d, using %d instead.\n",g_szScriptFileName,g_lineNumber,i,(int32_t)(*(g_scriptPtr-1))); - g_numCompilerWarnings++; - } - } - return 0; - - case CON_HITRADIUSVAR: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - C_GetManyVars(5); - break; - case CON_HITRADIUS: - C_GetNextValue(LABEL_DEFINE); - C_GetNextValue(LABEL_DEFINE); - C_GetNextValue(LABEL_DEFINE); - case CON_ADDAMMO: - case CON_ADDWEAPON: - case CON_SIZETO: - case CON_SIZEAT: - case CON_DEBRIS: - case CON_ADDINVENTORY: - case CON_GUTS: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - C_GetNextValue(LABEL_DEFINE); - C_GetNextValue(LABEL_DEFINE); - break; - - case CON_ELSE: - if (g_checkingIfElse) - { - intptr_t offset; - intptr_t lastScriptPtr = g_scriptPtr - &script[0] - 1; - - g_ifElseAborted = 0; - g_checkingIfElse--; - - if (C_CheckMalformedBranch(lastScriptPtr)) - return 0; - - tempscrptr = g_scriptPtr; - offset = (unsigned)(tempscrptr-script); - g_scriptPtr++; //Leave a spot for the fail location - C_ParseCommand(); - - if (C_CheckEmptyBranch(tw, lastScriptPtr)) - return 0; - - tempscrptr = (intptr_t *)script+offset; - *tempscrptr = (intptr_t) g_scriptPtr; - bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); - } - else - { - g_scriptPtr--; - tempscrptr = g_scriptPtr; - g_numCompilerWarnings++; - C_ReportError(-1); - - initprintf("%s:%d: warning: found `else' with no `if'.\n",g_szScriptFileName,g_lineNumber); - - if (C_GetKeyword() == CON_LEFTBRACE) - { - C_GetNextKeyword(); - g_numBraces++; - - do - done = C_ParseCommand(); - while (done == 0); - } - else C_ParseCommand(); - - g_scriptPtr = tempscrptr; - } - return 0; - - case CON_SETSECTOR: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GETSECTOR: - { - int32_t lLabelID; - - // syntax getsector[].x - // gets the value of sector[].xxx into - - // now get name of .xxx - while ((*textptr != '[')) - { - textptr++; - } - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameID(SectorLabels,§orH,Bstrtolower(label+(g_numLabels<<6))); - - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=lLabelID; - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETSECTOR) - C_GetNextVarType(GAMEVAR_READONLY); - else - C_GetNextVar(); - break; - } - - case CON_FINDNEARACTOR: - case CON_FINDNEARACTOR3D: - case CON_FINDNEARSPRITE: - case CON_FINDNEARSPRITE3D: - case CON_FINDNEARACTORZ: - case CON_FINDNEARSPRITEZ: - { - // syntax findnearactor - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - - C_GetNextValue(LABEL_DEFINE); // get - C_GetNextValue(LABEL_DEFINE); // get maxdist - - switch (tw) - { - case CON_FINDNEARACTORZ: - case CON_FINDNEARSPRITEZ: - C_GetNextValue(LABEL_DEFINE); - default: - break; - } - - // target var - // get the ID of the DEF - C_GetNextVarType(GAMEVAR_READONLY); - break; - } - - case CON_FINDNEARACTORVAR: - case CON_FINDNEARACTOR3DVAR: - case CON_FINDNEARSPRITEVAR: - case CON_FINDNEARSPRITE3DVAR: - case CON_FINDNEARACTORZVAR: - case CON_FINDNEARSPRITEZVAR: - { - C_GetNextValue(LABEL_DEFINE); // get - - // get the ID of the DEF - C_GetNextVar(); - switch (tw) - { - case CON_FINDNEARACTORZVAR: - case CON_FINDNEARSPRITEZVAR: - C_GetNextVar(); - default: - break; - } - // target var - // get the ID of the DEF - C_GetNextVarType(GAMEVAR_READONLY); - break; - } - - case CON_SQRT: - { - // syntax sqrt - // gets the sqrt of invar into outvar - - // get the ID of the DEF - C_GetNextVar(); - // target var - // get the ID of the DEF - C_GetNextVarType(GAMEVAR_READONLY); - break; - } - - case CON_SETWALL: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GETWALL: - { - int32_t lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while ((*textptr != '[')) - { - textptr++; - } - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameID(WallLabels,&wallH,Bstrtolower(label+(g_numLabels<<6))); - - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=lLabelID; - - // now at target VAR... - - // get the ID of the DEF - if (tw == CON_GETWALL) - C_GetNextVarType(GAMEVAR_READONLY); - else - C_GetNextVar(); - break; - } - - case CON_SETPLAYER: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GETPLAYER: - { - int32_t lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while ((*textptr != '[')) - { - textptr++; - } - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameOffset(&playerH,Bstrtolower(label+(g_numLabels<<6))); - //printf("LabelID is %d\n",lLabelID); - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=PlayerLabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",PlayerLabels[lLabelID].flags); - if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) - { - //printf("Member has PARM2\n"); - // get parm2 - // get the ID of the DEF - C_GetNextVar(); - } - else - { - //printf("Member does not have Parm2\n"); - } - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETPLAYER) - C_GetNextVarType(GAMEVAR_READONLY); - else - C_GetNextVar(); - break; - } - - case CON_SETINPUT: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GETINPUT: - { - int32_t lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while ((*textptr != '[')) - { - textptr++; - } - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameOffset(&inputH,Bstrtolower(label+(g_numLabels<<6))); - //printf("LabelID is %d\n",lLabelID); - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=InputLabels[lLabelID].lId; - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETINPUT) - C_GetNextVarType(GAMEVAR_READONLY); - else - C_GetNextVar(); - break; - } - - case CON_SETUSERDEF: - case CON_GETUSERDEF: - { - int32_t lLabelID; - - // syntax [gs]etuserdef.x - // gets the value of ud.xxx into - - // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameID(UserdefsLabels,&userdefH,Bstrtolower(label+(g_numLabels<<6))); - - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=lLabelID; - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETUSERDEF) - C_GetNextVarType(GAMEVAR_READONLY); - else - C_GetNextVar(); - break; - } - - case CON_SETACTORVAR: - case CON_SETPLAYERVAR: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GETACTORVAR: - case CON_GETPLAYERVAR: - { - // syntax [gs]etactorvar[]. - // gets the value of the per-actor variable varx into VAR - - // now get name of - while ((*textptr != '[')) - { - textptr++; - } - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of . - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - - if (g_scriptPtr[-1] == g_iThisActorID) // convert to "setvarvar" - { - g_scriptPtr--; - g_scriptPtr[-1]=CON_SETVARVAR; - if (tw == CON_SETACTORVAR || tw == CON_SETPLAYERVAR) - { - C_GetNextVarType(GAMEVAR_READONLY); - C_GetNextVar(); - } - else - { - g_scriptPtr++; - C_GetNextVar(); - g_scriptPtr-=2; - C_GetNextVarType(GAMEVAR_READONLY); - g_scriptPtr++; - } - break; - } - - /// now pointing at 'xxx' - - // get the ID of the DEF - C_GetNextLabelName(); - //printf("found label of '%s'\n", label+(g_numLabels<<6)); - - // Check to see if it's a keyword - if (hash_find(&h_keywords,label+(g_numLabels<<6))>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 0; - } - - i=GetDefID(label+(g_numLabels<<6)); - //printf("Label '%s' ID is %d\n",label+(g_numLabels<<6), i); - if (i<0) - { - // not a defined DEF - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEVAR); - return 0; - } - if (aGameVars[i].dwFlags & GAMEVAR_READONLY) - { - g_numCompilerErrors++; - C_ReportError(ERROR_VARREADONLY); - return 0; - } - - switch (tw) - { - case CON_SETACTORVAR: - { - if (!(aGameVars[i].dwFlags & GAMEVAR_PERACTOR)) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: variable `%s' is not per-actor.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - return 0; - } - break; - } - case CON_SETPLAYERVAR: - { - if (!(aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: variable `%s' is not per-player.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - return 0; - } - break; - } - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=i; // the ID of the DEF (offset into array...) - - switch (tw) - { - case CON_GETACTORVAR: - case CON_GETPLAYERVAR: - C_GetNextVarType(GAMEVAR_READONLY); - break; - default: - C_GetNextVar(); - break; - } - break; - } - - case CON_SETACTOR: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GETACTOR: - { - int32_t lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while ((*textptr != '[')) - textptr++; - - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of .xxx - - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - - if (*textptr != '.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameOffset(&actorH,Bstrtolower(label+(g_numLabels<<6))); - //printf("LabelID is %d\n",lLabelID); - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=ActorLabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); - if (ActorLabels[lLabelID].flags & LABEL_HASPARM2) - { - //printf("Member has PARM2\n"); - // get parm2 - // get the ID of the DEF - C_GetNextVar(); - } - - // now at target VAR... - - // get the ID of the DEF - if (tw == CON_GETACTOR) - C_GetNextVarType(GAMEVAR_READONLY); - else - C_GetNextVar(); - break; - } - - case CON_GETTSPR: - case CON_SETTSPR: - { - int32_t lLabelID; - - if (g_currentEvent != EVENT_ANIMATESPRITES) - { - C_ReportError(-1); - initprintf("%s:%d: warning: found `%s' outside of EVENT_ANIMATESPRITES\n",g_szScriptFileName,g_lineNumber,tempbuf); - g_numCompilerWarnings++; - } - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while ((*textptr != '[')) - { - textptr++; - } - if (*textptr == '[') - textptr++; - - // get the ID of the DEF - g_labelsOnly = 1; - C_GetNextVar(); - g_labelsOnly = 0; - // now get name of .xxx - while (*textptr != '.') - { - if (*textptr == 0xa) - break; - if (!*textptr) - break; - - textptr++; - } - if (*textptr!='.') - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - return 0; - } - textptr++; - /// now pointing at 'xxx' - C_GetNextLabelName(); - //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - - lLabelID=C_GetLabelNameOffset(&tspriteH,Bstrtolower(label+(g_numLabels<<6))); - //printf("LabelID is %d\n",lLabelID); - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=TsprLabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); - - // now at target VAR... - - // get the ID of the DEF - if (tw == CON_GETTSPR) - C_GetNextVarType(GAMEVAR_READONLY); - else - C_GetNextVar(); - break; - } - - case CON_STOPACTORSOUND: - C_GetManyVars(2); - break; - - case CON_SECTOROFWALL: - C_GetNextVarType(GAMEVAR_READONLY); - C_GetNextVar(); - return 0; - - case CON_GETTICKS: -/* - if (C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_REVEVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GETCURRADDRESS: - C_GetNextVarType(GAMEVAR_READONLY); - return 0; - - case CON_ESHOOTVAR: - case CON_ESPAWNVAR: - case CON_QSPAWNVAR: - case CON_EQSPAWNVAR: - case CON_OPERATERESPAWNS: - case CON_OPERATEMASTERSWITCHES: - case CON_CHECKACTIVATORMOTION: - case CON_TIME: - case CON_INITTIMER: - case CON_LOCKPLAYER: - case CON_SHOOTVAR: - case CON_QUAKE: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_JUMP: - case CON_CMENU: - case CON_SOUNDVAR: - case CON_GLOBALSOUNDVAR: - case CON_STOPSOUNDVAR: - case CON_SOUNDONCEVAR: - case CON_ANGOFFVAR: - case CON_CHECKAVAILWEAPON: - case CON_CHECKAVAILINVEN: - case CON_GUNIQHUDID: - case CON_SAVEGAMEVAR: - case CON_READGAMEVAR: - case CON_USERQUOTE: - case CON_STARTTRACKVAR: - case CON_CLEARMAPSTATE: - case CON_ACTIVATECHEAT: - case CON_SETGAMEPALETTE: - C_GetNextVar(); - return 0; - - case CON_ENHANCED: - { - // don't store in pCode... - g_scriptPtr--; - //printf("We are enhanced, baby...\n"); - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - if (*g_scriptPtr > BYTEVERSION_JF) - { - g_numCompilerWarnings++; - initprintf("%s:%d: warning: need build %d, found build %d\n",g_szScriptFileName,g_lineNumber,k,BYTEVERSION_JF); - } - break; - } - - case CON_DYNAMICREMAP: - { - g_scriptPtr--; - if (g_dynamicTileMapping++) - { - initprintf("%s:%d: warning: duplicate dynamicremap statement\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - } - else initprintf("Using dynamic tile remapping\n"); - break; - } - - case CON_RANDVAR: - case CON_ZSHOOT: - case CON_EZSHOOT: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_SETVAR: - case CON_ADDVAR: - case CON_SUBVAR: - case CON_DISPLAYRANDVAR: - case CON_MULVAR: - case CON_DIVVAR: - case CON_MODVAR: - case CON_ANDVAR: - case CON_ORVAR: - case CON_XORVAR: - case CON_SHIFTVARL: - case CON_SHIFTVARR: - - { - intptr_t *inst = g_scriptPtr-1; - char *tptr = textptr; - // syntax: [rand|add|set]var - // sets var1 to const1 - // adds const1 to var1 (const1 can be negative...) - //printf("Found [add|set]var at line= %d\n",g_lineNumber); - - // get the ID of the DEF - if (tw != CON_ZSHOOT && tw != CON_EZSHOOT) - C_GetNextVarType(GAMEVAR_READONLY); - else C_GetNextVar(); - - C_GetNextValue(LABEL_DEFINE); // the number to check against... - - if (tw == CON_MULVAR && *(g_scriptPtr-1) == -1) - { - *inst = CON_INV; - g_scriptPtr--; - return 0; - } - - if (tw == CON_DIVVAR || (tw == CON_MULVAR && *(g_scriptPtr-1) > 0)) - { - int32_t i = *(g_scriptPtr-1); - j = klabs(*(g_scriptPtr-1)); - - if (C_IntPow2(j)) - { - *inst = ((tw == CON_DIVVAR) ? CON_SHIFTVARR : CON_SHIFTVARL); - *(g_scriptPtr-1) = C_Pow2IntLogBase2(j); -// initprintf("%s:%d: replacing multiply/divide with shift\n",g_szScriptFileName,g_lineNumber); - - if (i == j) - return 0; - - *g_scriptPtr++ = CON_INV + (g_lineNumber<<12); - textptr = tptr; - C_GetNextVarType(GAMEVAR_READONLY); - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; -// initprintf("%s:%d: adding inversion\n",g_szScriptFileName,g_lineNumber); - } - } - } - return 0; - case CON_WRITEARRAYTOFILE: - case CON_READARRAYFROMFILE: - C_GetNextLabelName(); - i=GetADefID(label+(g_numLabels<<6)); - if (i > (-1)) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=i; - } - else - { - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEARRAY); - return 1; - } - C_GetNextValue(LABEL_DEFINE); - return 0; - case CON_COPY: - C_GetNextLabelName(); - i=GetADefID(label+(g_numLabels<<6)); - if (i > (-1)) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=i; - } - else - { - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEARRAY); - return 1; - } - C_SkipComments();// skip comments and whitespace - if (*textptr != '[') - - { - g_numCompilerErrors++; - C_ReportError(ERROR_GAMEARRAYBNO); - return 1; - } - textptr++; - C_GetNextVar(); - C_SkipComments();// skip comments and whitespace - if (*textptr != ']') - { - g_numCompilerErrors++; - C_ReportError(ERROR_GAMEARRAYBNC); - return 1; - } - textptr++; - case CON_SETARRAY: - C_GetNextLabelName(); - i=GetADefID(label+(g_numLabels<<6)); - if (i > (-1)) - { - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=i; - } - else - { - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEARRAY); - return 1; - } - - C_SkipComments();// skip comments and whitespace - if (*textptr != '[') - { - g_numCompilerErrors++; - C_ReportError(ERROR_GAMEARRAYBNO); - return 1; - } - textptr++; - C_GetNextVar(); - C_SkipComments();// skip comments and whitespace - if (*textptr != ']') - { - g_numCompilerErrors++; - C_ReportError(ERROR_GAMEARRAYBNC); - return 1; - } - textptr++; - C_GetNextVar(); - return 0; - case CON_GETARRAYSIZE: - case CON_RESIZEARRAY: - C_GetNextLabelName(); - i=GetADefID(label+(g_numLabels<<6)); - if (i < 0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_NOTAGAMEARRAY); - return 1; - } - - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=i; - - C_SkipComments(); - C_GetNextVar(); - return 0; - - case CON_RANDVARVAR: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_SETVARVAR: - case CON_ADDVARVAR: - case CON_SUBVARVAR: - case CON_MULVARVAR: - case CON_DIVVARVAR: - case CON_MODVARVAR: - case CON_ANDVARVAR: - case CON_ORVARVAR: - case CON_XORVARVAR: - case CON_DISPLAYRANDVARVAR: - case CON_SIN: - case CON_COS: - C_GetNextVarType(GAMEVAR_READONLY); - C_GetNextVar(); - return 0; - - case CON_SMAXAMMO: - case CON_ADDWEAPONVAR: - case CON_ACTIVATEBYSECTOR: - case CON_OPERATESECTORS: - case CON_OPERATEACTIVATORS: - case CON_SSP: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_GMAXAMMO: - case CON_DIST: - case CON_LDIST: - case CON_GETINCANGLE: - case CON_GETANGLE: - case CON_MULSCALE: - case CON_SETASPECT: - // get the ID of the DEF - switch (tw) - { - case CON_DIST: - case CON_LDIST: - case CON_GETANGLE: - case CON_GETINCANGLE: - C_GetNextVarType(GAMEVAR_READONLY); - break; - default: - C_GetNextVar(); - break; - } - - // get the ID of the DEF - if (tw == CON_GMAXAMMO) - C_GetNextVarType(GAMEVAR_READONLY); - else C_GetNextVar(); - - switch (tw) - { - case CON_DIST: - case CON_LDIST: - case CON_GETANGLE: - case CON_GETINCANGLE: - C_GetNextVar(); - break; - case CON_MULSCALE: - C_GetManyVars(2); - break; - } - return 0; - - case CON_FLASH: - case CON_SAVEMAPSTATE: - case CON_LOADMAPSTATE: - return 0; - - case CON_DRAGPOINT: - case CON_GETKEYNAME: - C_GetManyVars(3); - return 0; - - case CON_GETFLORZOFSLOPE: - case CON_GETCEILZOFSLOPE: - C_GetManyVars(3); - C_GetNextVarType(GAMEVAR_READONLY); - return 0; - - case CON_DEFINEPROJECTILE: - { - int32_t y; - int32_t z; - - if (g_processingState || g_parsingActorPtr) - { - C_ReportError(ERROR_FOUNDWITHIN); - g_numCompilerErrors++; - } - - g_scriptPtr--; - - C_GetNextValue(LABEL_DEFINE); - j = *(g_scriptPtr-1); - - if (j > MAXTILES-1) - { - C_ReportError(ERROR_EXCEEDSMAXTILES); - g_numCompilerErrors++; - } - - C_GetNextValue(LABEL_DEFINE); - y = *(g_scriptPtr-1); - C_GetNextValue(LABEL_DEFINE); - z = *(g_scriptPtr-1); - - C_SetProjectile(j,y,z); - SpriteFlags[j] |= SPRITE_PROJECTILE; - return 0; - } - - case CON_SPRITEFLAGS: - { - if (g_parsingActorPtr == 0 && g_processingState == 0) - { - g_scriptPtr--; - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j = *g_scriptPtr; - - if (j > MAXTILES-1) - { - C_ReportError(ERROR_EXCEEDSMAXTILES); - g_numCompilerErrors++; - } - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - SpriteFlags[j] = *g_scriptPtr; - - return 0; - } -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - C_GetNextVar(); - return 0; - } - - case CON_SPRITESHADOW: - case CON_SPRITENVG: - case CON_SPRITENOSHADE: - case CON_SPRITENOPAL: - case CON_PRECACHE: - { - if (g_processingState || g_parsingActorPtr) - { - C_ReportError(ERROR_FOUNDWITHIN); - g_numCompilerErrors++; - } - - g_scriptPtr--; - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j = *g_scriptPtr; - - if (j > MAXTILES-1) - { - C_ReportError(ERROR_EXCEEDSMAXTILES); - g_numCompilerErrors++; - } - - switch (tw) - { - case CON_SPRITESHADOW: - SpriteFlags[*g_scriptPtr] |= SPRITE_SHADOW; - break; - case CON_SPRITENVG: - SpriteFlags[*g_scriptPtr] |= SPRITE_NVG; - break; - case CON_SPRITENOSHADE: - SpriteFlags[*g_scriptPtr] |= SPRITE_NOSHADE; - break; - case CON_SPRITENOPAL: - SpriteFlags[*g_scriptPtr] |= SPRITE_NOPAL; - break; - case CON_PRECACHE: - SpriteCacheList[*g_scriptPtr][0] = j; - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - i = *g_scriptPtr; - if (i > MAXTILES-1) - { - C_ReportError(ERROR_EXCEEDSMAXTILES); - g_numCompilerErrors++; - } - SpriteCacheList[j][1] = i; - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - i = *g_scriptPtr; - SpriteCacheList[j][2] = i; - break; - } - return 0; - } - - case CON_IFACTORSOUND: - case CON_IFVARVARG: - case CON_IFVARVARL: - case CON_IFVARVARE: - case CON_IFVARVARN: - case CON_IFVARVARAND: - case CON_IFVARVAROR: - case CON_IFVARVARXOR: - case CON_IFVARVAREITHER: - case CON_WHILEVARVARN: - { - intptr_t offset; - intptr_t lastScriptPtr = g_scriptPtr - &script[0] - 1; - - g_ifElseAborted = 0; - - C_GetManyVars(2); - - if (C_CheckMalformedBranch(lastScriptPtr)) - return 0; - - tempscrptr = g_scriptPtr; - offset = (unsigned)(g_scriptPtr-script); - g_scriptPtr++; // Leave a spot for the fail location - - C_ParseCommand(); - - if (C_CheckEmptyBranch(tw, lastScriptPtr)) - return 0; - - tempscrptr = (intptr_t *)script+offset; - *tempscrptr = (intptr_t) g_scriptPtr; - bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); - - if (tw != CON_WHILEVARVARN) - { - j = C_GetKeyword(); - - if (j == CON_ELSE || j == CON_LEFTBRACE) - g_checkingIfElse++; - } - return 0; - } - - case CON_SPGETLOTAG: - case CON_SPGETHITAG: - case CON_SECTGETLOTAG: - case CON_SECTGETHITAG: - case CON_GETTEXTUREFLOOR: - case CON_GETTEXTURECEILING: - // no paramaters... - return 0; - - case CON_STARTTRACK: - // one parameter (track#) - C_GetNextValue(LABEL_DEFINE); - return 0; - - case CON_IFVARL: - case CON_IFVARG: - case CON_IFVARE: - case CON_IFVARN: - case CON_IFVARAND: - case CON_IFVAROR: - case CON_IFVARXOR: - case CON_IFVAREITHER: - case CON_WHILEVARN: - { - intptr_t offset; - intptr_t lastScriptPtr = (g_scriptPtr-script-1); - - g_ifElseAborted = 0; - // get the ID of the DEF - C_GetNextVar(); - C_GetNextValue(LABEL_DEFINE); // the number to check against... - - if (C_CheckMalformedBranch(lastScriptPtr)) - return 0; - - tempscrptr = g_scriptPtr; - offset = (unsigned)(tempscrptr-script); - g_scriptPtr++; //Leave a spot for the fail location - - C_ParseCommand(); - - if (C_CheckEmptyBranch(tw, lastScriptPtr)) - return 0; - - tempscrptr = (intptr_t *)script+offset; - *tempscrptr = (intptr_t) g_scriptPtr; - bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); - - if (tw != CON_WHILEVARN) - { - j = C_GetKeyword(); - - if (j == CON_ELSE || j == CON_LEFTBRACE) - g_checkingIfElse++; - } - - return 0; - } - case CON_ADDLOGVAR: - - // syntax: addlogvar - - // prints the line number in the log file. - /* *g_scriptPtr=g_lineNumber; - g_scriptPtr++; */ - - // get the ID of the DEF - C_GetNextVar(); - return 0; - - case CON_ROTATESPRITE16: - case CON_ROTATESPRITE: - if (g_parsingEventPtr == 0 && g_processingState == 0) - { - C_ReportError(ERROR_EVENTONLY); - g_numCompilerErrors++; - } - - // syntax: - // int32_t x, int32_t y, int32_t z, short a, short tilenum, int8_t shade, char orientation, x1, y1, x2, y2 - // myospal adds char pal - - // get the ID of the DEFs - - C_GetManyVars(12); - break; - - case CON_SHOWVIEW: - if (g_parsingEventPtr == 0 && g_processingState == 0) - { - C_ReportError(ERROR_EVENTONLY); - g_numCompilerErrors++; - } - - C_GetManyVars(10); - break; - - case CON_GETZRANGE: - C_GetManyVars(4); - C_GetManyVarsType(GAMEVAR_READONLY,4); - C_GetManyVars(2); - break; - - case CON_SECTSETINTERPOLATION: - case CON_SECTCLEARINTERPOLATION: - C_GetNextVar(); - break; - - case CON_CLIPMOVE: - case CON_CLIPMOVENOSLIDE: - // ,,,z,, xvect,yvect,walldist,floordist,ceildist,clipmask - C_GetManyVarsType(GAMEVAR_READONLY,3); - C_GetNextVar(); - C_GetNextVarType(GAMEVAR_READONLY); - C_GetManyVars(6); - break; - - case CON_CALCHYPOTENUSE: - C_GetNextVarType(GAMEVAR_READONLY); - C_GetManyVars(2); - break; - - case CON_LINEINTERSECT: - case CON_RAYINTERSECT: - // lineintersect x y z x y z x y x y - // rayintersect x y z vx vy vz x y x y - C_GetManyVars(10); - C_GetManyVarsType(GAMEVAR_READONLY,4); - break; - - case CON_HITSCAN: - case CON_CANSEE: - // get the ID of the DEF - C_GetManyVars(tw==CON_CANSEE?8:7); - C_GetManyVarsType(GAMEVAR_READONLY,tw==CON_CANSEE?1:6); - if (tw==CON_HITSCAN) C_GetNextVar(); - break; - - case CON_CANSEESPR: - C_GetManyVars(2); - C_GetNextVarType(GAMEVAR_READONLY); - break; - - case CON_NEARTAG: - C_GetManyVars(5); - C_GetManyVarsType(GAMEVAR_READONLY,4); - C_GetManyVars(2); - break; - - case CON_ROTATEPOINT: - C_GetManyVars(5); - C_GetManyVarsType(GAMEVAR_READONLY,2); - break; - - case CON_GETTIMEDATE: - C_GetManyVarsType(GAMEVAR_READONLY,8); - break; - - case CON_MOVESPRITE: - case CON_SETSPRITE: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - C_GetManyVars(4); - if (tw == CON_MOVESPRITE) - { - C_GetNextVar(); - C_GetNextVarType(GAMEVAR_READONLY); - } - break; - - case CON_MINITEXT: - case CON_GAMETEXT: - case CON_GAMETEXTZ: - case CON_DIGITALNUMBER: - case CON_DIGITALNUMBERZ: - if (g_parsingEventPtr == 0 && g_processingState == 0) - { - C_ReportError(ERROR_EVENTONLY); - g_numCompilerErrors++; - } - - switch (tw) - { - case CON_GAMETEXTZ: - case CON_DIGITALNUMBERZ: - C_GetManyVars(1); - case CON_GAMETEXT: - case CON_DIGITALNUMBER: - C_GetManyVars(6); - default: - C_GetManyVars(5); - break; - } - break; - - case CON_UPDATESECTOR: - case CON_UPDATESECTORZ: - C_GetManyVars(2); - if (tw==CON_UPDATESECTORZ) - C_GetNextVar(); - C_GetNextVarType(GAMEVAR_READONLY); - break; - - case CON_MYOS: - case CON_MYOSPAL: - case CON_MYOSX: - case CON_MYOSPALX: - if (g_parsingEventPtr == 0 && g_processingState == 0) - { - C_ReportError(ERROR_EVENTONLY); - g_numCompilerErrors++; - } - - // syntax: - // int32_t x, int32_t y, short tilenum, int8_t shade, char orientation - // myospal adds char pal - - C_GetManyVars(5); - if (tw==CON_MYOSPAL || tw==CON_MYOSPALX) - { - // Parse: pal - - // get the ID of the DEF - C_GetNextVar(); - } - break; - - case CON_FINDPLAYER: - case CON_FINDOTHERPLAYER: - case CON_DISPLAYRAND: - - // syntax: displayrand - // gets rand (not game rand) into - - // Get The ID of the DEF - C_GetNextVarType(GAMEVAR_READONLY); - break; - - case CON_SWITCH: - { - intptr_t tempoffset; - - //AddLog("Got Switch statement"); - if (g_checkingSwitch) - { - // Bsprintf(g_szBuf,"ERROR::%s %d: g_checkingSwitch=",__FILE__,__LINE__, g_checkingSwitch); - // AddLog(g_szBuf); - } - g_checkingSwitch++; // allow nesting (if other things work) - // Get The ID of the DEF - C_GetNextVar(); - - tempscrptr= g_scriptPtr; - tempoffset = (unsigned)(tempscrptr-script); - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=0; // leave spot for end location (for after processing) - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=0; // count of case statements - g_caseScriptPtr=g_scriptPtr; // the first case's pointer. - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=0; // leave spot for 'default' location (null if none) - - temptextptr=textptr; - // probably does not allow nesting... - - //AddLog("Counting Case Statements..."); - - j=C_CountCaseStatements(); -// initprintf("Done Counting Case Statements for switch %d: found %d.\n", g_checkingSwitch,j); - g_scriptPtr+=j*2; - C_SkipComments(); - g_scriptPtr-=j*2; // allocate buffer for the table - tempscrptr = (intptr_t *)(script+tempoffset); - - //AddLog(g_szBuf); - if (g_checkingSwitch>1) - { - // Bsprintf(g_szBuf,"ERROR::%s %d: g_checkingSwitch=",__FILE__,__LINE__, g_checkingSwitch); - // AddLog(g_szBuf); - } - if (j<0) - { - return 1; - } - if (tempscrptr) - { - tempscrptr[1]=(intptr_t)j; // save count of cases - } - else - { - //Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); - //AddLog(g_szBuf); - } - - while (j--) - { - // leave room for statements - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=0; // value check - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=0; // code offset - C_SkipComments(); - } - - //Bsprintf(g_szBuf,"SWITCH1: '%.22s'",textptr); - //AddLog(g_szBuf); - - g_numCases=0; - while (C_ParseCommand() == 0) - { - //Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr); - //AddLog(g_szBuf); - } - tempscrptr = (intptr_t *)(script+tempoffset); - - //Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); - //AddLog(g_szBuf); - // done processing switch. clean up. - if (g_checkingSwitch<1) - { - // Bsprintf(g_szBuf,"ERROR::%s %d: g_checkingSwitch=%d",__FILE__,__LINE__, g_checkingSwitch); - // AddLog(g_szBuf); - } - g_numCases=0; - if (tempscrptr) - { - intptr_t t,n; - for (i=3; i<3+tempscrptr[1]*2-2; i+=2) // sort them - { - t=tempscrptr[i]; n=i; - for (j=i+2; j<3+tempscrptr[1]*2; j+=2) - if (tempscrptr[j]>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); - } - else - { - //Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); - //AddLog(g_szBuf); - } - g_caseScriptPtr=NULL; - // decremented in endswitch. Don't decrement here... - // g_checkingSwitch--; // allow nesting (maybe if other things work) - tempscrptr=NULL; - if (g_checkingSwitch) - { - //Bsprintf(g_szBuf,"ERROR::%s %d: g_checkingSwitch=%d",__FILE__,__LINE__, g_checkingSwitch); - //AddLog(g_szBuf); - } - //AddLog("End of Switch statement"); - } - break; - - case CON_CASE: - { - intptr_t tempoffset = 0; - //AddLog("Found Case"); - - if (g_checkingSwitch < 1) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: found `case' statement when not in switch\n",g_szScriptFileName,g_lineNumber); - g_scriptPtr--; - return 1; - } - -repeatcase: - g_scriptPtr--; // don't save in code - g_numCases++; - //Bsprintf(g_szBuf,"case1: %.12s",textptr); - //AddLog(g_szBuf); - C_GetNextValue(LABEL_DEFINE); - if (*textptr == ':') - textptr++; - //Bsprintf(g_szBuf,"case2: %.12s",textptr); - //AddLog(g_szBuf); - - j= *(--g_scriptPtr); // get value - //Bsprintf(g_szBuf,"case: Value of case %d is %d",(int32_t)g_numCases,(int32_t)j); - //AddLog(g_szBuf); - if (g_caseScriptPtr) - { - for (i=(g_numCases/2)-1; i>=0; i--) - if (g_caseScriptPtr[i*2+1]==j) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_DUPLICATECASE); - break; - } - //AddLog("Adding value to script"); - g_caseScriptPtr[g_numCases++]=j; // save value - g_caseScriptPtr[g_numCases]=(intptr_t)((intptr_t *)g_scriptPtr-&script[0]); // save offset - } - // j = C_GetKeyword(); - //Bsprintf(g_szBuf,"case3: %.12s",textptr); - //AddLog(g_szBuf); - - if (C_GetKeyword() == CON_CASE) - { - //AddLog("Found Repeat Case"); - C_GetNextKeyword(); // eat 'case' - goto repeatcase; - } - //Bsprintf(g_szBuf,"case4: '%.12s'",textptr); - //AddLog(g_szBuf); - tempoffset = (unsigned)(tempscrptr-script); - - while (C_ParseCommand() == 0) - { - //Bsprintf(g_szBuf,"case5 '%.25s'",textptr); - //AddLog(g_szBuf); - if (C_GetKeyword() == CON_CASE) - { - //AddLog("Found Repeat Case"); - C_GetNextKeyword(); // eat 'case' - tempscrptr = (intptr_t *)(script+tempoffset); - goto repeatcase; - } - } - tempscrptr = (intptr_t *)(script+tempoffset); - //AddLog("End Case"); - return 0; - // break; - } - case CON_DEFAULT: - g_scriptPtr--; // don't save - - C_SkipComments(); - - if (*textptr == ':') - textptr++; - - if (g_checkingSwitch<1) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: found `default' statement when not in switch\n",g_szScriptFileName,g_lineNumber); - return 1; - } - if (g_caseScriptPtr && g_caseScriptPtr[0]!=0) - { - // duplicate default statement - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: multiple `default' statements found in switch\n",g_szScriptFileName,g_lineNumber); - } - if (g_caseScriptPtr) - { - g_caseScriptPtr[0]=(intptr_t)(g_scriptPtr-&script[0]); // save offset -// bitptr[(g_caseScriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_caseScriptPtr-script)&7)); - } - //Bsprintf(g_szBuf,"default: '%.22s'",textptr); - //AddLog(g_szBuf); - while (C_ParseCommand() == 0) - { - //Bsprintf(g_szBuf,"defaultParse: '%.22s'",textptr); - //AddLog(g_szBuf); - ; - } - break; - - case CON_ENDSWITCH: - //AddLog("End Switch"); - g_checkingSwitch--; - if (g_checkingSwitch < 0) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: found `endswitch' without matching `switch'\n",g_szScriptFileName,g_lineNumber); - } - return 1; // end of block - break; - - case CON_QSTRNCAT: - C_GetManyVars(3); - return 0; - case CON_CHANGESPRITESTAT: - case CON_CHANGESPRITESECT: - case CON_ZSHOOTVAR: - case CON_EZSHOOTVAR: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_EVENTSYNC); - } -*/ - case CON_GETPNAME: - case CON_STARTLEVEL: - case CON_QSTRCAT: - case CON_QSTRCPY: - case CON_QSTRLEN: - case CON_QGETSYSSTR: - case CON_HEADSPRITESTAT: - case CON_PREVSPRITESTAT: - case CON_NEXTSPRITESTAT: - case CON_HEADSPRITESECT: - case CON_PREVSPRITESECT: - case CON_NEXTSPRITESECT: - C_GetManyVars(2); - return 0; - case CON_QSUBSTR: - C_GetManyVars(4); - return 0; - case CON_SETACTORANGLE: - case CON_SETPLAYERANGLE: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - g_numCompilerWarnings++; - C_ReportError(WARNING_EVENTSYNC); - } -*/ - case CON_GETANGLETOTARGET: - case CON_GETACTORANGLE: - case CON_GETPLAYERANGLE: - // Syntax: - - // get the ID of the DEF - C_GetNextVar(); - return 0; - - case CON_ADDLOG: - // syntax: addlog - - // prints the line number in the log file. - /* *g_scriptPtr=g_lineNumber; - g_scriptPtr++; */ - return 0; - - case CON_IFRND: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_IFPDISTL: - case CON_IFPDISTG: - case CON_IFWASWEAPON: - case CON_IFACTIONCOUNT: - case CON_IFCOUNT: - case CON_IFACTOR: - case CON_IFSTRENGTH: - case CON_IFSPAWNEDBY: - case CON_IFGAPZL: - case CON_IFFLOORDISTL: - case CON_IFCEILINGDISTL: - // case 74: - case CON_IFPHEALTHL: - case CON_IFSPRITEPAL: - case CON_IFGOTWEAPONCE: - case CON_IFANGDIFFL: - case CON_IFSOUND: - case CON_IFAI: - case CON_IFACTION: - case CON_IFMOVE: - case CON_IFP: - case CON_IFPINVENTORY: - { - intptr_t offset; - intptr_t lastScriptPtr = (g_scriptPtr-&script[0]-1); - - g_ifElseAborted = 0; - - switch (tw) - { - case CON_IFAI: - C_GetNextValue(LABEL_AI); - break; - case CON_IFACTION: - C_GetNextValue(LABEL_ACTION); - break; - case CON_IFMOVE: - if ((C_GetNextValue(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(g_scriptPtr-1) != 0) && (*(g_scriptPtr-1) != 1)) - { - C_ReportError(-1); - *(g_scriptPtr-1) = 0; - initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - } - break; - case CON_IFPINVENTORY: - C_GetNextValue(LABEL_DEFINE); - C_GetNextValue(LABEL_DEFINE); - break; - case CON_IFP: - j = 0; - do - { - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j |= *g_scriptPtr; - } - while (C_GetKeyword() == -1); - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr = j; - g_scriptPtr++; - break; - case CON_IFSOUND: - case CON_IFACTORSOUND: -/* - if (C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_REVEVENTSYNC); - g_numCompilerWarnings++; - } -*/ - default: - C_GetNextValue(LABEL_DEFINE); - break; - } - - if (C_CheckMalformedBranch(lastScriptPtr)) - return 0; - - tempscrptr = g_scriptPtr; - offset = (unsigned)(tempscrptr-script); - - g_scriptPtr++; //Leave a spot for the fail location - - C_ParseCommand(); - - if (C_CheckEmptyBranch(tw, lastScriptPtr)) - return 0; - - tempscrptr = (intptr_t *)script+offset; - *tempscrptr = (intptr_t) g_scriptPtr; - bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); - - j = C_GetKeyword(); - - if (j == CON_ELSE || j == CON_LEFTBRACE) - g_checkingIfElse++; - - return 0; - } - - case CON_IFCLIENT: - case CON_IFSERVER: - case CON_IFONWATER: - case CON_IFINWATER: - case CON_IFACTORNOTSTAYPUT: - case CON_IFCANSEE: - case CON_IFHITWEAPON: - case CON_IFSQUISHED: - case CON_IFDEAD: - case CON_IFCANSHOOTTARGET: - case CON_IFHITSPACE: - case CON_IFOUTSIDE: - case CON_IFMULTIPLAYER: - case CON_IFINSPACE: - case CON_IFBULLETNEAR: - case CON_IFRESPAWN: - case CON_IFINOUTERSPACE: - case CON_IFNOTMOVING: - case CON_IFAWAYFROMWALL: - case CON_IFCANSEETARGET: - case CON_IFNOSOUNDS: - { - intptr_t offset; - intptr_t lastScriptPtr = (g_scriptPtr-&script[0]-1); - - g_ifElseAborted = 0; - - if (C_CheckMalformedBranch(lastScriptPtr)) - return 0; - - tempscrptr = g_scriptPtr; - offset = (unsigned)(tempscrptr-script); - - g_scriptPtr++; //Leave a spot for the fail location - - C_ParseCommand(); - - if (C_CheckEmptyBranch(tw, lastScriptPtr)) - return 0; - - tempscrptr = (intptr_t *)script+offset; - *tempscrptr = (intptr_t) g_scriptPtr; - bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); - - j = C_GetKeyword(); - - if (j == CON_ELSE || j == CON_LEFTBRACE) - g_checkingIfElse++; - - return 0; - } - - case CON_LEFTBRACE: - if (!(g_processingState || g_parsingActorPtr || g_parsingEventPtr)) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYNTAXERROR); - } - /* if (C_GetKeyword() == CON_NULLOP) - { - // initprintf("%s:%d: warning: 'nullop' statement has no effect\n",g_szScriptFileName,g_lineNumber); - C_GetNextKeyword(); - g_scriptPtr--; - } - */ -#if 0 - if (C_GetKeyword() == CON_RIGHTBRACE) // rewrite "{ }" into "nullop" - { -// initprintf("%s:%d: rewriting empty braces '{ }' as 'nullop' from left\n",g_szScriptFileName,g_lineNumber); - *(--g_scriptPtr) = CON_NULLOP; - C_GetNextKeyword(); - g_scriptPtr--; - return 0; - } -#endif - g_numBraces++; - - do - done = C_ParseCommand(); - while (done == 0); - return 0; - - case CON_RIGHTBRACE: - g_numBraces--; - - if ((*(g_scriptPtr-2)>>12) == (IFELSE_MAGIC) && - ((*(g_scriptPtr-2) & 0xFFF) == CON_LEFTBRACE)) // rewrite "{ }" into "nullop" - { -// initprintf("%s:%d: rewriting empty braces '{ }' as 'nullop' from right\n",g_szScriptFileName,g_lineNumber); - *(g_scriptPtr-2) = CON_NULLOP + (IFELSE_MAGIC<<12); - g_scriptPtr -= 2; - - if (C_GetKeyword() != CON_ELSE && (*(g_scriptPtr-2)&0xFFF) != CON_ELSE) - g_ifElseAborted = 1; - else g_ifElseAborted = 0; - - j = C_GetKeyword(); - - if (g_checkingIfElse && j != CON_ELSE) - g_checkingIfElse--; - - return 1; - } - - if (g_numBraces < 0) - { - if (g_checkingSwitch) - { - C_ReportError(ERROR_NOENDSWITCH); - } - - C_ReportError(-1); - initprintf("%s:%d: error: found more `}' than `{'.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - } - if (g_checkingIfElse && j != CON_ELSE) - g_checkingIfElse--; - - return 1; - - case CON_BETANAME: - g_scriptPtr--; - j = 0; - C_NextLine(); - return 0; - - case CON_DEFINEVOLUMENAME: - g_scriptPtr--; - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j = *g_scriptPtr; - C_SkipComments(); - - if (j < 0 || j > MAXVOLUMES-1) - { - initprintf("%s:%d: error: volume number exceeds maximum volume count.\n", - g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - C_NextLine(); - break; - } - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - EpisodeNames[j][i] = toupper(*textptr); - textptr++,i++; - if (i >= (signed)sizeof(EpisodeNames[j])-1) - { - initprintf("%s:%d: warning: truncating volume name to %d characters.\n", - g_szScriptFileName,g_lineNumber,(int32_t)sizeof(EpisodeNames[j])-1); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - g_numVolumes = j+1; - EpisodeNames[j][i] = '\0'; - return 0; - - case CON_DEFINEGAMEFUNCNAME: - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j = *g_scriptPtr; - C_SkipComments(); - - if (j < 0 || j > NUMGAMEFUNCTIONS-1) - { - initprintf("%s:%d: error: function number exceeds number of game functions.\n", - g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - C_NextLine(); - break; - } - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - gamefunctions[j][i] = *textptr; - keydefaults[j*3][i] = *textptr; - textptr++,i++; - if (*textptr != 0x0a && *textptr != 0x0d && ispecial(*textptr)) - { - initprintf("%s:%d: warning: invalid character in function name.\n", - g_szScriptFileName,g_lineNumber); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - if (i >= MAXGAMEFUNCLEN-1) - { - initprintf("%s:%d: warning: truncating function name to %d characters.\n", - g_szScriptFileName,g_lineNumber,MAXGAMEFUNCLEN); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - gamefunctions[j][i] = '\0'; - keydefaults[j*3][i] = '\0'; - hash_add(&h_gamefuncs,gamefunctions[j],j,0); - { - char *str = Bstrtolower(Bstrdup(gamefunctions[j])); - hash_add(&h_gamefuncs,str,j,0); - Bfree(str); - } - - return 0; - - case CON_DEFINESKILLNAME: - g_scriptPtr--; - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j = *g_scriptPtr; - C_SkipComments(); - - if (j < 0 || j > 4) - { - initprintf("%s:%d: error: skill number exceeds maximum skill count.\n", - g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - C_NextLine(); - break; - } - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - SkillNames[j][i] = toupper(*textptr); - textptr++,i++; - if (i >= (signed)sizeof(SkillNames[j])-1) - { - initprintf("%s:%d: warning: truncating skill name to %d characters.\n", - g_szScriptFileName,g_lineNumber,(int32_t)sizeof(SkillNames[j])-1); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - SkillNames[j][i] = '\0'; - return 0; - - case CON_SETGAMENAME: - { - char gamename[32]; - g_scriptPtr--; - - C_SkipComments(); - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - gamename[i] = *textptr; - textptr++,i++; - if (i >= (signed)sizeof(gamename)-1) - { - initprintf("%s:%d: warning: truncating game name to %d characters.\n", - g_szScriptFileName,g_lineNumber,(int32_t)sizeof(gamename)-1); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - gamename[i] = '\0'; - g_gameNamePtr = Bstrdup(gamename); - Bsprintf(tempbuf,"%s - " APPNAME,g_gameNamePtr); - wm_setapptitle(tempbuf); - } - return 0; - - case CON_SETDEFNAME: - { - g_scriptPtr--; - C_SkipComments(); - - j = 0; - while (isaltok(*textptr)) - { - tempbuf[j] = *(textptr++); - j++; - } - tempbuf[j] = '\0'; - g_defNamePtr = Bstrdup(tempbuf); - initprintf("Using DEF file: %s.\n",g_defNamePtr); - } - return 0; - - case CON_SETCFGNAME: - { - g_scriptPtr--; - C_SkipComments(); - - j = 0; - while (isaltok(*textptr)) - { - tempbuf[j] = *(textptr++); - j++; - } - tempbuf[j] = '\0'; - if (Bstrcmp(setupfilename,SETUPFILENAME) == 0) // not set to something else via -cfg - { - char temp[BMAX_PATH]; - struct stat st; - int32_t fullscreen = ud.config.ScreenMode; - int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP; - int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick; -#ifdef USE_OPENGL - int32_t glrm = glrendmode; -#endif - - if (Bstat(g_modDir, &st) < 0) - { - if (errno == ENOENT) // path doesn't exist - { - if (Bmkdir(g_modDir, S_IRWXU) < 0) - { - OSD_Printf("Failed to create configuration file directory %s\n", g_modDir); - return 0; - } - else OSD_Printf("Created configuration file directory %s\n", g_modDir); - } - else - { - // another type of failure - return 0; - } - } - else if ((st.st_mode & S_IFDIR) != S_IFDIR) - { - // directory isn't a directory - return 0; - } - - Bstrcpy(temp,tempbuf); - CONFIG_WriteSetup(1); - if (g_modDir[0] != '/') - Bsprintf(setupfilename,"%s/",g_modDir); - else setupfilename[0] = 0; - Bstrcat(setupfilename,temp); - - initprintf("Using config file '%s'.\n",setupfilename); - - CONFIG_ReadSetup(); - - ud.config.ScreenMode = fullscreen; - ud.config.ScreenWidth = xdim; - ud.config.ScreenHeight = ydim; - ud.config.ScreenBPP = bpp; - ud.config.UseMouse = usemouse; - ud.config.UseJoystick = usejoy; -#ifdef USE_OPENGL - glrendmode = glrm; -#endif - - } - } - return 0; - - case CON_DEFINEGAMETYPE: - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j = *g_scriptPtr; - - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - GametypeFlags[j] = *g_scriptPtr; - - C_SkipComments(); - - if (j < 0 || j > MAXGAMETYPES-1) - { - initprintf("%s:%d: error: gametype number exceeds maximum gametype count.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - C_NextLine(); - break; - } - g_numGametypes = j+1; - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - GametypeNames[j][i] = toupper(*textptr); - textptr++,i++; - if (i >= (signed)sizeof(GametypeNames[j])-1) - { - initprintf("%s:%d: warning: truncating gametype name to %d characters.\n", - g_szScriptFileName,g_lineNumber,(int32_t)sizeof(GametypeNames[j])-1); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - GametypeNames[j][i] = '\0'; - return 0; - - case CON_DEFINELEVELNAME: - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - j = *g_scriptPtr; - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - k = *g_scriptPtr; - C_SkipComments(); - - if (j < 0 || j > MAXVOLUMES-1) - { - initprintf("%s:%d: error: volume number exceeds maximum volume count.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - C_NextLine(); - break; - } - if (k < 0 || k > MAXLEVELS-1) - { - initprintf("%s:%d: error: level number exceeds maximum number of levels per episode.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - C_NextLine(); - break; - } - - i = 0; - - tempbuf[i] = '/'; - - while (*textptr != ' ' && *textptr != '\t' && *textptr != 0x0a) - { - tempbuf[i+1] = *textptr; - textptr++,i++; - if (i >= BMAX_PATH) - { - initprintf("%s:%d: error: level file name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,BMAX_PATH); - g_numCompilerErrors++; - while (*textptr != ' ' && *textptr != '\t') textptr++; - break; - } - } - tempbuf[i+1] = '\0'; - - Bcorrectfilename(tempbuf,0); - - if (MapInfo[j *MAXLEVELS+k].filename == NULL) - MapInfo[j *MAXLEVELS+k].filename = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t)); - else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].filename)) - MapInfo[j *MAXLEVELS+k].filename = Brealloc(MapInfo[j*MAXLEVELS+k].filename,(Bstrlen(tempbuf)+1)); - - Bstrcpy(MapInfo[j*MAXLEVELS+k].filename,tempbuf); - - C_SkipComments(); - - MapInfo[j *MAXLEVELS+k].partime = - (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+ - (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC); - - textptr += 5; - while (*textptr == ' ' || *textptr == '\t') textptr++; - - MapInfo[j *MAXLEVELS+k].designertime = - (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+ - (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC); - - textptr += 5; - while (*textptr == ' ' || *textptr == '\t') textptr++; - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - tempbuf[i] = Btoupper(*textptr); - textptr++,i++; - if (i >= 32) - { - initprintf("%s:%d: warning: truncating level name to %d characters.\n", - g_szScriptFileName,g_lineNumber,32); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - - tempbuf[i] = '\0'; - - if (MapInfo[j*MAXLEVELS+k].name == NULL) - MapInfo[j*MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t)); - else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].name)) - MapInfo[j *MAXLEVELS+k].name = Brealloc(MapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1)); - - /* initprintf("level name string len: %d\n",Bstrlen(tempbuf)); */ - - Bstrcpy(MapInfo[j*MAXLEVELS+k].name,tempbuf); - - return 0; - - case CON_DEFINEQUOTE: - case CON_REDEFINEQUOTE: - if (tw == CON_DEFINEQUOTE) - { - g_scriptPtr--; - } - - C_GetNextValue(LABEL_DEFINE); - - k = *(g_scriptPtr-1); - - if (k >= MAXQUOTES) - { - initprintf("%s:%d: error: quote number exceeds limit of %d.\n",g_szScriptFileName,g_lineNumber,MAXQUOTES); - g_numCompilerErrors++; - } - - if (ScriptQuotes[k] == NULL) - ScriptQuotes[k] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t)); - - if (!ScriptQuotes[k]) - { - ScriptQuotes[k] = NULL; - Bsprintf(tempbuf,"Failed allocating %" PRIdPTR " byte quote text buffer.",sizeof(uint8_t) * MAXQUOTELEN); - G_GameExit(tempbuf); - } - - if (tw == CON_DEFINEQUOTE) - g_scriptPtr--; - - i = 0; - - while (*textptr == ' ' || *textptr == '\t') - textptr++; - - if (tw == CON_REDEFINEQUOTE) - { - if (ScriptQuoteRedefinitions[g_numQuoteRedefinitions] == NULL) - ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t)); - if (!ScriptQuoteRedefinitions[g_numQuoteRedefinitions]) - { - ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = NULL; - Bsprintf(tempbuf,"Failed allocating %" PRIdPTR " byte quote text buffer.",sizeof(uint8_t) * MAXQUOTELEN); - G_GameExit(tempbuf); - } - } - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - /* - if (*textptr == '%' && *(textptr+1) == 's') - { - initprintf("%s:%d: error: quote text contains string identifier.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; - break; - } - */ - if (tw == CON_DEFINEQUOTE) - *(ScriptQuotes[k]+i) = *textptr; - else - *(ScriptQuoteRedefinitions[g_numQuoteRedefinitions]+i) = *textptr; - textptr++,i++; - if (i >= MAXQUOTELEN-1) - { - initprintf("%s:%d: warning: truncating quote text to %d characters.\n",g_szScriptFileName,g_lineNumber,MAXQUOTELEN-1); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - if (tw == CON_DEFINEQUOTE) - *(ScriptQuotes[k]+i) = '\0'; - else - { - *(ScriptQuoteRedefinitions[g_numQuoteRedefinitions]+i) = '\0'; - bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); - *g_scriptPtr++=g_numQuoteRedefinitions; - g_numQuoteRedefinitions++; - } - return 0; - - case CON_CHEATKEYS: - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); - CheatKeys[0] = *(g_scriptPtr-1); - C_GetNextValue(LABEL_DEFINE); - CheatKeys[1] = *(g_scriptPtr-1); - g_scriptPtr -= 2; - return 0; - - case CON_DEFINECHEAT: - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); - k = *(g_scriptPtr-1); - - if (k > 25) - { - initprintf("%s:%d: error: cheat redefinition attempts to redefine nonexistent cheat.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - C_NextLine(); - break; - } - g_scriptPtr--; - i = 0; - while (*textptr == ' ' || *textptr == '\t') - textptr++; - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') - { - CheatStrings[k][i] = *textptr; - textptr++,i++; - if (i >= (signed)sizeof(CheatStrings[k])-1) - { - initprintf("%s:%d: warning: truncating cheat string to %d characters.\n", - g_szScriptFileName,g_lineNumber,MAXCHEATLEN); //,sizeof(CheatStrings[k])-1); - g_numCompilerWarnings++; - C_NextLine(); - break; - } - } - CheatStrings[k][i] = '\0'; - return 0; - - case CON_DEFINESOUND: - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); - k = *(g_scriptPtr-1); - if (k >= MAXSOUNDS) - { - initprintf("%s:%d: error: exceeded sound limit of %d.\n",g_szScriptFileName,g_lineNumber,MAXSOUNDS); - g_numCompilerErrors++; - } - g_scriptPtr--; - i = 0; - C_SkipComments(); - - if (g_sounds[k].filename == NULL) - g_sounds[k].filename = Bcalloc(BMAX_PATH,sizeof(uint8_t)); - if (!g_sounds[k].filename) - { - Bsprintf(tempbuf,"Failed allocating %" PRIdPTR " byte buffer.",sizeof(uint8_t) * BMAX_PATH); - G_GameExit(tempbuf); - } - - if (*textptr == '\"') - { - textptr++; - while (*textptr && *textptr != '\"') - { - g_sounds[k].filename[i++] = *textptr++; - if (i >= BMAX_PATH) - { - initprintf("%s:%d: error: sound filename exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,BMAX_PATH); - g_numCompilerErrors++; - C_SkipComments(); - break; - } - } - textptr++; - } - else while (*textptr != ' ' && *textptr != '\t' && *textptr != '\r' && *textptr != '\n') - { - g_sounds[k].filename[i++] = *textptr++; - if (i >= BMAX_PATH) - { - initprintf("%s:%d: error: sound filename exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,BMAX_PATH); - g_numCompilerErrors++; - C_SkipComments(); - break; - } - } - g_sounds[k].filename[i] = '\0'; - - C_GetNextValue(LABEL_DEFINE); - g_sounds[k].ps = *(g_scriptPtr-1); - C_GetNextValue(LABEL_DEFINE); - g_sounds[k].pe = *(g_scriptPtr-1); - C_GetNextValue(LABEL_DEFINE); - g_sounds[k].pr = *(g_scriptPtr-1); - C_GetNextValue(LABEL_DEFINE); - g_sounds[k].m = *(g_scriptPtr-1); - C_GetNextValue(LABEL_DEFINE); - g_sounds[k].vo = *(g_scriptPtr-1); - g_scriptPtr -= 5; - - if (k > g_maxSoundPos) - g_maxSoundPos = k; - return 0; - - case CON_ENDEVENT: - - if (g_parsingEventPtr == 0) - { - C_ReportError(-1); - initprintf("%s:%d: error: found `endevent' without open `onevent'.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - } - if (g_numBraces > 0) - { - C_ReportError(ERROR_OPENBRACKET); - g_numCompilerErrors++; - } - if (g_numBraces < 0) - { - C_ReportError(ERROR_CLOSEBRACKET); - g_numCompilerErrors++; - } - // if event has already been declared then put a jump in instead - if (previous_event) - { - g_scriptPtr--; - *(g_scriptPtr++) = CON_JUMP; - *(g_scriptPtr++) = MAXGAMEVARS; - *(g_scriptPtr++) = previous_event-script; - *(g_scriptPtr++) = CON_ENDEVENT; - previous_event = NULL; - } - g_parsingEventPtr = g_parsingActorPtr = 0; - g_currentEvent = -1; - Bsprintf(g_szCurrentBlockName,"(none)"); - return 0; - - case CON_ENDA: - if (g_parsingActorPtr == 0) - { - C_ReportError(-1); - initprintf("%s:%d: error: found `enda' without open `actor'.\n",g_szScriptFileName,g_lineNumber); - g_numCompilerErrors++; - } - if (g_numBraces > 0) - { - C_ReportError(ERROR_OPENBRACKET); - g_numCompilerErrors++; - } - if (g_numBraces < 0) - { - C_ReportError(ERROR_CLOSEBRACKET); - g_numCompilerErrors++; - } - g_parsingActorPtr = 0; - Bsprintf(g_szCurrentBlockName,"(none)"); - return 0; - - case CON_RETURN: - case CON_BREAK: - if (g_checkingSwitch) - { - if (otw == CON_BREAK) - { - C_ReportError(-1); - initprintf("%s:%d: warning: duplicate `break'.\n",g_szScriptFileName, g_lineNumber); - g_numCompilerWarnings++; - g_scriptPtr--; - return 0; - } - return 1; - } - return 0; - - case CON_SCRIPTSIZE: - g_scriptPtr--; - C_GetNextValue(LABEL_DEFINE); - j = *(g_scriptPtr-1); - g_scriptPtr--; - C_SkipComments(); - return C_SetScriptSize(j); - - case CON_FALL: - case CON_TIP: - // case 21: - case CON_KILLIT: - case CON_RESETACTIONCOUNT: - case CON_PSTOMP: - case CON_RESETPLAYER: - case CON_RESETCOUNT: - case CON_WACKPLAYER: - case CON_OPERATE: - case CON_RESPAWNHITAG: - case CON_GETLASTPAL: - case CON_PKICK: - case CON_MIKESND: - case CON_TOSSWEAPON: -/* - if (!C_CheckEventSync(g_currentEvent)) - { - C_ReportError(WARNING_EVENTSYNC); - g_numCompilerWarnings++; - } -*/ - case CON_NULLOP: - if (tw == CON_NULLOP) - { - if (C_GetKeyword() != CON_ELSE) - { - C_ReportError(-1); - g_numCompilerWarnings++; - initprintf("%s:%d: warning: `nullop' found without `else'\n",g_szScriptFileName,g_lineNumber); - g_scriptPtr--; - g_ifElseAborted = 1; - } - } - case CON_STOPALLSOUNDS: - return 0; - case CON_GAMESTARTUP: - { - int32_t params[30]; - - g_scriptPtr--; - for (j = 0; j < 30; j++) - { - C_GetNextValue(LABEL_DEFINE); - g_scriptPtr--; - params[j] = *g_scriptPtr; - - if (j != 25) continue; - - if (C_GetKeyword() != -1) - { -// initprintf("Duke Nukem 3D v1.3D style CON files detected.\n"); - break; - } - else - { - g_scriptVersion = 14; -// initprintf("Duke Nukem 3D v1.4+ style CON files detected.\n"); - } - - } - - /* - v1.3d v1.5 - DEFAULTVISIBILITY DEFAULTVISIBILITY - GENERICIMPACTDAMAGE GENERICIMPACTDAMAGE - MAXPLAYERHEALTH MAXPLAYERHEALTH - STARTARMORHEALTH STARTARMORHEALTH - RESPAWNACTORTIME RESPAWNACTORTIME - RESPAWNITEMTIME RESPAWNITEMTIME - RUNNINGSPEED RUNNINGSPEED - RPGBLASTRADIUS GRAVITATIONALCONSTANT - PIPEBOMBRADIUS RPGBLASTRADIUS - SHRINKERBLASTRADIUS PIPEBOMBRADIUS - TRIPBOMBBLASTRADIUS SHRINKERBLASTRADIUS - MORTERBLASTRADIUS TRIPBOMBBLASTRADIUS - BOUNCEMINEBLASTRADIUS MORTERBLASTRADIUS - SEENINEBLASTRADIUS BOUNCEMINEBLASTRADIUS - MAXPISTOLAMMO SEENINEBLASTRADIUS - MAXSHOTGUNAMMO MAXPISTOLAMMO - MAXCHAINGUNAMMO MAXSHOTGUNAMMO - MAXRPGAMMO MAXCHAINGUNAMMO - MAXHANDBOMBAMMO MAXRPGAMMO - MAXSHRINKERAMMO MAXHANDBOMBAMMO - MAXDEVISTATORAMMO MAXSHRINKERAMMO - MAXTRIPBOMBAMMO MAXDEVISTATORAMMO - MAXFREEZEAMMO MAXTRIPBOMBAMMO - CAMERASDESTRUCTABLE MAXFREEZEAMMO - NUMFREEZEBOUNCES MAXGROWAMMO - FREEZERHURTOWNER CAMERASDESTRUCTABLE - NUMFREEZEBOUNCES - FREEZERHURTOWNER - QSIZE - TRIPBOMBLASERMODE - */ - - j = 0; - ud.const_visibility = params[j++]; - g_impactDamage = params[j++]; - g_maxPlayerHealth = g_player[0].ps->max_player_health = g_player[0].ps->max_shield_amount = params[j++]; - g_startArmorAmount = params[j++]; - g_actorRespawnTime = params[j++]; - g_itemRespawnTime = params[j++]; - g_playerFriction = params[j++]; - if (g_scriptVersion == 14) g_spriteGravity = params[j++]; - g_rpgBlastRadius = params[j++]; - g_pipebombBlastRadius = params[j++]; - g_shrinkerBlastRadius = params[j++]; - g_tripbombBlastRadius = params[j++]; - g_morterBlastRadius = params[j++]; - g_bouncemineBlastRadius = params[j++]; - g_seenineBlastRadius = params[j++]; - g_player[0].ps->max_ammo_amount[PISTOL_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[SHOTGUN_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[CHAINGUN_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[RPG_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[HANDBOMB_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[SHRINKER_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[DEVISTATOR_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[TRIPBOMB_WEAPON] = params[j++]; - g_player[0].ps->max_ammo_amount[FREEZE_WEAPON] = params[j++]; - if (g_scriptVersion == 14) g_player[0].ps->max_ammo_amount[GROW_WEAPON] = params[j++]; - g_damageCameras = params[j++]; - g_numFreezeBounces = params[j++]; - g_freezerSelfDamage = params[j++]; - if (g_scriptVersion == 14) - { - g_spriteDeleteQueueSize = params[j++]; - if (g_spriteDeleteQueueSize > 1024) g_spriteDeleteQueueSize = 1024; - else if (g_spriteDeleteQueueSize < 0) g_spriteDeleteQueueSize = 0; - - g_tripbombLaserMode = params[j++]; - } - } - return 0; - } - return 0; -} - -/* Anything added with C_AddDefinition() cannot be overwritten in the CONs */ - -static void C_AddDefinition(const char *lLabel,int32_t lValue,int32_t lType) -{ - Bstrcpy(label+(g_numLabels<<6),lLabel); - labeltype[g_numLabels] = lType; - hash_add(&h_labels,label+(g_numLabels<<6),g_numLabels,0); - labelcode[g_numLabels++] = lValue; - g_numDefaultLabels++; -} - -static void C_AddDefaultDefinitions(void) -{ - C_AddDefinition("EVENT_AIMDOWN",EVENT_AIMDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_AIMUP",EVENT_AIMUP,LABEL_DEFINE); - C_AddDefinition("EVENT_ANIMATESPRITES",EVENT_ANIMATESPRITES,LABEL_DEFINE); - C_AddDefinition("EVENT_CHANGEWEAPON",EVENT_CHANGEWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETBOOT",EVENT_CHEATGETBOOT,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETFIRSTAID",EVENT_CHEATGETFIRSTAID,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETHEAT",EVENT_CHEATGETHEAT,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETHOLODUKE",EVENT_CHEATGETHOLODUKE,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETJETPACK",EVENT_CHEATGETJETPACK,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETSCUBA",EVENT_CHEATGETSCUBA,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETSHIELD",EVENT_CHEATGETSHIELD,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETSTEROIDS",EVENT_CHEATGETSTEROIDS,LABEL_DEFINE); - C_AddDefinition("EVENT_CROUCH",EVENT_CROUCH,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYCROSSHAIR",EVENT_DISPLAYCROSSHAIR,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYREST",EVENT_DISPLAYREST,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYROOMS",EVENT_DISPLAYROOMS,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYSBAR",EVENT_DISPLAYSBAR,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYWEAPON",EVENT_DISPLAYWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_DOFIRE",EVENT_DOFIRE,LABEL_DEFINE); - C_AddDefinition("EVENT_DRAWWEAPON",EVENT_DRAWWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_EGS",EVENT_EGS,LABEL_DEFINE); - C_AddDefinition("EVENT_ENTERLEVEL",EVENT_ENTERLEVEL,LABEL_DEFINE); - C_AddDefinition("EVENT_FAKEDOMOVETHINGS",EVENT_FAKEDOMOVETHINGS,LABEL_DEFINE); - C_AddDefinition("EVENT_FIRE",EVENT_FIRE,LABEL_DEFINE); - C_AddDefinition("EVENT_FIREWEAPON",EVENT_FIREWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_GAME",EVENT_GAME,LABEL_DEFINE); - C_AddDefinition("EVENT_GETAUTOAIMANGLE",EVENT_GETAUTOAIMANGLE,LABEL_DEFINE); - C_AddDefinition("EVENT_GETLOADTILE",EVENT_GETLOADTILE,LABEL_DEFINE); - C_AddDefinition("EVENT_GETMENUTILE",EVENT_GETMENUTILE,LABEL_DEFINE); - C_AddDefinition("EVENT_GETSHOTRANGE",EVENT_GETSHOTRANGE,LABEL_DEFINE); - C_AddDefinition("EVENT_HOLODUKEOFF",EVENT_HOLODUKEOFF,LABEL_DEFINE); - C_AddDefinition("EVENT_HOLODUKEON",EVENT_HOLODUKEON,LABEL_DEFINE); - C_AddDefinition("EVENT_HOLSTER",EVENT_HOLSTER,LABEL_DEFINE); - C_AddDefinition("EVENT_INCURDAMAGE",EVENT_INCURDAMAGE,LABEL_DEFINE); - C_AddDefinition("EVENT_INIT",EVENT_INIT,LABEL_DEFINE); - C_AddDefinition("EVENT_INVENTORY",EVENT_INVENTORY,LABEL_DEFINE); - C_AddDefinition("EVENT_INVENTORYLEFT",EVENT_INVENTORYLEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_INVENTORYRIGHT",EVENT_INVENTORYRIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_JUMP",EVENT_JUMP,LABEL_DEFINE); - C_AddDefinition("EVENT_LOGO",EVENT_LOGO,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKDOWN",EVENT_LOOKDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKLEFT",EVENT_LOOKLEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKRIGHT",EVENT_LOOKRIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKUP",EVENT_LOOKUP,LABEL_DEFINE); - C_AddDefinition("EVENT_MOVEBACKWARD",EVENT_MOVEBACKWARD,LABEL_DEFINE); - C_AddDefinition("EVENT_MOVEFORWARD",EVENT_MOVEFORWARD,LABEL_DEFINE); - C_AddDefinition("EVENT_NEXTWEAPON",EVENT_NEXTWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_PREVIOUSWEAPON",EVENT_PREVIOUSWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_PRESSEDFIRE",EVENT_PRESSEDFIRE,LABEL_DEFINE); - C_AddDefinition("EVENT_PROCESSINPUT",EVENT_PROCESSINPUT,LABEL_DEFINE); - C_AddDefinition("EVENT_QUICKKICK",EVENT_QUICKKICK,LABEL_DEFINE); - C_AddDefinition("EVENT_RESETINVENTORY",EVENT_RESETINVENTORY,LABEL_DEFINE); - C_AddDefinition("EVENT_RESETPLAYER",EVENT_RESETPLAYER,LABEL_DEFINE); - C_AddDefinition("EVENT_RESETWEAPONS",EVENT_RESETWEAPONS,LABEL_DEFINE); - C_AddDefinition("EVENT_RETURNTOCENTER",EVENT_RETURNTOCENTER,LABEL_DEFINE); - C_AddDefinition("EVENT_SELECTWEAPON",EVENT_SELECTWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_SOARDOWN",EVENT_SOARDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_SOARUP",EVENT_SOARUP,LABEL_DEFINE); - C_AddDefinition("EVENT_SPAWN",EVENT_SPAWN,LABEL_DEFINE); - C_AddDefinition("EVENT_STRAFELEFT",EVENT_STRAFELEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_STRAFERIGHT",EVENT_STRAFERIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_SWIMDOWN",EVENT_SWIMDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_SWIMUP",EVENT_SWIMUP,LABEL_DEFINE); - C_AddDefinition("EVENT_TURNAROUND",EVENT_TURNAROUND,LABEL_DEFINE); - C_AddDefinition("EVENT_TURNLEFT",EVENT_TURNLEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_TURNRIGHT",EVENT_TURNRIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_USE",EVENT_USE,LABEL_DEFINE); - C_AddDefinition("EVENT_USEJETPACK",EVENT_USEJETPACK,LABEL_DEFINE); - C_AddDefinition("EVENT_USEMEDKIT",EVENT_USEMEDKIT,LABEL_DEFINE); - C_AddDefinition("EVENT_USENIGHTVISION",EVENT_USENIGHTVISION,LABEL_DEFINE); - C_AddDefinition("EVENT_USESTEROIDS",EVENT_USESTEROIDS,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY10",EVENT_WEAPKEY10,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY1",EVENT_WEAPKEY1,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY2",EVENT_WEAPKEY2,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY3",EVENT_WEAPKEY3,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY4",EVENT_WEAPKEY4,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY5",EVENT_WEAPKEY5,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY6",EVENT_WEAPKEY6,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY7",EVENT_WEAPKEY7,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY8",EVENT_WEAPKEY8,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY9",EVENT_WEAPKEY9,LABEL_DEFINE); - C_AddDefinition("EVENT_KILLIT",EVENT_KILLIT,LABEL_DEFINE); - C_AddDefinition("EVENT_LOADACTOR",EVENT_LOADACTOR,LABEL_DEFINE); - C_AddDefinition("EVENT_NEWGAME",EVENT_NEWGAME,LABEL_DEFINE); - - C_AddDefinition("STR_MAPNAME",STR_MAPNAME,LABEL_DEFINE); - C_AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE); - C_AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE); - C_AddDefinition("STR_VERSION",STR_VERSION,LABEL_DEFINE); - C_AddDefinition("STR_GAMETYPE",STR_GAMETYPE,LABEL_DEFINE); - C_AddDefinition("STR_VOLUMENAME",STR_VOLUMENAME,LABEL_DEFINE); - - C_AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE); - - C_AddDefinition("PROJ_BOUNCES",PROJ_BOUNCES,LABEL_DEFINE); - C_AddDefinition("PROJ_BSOUND",PROJ_BSOUND,LABEL_DEFINE); - C_AddDefinition("PROJ_CLIPDIST",PROJ_CLIPDIST,LABEL_DEFINE); - C_AddDefinition("PROJ_CSTAT",PROJ_CSTAT,LABEL_DEFINE); - C_AddDefinition("PROJ_DECAL",PROJ_DECAL,LABEL_DEFINE); - C_AddDefinition("PROJ_DROP",PROJ_DROP,LABEL_DEFINE); - C_AddDefinition("PROJ_EXTRA",PROJ_EXTRA,LABEL_DEFINE); - C_AddDefinition("PROJ_EXTRA_RAND",PROJ_EXTRA_RAND,LABEL_DEFINE); - C_AddDefinition("PROJ_FLASH_COLOR",PROJ_FLASH_COLOR,LABEL_DEFINE); - C_AddDefinition("PROJ_HITRADIUS",PROJ_HITRADIUS,LABEL_DEFINE); - C_AddDefinition("PROJ_ISOUND",PROJ_ISOUND,LABEL_DEFINE); - C_AddDefinition("PROJ_OFFSET",PROJ_OFFSET,LABEL_DEFINE); - C_AddDefinition("PROJ_PAL",PROJ_PAL,LABEL_DEFINE); - C_AddDefinition("PROJ_RANGE",PROJ_RANGE,LABEL_DEFINE); - C_AddDefinition("PROJ_SHADE",PROJ_SHADE,LABEL_DEFINE); - C_AddDefinition("PROJ_SOUND",PROJ_SOUND,LABEL_DEFINE); - C_AddDefinition("PROJ_SPAWNS",PROJ_SPAWNS,LABEL_DEFINE); - C_AddDefinition("PROJ_SXREPEAT",PROJ_SXREPEAT,LABEL_DEFINE); - C_AddDefinition("PROJ_SYREPEAT",PROJ_SYREPEAT,LABEL_DEFINE); - C_AddDefinition("PROJ_TNUM",PROJ_TNUM,LABEL_DEFINE); - C_AddDefinition("PROJ_TOFFSET",PROJ_TOFFSET,LABEL_DEFINE); - C_AddDefinition("PROJ_TRAIL",PROJ_TRAIL,LABEL_DEFINE); - C_AddDefinition("PROJ_TXREPEAT",PROJ_TXREPEAT,LABEL_DEFINE); - C_AddDefinition("PROJ_TYREPEAT",PROJ_TYREPEAT,LABEL_DEFINE); - C_AddDefinition("PROJ_VEL_MULT",PROJ_VEL_MULT,LABEL_DEFINE); - C_AddDefinition("PROJ_VEL",PROJ_VEL,LABEL_DEFINE); - C_AddDefinition("PROJ_WORKSLIKE",PROJ_WORKSLIKE,LABEL_DEFINE); - C_AddDefinition("PROJ_XREPEAT",PROJ_XREPEAT,LABEL_DEFINE); - C_AddDefinition("PROJ_YREPEAT",PROJ_YREPEAT,LABEL_DEFINE); -} - -#pragma pack(push,1) -static void C_InitProjectiles(void) -{ - int32_t i; - - typedef struct - { - int32_t workslike, cstat; // 8b - int32_t hitradius, range, flashcolor; // 12b - int16_t spawns, sound, isound, vel; // 8b - int16_t decal, trail, tnum, drop; // 8b - int16_t offset, bounces, bsound; // 6b - int16_t toffset; // 2b - int16_t extra, extra_rand; // 4b - int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b - int8_t shade, xrepeat, yrepeat, pal; // 4b - int8_t velmult; // 1b - uint8_t clipdist; // 1b - } defaultprojectile_t; - - defaultprojectile_t DefaultProjectile = - { - 1, -1, 2048, 0, 0, SMALLSMOKE, -1, -1, 600, BULLETHOLE, -1, 0, 0, 448, g_numFreezeBounces, PIPEBOMB_BOUNCE, 1, - 100, -1, -1, -1, -1, -1, -96, 18, 18, 0, 1, 32 - }; - - // this will only happen if I forget to update this function... - if (offsetof(projectile_t, filler) != sizeof(DefaultProjectile)) - G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!"); - - for (i=MAXTILES-1; i>=0; i--) - Bmemcpy(&ProjectileData[i],&DefaultProjectile,sizeof(projectile_t)); - - Bmemcpy(&DefaultProjectileData[0], &ProjectileData[0], sizeof(ProjectileData)); -} -#pragma pack(pop) - -extern int32_t g_numObituaries; -extern int32_t g_numSelfObituaries; - -void C_Compile(const char *filenam) -{ - char *mptr; - int32_t i; - int32_t fs,fp; - int32_t startcompiletime; - - clearbuf(apScriptGameEvent,MAXGAMEEVENTS,0L); - - C_InitHashes(); - Gv_Init(); - C_InitProjectiles(); - - fp = kopen4loadfrommod((char *)filenam,g_loadFromGroupOnly); - if (fp == -1) // JBF: was 0 - { - extern int32_t numgroupfiles; - - if (g_loadFromGroupOnly == 1 || numgroupfiles == 0) - { -#ifdef WIN32 - Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A valid copy of '%s' or other compatible data is needed to run EDuke32.\n\n" - "You can find '%s' in the 'DN3DINST' or 'ATOMINST' directory on your Duke Nukem 3D installation CD.\n\n" - "If you don't already own a copy of Duke or haven't seen your disc in years, don't worry -- you can download the full, registered " - "version of Duke Nukem 3D: Atomic Edition immediately for only $5.99 through our partnership with GOG.com.\n\n" - "Not a typo; it's less than 6 bucks. Get Duke now?\n\n" - "(Clicking yes will bring you to our web store)", - g_grpNamePtr,g_grpNamePtr); - - if (wm_ynbox("Important - Duke Nukem 3D not found - EDuke32",tempbuf)) - { - SHELLEXECUTEINFOA sinfo; - char *p = "http://www.gog.com/en/gamecard/duke_nukem_3d_atomic_edition/pp/6c1e671f9af5b46d9c1a52067bdf0e53685674f7"; - - Bmemset(&sinfo, 0, sizeof(sinfo)); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SEE_MASK_CLASSNAME; - sinfo.lpVerb = "open"; - sinfo.lpFile = p; - sinfo.nShow = SW_SHOWNORMAL; - sinfo.lpClass = "http"; - - if (!ShellExecuteExA(&sinfo)) - G_GameExit("Error launching default system browser!"); - } - G_GameExit(""); -#else - Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A valid copy of '%s' or other compatible data is needed to run EDuke32.\n" - "You can find '%s' in the 'DN3DINST' or 'ATOMINST' directory on your Duke Nukem 3D installation CD-ROM.\n\n" - "EDuke32 will now close.", - g_grpNamePtr,g_grpNamePtr); - G_GameExit(tempbuf); -#endif - } - else - { - Bsprintf(tempbuf,"CON file `%s' missing.", filenam); - G_GameExit(tempbuf); - } - - //g_loadFromGroupOnly = 1; - return; //Not there - } - - fs = kfilelength(fp); - - initprintf("Compiling: %s (%d bytes)\n",filenam,fs); - - flushlogwindow = 0; - - startcompiletime = getticks(); - - mptr = (char *)Bmalloc(fs+1); - if (!mptr) - { - Bsprintf(tempbuf,"Failed allocating %d byte CON text buffer.", fs+1); - G_GameExit(tempbuf); - } - - mptr[fs] = 0; - - textptr = (char *) mptr; - kread(fp,(char *)textptr,fs); - kclose(fp); - - clearbuf(actorscrptr,MAXTILES,0L); // JBF 20040531: MAXSPRITES? I think Todd meant MAXTILES... - clearbuf(actorLoadEventScrptr,MAXTILES,0L); // I think this should be here... - clearbufbyte(ActorType,MAXTILES,0L); -// clearbufbyte(script,sizeof(script),0l); // JBF 20040531: yes? no? - if (script != NULL) - Bfree(script); - - script = Bcalloc(1,g_scriptSize * sizeof(intptr_t)); - bitptr = Bcalloc(1,(((g_scriptSize+7)>>3)+1) * sizeof(uint8_t)); -// initprintf("script: %d, bitptr: %d\n",script,bitptr); - - g_numLabels = g_numDefaultLabels = 0; - g_scriptPtr = script+1; - g_numCompilerWarnings = 0; - g_numCompilerErrors = 0; - g_lineNumber = 1; - g_totalLines = 0; - - C_AddDefaultDefinitions(); - - Bstrcpy(g_szScriptFileName, filenam); // JBF 20031130: Store currently compiling file name - - while (C_ParseCommand() == 0); - - flushlogwindow = 1; - - if (g_numCompilerErrors > 63) - initprintf("fatal error: too many errors: Aborted\n"); - - //*script = (intptr_t) g_scriptPtr; - - Bfree(mptr); - mptr = NULL; - - if (g_numCompilerWarnings|g_numCompilerErrors) - initprintf("Found %d warning(s), %d error(s).\n",g_numCompilerWarnings,g_numCompilerErrors); - - if (g_numCompilerErrors) - { - if (g_loadFromGroupOnly) - { - Bsprintf(buf,"Error compiling CON files."); - G_GameExit(buf); - } - else - { - if (g_groupFileHandle != -1 && g_loadFromGroupOnly == 0) - { -// initprintf("Error(s) found in file `%s'. Do you want to use the INTERNAL DEFAULTS (y/N)?\n",filenam); - - i=wm_ynbox("CON File Compilation Error", "Error(s) found in file `%s'. Do you want to use the " - "INTERNAL DEFAULTS?",filenam); - if (i) i = 'y'; - if (i == 'y' || i == 'Y') - { - initprintf(" Yes\n"); - g_loadFromGroupOnly = 1; - return; - } - else - { -#if (defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)) - while (!quitevent) // keep the window open so people can copy CON errors out of it - handleevents(); -#endif - G_GameExit(""); - } - } - } - } - else - { - int32_t j=0, k=0, l=0; - - hash_free(&h_keywords); - freehashnames(); - - hash_free(§orH); - hash_free(&wallH); - hash_free(&userdefH); - - hash_free(&projectileH); - hash_free(&playerH); - hash_free(&inputH); - hash_free(&actorH); - hash_free(&tspriteH); - - g_totalLines += g_lineNumber; - - C_SetScriptSize(g_scriptPtr-script+8); - - initprintf("Script compiled in %dms, %ld*%db, version %s\n", getticks() - startcompiletime, - (unsigned long)(g_scriptPtr-script), (int32_t)sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); - - initprintf("%d/%d labels, %d/%d variables\n", g_numLabels, - (int32_t)min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)), - MAXSPRITES * sizeof(spritetype)/(1<<6)), - g_gameVarCount, MAXGAMEVARS); - - for (i=MAXQUOTES-1; i>=0; i--) - if (ScriptQuotes[i]) - j++; - for (i=MAXGAMEEVENTS-1; i>=0; i--) - if (apScriptGameEvent[i]) - k++; - for (i=MAXTILES-1; i>=0; i--) - if (actorscrptr[i]) - l++; - - if (j) initprintf("%d quotes, ", j); - if (g_numQuoteRedefinitions) initprintf("%d strings, ", g_numQuoteRedefinitions); - if (k) initprintf("%d events, ", k); - if (l) initprintf("%d actors", l); - - initprintf("\n"); - - for (i=127; i>=0; i--) - if (ScriptQuotes[i] == NULL) - ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t)); - - for (i=MAXQUOTELEN-7; i>=0; i--) - if (Bstrncmp(&ScriptQuotes[13][i],"SPACE",5) == 0) - { - Bmemset(tempbuf,0,sizeof(tempbuf)); - Bstrncpy(tempbuf,ScriptQuotes[13],i); - Bstrcat(tempbuf,"OPEN"); - Bstrcat(tempbuf,&ScriptQuotes[13][i+5]); - Bstrncpy(ScriptQuotes[13],tempbuf,MAXQUOTELEN-1); - i = MAXQUOTELEN-7; - } - - // most of these are based on Blood, obviously - { - const char *PlayerObituaries[] = - { - "^02%s^02 beat %s^02 like a cur", - "^02%s^02 broke %s", - "^02%s^02 body bagged %s", - "^02%s^02 boned %s^02 like a fish", - "^02%s^02 castrated %s", - "^02%s^02 creamed %s", - "^02%s^02 crushed %s", - "^02%s^02 destroyed %s", - "^02%s^02 diced %s", - "^02%s^02 disemboweled %s", - "^02%s^02 erased %s", - "^02%s^02 eviscerated %s", - "^02%s^02 flailed %s", - "^02%s^02 flattened %s", - "^02%s^02 gave AnAl MaDnEsS to %s", - "^02%s^02 gave %s^02 Anal Justice", - "^02%s^02 hosed %s", - "^02%s^02 hurt %s^02 real bad", - "^02%s^02 killed %s", - "^02%s^02 made dog meat out of %s", - "^02%s^02 made mincemeat out of %s", - "^02%s^02 manhandled %s", - "^02%s^02 massacred %s", - "^02%s^02 mutilated %s", - "^02%s^02 murdered %s", - "^02%s^02 neutered %s", - "^02%s^02 punted %s", - "^02%s^02 reamed %s", - "^02%s^02 ripped %s^02 a new orifice", - "^02%s^02 rocked %s", - "^02%s^02 sent %s^02 to hell", - "^02%s^02 shredded %s", - "^02%s^02 slashed %s", - "^02%s^02 slaughtered %s", - "^02%s^02 sliced %s", - "^02%s^02 smacked %s around", - "^02%s^02 smashed %s", - "^02%s^02 snuffed %s", - "^02%s^02 sodomized %s", - "^02%s^02 splattered %s", - "^02%s^02 sprayed %s", - "^02%s^02 squashed %s", - "^02%s^02 throttled %s", - "^02%s^02 toasted %s", - "^02%s^02 vented %s", - "^02%s^02 ventilated %s", - "^02%s^02 wasted %s", - "^02%s^02 wrecked %s", - }; - - const char *PlayerSelfObituaries[] = - { - "^02%s^02 is excrement", - "^02%s^02 is hamburger", - "^02%s^02 suffered scrotum separation", - "^02%s^02 volunteered for population control", - "^02%s^02 has suicided", - "^02%s^02 bled out", - }; - - g_numObituaries = (sizeof(PlayerObituaries)/sizeof(PlayerObituaries[0])); - for (i=g_numObituaries-1; i>=0; i--) - { - if (ScriptQuotes[i+OBITQUOTEINDEX] == NULL) - { - ScriptQuotes[i+OBITQUOTEINDEX] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t)); - Bstrcpy(ScriptQuotes[i+OBITQUOTEINDEX],PlayerObituaries[i]); - } - } - - g_numSelfObituaries = (sizeof(PlayerSelfObituaries)/sizeof(PlayerSelfObituaries[0])); - for (i=g_numSelfObituaries-1; i>=0; i--) - { - if (ScriptQuotes[i+SUICIDEQUOTEINDEX] == NULL) - { - ScriptQuotes[i+SUICIDEQUOTEINDEX] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t)); - Bstrcpy(ScriptQuotes[i+SUICIDEQUOTEINDEX],PlayerSelfObituaries[i]); - } - } - } - } -} - -void C_ReportError(int32_t iError) -{ - if (Bstrcmp(g_szCurrentBlockName,g_szLastBlockName)) - { - if (g_parsingEventPtr || g_processingState || g_parsingActorPtr) - initprintf("%s: In %s `%s':\n",g_szScriptFileName,g_parsingEventPtr?"event":g_parsingActorPtr?"actor":"state",g_szCurrentBlockName); - else initprintf("%s: At top level:\n",g_szScriptFileName); - Bstrcpy(g_szLastBlockName,g_szCurrentBlockName); - } - switch (iError) - { - case ERROR_CLOSEBRACKET: - initprintf("%s:%d: error: found more `}' than `{' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_EVENTONLY: - initprintf("%s:%d: error: `%s' only valid during events.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_EXCEEDSMAXTILES: - initprintf("%s:%d: error: `%s' value exceeds MAXTILES. Maximum is %d.\n",g_szScriptFileName,g_lineNumber,tempbuf,MAXTILES-1); - break; - case ERROR_EXPECTEDKEYWORD: - initprintf("%s:%d: error: expected a keyword but found `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_FOUNDWITHIN: - initprintf("%s:%d: error: found `%s' within %s.\n",g_szScriptFileName,g_lineNumber,tempbuf,g_parsingEventPtr?"an event":g_parsingActorPtr?"an actor":"a state"); - break; - case ERROR_ISAKEYWORD: - initprintf("%s:%d: error: symbol `%s' is a keyword.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOENDSWITCH: - initprintf("%s:%d: error: did not find `endswitch' before `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEDEF: - initprintf("%s:%d: error: symbol `%s' is not a game definition.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEVAR: - initprintf("%s:%d: error: symbol `%s' is not a game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEARRAY: - initprintf("%s:%d: error: symbol `%s' is not a game array.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_GAMEARRAYBNC: - initprintf("%s:%d: error: square brackets for index of game array not closed, expected ] found %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_GAMEARRAYBNO: - initprintf("%s:%d: error: square brackets for index of game array not opened, expected [ found %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_INVALIDARRAYWRITE: - initprintf("%s:%d: error: arrays can only be written to using `setarray' %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_OPENBRACKET: - initprintf("%s:%d: error: found more `{' than `}' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_PARAMUNDEFINED: - initprintf("%s:%d: error: parameter `%s' is undefined.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_SYMBOLNOTRECOGNIZED: - initprintf("%s:%d: error: symbol `%s' is not recognized.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_SYNTAXERROR: - initprintf("%s:%d: error: syntax error.\n",g_szScriptFileName,g_lineNumber); - break; - case ERROR_VARREADONLY: - initprintf("%s:%d: error: variable `%s' is read-only.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_VARTYPEMISMATCH: - initprintf("%s:%d: error: variable `%s' is of the wrong type.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_BADGAMEVAR: - initprintf("%s:%d: warning: variable `%s' should be either per-player OR per-actor, not both.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_DUPLICATECASE: - initprintf("%s:%d: warning: duplicate case ignored.\n",g_szScriptFileName,g_lineNumber); - break; - case WARNING_DUPLICATEDEFINITION: - initprintf("%s:%d: warning: duplicate game definition `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_EVENTSYNC: - initprintf("%s:%d: warning: found `%s' within a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case WARNING_LABELSONLY: - initprintf("%s:%d: warning: expected a label, found a constant.\n",g_szScriptFileName,g_lineNumber); - break; - case WARNING_NAMEMATCHESVAR: - initprintf("%s:%d: warning: symbol `%s' already used for game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_REVEVENTSYNC: - initprintf("%s:%d: warning: found `%s' outside of a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - } -} diff --git a/polymer-perf/eduke32/source/gamedef.h b/polymer-perf/eduke32/source/gamedef.h deleted file mode 100644 index e7b90b534..000000000 --- a/polymer-perf/eduke32/source/gamedef.h +++ /dev/null @@ -1,938 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef _gamedef_h_ -#define _gamedef_h_ - -#define MAXGAMEEVENTS 128 -#define LABEL_HASPARM2 1 -#define LABEL_ISSTRING 2 - -extern hashtable_t h_gamevars; -extern hashtable_t h_arrays; -extern hashtable_t h_keywords; -extern hashtable_t h_gamefuncs; -extern hashtable_t h_labels; - - -extern int32_t g_iReturnVarID; // var ID of "RETURN" -extern int32_t g_iWeaponVarID; // var ID of "WEAPON" -extern int32_t g_iWorksLikeVarID; // var ID of "WORKSLIKE" -extern int32_t g_iZRangeVarID; // var ID of "ZRANGE" -extern int32_t g_iAngRangeVarID; // var ID of "ANGRANGE" -extern int32_t g_iAimAngleVarID; // var ID of "AUTOAIMANGLE" -extern int32_t g_iLoTagID; // var ID of "LOTAG" -extern int32_t g_iHiTagID; // var ID of "HITAG" -extern int32_t g_iTextureID; // var ID of "TEXTURE" -extern int32_t g_iThisActorID; // var ID of "THISACTOR" -extern int32_t g_iSpriteVarID; -extern int32_t g_iSectorVarID; -extern int32_t g_iWallVarID; -extern int32_t g_iPlayerVarID; -extern int32_t g_iActorVarID; - -extern intptr_t *actorLoadEventScrptr[MAXTILES]; - -extern intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; - -extern int32_t otherp; -extern int32_t g_currentweapon; -extern int32_t g_gun_pos; -extern int32_t g_looking_arc; -extern int32_t g_currentweapon; -extern int32_t g_weapon_xoffset; -extern int32_t g_gs; -extern int32_t g_kb; -extern int32_t g_looking_angSR1; -extern int32_t lastvisinc; -extern char CheatStrings[][MAXCHEATLEN]; -extern char g_szScriptFileName[BMAX_PATH]; -extern int32_t g_totalLines,g_lineNumber; -extern int32_t g_numCompilerErrors,g_numCompilerWarnings,g_numQuoteRedefinitions; -extern int32_t g_scriptVersion; -extern uint32_t g_scriptDateVersion; // YYYYMMDD -extern char g_szBuf[1024]; - -extern intptr_t *g_scriptPtr; - -typedef struct -{ - char *name; - int32_t lId; - int32_t flags; - int32_t maxParm2; -} memberlabel_t; - -extern const memberlabel_t SectorLabels[]; -extern const memberlabel_t WallLabels[]; -extern const memberlabel_t ActorLabels[]; -extern const memberlabel_t PlayerLabels[]; -extern const memberlabel_t ProjectileLabels[]; -extern const memberlabel_t userdeflabels[]; -extern const memberlabel_t InputLabels[]; -extern const memberlabel_t TsprLabels[]; - -void C_ReportError(int32_t iError); -void C_Compile(const char *filenam); - -/* -extern void VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t lVar2); -extern void VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2); -extern void VM_AccessPlayer(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2); -extern void VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2); -extern void VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2); -extern void VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2); -extern void VM_AccessSprite(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2); -extern void VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2); -extern void VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2); -*/ - -#define CON_ERROR OSD_ERROR "Line %d, %s: " - -enum vmflags_t { - VM_RETURN = 0x00000001, - VM_KILL = 0x00000002, - VM_NOEXECUTE = 0x00000004, -}; - -typedef struct { - int32_t g_i, g_p, g_x; - intptr_t *g_t; - spritetype *g_sp; - int32_t g_flags; -} vmstate_t; - -extern vmstate_t vm; - -extern int32_t g_scriptSanityChecks; - -extern int32_t g_errorLineNum; -extern int32_t g_tw; -extern const char *keyw[]; - -enum SystemString_t { - STR_MAPNAME, - STR_MAPFILENAME, - STR_PLAYERNAME, - STR_VERSION, - STR_GAMETYPE, - STR_VOLUMENAME -}; - -enum ScriptError_t -{ - ERROR_CLOSEBRACKET, - ERROR_EVENTONLY, - ERROR_EXCEEDSMAXTILES, - ERROR_EXPECTEDKEYWORD, - ERROR_FOUNDWITHIN, - ERROR_ISAKEYWORD, - ERROR_NOENDSWITCH, - ERROR_NOTAGAMEDEF, - ERROR_NOTAGAMEVAR, - ERROR_NOTAGAMEARRAY, - ERROR_GAMEARRAYBNC, - ERROR_GAMEARRAYBNO, - ERROR_INVALIDARRAYWRITE, - ERROR_OPENBRACKET, - ERROR_PARAMUNDEFINED, - ERROR_SYMBOLNOTRECOGNIZED, - ERROR_SYNTAXERROR, - ERROR_VARREADONLY, - ERROR_VARTYPEMISMATCH, - WARNING_BADGAMEVAR, - WARNING_DUPLICATECASE, - WARNING_DUPLICATEDEFINITION, - WARNING_EVENTSYNC, - WARNING_LABELSONLY, - WARNING_NAMEMATCHESVAR, - WARNING_REVEVENTSYNC -}; - -enum PlayerLabel_t -{ - PLAYER_ZOOM, - PLAYER_EXITX, - PLAYER_EXITY, - PLAYER_LOOGIEX, - PLAYER_LOOGIEY, - PLAYER_NUMLOOGS, - PLAYER_LOOGCNT, - PLAYER_POSX, - PLAYER_POSY, - PLAYER_POSZ, - PLAYER_HORIZ, - PLAYER_OHORIZ, - PLAYER_OHORIZOFF, - PLAYER_INVDISPTIME, - PLAYER_BOBPOSX, - PLAYER_BOBPOSY, - PLAYER_OPOSX, - PLAYER_OPOSY, - PLAYER_OPOSZ, - PLAYER_PYOFF, - PLAYER_OPYOFF, - PLAYER_POSXV, - PLAYER_POSYV, - PLAYER_POSZV, - PLAYER_LAST_PISSED_TIME, - PLAYER_TRUEFZ, - PLAYER_TRUECZ, - PLAYER_PLAYER_PAR, - PLAYER_VISIBILITY, - PLAYER_BOBCOUNTER, - PLAYER_WEAPON_SWAY, - PLAYER_PALS_TIME, - PLAYER_RANDOMFLAMEX, - PLAYER_CRACK_TIME, - PLAYER_AIM_MODE, - PLAYER_ANG, - PLAYER_OANG, - PLAYER_ANGVEL, - PLAYER_CURSECTNUM, - PLAYER_LOOK_ANG, - PLAYER_LAST_EXTRA, - PLAYER_SUBWEAPON, - PLAYER_AMMO_AMOUNT, - PLAYER_WACKEDBYACTOR, - PLAYER_FRAG, - PLAYER_FRAGGEDSELF, - PLAYER_CURR_WEAPON, - PLAYER_LAST_WEAPON, - PLAYER_TIPINCS, - PLAYER_HORIZOFF, - PLAYER_WANTWEAPONFIRE, - PLAYER_HOLODUKE_AMOUNT, - PLAYER_NEWOWNER, - PLAYER_HURT_DELAY, - PLAYER_HBOMB_HOLD_DELAY, - PLAYER_JUMPING_COUNTER, - PLAYER_AIRLEFT, - PLAYER_KNEE_INCS, - PLAYER_ACCESS_INCS, - PLAYER_FTA, - PLAYER_FTQ, - PLAYER_ACCESS_WALLNUM, - PLAYER_ACCESS_SPRITENUM, - PLAYER_KICKBACK_PIC, - PLAYER_GOT_ACCESS, - PLAYER_WEAPON_ANG, - PLAYER_FIRSTAID_AMOUNT, - PLAYER_SOMETHINGONPLAYER, - PLAYER_ON_CRANE, - PLAYER_I, - PLAYER_ONE_PARALLAX_SECTNUM, - PLAYER_OVER_SHOULDER_ON, - PLAYER_RANDOM_CLUB_FRAME, - PLAYER_FIST_INCS, - PLAYER_ONE_EIGHTY_COUNT, - PLAYER_CHEAT_PHASE, - PLAYER_DUMMYPLAYERSPRITE, - PLAYER_EXTRA_EXTRA8, - PLAYER_QUICK_KICK, - PLAYER_HEAT_AMOUNT, - PLAYER_ACTORSQU, - PLAYER_TIMEBEFOREEXIT, - PLAYER_CUSTOMEXITSOUND, - PLAYER_WEAPRECS, - PLAYER_WEAPRECCNT, - PLAYER_INTERFACE_TOGGLE_FLAG, - PLAYER_ROTSCRNANG, - PLAYER_DEAD_FLAG, - PLAYER_SHOW_EMPTY_WEAPON, - PLAYER_SCUBA_AMOUNT, - PLAYER_JETPACK_AMOUNT, - PLAYER_STEROIDS_AMOUNT, - PLAYER_SHIELD_AMOUNT, - PLAYER_HOLODUKE_ON, - PLAYER_PYCOUNT, - PLAYER_WEAPON_POS, - PLAYER_FRAG_PS, - PLAYER_TRANSPORTER_HOLD, - PLAYER_LAST_FULL_WEAPON, - PLAYER_FOOTPRINTSHADE, - PLAYER_BOOT_AMOUNT, - PLAYER_SCREAM_VOICE, - PLAYER_GM, - PLAYER_ON_WARPING_SECTOR, - PLAYER_FOOTPRINTCOUNT, - PLAYER_HBOMB_ON, - PLAYER_JUMPING_TOGGLE, - PLAYER_RAPID_FIRE_HOLD, - PLAYER_ON_GROUND, - PLAYER_NAME, - PLAYER_INVEN_ICON, - PLAYER_BUTTONPALETTE, - PLAYER_JETPACK_ON, - PLAYER_SPRITEBRIDGE, - PLAYER_LASTRANDOMSPOT, - PLAYER_SCUBA_ON, - PLAYER_FOOTPRINTPAL, - PLAYER_HEAT_ON, - PLAYER_HOLSTER_WEAPON, - PLAYER_FALLING_COUNTER, - PLAYER_GOTWEAPON, - PLAYER_REFRESH_INVENTORY, - PLAYER_PALETTE, - PLAYER_TOGGLE_KEY_FLAG, - PLAYER_KNUCKLE_INCS, - PLAYER_WALKING_SND_TOGGLE, - PLAYER_PALOOKUP, - PLAYER_HARD_LANDING, - PLAYER_MAX_SECRET_ROOMS, - PLAYER_SECRET_ROOMS, - PLAYER_PALS, - PLAYER_MAX_ACTORS_KILLED, - PLAYER_ACTORS_KILLED, - PLAYER_RETURN_TO_CENTER, - PLAYER_RUNSPEED, - PLAYER_SBS, - PLAYER_RELOADING, - PLAYER_AUTO_AIM, - PLAYER_MOVEMENT_LOCK, - PLAYER_SOUND_PITCH, - PLAYER_WEAPONSWITCH, - PLAYER_TEAM, - PLAYER_MAX_PLAYER_HEALTH, - PLAYER_MAX_SHIELD_AMOUNT, - PLAYER_MAX_AMMO_AMOUNT, - PLAYER_LAST_QUICK_KICK, - PLAYER_END -}; - -enum UserdefsLabel_t -{ - USERDEFS_GOD, - USERDEFS_WARP_ON, - USERDEFS_CASHMAN, - USERDEFS_EOG, - USERDEFS_SHOWALLMAP, - USERDEFS_SHOW_HELP, - USERDEFS_SCROLLMODE, - USERDEFS_CLIPPING, - USERDEFS_USER_NAME, - USERDEFS_RIDECULE, - USERDEFS_SAVEGAME, - USERDEFS_PWLOCKOUT, - USERDEFS_RTSNAME, - USERDEFS_OVERHEAD_ON, - USERDEFS_LAST_OVERHEAD, - USERDEFS_SHOWWEAPONS, - USERDEFS_PAUSE_ON, - USERDEFS_FROM_BONUS, - USERDEFS_CAMERASPRITE, - USERDEFS_LAST_CAMSPRITE, - USERDEFS_LAST_LEVEL, - USERDEFS_SECRETLEVEL, - USERDEFS_CONST_VISIBILITY, - USERDEFS_UW_FRAMERATE, - USERDEFS_CAMERA_TIME, - USERDEFS_FOLFVEL, - USERDEFS_FOLAVEL, - USERDEFS_FOLX, - USERDEFS_FOLY, - USERDEFS_FOLA, - USERDEFS_RECCNT, - USERDEFS_ENTERED_NAME, - USERDEFS_SCREEN_TILTING, - USERDEFS_SHADOWS, - USERDEFS_FTA_ON, - USERDEFS_EXECUTIONS, - USERDEFS_AUTO_RUN, - USERDEFS_COORDS, - USERDEFS_TICKRATE, - USERDEFS_M_COOP, - USERDEFS_COOP, - USERDEFS_SCREEN_SIZE, - USERDEFS_LOCKOUT, - USERDEFS_CROSSHAIR, - USERDEFS_WCHOICE, - USERDEFS_PLAYERAI, - USERDEFS_RESPAWN_MONSTERS, - USERDEFS_RESPAWN_ITEMS, - USERDEFS_RESPAWN_INVENTORY, - USERDEFS_RECSTAT, - USERDEFS_MONSTERS_OFF, - USERDEFS_BRIGHTNESS, - USERDEFS_M_RESPAWN_ITEMS, - USERDEFS_M_RESPAWN_MONSTERS, - USERDEFS_M_RESPAWN_INVENTORY, - USERDEFS_M_RECSTAT, - USERDEFS_M_MONSTERS_OFF, - USERDEFS_DETAIL, - USERDEFS_M_FFIRE, - USERDEFS_FFIRE, - USERDEFS_M_PLAYER_SKILL, - USERDEFS_M_LEVEL_NUMBER, - USERDEFS_M_VOLUME_NUMBER, - USERDEFS_MULTIMODE, - USERDEFS_PLAYER_SKILL, - USERDEFS_LEVEL_NUMBER, - USERDEFS_VOLUME_NUMBER, - USERDEFS_M_MARKER, - USERDEFS_MARKER, - USERDEFS_MOUSEFLIP, - USERDEFS_STATUSBARSCALE, - USERDEFS_DRAWWEAPON, - USERDEFS_MOUSEAIMING, - USERDEFS_WEAPONSWITCH, - USERDEFS_DEMOCAMS, - USERDEFS_COLOR, - USERDEFS_MSGDISPTIME, - USERDEFS_STATUSBARMODE, - USERDEFS_M_NOEXITS, - USERDEFS_NOEXITS, - USERDEFS_AUTOVOTE, - USERDEFS_AUTOMSG, - USERDEFS_IDPLAYERS, - USERDEFS_TEAM, - USERDEFS_VIEWBOB, - USERDEFS_WEAPONSWAY, - USERDEFS_ANGLEINTERPOLATION, - USERDEFS_OBITUARIES, - USERDEFS_LEVELSTATS, - USERDEFS_CROSSHAIRSCALE, - USERDEFS_ALTHUD, - USERDEFS_DISPLAY_BONUS_SCREEN, - USERDEFS_SHOW_LEVEL_TEXT, - USERDEFS_WEAPONSCALE, - USERDEFS_TEXTSCALE, - USERDEFS_END -}; - -enum SectorLabel_t -{ - SECTOR_WALLPTR, - SECTOR_WALLNUM, - SECTOR_CEILINGZ, - SECTOR_FLOORZ, - SECTOR_CEILINGSTAT, - SECTOR_FLOORSTAT, - SECTOR_CEILINGPICNUM, - SECTOR_CEILINGSLOPE, - SECTOR_CEILINGSHADE, - SECTOR_CEILINGPAL, - SECTOR_CEILINGXPANNING, - SECTOR_CEILINGYPANNING, - SECTOR_FLOORPICNUM, - SECTOR_FLOORSLOPE, - SECTOR_FLOORSHADE, - SECTOR_FLOORPAL, - SECTOR_FLOORXPANNING, - SECTOR_FLOORYPANNING, - SECTOR_VISIBILITY, - SECTOR_ALIGNTO, - SECTOR_LOTAG, - SECTOR_HITAG, - SECTOR_EXTRA, - SECTOR_END -}; - -enum WallLabel_t -{ - WALL_X, - WALL_Y, - WALL_POINT2, - WALL_NEXTWALL, - WALL_NEXTSECTOR, - WALL_CSTAT, - WALL_PICNUM, - WALL_OVERPICNUM, - WALL_SHADE, - WALL_PAL, - WALL_XREPEAT, - WALL_YREPEAT, - WALL_XPANNING, - WALL_YPANNING, - WALL_LOTAG, - WALL_HITAG, - WALL_EXTRA, - WALL_END -}; - -enum ActorLabel_t -{ - ACTOR_X, - ACTOR_Y, - ACTOR_Z, - ACTOR_CSTAT, - ACTOR_PICNUM, - ACTOR_SHADE, - ACTOR_PAL, - ACTOR_CLIPDIST, - ACTOR_DETAIL, - ACTOR_XREPEAT, - ACTOR_YREPEAT, - ACTOR_XOFFSET, - ACTOR_YOFFSET, - ACTOR_SECTNUM, - ACTOR_STATNUM, - ACTOR_ANG, - ACTOR_OWNER, - ACTOR_XVEL, - ACTOR_YVEL, - ACTOR_ZVEL, - ACTOR_LOTAG, - ACTOR_HITAG, - ACTOR_EXTRA, - ACTOR_HTCGG, - ACTOR_HTPICNUM, - ACTOR_HTANG, - ACTOR_HTEXTRA, - ACTOR_HTOWNER, - ACTOR_HTMOVFLAG, - ACTOR_HTTEMPANG, - ACTOR_HTACTORSTAYPUT, - ACTOR_HTDISPICNUM, - ACTOR_HTTIMETOSLEEP, - ACTOR_HTFLOORZ, - ACTOR_HTCEILINGZ, - ACTOR_HTLASTVX, - ACTOR_HTLASTVY, - ACTOR_HTBPOSX, - ACTOR_HTBPOSY, - ACTOR_HTBPOSZ, - ACTOR_HTG_T, - ACTOR_ANGOFF, - ACTOR_PITCH, - ACTOR_ROLL, - ACTOR_MDXOFF, - ACTOR_MDYOFF, - ACTOR_MDZOFF, - ACTOR_MDFLAGS, - ACTOR_XPANNING, - ACTOR_YPANNING, - ACTOR_HTFLAGS, - ACTOR_ALPHA, - ACTOR_END -}; - -enum InputLabel_t -{ - INPUT_AVEL, - INPUT_HORZ, - INPUT_FVEL, - INPUT_SVEL, - INPUT_BITS, - INPUT_EXTBITS, - INPUT_END -}; - -enum ProjectileLabel_t -{ - PROJ_WORKSLIKE, - PROJ_SPAWNS, - PROJ_SXREPEAT, - PROJ_SYREPEAT, - PROJ_SOUND, - PROJ_ISOUND, - PROJ_VEL, - PROJ_EXTRA, - PROJ_DECAL, - PROJ_TRAIL, - PROJ_TXREPEAT, - PROJ_TYREPEAT, - PROJ_TOFFSET, - PROJ_TNUM, - PROJ_DROP, - PROJ_CSTAT, - PROJ_CLIPDIST, - PROJ_SHADE, - PROJ_XREPEAT, - PROJ_YREPEAT, - PROJ_PAL, - PROJ_EXTRA_RAND, - PROJ_HITRADIUS, - PROJ_VEL_MULT, - PROJ_OFFSET, - PROJ_BOUNCES, - PROJ_BSOUND, - PROJ_RANGE, - PROJ_FLASH_COLOR, // 29 - PROJ_END -}; - -enum ScriptKeywords_t -{ - CON_DEFINELEVELNAME, // 0 - CON_ACTOR, // 1 - CON_ADDAMMO, // 2 - CON_IFRND, // 3 - CON_ENDA, // 4 - CON_IFCANSEE, // 5 - CON_IFHITWEAPON, // 6 - CON_ACTION, // 7 - CON_IFPDISTL, // 8 - CON_IFPDISTG, // 9 - CON_ELSE, // 10 - CON_STRENGTH, // 11 - CON_BREAK, // 12 - CON_SHOOT, // 13 - CON_PALFROM, // 14 - CON_SOUND, // 15 - CON_FALL, // 16 - CON_STATE, // 17 - CON_ENDS, // 18 - CON_DEFINE, // 19 - CON_RETURN, // 20 - CON_IFAI, // 21 - CON_KILLIT, // 22 - CON_ADDWEAPON, // 23 - CON_AI, // 24 - CON_ADDPHEALTH, // 25 - CON_IFDEAD, // 26 - CON_IFSQUISHED, // 27 - CON_SIZETO, // 28 - CON_LEFTBRACE, // 29 - CON_RIGHTBRACE, // 30 - CON_SPAWN, // 31 - CON_MOVE, // 32 - CON_IFWASWEAPON, // 33 - CON_IFACTION, // 34 - CON_IFACTIONCOUNT, // 35 - CON_RESETACTIONCOUNT, // 36 - CON_DEBRIS, // 37 - CON_PSTOMP, // 38 - CON_BLOCKCOMMENT, // 39 deprecated - CON_CSTAT, // 40 - CON_IFMOVE, // 41 - CON_RESETPLAYER, // 42 - CON_IFONWATER, // 43 - CON_IFINWATER, // 44 - CON_IFCANSHOOTTARGET, // 45 - CON_IFCOUNT, // 46 - CON_RESETCOUNT, // 47 - CON_ADDINVENTORY, // 48 - CON_IFACTORNOTSTAYPUT, // 49 - CON_HITRADIUS, // 50 - CON_IFP, // 51 - CON_COUNT, // 52 - CON_IFACTOR, // 53 - CON_MUSIC, // 54 - CON_INCLUDE, // 55 - CON_IFSTRENGTH, // 56 - CON_DEFINESOUND, // 57 - CON_GUTS, // 58 - CON_IFSPAWNEDBY, // 59 - CON_GAMESTARTUP, // 60 - CON_WACKPLAYER, // 61 - CON_IFGAPZL, // 62 - CON_IFHITSPACE, // 63 - CON_IFOUTSIDE, // 64 - CON_IFMULTIPLAYER, // 65 - CON_OPERATE, // 66 - CON_IFINSPACE, // 67 - CON_DEBUG, // 68 - CON_ENDOFGAME, // 69 - CON_IFBULLETNEAR, // 70 - CON_IFRESPAWN, // 71 - CON_IFFLOORDISTL, // 72 - CON_IFCEILINGDISTL, // 73 - CON_SPRITEPAL, // 74 - CON_IFPINVENTORY, // 75 - CON_BETANAME, // 76 - CON_CACTOR, // 77 - CON_IFPHEALTHL, // 78 - CON_DEFINEQUOTE, // 79 - CON_QUOTE, // 80 - CON_IFINOUTERSPACE, // 81 - CON_IFNOTMOVING, // 82 - CON_RESPAWNHITAG, // 83 - CON_TIP, // 84 - CON_IFSPRITEPAL, // 85 - CON_MONEY, // 86 - CON_SOUNDONCE, // 87 - CON_ADDKILLS, // 88 - CON_STOPSOUND, // 89 - CON_IFAWAYFROMWALL, // 90 - CON_IFCANSEETARGET, // 91 - CON_GLOBALSOUND, // 92 - CON_LOTSOFGLASS, // 93 - CON_IFGOTWEAPONCE, // 94 - CON_GETLASTPAL, // 95 - CON_PKICK, // 96 - CON_MIKESND, // 97 - CON_USERACTOR, // 98 - CON_SIZEAT, // 99 - CON_ADDSTRENGTH, // 100 - CON_CSTATOR, // 101 - CON_MAIL, // 102 - CON_PAPER, // 103 - CON_TOSSWEAPON, // 104 - CON_SLEEPTIME, // 105 - CON_NULLOP, // 106 - CON_DEFINEVOLUMENAME, // 107 - CON_DEFINESKILLNAME, // 108 - CON_IFNOSOUNDS, // 109 - CON_CLIPDIST, // 110 - CON_IFANGDIFFL, // 111 - CON_GAMEVAR, // 112 - CON_IFVARL, // 113 - CON_IFVARG, // 114 - CON_SETVARVAR, // 115 - CON_SETVAR, // 116 - CON_ADDVARVAR, // 117 - CON_ADDVAR, // 118 - CON_IFVARVARL, // 119 - CON_IFVARVARG, // 120 - CON_ADDLOGVAR, // 121 - CON_ADDLOG, // 122 - CON_ONEVENT, // 123 - CON_ENDEVENT, // 124 - CON_IFVARE, // 125 - CON_IFVARVARE, // 126 - CON_SPGETLOTAG, // 127 - CON_SPGETHITAG, // 128 - CON_SECTGETLOTAG, // 129 - CON_SECTGETHITAG, // 130 - CON_IFSOUND, // 131 - CON_GETTEXTUREFLOOR, // 132 - CON_GETTEXTURECEILING, // 133 - CON_INITTIMER, // 134 - CON_STARTTRACK, // 135 - CON_RANDVAR, // 136 - CON_ENHANCED, // 137 - CON_GETANGLETOTARGET, // 138 - CON_GETACTORANGLE, // 139 - CON_SETACTORANGLE, // 140 - CON_MULVAR, // 141 - CON_MULVARVAR, // 142 - CON_DIVVAR, // 143 - CON_DIVVARVAR, // 144 - CON_MODVAR, // 145 - CON_MODVARVAR, // 146 - CON_ANDVAR, // 147 - CON_ANDVARVAR, // 148 - CON_ORVAR, // 149 - CON_ORVARVAR, // 150 - CON_GETPLAYERANGLE, // 151 - CON_SETPLAYERANGLE, // 152 - CON_LOCKPLAYER, // 153 - CON_SETSECTOR, // 154 - CON_GETSECTOR, // 155 - CON_SETACTOR, // 156 - CON_GETACTOR, // 157 - CON_SETWALL, // 158 - CON_GETWALL, // 159 - CON_FINDNEARACTOR, // 160 - CON_FINDNEARACTORVAR, // 161 - CON_SETACTORVAR, // 162 - CON_GETACTORVAR, // 163 - CON_ESPAWN, // 164 - CON_GETPLAYER, // 165 - CON_SETPLAYER, // 166 - CON_SQRT, // 167 - CON_EVENTLOADACTOR, // 168 - CON_ESPAWNVAR, // 169 - CON_GETUSERDEF, // 170 - CON_SETUSERDEF, // 171 - CON_SUBVARVAR, // 172 - CON_SUBVAR, // 173 - CON_IFVARN, // 174 - CON_IFVARVARN, // 175 - CON_IFVARAND, // 176 - CON_IFVARVARAND, // 177 - CON_MYOS, // 178 - CON_MYOSPAL, // 179 - CON_DISPLAYRAND, // 180 - CON_SIN, // 181 - CON_XORVARVAR, // 182 - CON_XORVAR, // 183 - CON_RANDVARVAR, // 184 - CON_MYOSX, // 185 - CON_MYOSPALX, // 186 - CON_GMAXAMMO, // 187 - CON_SMAXAMMO, // 188 - CON_STARTLEVEL, // 189 - CON_ESHOOT, // 190 - CON_QSPAWN, // 191 - CON_ROTATESPRITE, // 192 - CON_DEFINEPROJECTILE, // 193 - CON_SPRITESHADOW, // 194 - CON_COS, // 195 - CON_ESHOOTVAR, // 196 - CON_FINDNEARACTOR3D, // 197 - CON_FINDNEARACTOR3DVAR, // 198 - CON_FLASH, // 199 - CON_QSPAWNVAR, // 200 - CON_EQSPAWN, // 201 - CON_EQSPAWNVAR, // 202 - CON_MINITEXT, // 203 - CON_GAMETEXT, // 204 - CON_DIGITALNUMBER, // 205 - CON_ADDWEAPONVAR, // 206 - CON_SETPROJECTILE, // 207 - CON_ANGOFF, // 208 - CON_UPDATESECTOR, // 209 - CON_INSERTSPRITEQ, // 210 - CON_ANGOFFVAR, // 211 - CON_WHILEVARN, // 212 - CON_SWITCH, // 213 - CON_CASE, // 214 - CON_DEFAULT, // 215 - CON_ENDSWITCH, // 216 - CON_SHOOTVAR, // 217 - CON_SOUNDVAR, // 218 - CON_FINDPLAYER, // 219 - CON_FINDOTHERPLAYER, // 220 - CON_ACTIVATEBYSECTOR, // 221 - CON_OPERATESECTORS, // 222 - CON_OPERATERESPAWNS, // 223 - CON_OPERATEACTIVATORS, // 224 - CON_OPERATEMASTERSWITCHES, // 225 - CON_CHECKACTIVATORMOTION, // 226 - CON_ZSHOOT, // 227 - CON_DIST, // 228 - CON_LDIST, // 229 - CON_SHIFTVARL, // 230 - CON_SHIFTVARR, // 231 - CON_SPRITENVG, // 232 - CON_GETANGLE, // 233 - CON_WHILEVARVARN, // 234 - CON_HITSCAN, // 235 - CON_TIME, // 236 - CON_GETPLAYERVAR, // 237 - CON_SETPLAYERVAR, // 238 - CON_MULSCALE, // 239 - CON_SETASPECT, // 240 - CON_EZSHOOT, // 241 - CON_SPRITENOSHADE, // 242 - CON_MOVESPRITE, // 243 - CON_CHECKAVAILWEAPON, // 244 - CON_SOUNDONCEVAR, // 245 - CON_UPDATESECTORZ, // 246 - CON_STOPALLSOUNDS, // 247 - CON_SSP, // 248 - CON_STOPSOUNDVAR, // 249 - CON_DISPLAYRANDVAR, // 250 - CON_DISPLAYRANDVARVAR, // 251 - CON_CHECKAVAILINVEN, // 252 - CON_GLOBALSOUNDVAR, // 253 - CON_GUNIQHUDID, // 254 - CON_GETPROJECTILE, // 255 - CON_GETTHISPROJECTILE, // 256 - CON_SETTHISPROJECTILE, // 257 - CON_DEFINECHEAT, // 258 - CON_CHEATKEYS, // 259 - CON_USERQUOTE, // 260 - CON_PRECACHE, // 261 - CON_DEFINEGAMEFUNCNAME, // 262 - CON_REDEFINEQUOTE, // 263 - CON_QSPRINTF, // 264 - CON_GETPNAME, // 265 - CON_QSTRCAT, // 266 - CON_QSTRCPY, // 267 - CON_SETSPRITE, // 268 - CON_ROTATEPOINT, // 269 - CON_DRAGPOINT, // 270 - CON_GETZRANGE, // 271 - CON_CHANGESPRITESTAT, // 272 - CON_GETCEILZOFSLOPE, // 273 - CON_GETFLORZOFSLOPE, // 274 - CON_NEARTAG, // 275 - CON_DEFINEGAMETYPE, // 276 - CON_CHANGESPRITESECT, // 277 - CON_SPRITEFLAGS, // 278 - CON_SAVEGAMEVAR, // 279 - CON_READGAMEVAR, // 280 - CON_FINDNEARSPRITE, // 281 - CON_FINDNEARSPRITEVAR, // 282 - CON_FINDNEARSPRITE3D, // 283 - CON_FINDNEARSPRITE3DVAR,// 284 - CON_DYNAMICREMAP, // 285 - CON_SETINPUT, // 286 - CON_GETINPUT, // 287 - CON_SAVE, // 288 - CON_CANSEE, // 289 - CON_CANSEESPR, // 290 - CON_FINDNEARACTORZ, // 291 - CON_FINDNEARACTORZVAR, // 292 - CON_FINDNEARSPRITEZ, // 293 - CON_FINDNEARSPRITEZVAR, // 294 - CON_ZSHOOTVAR, // 295 - CON_EZSHOOTVAR, // 296 - CON_GETCURRADDRESS, // 297 - CON_JUMP, // 298 - CON_QSTRLEN, // 299 - CON_GETINCANGLE, // 300 - CON_QUAKE, // 301 - CON_SHOWVIEW, // 302 - CON_HEADSPRITESTAT, // 303 - CON_PREVSPRITESTAT, // 304 - CON_NEXTSPRITESTAT, // 305 - CON_HEADSPRITESECT, // 306 - CON_PREVSPRITESECT, // 307 - CON_NEXTSPRITESECT, // 308 - CON_GETKEYNAME, // 309 - CON_QSUBSTR, // 310 - CON_GAMETEXTZ, // 311 - CON_DIGITALNUMBERZ, // 312 - CON_SPRITENOPAL, // 313 - CON_HITRADIUSVAR, // 314 - CON_ROTATESPRITE16, // 315 - CON_GAMEARRAY, // 316 - CON_SETARRAY, // 317 - CON_RESIZEARRAY, // 318 - CON_WRITEARRAYTOFILE, // 319 - CON_READARRAYFROMFILE, // 320 - CON_STARTTRACKVAR, // 321 - CON_QGETSYSSTR, // 322 - CON_GETTICKS, // 323 - CON_GETTSPR, // 324 - CON_SETTSPR, // 325 - CON_SAVEMAPSTATE, // 326 - CON_LOADMAPSTATE, // 327 - CON_CLEARMAPSTATE, // 328 - CON_SCRIPTSIZE, // 329 - CON_SETGAMENAME, // 330 - CON_CMENU, // 331 - CON_GETTIMEDATE, // 332 - CON_ACTIVATECHEAT, // 333 - CON_SETGAMEPALETTE, // 334 - CON_SETDEFNAME, // 335 - CON_SETCFGNAME, // 336 - CON_IFVAROR, // 337 - CON_IFVARVAROR, // 338 - CON_IFVARXOR, // 339 - CON_IFVARVARXOR, // 340 - CON_IFVAREITHER, // 341 - CON_IFVARVAREITHER, // 342 - CON_GETARRAYSIZE, // 343 - CON_SAVENN, // 344 - CON_COPY, // 345 - CON_INV, // 346 - CON_SECTOROFWALL, // 347 - CON_QSTRNCAT, // 348 - CON_IFACTORSOUND, // 349 - CON_STOPACTORSOUND, // 350 - CON_IFCLIENT, // 351 - CON_IFSERVER, // 352 - CON_SECTSETINTERPOLATION, // 353 - CON_SECTCLEARINTERPOLATION, // 354 - CON_CLIPMOVE, // 355 - CON_LINEINTERSECT, // 356 - CON_RAYINTERSECT, // 357 - CON_CALCHYPOTENUSE, // 358 - CON_CLIPMOVENOSLIDE, // 359 - CON_END -}; -#endif diff --git a/polymer-perf/eduke32/source/gamedefs.h b/polymer-perf/eduke32/source/gamedefs.h deleted file mode 100644 index 2e0a5c04c..000000000 --- a/polymer-perf/eduke32/source/gamedefs.h +++ /dev/null @@ -1,181 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -//**************************************************************************** -// -// gamedefs.h -// -// common defines between the game and the setup program -// -//**************************************************************************** - -#ifndef _gamedefs_public_ -#define _gamedefs_public_ -#ifdef __cplusplus -extern "C" { -#endif - -//**************************************************************************** -// -// DEFINES -// -//**************************************************************************** - -// -// Setup program defines -// -#define SETUPFILENAME "eduke32.cfg" - - -// Max number of players - -#define MAXPLAYERS 16 - -// Number of Mouse buttons - -#define MAXMOUSEBUTTONS 10 - -// Number of JOY buttons - -#define MAXJOYBUTTONS (32+4) - -// Number of EXTERNAL buttons - -//#define MAXEXTERNALBUTTONS 6 - -// -// modem string defines -// - -#define MAXMODEMSTRING 50 - -// MACRO defines - -#define MAXMACROS 10 -#define MAXMACROLENGTH 34 - -// Phone list defines - -#define PHONENUMBERLENGTH 28 -#define PHONENAMELENGTH 16 -#define MAXPHONEENTRIES 10 - -// length of program functions - -#define MAXFUNCTIONLENGTH 30 - -// length of axis functions - -#define MAXAXISFUNCTIONLENGTH 30 - -// Max Player Name length - -#define MAXPLAYERNAMELENGTH 11 - -// Max RTS Name length - -#define MAXRTSNAMELENGTH 15 - -// Number of Mouse Axes - -#define MAXMOUSEAXES 2 - -// Number of JOY axes - -#define MAXJOYAXES 8 - -// MIN/MAX scale value for controller scales - -#define MAXCONTROLSCALEVALUE (1<<19) - -// DEFAULT scale value for controller scales - -#define DEFAULTCONTROLSCALEVALUE (1<<16) - -// base value for controller scales - -#define BASECONTROLSCALEVALUE (1<<16) - -// DEFAULT mouse sensitivity scale - -#define DEFAULTMOUSESENSITIVITY 7 - -enum - { - gametype_network=3, - gametype_serial=1, - gametype_modem=2 - }; - -enum - { - connecttype_dialing=0, - connecttype_answer=1, - connecttype_alreadyconnected=2 - }; - -enum - { - screenbuffer_320x200, - screenbuffer_640x400, - screenbuffer_640x480, - screenbuffer_800x600, - screenbuffer_1024x768, - screenbuffer_1280x1024, - screenbuffer_1600x1200 - }; - -enum - { - vesa_320x200, - vesa_360x200, - vesa_320x240, - vesa_360x240, - vesa_320x400, - vesa_360x400, - vesa_640x350, - vesa_640x400, - vesa_640x480, - vesa_800x600, - vesa_1024x768, - vesa_1280x1024, - vesa_1600x1200 - }; - -enum - { - screenmode_chained, - screenmode_vesa, - screenmode_buffered, - screenmode_tseng, - screenmode_paradise, - screenmode_s3, - screenmode_crystal, - screenmode_redblue, - }; - - -#ifdef __cplusplus -}; -#endif -#endif - diff --git a/polymer-perf/eduke32/source/gameexec.c b/polymer-perf/eduke32/source/gameexec.c deleted file mode 100644 index a5742c7b8..000000000 --- a/polymer-perf/eduke32/source/gameexec.c +++ /dev/null @@ -1,5187 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include -#include -#include - -#include "duke3d.h" -#include "gamedef.h" -#include "gameexec.h" -#include "scriplib.h" -#include "savegame.h" -#include "premap.h" -#include "osdcmds.h" -#include "osd.h" -#include "menus.h" - -#if KRANDDEBUG -# define GAMEEXEC_INLINE -# define GAMEEXEC_STATIC -#else -# define GAMEEXEC_INLINE inline -# define GAMEEXEC_STATIC static -#endif - -void G_RestoreMapState(mapstate_t *save); -void G_SaveMapState(mapstate_t *save); - -vmstate_t vm; - -int32_t g_errorLineNum; -int32_t g_tw; -extern int32_t ticrandomseed; - -GAMEEXEC_STATIC int32_t VM_Execute(int32_t once); - -#include "gamestructures.c" - -void VM_ScriptInfo(void) -{ - intptr_t *p; - - if (!script) - return; - - if (insptr) - { - for (p=insptr-20; p>12&&(*p&0xFFF)>12),keyw[*p&0xFFF]); - else - initprintf(" %d",(int32_t)*p); - } - - initprintf("\n"); - } - - if (vm.g_i) - initprintf("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum); - - initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw); -} - -void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int32_t iPlayer, register int32_t lDist) -{ - if (!apScriptGameEvent[iEventID]) - return; - - { - intptr_t *oinsptr=insptr; - vmstate_t vm_backup; - vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0], - &sprite[iActor], 0 }; - - insptr = apScriptGameEvent[iEventID]; - - Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t)); - Bmemcpy(&vm, &tempvm, sizeof(vmstate_t)); - - VM_Execute(0); - - if (vm.g_flags & VM_KILL) - { - // if player was set to squish, first stop that... - if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i) - g_player[vm.g_p].ps->actorsqu = -1; - - deletesprite(vm.g_i); - } - - Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t)); - insptr = oinsptr; - } -} - -static inline int32_t VM_CheckSquished(void) -{ - sectortype *sc = §or[vm.g_sp->sectnum]; - - if ((vm.g_sp->picnum == APLAYER && ud.clipping) || sc->lotag == 23 || - (vm.g_sp->pal == 1 ? - !(sc->floorz - sc->ceilingz < (32<<8) && (sc->lotag&32768) == 0) : - !(sc->floorz - sc->ceilingz < (12<<8)))) - return 0; - - P_DoQuote(QUOTE_SQUISHED, g_player[vm.g_p].ps); - - if (A_CheckEnemySprite(vm.g_sp)) vm.g_sp->xvel = 0; - - if (vm.g_sp->pal == 1) - { - actor[vm.g_i].picnum = SHOTSPARK1; - actor[vm.g_i].extra = 1; - return 0; - } - - return 1; -} - -GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *p) -{ - int32_t n = 128-(krand()&255); - - p->horiz += 64; - p->return_to_center = 9; - p->look_ang = p->rotscrnang = n>>1; -} - -GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s) -{ - int32_t bx,by,bxvect,byvect,i; - int32_t mx = s->x, my = s->y; - int32_t mxvect = sintable[(s->ang+512)&2047]; - int32_t myvect = sintable[s->ang&2047]; - - if (A_CheckEnemySprite(s) && s->extra <= 0) // hack - return 0; - - for (i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list - { - if (OW == i) - continue; - - bx = SX-mx; - by = SY-my; - bxvect = sintable[(SA+512)&2047]; - byvect = sintable[SA&2047]; - - if ((mxvect * bx) + (myvect * by) >= 0 && (bxvect * bx) + (byvect * by) < 0) - { - if (klabs((bxvect * by) - (byvect * bx)) < 65536<<6) - { - s->ang -= 512+(krand()&1024); - return 1; - } - } - } - return 0; -} - -int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs) -{ - spritetype *s = &sprite[iActor]; - - if (s->picnum != APLAYER && (actor[iActor].t_data[0]&63) > 2) - return(s->ang + 1024); - - { - int32_t furthest_angle=0; - int32_t d; - int32_t greatestd = -(1<<30); - int32_t angincs = 2048/angs,j; - hitdata_t hitinfo; - - for (j=s->ang; j<(2048+s->ang); j+=angincs) - { - s->z -= (8<<8); - hitscan((const vec3_t *)s, s->sectnum, - sintable[(j+512)&2047], - sintable[j&2047],0, - &hitinfo,CLIPMASK1); - s->z += (8<<8); - d = klabs(hitinfo.pos.x-s->x) + klabs(hitinfo.pos.y-s->y); - - if (d > greatestd) - { - greatestd = d; - furthest_angle = j; - } - } - return (furthest_angle&2047); - } -} - -int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_t *day) -{ - if ((actor[iActor].t_data[0]&63)) return -1; - { - int32_t d, da;//, d, cd, ca,tempx,tempy,cx,cy; - int32_t j, angincs; - spritetype *s = &sprite[iActor]; - hitdata_t hitinfo; - - if ((!g_netServer && ud.multimode < 2) && ud.player_skill < 3) - angincs = 2048/2; - else angincs = 2048/(1+(krand()&1)); - - for (j=ts->ang; j<(2048+ts->ang); j+=(angincs-(krand()&511))) - { - ts->z -= (16<<8); - hitscan((const vec3_t *)ts, ts->sectnum, - sintable[(j+512)&2047], - sintable[j&2047],16384-(krand()&32767), - &hitinfo,CLIPMASK1); - - ts->z += (16<<8); - - d = klabs(hitinfo.pos.x-ts->x)+klabs(hitinfo.pos.y-ts->y); - da = klabs(hitinfo.pos.x-s->x)+klabs(hitinfo.pos.y-s->y); - - if (d < da && hitinfo.hitsect > -1) - if (cansee(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z, - hitinfo.hitsect,s->x,s->y,s->z-(16<<8),s->sectnum)) - { - *dax = hitinfo.pos.x; - *day = hitinfo.pos.y; - return hitinfo.hitsect; - } - } - return -1; - } -} - -void A_GetZLimits(int32_t iActor) -{ - spritetype *s = &sprite[iActor]; - -// if (s->statnum == STAT_PLAYER || s->statnum == STAT_STANDABLE || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_ACTOR || s->statnum == STAT_PROJECTILE) - { - int32_t hz,lz,zr = 127L; - int32_t cstat = s->cstat; - - s->cstat = 0; - - if (s->statnum == STAT_PROJECTILE) - zr = 4L; - - s->z -= ZOFFSET; - getzrange((vec3_t *)s,s->sectnum,&actor[iActor].ceilingz,&hz,&actor[iActor].floorz,&lz,zr,CLIPMASK0); - s->z += ZOFFSET; - - s->cstat = cstat; - - if ((lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0) - { - lz &= (MAXSPRITES-1); - if (A_CheckEnemySprite(&sprite[lz]) && sprite[lz].pal != 1) - { - if (s->statnum != 4) - { - actor[iActor].dispicnum = -4; // No shadows on actors - s->xvel = -256; - A_SetSprite(iActor,CLIPMASK0); - } - } - else if (sprite[lz].picnum == APLAYER && A_CheckEnemySprite(s)) - { - actor[iActor].dispicnum = -4; // No shadows on actors - s->xvel = -256; - A_SetSprite(iActor,CLIPMASK0); - } - else if (s->statnum == STAT_PROJECTILE && sprite[lz].picnum == APLAYER) - if (s->owner == lz) - { - actor[iActor].ceilingz = sector[s->sectnum].ceilingz; - actor[iActor].floorz = sector[s->sectnum].floorz; - } - } - } - /* - else - { - actor[iActor].ceilingz = sector[s->sectnum].ceilingz; - actor[iActor].floorz = sector[s->sectnum].floorz; - } - */ -} - -void A_Fall(int32_t iActor) -{ - spritetype *s = &sprite[iActor]; - int32_t hz,lz,c = g_spriteGravity; - - if (G_CheckForSpaceFloor(s->sectnum)) - c = 0; - else - { - if (G_CheckForSpaceCeiling(s->sectnum) || sector[s->sectnum].lotag == 2) - c = g_spriteGravity/6; - } - - if (s->statnum == STAT_ACTOR || s->statnum == STAT_PLAYER || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_STANDABLE) - { - int32_t cstat = s->cstat; - s->cstat = 0; - s->z -= ZOFFSET; - getzrange((vec3_t *)s,s->sectnum,&actor[iActor].ceilingz,&hz,&actor[iActor].floorz,&lz,127L,CLIPMASK0); - s->z += ZOFFSET; - s->cstat = cstat; - } - else - { - actor[iActor].ceilingz = sector[s->sectnum].ceilingz; - actor[iActor].floorz = sector[s->sectnum].floorz; - } - - if (s->z < actor[iActor].floorz-(ZOFFSET)) - { - if (sector[s->sectnum].lotag == 2 && s->zvel > 3122) - s->zvel = 3144; - s->z += s->zvel = min(6144, s->zvel+c); - } - if (s->z >= actor[iActor].floorz-(ZOFFSET)) - { - s->z = actor[iActor].floorz - ZOFFSET; - s->zvel = 0; - } -} - -int32_t G_GetAngleDelta(int32_t a,int32_t na) -{ - a &= 2047; - na &= 2047; - - if (klabs(a-na) < 1024) - { -// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a); - return (na-a); - } - - if (na > 1024) na -= 2048; - if (a > 1024) a -= 2048; - - na -= 2048; - a -= 2048; -// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a); - return (na-a); -} - -GAMEEXEC_STATIC GAMEEXEC_INLINE void VM_AlterAng(int32_t a) -{ - intptr_t *moveptr; - int32_t ticselapsed = (vm.g_t[0])&31; - - if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > &script[g_scriptSize]) - { - vm.g_t[1] = 0; - OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum); - return; - } - - vm.g_sp->xvel += (*moveptr-vm.g_sp->xvel)/5; - if (vm.g_sp->zvel < 648) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)/5; - - if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack - return; - - if (a&seekplayer) - { - int32_t aang = vm.g_sp->ang, angdif, goalang; - int32_t j = g_player[vm.g_p].ps->holoduke_on; - - // NOTE: looks like 'owner' is set to target sprite ID... - - if (j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,vm.g_sp->x,vm.g_sp->y,vm.g_sp->z,vm.g_sp->sectnum)) - vm.g_sp->owner = j; - else vm.g_sp->owner = g_player[vm.g_p].ps->i; - - if (sprite[vm.g_sp->owner].picnum == APLAYER) - goalang = getangle(actor[vm.g_i].lastvx-vm.g_sp->x,actor[vm.g_i].lastvy-vm.g_sp->y); - else - goalang = getangle(sprite[vm.g_sp->owner].x-vm.g_sp->x,sprite[vm.g_sp->owner].y-vm.g_sp->y); - - if (vm.g_sp->xvel && vm.g_sp->picnum != DRONE) - { - angdif = G_GetAngleDelta(aang,goalang); - - if (ticselapsed < 2) - { - if (klabs(angdif) < 256) - { - j = 128-(krand()&256); - vm.g_sp->ang += j; - if (A_GetHitscanRange(vm.g_i) < 844) - vm.g_sp->ang -= j; - } - } - else if (ticselapsed > 18 && ticselapsed < GAMETICSPERSEC) // choose - { - if (klabs(angdif>>2) < 128) vm.g_sp->ang = goalang; - else vm.g_sp->ang += angdif>>2; - } - } - else vm.g_sp->ang = goalang; - } - - if (ticselapsed < 1) - { - int32_t j = 2; - if (a&furthestdir) - { - vm.g_sp->ang = A_GetFurthestAngle(vm.g_i,j); - vm.g_sp->owner = g_player[vm.g_p].ps->i; - } - - if (a&fleeenemy) - { - vm.g_sp->ang = A_GetFurthestAngle(vm.g_i,j); // += angdif; // = G_GetAngleDelta(aang,goalang)>>1; - } - } -} - -GAMEEXEC_STATIC void VM_Move(void) -{ - int32_t l; - intptr_t *moveptr; - int32_t a = vm.g_sp->hitag, goalang, angdif; - int32_t daxvel; - int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0); - - if (a == -1) a = 0; - - vm.g_t[0]++; - - if (vm.g_t[1] == 0 || a == 0) - { - if (deadflag || (actor[vm.g_i].bposx != vm.g_sp->x) || (actor[vm.g_i].bposy != vm.g_sp->y)) - { - actor[vm.g_i].bposx = vm.g_sp->x; - actor[vm.g_i].bposy = vm.g_sp->y; - setsprite(vm.g_i,(vec3_t *)vm.g_sp); - } - return; - } - - if (a&face_player && !deadflag) - { - if (g_player[vm.g_p].ps->newowner >= 0) - goalang = getangle(g_player[vm.g_p].ps->opos.x-vm.g_sp->x,g_player[vm.g_p].ps->opos.y-vm.g_sp->y); - else goalang = getangle(g_player[vm.g_p].ps->pos.x-vm.g_sp->x,g_player[vm.g_p].ps->pos.y-vm.g_sp->y); - angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2; - if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) - angdif *= 2; - vm.g_sp->ang += angdif; - } - - if (a&spin && !deadflag) - vm.g_sp->ang += sintable[((vm.g_t[0]<<3)&2047)]>>6; - - if (a&face_player_slow && !deadflag) - { - if (g_player[vm.g_p].ps->newowner >= 0) - goalang = getangle(g_player[vm.g_p].ps->opos.x-vm.g_sp->x,g_player[vm.g_p].ps->opos.y-vm.g_sp->y); - else goalang = getangle(g_player[vm.g_p].ps->pos.x-vm.g_sp->x,g_player[vm.g_p].ps->pos.y-vm.g_sp->y); - angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>4; - if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) - angdif *= 2; - vm.g_sp->ang += angdif; - } - - if (((a&jumptoplayer) == jumptoplayer) && !deadflag) - { - if (vm.g_t[0] < 16) - vm.g_sp->zvel -= (sintable[(512+(vm.g_t[0]<<4))&2047]>>5); - } - - if (a&face_player_smart && !deadflag) - { - int32_t newx = g_player[vm.g_p].ps->pos.x+(g_player[vm.g_p].ps->vel.x/768); - int32_t newy = g_player[vm.g_p].ps->pos.y+(g_player[vm.g_p].ps->vel.y/768); - - goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y); - angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2; - if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) - angdif *= 2; - vm.g_sp->ang += angdif; - } - - if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > &script[g_scriptSize]) - { - vm.g_t[1] = 0; - OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum); - return; - } - - if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1; - if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1; - - if (a&dodgebullet && !deadflag) - A_Dodge(vm.g_sp); - - if (vm.g_sp->picnum != APLAYER) - VM_AlterAng(a); - - if (vm.g_sp->xvel > -6 && vm.g_sp->xvel < 6) vm.g_sp->xvel = 0; - - a = A_CheckEnemySprite(vm.g_sp); - - if (vm.g_sp->xvel || vm.g_sp->zvel) - { - if (a && vm.g_sp->picnum != ROTATEGUN) - { - if ((vm.g_sp->picnum == DRONE || vm.g_sp->picnum == COMMANDER) && vm.g_sp->extra > 0) - { - if (vm.g_sp->picnum == COMMANDER) - { - actor[vm.g_i].floorz = l = getflorzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); - if (vm.g_sp->z > (l-(8<<8))) - { - if (vm.g_sp->z > (l-(8<<8))) vm.g_sp->z = l-(8<<8); - vm.g_sp->zvel = 0; - } - - actor[vm.g_i].ceilingz = l = getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); - if ((vm.g_sp->z-l) < (80<<8)) - { - vm.g_sp->z = l+(80<<8); - vm.g_sp->zvel = 0; - } - } - else - { - if (vm.g_sp->zvel > 0) - { - actor[vm.g_i].floorz = l = getflorzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); - if (vm.g_sp->z > (l-(30<<8))) - vm.g_sp->z = l-(30<<8); - } - else - { - actor[vm.g_i].ceilingz = l = getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); - if ((vm.g_sp->z-l) < (50<<8)) - { - vm.g_sp->z = l+(50<<8); - vm.g_sp->zvel = 0; - } - } - } - } - else if (vm.g_sp->picnum != ORGANTIC) - { - if (vm.g_sp->zvel > 0 && actor[vm.g_i].floorz < vm.g_sp->z) - vm.g_sp->z = actor[vm.g_i].floorz; - if (vm.g_sp->zvel < 0) - { - l = getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y); - if ((vm.g_sp->z-l) < (66<<8)) - { - vm.g_sp->z = l+(66<<8); - vm.g_sp->zvel >>= 1; - } - } - } - } - else if (vm.g_sp->picnum == APLAYER) - if ((vm.g_sp->z-actor[vm.g_i].ceilingz) < (32<<8)) - vm.g_sp->z = actor[vm.g_i].ceilingz+(32<<8); - - daxvel = vm.g_sp->xvel; - angdif = vm.g_sp->ang; - - if (a && vm.g_sp->picnum != ROTATEGUN) - { - if (vm.g_x < 960 && vm.g_sp->xrepeat > 16) - { - - daxvel = -(1024-vm.g_x); - angdif = getangle(g_player[vm.g_p].ps->pos.x-vm.g_sp->x,g_player[vm.g_p].ps->pos.y-vm.g_sp->y); - - if (vm.g_x < 512) - { - g_player[vm.g_p].ps->vel.x = 0; - g_player[vm.g_p].ps->vel.y = 0; - } - else - { - g_player[vm.g_p].ps->vel.x = mulscale(g_player[vm.g_p].ps->vel.x,g_player[vm.g_p].ps->runspeed-0x2000,16); - g_player[vm.g_p].ps->vel.y = mulscale(g_player[vm.g_p].ps->vel.y,g_player[vm.g_p].ps->runspeed-0x2000,16); - } - } - else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER) - { - if (actor[vm.g_i].bposz != vm.g_sp->z || ((!g_netServer && ud.multimode < 2) && ud.player_skill < 2)) - { - if ((vm.g_t[0]&1) || g_player[vm.g_p].ps->actorsqu == vm.g_i) return; - else daxvel <<= 1; - } - else - { - if ((vm.g_t[0]&3) || g_player[vm.g_p].ps->actorsqu == vm.g_i) return; - else daxvel <<= 2; - } - } - } - - { - vec3_t tmpvect = { (daxvel*(sintable[(angdif+512)&2047]))>>14, - (daxvel*(sintable[angdif&2047]))>>14, vm.g_sp->zvel - }; - - actor[vm.g_i].movflag = A_MoveSprite(vm.g_i,&tmpvect,CLIPMASK0); - } - } - - if (!a) return; - - if (sector[vm.g_sp->sectnum].ceilingstat&1) - vm.g_sp->shade += (sector[vm.g_sp->sectnum].ceilingshade-vm.g_sp->shade)>>1; - else vm.g_sp->shade += (sector[vm.g_sp->sectnum].floorshade-vm.g_sp->shade)>>1; - -// wtf? - /* - if (sector[vm.g_sp->sectnum].floorpicnum == MIRROR) - deletesprite(vm.g_i); - */ -} - -GAMEEXEC_STATIC GAMEEXEC_INLINE void __fastcall VM_DoConditional(register int32_t condition) -{ - if (condition || ((insptr = (intptr_t *)*(insptr+1)) && (((*insptr) & 0xfff) == CON_ELSE))) - { - // skip 'else' pointer.. and... - insptr += 2; - VM_Execute(1); - return; - } -} - -GAMEEXEC_STATIC int32_t VM_Execute(int32_t once) -{ - register int32_t tw = *insptr; - - // jump directly into the loop, saving us from the checks during the first iteration - goto skip_check; - - while (!once) - { - if (vm.g_flags & (VM_RETURN|VM_KILL|VM_NOEXECUTE)) - return 1; - - tw = *insptr; - -skip_check: - // Bsprintf(g_szBuf,"Parsing: %d",*insptr); - // AddLog(g_szBuf); - - g_errorLineNum = tw>>12; - g_tw = tw &= 0xFFF; - - switch (tw) - { - case CON_REDEFINEQUOTE: - insptr++; - { - int32_t q = *insptr++, i = *insptr++; - if ((ScriptQuotes[q] == NULL || ScriptQuoteRedefinitions[i] == NULL)) - { - OSD_Printf(CON_ERROR "%d %d null quote\n",g_errorLineNum,keyw[g_tw],q,i); - break; - } - Bstrcpy(ScriptQuotes[q],ScriptQuoteRedefinitions[i]); - continue; - } - - case CON_GETTHISPROJECTILE: - case CON_SETTHISPROJECTILE: - insptr++; - { - // syntax [gs]etplayer[].x - // - int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; - - VM_AccessActiveProjectile(tw==CON_SETTHISPROJECTILE,lVar1,lLabelID,lVar2); - continue; - } - - case CON_IFRND: - VM_DoConditional(rnd(*(++insptr))); - continue; - - case CON_IFCANSHOOTTARGET: - { - int32_t j; - if (vm.g_x > 1024) - { - int16_t temphit, sclip = 768, angdif = 16; - - j = A_CheckHitSprite(vm.g_i,&temphit); - - if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->xrepeat > 56) - { - sclip = 3084; - angdif = 48; - } - - if (j == (1<<30)) - { - VM_DoConditional(1); - break; - } - if (j > sclip) - { - if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum) - j = 0; - else - { - vm.g_sp->ang += angdif; - j = A_CheckHitSprite(vm.g_i,&temphit); - vm.g_sp->ang -= angdif; - if (j > sclip) - { - if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum) - j = 0; - else - { - vm.g_sp->ang -= angdif; - j = A_CheckHitSprite(vm.g_i,&temphit); - vm.g_sp->ang += angdif; - if (j > 768) - { - if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum) - j = 0; - else j = 1; - } - else j = 0; - } - } - else j = 0; - } - } - else j = 0; - } - else j = 1; - - VM_DoConditional(j); - } - continue; - - case CON_IFCANSEETARGET: - { - int32_t j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-((krand()&41)<<8), - vm.g_sp->sectnum,g_player[vm.g_p].ps->pos.x,g_player[vm.g_p].ps->pos.y, - g_player[vm.g_p].ps->pos.z/*-((krand()&41)<<8)*/,sprite[g_player[vm.g_p].ps->i].sectnum); - VM_DoConditional(j); - if (j) actor[vm.g_i].timetosleep = SLEEPTIME; - } - continue; - - case CON_IFACTORNOTSTAYPUT: - VM_DoConditional(actor[vm.g_i].actorstayput == -1); - continue; - - case CON_IFCANSEE: - { - spritetype *s = &sprite[g_player[vm.g_p].ps->i]; - int32_t j; - - // select sprite for monster to target - // if holoduke is on, let them target holoduke first. - // - if (g_player[vm.g_p].ps->holoduke_on >= 0) - { - s = &sprite[g_player[vm.g_p].ps->holoduke_on]; - j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((32<<8)-1)),vm.g_sp->sectnum, - s->x,s->y,s->z,s->sectnum); - - if (j == 0) - { - // they can't see player's holoduke - // check for player... - s = &sprite[g_player[vm.g_p].ps->i]; - } - } - - // can they see player, (or player's holoduke) - j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((47<<8))),vm.g_sp->sectnum, - s->x,s->y,s->z-(24<<8),s->sectnum); - - if (j == 0) - { - // search around for target player - - // also modifies 'target' x&y if found.. - - j = 1; - if (A_FurthestVisiblePoint(vm.g_i,s,&actor[vm.g_i].lastvx,&actor[vm.g_i].lastvy) == -1) - j = 0; - } - else - { - // else, they did see it. - // save where we were looking... - actor[vm.g_i].lastvx = s->x; - actor[vm.g_i].lastvy = s->y; - } - - if (j && (vm.g_sp->statnum == STAT_ACTOR || vm.g_sp->statnum == STAT_STANDABLE)) - actor[vm.g_i].timetosleep = SLEEPTIME; - - VM_DoConditional(j); - continue; - } - - case CON_IFHITWEAPON: - VM_DoConditional(A_IncurDamage(vm.g_i) >= 0); - continue; - - case CON_IFSQUISHED: - VM_DoConditional(VM_CheckSquished()); - continue; - - case CON_IFDEAD: - // j = vm.g_sp->extra; - // if (vm.g_sp->picnum == APLAYER) - // j--; - VM_DoConditional(vm.g_sp->extra <= 0); - continue; - - case CON_AI: - insptr++; - //Following changed to use pointersizes - vm.g_t[5] = *insptr++; // Ai - vm.g_t[4] = *(intptr_t *)(vm.g_t[5]); // Action - if (vm.g_t[5]) vm.g_t[1] = *(((intptr_t *)vm.g_t[5])+1); // move - vm.g_sp->hitag = *(((intptr_t *)vm.g_t[5])+2); // move flags - vm.g_t[0] = vm.g_t[2] = vm.g_t[3] = 0; // count, actioncount... vm.g_t[3] = ?? - if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack - continue; - if (vm.g_sp->hitag&random_angle) - vm.g_sp->ang = krand()&2047; - continue; - - case CON_ACTION: - insptr++; - vm.g_t[2] = vm.g_t[3] = 0; - vm.g_t[4] = *insptr++; - continue; - - case CON_IFPDISTL: - VM_DoConditional(vm.g_x < *(++insptr)); - if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0) - actor[vm.g_i].timetosleep = SLEEPTIME; - continue; - - case CON_IFPDISTG: - VM_DoConditional(vm.g_x > *(++insptr)); - if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0) - actor[vm.g_i].timetosleep = SLEEPTIME; - continue; - - case CON_ELSE: - insptr = (intptr_t *) *(insptr+1); - continue; - - case CON_ADDSTRENGTH: - insptr++; - vm.g_sp->extra += *insptr++; - continue; - - case CON_STRENGTH: - insptr++; - vm.g_sp->extra = *insptr++; - continue; - - case CON_IFGOTWEAPONCE: - insptr++; - - if ((GametypeFlags[ud.coop]&GAMETYPE_WEAPSTAY) && (g_netServer || ud.multimode > 1)) - { - if (*insptr == 0) - { - int32_t j = 0; - for (; j < g_player[vm.g_p].ps->weapreccnt; j++) - if (g_player[vm.g_p].ps->weaprecs[j] == vm.g_sp->picnum) - break; - - VM_DoConditional(j < g_player[vm.g_p].ps->weapreccnt && vm.g_sp->owner == vm.g_i); - continue; - } - else if (g_player[vm.g_p].ps->weapreccnt < MAX_WEAPONS) - { - g_player[vm.g_p].ps->weaprecs[g_player[vm.g_p].ps->weapreccnt++] = vm.g_sp->picnum; - VM_DoConditional(vm.g_sp->owner == vm.g_i); - continue; - } - } - VM_DoConditional(0); - continue; - - case CON_GETLASTPAL: - insptr++; - if (vm.g_sp->picnum == APLAYER) - vm.g_sp->pal = g_player[vm.g_sp->yvel].ps->palookup; - else - { - if (vm.g_sp->pal == 1 && vm.g_sp->extra == 0) // hack for frozen - vm.g_sp->extra++; - vm.g_sp->pal = actor[vm.g_i].tempang; - } - actor[vm.g_i].tempang = 0; - continue; - - case CON_TOSSWEAPON: - insptr++; - P_DropWeapon(g_player[vm.g_sp->yvel].ps); - continue; - - case CON_NULLOP: - insptr++; - continue; - - case CON_MIKESND: - insptr++; - if (((unsigned)vm.g_sp->yvel >= MAXSOUNDS)) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->yvel); - insptr++; - continue; - } - if (!S_CheckSoundPlaying(vm.g_i,vm.g_sp->yvel)) - A_PlaySound(vm.g_sp->yvel,vm.g_i); - continue; - - case CON_PKICK: - insptr++; - - if ((g_netServer || ud.multimode > 1) && vm.g_sp->picnum == APLAYER) - { - if (g_player[otherp].ps->quick_kick == 0) - g_player[otherp].ps->quick_kick = 14; - } - else if (vm.g_sp->picnum != APLAYER && g_player[vm.g_p].ps->quick_kick == 0) - g_player[vm.g_p].ps->quick_kick = 14; - continue; - - case CON_SIZETO: - insptr++; - - { - int32_t j = (*insptr++ - vm.g_sp->xrepeat)<<1; - vm.g_sp->xrepeat += ksgn(j); - - if ((vm.g_sp->picnum == APLAYER && vm.g_sp->yrepeat < 36) || *insptr < vm.g_sp->yrepeat || - ((vm.g_sp->yrepeat*(tilesizy[vm.g_sp->picnum]+8))<<2) < (actor[vm.g_i].floorz - actor[vm.g_i].ceilingz)) - { - j = ((*insptr)-vm.g_sp->yrepeat)<<1; - if (klabs(j)) vm.g_sp->yrepeat += ksgn(j); - } - } - insptr++; - - continue; - - case CON_SIZEAT: - insptr++; - vm.g_sp->xrepeat = (uint8_t) *insptr++; - vm.g_sp->yrepeat = (uint8_t) *insptr++; - continue; - - case CON_SHOOT: - insptr++; - A_Shoot(vm.g_i,*insptr++); - continue; - - case CON_SOUNDONCE: - if (((unsigned)*(++insptr) >= MAXSOUNDS)) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr++); - continue; - } - if (!S_CheckSoundPlaying(vm.g_i,*insptr++)) - A_PlaySound(*(insptr-1),vm.g_i); - continue; - - case CON_IFACTORSOUND: - insptr++; - { - int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++); - - if (((unsigned)j >= MAXSOUNDS)) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); - insptr++; - continue; - } - insptr--; - VM_DoConditional(A_CheckSoundPlaying(i,j)); - } - continue; - - case CON_IFSOUND: - if (((unsigned)*(++insptr) >= MAXSOUNDS)) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); - insptr++; - continue; - } - VM_DoConditional(S_CheckSoundPlaying(vm.g_i,*insptr)); - // VM_DoConditional(SoundOwner[*insptr][0].i == vm.g_i); - continue; - - case CON_STOPSOUND: - if (((unsigned)*(++insptr) >= MAXSOUNDS)) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); - insptr++; - continue; - } - if (S_CheckSoundPlaying(vm.g_i,*insptr)) - S_StopSound((int16_t)*insptr); - insptr++; - continue; - - case CON_STOPACTORSOUND: - insptr++; - { - int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++); - - if ((j<0 || j>=MAXSOUNDS)) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - - if (A_CheckSoundPlaying(i,j)) - S_StopEnvSound(j,i); - - continue; - } - - case CON_GLOBALSOUND: - if (((unsigned)*(++insptr) >= MAXSOUNDS)) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); - insptr++; - continue; - } - if (vm.g_p == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND)) - A_PlaySound(*insptr,g_player[screenpeek].ps->i); - insptr++; - continue; - - case CON_SOUND: - if ((unsigned)*(++insptr) >= MAXSOUNDS) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); - insptr++; - continue; - } - A_PlaySound(*insptr++,vm.g_i); - continue; - - case CON_TIP: - insptr++; - g_player[vm.g_p].ps->tipincs = GAMETICSPERSEC; - continue; - - case CON_FALL: - insptr++; - vm.g_sp->xoffset = vm.g_sp->yoffset = 0; - - { - int32_t j = g_spriteGravity; - - if (G_CheckForSpaceCeiling(vm.g_sp->sectnum) || sector[vm.g_sp->sectnum].lotag == 2) - j = g_spriteGravity/6; - else if (G_CheckForSpaceFloor(vm.g_sp->sectnum)) - j = 0; - - if (!actor[vm.g_i].cgg-- || (sector[vm.g_sp->sectnum].floorstat&2)) - { - A_GetZLimits(vm.g_i); - actor[vm.g_i].cgg = 3; - } - - if (vm.g_sp->z < (actor[vm.g_i].floorz-ZOFFSET)) - { - vm.g_sp->z += vm.g_sp->zvel = min(6144, vm.g_sp->zvel+j); - - if (vm.g_sp->z > (actor[vm.g_i].floorz - ZOFFSET)) - vm.g_sp->z = (actor[vm.g_i].floorz - ZOFFSET); - continue; - } - vm.g_sp->z = actor[vm.g_i].floorz - ZOFFSET; - - if (A_CheckEnemySprite(vm.g_sp) || (vm.g_sp->picnum == APLAYER && vm.g_sp->owner >= 0)) - { - if (vm.g_sp->zvel > 3084 && vm.g_sp->extra <= 1) - { - // I'm guessing this DRONE check is from a beta version of the game - // where they crashed into the ground when killed - if (!(vm.g_sp->picnum == APLAYER && vm.g_sp->extra > 0) && vm.g_sp->pal != 1 && vm.g_sp->picnum != DRONE) - { - A_DoGuts(vm.g_i,JIBS6,15); - A_PlaySound(SQUISHED,vm.g_i); - A_Spawn(vm.g_i,BLOODPOOL); - } - actor[vm.g_i].picnum = SHOTSPARK1; - actor[vm.g_i].extra = 1; - vm.g_sp->zvel = 0; - } - else if (vm.g_sp->zvel > 2048 && sector[vm.g_sp->sectnum].lotag != 1) - { - j = vm.g_sp->sectnum; - pushmove((vec3_t *)vm.g_sp,(int16_t *)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); - if ((unsigned)j < MAXSECTORS) - changespritesect(vm.g_i,j); - A_PlaySound(THUD,vm.g_i); - } - } - } - - if (vm.g_sp->z > (actor[vm.g_i].floorz - ZOFFSET)) - { - A_GetZLimits(vm.g_i); - if (actor[vm.g_i].floorz != sector[vm.g_sp->sectnum].floorz) - vm.g_sp->z = (actor[vm.g_i].floorz - ZOFFSET); - continue; - } - else if (sector[vm.g_sp->sectnum].lotag == 1) - { - switch (DynamicTileMap[vm.g_sp->picnum]) - { - default: - // fix for flying/jumping monsters getting stuck in water - { - intptr_t *moveptr = (intptr_t *)vm.g_t[1]; - if (vm.g_sp->hitag & jumptoplayer || - (actorscrptr[vm.g_sp->picnum] && - (unsigned int)(moveptr - &script[0]) <= (unsigned int)(&script[g_scriptSize] - &script[0]) && - *(moveptr+1))) - { - // OSD_Printf("%d\n",*(moveptr+1)); - break; - } - } - // OSD_Printf("hitag: %d\n",vm.g_sp->hitag); - vm.g_sp->z += (24<<8); - case OCTABRAIN__STATIC: - case COMMANDER__STATIC: - case DRONE__STATIC: - break; - } - continue; - } - vm.g_sp->zvel = 0; - continue; - - case CON_RETURN: - vm.g_flags |= VM_RETURN; - case CON_ENDA: - case CON_BREAK: - case CON_ENDS: - return 1; - case CON_RIGHTBRACE: - insptr++; - return 1; - case CON_ADDAMMO: - if (((unsigned)*(++insptr) >= MAX_WEAPONS)) - { - OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); - insptr += 2; break; - } - if (g_player[vm.g_p].ps->ammo_amount[*insptr] >= g_player[vm.g_p].ps->max_ammo_amount[*insptr]) - { - vm.g_flags |= VM_NOEXECUTE; - break; - } - P_AddAmmo(*insptr, g_player[vm.g_p].ps, *(insptr+1)); - if (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && g_player[vm.g_p].ps->gotweapon & (1 << *insptr)) - { - if (!(g_player[vm.g_p].ps->weaponswitch & 1)) - P_AddWeaponNoSwitch(g_player[vm.g_p].ps, *insptr); - else P_AddWeapon(g_player[vm.g_p].ps, *insptr); - } - insptr += 2; - continue; - - case CON_MONEY: - insptr++; - A_SpawnMultiple(vm.g_i, MONEY, *insptr++); - continue; - - case CON_MAIL: - insptr++; - A_SpawnMultiple(vm.g_i, MAIL, *insptr++); - continue; - - case CON_SLEEPTIME: - insptr++; - actor[vm.g_i].timetosleep = (int16_t)*insptr++; - continue; - - case CON_PAPER: - insptr++; - A_SpawnMultiple(vm.g_i, PAPER, *insptr++); - continue; - - case CON_ADDKILLS: - insptr++; - g_player[vm.g_p].ps->actors_killed += *insptr++; - actor[vm.g_i].actorstayput = -1; - continue; - - case CON_LOTSOFGLASS: - insptr++; - A_SpawnGlass(vm.g_i,*insptr++); - continue; - - case CON_KILLIT: - insptr++; - vm.g_flags |= VM_KILL; - continue; - - case CON_ADDWEAPON: - if (((unsigned)*(++insptr) >= MAX_WEAPONS)) - { - OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); - insptr += 2; - continue; - } - if ((g_player[vm.g_p].ps->gotweapon & (1 << *insptr)) == 0) - { - if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, *insptr); - else P_AddWeapon(g_player[vm.g_p].ps, *insptr); - } - else if (g_player[vm.g_p].ps->ammo_amount[*insptr] >= g_player[vm.g_p].ps->max_ammo_amount[*insptr]) - { - vm.g_flags |= VM_NOEXECUTE; - continue; - } - P_AddAmmo(*insptr, g_player[vm.g_p].ps, *(insptr+1)); - if (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && g_player[vm.g_p].ps->gotweapon & (1 << *insptr)) - { - if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, *insptr); - else P_AddWeapon(g_player[vm.g_p].ps, *insptr); - } - insptr += 2; - continue; - - case CON_DEBUG: - insptr++; - initprintf("%"PRIdPTR"\n",*insptr++); - continue; - - case CON_ENDOFGAME: - insptr++; - g_player[vm.g_p].ps->timebeforeexit = *insptr++; - g_player[vm.g_p].ps->customexitsound = -1; - ud.eog = 1; - continue; - - case CON_ADDPHEALTH: - insptr++; - - { - int32_t j; - - if (g_player[vm.g_p].ps->newowner >= 0) - { - g_player[vm.g_p].ps->newowner = -1; - g_player[vm.g_p].ps->pos.x = g_player[vm.g_p].ps->opos.x; - g_player[vm.g_p].ps->pos.y = g_player[vm.g_p].ps->opos.y; - g_player[vm.g_p].ps->pos.z = g_player[vm.g_p].ps->opos.z; - g_player[vm.g_p].ps->ang = g_player[vm.g_p].ps->oang; - updatesector(g_player[vm.g_p].ps->pos.x,g_player[vm.g_p].ps->pos.y,&g_player[vm.g_p].ps->cursectnum); - P_UpdateScreenPal(g_player[vm.g_p].ps); - - j = headspritestat[STAT_ACTOR]; - while (j >= 0) - { - if (sprite[j].picnum==CAMERA1) - sprite[j].yvel = 0; - j = nextspritestat[j]; - } - } - - j = sprite[g_player[vm.g_p].ps->i].extra; - - if (vm.g_sp->picnum != ATOMICHEALTH) - { - if (j > g_player[vm.g_p].ps->max_player_health && *insptr > 0) - { - insptr++; - continue; - } - else - { - if (j > 0) - j += *insptr; - if (j > g_player[vm.g_p].ps->max_player_health && *insptr > 0) - j = g_player[vm.g_p].ps->max_player_health; - } - } - else - { - if (j > 0) - j += *insptr; - if (j > (g_player[vm.g_p].ps->max_player_health<<1)) - j = (g_player[vm.g_p].ps->max_player_health<<1); - } - - if (j < 0) j = 0; - - if (ud.god == 0) - { - if (*insptr > 0) - { - if ((j - *insptr) < (g_player[vm.g_p].ps->max_player_health>>2) && - j >= (g_player[vm.g_p].ps->max_player_health>>2)) - A_PlaySound(DUKE_GOTHEALTHATLOW,g_player[vm.g_p].ps->i); - - g_player[vm.g_p].ps->last_extra = j; - } - - sprite[g_player[vm.g_p].ps->i].extra = j; - } - } - - insptr++; - continue; - - case CON_STATE: - { - intptr_t *tempscrptr=insptr+2; - - insptr = (intptr_t *) *(insptr+1); - VM_Execute(0); - insptr = tempscrptr; - } - continue; - - case CON_LEFTBRACE: - insptr++; - VM_Execute(0); - continue; - - case CON_MOVE: - insptr++; - vm.g_t[0]=0; - vm.g_t[1] = *insptr++; - vm.g_sp->hitag = *insptr++; - if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack - continue; - if (vm.g_sp->hitag&random_angle) - vm.g_sp->ang = krand()&2047; - continue; - - case CON_ADDWEAPONVAR: - insptr++; - if ((g_player[vm.g_p].ps->gotweapon & (1 << Gv_GetVarX(*(insptr)))) == 0) - { - if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); - else P_AddWeapon(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); - } - else if (g_player[vm.g_p].ps->ammo_amount[Gv_GetVarX(*(insptr))] >= g_player[vm.g_p].ps->max_ammo_amount[Gv_GetVarX(*(insptr))]) - { - vm.g_flags |= VM_NOEXECUTE; - continue; - } - P_AddAmmo(Gv_GetVarX(*(insptr)), g_player[vm.g_p].ps, Gv_GetVarX(*(insptr+1))); - if (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && (g_player[vm.g_p].ps->gotweapon & (1 << Gv_GetVarX(*(insptr))))) - { - if (!(g_player[vm.g_p].ps->weaponswitch & 1)) P_AddWeaponNoSwitch(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); - else P_AddWeapon(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr))); - } - insptr += 2; - continue; - - case CON_ACTIVATEBYSECTOR: - case CON_OPERATESECTORS: - case CON_OPERATEACTIVATORS: - case CON_SETASPECT: - case CON_SSP: - insptr++; - { - int32_t var1 = Gv_GetVarX(*insptr++), var2; - if (tw == CON_OPERATEACTIVATORS && *insptr == g_iThisActorID) - { - var2 = vm.g_p; - insptr++; - } - else var2 = Gv_GetVarX(*insptr++); - - switch (tw) - { - case CON_ACTIVATEBYSECTOR: - if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} - G_ActivateBySector(var1, var2); - break; - case CON_OPERATESECTORS: - if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} - G_OperateSectors(var1, var2); - break; - case CON_OPERATEACTIVATORS: - if ((var2<0 || var2>=playerswhenstarted)) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2); break;} - G_OperateActivators(var1, var2); - break; - case CON_SETASPECT: - setaspect(var1, var2); - break; - case CON_SSP: - if ((unsigned)var1 >= MAXSPRITES) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1); break;} - A_SetSprite(var1, var2); - break; - } - continue; - } - - case CON_CANSEESPR: - insptr++; - { - int32_t lVar1 = Gv_GetVarX(*insptr++), lVar2 = Gv_GetVarX(*insptr++), res; - - if ((unsigned)lVar1 >= MAXSPRITES || (unsigned)lVar2 >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],(unsigned)lVar1 >= MAXSPRITES ? lVar1 : lVar2); - res=0; - } - else res=cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum, - sprite[lVar2].x,sprite[lVar2].y,sprite[lVar2].z,sprite[lVar2].sectnum); - - Gv_SetVarX(*insptr++, res); - continue; - } - - case CON_OPERATERESPAWNS: - case CON_OPERATEMASTERSWITCHES: - case CON_CHECKACTIVATORMOTION: - insptr++; - { - int32_t var1 = Gv_GetVarX(*insptr++); - - switch (tw) - { - case CON_OPERATERESPAWNS: - G_OperateRespawns(var1); - break; - case CON_OPERATEMASTERSWITCHES: - G_OperateMasterSwitches(var1); - break; - case CON_CHECKACTIVATORMOTION: - Gv_SetVarX(g_iReturnVarID, G_CheckActivatorMotion(var1)); - break; - } - continue; - } - - case CON_INSERTSPRITEQ: - insptr++; - A_AddToDeleteQueue(vm.g_i); - continue; - - case CON_QSTRLEN: - insptr++; - { - int32_t i=*insptr++; - int32_t j=Gv_GetVarX(*insptr++); - if ((ScriptQuotes[j] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],j); - Gv_SetVarX(i,-1); - continue; - } - Gv_SetVarX(i,Bstrlen(ScriptQuotes[j])); - continue; - } - - case CON_HEADSPRITESTAT: - insptr++; - { - int32_t i=*insptr++; - int32_t j=Gv_GetVarX(*insptr++); - if ((unsigned)j > MAXSTATUS) - { - OSD_Printf(CON_ERROR "invalid status list %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - Gv_SetVarX(i,headspritestat[j]); - continue; - } - - case CON_PREVSPRITESTAT: - insptr++; - { - int32_t i=*insptr++; - int32_t j=Gv_GetVarX(*insptr++); - if ((unsigned)j >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - Gv_SetVarX(i,prevspritestat[j]); - continue; - } - - case CON_NEXTSPRITESTAT: - insptr++; - { - int32_t i=*insptr++; - int32_t j=Gv_GetVarX(*insptr++); - if ((unsigned)j >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - Gv_SetVarX(i,nextspritestat[j]); - continue; - } - - case CON_HEADSPRITESECT: - insptr++; - { - int32_t i=*insptr++; - int32_t j=Gv_GetVarX(*insptr++); - if ((unsigned)j >= (unsigned)numsectors) - { - OSD_Printf(CON_ERROR "invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - Gv_SetVarX(i,headspritesect[j]); - continue; - } - - case CON_PREVSPRITESECT: - insptr++; - { - int32_t i=*insptr++; - int32_t j=Gv_GetVarX(*insptr++); - if ((unsigned)j >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - Gv_SetVarX(i,prevspritesect[j]); - continue; - } - - case CON_NEXTSPRITESECT: - insptr++; - { - int32_t i=*insptr++; - int32_t j=Gv_GetVarX(*insptr++); - if ((unsigned)j >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - Gv_SetVarX(i,nextspritesect[j]); - continue; - } - - case CON_GETKEYNAME: - insptr++; - { - int32_t i = Gv_GetVarX(*insptr++), - f=Gv_GetVarX(*insptr++); - int32_t j=Gv_GetVarX(*insptr++); - if ((i<0 || i>=MAXQUOTES)) - OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],i); - else if ((ScriptQuotes[i] == NULL)) - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); - else if ((f<0 || f>=NUMGAMEFUNCTIONS)) - OSD_Printf(CON_ERROR "invalid function %d\n",g_errorLineNum,keyw[g_tw],f); - else - { - if (j<2) - Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][j])); - else - { - Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][0])); - if (!*tempbuf) - Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][1])); - } - } - - if (*tempbuf) - Bstrcpy(ScriptQuotes[i],tempbuf); - continue; - } - case CON_QSUBSTR: - insptr++; - { - int32_t q1 = Gv_GetVarX(*insptr++); - int32_t q2 = Gv_GetVarX(*insptr++); - int32_t st = Gv_GetVarX(*insptr++); - int32_t ln = Gv_GetVarX(*insptr++); - - if ((q1<0 || q1>=MAXQUOTES)) - { - OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q1); - continue; - } - if ((ScriptQuotes[q1] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q1); - continue; - } - if ((q2<0 || q2>=MAXQUOTES)) - { - OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q2); - continue; - } - if ((ScriptQuotes[q2] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q2); - continue; - } - - { - char *s1 = ScriptQuotes[q1]; - char *s2 = ScriptQuotes[q2]; - - while (*s2 && st--) s2++; - while ((*s1 = *s2) && ln--) - { - s1++; - s2++; - } - *s1=0; - } - continue; - } - - case CON_GETPNAME: - case CON_QSTRNCAT: - case CON_QSTRCAT: - case CON_QSTRCPY: - case CON_QGETSYSSTR: - case CON_CHANGESPRITESECT: - insptr++; - { - int32_t i = Gv_GetVarX(*insptr++), j; - if (tw == CON_GETPNAME && *insptr == g_iThisActorID) - { - j = vm.g_p; - insptr++; - } - else j = Gv_GetVarX(*insptr++); - - switch (tw) - { - case CON_GETPNAME: - if ((ScriptQuotes[i] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); - break; - } - if (g_player[j].user_name[0]) - Bstrcpy(ScriptQuotes[i],g_player[j].user_name); - else Bsprintf(ScriptQuotes[i],"%d",j); - break; - case CON_QGETSYSSTR: - if ((ScriptQuotes[i] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d %d\n",g_errorLineNum,keyw[g_tw],i,j); - break; - } - switch (j) - { - case STR_MAPNAME: - Bstrcpy(ScriptQuotes[i],MapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name); - break; - case STR_MAPFILENAME: - Bstrcpy(ScriptQuotes[i],MapInfo[ud.volume_number*MAXLEVELS + ud.level_number].filename); - break; - case STR_PLAYERNAME: - Bstrcpy(ScriptQuotes[i],g_player[vm.g_p].user_name); - break; - case STR_VERSION: - Bsprintf(tempbuf,HEAD2 " %s",s_buildRev); - Bstrcpy(ScriptQuotes[i],tempbuf); - break; - case STR_GAMETYPE: - Bstrcpy(ScriptQuotes[i],GametypeNames[ud.coop]); - break; - case STR_VOLUMENAME: - Bstrcpy(ScriptQuotes[i],EpisodeNames[ud.volume_number]); - break; - default: - OSD_Printf(CON_ERROR "unknown str ID %d %d\n",g_errorLineNum,keyw[g_tw],i,j); - } - break; - case CON_QSTRCAT: - if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL)) goto nullquote; - Bstrncat(ScriptQuotes[i],ScriptQuotes[j],(MAXQUOTELEN-1)-Bstrlen(ScriptQuotes[i])); - break; - case CON_QSTRNCAT: - if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL)) goto nullquote; - Bstrncat(ScriptQuotes[i],ScriptQuotes[j],Gv_GetVarX(*insptr++)); - break; - case CON_QSTRCPY: - if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL)) goto nullquote; - Bstrcpy(ScriptQuotes[i],ScriptQuotes[j]); - break; - case CON_CHANGESPRITESECT: - if ((unsigned)i >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],i); - break; - } - if ((unsigned)j >= (unsigned)numsectors) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); - break; - } - changespritesect(i,j); - break; - default: -nullquote: - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[i] ? j : i); - break; - } - continue; - } - - case CON_CHANGESPRITESTAT: - insptr++; - { - int32_t i = Gv_GetVarX(*insptr++); - int32_t j = Gv_GetVarX(*insptr++); - - if ((unsigned)i >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "Invalid sprite: %d\n",g_errorLineNum,keyw[g_tw],i); - continue; - } - if ((unsigned)j >= MAXSTATUS) - { - OSD_Printf(CON_ERROR "Invalid statnum: %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - if (sprite[i].statnum == j) continue; - - /* initialize actor data when changing to an actor statnum because there's usually - garbage left over from being handled as a hard coded object */ - - if (sprite[i].statnum > STAT_ZOMBIEACTOR && (j == STAT_ACTOR || j == STAT_ZOMBIEACTOR)) - { - actor[i].lastvx = 0; - actor[i].lastvy = 0; - actor[i].timetosleep = 0; - actor[i].cgg = 0; - actor[i].movflag = 0; - actor[i].tempang = 0; - actor[i].dispicnum = 0; - T1=T2=T3=T4=T5=T6=T7=T8=T9=0; - actor[i].flags = 0; - sprite[i].hitag = 0; - - // pointers - if (actorscrptr[sprite[i].picnum]) - { - T5 = *(actorscrptr[sprite[i].picnum]+1); - T2 = *(actorscrptr[sprite[i].picnum]+2); - sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3); - } - } - changespritestat(i,j); - continue; - } - - case CON_STARTLEVEL: - insptr++; // skip command - { - // from 'level' cheat in game.c (about line 6250) - int32_t volnume=Gv_GetVarX(*insptr++), levnume=Gv_GetVarX(*insptr++); - - if ((volnume > MAXVOLUMES-1 || volnume < 0)) - { - OSD_Printf(CON_ERROR "invalid volume (%d)\n",g_errorLineNum,keyw[g_tw],volnume); - continue; - } - - if ((levnume > MAXLEVELS-1 || levnume < 0)) - { - OSD_Printf(CON_ERROR "invalid level (%d)\n",g_errorLineNum,keyw[g_tw],levnume); - continue; - } - - ud.m_volume_number = ud.volume_number = volnume; - ud.m_level_number = ud.level_number = levnume; - if (numplayers > 1 && g_netServer) - Net_NewGame(volnume,levnume); - else - { - g_player[myconnectindex].ps->gm |= MODE_EOL; - ud.display_bonus_screen = 0; - } // MODE_RESTART; - - continue; - } - - case CON_MYOSX: - case CON_MYOSPALX: - case CON_MYOS: - case CON_MYOSPAL: - insptr++; - { - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++); - int32_t shade=Gv_GetVarX(*insptr++), orientation=Gv_GetVarX(*insptr++); - - switch (tw) - { - case CON_MYOS: - G_DrawTile(x,y,tilenum,shade,orientation); - break; - case CON_MYOSPAL: - { - int32_t pal=Gv_GetVarX(*insptr++); - G_DrawTilePal(x,y,tilenum,shade,orientation,pal); - break; - } - case CON_MYOSX: - G_DrawTileSmall(x,y,tilenum,shade,orientation); - break; - case CON_MYOSPALX: - { - int32_t pal=Gv_GetVarX(*insptr++); - G_DrawTilePalSmall(x,y,tilenum,shade,orientation,pal); - break; - } - } - continue; - } - - case CON_SWITCH: - insptr++; // p-code - { - // command format: - // variable ID to check - // script offset to 'end' - // count of case statements - // script offset to default case (null if none) - // For each case: value, ptr to code - //AddLog("Processing Switch..."); - int32_t lValue=Gv_GetVarX(*insptr++), lEnd=*insptr++, lCases=*insptr++; - intptr_t *lpDefault=insptr++, *lpCases=insptr, *lTempInsPtr; - int32_t bMatched=0, lCheckCase; - int32_t left,right; - insptr += lCases*2; - lTempInsPtr=insptr; - //Bsprintf(g_szBuf,"lEnd= %d *lpDefault=%d",lEnd,*lpDefault); - //AddLog(g_szBuf); - - //Bsprintf(g_szBuf,"Checking %d cases for %d",lCases, lValue); - //AddLog(g_szBuf); - left=0; right=lCases-1; - while (!bMatched) - { - //Bsprintf(g_szBuf,"Checking #%d Value= %d",lCheckCase, lpCases[lCheckCase*2]); - //AddLog(g_szBuf); - lCheckCase=(left+right)/2; - // initprintf("(%2d..%2d..%2d) [%2d..%2d..%2d]==%2d\n",left,lCheckCase,right,lpCases[left*2],lpCases[lCheckCase*2],lpCases[right*2],lValue); - if (lpCases[lCheckCase*2] > lValue) - right=lCheckCase-1; - else if (lpCases[lCheckCase*2] < lValue) - left =lCheckCase+1; - else if (lpCases[lCheckCase*2] == lValue) - { - //AddLog("Found Case Match"); - //Bsprintf(g_szBuf,"insptr=%d. lCheckCase=%d, offset=%d, &script[0]=%d", - // (int32_t)insptr,(int32_t)lCheckCase,lpCases[lCheckCase*2+1],(int32_t)&script[0]); - //AddLog(g_szBuf); - // fake a 2-d Array - insptr=(intptr_t *)(lpCases[lCheckCase*2+1] + &script[0]); - //Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr); - //AddLog(g_szBuf); - VM_Execute(0); - //AddLog("Done Executing Case"); - bMatched=1; - } - if (right-left < 0) - break; - } - if (!bMatched) - { - if (*lpDefault) - { - //AddLog("No Matching Case: Using Default"); - insptr=(intptr_t *)(*lpDefault + &script[0]); - VM_Execute(0); - } - else - { - //AddLog("No Matching Case: No Default to use"); - } - } - insptr=(intptr_t *)(lEnd + (intptr_t)&script[0]); - //Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr); - //AddLog(g_szBuf); - //AddLog("Done Processing Switch"); - - continue; - } - - case CON_ENDSWITCH: - case CON_ENDEVENT: - insptr++; - return 1; - - case CON_DISPLAYRAND: - insptr++; - Gv_SetVarX(*insptr++, rand()); - continue; - - case CON_DRAGPOINT: - insptr++; - { - int32_t wallnum = Gv_GetVarX(*insptr++), newx = Gv_GetVarX(*insptr++), newy = Gv_GetVarX(*insptr++); - - if ((wallnum<0 || wallnum>=numwalls)) - { - OSD_Printf(CON_ERROR "Invalid wall %d\n",g_errorLineNum,keyw[g_tw],wallnum); - continue; - } - dragpoint(wallnum,newx,newy); - continue; - } - - case CON_LDIST: - insptr++; - { - int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++); - - if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]); - continue; - } - - Gv_SetVarX(distvar, ldist(&sprite[xvar],&sprite[yvar])); - continue; - } - - case CON_DIST: - insptr++; - { - int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++); - - if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]); - continue; - } - - Gv_SetVarX(distvar, dist(&sprite[xvar],&sprite[yvar])); - continue; - } - - case CON_GETANGLE: - insptr++; - { - int32_t angvar = *insptr++; - int32_t xvar = Gv_GetVarX(*insptr++); - int32_t yvar = Gv_GetVarX(*insptr++); - - Gv_SetVarX(angvar, getangle(xvar,yvar)); - continue; - } - - case CON_GETINCANGLE: - insptr++; - { - int32_t angvar = *insptr++; - int32_t xvar = Gv_GetVarX(*insptr++); - int32_t yvar = Gv_GetVarX(*insptr++); - - Gv_SetVarX(angvar, G_GetAngleDelta(xvar,yvar)); - continue; - } - - case CON_MULSCALE: - insptr++; - { - int32_t var1 = *insptr++, var2 = Gv_GetVarX(*insptr++); - int32_t var3 = Gv_GetVarX(*insptr++), var4 = Gv_GetVarX(*insptr++); - - Gv_SetVarX(var1, mulscale(var2, var3, var4)); - continue; - } - - case CON_INITTIMER: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - - if (g_timerTicsPerSecond == j) - continue; - - uninittimer(); - inittimer((g_timerTicsPerSecond = j)); - } - continue; - - case CON_TIME: - insptr += 2; - continue; - - case CON_ESPAWNVAR: - case CON_EQSPAWNVAR: - case CON_QSPAWNVAR: - insptr++; - { - int32_t lIn=Gv_GetVarX(*insptr++); - int32_t j; - if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); - continue; - } - j = A_Spawn(vm.g_i, lIn); - switch (tw) - { - case CON_EQSPAWNVAR: - if (j != -1) - A_AddToDeleteQueue(j); - case CON_ESPAWNVAR: - aGameVars[g_iReturnVarID].val.lValue = j; - break; - case CON_QSPAWNVAR: - if (j != -1) - A_AddToDeleteQueue(j); - break; - } - continue; - } - - case CON_ESPAWN: - case CON_EQSPAWN: - case CON_QSPAWN: - insptr++; - - { - int32_t j; - - if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); - insptr++; - continue; - } - - j = A_Spawn(vm.g_i,*insptr++); - - switch (tw) - { - case CON_EQSPAWN: - if (j != -1) - A_AddToDeleteQueue(j); - case CON_ESPAWN: - aGameVars[g_iReturnVarID].val.lValue = j; - break; - case CON_QSPAWN: - if (j != -1) - A_AddToDeleteQueue(j); - break; - } - } - continue; - - case CON_ESHOOT: - case CON_EZSHOOT: - case CON_ZSHOOT: - insptr++; - - { - int32_t j; - - if (tw != CON_ESHOOT) - { - actor[vm.g_i].shootzvel = Gv_GetVarX(*insptr++); - if (actor[vm.g_i].shootzvel == 0) - actor[vm.g_i].shootzvel = 1; - } - - if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); - insptr++; - actor[vm.g_i].shootzvel=0; - continue; - } - - j = A_Shoot(vm.g_i,*insptr++); - - if (tw != CON_ZSHOOT) - aGameVars[g_iReturnVarID].val.lValue = j; - - actor[vm.g_i].shootzvel=0; - } - continue; - - case CON_SHOOTVAR: - case CON_ESHOOTVAR: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - - if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); - actor[vm.g_i].shootzvel=0; - continue; - } - - j = A_Shoot(vm.g_i, j); - if (tw == CON_ESHOOTVAR) - aGameVars[g_iReturnVarID].val.lValue = j; - actor[vm.g_i].shootzvel=0; - continue; - } - - case CON_EZSHOOTVAR: - case CON_ZSHOOTVAR: - insptr++; - - actor[vm.g_i].shootzvel = Gv_GetVarX(*insptr++); - - if (actor[vm.g_i].shootzvel == 0) - actor[vm.g_i].shootzvel = 1; - - { - int32_t j=Gv_GetVarX(*insptr++); - - if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); - actor[vm.g_i].shootzvel=0; - continue; - } - - j = A_Shoot(vm.g_i, j); - if (tw == CON_EZSHOOTVAR) - aGameVars[g_iReturnVarID].val.lValue = j; - actor[vm.g_i].shootzvel=0; - continue; - } - - case CON_CMENU: - insptr++; - ChangeToMenu(Gv_GetVarX(*insptr++)); - continue; - - case CON_SOUNDVAR: - case CON_STOPSOUNDVAR: - case CON_SOUNDONCEVAR: - case CON_GLOBALSOUNDVAR: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - - if (j<0 || j>=MAXSOUNDS) - { - OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - - switch (tw) - { - case CON_SOUNDONCEVAR: - if (!S_CheckSoundPlaying(vm.g_i,j)) - A_PlaySound((int16_t)j,vm.g_i); - continue; - case CON_GLOBALSOUNDVAR: - A_PlaySound((int16_t)j,g_player[screenpeek].ps->i); - continue; - case CON_STOPSOUNDVAR: - if (S_CheckSoundPlaying(vm.g_i,j)) - S_StopSound((int16_t)j); - continue; - case CON_SOUNDVAR: - A_PlaySound((int16_t)j,vm.g_i); - continue; - } - } - continue; - - case CON_GUNIQHUDID: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - if (j >= 0 && j < MAXUNIQHUDID-1) - guniqhudid = j; - else - OSD_Printf(CON_ERROR "Invalid ID %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - - case CON_SAVEGAMEVAR: - case CON_READGAMEVAR: - { - int32_t i=0; - insptr++; - if (ud.config.scripthandle < 0) - { - insptr++; - continue; - } - switch (tw) - { - case CON_SAVEGAMEVAR: - i=Gv_GetVarX(*insptr); - SCRIPT_PutNumber(ud.config.scripthandle, "Gamevars",aGameVars[*insptr++].szLabel,i,FALSE,FALSE); - break; - case CON_READGAMEVAR: - SCRIPT_GetNumber(ud.config.scripthandle, "Gamevars",aGameVars[*insptr].szLabel,&i); - Gv_SetVarX(*insptr++, i); - break; - } - continue; - } - - case CON_SHOWVIEW: - insptr++; - { - int32_t x=Gv_GetVarX(*insptr++); - int32_t y=Gv_GetVarX(*insptr++); - int32_t z=Gv_GetVarX(*insptr++); - int32_t a=Gv_GetVarX(*insptr++); - int32_t horiz=Gv_GetVarX(*insptr++); - int32_t sect=Gv_GetVarX(*insptr++); - int32_t x1=scale(Gv_GetVarX(*insptr++),xdim,320); - int32_t y1=scale(Gv_GetVarX(*insptr++),ydim,200); - int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320); - int32_t y2=scale(Gv_GetVarX(*insptr++),ydim,200); - int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); -#ifdef USE_OPENGL - int32_t j; -#endif - - if (g_screenCapture) continue; - - if (x1 > x2) swaplong(&x1,&x2); - if (y1 > y2) swaplong(&y1,&y2); - - if ((x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 2 || y2-y1 < 2)) - { - OSD_Printf(CON_ERROR "incorrect coordinates\n",g_errorLineNum,keyw[g_tw]); - continue; - } - if ((sect<0 || sect>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sect); - continue; - } - -#ifdef USE_OPENGL - j = glprojectionhacks; - glprojectionhacks = 0; -#endif - setview(x1,y1,x2,y2); - -#if 0 - if (!ud.pause_on && ((ud.show_help == 0 && (!net_server && ud.multimode < 2) && !(g_player[myconnectindex].ps->gm&MODE_MENU)) - || (net_server || ud.multimode > 1) || ud.recstat == 2)) - smoothratio = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536); -#endif - G_DoInterpolations(smoothratio); - - if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0) -#if defined(POLYMER) && defined(USE_OPENGL) - && (getrendermode() != 4) -#endif - ) - { - int32_t j, i = 0, k, dst = 0x7fffffff; - - for (k=g_mirrorCount-1; k>=0; k--) - { - j = klabs(wall[g_mirrorWall[k]].x-x); - j += klabs(wall[g_mirrorWall[k]].y-y); - if (j < dst) dst = j, i = k; - } - - if (wall[g_mirrorWall[i]].overpicnum == MIRROR) - { - int32_t tposx,tposy; - int16_t tang; - - preparemirror(x,y,z,a,horiz,g_mirrorWall[i],g_mirrorSector[i],&tposx,&tposy,&tang); - - j = visibility; - visibility = (j>>1) + (j>>2); - - drawrooms(tposx,tposy,z,tang,horiz,g_mirrorSector[i]+MAXSECTORS); - - display_mirror = 1; - G_DoSpriteAnimations(tposx,tposy,tang,smoothratio); - display_mirror = 0; - - drawmasks(); - completemirror(); //Reverse screen x-wise in this function - visibility = j; - } - gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7)); - } - -#ifdef POLYMER - if (getrendermode() == 4) - polymer_setanimatesprites(G_DoSpriteAnimations, x,y,a,smoothratio); -#endif - drawrooms(x,y,z,a,horiz,sect); - display_mirror = 2; - G_DoSpriteAnimations(x,y,a,smoothratio); - display_mirror = 0; - drawmasks(); - G_RestoreInterpolations(); - G_UpdateScreenArea(); -#ifdef USE_OPENGL - glprojectionhacks = j; -#endif - continue; - } - - case CON_ROTATESPRITE16: - case CON_ROTATESPRITE: - insptr++; - { - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++); - int32_t a=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++), shade=Gv_GetVarX(*insptr++); - int32_t pal=Gv_GetVarX(*insptr++), orientation=Gv_GetVarX(*insptr++); - int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++); - int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++); - - if (tw == CON_ROTATESPRITE) - { - x<<=16; - y<<=16; - } - - if (x < (-320)<<16 || x >= (640<<16) || y < (-200)<<16 || y >= (400<<16)) - { - OSD_Printf(CON_ERROR "invalid coordinates: %d, %d\n",g_errorLineNum, keyw[g_tw], x, y); - continue; - } - - rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2); - continue; - } - - case CON_GAMETEXT: - case CON_GAMETEXTZ: - insptr++; - { - int32_t tilenum = Gv_GetVarX(*insptr++); - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), q=Gv_GetVarX(*insptr++); - int32_t shade=Gv_GetVarX(*insptr++), pal=Gv_GetVarX(*insptr++); - int32_t orientation=Gv_GetVarX(*insptr++); - int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++); - int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++); - int32_t z = (tw == CON_GAMETEXTZ) ? Gv_GetVarX(*insptr++) : 65536; - - if ((ScriptQuotes[q] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); - if (tw == CON_GAMETEXTZ) - Gv_GetVarX(*insptr++); - continue; - } - - G_PrintGameText(0,tilenum,x>>1,y,ScriptQuotes[q],shade,pal,orientation,x1,y1,x2,y2,z); - continue; - } - - case CON_DIGITALNUMBER: - case CON_DIGITALNUMBERZ: - insptr++; - { - int32_t tilenum = Gv_GetVarX(*insptr++); - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), q=Gv_GetVarX(*insptr++); - int32_t shade=Gv_GetVarX(*insptr++), pal=Gv_GetVarX(*insptr++); - int32_t orientation=Gv_GetVarX(*insptr++); - int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++); - int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++); - int32_t z = (tw == CON_DIGITALNUMBERZ) ? Gv_GetVarX(*insptr++) : 65536; - - G_DrawTXDigiNumZ(tilenum,x,y,q,shade,pal,orientation,x1,y1,x2,y2,z); - continue; - } - - case CON_MINITEXT: - insptr++; - { - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), q=Gv_GetVarX(*insptr++); - int32_t shade=Gv_GetVarX(*insptr++), pal=Gv_GetVarX(*insptr++); - - if ((ScriptQuotes[q] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); - continue; - } - minitextshade(x,y,ScriptQuotes[q],shade,pal,26); - continue; - } - - case CON_ANGOFF: - insptr++; - spriteext[vm.g_i].angoff=*insptr++; - continue; - - case CON_GETZRANGE: - insptr++; - { - vec3_t vect; - - vect.x = Gv_GetVarX(*insptr++); - vect.y = Gv_GetVarX(*insptr++); - vect.z = Gv_GetVarX(*insptr++); - - { - int32_t sectnum=Gv_GetVarX(*insptr++); - int32_t ceilzvar=*insptr++, ceilhitvar=*insptr++, florzvar=*insptr++, florhitvar=*insptr++; - int32_t walldist=Gv_GetVarX(*insptr++), clipmask=Gv_GetVarX(*insptr++); - int32_t ceilz, ceilhit, florz, florhit; - - - if ((sectnum<0 || sectnum>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); - continue; - } - getzrange(&vect, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask); - Gv_SetVarX(ceilzvar, ceilz); - Gv_SetVarX(ceilhitvar, ceilhit); - Gv_SetVarX(florzvar, florz); - Gv_SetVarX(florhitvar, florhit); - } - continue; - } - - case CON_SECTSETINTERPOLATION: - case CON_SECTCLEARINTERPOLATION: - insptr++; - { - int32_t sectnum = Gv_GetVarX(*insptr++), osectnum; - - if ((sectnum<0 || sectnum>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); - continue; - } - - osectnum = sprite[MAXSPRITES-1].sectnum; - sprite[MAXSPRITES-1].sectnum = sectnum; - if (tw==CON_SECTSETINTERPOLATION) - Sect_SetInterpolation(MAXSPRITES-1); - else - Sect_ClearInterpolation(MAXSPRITES-1); - sprite[MAXSPRITES-1].sectnum = osectnum; - - continue; - } - - case CON_CALCHYPOTENUSE: - insptr++; - { - int32_t retvar=*insptr++; - int64_t dax=Gv_GetVarX(*insptr++), day=Gv_GetVarX(*insptr++); - int64_t hypsq = dax*dax + day*day; - - if (hypsq > (int64_t)INT_MAX) - Gv_SetVarX(retvar, (int32_t)sqrt((double)hypsq)); - else - Gv_SetVarX(retvar, ksqrt((int32_t)hypsq)); - - continue; - } - - case CON_LINEINTERSECT: - case CON_RAYINTERSECT: - insptr++; - { - int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++), z1=Gv_GetVarX(*insptr++); - int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++); - int32_t x3=Gv_GetVarX(*insptr++), y3=Gv_GetVarX(*insptr++), x4=Gv_GetVarX(*insptr++), y4=Gv_GetVarX(*insptr++); - int32_t intxvar=*insptr++, intyvar=*insptr++, intzvar=*insptr++, retvar=*insptr++; - int32_t intx, inty, intz, ret; - - if (tw==CON_LINEINTERSECT) - ret = lineintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz); - else - ret = rayintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz); - - Gv_SetVarX(retvar, ret); - if (ret) - { - Gv_SetVarX(intxvar, intx); - Gv_SetVarX(intyvar, inty); - Gv_SetVarX(intzvar, intz); - } - - continue; - } - - case CON_CLIPMOVE: - case CON_CLIPMOVENOSLIDE: - insptr++; - { - vec3_t vect; - int32_t retvar=*insptr++, xvar=*insptr++, yvar=*insptr++, z=Gv_GetVarX(*insptr++), sectnumvar=*insptr++; - int32_t xvect=Gv_GetVarX(*insptr++), yvect=Gv_GetVarX(*insptr++); - int32_t walldist=Gv_GetVarX(*insptr++), floordist=Gv_GetVarX(*insptr++), ceildist=Gv_GetVarX(*insptr++); - int32_t clipmask=Gv_GetVarX(*insptr++), oclipmoveboxtracenum=clipmoveboxtracenum; - int16_t sectnum; - - vect.x = Gv_GetVarX(xvar); - vect.y = Gv_GetVarX(yvar); - vect.z = z; - sectnum = Gv_GetVarX(sectnumvar); - - if ((sectnum<0 || sectnum>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); - Gv_SetVarX(retvar, 0); - continue; - } - - if (tw==CON_CLIPMOVENOSLIDE) - clipmoveboxtracenum = 1; - Gv_SetVarX(retvar, clipmove(&vect, §num, xvect, yvect, walldist, floordist, ceildist, clipmask)); - if (tw==CON_CLIPMOVENOSLIDE) - clipmoveboxtracenum = oclipmoveboxtracenum; - Gv_SetVarX(sectnumvar, sectnum); - Gv_SetVarX(xvar, vect.x); - Gv_SetVarX(yvar, vect.y); - - continue; - } - - case CON_HITSCAN: - insptr++; - { - vec3_t vect; - hitdata_t hitinfo; - - vect.x = Gv_GetVarX(*insptr++); - vect.y = Gv_GetVarX(*insptr++); - vect.z = Gv_GetVarX(*insptr++); - - { - int32_t sectnum=Gv_GetVarX(*insptr++); - int32_t vx=Gv_GetVarX(*insptr++), vy=Gv_GetVarX(*insptr++), vz=Gv_GetVarX(*insptr++); - int32_t hitsectvar=*insptr++, hitwallvar=*insptr++, hitspritevar=*insptr++; - int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++); - - if ((sectnum<0 || sectnum>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); - continue; - } - hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hitinfo, cliptype); - Gv_SetVarX(hitsectvar, hitinfo.hitsect); - Gv_SetVarX(hitwallvar, hitinfo.hitwall); - Gv_SetVarX(hitspritevar, hitinfo.hitsprite); - Gv_SetVarX(hitxvar, hitinfo.pos.x); - Gv_SetVarX(hityvar, hitinfo.pos.y); - Gv_SetVarX(hitzvar, hitinfo.pos.z); - } - continue; - } - - case CON_CANSEE: - insptr++; - { - int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++), z1=Gv_GetVarX(*insptr++); - int32_t sect1=Gv_GetVarX(*insptr++); - int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++); - int32_t sect2=Gv_GetVarX(*insptr++), rvar=*insptr++; - - if ((sect1<0 || sect1>=numsectors || sect2<0 || sect2>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector\n",g_errorLineNum,keyw[g_tw]); - Gv_SetVarX(rvar, 0); - } - - Gv_SetVarX(rvar, cansee(x1,y1,z1,sect1,x2,y2,z2,sect2)); - continue; - } - - case CON_ROTATEPOINT: - insptr++; - { - int32_t xpivot=Gv_GetVarX(*insptr++), ypivot=Gv_GetVarX(*insptr++); - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), daang=Gv_GetVarX(*insptr++); - int32_t x2var=*insptr++, y2var=*insptr++; - int32_t x2, y2; - - rotatepoint(xpivot,ypivot,x,y,daang,&x2,&y2); - Gv_SetVarX(x2var, x2); - Gv_SetVarX(y2var, y2); - continue; - } - - case CON_NEARTAG: - insptr++; - { - // neartag(int32_t x, int32_t y, int32_t z, short sectnum, short ang, //Starting position & angle - // short *neartagsector, //Returns near sector if sector[].tag != 0 - // short *neartagwall, //Returns near wall if wall[].tag != 0 - // short *neartagsprite, //Returns near sprite if sprite[].tag != 0 - // int32_t *neartaghitdist, //Returns actual distance to object (scale: 1024=largest grid size) - // int32_t neartagrange, //Choose maximum distance to scan (scale: 1024=largest grid size) - // char tagsearch) //1-lotag only, 2-hitag only, 3-lotag&hitag - - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++); - int32_t sectnum=Gv_GetVarX(*insptr++), ang=Gv_GetVarX(*insptr++); - int32_t neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++; - int32_t neartagrange=Gv_GetVarX(*insptr++), tagsearch=Gv_GetVarX(*insptr++); - - if ((sectnum<0 || sectnum>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); - continue; - } - neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, neartagrange, tagsearch); - - Gv_SetVarX(neartagsectorvar, neartagsector); - Gv_SetVarX(neartagwallvar, neartagwall); - Gv_SetVarX(neartagspritevar, neartagsprite); - Gv_SetVarX(neartaghitdistvar, neartaghitdist); - continue; - } - - case CON_GETTIMEDATE: - insptr++; - { - int32_t v1=*insptr++,v2=*insptr++,v3=*insptr++,v4=*insptr++,v5=*insptr++,v6=*insptr++,v7=*insptr++,v8=*insptr++; - time_t rawtime; - struct tm *ti; - - time(&rawtime); - ti=localtime(&rawtime); - // initprintf("Time&date: %s\n",asctime (ti)); - - Gv_SetVarX(v1, ti->tm_sec); - Gv_SetVarX(v2, ti->tm_min); - Gv_SetVarX(v3, ti->tm_hour); - Gv_SetVarX(v4, ti->tm_mday); - Gv_SetVarX(v5, ti->tm_mon); - Gv_SetVarX(v6, ti->tm_year+1900); - Gv_SetVarX(v7, ti->tm_wday); - Gv_SetVarX(v8, ti->tm_yday); - continue; - } - - case CON_MOVESPRITE: - case CON_SETSPRITE: - insptr++; - { - int32_t spritenum = Gv_GetVarX(*insptr++); - vec3_t davector; - - davector.x = Gv_GetVarX(*insptr++); - davector.y = Gv_GetVarX(*insptr++); - davector.z = Gv_GetVarX(*insptr++); - - if (tw == CON_SETSPRITE) - { - if ((unsigned)spritenum >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum); - continue; - } - setsprite(spritenum, &davector); - continue; - } - - { - int32_t cliptype = Gv_GetVarX(*insptr++); - - if ((unsigned)spritenum >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum); - insptr++; - continue; - } - Gv_SetVarX(*insptr++, A_MoveSprite(spritenum, &davector, cliptype)); - continue; - } - } - - case CON_GETFLORZOFSLOPE: - case CON_GETCEILZOFSLOPE: - insptr++; - { - int32_t sectnum = Gv_GetVarX(*insptr++), x = Gv_GetVarX(*insptr++), y = Gv_GetVarX(*insptr++); - if ((sectnum<0 || sectnum>=numsectors)) - { - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); - insptr++; - continue; - } - - if (tw == CON_GETFLORZOFSLOPE) - { - Gv_SetVarX(*insptr++, getflorzofslope(sectnum,x,y)); - continue; - } - Gv_SetVarX(*insptr++, getceilzofslope(sectnum,x,y)); - continue; - } - - case CON_UPDATESECTOR: - case CON_UPDATESECTORZ: - insptr++; - { - int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++); - int32_t z=(tw==CON_UPDATESECTORZ)?Gv_GetVarX(*insptr++):0; - int32_t var=*insptr++; - int16_t w=sprite[vm.g_i].sectnum; - - if (tw==CON_UPDATESECTOR) updatesector(x,y,&w); - else updatesectorz(x,y,z,&w); - - Gv_SetVarX(var, w); - continue; - } - - case CON_SPAWN: - insptr++; - if ((unsigned)vm.g_sp->sectnum < MAXSECTORS) - A_Spawn(vm.g_i,*insptr); - insptr++; - continue; - - case CON_IFWASWEAPON: - insptr++; - VM_DoConditional(actor[vm.g_i].picnum == *insptr); - continue; - - case CON_IFAI: - insptr++; - VM_DoConditional(vm.g_t[5] == *insptr); - continue; - - case CON_IFACTION: - insptr++; - VM_DoConditional(vm.g_t[4] == *insptr); - continue; - - case CON_IFACTIONCOUNT: - insptr++; - VM_DoConditional(vm.g_t[2] >= *insptr); - continue; - - case CON_RESETACTIONCOUNT: - insptr++; - vm.g_t[2] = 0; - continue; - - case CON_DEBRIS: - insptr++; - { - int32_t dnum = *insptr++; - int32_t s, l, j; - - if ((unsigned)vm.g_sp->sectnum < MAXSECTORS) - for (j=(*insptr)-1; j>=0; j--) - { - if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1) - s = 0; - else s = (krand()%3); - - l = A_InsertSprite(vm.g_sp->sectnum, - vm.g_sp->x+(krand()&255)-128,vm.g_sp->y+(krand()&255)-128,vm.g_sp->z-(8<<8)-(krand()&8191), - dnum+s,vm.g_sp->shade,32+(krand()&15),32+(krand()&15), - krand()&2047,(krand()&127)+32, - -(krand()&2047),vm.g_i,5); - if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1) - sprite[l].yvel = BlimpSpawnSprites[j%14]; - else sprite[l].yvel = -1; - sprite[l].pal = vm.g_sp->pal; - } - insptr++; - } - continue; - - case CON_COUNT: - insptr++; - vm.g_t[0] = (int16_t) *insptr++; - continue; - - case CON_CSTATOR: - insptr++; - vm.g_sp->cstat |= (int16_t) *insptr++; - continue; - - case CON_CLIPDIST: - insptr++; - vm.g_sp->clipdist = (int16_t) *insptr++; - continue; - - case CON_CSTAT: - insptr++; - vm.g_sp->cstat = (int16_t) *insptr++; - continue; - - case CON_SAVENN: - case CON_SAVE: - insptr++; - { - time_t curtime; - - g_lastSaveSlot = *insptr++; - - if (g_lastSaveSlot > 9) - continue; - - if (tw == CON_SAVE || ud.savegame[g_lastSaveSlot][0] == 0) - { - curtime = time(NULL); - Bstrcpy(tempbuf,asctime(localtime(&curtime))); - clearbufbyte(ud.savegame[g_lastSaveSlot],sizeof(ud.savegame[g_lastSaveSlot]),0); - Bsprintf(ud.savegame[g_lastSaveSlot],"Auto"); - // for (j=0;j<13;j++) - // Bmemcpy(&ud.savegame[g_lastSaveSlot][j+4],&tempbuf[j+3],sizeof(tempbuf[j+3])); - // ud.savegame[g_lastSaveSlot][j+4] = '\0'; - Bmemcpy(&ud.savegame[g_lastSaveSlot][4],&tempbuf[3],sizeof(tempbuf[0])*13); - ud.savegame[g_lastSaveSlot][17] = '\0'; - } - - OSD_Printf("Saving to slot %d\n",g_lastSaveSlot); - - KB_FlushKeyboardQueue(); - - g_screenCapture = 1; - G_DrawRooms(myconnectindex,65536); - g_screenCapture = 0; - if ((g_netServer || ud.multimode > 1)) - G_SavePlayer(-1-(g_lastSaveSlot)); - else G_SavePlayer(g_lastSaveSlot); - - continue; - } - - case CON_QUAKE: - insptr++; - g_earthquakeTime = (uint8_t)Gv_GetVarX(*insptr++); - A_PlaySound(EARTHQUAKE,g_player[screenpeek].ps->i); - continue; - - case CON_IFMOVE: - insptr++; - VM_DoConditional(vm.g_t[1] == *insptr); - continue; - - case CON_RESETPLAYER: - { - insptr++; - - //AddLog("resetplayer"); - if ((!g_netServer && ud.multimode < 2)) - { - if (g_lastSaveSlot >= 0 && ud.recstat != 2) - { - g_player[vm.g_p].ps->gm |= MODE_MENU; - KB_ClearKeyDown(sc_Space); - ChangeToMenu(15000); - } - else g_player[vm.g_p].ps->gm = MODE_RESTART; - vm.g_flags |= VM_NOEXECUTE; - } - else - { - if (vm.g_p == myconnectindex) - { - g_cameraDistance = 0; - g_cameraClock = totalclock; - } - - if (g_netServer) - { - int32_t jj = 0; - - P_ResetPlayer(vm.g_p); - - packbuf[jj++] = PACKET_PLAYER_SPAWN; - packbuf[jj++] = vm.g_p; - - Bmemcpy(&packbuf[jj], &g_player[vm.g_p].ps->pos.x, sizeof(vec3_t) * 2); - jj += sizeof(vec3_t) * 2; - - packbuf[jj++] = 0; - - enet_host_broadcast(g_netServer, CHAN_GAMESTATE , enet_packet_create(packbuf, jj, ENET_PACKET_FLAG_RELIABLE)); - } - } - P_UpdateScreenPal(g_player[vm.g_p].ps); - //AddLog("EOF: resetplayer"); - } - continue; - - case CON_IFONWATER: - VM_DoConditional(sector[vm.g_sp->sectnum].lotag == 1 && klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8)); - continue; - - case CON_IFINWATER: - VM_DoConditional(sector[vm.g_sp->sectnum].lotag == 2); - continue; - - case CON_IFCOUNT: - insptr++; - VM_DoConditional(vm.g_t[0] >= *insptr); - continue; - - case CON_IFACTOR: - insptr++; - VM_DoConditional(vm.g_sp->picnum == *insptr); - continue; - - case CON_RESETCOUNT: - insptr++; - vm.g_t[0] = 0; - continue; - - case CON_ADDINVENTORY: - insptr += 2; - switch (*(insptr-1)) - { - case GET_STEROIDS: - g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] = *insptr; - g_player[vm.g_p].ps->inven_icon = 2; - break; - - case GET_SHIELD: - g_player[vm.g_p].ps->inv_amount[GET_SHIELD] += *insptr;// 100; - if (g_player[vm.g_p].ps->inv_amount[GET_SHIELD] > g_player[vm.g_p].ps->max_shield_amount) - g_player[vm.g_p].ps->inv_amount[GET_SHIELD] = g_player[vm.g_p].ps->max_shield_amount; - break; - - case GET_SCUBA: - g_player[vm.g_p].ps->inv_amount[GET_SCUBA] = *insptr;// 1600; - g_player[vm.g_p].ps->inven_icon = 6; - break; - - case GET_HOLODUKE: - g_player[vm.g_p].ps->inv_amount[GET_HOLODUKE] = *insptr;// 1600; - g_player[vm.g_p].ps->inven_icon = 3; - break; - - case GET_JETPACK: - g_player[vm.g_p].ps->inv_amount[GET_JETPACK] = *insptr;// 1600; - g_player[vm.g_p].ps->inven_icon = 4; - break; - - case GET_ACCESS: - switch (vm.g_sp->pal) - { - case 0: - g_player[vm.g_p].ps->got_access |= 1; - break; - case 21: - g_player[vm.g_p].ps->got_access |= 2; - break; - case 23: - g_player[vm.g_p].ps->got_access |= 4; - break; - } - break; - - case GET_HEATS: - g_player[vm.g_p].ps->inv_amount[GET_HEATS] = *insptr; - g_player[vm.g_p].ps->inven_icon = 5; - break; - - case GET_FIRSTAID: - g_player[vm.g_p].ps->inven_icon = 1; - g_player[vm.g_p].ps->inv_amount[GET_FIRSTAID] = *insptr; - break; - - case GET_BOOTS: - g_player[vm.g_p].ps->inven_icon = 7; - g_player[vm.g_p].ps->inv_amount[GET_BOOTS] = *insptr; - break; - default: - OSD_Printf(CON_ERROR "Invalid inventory ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*(insptr-1)); - break; - } - insptr++; - continue; - - case CON_HITRADIUSVAR: - insptr++; - { - int32_t v1=Gv_GetVarX(*insptr++),v2=Gv_GetVarX(*insptr++),v3=Gv_GetVarX(*insptr++); - int32_t v4=Gv_GetVarX(*insptr++),v5=Gv_GetVarX(*insptr++); - A_RadiusDamage(vm.g_i,v1,v2,v3,v4,v5); - } - continue; - - case CON_HITRADIUS: - A_RadiusDamage(vm.g_i,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5)); - insptr += 6; - continue; - - case CON_IFP: - { - int32_t l = *(++insptr); - int32_t j = 0; - int32_t s = sprite[g_player[vm.g_p].ps->i].xvel; - - if ((l&8) && g_player[vm.g_p].ps->on_ground && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_CROUCH)) - j = 1; - else if ((l&16) && g_player[vm.g_p].ps->jumping_counter == 0 && !g_player[vm.g_p].ps->on_ground && - g_player[vm.g_p].ps->vel.z > 2048) - j = 1; - else if ((l&32) && g_player[vm.g_p].ps->jumping_counter > 348) - j = 1; - else if ((l&1) && s >= 0 && s < 8) - j = 1; - else if ((l&2) && s >= 8 && !TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) - j = 1; - else if ((l&4) && s >= 8 && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) - j = 1; - else if ((l&64) && g_player[vm.g_p].ps->pos.z < (vm.g_sp->z-(48<<8))) - j = 1; - else if ((l&128) && s <= -8 && !TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) - j = 1; - else if ((l&256) && s <= -8 && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN)) - j = 1; - else if ((l&512) && (g_player[vm.g_p].ps->quick_kick > 0 || (g_player[vm.g_p].ps->curr_weapon == KNEE_WEAPON && g_player[vm.g_p].ps->kickback_pic > 0))) - j = 1; - else if ((l&1024) && sprite[g_player[vm.g_p].ps->i].xrepeat < 32) - j = 1; - else if ((l&2048) && g_player[vm.g_p].ps->jetpack_on) - j = 1; - else if ((l&4096) && g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] > 0 && g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] < 400) - j = 1; - else if ((l&8192) && g_player[vm.g_p].ps->on_ground) - j = 1; - else if ((l&16384) && sprite[g_player[vm.g_p].ps->i].xrepeat > 32 && sprite[g_player[vm.g_p].ps->i].extra > 0 && g_player[vm.g_p].ps->timebeforeexit == 0) - j = 1; - else if ((l&32768) && sprite[g_player[vm.g_p].ps->i].extra <= 0) - j = 1; - else if ((l&65536L)) - { - if (vm.g_sp->picnum == APLAYER && (g_netServer || ud.multimode > 1)) - j = G_GetAngleDelta(g_player[otherp].ps->ang,getangle(g_player[vm.g_p].ps->pos.x-g_player[otherp].ps->pos.x,g_player[vm.g_p].ps->pos.y-g_player[otherp].ps->pos.y)); - else - j = G_GetAngleDelta(g_player[vm.g_p].ps->ang,getangle(vm.g_sp->x-g_player[vm.g_p].ps->pos.x,vm.g_sp->y-g_player[vm.g_p].ps->pos.y)); - - if (j > -128 && j < 128) - j = 1; - else - j = 0; - } - VM_DoConditional((intptr_t) j); - } - continue; - - case CON_IFSTRENGTH: - insptr++; - VM_DoConditional(vm.g_sp->extra <= *insptr); - continue; - - case CON_GUTS: - A_DoGuts(vm.g_i,*(insptr+1),*(insptr+2)); - insptr += 3; - continue; - - case CON_IFSPAWNEDBY: - insptr++; - VM_DoConditional(actor[vm.g_i].picnum == *insptr); - continue; - - case CON_WACKPLAYER: - insptr++; - P_ForceAngle(g_player[vm.g_p].ps); - continue; - - case CON_FLASH: - insptr++; - sprite[vm.g_i].shade = -127; - g_player[vm.g_p].ps->visibility = -127; - lastvisinc = totalclock+32; - continue; - - case CON_SAVEMAPSTATE: - if (MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate == NULL) - MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate = Bcalloc(1,sizeof(mapstate_t)); - G_SaveMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); - insptr++; - continue; - - case CON_LOADMAPSTATE: - if (MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate) - G_RestoreMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); - insptr++; - continue; - - case CON_CLEARMAPSTATE: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - if ((unsigned)j >= MAXVOLUMES*MAXLEVELS) - { - OSD_Printf(CON_ERROR "Invalid map number: %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - if (MapInfo[j].savedstate) - G_FreeMapState(j); - } - continue; - - case CON_STOPALLSOUNDS: - insptr++; - if (screenpeek == vm.g_p) - FX_StopAllSounds(); - continue; - - case CON_IFGAPZL: - insptr++; - VM_DoConditional(((actor[vm.g_i].floorz - actor[vm.g_i].ceilingz) >> 8) < *insptr); - continue; - - case CON_IFHITSPACE: - VM_DoConditional(TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_OPEN)); - continue; - - case CON_IFOUTSIDE: - VM_DoConditional(sector[vm.g_sp->sectnum].ceilingstat&1); - continue; - - case CON_IFMULTIPLAYER: - VM_DoConditional((g_netServer || g_netClient || ud.multimode > 1)); - continue; - - case CON_IFCLIENT: - VM_DoConditional(g_netClient != NULL); - continue; - - case CON_IFSERVER: - VM_DoConditional(g_netServer != NULL); - continue; - - case CON_OPERATE: - insptr++; - if (sector[vm.g_sp->sectnum].lotag == 0) - { - neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang, - &neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,5); - if (neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag)) - if ((sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz) - if ((sector[neartagsector].lotag&16384) == 0) - if ((sector[neartagsector].lotag&32768) == 0) - { - int32_t j = headspritesect[neartagsector]; - while (j >= 0) - { - if (sprite[j].picnum == ACTIVATOR) - break; - j = nextspritesect[j]; - } - if (j == -1) - G_OperateSectors(neartagsector,vm.g_i); - } - } - continue; - - case CON_IFINSPACE: - VM_DoConditional(G_CheckForSpaceCeiling(vm.g_sp->sectnum)); - continue; - - case CON_SPRITEPAL: - insptr++; - if (vm.g_sp->picnum != APLAYER) - actor[vm.g_i].tempang = vm.g_sp->pal; - vm.g_sp->pal = *insptr++; - continue; - - case CON_CACTOR: - insptr++; - vm.g_sp->picnum = *insptr++; - continue; - - case CON_IFBULLETNEAR: - VM_DoConditional(A_Dodge(vm.g_sp) == 1); - continue; - - case CON_IFRESPAWN: - if (A_CheckEnemySprite(vm.g_sp)) - VM_DoConditional(ud.respawn_monsters); - else if (A_CheckInventorySprite(vm.g_sp)) - VM_DoConditional(ud.respawn_inventory); - else - VM_DoConditional(ud.respawn_items); - continue; - - case CON_IFFLOORDISTL: - insptr++; - VM_DoConditional((actor[vm.g_i].floorz - vm.g_sp->z) <= ((*insptr)<<8)); - continue; - - case CON_IFCEILINGDISTL: - insptr++; - VM_DoConditional((vm.g_sp->z - actor[vm.g_i].ceilingz) <= ((*insptr)<<8)); - continue; - - case CON_PALFROM: - insptr++; - { - int32_t j = 2; - g_player[vm.g_p].ps->pals.f = *insptr++; - for (; j>=0; j--) - *((char *)(&g_player[vm.g_p].ps->pals.r)+2-j) = *insptr++; - } - continue; - - case CON_SECTOROFWALL: - insptr++; - { - int32_t j = *insptr++; - - Gv_SetVarX(j, sectorofwall(Gv_GetVarX(*insptr++))); - } - continue; - - case CON_QSPRINTF: - insptr++; - { - int32_t dq = Gv_GetVarX(*insptr++), sq = Gv_GetVarX(*insptr++); - if ((ScriptQuotes[sq] == NULL || ScriptQuotes[dq] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[sq] ? dq : sq); - - while ((*insptr & 0xFFF) != CON_NULLOP) - Gv_GetVarX(*insptr++); - - insptr++; // skip the NOP - continue; - } - - { - int32_t arg[32], i = 0, j = 0, k = 0; - int32_t len = Bstrlen(ScriptQuotes[sq]); - char tempbuf[MAXQUOTELEN]; - - while ((*insptr & 0xFFF) != CON_NULLOP && i < 32) - arg[i++] = Gv_GetVarX(*insptr++); - - insptr++; // skip the NOP - - i = 0; - - do - { - while (k < len && j < MAXQUOTELEN && ScriptQuotes[sq][k] != '%') - tempbuf[j++] = ScriptQuotes[sq][k++]; - - if (ScriptQuotes[sq][k] == '%') - { - k++; - switch (ScriptQuotes[sq][k]) - { - case 'l': - if (ScriptQuotes[sq][k+1] != 'd') - { - // write the % and l - tempbuf[j++] = ScriptQuotes[sq][k-1]; - tempbuf[j++] = ScriptQuotes[sq][k++]; - break; - } - k++; - case 'd': - { - char buf[16]; - int32_t ii = 0; - - Bsprintf(buf, "%d", arg[i++]); - - ii = Bstrlen(buf); - Bmemcpy(&tempbuf[j], buf, ii); - j += ii; - k++; - } - break; - - case 's': - { - int32_t ii = Bstrlen(ScriptQuotes[arg[i]]); - - Bmemcpy(&tempbuf[j], ScriptQuotes[arg[i]], ii); - j += ii; - k++; - } - break; - - default: - tempbuf[j++] = ScriptQuotes[sq][k-1]; - break; - } - } - } - while (k < len && j < MAXQUOTELEN); - - tempbuf[j] = '\0'; - Bstrcpy(ScriptQuotes[dq], tempbuf); - continue; - } - } - - case CON_ADDLOG: - { - insptr++; - - OSD_Printf(OSDTEXT_GREEN "CONLOG: L=%d\n",g_errorLineNum); - continue; - } - - case CON_ADDLOGVAR: - insptr++; - { - int32_t m=1; - char szBuf[256]; - int32_t lVarID = *insptr; - - if ((lVarID >= g_gameVarCount) || lVarID < 0) - { - if (*insptr==MAXGAMEVARS) // addlogvar for a constant? Har. - insptr++; - // else if (*insptr > g_gameVarCount && (*insptr < (MAXGAMEVARS<<1)+MAXGAMEVARS+1+MAXGAMEARRAYS)) - else if (*insptr&(MAXGAMEVARS<<2)) - { - int32_t index; - - lVarID ^= (MAXGAMEVARS<<2); - - if (lVarID&(MAXGAMEVARS<<1)) - { - m = -m; - lVarID ^= (MAXGAMEVARS<<1); - } - - insptr++; - - index=Gv_GetVarX(*insptr++); - if ((index < aGameArrays[lVarID].size)&&(index>=0)) - { - OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n",keyw[g_tw],g_errorLineNum, - aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]); - continue; - } - else - { - OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); - continue; - } - } - else if (*insptr&(MAXGAMEVARS<<3)) - { - // FIXME FIXME FIXME - if ((lVarID & (MAXGAMEVARS-1)) == g_iActorVarID) - { - intptr_t *oinsptr = insptr++; - int32_t index = Gv_GetVarX(*insptr++); - insptr = oinsptr; - if ((unsigned)index >= MAXSPRITES-1) - { - OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); - Gv_GetVarX(*insptr++); - continue; - } - OSD_Printf(OSDTEXT_GREEN "%s: L=%d %d %d\n",keyw[g_tw],g_errorLineNum,index,Gv_GetVar(*insptr++,index,vm.g_p)); - continue; - } - } - else if (*insptr&(MAXGAMEVARS<<1)) - { - m = -m; - lVarID ^= (MAXGAMEVARS<<1); - } - else - { - // invalid varID - insptr++; - OSD_Printf(CON_ERROR "invalid variable\n",g_errorLineNum,keyw[g_tw]); - continue; // out of switch - } - } - Bsprintf(szBuf,"CONLOGVAR: L=%d %s ",g_errorLineNum, aGameVars[lVarID].szLabel); - strcpy(g_szBuf,szBuf); - - if (aGameVars[lVarID].dwFlags & GAMEVAR_READONLY) - { - Bsprintf(szBuf," (read-only)"); - strcat(g_szBuf,szBuf); - } - if (aGameVars[lVarID].dwFlags & GAMEVAR_PERPLAYER) - { - Bsprintf(szBuf," (Per Player. Player=%d)",vm.g_p); - } - else if (aGameVars[lVarID].dwFlags & GAMEVAR_PERACTOR) - { - Bsprintf(szBuf," (Per Actor. Actor=%d)",vm.g_i); - } - else - { - Bsprintf(szBuf," (Global)"); - } - Bstrcat(g_szBuf,szBuf); - Bsprintf(szBuf," =%d\n", Gv_GetVarX(lVarID)*m); - Bstrcat(g_szBuf,szBuf); - OSD_Printf(OSDTEXT_GREEN "%s",g_szBuf); - insptr++; - continue; - } - - case CON_SETSECTOR: - case CON_GETSECTOR: - insptr++; - { - // syntax [gs]etsector[].x - // - int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; - - VM_AccessSector(tw==CON_SETSECTOR, lVar1, lLabelID, lVar2); - continue; - } - - case CON_SQRT: - insptr++; - { - // syntax sqrt - int32_t lInVarID=*insptr++, lOutVarID=*insptr++; - - Gv_SetVarX(lOutVarID, ksqrt(Gv_GetVarX(lInVarID))); - continue; - } - - case CON_FINDNEARACTOR: - case CON_FINDNEARSPRITE: - case CON_FINDNEARACTOR3D: - case CON_FINDNEARSPRITE3D: - insptr++; - { - // syntax findnearactorvar - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - int32_t lType=*insptr++, lMaxDist=*insptr++, lVarID=*insptr++; - int32_t lFound=-1, j, k = MAXSTATUS-1; - - if (tw == CON_FINDNEARACTOR || tw == CON_FINDNEARACTOR3D) - k = 1; - do - { - j=headspritestat[k]; // all sprites - if (tw==CON_FINDNEARSPRITE3D || tw==CON_FINDNEARACTOR3D) - { - while (j>=0) - { - if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) - { - lFound=j; - j = MAXSPRITES; - break; - } - j = nextspritestat[j]; - } - if (j == MAXSPRITES || tw == CON_FINDNEARACTOR3D) - break; - continue; - } - - while (j>=0) - { - if (sprite[j].picnum == lType && j != vm.g_i && ldist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) - { - lFound=j; - j = MAXSPRITES; - break; - } - j = nextspritestat[j]; - } - - if (j == MAXSPRITES || tw == CON_FINDNEARACTOR) - break; - } - while (k--); - Gv_SetVarX(lVarID, lFound); - continue; - } - - case CON_FINDNEARACTORVAR: - case CON_FINDNEARSPRITEVAR: - case CON_FINDNEARACTOR3DVAR: - case CON_FINDNEARSPRITE3DVAR: - insptr++; - { - // syntax findnearactorvar - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - int32_t lType=*insptr++, lMaxDist=Gv_GetVarX(*insptr++), lVarID=*insptr++; - int32_t lFound=-1, j, k = 1; - - if (tw == CON_FINDNEARSPRITEVAR || tw == CON_FINDNEARSPRITE3DVAR) - k = MAXSTATUS-1; - - do - { - j=headspritestat[k]; // all sprites - if (tw==CON_FINDNEARACTOR3DVAR || tw==CON_FINDNEARSPRITE3DVAR) - { - while (j >= 0) - { - if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) - { - lFound=j; - j = MAXSPRITES; - break; - } - j = nextspritestat[j]; - } - if (j == MAXSPRITES || tw==CON_FINDNEARACTOR3DVAR) - break; - continue; - } - - while (j >= 0) - { - if (sprite[j].picnum == lType && j != vm.g_i && ldist(&sprite[vm.g_i], &sprite[j]) < lMaxDist) - { - lFound=j; - j = MAXSPRITES; - break; - } - j = nextspritestat[j]; - } - - if (j == MAXSPRITES || tw==CON_FINDNEARACTORVAR) - break; - } - while (k--); - Gv_SetVarX(lVarID, lFound); - continue; - } - - case CON_FINDNEARACTORZVAR: - case CON_FINDNEARSPRITEZVAR: - insptr++; - { - // syntax findnearactorvar - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - int32_t lType=*insptr++, lMaxDist=Gv_GetVarX(*insptr++); - int32_t lMaxZDist=Gv_GetVarX(*insptr++); - int32_t lVarID=*insptr++, lFound=-1, lTemp, lTemp2, j, k=MAXSTATUS-1; - do - { - j=headspritestat[tw==CON_FINDNEARACTORZVAR?1:k]; // all sprites - if (j == -1) continue; - do - { - if (sprite[j].picnum == lType && j != vm.g_i) - { - lTemp=ldist(&sprite[vm.g_i], &sprite[j]); - if (lTemp < lMaxDist) - { - lTemp2=klabs(sprite[vm.g_i].z-sprite[j].z); - if (lTemp2 < lMaxZDist) - { - lFound=j; - j = MAXSPRITES; - break; - } - } - } - j = nextspritestat[j]; - } - while (j>=0); - if (tw==CON_FINDNEARACTORZVAR || j == MAXSPRITES) - break; - } - while (k--); - Gv_SetVarX(lVarID, lFound); - - continue; - } - - case CON_FINDNEARACTORZ: - case CON_FINDNEARSPRITEZ: - insptr++; - { - // syntax findnearactorvar - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - int32_t lType=*insptr++, lMaxDist=*insptr++, lMaxZDist=*insptr++, lVarID=*insptr++; - int32_t lTemp, lTemp2, lFound=-1, j, k=MAXSTATUS-1; - do - { - j=headspritestat[tw==CON_FINDNEARACTORZ?1:k]; // all sprites - if (j == -1) continue; - do - { - if (sprite[j].picnum == lType && j != vm.g_i) - { - lTemp=ldist(&sprite[vm.g_i], &sprite[j]); - if (lTemp < lMaxDist) - { - lTemp2=klabs(sprite[vm.g_i].z-sprite[j].z); - if (lTemp2 < lMaxZDist) - { - lFound=j; - j = MAXSPRITES; - break; - } - } - } - j = nextspritestat[j]; - } - while (j>=0); - - if (tw==CON_FINDNEARACTORZ || j == MAXSPRITES) - break; - } - while (k--); - Gv_SetVarX(lVarID, lFound); - continue; - } - - case CON_FINDPLAYER: - insptr++; - { - int32_t j; - // Gv_SetVarX(g_iReturnVarID, A_FindPlayer(&sprite[vm.g_i],&j)); - aGameVars[g_iReturnVarID].val.lValue = A_FindPlayer(&sprite[vm.g_i],&j); - Gv_SetVarX(*insptr++, j); - } - continue; - - case CON_FINDOTHERPLAYER: - insptr++; - { - int32_t j; - // Gv_SetVarX(g_iReturnVarID, P_FindOtherPlayer(vm.g_p,&j)); - aGameVars[g_iReturnVarID].val.lValue = P_FindOtherPlayer(vm.g_p,&j); - Gv_SetVarX(*insptr++, j); - } - continue; - - case CON_SETPLAYER: - insptr++; - { - // syntax [gs]etplayer[].x - // - int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2; - // HACK: need to have access to labels structure at run-time... - - if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) - lParm2=Gv_GetVarX(*insptr++); - lVar2=*insptr++; - - VM_SetPlayer(lVar1, lLabelID, lVar2, lParm2); - continue; - } - - - case CON_GETPLAYER: - insptr++; - { - // syntax [gs]etplayer[].x - // - int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2; - // HACK: need to have access to labels structure at run-time... - - if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) - lParm2=Gv_GetVarX(*insptr++); - lVar2=*insptr++; - - VM_GetPlayer(lVar1, lLabelID, lVar2, lParm2); - continue; - } - - case CON_SETINPUT: - case CON_GETINPUT: - insptr++; - { - // syntax [gs]etplayer[].x - // - int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; - - VM_AccessPlayerInput(tw==CON_SETINPUT, lVar1, lLabelID, lVar2); - continue; - } - - case CON_GETUSERDEF: - case CON_SETUSERDEF: - insptr++; - { - // syntax [gs]etuserdef.xxx - // - int32_t lLabelID=*insptr++, lVar2=*insptr++; - - VM_AccessUserdef(tw==CON_SETUSERDEF, lLabelID, lVar2); - continue; - } - - case CON_GETPROJECTILE: - case CON_SETPROJECTILE: - insptr++; - { - // syntax [gs]etplayer[].x - // - int32_t lVar1=Gv_GetVarX(*insptr++), lLabelID=*insptr++, lVar2=*insptr++; - - VM_AccessProjectile(tw==CON_SETPROJECTILE,lVar1,lLabelID,lVar2); - continue; - } - - case CON_SETWALL: - case CON_GETWALL: - insptr++; - { - // syntax [gs]etwall[].x - // - int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; - - VM_AccessWall(tw==CON_SETWALL, lVar1, lLabelID, lVar2); - continue; - } - - case CON_SETACTORVAR: - case CON_GETACTORVAR: - insptr++; - { - // syntax [gs]etactorvar[]. - // gets the value of the per-actor variable varx into VAR - // - int32_t lSprite=Gv_GetVarX(*insptr++), lVar1=*insptr++; - int32_t lVar2=*insptr++; - - if ((unsigned)lSprite >= MAXSPRITES) - { - OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],lSprite); - if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; - if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; - continue; - } - - if (tw == CON_SETACTORVAR) - { - Gv_SetVar(lVar1, Gv_GetVarX(lVar2), lSprite, vm.g_p); - continue; - } - Gv_SetVarX(lVar2, Gv_GetVar(lVar1, lSprite, vm.g_p)); - continue; - } - - case CON_SETPLAYERVAR: - case CON_GETPLAYERVAR: - insptr++; - { - int32_t iPlayer = vm.g_p; - - if (*insptr != g_iThisActorID) - iPlayer=Gv_GetVarX(*insptr); - - insptr++; - { - int32_t lVar1=*insptr++, lVar2=*insptr++; - - if ((unsigned)iPlayer >= (unsigned)playerswhenstarted) - { - OSD_Printf(CON_ERROR "invalid player ID %d\n",g_errorLineNum,keyw[g_tw],iPlayer); - if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; - if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; - continue; - } - - if (tw == CON_SETPLAYERVAR) - { - Gv_SetVar(lVar1, Gv_GetVarX(lVar2), vm.g_i, iPlayer); - continue; - } - Gv_SetVarX(lVar2, Gv_GetVar(lVar1, vm.g_i, iPlayer)); - continue; - } - } - - case CON_SETACTOR: - insptr++; - { - // syntax [gs]etactor[].x - // - - int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0; - - if (ActorLabels[lLabelID].flags & LABEL_HASPARM2) - lParm2=Gv_GetVarX(*insptr++); - - { - int32_t lVar2=*insptr++; - - VM_SetSprite(lVar1, lLabelID, lVar2, lParm2); - } - continue; - } - - case CON_GETACTOR: - insptr++; - { - // syntax [gs]etactor[].x - // - - int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0; - - if (ActorLabels[lLabelID].flags & LABEL_HASPARM2) - lParm2=Gv_GetVarX(*insptr++); - - { - int32_t lVar2=*insptr++; - - VM_GetSprite(lVar1, lLabelID, lVar2, lParm2); - } - continue; - } - - case CON_SETTSPR: - case CON_GETTSPR: - insptr++; - { - // syntax [gs]etactor[].x - // - - int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; - - VM_AccessTsprite(tw==CON_SETTSPR, lVar1, lLabelID, lVar2); - continue; - } - - case CON_GETANGLETOTARGET: - insptr++; - // Actor[vm.g_i].lastvx and lastvy are last known location of target. - Gv_SetVarX(*insptr++, getangle(actor[vm.g_i].lastvx-vm.g_sp->x,actor[vm.g_i].lastvy-vm.g_sp->y)); - continue; - - case CON_ANGOFFVAR: - insptr++; - spriteext[vm.g_i].angoff=Gv_GetVarX(*insptr++); - continue; - - case CON_LOCKPLAYER: - insptr++; - g_player[vm.g_p].ps->transporter_hold=Gv_GetVarX(*insptr++); - continue; - - case CON_CHECKAVAILWEAPON: - case CON_CHECKAVAILINVEN: - insptr++; - { - int32_t j = vm.g_p; - - if (*insptr != g_iThisActorID) - j=Gv_GetVarX(*insptr); - - insptr++; - - if ((unsigned)j >= (unsigned)playerswhenstarted) - { - OSD_Printf(CON_ERROR "Invalid player ID %d\n",g_errorLineNum,keyw[g_tw],j); - continue; - } - - if (tw == CON_CHECKAVAILWEAPON) - P_CheckWeapon(g_player[j].ps); - else P_SelectNextInvItem(g_player[j].ps); - } - continue; - - case CON_GETPLAYERANGLE: - insptr++; - Gv_SetVarX(*insptr++, g_player[vm.g_p].ps->ang); - continue; - - case CON_SETPLAYERANGLE: - insptr++; - g_player[vm.g_p].ps->ang=Gv_GetVarX(*insptr++); - g_player[vm.g_p].ps->ang &= 2047; - continue; - - case CON_GETACTORANGLE: - insptr++; - Gv_SetVarX(*insptr++, vm.g_sp->ang); - continue; - - case CON_SETACTORANGLE: - insptr++; - vm.g_sp->ang=Gv_GetVarX(*insptr++); - vm.g_sp->ang &= 2047; - continue; - - case CON_SETVAR: - insptr++; - Gv_SetVarX(*insptr, *(insptr+1)); - insptr += 2; - continue; - - case CON_SETARRAY: - insptr++; - { - int32_t j=*insptr++; - int32_t index = Gv_GetVarX(*insptr++); - int32_t value = Gv_GetVarX(*insptr++); - - if (j<0 || j >= g_gameArrayCount || index >= aGameArrays[j].size || index < 0) - { - OSD_Printf(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",j,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); - continue; - } - aGameArrays[j].plValues[index]=value; - continue; - } - case CON_WRITEARRAYTOFILE: - case CON_READARRAYFROMFILE: - insptr++; - { - int32_t j=*insptr++; - { - int q = *insptr++; - - if (ScriptQuotes[q] == NULL) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); - continue; - } - - if (tw == CON_READARRAYFROMFILE) - { - int32_t fil = kopen4loadfrommod(ScriptQuotes[q], 0); - int32_t asize; - - if (fil < 0) - continue; - - asize = kfilelength(fil); - - if (asize > 0) - { - /*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", - aGameArrays[j].szLabel, aGameArrays[j].size, asize / sizeof(int32_t));*/ - aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, asize); - aGameArrays[j].size = asize / sizeof(int32_t); - kread(fil, aGameArrays[j].plValues, asize); - } - - kclose(fil); - continue; - } - - { - FILE *fil; - char temp[BMAX_PATH]; - - if (g_modDir[0] != '/') - Bsprintf(temp,"%s/%s",g_modDir,ScriptQuotes[q]); - else Bsprintf(temp,"%s",ScriptQuotes[q]); - - if ((fil = fopen(temp,"wb")) == 0) continue; - - fwrite(aGameArrays[j].plValues,1,sizeof(int) * aGameArrays[j].size,fil); - fclose(fil); - } - - continue; - } - } - - case CON_GETARRAYSIZE: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(*insptr++,aGameArrays[j].size); - } - continue; - - case CON_RESIZEARRAY: - insptr++; - { - int32_t j=*insptr++; - int32_t asize = Gv_GetVarX(*insptr++); - - if (asize > 0) - { - /*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize);*/ - aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, sizeof(int32_t) * asize); - aGameArrays[j].size = asize; - } - continue; - } - - case CON_COPY: - insptr++; - { - int32_t j=*insptr++; - int32_t index = Gv_GetVarX(*insptr++); - int32_t j1=*insptr++; - int32_t index1 = Gv_GetVarX(*insptr++); - int32_t value = Gv_GetVarX(*insptr++); - - if (index > aGameArrays[j].size || index1 > aGameArrays[j1].size) continue; - if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index; - if ((index1+value)>aGameArrays[j1].size) value=aGameArrays[j1].size-index1; - Bmemcpy(aGameArrays[j1].plValues+index1, aGameArrays[j].plValues+index, value * sizeof(intptr_t)); - continue; - } - - case CON_RANDVAR: - insptr++; - Gv_SetVarX(*insptr, mulscale16(krand(), *(insptr+1)+1)); - insptr += 2; - continue; - - case CON_DISPLAYRANDVAR: - insptr++; - Gv_SetVarX(*insptr, mulscale15((uint16_t)rand(), *(insptr+1)+1)); - insptr += 2; - continue; - - case CON_INV: - Gv_SetVarX(*(insptr+1), -Gv_GetVarX(*(insptr+1))); - insptr += 2; - continue; - - case CON_MULVAR: - insptr++; - Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) * *(insptr+1)); - insptr += 2; - continue; - - case CON_DIVVAR: - insptr++; - if (*(insptr+1) == 0) - { - OSD_Printf(CON_ERROR "Divide by zero.\n",g_errorLineNum,keyw[g_tw]); - insptr += 2; - continue; - } - Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) / *(insptr+1)); - insptr += 2; - continue; - - case CON_MODVAR: - insptr++; - if (*(insptr+1) == 0) - { - OSD_Printf(CON_ERROR "Mod by zero.\n",g_errorLineNum,keyw[g_tw]); - insptr += 2; - continue; - } - Gv_SetVarX(*insptr,Gv_GetVarX(*insptr)%*(insptr+1)); - insptr += 2; - continue; - - case CON_ANDVAR: - insptr++; - Gv_SetVarX(*insptr,Gv_GetVarX(*insptr) & *(insptr+1)); - insptr += 2; - continue; - - case CON_ORVAR: - insptr++; - Gv_SetVarX(*insptr,Gv_GetVarX(*insptr) | *(insptr+1)); - insptr += 2; - continue; - - case CON_XORVAR: - insptr++; - Gv_SetVarX(*insptr,Gv_GetVarX(*insptr) ^ *(insptr+1)); - insptr += 2; - continue; - - case CON_SETVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j, Gv_GetVarX(*insptr++)); - } - continue; - - case CON_RANDVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j,mulscale(krand(), Gv_GetVarX(*insptr++)+1, 16)); - } - continue; - - case CON_DISPLAYRANDVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j,mulscale((uint16_t)rand(), Gv_GetVarX(*insptr++)+1, 15)); - } - continue; - - case CON_GMAXAMMO: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - if ((j<0 || j>=MAX_WEAPONS)) - { - OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j); - insptr++; - continue; - } - Gv_SetVarX(*insptr++, g_player[vm.g_p].ps->max_ammo_amount[j]); - } - continue; - - case CON_SMAXAMMO: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - if ((j<0 || j>=MAX_WEAPONS)) - { - OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j); - insptr++; - continue; - } - g_player[vm.g_p].ps->max_ammo_amount[j]=Gv_GetVarX(*insptr++); - } - continue; - - case CON_MULVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j, Gv_GetVarX(j)*Gv_GetVarX(*insptr++)); - } - continue; - - case CON_DIVVARVAR: - insptr++; - { - int32_t j=*insptr++; - int32_t l2=Gv_GetVarX(*insptr++); - - if (l2==0) - { - OSD_Printf(CON_ERROR "Divide by zero.\n",g_errorLineNum,keyw[g_tw]); - continue; - } - Gv_SetVarX(j, Gv_GetVarX(j)/l2); - continue; - } - - case CON_MODVARVAR: - insptr++; - { - int32_t j=*insptr++; - int32_t l2=Gv_GetVarX(*insptr++); - - if (l2==0) - { - OSD_Printf(CON_ERROR "Mod by zero.\n",g_errorLineNum,keyw[g_tw]); - continue; - } - - Gv_SetVarX(j, Gv_GetVarX(j) % l2); - continue; - } - - case CON_ANDVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j, Gv_GetVarX(j) & Gv_GetVarX(*insptr++)); - } - continue; - - case CON_XORVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j, Gv_GetVarX(j) ^ Gv_GetVarX(*insptr++)); - } - continue; - - case CON_ORVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j, Gv_GetVarX(j) | Gv_GetVarX(*insptr++)); - } - continue; - - case CON_SUBVAR: - insptr++; - Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) - *(insptr+1)); - insptr += 2; - continue; - - case CON_SUBVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j, Gv_GetVarX(j) - Gv_GetVarX(*insptr++)); - } - continue; - - case CON_ADDVAR: - insptr++; - Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) + *(insptr+1)); - insptr += 2; - continue; - - case CON_SHIFTVARL: - insptr++; - Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) << *(insptr+1)); - insptr += 2; - continue; - - case CON_SHIFTVARR: - insptr++; - Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) >> *(insptr+1)); - insptr += 2; - continue; - - case CON_SIN: - insptr++; - Gv_SetVarX(*insptr, sintable[Gv_GetVarX(*(insptr+1))&2047]); - insptr += 2; - continue; - - case CON_COS: - insptr++; - Gv_SetVarX(*insptr, sintable[(Gv_GetVarX(*(insptr+1))+512)&2047]); - insptr += 2; - continue; - - case CON_ADDVARVAR: - insptr++; - { - int32_t j=*insptr++; - Gv_SetVarX(j, Gv_GetVarX(j) + Gv_GetVarX(*insptr++)); - } - continue; - - case CON_SPGETLOTAG: - insptr++; - Gv_SetVarX(g_iLoTagID, vm.g_sp->lotag); - continue; - - case CON_SPGETHITAG: - insptr++; - Gv_SetVarX(g_iHiTagID, vm.g_sp->hitag); - continue; - - case CON_SECTGETLOTAG: - insptr++; - Gv_SetVarX(g_iLoTagID, sector[vm.g_sp->sectnum].lotag); - continue; - - case CON_SECTGETHITAG: - insptr++; - Gv_SetVarX(g_iHiTagID, sector[vm.g_sp->sectnum].hitag); - continue; - - case CON_GETTEXTUREFLOOR: - insptr++; - Gv_SetVarX(g_iTextureID, sector[vm.g_sp->sectnum].floorpicnum); - continue; - - case CON_STARTTRACK: - case CON_STARTTRACKVAR: - insptr++; - if (tw == CON_STARTTRACK) g_musicIndex=(ud.volume_number*MAXLEVELS)+(*(insptr++)); - else g_musicIndex=(ud.volume_number*MAXLEVELS)+(Gv_GetVarX(*(insptr++))); - if (MapInfo[(uint8_t)g_musicIndex].musicfn == NULL) - { - OSD_Printf(CON_ERROR "null music for map %d\n",g_errorLineNum,keyw[g_tw],g_musicIndex); - continue; - } - S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex); - continue; - - case CON_ACTIVATECHEAT: - insptr++; - { - int32_t j=Gv_GetVarX(*(insptr++)); - if (numplayers != 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME)) - { - OSD_Printf(CON_ERROR "not in a single-player game.\n",g_errorLineNum,keyw[g_tw]); - continue; - } - osdcmd_cheatsinfo_stat.cheatnum = j; - } - continue; - - case CON_SETGAMEPALETTE: - insptr++; - P_SetGamePalette(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr++)),0); - continue; - - case CON_GETTEXTURECEILING: - insptr++; - Gv_SetVarX(g_iTextureID, sector[vm.g_sp->sectnum].ceilingpicnum); - continue; - - case CON_IFVARVARAND: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - j &= Gv_GetVarX(*insptr++); - insptr--; - VM_DoConditional(j); - } - continue; - - case CON_IFVARVAROR: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - j |= Gv_GetVarX(*insptr++); - insptr--; - VM_DoConditional(j); - } - continue; - - case CON_IFVARVARXOR: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - j ^= Gv_GetVarX(*insptr++); - insptr--; - VM_DoConditional(j); - } - continue; - - case CON_IFVARVAREITHER: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - int32_t l = Gv_GetVarX(*insptr++); - insptr--; - VM_DoConditional(j || l); - } - continue; - - case CON_IFVARVARN: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - j = (j != Gv_GetVarX(*insptr++)); - insptr--; - VM_DoConditional(j); - } - continue; - - case CON_IFVARVARE: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - j = (j == Gv_GetVarX(*insptr++)); - insptr--; - VM_DoConditional(j); - } - continue; - - case CON_IFVARVARG: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - j = (j > Gv_GetVarX(*insptr++)); - insptr--; - VM_DoConditional(j); - } - continue; - - case CON_IFVARVARL: - insptr++; - { - int32_t j = Gv_GetVarX(*insptr++); - j = (j < Gv_GetVarX(*insptr++)); - insptr--; - VM_DoConditional(j); - } - continue; - - case CON_IFVARE: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j == *insptr); - } - continue; - - case CON_IFVARN: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j != *insptr); - } - continue; - - case CON_WHILEVARN: - { - intptr_t *savedinsptr=insptr+2; - int32_t j; - do - { - insptr=savedinsptr; - j = (Gv_GetVarX(*(insptr-1)) != *insptr); - VM_DoConditional(j); - } - while (j); - continue; - } - - case CON_WHILEVARVARN: - { - int32_t j; - intptr_t *savedinsptr=insptr+2; - do - { - insptr=savedinsptr; - j = Gv_GetVarX(*(insptr-1)); - j = (j != Gv_GetVarX(*insptr++)); - insptr--; - VM_DoConditional(j); - } - while (j); - continue; - } - - case CON_IFVARAND: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j & *insptr); - } - continue; - - case CON_IFVAROR: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j | *insptr); - } - continue; - - case CON_IFVARXOR: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j ^ *insptr); - } - continue; - - case CON_IFVAREITHER: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j || *insptr); - } - continue; - - case CON_IFVARG: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j > *insptr); - } - continue; - - case CON_IFVARL: - insptr++; - { - int32_t j=Gv_GetVarX(*insptr++); - VM_DoConditional(j < *insptr); - } - continue; - - case CON_IFPHEALTHL: - insptr++; - VM_DoConditional(sprite[g_player[vm.g_p].ps->i].extra < *insptr); - continue; - - case CON_IFPINVENTORY: - insptr++; - { - int32_t j = 0; - switch (*insptr++) - { - case GET_STEROIDS: - if (g_player[vm.g_p].ps->inv_amount[GET_STEROIDS] != *insptr) - j = 1; - break; - case GET_SHIELD: - if (g_player[vm.g_p].ps->inv_amount[GET_SHIELD] != g_player[vm.g_p].ps->max_shield_amount) - j = 1; - break; - case GET_SCUBA: - if (g_player[vm.g_p].ps->inv_amount[GET_SCUBA] != *insptr) j = 1; - break; - case GET_HOLODUKE: - if (g_player[vm.g_p].ps->inv_amount[GET_HOLODUKE] != *insptr) j = 1; - break; - case GET_JETPACK: - if (g_player[vm.g_p].ps->inv_amount[GET_JETPACK] != *insptr) j = 1; - break; - case GET_ACCESS: - switch (vm.g_sp->pal) - { - case 0: - if (g_player[vm.g_p].ps->got_access&1) j = 1; - break; - case 21: - if (g_player[vm.g_p].ps->got_access&2) j = 1; - break; - case 23: - if (g_player[vm.g_p].ps->got_access&4) j = 1; - break; - } - break; - case GET_HEATS: - if (g_player[vm.g_p].ps->inv_amount[GET_HEATS] != *insptr) j = 1; - break; - case GET_FIRSTAID: - if (g_player[vm.g_p].ps->inv_amount[GET_FIRSTAID] != *insptr) j = 1; - break; - case GET_BOOTS: - if (g_player[vm.g_p].ps->inv_amount[GET_BOOTS] != *insptr) j = 1; - break; - default: - OSD_Printf(CON_ERROR "invalid inventory ID: %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*(insptr-1)); - } - - VM_DoConditional(j); - continue; - } - - case CON_PSTOMP: - insptr++; - if (g_player[vm.g_p].ps->knee_incs == 0 && sprite[g_player[vm.g_p].ps->i].xrepeat >= 40) - if (cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(4<<8),vm.g_sp->sectnum,g_player[vm.g_p].ps->pos.x, - g_player[vm.g_p].ps->pos.y,g_player[vm.g_p].ps->pos.z+(16<<8),sprite[g_player[vm.g_p].ps->i].sectnum)) - { - int32_t j = playerswhenstarted-1; - for (; j>=0; j--) - { - if (g_player[j].ps->actorsqu == vm.g_i) - break; - } - if (j == -1) - { - g_player[vm.g_p].ps->knee_incs = 1; - if (g_player[vm.g_p].ps->weapon_pos == 0) - g_player[vm.g_p].ps->weapon_pos = -1; - g_player[vm.g_p].ps->actorsqu = vm.g_i; - } - } - continue; - - case CON_IFAWAYFROMWALL: - { - int16_t s1=vm.g_sp->sectnum; - int32_t j = 0; - - updatesector(vm.g_sp->x+108,vm.g_sp->y+108,&s1); - if (s1 == vm.g_sp->sectnum) - { - updatesector(vm.g_sp->x-108,vm.g_sp->y-108,&s1); - if (s1 == vm.g_sp->sectnum) - { - updatesector(vm.g_sp->x+108,vm.g_sp->y-108,&s1); - if (s1 == vm.g_sp->sectnum) - { - updatesector(vm.g_sp->x-108,vm.g_sp->y+108,&s1); - if (s1 == vm.g_sp->sectnum) - j = 1; - } - } - } - VM_DoConditional(j); - } - continue; - - case CON_QUOTE: - insptr++; - - if ((ScriptQuotes[*insptr] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); - insptr++; - continue; - } - - if ((unsigned)vm.g_p >= MAXPLAYERS) - { - OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr,vm.g_p); - insptr++; - continue; - } - - P_DoQuote(*(insptr++)|MAXQUOTES,g_player[vm.g_p].ps); - continue; - - case CON_USERQUOTE: - insptr++; - { - int32_t i=Gv_GetVarX(*insptr++); - - if ((ScriptQuotes[i] == NULL)) - { - OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); - continue; - } - G_AddUserQuote(ScriptQuotes[i]); - } - continue; - - case CON_IFINOUTERSPACE: - VM_DoConditional(G_CheckForSpaceFloor(vm.g_sp->sectnum)); - continue; - - case CON_IFNOTMOVING: - VM_DoConditional((actor[vm.g_i].movflag&49152) > 16384); - continue; - - case CON_RESPAWNHITAG: - insptr++; - switch (DynamicTileMap[vm.g_sp->picnum]) - { - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case PODFEM1__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - if (vm.g_sp->yvel) G_OperateRespawns(vm.g_sp->yvel); - break; - default: - if (vm.g_sp->hitag >= 0) G_OperateRespawns(vm.g_sp->hitag); - break; - } - continue; - - case CON_IFSPRITEPAL: - insptr++; - VM_DoConditional(vm.g_sp->pal == *insptr); - continue; - - case CON_IFANGDIFFL: - insptr++; - { - int32_t j = klabs(G_GetAngleDelta(g_player[vm.g_p].ps->ang,vm.g_sp->ang)); - VM_DoConditional(j <= *insptr); - } - continue; - - case CON_IFNOSOUNDS: - { - int32_t j = MAXSOUNDS-1; - for (; j>=0; j--) - { - int32_t k = 0; - - for (; kpicnum] == 0) return; - - insptr = actorLoadEventScrptr[vm.g_sp->picnum]; - - vm.g_flags &= ~(VM_RETURN|VM_KILL|VM_NOEXECUTE); - - if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS) - { - // if(A_CheckEnemySprite(vm.g_sp)) - // g_player[vm.g_p].ps->actors_killed++; - deletesprite(vm.g_i); - return; - } - - VM_Execute(0); - - if (vm.g_flags & VM_KILL) - deletesprite(vm.g_i); -} - -void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist) -{ - vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0], - &sprite[iActor], 0 - }; - - if (g_netClient && A_CheckSpriteFlags(iActor, SPRITE_NULL)) - { - deletesprite(iActor); - return; - } - - if (g_netServer || g_netClient) - randomseed = ticrandomseed; - - Bmemcpy(&vm, &tempvm, sizeof(vmstate_t)); - - insptr = 4 + (actorscrptr[vm.g_sp->picnum]); - - if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS) - { - if (A_CheckEnemySprite(vm.g_sp)) - g_player[vm.g_p].ps->actors_killed++; - deletesprite(vm.g_i); - return; - } - - /* Qbix: Changed variables to be aware of the sizeof *insptr - * (whether it is int32_t vs intptr_t), Although it is specifically cast to intptr_t* - * which might be corrected if the code is converted to use offsets */ - if ((unsigned)(vm.g_t[4]-(intptr_t)&script[0]) <= (unsigned)((intptr_t)&script[g_scriptSize]-(intptr_t)&script[0])) - { - vm.g_sp->lotag += TICSPERFRAME; - - if (vm.g_sp->lotag > *(intptr_t *)(vm.g_t[4]+4*sizeof(*insptr))) - { - vm.g_t[2]++; - vm.g_sp->lotag = 0; - vm.g_t[3] += *(intptr_t *)(vm.g_t[4]+3*sizeof(*insptr)); - } - - if (klabs(vm.g_t[3]) >= klabs(*(intptr_t *)(vm.g_t[4]+sizeof(*insptr)) * *(intptr_t *)(vm.g_t[4]+3*sizeof(*insptr)))) - vm.g_t[3] = 0; - } - - VM_Execute(0); - - if (vm.g_flags & VM_KILL) - { - // if player was set to squish, first stop that... - if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i) - g_player[vm.g_p].ps->actorsqu = -1; - - deletesprite(vm.g_i); - return; - } - - VM_Move(); - - /* if (ud.angleinterpolation) - { - temp = (vm.g_sp->ang & 2047) - sprpos[vm.g_i].ang; - sprpos[vm.g_i].oldang = sprpos[vm.g_i].ang; - if (temp) - { - temp2 = temp/klabs(temp); - if (klabs(temp) > 1024) temp2 = -(temp2); - sprpos[vm.g_i].angdir = temp2; - sprpos[vm.g_i].angdif = min(ud.angleinterpolation,klabs(temp)); - sprpos[vm.g_i].ang += sprpos[vm.g_i].angdif * sprpos[vm.g_i].angdir; - sprpos[vm.g_i].ang &= 2047; - } - } - */ - if (vm.g_sp->statnum == STAT_STANDABLE) - switch (DynamicTileMap[vm.g_sp->picnum]) - { - case RUBBERCAN__STATIC: - case EXPLODINGBARREL__STATIC: - case WOODENHORSE__STATIC: - case HORSEONSIDE__STATIC: - case CANWITHSOMETHING__STATIC: - case FIREBARREL__STATIC: - case NUKEBARREL__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case TRIPBOMB__STATIC: - case EGG__STATIC: - if (actor[vm.g_i].timetosleep > 1) - actor[vm.g_i].timetosleep--; - else if (actor[vm.g_i].timetosleep == 1) - changespritestat(vm.g_i,STAT_ZOMBIEACTOR); - default: - return; - } - - if (vm.g_sp->statnum != 1) - return; - - if (A_CheckEnemySprite(vm.g_sp)) - { - if (vm.g_sp->xrepeat > 60) return; - if (ud.respawn_monsters == 1 && vm.g_sp->extra <= 0) return; - } - else if (ud.respawn_items == 1 && (vm.g_sp->cstat&32768)) return; - - if (A_CheckSpriteFlags(vm.g_i, SPRITE_USEACTIVATOR) && sector[vm.g_sp->sectnum].lotag & 16384) - changespritestat(vm.g_i,STAT_ZOMBIEACTOR); - else if (actor[vm.g_i].timetosleep > 1) - actor[vm.g_i].timetosleep--; - else if (actor[vm.g_i].timetosleep == 1) - changespritestat(vm.g_i,STAT_ZOMBIEACTOR); -} - -void G_SaveMapState(mapstate_t *save) -{ - if (save != NULL) - { - int32_t i; - intptr_t j; - - Bmemcpy(&save->numwalls,&numwalls,sizeof(numwalls)); - Bmemcpy(&save->wall[0],&wall[0],sizeof(walltype)*MAXWALLS); - Bmemcpy(&save->numsectors,&numsectors,sizeof(numsectors)); - Bmemcpy(&save->sector[0],§or[0],sizeof(sectortype)*MAXSECTORS); - Bmemcpy(&save->sprite[0],&sprite[0],sizeof(spritetype)*MAXSPRITES); - Bmemcpy(&save->spriteext[0],&spriteext[0],sizeof(spriteext_t)*MAXSPRITES); - Bmemcpy(&save->headspritesect[0],&headspritesect[0],sizeof(headspritesect)); - Bmemcpy(&save->prevspritesect[0],&prevspritesect[0],sizeof(prevspritesect)); - Bmemcpy(&save->nextspritesect[0],&nextspritesect[0],sizeof(nextspritesect)); - Bmemcpy(&save->headspritestat[0],&headspritestat[0],sizeof(headspritestat)); - Bmemcpy(&save->prevspritestat[0],&prevspritestat[0],sizeof(prevspritestat)); - Bmemcpy(&save->nextspritestat[0],&nextspritestat[0],sizeof(nextspritestat)); - - for (i=MAXSPRITES-1; i>=0; i--) - { - save->scriptptrs[i] = 0; - - if (actorscrptr[PN] == 0) continue; - - j = (intptr_t)&script[0]; - - if (T2 >= j && T2 < (intptr_t)(&script[g_scriptSize])) - { - save->scriptptrs[i] |= 1; - T2 -= j; - } - if (T5 >= j && T5 < (intptr_t)(&script[g_scriptSize])) - { - save->scriptptrs[i] |= 2; - T5 -= j; - } - if (T6 >= j && T6 < (intptr_t)(&script[g_scriptSize])) - { - save->scriptptrs[i] |= 4; - T6 -= j; - } - } - - Bmemcpy(&save->actor[0],&actor[0],sizeof(actor_t)*MAXSPRITES); - - for (i=MAXSPRITES-1; i>=0; i--) - { - if (actorscrptr[PN] == 0) continue; - j = (intptr_t)&script[0]; - - if (save->scriptptrs[i]&1) - T2 += j; - if (save->scriptptrs[i]&2) - T5 += j; - if (save->scriptptrs[i]&4) - T6 += j; - } - - Bmemcpy(&save->g_numCyclers,&g_numCyclers,sizeof(g_numCyclers)); - Bmemcpy(&save->cyclers[0][0],&cyclers[0][0],sizeof(cyclers)); - Bmemcpy(&save->g_playerSpawnPoints[0],&g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints)); - Bmemcpy(&save->g_numAnimWalls,&g_numAnimWalls,sizeof(g_numAnimWalls)); - Bmemcpy(&save->SpriteDeletionQueue[0],&SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue)); - Bmemcpy(&save->g_spriteDeleteQueuePos,&g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos)); - Bmemcpy(&save->animwall[0],&animwall[0],sizeof(animwall)); - Bmemcpy(&save->msx[0],&msx[0],sizeof(msx)); - Bmemcpy(&save->msy[0],&msy[0],sizeof(msy)); - Bmemcpy(&save->g_mirrorWall[0],&g_mirrorWall[0],sizeof(g_mirrorWall)); - Bmemcpy(&save->g_mirrorSector[0],&g_mirrorSector[0],sizeof(g_mirrorSector)); - Bmemcpy(&save->g_mirrorCount,&g_mirrorCount,sizeof(g_mirrorCount)); - Bmemcpy(&save->show2dsector[0],&show2dsector[0],sizeof(show2dsector)); - Bmemcpy(&save->g_numClouds,&g_numClouds,sizeof(g_numClouds)); - Bmemcpy(&save->clouds[0],&clouds[0],sizeof(clouds)); - Bmemcpy(&save->cloudx[0],&cloudx[0],sizeof(cloudx)); - Bmemcpy(&save->cloudy[0],&cloudy[0],sizeof(cloudy)); - Bmemcpy(&save->pskyoff[0],&pskyoff[0],sizeof(pskyoff)); - Bmemcpy(&save->pskybits,&pskybits,sizeof(pskybits)); - Bmemcpy(&save->animategoal[0],&animategoal[0],sizeof(animategoal)); - Bmemcpy(&save->animatevel[0],&animatevel[0],sizeof(animatevel)); - Bmemcpy(&save->g_animateCount,&g_animateCount,sizeof(g_animateCount)); - Bmemcpy(&save->animatesect[0],&animatesect[0],sizeof(animatesect)); - for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(§or[0])); - Bmemcpy(&save->animateptr[0],&animateptr[0],sizeof(animateptr)); - for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[0])); - Bmemcpy(&save->g_numPlayerSprites,&g_numPlayerSprites,sizeof(g_numPlayerSprites)); - Bmemcpy(&save->g_earthquakeTime,&g_earthquakeTime,sizeof(g_earthquakeTime)); - Bmemcpy(&save->lockclock,&lockclock,sizeof(lockclock)); - Bmemcpy(&save->randomseed,&randomseed,sizeof(randomseed)); - Bmemcpy(&save->g_globalRandom,&g_globalRandom,sizeof(g_globalRandom)); - - for (i=g_gameVarCount-1; i>=0; i--) - { - if (aGameVars[i].dwFlags & GAMEVAR_NORESET) continue; - if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER) - { - if (!save->vars[i]) - save->vars[i] = Bcalloc(MAXPLAYERS,sizeof(intptr_t)); - Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXPLAYERS); - } - else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR) - { - if (!save->vars[i]) - save->vars[i] = Bcalloc(MAXSPRITES,sizeof(intptr_t)); - Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXSPRITES); - } - else save->vars[i] = (intptr_t *)aGameVars[i].val.lValue; - } - - ototalclock = totalclock; - } -} - -extern void Gv_RefreshPointers(void); - -void G_RestoreMapState(mapstate_t *save) -{ - if (save != NULL) - { - int32_t i, k, x; - intptr_t j; - char phealth[MAXPLAYERS]; - - for (i=0; ii].extra; - - pub = NUMPAGES; - pus = NUMPAGES; - G_UpdateScreenArea(); - - Bmemcpy(&numwalls,&save->numwalls,sizeof(numwalls)); - Bmemcpy(&wall[0],&save->wall[0],sizeof(walltype)*MAXWALLS); - Bmemcpy(&numsectors,&save->numsectors,sizeof(numsectors)); - Bmemcpy(§or[0],&save->sector[0],sizeof(sectortype)*MAXSECTORS); - Bmemcpy(&sprite[0],&save->sprite[0],sizeof(spritetype)*MAXSPRITES); - Bmemcpy(&spriteext[0],&save->spriteext[0],sizeof(spriteext_t)*MAXSPRITES); - Bmemcpy(&headspritesect[0],&save->headspritesect[0],sizeof(headspritesect)); - Bmemcpy(&prevspritesect[0],&save->prevspritesect[0],sizeof(prevspritesect)); - Bmemcpy(&nextspritesect[0],&save->nextspritesect[0],sizeof(nextspritesect)); - Bmemcpy(&headspritestat[0],&save->headspritestat[0],sizeof(headspritestat)); - Bmemcpy(&prevspritestat[0],&save->prevspritestat[0],sizeof(prevspritestat)); - Bmemcpy(&nextspritestat[0],&save->nextspritestat[0],sizeof(nextspritestat)); - Bmemcpy(&actor[0],&save->actor[0],sizeof(actor_t)*MAXSPRITES); - - for (i=MAXSPRITES-1; i>=0; i--) - { - j = (intptr_t)(&script[0]); - if (save->scriptptrs[i]&1) T2 += j; - if (save->scriptptrs[i]&2) T5 += j; - if (save->scriptptrs[i]&4) T6 += j; - } - - Bmemcpy(&g_numCyclers,&save->g_numCyclers,sizeof(g_numCyclers)); - Bmemcpy(&cyclers[0][0],&save->cyclers[0][0],sizeof(cyclers)); - Bmemcpy(&g_playerSpawnPoints[0],&save->g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints)); - Bmemcpy(&g_numAnimWalls,&save->g_numAnimWalls,sizeof(g_numAnimWalls)); - Bmemcpy(&SpriteDeletionQueue[0],&save->SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue)); - Bmemcpy(&g_spriteDeleteQueuePos,&save->g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos)); - Bmemcpy(&animwall[0],&save->animwall[0],sizeof(animwall)); - Bmemcpy(&msx[0],&save->msx[0],sizeof(msx)); - Bmemcpy(&msy[0],&save->msy[0],sizeof(msy)); - Bmemcpy(&g_mirrorWall[0],&save->g_mirrorWall[0],sizeof(g_mirrorWall)); - Bmemcpy(&g_mirrorSector[0],&save->g_mirrorSector[0],sizeof(g_mirrorSector)); - Bmemcpy(&g_mirrorCount,&save->g_mirrorCount,sizeof(g_mirrorCount)); - Bmemcpy(&show2dsector[0],&save->show2dsector[0],sizeof(show2dsector)); - Bmemcpy(&g_numClouds,&save->g_numClouds,sizeof(g_numClouds)); - Bmemcpy(&clouds[0],&save->clouds[0],sizeof(clouds)); - Bmemcpy(&cloudx[0],&save->cloudx[0],sizeof(cloudx)); - Bmemcpy(&cloudy[0],&save->cloudy[0],sizeof(cloudy)); - Bmemcpy(&pskyoff[0],&save->pskyoff[0],sizeof(pskyoff)); - Bmemcpy(&pskybits,&save->pskybits,sizeof(pskybits)); - Bmemcpy(&animategoal[0],&save->animategoal[0],sizeof(animategoal)); - Bmemcpy(&animatevel[0],&save->animatevel[0],sizeof(animatevel)); - Bmemcpy(&g_animateCount,&save->g_animateCount,sizeof(g_animateCount)); - Bmemcpy(&animatesect[0],&save->animatesect[0],sizeof(animatesect)); - Bmemcpy(&animateptr[0],&save->animateptr[0],sizeof(animateptr)); - for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[0])); - Bmemcpy(&g_numPlayerSprites,&save->g_numPlayerSprites,sizeof(g_numPlayerSprites)); - Bmemcpy(&g_earthquakeTime,&save->g_earthquakeTime,sizeof(g_earthquakeTime)); - Bmemcpy(&lockclock,&save->lockclock,sizeof(lockclock)); - Bmemcpy(&randomseed,&save->randomseed,sizeof(randomseed)); - Bmemcpy(&g_globalRandom,&save->g_globalRandom,sizeof(g_globalRandom)); - - for (i=g_gameVarCount-1; i>=0; i--) - { - if (aGameVars[i].dwFlags & GAMEVAR_NORESET) continue; - if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER) - { - if (!save->vars[i]) continue; - Bmemcpy(&aGameVars[i].val.plValues[0],&save->vars[i][0],sizeof(intptr_t) * MAXPLAYERS); - } - else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR) - { - if (!save->vars[i]) continue; - Bmemcpy(&aGameVars[i].val.plValues[0],&save->vars[i][0],sizeof(intptr_t) * MAXSPRITES); - } - else aGameVars[i].val.lValue = (intptr_t)save->vars[i]; - } - - Gv_RefreshPointers(); - - for (i=0; ii].extra = phealth[i]; - - if (g_player[myconnectindex].ps->over_shoulder_on != 0) - { - g_cameraDistance = 0; - g_cameraClock = 0; - g_player[myconnectindex].ps->over_shoulder_on = 1; - } - - screenpeek = myconnectindex; - - if (ud.lockout == 0) - { - for (x=g_numAnimWalls-1; x>=0; x--) - if (wall[animwall[x].wallnum].extra >= 0) - wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; - } - else - { - for (x=g_numAnimWalls-1; x>=0; x--) - switch (DynamicTileMap[wall[animwall[x].wallnum].picnum]) - { - case FEMPIC1__STATIC: - wall[animwall[x].wallnum].picnum = BLANKSCREEN; - break; - case FEMPIC2__STATIC: - case FEMPIC3__STATIC: - wall[animwall[x].wallnum].picnum = SCREENBREAK6; - break; - } - } - - g_numInterpolations = 0; - startofdynamicinterpolations = 0; - - k = headspritestat[STAT_EFFECTOR]; - while (k >= 0) - { - switch (sprite[k].lotag) - { - case 31: - G_SetInterpolation(§or[sprite[k].sectnum].floorz); - break; - case 32: - G_SetInterpolation(§or[sprite[k].sectnum].ceilingz); - break; - case 25: - G_SetInterpolation(§or[sprite[k].sectnum].floorz); - G_SetInterpolation(§or[sprite[k].sectnum].ceilingz); - break; - case 17: - G_SetInterpolation(§or[sprite[k].sectnum].floorz); - G_SetInterpolation(§or[sprite[k].sectnum].ceilingz); - break; - case 0: - case 5: - case 6: - case 11: - case 14: - case 15: - case 16: - case 26: - case 30: - Sect_SetInterpolation(k); - break; - } - - k = nextspritestat[k]; - } - - for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i]; - for (i = g_animateCount-1; i>=0; i--) - G_SetInterpolation(animateptr[i]); - - Net_ResetPrediction(); - - G_ClearFIFO(); - G_ResetTimers(); - } -} diff --git a/polymer-perf/eduke32/source/gameexec.h b/polymer-perf/eduke32/source/gameexec.h deleted file mode 100644 index 6a8ff7718..000000000 --- a/polymer-perf/eduke32/source/gameexec.h +++ /dev/null @@ -1,139 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __gameexec_h__ -#define __gameexec_h__ - -// the order of these can't be changed or else compatibility with EDuke 2.0 mods will break -enum GameEvent_t { - EVENT_INIT, - EVENT_ENTERLEVEL, - EVENT_RESETWEAPONS, - EVENT_RESETINVENTORY, - EVENT_HOLSTER, - EVENT_LOOKLEFT, - EVENT_LOOKRIGHT, - EVENT_SOARUP, - EVENT_SOARDOWN, - EVENT_CROUCH, - EVENT_JUMP, - EVENT_RETURNTOCENTER, - EVENT_LOOKUP, - EVENT_LOOKDOWN, - EVENT_AIMUP, - EVENT_FIRE, - EVENT_CHANGEWEAPON, - EVENT_GETSHOTRANGE, - EVENT_GETAUTOAIMANGLE, - EVENT_GETLOADTILE, - EVENT_CHEATGETSTEROIDS, - EVENT_CHEATGETHEAT, - EVENT_CHEATGETBOOT, - EVENT_CHEATGETSHIELD, - EVENT_CHEATGETSCUBA, - EVENT_CHEATGETHOLODUKE, - EVENT_CHEATGETJETPACK, - EVENT_CHEATGETFIRSTAID, - EVENT_QUICKKICK, - EVENT_INVENTORY, - EVENT_USENIGHTVISION, - EVENT_USESTEROIDS, - EVENT_INVENTORYLEFT, - EVENT_INVENTORYRIGHT, - EVENT_HOLODUKEON, - EVENT_HOLODUKEOFF, - EVENT_USEMEDKIT, - EVENT_USEJETPACK, - EVENT_TURNAROUND, - EVENT_DISPLAYWEAPON, - EVENT_FIREWEAPON, - EVENT_SELECTWEAPON, - EVENT_MOVEFORWARD, - EVENT_MOVEBACKWARD, - EVENT_TURNLEFT, - EVENT_TURNRIGHT, - EVENT_STRAFELEFT, - EVENT_STRAFERIGHT, - EVENT_WEAPKEY1, - EVENT_WEAPKEY2, - EVENT_WEAPKEY3, - EVENT_WEAPKEY4, - EVENT_WEAPKEY5, - EVENT_WEAPKEY6, - EVENT_WEAPKEY7, - EVENT_WEAPKEY8, - EVENT_WEAPKEY9, - EVENT_WEAPKEY10, - EVENT_DRAWWEAPON, - EVENT_DISPLAYCROSSHAIR, - EVENT_DISPLAYREST, - EVENT_DISPLAYSBAR, - EVENT_RESETPLAYER, - EVENT_INCURDAMAGE, - EVENT_AIMDOWN, - EVENT_GAME, - EVENT_PREVIOUSWEAPON, - EVENT_NEXTWEAPON, - EVENT_SWIMUP, - EVENT_SWIMDOWN, - EVENT_GETMENUTILE, - EVENT_SPAWN, - EVENT_LOGO, - EVENT_EGS, - EVENT_DOFIRE, - EVENT_PRESSEDFIRE, - EVENT_USE, - EVENT_PROCESSINPUT, - EVENT_FAKEDOMOVETHINGS, - EVENT_DISPLAYROOMS, - EVENT_KILLIT, - EVENT_LOADACTOR, - EVENT_DISPLAYBONUSSCREEN, - EVENT_DISPLAYMENU, - EVENT_DISPLAYMENUREST, - EVENT_DISPLAYLOADINGSCREEN, - EVENT_ANIMATESPRITES, - EVENT_NEWGAME, - MAXEVENTS -}; - -extern int32_t g_errorLineNum; -extern int32_t g_tw; -extern int32_t ticrandomseed; -extern vmstate_t vm; - -void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist); -void A_Fall(int32_t iActor); -int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_t *day); -int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs); -void A_GetZLimits(int32_t iActor); -void A_LoadActor(int32_t iActor); -int32_t G_GetAngleDelta(int32_t a,int32_t na); -void G_RestoreMapState(mapstate_t *save); -void G_RestoreMapState(mapstate_t *save); -void G_SaveMapState(mapstate_t *save); -void G_SaveMapState(mapstate_t *save); -void Gv_RefreshPointers(void); -void VM_OnEvent(register int32_t iEventID,register int32_t iActor,register int32_t iPlayer,register int32_t lDist); -void VM_ScriptInfo(void); - -#endif diff --git a/polymer-perf/eduke32/source/gamestructures.c b/polymer-perf/eduke32/source/gamestructures.c deleted file mode 100644 index dc7aab420..000000000 --- a/polymer-perf/eduke32/source/gamestructures.c +++ /dev/null @@ -1,3822 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -/* -#include "duke3d.h" -#include "gamedef.h" -#include "osd.h" -*/ -// this is all the crap for accessing the game's structs through the CON VM -// I got a 3-4 fps gain by inlining these... - -#ifndef _gamevars_c_ -static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t lVar2) -{ - int32_t lValue=0; - - if (vm.g_p != myconnectindex) - { - // if (lVar2 == MAXGAMEVARS) - // insptr++; - insptr += (lVar2 == MAXGAMEVARS); - return; - } - - if (iSet) - lValue=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case USERDEFS_GOD: - if (iSet) - { - ud.god = lValue; - return; - } - Gv_SetVarX(lVar2, ud.god); - return; - - case USERDEFS_WARP_ON: - if (iSet) - { - ud.warp_on = lValue; - return; - } - Gv_SetVarX(lVar2, ud.warp_on); - return; - - case USERDEFS_CASHMAN: - if (iSet) - { - ud.cashman = lValue; - return; - } - Gv_SetVarX(lVar2, ud.cashman); - return; - - case USERDEFS_EOG: - if (iSet) - { - ud.eog = lValue; - return; - } - Gv_SetVarX(lVar2, ud.eog); - return; - - case USERDEFS_SHOWALLMAP: - if (iSet) - { - ud.showallmap = lValue; - return; - } - Gv_SetVarX(lVar2, ud.showallmap); - return; - - case USERDEFS_SHOW_HELP: - if (iSet) - { - ud.show_help = lValue; - return; - } - Gv_SetVarX(lVar2, ud.show_help); - return; - - case USERDEFS_SCROLLMODE: - if (iSet) - { - ud.scrollmode = lValue; - return; - } - Gv_SetVarX(lVar2, ud.scrollmode); - return; - - case USERDEFS_CLIPPING: - if (iSet) - { - ud.clipping = lValue; - return; - } - Gv_SetVarX(lVar2, ud.clipping); - return; - - // case USERDEFS_USER_NAME: - // if(iSet) - // { - // ud.user_name[MAXPLAYERS][32] = lValue; - // return; - // } - // Gv_SetVarX(lVar2, ud.user_name[MAXPLAYERS][32]); - // return; - - // case USERDEFS_RIDECULE: - // if(iSet) - // { - // ud.ridecule = lValue; - // return; - // } - // Gv_SetVarX(lVar2, ud.ridecule); - // return; - - // case USERDEFS_SAVEGAME: - // if(iSet) - // { - // ud.savegame = lValue; - // return; - // } - // Gv_SetVarX(lVar2, ud.savegame); - // return; - - // case USERDEFS_PWLOCKOUT: - // if(iSet) - // { - // ud.pwlockout = lValue; - // return; - // } - // Gv_SetVarX(lVar2, ud.pwlockout); - // return; - - // case USERDEFS_RTSNAME: - // if(iSet) - // { - // ud.rtsname = lValue; - // return; - // } - // Gv_SetVarX(lVar2, ud.rtsname); - // return; - - case USERDEFS_OVERHEAD_ON: - if (iSet) - { - ud.overhead_on = lValue; - return; - } - Gv_SetVarX(lVar2, ud.overhead_on); - return; - - case USERDEFS_LAST_OVERHEAD: - if (iSet) - { - ud.last_overhead = lValue; - return; - } - Gv_SetVarX(lVar2, ud.last_overhead); - return; - - case USERDEFS_SHOWWEAPONS: - if (iSet) - { - ud.showweapons = lValue; - return; - } - Gv_SetVarX(lVar2, ud.showweapons); - return; - - case USERDEFS_PAUSE_ON: - if (iSet) - { - ud.pause_on = lValue; - return; - } - Gv_SetVarX(lVar2, ud.pause_on); - return; - - case USERDEFS_FROM_BONUS: - if (iSet) - { - ud.from_bonus = lValue; - return; - } - Gv_SetVarX(lVar2, ud.from_bonus); - return; - - case USERDEFS_CAMERASPRITE: - if (iSet) - { - ud.camerasprite = lValue; - return; - } - Gv_SetVarX(lVar2, ud.camerasprite); - return; - - case USERDEFS_LAST_CAMSPRITE: - if (iSet) - { - ud.last_camsprite = lValue; - return; - } - Gv_SetVarX(lVar2, ud.last_camsprite); - return; - - case USERDEFS_LAST_LEVEL: - if (iSet) - { - ud.last_level = lValue; - return; - } - Gv_SetVarX(lVar2, ud.last_level); - return; - - case USERDEFS_SECRETLEVEL: - if (iSet) - { - ud.secretlevel = lValue; - return; - } - Gv_SetVarX(lVar2, ud.secretlevel); - return; - - case USERDEFS_CONST_VISIBILITY: - if (iSet) - { - ud.const_visibility = lValue; - return; - } - Gv_SetVarX(lVar2, ud.const_visibility); - return; - - case USERDEFS_UW_FRAMERATE: - if (iSet) - { - ud.uw_framerate = lValue; - return; - } - Gv_SetVarX(lVar2, ud.uw_framerate); - return; - - case USERDEFS_CAMERA_TIME: - if (iSet) - { - ud.camera_time = lValue; - return; - } - Gv_SetVarX(lVar2, ud.camera_time); - return; - - case USERDEFS_FOLFVEL: - if (iSet) - { - ud.folfvel = lValue; - return; - } - Gv_SetVarX(lVar2, ud.folfvel); - return; - - case USERDEFS_FOLAVEL: - if (iSet) - { - ud.folavel = lValue; - return; - } - Gv_SetVarX(lVar2, ud.folavel); - return; - - case USERDEFS_FOLX: - if (iSet) - { - ud.folx = lValue; - return; - } - Gv_SetVarX(lVar2, ud.folx); - return; - - case USERDEFS_FOLY: - if (iSet) - { - ud.foly = lValue; - return; - } - Gv_SetVarX(lVar2, ud.foly); - return; - - case USERDEFS_FOLA: - if (iSet) - { - ud.fola = lValue; - return; - } - Gv_SetVarX(lVar2, ud.fola); - return; - - case USERDEFS_RECCNT: - if (iSet) - { - ud.reccnt = lValue; - return; - } - Gv_SetVarX(lVar2, ud.reccnt); - return; - - case USERDEFS_ENTERED_NAME: - if (iSet) - { - ud.entered_name = lValue; - return; - } - Gv_SetVarX(lVar2, ud.entered_name); - return; - - case USERDEFS_SCREEN_TILTING: - if (iSet) - { - ud.screen_tilting = lValue; - return; - } - Gv_SetVarX(lVar2, ud.screen_tilting); - return; - - case USERDEFS_SHADOWS: - if (iSet) - { - ud.shadows = lValue; - return; - } - Gv_SetVarX(lVar2, ud.shadows); - return; - - case USERDEFS_FTA_ON: - if (iSet) - { - ud.fta_on = lValue; - return; - } - Gv_SetVarX(lVar2, ud.fta_on); - return; - - case USERDEFS_EXECUTIONS: - if (iSet) - { - ud.executions = lValue; - return; - } - Gv_SetVarX(lVar2, ud.executions); - return; - - case USERDEFS_AUTO_RUN: - if (iSet) - { - ud.auto_run = lValue; - return; - } - Gv_SetVarX(lVar2, ud.auto_run); - return; - - case USERDEFS_COORDS: - if (iSet) - { - ud.coords = lValue; - return; - } - Gv_SetVarX(lVar2, ud.coords); - return; - - case USERDEFS_TICKRATE: - if (iSet) - { - ud.tickrate = lValue; - return; - } - Gv_SetVarX(lVar2, ud.tickrate); - return; - - case USERDEFS_M_COOP: - if (iSet) - { - ud.m_coop = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_coop); - return; - - case USERDEFS_COOP: - if (iSet) - { - ud.coop = lValue; - return; - } - Gv_SetVarX(lVar2, ud.coop); - return; - - case USERDEFS_SCREEN_SIZE: - if (iSet) - { - if (ud.screen_size != lValue) - { - ud.screen_size = lValue; - G_UpdateScreenArea(); - } - return; - } - Gv_SetVarX(lVar2, ud.screen_size); - return; - - case USERDEFS_LOCKOUT: - if (iSet) - { - ud.lockout = lValue; - return; - } - Gv_SetVarX(lVar2, ud.lockout); - return; - - case USERDEFS_CROSSHAIR: - if (iSet) - { - ud.crosshair = lValue; - return; - } - Gv_SetVarX(lVar2, ud.crosshair); - return; - - // case USERDEFS_WCHOICE: - // if(iSet) - // { - // ud.wchoice = lValue; - // return; - // } - // Gv_SetVarX(lVar2, ud.wchoice); - // return; - - case USERDEFS_PLAYERAI: - if (iSet) - { - ud.playerai = lValue; - return; - } - Gv_SetVarX(lVar2, ud.playerai); - return; - - case USERDEFS_RESPAWN_MONSTERS: - if (iSet) - { - ud.respawn_monsters = lValue; - return; - } - Gv_SetVarX(lVar2, ud.respawn_monsters); - return; - - case USERDEFS_RESPAWN_ITEMS: - if (iSet) - { - ud.respawn_items = lValue; - return; - } - Gv_SetVarX(lVar2, ud.respawn_items); - return; - - case USERDEFS_RESPAWN_INVENTORY: - if (iSet) - { - ud.respawn_inventory = lValue; - return; - } - Gv_SetVarX(lVar2, ud.respawn_inventory); - return; - - case USERDEFS_RECSTAT: - if (iSet) - { - ud.recstat = lValue; - return; - } - Gv_SetVarX(lVar2, ud.recstat); - return; - - case USERDEFS_MONSTERS_OFF: - if (iSet) - { - ud.monsters_off = lValue; - return; - } - Gv_SetVarX(lVar2, ud.monsters_off); - return; - - case USERDEFS_BRIGHTNESS: - if (iSet) - { - ud.brightness = lValue; - return; - } - Gv_SetVarX(lVar2, ud.brightness); - return; - - case USERDEFS_M_RESPAWN_ITEMS: - if (iSet) - { - ud.m_respawn_items = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_respawn_items); - return; - - case USERDEFS_M_RESPAWN_MONSTERS: - if (iSet) - { - ud.m_respawn_monsters = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_respawn_monsters); - return; - - case USERDEFS_M_RESPAWN_INVENTORY: - if (iSet) - { - ud.m_respawn_inventory = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_respawn_inventory); - return; - - case USERDEFS_M_RECSTAT: - if (iSet) - { - ud.m_recstat = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_recstat); - return; - - case USERDEFS_M_MONSTERS_OFF: - if (iSet) - { - ud.m_monsters_off = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_monsters_off); - return; - - case USERDEFS_DETAIL: - if (iSet) - { - ud.detail = lValue; - return; - } - Gv_SetVarX(lVar2, ud.detail); - return; - - case USERDEFS_M_FFIRE: - if (iSet) - { - ud.m_ffire = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_ffire); - return; - - case USERDEFS_FFIRE: - if (iSet) - { - ud.ffire = lValue; - return; - } - Gv_SetVarX(lVar2, ud.ffire); - return; - - case USERDEFS_M_PLAYER_SKILL: - if (iSet) - { - ud.m_player_skill = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_player_skill); - return; - - case USERDEFS_M_LEVEL_NUMBER: - if (iSet) - { - ud.m_level_number = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_level_number); - return; - - case USERDEFS_M_VOLUME_NUMBER: - if (iSet) - { - ud.m_volume_number = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_volume_number); - return; - - case USERDEFS_MULTIMODE: - if (iSet) - { - ud.multimode = lValue; - return; - } - Gv_SetVarX(lVar2, ud.multimode); - return; - - case USERDEFS_PLAYER_SKILL: - if (iSet) - { - ud.player_skill = lValue; - return; - } - Gv_SetVarX(lVar2, ud.player_skill); - return; - - case USERDEFS_LEVEL_NUMBER: - if (iSet) - { - ud.level_number = lValue; - return; - } - Gv_SetVarX(lVar2, ud.level_number); - return; - - case USERDEFS_VOLUME_NUMBER: - if (iSet) - { - ud.volume_number = lValue; - return; - } - Gv_SetVarX(lVar2, ud.volume_number); - return; - - case USERDEFS_M_MARKER: - if (iSet) - { - ud.m_marker = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_marker); - return; - - case USERDEFS_MARKER: - if (iSet) - { - ud.marker = lValue; - return; - } - Gv_SetVarX(lVar2, ud.marker); - return; - - case USERDEFS_MOUSEFLIP: - if (iSet) - { - ud.mouseflip = lValue; - return; - } - Gv_SetVarX(lVar2, ud.mouseflip); - return; - - case USERDEFS_STATUSBARSCALE: - if (iSet) - { - ud.statusbarscale = lValue; - return; - } - Gv_SetVarX(lVar2, ud.statusbarscale); - return; - - case USERDEFS_DRAWWEAPON: - if (iSet) - { - ud.drawweapon = lValue; - return; - } - Gv_SetVarX(lVar2, ud.drawweapon); - return; - - case USERDEFS_MOUSEAIMING: - if (iSet) - { - ud.mouseaiming = lValue; - return; - } - Gv_SetVarX(lVar2, ud.mouseaiming); - return; - - case USERDEFS_WEAPONSWITCH: - if (iSet) - { - ud.weaponswitch = lValue; - return; - } - Gv_SetVarX(lVar2, ud.weaponswitch); - return; - - case USERDEFS_DEMOCAMS: - if (iSet) - { - ud.democams = lValue; - return; - } - Gv_SetVarX(lVar2, ud.democams); - return; - - case USERDEFS_COLOR: - if (iSet) - { - ud.color = lValue; - return; - } - Gv_SetVarX(lVar2, ud.color); - return; - - case USERDEFS_MSGDISPTIME: - if (iSet) - { - ud.msgdisptime = lValue; - return; - } - Gv_SetVarX(lVar2, ud.msgdisptime); - return; - - case USERDEFS_STATUSBARMODE: - if (iSet) - { - ud.statusbarmode = lValue; - return; - } - Gv_SetVarX(lVar2, ud.statusbarmode); - return; - - case USERDEFS_M_NOEXITS: - if (iSet) - { - ud.m_noexits = lValue; - return; - } - Gv_SetVarX(lVar2, ud.m_noexits); - return; - - case USERDEFS_NOEXITS: - if (iSet) - { - ud.noexits = lValue; - return; - } - Gv_SetVarX(lVar2, ud.noexits); - return; - - case USERDEFS_AUTOVOTE: - if (iSet) - { - ud.autovote = lValue; - return; - } - Gv_SetVarX(lVar2, ud.autovote); - return; - - case USERDEFS_AUTOMSG: - if (iSet) - { - ud.automsg = lValue; - return; - } - Gv_SetVarX(lVar2, ud.automsg); - return; - - case USERDEFS_IDPLAYERS: - if (iSet) - { - ud.idplayers = lValue; - return; - } - Gv_SetVarX(lVar2, ud.idplayers); - return; - - case USERDEFS_TEAM: - if (iSet) - { - ud.team = lValue; - return; - } - Gv_SetVarX(lVar2, ud.team); - return; - - case USERDEFS_VIEWBOB: - if (iSet) - { - ud.viewbob = lValue; - return; - } - Gv_SetVarX(lVar2, ud.viewbob); - return; - - case USERDEFS_WEAPONSWAY: - if (iSet) - { - ud.weaponsway = lValue; - return; - } - Gv_SetVarX(lVar2, ud.weaponsway); - return; - - case USERDEFS_ANGLEINTERPOLATION: - if (iSet) - { - ud.angleinterpolation = lValue; - return; - } - Gv_SetVarX(lVar2, ud.angleinterpolation); - return; - - case USERDEFS_OBITUARIES: - if (iSet) - { - ud.obituaries = lValue; - return; - } - Gv_SetVarX(lVar2, ud.obituaries); - return; - - case USERDEFS_LEVELSTATS: - if (iSet) - { - ud.levelstats = lValue; - return; - } - Gv_SetVarX(lVar2, ud.levelstats); - return; - - case USERDEFS_CROSSHAIRSCALE: - if (iSet) - { - ud.crosshairscale = lValue; - return; - } - Gv_SetVarX(lVar2, ud.crosshairscale); - return; - - case USERDEFS_ALTHUD: - if (iSet) - { - ud.althud = lValue; - return; - } - Gv_SetVarX(lVar2, ud.althud); - return; - - case USERDEFS_DISPLAY_BONUS_SCREEN: - if (iSet) - { - ud.display_bonus_screen = lValue; - return; - } - Gv_SetVarX(lVar2, ud.display_bonus_screen); - return; - - case USERDEFS_SHOW_LEVEL_TEXT: - if (iSet) - { - ud.show_level_text = lValue; - return; - } - Gv_SetVarX(lVar2, ud.show_level_text); - return; - - case USERDEFS_WEAPONSCALE: - if (iSet) - { - ud.weaponscale = lValue; - return; - } - Gv_SetVarX(lVar2, ud.weaponscale); - return; - - case USERDEFS_TEXTSCALE: - if (iSet) - { - ud.textscale = lValue; - return; - } - Gv_SetVarX(lVar2, ud.textscale); - return; - - default: - return; - } -} - -static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - int32_t lValue=0,proj=vm.g_i; - - if (lVar1 != g_iThisActorID) - proj=Gv_GetVarX(lVar1); - - if ((unsigned)proj >= MAXSPRITES) - { - // OSD_Printf("VM_AccessActiveProjectile(): invalid projectile (%d)\n",proj); - OSD_Printf(CON_ERROR "tried to %s %s on invalid target projectile (%d) %d %d from %s\n",g_errorLineNum,keyw[g_tw], - iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,vm.g_sp->picnum, - (lVar1= playerswhenstarted) /* && g_scriptSanityChecks */) - goto badplayer; - - if ((PlayerLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) - goto badpos; - - switch (lLabelID) - { - case PLAYER_ZOOM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->zoom); return; - case PLAYER_EXITX: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->exitx); return; - case PLAYER_EXITY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->exity); return; - case PLAYER_LOOGIEX: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->loogiex[lParm2]); return; - case PLAYER_LOOGIEY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->loogiey[lParm2]); return; - case PLAYER_NUMLOOGS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->numloogs); return; - case PLAYER_LOOGCNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->loogcnt); return; - case PLAYER_POSX: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pos.x); return; - case PLAYER_POSY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pos.y); return; - case PLAYER_POSZ: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pos.z); return; - case PLAYER_HORIZ: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->horiz); return; - case PLAYER_OHORIZ: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->ohoriz); return; - case PLAYER_OHORIZOFF: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->ohorizoff); return; - case PLAYER_INVDISPTIME: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->invdisptime); return; - case PLAYER_BOBPOSX: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->bobposx); return; - case PLAYER_BOBPOSY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->bobposy); return; - case PLAYER_OPOSX: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->opos.x); return; - case PLAYER_OPOSY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->opos.y); return; - case PLAYER_OPOSZ: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->opos.z); return; - case PLAYER_PYOFF: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pyoff); return; - case PLAYER_OPYOFF: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->opyoff); return; - case PLAYER_POSXV: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->vel.x); return; - case PLAYER_POSYV: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->vel.y); return; - case PLAYER_POSZV: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->vel.z); return; - case PLAYER_LAST_PISSED_TIME: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_pissed_time); return; - case PLAYER_TRUEFZ: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->truefz); return; - case PLAYER_TRUECZ: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->truecz); return; - case PLAYER_PLAYER_PAR: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->player_par); return; - case PLAYER_VISIBILITY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->visibility); return; - case PLAYER_BOBCOUNTER: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->bobcounter); return; - case PLAYER_WEAPON_SWAY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapon_sway); return; - case PLAYER_PALS_TIME: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.f); return; - case PLAYER_RANDOMFLAMEX: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->randomflamex); return; - case PLAYER_CRACK_TIME: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->crack_time); return; - case PLAYER_AIM_MODE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->aim_mode); return; - case PLAYER_ANG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->ang); return; - case PLAYER_OANG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->oang); return; - case PLAYER_ANGVEL: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->angvel); return; - case PLAYER_CURSECTNUM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->cursectnum); return; - case PLAYER_LOOK_ANG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->look_ang); return; - case PLAYER_LAST_EXTRA: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_extra); return; - case PLAYER_SUBWEAPON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->subweapon); return; - case PLAYER_AMMO_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->ammo_amount[lParm2]); return; - case PLAYER_WACKEDBYACTOR: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->wackedbyactor); return; - case PLAYER_FRAG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->frag); return; - case PLAYER_FRAGGEDSELF: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->fraggedself); return; - case PLAYER_CURR_WEAPON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->curr_weapon); return; - case PLAYER_LAST_WEAPON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_weapon); return; - case PLAYER_TIPINCS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->tipincs); return; - case PLAYER_HORIZOFF: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->horizoff); return; - case PLAYER_WANTWEAPONFIRE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->wantweaponfire); return; - case PLAYER_HOLODUKE_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_HOLODUKE]); return; - case PLAYER_NEWOWNER: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->newowner); return; - case PLAYER_HURT_DELAY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->hurt_delay); return; - case PLAYER_HBOMB_HOLD_DELAY: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->hbomb_hold_delay); return; - case PLAYER_JUMPING_COUNTER: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->jumping_counter); return; - case PLAYER_AIRLEFT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->airleft); return; - case PLAYER_KNEE_INCS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->knee_incs); return; - case PLAYER_ACCESS_INCS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->access_incs); return; - case PLAYER_FTA: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->fta); return; - case PLAYER_FTQ: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->ftq); return; - case PLAYER_ACCESS_WALLNUM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->access_wallnum); return; - case PLAYER_ACCESS_SPRITENUM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->access_spritenum); return; - case PLAYER_KICKBACK_PIC: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->kickback_pic); return; - case PLAYER_GOT_ACCESS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->got_access); return; - case PLAYER_WEAPON_ANG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapon_ang); return; - case PLAYER_FIRSTAID_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_FIRSTAID]); return; - case PLAYER_SOMETHINGONPLAYER: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->somethingonplayer); return; - case PLAYER_ON_CRANE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->on_crane); return; - case PLAYER_I: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->i); return; - case PLAYER_ONE_PARALLAX_SECTNUM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->one_parallax_sectnum); return; - case PLAYER_OVER_SHOULDER_ON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->over_shoulder_on); return; - case PLAYER_RANDOM_CLUB_FRAME: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->random_club_frame); return; - case PLAYER_FIST_INCS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->fist_incs); return; - case PLAYER_ONE_EIGHTY_COUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->one_eighty_count); return; - case PLAYER_CHEAT_PHASE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->cheat_phase); return; - case PLAYER_DUMMYPLAYERSPRITE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->dummyplayersprite); return; - case PLAYER_EXTRA_EXTRA8: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->extra_extra8); return; - case PLAYER_QUICK_KICK: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->quick_kick); return; - case PLAYER_HEAT_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_HEATS]); return; - case PLAYER_ACTORSQU: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->actorsqu); return; - case PLAYER_TIMEBEFOREEXIT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->timebeforeexit); return; - case PLAYER_CUSTOMEXITSOUND: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->customexitsound); return; - case PLAYER_WEAPRECS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->weaprecs[lParm2]); return; - case PLAYER_WEAPRECCNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapreccnt); return; - case PLAYER_INTERFACE_TOGGLE_FLAG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->interface_toggle_flag); return; - case PLAYER_ROTSCRNANG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->rotscrnang); return; - case PLAYER_DEAD_FLAG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->dead_flag); return; - case PLAYER_SHOW_EMPTY_WEAPON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->show_empty_weapon); return; - case PLAYER_SCUBA_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_SCUBA]); return; - case PLAYER_JETPACK_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_JETPACK]); return; - case PLAYER_STEROIDS_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_STEROIDS]); return; - case PLAYER_SHIELD_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_SHIELD]); return; - case PLAYER_HOLODUKE_ON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->holoduke_on); return; - case PLAYER_PYCOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pycount); return; - case PLAYER_WEAPON_POS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->weapon_pos); return; - case PLAYER_FRAG_PS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->frag_ps); return; - case PLAYER_TRANSPORTER_HOLD: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->transporter_hold); return; - case PLAYER_LAST_FULL_WEAPON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_full_weapon); return; - case PLAYER_FOOTPRINTSHADE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->footprintshade); return; - case PLAYER_BOOT_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inv_amount[GET_BOOTS]); return; - case PLAYER_SCREAM_VOICE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->scream_voice); return; - case PLAYER_GM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->gm); return; - case PLAYER_ON_WARPING_SECTOR: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->on_warping_sector); return; - case PLAYER_FOOTPRINTCOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->footprintcount); return; - case PLAYER_HBOMB_ON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->hbomb_on); return; - case PLAYER_JUMPING_TOGGLE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->jumping_toggle); return; - case PLAYER_RAPID_FIRE_HOLD: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->rapid_fire_hold); return; - case PLAYER_ON_GROUND: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->on_ground); return; - case PLAYER_INVEN_ICON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->inven_icon); return; - case PLAYER_BUTTONPALETTE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->buttonpalette); return; - case PLAYER_JETPACK_ON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->jetpack_on); return; - case PLAYER_SPRITEBRIDGE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->spritebridge); return; - case PLAYER_LASTRANDOMSPOT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->lastrandomspot); return; - case PLAYER_SCUBA_ON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->scuba_on); return; - case PLAYER_FOOTPRINTPAL: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->footprintpal); return; - case PLAYER_HEAT_ON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->heat_on); return; - case PLAYER_HOLSTER_WEAPON: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->holster_weapon); return; - case PLAYER_FALLING_COUNTER: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->falling_counter); return; - case PLAYER_GOTWEAPON: - Gv_SetVarX(lVar2, (g_player[iPlayer].ps->gotweapon & (1<refresh_inventory); return; - case PLAYER_TOGGLE_KEY_FLAG: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->toggle_key_flag); return; - case PLAYER_KNUCKLE_INCS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->knuckle_incs); return; - case PLAYER_WALKING_SND_TOGGLE: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->walking_snd_toggle); return; - case PLAYER_PALOOKUP: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->palookup); return; - case PLAYER_HARD_LANDING: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->hard_landing); return; - case PLAYER_MAX_SECRET_ROOMS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_secret_rooms); return; - case PLAYER_SECRET_ROOMS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->secret_rooms); return; - case PLAYER_PALS: - switch (lParm2) - { - case 0: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.r); return; - case 1: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.g); return; - case 2: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->pals.b); return; - } - return; - case PLAYER_MAX_ACTORS_KILLED: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_actors_killed); return; - case PLAYER_ACTORS_KILLED: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->actors_killed); return; - case PLAYER_RETURN_TO_CENTER: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->return_to_center); return; - case PLAYER_RUNSPEED: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->runspeed); return; - case PLAYER_SBS: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->sbs); return; - case PLAYER_RELOADING: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->reloading); return; - case PLAYER_AUTO_AIM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->auto_aim); return; - case PLAYER_MOVEMENT_LOCK: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->movement_lock); return; - case PLAYER_SOUND_PITCH: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->sound_pitch); return; - case PLAYER_WEAPONSWITCH: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->weaponswitch); return; - case PLAYER_TEAM: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->team); return; - case PLAYER_MAX_PLAYER_HEALTH: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_player_health); return; - case PLAYER_MAX_SHIELD_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_shield_amount); return; - case PLAYER_MAX_AMMO_AMOUNT: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->max_ammo_amount[lParm2]); return; - case PLAYER_LAST_QUICK_KICK: - Gv_SetVarX(lVar2, g_player[iPlayer].ps->last_quick_kick); - return; - - default: - return; - } - -badplayer: - // OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i); - OSD_Printf(CON_ERROR "tried to get %s on invalid target player (%d) from spr %d gv %s\n",g_errorLineNum,keyw[g_tw], - PlayerLabels[lLabelID].name,iPlayer,vm.g_i, - (lVar1= playerswhenstarted) /* && g_scriptSanityChecks */) - goto badplayer; - - if ((PlayerLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) - goto badpos; - - lVar1=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case PLAYER_ZOOM: - g_player[iPlayer].ps->zoom=lVar1; return; - case PLAYER_EXITX: - g_player[iPlayer].ps->exitx=lVar1; return; - case PLAYER_EXITY: - g_player[iPlayer].ps->exity=lVar1; return; - case PLAYER_LOOGIEX: - g_player[iPlayer].ps->loogiex[lParm2]=lVar1; return; - case PLAYER_LOOGIEY: - g_player[iPlayer].ps->loogiey[lParm2]=lVar1; return; - case PLAYER_NUMLOOGS: - g_player[iPlayer].ps->numloogs=lVar1; return; - case PLAYER_LOOGCNT: - g_player[iPlayer].ps->loogcnt=lVar1; return; - case PLAYER_POSX: - g_player[iPlayer].ps->pos.x=lVar1; return; - case PLAYER_POSY: - g_player[iPlayer].ps->pos.y=lVar1; return; - case PLAYER_POSZ: - g_player[iPlayer].ps->pos.z=lVar1; return; - case PLAYER_HORIZ: - g_player[iPlayer].ps->horiz=lVar1; return; - case PLAYER_OHORIZ: - g_player[iPlayer].ps->ohoriz=lVar1; return; - case PLAYER_OHORIZOFF: - g_player[iPlayer].ps->ohorizoff=lVar1; return; - case PLAYER_INVDISPTIME: - g_player[iPlayer].ps->invdisptime=lVar1; return; - case PLAYER_BOBPOSX: - g_player[iPlayer].ps->bobposx=lVar1; return; - case PLAYER_BOBPOSY: - g_player[iPlayer].ps->bobposy=lVar1; return; - case PLAYER_OPOSX: - g_player[iPlayer].ps->opos.x=lVar1; return; - case PLAYER_OPOSY: - g_player[iPlayer].ps->opos.y=lVar1; return; - case PLAYER_OPOSZ: - g_player[iPlayer].ps->opos.z=lVar1; return; - case PLAYER_PYOFF: - g_player[iPlayer].ps->pyoff=lVar1; return; - case PLAYER_OPYOFF: - g_player[iPlayer].ps->opyoff=lVar1; return; - case PLAYER_POSXV: - g_player[iPlayer].ps->vel.x=lVar1; return; - case PLAYER_POSYV: - g_player[iPlayer].ps->vel.y=lVar1; return; - case PLAYER_POSZV: - g_player[iPlayer].ps->vel.z=lVar1; return; - case PLAYER_LAST_PISSED_TIME: - g_player[iPlayer].ps->last_pissed_time=lVar1; return; - case PLAYER_TRUEFZ: - g_player[iPlayer].ps->truefz=lVar1; return; - case PLAYER_TRUECZ: - g_player[iPlayer].ps->truecz=lVar1; return; - case PLAYER_PLAYER_PAR: - g_player[iPlayer].ps->player_par=lVar1; return; - case PLAYER_VISIBILITY: - g_player[iPlayer].ps->visibility=lVar1; return; - case PLAYER_BOBCOUNTER: - g_player[iPlayer].ps->bobcounter=lVar1; return; - case PLAYER_WEAPON_SWAY: - g_player[iPlayer].ps->weapon_sway=lVar1; return; - case PLAYER_PALS_TIME: - g_player[iPlayer].ps->pals.f=lVar1; return; - case PLAYER_RANDOMFLAMEX: - g_player[iPlayer].ps->randomflamex=lVar1; return; - case PLAYER_CRACK_TIME: - g_player[iPlayer].ps->crack_time=lVar1; return; - case PLAYER_AIM_MODE: - g_player[iPlayer].ps->aim_mode=lVar1; return; - case PLAYER_ANG: - g_player[iPlayer].ps->ang=lVar1; return; - case PLAYER_OANG: - g_player[iPlayer].ps->oang=lVar1; return; - case PLAYER_ANGVEL: - g_player[iPlayer].ps->angvel=lVar1; return; - case PLAYER_CURSECTNUM: - g_player[iPlayer].ps->cursectnum=lVar1; return; - case PLAYER_LOOK_ANG: - g_player[iPlayer].ps->look_ang=lVar1; return; - case PLAYER_LAST_EXTRA: - g_player[iPlayer].ps->last_extra=lVar1; return; - case PLAYER_SUBWEAPON: - g_player[iPlayer].ps->subweapon=lVar1; return; - case PLAYER_AMMO_AMOUNT: - g_player[iPlayer].ps->ammo_amount[lParm2]=lVar1; return; - case PLAYER_WACKEDBYACTOR: - g_player[iPlayer].ps->wackedbyactor=lVar1; return; - case PLAYER_FRAG: - g_player[iPlayer].ps->frag=lVar1; return; - case PLAYER_FRAGGEDSELF: - g_player[iPlayer].ps->fraggedself=lVar1; return; - case PLAYER_CURR_WEAPON: - g_player[iPlayer].ps->curr_weapon=lVar1; return; - case PLAYER_LAST_WEAPON: - g_player[iPlayer].ps->last_weapon=lVar1; return; - case PLAYER_TIPINCS: - g_player[iPlayer].ps->tipincs=lVar1; return; - case PLAYER_HORIZOFF: - g_player[iPlayer].ps->horizoff=lVar1; return; - case PLAYER_WANTWEAPONFIRE: - g_player[iPlayer].ps->wantweaponfire=lVar1; return; - case PLAYER_HOLODUKE_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_HOLODUKE]=lVar1; return; - case PLAYER_NEWOWNER: - g_player[iPlayer].ps->newowner=lVar1; return; - case PLAYER_HURT_DELAY: - g_player[iPlayer].ps->hurt_delay=lVar1; return; - case PLAYER_HBOMB_HOLD_DELAY: - g_player[iPlayer].ps->hbomb_hold_delay=lVar1; return; - case PLAYER_JUMPING_COUNTER: - g_player[iPlayer].ps->jumping_counter=lVar1; return; - case PLAYER_AIRLEFT: - g_player[iPlayer].ps->airleft=lVar1; return; - case PLAYER_KNEE_INCS: - g_player[iPlayer].ps->knee_incs=lVar1; return; - case PLAYER_ACCESS_INCS: - g_player[iPlayer].ps->access_incs=lVar1; return; - case PLAYER_FTA: - g_player[iPlayer].ps->fta=lVar1; return; - case PLAYER_FTQ: - g_player[iPlayer].ps->ftq=lVar1; return; - case PLAYER_ACCESS_WALLNUM: - g_player[iPlayer].ps->access_wallnum=lVar1; return; - case PLAYER_ACCESS_SPRITENUM: - g_player[iPlayer].ps->access_spritenum=lVar1; return; - case PLAYER_KICKBACK_PIC: - g_player[iPlayer].ps->kickback_pic=lVar1; return; - case PLAYER_GOT_ACCESS: - g_player[iPlayer].ps->got_access=lVar1; return; - case PLAYER_WEAPON_ANG: - g_player[iPlayer].ps->weapon_ang=lVar1; return; - case PLAYER_FIRSTAID_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_FIRSTAID]=lVar1; return; - case PLAYER_SOMETHINGONPLAYER: - g_player[iPlayer].ps->somethingonplayer=lVar1; return; - case PLAYER_ON_CRANE: - g_player[iPlayer].ps->on_crane=lVar1; return; - case PLAYER_I: - g_player[iPlayer].ps->i=lVar1; return; - case PLAYER_ONE_PARALLAX_SECTNUM: - g_player[iPlayer].ps->one_parallax_sectnum=lVar1; return; - case PLAYER_OVER_SHOULDER_ON: - g_player[iPlayer].ps->over_shoulder_on=lVar1; return; - case PLAYER_RANDOM_CLUB_FRAME: - g_player[iPlayer].ps->random_club_frame=lVar1; return; - case PLAYER_FIST_INCS: - g_player[iPlayer].ps->fist_incs=lVar1; return; - case PLAYER_ONE_EIGHTY_COUNT: - g_player[iPlayer].ps->one_eighty_count=lVar1; return; - case PLAYER_CHEAT_PHASE: - g_player[iPlayer].ps->cheat_phase=lVar1; return; - case PLAYER_DUMMYPLAYERSPRITE: - g_player[iPlayer].ps->dummyplayersprite=lVar1; return; - case PLAYER_EXTRA_EXTRA8: - g_player[iPlayer].ps->extra_extra8=lVar1; return; - case PLAYER_QUICK_KICK: - g_player[iPlayer].ps->quick_kick=lVar1; return; - case PLAYER_HEAT_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_HEATS]=lVar1; return; - case PLAYER_ACTORSQU: - g_player[iPlayer].ps->actorsqu=lVar1; return; - case PLAYER_TIMEBEFOREEXIT: - g_player[iPlayer].ps->timebeforeexit=lVar1; return; - case PLAYER_CUSTOMEXITSOUND: - g_player[iPlayer].ps->customexitsound=lVar1; return; - case PLAYER_WEAPRECS: - g_player[iPlayer].ps->weaprecs[lParm2]=lVar1; return; - case PLAYER_WEAPRECCNT: - g_player[iPlayer].ps->weapreccnt=lVar1; return; - case PLAYER_INTERFACE_TOGGLE_FLAG: - g_player[iPlayer].ps->interface_toggle_flag=lVar1; return; - case PLAYER_ROTSCRNANG: - g_player[iPlayer].ps->rotscrnang=lVar1; return; - case PLAYER_DEAD_FLAG: - g_player[iPlayer].ps->dead_flag=lVar1; return; - case PLAYER_SHOW_EMPTY_WEAPON: - g_player[iPlayer].ps->show_empty_weapon=lVar1; return; - case PLAYER_SCUBA_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_SCUBA]=lVar1; return; - case PLAYER_JETPACK_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_JETPACK]=lVar1; return; - case PLAYER_STEROIDS_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_STEROIDS]=lVar1; return; - case PLAYER_SHIELD_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_SHIELD]=lVar1; return; - case PLAYER_HOLODUKE_ON: - g_player[iPlayer].ps->holoduke_on=lVar1; return; - case PLAYER_PYCOUNT: - g_player[iPlayer].ps->pycount=lVar1; return; - case PLAYER_WEAPON_POS: - g_player[iPlayer].ps->weapon_pos=lVar1; return; - case PLAYER_FRAG_PS: - g_player[iPlayer].ps->frag_ps=lVar1; return; - case PLAYER_TRANSPORTER_HOLD: - g_player[iPlayer].ps->transporter_hold=lVar1; return; - case PLAYER_LAST_FULL_WEAPON: - g_player[iPlayer].ps->last_full_weapon=lVar1; return; - case PLAYER_FOOTPRINTSHADE: - g_player[iPlayer].ps->footprintshade=lVar1; return; - case PLAYER_BOOT_AMOUNT: - g_player[iPlayer].ps->inv_amount[GET_BOOTS]=lVar1; return; - case PLAYER_SCREAM_VOICE: - g_player[iPlayer].ps->scream_voice=lVar1; return; - case PLAYER_GM: - g_player[iPlayer].ps->gm=lVar1; return; - case PLAYER_ON_WARPING_SECTOR: - g_player[iPlayer].ps->on_warping_sector=lVar1; return; - case PLAYER_FOOTPRINTCOUNT: - g_player[iPlayer].ps->footprintcount=lVar1; return; - case PLAYER_HBOMB_ON: - g_player[iPlayer].ps->hbomb_on=lVar1; return; - case PLAYER_JUMPING_TOGGLE: - g_player[iPlayer].ps->jumping_toggle=lVar1; return; - case PLAYER_RAPID_FIRE_HOLD: - g_player[iPlayer].ps->rapid_fire_hold=lVar1; return; - case PLAYER_ON_GROUND: - g_player[iPlayer].ps->on_ground=lVar1; return; - case PLAYER_INVEN_ICON: - g_player[iPlayer].ps->inven_icon=lVar1; return; - case PLAYER_BUTTONPALETTE: - g_player[iPlayer].ps->buttonpalette=lVar1; return; - case PLAYER_JETPACK_ON: - g_player[iPlayer].ps->jetpack_on=lVar1; return; - case PLAYER_SPRITEBRIDGE: - g_player[iPlayer].ps->spritebridge=lVar1; return; - case PLAYER_LASTRANDOMSPOT: - g_player[iPlayer].ps->lastrandomspot=lVar1; return; - case PLAYER_SCUBA_ON: - g_player[iPlayer].ps->scuba_on=lVar1; return; - case PLAYER_FOOTPRINTPAL: - g_player[iPlayer].ps->footprintpal=lVar1; return; - case PLAYER_HEAT_ON: - if (g_player[iPlayer].ps->heat_on != lVar1) - { - g_player[iPlayer].ps->heat_on=lVar1; - P_UpdateScreenPal(g_player[iPlayer].ps); - } return; - case PLAYER_HOLSTER_WEAPON: - g_player[iPlayer].ps->holster_weapon=lVar1; return; - case PLAYER_FALLING_COUNTER: - g_player[iPlayer].ps->falling_counter=lVar1; return; - case PLAYER_GOTWEAPON: - if (lVar1) - { - g_player[iPlayer].ps->gotweapon |= (1<gotweapon &= ~(1<refresh_inventory=lVar1; return; - case PLAYER_TOGGLE_KEY_FLAG: - g_player[iPlayer].ps->toggle_key_flag=lVar1; return; - case PLAYER_KNUCKLE_INCS: - g_player[iPlayer].ps->knuckle_incs=lVar1; return; - case PLAYER_WALKING_SND_TOGGLE: - g_player[iPlayer].ps->walking_snd_toggle=lVar1; return; - case PLAYER_PALOOKUP: - g_player[iPlayer].ps->palookup=lVar1; return; - case PLAYER_HARD_LANDING: - g_player[iPlayer].ps->hard_landing=lVar1; return; - case PLAYER_MAX_SECRET_ROOMS: - g_player[iPlayer].ps->max_secret_rooms=lVar1; return; - case PLAYER_SECRET_ROOMS: - g_player[iPlayer].ps->secret_rooms=lVar1; return; - case PLAYER_PALS: - switch (lParm2) - { - case 0: - g_player[iPlayer].ps->pals.r = lVar1; return; - case 1: - g_player[iPlayer].ps->pals.g = lVar1; return; - case 2: - g_player[iPlayer].ps->pals.b = lVar1; return; - } - return; - case PLAYER_MAX_ACTORS_KILLED: - g_player[iPlayer].ps->max_actors_killed=lVar1; return; - case PLAYER_ACTORS_KILLED: - g_player[iPlayer].ps->actors_killed=lVar1; return; - case PLAYER_RETURN_TO_CENTER: - g_player[iPlayer].ps->return_to_center=lVar1; return; - case PLAYER_RUNSPEED: - g_player[iPlayer].ps->runspeed=lVar1; return; - case PLAYER_SBS: - g_player[iPlayer].ps->sbs=lVar1; return; - case PLAYER_RELOADING: - g_player[iPlayer].ps->reloading=lVar1; return; - case PLAYER_AUTO_AIM: - g_player[iPlayer].ps->auto_aim=lVar1; return; - case PLAYER_MOVEMENT_LOCK: - g_player[iPlayer].ps->movement_lock=lVar1; return; - case PLAYER_SOUND_PITCH: - g_player[iPlayer].ps->sound_pitch=lVar1; return; - case PLAYER_WEAPONSWITCH: - g_player[iPlayer].ps->weaponswitch=lVar1; return; - case PLAYER_TEAM: - g_player[iPlayer].ps->team=lVar1; return; - case PLAYER_MAX_PLAYER_HEALTH: - g_player[iPlayer].ps->max_player_health = lVar1; return; - case PLAYER_MAX_SHIELD_AMOUNT: - g_player[iPlayer].ps->max_shield_amount = lVar1; return; - case PLAYER_MAX_AMMO_AMOUNT: - g_player[iPlayer].ps->max_ammo_amount[lParm2]=lVar1; return; - case PLAYER_LAST_QUICK_KICK: - g_player[iPlayer].ps->last_quick_kick=lVar1; - return; - - default: - return; - } - -badplayer: - // OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i); - OSD_Printf(CON_ERROR "tried to set %s on invalid target player (%d) from spr %d gv %s\n",g_errorLineNum,keyw[g_tw], - PlayerLabels[lLabelID].name,iPlayer,vm.g_i, - (lVar1= playerswhenstarted) /* && g_scriptSanityChecks */) - goto badplayer; - - if (iSet) - lValue=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case INPUT_AVEL: - if (iSet) - { - g_player[iPlayer].sync->avel=lValue; - return; - } - Gv_SetVarX(lVar2, g_player[iPlayer].sync->avel); - return; - - case INPUT_HORZ: - if (iSet) - { - g_player[iPlayer].sync->horz=lValue; - return; - } - Gv_SetVarX(lVar2, g_player[iPlayer].sync->horz); - return; - - case INPUT_FVEL: - if (iSet) - { - g_player[iPlayer].sync->fvel=lValue; - return; - } - Gv_SetVarX(lVar2, g_player[iPlayer].sync->fvel); - return; - - case INPUT_SVEL: - if (iSet) - { - g_player[iPlayer].sync->svel=lValue; - return; - } - Gv_SetVarX(lVar2, g_player[iPlayer].sync->svel); - return; - - case INPUT_BITS: - if (iSet) - { - g_player[iPlayer].sync->bits=lValue; - return; - } - Gv_SetVarX(lVar2, g_player[iPlayer].sync->bits); - return; - - case INPUT_EXTBITS: - if (iSet) - { - g_player[iPlayer].sync->extbits=lValue; - return; - } - Gv_SetVarX(lVar2, g_player[iPlayer].sync->extbits); - return; - default: - return; - } - -badplayer: - insptr += (lVar2 == MAXGAMEVARS); - OSD_Printf(CON_ERROR "invalid target player (%d) %d\n",g_errorLineNum,keyw[g_tw],iPlayer,vm.g_i); - return; -} - -static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - int32_t lValue=0; - int32_t iWall = Gv_GetVarX(lVar1); - - if ((iWall<0 || iWall >= numwalls) /* && g_scriptSanityChecks */) - goto badwall; - - if (iSet) - lValue=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case WALL_X: - if (iSet) - { - wall[iWall].x=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].x); - return; - - case WALL_Y: - if (iSet) - { - wall[iWall].y=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].y); - return; - - case WALL_POINT2: - if (iSet) - { - wall[iWall].point2=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].point2); - return; - - case WALL_NEXTWALL: - if (iSet) - { - wall[iWall].nextwall=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].nextwall); - return; - - case WALL_NEXTSECTOR: - if (iSet) - { - wall[iWall].nextsector=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].nextsector); - return; - - case WALL_CSTAT: - if (iSet) - { - wall[iWall].cstat=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].cstat); - return; - - case WALL_PICNUM: - if (iSet) - { - wall[iWall].picnum=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].picnum); - return; - - case WALL_OVERPICNUM: - if (iSet) - { - wall[iWall].overpicnum=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].overpicnum); - return; - - case WALL_SHADE: - if (iSet) - { - wall[iWall].shade=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].shade); - return; - - case WALL_PAL: - if (iSet) - { - wall[iWall].pal=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].pal); - return; - - case WALL_XREPEAT: - if (iSet) - { - wall[iWall].xrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].xrepeat); - return; - - case WALL_YREPEAT: - if (iSet) - { - wall[iWall].yrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].yrepeat); - return; - - case WALL_XPANNING: - if (iSet) - { - wall[iWall].xpanning=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].xpanning); - return; - - case WALL_YPANNING: - if (iSet) - { - wall[iWall].ypanning=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].ypanning); - return; - - case WALL_LOTAG: - if (iSet) - { - wall[iWall].lotag=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].lotag); - return; - - case WALL_HITAG: - if (iSet) - { - wall[iWall].hitag=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].hitag); - return; - - case WALL_EXTRA: - if (iSet) - { - wall[iWall].extra=lValue; - return; - } - Gv_SetVarX(lVar2, wall[iWall].extra); - return; - default: - return; - } - -badwall: - insptr += (lVar2 == MAXGAMEVARS); - OSD_Printf(CON_ERROR "Invalid wall %d\n",g_errorLineNum,keyw[g_tw],iWall); - return; -} - -static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - int32_t lValue=0; - int32_t iSector=sprite[vm.g_i].sectnum; - - if (lVar1 != g_iThisActorID) - iSector=Gv_GetVarX(lVar1); - - if ((iSector<0 || iSector >= numsectors) /* && g_scriptSanityChecks */) - goto badsector; - - if (iSet) - lValue=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case SECTOR_WALLPTR: - if (iSet) - { - sector[iSector].wallptr=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].wallptr); - return; - - case SECTOR_WALLNUM: - if (iSet) - { - sector[iSector].wallnum=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].wallnum); - return; - - case SECTOR_CEILINGZ: - if (iSet) - { - sector[iSector].ceilingz=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingz); - return; - - case SECTOR_FLOORZ: - if (iSet) - { - sector[iSector].floorz=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorz); - return; - - case SECTOR_CEILINGSTAT: - if (iSet) - { - sector[iSector].ceilingstat=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingstat); - return; - - case SECTOR_FLOORSTAT: - if (iSet) - { - sector[iSector].floorstat=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorstat); - return; - - case SECTOR_CEILINGPICNUM: - if (iSet) - { - sector[iSector].ceilingpicnum=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingpicnum); - return; - - case SECTOR_CEILINGSLOPE: - if (iSet) - { - sector[iSector].ceilingheinum=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingheinum); - return; - - case SECTOR_CEILINGSHADE: - if (iSet) - { - sector[iSector].ceilingshade=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingshade); - return; - - case SECTOR_CEILINGPAL: - if (iSet) - { - sector[iSector].ceilingpal=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingpal); - return; - - case SECTOR_CEILINGXPANNING: - if (iSet) - { - sector[iSector].ceilingxpanning=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingxpanning); - return; - - case SECTOR_CEILINGYPANNING: - if (iSet) - { - sector[iSector].ceilingypanning=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].ceilingypanning); - return; - - case SECTOR_FLOORPICNUM: - if (iSet) - { - sector[iSector].floorpicnum=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorpicnum); - return; - - case SECTOR_FLOORSLOPE: - if (iSet) - { - sector[iSector].floorheinum=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorheinum); - return; - - case SECTOR_FLOORSHADE: - if (iSet) - { - sector[iSector].floorshade=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorshade); - return; - - case SECTOR_FLOORPAL: - if (iSet) - { - sector[iSector].floorpal=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorpal); - return; - - case SECTOR_FLOORXPANNING: - if (iSet) - { - sector[iSector].floorxpanning=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorxpanning); - return; - - case SECTOR_FLOORYPANNING: - if (iSet) - { - sector[iSector].floorypanning=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].floorypanning); - return; - - case SECTOR_VISIBILITY: - if (iSet) - { - sector[iSector].visibility=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].visibility); - return; - - case SECTOR_ALIGNTO: - if (iSet) - { - sector[iSector].filler=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].filler); - return; - - case SECTOR_LOTAG: - if (iSet) - { - sector[iSector].lotag=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].lotag); - return; - - case SECTOR_HITAG: - if (iSet) - { - sector[iSector].hitag=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].hitag); - return; - - case SECTOR_EXTRA: - if (iSet) - { - sector[iSector].extra=lValue; - return; - } - Gv_SetVarX(lVar2, sector[iSector].extra); - return; - - default: - return; - } - -badsector: - OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],iSector); - insptr += (lVar2 == MAXGAMEVARS); - return; -} - -static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2) -{ - register int32_t iActor=vm.g_i; - - if (lVar1 != g_iThisActorID) - iActor=Gv_GetVarX(lVar1); - - if ((unsigned)iActor >= MAXSPRITES) - goto badactor; - - if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) - goto badpos; - - lVar1=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case ACTOR_X: - sprite[iActor].x=lVar1; - return; - - case ACTOR_Y: - sprite[iActor].y=lVar1; - return; - - case ACTOR_Z: - sprite[iActor].z=lVar1; - return; - - case ACTOR_CSTAT: - sprite[iActor].cstat=lVar1; - return; - - case ACTOR_PICNUM: - sprite[iActor].picnum=lVar1; - return; - - case ACTOR_SHADE: - sprite[iActor].shade=lVar1; - return; - - case ACTOR_PAL: - sprite[iActor].pal=lVar1; - return; - - case ACTOR_CLIPDIST: - sprite[iActor].clipdist=lVar1; - return; - - case ACTOR_DETAIL: - sprite[iActor].filler=lVar1; - return; - - case ACTOR_XREPEAT: - sprite[iActor].xrepeat=lVar1; - return; - - case ACTOR_YREPEAT: - sprite[iActor].yrepeat=lVar1; - return; - - case ACTOR_XOFFSET: - sprite[iActor].xoffset=lVar1; - return; - - case ACTOR_YOFFSET: - sprite[iActor].yoffset=lVar1; - return; - - case ACTOR_SECTNUM: - changespritesect(iActor,lVar1); - return; - - case ACTOR_STATNUM: - changespritestat(iActor,lVar1); - return; - - case ACTOR_ANG: - sprite[iActor].ang=lVar1; - return; - - case ACTOR_OWNER: - sprite[iActor].owner=lVar1; - return; - - case ACTOR_XVEL: - sprite[iActor].xvel=lVar1; - return; - - case ACTOR_YVEL: - sprite[iActor].yvel=lVar1; - return; - - case ACTOR_ZVEL: - sprite[iActor].zvel=lVar1; - return; - - case ACTOR_LOTAG: - sprite[iActor].lotag=lVar1; - return; - - case ACTOR_HITAG: - sprite[iActor].hitag=lVar1; - return; - - case ACTOR_EXTRA: - sprite[iActor].extra=lVar1; - return; - - case ACTOR_HTCGG: - actor[iActor].cgg=lVar1; - return; - - case ACTOR_HTPICNUM : - actor[iActor].picnum=lVar1; - return; - - case ACTOR_HTANG: - actor[iActor].ang=lVar1; - return; - - case ACTOR_HTEXTRA: - actor[iActor].extra=lVar1; - return; - - case ACTOR_HTOWNER: - actor[iActor].owner=lVar1; - return; - - case ACTOR_HTMOVFLAG: - actor[iActor].movflag=lVar1; - return; - - case ACTOR_HTTEMPANG: - actor[iActor].tempang=lVar1; - return; - - case ACTOR_HTACTORSTAYPUT: - actor[iActor].actorstayput=lVar1; - return; - - case ACTOR_HTDISPICNUM: - actor[iActor].dispicnum=lVar1; - return; - - case ACTOR_HTTIMETOSLEEP: - actor[iActor].timetosleep=lVar1; - return; - - case ACTOR_HTFLOORZ: - actor[iActor].floorz=lVar1; - return; - - case ACTOR_HTCEILINGZ: - actor[iActor].ceilingz=lVar1; - return; - - case ACTOR_HTLASTVX: - actor[iActor].lastvx=lVar1; - return; - - case ACTOR_HTLASTVY: - actor[iActor].lastvy=lVar1; - return; - - case ACTOR_HTBPOSX: - actor[iActor].bposx=lVar1; - return; - - case ACTOR_HTBPOSY: - actor[iActor].bposy=lVar1; - return; - - case ACTOR_HTBPOSZ: - actor[iActor].bposz=lVar1; - return; - - case ACTOR_HTG_T: - actor[iActor].t_data[lParm2]=lVar1; - return; - - case ACTOR_ANGOFF: - spriteext[iActor].angoff=lVar1; - return; - - case ACTOR_PITCH: - spriteext[iActor].pitch=lVar1; - return; - - case ACTOR_ROLL: - spriteext[iActor].roll=lVar1; - return; - - case ACTOR_MDXOFF: - spriteext[iActor].xoff=lVar1; - return; - - case ACTOR_MDYOFF: - spriteext[iActor].yoff=lVar1; - return; - - case ACTOR_MDZOFF: - spriteext[iActor].zoff=lVar1; - return; - - case ACTOR_MDFLAGS: - spriteext[iActor].flags=lVar1; - return; - - case ACTOR_XPANNING: - spriteext[iActor].xpanning=lVar1; - return; - - case ACTOR_YPANNING: - spriteext[iActor].ypanning=lVar1; - return; - - case ACTOR_HTFLAGS: - actor[iActor].flags=lVar1; - return; - - case ACTOR_ALPHA: - spriteext[iActor].alpha=(float)(lVar1/255.0f); - return; - - default: - return; - } - -badactor: - OSD_Printf(CON_ERROR "tried to set %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",g_errorLineNum,keyw[g_tw], - ActorLabels[lLabelID].name,iActor,vm.g_i,vm.g_sp->picnum, - (lVar1= MAXSPRITES) - goto badactor; - - if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) - goto badpos; - - switch (lLabelID) - { - case ACTOR_X: - Gv_SetVarX(lVar2, sprite[iActor].x); - return; - - case ACTOR_Y: - Gv_SetVarX(lVar2, sprite[iActor].y); - return; - - case ACTOR_Z: - Gv_SetVarX(lVar2, sprite[iActor].z); - return; - - case ACTOR_CSTAT: - Gv_SetVarX(lVar2, sprite[iActor].cstat); - return; - - case ACTOR_PICNUM: - Gv_SetVarX(lVar2, sprite[iActor].picnum); - return; - - case ACTOR_SHADE: - Gv_SetVarX(lVar2, sprite[iActor].shade); - return; - - case ACTOR_PAL: - Gv_SetVarX(lVar2, sprite[iActor].pal); - return; - - case ACTOR_CLIPDIST: - Gv_SetVarX(lVar2, sprite[iActor].clipdist); - return; - - case ACTOR_DETAIL: - Gv_SetVarX(lVar2, sprite[iActor].filler); - return; - - case ACTOR_XREPEAT: - Gv_SetVarX(lVar2, sprite[iActor].xrepeat); - return; - - case ACTOR_YREPEAT: - Gv_SetVarX(lVar2, sprite[iActor].yrepeat); - return; - - case ACTOR_XOFFSET: - Gv_SetVarX(lVar2, sprite[iActor].xoffset); - return; - - case ACTOR_YOFFSET: - Gv_SetVarX(lVar2, sprite[iActor].yoffset); - return; - - case ACTOR_SECTNUM: - Gv_SetVarX(lVar2, sprite[iActor].sectnum); - return; - - case ACTOR_STATNUM: - Gv_SetVarX(lVar2, sprite[iActor].statnum); - return; - - case ACTOR_ANG: - Gv_SetVarX(lVar2, sprite[iActor].ang); - return; - - case ACTOR_OWNER: - Gv_SetVarX(lVar2, sprite[iActor].owner); - return; - - case ACTOR_XVEL: - Gv_SetVarX(lVar2, sprite[iActor].xvel); - return; - - case ACTOR_YVEL: - Gv_SetVarX(lVar2, sprite[iActor].yvel); - return; - - case ACTOR_ZVEL: - Gv_SetVarX(lVar2, sprite[iActor].zvel); - return; - - case ACTOR_LOTAG: - Gv_SetVarX(lVar2, sprite[iActor].lotag); - return; - - case ACTOR_HITAG: - Gv_SetVarX(lVar2, sprite[iActor].hitag); - return; - - case ACTOR_EXTRA: - Gv_SetVarX(lVar2, sprite[iActor].extra); - return; - - case ACTOR_HTCGG: - Gv_SetVarX(lVar2, actor[iActor].cgg); - return; - - case ACTOR_HTPICNUM : - Gv_SetVarX(lVar2, actor[iActor].picnum); - return; - - case ACTOR_HTANG: - Gv_SetVarX(lVar2, actor[iActor].ang); - return; - - case ACTOR_HTEXTRA: - Gv_SetVarX(lVar2,actor[iActor].extra); - return; - - case ACTOR_HTOWNER: - Gv_SetVarX(lVar2,actor[iActor].owner); - return; - - case ACTOR_HTMOVFLAG: - Gv_SetVarX(lVar2,actor[iActor].movflag); - return; - - case ACTOR_HTTEMPANG: - Gv_SetVarX(lVar2,actor[iActor].tempang); - return; - - case ACTOR_HTACTORSTAYPUT: - Gv_SetVarX(lVar2,actor[iActor].actorstayput); - return; - - case ACTOR_HTDISPICNUM: - Gv_SetVarX(lVar2,actor[iActor].dispicnum); - return; - - case ACTOR_HTTIMETOSLEEP: - Gv_SetVarX(lVar2,actor[iActor].timetosleep); - return; - - case ACTOR_HTFLOORZ: - Gv_SetVarX(lVar2,actor[iActor].floorz); - return; - - case ACTOR_HTCEILINGZ: - Gv_SetVarX(lVar2,actor[iActor].ceilingz); - return; - - case ACTOR_HTLASTVX: - Gv_SetVarX(lVar2,actor[iActor].lastvx); - return; - - case ACTOR_HTLASTVY: - Gv_SetVarX(lVar2,actor[iActor].lastvy); - return; - - case ACTOR_HTBPOSX: - Gv_SetVarX(lVar2,actor[iActor].bposx); - return; - - case ACTOR_HTBPOSY: - Gv_SetVarX(lVar2,actor[iActor].bposy); - return; - - case ACTOR_HTBPOSZ: - Gv_SetVarX(lVar2,actor[iActor].bposz); - return; - - case ACTOR_HTG_T: - Gv_SetVarX(lVar2, actor[iActor].t_data[lParm2]); - return; - - case ACTOR_ANGOFF: - Gv_SetVarX(lVar2,spriteext[iActor].angoff); - return; - - case ACTOR_PITCH: - Gv_SetVarX(lVar2,spriteext[iActor].pitch); - return; - - case ACTOR_ROLL: - Gv_SetVarX(lVar2,spriteext[iActor].roll); - return; - - case ACTOR_MDXOFF: - Gv_SetVarX(lVar2,spriteext[iActor].xoff); - return; - - case ACTOR_MDYOFF: - Gv_SetVarX(lVar2,spriteext[iActor].yoff); - return; - - case ACTOR_MDZOFF: - Gv_SetVarX(lVar2,spriteext[iActor].zoff); - return; - - case ACTOR_MDFLAGS: - Gv_SetVarX(lVar2,spriteext[iActor].flags); - return; - - case ACTOR_XPANNING: - Gv_SetVarX(lVar2, spriteext[iActor].xpanning); - return; - - case ACTOR_YPANNING: - Gv_SetVarX(lVar2, spriteext[iActor].ypanning); - return; - - case ACTOR_HTFLAGS: - Gv_SetVarX(lVar2,actor[iActor].flags); - return; - - case ACTOR_ALPHA: - Gv_SetVarX(lVar2, (uint8_t)(spriteext[iActor].alpha * 255.0f)); - return; - - default: - return; - } - -badactor: - OSD_Printf(CON_ERROR "tried to get %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",g_errorLineNum,keyw[g_tw], - ActorLabels[lLabelID].name,iActor,vm.g_i,vm.g_sp->picnum, - (lVar1= MAXSPRITES) - goto badsprite; - - if (iSet) - lValue=Gv_GetVarX(lVar2); - - if ((!spriteext[iActor].tspr) && g_scriptSanityChecks) - goto badtspr; - - switch (lLabelID) - { - case ACTOR_X: - if (iSet) - { - spriteext[iActor].tspr->x=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->x); - return; - - case ACTOR_Y: - if (iSet) - { - spriteext[iActor].tspr->y=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->y); - return; - - case ACTOR_Z: - if (iSet) - { - spriteext[iActor].tspr->z=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->z); - return; - - case ACTOR_CSTAT: - if (iSet) - { - spriteext[iActor].tspr->cstat=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->cstat); - return; - - case ACTOR_PICNUM: - if (iSet) - { - spriteext[iActor].tspr->picnum=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->picnum); - return; - - case ACTOR_SHADE: - if (iSet) - { - spriteext[iActor].tspr->shade=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->shade); - return; - - case ACTOR_PAL: - if (iSet) - { - spriteext[iActor].tspr->pal=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->pal); - return; - - case ACTOR_CLIPDIST: - if (iSet) - { - spriteext[iActor].tspr->clipdist=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->clipdist); - return; - - case ACTOR_DETAIL: - if (iSet) - { - spriteext[iActor].tspr->filler=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->filler); - return; - - case ACTOR_XREPEAT: - if (iSet) - { - spriteext[iActor].tspr->xrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->xrepeat); - return; - - case ACTOR_YREPEAT: - if (iSet) - { - spriteext[iActor].tspr->yrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->yrepeat); - return; - - case ACTOR_XOFFSET: - if (iSet) - { - spriteext[iActor].tspr->xoffset=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->xoffset); - return; - - case ACTOR_YOFFSET: - if (iSet) - { - spriteext[iActor].tspr->yoffset=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->yoffset); - return; - - case ACTOR_SECTNUM: - if (iSet) - { - spriteext[iActor].tspr->sectnum=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->sectnum); - return; - - case ACTOR_STATNUM: - if (iSet) - { - spriteext[iActor].tspr->statnum=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->statnum); - return; - - case ACTOR_ANG: - if (iSet) - { - spriteext[iActor].tspr->ang=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->ang); - return; - - case ACTOR_OWNER: - if (iSet) - { - spriteext[iActor].tspr->owner=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->owner); - return; - -#if 1 - case ACTOR_XVEL: - if (iSet) - { - spriteext[iActor].tspr->xvel=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->xvel); - return; - - case ACTOR_YVEL: - if (iSet) - { - spriteext[iActor].tspr->yvel=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->yvel); - return; - - case ACTOR_ZVEL: - if (iSet) - { - spriteext[iActor].tspr->zvel=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->zvel); - return; - - case ACTOR_LOTAG: - if (iSet) - { - spriteext[iActor].tspr->lotag=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->lotag); - return; - - case ACTOR_HITAG: - if (iSet) - { - spriteext[iActor].tspr->hitag=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->hitag); - return; - - case ACTOR_EXTRA: - if (iSet) - { - spriteext[iActor].tspr->extra=lValue; - return; - } - Gv_SetVarX(lVar2, spriteext[iActor].tspr->extra); - return; -#endif - - default: - return; - } - -badsprite: - OSD_Printf(CON_ERROR "invalid target sprite (%d) %d %d\n",g_errorLineNum,keyw[g_tw],iActor,vm.g_i,vm.g_sp->picnum); - insptr += (lVar2 == MAXGAMEVARS); - return; - -badtspr: - OSD_Printf(CON_ERROR "Internal bug, tsprite is unavailable\n",g_errorLineNum,keyw[g_tw]); - return; -} - -static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - int32_t lValue=0; - - if ((lVar1 < 0 || lVar1 >= MAXTILES) /* && g_scriptSanityChecks */) - goto badtile; - - if (iSet) - lValue=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case PROJ_WORKSLIKE: - if (iSet) - { - ProjectileData[lVar1].workslike=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].workslike); - return; - - case PROJ_SPAWNS: - if (iSet) - { - ProjectileData[lVar1].spawns=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].spawns); - return; - - case PROJ_SXREPEAT: - if (iSet) - { - ProjectileData[lVar1].sxrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].sxrepeat); - return; - - case PROJ_SYREPEAT: - if (iSet) - { - ProjectileData[lVar1].syrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].syrepeat); - return; - - case PROJ_SOUND: - if (iSet) - { - ProjectileData[lVar1].sound=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].sound); - return; - - case PROJ_ISOUND: - if (iSet) - { - ProjectileData[lVar1].isound=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].isound); - return; - - case PROJ_VEL: - if (iSet) - { - ProjectileData[lVar1].vel=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].vel); - return; - - case PROJ_EXTRA: - if (iSet) - { - ProjectileData[lVar1].extra=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].extra); - return; - - case PROJ_DECAL: - if (iSet) - { - ProjectileData[lVar1].decal=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].decal); - return; - - case PROJ_TRAIL: - if (iSet) - { - ProjectileData[lVar1].trail=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].trail); - return; - - case PROJ_TXREPEAT: - if (iSet) - { - ProjectileData[lVar1].txrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].txrepeat); - return; - - case PROJ_TYREPEAT: - if (iSet) - { - ProjectileData[lVar1].tyrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].tyrepeat); - return; - - case PROJ_TOFFSET: - if (iSet) - { - ProjectileData[lVar1].toffset=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].toffset); - return; - - case PROJ_TNUM: - if (iSet) - { - ProjectileData[lVar1].tnum=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].tnum); - return; - - case PROJ_DROP: - if (iSet) - { - ProjectileData[lVar1].drop=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].drop); - return; - - case PROJ_CSTAT: - if (iSet) - { - ProjectileData[lVar1].cstat=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].cstat); - return; - - case PROJ_CLIPDIST: - if (iSet) - { - ProjectileData[lVar1].clipdist=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].clipdist); - return; - - case PROJ_SHADE: - if (iSet) - { - ProjectileData[lVar1].shade=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].shade); - return; - - case PROJ_XREPEAT: - if (iSet) - { - ProjectileData[lVar1].xrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].xrepeat); - return; - - case PROJ_YREPEAT: - if (iSet) - { - ProjectileData[lVar1].yrepeat=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].yrepeat); - return; - - case PROJ_PAL: - if (iSet) - { - ProjectileData[lVar1].pal=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].pal); - return; - - case PROJ_EXTRA_RAND: - if (iSet) - { - ProjectileData[lVar1].extra_rand=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].extra_rand); - return; - - case PROJ_HITRADIUS: - if (iSet) - { - ProjectileData[lVar1].hitradius=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].hitradius); - return; - - case PROJ_VEL_MULT: - if (iSet) - { - ProjectileData[lVar1].velmult=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].velmult); - return; - - case PROJ_OFFSET: - if (iSet) - { - ProjectileData[lVar1].offset=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].offset); - return; - - case PROJ_BOUNCES: - if (iSet) - { - ProjectileData[lVar1].bounces=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].bounces); - return; - - case PROJ_BSOUND: - if (iSet) - { - ProjectileData[lVar1].bsound=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].bsound); - return; - - case PROJ_RANGE: - if (iSet) - { - ProjectileData[lVar1].range=lValue; - return; - } - Gv_SetVarX(lVar2, ProjectileData[lVar1].range); - return; - - default: - return; - } - -badtile: - OSD_Printf(CON_ERROR "invalid tile (%d)\n",g_errorLineNum,keyw[g_tw],lVar1); - insptr += (lVar2 == MAXGAMEVARS); - return; -} -#else -static int32_t __fastcall VM_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2) -{ - if ((ActorLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) - goto badpos; - - switch (lLabelID) - { - case ACTOR_X: return sprite[iActor].x; - case ACTOR_Y: return sprite[iActor].y; - case ACTOR_Z: return sprite[iActor].z; - case ACTOR_CSTAT: return sprite[iActor].cstat; - case ACTOR_PICNUM: return sprite[iActor].picnum; - case ACTOR_SHADE: return sprite[iActor].shade; - case ACTOR_PAL: return sprite[iActor].pal; - case ACTOR_CLIPDIST: return sprite[iActor].clipdist; - case ACTOR_DETAIL: return sprite[iActor].filler; - case ACTOR_XREPEAT: return sprite[iActor].xrepeat; - case ACTOR_YREPEAT: return sprite[iActor].yrepeat; - case ACTOR_XOFFSET: return sprite[iActor].xoffset; - case ACTOR_YOFFSET: return sprite[iActor].yoffset; - case ACTOR_SECTNUM: return sprite[iActor].sectnum; - case ACTOR_STATNUM: return sprite[iActor].statnum; - case ACTOR_ANG: return sprite[iActor].ang; - case ACTOR_OWNER: return sprite[iActor].owner; - case ACTOR_XVEL: return sprite[iActor].xvel; - case ACTOR_YVEL: return sprite[iActor].yvel; - case ACTOR_ZVEL: return sprite[iActor].zvel; - case ACTOR_LOTAG: return sprite[iActor].lotag; - case ACTOR_HITAG: return sprite[iActor].hitag; - case ACTOR_EXTRA: return sprite[iActor].extra; - case ACTOR_HTCGG: return actor[iActor].cgg; - case ACTOR_HTPICNUM : return actor[iActor].picnum; - case ACTOR_HTANG: return actor[iActor].ang; - case ACTOR_HTEXTRA: return actor[iActor].extra; - case ACTOR_HTOWNER: return actor[iActor].owner; - case ACTOR_HTMOVFLAG: return actor[iActor].movflag; - case ACTOR_HTTEMPANG: return actor[iActor].tempang; - case ACTOR_HTACTORSTAYPUT: return actor[iActor].actorstayput; - case ACTOR_HTDISPICNUM: return actor[iActor].dispicnum; - case ACTOR_HTTIMETOSLEEP: return actor[iActor].timetosleep; - case ACTOR_HTFLOORZ: return actor[iActor].floorz; - case ACTOR_HTCEILINGZ: return actor[iActor].ceilingz; - case ACTOR_HTLASTVX: return actor[iActor].lastvx; - case ACTOR_HTLASTVY: return actor[iActor].lastvy; - case ACTOR_HTBPOSX: return actor[iActor].bposx; - case ACTOR_HTBPOSY: return actor[iActor].bposy; - case ACTOR_HTBPOSZ: return actor[iActor].bposz; - case ACTOR_HTG_T: return actor[iActor].t_data[lParm2]; - case ACTOR_ANGOFF: return spriteext[iActor].angoff; - case ACTOR_PITCH: return spriteext[iActor].pitch; - case ACTOR_ROLL: return spriteext[iActor].roll; - case ACTOR_MDXOFF: return spriteext[iActor].xoff; - case ACTOR_MDYOFF: return spriteext[iActor].yoff; - case ACTOR_MDZOFF: return spriteext[iActor].zoff; - case ACTOR_MDFLAGS: return spriteext[iActor].flags; - case ACTOR_XPANNING: return spriteext[iActor].xpanning; - case ACTOR_YPANNING: return spriteext[iActor].ypanning; - case ACTOR_HTFLAGS: return actor[iActor].flags; - case ACTOR_ALPHA: return (uint8_t)(spriteext[iActor].alpha*255.0f); - default: return -1; - } - -badpos: - OSD_Printf(CON_ERROR "tried to get invalid %s position %d on sprite (%d) from spr %d\n", - g_errorLineNum,keyw[g_tw],ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); - return -1; -} - -static int32_t __fastcall VM_AccessSectorX(int32_t iSector, int32_t lLabelID) -{ - switch (lLabelID) - { - case SECTOR_WALLPTR: return sector[iSector].wallptr; - case SECTOR_WALLNUM: return sector[iSector].wallnum; - case SECTOR_CEILINGZ: return sector[iSector].ceilingz; - case SECTOR_FLOORZ: return sector[iSector].floorz; - case SECTOR_CEILINGSTAT: return sector[iSector].ceilingstat; - case SECTOR_FLOORSTAT: return sector[iSector].floorstat; - case SECTOR_CEILINGPICNUM: return sector[iSector].ceilingpicnum; - case SECTOR_CEILINGSLOPE: return sector[iSector].ceilingheinum; - case SECTOR_CEILINGSHADE: return sector[iSector].ceilingshade; - case SECTOR_CEILINGPAL: return sector[iSector].ceilingpal; - case SECTOR_CEILINGXPANNING: return sector[iSector].ceilingxpanning; - case SECTOR_CEILINGYPANNING: return sector[iSector].ceilingypanning; - case SECTOR_FLOORPICNUM: return sector[iSector].floorpicnum; - case SECTOR_FLOORSLOPE: return sector[iSector].floorheinum; - case SECTOR_FLOORSHADE: return sector[iSector].floorshade; - case SECTOR_FLOORPAL: return sector[iSector].floorpal; - case SECTOR_FLOORXPANNING: return sector[iSector].floorxpanning; - case SECTOR_FLOORYPANNING: return sector[iSector].floorypanning; - case SECTOR_VISIBILITY: return sector[iSector].visibility; - case SECTOR_ALIGNTO: return sector[iSector].filler; - case SECTOR_LOTAG: return sector[iSector].lotag; - case SECTOR_HITAG: return sector[iSector].hitag; - case SECTOR_EXTRA: return sector[iSector].extra; - default: return -1; - } -} - -static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2) -{ - if ((PlayerLabels[lLabelID].flags &LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) /* && g_scriptSanityChecks */) - goto badpos; - - switch (lLabelID) - { - case PLAYER_ZOOM: - return g_player[iPlayer].ps->zoom; - case PLAYER_EXITX: - return g_player[iPlayer].ps->exitx; - case PLAYER_EXITY: - return g_player[iPlayer].ps->exity; - case PLAYER_LOOGIEX: - return g_player[iPlayer].ps->loogiex[lParm2]; - case PLAYER_LOOGIEY: - return g_player[iPlayer].ps->loogiey[lParm2]; - case PLAYER_NUMLOOGS: - return g_player[iPlayer].ps->numloogs; - case PLAYER_LOOGCNT: - return g_player[iPlayer].ps->loogcnt; - case PLAYER_POSX: - return g_player[iPlayer].ps->pos.x; - case PLAYER_POSY: - return g_player[iPlayer].ps->pos.y; - case PLAYER_POSZ: - return g_player[iPlayer].ps->pos.z; - case PLAYER_HORIZ: - return g_player[iPlayer].ps->horiz; - case PLAYER_OHORIZ: - return g_player[iPlayer].ps->ohoriz; - case PLAYER_OHORIZOFF: - return g_player[iPlayer].ps->ohorizoff; - case PLAYER_INVDISPTIME: - return g_player[iPlayer].ps->invdisptime; - case PLAYER_BOBPOSX: - return g_player[iPlayer].ps->bobposx; - case PLAYER_BOBPOSY: - return g_player[iPlayer].ps->bobposy; - case PLAYER_OPOSX: - return g_player[iPlayer].ps->opos.x; - case PLAYER_OPOSY: - return g_player[iPlayer].ps->opos.y; - case PLAYER_OPOSZ: - return g_player[iPlayer].ps->opos.z; - case PLAYER_PYOFF: - return g_player[iPlayer].ps->pyoff; - case PLAYER_OPYOFF: - return g_player[iPlayer].ps->opyoff; - case PLAYER_POSXV: - return g_player[iPlayer].ps->vel.x; - case PLAYER_POSYV: - return g_player[iPlayer].ps->vel.y; - case PLAYER_POSZV: - return g_player[iPlayer].ps->vel.z; - case PLAYER_LAST_PISSED_TIME: - return g_player[iPlayer].ps->last_pissed_time; - case PLAYER_TRUEFZ: - return g_player[iPlayer].ps->truefz; - case PLAYER_TRUECZ: - return g_player[iPlayer].ps->truecz; - case PLAYER_PLAYER_PAR: - return g_player[iPlayer].ps->player_par; - case PLAYER_VISIBILITY: - return g_player[iPlayer].ps->visibility; - case PLAYER_BOBCOUNTER: - return g_player[iPlayer].ps->bobcounter; - case PLAYER_WEAPON_SWAY: - return g_player[iPlayer].ps->weapon_sway; - case PLAYER_PALS_TIME: - return g_player[iPlayer].ps->pals.f; - case PLAYER_RANDOMFLAMEX: - return g_player[iPlayer].ps->randomflamex; - case PLAYER_CRACK_TIME: - return g_player[iPlayer].ps->crack_time; - case PLAYER_AIM_MODE: - return g_player[iPlayer].ps->aim_mode; - case PLAYER_ANG: - return g_player[iPlayer].ps->ang; - case PLAYER_OANG: - return g_player[iPlayer].ps->oang; - case PLAYER_ANGVEL: - return g_player[iPlayer].ps->angvel; - case PLAYER_CURSECTNUM: - return g_player[iPlayer].ps->cursectnum; - case PLAYER_LOOK_ANG: - return g_player[iPlayer].ps->look_ang; - case PLAYER_LAST_EXTRA: - return g_player[iPlayer].ps->last_extra; - case PLAYER_SUBWEAPON: - return g_player[iPlayer].ps->subweapon; - case PLAYER_AMMO_AMOUNT: - return g_player[iPlayer].ps->ammo_amount[lParm2]; - case PLAYER_WACKEDBYACTOR: - return g_player[iPlayer].ps->wackedbyactor; - case PLAYER_FRAG: - return g_player[iPlayer].ps->frag; - case PLAYER_FRAGGEDSELF: - return g_player[iPlayer].ps->fraggedself; - case PLAYER_CURR_WEAPON: - return g_player[iPlayer].ps->curr_weapon; - case PLAYER_LAST_WEAPON: - return g_player[iPlayer].ps->last_weapon; - case PLAYER_TIPINCS: - return g_player[iPlayer].ps->tipincs; - case PLAYER_HORIZOFF: - return g_player[iPlayer].ps->horizoff; - case PLAYER_WANTWEAPONFIRE: - return g_player[iPlayer].ps->wantweaponfire; - case PLAYER_HOLODUKE_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_HOLODUKE]; - case PLAYER_NEWOWNER: - return g_player[iPlayer].ps->newowner; - case PLAYER_HURT_DELAY: - return g_player[iPlayer].ps->hurt_delay; - case PLAYER_HBOMB_HOLD_DELAY: - return g_player[iPlayer].ps->hbomb_hold_delay; - case PLAYER_JUMPING_COUNTER: - return g_player[iPlayer].ps->jumping_counter; - case PLAYER_AIRLEFT: - return g_player[iPlayer].ps->airleft; - case PLAYER_KNEE_INCS: - return g_player[iPlayer].ps->knee_incs; - case PLAYER_ACCESS_INCS: - return g_player[iPlayer].ps->access_incs; - case PLAYER_FTA: - return g_player[iPlayer].ps->fta; - case PLAYER_FTQ: - return g_player[iPlayer].ps->ftq; - case PLAYER_ACCESS_WALLNUM: - return g_player[iPlayer].ps->access_wallnum; - case PLAYER_ACCESS_SPRITENUM: - return g_player[iPlayer].ps->access_spritenum; - case PLAYER_KICKBACK_PIC: - return g_player[iPlayer].ps->kickback_pic; - case PLAYER_GOT_ACCESS: - return g_player[iPlayer].ps->got_access; - case PLAYER_WEAPON_ANG: - return g_player[iPlayer].ps->weapon_ang; - case PLAYER_FIRSTAID_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_FIRSTAID]; - case PLAYER_SOMETHINGONPLAYER: - return g_player[iPlayer].ps->somethingonplayer; - case PLAYER_ON_CRANE: - return g_player[iPlayer].ps->on_crane; - case PLAYER_I: - return g_player[iPlayer].ps->i; - case PLAYER_ONE_PARALLAX_SECTNUM: - return g_player[iPlayer].ps->one_parallax_sectnum; - case PLAYER_OVER_SHOULDER_ON: - return g_player[iPlayer].ps->over_shoulder_on; - case PLAYER_RANDOM_CLUB_FRAME: - return g_player[iPlayer].ps->random_club_frame; - case PLAYER_FIST_INCS: - return g_player[iPlayer].ps->fist_incs; - case PLAYER_ONE_EIGHTY_COUNT: - return g_player[iPlayer].ps->one_eighty_count; - case PLAYER_CHEAT_PHASE: - return g_player[iPlayer].ps->cheat_phase; - case PLAYER_DUMMYPLAYERSPRITE: - return g_player[iPlayer].ps->dummyplayersprite; - case PLAYER_EXTRA_EXTRA8: - return g_player[iPlayer].ps->extra_extra8; - case PLAYER_QUICK_KICK: - return g_player[iPlayer].ps->quick_kick; - case PLAYER_HEAT_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_HEATS]; - case PLAYER_ACTORSQU: - return g_player[iPlayer].ps->actorsqu; - case PLAYER_TIMEBEFOREEXIT: - return g_player[iPlayer].ps->timebeforeexit; - case PLAYER_CUSTOMEXITSOUND: - return g_player[iPlayer].ps->customexitsound; - case PLAYER_WEAPRECS: - return g_player[iPlayer].ps->weaprecs[lParm2]; - case PLAYER_WEAPRECCNT: - return g_player[iPlayer].ps->weapreccnt; - case PLAYER_INTERFACE_TOGGLE_FLAG: - return g_player[iPlayer].ps->interface_toggle_flag; - case PLAYER_ROTSCRNANG: - return g_player[iPlayer].ps->rotscrnang; - case PLAYER_DEAD_FLAG: - return g_player[iPlayer].ps->dead_flag; - case PLAYER_SHOW_EMPTY_WEAPON: - return g_player[iPlayer].ps->show_empty_weapon; - case PLAYER_SCUBA_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_SCUBA]; - case PLAYER_JETPACK_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_JETPACK]; - case PLAYER_STEROIDS_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_STEROIDS]; - case PLAYER_SHIELD_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_SHIELD]; - case PLAYER_HOLODUKE_ON: - return g_player[iPlayer].ps->holoduke_on; - case PLAYER_PYCOUNT: - return g_player[iPlayer].ps->pycount; - case PLAYER_WEAPON_POS: - return g_player[iPlayer].ps->weapon_pos; - case PLAYER_FRAG_PS: - return g_player[iPlayer].ps->frag_ps; - case PLAYER_TRANSPORTER_HOLD: - return g_player[iPlayer].ps->transporter_hold; - case PLAYER_LAST_FULL_WEAPON: - return g_player[iPlayer].ps->last_full_weapon; - case PLAYER_FOOTPRINTSHADE: - return g_player[iPlayer].ps->footprintshade; - case PLAYER_BOOT_AMOUNT: - return g_player[iPlayer].ps->inv_amount[GET_BOOTS]; - case PLAYER_SCREAM_VOICE: - return g_player[iPlayer].ps->scream_voice; - case PLAYER_GM: - return g_player[iPlayer].ps->gm; - case PLAYER_ON_WARPING_SECTOR: - return g_player[iPlayer].ps->on_warping_sector; - case PLAYER_FOOTPRINTCOUNT: - return g_player[iPlayer].ps->footprintcount; - case PLAYER_HBOMB_ON: - return g_player[iPlayer].ps->hbomb_on; - case PLAYER_JUMPING_TOGGLE: - return g_player[iPlayer].ps->jumping_toggle; - case PLAYER_RAPID_FIRE_HOLD: - return g_player[iPlayer].ps->rapid_fire_hold; - case PLAYER_ON_GROUND: - return g_player[iPlayer].ps->on_ground; - case PLAYER_INVEN_ICON: - return g_player[iPlayer].ps->inven_icon; - case PLAYER_BUTTONPALETTE: - return g_player[iPlayer].ps->buttonpalette; - case PLAYER_JETPACK_ON: - return g_player[iPlayer].ps->jetpack_on; - case PLAYER_SPRITEBRIDGE: - return g_player[iPlayer].ps->spritebridge; - case PLAYER_LASTRANDOMSPOT: - return g_player[iPlayer].ps->lastrandomspot; - case PLAYER_SCUBA_ON: - return g_player[iPlayer].ps->scuba_on; - case PLAYER_FOOTPRINTPAL: - return g_player[iPlayer].ps->footprintpal; - case PLAYER_HEAT_ON: - return g_player[iPlayer].ps->heat_on; - case PLAYER_HOLSTER_WEAPON: - return g_player[iPlayer].ps->holster_weapon; - case PLAYER_FALLING_COUNTER: - return g_player[iPlayer].ps->falling_counter; - case PLAYER_GOTWEAPON: - return (g_player[iPlayer].ps->gotweapon & (1<refresh_inventory; - case PLAYER_TOGGLE_KEY_FLAG: - return g_player[iPlayer].ps->toggle_key_flag; - case PLAYER_KNUCKLE_INCS: - return g_player[iPlayer].ps->knuckle_incs; - case PLAYER_WALKING_SND_TOGGLE: - return g_player[iPlayer].ps->walking_snd_toggle; - case PLAYER_PALOOKUP: - return g_player[iPlayer].ps->palookup; - case PLAYER_HARD_LANDING: - return g_player[iPlayer].ps->hard_landing; - case PLAYER_MAX_SECRET_ROOMS: - return g_player[iPlayer].ps->max_secret_rooms; - case PLAYER_SECRET_ROOMS: - return g_player[iPlayer].ps->secret_rooms; - case PLAYER_PALS: - switch (lParm2) - { - case 0: - return g_player[iPlayer].ps->pals.r; - case 1: - return g_player[iPlayer].ps->pals.g; - case 2: - return g_player[iPlayer].ps->pals.b; - } - return -1; - case PLAYER_MAX_ACTORS_KILLED: - return g_player[iPlayer].ps->max_actors_killed; - case PLAYER_ACTORS_KILLED: - return g_player[iPlayer].ps->actors_killed; - case PLAYER_RETURN_TO_CENTER: - return g_player[iPlayer].ps->return_to_center; - case PLAYER_RUNSPEED: - return g_player[iPlayer].ps->runspeed; - case PLAYER_SBS: - return g_player[iPlayer].ps->sbs; - case PLAYER_RELOADING: - return g_player[iPlayer].ps->reloading; - case PLAYER_AUTO_AIM: - return g_player[iPlayer].ps->auto_aim; - case PLAYER_MOVEMENT_LOCK: - return g_player[iPlayer].ps->movement_lock; - case PLAYER_SOUND_PITCH: - return g_player[iPlayer].ps->sound_pitch; - case PLAYER_WEAPONSWITCH: - return g_player[iPlayer].ps->weaponswitch; - case PLAYER_TEAM: - return g_player[iPlayer].ps->team; - case PLAYER_MAX_PLAYER_HEALTH: - return g_player[iPlayer].ps->max_player_health; - case PLAYER_MAX_SHIELD_AMOUNT: - return g_player[iPlayer].ps->max_shield_amount; - case PLAYER_MAX_AMMO_AMOUNT: - return g_player[iPlayer].ps->max_ammo_amount[lParm2]; - case PLAYER_LAST_QUICK_KICK: - return g_player[iPlayer].ps->last_quick_kick; - default: - return -1; - } - -badpos: - OSD_Printf(CON_ERROR "tried to get invalid %s position %d on player (%d) from spr %d\n", - g_errorLineNum,keyw[g_tw],PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); - return -1; -} - -static int32_t __fastcall VM_AccessWallX(int32_t iWall, int32_t lLabelID) -{ - switch (lLabelID) - { - case WALL_X: - return wall[iWall].x; - case WALL_Y: - return wall[iWall].y; - case WALL_POINT2: - return wall[iWall].point2; - case WALL_NEXTWALL: - return wall[iWall].nextwall; - case WALL_NEXTSECTOR: - return wall[iWall].nextsector; - case WALL_CSTAT: - return wall[iWall].cstat; - case WALL_PICNUM: - return wall[iWall].picnum; - case WALL_OVERPICNUM: - return wall[iWall].overpicnum; - case WALL_SHADE: - return wall[iWall].shade; - case WALL_PAL: - return wall[iWall].pal; - case WALL_XREPEAT: - return wall[iWall].xrepeat; - case WALL_YREPEAT: - return wall[iWall].yrepeat; - case WALL_XPANNING: - return wall[iWall].xpanning; - case WALL_YPANNING: - return wall[iWall].ypanning; - case WALL_LOTAG: - return wall[iWall].lotag; - case WALL_HITAG: - return wall[iWall].hitag; - case WALL_EXTRA: - return wall[iWall].extra; - default: - return -1; - } -} -#endif // _gamevars_c_ diff --git a/polymer-perf/eduke32/source/gamevars.c b/polymer-perf/eduke32/source/gamevars.c deleted file mode 100644 index e87f0639b..000000000 --- a/polymer-perf/eduke32/source/gamevars.c +++ /dev/null @@ -1,1689 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "duke3d.h" -#include "gamevars.h" -#include "gamedef.h" -#include "osd.h" - -#define _gamevars_c_ -#include "gamestructures.c" - -extern int32_t OSD_errors; - -void Gv_RefreshPointers(void); -extern void G_FreeMapState(int32_t mapnum); -static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */ -{ - // call this function as many times as needed. - int32_t i=(MAXGAMEVARS-1); - // AddLog("Gv_Free"); - for (; i>=0; i--) - { - if ((aGameVars[i].dwFlags & GAMEVAR_USER_MASK) && aGameVars[i].val.plValues) - { - Bfree(aGameVars[i].val.plValues); - aGameVars[i].val.plValues=NULL; - } - - aGameVars[i].dwFlags |= GAMEVAR_RESET; - - if (i >= MAXGAMEARRAYS) - continue; - - if (aGameArrays[i].plValues) - Bfree(aGameArrays[i].plValues); - - aGameArrays[i].plValues=NULL; - aGameArrays[i].bReset=1; - } - g_gameVarCount=g_gameArrayCount=0; - hash_init(&h_gamevars); - hash_init(&h_arrays); - return; -} - -static void Gv_Clear(void) -{ - // only call this function ONCE... - int32_t i=(MAXGAMEVARS-1); - - //AddLog("Gv_Clear"); - - for (; i>=0; i--) - { - if (aGameVars[i].szLabel) - Bfree(aGameVars[i].szLabel); - aGameVars[i].szLabel=NULL; - aGameVars[i].dwFlags=0; - - if ((aGameVars[i].dwFlags & GAMEVAR_USER_MASK) && aGameVars[i].val.plValues) - { - Bfree(aGameVars[i].val.plValues); - aGameVars[i].val.plValues=NULL; - } - aGameVars[i].val.lValue=0; - aGameVars[i].dwFlags |= GAMEVAR_RESET; - if (i >= MAXGAMEARRAYS) - continue; - if (aGameArrays[i].szLabel) - Bfree(aGameArrays[i].szLabel); - aGameArrays[i].szLabel=NULL; - - if (aGameArrays[i].plValues) - Bfree(aGameArrays[i].plValues); - aGameArrays[i].plValues=NULL; - aGameArrays[i].bReset=1; - } - g_gameVarCount=g_gameArrayCount=0; - hash_init(&h_gamevars); - hash_init(&h_arrays); - return; -} - -int32_t Gv_ReadSave(int32_t fil, int32_t newbehav) -{ - int32_t i, j; - intptr_t l; - char savedstate[MAXVOLUMES*MAXLEVELS]; - char tbuf[12]; - - if (newbehav) - { - if (kread(fil, tbuf, 12)!=12) goto corrupt; - if (Bmemcmp(tbuf, "BEG: EDuke32", 12)) { OSD_Printf("BEG ERR\n"); return 2; } - } - - Bmemset(&savedstate,0,sizeof(savedstate)); - - // AddLog("Reading gamevars from savegame"); - - Gv_Free(); // nuke 'em from orbit, it's the only way to be sure... - - // Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__); - // AddLog(g_szBuf); - - if (kdfread(&g_gameVarCount,sizeof(g_gameVarCount),1,fil) != 1) goto corrupt; - for (i=0; ivars[j]) - MapInfo[i].savedstate->vars[j] = Bcalloc(MAXPLAYERS,sizeof(intptr_t)); - if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt; - } - else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR) - { -// if (!MapInfo[i].savedstate->vars[j]) - MapInfo[i].savedstate->vars[j] = Bcalloc(MAXSPRITES,sizeof(intptr_t)); - if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt; - } - } - } - else if (MapInfo[i].savedstate) - { - G_FreeMapState(i); - } - } - - if (!newbehav) - { - if (kdfread(&l,sizeof(l),1,fil) != 1) goto corrupt; - if (kdfread(g_szBuf,l,1,fil) != 1) goto corrupt; - g_szBuf[l]=0; - OSD_Printf("%s\n",g_szBuf); - } - else - { - if (kread(fil, tbuf, 12)!=12) goto corrupt; - if (Bmemcmp(tbuf, "EOF: EDuke32", 12)) { OSD_Printf("EOF ERR\n"); return 2; } - } - -#if 0 - { - FILE *fp; - AddLog("Dumping Vars..."); - fp=fopen("xxx.txt","w"); - if (fp) - { - Gv_DumpValues(fp); - fclose(fp); - } - AddLog("Done Dumping..."); - } -#endif - return(0); -corrupt: - return(1); -} - -void Gv_WriteSave(FILE *fil, int32_t newbehav) -{ - int32_t i, j; - intptr_t l; - char savedstate[MAXVOLUMES*MAXLEVELS]; - - Bmemset(&savedstate,0,sizeof(savedstate)); - - // AddLog("Saving Game Vars to File"); - if (newbehav) - fwrite("BEG: EDuke32", 12, 1, fil); - - dfwrite(&g_gameVarCount,sizeof(g_gameVarCount),1,fil); - - for (i=0; ivars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil); - } - else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR) - { - dfwrite(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil); - } - } - } - - if (!newbehav) - { - Bsprintf(g_szBuf,"EOF: EDuke32"); - l=Bstrlen(g_szBuf); - dfwrite(&l,sizeof(l),1,fil); - dfwrite(g_szBuf,l,1,fil); - } - else - fwrite("EOF: EDuke32", 12, 1, fil); -} - -void Gv_DumpValues(void) -{ - int32_t i; - - OSD_Printf("// Current Game Definitions\n\n"); - - for (i=0; i= MAXGAMEARRAYS) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: too many arrays!\n",g_szScriptFileName,g_lineNumber); - return 0; - } - - if (Bstrlen(pszLabel) > (MAXARRAYLABEL-1)) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: array name `%s' exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,pszLabel, MAXARRAYLABEL); - return 0; - } - i = hash_find(&h_arrays,pszLabel); - if (i >=0 && !aGameArrays[i].bReset) - { - // found it it's a duplicate in error - g_numCompilerWarnings++; - C_ReportError(WARNING_DUPLICATEDEFINITION); - return 0; - } - - i = g_gameArrayCount; - - if (aGameArrays[i].szLabel == NULL) - aGameArrays[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t)); - if (aGameArrays[i].szLabel != pszLabel) - Bstrcpy(aGameArrays[i].szLabel,pszLabel); - aGameArrays[i].plValues=Bcalloc(asize,sizeof(intptr_t)); - aGameArrays[i].size=asize; - aGameArrays[i].bReset=0; - g_gameArrayCount++; - hash_add(&h_arrays, aGameArrays[i].szLabel, i, 1); - return 1; -} - -int32_t Gv_NewVar(const char *pszLabel, int32_t lValue, uint32_t dwFlags) -{ - int32_t i, j; - - //Bsprintf(g_szBuf,"Gv_NewVar(%s, %d, %X)",pszLabel, lValue, dwFlags); - //AddLog(g_szBuf); - - if (g_gameVarCount >= MAXGAMEVARS) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: too many gamevars!\n",g_szScriptFileName,g_lineNumber); - return 0; - } - - if (Bstrlen(pszLabel) > (MAXVARLABEL-1)) - { - g_numCompilerErrors++; - C_ReportError(-1); - initprintf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,pszLabel, MAXVARLABEL); - return 0; - } - - i = hash_find(&h_gamevars,pszLabel); - - if (i >= 0 && !(aGameVars[i].dwFlags & GAMEVAR_RESET)) - { - // found it... - if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) - { - // warning++; - // initprintf("%s:%d: warning: Internal gamevar '%s' cannot be redefined.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - C_ReportError(-1); - initprintf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - return 0; - } - else if (!(aGameVars[i].dwFlags & GAMEVAR_DEFAULT) && !(aGameVars[i].dwFlags & GAMEVAR_SYSTEM)) - { - // it's a duplicate in error - g_numCompilerWarnings++; - C_ReportError(WARNING_DUPLICATEDEFINITION); - return 0; - } - } - - if (i == -1) - i = g_gameVarCount; - - // Set values - if ((aGameVars[i].dwFlags & GAMEVAR_SYSTEM) == 0) - { - if (aGameVars[i].szLabel == NULL) - aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t)); - if (aGameVars[i].szLabel != pszLabel) - Bstrcpy(aGameVars[i].szLabel,pszLabel); - aGameVars[i].dwFlags=dwFlags; - - if (aGameVars[i].dwFlags & GAMEVAR_USER_MASK) - { - // only free if not system - if (aGameVars[i].val.plValues) - Bfree(aGameVars[i].val.plValues); - aGameVars[i].val.plValues=NULL; - } - } - - // if existing is system, they only get to change default value.... - aGameVars[i].lDefault = lValue; - aGameVars[i].dwFlags &= ~GAMEVAR_RESET; - - if (i == g_gameVarCount) - { - // we're adding a new one. - hash_add(&h_gamevars, aGameVars[i].szLabel, g_gameVarCount++, 0); - } - - if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER) - { - if (!aGameVars[i].val.plValues) - aGameVars[i].val.plValues=Bcalloc(MAXPLAYERS,sizeof(intptr_t)); - for (j=MAXPLAYERS-1; j>=0; j--) - aGameVars[i].val.plValues[j]=lValue; - } - else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR) - { - if (!aGameVars[i].val.plValues) - aGameVars[i].val.plValues=Bcalloc(MAXSPRITES,sizeof(intptr_t)); - for (j=MAXSPRITES-1; j>=0; j--) - aGameVars[i].val.plValues[j]=lValue; - } - else aGameVars[i].val.lValue = lValue; - - return 1; -} - -void __fastcall A_ResetVars(register int32_t iActor) -{ - register int32_t i=(MAXGAMEVARS-1); - do - { - if ((aGameVars[i].dwFlags & (GAMEVAR_PERACTOR|GAMEVAR_NODEFAULT)) == GAMEVAR_PERACTOR) - aGameVars[i].val.plValues[iActor]=aGameVars[i].lDefault; - } - while (i--); -} - -static int32_t Gv_GetVarIndex(const char *szGameLabel) -{ - int32_t i = hash_find(&h_gamevars,szGameLabel); - if (i == -1) - { - OSD_Printf(OSD_ERROR "Gv_GetVarDataPtr(): INTERNAL ERROR: couldn't find gamevar %s!\n",szGameLabel); - return 0; - } - return i; -} - -int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, register int32_t iPlayer) -{ - if (id == g_iThisActorID) - return iActor; - - if (id == MAXGAMEVARS) - return(*insptr++); - - { - register intptr_t negateResult = id&(MAXGAMEVARS<<1); - - if (id >= g_gameVarCount) - { - if (id&(MAXGAMEVARS<<2)) // array - { - register int32_t index=Gv_GetVar(*insptr++,iActor,iPlayer); - - id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1)); - - if (index >= aGameArrays[id].size || index < 0) - { - OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index); - return -1; - } - - return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult); - } - - if (id&(MAXGAMEVARS<<3)) // struct shortcut vars - { - register int32_t index=Gv_GetVar(*insptr++, iActor, iPlayer); - - switch ((id&(MAXGAMEVARS-1)) - g_iSpriteVarID) - { - case 0: //if (id == g_iSpriteVarID) - { - int32_t parm2 = 0, label = *insptr++; - - /*OSD_Printf("%d %d %d\n",__LINE__,index,label);*/ - if (ActorLabels[label].flags & LABEL_HASPARM2) - parm2 = Gv_GetVar(*insptr++, iActor, iPlayer); - - return ((VM_AccessSpriteX(index, label, parm2) ^ -negateResult) + negateResult); - } - case 3: //else if (id == g_iPlayerVarID) - { - int32_t parm2 = 0, label = *insptr++; - - if (PlayerLabels[label].flags & LABEL_HASPARM2) - parm2 = Gv_GetVar(*insptr++, iActor, iPlayer); - - if (index == vm.g_i) index = vm.g_p; - return ((VM_AccessPlayerX(index, label, parm2) ^ -negateResult) + negateResult); - } - case 4: //else if (id == g_iActorVarID) - return ((Gv_GetVar(*insptr++, index, iPlayer) ^ -negateResult) + negateResult); - case 1: //else if (id == g_iSectorVarID) - if (index == vm.g_i) index = sprite[vm.g_i].sectnum; - return ((VM_AccessSectorX(index, *insptr++) ^ -negateResult) + negateResult); - case 2: //else if (id == g_iWallVarID) - return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult); - default: - OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]); - return -1; - } - } - - id &= (MAXGAMEVARS-1); - - if (!negateResult) - { - OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id); - return -1; - } - } - - switch (aGameVars[id].dwFlags & - (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) - { - default: - return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult); - case GAMEVAR_PERPLAYER: - if ((unsigned)iPlayer >= MAXPLAYERS) goto bad_id; - return ((aGameVars[id].val.plValues[iPlayer] ^ -negateResult) + negateResult); - case GAMEVAR_PERACTOR: - if ((unsigned)iActor >= MAXSPRITES) goto bad_id; - return ((aGameVars[id].val.plValues[iActor] ^ -negateResult) + negateResult); - case GAMEVAR_INTPTR: - return (((*((int32_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); - case GAMEVAR_SHORTPTR: - return (((*((int16_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); - case GAMEVAR_CHARPTR: - return (((*((char *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); - } - } -bad_id: - OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite/player ID %d/%d\n",g_errorLineNum,keyw[g_tw],iActor,iPlayer); - return -1; -} - -void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register int32_t iActor, register int32_t iPlayer) -{ - if (id<0 || id >= g_gameVarCount) goto badvarid; - - //Bsprintf(g_szBuf,"SGVI: %d ('%s') to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer); - //AddLog(g_szBuf); - - switch (aGameVars[id].dwFlags & - (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) - { - default: - aGameVars[id].val.lValue=lValue; - return; - case GAMEVAR_PERPLAYER: - if ((unsigned)iPlayer > MAXPLAYERS-1) goto badindex; - // for the current player - aGameVars[id].val.plValues[iPlayer]=lValue; - return; - case GAMEVAR_PERACTOR: - if ((unsigned)iActor > MAXSPRITES-1) goto badindex; - aGameVars[id].val.plValues[iActor]=lValue; - return; - case GAMEVAR_INTPTR: - *((int32_t *)aGameVars[id].val.lValue)=(int32_t)lValue; - return; - case GAMEVAR_SHORTPTR: - *((int16_t *)aGameVars[id].val.lValue)=(int16_t)lValue; - return; - case GAMEVAR_CHARPTR: - *((uint8_t *)aGameVars[id].val.lValue)=(uint8_t)lValue; - return; - } - -badvarid: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid gamevar (%d) from sprite %d (%d), player %d\n", - g_errorLineNum,keyw[g_tw],id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); - return; - -badindex: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s from sprite %d, player %d\n", - g_errorLineNum,keyw[g_tw], - aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? iActor : iPlayer, - aGameVars[id].szLabel,vm.g_i,vm.g_p); - return; -} - -int32_t __fastcall Gv_GetVarX(register int32_t id) -{ - if (id == g_iThisActorID) - return vm.g_i; - - if (id == MAXGAMEVARS) - return(*insptr++); - - { - register intptr_t negateResult = id&(MAXGAMEVARS<<1); - - if (id >= g_gameVarCount) - { - if (id&(MAXGAMEVARS<<2)) // array - { - register int32_t index=Gv_GetVarX(*insptr++); - - id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1)); - - if (index >= aGameArrays[id].size || index < 0) - { - OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index); - return -1; - } - return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult); - } - - if (id&(MAXGAMEVARS<<3)) // struct shortcut vars - { - int32_t index=Gv_GetVarX(*insptr++); - - switch ((id&(MAXGAMEVARS-1)) - g_iSpriteVarID) - { - case 0: //if (id == g_iSpriteVarID) - { - register int32_t parm2 = 0, label = *insptr++; - - /*OSD_Printf("%d %d %d\n",__LINE__,index,label);*/ - if (ActorLabels[label].flags & LABEL_HASPARM2) - parm2 = Gv_GetVarX(*insptr++); - - return ((VM_AccessSpriteX(index, label, parm2) ^ -negateResult) + negateResult); - } - case 3: //else if (id == g_iPlayerVarID) - { - register int32_t parm2 = 0, label = *insptr++; - - if (PlayerLabels[label].flags & LABEL_HASPARM2) - parm2 = Gv_GetVarX(*insptr++); - - if (index == vm.g_i) index = vm.g_p; - return ((VM_AccessPlayerX(index, label, parm2) ^ -negateResult) + negateResult); - } - case 4: //else if (id == g_iActorVarID) - return ((Gv_GetVar(*insptr++, index, vm.g_p) ^ -negateResult) + negateResult); - case 1: //else if (id == g_iSectorVarID) - if (index == vm.g_i) index = sprite[vm.g_i].sectnum; - return ((VM_AccessSectorX(index, *insptr++) ^ -negateResult) + negateResult); - case 2: //else if (id == g_iWallVarID) - return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult); - default: - OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]); - return -1; - } - } - - id &= (MAXGAMEVARS-1); - - if (!negateResult) - { - OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id); - return -1; - } - } - - switch (aGameVars[id].dwFlags & - (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) - { - default: - return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult); - case GAMEVAR_PERPLAYER: - return ((aGameVars[id].val.plValues[vm.g_p] ^ -negateResult) + negateResult); - case GAMEVAR_PERACTOR: - return ((aGameVars[id].val.plValues[vm.g_i] ^ -negateResult) + negateResult); - case GAMEVAR_INTPTR: - return (((*((int32_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); - case GAMEVAR_SHORTPTR: - return (((*((int16_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); - case GAMEVAR_CHARPTR: - return (((*((uint8_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult); - } - } -} - -void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue) -{ - switch (aGameVars[id].dwFlags & - (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) - { - default: - aGameVars[id].val.lValue=lValue; - return; - case GAMEVAR_PERPLAYER: - if ((unsigned)vm.g_p > MAXPLAYERS-1) goto badindex; - aGameVars[id].val.plValues[vm.g_p]=lValue; - return; - case GAMEVAR_PERACTOR: - if ((unsigned)vm.g_i > MAXSPRITES-1) goto badindex; - aGameVars[id].val.plValues[vm.g_i]=lValue; - return; - case GAMEVAR_INTPTR: - *((int32_t *)aGameVars[id].val.lValue)=(int32_t)lValue; - return; - case GAMEVAR_SHORTPTR: - *((int16_t *)aGameVars[id].val.lValue)=(int16_t)lValue; - return; - case GAMEVAR_CHARPTR: - *((uint8_t *)aGameVars[id].val.lValue)=(uint8_t)lValue; - return; - } - -badindex: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s\n", - g_errorLineNum,keyw[g_tw], - aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? vm.g_i : vm.g_p, - aGameVars[id].szLabel); - return; -} - -int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t lDefault, int32_t iActor, int32_t iPlayer) -{ - int32_t i = hash_find(&h_gamevars,szGameLabel); - - if (i < 0) - return lDefault; - - return Gv_GetVar(i, iActor, iPlayer); -} - -static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel) -{ - int32_t i = hash_find(&h_gamevars,szGameLabel); - - if (i < 0) - return NULL; - - if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR | GAMEVAR_PERPLAYER)) - { - if (!aGameVars[i].val.plValues) - OSD_Printf(CON_ERROR "Gv_GetVarDataPtr(): INTERNAL ERROR: NULL array !!!\n",g_errorLineNum,keyw[g_tw]); - return aGameVars[i].val.plValues; - } - - return &(aGameVars[i].val.lValue); -} - -void Gv_ResetSystemDefaults(void) -{ - // call many times... - - int32_t i,j; - char aszBuf[64]; - - //AddLog("ResetWeaponDefaults"); - - for (j=MAXPLAYERS-1; j>=0; j--) - { - for (i=MAX_WEAPONS-1; i>=0; i--) - { - Bsprintf(aszBuf,"WEAPON%d_CLIP",i); - aplWeaponClip[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",i); - aplWeaponReload[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",i); - aplWeaponFireDelay[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",i); - aplWeaponTotalTime[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",i); - aplWeaponHoldDelay[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",i); - aplWeaponFlags[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",i); - aplWeaponShoots[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",i); - aplWeaponSpawnTime[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",i); - aplWeaponSpawn[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",i); - aplWeaponShotsPerBurst[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",i); - aplWeaponWorksLike[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",i); - aplWeaponInitialSound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",i); - aplWeaponFireSound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",i); - aplWeaponSound2Time[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",i); - aplWeaponSound2Sound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",i); - aplWeaponReloadSound1[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",i); - aplWeaponReloadSound2[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i); - aplWeaponSelectSound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i); - aplWeaponFlashColor[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); - } - } - - g_iReturnVarID=Gv_GetVarIndex("RETURN"); - g_iWeaponVarID=Gv_GetVarIndex("WEAPON"); - g_iWorksLikeVarID=Gv_GetVarIndex("WORKSLIKE"); - g_iZRangeVarID=Gv_GetVarIndex("ZRANGE"); - g_iAngRangeVarID=Gv_GetVarIndex("ANGRANGE"); - g_iAimAngleVarID=Gv_GetVarIndex("AUTOAIMANGLE"); - g_iLoTagID=Gv_GetVarIndex("LOTAG"); - g_iHiTagID=Gv_GetVarIndex("HITAG"); - g_iTextureID=Gv_GetVarIndex("TEXTURE"); - g_iThisActorID=Gv_GetVarIndex("THISACTOR"); - - g_iSpriteVarID=Gv_GetVarIndex("sprite"); - g_iSectorVarID=Gv_GetVarIndex("sector"); - g_iWallVarID=Gv_GetVarIndex("wall"); - g_iPlayerVarID=Gv_GetVarIndex("player"); - g_iActorVarID=Gv_GetVarIndex("actorvar"); - - Bmemcpy(&ProjectileData,&DefaultProjectileData,sizeof(ProjectileData)); - - //AddLog("EOF:ResetWeaponDefaults"); -} - -static void Gv_AddSystemVars(void) -{ - // only call ONCE - char aszBuf[64]; - - //AddLog("Gv_AddSystemVars"); - - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",KNEE_WEAPON); - Gv_NewVar(aszBuf, KNEE_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",KNEE_WEAPON); - Gv_NewVar(aszBuf, 7, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",KNEE_WEAPON); - Gv_NewVar(aszBuf, 14, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",KNEE_WEAPON); - Gv_NewVar(aszBuf, WEAPON_NOVISIBLE | WEAPON_RANDOMRESTART | WEAPON_AUTOMATIC, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",KNEE_WEAPON); - Gv_NewVar(aszBuf, KNEE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",KNEE_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",KNEE_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",KNEE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",PISTOL_WEAPON); - Gv_NewVar(aszBuf, PISTOL_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",PISTOL_WEAPON); - Gv_NewVar(aszBuf, NAM?20:12, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",PISTOL_WEAPON); - Gv_NewVar(aszBuf, NAM?50:27, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 2, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 5, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",PISTOL_WEAPON); - Gv_NewVar(aszBuf, NAM?WEAPON_HOLSTER_CLEARS_CLIP:0 | WEAPON_RELOAD_TIMING, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",PISTOL_WEAPON); - Gv_NewVar(aszBuf, SHOTSPARK1, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 2, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",PISTOL_WEAPON); - Gv_NewVar(aszBuf, SHELL, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",PISTOL_WEAPON); - Gv_NewVar(aszBuf, PISTOL_FIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",PISTOL_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",PISTOL_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",PISTOL_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",PISTOL_WEAPON); - Gv_NewVar(aszBuf, 255+(95<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, SHOTGUN_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 13, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 4, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 30, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, WEAPON_CHECKATRELOAD, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, SHOTGUN, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 24, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, SHOTGUNSHELL, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 7, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, SHOTGUN_FIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 15, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, SHOTGUN_COCK, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, SHOTGUN_COCK, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",SHOTGUN_WEAPON); - Gv_NewVar(aszBuf, 255+(95<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, CHAINGUN_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 3, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 12, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 3, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, WEAPON_AUTOMATIC | WEAPON_FIREEVERYTHIRD | WEAPON_AMMOPERSHOT | WEAPON_SPAWNTYPE3 | WEAPON_RESET, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, CHAINGUN, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 1, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, SHELL, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, CHAINGUN_FIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",CHAINGUN_WEAPON); - Gv_NewVar(aszBuf, 255+(95<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",RPG_WEAPON); - Gv_NewVar(aszBuf, RPG_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",RPG_WEAPON); - Gv_NewVar(aszBuf, 4, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",RPG_WEAPON); - Gv_NewVar(aszBuf, 20, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",RPG_WEAPON); - Gv_NewVar(aszBuf, RPG, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",RPG_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",RPG_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",RPG_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",RPG_WEAPON); - Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",RPG_WEAPON); - Gv_NewVar(aszBuf, 255+(95<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, HANDBOMB_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 30, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 6, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 19, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 12, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, WEAPON_THROWIT, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, HEAVYHBOMB, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",HANDBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, SHRINKER_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 10, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, NAM?30:12, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, WEAPON_GLOWS, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, SHRINKER, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, SHRINKER_FIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",SHRINKER_WEAPON); - Gv_NewVar(aszBuf, 128+(255<<8)+(128<<16), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, DEVISTATOR_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 3, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 6, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 5, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, WEAPON_FIREEVERYOTHER | WEAPON_AMMOPERSHOT, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, RPG, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 2, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, CAT_FIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",DEVISTATOR_WEAPON); - Gv_NewVar(aszBuf, 255+(95<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, TRIPBOMB_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 16, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 3, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 16, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 7, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, WEAPON_NOVISIBLE | WEAPON_STANDSTILL | WEAPON_CHECKATRELOAD, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, HANDHOLDINGLASER, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",FREEZE_WEAPON); - Gv_NewVar(aszBuf, FREEZE_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 3, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 5, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",FREEZE_WEAPON); - Gv_NewVar(aszBuf, WEAPON_RESET, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",FREEZE_WEAPON); - Gv_NewVar(aszBuf, FREEZEBLAST, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",FREEZE_WEAPON); - Gv_NewVar(aszBuf, CAT_FIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",FREEZE_WEAPON); - Gv_NewVar(aszBuf, CAT_FIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",FREEZE_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",FREEZE_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",FREEZE_WEAPON); - Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",FREEZE_WEAPON); - Gv_NewVar(aszBuf, 128+(128<<8)+(255<<16), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - ///////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, HANDREMOTE_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 10, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 2, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 10, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, WEAPON_BOMB_TRIGGER | WEAPON_NOVISIBLE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",HANDREMOTE_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - /////////////////////////////////////////////////////// - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",GROW_WEAPON); - Gv_NewVar(aszBuf, GROW_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_CLIP",GROW_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOAD",GROW_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",GROW_WEAPON); - Gv_NewVar(aszBuf, 3, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",GROW_WEAPON); - Gv_NewVar(aszBuf, NAM?30:5, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",GROW_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",GROW_WEAPON); - Gv_NewVar(aszBuf, WEAPON_GLOWS, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",GROW_WEAPON); - Gv_NewVar(aszBuf, GROWSPARK, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",GROW_WEAPON); - Gv_NewVar(aszBuf, NAM?2:0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",GROW_WEAPON); - Gv_NewVar(aszBuf, NAM?SHELL:0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",GROW_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",GROW_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",GROW_WEAPON); - Gv_NewVar(aszBuf, NAM?0:EXPANDERSHOOT, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",GROW_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",GROW_WEAPON); - Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",GROW_WEAPON); - Gv_NewVar(aszBuf, EJECT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",GROW_WEAPON); - Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",GROW_WEAPON); - Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",GROW_WEAPON); - Gv_NewVar(aszBuf, 255+(95<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - Gv_NewVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Gv_NewVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - Gv_NewVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Gv_NewVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - Gv_NewVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Gv_NewVar("PIPEBOMB_CONTROL", NAM?PIPEBOMB_TIMER:PIPEBOMB_REMOTE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - - Gv_NewVar("RESPAWN_MONSTERS", (intptr_t)&ud.respawn_monsters,GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("RESPAWN_ITEMS",(intptr_t)&ud.respawn_items, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("RESPAWN_INVENTORY",(intptr_t)&ud.respawn_inventory, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("MONSTERS_OFF",(intptr_t)&ud.monsters_off, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("MARKER",(intptr_t)&ud.marker, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("FFIRE",(intptr_t)&ud.ffire, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("LEVEL",(intptr_t)&ud.level_number, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); - Gv_NewVar("VOLUME",(intptr_t)&ud.volume_number, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); - - Gv_NewVar("COOP",(intptr_t)&ud.coop, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("MULTIMODE",(intptr_t)&ud.multimode, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - - Gv_NewVar("WEAPON", 0, GAMEVAR_PERPLAYER | GAMEVAR_READONLY | GAMEVAR_SYSTEM); - Gv_NewVar("WORKSLIKE", 0, GAMEVAR_PERPLAYER | GAMEVAR_READONLY | GAMEVAR_SYSTEM); - Gv_NewVar("RETURN", 0, GAMEVAR_SYSTEM); - Gv_NewVar("ZRANGE", 4, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Gv_NewVar("ANGRANGE", 18, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Gv_NewVar("AUTOAIMANGLE", 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); - Gv_NewVar("LOTAG", 0, GAMEVAR_SYSTEM); - Gv_NewVar("HITAG", 0, GAMEVAR_SYSTEM); - Gv_NewVar("TEXTURE", 0, GAMEVAR_SYSTEM); - Gv_NewVar("THISACTOR", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); - - // special vars for struct access - Gv_NewVar("sprite", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL); - Gv_NewVar("sector", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL); - Gv_NewVar("wall", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL); - Gv_NewVar("player", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL); - Gv_NewVar("actorvar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL); - - Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("currentweapon",(intptr_t)&g_currentweapon, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("gs",(intptr_t)&g_gs, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("looking_arc",(intptr_t)&g_looking_arc, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("gun_pos",(intptr_t)&g_gun_pos, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("weapon_xoffset",(intptr_t)&g_weapon_xoffset, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("weaponcount",(intptr_t)&g_kb, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("looking_angSR1",(intptr_t)&g_looking_angSR1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); - Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("windowx1",(intptr_t)&windowx1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("windowx2",(intptr_t)&windowx2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("windowy1",(intptr_t)&windowy1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("windowy2",(intptr_t)&windowy2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("lastvisinc",(intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); - - Gv_NewVar("current_menu",(intptr_t)&g_currentMenu, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); - Gv_NewVar("numplayers",(intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); - Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("gametype_flags",(intptr_t)&GametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - Gv_NewVar("framerate",(intptr_t)&g_currentFrameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY); - Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY); - - Gv_NewVar("camerax",(intptr_t)&ud.camera.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("cameray",(intptr_t)&ud.camera.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("cameraz",(intptr_t)&ud.camera.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - - Gv_NewVar("myx",(intptr_t)&my.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myy",(intptr_t)&my.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myz",(intptr_t)&my.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("omyx",(intptr_t)&omy.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("omyy",(intptr_t)&omy.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("omyz",(intptr_t)&omy.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myvelx",(intptr_t)&myvel.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myvely",(intptr_t)&myvel.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myvelz",(intptr_t)&myvel.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); - - Gv_NewVar("myhoriz",(intptr_t)&myhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myhorizoff",(intptr_t)&myhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("omyhoriz",(intptr_t)&omyhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("omyhorizoff",(intptr_t)&omyhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myang",(intptr_t)&myang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("omyang",(intptr_t)&omyang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("mycursectnum",(intptr_t)&mycursectnum, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myjumpingcounter",(intptr_t)&myjumpingcounter, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_SYNCCHECK); - - Gv_NewVar("myjumpingtoggle",(intptr_t)&myjumpingtoggle, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myonground",(intptr_t)&myonground, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myhardlanding",(intptr_t)&myhardlanding, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("myreturntocenter",(intptr_t)&myreturntocenter, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); - - Gv_NewVar("display_mirror",(intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR | GAMEVAR_SYNCCHECK); - Gv_NewVar("randomseed",(intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); - - Gv_NewVar("NUMWALLS",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); - Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); - - Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK); -#ifdef USE_OPENGL - Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); -#else - Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); -#endif -} - -void Gv_Init(void) -{ - // only call ONCE - - // initprintf("Initializing game variables\n"); - //AddLog("Gv_Init"); - - Gv_Clear(); - Gv_AddSystemVars(); - Gv_InitWeaponPointers(); - Gv_ResetSystemDefaults(); -} - -void Gv_InitWeaponPointers(void) -{ - int32_t i; - char aszBuf[64]; - // called from game Init AND when level is loaded... - - //AddLog("Gv_InitWeaponPointers"); - - for (i=(MAX_WEAPONS-1); i>=0; i--) - { - Bsprintf(aszBuf,"WEAPON%d_CLIP",i); - aplWeaponClip[i]=Gv_GetVarDataPtr(aszBuf); - if (!aplWeaponClip[i]) - { - initprintf("ERROR: NULL weapon! WTF?!\n"); - // exit(0); - G_Shutdown(); - } - Bsprintf(aszBuf,"WEAPON%d_RELOAD",i); - aplWeaponReload[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",i); - aplWeaponFireDelay[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",i); - aplWeaponTotalTime[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",i); - aplWeaponHoldDelay[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",i); - aplWeaponFlags[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",i); - aplWeaponShoots[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",i); - aplWeaponSpawnTime[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",i); - aplWeaponSpawn[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",i); - aplWeaponShotsPerBurst[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",i); - aplWeaponWorksLike[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",i); - aplWeaponInitialSound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",i); - aplWeaponFireSound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",i); - aplWeaponSound2Time[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",i); - aplWeaponSound2Sound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",i); - aplWeaponReloadSound1[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",i); - aplWeaponReloadSound2[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i); - aplWeaponSelectSound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i); - aplWeaponFlashColor[i]=Gv_GetVarDataPtr(aszBuf); - } -} - -void Gv_RefreshPointers(void) -{ - aGameVars[Gv_GetVarIndex("RESPAWN_MONSTERS")].val.lValue = (intptr_t)&ud.respawn_monsters; - aGameVars[Gv_GetVarIndex("RESPAWN_ITEMS")].val.lValue = (intptr_t)&ud.respawn_items; - aGameVars[Gv_GetVarIndex("RESPAWN_INVENTORY")].val.lValue = (intptr_t)&ud.respawn_inventory; - aGameVars[Gv_GetVarIndex("MONSTERS_OFF")].val.lValue = (intptr_t)&ud.monsters_off; - aGameVars[Gv_GetVarIndex("MARKER")].val.lValue = (intptr_t)&ud.marker; - aGameVars[Gv_GetVarIndex("FFIRE")].val.lValue = (intptr_t)&ud.ffire; - aGameVars[Gv_GetVarIndex("LEVEL")].val.lValue = (intptr_t)&ud.level_number; - aGameVars[Gv_GetVarIndex("VOLUME")].val.lValue = (intptr_t)&ud.volume_number; - - aGameVars[Gv_GetVarIndex("COOP")].val.lValue = (intptr_t)&ud.coop; - aGameVars[Gv_GetVarIndex("MULTIMODE")].val.lValue = (intptr_t)&ud.multimode; - - aGameVars[Gv_GetVarIndex("myconnectindex")].val.lValue = (intptr_t)&myconnectindex; - aGameVars[Gv_GetVarIndex("screenpeek")].val.lValue = (intptr_t)&screenpeek; - aGameVars[Gv_GetVarIndex("currentweapon")].val.lValue = (intptr_t)&g_currentweapon; - aGameVars[Gv_GetVarIndex("gs")].val.lValue = (intptr_t)&g_gs; - aGameVars[Gv_GetVarIndex("looking_arc")].val.lValue = (intptr_t)&g_looking_arc; - aGameVars[Gv_GetVarIndex("gun_pos")].val.lValue = (intptr_t)&g_gun_pos; - aGameVars[Gv_GetVarIndex("weapon_xoffset")].val.lValue = (intptr_t)&g_weapon_xoffset; - aGameVars[Gv_GetVarIndex("weaponcount")].val.lValue = (intptr_t)&g_kb; - aGameVars[Gv_GetVarIndex("looking_angSR1")].val.lValue = (intptr_t)&g_looking_angSR1; - aGameVars[Gv_GetVarIndex("xdim")].val.lValue = (intptr_t)&xdim; - aGameVars[Gv_GetVarIndex("ydim")].val.lValue = (intptr_t)&ydim; - aGameVars[Gv_GetVarIndex("windowx1")].val.lValue = (intptr_t)&windowx1; - aGameVars[Gv_GetVarIndex("windowx2")].val.lValue = (intptr_t)&windowx2; - aGameVars[Gv_GetVarIndex("windowy1")].val.lValue = (intptr_t)&windowy1; - aGameVars[Gv_GetVarIndex("windowy2")].val.lValue = (intptr_t)&windowy2; - aGameVars[Gv_GetVarIndex("totalclock")].val.lValue = (intptr_t)&totalclock; - aGameVars[Gv_GetVarIndex("lastvisinc")].val.lValue = (intptr_t)&lastvisinc; - aGameVars[Gv_GetVarIndex("numsectors")].val.lValue = (intptr_t)&numsectors; - aGameVars[Gv_GetVarIndex("numplayers")].val.lValue = (intptr_t)&numplayers; - aGameVars[Gv_GetVarIndex("current_menu")].val.lValue = (intptr_t)&g_currentMenu; - aGameVars[Gv_GetVarIndex("viewingrange")].val.lValue = (intptr_t)&viewingrange; - aGameVars[Gv_GetVarIndex("yxaspect")].val.lValue = (intptr_t)&yxaspect; - aGameVars[Gv_GetVarIndex("gravitationalconstant")].val.lValue = (intptr_t)&g_spriteGravity; - aGameVars[Gv_GetVarIndex("gametype_flags")].val.lValue = (intptr_t)&GametypeFlags[ud.coop]; - aGameVars[Gv_GetVarIndex("framerate")].val.lValue = (intptr_t)&g_currentFrameRate; - - aGameVars[Gv_GetVarIndex("camerax")].val.lValue = (intptr_t)&ud.camera.x; - aGameVars[Gv_GetVarIndex("cameray")].val.lValue = (intptr_t)&ud.camera.y; - aGameVars[Gv_GetVarIndex("cameraz")].val.lValue = (intptr_t)&ud.camera.z; - aGameVars[Gv_GetVarIndex("cameraang")].val.lValue = (intptr_t)&ud.cameraang; - aGameVars[Gv_GetVarIndex("camerahoriz")].val.lValue = (intptr_t)&ud.camerahoriz; - aGameVars[Gv_GetVarIndex("camerasect")].val.lValue = (intptr_t)&ud.camerasect; - aGameVars[Gv_GetVarIndex("cameradist")].val.lValue = (intptr_t)&g_cameraDistance; - aGameVars[Gv_GetVarIndex("cameraclock")].val.lValue = (intptr_t)&g_cameraClock; - - aGameVars[Gv_GetVarIndex("myx")].val.lValue = (intptr_t)&my.x; - aGameVars[Gv_GetVarIndex("myy")].val.lValue = (intptr_t)&my.y; - aGameVars[Gv_GetVarIndex("myz")].val.lValue = (intptr_t)&my.z; - aGameVars[Gv_GetVarIndex("omyx")].val.lValue = (intptr_t)&omy.x; - aGameVars[Gv_GetVarIndex("omyy")].val.lValue = (intptr_t)&omy.y; - aGameVars[Gv_GetVarIndex("omyz")].val.lValue = (intptr_t)&omy.z; - aGameVars[Gv_GetVarIndex("myvelx")].val.lValue = (intptr_t)&myvel.x; - aGameVars[Gv_GetVarIndex("myvely")].val.lValue = (intptr_t)&myvel.y; - aGameVars[Gv_GetVarIndex("myvelz")].val.lValue = (intptr_t)&myvel.z; - - aGameVars[Gv_GetVarIndex("myhoriz")].val.lValue = (intptr_t)&myhoriz; - aGameVars[Gv_GetVarIndex("myhorizoff")].val.lValue = (intptr_t)&myhorizoff; - aGameVars[Gv_GetVarIndex("omyhoriz")].val.lValue = (intptr_t)&omyhoriz; - aGameVars[Gv_GetVarIndex("omyhorizoff")].val.lValue = (intptr_t)&omyhorizoff; - aGameVars[Gv_GetVarIndex("myang")].val.lValue = (intptr_t)&myang; - aGameVars[Gv_GetVarIndex("omyang")].val.lValue = (intptr_t)&omyang; - aGameVars[Gv_GetVarIndex("mycursectnum")].val.lValue = (intptr_t)&mycursectnum; - aGameVars[Gv_GetVarIndex("myjumpingcounter")].val.lValue = (intptr_t)&myjumpingcounter; - - aGameVars[Gv_GetVarIndex("myjumpingtoggle")].val.lValue = (intptr_t)&myjumpingtoggle; - aGameVars[Gv_GetVarIndex("myonground")].val.lValue = (intptr_t)&myonground; - aGameVars[Gv_GetVarIndex("myhardlanding")].val.lValue = (intptr_t)&myhardlanding; - aGameVars[Gv_GetVarIndex("myreturntocenter")].val.lValue = (intptr_t)&myreturntocenter; - - aGameVars[Gv_GetVarIndex("display_mirror")].val.lValue = (intptr_t)&display_mirror; - aGameVars[Gv_GetVarIndex("randomseed")].val.lValue = (intptr_t)&randomseed; - - aGameVars[Gv_GetVarIndex("NUMWALLS")].val.lValue = (intptr_t)&numwalls; - aGameVars[Gv_GetVarIndex("NUMSECTORS")].val.lValue = (intptr_t)&numsectors; - - aGameVars[Gv_GetVarIndex("lastsavepos")].val.lValue = (intptr_t)&g_lastSaveSlot; -#ifdef USE_OPENGL - aGameVars[Gv_GetVarIndex("rendmode")].val.lValue = (intptr_t)&rendmode; -#endif -} diff --git a/polymer-perf/eduke32/source/gamevars.h b/polymer-perf/eduke32/source/gamevars.h deleted file mode 100644 index af69a1cb3..000000000 --- a/polymer-perf/eduke32/source/gamevars.h +++ /dev/null @@ -1,97 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __gamevars_h__ -#define __gamevars_h__ - -// store global game definitions -enum GamevarFlags_t { - MAXGAMEVARS = 2048, // must be a power of two - MAXVARLABEL = 26, - GAMEVAR_PERPLAYER = 0x00000001, // per-player variable - GAMEVAR_PERACTOR = 0x00000002, // per-actor variable - GAMEVAR_USER_MASK = (0x00000001|0x00000002), - GAMEVAR_RESET = 0x00000008, // marks var for to default - GAMEVAR_DEFAULT = 0x00000100, // allow override - GAMEVAR_SECRET = 0x00000200, // don't dump... - GAMEVAR_NODEFAULT = 0x00000400, // don't reset on actor spawn - GAMEVAR_SYSTEM = 0x00000800, // cannot change mode flags...(only default value) - GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed) - GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t - GAMEVAR_SYNCCHECK = 0x00004000, // throw warnings during compile if used in local event - GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short - GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char - GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state - GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars - GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets -}; - -enum GamearrayFlags_t { - MAXGAMEARRAYS = (MAXGAMEVARS>>2), // must be lower than MAXGAMEVARS - MAXARRAYLABEL = MAXVARLABEL, - GAMEARRAY_NORMAL = 0, - GAMEARRAY_NORESET = 0x00000001, -}; - -#pragma pack(push,1) -typedef struct { - union { - intptr_t lValue; - intptr_t *plValues; // array of values when 'per-player', or 'per-actor' - } val; - intptr_t lDefault; - uintptr_t dwFlags; - char *szLabel; -} gamevar_t; - -typedef struct { - char *szLabel; - int32_t *plValues; // array of values - intptr_t size; - intptr_t bReset; -} gamearray_t; -#pragma pack(pop) - -extern gamevar_t aGameVars[MAXGAMEVARS]; -extern gamearray_t aGameArrays[MAXGAMEARRAYS]; -extern int32_t g_gameVarCount; -extern int32_t g_gameArrayCount; - -int32_t __fastcall Gv_GetVar(register int32_t id,register int32_t iActor,register int32_t iPlayer); -int32_t __fastcall Gv_GetVarX(register int32_t id); -int32_t Gv_GetVarByLabel(const char *szGameLabel,int32_t lDefault,int32_t iActor,int32_t iPlayer); -int32_t Gv_NewArray(const char *pszLabel,int32_t asize); -int32_t Gv_NewVar(const char *pszLabel,int32_t lValue,uint32_t dwFlags); -int32_t Gv_ReadSave(int32_t fil,int32_t newbehav); -void __fastcall A_ResetVars(register int32_t iActor); -void __fastcall Gv_SetVar(register int32_t id,register int32_t lValue,register int32_t iActor,register int32_t iPlayer); -void __fastcall Gv_SetVarX(register int32_t id,register int32_t lValue); -void G_FreeMapState(int32_t mapnum); -void Gv_DumpValues(void); -void Gv_Init(void); -void Gv_InitWeaponPointers(void); -void Gv_RefreshPointers(void); -void Gv_RefreshPointers(void); -void Gv_ResetSystemDefaults(void); -void Gv_ResetVars(void); -void Gv_WriteSave(FILE *fil,int32_t newbehav); -#endif diff --git a/polymer-perf/eduke32/source/global.c b/polymer-perf/eduke32/source/global.c deleted file mode 100644 index 95aa23802..000000000 --- a/polymer-perf/eduke32/source/global.c +++ /dev/null @@ -1,192 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#define __global_c__ -#include "global.h" -#include "duke3d.h" -#include "rev.h" - -const char *s_buildDate = "20110109"; -char *MusicPtr = NULL; -int32_t g_musicSize; - -int16_t g_globalRandom; -int16_t neartagsector, neartagwall, neartagsprite; - -int32_t neartaghitdist,lockclock,g_startArmorAmount; -// JBF: g_spriteGravity modified to default to Atomic ed. default when using 1.3d CONs -int32_t g_spriteGravity=176; - -// int32_t temp_data[MAXSPRITES][6]; -actor_t actor[MAXSPRITES]; - -int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize=64; -animwalltype animwall[MAXANIMWALLS]; -int16_t g_numAnimWalls; -int32_t *animateptr[MAXANIMATES]; -int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount; -// int32_t oanimateval[MAXANIMATES]; -int16_t animatesect[MAXANIMATES]; -int32_t msx[2048],msy[2048]; -int16_t cyclers[MAXCYCLERS][6],g_numCyclers; - -char *ScriptQuotes[MAXQUOTES], *ScriptQuoteRedefinitions[MAXQUOTES]; - -char tempbuf[2048], packbuf[PACKBUF_SIZE], menutextbuf[128], buf[1024]; - -int16_t camsprite; -int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount; - -int32_t g_currentMenu; - -map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music -sound_t g_sounds[ MAXSOUNDS ]; -volatile char g_soundlocks[MAXSOUNDS]; - -char EpisodeNames[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" }; -char SkillNames[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" }; - -char GametypeNames[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY","DUKEMATCH (NO SPAWN)","TEAM DM (SPAWN)","TEAM DM (NO SPAWN)"}; - -int32_t GametypeFlags[MAXGAMETYPES] = -{ - /*4+*/8+16+1024+2048+16384, - 1+2+32+64+128+256+512+4096+8192+32768, - 2+/*4+*/8+16+16384, - /*4+*/8+16+1024+2048+16384+65536+131072, - 2+/*4+*/8+16+16384+65536+131072 -}; -char g_numGametypes = 5; - -int32_t g_currentFrameRate; - -char g_numVolumes = 3; - -int32_t g_timerTicsPerSecond=TICRATE; -//fx_device device; - -char g_numPlayerSprites,g_loadFromGroupOnly=0,g_earthquakeTime; - -int32_t playerswhenstarted; - -int32_t fricxv,fricyv; -#pragma pack(push,1) -playerdata_t g_player[MAXPLAYERS]; -input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; -playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; -#pragma pack(pop) -user_defs ud; - -char pus, pub; - -input_t loc; -input_t recsync[RECSYNCBUFSIZ]; -input_t avg; - -int32_t movefifosendplc; - -//Multiplayer syncing variables -int32_t screenpeek; - -//Game recording variables - -char ready2send; -int32_t vel, svel, angvel, horiz, ototalclock, g_actorRespawnTime=768, g_itemRespawnTime=768, g_groupFileHandle; - -intptr_t *g_scriptPtr,*insptr,*labelcode,*labeltype; -int32_t g_numLabels,g_numDefaultLabels; -intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr; -char *label; -char ActorType[MAXTILES]; -intptr_t *script = NULL; - -int32_t g_scriptSize = 1048576; - -char typebuflen,typebuf[141]; - -char g_musicIndex; -char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; -char g_RTSPlaying; - - -int16_t BlimpSpawnSprites[15] = -{ - RPGSPRITE__STATIC, - CHAINGUNSPRITE__STATIC, - DEVISTATORAMMO__STATIC, - RPGAMMO__STATIC, - RPGAMMO__STATIC, - JETPACK__STATIC, - SHIELD__STATIC, - FIRSTAID__STATIC, - STEROIDS__STATIC, - RPGAMMO__STATIC, - RPGAMMO__STATIC, - RPGSPRITE__STATIC, - RPGAMMO__STATIC, - FREEZESPRITE__STATIC, - FREEZEAMMO__STATIC -}; - -int32_t g_impactDamage, g_maxPlayerHealth; -int32_t g_scriptDebug; - -//GLOBAL.C - replace the end "my's" with this -vec3_t my, omy, myvel; -int16_t myhoriz, omyhoriz, myhorizoff, omyhorizoff; -int16_t myang, omyang, mycursectnum, myjumpingcounter; - -char myjumpingtoggle, myonground, myhardlanding, myreturntocenter; -int8_t multiwho, multipos, multiwhat, multiflag; - -int32_t g_playerFriction = 0xcc00, g_showShareware; - -int16_t myangbak[MOVEFIFOSIZ]; -char szPlayerName[32]; -int32_t g_damageCameras,g_freezerSelfDamage=0,g_tripbombLaserMode=0; -int32_t g_gameQuit = 0; -uint32_t everyothertime; -int32_t g_numFreezeBounces=3,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius, - g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius; -DukeStatus_t sbar; - -int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128]; -int32_t cloudtotalclock = 0; -int32_t g_numInterpolations = 0, startofdynamicinterpolations = 0; -int32_t g_interpolationLock = 0; -int32_t oldipos[MAXINTERPOLATIONS]; -int32_t bakipos[MAXINTERPOLATIONS]; -int32_t *curipos[MAXINTERPOLATIONS]; - -int32_t nextvoxid = 0; - -int32_t SpriteFlags[MAXTILES]; - -projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES]; - -char CheatKeys[2] = { sc_D, sc_N }; -char setupfilename[BMAX_PATH]= SETUPFILENAME; - -int32_t g_doQuickSave = 0; -uint32_t g_moveThingsCount = 0; - -int32_t g_restorePalette = 0, g_screenCapture = 0, g_noEnemies = 0; diff --git a/polymer-perf/eduke32/source/global.h b/polymer-perf/eduke32/source/global.h deleted file mode 100644 index 1b0e9b47e..000000000 --- a/polymer-perf/eduke32/source/global.h +++ /dev/null @@ -1,145 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __global_h__ -#define __global_h__ - -#include "duke3d.h" -#include "sector.h" - -#ifdef __global_c__ - #define G_EXTERN -#else - #define G_EXTERN extern -#endif - -// duke3d global soup :( - -#define MAXINTERPOLATIONS MAXSPRITES - -G_EXTERN const char *s_buildRev; -G_EXTERN DukeStatus_t sbar; -G_EXTERN actor_t actor[MAXSPRITES]; -G_EXTERN animwalltype animwall[MAXANIMWALLS]; -G_EXTERN char *ScriptQuotes[MAXQUOTES],*ScriptQuoteRedefinitions[MAXQUOTES]; -G_EXTERN char *label; -G_EXTERN char ActorType[MAXTILES]; -G_EXTERN char CheatKeys[2]; -G_EXTERN char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; -G_EXTERN char EpisodeNames[MAXVOLUMES][33]; -G_EXTERN char GametypeNames[MAXGAMETYPES][33]; -G_EXTERN char SkillNames[5][33]; -G_EXTERN char g_RTSPlaying; -G_EXTERN char g_musicIndex; -G_EXTERN char g_numGametypes; -G_EXTERN char g_numPlayerSprites,g_loadFromGroupOnly; -G_EXTERN char g_numVolumes; -G_EXTERN char myjumpingtoggle,myonground,myhardlanding,myreturntocenter; -G_EXTERN char pus,pub; -G_EXTERN char ready2send; -G_EXTERN char setupfilename[BMAX_PATH]; -G_EXTERN char szPlayerName[32]; -G_EXTERN char tempbuf[2048],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[1024]; -G_EXTERN char typebuflen,typebuf[141]; -G_EXTERN const char *s_buildDate; -G_EXTERN input_t avg; -G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; -G_EXTERN input_t loc; -G_EXTERN input_t recsync[RECSYNCBUFSIZ]; -G_EXTERN int16_t BlimpSpawnSprites[15]; -G_EXTERN int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize; -G_EXTERN int16_t animatesect[MAXANIMATES]; -G_EXTERN int16_t camsprite; -G_EXTERN int16_t cyclers[MAXCYCLERS][6],g_numCyclers; -G_EXTERN int16_t g_globalRandom; -G_EXTERN int16_t g_mirrorWall[64],g_mirrorSector[64],g_mirrorCount; -G_EXTERN int16_t g_numAnimWalls; -G_EXTERN int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128]; -G_EXTERN int16_t myang,omyang,mycursectnum,myjumpingcounter; -G_EXTERN int16_t myangbak[MOVEFIFOSIZ]; -G_EXTERN int16_t myhoriz,omyhoriz,myhorizoff,omyhorizoff; -G_EXTERN int16_t neartagsector,neartagwall,neartagsprite; -G_EXTERN int32_t *animateptr[MAXANIMATES]; -G_EXTERN int32_t *curipos[MAXINTERPOLATIONS]; -G_EXTERN int32_t GametypeFlags[MAXGAMETYPES]; -G_EXTERN int32_t SpriteFlags[MAXTILES]; -G_EXTERN int32_t animategoal[MAXANIMATES],animatevel[MAXANIMATES],g_animateCount; -G_EXTERN int32_t bakipos[MAXINTERPOLATIONS]; -G_EXTERN int32_t cloudtotalclock; -G_EXTERN int32_t fricxv,fricyv; -G_EXTERN int32_t g_currentFrameRate; -G_EXTERN int32_t g_currentMenu; -G_EXTERN int32_t g_damageCameras,g_freezerSelfDamage; -G_EXTERN int32_t g_doQuickSave; -G_EXTERN char g_earthquakeTime; -G_EXTERN int32_t g_gameQuit; -G_EXTERN int32_t g_groupFileHandle; -G_EXTERN int32_t g_impactDamage,g_maxPlayerHealth; -G_EXTERN int32_t g_interpolationLock; -G_EXTERN int32_t g_lastSaveSlot; -G_EXTERN int32_t g_musicSize; -G_EXTERN int32_t g_numFreezeBounces; -G_EXTERN int32_t g_numInterpolations; -G_EXTERN int32_t g_numLabels,g_numDefaultLabels; -G_EXTERN int32_t g_numRealPalettes; -G_EXTERN int32_t g_playerFriction; -G_EXTERN int32_t g_scriptDebug; -G_EXTERN int32_t g_scriptSize; -G_EXTERN int32_t g_showShareware; -G_EXTERN int32_t g_spriteGravity; -G_EXTERN int32_t g_timerTicsPerSecond; -G_EXTERN int32_t g_tripbombLaserMode; -G_EXTERN int32_t movefifosendplc; -G_EXTERN int32_t msx[2048],msy[2048]; -G_EXTERN int32_t neartaghitdist,lockclock,g_startArmorAmount; -G_EXTERN int32_t nextvoxid; -G_EXTERN int32_t oldipos[MAXINTERPOLATIONS]; -G_EXTERN int32_t playerswhenstarted; -G_EXTERN int32_t screenpeek; -G_EXTERN int32_t startofdynamicinterpolations; -G_EXTERN int32_t vel,svel,angvel,horiz,ototalclock,g_actorRespawnTime; -G_EXTERN int8_t multiwho,multipos,multiwhat,multiflag; -G_EXTERN intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr; -G_EXTERN intptr_t *g_scriptPtr,*insptr,*labelcode,*labeltype; -G_EXTERN intptr_t *script; -G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; -G_EXTERN playerdata_t g_player[MAXPLAYERS]; -G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; -G_EXTERN projectile_t ProjectileData[MAXTILES],DefaultProjectileData[MAXTILES],SpriteProjectile[MAXSPRITES]; -G_EXTERN sound_t g_sounds[MAXSOUNDS]; -G_EXTERN uint32_t everyothertime; -G_EXTERN uint32_t g_moveThingsCount; -G_EXTERN vec3_t my,omy,myvel; -G_EXTERN volatile char g_soundlocks[MAXSOUNDS]; -G_EXTERN int32_t g_rpgBlastRadius; -G_EXTERN int32_t g_pipebombBlastRadius; -G_EXTERN int32_t g_tripbombBlastRadius; -G_EXTERN int32_t g_shrinkerBlastRadius; -G_EXTERN int32_t g_morterBlastRadius; -G_EXTERN int32_t g_bouncemineBlastRadius; -G_EXTERN int32_t g_seenineBlastRadius; -G_EXTERN int32_t g_itemRespawnTime; -G_EXTERN int32_t g_restorePalette; -G_EXTERN int32_t g_screenCapture; -G_EXTERN int32_t g_noEnemies; - -#endif diff --git a/polymer-perf/eduke32/source/grpscan.c b/polymer-perf/eduke32/source/grpscan.c deleted file mode 100644 index 72f6a5107..000000000 --- a/polymer-perf/eduke32/source/grpscan.c +++ /dev/null @@ -1,242 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "compat.h" -#include "baselayer.h" - -#include "scriptfile.h" -#include "cache1d.h" -#include "crc32.h" - -#include "duke3d.h" -#include "grpscan.h" - -struct grpfile grpfiles[numgrpfiles] = -{ - { "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAME_DUKE, NULL }, - { "Duke Nukem 3D: Atomic Edition", 0xF514A6AC, 44348015, GAME_DUKE, NULL }, - { "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAME_DUKE, NULL }, - { "Duke Nukem 3D Shareware", 0x983AD923, 11035779, GAME_DUKE, NULL }, - { "Duke Nukem 3D Mac Shareware", 0xC5F71561, 10444391, GAME_DUKE, NULL }, - { "NAM", 0x75C1F07B, 43448927, GAME_NAM, NULL }, - { "Napalm", 0x3DE1589A, 44365728, GAME_NAM, NULL }, - { "WW2GI", 0x907B82BF, 77939508, GAME_WW2, NULL }, -}; -struct grpfile *foundgrps = NULL; - -#define GRPCACHEFILE "grpfiles.cache" -static struct grpcache -{ - struct grpcache *next; - int32_t size; - int32_t mtime; - int32_t crcval; - char name[BMAX_PATH]; -} -*grpcache = NULL, *usedgrpcache = NULL; - -static int32_t LoadGroupsCache(void) -{ - struct grpcache *fg; - - int32_t fsize, fmtime, fcrcval; - char *fname; - - scriptfile *script; - - script = scriptfile_fromfile(GRPCACHEFILE); - if (!script) return -1; - - while (!scriptfile_eof(script)) - { - if (scriptfile_getstring(script, &fname)) break; // filename - if (scriptfile_getnumber(script, &fsize)) break; // filesize - if (scriptfile_getnumber(script, &fmtime)) break; // modification time - if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum - - fg = Bcalloc(1, sizeof(struct grpcache)); - fg->next = grpcache; - grpcache = fg; - - Bstrncpy(fg->name, fname, BMAX_PATH); - fg->size = fsize; - fg->mtime = fmtime; - fg->crcval = fcrcval; - } - - scriptfile_close(script); - return 0; -} - -static void FreeGroupsCache(void) -{ - struct grpcache *fg; - - while (grpcache) - { - fg = grpcache->next; - Bfree(grpcache); - grpcache = fg; - } -} - -int32_t ScanGroups(void) -{ - CACHE1D_FIND_REC *srch, *sidx; - struct grpcache *fg, *fgg; - struct grpfile *grp; - char *fn; - struct Bstat st; -#define BUFFER_SIZE (1024 * 1024 * 8) - uint8_t *buf = Bmalloc(BUFFER_SIZE); - - if (!buf) - { - initprintf("Error allocating %d byte buffer to scan GRPs!\n", BUFFER_SIZE); - return 0; - } - - initprintf("Searching for game data...\n"); - - LoadGroupsCache(); - - srch = klistpath("/", "*.grp", CACHE1D_FIND_FILE); - - for (sidx = srch; sidx; sidx = sidx->next) - { - for (fg = grpcache; fg; fg = fg->next) - { - if (!Bstrcmp(fg->name, sidx->name)) break; - } - - if (fg) - { - if (findfrompath(sidx->name, &fn)) continue; // failed to resolve the filename - if (Bstat(fn, &st)) - { - Bfree(fn); - continue; - } // failed to stat the file - Bfree(fn); - if (fg->size == st.st_size && fg->mtime == st.st_mtime) - { - grp = (struct grpfile *)Bcalloc(1, sizeof(struct grpfile)); - grp->name = Bstrdup(sidx->name); - grp->crcval = fg->crcval; - grp->size = fg->size; - grp->next = foundgrps; - foundgrps = grp; - - fgg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache)); - strcpy(fgg->name, fg->name); - fgg->size = fg->size; - fgg->mtime = fg->mtime; - fgg->crcval = fg->crcval; - fgg->next = usedgrpcache; - usedgrpcache = fgg; - continue; - } - } - - { - int32_t b, fh; - int32_t crcval; - - fh = openfrompath(sidx->name, BO_RDONLY|BO_BINARY, BS_IREAD); - if (fh < 0) continue; - if (fstat(fh, &st)) continue; - - initprintf(" Checksumming %s...", sidx->name); - crc32init((uint32_t *)&crcval); - do - { - b = read(fh, buf, BUFFER_SIZE); - if (b > 0) crc32block((uint32_t *)&crcval, (uint8_t *)buf, b); - } - while (b == BUFFER_SIZE); - crc32finish((uint32_t *)&crcval); - close(fh); - initprintf(" Done\n"); - - grp = (struct grpfile *)Bcalloc(1, sizeof(struct grpfile)); - grp->name = Bstrdup(sidx->name); - grp->crcval = crcval; - grp->size = st.st_size; - grp->next = foundgrps; - foundgrps = grp; - - fgg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache)); - Bstrncpy(fgg->name, sidx->name, BMAX_PATH); - fgg->size = st.st_size; - fgg->mtime = st.st_mtime; - fgg->crcval = crcval; - fgg->next = usedgrpcache; - usedgrpcache = fgg; - } - } - - klistfree(srch); - FreeGroupsCache(); - - if (usedgrpcache) - { - int32_t i = 0; - FILE *fp; - fp = fopen(GRPCACHEFILE, "wt"); - if (fp) - { - for (fg = usedgrpcache; fg; fg=fgg) - { - fgg = fg->next; - fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval); - Bfree(fg); - i++; - } - fclose(fp); - } -// initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file"); - if (buf) - Bfree(buf); - return 0; - } - - initprintf("Found no recognized game data!\n"); - - if (buf) - Bfree(buf); - - return 0; -} - -void FreeGroups(void) -{ - struct grpfile *fg; - - while (foundgrps) - { - fg = foundgrps->next; - Bfree((char *)foundgrps->name); - Bfree(foundgrps); - foundgrps = fg; - } -} - diff --git a/polymer-perf/eduke32/source/grpscan.h b/polymer-perf/eduke32/source/grpscan.h deleted file mode 100644 index 574cce643..000000000 --- a/polymer-perf/eduke32/source/grpscan.h +++ /dev/null @@ -1,39 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef __grpscan_h__ -#define __grpscan_h__ - -// List of internally-known GRP files -#define numgrpfiles 8 -struct grpfile { - const char *name; - int32_t crcval; - int32_t size; - int32_t game; - struct grpfile *next; -} grpfiles[numgrpfiles], *foundgrps; - -int32_t ScanGroups(void); -void FreeGroups(void); - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/Makefile b/polymer-perf/eduke32/source/jaudiolib/Makefile deleted file mode 100644 index 8023dec13..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -include ../../Makefile.common -include ../../$(EROOT)/Makefile.shared - -OBJ=obj -OBJNAME=libjfaudiolib.a -SRC=src -INC=include - -# SDK locations - adjust to match your setup -ifneq ($(DXROOT_OVERRIDE),) - DXROOT ?= $(DXROOT_OVERRIDE) -else - DXROOT ?= c:/sdks/directx/dx8 -endif - -CFLAGS=$(BASECFLAGS) $(F_NO_STACK_PROTECTOR) -# for BUILD_ECHOFLAGS: -OURCFLAGS=$(CFLAGS) -CPPFLAGS=-I$(INC) -I$(SRC) -DHAVE_VORBIS - -ifeq ($(PLATFORM),DARWIN) - ifeq (1,$(SDL_FRAMEWORK)) - APPLE_INCLUDE_DIR:=../../Apple/include - OURCFLAGS += -DSDL_FRAMEWORK -I$(APPLE_INCLUDE_DIR) -I/Library/Frameworks/SDL.framework/Headers \ - -I/Library/Frameworks/SDL_mixer.framework/Headers - endif -endif - - -OBJECTS=$(OBJ)/drivers.o \ - $(OBJ)/fx_man.o \ - $(OBJ)/multivoc.o \ - $(OBJ)/mix.o \ - $(OBJ)/mixst.o \ - $(OBJ)/pitch.o \ - $(OBJ)/vorbis.o \ - $(OBJ)/driver_nosound.o - -ifeq ($(PLATFORM),WINDOWS) - CPPFLAGS+= -I$(DXROOT)/include -Ithird-party/mingw32/include - OBJECTS+= $(OBJ)/driver_directsound.o - OBJNAME=libjfaudiolib_win32.a - OBJ=obj_win -else - CPPFLAGS+= -DHAVE_SDL - OBJECTS+= $(OBJ)/driver_sdl.o -endif - -# OBJECTS=$(SOURCES:%.c=$(OBJ)/%.o) - -$(OBJNAME): $(OBJECTS) - $(BUILD_ECHOFLAGS) - $(ARCHIVE_STATUS) - if $(AR) cr $@ $^; then $(ARCHIVE_OK); else $(ARCHIVE_FAILED); fi - -$(OBJECTS): $(OBJ)/%.o: $(SRC)/%.c - -mkdir -p $(OBJ) - $(COMPILE_STATUS) - if $(CC) $(CPPFLAGS) $(OURCFLAGS) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi - -ifeq ($(PRETTY_OUTPUT),1) -.SILENT: -endif -.PHONY: clean -clean: - -rm -f $(OBJECTS) $(OBJNAME) diff --git a/polymer-perf/eduke32/source/jaudiolib/Makefile.msvc b/polymer-perf/eduke32/source/jaudiolib/Makefile.msvc deleted file mode 100644 index 0badb9ece..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/Makefile.msvc +++ /dev/null @@ -1,50 +0,0 @@ -OBJ=obj.msc -INC=include -SRC=src -JFAUDIOLIB=libjfaudiolib.lib - -!ifdef DEBUG -# debugging options -flags_cl=/Od /Zi -flags_link=/DEBUG -flags_lib= -!else -# release options -flags_cl=/Ox /GL /arch:SSE -flags_link=/RELEASE /LTCG -flags_lib=/LTCG -!endif - -CC=cl -LINK=link /opt:ref /nologo - -DXROOT=U:\SDKs\Microsoft DirectX SDK (April 2007) -VORBISSDK=U:\SDKs\oggvorbis-win32sdk-1.0.1 - -CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(SRC) /I"$(VORBISSDK)\include" /I"$(DXROOT)\include" -!ifdef DEBUG -CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS -!endif - -CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 /D "_CRT_SECURE_NO_DEPRECATE" /W2 /DHAVE_VORBIS /Iinclude/msvc /DWIN32 - -OBJECTS=$(OBJ)\drivers.o \ - $(OBJ)\fx_man.o \ - $(OBJ)\multivoc.o \ - $(OBJ)\mix.o \ - $(OBJ)\mixst.o \ - $(OBJ)\pitch.o \ - $(OBJ)\vorbis.o \ - $(OBJ)\driver_nosound.o \ - $(OBJ)\driver_directsound.o - -{$(SRC)}.c{$(OBJ)}.o: - $(CC) /c $(CFLAGS) /Fo$@ $< - -jfaudiolib: $(JFAUDIOLIB) -$(JFAUDIOLIB): $(OBJECTS) - lib $(flags_lib) /out:$@ /nologo $** - -clean: - -del /Q $(OBJ)\* $(JFAUDIOLIB) - diff --git a/polymer-perf/eduke32/source/jaudiolib/include/fx_man.h b/polymer-perf/eduke32/source/jaudiolib/include/fx_man.h deleted file mode 100644 index e9c4b34f4..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/include/fx_man.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - module: FX_MAN.H - - author: James R. Dose - date: March 17, 1994 - - Public header for FX_MAN.C - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#ifndef __FX_MAN_H -#define __FX_MAN_H - -#include "inttypes.h" -#include "limits.h" -#include "sndcards.h" - -enum FX_ERRORS - { - FX_Warning = -2, - FX_Error = -1, - FX_Ok = 0, - FX_ASSVersion, - FX_SoundCardError, - FX_InvalidCard, - FX_MultiVocError, - }; - -#define FX_MUSIC_PRIORITY INT_MAX - -const char *FX_ErrorString( int32_t ErrorNumber ); -int32_t FX_Init( int32_t SoundCard, int32_t numvoices, int32_t numchannels, int32_t samplebits, unsigned mixrate, void * initdata ); -int32_t FX_Shutdown( void ); -int32_t FX_SetCallBack( void ( *function )( uint32_t ) ); -void FX_SetVolume( int32_t volume ); -int32_t FX_GetVolume( void ); - -void FX_SetReverseStereo( int32_t setting ); -int32_t FX_GetReverseStereo( void ); -void FX_SetReverb( int32_t reverb ); -void FX_SetFastReverb( int32_t reverb ); -int32_t FX_GetMaxReverbDelay( void ); -int32_t FX_GetReverbDelay( void ); -void FX_SetReverbDelay( int32_t delay ); - -int32_t FX_PauseVoice ( int32_t handle, int32_t pause ); -int32_t FX_VoiceAvailable( int32_t priority ); -int32_t FX_EndLooping( int32_t handle ); -int32_t FX_SetPan( int32_t handle, int32_t vol, int32_t left, int32_t right ); -int32_t FX_SetPitch( int32_t handle, int32_t pitchoffset ); -int32_t FX_SetFrequency( int32_t handle, int32_t frequency ); - -int32_t FX_PlayVOC( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval ); -int32_t FX_PlayLoopedVOC( char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -int32_t FX_PlayWAV( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval ); -int32_t FX_PlayLoopedWAV( char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -int32_t FX_PlayVOC3D( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t angle, int32_t distance, - int32_t priority, uint32_t callbackval ); -int32_t FX_PlayWAV3D( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t angle, int32_t distance, - int32_t priority, uint32_t callbackval ); - -int32_t FX_PlayAuto( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval ); -int32_t FX_PlayLoopedAuto( char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -int32_t FX_PlayAuto3D( char *ptr, uint32_t ptrlength, int32_t pitchoffset, int32_t angle, int32_t distance, - int32_t priority, uint32_t callbackval ); - -int32_t FX_PlayRaw( char *ptr, uint32_t length, unsigned rate, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -int32_t FX_PlayLoopedRaw( char *ptr, uint32_t length, char *loopstart, - char *loopend, unsigned rate, int32_t pitchoffset, int32_t vol, int32_t left, - int32_t right, int32_t priority, uint32_t callbackval ); -int32_t FX_Pan3D( int32_t handle, int32_t angle, int32_t distance ); -int32_t FX_SoundActive( int32_t handle ); -int32_t FX_SoundsPlaying( void ); -int32_t FX_StopSound( int32_t handle ); -int32_t FX_StopAllSounds( void ); -int32_t FX_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ), - int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval ); - -int32_t FX_SetVoiceCallback(int32_t handle, uint32_t callbackval); -int32_t FX_SetPrintf(void (*function)(const char *, ...)); - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/include/msvc/inttypes.h b/polymer-perf/eduke32/source/jaudiolib/include/msvc/inttypes.h deleted file mode 100644 index 4b3828a21..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/include/msvc/inttypes.h +++ /dev/null @@ -1,305 +0,0 @@ -// ISO C9x compliant inttypes.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_INTTYPES_H_ // [ -#define _MSC_INTTYPES_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include "stdint.h" - -// 7.8 Format conversion of integer types - -typedef struct { - intmax_t quot; - intmax_t rem; -} imaxdiv_t; - -// 7.8.1 Macros for format specifiers - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 - -// The fprintf macros for signed integers are: -#define PRId8 "d" -#define PRIi8 "i" -#define PRIdLEAST8 "d" -#define PRIiLEAST8 "i" -#define PRIdFAST8 "d" -#define PRIiFAST8 "i" - -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIdLEAST16 "hd" -#define PRIiLEAST16 "hi" -#define PRIdFAST16 "hd" -#define PRIiFAST16 "hi" - -#define PRId32 "I32d" -#define PRIi32 "I32i" -#define PRIdLEAST32 "I32d" -#define PRIiLEAST32 "I32i" -#define PRIdFAST32 "I32d" -#define PRIiFAST32 "I32i" - -#define PRId64 "I64d" -#define PRIi64 "I64i" -#define PRIdLEAST64 "I64d" -#define PRIiLEAST64 "I64i" -#define PRIdFAST64 "I64d" -#define PRIiFAST64 "I64i" - -#define PRIdMAX "I64d" -#define PRIiMAX "I64i" - -#define PRIdPTR "Id" -#define PRIiPTR "Ii" - -// The fprintf macros for unsigned integers are: -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRIoLEAST8 "o" -#define PRIuLEAST8 "u" -#define PRIxLEAST8 "x" -#define PRIXLEAST8 "X" -#define PRIoFAST8 "o" -#define PRIuFAST8 "u" -#define PRIxFAST8 "x" -#define PRIXFAST8 "X" - -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" -#define PRIoLEAST16 "ho" -#define PRIuLEAST16 "hu" -#define PRIxLEAST16 "hx" -#define PRIXLEAST16 "hX" -#define PRIoFAST16 "ho" -#define PRIuFAST16 "hu" -#define PRIxFAST16 "hx" -#define PRIXFAST16 "hX" - -#define PRIo32 "I32o" -#define PRIu32 "I32u" -#define PRIx32 "I32x" -#define PRIX32 "I32X" -#define PRIoLEAST32 "I32o" -#define PRIuLEAST32 "I32u" -#define PRIxLEAST32 "I32x" -#define PRIXLEAST32 "I32X" -#define PRIoFAST32 "I32o" -#define PRIuFAST32 "I32u" -#define PRIxFAST32 "I32x" -#define PRIXFAST32 "I32X" - -#define PRIo64 "I64o" -#define PRIu64 "I64u" -#define PRIx64 "I64x" -#define PRIX64 "I64X" -#define PRIoLEAST64 "I64o" -#define PRIuLEAST64 "I64u" -#define PRIxLEAST64 "I64x" -#define PRIXLEAST64 "I64X" -#define PRIoFAST64 "I64o" -#define PRIuFAST64 "I64u" -#define PRIxFAST64 "I64x" -#define PRIXFAST64 "I64X" - -#define PRIoMAX "I64o" -#define PRIuMAX "I64u" -#define PRIxMAX "I64x" -#define PRIXMAX "I64X" - -#define PRIoPTR "Io" -#define PRIuPTR "Iu" -#define PRIxPTR "Ix" -#define PRIXPTR "IX" - -// The fscanf macros for signed integers are: -#define SCNd8 "d" -#define SCNi8 "i" -#define SCNdLEAST8 "d" -#define SCNiLEAST8 "i" -#define SCNdFAST8 "d" -#define SCNiFAST8 "i" - -#define SCNd16 "hd" -#define SCNi16 "hi" -#define SCNdLEAST16 "hd" -#define SCNiLEAST16 "hi" -#define SCNdFAST16 "hd" -#define SCNiFAST16 "hi" - -#define SCNd32 "ld" -#define SCNi32 "li" -#define SCNdLEAST32 "ld" -#define SCNiLEAST32 "li" -#define SCNdFAST32 "ld" -#define SCNiFAST32 "li" - -#define SCNd64 "I64d" -#define SCNi64 "I64i" -#define SCNdLEAST64 "I64d" -#define SCNiLEAST64 "I64i" -#define SCNdFAST64 "I64d" -#define SCNiFAST64 "I64i" - -#define SCNdMAX "I64d" -#define SCNiMAX "I64i" - -#ifdef _WIN64 // [ -# define SCNdPTR "I64d" -# define SCNiPTR "I64i" -#else // _WIN64 ][ -# define SCNdPTR "ld" -# define SCNiPTR "li" -#endif // _WIN64 ] - -// The fscanf macros for unsigned integers are: -#define SCNo8 "o" -#define SCNu8 "u" -#define SCNx8 "x" -#define SCNX8 "X" -#define SCNoLEAST8 "o" -#define SCNuLEAST8 "u" -#define SCNxLEAST8 "x" -#define SCNXLEAST8 "X" -#define SCNoFAST8 "o" -#define SCNuFAST8 "u" -#define SCNxFAST8 "x" -#define SCNXFAST8 "X" - -#define SCNo16 "ho" -#define SCNu16 "hu" -#define SCNx16 "hx" -#define SCNX16 "hX" -#define SCNoLEAST16 "ho" -#define SCNuLEAST16 "hu" -#define SCNxLEAST16 "hx" -#define SCNXLEAST16 "hX" -#define SCNoFAST16 "ho" -#define SCNuFAST16 "hu" -#define SCNxFAST16 "hx" -#define SCNXFAST16 "hX" - -#define SCNo32 "lo" -#define SCNu32 "lu" -#define SCNx32 "lx" -#define SCNX32 "lX" -#define SCNoLEAST32 "lo" -#define SCNuLEAST32 "lu" -#define SCNxLEAST32 "lx" -#define SCNXLEAST32 "lX" -#define SCNoFAST32 "lo" -#define SCNuFAST32 "lu" -#define SCNxFAST32 "lx" -#define SCNXFAST32 "lX" - -#define SCNo64 "I64o" -#define SCNu64 "I64u" -#define SCNx64 "I64x" -#define SCNX64 "I64X" -#define SCNoLEAST64 "I64o" -#define SCNuLEAST64 "I64u" -#define SCNxLEAST64 "I64x" -#define SCNXLEAST64 "I64X" -#define SCNoFAST64 "I64o" -#define SCNuFAST64 "I64u" -#define SCNxFAST64 "I64x" -#define SCNXFAST64 "I64X" - -#define SCNoMAX "I64o" -#define SCNuMAX "I64u" -#define SCNxMAX "I64x" -#define SCNXMAX "I64X" - -#ifdef _WIN64 // [ -# define SCNoPTR "I64o" -# define SCNuPTR "I64u" -# define SCNxPTR "I64x" -# define SCNXPTR "I64X" -#else // _WIN64 ][ -# define SCNoPTR "lo" -# define SCNuPTR "lu" -# define SCNxPTR "lx" -# define SCNXPTR "lX" -#endif // _WIN64 ] - -#endif // __STDC_FORMAT_MACROS ] - -// 7.8.2 Functions for greatest-width integer types - -// 7.8.2.1 The imaxabs function -#define imaxabs _abs64 - -// 7.8.2.2 The imaxdiv function - -// This is modified version of div() function from Microsoft's div.c found -// in %MSVC.NET%\crt\src\div.c -#ifdef STATIC_IMAXDIV // [ -static -#else // STATIC_IMAXDIV ][ -_inline -#endif // STATIC_IMAXDIV ] -imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -{ - imaxdiv_t result; - - result.quot = numer / denom; - result.rem = numer % denom; - - if (numer < 0 && result.rem > 0) { - // did division wrong; must fix up - ++result.quot; - result.rem -= denom; - } - - return result; -} - -// 7.8.2.3 The strtoimax and strtoumax functions -#define strtoimax _strtoi64 -#define strtoumax _strtoui64 - -// 7.8.2.4 The wcstoimax and wcstoumax functions -#define wcstoimax _wcstoi64 -#define wcstoumax _wcstoui64 - - -#endif // _MSC_INTTYPES_H_ ] diff --git a/polymer-perf/eduke32/source/jaudiolib/include/msvc/stdint.h b/polymer-perf/eduke32/source/jaudiolib/include/msvc/stdint.h deleted file mode 100644 index 11d8dbfd5..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/include/msvc/stdint.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef short int16_t; - typedef int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/polymer-perf/eduke32/source/jaudiolib/include/music.h b/polymer-perf/eduke32/source/jaudiolib/include/music.h deleted file mode 100644 index 1d85f4284..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/include/music.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) -*/ -/********************************************************************** - module: MUSIC.H - - author: James R. Dose - date: March 25, 1994 - - Public header for MUSIC.C - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#ifndef __MUSIC_H -#define __MUSIC_H - -#include "compat.h" - -extern int32_t MUSIC_ErrorCode; - -enum MUSIC_ERRORS - { - MUSIC_Warning = -2, - MUSIC_Error = -1, - MUSIC_Ok = 0, - MUSIC_ASSVersion, - MUSIC_SoundCardError, - MUSIC_MPU401Error, - MUSIC_InvalidCard, - MUSIC_MidiError, - MUSIC_TaskManError, - MUSIC_DPMI_Error - }; - -typedef struct - { - uint32_t tickposition; - uint32_t milliseconds; - uint32_t measure; - uint32_t beat; - uint32_t tick; - } songposition; - -#define MUSIC_LoopSong ( 1 == 1 ) -#define MUSIC_PlayOnce ( !MUSIC_LoopSong ) - -char *MUSIC_ErrorString( int32_t ErrorNumber ); -int32_t MUSIC_Init( int32_t SoundCard, int32_t Address ); -int32_t MUSIC_Shutdown( void ); -void MUSIC_SetVolume( int32_t volume ); -void MUSIC_SetMidiChannelVolume( int32_t channel, int32_t volume ); -void MUSIC_ResetMidiChannelVolumes( void ); -int32_t MUSIC_GetVolume( void ); -void MUSIC_SetLoopFlag( int32_t loopflag ); -int32_t MUSIC_SongPlaying( void ); -void MUSIC_Continue( void ); -void MUSIC_Pause( void ); -int32_t MUSIC_StopSong( void ); -int32_t MUSIC_PlaySong( char *song, int32_t loopflag ); -void MUSIC_SetContext( int32_t context ); -int32_t MUSIC_GetContext( void ); -void MUSIC_SetSongTick( uint32_t PositionInTicks ); -void MUSIC_SetSongTime( uint32_t milliseconds ); -void MUSIC_SetSongPosition( int32_t measure, int32_t beat, int32_t tick ); -void MUSIC_GetSongPosition( songposition *pos ); -void MUSIC_GetSongLength( songposition *pos ); -int32_t MUSIC_FadeVolume( int32_t tovolume, int32_t milliseconds ); -int32_t MUSIC_FadeActive( void ); -void MUSIC_StopFade( void ); -void MUSIC_RerouteMidiChannel( int32_t channel, int32_t ( *function )( int32_t, int32_t, int32_t ) ); -void MUSIC_RegisterTimbreBank( char *timbres ); -void MUSIC_Update(void); - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/include/sndcards.h b/polymer-perf/eduke32/source/jaudiolib/include/sndcards.h deleted file mode 100644 index 100f2b416..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/include/sndcards.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - module: SNDCARDS.H - - author: James R. Dose - date: March 31, 1994 - - Contains enumerated type definitions for sound cards. - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#ifndef __SNDCARDS_H -#define __SNDCARDS_H - -#define ASS_VERSION_STRING "JonoF 20090718" - -typedef enum - { - ASS_NoSound, - ASS_SDL, - ASS_DirectSound, - ASS_NumSoundCards, - ASS_AutoDetect = -2 - } soundcardnames; - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/src/_multivc.h b/polymer-perf/eduke32/source/jaudiolib/src/_multivc.h deleted file mode 100644 index 8bd4f001a..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/_multivc.h +++ /dev/null @@ -1,303 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - file: _MULTIVC.H - - author: James R. Dose - date: December 20, 1993 - - Private header for MULTIVOC.C - - (c) Copyright 1993 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#include "limits.h" -#include "inttypes.h" - -#ifndef ___MULTIVC_H -#define ___MULTIVC_H - -#define TRUE ( 1 == 1 ) -#define FALSE ( !TRUE ) - -#define VOC_8BIT 0x0 -#define VOC_CT4_ADPCM 0x1 -#define VOC_CT3_ADPCM 0x2 -#define VOC_CT2_ADPCM 0x3 -#define VOC_16BIT 0x4 -#define VOC_ALAW 0x6 -#define VOC_MULAW 0x7 -#define VOC_CREATIVE_ADPCM 0x200 - -#define T_SIXTEENBIT_STEREO 0 -#define T_8BITS 1 -#define T_MONO 2 -#define T_16BITSOURCE 4 -#define T_STEREOSOURCE 8 -#define T_LEFTQUIET 16 -#define T_RIGHTQUIET 32 -#define T_DEFAULT T_SIXTEENBIT_STEREO - -#define MV_MaxPanPosition 127 -#define MV_NumPanPositions ( MV_MaxPanPosition + 1 ) -#define MV_MaxTotalVolume 255 -//#define MV_MaxVolume 63 -#define MV_NumVoices 8 - -// mirrors FX_MUSIC_PRIORITY from fx_man.h -#define MV_MUSIC_PRIORITY INT_MAX - -#define MIX_VOLUME( volume ) \ - ( ( max( 0, min( ( volume ), 255 ) ) * ( MV_MaxVolume + 1 ) ) >> 8 ) -// ( ( max( 0, min( ( volume ), 255 ) ) ) >> 2 ) - -#define STEREO 1 -#define SIXTEEN_BIT 2 - -#define MONO_8BIT 0 -#define STEREO_8BIT ( STEREO ) -#define MONO_16BIT ( SIXTEEN_BIT ) -#define STEREO_16BIT ( STEREO | SIXTEEN_BIT ) - -#define MONO_8BIT_SAMPLE_SIZE 1 -#define MONO_16BIT_SAMPLE_SIZE 2 -#define STEREO_8BIT_SAMPLE_SIZE ( 2 * MONO_8BIT_SAMPLE_SIZE ) -#define STEREO_16BIT_SAMPLE_SIZE ( 2 * MONO_16BIT_SAMPLE_SIZE ) - -//#define SILENCE_16BIT 0x80008000 -#define SILENCE_16BIT 0 -#define SILENCE_8BIT 0x80808080 -//#define SILENCE_16BIT_PAS 0 - -#define MixBufferSize 256 - -#define NumberOfBuffers 16 -#define TotalBufferSize ( MixBufferSize * NumberOfBuffers ) - -#define PI 3.1415926536 - -typedef enum - { - Raw, - VOC, - DemandFeed, - WAV, - Vorbis - } wavedata; - -typedef enum - { - NoMoreData, - KeepPlaying - } playbackstatus; - - -typedef struct VoiceNode - { - struct VoiceNode *next; - struct VoiceNode *prev; - - wavedata wavetype; - char bits; - char channels; - - playbackstatus ( *GetSound )( struct VoiceNode *voice ); - - void ( *mix )( uint32_t position, uint32_t rate, - char *start, uint32_t length ); - - char *NextBlock; - char *LoopStart; - char *LoopEnd; - unsigned LoopCount; - uint32_t LoopSize; - uint32_t BlockLength; - - uint32_t PitchScale; - uint32_t FixedPointBufferSize; - - char *sound; - uint32_t length; - uint32_t SamplingRate; - uint32_t RateScale; - uint32_t position; - int32_t Playing; - int32_t Paused; - - int32_t handle; - int32_t priority; - - void ( *DemandFeed )( char **ptr, uint32_t *length ); - void *extra; - - int16_t *LeftVolume; - int16_t *RightVolume; - - uint32_t callbackval; - - } VoiceNode; - -typedef struct - { - VoiceNode *start; - VoiceNode *end; - } VList; - -typedef struct - { - uint8_t left; - uint8_t right; - } Pan; - -typedef int16_t MONO16; -typedef int8_t MONO8; - -typedef struct - { - MONO16 left; - MONO16 right; -// uint16_t left; -// uint16_t right; - } STEREO16; - -typedef struct - { - MONO16 left; - MONO16 right; - } SIGNEDSTEREO16; - -typedef struct - { -// MONO8 left; -// MONO8 right; - char left; - char right; - } STEREO8; - -typedef struct - { - char RIFF[ 4 ]; - uint32_t file_size; - char WAVE[ 4 ]; - char fmt[ 4 ]; - uint32_t format_size; - } riff_header; - -typedef struct - { - uint16_t wFormatTag; - uint16_t nChannels; - uint32_t nSamplesPerSec; - uint32_t nAvgBytesPerSec; - uint16_t nBlockAlign; - uint16_t nBitsPerSample; - } format_header; - -typedef struct - { - uint8_t DATA[ 4 ]; - uint32_t size; - } data_header; - -typedef MONO8 VOLUME8[ 256 ]; -typedef MONO16 VOLUME16[ 256 ]; - -extern Pan MV_PanTable[ MV_NumPanPositions ][ 255 + 1 ]; -extern int32_t MV_ErrorCode; -extern int32_t MV_Installed; -extern int32_t MV_MaxVolume; -extern int32_t MV_MixRate; -typedef char HARSH_CLIP_TABLE_8[ MV_NumVoices * 256 ]; - -#define MV_SetErrorCode( status ) \ - MV_ErrorCode = ( status ); - -void MV_PlayVoice( VoiceNode *voice ); - -VoiceNode *MV_AllocVoice( int32_t priority ); - -void MV_SetVoiceMixMode( VoiceNode *voice ); -void MV_SetVoiceVolume ( VoiceNode *voice, int32_t vol, int32_t left, int32_t right ); - -void MV_ReleaseVorbisVoice( VoiceNode * voice ); - -// implemented in mix.c -void ClearBuffer_DW( void *ptr, unsigned data, int32_t length ); - -void MV_Mix8BitMono( uint32_t position, uint32_t rate, - char *start, uint32_t length ); - -void MV_Mix8BitStereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitMono( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitStereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitMono16( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix8BitMono16( uint32_t position, uint32_t rate, - char *start, uint32_t length ); - -void MV_Mix8BitStereo16( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitStereo16( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_16BitReverb( char *src, char *dest, VOLUME16 *volume, int32_t count ); - -void MV_8BitReverb( int8_t *src, int8_t *dest, VOLUME16 *volume, int32_t count ); - -void MV_16BitReverbFast( char *src, char *dest, int32_t count, int32_t shift ); - -void MV_8BitReverbFast( int8_t *src, int8_t *dest, int32_t count, int32_t shift ); - -// implemented in mixst.c -void ClearBuffer_DW( void *ptr, unsigned data, int32_t length ); - -void MV_Mix8BitMono8Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ); - -void MV_Mix8BitStereo8Stereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitMono8Stereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitStereo8Stereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitMono16Stereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix8BitMono16Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ); - -void MV_Mix8BitStereo16Stereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -void MV_Mix16BitStereo16Stereo( uint32_t position, - uint32_t rate, char *start, uint32_t length ); - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/src/driver_directsound.c b/polymer-perf/eduke32/source/jaudiolib/src/driver_directsound.c deleted file mode 100644 index 5051ecf4f..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/driver_directsound.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -/** - * DirectSound output driver for MultiVoc - */ - -#define WIN32_LEAN_AND_MEAN -#define DIRECTSOUND_VERSION 0x0700 -#include -#include -#include -#include -#include - -#include "driver_directsound.h" -#include "multivoc.h" - -enum { - DSErr_Warning = -2, - DSErr_Error = -1, - DSErr_Ok = 0, - DSErr_Uninitialised, - DSErr_DirectSoundCreate, - DSErr_SetCooperativeLevel, - DSErr_CreateSoundBuffer, - DSErr_CreateSoundBufferSecondary, - DSErr_SetFormat, - DSErr_SetFormatSecondary, - DSErr_Notify, - DSErr_NotifyEvents, - DSErr_SetNotificationPositions, - DSErr_Play, - DSErr_PlaySecondary, - DSErr_CreateThread, - DSErr_CreateMutex -}; - -static int32_t ErrorCode = DSErr_Ok; -static int32_t Initialised = 0; -static int32_t Playing = 0; - -static char *MixBuffer = 0; -static int32_t MixBufferSize = 0; -static int32_t MixBufferCount = 0; -static int32_t MixBufferCurrent = 0; -static int32_t MixBufferUsed = 0; -static void ( *MixCallBack )( void ) = 0; - -static LPDIRECTSOUND lpds = 0; -static LPDIRECTSOUNDBUFFER lpdsbprimary = 0, lpdsbsec = 0; -static LPDIRECTSOUNDNOTIFY lpdsnotify = 0; -static DSBPOSITIONNOTIFY notifyPositions[3] = { { 0,0 }, { 0,0 }, { 0,0 } }; -static HANDLE mixThread = 0; -static HANDLE mutex = 0; - - -static void FillBufferPortion(char * ptr, int32_t remaining) -{ - int32_t len = 0; - char *sptr; - - while (remaining >= len) { - if (MixBufferUsed == MixBufferSize) { - MixCallBack(); - - MixBufferUsed = 0; - MixBufferCurrent++; - if (MixBufferCurrent >= MixBufferCount) { - MixBufferCurrent -= MixBufferCount; - } - } - - while (remaining >= len && MixBufferUsed < MixBufferSize) { - sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed; - - len = MixBufferSize - MixBufferUsed; - if (remaining < len) { - len = remaining; - } - - memcpy(ptr, sptr, len); - - ptr += len; - MixBufferUsed += len; - remaining -= len; - } - } -} - -static void FillBuffer(int32_t bufnum) -{ - HRESULT err; - LPVOID ptr, ptr2; - DWORD remaining, remaining2; - int32_t retries = 1; - - //initprintf( "DirectSound FillBuffer: filling %d\n", bufnum); - - do { - err = IDirectSoundBuffer_Lock(lpdsbsec, - notifyPositions[bufnum].dwOffset, - notifyPositions[1].dwOffset, - &ptr, &remaining, - &ptr2, &remaining2, - 0); - if (FAILED(err)) { - if (err == DSERR_BUFFERLOST) { - err = IDirectSoundBuffer_Restore(lpdsbsec); - if (FAILED(err)) { - return; - } - - if (retries-- > 0) { - continue; - } - } - if (MV_Printf) - MV_Printf("DirectSound FillBuffer: err %x\n", (uint32_t) err); - return; - } - break; - } while (1); - - if (ptr) { - FillBufferPortion((char *) ptr, remaining); - } - if (ptr2) { - FillBufferPortion((char *) ptr2, remaining2); - } - - IDirectSoundBuffer_Unlock(lpdsbsec, ptr, remaining, ptr2, remaining2); -} - -static DWORD WINAPI fillDataThread(LPVOID lpParameter) -{ - DWORD waitret, waitret2; - HANDLE handles[] = { handles[0] = notifyPositions[0].hEventNotify, - handles[1] = notifyPositions[1].hEventNotify, - handles[2] = notifyPositions[2].hEventNotify }; - - UNREFERENCED_PARAMETER(lpParameter); - - do { - waitret = WaitForMultipleObjects(3, handles, FALSE, INFINITE); - switch (waitret) { - case WAIT_OBJECT_0: - case WAIT_OBJECT_0+1: - waitret2 = WaitForSingleObject(mutex, INFINITE); - if (waitret2 == WAIT_OBJECT_0) { - FillBuffer(WAIT_OBJECT_0 + 1 - waitret); - ReleaseMutex(mutex); - } else { - if (MV_Printf) - MV_Printf( "DirectSound fillDataThread: wfso err %d\n", (int32_t) waitret2); - } - break; - case WAIT_OBJECT_0+2: -// initprintf( "DirectSound fillDataThread: exiting\n"); - ExitThread(0); - break; - default: - if (MV_Printf) - MV_Printf( "DirectSound fillDataThread: wfmo err %d\n", (int32_t) waitret); - break; - } - } while (1); - - return 0; -} - - -int32_t DirectSoundDrv_GetError(void) -{ - return ErrorCode; -} - -const char *DirectSoundDrv_ErrorString( int32_t ErrorNumber ) -{ - const char *ErrorString; - - switch( ErrorNumber ) - { - case DSErr_Warning : - case DSErr_Error : - ErrorString = DirectSoundDrv_ErrorString( ErrorCode ); - break; - - case DSErr_Ok : - ErrorString = "DirectSound ok."; - break; - - case DSErr_Uninitialised: - ErrorString = "DirectSound uninitialised."; - break; - - case DSErr_DirectSoundCreate: - ErrorString = "DirectSound error: DirectSoundCreate failed."; - break; - - case DSErr_SetCooperativeLevel: - ErrorString = "DirectSound error: SetCooperativeLevel failed."; - break; - - case DSErr_CreateSoundBuffer: - ErrorString = "DirectSound error: primary CreateSoundBuffer failed."; - break; - - case DSErr_CreateSoundBufferSecondary: - ErrorString = "DirectSound error: secondary CreateSoundBuffer failed."; - break; - - case DSErr_SetFormat: - ErrorString = "DirectSound error: primary buffer SetFormat failed."; - break; - - case DSErr_SetFormatSecondary: - ErrorString = "DirectSound error: secondary buffer SetFormat failed."; - break; - - case DSErr_Notify: - ErrorString = "DirectSound error: failed querying secondary buffer for notify interface."; - break; - - case DSErr_NotifyEvents: - ErrorString = "DirectSound error: failed creating notify events."; - break; - - case DSErr_SetNotificationPositions: - ErrorString = "DirectSound error: failed setting notification positions."; - break; - - case DSErr_Play: - ErrorString = "DirectSound error: primary buffer Play failed."; - break; - - case DSErr_PlaySecondary: - ErrorString = "DirectSound error: secondary buffer Play failed."; - break; - - case DSErr_CreateThread: - ErrorString = "DirectSound error: failed creating mix thread."; - break; - - case DSErr_CreateMutex: - ErrorString = "DirectSound error: failed creating mix mutex."; - break; - - default: - ErrorString = "Unknown DirectSound error code."; - break; - } - - return ErrorString; - -} - - -static void TeardownDSound(HRESULT err) -{ - if (FAILED(err)) { - if (MV_Printf) - MV_Printf( "Dying error: %x\n", (uint32_t) err); - } - - if (lpdsnotify) IDirectSoundNotify_Release(lpdsnotify); - if (notifyPositions[0].hEventNotify) CloseHandle(notifyPositions[0].hEventNotify); - if (notifyPositions[1].hEventNotify) CloseHandle(notifyPositions[1].hEventNotify); - if (notifyPositions[2].hEventNotify) CloseHandle(notifyPositions[2].hEventNotify); - if (mutex) CloseHandle(mutex); - if (lpdsbsec) IDirectSoundBuffer_Release(lpdsbsec); - if (lpdsbprimary) IDirectSoundBuffer_Release(lpdsbprimary); - if (lpds) IDirectSound_Release(lpds); - notifyPositions[0].hEventNotify = - notifyPositions[1].hEventNotify = - notifyPositions[2].hEventNotify = 0; - mutex = 0; - lpdsnotify = 0; - lpdsbsec = 0; - lpdsbprimary = 0; - lpds = 0; -} - -int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata) -{ - HRESULT err; - DSBUFFERDESC bufdesc; - WAVEFORMATEX wfex; - - if (Initialised) { - DirectSoundDrv_PCM_Shutdown(); - } - - err = DirectSoundCreate(0, &lpds, 0); - if (FAILED( err )) { - ErrorCode = DSErr_DirectSoundCreate; - return DSErr_Error; - } - - err = IDirectSound_SetCooperativeLevel(lpds, (HWND) initdata, DSSCL_PRIORITY); - if (FAILED( err )) { - TeardownDSound(err); - ErrorCode = DSErr_SetCooperativeLevel; - return DSErr_Error; - } - - memset(&bufdesc, 0, sizeof(DSBUFFERDESC)); - bufdesc.dwSize = sizeof(DSBUFFERDESC); - bufdesc.dwFlags = DSBCAPS_LOCSOFTWARE | - DSBCAPS_PRIMARYBUFFER | - DSBCAPS_GETCURRENTPOSITION2 | - DSBCAPS_STICKYFOCUS ; - - err = IDirectSound_CreateSoundBuffer(lpds, &bufdesc, &lpdsbprimary, 0); - if (FAILED( err )) { - TeardownDSound(err); - ErrorCode = DSErr_CreateSoundBuffer; - return DSErr_Error; - } - - memset(&wfex, 0, sizeof(WAVEFORMATEX)); - wfex.wFormatTag = WAVE_FORMAT_PCM; - wfex.nChannels = *numchannels; - wfex.nSamplesPerSec = *mixrate; - wfex.wBitsPerSample = *samplebits; - wfex.nBlockAlign = wfex.nChannels * wfex.wBitsPerSample / 8; - wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign; - - err = IDirectSoundBuffer_SetFormat(lpdsbprimary, &wfex); - if (FAILED( err )) { - TeardownDSound(err); - ErrorCode = DSErr_SetFormat; - return DSErr_Error; - } - - bufdesc.dwFlags = DSBCAPS_LOCSOFTWARE | - DSBCAPS_CTRLPOSITIONNOTIFY | - DSBCAPS_GETCURRENTPOSITION2 | - DSBCAPS_STICKYFOCUS ; - bufdesc.dwBufferBytes = wfex.nBlockAlign * 2560 * 2; - bufdesc.lpwfxFormat = &wfex; - - err = IDirectSound_CreateSoundBuffer(lpds, &bufdesc, &lpdsbsec, 0); - if (FAILED( err )) { - TeardownDSound(err); - ErrorCode = DSErr_SetFormatSecondary; - return DSErr_Error; - } - - err = IDirectSoundBuffer_QueryInterface(lpdsbsec, &IID_IDirectSoundNotify, - (LPVOID *) &lpdsnotify); - if (FAILED( err )) { - TeardownDSound(err); - ErrorCode = DSErr_Notify; - return DSErr_Error; - } - - notifyPositions[0].dwOffset = 0; - notifyPositions[0].hEventNotify = CreateEvent(NULL, FALSE, FALSE, NULL); - notifyPositions[1].dwOffset = bufdesc.dwBufferBytes / 2; - notifyPositions[1].hEventNotify = CreateEvent(NULL, FALSE, FALSE, NULL); - notifyPositions[2].dwOffset = DSBPN_OFFSETSTOP; - notifyPositions[2].hEventNotify = CreateEvent(NULL, FALSE, FALSE, NULL); - if (!notifyPositions[0].hEventNotify || - !notifyPositions[1].hEventNotify || - !notifyPositions[2].hEventNotify) { - TeardownDSound(DS_OK); - ErrorCode = DSErr_NotifyEvents; - return DSErr_Error; - } - - err = IDirectSoundNotify_SetNotificationPositions(lpdsnotify, 3, notifyPositions); - if (FAILED( err )) { - TeardownDSound(err); - ErrorCode = DSErr_SetNotificationPositions; - return DSErr_Error; - } - - err = IDirectSoundBuffer_Play(lpdsbprimary, 0, 0, DSBPLAY_LOOPING); - if (FAILED( err )) { - TeardownDSound(err); - ErrorCode = DSErr_Play; - return DSErr_Error; - } - - mutex = CreateMutex(0, FALSE, 0); - if (!mutex) { - TeardownDSound(DS_OK); - ErrorCode = DSErr_CreateMutex; - return DSErr_Error; - } - - Initialised = 1; - -// initprintf("DirectSound Init: yay\n"); - - return DSErr_Ok; -} - -void DirectSoundDrv_PCM_Shutdown(void) -{ - if (!Initialised) { - return; - } - - DirectSoundDrv_PCM_StopPlayback(); - - TeardownDSound(DS_OK); - - Initialised = 0; -} - -int32_t DirectSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize, - int32_t NumDivisions, void ( *CallBackFunc )( void ) ) -{ - HRESULT err; - - if (!Initialised) { - ErrorCode = DSErr_Uninitialised; - return DSErr_Error; - } - - DirectSoundDrv_PCM_StopPlayback(); - - MixBuffer = BufferStart; - MixBufferSize = BufferSize; - MixBufferCount = NumDivisions; - MixBufferCurrent = 0; - MixBufferUsed = 0; - MixCallBack = CallBackFunc; - - // prime the buffer - FillBuffer(0); - - mixThread = CreateThread(NULL, 0, fillDataThread, 0, 0, 0); - if (!mixThread) { - ErrorCode = DSErr_CreateThread; - return DSErr_Error; - } - - SetThreadPriority(mixThread, THREAD_PRIORITY_ABOVE_NORMAL); - - err = IDirectSoundBuffer_Play(lpdsbsec, 0, 0, DSBPLAY_LOOPING); - if (FAILED( err )) { - ErrorCode = DSErr_PlaySecondary; - return DSErr_Error; - } - - Playing = 1; - - return DSErr_Ok; -} - -void DirectSoundDrv_PCM_StopPlayback(void) -{ - if (!Playing) { - return; - } - - IDirectSoundBuffer_Stop(lpdsbsec); - IDirectSoundBuffer_SetCurrentPosition(lpdsbsec, 0); - - Playing = 0; -} - -void DirectSoundDrv_PCM_Lock(void) -{ - DWORD err; - - err = WaitForSingleObject(mutex, INFINITE); - if (err != WAIT_OBJECT_0) { - if (MV_Printf) - MV_Printf( "DirectSound lock: wfso %d\n", (int32_t) err); - } -} - -void DirectSoundDrv_PCM_Unlock(void) -{ - ReleaseMutex(mutex); -} diff --git a/polymer-perf/eduke32/source/jaudiolib/src/driver_directsound.h b/polymer-perf/eduke32/source/jaudiolib/src/driver_directsound.h deleted file mode 100644 index 9d7d50737..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/driver_directsound.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -#include "inttypes.h" - -int32_t DirectSoundDrv_GetError(void); -const char *DirectSoundDrv_ErrorString( int32_t ErrorNumber ); -int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata); -void DirectSoundDrv_PCM_Shutdown(void); -int32_t DirectSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize, - int32_t NumDivisions, void ( *CallBackFunc )( void ) ); -void DirectSoundDrv_PCM_StopPlayback(void); -void DirectSoundDrv_PCM_Lock(void); -void DirectSoundDrv_PCM_Unlock(void); diff --git a/polymer-perf/eduke32/source/jaudiolib/src/driver_nosound.c b/polymer-perf/eduke32/source/jaudiolib/src/driver_nosound.c deleted file mode 100644 index 638f8d5c5..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/driver_nosound.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -/** - * Stub driver for no output - */ - -#include "inttypes.h" - -#ifndef UNREFERENCED_PARAMETER -# define UNREFERENCED_PARAMETER(x) x=x -#endif - - -int32_t NoSoundDrv_GetError(void) -{ - return 0; -} - -const char *NoSoundDrv_ErrorString( int32_t ErrorNumber ) -{ - UNREFERENCED_PARAMETER(ErrorNumber); - return "No sound, Ok."; -} - -int32_t NoSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata) -{ - UNREFERENCED_PARAMETER(mixrate); - UNREFERENCED_PARAMETER(numchannels); - UNREFERENCED_PARAMETER(samplebits); - UNREFERENCED_PARAMETER(initdata); - return 0; -} - -void NoSoundDrv_PCM_Shutdown(void) -{ -} - -int32_t NoSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize, - int32_t NumDivisions, void ( *CallBackFunc )( void ) ) -{ - UNREFERENCED_PARAMETER(BufferStart); - UNREFERENCED_PARAMETER(BufferSize); - UNREFERENCED_PARAMETER(NumDivisions); - UNREFERENCED_PARAMETER(CallBackFunc); - return 0; -} - -void NoSoundDrv_PCM_StopPlayback(void) -{ -} - -void NoSoundDrv_PCM_Lock(void) -{ -} - -void NoSoundDrv_PCM_Unlock(void) -{ -} diff --git a/polymer-perf/eduke32/source/jaudiolib/src/driver_nosound.h b/polymer-perf/eduke32/source/jaudiolib/src/driver_nosound.h deleted file mode 100644 index 5555cbfc7..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/driver_nosound.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - - -int NoSoundDrv_GetError(void); -const char *NoSoundDrv_ErrorString( int ErrorNumber ); -int NoSoundDrv_PCM_Init(int *mixrate, int *numchannels, int *samplebits, void * initdata); -void NoSoundDrv_PCM_Shutdown(void); -int NoSoundDrv_PCM_BeginPlayback(char *BufferStart, int BufferSize, - int NumDivisions, void ( *CallBackFunc )( void ) ); -void NoSoundDrv_PCM_StopPlayback(void); -void NoSoundDrv_PCM_Lock(void); -void NoSoundDrv_PCM_Unlock(void); diff --git a/polymer-perf/eduke32/source/jaudiolib/src/driver_sdl.c b/polymer-perf/eduke32/source/jaudiolib/src/driver_sdl.c deleted file mode 100644 index 07940053d..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/driver_sdl.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -/** - * libSDL output driver for MultiVoc - */ - - -#include -#if defined(SDL_FRAMEWORK) -# include -#else -# include -#endif -#include -#include "driver_sdl.h" - -#ifndef UNREFERENCED_PARAMETER -#define UNREFERENCED_PARAMETER(P) (P)=(P) -#endif - -enum { - SDLErr_Warning = -2, - SDLErr_Error = -1, - SDLErr_Ok = 0, - SDLErr_Uninitialised, - SDLErr_InitSubSystem, - SDLErr_OpenAudio -}; - -static int32_t ErrorCode = SDLErr_Ok; -static int32_t Initialised = 0; -static int32_t Playing = 0; -// static int32_t StartedSDL = -1; - -static char *MixBuffer = 0; -static int32_t MixBufferSize = 0; -static int32_t MixBufferCount = 0; -static int32_t MixBufferCurrent = 0; -static int32_t MixBufferUsed = 0; -static void ( *MixCallBack )( void ) = 0; - -static Mix_Chunk *DummyChunk = NULL; -static uint8_t *DummyBuffer = NULL; -static int32_t InterruptsDisabled = 0; -static SDL_mutex *EffectFence; - -static void fillData(int32_t chan, void *ptr, int32_t remaining, void *udata) -{ - int32_t len; - char *sptr; - - UNREFERENCED_PARAMETER(chan); - UNREFERENCED_PARAMETER(udata); - - if (!MixBuffer || !MixCallBack) - return; - - SDL_LockMutex(EffectFence); - - while (remaining > 0) { - if (MixBufferUsed == MixBufferSize) { - MixCallBack(); - - MixBufferUsed = 0; - MixBufferCurrent++; - if (MixBufferCurrent >= MixBufferCount) { - MixBufferCurrent -= MixBufferCount; - } - } - - while (remaining > 0 && MixBufferUsed < MixBufferSize) { - sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed; - - len = MixBufferSize - MixBufferUsed; - if (remaining < len) { - len = remaining; - } - - memcpy(ptr, sptr, len); - - ptr += len; - MixBufferUsed += len; - remaining -= len; - } - } - - SDL_UnlockMutex(EffectFence); -} - - -int32_t SDLDrv_GetError(void) -{ - return ErrorCode; -} - -const char *SDLDrv_ErrorString( int32_t ErrorNumber ) -{ - const char *ErrorString; - - switch( ErrorNumber ) { - case SDLErr_Warning : - case SDLErr_Error : - ErrorString = SDLDrv_ErrorString( ErrorCode ); - break; - - case SDLErr_Ok : - ErrorString = "SDL Audio ok."; - break; - - case SDLErr_Uninitialised: - ErrorString = "SDL Audio uninitialised."; - break; - - case SDLErr_InitSubSystem: - ErrorString = "SDL Audio: error in Init or InitSubSystem."; - break; - - case SDLErr_OpenAudio: - ErrorString = "SDL Audio: error in OpenAudio."; - break; - - default: - ErrorString = "Unknown SDL Audio error code."; - break; - } - - return ErrorString; -} - -int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata) -{ - int32_t err = 0; - int32_t chunksize; - uint16_t fmt; - - UNREFERENCED_PARAMETER(numchannels); - UNREFERENCED_PARAMETER(initdata); - - if (Initialised) { - SDLDrv_PCM_Shutdown(); - } - - chunksize = 512; - - if (*mixrate >= 16000) chunksize *= 2; - if (*mixrate >= 32000) chunksize *= 2; - - err = Mix_OpenAudio(*mixrate, (*samplebits == 8) ? AUDIO_U8 : AUDIO_S16SYS, *numchannels, chunksize); - - if (err < 0) { - ErrorCode = SDLErr_OpenAudio; - return SDLErr_Error; - } - - if (Mix_QuerySpec(mixrate, &fmt, numchannels)) - { - if (fmt == AUDIO_U8 || fmt == AUDIO_S8) *samplebits = 8; - else *samplebits = 16; - } - - //Mix_SetPostMix(fillData, NULL); - - EffectFence = SDL_CreateMutex(); - - // channel 0 and 1 are actual sounds - // dummy channel 2 runs our fillData() callback as an effect - Mix_RegisterEffect(2, fillData, NULL, NULL); - - DummyBuffer = (uint8_t *) malloc(chunksize); - memset(DummyBuffer, 0, chunksize); - - DummyChunk = Mix_QuickLoad_RAW(DummyBuffer, chunksize); - - Mix_PlayChannel(2, DummyChunk, -1); - - Initialised = 1; - - return SDLErr_Ok; -} - -void SDLDrv_PCM_Shutdown(void) -{ - if (!Initialised) - return; - else Mix_HaltChannel(-1); - - if (DummyChunk != NULL) - { - Mix_FreeChunk(DummyChunk); - DummyChunk = NULL; - } - - if (DummyBuffer != NULL) - { - free(DummyBuffer); - DummyBuffer = NULL; - } - - Mix_CloseAudio(); - - SDL_DestroyMutex(EffectFence); - - Initialised = 0; -} - -int32_t SDLDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize, - int32_t NumDivisions, void ( *CallBackFunc )( void ) ) -{ - if (!Initialised) { - ErrorCode = SDLErr_Uninitialised; - return SDLErr_Error; - } - - if (Playing) { - SDLDrv_PCM_StopPlayback(); - } - - MixBuffer = BufferStart; - MixBufferSize = BufferSize; - MixBufferCount = NumDivisions; - MixBufferCurrent = 0; - MixBufferUsed = 0; - MixCallBack = CallBackFunc; - - // prime the buffer - MixCallBack(); - - Mix_Resume(-1); - - Playing = 1; - - return SDLErr_Ok; -} - -void SDLDrv_PCM_StopPlayback(void) -{ - if (!Initialised || !Playing) { - return; - } - - Mix_Pause(-1); - - Playing = 0; -} - -void SDLDrv_PCM_Lock(void) -{ - if (InterruptsDisabled++) - return; - - SDL_LockMutex(EffectFence); -} - -void SDLDrv_PCM_Unlock(void) -{ - if (--InterruptsDisabled) - return; - - SDL_UnlockMutex(EffectFence); -} - diff --git a/polymer-perf/eduke32/source/jaudiolib/src/driver_sdl.h b/polymer-perf/eduke32/source/jaudiolib/src/driver_sdl.h deleted file mode 100644 index 9ea19e97d..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/driver_sdl.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - - -int32_t SDLDrv_GetError(void); -const char *SDLDrv_ErrorString( int32_t ErrorNumber ); -int32_t SDLDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata); -void SDLDrv_PCM_Shutdown(void); -int32_t SDLDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize, - int32_t NumDivisions, void ( *CallBackFunc )( void ) ); -void SDLDrv_PCM_StopPlayback(void); -void SDLDrv_PCM_Lock(void); -void SDLDrv_PCM_Unlock(void); diff --git a/polymer-perf/eduke32/source/jaudiolib/src/drivers.c b/polymer-perf/eduke32/source/jaudiolib/src/drivers.c deleted file mode 100644 index 7b1e645b4..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/drivers.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -/** - * Abstraction layer for hiding the various supported sound devices - * behind a common and opaque interface called on by MultiVoc. - */ - -#include "drivers.h" - -#include "driver_nosound.h" - -#ifdef HAVE_SDL -# include "driver_sdl.h" -#endif - -#ifdef WIN32 -# include "driver_directsound.h" -#endif - -int32_t ASS_SoundDriver = -1; - -#define UNSUPPORTED { 0,0,0,0,0,0,0,0, }, - -static struct { - int32_t (* GetError)(void); - const char * (* ErrorString)(int32_t); - int32_t (* Init)(int32_t *, int32_t *, int32_t *, void *); - void (* Shutdown)(void); - int32_t (* BeginPlayback)(char *, int32_t, int32_t, void ( * )(void) ); - void (* StopPlayback)(void); - void (* Lock)(void); - void (* Unlock)(void); -} SoundDrivers[ASS_NumSoundCards] = { - - // Everyone gets the "no sound" driver - { - NoSoundDrv_GetError, - NoSoundDrv_ErrorString, - NoSoundDrv_PCM_Init, - NoSoundDrv_PCM_Shutdown, - NoSoundDrv_PCM_BeginPlayback, - NoSoundDrv_PCM_StopPlayback, - NoSoundDrv_PCM_Lock, - NoSoundDrv_PCM_Unlock, - }, - - // Simple DirectMedia Layer - #ifdef HAVE_SDL - { - SDLDrv_GetError, - SDLDrv_ErrorString, - SDLDrv_PCM_Init, - SDLDrv_PCM_Shutdown, - SDLDrv_PCM_BeginPlayback, - SDLDrv_PCM_StopPlayback, - SDLDrv_PCM_Lock, - SDLDrv_PCM_Unlock, - }, - #else - UNSUPPORTED - #endif - - // Windows DirectSound - #ifdef WIN32 - { - DirectSoundDrv_GetError, - DirectSoundDrv_ErrorString, - DirectSoundDrv_PCM_Init, - DirectSoundDrv_PCM_Shutdown, - DirectSoundDrv_PCM_BeginPlayback, - DirectSoundDrv_PCM_StopPlayback, - DirectSoundDrv_PCM_Lock, - DirectSoundDrv_PCM_Unlock, - }, - #else - UNSUPPORTED - #endif -}; - - -int32_t SoundDriver_IsSupported(int32_t driver) -{ - return (SoundDrivers[driver].GetError != 0); -} - - -int32_t SoundDriver_GetError(void) -{ - if (!SoundDriver_IsSupported(ASS_SoundDriver)) { - return -1; - } - return SoundDrivers[ASS_SoundDriver].GetError(); -} - -const char * SoundDriver_ErrorString( int32_t ErrorNumber ) -{ - if (ASS_SoundDriver < 0 || ASS_SoundDriver >= ASS_NumSoundCards) { - return "No sound driver selected."; - } - if (!SoundDriver_IsSupported(ASS_SoundDriver)) { - return "Unsupported sound driver selected."; - } - return SoundDrivers[ASS_SoundDriver].ErrorString(ErrorNumber); -} - -int32_t SoundDriver_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata) -{ - return SoundDrivers[ASS_SoundDriver].Init(mixrate, numchannels, samplebits, initdata); -} - -void SoundDriver_Shutdown(void) -{ - SoundDrivers[ASS_SoundDriver].Shutdown(); -} - -int32_t SoundDriver_BeginPlayback(char *BufferStart, int32_t BufferSize, - int32_t NumDivisions, void ( *CallBackFunc )( void ) ) -{ - return SoundDrivers[ASS_SoundDriver].BeginPlayback(BufferStart, - BufferSize, NumDivisions, CallBackFunc); -} - -void SoundDriver_StopPlayback(void) -{ - SoundDrivers[ASS_SoundDriver].StopPlayback(); -} - -void SoundDriver_Lock(void) -{ - SoundDrivers[ASS_SoundDriver].Lock(); -} - -void SoundDriver_Unlock(void) -{ - SoundDrivers[ASS_SoundDriver].Unlock(); -} diff --git a/polymer-perf/eduke32/source/jaudiolib/src/drivers.h b/polymer-perf/eduke32/source/jaudiolib/src/drivers.h deleted file mode 100644 index bc0bd3b39..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/drivers.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -#ifndef DRIVERS_H -#define DRIVERS_H - -#include "inttypes.h" -#include "sndcards.h" - -extern int32_t ASS_SoundDriver; - -int32_t SoundDriver_IsSupported(int32_t driver); - -int32_t SoundDriver_GetError(void); -const char * SoundDriver_ErrorString( int32_t ErrorNumber ); -int32_t SoundDriver_Init(int32_t *mixrate, int32_t *numchannels, int32_t *samplebits, void * initdata); -void SoundDriver_Shutdown(void); -int32_t SoundDriver_BeginPlayback( char *BufferStart, - int32_t BufferSize, int32_t NumDivisions, - void ( *CallBackFunc )( void ) ); -void SoundDriver_StopPlayback(void); -void SoundDriver_Lock(void); -void SoundDriver_Unlock(void); - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/src/fx_man.c b/polymer-perf/eduke32/source/jaudiolib/src/fx_man.c deleted file mode 100644 index f57b0e8f7..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/fx_man.c +++ /dev/null @@ -1,1075 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - module: FX_MAN.C - - author: James R. Dose - date: March 17, 1994 - - Device independant sound effect routines. - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#include -#include -#include -#include "sndcards.h" -#include "drivers.h" -#include "multivoc.h" -#include "fx_man.h" - -#ifdef __POWERPC__ -static inline uint16_t SWAP16(uint16_t s) -{ - return (s >> 8) | (s << 8); -} - -static inline uint32_t SWAP32(uint32_t s) -{ - return (s >> 24) | (s << 24) | ((s&0xff00) << 8) | ((s & 0xff0000) >> 8); -} - -#define LITTLE16 SWAP16 -#define LITTLE32 SWAP32 -#else -#define LITTLE16 -#define LITTLE32 -#endif - -#define TRUE ( 1 == 1 ) -#define FALSE ( !TRUE ) - -int32_t FX_ErrorCode = FX_Ok; -int32_t FX_Installed = FALSE; - -#define FX_SetErrorCode( status ) \ - FX_ErrorCode = ( status ); - - -/*--------------------------------------------------------------------- - Function: FX_ErrorString - - Returns a pointer to the error message associated with an error - number. A -1 returns a pointer the current error. ----------------------------------------------------------------------*/ - -const char *FX_ErrorString -( - int32_t ErrorNumber -) - -{ - const char *ErrorString; - - switch (ErrorNumber) - { - case FX_Warning : - case FX_Error : - ErrorString = FX_ErrorString(FX_ErrorCode); - break; - - case FX_Ok : - ErrorString = "Fx ok."; - break; - - case FX_ASSVersion : - ErrorString = "Apogee Sound System Version " ASS_VERSION_STRING " " - "Programmed by Jim Dose\n" - "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n"; - break; - - case FX_SoundCardError : - ErrorString = SoundDriver_ErrorString(SoundDriver_GetError()); - break; - - case FX_InvalidCard : - ErrorString = "Invalid Sound Fx device."; - break; - - case FX_MultiVocError : - ErrorString = MV_ErrorString(MV_Error); - break; - - default : - ErrorString = "Unknown Fx error code."; - break; - } - - return(ErrorString); -} - - -/*--------------------------------------------------------------------- - Function: FX_Init - - Selects which sound device to use. ----------------------------------------------------------------------*/ - -int32_t FX_Init -( - int32_t SoundCard, - int32_t numvoices, - int32_t numchannels, - int32_t samplebits, - unsigned mixrate, - void * initdata -) - -{ - int32_t status; - int32_t devicestatus; - - if (FX_Installed) - { - FX_Shutdown(); - } - - if (SoundCard == ASS_AutoDetect) - { -#if defined WIN32 - SoundCard = ASS_DirectSound; -#elif defined HAVE_SDL - SoundCard = ASS_SDL; -#else - SoundCard = ASS_NoSound; -#endif - } - - if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards) - { - FX_SetErrorCode(FX_InvalidCard); - status = FX_Error; - return status; - } - - if (SoundDriver_IsSupported(SoundCard) == 0) - { - // unsupported cards fall back to no sound - SoundCard = ASS_NoSound; - } - - status = FX_Ok; - devicestatus = MV_Init(SoundCard, mixrate, numvoices, numchannels, samplebits, initdata); - if (devicestatus != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Error; - } - - if (status == FX_Ok) - { - FX_Installed = TRUE; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_Shutdown - - Terminates use of sound device. ----------------------------------------------------------------------*/ - -int32_t FX_Shutdown -( - void -) - -{ - int32_t status; - - if (!FX_Installed) - { - return(FX_Ok); - } - - status = MV_Shutdown(); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Error; - } - - FX_Installed = FALSE; - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetCallback - - Sets the function to call when a voice is done. ----------------------------------------------------------------------*/ - -int32_t FX_SetCallBack -( - void (*function)(uint32_t) -) - -{ - int32_t status; - - status = FX_Ok; - - MV_SetCallBack(function); - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetVolume - - Sets the volume of the current sound device. ----------------------------------------------------------------------*/ - -void FX_SetVolume -( - int32_t volume -) - -{ - MV_SetVolume(volume); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetVolume - - Returns the volume of the current sound device. ----------------------------------------------------------------------*/ - -int32_t FX_GetVolume -( - void -) - -{ - int32_t volume; - - volume = MV_GetVolume(); - - return(volume); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverseStereo - - Set the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -void FX_SetReverseStereo -( - int32_t setting -) - -{ - MV_SetReverseStereo(setting); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetReverseStereo - - Returns the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -int32_t FX_GetReverseStereo -( - void -) - -{ - return MV_GetReverseStereo(); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverb - - Sets the reverb level. ----------------------------------------------------------------------*/ - -void FX_SetReverb -( - int32_t reverb -) - -{ - MV_SetReverb(reverb); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetFastReverb - - Sets the reverb level. ----------------------------------------------------------------------*/ - -void FX_SetFastReverb -( - int32_t reverb -) - -{ - MV_SetFastReverb(reverb); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetMaxReverbDelay - - Returns the maximum delay time for reverb. ----------------------------------------------------------------------*/ - -int32_t FX_GetMaxReverbDelay -( - void -) - -{ - return MV_GetMaxReverbDelay(); -} - - -/*--------------------------------------------------------------------- - Function: FX_GetReverbDelay - - Returns the current delay time for reverb. ----------------------------------------------------------------------*/ - -int32_t FX_GetReverbDelay -( - void -) - -{ - return MV_GetReverbDelay(); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetReverbDelay - - Sets the delay level of reverb to add to mix. ----------------------------------------------------------------------*/ - -void FX_SetReverbDelay -( - int32_t delay -) - -{ - MV_SetReverbDelay(delay); -} - - -/*--------------------------------------------------------------------- - Function: FX_VoiceAvailable - - Checks if a voice can be play at the specified priority. ----------------------------------------------------------------------*/ - -int32_t FX_VoiceAvailable -( - int32_t priority -) - -{ - return MV_VoiceAvailable(priority); -} - -/*--------------------------------------------------------------------- -Function: FX_PauseVoice - -Stops the voice associated with the specified handle from looping -without stoping the sound. ----------------------------------------------------------------------*/ - -int32_t FX_PauseVoice -( - int32_t handle, - int32_t pause -) - -{ - int32_t status; - - status = MV_PauseVoice(handle, pause); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_EndLooping - - Stops the voice associated with the specified handle from looping - without stoping the sound. ----------------------------------------------------------------------*/ - -int32_t FX_EndLooping -( - int32_t handle -) - -{ - int32_t status; - - status = MV_EndLooping(handle); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - -/*--------------------------------------------------------------------- - Function: FX_SetPan - - Sets the stereo and mono volume level of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -int32_t FX_SetPan -( - int32_t handle, - int32_t vol, - int32_t left, - int32_t right -) - -{ - int32_t status; - - status = MV_SetPan(handle, vol, left, right); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetPitch - - Sets the pitch of the voice associated with the specified handle. ----------------------------------------------------------------------*/ - -int32_t FX_SetPitch -( - int32_t handle, - int32_t pitchoffset -) - -{ - int32_t status; - - status = MV_SetPitch(handle, pitchoffset); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SetFrequency - - Sets the frequency of the voice associated with the specified handle. ----------------------------------------------------------------------*/ - -int32_t FX_SetFrequency -( - int32_t handle, - int32_t frequency -) - -{ - int32_t status; - - status = MV_SetFrequency(handle, frequency); - if (status == MV_Error) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayVOC - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int32_t FX_PlayVOC -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayVOC(ptr, ptrlength, pitchoffset, vol, left, right, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayLoopedVOC - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int32_t FX_PlayLoopedVOC -( - char *ptr, - uint32_t ptrlength, - int32_t loopstart, - int32_t loopend, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayLoopedVOC(ptr, ptrlength, loopstart, loopend, pitchoffset, - vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int32_t FX_PlayWAV -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayWAV(ptr, ptrlength, pitchoffset, vol, left, right, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV - - Begin playback of sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int32_t FX_PlayLoopedWAV -( - char *ptr, - uint32_t ptrlength, - int32_t loopstart, - int32_t loopend, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayLoopedWAV(ptr, ptrlength, loopstart, loopend, - pitchoffset, vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayVOC3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int32_t FX_PlayVOC3D -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t angle, - int32_t distance, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayVOC3D(ptr, ptrlength, pitchoffset, angle, distance, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayWAV3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int32_t FX_PlayWAV3D -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t angle, - int32_t distance, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayWAV3D(ptr, ptrlength, pitchoffset, angle, distance, - priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayRaw - - Begin playback of raw sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int32_t FX_PlayRaw -( - char *ptr, - uint32_t length, - unsigned rate, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayRaw(ptr, length, rate, pitchoffset, - vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayLoopedRaw - - Begin playback of raw sound data with the given volume and priority. ----------------------------------------------------------------------*/ - -int32_t FX_PlayLoopedRaw -( - char *ptr, - uint32_t length, - char *loopstart, - char *loopend, - unsigned rate, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_PlayLoopedRaw(ptr, length, loopstart, loopend, - rate, pitchoffset, vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_Pan3D - - Set the angle and distance from the listener of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -int32_t FX_Pan3D(int32_t handle,int32_t angle,int32_t distance) -{ - int32_t status; - - status = MV_Pan3D(handle, angle, distance); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - status = FX_Warning; - } - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: FX_SoundActive - - Tests if the specified sound is currently playing. ----------------------------------------------------------------------*/ - -int32_t FX_SoundActive(int32_t handle) -{ - return(MV_VoicePlaying(handle)); -} - - -/*--------------------------------------------------------------------- - Function: FX_SoundsPlaying - - Reports the number of voices playing. ----------------------------------------------------------------------*/ - -int32_t FX_SoundsPlaying(void) -{ - return(MV_VoicesPlaying()); -} - - -/*--------------------------------------------------------------------- - Function: FX_StopSound - - Halts playback of a specific voice ----------------------------------------------------------------------*/ - -int32_t FX_StopSound(int32_t handle) -{ - int32_t status; - - status = MV_Kill(handle); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - return(FX_Warning); - } - - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_StopAllSounds - - Halts playback of all sounds. ----------------------------------------------------------------------*/ - -int32_t FX_StopAllSounds -( - void -) - -{ - int32_t status; - - status = MV_KillAllVoices(); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - return(FX_Warning); - } - - return(FX_Ok); -} - - -/*--------------------------------------------------------------------- - Function: FX_StartDemandFeedPlayback - - Plays a digitized sound from a user controlled buffering system. ----------------------------------------------------------------------*/ - -int32_t FX_StartDemandFeedPlayback -( - void (*function)(char **ptr, uint32_t *length), - int32_t rate, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t handle; - - handle = MV_StartDemandFeedPlayback(function, rate, - pitchoffset, vol, left, right, priority, callbackval); - if (handle < MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return(handle); -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayAuto - - Play a sound, autodetecting the format. ----------------------------------------------------------------------*/ -int32_t FX_PlayAuto(char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol, - int32_t left, int32_t right, int32_t priority, uint32_t callbackval) -{ - int32_t handle = -1; - - switch (*(int32_t *)ptr) - { - case 'C'+('r'<<8)+('e'<<16)+('a'<<24): - handle = MV_PlayVOC(ptr, length, pitchoffset, vol, left, right, priority, callbackval); - break; - case 'R'+('I'<<8)+('F'<<16)+('F'<<24): - handle = MV_PlayWAV(ptr, length, pitchoffset, vol, left, right, priority, callbackval); - break; - case 'O'+('g'<<8)+('g'<<16)+('S'<<24): - handle = MV_PlayVorbis(ptr, length, pitchoffset, vol, left, right, priority, callbackval); - break; - default: - switch (*(int32_t *)(ptr + 8)) - { - case 'W'+('A'<<8)+('V'<<16)+('E'<<24): - handle = MV_PlayWAV(ptr, length, pitchoffset, vol, left, right, priority, callbackval); - break; - } - break; - } - - if (handle <= MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return handle; -} - -int32_t FX_SetPrintf(void (*function)(const char *, ...)) -{ - MV_SetPrintf(function); - - return FX_Ok; -} - - -/*--------------------------------------------------------------------- - Function: FX_PlayLoopedAuto - - Play a looped sound, autodetecting the format. ----------------------------------------------------------------------*/ -int32_t FX_PlayLoopedAuto(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval) -{ - int32_t handle = -1; - printf("FX_PlayLoopedAuto %X\n",*(int32_t *)ptr); - switch (*(int32_t *)ptr) - { - case LITTLE32('C'+('r'<<8)+('e'<<16)+('a'<<24)): - handle = MV_PlayLoopedVOC(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); - break; - case LITTLE32('R'+('I'<<8)+('F'<<16)+('F'<<24)): - handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); - break; - case LITTLE32('O'+('g'<<8)+('g'<<16)+('S'<<24)): - handle = MV_PlayLoopedVorbis(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); - break; - default: - switch (*(int32_t *)(ptr + 8)) - { - case LITTLE32('W'+('A'<<8)+('V'<<16)+('E'<<24)): - handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); - break; - } - break; - } - - - if (handle <= MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return handle; -} - -/*--------------------------------------------------------------------- - Function: FX_PlayAuto3D - - Play a positioned sound, autodetecting the format. ----------------------------------------------------------------------*/ -int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, - int32_t distance, int32_t priority, uint32_t callbackval) -{ - int32_t handle = -1; - - switch (*(int32_t *)ptr) - { - case LITTLE32('C'+('r'<<8)+('e'<<16)+('a'<<24)): // Crea - handle = MV_PlayVOC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); - break; - case LITTLE32('R'+('I'<<8)+('F'<<16)+('F'<<24)): // RIFF - handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); - break; - case LITTLE32('O'+('g'<<8)+('g'<<16)+('S'<<24)): // OggS - handle = MV_PlayVorbis3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); - break; - default: - switch (*(int32_t *)(ptr + 8)) - { - case LITTLE32('W'+('A'<<8)+('V'<<16)+('E'<<24)): // WAVE - handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); - break; - } - break; - } - - if (handle <= MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - handle = FX_Warning; - } - - return handle; -} - -int32_t FX_SetVoiceCallback(int32_t handle, uint32_t callbackval) -{ - int32_t status; - - status = MV_SetVoiceCallback(handle, callbackval); - if (status != MV_Ok) - { - FX_SetErrorCode(FX_MultiVocError); - return(FX_Warning); - } - - return(FX_Ok); -} diff --git a/polymer-perf/eduke32/source/jaudiolib/src/linklist.h b/polymer-perf/eduke32/source/jaudiolib/src/linklist.h deleted file mode 100644 index e4ebd8ad5..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/linklist.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -#ifndef __linklist_h -#define __linklist_h -#ifdef __cplusplus -extern "C" { -#endif - - -#define NewNode(type) ((type*)Bmalloc(sizeof(type))) - - -#define LL_CreateNewLinkedList(rootnode,type,next,prev) \ - { \ - (rootnode) = NewNode(type); \ - (rootnode)->prev = (rootnode); \ - (rootnode)->next = (rootnode); \ - } - - - -#define LL_AddNode(rootnode, newnode, next, prev) \ - { \ - (newnode)->next = (rootnode); \ - (newnode)->prev = (rootnode)->prev; \ - (rootnode)->prev->next = (newnode); \ - (rootnode)->prev = (newnode); \ - } - -#define LL_TransferList(oldroot,newroot,next,prev) \ - { \ - if ((oldroot)->prev != (oldroot)) \ - { \ - (oldroot)->prev->next = (newroot); \ - (oldroot)->next->prev = (newroot)->prev; \ - (newroot)->prev->next = (oldroot)->next; \ - (newroot)->prev = (oldroot)->prev; \ - (oldroot)->next = (oldroot); \ - (oldroot)->prev = (oldroot); \ - } \ - } - -#define LL_ReverseList(root,type,next,prev) \ - { \ - type *newend,*trav,*tprev; \ - \ - newend = (root)->next; \ - for(trav = (root)->prev; trav != newend; trav = tprev) \ - { \ - tprev = trav->prev; \ - LL_MoveNode(trav,newend,next,prev); \ - } \ - } - - -#define LL_RemoveNode(node,next,prev) \ - { \ - (node)->prev->next = (node)->next; \ - (node)->next->prev = (node)->prev; \ - (node)->next = (node); \ - (node)->prev = (node); \ - } - - -#define LL_SortedInsertion(rootnode,insertnode,next,prev,type,sortparm) \ - { \ - type *hoya; \ - \ - hoya = (rootnode)->next; \ - while((hoya != (rootnode)) && ((insertnode)->sortparm > hoya->sortparm)) \ - { \ - hoya = hoya->next; \ - } \ - LL_AddNode(hoya,(insertnode),next,prev); \ - } - -#define LL_MoveNode(node,newroot,next,prev) \ - { \ - LL_RemoveNode((node),next,prev); \ - LL_AddNode((newroot),(node),next,prev); \ - } - -#define LL_ListEmpty(list,next,prev) \ - ( \ - ((list)->next == (list)) && \ - ((list)->prev == (list)) \ - ) - -#define LL_Free(list) Bfree(list) -#define LL_Reset(list,next,prev) (list)->next = (list)->prev = (list) -#define LL_New LL_CreateNewLinkedList -#define LL_Remove LL_RemoveNode -#define LL_Add LL_AddNode -#define LL_Empty LL_ListEmpty -#define LL_Move LL_MoveNode - - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/src/ll_man.h b/polymer-perf/eduke32/source/jaudiolib/src/ll_man.h deleted file mode 100644 index 0fb891ae1..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/ll_man.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - module: LL_MAN.H - - author: James R. Dose - date: February 4, 1994 - - Public header for LL_MAN.C. Linked list management routines. - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#ifndef __LL_MAN_H -#define __LL_MAN_H - -enum LL_Errors - { - LL_Warning = -2, - LL_Error = -1, - LL_Ok = 0 - }; - -typedef struct list - { - void *start; - void *end; - } list; - -void LL_AddNode( char *node, char **head, char **tail, int32_t next, int32_t prev ); -void LL_RemoveNode( char *node, char **head, char **tail, int32_t next, int32_t prev ); -void LL_UnlockMemory( void ); -int32_t LL_LockMemory( void ); - -#define LL_AddToHead( type, listhead, node ) \ - LL_AddNode( ( char * )( node ), \ - ( char ** )&( ( listhead )->start ), \ - ( char ** )&( ( listhead )->end ), \ - ( int32_t )&( ( type * ) 0 )->next, \ - ( int32_t )&( ( type * ) 0 )->prev ) - -#define LL_AddToTail( type, listhead, node ) \ - LL_AddNode( ( char * )( node ), \ - ( char ** )&( ( listhead )->end ), \ - ( char ** )&( ( listhead )->start ), \ - ( int32_t )&( ( type * ) 0 )->prev, \ - ( int32_t )&( ( type * ) 0 )->next ) - -#define LL_Remove( type, listhead, node ) \ - LL_RemoveNode( ( char * )( node ), \ - ( char ** )&( ( listhead )->start ), \ - ( char ** )&( ( listhead )->end ), \ - ( int32_t )&( ( type * ) 0 )->next, \ - ( int32_t )&( ( type * ) 0 )->prev ) - -#define LL_NextNode( node ) ( ( node )->next ) -#define LL_PreviousNode( node ) ( ( node )->prev ) - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/src/mix.c b/polymer-perf/eduke32/source/jaudiolib/src/mix.c deleted file mode 100644 index 82ee3f214..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/mix.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -#include "_multivc.h" - -extern char *MV_HarshClipTable; -extern char *MV_MixDestination; // pointer to the next output sample -extern uint32_t MV_MixPosition; // return value of where the source pointer got to -extern int16_t *MV_LeftVolume; -extern int16_t *MV_RightVolume; -extern int32_t MV_SampleSize; -extern int32_t MV_RightChannelOffset; - -#ifdef __POWERPC__ -# define BIGENDIAN -#endif - -void ClearBuffer_DW( void *ptr, unsigned data, int32_t length ) -{ - unsigned *ptrdw = ptr; - while (length--) { - *(ptrdw++) = data; - } -} - -/* - JBF: - - position = offset of starting sample in start - rate = resampling increment - start = sound data - length = count of samples to mix - */ - -// 8-bit mono source, 8-bit mono output -void MV_Mix8BitMono( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0; - - while (length--) { - sample0 = source[position >> 16]; - position += rate; - - sample0 = MV_LeftVolume[sample0] + *dest; - sample0 = MV_HarshClipTable[sample0 + 128]; - - *dest = sample0 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 8-bit mono source, 8-bit stereo output -void MV_Mix8BitStereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[position >> 16]; - sample1 = sample0; - position += rate; - - sample0 = MV_LeftVolume[sample0] + *dest; - sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset); - sample0 = MV_HarshClipTable[sample0 + 128]; - sample1 = MV_HarshClipTable[sample1 + 128]; - - *dest = sample0 & 255; - *(dest + MV_RightChannelOffset) = sample1 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 8-bit mono source, 16-bit mono output -void MV_Mix16BitMono( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0; - - while (length--) { - sample0 = source[position >> 16]; - position += rate; - - sample0 = MV_LeftVolume[sample0] + *dest; - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - - *dest = (int16_t) sample0; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 8-bit mono source, 16-bit stereo output -void MV_Mix16BitStereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[position >> 16]; - sample1 = sample0; - position += rate; - - sample0 = MV_LeftVolume[sample0] + *dest; - sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2); - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - if (sample1 < -32768) sample1 = -32768; - else if (sample1 > 32767) sample1 = 32767; - - *dest = (int16_t) sample0; - *(dest + MV_RightChannelOffset/2) = (int16_t) sample1; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit mono source, 16-bit mono output -void MV_Mix16BitMono16( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint16_t *source = (uint16_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0l, sample0h, sample0; - - while (length--) { - sample0 = source[position >> 16]; -#ifdef BIGENDIAN - sample0l = sample0 >> 8; - sample0h = (sample0 & 255) ^ 128; -#else - sample0l = sample0 & 255; - sample0h = (sample0 >> 8) ^ 128; -#endif - position += rate; - - sample0l = MV_LeftVolume[sample0l] >> 8; - sample0h = MV_LeftVolume[sample0h]; - sample0 = sample0l + sample0h + 128 + *dest; - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - - *dest = (int16_t) sample0; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit mono source, 8-bit mono output -void MV_Mix8BitMono16( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - int8_t *source = (int8_t *) start + 1; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - position += rate; - - sample0 = MV_LeftVolume[sample0 + 128] + *dest; - sample0 = MV_HarshClipTable[sample0 + 128]; - - *dest = sample0 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit mono source, 8-bit stereo output -void MV_Mix8BitStereo16( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - int8_t *source = (int8_t *) start + 1; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - sample1 = sample0; - position += rate; - - sample0 = MV_LeftVolume[sample0 + 128] + *dest; - sample1 = MV_RightVolume[sample1 + 128] + *(dest + MV_RightChannelOffset); - sample0 = MV_HarshClipTable[sample0 + 128]; - sample1 = MV_HarshClipTable[sample1 + 128]; - - *dest = sample0 & 255; - *(dest + MV_RightChannelOffset) = sample1 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit mono source, 16-bit stereo output -void MV_Mix16BitStereo16( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint16_t *source = (uint16_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0l, sample0h, sample0; - int32_t sample1l, sample1h, sample1; - - while (length--) { - sample0 = source[position >> 16]; -#ifdef BIGENDIAN - sample0l = sample0 >> 8; - sample0h = (sample0 & 255) ^ 128; -#else - sample0l = sample0 & 255; - sample0h = (sample0 >> 8) ^ 128; -#endif - sample1l = sample0l; - sample1h = sample0h; - position += rate; - - sample0l = MV_LeftVolume[sample0l] >> 8; - sample0h = MV_LeftVolume[sample0h]; - sample1l = MV_RightVolume[sample1l] >> 8; - sample1h = MV_RightVolume[sample1h]; - sample0 = sample0l + sample0h + 128 + *dest; - sample1 = sample1l + sample1h + 128 + *(dest + MV_RightChannelOffset/2); - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - if (sample1 < -32768) sample1 = -32768; - else if (sample1 > 32767) sample1 = 32767; - - *dest = (int16_t) sample0; - *(dest + MV_RightChannelOffset/2) = (int16_t) sample1; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -void MV_16BitReverb( char *src, char *dest, VOLUME16 *volume, int32_t count ) -{ - uint16_t * input = (uint16_t *) src; - int16_t * output = (int16_t *) dest; - int16_t sample0l, sample0h, sample0; - - do { - sample0 = *input; -#ifdef BIGENDIAN - sample0l = sample0 >> 8; - sample0h = (sample0 & 255) ^ 128; -#else - sample0l = sample0 & 255; - sample0h = (sample0 >> 8) ^ 128; -#endif - - sample0l = ((int16_t *) volume)[sample0l] >> 8; - sample0h = ((int16_t *) volume)[sample0h]; - *output = (int16_t) (sample0l + sample0h + 128); - - input++; - output++; - } while (--count > 0); -} - -void MV_8BitReverb( int8_t *src, int8_t *dest, VOLUME16 *volume, int32_t count ) -{ - uint8_t * input = (uint8_t *) src; - uint8_t * output = (uint8_t *) dest; - - do { - *output = ((int16_t *) volume)[*input] + 128; - - input++; - output++; - } while (--count > 0); -} - -void MV_16BitReverbFast( char *src, char *dest, int32_t count, int32_t shift ) -{ - int16_t * input = (int16_t *) src; - int16_t * output = (int16_t *) dest; - - do { - *output = *input >> shift; - - input++; - output++; - } while (--count > 0); -} - -void MV_8BitReverbFast( int8_t *src, int8_t *dest, int32_t count, int32_t shift ) -{ - uint8_t sample0, c; - - c = 128 - (128 >> shift); - - do { - sample0 = *((uint8_t *) src) >> shift; - *dest = sample0 + c + ((sample0 ^ 128) >> 7); - - src++; - dest++; - } while (--count > 0); -} - diff --git a/polymer-perf/eduke32/source/jaudiolib/src/mixst.c b/polymer-perf/eduke32/source/jaudiolib/src/mixst.c deleted file mode 100644 index e9ea69893..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/mixst.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -#include "_multivc.h" - -extern char *MV_HarshClipTable; -extern char *MV_MixDestination; // pointer to the next output sample -extern uint32_t MV_MixPosition; // return value of where the source pointer got to -extern int16_t *MV_LeftVolume; -extern int16_t *MV_RightVolume; -extern int32_t MV_SampleSize; -extern int32_t MV_RightChannelOffset; - -#ifdef __POWERPC__ -# define BIGENDIAN -#endif - -/* - JBF: - - position = offset of starting sample in start - rate = resampling increment - start = sound data - length = count of samples to mix - */ - -// 8-bit stereo source, 8-bit mono output -void MV_Mix8BitMono8Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - sample1 = source[((position >> 16) << 1) + 1]; - position += rate; - - sample0 = (MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) / 2 + *dest; - sample0 = MV_HarshClipTable[sample0 + 128]; - - *dest = sample0 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 8-bit stereo source, 8-bit stereo output -void MV_Mix8BitStereo8Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - sample1 = source[((position >> 16) << 1) + 1]; - position += rate; - - sample0 = MV_LeftVolume[sample0] + *dest; - sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset); - sample0 = MV_HarshClipTable[sample0 + 128]; - sample1 = MV_HarshClipTable[sample1 + 128]; - - *dest = sample0 & 255; - *(dest + MV_RightChannelOffset) = sample1 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 8-bit stereo source, 16-bit mono output -void MV_Mix16BitMono8Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - sample1 = source[((position >> 16) << 1) + 1]; - position += rate; - - sample0 = (MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) / 2 + *dest; - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - - *dest = (int16_t) sample0; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 8-bit stereo source, 16-bit stereo output -void MV_Mix16BitStereo8Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint8_t *source = (uint8_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - sample1 = source[((position >> 16) << 1) + 1]; - position += rate; - - sample0 = MV_LeftVolume[sample0] + *dest; - sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2); - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - if (sample1 < -32768) sample1 = -32768; - else if (sample1 > 32767) sample1 = 32767; - - *dest = (int16_t) sample0; - *(dest + MV_RightChannelOffset/2) = (int16_t) sample1; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit stereo source, 16-bit mono output -void MV_Mix16BitMono16Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint16_t *source = (uint16_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0l, sample0h, sample0; - int32_t sample1l, sample1h, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - sample1 = source[((position >> 16) << 1) + 1]; -#ifdef BIGENDIAN - sample0l = sample0 >> 8; - sample0h = (sample0 & 255) ^ 128; - sample1l = sample1 >> 8; - sample1h = (sample1 & 255) ^ 128; -#else - sample0l = sample0 & 255; - sample0h = (sample0 >> 8) ^ 128; - sample1l = sample1 & 255; - sample1h = (sample1 >> 8) ^ 128; -#endif - position += rate; - - sample0l = MV_LeftVolume[sample0l] >> 8; - sample0h = MV_LeftVolume[sample0h]; - sample0 = sample0l + sample0h + 128; - sample1l = MV_LeftVolume[sample1l] >> 8; - sample1h = MV_LeftVolume[sample1h]; - sample1 = sample1l + sample1h + 128; - - sample0 = (sample0 + sample1) / 2 + *dest; - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - - *dest = (int16_t) sample0; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit stereo source, 8-bit mono output -void MV_Mix8BitMono16Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - int8_t *source = (int8_t *) start + 1; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 2]; - sample1 = source[((position >> 16) << 2) + 2]; - position += rate; - - sample0 = MV_LeftVolume[sample0 + 128]; - sample1 = MV_LeftVolume[sample1 + 128]; - sample0 = (sample0 + sample1) / 2 + *dest; - sample0 = MV_HarshClipTable[sample0 + 128]; - - *dest = sample0 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit stereo source, 8-bit stereo output -void MV_Mix8BitStereo16Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - int8_t *source = (int8_t *) start + 1; - uint8_t *dest = (uint8_t *) MV_MixDestination; - int32_t sample0, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 2]; - sample1 = source[((position >> 16) << 2) + 2]; - position += rate; - - sample0 = MV_LeftVolume[sample0 + 128] + *dest; - sample1 = MV_RightVolume[sample1 + 128] + *(dest + MV_RightChannelOffset); - sample0 = MV_HarshClipTable[sample0 + 128]; - sample1 = MV_HarshClipTable[sample1 + 128]; - - *dest = sample0 & 255; - *(dest + MV_RightChannelOffset) = sample1 & 255; - - dest += MV_SampleSize; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} - -// 16-bit stereo source, 16-bit stereo output -void MV_Mix16BitStereo16Stereo( uint32_t position, uint32_t rate, - char *start, uint32_t length ) -{ - uint16_t *source = (uint16_t *) start; - int16_t *dest = (int16_t *) MV_MixDestination; - int32_t sample0l, sample0h, sample0; - int32_t sample1l, sample1h, sample1; - - while (length--) { - sample0 = source[(position >> 16) << 1]; - sample1 = source[((position >> 16) << 1) + 1]; -#ifdef BIGENDIAN - sample0l = sample0 >> 8; - sample0h = (sample0 & 255) ^ 128; - sample1l = sample1 >> 8; - sample1h = (sample1 & 255) ^ 128; -#else - sample0l = sample0 & 255; - sample0h = (sample0 >> 8) ^ 128; - sample1l = sample1 & 255; - sample1h = (sample1 >> 8) ^ 128; -#endif - position += rate; - - sample0l = MV_LeftVolume[sample0l] >> 8; - sample0h = MV_LeftVolume[sample0h]; - sample1l = MV_RightVolume[sample1l] >> 8; - sample1h = MV_RightVolume[sample1h]; - sample0 = sample0l + sample0h + 128 + *dest; - sample1 = sample1l + sample1h + 128 + *(dest + MV_RightChannelOffset/2); - if (sample0 < -32768) sample0 = -32768; - else if (sample0 > 32767) sample0 = 32767; - if (sample1 < -32768) sample1 = -32768; - else if (sample1 > 32767) sample1 = 32767; - - *dest = (int16_t) sample0; - *(dest + MV_RightChannelOffset/2) = (int16_t) sample1; - - dest += MV_SampleSize / 2; - } - - MV_MixPosition = position; - MV_MixDestination = (char *) dest; -} diff --git a/polymer-perf/eduke32/source/jaudiolib/src/multivoc.c b/polymer-perf/eduke32/source/jaudiolib/src/multivoc.c deleted file mode 100644 index bf1ec3e77..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/multivoc.c +++ /dev/null @@ -1,2765 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - module: MULTIVOC.C - - author: James R. Dose - date: December 20, 1993 - - Routines to provide multichannel digitized sound playback for - Sound Blaster compatible sound cards. - - (c) Copyright 1993 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#include -#include -#include -#include -#include -#include "linklist.h" -#include "sndcards.h" -#include "drivers.h" -#include "pitch.h" -#include "multivoc.h" -#include "_multivc.h" - -#ifdef _MSC_VER -#define inline __inline -#endif - -#ifdef __POWERPC__ -#define LITTLE16 SWAP16 -#define LITTLE32 SWAP32 -#else -#define LITTLE16 -#define LITTLE32 -#endif - -static void MV_Mix( VoiceNode *voice, int32_t buffer ); -static void MV_StopVoice( VoiceNode *voice ); -static void MV_ServiceVoc( void ); - -static playbackstatus MV_GetNextVOCBlock( VoiceNode *voice ); -static playbackstatus MV_GetNextDemandFeedBlock( VoiceNode *voice ); -static playbackstatus MV_GetNextRawBlock( VoiceNode *voice ); -static playbackstatus MV_GetNextWAVBlock( VoiceNode *voice ); - -static VoiceNode *MV_GetVoice( int32_t handle ); - -static int16_t *MV_GetVolumeTable( int32_t vol ); - -static void MV_SetVoicePitch( VoiceNode *voice, uint32_t rate, int32_t pitchoffset ); -static void MV_CalcVolume( int32_t MaxLevel ); -static void MV_CalcPanTable( void ); - -static inline uint16_t SWAP16(uint16_t s) -{ - return (s >> 8) | (s << 8); -} - -static inline uint32_t SWAP32(uint32_t s) -{ - return (s >> 24) | (s << 24) | ((s&0xff00) << 8) | ((s & 0xff0000) >> 8); -} - -#ifndef min -#define min(x,y) ((x) < (y) ? (x) : (y)) -#endif -#ifndef max -#define max(x,y) ((x) > (y) ? (x) : (y)) -#endif - -#define RoundFixed( fixedval, bits ) \ - ( \ - ( \ - (fixedval) + ( 1 << ( (bits) - 1 ) )\ - ) >> (bits) \ - ) - -#define IS_QUIET( ptr ) ( ( void * )( ptr ) == ( void * )&MV_VolumeTable[ 0 ] ) - -static int32_t MV_ReverbLevel; -static int32_t MV_ReverbDelay; -static VOLUME16 *MV_ReverbTable = NULL; - -//static int16_t MV_VolumeTable[ MV_MaxVolume + 1 ][ 256 ]; -static int16_t MV_VolumeTable[ 255 + 1 ][ 256 ]; - -//static Pan MV_PanTable[ MV_NumPanPositions ][ MV_MaxVolume + 1 ]; -Pan MV_PanTable[ MV_NumPanPositions ][ 255 + 1 ]; - -int32_t MV_Installed = FALSE; -static int32_t MV_TotalVolume = MV_MaxTotalVolume; -static int32_t MV_MaxVoices = 1; - -static int32_t MV_BufferSize = MixBufferSize; -static int32_t MV_BufferLength; - -static int32_t MV_NumberOfBuffers = NumberOfBuffers; - -static int32_t MV_MixMode = MONO_8BIT; -static int32_t MV_Channels = 1; -static int32_t MV_Bits = 8; - -static int32_t MV_Silence = SILENCE_8BIT; -static int32_t MV_SwapLeftRight = FALSE; - -static int32_t MV_RequestedMixRate; -int32_t MV_MixRate; - -static int32_t MV_BuffShift; - -static int32_t MV_TotalMemory; - -static int32_t MV_BufferEmpty[ NumberOfBuffers ]; -char *MV_MixBuffer[ NumberOfBuffers + 1 ]; - -static VoiceNode *MV_Voices = NULL; - -static volatile VoiceNode VoiceList; -static volatile VoiceNode VoicePool; - -static int32_t MV_MixPage = 0; -static int32_t MV_VoiceHandle = MV_MinVoiceHandle; - -void (*MV_Printf)(const char *fmt, ...) = NULL; -static void (*MV_CallBackFunc)(uint32_t) = NULL; -static void (*MV_MixFunction)(VoiceNode *voice, int32_t buffer); - -int32_t MV_MaxVolume = 255; - -char *MV_HarshClipTable; -char *MV_MixDestination; -int16_t *MV_LeftVolume; -int16_t *MV_RightVolume; -int32_t MV_SampleSize = 1; -int32_t MV_RightChannelOffset; - -uint32_t MV_MixPosition; - -int32_t MV_ErrorCode = MV_Ok; - -static int32_t lockdepth = 0; - -static inline void DisableInterrupts(void) -{ - if (lockdepth++ > 0) - return; - SoundDriver_Lock(); - return; -} - -static inline void RestoreInterrupts(void) -{ - if (--lockdepth > 0) - return; - SoundDriver_Unlock(); -} - - -/*--------------------------------------------------------------------- - Function: MV_ErrorString - - Returns a pointer to the error message associated with an error - number. A -1 returns a pointer the current error. ----------------------------------------------------------------------*/ - -const char *MV_ErrorString(int32_t ErrorNumber) -{ - switch (ErrorNumber) - { - case MV_Warning : - case MV_Error : - return MV_ErrorString(MV_ErrorCode); - - case MV_Ok : - return "Multivoc ok."; - - case MV_UnsupportedCard : - return "Selected sound card is not supported by Multivoc."; - - case MV_NotInstalled : - return "Multivoc not installed."; - - case MV_DriverError : - return SoundDriver_ErrorString(SoundDriver_GetError()); - - case MV_NoVoices : - return "No free voices available to Multivoc."; - - case MV_NoMem : - return "Out of memory in Multivoc."; - - case MV_VoiceNotFound : - return "No voice with matching handle found."; - - case MV_InvalidVOCFile : - return "Invalid VOC file passed in to Multivoc."; - - case MV_InvalidWAVFile : - return "Invalid WAV file passed in to Multivoc."; - - case MV_InvalidVorbisFile : - return "Invalid OggVorbis file passed in to Multivoc."; - - case MV_InvalidMixMode : - return "Invalid mix mode request in Multivoc."; - - default : - return "Unknown Multivoc error code."; - } -} - - -/*--------------------------------------------------------------------- - Function: MV_Mix - - Mixes the sound into the buffer. ----------------------------------------------------------------------*/ - -static void MV_Mix(VoiceNode *voice,int32_t buffer) -{ - char *start; - int32_t length; - int32_t voclength; - uint32_t position; - uint32_t rate; - uint32_t FixedPointBufferSize; - - /* cheap fix for a crash under 64-bit linux --\ - v */ - if (voice->length == 0 && (!voice->GetSound || voice->GetSound(voice) != KeepPlaying)) - return; - - length = MixBufferSize; - FixedPointBufferSize = voice->FixedPointBufferSize; - - MV_MixDestination = MV_MixBuffer[ buffer ]; - MV_LeftVolume = voice->LeftVolume; - MV_RightVolume = voice->RightVolume; - - if ((MV_Channels == 2) && (IS_QUIET(MV_LeftVolume))) - { - MV_LeftVolume = MV_RightVolume; - MV_MixDestination += MV_RightChannelOffset; - } - - // Add this voice to the mix - while (length > 0) - { - start = voice->sound; - rate = voice->RateScale; - position = voice->position; - - // Check if the last sample in this buffer would be - // beyond the length of the sample block - if ((position + FixedPointBufferSize) >= voice->length) - { - if (position < voice->length) - { - voclength = (voice->length - position + rate - voice->channels) / rate; - } - else - { - voice->GetSound(voice); - return; - } - } - else - voclength = length; - - if (voice->mix) - voice->mix(position, rate, start, voclength); - - voice->position = MV_MixPosition; - - length -= voclength; - - if (voice->position >= voice->length) - { - // Get the next block of sound - if (voice->GetSound(voice) != KeepPlaying) - return; - - if (length > (voice->channels - 1)) - { - // Get the position of the last sample in the buffer - FixedPointBufferSize = voice->RateScale * (length - voice->channels); - } - } - } -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayVoice - - Adds a voice to the play list. ----------------------------------------------------------------------*/ - -void MV_PlayVoice(VoiceNode *voice) -{ - DisableInterrupts(); - LL_SortedInsertion(&VoiceList, voice, prev, next, VoiceNode, priority); - RestoreInterrupts(); -} - - -/*--------------------------------------------------------------------- - Function: MV_StopVoice - - Removes the voice from the play list and adds it to the free list. ----------------------------------------------------------------------*/ - -void MV_StopVoice(VoiceNode *voice) -{ - DisableInterrupts(); - - // move the voice from the play list to the free list - LL_Remove(voice, next, prev); - LL_Add((VoiceNode*) &VoicePool, voice, next, prev); - - RestoreInterrupts(); - - if (voice->wavetype == Vorbis) - MV_ReleaseVorbisVoice(voice); - - voice->handle = 0; -} - - -/*--------------------------------------------------------------------- - Function: MV_ServiceVoc - - Starts playback of the waiting buffer and mixes the next one. - - JBF: no synchronisation happens inside MV_ServiceVoc nor the - supporting functions it calls. This would cause a deadlock - between the mixer thread in the driver vs the nested - locking in the user-space functions of MultiVoc. The call - to MV_ServiceVoc is synchronised in the driver. - - Known functions called by MV_ServiceVoc and its helpers: - MV_Mix (and its MV_Mix*bit* workers) - MV_GetNextVOCBlock - MV_GetNextWAVBlock - MV_SetVoiceMixMode ----------------------------------------------------------------------*/ -void MV_ServiceVoc(void) -{ - VoiceNode *voice; - VoiceNode *next; - //int32_t flags; - int32_t iter; - - // Toggle which buffer we'll mix next - if (++MV_MixPage >= MV_NumberOfBuffers) - MV_MixPage -= MV_NumberOfBuffers; - - if (MV_ReverbLevel == 0) - { - // Initialize buffer - //Commented out so that the buffer is always cleared. - //This is so the guys at Echo Speech can mix into the - //buffer even when no sounds are playing. - if (!MV_BufferEmpty[MV_MixPage]) - { - ClearBuffer_DW(MV_MixBuffer[ MV_MixPage ], MV_Silence, MV_BufferSize >> 2); - MV_BufferEmpty[ MV_MixPage ] = TRUE; - } - } - else - { - char *end; - char *source; - char *dest; - int32_t count; - int32_t length; - - end = MV_MixBuffer[ 0 ] + MV_BufferLength;; - dest = MV_MixBuffer[ MV_MixPage ]; - source = MV_MixBuffer[ MV_MixPage ] - MV_ReverbDelay; - - if (source < MV_MixBuffer[ 0 ]) - source += MV_BufferLength; - - length = MV_BufferSize; - while (length > 0) - { - count = length; - if (source + count > end) - count = end - source; - - if (MV_Bits == 16) - { - if (MV_ReverbTable != NULL) - MV_16BitReverb(source, dest, MV_ReverbTable, count / 2); - else - MV_16BitReverbFast(source, dest, count / 2, MV_ReverbLevel); - } - else - { - if (MV_ReverbTable != NULL) - MV_8BitReverb((int8_t *) source, (int8_t *) dest, MV_ReverbTable, count); - else - MV_8BitReverbFast((int8_t *) source, (int8_t *) dest, count, MV_ReverbLevel); - } - - // if we go through the loop again, it means that we've wrapped around the buffer - source = MV_MixBuffer[ 0 ]; - dest += count; - length -= count; - } - } - - // Play any waiting voices - //DisableInterrupts(); - - if (!VoiceList.next || (voice = VoiceList.next) == &VoiceList) - return; - - iter = 0; - - do - { - next = voice->next; - iter++; - - if (iter > MV_MaxVoices && MV_Printf) - MV_Printf("more iterations than voices! iter: %d\n",iter); - - if (voice->Paused) - continue; - - MV_BufferEmpty[ MV_MixPage ] = FALSE; - - MV_MixFunction(voice, MV_MixPage); - - // Is this voice done? - if (!voice->Playing) - { - //JBF: prevent a deadlock caused by MV_StopVoice grabbing the mutex again - //MV_StopVoice( voice ); - LL_Remove(voice, next, prev); - LL_Add((VoiceNode*) &VoicePool, voice, next, prev); - - if (voice->wavetype == Vorbis) - MV_ReleaseVorbisVoice(voice); - - voice->handle = 0; - - if (MV_CallBackFunc) - MV_CallBackFunc(voice->callbackval); - } - } - while ((voice = next) != &VoiceList); - - //RestoreInterrupts(); -} - - -/*--------------------------------------------------------------------- - Function: MV_GetNextVOCBlock - - Interpret the information of a VOC format sound file. ----------------------------------------------------------------------*/ - -playbackstatus MV_GetNextVOCBlock(VoiceNode *voice) -{ - uint8_t *ptr; - int32_t blocktype; - int32_t lastblocktype; - uint32_t blocklength; - uint32_t samplespeed; - uint32_t tc = 0; - int32_t packtype; - int32_t voicemode; - int32_t done; - unsigned BitsPerSample; - unsigned Channels; - unsigned Format; - - if (voice->BlockLength > 0) - { - voice->position -= voice->length; - voice->sound += (voice->length >> 16) * (voice->channels * voice->bits / 8); - voice->length = min(voice->BlockLength, 0x8000); - voice->BlockLength -= voice->length; - voice->length <<= 16; - return(KeepPlaying); - } - - ptr = (uint8_t *)voice->NextBlock; - - voice->Playing = TRUE; - voice->Paused = FALSE; - - voicemode = 0; - lastblocktype = 0; - packtype = 0; - - done = FALSE; - - do - { - // Stop playing if we get a NULL pointer - if (ptr == NULL) - { - voice->Playing = FALSE; - done = TRUE; - break; - } - - blocktype = (int32_t)*ptr; - blocklength = LITTLE32(*(uint32_t *)(ptr + 1)) & 0x00ffffff; - ptr += 4; - - switch (blocktype) - { - case 0 : - // End of data - if ((voice->LoopStart == NULL) || - ((intptr_t) voice->LoopStart >= ((intptr_t) ptr - 4))) - { - voice->Playing = FALSE; - done = TRUE; - } - else - { - voice->NextBlock = voice->LoopStart; - voice->BlockLength = 0; - voice->position = 0; - return MV_GetNextVOCBlock(voice); - } - break; - - case 1 : - // Sound data block - voice->bits = 8; - voice->channels = voicemode + 1; - if (lastblocktype != 8) - { - tc = (uint32_t)*ptr << 8; - packtype = *(ptr + 1); - } - - ptr += 2; - blocklength -= 2; - - samplespeed = 256000000L / (voice->channels * (65536 - tc)); - - // Skip packed or stereo data - if ((packtype != 0) || (voicemode != 0 && voicemode != 1)) - { - ptr += blocklength; - } - else - { - done = TRUE; - } - voicemode = 0; - break; - - case 2 : - // Sound continuation block - samplespeed = voice->SamplingRate; - done = TRUE; - break; - - case 3 : - // Silence - // Not implimented. - ptr += blocklength; - break; - - case 4 : - // Marker - // Not implimented. - ptr += blocklength; - break; - - case 5 : - // ASCII string - // Not implimented. - ptr += blocklength; - break; - - case 6 : - // Repeat begin - if (voice->LoopEnd == NULL) - { - voice->LoopCount = LITTLE16(*(uint16_t *)ptr); - voice->LoopStart = (char *)((intptr_t) ptr + blocklength); - } - ptr += blocklength; - break; - - case 7 : - // Repeat end - ptr += blocklength; - if (lastblocktype == 6) - { - voice->LoopCount = 0; - } - else - { - if ((voice->LoopCount > 0) && (voice->LoopStart != NULL)) - { - ptr = (uint8_t *) voice->LoopStart; - if (voice->LoopCount < 0xffff) - { - voice->LoopCount--; - if (voice->LoopCount == 0) - { - voice->LoopStart = NULL; - } - } - } - } - break; - - case 8 : - // Extended block - voice->bits = 8; - voice->channels = 1; - tc = LITTLE16(*(uint16_t *)ptr); - packtype = *(ptr + 2); - voicemode = *(ptr + 3); - ptr += blocklength; - break; - - case 9 : - // New sound data block - samplespeed = LITTLE32(*(uint32_t *)ptr); - BitsPerSample = (unsigned)*(ptr + 4); - Channels = (unsigned)*(ptr + 5); - Format = (unsigned)LITTLE16(*(uint16_t *)(ptr + 6)); - - if ((BitsPerSample == 8) && (Channels == 1 || Channels == 2) && - (Format == VOC_8BIT)) - { - ptr += 12; - blocklength -= 12; - voice->bits = 8; - voice->channels = Channels; - done = TRUE; - } - else if ((BitsPerSample == 16) && (Channels == 1 || Channels == 2) && - (Format == VOC_16BIT)) - { - ptr += 12; - blocklength -= 12; - voice->bits = 16; - voice->channels = Channels; - done = TRUE; - } - else - { - ptr += blocklength; - } - break; - - default : - // Unknown data. Probably not a VOC file. - voice->Playing = FALSE; - done = TRUE; - break; - } - - lastblocktype = blocktype; - } - while (!done); - - if (voice->Playing) - { - voice->NextBlock = (char *)ptr + blocklength; - voice->sound = (char *)ptr; - - voice->SamplingRate = samplespeed; - voice->RateScale = (voice->SamplingRate * voice->PitchScale) / MV_MixRate; - - // Multiply by MixBufferSize - 1 - voice->FixedPointBufferSize = (voice->RateScale * MixBufferSize) - - voice->RateScale; - - if (voice->LoopEnd != NULL) - { - if (blocklength > (uint32_t)voice->LoopEnd) - blocklength = (uint32_t)voice->LoopEnd; - else - voice->LoopEnd = (char *)blocklength; - - voice->LoopStart = voice->sound + (uint32_t)voice->LoopStart; - voice->LoopEnd = voice->sound + (uint32_t)voice->LoopEnd; - voice->LoopSize = voice->LoopEnd - voice->LoopStart; - } - - if (voice->bits == 16) - blocklength /= 2; - - if (voice->channels == 2) - blocklength /= 2; - - voice->position = 0; - voice->length = min(blocklength, 0x8000); - voice->BlockLength = blocklength - voice->length; - voice->length <<= 16; - - MV_SetVoiceMixMode(voice); - - return(KeepPlaying); - } - - return(NoMoreData); -} - - -/*--------------------------------------------------------------------- - Function: MV_GetNextDemandFeedBlock - - Controls playback of demand fed data. ----------------------------------------------------------------------*/ - -playbackstatus MV_GetNextDemandFeedBlock(VoiceNode *voice) -{ - if (voice->BlockLength > 0) - { - voice->position -= voice->length; - voice->sound += voice->length >> 16; - voice->length = min(voice->BlockLength, 0x8000); - voice->BlockLength -= voice->length; - voice->length <<= 16; - - return(KeepPlaying); - } - - if (voice->DemandFeed == NULL) - return(NoMoreData); - - voice->position = 0; - (voice->DemandFeed)(&voice->sound, &voice->BlockLength); - voice->length = min(voice->BlockLength, 0x8000); - voice->BlockLength -= voice->length; - voice->length <<= 16; - - return((voice->length > 0) && (voice->sound != NULL) ? KeepPlaying : NoMoreData); -} - - -/*--------------------------------------------------------------------- - Function: MV_GetNextRawBlock - - Controls playback of demand fed data. ----------------------------------------------------------------------*/ - -playbackstatus MV_GetNextRawBlock(VoiceNode *voice) -{ - if (voice->BlockLength <= 0) - { - if (voice->LoopStart == NULL) - { - voice->Playing = FALSE; - return(NoMoreData); - } - - voice->BlockLength = voice->LoopSize; - voice->NextBlock = voice->LoopStart; - voice->length = 0; - voice->position = 0; - } - - voice->sound = voice->NextBlock; - voice->position -= voice->length; - voice->length = min(voice->BlockLength, 0x8000); - voice->NextBlock += voice->length * (voice->channels * voice->bits / 8); - voice->BlockLength -= voice->length; - voice->length <<= 16; - - return(KeepPlaying); -} - - -/*--------------------------------------------------------------------- - Function: MV_GetNextWAVBlock - - Controls playback of demand fed data. ----------------------------------------------------------------------*/ - -playbackstatus MV_GetNextWAVBlock(VoiceNode *voice) -{ - if (voice->BlockLength <= 0) - { - if (voice->LoopStart == NULL) - { - voice->Playing = FALSE; - return(NoMoreData); - } - - voice->BlockLength = voice->LoopSize; - voice->NextBlock = voice->LoopStart; - voice->length = 0; - voice->position = 0; - } - - voice->sound = voice->NextBlock; - voice->position -= voice->length; - voice->length = min(voice->BlockLength, 0x8000); - voice->NextBlock += voice->length * (voice->channels * voice->bits / 8); - voice->BlockLength -= voice->length; - voice->length <<= 16; - - return(KeepPlaying); -} - - -/*--------------------------------------------------------------------- - Function: MV_GetVoice - - Locates the voice with the specified handle. ----------------------------------------------------------------------*/ - -VoiceNode *MV_GetVoice(int32_t handle) -{ - VoiceNode *voice; - - if (handle < MV_MinVoiceHandle || handle > MV_MaxVoices) - { - if (MV_Printf) - MV_Printf("MV_GetVoice(): bad handle (%d)!\n", handle); - return NULL; - } - - DisableInterrupts(); - - for (voice = VoiceList.next; voice != &VoiceList; voice = voice->next) - { - if (handle == voice->handle) - { - RestoreInterrupts(); - return voice; - } - } - - RestoreInterrupts(); - MV_SetErrorCode(MV_VoiceNotFound); - return NULL; -} - - -/*--------------------------------------------------------------------- - Function: MV_VoicePlaying - - Checks if the voice associated with the specified handle is - playing. ----------------------------------------------------------------------*/ - -int32_t MV_VoicePlaying(int32_t handle) -{ - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(FALSE); - } - - return MV_GetVoice(handle) ? TRUE : FALSE; -} - - -/*--------------------------------------------------------------------- - Function: MV_KillAllVoices - - Stops output of all currently active voices. ----------------------------------------------------------------------*/ - -int32_t MV_KillAllVoices(void) -{ - VoiceNode * voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - DisableInterrupts(); - - if (&VoiceList == VoiceList.next) - { - RestoreInterrupts(); - return(MV_Ok); - } - - voice = VoiceList.prev; - - // Remove all the voices from the list - while (voice != &VoiceList) - { - if (voice->priority == MV_MUSIC_PRIORITY) - { - voice = voice->prev; - continue; - } - - MV_Kill(voice->handle); - voice = VoiceList.prev; - } - - RestoreInterrupts(); - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_Kill - - Stops output of the voice associated with the specified handle. ----------------------------------------------------------------------*/ - -int32_t MV_Kill(int32_t handle) -{ - VoiceNode *voice; - uint32_t callbackval; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - DisableInterrupts(); - - if ((voice = MV_GetVoice(handle)) == NULL) - { - RestoreInterrupts(); - MV_SetErrorCode(MV_VoiceNotFound); - return(MV_Error); - } - - callbackval = voice->callbackval; - - MV_StopVoice(voice); - - RestoreInterrupts(); - - if (MV_CallBackFunc) - MV_CallBackFunc(callbackval); - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_VoicesPlaying - - Determines the number of currently active voices. ----------------------------------------------------------------------*/ - -int32_t MV_VoicesPlaying(void) -{ - VoiceNode *voice; - int32_t NumVoices = 0; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(0); - } - - DisableInterrupts(); - - for (voice = VoiceList.next; voice != &VoiceList; voice = voice->next) - NumVoices++; - - RestoreInterrupts(); - - return(NumVoices); -} - - -/*--------------------------------------------------------------------- - Function: MV_AllocVoice - - Retrieve an inactive or lower priority voice for output. ----------------------------------------------------------------------*/ - -VoiceNode *MV_AllocVoice(int32_t priority) -{ - VoiceNode *voice; - VoiceNode *node; - - DisableInterrupts(); - - // Check if we have any free voices - if (LL_Empty(&VoicePool, next, prev)) - { - // check if we have a higher priority than a voice that is playing. - for (voice = node = VoiceList.next; node != &VoiceList; node = node->next) - { - if (node->priority < voice->priority) - voice = node; - } - - if (priority >= voice->priority && voice != &VoiceList && voice->handle >= MV_MinVoiceHandle) - MV_Kill(voice->handle); - - if (LL_Empty(&VoicePool, next, prev)) - { - // No free voices - RestoreInterrupts(); - return NULL; - } - } - - voice = VoicePool.next; - LL_Remove(voice, next, prev); - RestoreInterrupts(); - - MV_VoiceHandle = MV_MinVoiceHandle; - - // Find a free voice handle - do - { - if (++MV_VoiceHandle < MV_MinVoiceHandle || MV_VoiceHandle > MV_MaxVoices) - MV_VoiceHandle = MV_MinVoiceHandle; - } - while (MV_VoicePlaying(MV_VoiceHandle)); - - voice->handle = MV_VoiceHandle; - - return voice; -} - - -/*--------------------------------------------------------------------- - Function: MV_VoiceAvailable - - Checks if a voice can be played at the specified priority. ----------------------------------------------------------------------*/ - -int32_t MV_VoiceAvailable(int32_t priority) -{ - VoiceNode *voice; - VoiceNode *node; - - // Check if we have any free voices - if (!LL_Empty(&VoicePool, next, prev)) - return TRUE; - - DisableInterrupts(); - - // check if we have a higher priority than a voice that is playing. - for (voice = node = VoiceList.next; node != &VoiceList; node = node->next) - { - if (node->priority < voice->priority) - voice = node; - } - - if ((voice == &VoiceList) || (priority < voice->priority)) - { - RestoreInterrupts(); - return FALSE; - } - - RestoreInterrupts(); - return TRUE; -} - - -/*--------------------------------------------------------------------- - Function: MV_SetVoicePitch - - Sets the pitch for the specified voice. ----------------------------------------------------------------------*/ - -void MV_SetVoicePitch -( - VoiceNode *voice, - uint32_t rate, - int32_t pitchoffset -) - -{ - voice->SamplingRate = rate; - voice->PitchScale = PITCH_GetScale(pitchoffset); - voice->RateScale = (rate * voice->PitchScale) / MV_MixRate; - - // Multiply by MixBufferSize - 1 - voice->FixedPointBufferSize = (voice->RateScale * MixBufferSize) - - voice->RateScale; -} - - -/*--------------------------------------------------------------------- - Function: MV_SetPitch - - Sets the pitch for the voice associated with the specified handle. ----------------------------------------------------------------------*/ - -int32_t MV_SetPitch -( - int32_t handle, - int32_t pitchoffset -) - -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - voice = MV_GetVoice(handle); - if (voice == NULL) - { - MV_SetErrorCode(MV_VoiceNotFound); - return(MV_Error); - } - - MV_SetVoicePitch(voice, voice->SamplingRate, pitchoffset); - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_SetFrequency - - Sets the frequency for the voice associated with the specified handle. ----------------------------------------------------------------------*/ - -int32_t MV_SetFrequency -( - int32_t handle, - int32_t frequency -) - -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - voice = MV_GetVoice(handle); - if (voice == NULL) - { - MV_SetErrorCode(MV_VoiceNotFound); - return(MV_Error); - } - - MV_SetVoicePitch(voice, frequency, 0); - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_GetVolumeTable - - Returns a pointer to the volume table associated with the specified - volume. ----------------------------------------------------------------------*/ - -static int16_t *MV_GetVolumeTable -( - int32_t vol -) - -{ - int32_t volume; - int16_t *table; - - volume = MIX_VOLUME(vol); - - table = (int16_t *) &MV_VolumeTable[ volume ]; - - return(table); -} - - -/*--------------------------------------------------------------------- - Function: MV_SetVoiceMixMode - - Selects which method should be used to mix the voice. - - 8Bit 16Bit 8Bit 16Bit | 8Bit 16Bit 8Bit 16Bit | - Mono Mono Ster Ster | Mono Mono Ster Ster | Mixer - Out Out Out Out | In In In In | ---------------------------+---------------------------+------------- - X | X | Mix8BitMono16 - X | X | Mix8BitMono - X | X | Mix8BitStereo16 - X | X | Mix8BitStereo - X | X | Mix16BitMono16 - X | X | Mix16BitMono - X | X | Mix16BitStereo16 - X | X | Mix16BitStereo ---------------------------+---------------------------+------------- - X | X | Mix16BitStereo16Stereo - X | X | Mix16BitStereo8Stereo - X | X | Mix8BitStereo16Stereo - X | X | Mix8BitStereo8Stereo - X | X | Mix16BitMono16Stereo - X | X | Mix16BitMono8Stereo - X | X | Mix8BitMono16Stereo - X | X | Mix8BitMono8Stereo - ----------------------------------------------------------------------*/ - -void MV_SetVoiceMixMode -( - VoiceNode *voice -) - -{ - //int32_t flags; - int32_t test; - - //DisableInterrupts(); - - test = T_DEFAULT; - if (MV_Bits == 8) - { - test |= T_8BITS; - } - - if (MV_Channels == 1) - { - test |= T_MONO; - } - else - { - if (IS_QUIET(voice->RightVolume)) - { - test |= T_RIGHTQUIET; - } - else if (IS_QUIET(voice->LeftVolume)) - { - test |= T_LEFTQUIET; - } - } - - if (voice->bits == 16) - { - test |= T_16BITSOURCE; - } - - if (voice->channels == 2) - { - test |= T_STEREOSOURCE; - test &= ~(T_RIGHTQUIET | T_LEFTQUIET); - } - - switch (test) - { - case T_8BITS | T_MONO | T_16BITSOURCE : - voice->mix = MV_Mix8BitMono16; - break; - - case T_8BITS | T_MONO : - voice->mix = MV_Mix8BitMono; - break; - - case T_8BITS | T_16BITSOURCE | T_LEFTQUIET : - MV_LeftVolume = MV_RightVolume; - voice->mix = MV_Mix8BitMono16; - break; - - case T_8BITS | T_LEFTQUIET : - MV_LeftVolume = MV_RightVolume; - voice->mix = MV_Mix8BitMono; - break; - - case T_8BITS | T_16BITSOURCE | T_RIGHTQUIET : - voice->mix = MV_Mix8BitMono16; - break; - - case T_8BITS | T_RIGHTQUIET : - voice->mix = MV_Mix8BitMono; - break; - - case T_8BITS | T_16BITSOURCE : - voice->mix = MV_Mix8BitStereo16; - break; - - case T_8BITS : - voice->mix = MV_Mix8BitStereo; - break; - - case T_MONO | T_16BITSOURCE : - voice->mix = MV_Mix16BitMono16; - break; - - case T_MONO : - voice->mix = MV_Mix16BitMono; - break; - - case T_16BITSOURCE | T_LEFTQUIET : - MV_LeftVolume = MV_RightVolume; - voice->mix = MV_Mix16BitMono16; - break; - - case T_LEFTQUIET : - MV_LeftVolume = MV_RightVolume; - voice->mix = MV_Mix16BitMono; - break; - - case T_16BITSOURCE | T_RIGHTQUIET : - voice->mix = MV_Mix16BitMono16; - break; - - case T_RIGHTQUIET : - voice->mix = MV_Mix16BitMono; - break; - - case T_16BITSOURCE : - voice->mix = MV_Mix16BitStereo16; - break; - - case T_SIXTEENBIT_STEREO : - voice->mix = MV_Mix16BitStereo; - break; - - case T_16BITSOURCE | T_STEREOSOURCE: - voice->mix = MV_Mix16BitStereo16Stereo; - break; - - case T_16BITSOURCE | T_STEREOSOURCE | T_8BITS: - voice->mix = MV_Mix8BitStereo16Stereo; - break; - - case T_16BITSOURCE | T_STEREOSOURCE | T_MONO: - voice->mix = MV_Mix16BitMono16Stereo; - break; - - case T_16BITSOURCE | T_STEREOSOURCE | T_8BITS | T_MONO: - voice->mix = MV_Mix8BitMono16Stereo; - break; - - case T_STEREOSOURCE: - voice->mix = MV_Mix16BitStereo8Stereo; - break; - - case T_STEREOSOURCE | T_8BITS: - voice->mix = MV_Mix8BitStereo8Stereo; - break; - - case T_STEREOSOURCE | T_MONO: - voice->mix = MV_Mix16BitMono8Stereo; - break; - - case T_STEREOSOURCE | T_8BITS | T_MONO: - voice->mix = MV_Mix8BitMono8Stereo; - break; - - default : - voice->mix = 0; - } - - //RestoreInterrupts( flags ); -} - - -/*--------------------------------------------------------------------- - Function: MV_SetVoiceVolume - - Sets the stereo and mono volume level of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -void MV_SetVoiceVolume -( - VoiceNode *voice, - int32_t vol, - int32_t left, - int32_t right -) - -{ - if (MV_Channels == 1) - { - left = vol; - right = vol; - } - - if (MV_SwapLeftRight) - { - // SBPro uses reversed panning - voice->LeftVolume = MV_GetVolumeTable(right); - voice->RightVolume = MV_GetVolumeTable(left); - } - else - { - voice->LeftVolume = MV_GetVolumeTable(left); - voice->RightVolume = MV_GetVolumeTable(right); - } - - MV_SetVoiceMixMode(voice); -} - -/*--------------------------------------------------------------------- -Function: MV_PauseVoice - -Pauses the voice associated with the specified handle -without stoping the sound. ----------------------------------------------------------------------*/ - -int32_t MV_PauseVoice -( - int32_t handle, - int32_t pause -) - -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - DisableInterrupts(); - - voice = MV_GetVoice(handle); - if (voice == NULL) - { - RestoreInterrupts(); - MV_SetErrorCode(MV_VoiceNotFound); - return(MV_Warning); - } - - voice->Paused = pause; - - RestoreInterrupts(); - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_EndLooping - - Stops the voice associated with the specified handle from looping - without stoping the sound. ----------------------------------------------------------------------*/ - -int32_t MV_EndLooping -( - int32_t handle -) - -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - DisableInterrupts(); - - voice = MV_GetVoice(handle); - if (voice == NULL) - { - RestoreInterrupts(); - MV_SetErrorCode(MV_VoiceNotFound); - return(MV_Warning); - } - - voice->LoopCount = 0; - voice->LoopStart = NULL; - voice->LoopEnd = NULL; - - RestoreInterrupts(); - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_SetPan - - Sets the stereo and mono volume level of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -int32_t MV_SetPan -( - int32_t handle, - int32_t vol, - int32_t left, - int32_t right -) - -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - voice = MV_GetVoice(handle); - if (voice == NULL) - { - MV_SetErrorCode(MV_VoiceNotFound); - return(MV_Warning); - } - - MV_SetVoiceVolume(voice, vol, left, right); - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_Pan3D - - Set the angle and distance from the listener of the voice associated - with the specified handle. ----------------------------------------------------------------------*/ - -int32_t MV_Pan3D -( - int32_t handle, - int32_t angle, - int32_t distance -) - -{ - int32_t left; - int32_t right; - int32_t mid; - int32_t volume; - int32_t status; - - if (distance < 0) - { - distance = -distance; - angle += MV_NumPanPositions / 2; - } - - volume = MIX_VOLUME(distance); - - // Ensure angle is within 0 - 31 - angle &= MV_MaxPanPosition; - - left = MV_PanTable[ angle ][ volume ].left; - right = MV_PanTable[ angle ][ volume ].right; - mid = max(0, 255 - distance); - - status = MV_SetPan(handle, mid, left, right); - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: MV_SetReverb - - Sets the level of reverb to add to mix. ----------------------------------------------------------------------*/ - -void MV_SetReverb -( - int32_t reverb -) - -{ - MV_ReverbLevel = MIX_VOLUME(reverb); - MV_ReverbTable = &MV_VolumeTable[ MV_ReverbLevel ]; -} - - -/*--------------------------------------------------------------------- - Function: MV_SetFastReverb - - Sets the level of reverb to add to mix. ----------------------------------------------------------------------*/ - -void MV_SetFastReverb -( - int32_t reverb -) - -{ - MV_ReverbLevel = max(0, min(16, reverb)); - MV_ReverbTable = NULL; -} - - -/*--------------------------------------------------------------------- - Function: MV_GetMaxReverbDelay - - Returns the maximum delay time for reverb. ----------------------------------------------------------------------*/ - -int32_t MV_GetMaxReverbDelay -( - void -) - -{ - int32_t maxdelay; - - maxdelay = MixBufferSize * MV_NumberOfBuffers; - - return maxdelay; -} - - -/*--------------------------------------------------------------------- - Function: MV_GetReverbDelay - - Returns the current delay time for reverb. ----------------------------------------------------------------------*/ - -int32_t MV_GetReverbDelay -( - void -) - -{ - return MV_ReverbDelay / MV_SampleSize; -} - - -/*--------------------------------------------------------------------- - Function: MV_SetReverbDelay - - Sets the delay level of reverb to add to mix. ----------------------------------------------------------------------*/ - -void MV_SetReverbDelay -( - int32_t delay -) - -{ - int32_t maxdelay; - - maxdelay = MV_GetMaxReverbDelay(); - MV_ReverbDelay = max(MixBufferSize, min(delay, maxdelay)); - MV_ReverbDelay *= MV_SampleSize; -} - - -/*--------------------------------------------------------------------- - Function: MV_SetMixMode - - Prepares Multivoc to play stereo of mono digitized sounds. ----------------------------------------------------------------------*/ - -int32_t MV_SetMixMode -( - int32_t numchannels, - int32_t samplebits -) - -{ - int32_t mode; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - mode = 0; - if (numchannels == 2) - { - mode |= STEREO; - } - if (samplebits == 16) - { - mode |= SIXTEEN_BIT; - } - - MV_MixMode = mode; - - MV_Channels = 1; - if (MV_MixMode & STEREO) - { - MV_Channels = 2; - } - - MV_Bits = 8; - if (MV_MixMode & SIXTEEN_BIT) - { - MV_Bits = 16; - } - - MV_BuffShift = 7 + MV_Channels; - MV_SampleSize = sizeof(MONO8) * MV_Channels; - - if (MV_Bits == 8) - { - MV_Silence = SILENCE_8BIT; - } - else - { - MV_Silence = SILENCE_16BIT; - MV_BuffShift += 1; - MV_SampleSize *= 2; - } - - MV_BufferSize = MixBufferSize * MV_SampleSize; - MV_NumberOfBuffers = TotalBufferSize / MV_BufferSize; - MV_BufferLength = TotalBufferSize; - - MV_RightChannelOffset = MV_SampleSize / 2; - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_StartPlayback - - Starts the sound playback engine. ----------------------------------------------------------------------*/ - -int32_t MV_StartPlayback -( - void -) - -{ - int32_t status; - int32_t buffer; - - // Initialize the buffers - ClearBuffer_DW(MV_MixBuffer[ 0 ], MV_Silence, TotalBufferSize >> 2); - for (buffer = 0; buffer < MV_NumberOfBuffers; buffer++) - { - MV_BufferEmpty[ buffer ] = TRUE; - } - - // Set the mix buffer variables - MV_MixPage = 1; - - MV_MixFunction = MV_Mix; - -//JIM -// MV_MixRate = MV_RequestedMixRate; -// return( MV_Ok ); - - // Start playback - status = SoundDriver_BeginPlayback(MV_MixBuffer[0], MV_BufferSize, - MV_NumberOfBuffers, MV_ServiceVoc); - if (status != MV_Ok) - { - MV_SetErrorCode(MV_DriverError); - return MV_Error; - } - - MV_MixRate = MV_RequestedMixRate; - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_StopPlayback - - Stops the sound playback engine. ----------------------------------------------------------------------*/ - -void MV_StopPlayback -( - void -) - -{ - VoiceNode *voice; - VoiceNode *next; - - // Stop sound playback - SoundDriver_StopPlayback(); - - // Make sure all callbacks are done. - DisableInterrupts(); - - for (voice = VoiceList.next; voice != &VoiceList; voice = next) - { - next = voice->next; - - MV_StopVoice(voice); - - if (MV_CallBackFunc) - MV_CallBackFunc(voice->callbackval); - } - - RestoreInterrupts(); -} - - -/*--------------------------------------------------------------------- - Function: MV_StartDemandFeedPlayback - - Plays a digitized sound from a user controlled buffering system. ----------------------------------------------------------------------*/ - -int32_t MV_StartDemandFeedPlayback -( - void (*function)(char **ptr, uint32_t *length), - int32_t rate, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - // Request a voice from the voice pool - voice = MV_AllocVoice(priority); - if (voice == NULL) - { - MV_SetErrorCode(MV_NoVoices); - return(MV_Error); - } - - voice->wavetype = DemandFeed; - voice->bits = 8; - voice->channels = 1; - voice->GetSound = MV_GetNextDemandFeedBlock; - voice->NextBlock = NULL; - voice->DemandFeed = function; - voice->LoopStart = NULL; - voice->LoopCount = 0; - voice->BlockLength = 0; - voice->position = 0; - voice->sound = NULL; - voice->length = 0; - voice->BlockLength = 0; - voice->Playing = TRUE; - voice->next = NULL; - voice->prev = NULL; - voice->priority = priority; - voice->callbackval = callbackval; - - MV_SetVoicePitch(voice, rate, pitchoffset); - MV_SetVoiceVolume(voice, vol, left, right); - MV_PlayVoice(voice); - - return(voice->handle); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayRaw - - Begin playback of sound data with the given sound levels and - priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayRaw -( - char *ptr, - uint32_t length, - unsigned rate, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t status; - - status = MV_PlayLoopedRaw(ptr, length, NULL, NULL, rate, pitchoffset, - vol, left, right, priority, callbackval); - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayLoopedRaw - - Begin playback of sound data with the given sound levels and - priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayLoopedRaw -( - char *ptr, - uint32_t length, - char *loopstart, - char *loopend, - unsigned rate, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - // Request a voice from the voice pool - voice = MV_AllocVoice(priority); - if (voice == NULL) - { - MV_SetErrorCode(MV_NoVoices); - return(MV_Error); - } - - voice->wavetype = Raw; - voice->bits = 8; - voice->channels = 1; - voice->GetSound = MV_GetNextRawBlock; - voice->Playing = TRUE; - voice->NextBlock = ptr; - voice->position = 0; - voice->BlockLength = length; - voice->length = 0; - voice->next = NULL; - voice->prev = NULL; - voice->priority = priority; - voice->callbackval = callbackval; - voice->LoopStart = loopstart; - voice->LoopEnd = loopend; - voice->LoopSize = (voice->LoopEnd - voice->LoopStart) + 1; - - MV_SetVoicePitch(voice, rate, pitchoffset); - MV_SetVoiceVolume(voice, vol, left, right); - MV_PlayVoice(voice); - - return(voice->handle); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayWAV - - Begin playback of sound data with the given sound levels and - priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayWAV -( - char *ptr, - uint32_t length, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t status; - - status = MV_PlayLoopedWAV(ptr, length, -1, -1, pitchoffset, vol, left, right, - priority, callbackval); - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayWAV3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int32_t MV_PlayWAV3D -( - char *ptr, - uint32_t length, - int32_t pitchoffset, - int32_t angle, - int32_t distance, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t left; - int32_t right; - int32_t mid; - int32_t volume; - int32_t status; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - if (distance < 0) - { - distance = -distance; - angle += MV_NumPanPositions / 2; - } - - volume = MIX_VOLUME(distance); - - // Ensure angle is within 0 - 31 - angle &= MV_MaxPanPosition; - - left = MV_PanTable[ angle ][ volume ].left; - right = MV_PanTable[ angle ][ volume ].right; - mid = max(0, 255 - distance); - - status = MV_PlayWAV(ptr, length, pitchoffset, mid, left, right, priority, - callbackval); - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayLoopedWAV - - Begin playback of sound data with the given sound levels and - priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayLoopedWAV -( - char *ptr, - uint32_t ptrlength, - int32_t loopstart, - int32_t loopend, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - riff_header riff; - format_header format; - data_header data; - VoiceNode *voice; - int32_t length; - - UNREFERENCED_PARAMETER(ptrlength); - UNREFERENCED_PARAMETER(loopend); - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - memcpy(&riff, ptr, sizeof(riff_header)); - riff.file_size = LITTLE32(riff.file_size); - riff.format_size = LITTLE32(riff.format_size); - - if ((memcmp(riff.RIFF, "RIFF", 4) != 0) || - (memcmp(riff.WAVE, "WAVE", 4) != 0) || - (memcmp(riff.fmt, "fmt ", 4) != 0)) - { - MV_SetErrorCode(MV_InvalidWAVFile); - return(MV_Error); - } - - memcpy(&format, ptr + sizeof(riff_header), sizeof(format_header)); - format.wFormatTag = LITTLE16(format.wFormatTag); - format.nChannels = LITTLE16(format.nChannels); - format.nSamplesPerSec = LITTLE32(format.nSamplesPerSec); - format.nAvgBytesPerSec = LITTLE32(format.nAvgBytesPerSec); - format.nBlockAlign = LITTLE16(format.nBlockAlign); - format.nBitsPerSample = LITTLE16(format.nBitsPerSample); - - memcpy(&data, ptr + sizeof(riff_header) + riff.format_size, sizeof(data_header)); - data.size = LITTLE32(data.size); - - // Check if it's PCM data. - if (format.wFormatTag != 1) - { - MV_SetErrorCode(MV_InvalidWAVFile); - return(MV_Error); - } - - if (format.nChannels != 1 && format.nChannels != 2) - { - MV_SetErrorCode(MV_InvalidWAVFile); - return(MV_Error); - } - - if ((format.nBitsPerSample != 8) && - (format.nBitsPerSample != 16)) - { - MV_SetErrorCode(MV_InvalidWAVFile); - return(MV_Error); - } - - if (memcmp(data.DATA, "data", 4) != 0) - { - MV_SetErrorCode(MV_InvalidWAVFile); - return(MV_Error); - } - - // Request a voice from the voice pool - voice = MV_AllocVoice(priority); - if (voice == NULL) - { - MV_SetErrorCode(MV_NoVoices); - return(MV_Error); - } - - voice->wavetype = WAV; - voice->bits = format.nBitsPerSample; - voice->channels = format.nChannels; - voice->GetSound = MV_GetNextWAVBlock; - - length = data.size; - if (voice->bits == 16) - { - data.size &= ~1; - length /= 2; - } - if (voice->channels == 2) - { - data.size &= ~1; - length /= 2; - } - - voice->Playing = TRUE; - voice->Paused = FALSE; - voice->DemandFeed = NULL; - voice->LoopStart = NULL; - voice->LoopCount = 0; - voice->position = 0; - voice->length = 0; - voice->BlockLength = length; - voice->NextBlock = (char *)((intptr_t) ptr + sizeof(riff_header) + riff.format_size + sizeof(data_header)); - voice->next = NULL; - voice->prev = NULL; - voice->priority = priority; - voice->callbackval = callbackval; - voice->LoopStart = loopstart >= 0 ? voice->NextBlock : NULL; - voice->LoopEnd = NULL; - voice->LoopSize = length; - - MV_SetVoicePitch(voice, format.nSamplesPerSec, pitchoffset); - MV_SetVoiceVolume(voice, vol, left, right); - MV_PlayVoice(voice); - - return(voice->handle); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayVOC3D - - Begin playback of sound data at specified angle and distance - from listener. ----------------------------------------------------------------------*/ - -int32_t MV_PlayVOC3D -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t angle, - int32_t distance, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t left; - int32_t right; - int32_t mid; - int32_t volume; - int32_t status; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - if (distance < 0) - { - distance = -distance; - angle += MV_NumPanPositions / 2; - } - - volume = MIX_VOLUME(distance); - - // Ensure angle is within 0 - 31 - angle &= MV_MaxPanPosition; - - left = MV_PanTable[ angle ][ volume ].left; - right = MV_PanTable[ angle ][ volume ].right; - mid = max(0, 255 - distance); - - status = MV_PlayVOC(ptr, ptrlength, pitchoffset, mid, left, right, priority, - callbackval); - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayVOC - - Begin playback of sound data with the given sound levels and - priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayVOC -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - int32_t status; - - status = MV_PlayLoopedVOC(ptr, ptrlength, -1, -1, pitchoffset, vol, left, right, - priority, callbackval); - - return(status); -} - - -/*--------------------------------------------------------------------- - Function: MV_PlayLoopedVOC - - Begin playback of sound data with the given sound levels and - priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayLoopedVOC -( - char *ptr, - uint32_t ptrlength, - int32_t loopstart, - int32_t loopend, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval -) - -{ - VoiceNode *voice; - int32_t status; - - UNREFERENCED_PARAMETER(ptrlength); - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - // Make sure it's a valid VOC file. - status = memcmp(ptr, "Creative Voice File", 19); - if (status != 0) - { - MV_SetErrorCode(MV_InvalidVOCFile); - return(MV_Error); - } - - // Request a voice from the voice pool - voice = MV_AllocVoice(priority); - if (voice == NULL) - { - MV_SetErrorCode(MV_NoVoices); - return(MV_Error); - } - - voice->wavetype = VOC; - voice->bits = 8; - voice->channels = 1; - voice->GetSound = MV_GetNextVOCBlock; - voice->NextBlock = ptr + LITTLE16(*(uint16_t *)(ptr + 0x14)); - voice->DemandFeed = NULL; - voice->LoopStart = NULL; - voice->LoopCount = 0; - voice->BlockLength = 0; - voice->PitchScale = PITCH_GetScale(pitchoffset); - voice->length = 0; - voice->next = NULL; - voice->prev = NULL; - voice->priority = priority; - voice->callbackval = callbackval; - voice->LoopStart = loopstart >= 0 ? voice->NextBlock : 0; - voice->LoopEnd = 0; - voice->LoopSize = loopend - loopstart + 1; - - if (loopstart < 0) - { - voice->LoopStart = NULL; - voice->LoopEnd = NULL; - } - - MV_SetVoiceVolume(voice, vol, left, right); - MV_PlayVoice(voice); - - return(voice->handle); -} - - -/*--------------------------------------------------------------------- - Function: MV_CreateVolumeTable - - Create the table used to convert sound data to a specific volume - level. ----------------------------------------------------------------------*/ - -void MV_CreateVolumeTable -( - int32_t index, - int32_t volume, - int32_t MaxVolume -) - -{ - int32_t val; - int32_t level; - int32_t i; - - level = (volume * MaxVolume) / MV_MaxTotalVolume; - if (MV_Bits == 16) - { - for (i = 0; i < 65536; i += 256) - { - val = i - 0x8000; - val *= level; - val /= MV_MaxVolume; - MV_VolumeTable[ index ][ i / 256 ] = val; - } - } - else - { - for (i = 0; i < 256; i++) - { - val = i - 0x80; - val *= level; - val /= MV_MaxVolume; - MV_VolumeTable[ volume ][ i ] = val; - } - } -} - - -/*--------------------------------------------------------------------- - Function: MV_CalcVolume - - Create the table used to convert sound data to a specific volume - level. ----------------------------------------------------------------------*/ - -void MV_CalcVolume -( - int32_t MaxVolume -) - -{ - int32_t volume; - - for (volume = 0; volume < 128; volume++) - { - MV_HarshClipTable[ volume ] = 0; - MV_HarshClipTable[ volume + 384 ] = 255; - } - for (volume = 0; volume < 256; volume++) - { - MV_HarshClipTable[ volume + 128 ] = volume; - } - - // For each volume level, create a translation table with the - // appropriate volume calculated. - for (volume = 0; volume <= MV_MaxVolume; volume++) - { - MV_CreateVolumeTable(volume, volume, MaxVolume); - } -} - - -/*--------------------------------------------------------------------- - Function: MV_CalcPanTable - - Create the table used to determine the stereo volume level of - a sound located at a specific angle and distance from the listener. ----------------------------------------------------------------------*/ - -void MV_CalcPanTable -( - void -) - -{ - int32_t level; - int32_t angle; - int32_t distance; - int32_t HalfAngle; - int32_t ramp; - - HalfAngle = (MV_NumPanPositions / 2); - - for (distance = 0; distance <= MV_MaxVolume; distance++) - { - level = (255 * (MV_MaxVolume - distance)) / MV_MaxVolume; - for (angle = 0; angle <= HalfAngle / 2; angle++) - { - ramp = level - ((level * angle) / - (MV_NumPanPositions / 4)); - - MV_PanTable[ angle ][ distance ].left = ramp; - MV_PanTable[ HalfAngle - angle ][ distance ].left = ramp; - MV_PanTable[ HalfAngle + angle ][ distance ].left = level; - MV_PanTable[ MV_MaxPanPosition - angle ][ distance ].left = level; - - MV_PanTable[ angle ][ distance ].right = level; - MV_PanTable[ HalfAngle - angle ][ distance ].right = level; - MV_PanTable[ HalfAngle + angle ][ distance ].right = ramp; - MV_PanTable[ MV_MaxPanPosition - angle ][ distance ].right = ramp; - } - } -} - - -/*--------------------------------------------------------------------- - Function: MV_SetVolume - - Sets the volume of digitized sound playback. ----------------------------------------------------------------------*/ - -void MV_SetVolume -( - int32_t volume -) - -{ - volume = max(0, volume); - volume = min(volume, MV_MaxTotalVolume); - - MV_TotalVolume = volume; - - // Calculate volume table - MV_CalcVolume(volume); -} - - -/*--------------------------------------------------------------------- - Function: MV_GetVolume - - Returns the volume of digitized sound playback. ----------------------------------------------------------------------*/ - -int32_t MV_GetVolume -( - void -) - -{ - return(MV_TotalVolume); -} - - -/*--------------------------------------------------------------------- - Function: MV_SetCallBack - - Set the function to call when a voice stops. ----------------------------------------------------------------------*/ - -void MV_SetCallBack -( - void (*function)(uint32_t) -) - -{ - MV_CallBackFunc = function; -} - - -/*--------------------------------------------------------------------- - Function: MV_SetReverseStereo - - Set the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -void MV_SetReverseStereo -( - int32_t setting -) - -{ - MV_SwapLeftRight = setting; -} - - -/*--------------------------------------------------------------------- - Function: MV_GetReverseStereo - - Returns the orientation of the left and right channels. ----------------------------------------------------------------------*/ - -int32_t MV_GetReverseStereo -( - void -) - -{ - return(MV_SwapLeftRight); -} - - -/*--------------------------------------------------------------------- - Function: MV_Init - - Perform the initialization of variables and memory used by - Multivoc. ----------------------------------------------------------------------*/ - -int32_t MV_Init -( - int32_t soundcard, - int32_t MixRate, - int32_t Voices, - int32_t numchannels, - int32_t samplebits, - void * initdata -) - -{ - char *ptr; - int32_t status; - int32_t buffer; - int32_t index; - - if (MV_Installed) - { - MV_Shutdown(); - } - - MV_SetErrorCode(MV_Ok); - - MV_TotalMemory = Voices * sizeof(VoiceNode) + sizeof(HARSH_CLIP_TABLE_8) + TotalBufferSize; - ptr = (char *) calloc(1, MV_TotalMemory); - if (!ptr) - { - MV_SetErrorCode(MV_NoMem); - return(MV_Error); - } - - MV_Voices = (VoiceNode *)ptr; - ptr += Voices * sizeof(VoiceNode); - - MV_HarshClipTable = ptr; - ptr += sizeof(HARSH_CLIP_TABLE_8); - - // Set number of voices before calculating volume table - MV_MaxVoices = Voices; - - LL_Reset((VoiceNode*) &VoiceList, next, prev); - LL_Reset((VoiceNode*) &VoicePool, next, prev); - - for (index = 0; index < Voices; index++) - { - LL_Add((VoiceNode*) &VoicePool, &MV_Voices[ index ], next, prev); - } - - MV_SetReverseStereo(FALSE); - - ASS_SoundDriver = soundcard; - - // Initialize the sound card - status = SoundDriver_Init(&MixRate, &numchannels, &samplebits, initdata); - if (status != MV_Ok) - { - MV_SetErrorCode(MV_DriverError); - } - - if (MV_ErrorCode != MV_Ok) - { - status = MV_ErrorCode; - - free(MV_Voices); - MV_Voices = NULL; - MV_HarshClipTable = NULL; - MV_TotalMemory = 0; - - MV_SetErrorCode(status); - return(MV_Error); - } - - MV_Installed = TRUE; - MV_CallBackFunc = NULL; - MV_ReverbLevel = 0; - MV_ReverbTable = NULL; - - // Set the sampling rate - MV_RequestedMixRate = MixRate; - - // Set Mixer to play stereo digitized sound - MV_SetMixMode(numchannels, samplebits); - MV_ReverbDelay = MV_BufferSize * 3; - - // Make sure we don't cross a physical page - MV_MixBuffer[ MV_NumberOfBuffers ] = ptr; - for (buffer = 0; buffer < MV_NumberOfBuffers; buffer++) - { - MV_MixBuffer[ buffer ] = ptr; - ptr += MV_BufferSize; - } - - // Calculate pan table - MV_CalcPanTable(); - - MV_SetVolume(MV_MaxTotalVolume); - - // Start the playback engine - status = MV_StartPlayback(); - if (status != MV_Ok) - { - // Preserve error code while we shutdown. - status = MV_ErrorCode; - MV_Shutdown(); - MV_SetErrorCode(status); - return(MV_Error); - } - - return(MV_Ok); -} - - -/*--------------------------------------------------------------------- - Function: MV_Shutdown - - Restore any resources allocated by Multivoc back to the system. ----------------------------------------------------------------------*/ - -int32_t MV_Shutdown -( - void -) - -{ - int32_t buffer; - - if (!MV_Installed) - { - return(MV_Ok); - } - - MV_KillAllVoices(); - - MV_Installed = FALSE; - - // Stop the sound playback engine - MV_StopPlayback(); - - // Shutdown the sound card - SoundDriver_Shutdown(); - - // Free any voices we allocated - free(MV_Voices); - MV_Voices = NULL; - MV_TotalMemory = 0; - - LL_Reset((VoiceNode*) &VoiceList, next, prev); - LL_Reset((VoiceNode*) &VoicePool, next, prev); - - MV_MaxVoices = 1; - - // Release the descriptor from our mix buffer - for (buffer = 0; buffer < NumberOfBuffers; buffer++) - { - MV_MixBuffer[ buffer ] = NULL; - } - - return(MV_Ok); -} - -int32_t MV_SetVoiceCallback(int32_t handle, uint32_t callbackval) -{ - VoiceNode *voice; - - if (!MV_Installed) - { - MV_SetErrorCode(MV_NotInstalled); - return(MV_Error); - } - - DisableInterrupts(); - - if ((voice = MV_GetVoice(handle)) == NULL) - { - RestoreInterrupts(); - MV_SetErrorCode(MV_VoiceNotFound); - return(MV_Error); - } - - voice->callbackval = callbackval; - - RestoreInterrupts(); - - return(MV_Ok); -} - -void MV_SetPrintf(void (*function)(const char *, ...)) -{ - MV_Printf = function; -} - - -// vim:ts=3:expandtab: diff --git a/polymer-perf/eduke32/source/jaudiolib/src/multivoc.h b/polymer-perf/eduke32/source/jaudiolib/src/multivoc.h deleted file mode 100644 index e4794c7e8..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/multivoc.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - file: MULTIVOC.H - - author: James R. Dose - date: December 20, 1993 - - Public header for MULTIVOC.C - - (c) Copyright 1993 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#ifndef __MULTIVOC_H -#define __MULTIVOC_H - -#ifndef UNREFERENCED_PARAMETER -#define UNREFERENCED_PARAMETER(x) x=x -#endif - -#define MV_MinVoiceHandle 1 - -extern int32_t MV_ErrorCode; - -enum MV_Errors - { - MV_Warning = -2, - MV_Error = -1, - MV_Ok = 0, - MV_UnsupportedCard, - MV_NotInstalled, - MV_DriverError, - MV_NoVoices, - MV_NoMem, - MV_VoiceNotFound, - MV_InvalidVOCFile, - MV_InvalidWAVFile, - MV_InvalidVorbisFile, - MV_InvalidMixMode, - MV_NullRecordFunction - }; - -void (*MV_Printf)(const char *fmt, ...); -const char *MV_ErrorString( int32_t ErrorNumber ); -int32_t MV_VoicePlaying( int32_t handle ); -int32_t MV_KillAllVoices( void ); -int32_t MV_Kill( int32_t handle ); -int32_t MV_VoicesPlaying( void ); -int32_t MV_VoiceAvailable( int32_t priority ); -int32_t MV_SetPitch( int32_t handle, int32_t pitchoffset ); -int32_t MV_SetFrequency( int32_t handle, int32_t frequency ); -int32_t MV_PauseVoice( int32_t handle, int32_t pause ); -int32_t MV_EndLooping( int32_t handle ); -int32_t MV_SetPan( int32_t handle, int32_t vol, int32_t left, int32_t right ); -int32_t MV_Pan3D( int32_t handle, int32_t angle, int32_t distance ); -void MV_SetReverb( int32_t reverb ); -void MV_SetFastReverb( int32_t reverb ); -int32_t MV_GetMaxReverbDelay( void ); -int32_t MV_GetReverbDelay( void ); -void MV_SetReverbDelay( int32_t delay ); -int32_t MV_SetMixMode( int32_t numchannels, int32_t samplebits ); -int32_t MV_StartPlayback( void ); -void MV_StopPlayback( void ); -int32_t MV_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ), - int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval ); -int32_t MV_PlayRaw( char *ptr, uint32_t length, - unsigned rate, int32_t pitchoffset, int32_t vol, int32_t left, - int32_t right, int32_t priority, uint32_t callbackval ); -int32_t MV_PlayLoopedRaw( char *ptr, uint32_t length, - char *loopstart, char *loopend, unsigned rate, int32_t pitchoffset, - int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -int32_t MV_PlayWAV( char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol, int32_t left, - int32_t right, int32_t priority, uint32_t callbackval ); -int32_t MV_PlayWAV3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance, - int32_t priority, uint32_t callbackval ); -int32_t MV_PlayLoopedWAV( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -int32_t MV_PlayVOC3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance, - int32_t priority, uint32_t callbackval ); -int32_t MV_PlayVOC( char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval ); -int32_t MV_PlayLoopedVOC( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -int32_t MV_PlayVorbis3D( char *ptr, uint32_t length, int32_t pitchoffset, int32_t angle, int32_t distance, - int32_t priority, uint32_t callbackval ); -int32_t MV_PlayVorbis( char *ptr, uint32_t length, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, - int32_t priority, uint32_t callbackval ); -int32_t MV_PlayLoopedVorbis( char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, - int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, - uint32_t callbackval ); -void MV_CreateVolumeTable( int32_t index, int32_t volume, int32_t MaxVolume ); -void MV_SetVolume( int32_t volume ); -int32_t MV_GetVolume( void ); -void MV_SetCallBack( void ( *function )( uint32_t ) ); -void MV_SetReverseStereo( int32_t setting ); -int32_t MV_GetReverseStereo( void ); -int32_t MV_Init( int32_t soundcard, int32_t MixRate, int32_t Voices, int32_t numchannels, - int32_t samplebits, void * initdata ); -int32_t MV_Shutdown( void ); -int32_t MV_SetVoiceCallback(int32_t handle, uint32_t callbackval); -void MV_SetPrintf(void (*function)(const char *fmt, ...)); - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/src/pitch.c b/polymer-perf/eduke32/source/jaudiolib/src/pitch.c deleted file mode 100644 index 786fed04a..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/pitch.c +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - module: PITCH.C - - author: James R. Dose - date: June 14, 1993 - - Routines for pitch scaling. - - (c) Copyright 1993 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#include -#include -#include "pitch.h" - -#define MAXDETUNE 50 - -static uint32_t PitchTable[ 12 ][ MAXDETUNE ]; -static int32_t PITCH_Installed = 0; - - -/*--------------------------------------------------------------------- - Function: PITCH_Init - - Initializes pitch table. ----------------------------------------------------------------------*/ - - -void PITCH_Init(void) -{ - int32_t note; - int32_t detune; - - if (!PITCH_Installed) - { - for (note = 0; note < 12; note++) - { - for (detune = 0; detune < MAXDETUNE; detune++) - { - PitchTable[ note ][ detune ] = 0x10000 * - pow(2, (note * MAXDETUNE + detune) / (12.0 * MAXDETUNE)); - } - } - - PITCH_Installed = 1; - } -} - - -/*--------------------------------------------------------------------- - Function: PITCH_GetScale - - Returns a fixed-point value to scale number the specified amount. ----------------------------------------------------------------------*/ - -uint32_t PITCH_GetScale(int32_t pitchoffset) -{ - uint32_t scale; - int32_t octaveshift; - int32_t noteshift; - int32_t note; - int32_t detune; - - if ( !PITCH_Installed ) - PITCH_Init(); - - if (pitchoffset == 0) - return(PitchTable[ 0 ][ 0 ]); - - noteshift = pitchoffset % 1200; - if (noteshift < 0) - noteshift += 1200; - - note = noteshift / 100; - detune = (noteshift % 100) / (100 / MAXDETUNE); - octaveshift = (pitchoffset - noteshift) / 1200; - - if (detune < 0) - { - detune += (100 / MAXDETUNE); - note--; - if (note < 0) - { - note += 12; - octaveshift--; - } - } - - scale = PitchTable[ note ][ detune ]; - - return (octaveshift < 0) ? (scale >> -octaveshift) : (scale <<= octaveshift); -} - diff --git a/polymer-perf/eduke32/source/jaudiolib/src/pitch.h b/polymer-perf/eduke32/source/jaudiolib/src/pitch.h deleted file mode 100644 index 8bead2435..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/pitch.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright (C) 1994-1995 Apogee Software, Ltd. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/********************************************************************** - module: PITCH.H - - author: James R. Dose - date: June 14, 1994 - - Public header for PITCH.C - - (c) Copyright 1994 James R. Dose. All Rights Reserved. -**********************************************************************/ - -#ifndef __PITCH_H -#define __PITCH_H - -#include "inttypes.h" - -enum PITCH_ERRORS - { - PITCH_Warning = -2, - PITCH_Error = -1, - PITCH_Ok = 0, - }; - -//void PITCH_Init( void ); -uint32_t PITCH_GetScale( int32_t pitchoffset ); -void PITCH_UnlockMemory( void ); -int32_t PITCH_LockMemory( void ); -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/src/vorbis.c b/polymer-perf/eduke32/source/jaudiolib/src/vorbis.c deleted file mode 100644 index 0115e1857..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/src/vorbis.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - Copyright (C) 2009 Jonathon Fowler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - -/** - * OggVorbis source support for MultiVoc - */ - -#ifdef HAVE_VORBIS - -#define OV_EXCLUDE_STATIC_CALLBACKS - -#ifdef __APPLE__ -# include -#else -# include "vorbis/vorbisfile.h" -#endif - -#include -#include -#include -#ifndef _MSC_VER -#include -#endif -#include -#include "pitch.h" -#include "multivoc.h" -#include "_multivc.h" - -#ifndef min -#define min(x,y) ((x) < (y) ? (x) : (y)) -#endif -#ifndef max -#define max(x,y) ((x) > (y) ? (x) : (y)) -#endif - -#define BLOCKSIZE 0x8000 - -typedef struct { - void * ptr; - size_t length; - size_t pos; - - OggVorbis_File vf; - - char block[BLOCKSIZE]; - int32_t lastbitstream; -} vorbis_data; - - -static size_t read_vorbis(void * ptr, size_t size, size_t nmemb, void * datasource) -{ - vorbis_data * vorb = (vorbis_data *) datasource; - size_t nread = 0; - size_t bytes; - - errno = 0; - - if (vorb->length == vorb->pos) { - return 0; - } - - for (; nmemb > 0; nmemb--, nread++) { - bytes = vorb->length - vorb->pos; - if (size < bytes) { - bytes = size; - } - - memcpy(ptr, (uint8_t *)vorb->ptr + vorb->pos, bytes); - vorb->pos += bytes; - ptr = (uint8_t *)ptr + bytes; - - if (vorb->length == vorb->pos) { - nread++; - break; - } - } - - return nread; -} - - -static int32_t seek_vorbis(void * datasource, ogg_int64_t offset, int32_t whence) -{ - vorbis_data * vorb = (vorbis_data *) datasource; - - switch (whence) { - case SEEK_SET: vorb->pos = 0; break; - case SEEK_CUR: break; - case SEEK_END: vorb->pos = vorb->length; break; - } - - vorb->pos += offset; - - if (vorb->pos > vorb->length) { - vorb->pos = vorb->length; - } - - return vorb->pos; -} - -static int32_t close_vorbis(void * datasource) -{ - UNREFERENCED_PARAMETER(datasource); - return 0; -} - -static long tell_vorbis(void * datasource) -{ - vorbis_data * vorb = (vorbis_data *) datasource; - - return vorb->pos; -} - -static ov_callbacks vorbis_callbacks = { - read_vorbis, - seek_vorbis, - close_vorbis, - tell_vorbis -}; - - -/*--------------------------------------------------------------------- -Function: MV_GetNextVorbisBlock - -Controls playback of OggVorbis data ----------------------------------------------------------------------*/ - -static playbackstatus MV_GetNextVorbisBlock -( - VoiceNode *voice - ) - -{ - vorbis_data * vd = (vorbis_data *) voice->extra; - int32_t bytes, bytesread; - int32_t bitstream, err; - - voice->Playing = TRUE; - - bytesread = 0; - do { - bytes = ov_read(&vd->vf, vd->block + bytesread, BLOCKSIZE - bytesread, 0, 2, 1, &bitstream); - //fprintf(stderr, "ov_read = %d\n", bytes); - if (bytes > 0) { bytesread += bytes; continue; } - else if (bytes == OV_HOLE) continue; - else if (bytes == 0) { - if (voice->LoopStart) { - err = ov_pcm_seek_page(&vd->vf, 0); - if (err != 0) { - MV_Printf("MV_GetNextVorbisBlock ov_pcm_seek_page_lap: err %d\n", err); - } else { - continue; - } - } else { - break; - } - } else if (bytes < 0) { - MV_Printf("MV_GetNextVorbisBlock ov_read: err %d\n", bytes); - voice->Playing = FALSE; - return NoMoreData; - } - } while (bytesread < BLOCKSIZE); - - if (bytesread == 0) { - voice->Playing = FALSE; - return NoMoreData; - } - - if (bitstream != vd->lastbitstream) { - vorbis_info * vi = 0; - - vi = ov_info(&vd->vf, -1); - if (!vi || (vi->channels != 1 && vi->channels != 2)) { - voice->Playing = FALSE; - return NoMoreData; - } - - voice->channels = vi->channels; - voice->SamplingRate = vi->rate; - voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate; - voice->FixedPointBufferSize = ( voice->RateScale * MixBufferSize ) - voice->RateScale; - MV_SetVoiceMixMode( voice ); - vd->lastbitstream = bitstream; - } - - bytesread /= 2 * voice->channels; - - voice->position = 0; - voice->sound = vd->block; - voice->BlockLength = 0; - voice->length = bytesread << 16; - - return( KeepPlaying ); -} - - -/*--------------------------------------------------------------------- -Function: MV_PlayVorbis3D - -Begin playback of sound data at specified angle and distance -from listener. ----------------------------------------------------------------------*/ - -int32_t MV_PlayVorbis3D -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t angle, - int32_t distance, - int32_t priority, - uint32_t callbackval - ) - -{ - int32_t left; - int32_t right; - int32_t mid; - int32_t volume; - int32_t status; - - if ( !MV_Installed ) - { - MV_SetErrorCode( MV_NotInstalled ); - return( MV_Error ); - } - - if ( distance < 0 ) - { - distance = -distance; - angle += MV_NumPanPositions / 2; - } - - volume = MIX_VOLUME( distance ); - - // Ensure angle is within 0 - 31 - angle &= MV_MaxPanPosition; - - left = MV_PanTable[ angle ][ volume ].left; - right = MV_PanTable[ angle ][ volume ].right; - mid = max( 0, 255 - distance ); - - status = MV_PlayVorbis( ptr, ptrlength, pitchoffset, mid, left, right, priority, - callbackval ); - - return( status ); -} - - -/*--------------------------------------------------------------------- -Function: MV_PlayVorbis - -Begin playback of sound data with the given sound levels and -priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayVorbis -( - char *ptr, - uint32_t ptrlength, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval - ) - -{ - int32_t status; - - status = MV_PlayLoopedVorbis( ptr, ptrlength, -1, -1, pitchoffset, vol, left, right, - priority, callbackval ); - - return( status ); -} - - -/*--------------------------------------------------------------------- -Function: MV_PlayLoopedVorbis - -Begin playback of sound data with the given sound levels and -priority. ----------------------------------------------------------------------*/ - -int32_t MV_PlayLoopedVorbis -( - char *ptr, - uint32_t ptrlength, - int32_t loopstart, - int32_t loopend, - int32_t pitchoffset, - int32_t vol, - int32_t left, - int32_t right, - int32_t priority, - uint32_t callbackval - ) - -{ - VoiceNode *voice; - int32_t status; - vorbis_data * vd = 0; - vorbis_info * vi = 0; - - UNREFERENCED_PARAMETER(loopend); - - if ( !MV_Installed ) - { - MV_SetErrorCode( MV_NotInstalled ); - return( MV_Error ); - } - - vd = (vorbis_data *) malloc( sizeof(vorbis_data) ); - if (!vd) { - MV_SetErrorCode( MV_InvalidVorbisFile ); - return MV_Error; - } - - memset(vd, 0, sizeof(vorbis_data)); - vd->ptr = ptr; - vd->pos = 0; - vd->length = ptrlength; - vd->lastbitstream = -1; - - status = ov_open_callbacks((void *) vd, &vd->vf, 0, 0, vorbis_callbacks); - if (status < 0) { - MV_Printf("MV_PlayLoopedVorbis: err %d\n", status); - MV_SetErrorCode( MV_InvalidVorbisFile ); - return MV_Error; - } - - vi = ov_info(&vd->vf, 0); - if (!vi) { - ov_clear(&vd->vf); - free(vd); - MV_SetErrorCode( MV_InvalidVorbisFile ); - return MV_Error; - } - - if (vi->channels != 1 && vi->channels != 2) { - ov_clear(&vd->vf); - free(vd); - MV_SetErrorCode( MV_InvalidVorbisFile ); - return MV_Error; - } - - // Request a voice from the voice pool - voice = MV_AllocVoice( priority ); - if ( voice == NULL ) - { - ov_clear(&vd->vf); - free(vd); - MV_SetErrorCode( MV_NoVoices ); - return( MV_Error ); - } - - voice->wavetype = Vorbis; - voice->bits = 16; - voice->channels = vi->channels; - voice->extra = (void *) vd; - voice->GetSound = MV_GetNextVorbisBlock; - voice->NextBlock = vd->block; - voice->DemandFeed = NULL; - voice->LoopCount = 0; - voice->BlockLength = 0; - voice->PitchScale = PITCH_GetScale( pitchoffset ); - voice->length = 0; - voice->next = NULL; - voice->prev = NULL; - voice->priority = priority; - voice->callbackval = callbackval; - voice->LoopStart = (char *) (loopstart >= 0 ? TRUE : FALSE); - voice->LoopEnd = 0; - voice->LoopSize = 0; - voice->Playing = TRUE; - voice->Paused = FALSE; - - voice->SamplingRate = vi->rate; - voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate; - voice->FixedPointBufferSize = ( voice->RateScale * MixBufferSize ) - - voice->RateScale; - MV_SetVoiceMixMode( voice ); - - MV_SetVoiceVolume( voice, vol, left, right ); - MV_PlayVoice( voice ); - - return( voice->handle ); -} - - -void MV_ReleaseVorbisVoice( VoiceNode * voice ) -{ - vorbis_data * vd = (vorbis_data *) voice->extra; - - if (voice->wavetype != Vorbis) { - return; - } - - ov_clear(&vd->vf); - free(vd); - - voice->extra = 0; -} - -#endif //HAVE_VORBIS diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/README.txt b/polymer-perf/eduke32/source/jaudiolib/third-party/README.txt deleted file mode 100644 index 3dbfa6736..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -OS X frameworks compiled from the sources contained in the Max audio ripper -application by Stephen Booth. - - http://svn.sbooth.org/max/trunk/Frameworks/ogg/ - http://svn.sbooth.org/max/trunk/Frameworks/vorbis/ - http://sbooth.org/Max/ - - -MinGW binaries compiled from vanilla Xiph.org libogg-1.1.4 and libvorbis-1.2.3 -on MinGW GCC 3.4.5. - - http://xiph.org/downloads/ - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/config_types.h b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/config_types.h deleted file mode 100644 index 327ef0b33..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/config_types.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __CONFIG_TYPES_H__ -#define __CONFIG_TYPES_H__ - -/* these are filled in by configure */ -typedef short ogg_int16_t; -typedef unsigned short ogg_uint16_t; -typedef int ogg_int32_t; -typedef unsigned int ogg_uint32_t; -typedef long long ogg_int64_t; - -#endif diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/ogg.h b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/ogg.h deleted file mode 100644 index ae0cfd534..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/ogg.h +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel libogg include - last mod: $Id: ogg.h 16051 2009-05-27 05:00:06Z xiphmont $ - - ********************************************************************/ -#ifndef _OGG_H -#define _OGG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -typedef struct { - void *iov_base; - size_t iov_len; -} ogg_iovec_t; - -typedef struct { - long endbyte; - int endbit; - - unsigned char *buffer; - unsigned char *ptr; - long storage; -} oggpack_buffer; - -/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ - -typedef struct { - unsigned char *header; - long header_len; - unsigned char *body; - long body_len; -} ogg_page; - -/* ogg_stream_state contains the current encode/decode state of a logical - Ogg bitstream **********************************************************/ - -typedef struct { - unsigned char *body_data; /* bytes from packet bodies */ - long body_storage; /* storage elements allocated */ - long body_fill; /* elements stored; fill mark */ - long body_returned; /* elements of fill returned */ - - - int *lacing_vals; /* The values that will go to the segment table */ - ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact - this way, but it is simple coupled to the - lacing fifo */ - long lacing_storage; - long lacing_fill; - long lacing_packet; - long lacing_returned; - - unsigned char header[282]; /* working space for header encode */ - int header_fill; - - int e_o_s; /* set when we have buffered the last packet in the - logical bitstream */ - int b_o_s; /* set after we've written the initial page - of a logical bitstream */ - long serialno; - long pageno; - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ - ogg_int64_t granulepos; - -} ogg_stream_state; - -/* ogg_packet is used to encapsulate the data and metadata belonging - to a single raw Ogg/Vorbis packet *************************************/ - -typedef struct { - unsigned char *packet; - long bytes; - long b_o_s; - long e_o_s; - - ogg_int64_t granulepos; - - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ -} ogg_packet; - -typedef struct { - unsigned char *data; - int storage; - int fill; - int returned; - - int unsynced; - int headerbytes; - int bodybytes; -} ogg_sync_state; - -/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ - -extern void oggpack_writeinit(oggpack_buffer *b); -extern int oggpack_writecheck(oggpack_buffer *b); -extern void oggpack_writetrunc(oggpack_buffer *b,long bits); -extern void oggpack_writealign(oggpack_buffer *b); -extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); -extern void oggpack_reset(oggpack_buffer *b); -extern void oggpack_writeclear(oggpack_buffer *b); -extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); -extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); -extern long oggpack_look(oggpack_buffer *b,int bits); -extern long oggpack_look1(oggpack_buffer *b); -extern void oggpack_adv(oggpack_buffer *b,int bits); -extern void oggpack_adv1(oggpack_buffer *b); -extern long oggpack_read(oggpack_buffer *b,int bits); -extern long oggpack_read1(oggpack_buffer *b); -extern long oggpack_bytes(oggpack_buffer *b); -extern long oggpack_bits(oggpack_buffer *b); -extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); - -extern void oggpackB_writeinit(oggpack_buffer *b); -extern int oggpackB_writecheck(oggpack_buffer *b); -extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); -extern void oggpackB_writealign(oggpack_buffer *b); -extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); -extern void oggpackB_reset(oggpack_buffer *b); -extern void oggpackB_writeclear(oggpack_buffer *b); -extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); -extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits); -extern long oggpackB_look(oggpack_buffer *b,int bits); -extern long oggpackB_look1(oggpack_buffer *b); -extern void oggpackB_adv(oggpack_buffer *b,int bits); -extern void oggpackB_adv1(oggpack_buffer *b); -extern long oggpackB_read(oggpack_buffer *b,int bits); -extern long oggpackB_read1(oggpack_buffer *b); -extern long oggpackB_bytes(oggpack_buffer *b); -extern long oggpackB_bits(oggpack_buffer *b); -extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b); - -/* Ogg BITSTREAM PRIMITIVES: encoding **************************/ - -extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); -extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, - int count, long e_o_s, ogg_int64_t granulepos); -extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); - -/* Ogg BITSTREAM PRIMITIVES: decoding **************************/ - -extern int ogg_sync_init(ogg_sync_state *oy); -extern int ogg_sync_clear(ogg_sync_state *oy); -extern int ogg_sync_reset(ogg_sync_state *oy); -extern int ogg_sync_destroy(ogg_sync_state *oy); -extern int ogg_sync_check(ogg_sync_state *oy); - -extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); -extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); -extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); -extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); -extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); -extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); - -/* Ogg BITSTREAM PRIMITIVES: general ***************************/ - -extern int ogg_stream_init(ogg_stream_state *os,int serialno); -extern int ogg_stream_clear(ogg_stream_state *os); -extern int ogg_stream_reset(ogg_stream_state *os); -extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); -extern int ogg_stream_destroy(ogg_stream_state *os); -extern int ogg_stream_check(ogg_stream_state *os); -extern int ogg_stream_eos(ogg_stream_state *os); - -extern void ogg_page_checksum_set(ogg_page *og); - -extern int ogg_page_version(const ogg_page *og); -extern int ogg_page_continued(const ogg_page *og); -extern int ogg_page_bos(const ogg_page *og); -extern int ogg_page_eos(const ogg_page *og); -extern ogg_int64_t ogg_page_granulepos(const ogg_page *og); -extern int ogg_page_serialno(const ogg_page *og); -extern long ogg_page_pageno(const ogg_page *og); -extern int ogg_page_packets(const ogg_page *og); - -extern void ogg_packet_clear(ogg_packet *op); - - -#ifdef __cplusplus -} -#endif - -#endif /* _OGG_H */ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/os_types.h b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/os_types.h deleted file mode 100644 index f6f8b3818..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/ogg/os_types.h +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os_types.h 16649 2009-10-25 00:49:58Z ds $ - - ********************************************************************/ -#ifndef _OS_TYPES_H -#define _OS_TYPES_H - -/* make it easy on the folks that want to compile the libs with a - different malloc than stdlib */ -#define _ogg_malloc malloc -#define _ogg_calloc calloc -#define _ogg_realloc realloc -#define _ogg_free free - -#if defined(_WIN32) - -# if defined(__CYGWIN__) -# include - typedef int16_t ogg_int16_t; - typedef uint16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef uint32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - typedef uint64_t ogg_uint64_t; -# elif defined(__MINGW32__) -# include - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - typedef unsigned long long ogg_uint64_t; -# elif defined(__MWERKS__) - typedef long long ogg_int64_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; -# else - /* MSVC/Borland */ - typedef __int64 ogg_int64_t; - typedef __int32 ogg_int32_t; - typedef unsigned __int32 ogg_uint32_t; - typedef __int16 ogg_int16_t; - typedef unsigned __int16 ogg_uint16_t; -# endif - -#elif defined(__MACOS__) - -# include - typedef SInt16 ogg_int16_t; - typedef UInt16 ogg_uint16_t; - typedef SInt32 ogg_int32_t; - typedef UInt32 ogg_uint32_t; - typedef SInt64 ogg_int64_t; - -#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ - -# include - typedef int16_t ogg_int16_t; - typedef u_int16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef u_int32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - -#elif defined(__HAIKU__) - - /* Haiku */ -# include - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - -#elif defined(__BEOS__) - - /* Be */ -# include - typedef int16_t ogg_int16_t; - typedef u_int16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef u_int32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - -#elif defined (__EMX__) - - /* OS/2 GCC */ - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - -#elif defined (DJGPP) - - /* DJGPP */ - typedef short ogg_int16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - -#elif defined(R5900) - - /* PS2 EE */ - typedef long ogg_int64_t; - typedef int ogg_int32_t; - typedef unsigned ogg_uint32_t; - typedef short ogg_int16_t; - -#elif defined(__SYMBIAN32__) - - /* Symbian GCC */ - typedef signed short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef signed int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long int ogg_int64_t; - -#elif defined(__TMS320C6X__) - - /* TI C64x compiler */ - typedef signed short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef signed int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long int ogg_int64_t; - -#else - -# include -# include - -#endif - -#endif /* _OS_TYPES_H */ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/vorbis/codec.h b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/vorbis/codec.h deleted file mode 100644 index 999aa3351..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/vorbis/codec.h +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - - ******************************************************************** - - function: libvorbis codec headers - last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $ - - ********************************************************************/ - -#ifndef _vorbis_codec_h_ -#define _vorbis_codec_h_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include - -typedef struct vorbis_info{ - int version; - int channels; - long rate; - - /* The below bitrate declarations are *hints*. - Combinations of the three values carry the following implications: - - all three set to the same value: - implies a fixed rate bitstream - only nominal set: - implies a VBR stream that averages the nominal bitrate. No hard - upper/lower limit - upper and or lower set: - implies a VBR bitstream that obeys the bitrate limits. nominal - may also be set to give a nominal rate. - none set: - the coder does not care to speculate. - */ - - long bitrate_upper; - long bitrate_nominal; - long bitrate_lower; - long bitrate_window; - - void *codec_setup; -} vorbis_info; - -/* vorbis_dsp_state buffers the current vorbis audio - analysis/synthesis state. The DSP state belongs to a specific - logical bitstream ****************************************************/ -typedef struct vorbis_dsp_state{ - int analysisp; - vorbis_info *vi; - - float **pcm; - float **pcmret; - int pcm_storage; - int pcm_current; - int pcm_returned; - - int preextrapolate; - int eofflag; - - long lW; - long W; - long nW; - long centerW; - - ogg_int64_t granulepos; - ogg_int64_t sequence; - - ogg_int64_t glue_bits; - ogg_int64_t time_bits; - ogg_int64_t floor_bits; - ogg_int64_t res_bits; - - void *backend_state; -} vorbis_dsp_state; - -typedef struct vorbis_block{ - /* necessary stream state for linking to the framing abstraction */ - float **pcm; /* this is a pointer into local storage */ - oggpack_buffer opb; - - long lW; - long W; - long nW; - int pcmend; - int mode; - - int eofflag; - ogg_int64_t granulepos; - ogg_int64_t sequence; - vorbis_dsp_state *vd; /* For read-only access of configuration */ - - /* local storage to avoid remallocing; it's up to the mapping to - structure it */ - void *localstore; - long localtop; - long localalloc; - long totaluse; - struct alloc_chain *reap; - - /* bitmetrics for the frame */ - long glue_bits; - long time_bits; - long floor_bits; - long res_bits; - - void *internal; - -} vorbis_block; - -/* vorbis_block is a single block of data to be processed as part of -the analysis/synthesis stream; it belongs to a specific logical -bitstream, but is independent from other vorbis_blocks belonging to -that logical bitstream. *************************************************/ - -struct alloc_chain{ - void *ptr; - struct alloc_chain *next; -}; - -/* vorbis_info contains all the setup information specific to the - specific compression/decompression mode in progress (eg, - psychoacoustic settings, channel setup, options, codebook - etc). vorbis_info and substructures are in backends.h. -*********************************************************************/ - -/* the comments are not part of vorbis_info so that vorbis_info can be - static storage */ -typedef struct vorbis_comment{ - /* unlimited user comment fields. libvorbis writes 'libvorbis' - whatever vendor is set to in encode */ - char **user_comments; - int *comment_lengths; - int comments; - char *vendor; - -} vorbis_comment; - - -/* libvorbis encodes in two abstraction layers; first we perform DSP - and produce a packet (see docs/analysis.txt). The packet is then - coded into a framed OggSquish bitstream by the second layer (see - docs/framing.txt). Decode is the reverse process; we sync/frame - the bitstream and extract individual packets, then decode the - packet back into PCM audio. - - The extra framing/packetizing is used in streaming formats, such as - files. Over the net (such as with UDP), the framing and - packetization aren't necessary as they're provided by the transport - and the streaming layer is not used */ - -/* Vorbis PRIMITIVES: general ***************************************/ - -extern void vorbis_info_init(vorbis_info *vi); -extern void vorbis_info_clear(vorbis_info *vi); -extern int vorbis_info_blocksize(vorbis_info *vi,int zo); -extern void vorbis_comment_init(vorbis_comment *vc); -extern void vorbis_comment_add(vorbis_comment *vc, const char *comment); -extern void vorbis_comment_add_tag(vorbis_comment *vc, - const char *tag, const char *contents); -extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count); -extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag); -extern void vorbis_comment_clear(vorbis_comment *vc); - -extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); -extern int vorbis_block_clear(vorbis_block *vb); -extern void vorbis_dsp_clear(vorbis_dsp_state *v); -extern double vorbis_granule_time(vorbis_dsp_state *v, - ogg_int64_t granulepos); - -extern const char *vorbis_version_string(void); - -/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ - -extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op); -extern int vorbis_analysis_headerout(vorbis_dsp_state *v, - vorbis_comment *vc, - ogg_packet *op, - ogg_packet *op_comm, - ogg_packet *op_code); -extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); - -extern int vorbis_bitrate_addblock(vorbis_block *vb); -extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, - ogg_packet *op); - -/* Vorbis PRIMITIVES: synthesis layer *******************************/ -extern int vorbis_synthesis_idheader(ogg_packet *op); -extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, - ogg_packet *op); - -extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_synthesis_restart(vorbis_dsp_state *v); -extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); -extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); - -extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag); -extern int vorbis_synthesis_halfrate_p(vorbis_info *v); - -/* Vorbis ERRORS and return codes ***********************************/ - -#define OV_FALSE -1 -#define OV_EOF -2 -#define OV_HOLE -3 - -#define OV_EREAD -128 -#define OV_EFAULT -129 -#define OV_EIMPL -130 -#define OV_EINVAL -131 -#define OV_ENOTVORBIS -132 -#define OV_EBADHEADER -133 -#define OV_EVERSION -134 -#define OV_ENOTAUDIO -135 -#define OV_EBADPACKET -136 -#define OV_EBADLINK -137 -#define OV_ENOSEEK -138 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/vorbis/vorbisfile.h b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/vorbis/vorbisfile.h deleted file mode 100644 index a865cd097..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/include/vorbis/vorbisfile.h +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.h 17021 2010-03-24 09:29:41Z xiphmont $ - - ********************************************************************/ - -#ifndef _OV_FILE_H_ -#define _OV_FILE_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include -#include "codec.h" - -/* The function prototypes for the callbacks are basically the same as for - * the stdio functions fread, fseek, fclose, ftell. - * The one difference is that the FILE * arguments have been replaced with - * a void * - this is to be used as a pointer to whatever internal data these - * functions might need. In the stdio case, it's just a FILE * cast to a void * - * - * If you use other functions, check the docs for these functions and return - * the right values. For seek_func(), you *MUST* return -1 if the stream is - * unseekable - */ -typedef struct { - size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); - int (*seek_func) (void *datasource, ogg_int64_t offset, int whence); - int (*close_func) (void *datasource); - long (*tell_func) (void *datasource); -} ov_callbacks; - -#ifndef OV_EXCLUDE_STATIC_CALLBACKS - -/* a few sets of convenient callbacks, especially for use under - * Windows where ov_open_callbacks() should always be used instead of - * ov_open() to avoid problems with incompatible crt.o version linking - * issues. */ - -static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){ - if(f==NULL)return(-1); - -#ifdef __MINGW32__ - return fseeko64(f,off,whence); -#elif defined (_WIN32) - return _fseeki64(f,off,whence); -#else - return fseek(f,off,whence); -#endif -} - -/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as - * static data. That means that every file which includes this header - * will get its own copy of these structs whether it uses them or - * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS. - * These static symbols are essential on platforms such as Windows on - * which several different versions of stdio support may be linked to - * by different DLLs, and we need to be certain we know which one - * we're using (the same one as the main application). - */ - -static ov_callbacks OV_CALLBACKS_DEFAULT = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap, - (int (*)(void *)) fclose, - (long (*)(void *)) ftell -}; - -static ov_callbacks OV_CALLBACKS_NOCLOSE = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap, - (int (*)(void *)) NULL, - (long (*)(void *)) ftell -}; - -static ov_callbacks OV_CALLBACKS_STREAMONLY = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) NULL, - (int (*)(void *)) fclose, - (long (*)(void *)) NULL -}; - -static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) NULL, - (int (*)(void *)) NULL, - (long (*)(void *)) NULL -}; - -#endif - -#define NOTOPEN 0 -#define PARTOPEN 1 -#define OPENED 2 -#define STREAMSET 3 -#define INITSET 4 - -typedef struct OggVorbis_File { - void *datasource; /* Pointer to a FILE *, etc. */ - int seekable; - ogg_int64_t offset; - ogg_int64_t end; - ogg_sync_state oy; - - /* If the FILE handle isn't seekable (eg, a pipe), only the current - stream appears */ - int links; - ogg_int64_t *offsets; - ogg_int64_t *dataoffsets; - long *serialnos; - ogg_int64_t *pcmlengths; /* overloaded to maintain binary - compatibility; x2 size, stores both - beginning and end values */ - vorbis_info *vi; - vorbis_comment *vc; - - /* Decoding working state local storage */ - ogg_int64_t pcm_offset; - int ready_state; - long current_serialno; - int current_link; - - double bittrack; - double samptrack; - - ogg_stream_state os; /* take physical pages, weld into a logical - stream of packets */ - vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ - vorbis_block vb; /* local working space for packet->PCM decode */ - - ov_callbacks callbacks; - -} OggVorbis_File; - - -extern int ov_clear(OggVorbis_File *vf); -extern int ov_fopen(char *path,OggVorbis_File *vf); -extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); -extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); - -extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); -extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); -extern int ov_test_open(OggVorbis_File *vf); - -extern long ov_bitrate(OggVorbis_File *vf,int i); -extern long ov_bitrate_instant(OggVorbis_File *vf); -extern long ov_streams(OggVorbis_File *vf); -extern long ov_seekable(OggVorbis_File *vf); -extern long ov_serialnumber(OggVorbis_File *vf,int i); - -extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); -extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); -extern double ov_time_total(OggVorbis_File *vf,int i); - -extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page(OggVorbis_File *vf,double pos); - -extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek_lap(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos); - -extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf); -extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); -extern double ov_time_tell(OggVorbis_File *vf); - -extern vorbis_info *ov_info(OggVorbis_File *vf,int link); -extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); - -extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples, - int *bitstream); -extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream, - void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param); -extern long ov_read(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream); -extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2); - -extern int ov_halfrate(OggVorbis_File *vf,int flag); -extern int ov_halfrate_p(OggVorbis_File *vf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libogg.a b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libogg.a deleted file mode 100644 index b994dd5ed..000000000 Binary files a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libogg.a and /dev/null differ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libvorbis.a b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libvorbis.a deleted file mode 100644 index 4c61eaba8..000000000 Binary files a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libvorbis.a and /dev/null differ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libvorbisfile.a b/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libvorbisfile.a deleted file mode 100644 index d56934509..000000000 Binary files a/polymer-perf/eduke32/source/jaudiolib/third-party/mingw32/lib/libvorbisfile.a and /dev/null differ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Headers b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Headers deleted file mode 120000 index a177d2a6b..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Headers \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Resources b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Resources deleted file mode 120000 index 953ee36f3..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Resources +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Resources \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Headers/ogg.h b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Headers/ogg.h deleted file mode 100644 index 9082679d9..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Headers/ogg.h +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel libogg include - last mod: $Id: ogg.h 7188 2004-07-20 07:26:04Z xiphmont $ - - ********************************************************************/ -#ifndef _OGG_H -#define _OGG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct { - long endbyte; - int endbit; - - unsigned char *buffer; - unsigned char *ptr; - long storage; -} oggpack_buffer; - -/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ - -typedef struct { - unsigned char *header; - long header_len; - unsigned char *body; - long body_len; -} ogg_page; - -/* ogg_stream_state contains the current encode/decode state of a logical - Ogg bitstream **********************************************************/ - -typedef struct { - unsigned char *body_data; /* bytes from packet bodies */ - long body_storage; /* storage elements allocated */ - long body_fill; /* elements stored; fill mark */ - long body_returned; /* elements of fill returned */ - - - int *lacing_vals; /* The values that will go to the segment table */ - ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact - this way, but it is simple coupled to the - lacing fifo */ - long lacing_storage; - long lacing_fill; - long lacing_packet; - long lacing_returned; - - unsigned char header[282]; /* working space for header encode */ - int header_fill; - - int e_o_s; /* set when we have buffered the last packet in the - logical bitstream */ - int b_o_s; /* set after we've written the initial page - of a logical bitstream */ - long serialno; - long pageno; - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ - ogg_int64_t granulepos; - -} ogg_stream_state; - -/* ogg_packet is used to encapsulate the data and metadata belonging - to a single raw Ogg/Vorbis packet *************************************/ - -typedef struct { - unsigned char *packet; - long bytes; - long b_o_s; - long e_o_s; - - ogg_int64_t granulepos; - - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ -} ogg_packet; - -typedef struct { - unsigned char *data; - int storage; - int fill; - int returned; - - int unsynced; - int headerbytes; - int bodybytes; -} ogg_sync_state; - -/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ - -extern void oggpack_writeinit(oggpack_buffer *b); -extern void oggpack_writetrunc(oggpack_buffer *b,long bits); -extern void oggpack_writealign(oggpack_buffer *b); -extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); -extern void oggpack_reset(oggpack_buffer *b); -extern void oggpack_writeclear(oggpack_buffer *b); -extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); -extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); -extern long oggpack_look(oggpack_buffer *b,int bits); -extern long oggpack_look1(oggpack_buffer *b); -extern void oggpack_adv(oggpack_buffer *b,int bits); -extern void oggpack_adv1(oggpack_buffer *b); -extern long oggpack_read(oggpack_buffer *b,int bits); -extern long oggpack_read1(oggpack_buffer *b); -extern long oggpack_bytes(oggpack_buffer *b); -extern long oggpack_bits(oggpack_buffer *b); -extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); - -extern void oggpackB_writeinit(oggpack_buffer *b); -extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); -extern void oggpackB_writealign(oggpack_buffer *b); -extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); -extern void oggpackB_reset(oggpack_buffer *b); -extern void oggpackB_writeclear(oggpack_buffer *b); -extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); -extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits); -extern long oggpackB_look(oggpack_buffer *b,int bits); -extern long oggpackB_look1(oggpack_buffer *b); -extern void oggpackB_adv(oggpack_buffer *b,int bits); -extern void oggpackB_adv1(oggpack_buffer *b); -extern long oggpackB_read(oggpack_buffer *b,int bits); -extern long oggpackB_read1(oggpack_buffer *b); -extern long oggpackB_bytes(oggpack_buffer *b); -extern long oggpackB_bits(oggpack_buffer *b); -extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b); - -/* Ogg BITSTREAM PRIMITIVES: encoding **************************/ - -extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); -extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); - -/* Ogg BITSTREAM PRIMITIVES: decoding **************************/ - -extern int ogg_sync_init(ogg_sync_state *oy); -extern int ogg_sync_clear(ogg_sync_state *oy); -extern int ogg_sync_reset(ogg_sync_state *oy); -extern int ogg_sync_destroy(ogg_sync_state *oy); - -extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); -extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); -extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); -extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); -extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); -extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); - -/* Ogg BITSTREAM PRIMITIVES: general ***************************/ - -extern int ogg_stream_init(ogg_stream_state *os,int serialno); -extern int ogg_stream_clear(ogg_stream_state *os); -extern int ogg_stream_reset(ogg_stream_state *os); -extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); -extern int ogg_stream_destroy(ogg_stream_state *os); -extern int ogg_stream_eos(ogg_stream_state *os); - -extern void ogg_page_checksum_set(ogg_page *og); - -extern int ogg_page_version(ogg_page *og); -extern int ogg_page_continued(ogg_page *og); -extern int ogg_page_bos(ogg_page *og); -extern int ogg_page_eos(ogg_page *og); -extern ogg_int64_t ogg_page_granulepos(ogg_page *og); -extern int ogg_page_serialno(ogg_page *og); -extern long ogg_page_pageno(ogg_page *og); -extern int ogg_page_packets(ogg_page *og); - -extern void ogg_packet_clear(ogg_packet *op); - - -#ifdef __cplusplus -} -#endif - -#endif /* _OGG_H */ - - - - - - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Headers/os_types.h b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Headers/os_types.h deleted file mode 100644 index 32dcb8bff..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Headers/os_types.h +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $ - - ********************************************************************/ -#ifndef _OS_TYPES_H -#define _OS_TYPES_H - -/* make it easy on the folks that want to compile the libs with a - different malloc than stdlib */ -#define _ogg_malloc malloc -#define _ogg_calloc calloc -#define _ogg_realloc realloc -#define _ogg_free free - -#if defined(_WIN32) - -# if defined(__CYGWIN__) -# include <_G_config.h> - typedef _G_int64_t ogg_int64_t; - typedef _G_int32_t ogg_int32_t; - typedef _G_uint32_t ogg_uint32_t; - typedef _G_int16_t ogg_int16_t; - typedef _G_uint16_t ogg_uint16_t; -# elif defined(__MINGW32__) - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - typedef unsigned long long ogg_uint64_t; -# elif defined(__MWERKS__) - typedef long long ogg_int64_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; -# else - /* MSVC/Borland */ - typedef __int64 ogg_int64_t; - typedef __int32 ogg_int32_t; - typedef unsigned __int32 ogg_uint32_t; - typedef __int16 ogg_int16_t; - typedef unsigned __int16 ogg_uint16_t; -# endif - -#elif defined(__MACOS__) - -# include - typedef SInt16 ogg_int16_t; - typedef UInt16 ogg_uint16_t; - typedef SInt32 ogg_int32_t; - typedef UInt32 ogg_uint32_t; - typedef SInt64 ogg_int64_t; - -#elif defined(__MACOSX__) /* MacOS X Framework build */ - -# include - typedef int16_t ogg_int16_t; - typedef u_int16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef u_int32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - -#elif defined(__BEOS__) - - /* Be */ -# include - typedef int16_t ogg_int16_t; - typedef u_int16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef u_int32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - -#elif defined (__EMX__) - - /* OS/2 GCC */ - typedef short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - -#elif defined (DJGPP) - - /* DJGPP */ - typedef short ogg_int16_t; - typedef int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long ogg_int64_t; - -#elif defined(R5900) - - /* PS2 EE */ - typedef long ogg_int64_t; - typedef int ogg_int32_t; - typedef unsigned ogg_uint32_t; - typedef short ogg_int16_t; - -#elif defined(__SYMBIAN32__) - - /* Symbian GCC */ - typedef signed short ogg_int16_t; - typedef unsigned short ogg_uint16_t; - typedef signed int ogg_int32_t; - typedef unsigned int ogg_uint32_t; - typedef long long int ogg_int64_t; - -#else - -# include -# include - -#endif - -#endif /* _OS_TYPES_H */ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Resources/English.lproj/InfoPlist.strings b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Resources/English.lproj/InfoPlist.strings deleted file mode 100644 index 7080cf949..000000000 Binary files a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Resources/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Resources/Info.plist b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index 4b6c1a8d5..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ogg - CFBundleIdentifier - com.yourcompany.yourcocoaframework - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ogg - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - 1.0 - - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/ogg b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/ogg deleted file mode 100755 index 9e4a0555e..000000000 Binary files a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/A/ogg and /dev/null differ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/Current b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/Current deleted file mode 120000 index 8c7e5a667..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/Versions/Current +++ /dev/null @@ -1 +0,0 @@ -A \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/ogg b/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/ogg deleted file mode 120000 index aa84ee717..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/ogg.framework/ogg +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/ogg \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Headers b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Headers deleted file mode 120000 index a177d2a6b..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Headers \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Resources b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Resources deleted file mode 120000 index 953ee36f3..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Resources +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Resources \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/codec.h b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/codec.h deleted file mode 100644 index 03f29bf36..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/codec.h +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the XIPHOPHORUS Company http://www.xiph.org/ * - - ******************************************************************** - - function: libvorbis codec headers - last mod: $Id: codec.h 7485 2004-08-05 14:54:23Z thomasvs $ - - ********************************************************************/ - -#ifndef _vorbis_codec_h_ -#define _vorbis_codec_h_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include - -typedef struct vorbis_info{ - int version; - int channels; - long rate; - - /* The below bitrate declarations are *hints*. - Combinations of the three values carry the following implications: - - all three set to the same value: - implies a fixed rate bitstream - only nominal set: - implies a VBR stream that averages the nominal bitrate. No hard - upper/lower limit - upper and or lower set: - implies a VBR bitstream that obeys the bitrate limits. nominal - may also be set to give a nominal rate. - none set: - the coder does not care to speculate. - */ - - long bitrate_upper; - long bitrate_nominal; - long bitrate_lower; - long bitrate_window; - - void *codec_setup; -} vorbis_info; - -/* vorbis_dsp_state buffers the current vorbis audio - analysis/synthesis state. The DSP state belongs to a specific - logical bitstream ****************************************************/ -typedef struct vorbis_dsp_state{ - int analysisp; - vorbis_info *vi; - - float **pcm; - float **pcmret; - int pcm_storage; - int pcm_current; - int pcm_returned; - - int preextrapolate; - int eofflag; - - long lW; - long W; - long nW; - long centerW; - - ogg_int64_t granulepos; - ogg_int64_t sequence; - - ogg_int64_t glue_bits; - ogg_int64_t time_bits; - ogg_int64_t floor_bits; - ogg_int64_t res_bits; - - void *backend_state; -} vorbis_dsp_state; - -typedef struct vorbis_block{ - /* necessary stream state for linking to the framing abstraction */ - float **pcm; /* this is a pointer into local storage */ - oggpack_buffer opb; - - long lW; - long W; - long nW; - int pcmend; - int mode; - - int eofflag; - ogg_int64_t granulepos; - ogg_int64_t sequence; - vorbis_dsp_state *vd; /* For read-only access of configuration */ - - /* local storage to avoid remallocing; it's up to the mapping to - structure it */ - void *localstore; - long localtop; - long localalloc; - long totaluse; - struct alloc_chain *reap; - - /* bitmetrics for the frame */ - long glue_bits; - long time_bits; - long floor_bits; - long res_bits; - - void *internal; - -} vorbis_block; - -/* vorbis_block is a single block of data to be processed as part of -the analysis/synthesis stream; it belongs to a specific logical -bitstream, but is independant from other vorbis_blocks belonging to -that logical bitstream. *************************************************/ - -struct alloc_chain{ - void *ptr; - struct alloc_chain *next; -}; - -/* vorbis_info contains all the setup information specific to the - specific compression/decompression mode in progress (eg, - psychoacoustic settings, channel setup, options, codebook - etc). vorbis_info and substructures are in backends.h. -*********************************************************************/ - -/* the comments are not part of vorbis_info so that vorbis_info can be - static storage */ -typedef struct vorbis_comment{ - /* unlimited user comment fields. libvorbis writes 'libvorbis' - whatever vendor is set to in encode */ - char **user_comments; - int *comment_lengths; - int comments; - char *vendor; - -} vorbis_comment; - - -/* libvorbis encodes in two abstraction layers; first we perform DSP - and produce a packet (see docs/analysis.txt). The packet is then - coded into a framed OggSquish bitstream by the second layer (see - docs/framing.txt). Decode is the reverse process; we sync/frame - the bitstream and extract individual packets, then decode the - packet back into PCM audio. - - The extra framing/packetizing is used in streaming formats, such as - files. Over the net (such as with UDP), the framing and - packetization aren't necessary as they're provided by the transport - and the streaming layer is not used */ - -/* Vorbis PRIMITIVES: general ***************************************/ - -extern void vorbis_info_init(vorbis_info *vi); -extern void vorbis_info_clear(vorbis_info *vi); -extern int vorbis_info_blocksize(vorbis_info *vi,int zo); -extern void vorbis_comment_init(vorbis_comment *vc); -extern void vorbis_comment_add(vorbis_comment *vc, char *comment); -extern void vorbis_comment_add_tag(vorbis_comment *vc, - char *tag, char *contents); -extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count); -extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag); -extern void vorbis_comment_clear(vorbis_comment *vc); - -extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); -extern int vorbis_block_clear(vorbis_block *vb); -extern void vorbis_dsp_clear(vorbis_dsp_state *v); -extern double vorbis_granule_time(vorbis_dsp_state *v, - ogg_int64_t granulepos); - -/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ - -extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op); -extern int vorbis_analysis_headerout(vorbis_dsp_state *v, - vorbis_comment *vc, - ogg_packet *op, - ogg_packet *op_comm, - ogg_packet *op_code); -extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); -extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); - -extern int vorbis_bitrate_addblock(vorbis_block *vb); -extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, - ogg_packet *op); - -/* Vorbis PRIMITIVES: synthesis layer *******************************/ -extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, - ogg_packet *op); - -extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); -extern int vorbis_synthesis_restart(vorbis_dsp_state *v); -extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); -extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm); -extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); -extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); - -extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag); -extern int vorbis_synthesis_halfrate_p(vorbis_info *v); - -/* Vorbis ERRORS and return codes ***********************************/ - -#define OV_FALSE -1 -#define OV_EOF -2 -#define OV_HOLE -3 - -#define OV_EREAD -128 -#define OV_EFAULT -129 -#define OV_EIMPL -130 -#define OV_EINVAL -131 -#define OV_ENOTVORBIS -132 -#define OV_EBADHEADER -133 -#define OV_EVERSION -134 -#define OV_ENOTAUDIO -135 -#define OV_EBADPACKET -136 -#define OV_EBADLINK -137 -#define OV_ENOSEEK -138 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/vorbisenc.h b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/vorbisenc.h deleted file mode 100644 index a60081ac9..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/vorbisenc.h +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the XIPHOPHORUS Company http://www.xiph.org/ * - * * - ******************************************************************** - - function: vorbis encode-engine setup - last mod: $Id: vorbisenc.h 7485 2004-08-05 14:54:23Z thomasvs $ - - ********************************************************************/ - -#ifndef _OV_ENC_H_ -#define _OV_ENC_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "codec.h" - -extern int vorbis_encode_init(vorbis_info *vi, - long channels, - long rate, - - long max_bitrate, - long nominal_bitrate, - long min_bitrate); - -extern int vorbis_encode_setup_managed(vorbis_info *vi, - long channels, - long rate, - - long max_bitrate, - long nominal_bitrate, - long min_bitrate); - -extern int vorbis_encode_setup_vbr(vorbis_info *vi, - long channels, - long rate, - - float quality /* quality level from 0. (lo) to 1. (hi) */ - ); - -extern int vorbis_encode_init_vbr(vorbis_info *vi, - long channels, - long rate, - - float base_quality /* quality level from 0. (lo) to 1. (hi) */ - ); - -extern int vorbis_encode_setup_init(vorbis_info *vi); - -extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); - - /* deprecated rate management supported only for compatability */ -#define OV_ECTL_RATEMANAGE_GET 0x10 -#define OV_ECTL_RATEMANAGE_SET 0x11 -#define OV_ECTL_RATEMANAGE_AVG 0x12 -#define OV_ECTL_RATEMANAGE_HARD 0x13 - -struct ovectl_ratemanage_arg { - int management_active; - - long bitrate_hard_min; - long bitrate_hard_max; - double bitrate_hard_window; - - long bitrate_av_lo; - long bitrate_av_hi; - double bitrate_av_window; - double bitrate_av_window_center; -}; - - - /* new rate setup */ -#define OV_ECTL_RATEMANAGE2_GET 0x14 -#define OV_ECTL_RATEMANAGE2_SET 0x15 - -struct ovectl_ratemanage2_arg { - int management_active; - - long bitrate_limit_min_kbps; - long bitrate_limit_max_kbps; - long bitrate_limit_reservoir_bits; - double bitrate_limit_reservoir_bias; - - long bitrate_average_kbps; - double bitrate_average_damping; -}; - - - -#define OV_ECTL_LOWPASS_GET 0x20 -#define OV_ECTL_LOWPASS_SET 0x21 - -#define OV_ECTL_IBLOCK_GET 0x30 -#define OV_ECTL_IBLOCK_SET 0x31 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/vorbisfile.h b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/vorbisfile.h deleted file mode 100644 index 259fa89b6..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Headers/vorbisfile.h +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the XIPHOPHORUS Company http://www.xiph.org/ * - * * - ******************************************************************** - - function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.h 7485 2004-08-05 14:54:23Z thomasvs $ - - ********************************************************************/ - -#ifndef _OV_FILE_H_ -#define _OV_FILE_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include -#include "codec.h" - -/* The function prototypes for the callbacks are basically the same as for - * the stdio functions fread, fseek, fclose, ftell. - * The one difference is that the FILE * arguments have been replaced with - * a void * - this is to be used as a pointer to whatever internal data these - * functions might need. In the stdio case, it's just a FILE * cast to a void * - * - * If you use other functions, check the docs for these functions and return - * the right values. For seek_func(), you *MUST* return -1 if the stream is - * unseekable - */ -typedef struct { - size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); - int (*seek_func) (void *datasource, ogg_int64_t offset, int whence); - int (*close_func) (void *datasource); - long (*tell_func) (void *datasource); -} ov_callbacks; - -#define NOTOPEN 0 -#define PARTOPEN 1 -#define OPENED 2 -#define STREAMSET 3 -#define INITSET 4 - -typedef struct OggVorbis_File { - void *datasource; /* Pointer to a FILE *, etc. */ - int seekable; - ogg_int64_t offset; - ogg_int64_t end; - ogg_sync_state oy; - - /* If the FILE handle isn't seekable (eg, a pipe), only the current - stream appears */ - int links; - ogg_int64_t *offsets; - ogg_int64_t *dataoffsets; - long *serialnos; - ogg_int64_t *pcmlengths; /* overloaded to maintain binary - compatability; x2 size, stores both - beginning and end values */ - vorbis_info *vi; - vorbis_comment *vc; - - /* Decoding working state local storage */ - ogg_int64_t pcm_offset; - int ready_state; - long current_serialno; - int current_link; - - double bittrack; - double samptrack; - - ogg_stream_state os; /* take physical pages, weld into a logical - stream of packets */ - vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ - vorbis_block vb; /* local working space for packet->PCM decode */ - - ov_callbacks callbacks; - -} OggVorbis_File; - -extern int ov_clear(OggVorbis_File *vf); -extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); -extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); - -extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); -extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, - char *initial, long ibytes, ov_callbacks callbacks); -extern int ov_test_open(OggVorbis_File *vf); - -extern long ov_bitrate(OggVorbis_File *vf,int i); -extern long ov_bitrate_instant(OggVorbis_File *vf); -extern long ov_streams(OggVorbis_File *vf); -extern long ov_seekable(OggVorbis_File *vf); -extern long ov_serialnumber(OggVorbis_File *vf,int i); - -extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); -extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); -extern double ov_time_total(OggVorbis_File *vf,int i); - -extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page(OggVorbis_File *vf,double pos); - -extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos); -extern int ov_time_seek_lap(OggVorbis_File *vf,double pos); -extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos); - -extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf); -extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); -extern double ov_time_tell(OggVorbis_File *vf); - -extern vorbis_info *ov_info(OggVorbis_File *vf,int link); -extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); - -extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples, - int *bitstream); -extern long ov_read(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream); -extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2); - -extern int ov_halfrate(OggVorbis_File *vf,int flag); -extern int ov_halfrate_p(OggVorbis_File *vf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Resources/English.lproj/InfoPlist.strings b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Resources/English.lproj/InfoPlist.strings deleted file mode 100644 index 7080cf949..000000000 Binary files a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Resources/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Resources/Info.plist b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index e73b193b3..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - vorbis - CFBundleIdentifier - com.yourcompany.yourcocoaframework - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - vorbis - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - 1.0 - - diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/vorbis b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/vorbis deleted file mode 100755 index 64b37e759..000000000 Binary files a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/A/vorbis and /dev/null differ diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/Current b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/Current deleted file mode 120000 index 8c7e5a667..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/Versions/Current +++ /dev/null @@ -1 +0,0 @@ -A \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/vorbis b/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/vorbis deleted file mode 120000 index 85a6d550c..000000000 --- a/polymer-perf/eduke32/source/jaudiolib/third-party/vorbis.framework/vorbis +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/vorbis \ No newline at end of file diff --git a/polymer-perf/eduke32/source/jmact/_control.h b/polymer-perf/eduke32/source/jmact/_control.h deleted file mode 100644 index ca49ec048..000000000 --- a/polymer-perf/eduke32/source/jmact/_control.h +++ /dev/null @@ -1,246 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is NOT part of Duke Nukem 3D version 1.5 - Atomic Edition -However, it is either an older version of a file that is, or is -some test code written during the development of Duke Nukem 3D. -This file is provided purely for educational interest. - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- - -//**************************************************************************** -// -// Private header for CONTROL.C -// -//**************************************************************************** - -#ifndef _control_private -#define _control_private -#ifdef __cplusplus -extern "C" { -#endif - - -//**************************************************************************** -// -// DEFINES -// -//**************************************************************************** - -#define BUTTON0_SCAN_1 sc_Space -#define BUTTON0_SCAN_2 sc_Enter -#define BUTTON0_SCAN_3 sc_kpad_Enter -#define BUTTON1_SCAN sc_Escape - -#define AXISUNDEFINED 0x7f -#define BUTTONUNDEFINED 0x7f -#define KEYUNDEFINED 0x7f - -#define SENSITIVE 0x400 -//#define MINSENSITIVE 0x30 - -#define THRESHOLD 0x200 -#define MINTHRESHOLD 0x80 - -#define USERINPUTDELAY 200 - -#define ResetMouse 0 -#define GetMouseButtons 3 -#define GetMouseDelta 11 - -#define MouseInt 0x33 -#define JoyMax 0xa00 -#define MaxJoyValue 5000 - -#define DEFAULTMOUSESENSITIVITY 7 // 0x7000+MINIMUMMOUSESENSITIVITY - -#define INSTANT_ONOFF 0 -#define TOGGLE_ONOFF 1 - -#define MAXCONTROLVALUE 0x7fff - -// Maximum number of buttons for any controller -#define MAXBUTTONS 32 - -// Number of Mouse buttons - -#define MAXMOUSEBUTTONS 10 - -// Number of Mouse Axes - -#define MAXMOUSEAXES 2 - -// Number of JOY buttons - -#define MAXJOYBUTTONS 32 - -// Number of JOY axes - -#define MAXJOYAXES 8 - -// NORMAL axis scale - -#define NORMALAXISSCALE (65536) - -#define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64_t)value<<((uint64_t)(x)))) -#define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1<<((uint64_t)(x)))) - -#define BUTTONHELDSET(x,value) (CONTROL_ButtonHeldState |= (uint64_t)(value<<((uint64_t)(x)))) - -#define LIMITCONTROL(x)\ - {\ - if ((*x)>MAXCONTROLVALUE) \ - {\ - (*x) = MAXCONTROLVALUE;\ - }\ - if ((*x)<-MAXCONTROLVALUE) \ - {\ - (*x) = -MAXCONTROLVALUE;\ - }\ - } -#define SGN(x) \ - ( ( (x) > 0 ) ? 1 : ( (x) < 0 ) ? -1 : 0 ) - -//**************************************************************************** -// -// TYPEDEFS -// -//**************************************************************************** - -typedef enum - { - motion_Left = -1, - motion_Up = -1, - motion_None = 0, - motion_Right = 1, - motion_Down = 1 - } motion; - - -typedef struct - { - int32_t joyMinX; - int32_t joyMinY; - int32_t threshMinX; - int32_t threshMinY; - int32_t threshMaxX; - int32_t threshMaxY; - int32_t joyMaxX; - int32_t joyMaxY; - int32_t joyMultXL; - int32_t joyMultYL; - int32_t joyMultXH; - int32_t joyMultYH; - } JoystickDef; - -// int32_t ThrottleMin; -// int32_t RudderMin; -// int32_t ThrottlethreshMin; -// int32_t RudderthreshMin; -// int32_t ThrottlethreshMax; -// int32_t RudderthreshMax; -// int32_t ThrottleMax; -// int32_t RudderMax; -// int32_t ThrottleMultL; -// int32_t RudderMultL; -// int32_t ThrottleMultH; -// int32_t RudderMultH; - -/* -typedef struct - { - uint8_t active : 1; - uint8_t used : 1; - uint8_t toggle : 1; - uint8_t buttonheld : 1; - uint8_t cleared : 1; - } controlflags; -typedef struct - { - volatile uint8_t active : 1; - volatile uint8_t used : 1; - volatile uint8_t toggle : 1; - volatile uint8_t buttonheld : 1; - volatile uint8_t cleared : 1; - } controlflags; -*/ -typedef struct - { - uint8_t active ; - uint8_t used ; - uint8_t toggle ; - uint8_t buttonheld ; - int32_t cleared ; - } controlflags; - -typedef struct - { - kb_scancode key1; - kb_scancode key2; - } controlkeymaptype; - -typedef struct - { - uint8_t singleclicked; - uint8_t doubleclicked; - uint16_t extra; - } controlbuttontype; - -typedef struct - { - uint8_t analogmap; - uint8_t minmap; - uint8_t maxmap; - uint8_t extra; - } controlaxismaptype; - -typedef struct - { - int32_t analog; - int32_t digital; - } controlaxistype; - - -//*************************************************************************** -// -// PROTOTYPES -// -//*************************************************************************** - -void CONTROL_GetMouseDelta( void ); -uint8_t CONTROL_GetMouseButtons( void ); -int32_t CONTROL_StartMouse( void ); -void CONTROL_GetJoyAbs( void ); -void CONTROL_GetJoyDelta( void ); -int32_t CONTROL_StartJoy( int32_t joy ); -void CONTROL_ShutJoy( int32_t joy ); -void CONTROL_SetFlag( int32_t which, int32_t active ); -void CONTROL_ButtonFunctionState( int32_t * state ); -int32_t CONTROL_KeyboardFunctionPressed( int32_t whichfunction ); -static inline int32_t CONTROL_CheckRange( int32_t which ); -int32_t CONTROL_GetTime( void ); -void CONTROL_AxisFunctionState( int32_t * state ); -void CONTROL_GetJoyMovement( ControlInfo * info ); - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/jmact/_scrplib.h b/polymer-perf/eduke32/source/jmact/_scrplib.h deleted file mode 100644 index 22a250e81..000000000 --- a/polymer-perf/eduke32/source/jmact/_scrplib.h +++ /dev/null @@ -1,209 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is NOT part of Duke Nukem 3D version 1.5 - Atomic Edition -However, it is either an older version of a file that is, or is -some test code written during the development of Duke Nukem 3D. -This file is provided purely for educational interest. - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) -*/ -//------------------------------------------------------------------------- - -// scrplib.h - -#ifndef _scriplib_private -#define _scriplib_private -#ifdef __cplusplus -extern "C" { -#endif - -#define SCRIPTSECTIONSTART ('[') -#define SCRIPTSECTIONEND (']') -#define SCRIPTENTRYSEPARATOR ('=') -#define SCRIPTCOMMENT (';') -#define SCRIPTEOL ('\n') -#define SCRIPTNULL ('\0') -#define SCRIPTSTRINGSEPARATOR ('"') -#define SCRIPTHEXFIRST ('0') -#define SCRIPTHEXSECOND ('x') -#define SCRIPTSPACE (' ') -#define SCRIPTDEFAULTVALUE ('~') -#define MAXSCRIPTFILES 20 -#define SCRIPT(scripthandle,item) (scriptfiles[(scripthandle)]->item) - -typedef enum - { - linetype_comment, - linetype_section, - linetype_entry - } linetype_t; - -typedef struct scriptline - { - int32_t type; - void * ptr; - struct scriptline *nextline; - struct scriptline *prevline; - } ScriptLineType; - -typedef struct scriptentry - { - char * name; - char * value; - struct scriptentry *nextentry; - struct scriptentry *preventry; - } ScriptEntryType; - -typedef struct scriptsection - { - char * name; - ScriptEntryType *entries; - ScriptLineType *lastline; - struct scriptsection *nextsection; - struct scriptsection *prevsection; - } ScriptSectionType; - -typedef struct - { - ScriptSectionType * script; - ScriptSectionType * lastsection; - ScriptLineType * scriptlines; - char scriptfilename[128]; - } script_t; - -/* -============== -= -= SCRIPT_New -= -============== -*/ - -int32_t SCRIPT_New( void ); - -/* -============== -= -= SCRIPT_Delete -= -============== -*/ -void SCRIPT_Delete( int32_t scripthandle ); - -/* -============== -= -= SCRIPT_FreeSection -= -============== -*/ -void SCRIPT_FreeSection( ScriptSectionType * section ); - -/* -============== -= -= SafeWriteString -= -============== -*/ -void SafeWriteString (int32_t handle, char * string); - -/* -============== -= -= SCRIPT_AddLine -= -============== -*/ - - -ScriptLineType * SCRIPT_AddLine - ( - ScriptLineType * root, - int32_t type, - void * ptr - ); - -/* -============== -= -= SCRIPT_SectionExists -= -============== -*/ -ScriptSectionType * SCRIPT_SectionExists - ( - int32_t scripthandle, - char * sectionname - ); - -/* -============== -= -= SCRIPT_AddSection -= -============== -*/ -ScriptSectionType * SCRIPT_AddSection( int32_t scripthandle, char * sectionname ); - -/* -============== -= -= SCRIPT_EntryExists -= -============== -*/ -ScriptEntryType * SCRIPT_EntryExists - ( - ScriptSectionType * section, - char * entryname - ); - -/* -============== -= -= SCRIPT_AddEntry -= -============== -*/ -void SCRIPT_AddEntry - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * entryvalue - ); - -/* -============== -= -= SCRIPT_DecodeToken -= -============== -*/ - -void SCRIPT_DecodeToken ( int32_t scripthandle, char * str ); - - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/jmact/animlib.c b/polymer-perf/eduke32/source/jmact/animlib.c deleted file mode 100644 index 1602e0c04..000000000 --- a/polymer-perf/eduke32/source/jmact/animlib.c +++ /dev/null @@ -1,318 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) -*/ -//------------------------------------------------------------------------- - -#include "compat.h" -#include "animlib.h" - -//**************************************************************************** -// -// LOCALS -// -//**************************************************************************** - -# pragma pack(push,1) - -/* structure declarations for deluxe animate large page files, doesn't - need to be in the header because there are no exposed functions - that use any of this directly */ - -typedef struct lpfileheaderstruct { uint32_t id; /* 4 uint8_tacter ID == "LPF " */ uint16_t maxLps; /* max # largePages allowed. 256 FOR NOW. */ uint16_t nLps; /* # largePages in this file. */ uint32_t nRecords; /* # records in this file. 65534 is current limit + ring */ uint16_t maxRecsPerLp; /* # records permitted in an lp. 256 FOR NOW. */ uint16_t lpfTableOffset; /* Absolute Seek position of lpfTable. 1280 FOR NOW. */ uint32_t contentType; /* 4 character ID == "ANIM" */ uint16_t width; /* Width of screen in pixels. */ uint16_t height; /* Height of screen in pixels. */ uint8_t variant; /* 0==ANIM. */ uint8_t version; /* 0==frame rate in 18/sec, 1= 70/sec */ uint8_t hasLastDelta; /* 1==Last record is a delta from last-to-first frame. */ uint8_t lastDeltaValid; /* 0==Ignore ring frame. */ uint8_t pixelType; /* 0==256 color. */ uint8_t CompressionType; /* 1==(RunSkipDump) Only one used FOR NOW. */ uint8_t otherRecsPerFrm; /* 0 FOR NOW. */ uint8_t bitmaptype; /* 1==320x200, 256-color. Only one implemented so far. */ uint8_t recordTypes[32]; /* Not yet implemented. */ uint32_t nFrames; /* Number of actual frames in the file, includes ring frame. */ uint16_t framesPerSecond; /* Number of frames to play per second. */ uint16_t pad2[29]; /* 58 bytes of filler to round up to 128 bytes total. */ } -lpfileheader; /* (comments from original source) */ - -// this is the format of a large page structure -typedef struct -{ - uint16_t baseRecord; // Number of first record in this large page. - uint16_t nRecords; // Number of records in lp. - // bit 15 of "nRecords" == "has continuation from previous lp". - // bit 14 of "nRecords" == "final record continues on next lp". - uint16_t nBytes; // Total number of bytes of contents, excluding header. -} lp_descriptor; - -#pragma pack(pop) - -#define IMAGEBUFFERSIZE 0x10000 - -typedef struct -{ - uint16_t framecount; // current frame of anim - lpfileheader * lpheader; // file header will be loaded into this structure - lp_descriptor * LpArray; // arrays of large page structs used to find frames - uint16_t curlpnum; // initialize to an invalid Large page number - lp_descriptor * curlp; // header of large page currently in memory - uint16_t * thepage; // buffer where current large page is loaded - uint8_t imagebuffer[IMAGEBUFFERSIZE]; // buffer where anim frame is decoded - uint8_t * buffer; - uint8_t pal[768]; - int32_t currentframe; -} anim_t; - -static anim_t * anim = NULL; - -//**************************************************************************** -// -// findpage () -// - return the large page number a given frame resides in -// -//**************************************************************************** - -static inline uint16_t findpage(uint16_t framenumber) -{ - // curlpnum is initialized to 0xffff, obviously - uint16_t i = (uint16_t)(anim->curlpnum & ~0xffff); - int32_t j = 0; - - if (framenumber < anim->currentframe) - i = 0, j++; - - // this scans the last used page and higher first and then scans the - // previously accessed pages afterwards if it doesn't find anything - do - { - for (; ilpheader->nLps; i++) - if (anim->LpArray[i].baseRecord <= framenumber && - anim->LpArray[i].baseRecord + anim->LpArray[i].nRecords > framenumber) - return i; - - if (!j && i == anim->lpheader->nLps) - { - // handle out of order pages... I don't think any Duke .ANM files - // have them, but they're part of the file spec - i = 0, j++; - continue; - } - } - while (0); - - return i; -} - - -//**************************************************************************** -// -// loadpage () -// - seek out and set pointers to the large page specified -// -//**************************************************************************** - -static inline void loadpage(uint16_t pagenumber, uint16_t **pagepointer) -{ - if (anim->curlpnum == pagenumber) - return; - - anim->curlp = &anim->LpArray[(anim->curlpnum = pagenumber)]; - *pagepointer = (uint16_t *)(anim->buffer + 0xb00 + (pagenumber*IMAGEBUFFERSIZE) + - sizeof(lp_descriptor) + sizeof(uint16_t)); -} - - -//**************************************************************************** -// -// decodeframe () -// - I found this less obfuscated version of the .ANM "decompressor", -// (c) 1998 "Jari Komppa aka Sol/Trauma". This code is public domain -// but has been mostly rewritten by me. -// -// - As a side note, it looks like this format came about in 1989 and -// never went anywhere after that, and appears to have been the format -// used by Electronic Arts' DeluxePaint Animation, which never made it -// past version 1.0. -// -//**************************************************************************** - -static void decodeframe(uint8_t * srcP, uint8_t * dstP) -{ - do - { - int32_t count=*srcP++; - - if (!count) /* Short RLE */ - { - int32_t color = *(srcP+1); - count = *(uint8_t *)((srcP += sizeof(int16_t)) - sizeof(int16_t)); - Bmemset((dstP += count) - count, color, count); - continue; - } - else if ((count & 0x80) == 0) /* Short copy */ - { - Bmemcpy((dstP += count) - count, (srcP += count) - count, count); - continue; - } - else if ((count &= ~0x80) > 0) /* short skip */ - { - dstP += count; - continue; - } - - /* long op */ - count = B_LITTLE16(*((uint16_t *)((srcP += sizeof(int16_t)) - sizeof(int16_t)))); - - if (!count) /* stop sign */ - return; - else if ((count & 0x8000) == 0) /* long skip */ - { - dstP += count; - continue; - } - else if ((count &= ~0x8000) & 0x4000) /* long RLE */ - { - int32_t color = *srcP++; - count &= ~0x4000; - Bmemset((dstP += count) - count, color, count); - continue; - } - - /* long copy */ - Bmemcpy((dstP += count) - count, (srcP += count) - count, count); - } - while (1); -} - - -//**************************************************************************** -// -// renderframe () -// - draw the frame sepcified from the large page in the buffer pointed to -// -//**************************************************************************** - -static void renderframe(uint16_t framenumber, uint16_t *pagepointer) -{ - uint8_t *ppointer; - uint16_t offset = 0; - uint16_t frame = framenumber - anim->curlp->baseRecord; - - while (frame--) offset += B_LITTLE16(pagepointer[frame]); - - ppointer = (uint8_t *)(pagepointer) + anim->curlp->nRecords*2 + offset + 4; - - if ((ppointer-4)[1]) - ppointer += B_LITTLE16(((uint16_t *)(ppointer-4))[1]) + (B_LITTLE16(((uint16_t *)(ppointer-4))[1]) & 1); - - decodeframe((uint8_t *)ppointer, (uint8_t *)anim->imagebuffer); -} - - -//**************************************************************************** -// -// drawframe () -// - high level frame draw routine -// -//**************************************************************************** - -static inline void drawframe(uint16_t framenumber) -{ - loadpage(findpage(framenumber), &anim->thepage); - renderframe(framenumber, anim->thepage); -} - - -void ANIM_LoadAnim(char * buffer) -{ - uint16_t i; - - anim = Brealloc(anim, sizeof(anim_t)); - - anim->curlpnum = 0xffff; - anim->currentframe = -1; - - // this just modifies the data in-place instead of copying it elsewhere now - anim->lpheader = (lpfileheader *)(anim->buffer = (uint8_t *)buffer); - - anim->lpheader->id = B_LITTLE32(anim->lpheader->id); - anim->lpheader->maxLps = B_LITTLE16(anim->lpheader->maxLps); - anim->lpheader->nLps = B_LITTLE16(anim->lpheader->nLps); - anim->lpheader->nRecords = B_LITTLE32(anim->lpheader->nRecords); - anim->lpheader->maxRecsPerLp = B_LITTLE16(anim->lpheader->maxRecsPerLp); - anim->lpheader->lpfTableOffset = B_LITTLE16(anim->lpheader->lpfTableOffset); - anim->lpheader->contentType = B_LITTLE32(anim->lpheader->contentType); - anim->lpheader->width = B_LITTLE16(anim->lpheader->width); - anim->lpheader->height = B_LITTLE16(anim->lpheader->height); - anim->lpheader->nFrames = B_LITTLE32(anim->lpheader->nFrames); - anim->lpheader->framesPerSecond = B_LITTLE16(anim->lpheader->framesPerSecond); - - buffer += sizeof(lpfileheader)+128; - - // load the color palette - for (i = 0; i < 768; i += 3) - { - anim->pal[i+2] = (*buffer++)>>2; - anim->pal[i+1] = (*buffer++)>>2; - anim->pal[i] = (*buffer++)>>2; - buffer++; - } - - // set up large page descriptors - anim->LpArray = (lp_descriptor *)buffer; - - // theoretically we should be able to play files with more than 256 frames now - // assuming the utilities to create them can make them that way - for (i = anim->lpheader->nLps-1; i != 0; i--) - { - anim->LpArray[i].baseRecord = B_LITTLE16(anim->LpArray[i].baseRecord); - anim->LpArray[i].nRecords = B_LITTLE16(anim->LpArray[i].nRecords); - anim->LpArray[i].nBytes = B_LITTLE16(anim->LpArray[i].nBytes); - } -} - - -void ANIM_FreeAnim(void) -{ - if (anim != NULL) - { - Bfree(anim); - anim = NULL; - } -} - - -int32_t ANIM_NumFrames(void) -{ - return anim->lpheader->nRecords; -} - - -uint8_t * ANIM_DrawFrame(int32_t framenumber) -{ - int32_t cnt = anim->currentframe; - - // handle first play and looping or rewinding - if (cnt < 0 || cnt > framenumber) - cnt = 0; - - do drawframe(cnt++); - while (cnt < framenumber); - - anim->currentframe = framenumber; - return anim->imagebuffer; -} - - -uint8_t * ANIM_GetPalette(void) -{ - return anim->pal; -} diff --git a/polymer-perf/eduke32/source/jmact/animlib.h b/polymer-perf/eduke32/source/jmact/animlib.h deleted file mode 100644 index 90b37549b..000000000 --- a/polymer-perf/eduke32/source/jmact/animlib.h +++ /dev/null @@ -1,92 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) -*/ -//------------------------------------------------------------------------- - -///////////////////////////////////////////////////////////////////////////// -// -// ANIMLIB.H -// -///////////////////////////////////////////////////////////////////////////// - -#ifndef _animlib_public_ -#define _animlib_public_ -#ifdef __cplusplus -extern "C" { -#endif - -//**************************************************************************** -// -// ANIM_LoadAnim () -// -// Setup internal anim data structure -// -//**************************************************************************** - -void ANIM_LoadAnim(char * buffer); - -//**************************************************************************** -// -// ANIM_FreeAnim () -// -// Free up internal anim data structure -// -//**************************************************************************** - -void ANIM_FreeAnim(void); - -//**************************************************************************** -// -// ANIM_NumFrames () -// -// returns the number of frames in the current anim -// -//**************************************************************************** - -int32_t ANIM_NumFrames(void); - -//**************************************************************************** -// -// ANIM_DrawFrame () -// -// Draw the frame to a returned buffer -// -//**************************************************************************** - -uint8_t * ANIM_DrawFrame(int32_t framenumber); - -//**************************************************************************** -// -// ANIM_GetPalette () -// -// return the palette of the anim -//**************************************************************************** - -uint8_t * ANIM_GetPalette(void); - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/jmact/control.c b/polymer-perf/eduke32/source/jmact/control.c deleted file mode 100644 index 378cdeff4..000000000 --- a/polymer-perf/eduke32/source/jmact/control.c +++ /dev/null @@ -1,887 +0,0 @@ -/* - * control.c - * MACT library controller handling - * - * Derived from MACT386.LIB disassembly by Jonathon Fowler - * - */ - -#include "compat.h" - -#include "keyboard.h" -#include "mouse.h" -#include "control.h" -#include "_control.h" - -#include "baselayer.h" -#include "osd.h" -#include "pragmas.h" - - -int32_t CONTROL_JoyPresent = FALSE; -int32_t CONTROL_JoystickEnabled = FALSE; -int32_t CONTROL_MousePresent = FALSE; -int32_t CONTROL_MouseEnabled = FALSE; -uint64_t CONTROL_ButtonState = 0; -uint64_t CONTROL_ButtonHeldState = 0; - -// static int32_t CONTROL_UserInputDelay = -1; -float CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; -static int32_t CONTROL_NumMouseButtons = 0; -static int32_t CONTROL_NumMouseAxes = 0; -static int32_t CONTROL_NumJoyButtons = 0; -static int32_t CONTROL_NumJoyAxes = 0; -static controlflags CONTROL_Flags[CONTROL_NUM_FLAGS]; -static controlbuttontype CONTROL_MouseButtonMapping[MAXMOUSEBUTTONS], -CONTROL_JoyButtonMapping[MAXJOYBUTTONS]; -static controlkeymaptype CONTROL_KeyMapping[CONTROL_NUM_FLAGS]; -static controlaxismaptype CONTROL_MouseAxesMap[MAXMOUSEAXES], // maps physical axes onto virtual ones -CONTROL_JoyAxesMap[MAXJOYAXES]; -static controlaxistype CONTROL_MouseAxes[MAXMOUSEAXES], // physical axes -CONTROL_JoyAxes[MAXJOYAXES]; -static controlaxistype CONTROL_LastMouseAxes[MAXMOUSEAXES], -CONTROL_LastJoyAxes[MAXJOYAXES]; -static int32_t CONTROL_MouseAxesScale[MAXMOUSEAXES], CONTROL_JoyAxesScale[MAXJOYAXES]; -static int32_t CONTROL_MouseButtonState[MAXMOUSEBUTTONS], CONTROL_JoyButtonState[MAXJOYBUTTONS]; -static int32_t CONTROL_MouseButtonClickedTime[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedTime[MAXJOYBUTTONS]; -static int32_t CONTROL_MouseButtonClickedState[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedState[MAXJOYBUTTONS]; -static int32_t CONTROL_MouseButtonClicked[MAXMOUSEBUTTONS], CONTROL_JoyButtonClicked[MAXJOYBUTTONS]; -static uint8_t CONTROL_MouseButtonClickedCount[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedCount[MAXJOYBUTTONS]; -static int32_t CONTROL_UserInputCleared[3]; -static int32_t(*GetTime)(void); -int32_t CONTROL_Started = FALSE; -static int32_t ticrate; -static int32_t CONTROL_DoubleClickSpeed; - -int32_t extinput[CONTROL_NUM_FLAGS]; -keybind KeyBindings[MAXBOUNDKEYS], MouseBindings[MAXMOUSEBUTTONS]; -int32_t bindsenabled = 0; -int32_t control_smoothmouse = 0; - -void CONTROL_GetMouseDelta(void) -{ - int32_t x,y; - - MOUSE_GetDelta(&x, &y); - - if (control_smoothmouse) - { - static int32_t lastx = 0, lasty = 0; - - CONTROL_MouseAxes[0].analog = (int32_t)(((x + lastx) / 2.0f) * 4.0f * CONTROL_MouseSensitivity); - CONTROL_MouseAxes[1].analog = (int32_t)((((y + lasty) / 2.0f) * 4.0f * CONTROL_MouseSensitivity) * 2.0f); - lastx = x; - lasty = y; - return; - } - - CONTROL_MouseAxes[0].analog = (int32_t)(x * 4.0f * CONTROL_MouseSensitivity); - CONTROL_MouseAxes[1].analog = (int32_t)((y * 4.0f * CONTROL_MouseSensitivity) * 2.0f); -} - -int32_t CONTROL_StartMouse(void) -{ - CONTROL_NumMouseButtons = MAXMOUSEBUTTONS; - return MOUSE_Init(); -} - -void CONTROL_GetJoyAbs(void) -{ -} - -void CONTROL_FilterJoyDelta(void) -{ -} - -void CONTROL_GetJoyDelta(void) -{ - int32_t i; - - for (i=0; i> 5; -} - -int32_t CONTROL_StartJoy(int32_t joy) -{ - UNREFERENCED_PARAMETER(joy); - return (inputdevices & 4) == 4; -} - -void CONTROL_ShutJoy(int32_t joy) -{ - UNREFERENCED_PARAMETER(joy); - CONTROL_JoyPresent = FALSE; -} - -int32_t CONTROL_GetTime(void) -{ - static int32_t t = 0; - t += 5; - return t; -} - -static inline int32_t CONTROL_CheckRange(int32_t which) -{ - if ((uint32_t)which >= (uint32_t)CONTROL_NUM_FLAGS) return TRUE; - //Error("CONTROL_CheckRange: Index %d out of valid range for %d control flags.", - // which, CONTROL_NUM_FLAGS); - return FALSE; -} - -void CONTROL_SetFlag(int32_t which, int32_t active) -{ - if (CONTROL_CheckRange(which)) return; - - if (CONTROL_Flags[which].toggle == INSTANT_ONOFF) - { - CONTROL_Flags[which].active = active; - return; - } - if (active) - { - CONTROL_Flags[which].buttonheld = FALSE; - } - else if (CONTROL_Flags[which].buttonheld == FALSE) - { - CONTROL_Flags[which].buttonheld = TRUE; - CONTROL_Flags[which].active = (CONTROL_Flags[which].active ? FALSE : TRUE); - } -} - -int32_t CONTROL_KeyboardFunctionPressed(int32_t which) -{ - int32_t key1 = 0, key2 = 0; - - if (CONTROL_CheckRange(which)) return FALSE; - - if (!CONTROL_Flags[which].used) return FALSE; - - if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key1].cmd[0]) - key1 = KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] ? TRUE : FALSE; - - if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key2].cmd[0]) - key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? TRUE : FALSE; - - return (key1 | key2); -} - -void CONTROL_ClearKeyboardFunction(int32_t which) -{ - if (CONTROL_CheckRange(which)) return; - - if (!CONTROL_Flags[which].used) return; - - if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED) - KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] = 0; - - if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED) - KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] = 0; -} - -void CONTROL_DefineFlag(int32_t which, int32_t toggle) -{ - if (CONTROL_CheckRange(which)) return; - - CONTROL_Flags[which].active = FALSE; - CONTROL_Flags[which].used = TRUE; - CONTROL_Flags[which].toggle = toggle; - CONTROL_Flags[which].buttonheld = FALSE; - CONTROL_Flags[which].cleared = 0; -} - -int32_t CONTROL_FlagActive(int32_t which) -{ - if (CONTROL_CheckRange(which)) return FALSE; - - return CONTROL_Flags[which].used; -} - -void CONTROL_MapKey(int32_t which, kb_scancode key1, kb_scancode key2) -{ - if (CONTROL_CheckRange(which)) return; - - CONTROL_KeyMapping[which].key1 = key1 ? key1 : KEYUNDEFINED; - CONTROL_KeyMapping[which].key2 = key2 ? key2 : KEYUNDEFINED; -} - -void CONTROL_PrintKeyMap(void) -{ - int32_t i; - - for (i=0; i= (uint32_t)MAXMOUSEBUTTONS) - { - //Error("CONTROL_MapButton: button %d out of valid range for %d mouse buttons.", - // whichbutton, CONTROL_NumMouseButtons); - return; - } - set = CONTROL_MouseButtonMapping; - break; - - case controldevice_joystick: - if ((uint32_t)whichbutton >= (uint32_t)MAXJOYBUTTONS) - { - //Error("CONTROL_MapButton: button %d out of valid range for %d joystick buttons.", - // whichbutton, CONTROL_NumJoyButtons); - return; - } - set = CONTROL_JoyButtonMapping; - break; - - default: - //Error("CONTROL_MapButton: invalid controller device type"); - return; - } - - if (doubleclicked) - set[whichbutton].doubleclicked = whichfunction; - else - set[whichbutton].singleclicked = whichfunction; -} - -void CONTROL_MapAnalogAxis(int32_t whichaxis, int32_t whichanalog, controldevice device) -{ - controlaxismaptype *set; - - if ((uint32_t)whichanalog >= (uint32_t)analog_maxtype) - { - //Error("CONTROL_MapAnalogAxis: analog function %d out of valid range for %d analog functions.", - // whichanalog, analog_maxtype); - return; - } - - switch (device) - { - case controldevice_mouse: - if ((uint32_t)whichaxis >= (uint32_t)MAXMOUSEAXES) - { - //Error("CONTROL_MapAnalogAxis: axis %d out of valid range for %d mouse axes.", - // whichaxis, MAXMOUSEAXES); - return; - } - - set = CONTROL_MouseAxesMap; - break; - - case controldevice_joystick: - if ((uint32_t)whichaxis >= (uint32_t)MAXJOYAXES) - { - //Error("CONTROL_MapAnalogAxis: axis %d out of valid range for %d joystick axes.", - // whichaxis, MAXJOYAXES); - return; - } - - set = CONTROL_JoyAxesMap; - break; - - default: - //Error("CONTROL_MapAnalogAxis: invalid controller device type"); - return; - } - - set[whichaxis].analogmap = whichanalog; -} - -void CONTROL_SetAnalogAxisScale(int32_t whichaxis, int32_t axisscale, controldevice device) -{ - int32_t *set; - - switch (device) - { - case controldevice_mouse: - if ((uint32_t)whichaxis >= (uint32_t)MAXMOUSEAXES) - { - //Error("CONTROL_SetAnalogAxisScale: axis %d out of valid range for %d mouse axes.", - // whichaxis, MAXMOUSEAXES); - return; - } - - set = CONTROL_MouseAxesScale; - break; - - case controldevice_joystick: - if ((uint32_t)whichaxis >= (uint32_t)MAXJOYAXES) - { - //Error("CONTROL_SetAnalogAxisScale: axis %d out of valid range for %d joystick axes.", - // whichaxis, MAXJOYAXES); - return; - } - - set = CONTROL_JoyAxesScale; - break; - - default: - //Error("CONTROL_SetAnalogAxisScale: invalid controller device type"); - return; - } - - set[whichaxis] = axisscale; -} - -void CONTROL_MapDigitalAxis(int32_t whichaxis, int32_t whichfunction, int32_t direction, controldevice device) -{ - controlaxismaptype *set; - - if (CONTROL_CheckRange(whichfunction)) whichfunction = AXISUNDEFINED; - - switch (device) - { - case controldevice_mouse: - if ((uint32_t)whichaxis >= (uint32_t)MAXMOUSEAXES) - { - //Error("CONTROL_MapDigitalAxis: axis %d out of valid range for %d mouse axes.", - // whichaxis, MAXMOUSEAXES); - return; - } - - set = CONTROL_MouseAxesMap; - break; - - case controldevice_joystick: - if ((uint32_t)whichaxis >= (uint32_t)MAXJOYAXES) - { - //Error("CONTROL_MapDigitalAxis: axis %d out of valid range for %d joystick axes.", - // whichaxis, MAXJOYAXES); - return; - } - - set = CONTROL_JoyAxesMap; - break; - - default: - //Error("CONTROL_MapDigitalAxis: invalid controller device type"); - return; - } - - switch (direction) // JBF: this is all very much a guess. The ASM puzzles me. - { - case axis_up: - case axis_left: - set[whichaxis].minmap = whichfunction; - break; - case axis_down: - case axis_right: - set[whichaxis].maxmap = whichfunction; - break; - default: - break; - } -} - -void CONTROL_ClearAssignments(void) -{ - int32_t i; - - memset(CONTROL_MouseButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_MouseButtonMapping)); - memset(CONTROL_JoyButtonMapping, BUTTONUNDEFINED, sizeof(CONTROL_JoyButtonMapping)); - memset(CONTROL_KeyMapping, KEYUNDEFINED, sizeof(CONTROL_KeyMapping)); - memset(CONTROL_MouseAxesMap, AXISUNDEFINED, sizeof(CONTROL_MouseAxesMap)); - memset(CONTROL_JoyAxesMap, AXISUNDEFINED, sizeof(CONTROL_JoyAxesMap)); - memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes)); - memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes)); - memset(CONTROL_LastMouseAxes, 0, sizeof(CONTROL_LastMouseAxes)); - memset(CONTROL_LastJoyAxes, 0, sizeof(CONTROL_LastJoyAxes)); - for (i=0; i=0; i--) - { - bs = (buttons >> i) & 1; - - DeviceButtonState[i] = bs; - ButtonClickedState[i] = FALSE; - - if (bs) - { - if (ButtonClicked[i] == FALSE) - { - ButtonClicked[i] = TRUE; - - if (ButtonClickedCount[i] == 0 || tm > ButtonClickedTime[i]) - { - ButtonClickedTime[i] = tm + CONTROL_DoubleClickSpeed; - ButtonClickedCount[i] = 1; - } - else if (tm < ButtonClickedTime[i]) - { - ButtonClickedState[i] = TRUE; - ButtonClickedTime[i] = 0; - ButtonClickedCount[i] = 2; - } - } - else if (ButtonClickedCount[i] == 2) - { - ButtonClickedState[i] = TRUE; - } - continue; - } - if (ButtonClickedCount[i] == 2) - ButtonClickedCount[i] = 0; - - ButtonClicked[i] = FALSE; - } -} - -void CONTROL_GetDeviceButtons(void) -{ - int32_t t; - - t = GetTime(); - - if (CONTROL_MouseEnabled) - { - DoGetDeviceButtons( - MOUSE_GetButtons(), t, - CONTROL_NumMouseButtons, - CONTROL_MouseButtonState, - CONTROL_MouseButtonClickedTime, - CONTROL_MouseButtonClickedState, - CONTROL_MouseButtonClicked, - CONTROL_MouseButtonClickedCount - ); - } - - if (CONTROL_JoystickEnabled) - { - int32_t buttons = joyb; - if (joynumhats > 0 && joyhat[0] != -1) - { - static int32_t hatstate[] = { 1, 1|2, 2, 2|4, 4, 4|8, 8, 8|1 }; - int32_t val; - - // thanks SDL for this much more sensible method - val = ((joyhat[0] + 4500 / 2) % 36000) / 4500; - if (val < 8) buttons |= hatstate[val] << min(MAXJOYBUTTONS,joynumbuttons); - } - - DoGetDeviceButtons( - buttons, t, - CONTROL_NumJoyButtons, - CONTROL_JoyButtonState, - CONTROL_JoyButtonClickedTime, - CONTROL_JoyButtonClickedState, - CONTROL_JoyButtonClicked, - CONTROL_JoyButtonClickedCount - ); - } -} - -void CONTROL_DigitizeAxis(int32_t axis, controldevice device) -{ - controlaxistype *set, *lastset; - - switch (device) - { - case controldevice_mouse: - set = CONTROL_MouseAxes; - lastset = CONTROL_LastMouseAxes; - break; - - case controldevice_joystick: - set = CONTROL_JoyAxes; - lastset = CONTROL_LastJoyAxes; - break; - - default: return; - } - - if (set[axis].analog > 0) - { - if (set[axis].analog > THRESHOLD || (set[axis].analog > MINTHRESHOLD && lastset[axis].digital == 1)) - set[axis].digital = 1; - } - else - { - if (set[axis].analog < -THRESHOLD || (set[axis].analog < -MINTHRESHOLD && lastset[axis].digital == -1)) - set[axis].digital = -1; - } -} - -void CONTROL_ScaleAxis(int32_t axis, controldevice device) -{ - controlaxistype *set; - int32_t *scale; - - switch (device) - { - case controldevice_mouse: - set = CONTROL_MouseAxes; - scale = CONTROL_MouseAxesScale; - break; - - case controldevice_joystick: - set = CONTROL_JoyAxes; - scale = CONTROL_JoyAxesScale; - break; - - default: return; - } - - set[axis].analog = mulscale16(set[axis].analog, scale[axis]); -} - -void CONTROL_ApplyAxis(int32_t axis, ControlInfo *info, controldevice device) -{ - controlaxistype *set; - controlaxismaptype *map; - - switch (device) - { - case controldevice_mouse: - set = CONTROL_MouseAxes; - map = CONTROL_MouseAxesMap; - break; - - case controldevice_joystick: - set = CONTROL_JoyAxes; - map = CONTROL_JoyAxesMap; - break; - - default: return; - } - - switch (map[axis].analogmap) - { - case analog_turning: info->dyaw += set[axis].analog; break; - case analog_strafing: info->dx += set[axis].analog; break; - case analog_lookingupanddown: info->dpitch += set[axis].analog; break; - case analog_elevation: info->dy += set[axis].analog; break; - case analog_rolling: info->droll += set[axis].analog; break; - case analog_moving: info->dz += set[axis].analog; break; - default: break; - } -} - -void CONTROL_PollDevices(ControlInfo *info) -{ - Bmemcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes)); - Bmemcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes)); - - memset(CONTROL_MouseAxes, 0, sizeof(CONTROL_MouseAxes)); - memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes)); - memset(info, 0, sizeof(ControlInfo)); - - if (CONTROL_MouseEnabled) - { - int32_t i = MAXMOUSEAXES-1; - - CONTROL_GetMouseDelta(); - do - { - CONTROL_DigitizeAxis(i, controldevice_mouse); - CONTROL_ScaleAxis(i, controldevice_mouse); - LIMITCONTROL(&CONTROL_MouseAxes[i].analog); - CONTROL_ApplyAxis(i, info, controldevice_mouse); - } - while (--i); - - CONTROL_DigitizeAxis(0, controldevice_mouse); - CONTROL_ScaleAxis(0, controldevice_mouse); - LIMITCONTROL(&CONTROL_MouseAxes[0].analog); - CONTROL_ApplyAxis(0, info, controldevice_mouse); - } - - if (CONTROL_JoystickEnabled) - { - int32_t i = MAXJOYAXES-1; - - CONTROL_GetJoyDelta(); - do - { - CONTROL_DigitizeAxis(i, controldevice_joystick); - CONTROL_ScaleAxis(i, controldevice_joystick); - LIMITCONTROL(&CONTROL_JoyAxes[i].analog); - CONTROL_ApplyAxis(i, info, controldevice_joystick); - } - while (--i); - - CONTROL_DigitizeAxis(0, controldevice_joystick); - CONTROL_ScaleAxis(0, controldevice_joystick); - LIMITCONTROL(&CONTROL_JoyAxes[0].analog); - CONTROL_ApplyAxis(0, info, controldevice_joystick); - } - - CONTROL_GetDeviceButtons(); -} - -void CONTROL_AxisFunctionState(int32_t *p1) -{ - if (CONTROL_NumMouseAxes) - { - int32_t j, i = CONTROL_NumMouseAxes-1; - - do - { - if (!CONTROL_MouseAxes[i].digital) continue; - - if (CONTROL_MouseAxes[i].digital < 0) - j = CONTROL_MouseAxesMap[i].minmap; - else - j = CONTROL_MouseAxesMap[i].maxmap; - - if (j != AXISUNDEFINED) - p1[j] = 1; - } - while (i--); - } - - if (CONTROL_NumJoyAxes) - { - int32_t j, i = CONTROL_NumJoyAxes-1; - - do - { - if (!CONTROL_JoyAxes[i].digital) continue; - - if (CONTROL_JoyAxes[i].digital < 0) - j = CONTROL_JoyAxesMap[i].minmap; - else - j = CONTROL_JoyAxesMap[i].maxmap; - - if (j != AXISUNDEFINED) - p1[j] = 1; - } - while (i--); - } -} - -void CONTROL_ButtonFunctionState(int32_t *p1) -{ - if (CONTROL_NumMouseButtons) - { - int32_t i = CONTROL_NumMouseButtons-1, j; - - do - { - if (!MouseBindings[i].cmd[0]) - { - j = CONTROL_MouseButtonMapping[i].doubleclicked; - if (j != KEYUNDEFINED) - p1[j] |= CONTROL_MouseButtonClickedState[i]; - - j = CONTROL_MouseButtonMapping[i].singleclicked; - if (j != KEYUNDEFINED) - p1[j] |= CONTROL_MouseButtonState[i]; - } - - if (!bindsenabled) - continue; - - if (MouseBindings[i].cmd[0] && CONTROL_MouseButtonState[i]) - { - if (MouseBindings[i].repeat || (MouseBindings[i].laststate == 0)) - OSD_Dispatch(MouseBindings[i].cmd); - } - MouseBindings[i].laststate = CONTROL_MouseButtonState[i]; - } - while (i--); - } - - if (CONTROL_NumJoyButtons) - { - int32_t i=CONTROL_NumJoyButtons-1, j; - - do - { - j = CONTROL_JoyButtonMapping[i].doubleclicked; - if (j != KEYUNDEFINED) - p1[j] |= CONTROL_JoyButtonClickedState[i]; - - j = CONTROL_JoyButtonMapping[i].singleclicked; - if (j != KEYUNDEFINED) - p1[j] |= CONTROL_JoyButtonState[i]; - } - while (i--); - } -} - -void CONTROL_ClearButton(int32_t whichbutton) -{ - if (CONTROL_CheckRange(whichbutton)) return; - BUTTONCLEAR(whichbutton); - CONTROL_Flags[whichbutton].cleared = TRUE; -} - -void CONTROL_ProcessBinds(void) -{ - int32_t i=MAXBOUNDKEYS-1; - - if (!bindsenabled) - return; - - do - { - if (KeyBindings[i].cmd[0]) - { - if (KB_KeyPressed(i) && (KeyBindings[i].repeat || (KeyBindings[i].laststate == 0))) - { - OSD_Dispatch(KeyBindings[i].cmd); - KeyBindings[i].laststate = KB_KeyPressed(i); - } - else KeyBindings[i].laststate = KB_KeyPressed(i); - } - } - while (i--); -} - -void CONTROL_GetInput(ControlInfo *info) -{ - int32_t periphs[CONTROL_NUM_FLAGS]; - int32_t i = CONTROL_NUM_FLAGS-1; - - CONTROL_PollDevices(info); - - memset(periphs, 0, sizeof(periphs)); - CONTROL_ButtonFunctionState(periphs); - CONTROL_AxisFunctionState(periphs); - - CONTROL_ButtonHeldState = CONTROL_ButtonState; - CONTROL_ButtonState = 0; - - do - { - CONTROL_SetFlag(i, /*CONTROL_KeyboardFunctionPressed(i) | */periphs[i] | extinput[i]); - - if (CONTROL_Flags[i].cleared == FALSE) BUTTONSET(i, CONTROL_Flags[i].active); - else if (CONTROL_Flags[i].active == FALSE) CONTROL_Flags[i].cleared = 0; - } - while (i--); - - memset(extinput, 0, sizeof(extinput)); -} - -int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ticspersecond) -{ - int32_t i; - - UNREFERENCED_PARAMETER(which); - - if (CONTROL_Started) return FALSE; - - if (TimeFunction) GetTime = TimeFunction; - else GetTime = CONTROL_GetTime; - - ticrate = ticspersecond; - - CONTROL_DoubleClickSpeed = (ticspersecond*57)/100; - if (CONTROL_DoubleClickSpeed <= 0) - CONTROL_DoubleClickSpeed = 1; - - if (initinput()) return TRUE; - - CONTROL_MousePresent = CONTROL_MouseEnabled = FALSE; - CONTROL_JoyPresent = CONTROL_JoystickEnabled = FALSE; - CONTROL_NumMouseButtons = CONTROL_NumJoyButtons = 0; - CONTROL_NumMouseAxes = CONTROL_NumJoyAxes = 0; - KB_Startup(); - - //switch (which) { - // case controltype_keyboard: - // break; - - // case controltype_keyboardandmouse: - CONTROL_NumMouseAxes = MAXMOUSEAXES; - CONTROL_NumMouseButtons = MAXMOUSEBUTTONS; - CONTROL_MousePresent = MOUSE_Init(); - CONTROL_MouseEnabled = CONTROL_MousePresent; - // break; - - // case controltype_keyboardandjoystick: - CONTROL_NumJoyAxes = min(MAXJOYAXES,joynumaxes); - CONTROL_NumJoyButtons = min(MAXJOYBUTTONS,joynumbuttons + 4*(joynumhats>0)); - CONTROL_JoyPresent = CONTROL_StartJoy(0);; - CONTROL_JoystickEnabled = CONTROL_JoyPresent; - // break; - //} - - /* - if (CONTROL_MousePresent) - initprintf("CONTROL_Startup: Mouse Present\n"); - if (CONTROL_JoyPresent) - initprintf("CONTROL_Startup: Joystick Present\n"); - */ - - CONTROL_ButtonState = 0; - CONTROL_ButtonHeldState = 0; - - memset(CONTROL_UserInputCleared, 0, sizeof(CONTROL_UserInputCleared)); - - for (i=0; i> ((uint64_t)(x)) ) & 1) -#define BUTTONHELD(x) ((CONTROL_ButtonHeldState>> ((uint64_t)(x)) ) & 1) - -#define BUTTONJUSTPRESSED(x) \ - ( BUTTON( x ) && !BUTTONHELD( x ) ) -#define BUTTONRELEASED(x) \ - ( !BUTTON( x ) && BUTTONHELD( x ) ) -#define BUTTONSTATECHANGED(x) \ - ( BUTTON( x ) != BUTTONHELD( x ) ) - - -//*************************************************************************** -// -// TYPEDEFS -// -//*************************************************************************** -typedef enum - { - axis_up, - axis_down, - axis_left, - axis_right - } axisdirection; - -typedef enum - { - analog_turning=0, - analog_strafing=1, - analog_lookingupanddown=2, - analog_elevation=3, - analog_rolling=4, - analog_moving=5, - analog_maxtype - } analogcontrol; - -typedef enum - { - dir_North, - dir_NorthEast, - dir_East, - dir_SouthEast, - dir_South, - dir_SouthWest, - dir_West, - dir_NorthWest, - dir_None - } direction; - -typedef struct - { - int32_t button0; - int32_t button1; - direction dir; - } UserInput; - -typedef struct - { - int32_t dx; - int32_t dy; - int32_t dz; - int32_t dyaw; - int32_t dpitch; - int32_t droll; - } ControlInfo; - -typedef enum - { - controltype_keyboard, - controltype_keyboardandmouse, - controltype_keyboardandjoystick - } controltype; - -typedef enum - { - controldevice_keyboard, - controldevice_mouse, - controldevice_joystick - } controldevice; - - -//*************************************************************************** -// -// GLOBALS -// -//*************************************************************************** - -extern int32_t CONTROL_Started; -extern int32_t CONTROL_MousePresent; -extern int32_t CONTROL_JoyPresent; -extern int32_t CONTROL_MouseEnabled; -extern int32_t CONTROL_JoystickEnabled; -extern uint64_t CONTROL_ButtonState; -extern uint64_t CONTROL_ButtonHeldState; - - -//*************************************************************************** -// -// PROTOTYPES -// -//*************************************************************************** - -void CONTROL_MapKey( int32_t which, kb_scancode key1, kb_scancode key2 ); -void CONTROL_MapButton - ( - int32_t whichfunction, - int32_t whichbutton, - int32_t doubleclicked, - controldevice device - ); -void CONTROL_DefineFlag( int32_t which, int32_t toggle ); -int32_t CONTROL_FlagActive( int32_t which ); -void CONTROL_ClearAssignments( void ); -void CONTROL_GetInput( ControlInfo *info ); -void CONTROL_ClearButton( int32_t whichbutton ); -float CONTROL_MouseSensitivity; -int32_t CONTROL_Startup - ( - controltype which, - int32_t ( *TimeFunction )( void ), - int32_t ticspersecond - ); -void CONTROL_Shutdown( void ); - -void CONTROL_SetDoubleClickDelay(int32_t delay); -int32_t CONTROL_GetDoubleClickDelay(void); - -void CONTROL_MapAnalogAxis - ( - int32_t whichaxis, - int32_t whichanalog, - controldevice device - ); - -void CONTROL_MapDigitalAxis - ( - int32_t whichaxis, - int32_t whichfunction, - int32_t direction, - controldevice device - ); -void CONTROL_SetAnalogAxisScale - ( - int32_t whichaxis, - int32_t axisscale, - controldevice device - ); - -void CONTROL_PrintKeyMap(void); -void CONTROL_PrintControlFlag(int32_t which); -void CONTROL_PrintAxes( void ); - -#define MAXBINDSTRINGLENGTH 128 -#define MAXBOUNDKEYS 256 - -typedef struct binding { - char *key; - char cmd[MAXBINDSTRINGLENGTH]; - char repeat; - char laststate; -} keybind; - -#define MAXMOUSEBUTTONS 10 - -extern keybind KeyBindings[MAXBOUNDKEYS], MouseBindings[MAXMOUSEBUTTONS]; -extern int32_t bindsenabled; - -void CONTROL_ProcessBinds(void); - -#define CONTROL_NUM_FLAGS 64 -extern int32_t extinput[CONTROL_NUM_FLAGS]; -extern int32_t control_smoothmouse; - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/jmact/file_lib.c b/polymer-perf/eduke32/source/jmact/file_lib.c deleted file mode 100644 index 620f1a641..000000000 --- a/polymer-perf/eduke32/source/jmact/file_lib.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * file_lib.c - * File functions to emulate MACT - * - * by Jonathon Fowler - * - * Since we weren't given the source for MACT386.LIB so I've had to do some - * creative interpolation here. - * - */ -//------------------------------------------------------------------------- -/* -Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include -#ifndef _MSC_VER -#include -#endif -#include -#include -#include "compat.h" - -#include "file_lib.h" -#include "cache1d.h" -#include "baselayer.h" - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#ifndef O_TEXT -#define O_TEXT 0 -#endif -#ifndef F_OK -#define F_OK 0 -#endif - -#define MaxFiles 20 -static char *FileNames[MaxFiles]; - -int32_t SafeOpen(const char *filename, int32_t mode, int32_t sharemode) -{ - int32_t h; - - h = openfrompath(filename, mode, sharemode); - if (h < 0) - { - initprintf("Error opening %s: %s", filename, strerror(errno)); - return h; - } - - if (h < MaxFiles) - { - if (FileNames[h]) Bfree(FileNames[h]); - FileNames[h] = (char*)Bmalloc(strlen(filename)+1); - if (FileNames[h]) strcpy(FileNames[h], filename); - } - - return h; -} - -int32_t SafeOpenRead(const char *filename, int32_t filetype) -{ - switch (filetype) - { - case filetype_binary: - return SafeOpen(filename, O_RDONLY|O_BINARY, S_IREAD); - case filetype_text: - return SafeOpen(filename, O_RDONLY|O_TEXT, S_IREAD); - default: - initprintf("SafeOpenRead: Illegal filetype specified"); - return -1; - } -} - -void SafeClose(int32_t handle) -{ - if (handle < 0) return; - if (close(handle) < 0) - { - if (handle < MaxFiles) - initprintf("Unable to close file %s", FileNames[handle]); - else - initprintf("Unable to close file"); - return; - } - - if (handle < MaxFiles && FileNames[handle]) - { - Bfree(FileNames[handle]); - FileNames[handle] = NULL; - } -} - -int32_t SafeFileExists(const char *filename) -{ - if (!access(filename, F_OK)) return TRUE; - return FALSE; -} - -int32_t SafeFileLength(int32_t handle) -{ - if (handle < 0) return -1; - return Bfilelength(handle); -} - -void SafeRead(int32_t handle, void *buffer, int32_t count) -{ - int32_t b; - - b = read(handle, buffer, count); - if (b != count) - { - close(handle); - if (handle < MaxFiles) - initprintf("File read failure %s reading %d bytes from file %s.", - strerror(errno), count, FileNames[handle]); - else - initprintf("File read failure %s reading %d bytes.", - strerror(errno), count); - return; - } -} - - diff --git a/polymer-perf/eduke32/source/jmact/file_lib.h b/polymer-perf/eduke32/source/jmact/file_lib.h deleted file mode 100644 index 1cc34375b..000000000 --- a/polymer-perf/eduke32/source/jmact/file_lib.h +++ /dev/null @@ -1,260 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- - -#ifndef _file_lib_public -#define _file_lib_public -#ifdef __cplusplus -extern "C" { -#endif - -enum - { - filetype_binary, - filetype_text - }; - -enum - { - access_read, - access_write, - access_append - }; - -//========================================================================== -// -// SafeOpenWrite - Opens a file for writing, returns handle -// -//========================================================================== -int32_t SafeOpenWrite ( const char * filename, int32_t filetype ); - -//========================================================================== -// -// SafeOpenRead - Opens a file for reading, returns handle -// -//========================================================================== -int32_t SafeOpenRead ( const char * filename, int32_t filetype ); - -//========================================================================== -// -// SafeOpenAppend - Opens a file for appending, returns handle -// -//========================================================================== -int32_t SafeOpenAppend ( const char * filename, int32_t filetype ); - -//========================================================================== -// -// SafeClose - Close a file denoted by the file handle -// -//========================================================================== -void SafeClose ( int32_t handle ); - -//========================================================================== -// -// SafeFileExists - Checks for existence of file -// -//========================================================================== -int32_t SafeFileExists ( const char * filename ); - -//========================================================================== -// -// SafeFileLength - Get length of a file pointed to by handle -// -//========================================================================== -int32_t SafeFileLength ( int32_t handle ); - -//========================================================================== -// -// SafeRead - reads from a handle -// -// handle - handle of file to read from -// -// buffer - pointer of buffer to read into -// -// count - number of bytes to read -// -//========================================================================== -void SafeRead (int32_t handle, void *buffer, int32_t count); - -//========================================================================== -// -// SafeWrite - writes to a handle -// -// handle - handle of file to write to -// -// buffer - pointer of buffer to write from -// -// count - number of bytes to write -// -//========================================================================== -void SafeWrite (int32_t handle, void *buffer, int32_t count); - -//========================================================================== -// -// LoadFile - Load a file -// -// filename - name of file -// -// bufferptr - pointer to pointer of buffer to read into -// -// returns number of bytes read -// -//========================================================================== -int32_t LoadFile ( const char * filename, void ** bufferptr ); - -//========================================================================== -// -// SaveFile - Save a file -// -// filename - name of file -// -// bufferptr - pointer to buffer to write from -// -// count - number of bytes to write -// -//========================================================================== -void SaveFile ( const char * filename, void * bufferptr, int32_t count ); - -//========================================================================== -// -// GetPathFromEnvironment - Add a pathname described in an environment -// variable to a standard filename. -// -// fullname - final string containing entire path -// -// envname - string naming enivronment variable -// -// filename - standard filename -// -//========================================================================== -void GetPathFromEnvironment( char *fullname, const char *envname, const char *filename ); - -//========================================================================== -// -// DefaultExtension - Add a default extension to a path -// -// path - a path -// -// extension - default extension should include '.' -// -//========================================================================== -void DefaultExtension (char *path, const char *extension); - -//========================================================================== -// -// DefaultPath - Add the default path to a filename if it doesn't have one -// -// path - filename -// -// extension - default path -// -//========================================================================== -void DefaultPath (char *path, const char *basepath); - -//========================================================================== -// -// ExtractFileBase - Extract the base filename from a path -// -// path - the path -// -// dest - where the file base name will be placed -// -//========================================================================== -void ExtractFileBase (char *path, char *dest); - -//========================================================================== -// -// GetExtension - Extract the extension from a name -// returns true if an extension is found -// returns false otherwise -// -//========================================================================== -int32_t GetExtension( char *filename, char *extension ); - -//========================================================================== -// -// SetExtension - Sets the extension from a name. Assumes that enough -// space is left at the end of the string to hold an extension. -// -//========================================================================== -void SetExtension( char *filename, const char *extension ); - -#ifdef __MSDOS__ -//****************************************************************************** -// -// GetPath -// -// Purpose -// To parse the directory entered by the user to make the directory. -// -// Parms -// Path - the path to be parsed. -// -// Returns -// Pointer to next path -// -//****************************************************************************** -char * GetPath (char * path, char *dir); - -//****************************************************************************** -// -// ChangeDirectory () -// -// Purpose -// To change to a directory. Checks for drive changes. -// -// Parms -// path - The path to change to. -// -// Returns -// TRUE - If successful. -// FALSE - If unsuccessful. -// -//****************************************************************************** -int32_t ChangeDirectory (char * path); - -//****************************************************************************** -// -// ChangeDrive () -// -// Purpose -// To change drives. -// -// Parms -// drive - The drive to change to. -// -// Returns -// TRUE - If drive change successful. -// FALSE - If drive change unsuccessful. -// -//****************************************************************************** -int32_t ChangeDrive (char *drive); - -#endif - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/jmact/keyboard.c b/polymer-perf/eduke32/source/jmact/keyboard.c deleted file mode 100644 index 1b6083325..000000000 --- a/polymer-perf/eduke32/source/jmact/keyboard.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * keyboard.c - * MACT library -to- JonoF's Build Port Keyboard Glue - * - * by Jonathon Fowler - * - * Since we don't have the source to the MACT library I've had to - * concoct some magic to glue its idea of controllers into that of - * my Build port. - * - */ -//------------------------------------------------------------------------- -/* -Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "compat.h" - -#include "keyboard.h" -#include "control.h" - - -kb_scancode KB_LastScan; - -static int32_t numpad = 0; - -// translation table for taking key names to scancodes and back again -static struct -{ - char *key; - kb_scancode sc; -} sctokeylut[] = -{ - { "Escape", 0x1 }, - { "1", 0x2 }, - { "2", 0x3 }, - { "3", 0x4 }, - { "4", 0x5 }, - { "5", 0x6 }, - { "6", 0x7 }, - { "7", 0x8 }, - { "8", 0x9 }, - { "9", 0xa }, - { "0", 0xb }, - { "-", 0xc }, - { "=", 0xd }, - { "BakSpc", 0xe }, - { "Tab", 0xf }, - { "Q", 0x10 }, - { "W", 0x11 }, - { "E", 0x12 }, - { "R", 0x13 }, - { "T", 0x14 }, - { "Y", 0x15 }, - { "U", 0x16 }, - { "I", 0x17 }, - { "O", 0x18 }, - { "P", 0x19 }, - { "[", 0x1a }, - { "]", 0x1b }, - { "Enter", 0x1c }, - { "LCtrl", 0x1d }, - { "A", 0x1e }, - { "S", 0x1f }, - { "D", 0x20 }, - { "F", 0x21 }, - { "G", 0x22 }, - { "H", 0x23 }, - { "J", 0x24 }, - { "K", 0x25 }, - { "L", 0x26 }, - { ";", 0x27 }, - { "'", 0x28 }, - { "`", 0x29 }, - { "LShift", 0x2a }, - { "\\", 0x2b }, - { "Z", 0x2c }, - { "X", 0x2d }, - { "C", 0x2e }, - { "V", 0x2f }, - { "B", 0x30 }, - { "N", 0x31 }, - { "M", 0x32 }, - { ",", 0x33 }, - { ".", 0x34 }, - { "/", 0x35 }, - { "RShift", 0x36 }, - { "Kpad*", 0x37 }, - { "LAlt", 0x38 }, - { "Space", 0x39 }, - { "CapLck", 0x3a }, - { "F1", 0x3b }, - { "F2", 0x3c }, - { "F3", 0x3d }, - { "F4", 0x3e }, - { "F5", 0x3f }, - { "F6", 0x40 }, - { "F7", 0x41 }, - { "F8", 0x42 }, - { "F9", 0x43 }, - { "F10", 0x44 }, - { "NumLck", 0x45 }, - { "ScrLck", 0x46 }, - { "Kpad7", 0x47 }, - { "Kpad8", 0x48 }, - { "Kpad9", 0x49 }, - { "Kpad-", 0x4a }, - { "Kpad4", 0x4b }, - { "Kpad5", 0x4c }, - { "Kpad6", 0x4d }, - { "Kpad+", 0x4e }, - { "Kpad1", 0x4f }, - { "Kpad2", 0x50 }, - { "Kpad3", 0x51 }, - { "Kpad0", 0x52 }, - { "Kpad.", 0x53 }, - { "F11", 0x57 }, - { "F12", 0x58 }, - { "KpdEnt", 0x9c }, - { "RCtrl", 0x9d }, - { "Kpad/", 0xb5 }, - { "RAlt", 0xb8 }, - { "PrtScn", 0xb7 }, - { "Pause", 0xc5 }, - { "Home", 0xc7 }, - { "Up", 0xc8 }, - { "PgUp", 0xc9 }, - { "Left", 0xcb }, - { "Right", 0xcd }, - { "End", 0xcf }, - { "Down", 0xd0 }, - { "PgDn", 0xd1 }, - { "Insert", 0xd2 }, - { "Delete", 0xd3 }, -}; - -// translation table for turning scancode into ascii characters -/* -static char sctoasc[2][256] = { - { -// 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 8, 9, // 0x00 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 13, 0, 'a', 's', // 0x10 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'','`', 0, '\\','z', 'x', 'c', 'v', // 0x20 - 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, // 0x30 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, // 0x40 - 0, 0, 0, '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x50 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x60 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x70 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x80 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, // 0x90 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xa0 - 0, 0, 0, 0, 0, '/', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xb0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xc0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xd0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xe0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 0xf0 - }, - { -// 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0, 27, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 8, 9, // 0x00 - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 13, 0, 'A', 'S', // 0x10 - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 0, '|', 'Z', 'X', 'C', 'V', // 0x20 - 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, // 0x30 - 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', // 0x40 - '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x50 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x60 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x70 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x80 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, // 0x90 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xa0 - 0, 0, 0, 0, 0, '/', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xb0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xc0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xd0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xe0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // 0xf0 - } -}; -*/ - -int32_t KB_KeyWaiting(void) -{ - return bkbhit(); -// return (keyfifoplc != keyfifoend); -} - -char KB_Getch(void) -{ - /* - uint8_t ch; - char shifted; - if (keyfifoplc == keyfifoend) return 0; - ch = keyfifo[keyfifoplc]; - keyfifoplc = ((keyfifoplc+2)&(KEYFIFOSIZ-1)); - - shifted = ((keystatus[0x2a]!=0)||(keystatus[0x36]!=0)); - if (ch >= 0x47 && ch <= 0x52) shifted = numpad; - - return sctoasc[shifted][ch]; - */ - return (char)bgetchar(); -} - -void KB_FlushKeyboardQueue(void) -{ - //keyfifoplc = keyfifoend = 0; - bflushchars(); -} - -void KB_ClearKeysDown(void) -{ - KB_LastScan = 0; - memset(keystatus, 0, sizeof(keystatus)); - //keyfifoplc = keyfifoend = 0; - //bflushchars(); -} - -char *KB_ScanCodeToString(kb_scancode scancode) -{ - uint32_t s; - - for (s=0; s < (sizeof(sctokeylut)/sizeof(sctokeylut[0])); s++) - if (sctokeylut[s].sc == scancode) return sctokeylut[s].key; - - return ""; -} - -kb_scancode KB_StringToScanCode(char * string) -{ - uint32_t s; - - for (s=0; s < (sizeof(sctokeylut)/sizeof(sctokeylut[0])); s++) - if (!Bstrcasecmp(sctokeylut[s].key, string)) return sctokeylut[s].sc; - - return 0; -} - -void KB_TurnKeypadOn(void) -{ - numpad = 1; -} - -void KB_TurnKeypadOff(void) -{ - numpad = 0; -} - -int32_t KB_KeypadActive(void) -{ - return numpad; -} - -static void KB_KeyEvent(int32_t scancode, int32_t keypressed) -{ - if (keypressed) KB_LastScan = scancode; -} - -void KB_Startup(void) -{ - numpad = 0; - setkeypresscallback(KB_KeyEvent); -} - -void KB_Shutdown(void) -{ - setkeypresscallback((void(*)(int32_t,int32_t))NULL); -} - diff --git a/polymer-perf/eduke32/source/jmact/keyboard.h b/polymer-perf/eduke32/source/jmact/keyboard.h deleted file mode 100644 index 66b348356..000000000 --- a/polymer-perf/eduke32/source/jmact/keyboard.h +++ /dev/null @@ -1,109 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) -*/ -//------------------------------------------------------------------------- - -#ifndef _keyboard_public -#define _keyboard_public -#ifdef __cplusplus -extern "C" { -#endif - -#include "baselayer.h" // for the keyboard stuff -#include "scancodes.h" - -/* -============================================================================= - - DEFINES - -============================================================================= -*/ - -typedef uint8_t kb_scancode; - -#define MAXKEYBOARDSCAN 128 - - -/* -============================================================================= - - GLOBAL VARIABLES - -============================================================================= -*/ - -//extern byte KB_KeyDown[ MAXKEYBOARDSCAN ]; // Keyboard state array -#define KB_KeyDown keystatus -extern kb_scancode KB_LastScan; - - -/* -============================================================================= - - MACROS - -============================================================================= -*/ - -#define KB_GetLastScanCode() ( KB_LastScan ) - -#define KB_SetLastScanCode( scancode ) { KB_LastScan = ( scancode ); } - -#define KB_ClearLastScanCode() { KB_SetLastScanCode( sc_None ); } - -#define KB_KeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 ) - -#define KB_ClearKeyDown( scan ) { keystatus[ ( scan ) ] = FALSE; } - -#define KB_UnBoundKeyPressed( scan ) ( keystatus[ ( scan ) ] != 0 && !KeyBindings[scan].cmd[0]) - -/* -============================================================================= - - FUNCTION PROTOTYPES - -============================================================================= -*/ - -int32_t KB_KeyWaiting( void ); // Checks if a character is waiting in the keyboard queue -char KB_Getch( void ); // Gets the next keypress -void KB_FlushKeyboardQueue( void ); // Empties the keyboard queue of all waiting characters. -void KB_ClearKeysDown( void ); // Clears all keys down flags. -char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string -kb_scancode KB_StringToScanCode( char * string ); // convert a string into a scancode -void KB_TurnKeypadOn( void ); // turn the keypad on -void KB_TurnKeypadOff( void ); // turn the keypad off -int32_t KB_KeypadActive( void ); // check whether keypad is active -void KB_Startup( void ); -void KB_Shutdown( void ); - -#define KB_FlushKeyBoardQueue KB_FlushKeyboardQueue -#define KB_GetCh KB_Getch - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/jmact/mathutil.c b/polymer-perf/eduke32/source/jmact/mathutil.c deleted file mode 100644 index 96e881c4e..000000000 --- a/polymer-perf/eduke32/source/jmact/mathutil.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * mathutil.c - * Mathematical utility functions to emulate MACT - * - * by Jonathon Fowler - * - * Since we weren't given the source for MACT386.LIB so I've had to do some - * creative interpolation here. - * - */ -//------------------------------------------------------------------------- -/* -Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include -#include "compat.h" -#include "pragmas.h" - -// I wonder if it's faster to use Ken's functions here... - -int32_t FindDistance2D(int32_t x, int32_t y) -{ - if ((x=klabs(x)) < (y=klabs(y))) swaplong(&x,&y); - - { - int32_t t = y + (y>>1); - return (x - (x>>5) - (x>>7) + (t>>2) + (t>>6)); - } -} - -int32_t FindDistance3D(int32_t x, int32_t y, int32_t z) -{ - if ((x=klabs(x)) < (y=klabs(y))) swaplong(&x,&y); - if (x < (z=klabs(z))) swaplong(&x,&z); - - { - int32_t t = y + z; - return (x - (x>>4) + (t>>2) + (t>>3)); - } -} diff --git a/polymer-perf/eduke32/source/jmact/mathutil.h b/polymer-perf/eduke32/source/jmact/mathutil.h deleted file mode 100644 index 21386c76f..000000000 --- a/polymer-perf/eduke32/source/jmact/mathutil.h +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is NOT part of Duke Nukem 3D version 1.5 - Atomic Edition -However, it is either an older version of a file that is, or is -some test code written during the development of Duke Nukem 3D. -This file is provided purely for educational interest. - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- - - -extern int32_t FindDistance2D(int32_t dx, int32_t dy); -extern int32_t FindDistance3D(int32_t dx, int32_t dy, int32_t dz); -extern int32_t FindDistance3D_HP(int32_t dx, int32_t dy, int32_t dz); -extern int32_t ArcTangentAppx(int32_t dx, int32_t dy); - diff --git a/polymer-perf/eduke32/source/jmact/mouse.c b/polymer-perf/eduke32/source/jmact/mouse.c deleted file mode 100644 index d8c95410c..000000000 --- a/polymer-perf/eduke32/source/jmact/mouse.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * mouse.c - * MACT library -to- JonoF's Build Port Mouse Glue - * - * by Jonathon Fowler - * - * Since we don't have the source to the MACT library I've had to - * concoct some magic to glue its idea of controllers into that of - * my Build port. - * - */ -//------------------------------------------------------------------------- -/* -Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "compat.h" - -#include "mouse.h" -#include "baselayer.h" - - -int32_t MOUSE_Init(void) -{ - initmouse(); - return ((inputdevices & 2) == 2); -} - - -void MOUSE_Shutdown(void) -{ - uninitmouse(); -} - - -void MOUSE_ShowCursor(void) -{ -} - - -void MOUSE_HideCursor(void) -{ -} - - -int32_t MOUSE_GetButtons(void) -{ - int32_t buttons; - readmousebstatus(&buttons); - return buttons; -} - - -int32_t MOUSE_ClearButton(int32_t b) -{ - return (mouseb &= ~b); -} - - -void MOUSE_GetDelta(int32_t*x, int32_t*y) -{ - readmousexy(x,y); -} - - - diff --git a/polymer-perf/eduke32/source/jmact/mouse.h b/polymer-perf/eduke32/source/jmact/mouse.h deleted file mode 100644 index 4ea7ec4dc..000000000 --- a/polymer-perf/eduke32/source/jmact/mouse.h +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) -*/ -//------------------------------------------------------------------------- - -#ifndef __mouse_h -#define __mouse_h -#ifdef __cplusplus -extern "C" { -#endif - -#define LEFT_MOUSE 1 -#define RIGHT_MOUSE 2 -#define MIDDLE_MOUSE 4 -#define THUMB_MOUSE 8 -#define WHEELUP_MOUSE 16 -#define WHEELDOWN_MOUSE 32 -#define LEFT_MOUSE_PRESSED( button ) ( ( ( button ) & LEFT_MOUSE ) != 0 ) -#define RIGHT_MOUSE_PRESSED( button ) ( ( ( button ) & RIGHT_MOUSE ) != 0 ) -#define MIDDLE_MOUSE_PRESSED( button ) ( ( ( button ) & MIDDLE_MOUSE ) != 0 ) - -int32_t MOUSE_Init( void ); -void MOUSE_Shutdown( void ); -void MOUSE_ShowCursor( void ); -void MOUSE_HideCursor( void ); -int32_t MOUSE_GetButtons( void ); -int32_t MOUSE_ClearButton( int32_t b ); -void MOUSE_GetDelta( int32_t*x, int32_t*y ); - -#ifdef __cplusplus -}; -#endif -#endif /* __mouse_h */ diff --git a/polymer-perf/eduke32/source/jmact/scriplib.c b/polymer-perf/eduke32/source/jmact/scriplib.c deleted file mode 100644 index 38cb9495b..000000000 --- a/polymer-perf/eduke32/source/jmact/scriplib.c +++ /dev/null @@ -1,937 +0,0 @@ -/* - * scriplib.c - * MACT library Script file parsing and writing - * - * by Jonathon Fowler - * - * Since we weren't given the source for MACT386.LIB so I've had to do some - * creative interpolation here. - * - * This all should be rewritten in a much much cleaner fashion. - * - */ -//------------------------------------------------------------------------- -/* -Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "compat.h" - -#include "scriplib.h" -#include "file_lib.h" -#include "_scrplib.h" -#include -#include -#include - -static script_t *scriptfiles[MAXSCRIPTFILES]; - - -#define SC(s) scriptfiles[s] - - -int32_t SCRIPT_New(void) -{ - int32_t i; - - for (i=0; i= MAXSCRIPTFILES) return; - - if (!SC(scripthandle)) return; - - if (SCRIPT(scripthandle,script)) - { - while (SCRIPT(scripthandle,script)->nextsection != SCRIPT(scripthandle,script)) - { - s = SCRIPT(scripthandle,script)->nextsection; - SCRIPT_FreeSection(SCRIPT(scripthandle,script)); - Bfree(SCRIPT(scripthandle,script)); - SCRIPT(scripthandle,script) = s; - } - - Bfree(SCRIPT(scripthandle,script)); - } - - Bfree(SC(scripthandle)); - SC(scripthandle) = 0; -} - -void SCRIPT_FreeSection(ScriptSectionType * section) -{ - ScriptEntryType *e; - - if (!section) return; - if (!section->entries) return; - - while (section->entries->nextentry != section->entries) - { - e = section->entries->nextentry; - Bfree(section->entries); - section->entries = e; - } - - Bfree(section->entries); - Bfree(section->name); -} - -#define AllocSection(s) \ - { \ - (s) = Bmalloc(sizeof(ScriptSectionType)); \ - (s)->name = NULL; \ - (s)->entries = NULL; \ - (s)->lastline = NULL; \ - (s)->nextsection = (s); \ - (s)->prevsection = (s); \ - } -#define AllocEntry(e) \ - { \ - (e) = Bmalloc(sizeof(ScriptEntryType)); \ - (e)->name = NULL; \ - (e)->value = NULL; \ - (e)->nextentry = (e); \ - (e)->preventry = (e); \ - } - -ScriptSectionType * SCRIPT_SectionExists(int32_t scripthandle, char * sectionname) -{ - ScriptSectionType *s, *ls=NULL; - - if (scripthandle < 0 || scripthandle >= MAXSCRIPTFILES) return NULL; - if (!sectionname) return NULL; - if (!SC(scripthandle)) return NULL; - if (!SCRIPT(scripthandle,script)) return NULL; - - for (s = SCRIPT(scripthandle,script); ls != s; ls=s,s=s->nextsection) - if (!Bstrcasecmp(s->name, sectionname)) return s; - - return NULL; -} - -ScriptSectionType * SCRIPT_AddSection(int32_t scripthandle, char * sectionname) -{ - ScriptSectionType *s,*s2; - - if (scripthandle < 0 || scripthandle >= MAXSCRIPTFILES) return NULL; - if (!sectionname) return NULL; - if (!SC(scripthandle)) return NULL; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - if (s) return s; - - AllocSection(s); - s->name = Bstrdup(sectionname); - if (!SCRIPT(scripthandle,script)) - { - SCRIPT(scripthandle,script) = s; - } - else - { - s2 = SCRIPT(scripthandle,script); - while (s2->nextsection != s2) s2=s2->nextsection; - s2->nextsection = s; - s->prevsection = s2; - } - - return s; -} - -ScriptEntryType * SCRIPT_EntryExists(ScriptSectionType * section, char * entryname) -{ - ScriptEntryType *e,*le=NULL; - - if (!section) return NULL; - if (!entryname) return NULL; - if (!section->entries) return NULL; - - for (e = section->entries; le != e; le=e,e=e->nextentry) - if (!Bstrcasecmp(e->name, entryname)) return e; - - return NULL; -} - -void SCRIPT_AddEntry(int32_t scripthandle, char * sectionname, char * entryname, char * entryvalue) -{ - ScriptSectionType *s; - ScriptEntryType *e,*e2; - - if (scripthandle < 0 || scripthandle >= MAXSCRIPTFILES) return; - if (!sectionname || !entryname || !entryvalue) return; - if (!SC(scripthandle)) return; - -// s = SCRIPT_SectionExists(scripthandle, sectionname); -// if (!s) { - s = SCRIPT_AddSection(scripthandle, sectionname); - if (!s) return; -// } - - e = SCRIPT_EntryExists(s, entryname); - if (!e) - { - AllocEntry(e); - e->name = Bstrdup(entryname); - if (!s->entries) - { - s->entries = e; - } - else - { - e2 = s->entries; - while (e2->nextentry != e2) e2=e2->nextentry; - e2->nextentry = e; - e->preventry = e2; - } - } - - if (e->value) Bfree(e->value); - e->value = Bstrdup(entryvalue); -} - - -int32_t SCRIPT_ParseBuffer(int32_t scripthandle, char *data, int32_t length) -{ - char *fence = data + length; - char *dp, *sp, ch=0, lastch=0; - char *currentsection = ""; - char *currententry = NULL; - char *currentvalue = NULL; - enum - { - ParsingIdle, - ParsingSectionBegin, - ParsingSectionName, - ParsingEntry, - ParsingValueBegin, - ParsingValue - }; - enum - { - ExpectingSection = 1, - ExpectingEntry = 2, - ExpectingAssignment = 4, - ExpectingValue = 8, - ExpectingComment = 16 - }; - int32_t state; - int32_t expect; - int32_t linenum=1; - int32_t rv = 0; -#define SETRV(v) if (v>rv||rv==0) rv=v - - if (!data) return 1; - if (length < 0) return 1; - - dp = sp = data; - state = ParsingIdle; - expect = ExpectingSection | ExpectingEntry; - -#define EATLINE(p) while (length > 0 && *p != '\n' && *p != '\r') { p++; length--; } -#define LETTER() { lastch = ch; ch = *(sp++); length--; } - - while (length > 0) - { - switch (state) - { - case ParsingIdle: - LETTER(); - switch (ch) - { - // whitespace - case ' ': - case '\t': continue; - case '\n': if (lastch == '\r') continue; linenum++; continue; - case '\r': linenum++; continue; - - case ';': - /*case '#':*/ - EATLINE(sp); - continue; - - case '[': if (!(expect & ExpectingSection)) - { - // Unexpected section start - printf("Unexpected start of section on line %d.\n", linenum); - SETRV(-1); - EATLINE(sp); - continue; - } - else - { - state = ParsingSectionBegin; - continue; - } - - default: if (isalpha(ch)) - { - if (!(expect & ExpectingEntry)) - { - // Unexpected name start - printf("Unexpected entry LabelText on line %d.\n", linenum); - SETRV(-1); - EATLINE(sp); - continue; - } - else - { - currententry = dp = sp-1; - state = ParsingEntry; - continue; - } - } - else - { - // Unexpected character - printf("Illegal character (ASCII %d) on line %d.\n", ch, linenum); - SETRV(-1); - EATLINE(sp); - continue; - } - } - - case ParsingSectionBegin: - currentsection = dp = sp; - state = ParsingSectionName; - case ParsingSectionName: - LETTER(); - switch (ch) - { - case '\n': - case '\r': // Unexpected newline - printf("Unexpected newline on line %d.\n", linenum); - SETRV(-1); - state = ParsingIdle; - linenum++; - continue; - - case ']': - *(dp) = 0; // Add new section - expect = ExpectingSection | ExpectingEntry; - state = ParsingIdle; - EATLINE(sp); - continue; - - default: - dp++; - continue; - } - - case ParsingEntry: - LETTER(); - switch (ch) - { - case ';': - /*case '#':*/ - // unexpected comment - EATLINE(sp); - printf("Unexpected comment on line %d.\n", linenum); - SETRV(-1); - case '\n': - case '\r': - // Unexpected newline - printf("Unexpected newline on line %d.\n", linenum); - SETRV(-1); - expect = ExpectingSection | ExpectingEntry; - state = ParsingIdle; - linenum++; - continue; - - case '=': - // Entry name finished, now for the value - while (*dp == ' ' || *dp == '\t') dp--; - *(++dp) = 0; - state = ParsingValueBegin; - continue; - - default: - dp++; - continue; - } - - case ParsingValueBegin: - currentvalue = dp = sp; - state = ParsingValue; - case ParsingValue: - LETTER(); - switch (ch) - { - case '\n': - case '\r': - // value complete, add it using parsed name - while (*dp == ' ' && *dp == '\t') dp--; - *(dp) = 0; - while (*currentvalue == ' ' || *currentvalue == '\t') currentvalue++; - state = ParsingIdle; - linenum++; - - SCRIPT_AddSection(scripthandle,currentsection); - SCRIPT_AddEntry(scripthandle,currentsection,currententry,currentvalue); - continue; - - default: - dp++; - continue; - } - - default: length=0; - continue; - } - } - - if (sp > fence) printf("Stepped outside the fence!\n"); - - return rv; -} - - -//--- - -int32_t SCRIPT_Init(char * name) -{ - int32_t h = SCRIPT_New(); - - if (h >= 0) Bstrncpy(SCRIPT(h,scriptfilename), name, 127); - - return h; -} - -void SCRIPT_Free(int32_t scripthandle) -{ - SCRIPT_Delete(scripthandle); -} - -int32_t SCRIPT_Load(char * filename) -{ - int32_t s,h,l; - char *b; - - h = SafeOpenRead(filename, filetype_binary); - l = SafeFileLength(h)+1; - b = (char *)Bmalloc(l); - SafeRead(h,b,l-1); - b[l-1] = '\n'; // JBF 20040111: evil nasty hack to trick my evil nasty parser - SafeClose(h); - - s = SCRIPT_Init(filename); - if (s<0) - { - Bfree(b); - return -1; - } - - SCRIPT_ParseBuffer(s,b,l); - - Bfree(b); - - return s; -} - -void SCRIPT_Save(int32_t scripthandle, char * filename) -{ - char *section, *entry, *value; - int32_t sec, ent, numsect, nument; - FILE *fp; - - - if (!filename) return; - if (!SC(scripthandle)) return; - - fp = fopen(filename, "w"); - if (!fp) return; - - numsect = SCRIPT_NumberSections(scripthandle); - for (sec=0; sec0) fprintf(fp, "\n"); - if (section[0] != 0) - fprintf(fp, "[%s]\n", section); - - nument = SCRIPT_NumberEntries(scripthandle,section); - for (ent=0; entnextsection) c++; - - return c; -} - -char * SCRIPT_Section(int32_t scripthandle, int32_t which) -{ - ScriptSectionType *s,*ls=NULL; - - if (!SC(scripthandle)) return ""; - if (!SCRIPT(scripthandle,script)) return ""; - - for (s = SCRIPT(scripthandle,script); which>0 && ls != s; ls=s, s=s->nextsection, which--) ; - - return s->name; -} - -int32_t SCRIPT_NumberEntries(int32_t scripthandle, char * sectionname) -{ - ScriptSectionType *s; - ScriptEntryType *e,*le=NULL; - int32_t c=0; - - if (!SC(scripthandle)) return 0; - if (!SCRIPT(scripthandle,script)) return 0; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - if (!s) return 0; - - for (e = s->entries; le != e; le=e,e=e->nextentry) c++; - return c; -} - -char * SCRIPT_Entry(int32_t scripthandle, char * sectionname, int32_t which) -{ - ScriptSectionType *s; - ScriptEntryType *e,*le=NULL; - - if (!SC(scripthandle)) return 0; - if (!SCRIPT(scripthandle,script)) return 0; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - if (!s) return ""; - - for (e = s->entries; which>0 && le != e; le=e, e=e->nextentry, which--) ; - return e->name; -} - -char * SCRIPT_GetRaw(int32_t scripthandle, char * sectionname, char * entryname) -{ - ScriptSectionType *s; - ScriptEntryType *e; - - if (!SC(scripthandle)) return 0; - if (!SCRIPT(scripthandle,script)) return 0; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - e = SCRIPT_EntryExists(s, entryname); - - if (!e) return ""; - return e->value; -} - -int32_t SCRIPT_GetString(int32_t scripthandle, char * sectionname, char * entryname, char * dest) -{ - ScriptSectionType *s; - ScriptEntryType *e; - char *p, ch; - int32_t c; - - if (!SC(scripthandle)) return 1; - if (!SCRIPT(scripthandle,script)) return 1; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - e = SCRIPT_EntryExists(s, entryname); - - //dest[0] = 0; - if (!e) return 1; - - p = e->value; - c = 0; - - if (*p == '\"') - { - // quoted string - p++; - while ((ch = *(p++))) - { - switch (ch) - { - case '\\': - ch = *(p++); - switch (ch) - { - case 0: return 0; - case 'n': dest[c++] = '\n'; break; - case 'r': dest[c++] = '\r'; break; - case 't': dest[c++] = '\t'; break; - default: dest[c++] = ch; break; - } - break; - case '\"': - dest[c] = 0; - return 0; - default: - dest[c++] = ch; - break; - } - } - } - else - { - while ((ch = *(p++))) - { - if (ch == ' ' || ch == '\t') { dest[c] = 0; break; } - else dest[c++] = ch; - } - } - - return 0; -} - -int32_t SCRIPT_GetDoubleString(int32_t scripthandle, char * sectionname, char * entryname, char * dest1, char * dest2) -{ - ScriptSectionType *s; - ScriptEntryType *e; - char *p, ch; - int32_t c; - - if (!SC(scripthandle)) return 1; - if (!SCRIPT(scripthandle,script)) return 1; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - e = SCRIPT_EntryExists(s, entryname); - - //dest1[0] = 0; - //dest2[0] = 0; - if (!e) return 1; - - p = e->value; - c = 0; - - if (*p == '\"') - { - // quoted string - p++; - while ((ch = *(p++))) - { - switch (ch) - { - case '\\': - ch = *(p++); - switch (ch) - { - case 0: return 0; - case 'n': dest1[c++] = '\n'; break; - case 'r': dest1[c++] = '\r'; break; - case 't': dest1[c++] = '\t'; break; - default: dest1[c++] = ch; break; - } - break; - case '\"': - dest1[c] = 0; - goto breakme; - default: - dest1[c++] = ch; - break; - } - } - if (ch == 0) return 0; - } - else - { - while ((ch = *(p++))) - { - if (ch == ' ' || ch == '\t') { dest1[c] = 0; break; } - else dest1[c++] = ch; - } - } - -breakme: - while (*p == ' ' || *p == '\t') p++; - if (*p == 0) return 0; - - c = 0; - - if (*p == '\"') - { - // quoted string - p++; - while ((ch = *(p++))) - { - switch (ch) - { - case '\\': - ch = *(p++); - switch (ch) - { - case 0: return 0; - case 'n': dest2[c++] = '\n'; break; - case 'r': dest2[c++] = '\r'; break; - case 't': dest2[c++] = '\t'; break; - default: dest2[c++] = ch; break; - } - break; - case '\"': - dest2[c] = 0; - return 0; - default: - dest2[c++] = ch; - break; - } - } - } - else - { - while ((ch = *(p++))) - { - if (ch == ' ' || ch == '\t') { dest2[c] = 0; break; } - else dest2[c++] = ch; - } - } - - return 0; -} - -int32_t SCRIPT_GetNumber(int32_t scripthandle, char * sectionname, char * entryname, int32_t * number) -{ - ScriptSectionType *s; - ScriptEntryType *e; - char *p; - - if (!SC(scripthandle)) return 1; - if (!SCRIPT(scripthandle,script)) return 1; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - e = SCRIPT_EntryExists(s, entryname); - - if (!e) return 1;// *number = 0; - else - { - if (e->value[0] == '0' && e->value[1] == 'x') - { - // hex - *number = strtol(e->value+2, &p, 16); - if (p == e->value || *p != 0 || *p != ' ' || *p != '\t') return 1; - } - else - { - // decimal - *number = strtol(e->value, &p, 10); - if (p == e->value || *p != 0 || *p != ' ' || *p != '\t') return 1; - } - } - - return 0; -} - -int32_t SCRIPT_GetBoolean(int32_t scripthandle, char * sectionname, char * entryname, int32_t * boole) -{ - ScriptSectionType *s; - ScriptEntryType *e; - - if (!SC(scripthandle)) return 1; - if (!SCRIPT(scripthandle,script)) return 1; - - s = SCRIPT_SectionExists(scripthandle, sectionname); - e = SCRIPT_EntryExists(s, entryname); - - if (!e) return 1;// *boole = 0; - else - { - if (!Bstrncasecmp(e->value, "true", 4)) *boole = 1; - else if (!Bstrncasecmp(e->value, "false", 5)) *boole = 0; - else if (e->value[0] == '1' && (e->value[1] == ' ' || e->value[1] == '\t' || e->value[1] == 0)) *boole = 1; - else if (e->value[0] == '0' && (e->value[1] == ' ' || e->value[1] == '\t' || e->value[1] == 0)) *boole = 0; - } - - return 0; -} - -void SCRIPT_PutSection(int32_t scripthandle, char * sectionname) -{ - SCRIPT_AddSection(scripthandle, sectionname); -} - -void SCRIPT_PutRaw -( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * raw -) -{ - SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); -} - -void SCRIPT_PutString -( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * string -) -{ - char *raw,*q,*p; - int32_t len = 3; - if (!string) string = ""; - - for (q=string; *q; q++) - { - if (*q == '\r' || *q == '\n' || *q == '\t' || *q == '\\' || *q == '"') len+=2; - else if (*q >= ' ') len++; - } - p = raw = Bmalloc(len); - *(p++) = '"'; - for (q=string; *q; q++) - { - if (*q == '\r') { *(p++) = '\\'; *(p++) = 'r'; } - else if (*q == '\n') { *(p++) = '\\'; *(p++) = 'n'; } - else if (*q == '\t') { *(p++) = '\\'; *(p++) = 't'; } - else if (*q == '\\' || *q == '"') { *(p++) = '\\'; *(p++) = *q; } - else if (*q >= ' ') *(p++) = *q; - } - *(p++) = '"'; - *p=0; - - SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); - Bfree(raw); -} - -void SCRIPT_PutDoubleString -( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * string1, - char * string2 -) -{ - char *raw,*q,*p; - int32_t len = 6; - if (!string1) string1 = ""; - if (!string2) string2 = ""; - - for (q=string1; *q; q++) - { - if (*q == '\r' || *q == '\n' || *q == '\t' || *q == '\\' || *q == '"') len+=2; - else if (*q >= ' ') len++; - } - for (q=string2; *q; q++) - { - if (*q == '\r' || *q == '\n' || *q == '\t' || *q == '\\' || *q == '"') len+=2; - else if (*q >= ' ') len++; - } - p = raw = Bmalloc(len); - *(p++) = '"'; - for (q=string1; *q; q++) - { - if (*q == '\r') { *(p++) = '\\'; *(p++) = 'r'; } - else if (*q == '\n') { *(p++) = '\\'; *(p++) = 'n'; } - else if (*q == '\t') { *(p++) = '\\'; *(p++) = 't'; } - else if (*q == '\\' || *q == '"') { *(p++) = '\\'; *(p++) = *q; } - else if (*q >= ' ') *(p++) = *q; - } - *(p++) = '"'; - *(p++) = ' '; - *(p++) = '"'; - for (q=string2; *q; q++) - { - if (*q == '\r') { *(p++) = '\\'; *(p++) = 'r'; } - else if (*q == '\n') { *(p++) = '\\'; *(p++) = 'n'; } - else if (*q == '\t') { *(p++) = '\\'; *(p++) = 't'; } - else if (*q == '\\' || *q == '"') { *(p++) = '\\'; *(p++) = *q; } - else if (*q >= ' ') *(p++) = *q; - } - *(p++) = '"'; - *p=0; - - SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); - Bfree(raw); -} - -void SCRIPT_PutNumber -( - int32_t scripthandle, - char * sectionname, - char * entryname, - int32_t number, - int32_t hexadecimal, - int32_t defaultvalue -) -{ - char raw[64]; - - UNREFERENCED_PARAMETER(defaultvalue); - if (hexadecimal) Bsprintf(raw, "0x%X", number); - else Bsprintf(raw, "%d", number); - - SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); -} - -void SCRIPT_PutBoolean -( - int32_t scripthandle, - char * sectionname, - char * entryname, - int32_t boole -) -{ - char raw[2] = "0"; - - if (boole) raw[0] = '1'; - - SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); -} - -void SCRIPT_PutDouble -( - int32_t scripthandle, - char * sectionname, - char * entryname, - double number, - int32_t defaultvalue -) -{ - char raw[64]; - - UNREFERENCED_PARAMETER(defaultvalue); - Bsprintf(raw, "%g", number); - - SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); -} - diff --git a/polymer-perf/eduke32/source/jmact/scriplib.h b/polymer-perf/eduke32/source/jmact/scriplib.h deleted file mode 100644 index a5d0033b7..000000000 --- a/polymer-perf/eduke32/source/jmact/scriplib.h +++ /dev/null @@ -1,293 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- - -// scriplib.h - -#ifndef _scriplib_public -#define _scriplib_public -#ifdef __cplusplus -extern "C" { -#endif - -/* -============== -= -= SCRIPT_Init -= -============== -*/ -int32_t SCRIPT_Init( char * name ); - - -/* -============== -= -= SCRIPT_Free -= -============== -*/ -void SCRIPT_Free( int32_t scripthandle ); - -/* -============== -= -= SCRIPT_Load -= -============== -*/ - -int32_t SCRIPT_Load ( char * filename ); - -/* -============== -= -= SCRIPT_Save -= -============== -*/ -void SCRIPT_Save (int32_t scripthandle, char * filename); - - -/* -============== -= -= SCRIPT_NumberSections -= -============== -*/ - -int32_t SCRIPT_NumberSections( int32_t scripthandle ); - -/* -============== -= -= SCRIPT_Section -= -============== -*/ - -char * SCRIPT_Section( int32_t scripthandle, int32_t which ); - -/* -============== -= -= SCRIPT_NumberEntries -= -============== -*/ - -int32_t SCRIPT_NumberEntries( int32_t scripthandle, char * sectionname ); - -/* -============== -= -= SCRIPT_Entry -= -============== -*/ - -char * SCRIPT_Entry( int32_t scripthandle, char * sectionname, int32_t which ); - - -/* -============== -= -= SCRIPT_GetRaw -= -============== -*/ -char * SCRIPT_GetRaw(int32_t scripthandle, char * sectionname, char * entryname); - -/* -============== -= -= SCRIPT_GetString -= -============== -*/ -int32_t SCRIPT_GetString - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * dest - ); - -/* -============== -= -= SCRIPT_GetDoubleString -= -============== -*/ -int32_t SCRIPT_GetDoubleString - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * dest1, - char * dest2 - ); - -/* -============== -= -= SCRIPT_GetNumber -= -============== -*/ -int32_t SCRIPT_GetNumber - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - int32_t * number - ); - -/* -============== -= -= SCRIPT_GetBoolean -= -============== -*/ -int32_t SCRIPT_GetBoolean - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - int32_t * boole - ); - -/* -============== -= -= SCRIPT_PutSection -= -============== -*/ -void SCRIPT_PutSection( int32_t scripthandle, char * sectionname ); - -/* -============== -= -= SCRIPT_PutRaw -= -============== -*/ -void SCRIPT_PutRaw - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * raw - ); - -/* -============== -= -= SCRIPT_PutString -= -============== -*/ -void SCRIPT_PutString - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * string - ); - -/* -============== -= -= SCRIPT_PutDoubleString -= -============== -*/ -void SCRIPT_PutDoubleString - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - char * string1, - char * string2 - ); - -/* -============== -= -= SCRIPT_PutNumber -= -============== -*/ -void SCRIPT_PutNumber - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - int32_t number, - int32_t hexadecimal, - int32_t defaultvalue - ); - -/* -============== -= -= SCRIPT_PutBoolean -= -============== -*/ -void SCRIPT_PutBoolean - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - int32_t boole - ); - -/* -============== -= -= SCRIPT_PutDouble -= -============== -*/ - -void SCRIPT_PutDouble - ( - int32_t scripthandle, - char * sectionname, - char * entryname, - double number, - int32_t defaultvalue - ); - - -#ifdef __cplusplus -}; -#endif -#endif diff --git a/polymer-perf/eduke32/source/keys.h b/polymer-perf/eduke32/source/keys.h deleted file mode 100644 index 2c1d3e0be..000000000 --- a/polymer-perf/eduke32/source/keys.h +++ /dev/null @@ -1,148 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef KEYS_H - -#define KEYS_H - - #define NUM_CODES 128 - - #define ESC 0x1B - #define ENTER 0x0D - - #define KEYSC_ESC 0x01 - #define KEYSC_1 0x02 - #define KEYSC_2 0x03 - #define KEYSC_3 0x04 - #define KEYSC_4 0x05 - #define KEYSC_5 0x06 - #define KEYSC_6 0x07 - #define KEYSC_7 0x08 - #define KEYSC_8 0x09 - #define KEYSC_9 0x0a - #define KEYSC_0 0x0b - #define KEYSC_DASH 0x0c - #define KEYSC_EQUAL 0x0d - - #define KEYSC_BS 0x0e - #define KEYSC_TAB 0x0f - #define KEYSC_Q 0x10 - #define KEYSC_W 0x11 - #define KEYSC_E 0x12 - #define KEYSC_R 0x13 - #define KEYSC_T 0x14 - #define KEYSC_Y 0x15 - #define KEYSC_U 0x16 - #define KEYSC_I 0x17 - #define KEYSC_O 0x18 - #define KEYSC_P 0x19 - #define KEYSC_LBRACK 0x1a - #define KEYSC_RBRACK 0x1b - #define KEYSC_ENTER 0x1c - - #define KEYSC_LCTRL 0x1d - #define KEYSC_A 0x1e - #define KEYSC_S 0x1f - #define KEYSC_D 0x20 - #define KEYSC_F 0x21 - #define KEYSC_G 0x22 - #define KEYSC_H 0x23 - #define KEYSC_J 0x24 - #define KEYSC_K 0x25 - #define KEYSC_L 0x26 - #define KEYSC_SEMI 0x27 - #define KEYSC_QUOTE 0x28 - #define KEYSC_BQUOTE 0x29 - #define KEYSC_TILDE 0x29 - - #define KEYSC_LSHIFT 0x2a - #define KEYSC_BSLASH 0x2b - #define KEYSC_Z 0x2c - #define KEYSC_X 0x2d - #define KEYSC_C 0x2e - #define KEYSC_V 0x2f - #define KEYSC_B 0x30 - #define KEYSC_N 0x31 - #define KEYSC_M 0x32 - #define KEYSC_COMMA 0x33 - #define KEYSC_PERIOD 0x34 - #define KEYSC_SLASH 0x35 - #define KEYSC_RSHIFT 0x36 - #define KEYSC_gSTAR 0x37 - - #define KEYSC_LALT 0x38 - #define KEYSC_SPACE 0x39 - #define KEYSC_CAPS 0x3a - - #define KEYSC_F1 0x3b - #define KEYSC_F2 0x3c - #define KEYSC_F3 0x3d - #define KEYSC_F4 0x3e - #define KEYSC_F5 0x3f - #define KEYSC_F6 0x40 - #define KEYSC_F7 0x41 - #define KEYSC_F8 0x42 - #define KEYSC_F9 0x43 - #define KEYSC_F10 0x44 - - #define KEYSC_gNUM 0x45 - #define KEYSC_SCROLL 0x46 - - #define KEYSC_gHOME 0x47 - #define KEYSC_gUP 0x48 - #define KEYSC_gPGUP 0x49 - #define KEYSC_gMINUS 0x4a - #define KEYSC_gLEFT 0x4b - #define KEYSC_gKP5 0x4c - #define KEYSC_gRIGHT 0x4d - #define KEYSC_gPLUS 0x4e - #define KEYSC_gEND 0x4f - #define KEYSC_gDOWN 0x50 - #define KEYSC_gPGDN 0x51 - #define KEYSC_gINS 0x52 - #define KEYSC_gDEL 0x53 - - #define KEYSC_F11 0x57 - #define KEYSC_F12 0x58 - - #define KEYSC_gENTER 0x9C - #define KEYSC_RCTRL 0x9D - #define KEYSC_gSLASH 0xB5 - #define KEYSC_RALT 0xB8 - #define KEYSC_PRTSCN 0xB7 - #define KEYSC_PAUSE 0xC5 - #define KEYSC_HOME 0xC7 - #define KEYSC_UP 0xC8 - #define KEYSC_PGUP 0xC9 - #define KEYSC_LEFT 0xCB - #define KEYSC_RIGHT 0xCD - #define KEYSC_END 0xCF - #define KEYSC_DOWN 0xD0 - #define KEYSC_PGDN 0xD1 - #define KEYSC_INSERT 0xD2 - #define KEYSC_DELETE 0xD3 - - #define asc_Esc 27 - #define asc_Enter 13 - #define asc_Space 32 - -#endif diff --git a/polymer-perf/eduke32/source/m32def.c b/polymer-perf/eduke32/source/m32def.c deleted file mode 100644 index a0d70a034..000000000 --- a/polymer-perf/eduke32/source/m32def.c +++ /dev/null @@ -1,4000 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "m32script.h" -#include "m32def.h" -#include "cache1d.h" -#include "sounds_mapster32.h" - -//#include "osd.h" -#include "keys.h" - -char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling -static char g_szCurrentBlockName[BMAX_PATH] = "(none)", g_szLastBlockName[BMAX_PATH] = "NULL"; - -////// compiler state vvv -static const char *textptr, *start_textptr, *g_curkwptr; -static int32_t def_tw; -int32_t g_totalLines, g_lineNumber; -int32_t g_numCompilerErrors, g_numCompilerWarnings; - -int32_t g_didDefineSomething; - -typedef struct -{ - int32_t currentStateIdx; - ofstype currentStateOfs; // the offset to the start of the currently parsed states' code - int32_t currentEvent; - ofstype parsingEventOfs; - - int32_t checkingSwitch; - int32_t numCases; - instype *caseScriptPtr; // the pointer to the start of the case table in a switch statement - // first entry is 'default' code. - instype *caseCodePtr; // the pointer to the start of the different cases' code - int32_t labelsOnly; - int32_t numBraces; - int32_t checkingIfElse, ifElseAborted; -} compilerstate_t; - -static compilerstate_t cs; -static compilerstate_t cs_default = {-1, -1, -1, -1, 0, 0, NULL, NULL, 0, 0, 0, 0}; -////// ------------------- - -instype *script = NULL; -instype *g_scriptPtr; -int32_t g_scriptSize = 65536; - -int32_t *constants, constants_allocsize=1024; -int32_t g_numSavedConstants=0; -static int32_t g_wasConstant=0; - -char *label; -int32_t *labelval; -uint8_t *labeltype; -int32_t g_numLabels=0, g_numDefaultLabels=0; -static int32_t label_allocsize = 512; - -int32_t g_stateCount = 0; -statesinfo_t *statesinfo = NULL; -static int32_t statesinfo_allocsize = 512; -static int32_t interactive_compilation = 0; - -static char tempbuf[2048]; -static char tlabel[MAXLABELLEN], tlabel2[MAXLABELLEN]; - -int32_t g_iReturnVar=0; -int32_t m32_sortvar1, m32_sortvar2; - -char *ScriptQuotes[MAXQUOTES+1], *ScriptQuoteRedefinitions[MAXQUOTES+1]; -int32_t g_numQuoteRedefinitions = 0; - -ofstype aEventOffsets[MAXEVENTS]; -int32_t aEventSizes[MAXEVENTS]; -uint16_t aEventNumLocals[MAXEVENTS]; - -gamevar_t aGameVars[MAXGAMEVARS]; -gamearray_t aGameArrays[MAXGAMEARRAYS]; -int32_t g_gameVarCount=0, g_systemVarCount=0; -int32_t g_gameArrayCount=0, g_systemArrayCount=0; - - -// "magic" number for { and }, overrides line number in compiled code for later detection -#define IFELSE_MAGIC 31337 - - -enum ScriptLabel_t -{ - LABEL_ANY = -1, - LABEL_DEFINE = 1, - LABEL_EVENT = 2 -}; - -static const char *LabelTypeText[] = -{ - "define", - "event" -}; - -static const char *C_GetLabelType(int32_t type) -{ - uint32_t i; - char x[64]; - - x[0] = 0; - for (i=0; i" -}; - -const memberlabel_t SectorLabels[]= -{ - { "wallptr", SECTOR_WALLPTR, 1, 0, 0 }, - { "wallnum", SECTOR_WALLNUM, 1, 0, 0 }, - { "ceilingz", SECTOR_CEILINGZ, 0, 0, 0 }, - { "floorz", SECTOR_FLOORZ, 0, 0, 0 }, - { "ceilingstat", SECTOR_CEILINGSTAT, 0, 0, 0 }, - { "floorstat", SECTOR_FLOORSTAT, 0, 0, 0 }, - { "ceilingpicnum", SECTOR_CEILINGPICNUM, 0, 0, MAXTILES-1 }, - { "ceilingslope", SECTOR_CEILINGSLOPE, 0, 0, 0}, - { "ceilingshade", SECTOR_CEILINGSHADE, 0, 0, 0 }, - { "ceilingpal", SECTOR_CEILINGPAL, 0, 0, 0 }, - { "ceilingxpanning", SECTOR_CEILINGXPANNING, 0, 0, 0 }, - { "ceilingypanning", SECTOR_CEILINGYPANNING, 0, 0, 0 }, - { "floorpicnum", SECTOR_FLOORPICNUM, 0, 0, MAXTILES-1 }, - { "floorslope", SECTOR_FLOORSLOPE, 0, 0, 0 }, - { "floorshade", SECTOR_FLOORSHADE, 0, 0, 0 }, - { "floorpal", SECTOR_FLOORPAL, 0, 0, 0 }, - { "floorxpanning", SECTOR_FLOORXPANNING, 0, 0, 0 }, - { "floorypanning", SECTOR_FLOORYPANNING, 0, 0, 0 }, - { "visibility", SECTOR_VISIBILITY, 0, 0, 0 }, - { "alignto", SECTOR_ALIGNTO, 0, 0, 0 }, // aka filler, not used - { "lotag", SECTOR_LOTAG, 0, 0, 0 }, - { "hitag", SECTOR_HITAG, 0, 0, 0 }, - { "extra", SECTOR_EXTRA, 0, 0, 0 }, - { "", -1, 0, 0, 0 } // END OF LIST -}; - -const memberlabel_t WallLabels[]= -{ - { "x", WALL_X, 0, -BXY_MAX, BXY_MAX }, - { "y", WALL_Y, 0, -BXY_MAX, BXY_MAX }, - { "point2", WALL_POINT2, 1, 0, 0 }, - { "nextwall", WALL_NEXTWALL, 1, 0, 0 }, - { "nextsector", WALL_NEXTSECTOR, 1, 0, 0 }, - { "cstat", WALL_CSTAT, 0, 0, 0 }, - { "picnum", WALL_PICNUM, 0, 0, MAXTILES-1 }, - { "overpicnum", WALL_OVERPICNUM, 0, 0, MAXTILES-1 }, - { "shade", WALL_SHADE, 0, 0, 0 }, - { "pal", WALL_PAL, 0, 0, 0 }, - { "xrepeat", WALL_XREPEAT, 0, 0, 0 }, - { "yrepeat", WALL_YREPEAT, 0, 0, 0 }, - { "xpanning", WALL_XPANNING, 0, 0, 0 }, - { "ypanning", WALL_YPANNING, 0, 0, 0 }, - { "lotag", WALL_LOTAG, 0, 0, 0 }, - { "hitag", WALL_HITAG, 0, 0, 0 }, - { "extra", WALL_EXTRA, 0, 0, 0 }, - { "", -1, 0, 0, 0 } // END OF LIST -}; - -const memberlabel_t SpriteLabels[]= -{ - { "x", SPRITE_X, 0, -BXY_MAX, BXY_MAX }, - { "y", SPRITE_Y, 0, -BXY_MAX, BXY_MAX }, - { "z", SPRITE_Z, 0, 0, 0 }, - { "cstat", SPRITE_CSTAT, 0, 0, 0 }, - { "picnum", SPRITE_PICNUM, 0, 0, MAXTILES-1 }, - { "shade", SPRITE_SHADE, 0, 0, 0 }, - { "pal", SPRITE_PAL, 0, 0, 0 }, - { "clipdist", SPRITE_CLIPDIST, 0, 0, 0 }, - { "detail", SPRITE_DETAIL, 1, 0, 0 }, // aka filler, not used - { "xrepeat", SPRITE_XREPEAT, 0, 0, 0 }, - { "yrepeat", SPRITE_YREPEAT, 0, 0, 0 }, - { "xoffset", SPRITE_XOFFSET, 0, 0, 0 }, - { "yoffset", SPRITE_YOFFSET, 0, 0, 0 }, - { "sectnum", SPRITE_SECTNUM, 1, 0, 0 }, - { "statnum", SPRITE_STATNUM, 1, 0, 0 }, - { "ang", SPRITE_ANG, 0, 0, 0 }, - { "owner", SPRITE_OWNER, 0, 0, 0 }, - { "xvel", SPRITE_XVEL, 0, 0, 0 }, - { "yvel", SPRITE_YVEL, 0, 0, 0 }, - { "zvel", SPRITE_ZVEL, 0, 0, 0 }, - { "lotag", SPRITE_LOTAG, 0, 0, 0 }, - { "hitag", SPRITE_HITAG, 0, 0, 0 }, - { "extra", SPRITE_EXTRA, 0, 0, 0 }, - { "", -1, 0, 0, 0 } // END OF LIST -}; - -const tokenmap_t iter_tokens[] = -{ - { "allsprites", ITER_ALLSPRITES }, - { "allsectors", ITER_ALLSECTORS }, - { "allwalls", ITER_ALLWALLS }, - { "selsprites", ITER_SELSPRITES }, - { "selsectors", ITER_SELSECTORS }, - { "selwalls", ITER_SELWALLS }, - { "drawnsprites", ITER_DRAWNSPRITES }, - { "spritesofsector", ITER_SPRITESOFSECTOR }, - { "loopofwall", ITER_LOOPOFWALL }, - { "wallsofsector", ITER_WALLSOFSECTOR }, - { "range", ITER_RANGE }, -// vvv alternatives go here vvv - { "selspr", ITER_SELSPRITES }, - { "selsec", ITER_SELSECTORS }, - { "sprofsec", ITER_SPRITESOFSECTOR }, - { "walofsec", ITER_WALLSOFSECTOR }, - { "", -1 } // END OF LIST -}; - - -hashtable_t h_gamevars = { MAXGAMEVARS>>1, NULL }; -hashtable_t h_arrays = { MAXGAMEARRAYS>>1, NULL }; -hashtable_t h_labels = { 11262>>1, NULL }; -static hashtable_t h_localvars = { MAXGAMEVARS>>2, NULL }; // values: offset|(array?(size<<16):0) - -static hashtable_t h_states = { 1264>>1, NULL }; -static hashtable_t h_keywords = { CON_END>>1, NULL }; -static hashtable_t h_iter = { ITER_END, NULL }; - -static hashtable_t h_sector = { SECTOR_END>>1, NULL }; -static hashtable_t h_wall = { WALL_END>>1, NULL }; -static hashtable_t h_sprite = { SPRITE_END>>1, NULL }; - - -static void C_InitHashes() -{ - int32_t i; - - hash_init(&h_gamevars); - hash_init(&h_arrays); - hash_init(&h_localvars); - - hash_init(&h_labels); - hash_init(&h_states); - - hash_init(&h_keywords); - for (i=NUMKEYWORDS-1; i>=0; i--) - hash_add(&h_keywords, keyw[i], i, 0); - for (i=0; i=0; i++) - hash_add(&h_sector,SectorLabels[i].name,i, 0); - hash_add(&h_sector,"filler", SECTOR_ALIGNTO, 0); - - hash_init(&h_wall); - for (i=0; WallLabels[i].lId >=0; i++) - hash_add(&h_wall,WallLabels[i].name,i, 0); - - hash_init(&h_sprite); - for (i=0; SpriteLabels[i].lId >=0; i++) - hash_add(&h_sprite,SpriteLabels[i].name,i, 0); - hash_add(&h_sprite,"filler", SPRITE_DETAIL, 0); - - hash_init(&h_iter); - for (i=0; iter_tokens[i].val >=0; i++) - hash_add(&h_iter, iter_tokens[i].token, iter_tokens[i].val, 0); -} - -// returns: 0:success, 1:failure -static int32_t C_SetScriptSize(int32_t size) -{ - ofstype oscriptOfs = (unsigned)(g_scriptPtr-script); - ofstype ocaseScriptOfs = (unsigned)(cs.caseScriptPtr-script); - ofstype ocaseCodeOfs = (unsigned)(cs.caseCodePtr-script); - - instype *newscript; - int32_t osize = g_scriptSize; - - if (g_scriptSize >= size) - return 0; - - //initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script)); - g_scriptSize = size; - initprintf("Resizing code buffer to %d*%d bytes\n", g_scriptSize, (int32_t)sizeof(instype)); - - newscript = (instype *)Brealloc(script, g_scriptSize * sizeof(instype)); - - if (newscript == NULL) - { - C_ReportError(-1); - initprintf("%s:%d: out of memory: Aborted (%ud)\n", g_szScriptFileName, g_lineNumber, (unsigned)(g_scriptPtr-script)); - g_numCompilerErrors++; -// initprintf(tempbuf); - return 1; - } - - if (size >= osize) - Bmemset(&newscript[osize], 0, (size-osize) * sizeof(instype)); - - if (script != newscript) - { - initprintf("Relocating compiled code from to 0x%lx to 0x%lx\n", (unsigned long)script, (unsigned long)newscript); - script = newscript; - } - - g_scriptPtr = (instype *)(script+oscriptOfs); -// initprintf("script: %d, \n",script); initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script)); - - if (cs.caseScriptPtr != NULL) - cs.caseScriptPtr = (instype *)(script+ocaseScriptOfs); - if (cs.caseCodePtr != NULL) - cs.caseCodePtr = (instype *)(script+ocaseCodeOfs); - - return 0; -} - -static inline int32_t char_whitespace(char c) -{ - return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='(' || c==')' || c==',' || c==';'; -} - -static inline int32_t char_alnumtok(char c) -{ - return isalnum(c) || c == '#' || c == '{' || c == '}' || c == '/' || c == '\\' || - c == '*' || c == '-' || c == '_' || c == '.' || c == '"'; -} - -static int32_t C_SkipComments(void) -{ - char c = *textptr; - - do - { - if (char_whitespace(c)) - { - textptr++; - g_lineNumber += (c=='\n'); - } - else if (c == '/' && textptr[1] == '/') - { - while (*textptr && *textptr != 0x0a && *textptr != 0x0d) - textptr++; - } - else if (c == '/' && textptr[1] == '*') - { - textptr += 2; - - while (*textptr && !(textptr[0] == '*' && textptr[1] == '/')) - { - if (*textptr == '\n') - g_lineNumber++; - textptr++; - } - - if (!*textptr) - { - C_CUSTOMERROR("found `/*' with no `*/'."); - cs.numBraces = 0; - cs.currentStateIdx = -1; - break; - } - - textptr += 2; - } - else - break; - } - while ((c = *textptr)); - - // Be sure to have enough space allocated for the command to be parsed next. - // Currently, the commands that potentially need the most space are - // various string handling function that accept inline strings. - if ((unsigned)(g_scriptPtr-script) > (unsigned)(g_scriptSize - max(40, MAXQUOTELEN/sizeof(instype)+8))) - return C_SetScriptSize(g_scriptSize<<1); - - return 0; -} - -static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz) -{ - // find the label psz in the table pLabel. - // returns the ID for the label, or -1 - - int32_t l = hash_findcase(tH, psz); - if (l>=0) - l = pLabel[l].lId; - - return l; -} - -// returns: 1 on EOF or (checkkeyw and keyword encountered), 0 else -static int32_t C_GetNextLabelName(int32_t checkkeyw) -{ - int32_t i; - - C_SkipComments(); - - tlabel[0] = 0; - - if (*textptr == 0) - { - C_CUSTOMERROR("unexpected EOF where label was expected."); - return 1; - } - - while (*textptr && (char_whitespace(*textptr) || *textptr=='-')) //!isalnum(*textptr)) - { - g_lineNumber += (*textptr == 0x0a); - textptr++; - } - - if (!isalpha(*textptr)) - C_CUSTOMERROR("label names must start with an alphabetic character, encountered '%c'.", *textptr); - - i = 0; - while (*textptr && !char_whitespace(*textptr) && *textptr!='['&& *textptr!=']') - { - if (i < MAXLABELLEN-1) - tlabel[i++] = *(textptr++); - else - textptr++; - } - - tlabel[i] = 0; - - if (checkkeyw) - { - if (hash_find(&h_keywords, tlabel)>=0) - { - g_numCompilerErrors++; - C_ReportError(ERROR_ISAKEYWORD); - return 1; - } - } - -// if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) -// initprintf("%s:%d: debug: got label `%s'.\n",g_szScriptFileName,g_lineNumber,tlabel); - - return 0; -} - -static int32_t C_CopyLabel(void) -{ - if (g_numLabels >= label_allocsize) - { - label = Brealloc(label, 2*label_allocsize*MAXLABELLEN*sizeof(char)); - labelval = Brealloc(labelval, 2*label_allocsize*sizeof(labelval[0])); - labeltype = Brealloc(labeltype, 2*label_allocsize*sizeof(labeltype[0])); - - if (label==NULL || labelval==NULL || labeltype==NULL) - { - label_allocsize = 0; - initprintf("Out of memory!"); - return 1; - } - label_allocsize *= 2; - } - - Bmemcpy(label+(g_numLabels*MAXLABELLEN), tlabel, MAXLABELLEN); - return 0; -} - -// returns: -1 on EOF or not a keyword, keyword index (==bytecode value) else -static int32_t C_GetKeyword(void) -{ - int32_t i; - const char *temptextptr; - - C_SkipComments(); - - if (*textptr == 0) - return -1; - - temptextptr = textptr; - - while (!char_alnumtok(*temptextptr)) - { - temptextptr++; - if (!*temptextptr) - return -1; - } - - i = 0; - while (char_alnumtok(*temptextptr)) - tempbuf[i++] = *(temptextptr++); - tempbuf[i] = 0; - - return hash_find(&h_keywords, tempbuf); -} - -//Returns its code # if keyword, -1 on eof or non-keyword -static int32_t C_GetNextKeyword(void) -{ - int32_t i, l, olinenum = g_lineNumber, havequickstate=0; - const char *otextptr = textptr; - - C_SkipComments(); - - if (*textptr == 0) - return -1; - - while (!char_alnumtok(*textptr)) - { - g_lineNumber += (*textptr == 0x0a); - - if (!*textptr) - return -1; - - textptr++; - } - - l = 0; - while (char_alnumtok(textptr[l]) && textptr[l] != '.') - { - tempbuf[l] = textptr[l]; - l++; - } - while (char_alnumtok(textptr[l])) - { - tempbuf[l] = textptr[l]; - l++; - } - tempbuf[l] = 0; - - g_curkwptr = textptr; - - textptr += l; - - i = hash_find(&h_keywords, tempbuf); - if (i<0) - { - if (tempbuf[0]=='{' && tempbuf[1]) - { - C_CUSTOMERROR("expected whitespace between `{' and `%s'", tempbuf+1); - return -1; - } - else if (tempbuf[0]=='}' && tempbuf[1]) - { - C_CUSTOMERROR("expected whitespace between `}' and `%s'", tempbuf+1); - return -1; - } - else - { - // if compiling from OSD, try state name - if (interactive_compilation) - i = hash_find(&h_states, tempbuf); - - if (i<0) - { - C_ReportError(ERROR_EXPECTEDKEYWORD); - g_numCompilerErrors++; - return -1; - } - else - { - havequickstate = 1; - i = CON_STATE; - } - } - } - - if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP) - *g_scriptPtr = i + (IFELSE_MAGIC<<12); - else - *g_scriptPtr = i + (g_lineNumber<<12); - - if (havequickstate) - { - g_lineNumber = olinenum; - // reset textptr so that case CON_STATE in C_ParseCommand() can insert the state number - textptr = otextptr; - } - - g_scriptPtr++; - -// if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) -// initprintf("%s:%d: debug: translating keyword `%s'.\n",g_szScriptFileName,g_lineNumber,keyw[i]); - return i; -} - -static int32_t GetGamevarID(const char *szGameLabel, int32_t searchlocals) -{ - if (searchlocals) - { - int32_t retid = hash_find(&h_localvars, szGameLabel); - if (retid>=0 && retid MAXGAMEVARS) // it's a local array - return retid; - } - return hash_find(&h_arrays, szGameLabel); -} - -// gamevar type restrictions -#define GV_WRITABLE GAMEVAR_READONLY -#define GV_SIMPLE GAMEVAR_SPECIAL - -static int32_t parse_integer_literal(int32_t *num) -{ - if (tolower(textptr[1])=='x') - sscanf(textptr+2, "%" SCNx32, num); - else - { - long lnum; - errno = 0; - lnum = strtol(textptr, NULL, 10); - if (errno || (sizeof(long)>4 && (lnumINT_MAX))) - { - C_CUSTOMERROR("integer literal exceeds bitwidth."); - return 1; - } - *num = (int32_t)lnum; - } - - return 0; -} - -static void C_GetNextVarType(int32_t type) -{ - int32_t i, id=0, flags=0, num, indirect=0; //, thenum; - - C_SkipComments(); - - if (*textptr == 0) - { - C_CUSTOMERROR("unexpected EOF where variable was expected."); - return; - } - - g_wasConstant = 0; - - if (*textptr == '"') - { - C_CUSTOMERROR("String literal encountered where not expected, skipping."); - while (*textptr && *textptr!='"' && *textptr!=0x0a) - textptr++; - if (*textptr == '"') - textptr++; - return; - } - else if (!(type&GV_WRITABLE) && !cs.labelsOnly && - (isdigit(textptr[0]) || (textptr[0]=='-' && isdigit(textptr[1])))) - { - // literal numeric constant where gamevar expected - -// if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) -// initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); - - parse_integer_literal(&num); -//thenum=num; - if (type==GV_SIMPLE && (num<0 || num>=65536)) - C_CUSTOMERROR("array index %d out of bounds. (max: 65535)", num); - - if (g_numCompilerErrors==0 && type!=GV_SIMPLE && num != (int16_t)num) - { - // Constant doesn't fit in 16 bits, make it indirect. - // Array indices are interpreted as unsigned, so they always fit into the high bits of the instruction. - - indirect = 1; - - for (i=g_numSavedConstants-1; i>=0; i--) - if (constants[i] == num) - { - num = i; - break; - } - - if (i<0) - { - i = g_numSavedConstants; - if (i>=constants_allocsize) - { - constants_allocsize *= 2; - constants = Brealloc(constants, constants_allocsize * sizeof(constants[0])); - if (!constants) - { - initprintf("C_GetNextVarType(): ERROR: out of memory!\n"); - g_numCompilerErrors++; - return; - } - } - - constants[i] = num; - num = i; - g_numSavedConstants++; - } - } - - if (type!=GV_SIMPLE) - g_wasConstant = 1; - -//printf("num:%d, idx:%d, indir:%d\n",thenum,num,indirect); - *g_scriptPtr++ = (num<<16) | M32_FLAG_CONSTANT | indirect; - - while (!char_whitespace(*textptr) && *textptr != ']') - textptr++; - - return; - } - else if (type != GV_SIMPLE && (textptr[0]=='.' || (textptr[0]=='-' && textptr[1]=='.'))) - { - // current sprite shortcut access - - int32_t lLabelID; - - flags = M32_FLAG_STRUCT; - if (*textptr=='-') - { - flags |= M32_FLAG_NEGATE; - textptr++; - } - textptr++; - - /// now pointing at 'xxx' - - C_GetNextLabelName(0); - lLabelID = C_GetLabelNameID(SpriteLabels, &h_sprite, Bstrtolower(tlabel)); - - if (lLabelID == -1) - { - g_numCompilerErrors++; - C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return; - } - - *g_scriptPtr++ = ((M32_THISACTOR_VAR_ID<<16) | flags | (lLabelID<<2) | M32_SPRITE_VAR_ID); - - return; - } - else if (textptr[0]=='-' && textptr[1] != '.') // && !isdigit(*(textptr+1)) - { - // negation - - if (type==0) - { -// if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) -// initprintf("%s:%d: debug: flagging gamevar as negative.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); - flags = M32_FLAG_NEGATE; - } - else - { - if (type==GV_WRITABLE) - C_CUSTOMERROR("syntax error. Tried negating written-to variable."); - else if (type==GV_SIMPLE) - C_CUSTOMERROR("syntax error. Tried negating variable in context that doesn't allow it."); - else // type==GV_WRITABLE|GV_SIMPLE - C_CUSTOMERROR("syntax error. Tried negating written-to variable in context that doesn't allow it."); - - C_GetNextLabelName(1); - - return; - } - } - - // at this point, flags can be 0 or M32_FLAG_NEGATE - - C_GetNextLabelName(1); - - C_SkipComments(); //skip comments and whitespace - - if (*textptr == '[') //read of array as a gamevar - { - int32_t lLabelID = -1, aridx; - - textptr++; - flags |= M32_FLAG_ARRAY; - - if (type & GV_SIMPLE) - { - g_numCompilerErrors++; - C_ReportError(ERROR_EXPECTEDSIMPLEVAR); - return; - } - - id = GetGamearrayID(tlabel, 1); - if (id < 0) - { - id = GetGamevarID(tlabel, 0); - - if (id < 0 || id >= 4) - { - C_CUSTOMERROR("symbol `%s' is neither an array name nor one of `(t)sprite', `sector' or `wall'.", tlabel); - return; - } - - flags &= ~M32_FLAG_ARRAY; // not an array - flags |= M32_FLAG_STRUCT; - } - else if (id>16)&0xffff); // decode... - } - - // ---------- - - C_SkipComments(); - - if (*textptr != ']') - { - g_numCompilerErrors++; - C_ReportError(ERROR_GAMEARRAYBNC); - return; - } - textptr++; - - // ---------- - - if ((flags & M32_VARTYPE_MASK) == M32_FLAG_LOCAL) - { - // id: local ofs | (size<<16) - int32_t ar_ofs=id&(MAXGAMEVARS-1), ar_size=(id>>16)&0xffff; - - if (aridx<0 || aridx>=ar_size) - C_CUSTOMERROR("local array index %d out of bounds. Size of local array `%s': %d.", aridx, tlabel2, ar_size); - - *g_scriptPtr++ = (flags|(ar_ofs+aridx)); - } - if ((flags & M32_VARTYPE_MASK) == M32_FLAG_ARRAY) - { - if ((aridx & M32_BITS_MASK) == M32_FLAG_CONSTANTINDEX) - *g_scriptPtr++ = (aridx | flags | id); - else // simple or local gamevar - *g_scriptPtr++ = (aridx<<16 | flags | id); - } - else if ((flags & M32_VARTYPE_MASK) == M32_FLAG_STRUCT) - { - while (*textptr && *textptr != 0x0a && *textptr != '.') - textptr++; - - if (*textptr != '.') - { - static const char *types[4] = {"sprite","sector","wall","tsprite"}; - C_CUSTOMERROR("syntax error. Expected `.