diff --git a/d2x-rebirth/2d/pcx.c b/d2x-rebirth/2d/pcx.c index f7f77967e..b003b5f11 100644 --- a/d2x-rebirth/2d/pcx.c +++ b/d2x-rebirth/2d/pcx.c @@ -80,26 +80,6 @@ int PCXHeader_read_n(PCXHeader *ph, int n, PHYSFS_file *fp) return i; } -int pcx_get_dimensions( char *filename, int *width, int *height) -{ - PHYSFS_file *PCXfile; - PCXHeader header; - - PCXfile = PHYSFSX_openReadBuffered(filename); - if (!PCXfile) return PCX_ERROR_OPENING; - - if (PCXHeader_read_n(&header, 1, PCXfile) != 1) { - PHYSFS_close(PCXfile); - return PCX_ERROR_NO_HEADER; - } - PHYSFS_close(PCXfile); - - *width = header.Xmax - header.Xmin+1; - *height = header.Ymax - header.Ymin+1; - - return PCX_ERROR_NONE; -} - int pcx_read_bitmap( char * filename, grs_bitmap * bmp,int bitmap_type ,ubyte * palette ) { PCXHeader header; diff --git a/d2x-rebirth/2d/scale.c b/d2x-rebirth/2d/scale.c deleted file mode 100644 index dfc71a881..000000000 --- a/d2x-rebirth/2d/scale.c +++ /dev/null @@ -1,407 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ -/* - * - * Routines for scaling a bitmap. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "fix.h" -#include "gr.h" -#include "dxxerror.h" -#include "rle.h" - -#if 0 -#define TRANSPARENCY_COLOR 255; -#endif - -static int Transparency_color = TRANSPARENCY_COLOR; - -void rls_stretch_scanline( char * source, char * dest, int XDelta, int YDelta ); -void rls_stretch_scanline_setup( int XDelta, int YDelta ); -void scale_bitmap_asm(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ); -void scale_bitmap_asm_rle(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ); -void scale_bitmap_cc_asm(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ); -void scale_bitmap_cc_asm_rle(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ); - -void scale_row_c( ubyte * sbits, ubyte * dbits, int width, fix u, fix du ) -{ - int i; - ubyte c; - - for ( i=0; icv_bitmap; - fix x0, y0, x1, y1; - fix u0, v0, u1, v1; - fix clipped_x0, clipped_y0, clipped_x1, clipped_y1; - fix clipped_u0, clipped_v0, clipped_u1, clipped_v1; - fix xmin, xmax, ymin, ymax; - int dx0, dy0, dx1, dy1; - int dtemp; - // Set initial variables.... - - x0 = vertbuf[0].x; y0 = vertbuf[0].y; - x1 = vertbuf[2].x; y1 = vertbuf[2].y; - - xmin = 0; ymin = 0; - xmax = i2f(dbp->bm_w)-fl2f(.5); ymax = i2f(dbp->bm_h)-fl2f(.5); - - u0 = i2f(0); v0 = i2f(0); - u1 = i2f(bp->bm_w-1); v1 = i2f(bp->bm_h-1); - - // Check for obviously offscreen bitmaps... - if ( (y1<=y0) || (x1<=x0) ) return; - if ( (x1<0 ) || (x0>=xmax) ) return; - if ( (y1<0 ) || (y0>=ymax) ) return; - - clipped_u0 = u0; clipped_v0 = v0; - clipped_u1 = u1; clipped_v1 = v1; - - clipped_x0 = x0; clipped_y0 = y0; - clipped_x1 = x1; clipped_y1 = y1; - - // Clip the left, moving u0 right as necessary - if ( x0 < xmin ) { - clipped_u0 = FIND_SCALED_NUM(xmin,x0,x1,u0,u1); - clipped_x0 = xmin; - } - - // Clip the right, moving u1 left as necessary - if ( x1 > xmax ) { - clipped_u1 = FIND_SCALED_NUM(xmax,x0,x1,u0,u1); - clipped_x1 = xmax; - } - - // Clip the top, moving v0 down as necessary - if ( y0 < ymin ) { - clipped_v0 = FIND_SCALED_NUM(ymin,y0,y1,v0,v1); - clipped_y0 = ymin; - } - - // Clip the bottom, moving v1 up as necessary - if ( y1 > ymax ) { - clipped_v1 = FIND_SCALED_NUM(ymax,y0,y1,v0,v1); - clipped_y1 = ymax; - } - - dx0 = f2i(clipped_x0); dx1 = f2i(clipped_x1); - dy0 = f2i(clipped_y0); dy1 = f2i(clipped_y1); - - if (dx1<=dx0) return; - if (dy1<=dy0) return; - - Assert( dx0>=0 ); - Assert( dy0>=0 ); - Assert( dx1bm_w ); - Assert( dy1bm_h ); - Assert( f2i(u0)<=f2i(u1) ); - Assert( f2i(v0)<=f2i(v1) ); - Assert( f2i(u0)>=0 ); - Assert( f2i(v0)>=0 ); - Assert( u1bm_w) ); - Assert( v1bm_h) ); - - dtemp = f2i(clipped_u1)-f2i(clipped_u0); - - if ( bp->bm_flags & BM_FLAG_RLE ) { - if ( (dtemp < (f2i(clipped_x1)-f2i(clipped_x0))) && (dtemp>0) ) - scale_bitmap_cc_asm_rle(bp, dbp, dx0, dy0, dx1, dy1, clipped_u0, clipped_v0, clipped_u1, clipped_v1 ); - else - scale_bitmap_asm_rle(bp, dbp, dx0, dy0, dx1, dy1, clipped_u0, clipped_v0, clipped_u1, clipped_v1 ); - } else { - if ( (dtemp < (f2i(clipped_x1)-f2i(clipped_x0))) && (dtemp>0) ) - scale_bitmap_cc_asm(bp, dbp, dx0, dy0, dx1, dy1, clipped_u0, clipped_v0, clipped_u1, clipped_v1 ); - else - scale_bitmap_asm(bp, dbp, dx0, dy0, dx1, dy1, clipped_u0, clipped_v0, clipped_u1, clipped_v1 ); - } -} - - -void scale_bitmap_c(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ) -{ - fix u, v, du, dv; - int x, y; - ubyte * sbits, * dbits; - - du = (u1-u0) / (x1-x0); - dv = (v1-v0) / (y1-y0); - - v = v0; - - for (y=y0; y<=y1; y++ ) { - sbits = &source_bmp->bm_data[source_bmp->bm_rowsize*f2i(v)]; - dbits = &dest_bmp->bm_data[dest_bmp->bm_rowsize*y+x0]; - u = u0; - v += dv; - for (x=x0; x<=x1; x++ ) { - *dbits++ = sbits[ u >> 16 ]; - u += du; - } - } -} - -void scale_bitmap_asm(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ) -{ - fix du, dv, v; - int y; - - du = (u1-u0) / (x1-x0); - dv = (v1-v0) / (y1-y0); - - v = v0; - - for (y=y0; y<=y1; y++ ) { - scale_row_asm_transparent( &source_bmp->bm_data[source_bmp->bm_rowsize*f2i(v)], &dest_bmp->bm_data[dest_bmp->bm_rowsize*y+x0], x1-x0+1, u0, du ); - v += dv; - } -} - -ubyte scale_rle_data[640]; - -void decode_row( grs_bitmap * bmp, int y ) -{ - int i, offset=4+bmp->bm_h; - - for (i=0; ibm_data[4+i]; - gr_rle_decode( &bmp->bm_data[offset], scale_rle_data ); -} - -void scale_bitmap_asm_rle(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ) -{ - fix du, dv, v; - int y, last_row=-1; - - du = (u1-u0) / (x1-x0); - dv = (v1-v0) / (y1-y0); - - v = v0; - - for (y=y0; y<=y1; y++ ) { - if ( f2i(v) != last_row ) { - last_row = f2i(v); - decode_row( source_bmp, last_row ); - } - scale_row_asm_transparent( scale_rle_data, &dest_bmp->bm_data[dest_bmp->bm_rowsize*y+x0], x1-x0+1, u0, du ); - v += dv; - } -} - - -void scale_bitmap_cc_asm(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ) -{ - fix dv, v; - int y; - - dv = (v1-v0) / (y1-y0); - - rls_stretch_scanline_setup( (int)(x1-x0), f2i(u1)-f2i(u0) ); - if ( scale_ydelta_minus_1 < 1 ) return; - rls_do_cc_setup_asm(); - - v = v0; - - for (y=y0; y<=y1; y++ ) { - scale_source_ptr = &source_bmp->bm_data[source_bmp->bm_rowsize*f2i(v)+f2i(u0)]; - scale_dest_ptr = &dest_bmp->bm_data[dest_bmp->bm_rowsize*y+x0]; - scale_do_cc_scanline(); - v += dv; - } -} - -void scale_bitmap_cc_asm_rle(grs_bitmap *source_bmp, grs_bitmap *dest_bmp, int x0, int y0, int x1, int y1, fix u0, fix v0, fix u1, fix v1 ) -{ - fix dv, v; - int y, last_row = -1; - - dv = (v1-v0) / (y1-y0); - - rls_stretch_scanline_setup( (int)(x1-x0), f2i(u1)-f2i(u0) ); - if ( scale_ydelta_minus_1 < 1 ) return; - rls_do_cc_setup_asm(); - - v = v0; - - for (y=y0; y<=y1; y++ ) { - if ( f2i(v) != last_row ) { - last_row = f2i(v); - decode_row( source_bmp, last_row ); - } - //scale_source_ptr = &source_bmp->bm_data[source_bmp->bm_rowsize*f2i(v)+f2i(u0)]; - scale_source_ptr = &scale_rle_data[f2i(u0)]; - scale_dest_ptr = &dest_bmp->bm_data[dest_bmp->bm_rowsize*y+x0]; - scale_do_cc_scanline(); - v += dv; - } -} - - - -// Run-length slice bitmap scan line stretcher - -void DrawHorizontalRun(char *ScreenPtr, int RunLength, int Color) -{ - int i; - - for (i=0; i 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - - //if ( *source != Transparency_color ) - rep_stosb(dest, RunLength, *source ); - dest += RunLength; - source++; - - } - - /* Draw the final run of pixels */ - //if ( *source != Transparency_color ) - rep_stosb(dest, FinalPixelCount, *source ); - - return; -} - - - - -void rls_stretch_scanline_setup( int XDelta, int YDelta ) -{ - scale_trans_color = Transparency_color & 0xFF; - scale_ydelta_minus_1 = YDelta - 1; - - /* X major line */ - /* Minimum # of pixels in a run in this line */ - scale_whole_step = XDelta / YDelta; - - /* Error term adjust each time Y steps by 1; used to tell when one - extra pixel should be drawn as part of a run, to account for - fractional steps along the X axis per 1-pixel steps along Y */ - scale_adj_up = (XDelta % YDelta) * 2; - - /* Error term adjust when the error term turns over, used to factor - out the X step made at that time */ - scale_adj_down = YDelta * 2; - - /* Initial error term; reflects an initial step of 0.5 along the Y - axis */ - scale_error_term = (XDelta % YDelta) - (YDelta * 2); - - /* The initial and last runs are partial, because Y advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - scale_initial_pixel_count = (scale_whole_step / 2) + 1; - scale_final_pixel_count = scale_initial_pixel_count; - - /* If the basic run length is even and there's no fractional - advance, we have one pixel that could go to either the initial - or last partial run, which we'll arbitrarily allocate to the - last run */ - if ((scale_adj_up == 0) && ((scale_whole_step & 0x01) == 0)) - { - scale_initial_pixel_count--; - } - /* If there're an odd number of pixels per run, we have 1 pixel that can't - be allocated to either the initial or last partial run, so we'll add 0.5 - to error term so this pixel will be handled by the normal full-run loop */ - if ((scale_whole_step & 0x01) != 0) - { - scale_error_term += YDelta; - } - -} - diff --git a/d2x-rebirth/arch/ogl/ogl.c b/d2x-rebirth/arch/ogl/ogl.c index a895d0acf..07f1e0126 100644 --- a/d2x-rebirth/arch/ogl/ogl.c +++ b/d2x-rebirth/arch/ogl/ogl.c @@ -449,7 +449,7 @@ void ogl_cache_level_textures(void) ogl_cache_polymodel_textures(Player_ship->model_num); ogl_cache_vclipn_textures(Player_ship->expl_vclip_num); - for (i=0;i #include #ifdef DO_MEMINFO -#include #include #endif diff --git a/d2x-rebirth/editor/macro.c b/d2x-rebirth/editor/macro.c deleted file mode 100644 index 9e4a8117e..000000000 --- a/d2x-rebirth/editor/macro.c +++ /dev/null @@ -1,182 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - -/* - * - * Routines for recording/playing/saving macros - * - */ - -#include -#include -#include -#include -#include -#include "inferno.h" -#include "segment.h" -#include "editor.h" -#include "gr.h" -#include "ui.h" -#include "key.h" -#include "fix.h" -#include "3d.h" -#include "mouse.h" -#include "bm.h" -#include "dxxerror.h" -#include "medlisp.h" -#include "kdefs.h" -#include "u_mem.h" - -#define MAX_NUM_EVENTS 10000 - -UI_EVENT * RecordBuffer; - -int MacroNumEvents = 0; -int MacroStatus = 0; - -static char filename[PATH_MAX] = "*.MIN"; - -int MacroRecordAll() -{ - if ( MacroStatus== UI_STATUS_NORMAL ) - { - if (RecordBuffer) d_free( RecordBuffer ); - MALLOC( RecordBuffer, UI_EVENT, MAX_NUM_EVENTS ); - ui_record_events( MAX_NUM_EVENTS, RecordBuffer, UI_RECORD_MOUSE | UI_RECORD_KEYS ); - MacroStatus = UI_STATUS_RECORDING; - } - return 1; -} - -int MacroRecordKeys() -{ - if ( MacroStatus== UI_STATUS_NORMAL ) - { - if (RecordBuffer) d_free( RecordBuffer ); - MALLOC( RecordBuffer, UI_EVENT, MAX_NUM_EVENTS ); - ui_record_events( MAX_NUM_EVENTS, RecordBuffer, UI_RECORD_KEYS ); - MacroStatus = UI_STATUS_RECORDING; - } - return 1; -} - -int MacroPlayNormal() -{ - if (MacroStatus== UI_STATUS_NORMAL && MacroNumEvents > 0 && RecordBuffer ) - { - ui_set_playback_speed( 1 ); - ui_play_events_realtime(MacroNumEvents, RecordBuffer); - MacroStatus = UI_STATUS_PLAYING; - } - return 1; -} - -int MacroPlayFast() -{ - if (MacroStatus== UI_STATUS_NORMAL && MacroNumEvents > 0 && RecordBuffer ) - { - mouse_toggle_cursor(0); - ui_play_events_fast(MacroNumEvents, RecordBuffer); - MacroStatus = UI_STATUS_FASTPLAY; - } - return 1; -} - -int MacroSave() -{ - - if (MacroNumEvents < 1 ) - { - ui_messagebox( -2, -2, 1, "No macro has been defined to save!", "Oops" ); - return 1; - } - - if (ui_get_filename( filename, "*.MAC", "SAVE MACRO" )) - { - PHYSFS_file *fp = PHYSFS_openWrite(filename); - - if (!fp) return 0; - RecordBuffer[0].type = 7; - RecordBuffer[0].frame = 0; - RecordBuffer[0].data = MacroNumEvents; - PHYSFS_write(fp, RecordBuffer, sizeof(UI_EVENT), MacroNumEvents); - PHYSFS_close(fp); - } - return 1; -} - -int MacroLoad() -{ - if (ui_get_filename( filename, "*.MAC", "LOAD MACRO" )) - { - PHYSFS_file *fp = PHYSFS_openRead(filename); - int length; - - if (!fp) - return 0; - if (RecordBuffer) - d_free( RecordBuffer ); - length = PHYSFS_fileLength(fp); - RecordBuffer = d_malloc(length); - if (!RecordBuffer) - return 0; - - PHYSFS_read(fp, RecordBuffer, length, 1); - PHYSFS_close(fp); - MacroNumEvents = RecordBuffer[0].data; - } - return 1; -} - -void macro_free_buffer() -{ - if ( RecordBuffer ) - d_free(RecordBuffer); -} - -int MacroMenu() -{ - int x; - char * MenuItems[] = { "Play fast", - "Play normal", - "Record all", - "Record keys", - "Save macro", - "Load macro" }; - - x = MenuX( -1, -1, 6, MenuItems ); - - switch( x ) - { - case 1: - MacroPlayFast(); - break; - case 2: - MacroPlayNormal(); - break; - case 3: - MacroRecordAll(); - break; - case 4: - MacroRecordKeys(); - break; - case 5: // Save - MacroSave(); - break; - case 6: // Load - MacroLoad(); - break; - } - return 1; -} - diff --git a/d2x-rebirth/include/checker.h b/d2x-rebirth/include/checker.h deleted file mode 100644 index e97e41b5e..000000000 --- a/d2x-rebirth/include/checker.h +++ /dev/null @@ -1,34 +0,0 @@ -//checker.h added 05/17/99 Matt Mueller -//FD_* on linux use asm, but checker doesn't like it. Borrowed these non-asm versions outta -#include - -#ifdef __CHECKER__ - -#undef FD_ZERO(set) -#undef FD_SET(d, set) -#undef FD_CLR(d, set) -#undef FD_ISSET(d, set) - -# define FD_ZERO(set) \ - do { \ - unsigned int __i; \ - for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \ - ((__fd_mask *) set)[__i] = 0; \ - } while (0) -# define FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) -# define FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) -# define FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) - -//checker doesn't seem to handle jmp's correctly... -#undef setjmp(env) -#define setjmp(env) __chcksetjmp(env) -#undef longjmp(env,val) -#define longjmp(env,val) __chcklongjmp(env,val) - -int __chcklongjmp(jmp_buf buf,int val); -int __chcksetjmp(jmp_buf buf); - -void chcksetwritable(char * p, int size); -void chcksetunwritable(char * p, int size); - -#endif diff --git a/d2x-rebirth/include/d1x.xpm b/d2x-rebirth/include/d1x.xpm deleted file mode 100755 index ca4b262c1..000000000 --- a/d2x-rebirth/include/d1x.xpm +++ /dev/null @@ -1,41 +0,0 @@ -/* XPM */ -static char *pixmap[] = { -/* width height ncols cpp */ -"32 32 3 2", - /* Colors */ - "00 c #000000", - "01 c #FF0000", - ".. s None c None", - "................................................................", - "..............01................................01..............", - "..............0101............................0101..............", - "..............010101........................010101..............", - "..............01010101....................01010101..............", - "..............0101010101................0101010101..............", - "..............010101010101............010101010101..............", - "..............01010101010101........01010101010101..............", - "..............0101000101010101......01010101010001..............", - "..............010001010101010101......010101010100..............", - "..............00010101010101010101......010101010100............", - "..............0000010101010101010101......0101010000............", - "............00000000010101010100000001......0100000000..........", - "............0000..0000010101000000000001....0000..0000..........", - "................0000000000000000000000000000000000..............", - "................0000..0000000000000000000000..0000..............", - "..................0100000000000000000000000000..................", - "................0000000000000000000000000000000000..............", - "..............00000101000000000000000000000001010000............", - "............000000000101000000000000000000010100000000..........", - "..........000001000001010101....010101010101010000010000........", - "........0000010101010101010101....010101010101010101010000......", - "....00000101010101010101010101......01010101010101010101010000..", - "....0000..............................010101010101010101010000..", - "........................................010101010101010101......", - "..........................................0101010101010101......", - "............................................01010101010101......", - "..............................................010101010101......", - "................................................0101010101......", - "..................................................01010101......", - "....................................................010101......", - "................................................................", -}; diff --git a/d2x-rebirth/include/descent.xpm b/d2x-rebirth/include/descent.xpm deleted file mode 100755 index e1c5acf23..000000000 --- a/d2x-rebirth/include/descent.xpm +++ /dev/null @@ -1,45 +0,0 @@ -/* XPM */ -static char *pixmap[] = { -/* width height ncols cpp */ -"32 32 7 2", - /* Colors */ - "00 c #000000", - "01 c #800000", - "02 c #C0C0C0", - "03 c #808080", - "04 c #FF0000", - "05 c #FFFFFF", - ".. s None c None", - "................................................................", - "................................................................", - "..........0303..........0301........0304..............03........", - "..........030303........040301....03030304........030303........", - "..........0303030303..0303030304010303030304..0303030303........", - "..........0303030303030303020303000303020303030303030303........", - "..........0303030303030303020303030303030303030303030303........", - "..........0303030303030303020303030303020303030303030303........", - "............0101000303030303030303030303030303010100............", - "..............01010303030303030303030303030303010101............", - "............0301010303030303030303030203030303010103............", - "..........03010101030303030300000003000303030301010103..........", - "........030101010101030300000000000000030303030301010103........", - "........020101010303030300000000000000000303020303010403........", - "......03010101040103030300000000000000000303..040401010103......", - "......010101030402..030300000000000000030303..050503010103......", - "....030101030304....030300030000000000030300..04040303010103....", - "....03010303..00....000303030000000000030302..04040303030103....", - "....030303..........0303030300000000030303..........03030303....", - "....030303..........0303030300000000030303............030303....", - "....0302............030303030303030303030303..........040103....", - "......04............030303030303030303030303............0103....", - "......04............030303030303030303030303............04......", - "....0401............030303030303030303030303............04......", - "....0000............0303030303030303030303..............04......", - "....................0303030303030303030303..............00......", - "......................030303030303030303........................", - "......................030303030303030303........................", - "......................0303030303030303..........................", - "................................................................", - "................................................................", - "................................................................", -}; diff --git a/d2x-rebirth/include/i86.h b/d2x-rebirth/include/i86.h deleted file mode 100644 index 370f7d9da..000000000 --- a/d2x-rebirth/include/i86.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _I86_H -#define _I86_H - -#endif diff --git a/d2x-rebirth/include/pa_enabl.h b/d2x-rebirth/include/pa_enabl.h deleted file mode 100644 index 559105bf0..000000000 --- a/d2x-rebirth/include/pa_enabl.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - -#if !defined(PA_ENABL_H) -#define PA_ENABL_H - -//#define POLY_ACC // define this if poly support wanted. - -#if defined(POLY_ACC) - -// uncomment only ONE of the following. -//#define PA_S3_VIRGE -//#define PA_DIAMOND_S3_VIRGE - -#endif - -#ifdef PA_3DFX_VOODOO - #define PA_DFX(x) x - #define NO_DFX(x) -#else - #define PA_DFX(x) - #define NO_DFX(x) x -#endif - -#endif diff --git a/d2x-rebirth/include/pcx.h b/d2x-rebirth/include/pcx.h index 40e01a96a..e81aea085 100644 --- a/d2x-rebirth/include/pcx.h +++ b/d2x-rebirth/include/pcx.h @@ -33,8 +33,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. // then bmp->bm_data is allocated and the w,h are filled. // If palette==NULL the palette isn't read in. Returns error code. -extern int pcx_get_dimensions( char *filename, int *width, int *height); - extern int pcx_read_bitmap( char * filename, grs_bitmap * bmp, int bitmap_type, ubyte * palette ); // Writes the bitmap bmp to filename, using palette. Returns error code. diff --git a/d2x-rebirth/main/endlevel.c b/d2x-rebirth/main/endlevel.c index 8100c0b01..f594c00b6 100644 --- a/d2x-rebirth/main/endlevel.c +++ b/d2x-rebirth/main/endlevel.c @@ -1283,6 +1283,10 @@ void do_endlevel_flythrough(int n) //update target point & angles compute_center_point_on_side(&dest_point,pseg,exit_side); + if (pseg->children[exit_side] == -2) + nextcenter = dest_point; + else + compute_segment_center(&nextcenter,&Segments[pseg->children[exit_side]]); //update target point and movement points @@ -1319,7 +1323,6 @@ void do_endlevel_flythrough(int n) vm_vec_scale(&flydata->step,flydata->speed); compute_segment_center(&curcenter,pseg); - compute_segment_center(&nextcenter,&Segments[pseg->children[exit_side]]); vm_vec_sub(&flydata->headvec,&nextcenter,&curcenter); #ifdef COMPACT_SEGS diff --git a/d2x-rebirth/main/mission.c b/d2x-rebirth/main/mission.c index c60b8c295..44913ebd3 100644 --- a/d2x-rebirth/main/mission.c +++ b/d2x-rebirth/main/mission.c @@ -774,7 +774,7 @@ int load_mission(mle *mission) snprintf(Ending_text_filename, sizeof(Ending_text_filename), "%s.txb",Current_mission_filename); } - while (PHYSFSX_fgets(buf,80,mfile)) { + while (PHYSFSX_fgets(buf,sizeof(buf),mfile)) { if (istok(buf,"name") && !Current_mission->enhanced) { Current_mission->enhanced = 0; continue; //already have name, go to next line @@ -857,7 +857,7 @@ int load_mission(mle *mission) } for (i=0;i MAX_SEGMENTS_ORIGINAL ) { - for ( i = 0; i <= Highest_segment_index; i++ ) - PHYSFS_write(fp, Automap_visited, sizeof(ubyte), 1); + PHYSFS_write(fp, Automap_visited, sizeof(ubyte), Highest_segment_index + 1); } else PHYSFS_write(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS_ORIGINAL); @@ -1088,8 +1087,7 @@ int state_save_all_sub(char *filename, char *desc) PHYSFS_write(fp, &PaletteBlueAdd, sizeof(int), 1); if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL ) { - for ( i = 0; i <= Highest_segment_index; i++ ) - PHYSFS_write(fp, Light_subtracted, sizeof(Light_subtracted[0]), 1); + PHYSFS_write(fp, Light_subtracted, sizeof(Light_subtracted[0]), Highest_segment_index + 1); } else PHYSFS_write(fp, Light_subtracted, sizeof(Light_subtracted[0]), MAX_SEGMENTS_ORIGINAL); @@ -1507,8 +1505,7 @@ int state_restore_all_sub(char *filename, int secret_restore) if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL ) { memset(&Automap_visited, 0, MAX_SEGMENTS); - for ( i = 0; i <= Highest_segment_index; i++ ) - PHYSFS_read(fp, Automap_visited, sizeof(ubyte), 1); + PHYSFS_read(fp, Automap_visited, sizeof(ubyte), Highest_segment_index + 1); } else PHYSFS_read(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS_ORIGINAL); @@ -1581,8 +1578,7 @@ int state_restore_all_sub(char *filename, int secret_restore) if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL ) { memset(&Light_subtracted, 0, sizeof(Light_subtracted[0])*MAX_SEGMENTS); - for ( i = 0; i <= Highest_segment_index; i++ ) - PHYSFS_read(fp, Light_subtracted, sizeof(Light_subtracted[0]), 1); + PHYSFS_read(fp, Light_subtracted, sizeof(Light_subtracted[0]), Highest_segment_index + 1); } else PHYSFS_read(fp, Light_subtracted, sizeof(Light_subtracted[0]), MAX_SEGMENTS_ORIGINAL); diff --git a/d2x-rebirth/misc/dos_disk.h b/d2x-rebirth/misc/dos_disk.h deleted file mode 100644 index c983fce4e..000000000 --- a/d2x-rebirth/misc/dos_disk.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _DISK_H -#define _DISK_H - -unsigned long getdiskfree(); - -#endif diff --git a/d2x-rebirth/misc/errtest.c b/d2x-rebirth/misc/errtest.c deleted file mode 100644 index c9dd5e490..000000000 --- a/d2x-rebirth/misc/errtest.c +++ /dev/null @@ -1,18 +0,0 @@ - -#define DEBUG_ON 1 - -#include - -#include "dxxerror.h" - -main(int argc,char **argv) -{ - error_init("Thank-you for running ERRTEST!"); - - Assert(argc!=0); -// Assert(argc==5); - - Error("test of error, argc=%d, argv=%x",argc,argv); -} - -ÿ \ No newline at end of file diff --git a/d2x-rebirth/misc/parsarg.c b/d2x-rebirth/misc/parsarg.c deleted file mode 100644 index e8887c9c9..000000000 --- a/d2x-rebirth/misc/parsarg.c +++ /dev/null @@ -1,132 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - -#pragma off (unreferenced) -static char rcsid[] = "$Id: parsarg.c,v 1.1.1.1 2006/03/17 19:58:50 zicodxx Exp $"; -#pragma on (unreferenced) - -#include -#include -#include -#include - -#include "parsarg.h" - -#define ARGBUF_SIZE 500 -#define MAX_ARGS 100 - -char arg_buf[ARGBUF_SIZE]; -char *ab_ptr=arg_buf; - -void perror_exit(int n,char *s) -{ - perror(s); - exit(n); -} - -void verror(char *s,void *first_arg_ptr) -{ - fprintf(stderr,"Error: "); - vfprintf(stderr,s,first_arg_ptr); - fprintf(stderr,"\n"); -} - -void error_exit(int ret_code,char *s,...) -{ - verror(s,((char *) &s)+sizeof(s)); /* addr of next parm on stack */ - exit(ret_code); -} - -void parse_args(int argc,char **argv,void (*handler_func)(char *arg),int flags) -{ - - for (;argc--;argv++) { - if (**argv=='@') { /* read args from file */ - char *arg_ptrs[MAX_ARGS]; - int arg_count; - FILE *argfile; - int len; - char *p=ab_ptr,c; - - if ((argfile=fopen(*argv+1,"rt"))==0) perror_exit(10,*argv+1); - if ((len=fread(ab_ptr,1,ARGBUF_SIZE-((int) (ab_ptr-arg_buf)),argfile))==ARGBUF_SIZE-(ab_ptr-arg_buf)) error_exit(20,"Argument buffer not big enough\n"); - fclose(argfile); - ab_ptr[len++]=0; /* write terminating null */ - - /* remove comments */ - - while ((p=strchr(ab_ptr,';'))!=NULL) { - char *p2=strchr(p,'\n'); - - if (p2) { /* found cr */ - strcpy(p,p2); /* copy over comment */ - len = strlen(ab_ptr); - } - else { /* no cr, end of string */ - *p=0; - len = (int) (p-ab_ptr); - } - } - ab_ptr[len]=0; /* write terminating null */ - - while (!ab_ptr[len-1]) len--; /* back up over terminating nulls */ - p=ab_ptr; - - - for (arg_count=0;p=MAX_ARGS) error_exit(10,"Too many args"); - while (p - -#include "parsarg.h" - - -handle_arg(char *a) -{ - printf("%s\n",a); -} - - -main(int argc,char **argv) -{ - - parse_args(argc-1,argv+1,handle_arg,PA_EXPAND); -} - -ÿ \ No newline at end of file diff --git a/d2x-rebirth/misc/pngfile.c b/d2x-rebirth/misc/pngfile.c deleted file mode 100644 index c2dc6ee31..000000000 --- a/d2x-rebirth/misc/pngfile.c +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include - -#include "pngfile.h" -#include "u_mem.h" -#include "pstypes.h" - -int read_png(char *filename, png_data *pdata) -{ - ubyte header[8]; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; - png_bytepp row_pointers = NULL; - png_uint_32 width, height; - int depth, color_type; - int i; - FILE *fp = NULL; - - if (!filename || !pdata) - return 0; - - if ((fp = fopen(filename, "rb")) == NULL) - return 0; - - fread(header, 1, 8, fp); - if (!png_check_sig(header, 8)) - return 0; - - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - info_ptr = png_create_info_struct(png_ptr); - - pdata->data = pdata->palette = NULL; - pdata->num_palette = 0; - if (setjmp(png_ptr->jmpbuf)) - { - png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); - if (pdata->data) - free(pdata->data); - if (pdata->palette) - free(pdata->palette); - if (row_pointers) - free(row_pointers); - fclose(fp); - return 0; - } - - png_init_io(png_ptr, fp); - png_set_sig_bytes(png_ptr, 8); - png_read_info(png_ptr, info_ptr); - png_get_IHDR(png_ptr, info_ptr, &width, &height, &depth, &color_type, NULL, NULL, NULL); - - pdata->width = width; - pdata->height = height; - pdata->depth = depth; - - pdata->data = (ubyte*)malloc(png_get_rowbytes(png_ptr, info_ptr) * height); - row_pointers = (png_bytep *)malloc(sizeof(png_bytep) * height); - for (i = 0; i < height; i++) - row_pointers[i] = &pdata->data[png_get_rowbytes(png_ptr, info_ptr) * i]; - - png_read_image(png_ptr, row_pointers); - free(row_pointers); - row_pointers=NULL; - png_read_end(png_ptr, info_ptr); - - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - png_colorp palette; - - if (png_get_PLTE(png_ptr, info_ptr, &palette, &pdata->num_palette)) - { - pdata->palette = (ubyte*)malloc(pdata->num_palette * 3); - memcpy(pdata->palette, palette, pdata->num_palette * 3); - } - } - - pdata->paletted = (color_type & PNG_COLOR_MASK_PALETTE) > 0; - pdata->color = (color_type & PNG_COLOR_MASK_COLOR) > 0; - pdata->alpha = (color_type & PNG_COLOR_MASK_ALPHA) > 0; - if (pdata->color && pdata->alpha) - pdata->channels = 4; - else if (pdata->color && !pdata->alpha) - pdata->channels = 3; - else if (!pdata->color && pdata->alpha) - pdata->channels = 2; - else //if (!pdata->color && !pdata->alpha) - pdata->channels = 1; - - png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); - fclose(fp); - - return 1; -} diff --git a/d2x-rebirth/ui/barbox.c b/d2x-rebirth/ui/barbox.c deleted file mode 100644 index 456d8bbd9..000000000 --- a/d2x-rebirth/ui/barbox.c +++ /dev/null @@ -1,107 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - - -#include -#include - -#include "fix.h" -#include "pstypes.h" -#include "gr.h" -#include "ui.h" -#include "key.h" - - -static UI_WINDOW * wnd = NULL; -static int bar_width, bar_height, bar_x, bar_y, bar_maxlength; - -void ui_barbox_open( char * text, int length ) -{ - grs_font * temp_font; - int text_width, text_height, avg; - int w,h, width, height, xc, yc, x, y; - - w = grd_curscreen->sc_w; - h = grd_curscreen->sc_h; - - width = w/3; - - bar_maxlength = length; - - if ( w < 640 ) { - temp_font = grd_curscreen->sc_canvas.cv_font; - grd_curscreen->sc_canvas.cv_font = ui_small_font; - } - - gr_get_string_size(text, &text_width, &text_height, &avg ); - - text_width += avg*6; - text_width += 10; - - if (text_width > width ) - width = text_width; - - height = text_height; - height += 30; - - xc = w/2; - yc = h/2; - - x = xc - width/2; - y = yc - height/2; - - if (x < 0 ) x = 0; - if ( (x+width-1) >= w ) x = w - width; - if (y < 0 ) y = 0; - if ( (y+height-1) >= h ) y = h - height; - - wnd = ui_open_window( x, y, width, height, WIN_DIALOG ); - - y = 5 + text_height/2 ; - - ui_string_centered( width/2, y, text ); - - y = 10 + text_height; - - bar_width = width - 15; - bar_height = 10; - bar_x = (width/2) - (bar_width/2); - bar_y = height - 15; - - ui_draw_line_in( bar_x-2, bar_y-2, bar_x+bar_width+1, bar_y+bar_height+1 ); - - grd_curscreen->sc_canvas.cv_font = temp_font; - -} - -void ui_barbox_update( int position ) -{ - int spos; - - spos = (position * bar_width)/bar_maxlength; - - gr_set_current_canvas( wnd->canvas ); - - ui_mouse_hide(); - gr_setcolor( BM_XRGB(0,0,10)); - gr_rect( bar_x, bar_y, bar_x+spos-1, bar_y+bar_height-1 ); - ui_mouse_show(); - ui_mouse_process(); - -} - -void ui_barbox_close() -{ - if (wnd) - ui_close_window(wnd); -} diff --git a/d2x-rebirth/ui/number.c b/d2x-rebirth/ui/number.c deleted file mode 100644 index b6e3543d2..000000000 --- a/d2x-rebirth/ui/number.c +++ /dev/null @@ -1,111 +0,0 @@ -/* -THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX -SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO -END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A -ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS -IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS -SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE -FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE -CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS -AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. -COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. -*/ - - -#include -#include - -#include "fix.h" -#include "pstypes.h" -#include "gr.h" -#include "ui.h" - -#define TEXT_EXTRA_HEIGHT 5 - -double ui_input_number( short xc, short yc, char * text, double OrgNumber ) -{ - UI_WINDOW * wnd; - UI_GADGET_INPUTBOX * InputBox; - - int text_width, text_height, avg; - short box_width, box_height, width, height, x, y; - short w, h; - char string[100]; - - sprintf( string, "%f", OrgNumber ); - - box_width = box_height = 0; - - gr_set_current_canvas( &grd_curscreen->sc_canvas ); - - box_width = 8*20; - box_height = 20; - - gr_get_string_size(text, &text_width, &text_height, &avg ); - - width = box_width + 50; - - text_width += avg*6; - text_width += 10; - - if (text_width > width ) - width = text_width; - - height = text_height; - height += box_height; - height += 4*5; - - // Center X and Y - w = grd_curscreen->sc_w; - h = grd_curscreen->sc_h; - - if ( xc == -1 ) xc = Mouse.x; - if ( yc == -1 ) yc = Mouse.y - box_height/2; - if ( xc == -2 ) xc = w/2; - if ( yc == -2 ) yc = h/2; - - x = xc - width/2; - y = yc - height/2; - - // Make sure that we're onscreen - if (x < 0 ) x = 0; - if ( (x+width-1) >= w ) x = w - width; - if (y < 0 ) y = 0; - if ( (y+height-1) >= h ) y = h - height; - - - wnd = ui_open_window( x, y, width, height, WIN_DIALOG ); - - y = TEXT_EXTRA_HEIGHT + text_height/2 - 1; - - ui_string_centered( width/2, y, text ); - - y = 2*TEXT_EXTRA_HEIGHT + text_height; - - y = height - TEXT_EXTRA_HEIGHT - box_height-10; - - InputBox = ui_add_gadget_inputbox( wnd, 10, y, 20, 20, string ); - - ui_gadget_calc_keys(wnd); - - //key_flush(); - - wnd->keyboard_focus_gadget = (UI_GADGET *)InputBox; - - while(1) - { - ui_mega_process(); - ui_window_do_gadgets(wnd); - - if (InputBox->pressed) break; - } - - ui_close_window(wnd); - - OrgNumber = atof(InputBox->text); - - return OrgNumber; - -} - -