From a1fe33147acb3e53536e1c4adfcc24266372b093 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 9 Mar 2013 22:11:54 +0000 Subject: [PATCH 01/74] Switch from C99 to Gnu99 to make editor build work --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index d66625dc0..35178e6e4 100644 --- a/SConstruct +++ b/SConstruct @@ -250,7 +250,7 @@ class D1XProgram(DXXProgram): DXXProgram.prepare_environment(self) # Flags and stuff for all platforms... self.env.Append(CCFLAGS = ['-Wall', '-funsigned-char', '-Werror=implicit-int', '-Werror=implicit-function-declaration', '-pedantic', '-pthread']) - self.env.Append(CFLAGS = ['-std=c99']) + self.env.Append(CFLAGS = ['-std=gnu99']) self.env.Append(CPPDEFINES = ['NETWORK']) self.env.Append(CPPPATH = [os.path.join(self.srcdir, f) for f in ['include', 'main', 'arch/include']]) From 39199291e174c16ffef99e5b2920ab5338a144a3 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 9 Mar 2013 00:25:10 +0000 Subject: [PATCH 02/74] Remove -pedantic It warns about the editor build and serves no purpose. --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 35178e6e4..84e26fac3 100644 --- a/SConstruct +++ b/SConstruct @@ -249,7 +249,7 @@ class D1XProgram(DXXProgram): def prepare_environment(self): DXXProgram.prepare_environment(self) # Flags and stuff for all platforms... - self.env.Append(CCFLAGS = ['-Wall', '-funsigned-char', '-Werror=implicit-int', '-Werror=implicit-function-declaration', '-pedantic', '-pthread']) + self.env.Append(CCFLAGS = ['-Wall', '-funsigned-char', '-Werror=implicit-int', '-Werror=implicit-function-declaration', '-pthread']) self.env.Append(CFLAGS = ['-std=gnu99']) self.env.Append(CPPDEFINES = ['NETWORK']) self.env.Append(CPPPATH = [os.path.join(self.srcdir, f) for f in ['include', 'main', 'arch/include']]) From 19b77c4e5cccf47711b90cffe50adfdaeca9c70c Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 17 Mar 2013 18:24:11 +0000 Subject: [PATCH 03/74] Support versions of gcc < 4.6 GCC 4.6 accepts the earlier form without comment, but GCC 4.5 chokes on it. --- include/editor/editor.h | 81 ++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/include/editor/editor.h b/include/editor/editor.h index 3a955a251..639de274e 100644 --- a/include/editor/editor.h +++ b/include/editor/editor.h @@ -27,7 +27,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. struct window; struct segment; -typedef struct segment segment; /* * Constants @@ -197,7 +196,7 @@ extern void med_combine_duplicate_vertices(sbyte *vlp); // 0 = successful attach // 1 = No room in Segments[]. // 2 = No room in Vertices[]. -extern int med_attach_segment(segment *destseg, segment *newseg, int destside, int newside); +extern int med_attach_segment(struct segment *destseg, struct segment *newseg, int destside, int newside); // Delete a segment. // Deletes a segment from the global array Segments. @@ -207,7 +206,7 @@ extern int med_attach_segment(segment *destseg, segment *newseg, int destside, i // Return value: // 0 = successful deletion // 1 = unable to delete -extern int med_delete_segment(segment *sp); +extern int med_delete_segment(struct segment *sp); // Rotate the segment *seg by the pitch, bank, heading defined by *rot, destructively // modifying its four free vertices in the global array Vertices. @@ -218,8 +217,8 @@ extern int med_delete_segment(segment *sp); // 0 = successful rotation // 1 = MAX_SIDES_PER_SEGMENT makes rotation illegal (connected to 0 or 2+ segments) // 2 = Rotation causes degeneracy, such as self-intersecting segment. -extern int med_rotate_segment(segment *seg, vms_matrix *rotmat); -extern int med_rotate_segment_ang(segment *seg, vms_angvec *ang); +extern int med_rotate_segment(struct segment *seg, vms_matrix *rotmat); +extern int med_rotate_segment_ang(struct segment *seg, vms_angvec *ang); // Scales a segment, destructively modifying vertex coordinates in global Vertices[]. // Uses scale factor in sp->scale. @@ -227,13 +226,13 @@ extern int med_rotate_segment_ang(segment *seg, vms_angvec *ang); // The vector *svp contains the x,y,z scale factors. The x,y,z directions are relative // to the segment. x scales in the dimension of the right vector, y of the up vector, z of the forward vector. // The dimension of the vectors is determined by averaging appropriate sets of 4 of the 8 points. -extern void med_scale_segment(segment *sp); +extern void med_scale_segment(struct segment *sp); // Create a wall which can be removed. // Creates wall at sp->sides[side], making it part of segment sp // Removable walls must be placed between two connected segments. You should add the removable // wall on both sides. In fact, you really must. -extern void create_removable_wall(segment *sp, int side, int tmap_num); +extern void create_removable_wall(struct segment *sp, int side, int tmap_num); // Loads mine *name from disk, updating global variables: // Segments, Vertices @@ -289,20 +288,20 @@ extern int medlisp_update_screen(); extern int create_new_mine(void); // extern void med_create_segment(segment *sp, vms_vector *scale); -extern void old_med_attach_segment(segment *sp,int main_side,int branch_side,fix cx, fix cy, fix cz, fix length, fix width, fix height, vms_matrix *mp); +extern void old_med_attach_segment(struct segment *sp,int main_side,int branch_side,fix cx, fix cy, fix cz, fix length, fix width, fix height, vms_matrix *mp); // Copy a segment from *ssp to *dsp. Do not simply copy the struct. Use *dsp's vertices, copying in // just the values, not the indices. -extern void med_copy_segment(segment *dsp,segment *ssp); +extern void med_copy_segment(struct segment *dsp,struct segment *ssp); // Create a segment given center, dimensions, rotation matrix. // Note that the created segment will always have planar sides and rectangular cross sections. // It will be created with walls on all sides, ie not connected to anything. -void med_create_segment(segment *sp,fix cx, fix cy, fix cz, fix length, fix width, fix height, vms_matrix *mp); +void med_create_segment(struct segment *sp,fix cx, fix cy, fix cz, fix length, fix width, fix height, vms_matrix *mp); // Create a default segment. // Useful for when user creates a garbage segment. -extern void med_create_default_segment(segment *sp); +extern void med_create_default_segment(struct segment *sp); // Create New_segment with sizes found in *scale. extern void med_create_new_segment(vms_vector *scale); @@ -314,7 +313,7 @@ extern void med_create_new_segment_from_cursegp(void); extern void med_update_new_segment(void); // Replace *sp with New_segment. -extern void med_update_segment(segment *sp); +extern void med_update_segment(struct segment *sp); // Create a new segment and use it to form a bridge between two existing segments. // Specify two segment:side pairs. If either segment:side is not open (ie, segment->children[side] != -1) @@ -323,7 +322,7 @@ extern void med_update_segment(segment *sp); // 0 bridge segment formed // 1 unable to form bridge because one (or both) of the sides is not open. // Note that no new vertices are created by this process. -extern int med_form_bridge_segment(segment *seg1, int side1, segment *seg2, int side2); +extern int med_form_bridge_segment(struct segment *seg1, int side1, struct segment *seg2, int side2); // Compress mine at Segments and Vertices by squeezing out all holes. // If no holes (ie, an unused segment followed by a used segment), then no action. @@ -334,21 +333,21 @@ extern void med_compress_mine(void); // Extract the forward vector from segment *sp, return in *vp. // The forward vector is defined to be the vector from the the center of the front face of the segment // to the center of the back face of the segment. -extern void med_extract_forward_vector_from_segment(segment *sp,vms_vector *vp); +extern void med_extract_forward_vector_from_segment(struct segment *sp,vms_vector *vp); // Extract the right vector from segment *sp, return in *vp. // The forward vector is defined to be the vector from the the center of the left face of the segment // to the center of the right face of the segment. -extern void med_extract_right_vector_from_segment(segment *sp,vms_vector *vp); +extern void med_extract_right_vector_from_segment(struct segment *sp,vms_vector *vp); // Extract the up vector from segment *sp, return in *vp. // The forward vector is defined to be the vector from the the center of the bottom face of the segment // to the center of the top face of the segment. -extern void med_extract_up_vector_from_segment(segment *sp,vms_vector *vp); +extern void med_extract_up_vector_from_segment(struct segment *sp,vms_vector *vp); // Compute the center point of a side of a segment. // The center point is defined to be the average of the 4 points defining the side. -extern void med_compute_center_point_on_side(vms_vector *vp,segment *sp,int side); +extern void med_compute_center_point_on_side(vms_vector *vp,struct segment *sp,int side); extern void set_matrix_based_on_side(vms_matrix *rotmat,int destside); @@ -390,19 +389,19 @@ extern void delete_curve(); // --- // -- Temporary function, identical to med_rotate_segment, but it takes a vector instead of an angvec // --- extern int med_rotate_segment_vec(segment *seg, vms_vector *vec); -extern void med_extract_matrix_from_segment(segment *sp,vms_matrix *rotmat); +extern void med_extract_matrix_from_segment(struct segment *sp,vms_matrix *rotmat); // Assign default u,v coordinates to all sides of a segment. // This routine should only be used for segments which are not connected to anything else, // ie the segment created at mine creation. -extern void assign_default_uvs_to_segment(segment *segp); -extern void assign_default_uvs_to_side(segment *segp, int side); +extern void assign_default_uvs_to_segment(struct segment *segp); +extern void assign_default_uvs_to_side(struct segment *segp, int side); -extern void assign_default_uvs_to_side(segment *segp,int side); +extern void assign_default_uvs_to_side(struct segment *segp,int side); // Assign u,v coordinates to con_seg, con_common_side from base_seg, base_common_side // They are connected at the edge defined by the vertices abs_id1, abs_id2. -extern void med_assign_uvs_to_side(segment *con_seg, int con_common_side, segment *base_seg, int base_common_side, int abs_id1, int abs_id2); +extern void med_assign_uvs_to_side(struct segment *con_seg, int con_common_side, struct segment *base_seg, int base_common_side, int abs_id1, int abs_id2); // Debug -- show a matrix. // type: 1 --> printf @@ -411,10 +410,10 @@ extern void med_assign_uvs_to_side(segment *con_seg, int con_common_side, segmen extern void show_matrix(char *s,vms_matrix *mp,int type); // Create coordinate axes in orientation of specified segment, stores vertices at *vp. -extern void create_coordinate_axes_from_segment(segment *sp,int *vertnums); +extern void create_coordinate_axes_from_segment(struct segment *sp,int *vertnums); // Scale a segment. Then, if it is connected to something, rotate it. -extern int med_scale_and_rotate_segment(segment *seg, vms_angvec *rot); +extern int med_scale_and_rotate_segment(struct segment *seg, vms_angvec *rot); // Set Vertex_active to number of occurrences of each vertex. // Set Num_vertices. @@ -429,30 +428,30 @@ extern void set_vertex_counts(void); // 0 joint formed // 1 unable to form joint because one or more vertices of side2 is not free // 2 unable to form joint because side1 is already used -extern int med_form_joint(segment *seg1, int side1, segment *seg2, int side2); +extern int med_form_joint(struct segment *seg1, int side1, struct segment *seg2, int side2); // The current texture... use by saying something=bm_lock_bitmap(CurrentTexture) extern int CurrentTexture; -extern void compute_segment_center(vms_vector *vp,segment *sp); +extern void compute_segment_center(vms_vector *vp,struct segment *sp); -extern void med_propagate_tmaps_to_segments(segment *base_seg,segment *con_seg, int uv_only_flag); +extern void med_propagate_tmaps_to_segments(struct segment *base_seg,struct segment *con_seg, int uv_only_flag); -extern void med_propagate_tmaps_to_back_side(segment *base_seg, int back_side, int uv_only_flag); +extern void med_propagate_tmaps_to_back_side(struct segment *base_seg, int back_side, int uv_only_flag); -extern void med_propagate_tmaps_to_any_side(segment *base_seg, int back_side, int tmap_num, int uv_only_flag); +extern void med_propagate_tmaps_to_any_side(struct segment *base_seg, int back_side, int tmap_num, int uv_only_flag); // Find segment adjacent to sp:side. // Adjacent means a segment which shares all four vertices. // Return true if segment found and fill in segment in adj_sp and side in adj_side. // Return false if unable to find, in which case adj_sp and adj_side are undefined. -extern int med_find_adjacent_segment_side(segment *sp, int side, segment **adj_sp, int *adj_side); +extern int med_find_adjacent_segment_side(struct segment *sp, int side, struct segment **adj_sp, int *adj_side); // Finds the closest segment and side to sp:side. -extern int med_find_closest_threshold_segment_side(segment *sp, int side, segment **adj_sp, int *adj_side, fix threshold); +extern int med_find_closest_threshold_segment_side(struct segment *sp, int side, struct segment **adj_sp, int *adj_side, fix threshold); // Given two segments, return the side index in the connecting segment which connects to the base segment -extern int find_connect_side(segment *base_seg, segment *con_seg); +extern int find_connect_side(struct segment *base_seg, struct segment *con_seg); // Select previous segment. // If there is a connection on the side opposite to the current side, then choose that segment. @@ -465,10 +464,10 @@ extern void get_previous_segment(int curseg_num, int curside,int *newseg_num, in extern void get_next_segment(int curseg_num, int curside, int *newseg_num, int *newside); // Copy texture maps in newseg to nsp. -extern void copy_uvs_seg_to_seg(segment *nsp,segment *newseg); +extern void copy_uvs_seg_to_seg(struct segment *nsp,struct segment *newseg); // Return true if segment is concave. -extern int check_seg_concavity(segment *s); +extern int check_seg_concavity(struct segment *s); // Return N_found_segs = number of concave segments in mine. // Segment ids stored at Found_segs @@ -480,7 +479,7 @@ extern void find_concave_segs(void); extern void warn_if_concave_segments(void); // Warn if segment s is concave. -extern void warn_if_concave_segment(segment *s); +extern void warn_if_concave_segment(struct segment *s); // Add a vertex to the vertex list. extern int med_add_vertex(vms_vector *vp); @@ -490,7 +489,7 @@ extern int med_add_vertex(vms_vector *vp); extern int med_create_duplicate_vertex(vms_vector *vp); // Create a new segment, duplicating exactly, including vertex ids and children, the passed segment. -extern int med_create_duplicate_segment(segment *sp); +extern int med_create_duplicate_segment(struct segment *sp); // Returns the index of a free segment. // Scans the Segments array. @@ -531,7 +530,7 @@ extern editor_view TopView; extern editor_view FrontView; extern editor_view RightView; -extern void set_view_target_from_segment(segment *sp); +extern void set_view_target_from_segment(struct segment *sp); extern int SafetyCheck(); extern void editor_status( const char *format, ...); @@ -621,12 +620,12 @@ extern void med_point_2_vec(grs_canvas *canv,vms_vector *v,short sx,short sy); void close_editor_screen(void); // From eobject.c -extern int place_object(segment *segp, vms_vector *object_pos, short object_type, short object_id); +extern int place_object(struct segment *segp, vms_vector *object_pos, short object_type, short object_id); // from ksegsize.c -extern void med_extract_up_vector_from_segment_side(segment *sp, int sidenum, vms_vector *vp); -extern void med_extract_right_vector_from_segment_side(segment *sp, int sidenum, vms_vector *vp); -extern void med_extract_forward_vector_from_segment_side(segment *sp, int sidenum, vms_vector *vp); +extern void med_extract_up_vector_from_segment_side(struct segment *sp, int sidenum, vms_vector *vp); +extern void med_extract_right_vector_from_segment_side(struct segment *sp, int sidenum, vms_vector *vp); +extern void med_extract_forward_vector_from_segment_side(struct segment *sp, int sidenum, vms_vector *vp); // In medmisc.c extern void draw_world_from_game(void); From 847248f7398bef8c114f9d91b5730611c5a45945 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 17 Mar 2013 22:54:53 +0000 Subject: [PATCH 04/74] Remove unused header files --- include/alloca.h | 11 ------ include/bcd.h | 90 --------------------------------------------- include/clipboard.h | 9 ----- include/compare.h | 14 ------- 4 files changed, 124 deletions(-) delete mode 100644 include/alloca.h delete mode 100644 include/bcd.h delete mode 100644 include/clipboard.h delete mode 100644 include/compare.h diff --git a/include/alloca.h b/include/alloca.h deleted file mode 100644 index 4a3800a3d..000000000 --- a/include/alloca.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _ALLOCA_H_ -#define _ALLOCA_H_ - -#include - -//-------------------------------------------------------------------------------- -#undef alloca -#define alloca(SIZE) __builtin_alloca(SIZE) -extern void * alloca( size_t ); - -#endif // _ALLOCA_H_ diff --git a/include/bcd.h b/include/bcd.h deleted file mode 100644 index 9515daab3..000000000 --- a/include/bcd.h +++ /dev/null @@ -1,90 +0,0 @@ -/* bcd.h -- header file for BCD, a CD-ROM audio playing library for DJGPP - by Brennan Underwood, http://brennan.home.ml.org/ */ -#ifndef _BCD_H -#define _BCD_H - -#define BCD_VERSION 0x0103 - -#ifdef __cplusplus -extern "C" { -#endif - -/* Installation and setup functions */ -/* Call this first! */ -int bcd_open(void); -/* Call before exit. */ -int bcd_close(void); - -/* open door, unlocking first if necessary */ -int bcd_open_door(void); -/* close door */ -int bcd_close_door(void); - -/* pass 1 to lock door, 0 to unlock */ -int bcd_lock(int); - -/* returns one of the following 3 #defined symbols */ -int bcd_disc_changed(void); -#define BCD_DISC_CHANGED 0xff -#define BCD_DISC_NOT_CHANGED 1 -#define BCD_DISC_UNKNOWN 0 - -/* perform a device reset */ -int bcd_reset(void); - -/* compare the returned status int to the following bits */ -int bcd_device_status(void); -#define BCD_DOOR_OPEN 1 -#define BCD_DOOR_UNLOCKED 2 -#define BCD_SUPPORT_COOKED 4 -#define BCD_READ_ONLY 8 -#define BCD_DATA_READ_ONLY 16 -#define BCD_SUPPORT_INTERLEAVE 32 - -/* returns 1 if audio is currently playing, 0 otherwise. -1 on error */ -int bcd_audio_busy(void); -/* current head position in frames */ -int bcd_audio_position(void); -/* convenience function, if audio busy, returns track# playing now */ -int bcd_now_playing(void); - -/* query MSCDEX for track list when disc changed or just starting up */ -int bcd_get_audio_info(void); -/* get a particular track's info */ -int bcd_get_track_address(int trackno, int *start, int *len); -/* check for track's audio/data status */ -int bcd_track_is_audio(int trackno); -/* play a particular track from beginning to end */ -int bcd_play_track(int *tracknum); -/* play an arbitrary section of audio for an arbitrary length of time */ -int bcd_play(int start, int len); -/* set the output volume. pass a parameter from 0-255 */ -int bcd_set_volume(int); -/* stop and pause are equivalent */ -int bcd_stop(void); -#define bcd_pause bcd_stop -int bcd_resume(void); - -/* Troubleshooting */ -/* Returns a human readable description of the last error encountered */ -char *bcd_error(void); -extern int _error_code; -/* If you are mad enough play the Rach 3, I mean parse _error_code yourself */ -#define BCD_DE_WRITE_PROTECT 0 -#define BCD_DE_UNKNOWN_UNIT 1 -#define BCD_DE_DRIVE_NOT_READY 2 -#define BCD_DE_UNKNOWN_COMMAND 3 -#define BCD_DE_CRC_ERROR 4 -#define BCD_DE_STRUCT_LEN 5 -#define BCD_DE_SEEK_ERROR 6 -#define BCD_DE_UNKNOWN_MEDIA 7 -#define BCD_DE_SECTOR_NOT_FOUND 8 -#define BCD_DE_OUT_OF_PAPER 9 -#define BCD_DE_WRITE_FAULT 10 -#define BCD_DE_READ_FAULT 11 -#define BCD_DE_GENERAL_FAILURE 12 -#define BCD_DE_INVALID_DISK_CHANGE 15 -/* set by BCD itself, for stuff like "Out of memory" */ -extern char *_bcd_error; - -#endif diff --git a/include/clipboard.h b/include/clipboard.h deleted file mode 100644 index aef994409..000000000 --- a/include/clipboard.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _CLIPBOARD_H -#define _CLIPBOARD_H - -#define MAX_PASTE_SIZE 36 - -// fills the specified buffer with clipboard text. returns number chars copied -extern int getClipboardText(char *text, int strlength); - -#endif diff --git a/include/compare.h b/include/compare.h deleted file mode 100644 index 9ea6aca5a..000000000 --- a/include/compare.h +++ /dev/null @@ -1,14 +0,0 @@ -//added 03/05/99 Matt Mueller - comparison functions.. used in checking -//versions without need to duplicate a function or have kludgy code - -#ifndef _COMPARE_H -#define _COMPARE_H - -#include "pstypes.h" - -typedef int32_t compare_int32_func(int32_t a,int32_t b); - -compare_int32_func int32_greaterorequal; -compare_int32_func int32_lessthan; - -#endif From 0236c2993ec63c7e474cd07dd10af4d80d5f5803 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 9 Mar 2013 20:29:20 +0000 Subject: [PATCH 05/74] Remove unused main/desc_id.h --- main/desc_id.h | 60 ------------------------------------------------- main/game.c | 1 - main/gamecntl.c | 1 - main/inferno.c | 2 -- 4 files changed, 64 deletions(-) delete mode 100644 main/desc_id.h diff --git a/main/desc_id.h b/main/desc_id.h deleted file mode 100644 index e71abb034..000000000 --- a/main/desc_id.h +++ /dev/null @@ -1,60 +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. -*/ -/* - * $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/desc_id.h,v $ - * $Revision: 1.1.1.1 $ - * $Author: zicodxx $ - * $Date: 2006/03/17 19:43:11 $ - * - * Header file which contains string for id and timestamp information - * - * $Log: desc_id.h,v $ - * Revision 1.1.1.1 2006/03/17 19:43:11 zicodxx - * initial import - * - * Revision 1.1.1.1 1999/06/14 22:12:14 donut - * Import of d1x 1.37 source. - * - * Revision 2.0 1995/02/27 11:29:38 john - * New version 2.0, which has no anonymous unions, builds with - * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. - * - * Revision 1.3 1994/10/19 09:52:57 allender - * Added variable for bogus error number return when game exits - * - * Revision 1.2 1994/10/18 16:43:52 allender - * Added constants for id and time stamping - * - * Revision 1.1 1994/10/17 09:56:47 allender - * Initial revision - * - * - */ - - - -#ifndef _DESC_ID_H -#define _DESC_ID_H - -#ifdef __MSDOS__ -#include -#endif - -#define DESC_ID_STR "Midway in our life's journey, I went astray" -#define DESC_ID_CHKSUM "alone in a dark wood." -#define DESC_DEAD_TIME "from the straight road and woke to find myself 000000000000" - -extern char desc_id_exit_num; - -#endif - diff --git a/main/game.c b/main/game.c index 19bfe24c0..6628f8a15 100644 --- a/main/game.c +++ b/main/game.c @@ -82,7 +82,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "songs.h" #include "rbaudio.h" #include "multi.h" -#include "desc_id.h" #include "cntrlcen.h" #include "pcx.h" #include "state.h" diff --git a/main/gamecntl.c b/main/gamecntl.c index d00585648..e14873eb9 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -78,7 +78,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "scores.h" #include "multi.h" -#include "desc_id.h" #include "cntrlcen.h" #include "fuelcen.h" #include "pcx.h" diff --git a/main/inferno.c b/main/inferno.c index 607edca1b..aa91cfdbb 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -61,7 +61,6 @@ char copyright[] = "DESCENT COPYRIGHT (C) 1994,1995 PARALLAX SOFTWARE CORPORAT #include "gamefont.h" #include "kconfig.h" #include "newmenu.h" -#include "desc_id.h" #include "config.h" #include "multi.h" #include "songs.h" @@ -86,7 +85,6 @@ char copyright[] = "DESCENT COPYRIGHT (C) 1994,1995 PARALLAX SOFTWARE CORPORAT #include "net_udp.h" #endif -char desc_id_exit_num = 0; int Screen_mode=-1; //game screen or editor screen? int descent_critical_error = 0; unsigned int descent_critical_deverror = 0; From 9f5fe33543e0336fa79abd7e47c7418dfda0cb10 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 16 Mar 2013 02:52:24 +0000 Subject: [PATCH 06/74] Fix compilation error in non-editor build --- main/gameseq.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main/gameseq.c b/main/gameseq.c index 6d44aaf5e..6b0eab98b 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -594,13 +594,8 @@ ushort netmisc_calc_checksum() do_checksum_calc((ubyte *)&s, 2, &sum1, &sum2); t = INTEL_INT(((int)Segments[i].static_light)); do_checksum_calc((ubyte *)&t, 4, &sum1, &sum2); -#ifndef EDITOR - s = INTEL_SHORT(Segments[i].pad); // necessary? If this isn't set to 0 it won't work Intel-Intel anyway. - do_checksum_calc((ubyte *)&s, 2, &sum1, &sum2); -#else s = INTEL_SHORT(0); // no matter if we need alignment on our platform, if we have editor we MUST consider this integer to get the same checksum as non-editor games calculate do_checksum_calc((ubyte *)&s, 2, &sum1, &sum2); -#endif } sum2 %= 255; return ((sum1<<8)+ sum2); From c8c1489837cc63320dcd121aa0b2ccdc6a308baf Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 18:46:12 +0000 Subject: [PATCH 07/74] Create struct reactor analogous to D2X --- main/bm.c | 6 +++--- main/bmread.c | 8 ++++---- main/cntrlcen.c | 17 ++++++++--------- main/cntrlcen.h | 13 ++++++++++--- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/main/bm.c b/main/bm.c index 9808b4517..faa0a6355 100644 --- a/main/bm.c +++ b/main/bm.c @@ -217,12 +217,12 @@ void properties_read_cmp(PHYSFS_file * fp) ObjStrength[i] = PHYSFSX_readFix(fp); First_multi_bitmap_num = PHYSFSX_readInt(fp); - N_controlcen_guns = PHYSFSX_readInt(fp); + Reactors[0].n_guns = PHYSFSX_readInt(fp); for (i = 0; i < MAX_CONTROLCEN_GUNS; i++) - PHYSFSX_readVector(&controlcen_gun_points[i], fp); + PHYSFSX_readVector(&Reactors[0].gun_points[i], fp); for (i = 0; i < MAX_CONTROLCEN_GUNS; i++) - PHYSFSX_readVector(&controlcen_gun_dirs[i], fp); + PHYSFSX_readVector(&Reactors[0].gun_dirs[i], fp); exit_modelnum = PHYSFSX_readInt(fp); destroyed_exit_modelnum = PHYSFSX_readInt(fp); diff --git a/main/bmread.c b/main/bmread.c index 96f4d395f..379d8c7fb 100644 --- a/main/bmread.c +++ b/main/bmread.c @@ -1224,7 +1224,7 @@ void bm_read_object(int skip) model_num = load_polygon_model(model_name,n_normal_bitmaps,first_bitmap_num,NULL); if (type == OL_CONTROL_CENTER) - N_controlcen_guns = read_model_guns(model_name,controlcen_gun_points,controlcen_gun_dirs,NULL); + Reactors[0].n_guns = read_model_guns(model_name,Reactors[0].gun_points,Reactors[0].gun_dirs,NULL); if ( model_name_dead ) Dead_modelnums[model_num] = load_polygon_model(model_name_dead,N_ObjBitmapPtrs-first_bitmap_num_dead,first_bitmap_num_dead,NULL); @@ -1846,9 +1846,9 @@ void bm_write_all(PHYSFS_file *fp) PHYSFS_write( fp, &First_multi_bitmap_num, sizeof(int), 1); - PHYSFS_write( fp, &N_controlcen_guns, sizeof(int), 1); - PHYSFS_write( fp, controlcen_gun_points, sizeof(vms_vector), MAX_CONTROLCEN_GUNS); - PHYSFS_write( fp, controlcen_gun_dirs, sizeof(vms_vector), MAX_CONTROLCEN_GUNS); + PHYSFS_write( fp, &Reactors[0].n_guns, sizeof(int), 1); + PHYSFS_write( fp, Reactors[0].gun_points, sizeof(vms_vector), MAX_CONTROLCEN_GUNS); + PHYSFS_write( fp, Reactors[0].gun_dirs, sizeof(vms_vector), MAX_CONTROLCEN_GUNS); PHYSFS_write( fp, &exit_modelnum, sizeof(int), 1); PHYSFS_write( fp, &destroyed_exit_modelnum, sizeof(int), 1); } diff --git a/main/cntrlcen.c b/main/cntrlcen.c index 9489ae9bc..149e4f56c 100644 --- a/main/cntrlcen.c +++ b/main/cntrlcen.c @@ -32,12 +32,10 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "endlevel.h" #include "byteswap.h" -vms_vector controlcen_gun_points[MAX_CONTROLCEN_GUNS]; -vms_vector controlcen_gun_dirs[MAX_CONTROLCEN_GUNS]; +reactor Reactors[MAX_REACTORS]; control_center_triggers ControlCenterTriggers; -int N_controlcen_guns; int Control_center_been_hit; int Control_center_player_been_seen; int Control_center_next_fire_time; @@ -51,20 +49,21 @@ void do_countdown_frame(); //return the position & orientation of a gun on the control center object void calc_controlcen_gun_point(vms_vector *gun_point,vms_vector *gun_dir,object *obj,int gun_num) { + reactor *reactor = &Reactors[0]; vms_matrix m; Assert(obj->type == OBJ_CNTRLCEN); Assert(obj->render_type==RT_POLYOBJ); - Assert(gun_num < N_controlcen_guns); + Assert(gun_num < reactor->n_guns); //instance gun position & orientation vm_copy_transpose_matrix(&m,&obj->orient); - vm_vec_rotate(gun_point,&controlcen_gun_points[gun_num],&m); + vm_vec_rotate(gun_point,&reactor->gun_points[gun_num],&m); vm_vec_add2(gun_point,&obj->pos); - vm_vec_rotate(gun_dir,&controlcen_gun_dirs[gun_num],&m); + vm_vec_rotate(gun_dir,&reactor->gun_dirs[gun_num],&m); } // ----------------------------------------------------------------------------- @@ -290,9 +289,9 @@ void do_controlcen_frame(object *obj) if ((Control_center_next_fire_time < 0) && !(controlcen_death_silence > F1_0*2)) { if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) - best_gun_num = calc_best_gun(N_controlcen_guns, Gun_pos, Gun_dir, &Believed_player_pos); + best_gun_num = calc_best_gun(Reactors[0].n_guns, Gun_pos, Gun_dir, &Believed_player_pos); else - best_gun_num = calc_best_gun(N_controlcen_guns, Gun_pos, Gun_dir, &ConsoleObject->pos); + best_gun_num = calc_best_gun(Reactors[0].n_guns, Gun_pos, Gun_dir, &ConsoleObject->pos); if (best_gun_num != -1) { vms_vector vec_to_goal; @@ -395,7 +394,7 @@ void init_controlcen_for_level(void) } else { // Compute all gun positions. objp = &Objects[cntrlcen_objnum]; - for (i=0; i Date: Sat, 23 Mar 2013 19:09:44 +0000 Subject: [PATCH 08/74] Move reactor Gun_dir,Gun_pos into struct object --- main/cntrlcen.c | 30 ++++++++++++++++-------------- main/cntrlcen.h | 7 ------- main/multi.c | 2 +- main/object.h | 10 ++++++++++ 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/main/cntrlcen.c b/main/cntrlcen.c index 149e4f56c..65514ec47 100644 --- a/main/cntrlcen.c +++ b/main/cntrlcen.c @@ -41,16 +41,15 @@ int Control_center_player_been_seen; int Control_center_next_fire_time; int Control_center_present; -vms_vector Gun_pos[MAX_CONTROLCEN_GUNS], Gun_dir[MAX_CONTROLCEN_GUNS]; - void do_countdown_frame(); // ----------------------------------------------------------------------------- //return the position & orientation of a gun on the control center object -void calc_controlcen_gun_point(vms_vector *gun_point,vms_vector *gun_dir,object *obj,int gun_num) +void calc_controlcen_gun_point(reactor *reactor, object *obj,int gun_num) { - reactor *reactor = &Reactors[0]; vms_matrix m; + vms_vector *gun_point = &obj->ctype.reactor_info.gun_pos[gun_num]; + vms_vector *gun_dir = &obj->ctype.reactor_info.gun_dir[gun_num]; Assert(obj->type == OBJ_CNTRLCEN); Assert(obj->render_type==RT_POLYOBJ); @@ -70,11 +69,13 @@ void calc_controlcen_gun_point(vms_vector *gun_point,vms_vector *gun_dir,object // Look at control center guns, find best one to fire at *objp. // Return best gun number (one whose direction dotted with vector to player is largest). // If best gun has negative dot, return -1, meaning no gun is good. -int calc_best_gun(int num_guns, vms_vector *gun_pos, vms_vector *gun_dir, vms_vector *objpos) +int calc_best_gun(int num_guns, const object *objreactor, const vms_vector *objpos) { int i; fix best_dot; int best_gun; + const vms_vector (*const gun_pos)[MAX_CONTROLCEN_GUNS] = &objreactor->ctype.reactor_info.gun_pos; + const vms_vector (*const gun_dir)[MAX_CONTROLCEN_GUNS] = &objreactor->ctype.reactor_info.gun_dir; best_dot = -F1_0*2; best_gun = -1; @@ -83,9 +84,9 @@ int calc_best_gun(int num_guns, vms_vector *gun_pos, vms_vector *gun_dir, vms_ve fix dot; vms_vector gun_vec; - vm_vec_sub(&gun_vec, objpos, &gun_pos[i]); + vm_vec_sub(&gun_vec, objpos, &((*gun_pos)[i])); vm_vec_normalize_quick(&gun_vec); - dot = vm_vec_dot(&gun_dir[i], &gun_vec); + dot = vm_vec_dot(&((*gun_dir)[i]), &gun_vec); if (dot > best_dot) { best_dot = dot; @@ -102,6 +103,7 @@ int calc_best_gun(int num_guns, vms_vector *gun_pos, vms_vector *gun_dir, vms_ve } + int Dead_controlcen_object_num=-1; int Control_center_destroyed = 0; @@ -289,9 +291,9 @@ void do_controlcen_frame(object *obj) if ((Control_center_next_fire_time < 0) && !(controlcen_death_silence > F1_0*2)) { if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) - best_gun_num = calc_best_gun(Reactors[0].n_guns, Gun_pos, Gun_dir, &Believed_player_pos); + best_gun_num = calc_best_gun(Reactors[0].n_guns, obj, &Believed_player_pos); else - best_gun_num = calc_best_gun(Reactors[0].n_guns, Gun_pos, Gun_dir, &ConsoleObject->pos); + best_gun_num = calc_best_gun(Reactors[0].n_guns, obj, &ConsoleObject->pos); if (best_gun_num != -1) { vms_vector vec_to_goal; @@ -299,10 +301,10 @@ void do_controlcen_frame(object *obj) fix delta_fire_time; if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) { - vm_vec_sub(&vec_to_goal, &Believed_player_pos, &Gun_pos[best_gun_num]); + vm_vec_sub(&vec_to_goal, &Believed_player_pos, &obj->ctype.reactor_info.gun_pos[best_gun_num]); dist_to_player = vm_vec_normalize_quick(&vec_to_goal); } else { - vm_vec_sub(&vec_to_goal, &ConsoleObject->pos, &Gun_pos[best_gun_num]); + vm_vec_sub(&vec_to_goal, &ConsoleObject->pos, &obj->ctype.reactor_info.gun_pos[best_gun_num]); dist_to_player = vm_vec_normalize_quick(&vec_to_goal); } @@ -317,7 +319,7 @@ void do_controlcen_frame(object *obj) if (Game_mode & GM_MULTI) multi_send_controlcen_fire(&vec_to_goal, best_gun_num, obj-Objects); #endif - Laser_create_new_easy( &vec_to_goal, &Gun_pos[best_gun_num], obj-Objects, CONTROLCEN_WEAPON_NUM, 1); + Laser_create_new_easy( &vec_to_goal, &obj->ctype.reactor_info.gun_pos[best_gun_num], obj-Objects, CONTROLCEN_WEAPON_NUM, 1); // 1/4 of time, fire another thing, not directly at player, so it might hit him if he's constantly moving. if (d_rand() < 32767/4) { @@ -330,7 +332,7 @@ void do_controlcen_frame(object *obj) if (Game_mode & GM_MULTI) multi_send_controlcen_fire(&vec_to_goal, best_gun_num, obj-Objects); #endif - Laser_create_new_easy( &vec_to_goal, &Gun_pos[best_gun_num], obj-Objects, CONTROLCEN_WEAPON_NUM, 1); + Laser_create_new_easy( &vec_to_goal, &obj->ctype.reactor_info.gun_pos[best_gun_num], obj-Objects, CONTROLCEN_WEAPON_NUM, 1); } delta_fire_time = (NDL - Difficulty_level) * F1_0/4; @@ -395,7 +397,7 @@ void init_controlcen_for_level(void) // Compute all gun positions. objp = &Objects[cntrlcen_objnum]; for (i=0; i Date: Sat, 23 Mar 2013 20:03:11 +0000 Subject: [PATCH 09/74] Add stubs to hide editor reactor differences from D2X --- editor/objpage.c | 4 +++- main/cntrlcen.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/editor/objpage.c b/editor/objpage.c index f328d7ecb..3b6a0ccf8 100644 --- a/editor/objpage.c +++ b/editor/objpage.c @@ -84,6 +84,8 @@ void draw_object_picture(int id, vms_angvec *orient_angles, int type) break; case OBJ_CNTRLCEN: + draw_model_picture(get_reactor_model_number(id), orient_angles); + break; case OBJ_CLUTTER: draw_model_picture(id, orient_angles); break; @@ -247,7 +249,7 @@ int objpage_goto_next_object() case OBJ_POWERUP: Cur_object_type = OBJ_CNTRLCEN; - Num_object_subtypes = 1; + Num_object_subtypes = get_num_reactor_models(); break; case OBJ_CNTRLCEN: diff --git a/main/cntrlcen.h b/main/cntrlcen.h index 9f90e12a3..9ef223ae6 100644 --- a/main/cntrlcen.h +++ b/main/cntrlcen.h @@ -47,6 +47,16 @@ typedef struct reactor { extern reactor Reactors[MAX_REACTORS]; +static inline int get_num_reactor_models() +{ + return 1; +} + +static inline int get_reactor_model_number(int id) +{ + return id; +} + extern int Control_center_been_hit; extern int Control_center_player_been_seen; extern int Control_center_next_fire_time; From 02cd293c2802b4598947d497608c4b4aa22c9809 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 21:15:14 +0000 Subject: [PATCH 10/74] Always use int[] for matcen robot flags --- editor/centers.c | 6 +++--- main/fuelcen.c | 12 ++++++------ main/fuelcen.h | 2 +- main/paging.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/editor/centers.c b/editor/centers.c index 583ddeff4..fa52cd5d1 100644 --- a/editor/centers.c +++ b/editor/centers.c @@ -153,7 +153,7 @@ int centers_dialog_handler(UI_DIALOG *dlg, d_event *event, centers_dialog *c) // Read materialization center robot bit flags for (i = 0; i < N_robot_types; i++) - ui_checkbox_check(c->robotMatFlag[i], RobotCenters[Cursegp->matcen_num].robot_flags & (1 << i)); + ui_checkbox_check(c->robotMatFlag[i], RobotCenters[Cursegp->matcen_num].robot_flags[0] & (1 << i)); } //------------------------------------------------------------ @@ -182,9 +182,9 @@ int centers_dialog_handler(UI_DIALOG *dlg, d_event *event, centers_dialog *c) if ( GADGET_PRESSED(c->robotMatFlag[i]) ) { if (c->robotMatFlag[i]->flag) - RobotCenters[Cursegp->matcen_num].robot_flags |= (1 << i); + RobotCenters[Cursegp->matcen_num].robot_flags[0] |= (1 << i); else - RobotCenters[Cursegp->matcen_num].robot_flags &= ~(1 << i); + RobotCenters[Cursegp->matcen_num].robot_flags[0] &= ~(1 << i); rval = 1; } } diff --git a/main/fuelcen.c b/main/fuelcen.c index 92780cef5..4757f0289 100644 --- a/main/fuelcen.c +++ b/main/fuelcen.c @@ -384,7 +384,7 @@ void robotmaker_proc( FuelCenter * robotcen ) return; } - if (RobotCenters[matcen_num].robot_flags == 0) { + if (RobotCenters[matcen_num].robot_flags[0] == 0) { return; } @@ -472,7 +472,7 @@ void robotmaker_proc( FuelCenter * robotcen ) compute_segment_center(&cur_object_loc, &Segments[robotcen->segnum]); // If this is the first materialization, set to valid robot. - if (RobotCenters[matcen_num].robot_flags != 0) { + if (RobotCenters[matcen_num].robot_flags[0] != 0) { int type; uint flags; sbyte legal_types[32]; // 32 bits in a word, the width of robot_flags. @@ -480,7 +480,7 @@ void robotmaker_proc( FuelCenter * robotcen ) robot_index = 0; num_types = 0; - flags = RobotCenters[matcen_num].robot_flags; + flags = RobotCenters[matcen_num].robot_flags[0]; while (flags) { if (flags & 1) legal_types[num_types++] = robot_index; @@ -668,7 +668,7 @@ void init_all_matcens(void) */ void matcen_info_read(matcen_info *mi, PHYSFS_file *fp, int version) { - mi->robot_flags = PHYSFSX_readInt(fp); + mi->robot_flags[0] = PHYSFSX_readInt(fp); if (version > 25) /*mi->robot_flags2 =*/ PHYSFSX_readInt(fp); mi->hit_points = PHYSFSX_readFix(fp); @@ -682,7 +682,7 @@ void matcen_info_swap(matcen_info *mi, int swap) if (!swap) return; - mi->robot_flags = SWAPINT(mi->robot_flags); + mi->robot_flags[0] = SWAPINT(mi->robot_flags[0]); //if (version > 25) /*mi->robot_flags2 = SWAPINT(mi->robot_flags2);*/ mi->hit_points = SWAPINT(mi->hit_points); @@ -707,7 +707,7 @@ void matcen_info_read_n_swap(matcen_info *mi, int n, int swap, PHYSFS_file *fp) void matcen_info_write(matcen_info *mi, short version, PHYSFS_file *fp) { - PHYSFS_writeSLE32(fp, mi->robot_flags); + PHYSFS_writeSLE32(fp, mi->robot_flags[0]); if (version >= 27) PHYSFS_writeSLE32(fp, 0 /*mi->robot_flags[1]*/); PHYSFSX_writeFix(fp, mi->hit_points); diff --git a/main/fuelcen.h b/main/fuelcen.h index ed74599f3..7517ac54b 100644 --- a/main/fuelcen.h +++ b/main/fuelcen.h @@ -115,7 +115,7 @@ typedef struct FuelCenter { extern int Num_robot_centers; typedef struct matcen_info { - int robot_flags; // Up to 32 different robots + int robot_flags[1]; // Up to 32 different robots fix hit_points; // How hard it is to destroy this particular matcen fix interval; // Interval between materialogrifizations short segnum; // Segment this is attached to. diff --git a/main/paging.c b/main/paging.c index 05b9e5a7f..b7d9f4563 100644 --- a/main/paging.c +++ b/main/paging.c @@ -241,12 +241,12 @@ void paging_touch_robot_maker( segment * segp ) { if ( segp->special == SEGMENT_IS_ROBOTMAKER ) { paging_touch_vclip(&Vclip[VCLIP_MORPHING_ROBOT]); - if (RobotCenters[segp->matcen_num].robot_flags != 0) { + if (RobotCenters[segp->matcen_num].robot_flags[0] != 0) { uint flags; int robot_index; robot_index = 0; - flags = RobotCenters[segp->matcen_num].robot_flags; + flags = RobotCenters[segp->matcen_num].robot_flags[0]; while (flags) { if (flags & 1) { // Page in robot_index From ac68a04296362119c6224840b89dc03e624501dd Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 02:32:02 +0000 Subject: [PATCH 11/74] Add unused fix *l to find_hitpoint_uv to match D2X --- main/collide.c | 2 +- main/fvi.c | 5 +++-- main/fvi.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main/collide.c b/main/collide.c index f9f98dc74..cb20d5d29 100644 --- a/main/collide.c +++ b/main/collide.c @@ -373,7 +373,7 @@ int check_effect_blowup(segment *seg,int side,vms_vector *pnt) //this can be blown up...did we hit it? - find_hitpoint_uv(&u,&v,pnt,seg,side,0); //evil: always say face zero + find_hitpoint_uv(&u,&v,NULL,pnt,seg,side,0); //evil: always say face zero x = ((unsigned) f2i(u*bm->bm_w)) % bm->bm_w; y = ((unsigned) f2i(v*bm->bm_h)) % bm->bm_h; diff --git a/main/fvi.c b/main/fvi.c index 8e892eaf2..a227f9c88 100644 --- a/main/fvi.c +++ b/main/fvi.c @@ -1093,8 +1093,9 @@ quit_looking: //finds the uv coords of the given point on the given seg & side //fills in u & v -void find_hitpoint_uv(fix *u,fix *v,vms_vector *pnt,segment *seg,int sidenum,int facenum) +void find_hitpoint_uv(fix *u,fix *v,fix *l,vms_vector *pnt,segment *seg,int sidenum,int facenum) { + (void)l; vms_vector_array *pnt_array; vms_vector_array normal_array; int segnum = seg-Segments; @@ -1179,7 +1180,7 @@ int check_trans_wall(vms_vector *pnt,segment *seg,int sidenum,int facenum) Assert(WALL_IS_DOORWAY(seg,sidenum) == WID_TRANSPARENT_WALL); - find_hitpoint_uv(&u,&v,pnt,seg,sidenum,facenum); + find_hitpoint_uv(&u,&v,NULL,pnt,seg,sidenum,facenum); if (side->tmap_num2 != 0) { bm = texmerge_get_cached_bitmap( side->tmap_num, side->tmap_num2 ); diff --git a/main/fvi.h b/main/fvi.h index 15500765f..b6812fd59 100644 --- a/main/fvi.h +++ b/main/fvi.h @@ -131,7 +131,7 @@ int find_vector_intersection(fvi_query *fq,fvi_info *hit_data); //finds the uv coords of the given point on the given seg & side //fills in u & v -void find_hitpoint_uv(fix *u,fix *v,vms_vector *pnt,segment *seg,int sidenum,int facenum); +void find_hitpoint_uv(fix *u,fix *v,fix *l,vms_vector *pnt,segment *seg,int sidenum,int facenum); //Returns true if the object is through any walls int object_intersects_wall(object *objp); From d79e68910c5e046955f31b740acaeea7b2a1501b Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 21:01:48 +0000 Subject: [PATCH 12/74] Add unused init_player_stats_level parameter 'secret_flag' to match D2X --- main/gameseq.c | 7 ++++--- main/gameseq.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/main/gameseq.c b/main/gameseq.c index 6b0eab98b..8217e1105 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -290,8 +290,9 @@ void init_ammo_and_energy(void) } // Setup player for new level (After completion of previous level) -void init_player_stats_level() +void init_player_stats_level(int secret_flag) { + (void)secret_flag; // int i; Players[Player_num].last_score = Players[Player_num].score; @@ -397,7 +398,7 @@ extern int game_handler(window *wind, d_event *event, void *data); void editor_reset_stuff_on_level() { gameseq_init_network_players(); - init_player_stats_level(); + init_player_stats_level(0); Viewer = ConsoleObject; ConsoleObject = Viewer = &Objects[Players[Player_num].objnum]; ConsoleObject->id=Player_num; @@ -1117,7 +1118,7 @@ void StartNewLevelSub(int level_num, int page_in_textures) automap_clear_visited(); - init_player_stats_level(); + init_player_stats_level(0); gr_use_palette_table( "palette.256" ); gr_palette_load(gr_palette); diff --git a/main/gameseq.h b/main/gameseq.h index 8cfbd255e..f69af8124 100644 --- a/main/gameseq.h +++ b/main/gameseq.h @@ -90,7 +90,7 @@ extern void draw_high_scores(int place); extern int add_player_to_high_scores(player *pp); extern void input_name (int place); extern int reset_high_scores(); -extern void init_player_stats_level(); +extern void init_player_stats_level(int secret_flag); void open_message_window(void); void close_message_window(void); From b197f80bebb5ace5a978d63a1c497443a860bec8 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 21:01:48 +0000 Subject: [PATCH 13/74] Add unused StartNewLevelSub parameter 'secret_flag' to match D2X --- main/gameseq.c | 11 ++++++++--- main/gameseq.h | 2 +- main/state.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/main/gameseq.c b/main/gameseq.c index 8217e1105..e2fc5dad1 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -1078,8 +1078,13 @@ void DoPlayerDead() } //called when the player is starting a new level for normal game mode and restore state -void StartNewLevelSub(int level_num, int page_in_textures) +void StartNewLevelSub(int level_num, int page_in_textures, int secret_flag) { + /* + * This flag is present for compatibility with D2X. Set it to zero + * so the optimizer deletes all reference to it. + */ + secret_flag = 0; if (!(Game_mode & GM_MULTI)) { last_drawn_cockpit = -1; } @@ -1118,7 +1123,7 @@ void StartNewLevelSub(int level_num, int page_in_textures) automap_clear_visited(); - init_player_stats_level(0); + init_player_stats_level(secret_flag); gr_use_palette_table( "palette.256" ); gr_palette_load(gr_palette); @@ -1218,7 +1223,7 @@ void StartNewLevel(int level_num) if (!(Game_mode & GM_MULTI)) { do_briefing_screens(Briefing_text_filename, level_num); } - StartNewLevelSub(level_num, 1 ); + StartNewLevelSub(level_num, 1, 0 ); } diff --git a/main/gameseq.h b/main/gameseq.h index f69af8124..59adfe4f6 100644 --- a/main/gameseq.h +++ b/main/gameseq.h @@ -63,7 +63,7 @@ void StartNewGame(int start_level); void StartNewLevel(int level_num); // Actually does the work to start new level -void StartNewLevelSub(int level_num, int page_in_textures); +void StartNewLevelSub(int level_num, int page_in_textures, int secret_flag); void InitPlayerObject(); //make sure player's object set up void init_player_stats_game(ubyte pnum); //clear all stats diff --git a/main/state.c b/main/state.c index 498dc8e4c..dc9517b9f 100644 --- a/main/state.c +++ b/main/state.c @@ -1208,7 +1208,7 @@ int state_restore_all_sub(char *filename) //Read player info - StartNewLevelSub(current_level, 1);//use page_in_textures here to fix OGL texture precashing crash -MPM + StartNewLevelSub(current_level, 1, 0);//use page_in_textures here to fix OGL texture precashing crash -MPM MALLOC(pl_rw, player_rw, 1); PHYSFS_read(fp, pl_rw, sizeof(player_rw), 1); player_rw_swap(pl_rw, swap); From 951ac5027c736475dd8670d4099526af544c5ca0 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 22:57:04 +0000 Subject: [PATCH 14/74] Add LoadLevel parameter page_in_textures to match D2X --- main/gameseq.c | 11 +++++------ main/gameseq.h | 2 +- main/newdemo.c | 6 ++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/main/gameseq.c b/main/gameseq.c index e2fc5dad1..3d0b14d2f 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -603,7 +603,7 @@ ushort netmisc_calc_checksum() } //load a level off disk. level numbers start at 1. Secret levels are -1,-2,-3 -void LoadLevel(int level_num) +void LoadLevel(int level_num,int page_in_textures) { char *level_name; player save_player; @@ -643,6 +643,9 @@ void LoadLevel(int level_num) songs_play_level_song( Current_level_num, 0 ); gr_palette_load(gr_palette); //actually load the palette + + if ( page_in_textures ) + piggy_load_level_data(); } //sets up Player_num & ConsoleObject @@ -1097,11 +1100,7 @@ void StartNewLevelSub(int level_num, int page_in_textures, int secret_flag) newdemo_record_start_frame(FrameTime ); } - LoadLevel(level_num); - - if ( page_in_textures ) { - piggy_load_level_data(); - } + LoadLevel(level_num, page_in_textures); Assert(Current_level_num == level_num); //make sure level set right diff --git a/main/gameseq.h b/main/gameseq.h index 59adfe4f6..3e0bddbe6 100644 --- a/main/gameseq.h +++ b/main/gameseq.h @@ -77,7 +77,7 @@ void DoPlayerDead(void); // load a level off disk. level numbers start at 1. // Secret levels are -1,-2,-3 -void LoadLevel(int level_num); +void LoadLevel(int level_num,int page_in_textures); extern void gameseq_remove_unused_players(); diff --git a/main/newdemo.c b/main/newdemo.c index 0b43eb34c..00089e2bd 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -2587,8 +2587,7 @@ int newdemo_read_frame_information(int rewrite) return -1; } #endif - LoadLevel((int)loaded_level); - piggy_load_level_data(); + LoadLevel((int)loaded_level,1); nd_playback_v_cntrlcen_destroyed = 0; reset_palette_add(); // get palette back to normal @@ -2675,8 +2674,7 @@ void newdemo_goto_end(int to_rewrite) } if (level != Current_level_num) { - LoadLevel(level); - piggy_load_level_data(); + LoadLevel(level,1); } } else From 438611ca9debd6cd67b615f45e39f060f29357bf Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 22:57:04 +0000 Subject: [PATCH 15/74] Add create_smart_children parameter num_smart_children to match D2X --- main/fireball.c | 3 ++- main/laser.c | 5 ++--- main/laser.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main/fireball.c b/main/fireball.c index 756ade49a..aeb3bd1f1 100644 --- a/main/fireball.c +++ b/main/fireball.c @@ -189,7 +189,8 @@ object *object_create_badass_explosion(object *objp, short segnum, vms_vector * rval = object_create_explosion_sub(objp, segnum, position, size, vclip_type, maxdamage, maxdistance, maxforce, parent ); if ((objp != NULL) && (objp->type == OBJ_WEAPON)) - create_smart_children(objp); +#define NUM_SMART_CHILDREN 6 + create_smart_children(objp, NUM_SMART_CHILDREN); return rval; } diff --git a/main/laser.c b/main/laser.c index c8b6cf169..9bb36da33 100644 --- a/main/laser.c +++ b/main/laser.c @@ -1252,7 +1252,6 @@ int do_laser_firing(int objnum, int weapon_num, int level, int flags, int nfires #define MAX_SMART_DISTANCE (F1_0*150) #define MAX_OBJDISTS 30 -#define NUM_SMART_CHILDREN 6 typedef struct { int objnum; @@ -1296,7 +1295,7 @@ int create_homing_missile(object *objp, int goal_obj, int objtype, int make_soun // ------------------------------------------------------------------------------------------- // Create the children of a smart bomb, which is a bunch of homing missiles. -void create_smart_children(object *objp) +void create_smart_children(object *objp, int num_smart_children) { int parent_type; int numobjs=0, objnum = 0, sel_objnum, last_sel_objnum = -1; @@ -1358,7 +1357,7 @@ void create_smart_children(object *objp) blob_id = ((N_weapon_types> 15]; if (numobjs > 1) while (sel_objnum == last_sel_objnum) diff --git a/main/laser.h b/main/laser.h index 3a8d121c1..d63c2dcb5 100644 --- a/main/laser.h +++ b/main/laser.h @@ -92,7 +92,7 @@ extern int do_laser_firing(int objnum, int weapon_id, int level, int flags, int // Returns object number of laser fired or -1 if not possible to fire laser. int Laser_create_new_easy(vms_vector * direction, vms_vector * position, int parent, int weapon_type, int make_sound); -extern void create_smart_children(struct object *objp); +extern void create_smart_children(struct object *objp, int num_smart_children); extern int object_to_object_visibility(struct object *obj1, struct object *obj2, int trans_type); extern int Muzzle_queue_index; From d5657d7cf8bffdc4432c0f21409dec11502056f7 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 9 Mar 2013 20:29:20 +0000 Subject: [PATCH 16/74] Remove unused include/tracker/tracker.h --- include/tracker/tracker.h | 41 --------------------------------------- main/config.c | 1 - 2 files changed, 42 deletions(-) delete mode 100644 include/tracker/tracker.h diff --git a/include/tracker/tracker.h b/include/tracker/tracker.h deleted file mode 100644 index 6e8aed249..000000000 --- a/include/tracker/tracker.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - This is code needed to contact and interact with the tracker server. Contact - me at kip@thevertigo.com for comments. Yes, I thought about GGZ, but it wasn't - fully portable at the time of writing. - - This file and the acompanying tracker_client.c file are free software; - you can redistribute them and/or modify them under the terms of the GNU - Library General Public License as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later version. - - These files are distributed in the hope that they will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with these files; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -// Multiple include protection... -#ifndef _TRACKER_H -#define _TRACKER_H - -// Don't bother with any of this if networking support isn't enabled... -#ifdef NETWORK - -// The default game tracker server address... -#define TRACKER_DEFAULT_SERVER "localhost" - -// Tracker port... -#define TRACKER_PORT 7988 - -// Invoke the browse UDP/IP network game GUI... -void TrackerBrowseMenu(); - -#endif // NETWORK - -#endif // _TRACKER_CLIENT_H - diff --git a/main/config.c b/main/config.c index 5c3433c0f..2a057ecd7 100644 --- a/main/config.c +++ b/main/config.c @@ -33,7 +33,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "player.h" #include "mission.h" #include "physfsx.h" -#include "tracker/tracker.h" struct Cfg GameCfg; From 7143a6927a2d557aade067c30201971dd6a565d3 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 23 Mar 2013 19:15:12 +0000 Subject: [PATCH 17/74] Remove unused newdemo_record_trigger --- main/newdemo.c | 10 ---------- main/newdemo.h | 1 - main/switch.c | 3 --- 3 files changed, 14 deletions(-) diff --git a/main/newdemo.c b/main/newdemo.c index 00089e2bd..60f185397 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -1011,16 +1011,6 @@ void newdemo_record_wall_hit_process( int segnum, int side, int damage, int play start_time(); } -void newdemo_record_trigger( int segnum, int side, int objnum ) -{ - stop_time(); - nd_write_byte( ND_EVENT_TRIGGER ); - nd_write_int( segnum ); - nd_write_int( side ); - nd_write_int( objnum ); - start_time(); -} - void newdemo_record_hostage_rescued( int hostage_number ) { stop_time(); diff --git a/main/newdemo.h b/main/newdemo.h index 33b36029f..bc300a84d 100644 --- a/main/newdemo.h +++ b/main/newdemo.h @@ -57,7 +57,6 @@ extern void newdemo_record_sound_3d_once( int soundno, int angle, int volume ); extern void newdemo_record_sound_once( int soundno ); extern void newdemo_record_sound( int soundno ); extern void newdemo_record_wall_hit_process( int segnum, int side, int damage, int playernum ); -extern void newdemo_record_trigger( int segnum, int side, int objnum ); extern void newdemo_record_hostage_rescued( int hostage_num ); extern void newdemo_record_morph_frame(); extern void newdemo_record_player_stats(int shields, int energy, int score ); diff --git a/main/switch.c b/main/switch.c index 5fc74fe4b..3e9dd6edf 100644 --- a/main/switch.c +++ b/main/switch.c @@ -196,9 +196,6 @@ void check_trigger(segment *seg, short side, short objnum) if (objnum == Players[Player_num].objnum) { -// if ( Newdemo_state == ND_STATE_RECORDING ) -// newdemo_record_trigger( seg-Segments, side, objnum ); - if ( Newdemo_state == ND_STATE_PLAYBACK ) return; From cede0b90b26cbe5b618426bcf671f15d8a117624 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 17:53:04 +0000 Subject: [PATCH 18/74] Remove unused flags in main/player.h --- main/player.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main/player.h b/main/player.h index f1ca2059f..b6f7b38ed 100644 --- a/main/player.h +++ b/main/player.h @@ -44,12 +44,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define PLAYER_FLAGS_BLUE_KEY 2 // Player has blue key #define PLAYER_FLAGS_RED_KEY 4 // Player has red key #define PLAYER_FLAGS_GOLD_KEY 8 // Player has gold key -#define PLAYER_FLAGS_IMMATERIAL 16 // Player is immaterial -#define PLAYER_FLAGS_MAP_ENEMIES 32 // Player can see enemies on map #define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map -#define PLAYER_FLAGS_RADAR_ENEMIES 128 // Player can see enemies on radar -#define PLAYER_FLAGS_RADAR_POWERUPS 256 // Player can see powerups -// #define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally -- OBSOLETE BY CHEAT STRUCT #define PLAYER_FLAGS_QUAD_LASERS 1024 // Player shoots 4 at once #define PLAYER_FLAGS_CLOAKED 2048 // Player is cloaked for awhile #define PLAYER_FLAGS_AFTERBURNER 4096 // Player's afterburner is engaged From 986f0ae4f84e65cc6dc1dfd08829706c27662533 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 17:53:04 +0000 Subject: [PATCH 19/74] Remove afterburner support stubs --- main/controls.c | 8 +------- main/gameseq.c | 2 +- main/object.c | 1 - main/player.h | 2 -- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/main/controls.c b/main/controls.c index d463bf8e1..449b6c432 100644 --- a/main/controls.c +++ b/main/controls.c @@ -38,8 +38,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. void read_flying_controls( object * obj ) { - fix afterburner_thrust; - Assert(FrameTime > 0); //Get MATT if hit this! // Couldn't the "50" in the next three lines be changed to "64" with no ill effect? @@ -47,12 +45,8 @@ void read_flying_controls( object * obj ) obj->mtype.phys_info.rotthrust.y = Controls.heading_time; obj->mtype.phys_info.rotthrust.z = Controls.bank_time; - afterburner_thrust = 0; - if (Players[Player_num].flags & PLAYER_FLAGS_AFTERBURNER) - afterburner_thrust = FrameTime; - // Set object's thrust vector for forward/backward - vm_vec_copy_scale(&obj->mtype.phys_info.thrust,&obj->orient.fvec, Controls.forward_thrust_time + afterburner_thrust ); + vm_vec_copy_scale(&obj->mtype.phys_info.thrust,&obj->orient.fvec, Controls.forward_thrust_time ); // slide left/right vm_vec_scale_add2(&obj->mtype.phys_info.thrust,&obj->orient.rvec, Controls.sideways_thrust_time ); diff --git a/main/gameseq.c b/main/gameseq.c index 3d0b14d2f..4122685e9 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -374,7 +374,7 @@ void init_player_stats_new_ship(ubyte pnum) Players[pnum].secondary_ammo[0] = 2 + NDL - Difficulty_level; Players[pnum].primary_weapon_flags = HAS_LASER_FLAG; Players[pnum].secondary_weapon_flags = HAS_CONCUSSION_FLAG; - Players[pnum].flags &= ~(PLAYER_FLAGS_QUAD_LASERS | PLAYER_FLAGS_AFTERBURNER | PLAYER_FLAGS_CLOAKED | PLAYER_FLAGS_INVULNERABLE); + Players[pnum].flags &= ~(PLAYER_FLAGS_QUAD_LASERS | PLAYER_FLAGS_CLOAKED | PLAYER_FLAGS_INVULNERABLE); Players[pnum].cloak_time = 0; Players[pnum].invulnerable_time = 0; Players[pnum].homing_object_dist = -F1_0; diff --git a/main/object.c b/main/object.c index a3986cd0e..f11b31b3d 100644 --- a/main/object.c +++ b/main/object.c @@ -1502,7 +1502,6 @@ void start_player_death_sequence(object *player) PaletteRedAdd = 40; Player_is_dead = 1; - Players[Player_num].flags &= ~(PLAYER_FLAGS_AFTERBURNER); vm_vec_zero(&player->mtype.phys_info.rotthrust); //this line commented by WraithX vm_vec_zero(&player->mtype.phys_info.thrust); diff --git a/main/player.h b/main/player.h index b6f7b38ed..b186fb8ad 100644 --- a/main/player.h +++ b/main/player.h @@ -47,9 +47,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map #define PLAYER_FLAGS_QUAD_LASERS 1024 // Player shoots 4 at once #define PLAYER_FLAGS_CLOAKED 2048 // Player is cloaked for awhile -#define PLAYER_FLAGS_AFTERBURNER 4096 // Player's afterburner is engaged -#define AFTERBURNER_MAX_TIME (F1_0*5) // Max time afterburner can be on. #define CALLSIGN_LEN 8 // so can use as filename (was: 12) // Amount of time player is cloaked. From 4fd6a17e9b9a3c44941d08594c01bc50bda7a709 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 17:53:04 +0000 Subject: [PATCH 20/74] Remove write-only robot fields fire_power[] and shield[] in main/robot.h --- main/bmread.c | 6 ++++-- main/robot.c | 4 ++-- main/robot.h | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main/bmread.c b/main/bmread.c index 379d8c7fb..cdf7b61b3 100644 --- a/main/bmread.c +++ b/main/bmread.c @@ -952,8 +952,10 @@ void bm_read_robot_ai(int skip) get4fix(robptr->firing_wait); get4byte(robptr->rapidfire_count); get4fix(robptr->turn_time); - get4fix(robptr->fire_power); - get4fix(robptr->shield); + fix fire_power[NDL]; // damage done by a hit from this robot + fix shield[NDL]; // shield strength of this robot + get4fix(fire_power); + get4fix(shield); get4fix(robptr->max_speed); get4fix(robptr->circle_distance); get4byte(robptr->evade_speed); diff --git a/main/robot.c b/main/robot.c index 4658f3389..6185cf9bf 100644 --- a/main/robot.c +++ b/main/robot.c @@ -251,9 +251,9 @@ int robot_info_read_n(robot_info *ri, int n, PHYSFS_file *fp) for (j = 0; j < NDL; j++) ri[i].turn_time[j] = PHYSFSX_readFix(fp); for (j = 0; j < NDL; j++) - ri[i].fire_power[j] = PHYSFSX_readFix(fp); + PHYSFSX_readFix(fp); for (j = 0; j < NDL; j++) - ri[i].shield[j] = PHYSFSX_readFix(fp); + PHYSFSX_readFix(fp); for (j = 0; j < NDL; j++) ri[i].max_speed[j] = PHYSFSX_readFix(fp); for (j = 0; j < NDL; j++) diff --git a/main/robot.h b/main/robot.h index df7b05c5d..5b69dfc0b 100644 --- a/main/robot.h +++ b/main/robot.h @@ -63,8 +63,6 @@ typedef struct robot_info { fix field_of_view[NDL]; // compare this value with forward_vector.dot.vector_to_player, if field_of_view <, then robot can see player fix firing_wait[NDL]; // time in seconds between shots fix turn_time[NDL]; // time in seconds to rotate 360 degrees in a dimension - fix fire_power[NDL]; // damage done by a hit from this robot - fix shield[NDL]; // shield strength of this robot fix max_speed[NDL]; // maximum speed attainable by this robot fix circle_distance[NDL]; // distance at which robot circles player From ccbd566860cbfd514b9311126195641060cad462 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 17:53:04 +0000 Subject: [PATCH 21/74] Remove unused declarations in main/screens.h --- main/screens.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/main/screens.h b/main/screens.h index 4a6da851f..4954220c2 100644 --- a/main/screens.h +++ b/main/screens.h @@ -116,9 +116,6 @@ extern grs_canvas *Canv_editor_game; // the game window on the editor screen //from game.c extern int set_screen_mode(int sm); // True = editor screen -extern u_int32_t menu_screen_mode; -extern int menu_use_game_res; -#define MENU_SCREEN_MODE (menu_use_game_res?Game_screen_mode:menu_screen_mode) #endif From 9cf2df4400d19b7715c0537123def2f070b5b85e Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 9 Mar 2013 20:29:20 +0000 Subject: [PATCH 22/74] Remove unused main/script.h --- main/collide.c | 7 ------- main/gameseq.c | 8 -------- main/script.h | 13 ------------- 3 files changed, 28 deletions(-) delete mode 100644 main/script.h diff --git a/main/collide.c b/main/collide.c index cb20d5d29..724e756fd 100644 --- a/main/collide.c +++ b/main/collide.c @@ -67,9 +67,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "editor/editor.h" #endif #include "collide.h" -#ifdef SCRIPT -#include "script.h" -#endif #define WALL_DAMAGE_SCALE (128) // Was 32 before 8:55 am on Thursday, September 15, changed by MK, walls were hurting me more than robots! #define WALL_DAMAGE_THRESHOLD (F1_0/3) @@ -851,10 +848,6 @@ int apply_damage_to_robot(object *robot, fix damage, int killer_objnum) if (robot->shields < 0) { -#ifdef SCRIPT - script_notify(NT_ROBOT_DIED, robot - Objects); -#endif - #ifndef SHAREWARE #ifdef NETWORK if (Game_mode & GM_MULTI) { diff --git a/main/gameseq.c b/main/gameseq.c index 4122685e9..5f00de5af 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -97,9 +97,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "editor/editor.h" #endif #include "custom.h" -#ifdef SCRIPT -#include "script.h" -#endif #include "byteswap.h" #include "segment.h" #include "gameseg.h" @@ -683,11 +680,6 @@ void StartNewGame(int start_level) N_players = 1; -#ifdef SCRIPT - script_reset(); - script_load("default.scr"); -#endif - StartNewLevel(start_level); Players[Player_num].starting_level = start_level; // Mark where they started diff --git a/main/script.h b/main/script.h deleted file mode 100644 index 2f007ff08..000000000 --- a/main/script.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _SCRIPT_H -#define _SCRIPT_H - -void script_notify(int nt_type, ...); -#define NT_ROBOT_DIED 1 - -void script_init(); -void script_reset(); // clear all functions and variabeles -int script_load(char *filename); -//int script_exec(char *function, char *args, ...); -void script_done(); - -#endif From ea264c8d429d96ac56d1fd57ffa6e95f9f38750b Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 16 Mar 2013 18:24:52 +0000 Subject: [PATCH 23/74] Add support for out-of-tree build --- SConstruct | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 126a4f127..bc339bfe3 100644 --- a/SConstruct +++ b/SConstruct @@ -51,6 +51,26 @@ class DXXProgram: self.use_udp = int(ARGUMENTS.get('use_udp', 1)) self.use_tracker = int(ARGUMENTS.get('use_tracker', 1)) self.verbosebuild = int(ARGUMENTS.get('verbosebuild', 0)) + builddir_prefix = ARGUMENTS.get('builddir_prefix', None) + builddir_suffix = ARGUMENTS.get('builddir_suffix', None) + default_builddir = builddir_prefix or '' + if builddir_prefix is not None or builddir_suffix is not None: + if os.environ.has_key('CC'): + default_builddir += '%s-' % os.path.basename(os.environ['CC']) + for a in ( + ('debug', 'dbg'), + ('profiler', 'prf'), + ('editor', 'ed'), + ('opengl', 'ogl'), + ('opengles', 'es'), + ): + if getattr(self, a[0]): + default_builddir += a[1] + if builddir_suffix is not None: + default_builddir += builddir_prefix + self.builddir = ARGUMENTS.get('builddir', default_builddir) + if self.builddir != '' and self.builddir[-1:] != '/': + self.builddir += '/' # Base class for platform-specific settings processing class _PlatformSettings: def __init__(self): @@ -118,6 +138,8 @@ class DXXProgram: self.env = Environment(ENV = os.environ, tools = ['mingw']) self.VERSION_STRING = ' v' + str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) + '.' + str(self.VERSION_MICRO) self.env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(self.PROGRAM_NAME) + '\\"'), ('DXX_VERSION_MAJORi', str(self.VERSION_MAJOR)), ('DXX_VERSION_MINORi', str(self.VERSION_MINOR)), ('DXX_VERSION_MICROi', str(self.VERSION_MICRO))]) + if self.user_settings.builddir != '': + self.env.VariantDir(self.user_settings.builddir, '.', duplicate=0) # Prettier build messages...... if (self.user_settings.verbosebuild == 0): @@ -478,13 +500,13 @@ class D1XProgram(DXXProgram): def register_program(self): env = self.env exe_target = os.path.join(self.srcdir, self.target) + objects = [self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, os.path.splitext(s)[0], self.env["OBJSUFFIX"]), source=s) for s in self.common_sources] versid_cppdefines=env['CPPDEFINES'][:] if self.user_settings.extra_version: versid_cppdefines.append(('DESCENT_VERSION_EXTRA', '\\"%s\\"' % self.user_settings.extra_version)) - env.Object(source = ['main/vers_id.c'], CPPDEFINES=versid_cppdefines) - versid_sources = ['main/vers_id%s' % env['OBJSUFFIX']] + objects.append(self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, 'main/vers_id', self.env["OBJSUFFIX"]), source='main/vers_id.c', CPPDEFINES=versid_cppdefines)) # finally building program... - env.Program(target=str(exe_target), source = self.common_sources + versid_sources, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) + env.Program(target='%s%s' % (self.user_settings.builddir, str(exe_target)), source = objects, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) if (sys.platform != 'darwin'): env.Install(self.user_settings.BIN_DIR, str(exe_target)) env.Alias('install', self.user_settings.BIN_DIR) From d1a095f916c94dce05df9388f13221af055d6305 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 23:38:52 +0000 Subject: [PATCH 24/74] Remove unused hostage code --- main/game.c | 2 -- main/hostage.c | 18 +----------------- main/hostage.h | 8 -------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/main/game.c b/main/game.c index 6628f8a15..31ca0c331 100644 --- a/main/game.c +++ b/main/game.c @@ -151,8 +151,6 @@ void init_game() { init_objects(); - hostage_init(); - init_special_effects(); init_exploding_walls(); diff --git a/main/hostage.c b/main/hostage.c index 0bc8ed024..e9f6d5d68 100644 --- a/main/hostage.c +++ b/main/hostage.c @@ -42,15 +42,6 @@ int N_hostage_types = 0; // Number of hostage types int Hostage_vclip_num[MAX_HOSTAGE_TYPES]; // vclip num for each tpye of hostage hostage_data Hostages[MAX_HOSTAGES]; // Data for each hostage in mine -//------------- Internally used hostage variables -------------------------------------------------- -static fix Hostage_animation_time=-1; // How long the rescue sequence has been playing - units are frames, not seconds - -1 means not playing - -//---------------- Initializes the hostage system ---------------------------------------------------- -void hostage_init() -{ - Hostage_animation_time=-1; -} - //-------------- Renders a hostage ---------------------------------------------------------------- void draw_hostage(object *obj) { @@ -83,13 +74,6 @@ void hostage_rescue( int hostage_number ) //------------------- Useful macros and variables --------------- -void hostage_remove_char( char * s, char c ) -{ - char *p; - p = strchr(s,c); - if (p) *p = '\0'; -} - int hostage_is_valid( int hostage_num ) { if ( hostage_num < 0 ) return 0; if ( hostage_num >= MAX_HOSTAGES ) return 0; @@ -109,7 +93,7 @@ int hostage_object_is_valid( int objnum ) { } -int hostage_get_next_slot() { +static int hostage_get_next_slot() { int i; for (i=0; i Date: Sun, 24 Mar 2013 23:48:24 +0000 Subject: [PATCH 25/74] Remove write-only hostage text --- editor/ehostage.c | 5 ----- main/hostage.c | 2 -- main/hostage.h | 1 - 3 files changed, 8 deletions(-) diff --git a/editor/ehostage.c b/editor/ehostage.c index ffec59944..1a6ddc8fe 100644 --- a/editor/ehostage.c +++ b/editor/ehostage.c @@ -370,9 +370,6 @@ int hostage_dialog_handler(UI_DIALOG *dlg, d_event *event, hostage_dialog *h) //------------------------------------------------------------ if (LastHostageIndex != CurrentHostageIndex ) { - if ( CurrentHostageIndex > -1 ) - strcpy( h->hostageText->text, Hostages[CurrentHostageIndex].text ); - else strcpy(h->hostageText->text, " " ); h->hostageText->position = strlen(h->hostageText->text); @@ -386,8 +383,6 @@ int hostage_dialog_handler(UI_DIALOG *dlg, d_event *event, hostage_dialog *h) // If any of the radio buttons that control the mode are set, then // update the cooresponding AI state. //------------------------------------------------------------ - if ( CurrentHostageIndex > -1 ) - strcpy( Hostages[CurrentHostageIndex].text, h->hostageText->text ); //------------------------------------------------------------ // Redraw the object in the little 64x64 box diff --git a/main/hostage.c b/main/hostage.c index e9f6d5d68..89ab2637c 100644 --- a/main/hostage.c +++ b/main/hostage.c @@ -112,7 +112,6 @@ void hostage_init_info( int objnum ) { //Hostages[i].type = 0; Hostages[i].vclip_num = -1; //Hostages[i].sound_num = -1; - strcpy( Hostages[i].text, "\0" ); Objects[objnum].id = i; } @@ -127,7 +126,6 @@ void hostage_init_all() //Hostages[i].type = 0; Hostages[i].vclip_num = -1; //Hostages[i].sound_num = -1; - strcpy( Hostages[i].text, "\0" ); } //@@hostage_read_global_messages(); diff --git a/main/hostage.h b/main/hostage.h index a1154085c..57c446253 100644 --- a/main/hostage.h +++ b/main/hostage.h @@ -128,7 +128,6 @@ typedef struct hostage_data { //ubyte type; short vclip_num; //short sound_num; - char text[HOSTAGE_MESSAGE_LEN]; } hostage_data; extern int N_hostage_types; From 19c95a684a17fff066f1ec8d42c874c9bcb98622 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 23:51:53 +0000 Subject: [PATCH 26/74] Remove unused hostage vclip_num --- editor/ehostage.c | 10 ---------- main/hostage.c | 2 -- main/hostage.h | 1 - 3 files changed, 13 deletions(-) diff --git a/editor/ehostage.c b/editor/ehostage.c index 1a6ddc8fe..09a11e070 100644 --- a/editor/ehostage.c +++ b/editor/ehostage.c @@ -397,18 +397,9 @@ int hostage_dialog_handler(UI_DIALOG *dlg, d_event *event, hostage_dialog *h) h->time = Temp; if (CurrentHostageIndex > -1 ) { - int vclip_num; - - vclip_num = Hostages[CurrentHostageIndex].vclip_num; - - Assert(vclip_num != -1); - gr_set_current_canvas( h->hostageViewBox->canvas ); - if ( vclip_num > -1 ) { - } else { gr_clear_canvas( CGREY ); - } } else { // no hostage, so just blank out gr_set_current_canvas( h->hostageViewBox->canvas ); @@ -425,7 +416,6 @@ int hostage_dialog_handler(UI_DIALOG *dlg, d_event *event, hostage_dialog *h) if ( CurrentHostageIndex > -1 ) { ui_dprintf_at( MainWindow, 10, 15, "Hostage: %d Object: %d", CurrentHostageIndex, Hostages[CurrentHostageIndex].objnum ); //@@ui_dprintf_at( MainWindow, 10, 73, "Type: %d Sound: %d ", Hostages[CurrentHostageIndex].type, Hostages[CurrentHostageIndex].sound_num ); - ui_dprintf_at( MainWindow, 10, 73, "Face: %d ", Hostages[CurrentHostageIndex].vclip_num); } else { ui_dprintf_at( MainWindow, 10, 15, "Hostage: none " ); //@@ui_dprintf_at( MainWindow, 10, 73, "Type: Sound: " ); diff --git a/main/hostage.c b/main/hostage.c index 89ab2637c..1a1d7d5f4 100644 --- a/main/hostage.c +++ b/main/hostage.c @@ -110,7 +110,6 @@ void hostage_init_info( int objnum ) { Hostages[i].objnum = objnum; Hostages[i].objsig = Objects[objnum].signature; //Hostages[i].type = 0; - Hostages[i].vclip_num = -1; //Hostages[i].sound_num = -1; Objects[objnum].id = i; } @@ -124,7 +123,6 @@ void hostage_init_all() Hostages[i].objnum = -1; Hostages[i].objsig = -1; //Hostages[i].type = 0; - Hostages[i].vclip_num = -1; //Hostages[i].sound_num = -1; } diff --git a/main/hostage.h b/main/hostage.h index 57c446253..b6f1bce47 100644 --- a/main/hostage.h +++ b/main/hostage.h @@ -126,7 +126,6 @@ typedef struct hostage_data { short objnum; int objsig; //ubyte type; - short vclip_num; //short sound_num; } hostage_data; From c0ae3d926436205c2a0865e25b39b5f93a05e124 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 01:54:39 +0000 Subject: [PATCH 27/74] Move player_ship_read bm.c -> player.c --- main/bm.c | 17 ----------------- main/player.c | 16 ++++++++++++++++ main/player.h | 5 +++++ 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/main/bm.c b/main/bm.c index faa0a6355..4a1417d3d 100644 --- a/main/bm.c +++ b/main/bm.c @@ -108,23 +108,6 @@ int tmap_info_read_n(tmap_info *ti, int n, PHYSFS_file *fp) return i; } -int player_ship_read(player_ship *ps, PHYSFS_file *fp) -{ - int i; - ps->model_num = PHYSFSX_readInt(fp); - ps->expl_vclip_num = PHYSFSX_readInt(fp); - ps->mass = PHYSFSX_readFix(fp); - ps->drag = PHYSFSX_readFix(fp); - ps->max_thrust = PHYSFSX_readFix(fp); - ps->reverse_thrust = PHYSFSX_readFix(fp); - ps->brakes = PHYSFSX_readFix(fp); - ps->wiggle = PHYSFSX_readFix(fp); - ps->max_rotthrust = PHYSFSX_readFix(fp); - for (i = 0; i < N_PLAYER_GUNS; i++) - PHYSFSX_readVector(&ps->gun_points[i], fp); - return i; -} - void gamedata_close() { free_polygon_models(); diff --git a/main/player.c b/main/player.c index d7fd00e7b..4731baab3 100644 --- a/main/player.c +++ b/main/player.c @@ -43,3 +43,19 @@ void player_rw_swap(player_rw *p, int swap) p->hostages_total = SWAPSHORT(p->hostages_total); p->homing_object_dist = SWAPINT(p->homing_object_dist); } + +void player_ship_read(player_ship *ps, PHYSFS_file *fp) +{ + int i; + ps->model_num = PHYSFSX_readInt(fp); + ps->expl_vclip_num = PHYSFSX_readInt(fp); + ps->mass = PHYSFSX_readFix(fp); + ps->drag = PHYSFSX_readFix(fp); + ps->max_thrust = PHYSFSX_readFix(fp); + ps->reverse_thrust = PHYSFSX_readFix(fp); + ps->brakes = PHYSFSX_readFix(fp); + ps->wiggle = PHYSFSX_readFix(fp); + ps->max_rotthrust = PHYSFSX_readFix(fp); + for (i = 0; i < N_PLAYER_GUNS; i++) + PHYSFSX_readVector(&ps->gun_points[i], fp); +} diff --git a/main/player.h b/main/player.h index b186fb8ad..e19eb78df 100644 --- a/main/player.h +++ b/main/player.h @@ -181,6 +181,11 @@ extern int Player_num; // The player number who is on the console. extern player Players[MAX_PLAYERS]; // Misc player info extern player_ship *Player_ship; +/* + * reads a player_ship structure from a PHYSFS_file + */ +void player_ship_read(player_ship *ps, PHYSFS_file *fp); + void player_rw_swap(player_rw *p, int swap); #endif From 7b8fa4db3d9249abe871dbe446309118cbe9d83d Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 02:11:09 +0000 Subject: [PATCH 28/74] Remove unused gauge declarations --- main/gauges.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/main/gauges.h b/main/gauges.h index 114c8d094..9bbf6e6e4 100644 --- a/main/gauges.h +++ b/main/gauges.h @@ -34,8 +34,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. extern bitmap_index Gauges[MAX_GAUGE_BMS_MAC]; // Array of all gauge bitmaps. -extern void show_score(); -extern void show_score_added(); extern void add_points_to_score(); extern void add_bonus_points_to_score(); @@ -44,19 +42,14 @@ void init_gauges(void); void close_gauges(void); void cockpit_decode_alpha(grs_bitmap *bm); void show_mousefs_indicator(int mx, int my, int mz, int x, int y, int size); -extern void check_erase_message(void); extern void draw_hud(); // draw all the HUD stuff extern void player_dead_message(void); //extern void say_afterburner_status(void); -// fills in the coords of the hostage video window -void get_hostage_window_coords(int *x, int *y, int *w, int *h); - // from testgaug.c -void gauge_frame(void); extern void update_laser_weapon_info(void); extern void play_homing_warning(void); From 5cc09c974aadaa3f5f3fe0ce32a3fc186e960c63 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 22:27:04 +0000 Subject: [PATCH 29/74] Make blast_blastable_wall match D2X --- main/wall.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/main/wall.c b/main/wall.c index cd50e69d4..539be067f 100644 --- a/main/wall.c +++ b/main/wall.c @@ -250,31 +250,31 @@ void blast_blastable_wall(segment *seg, int side) { int Connectside; segment *csegp; - int a, n; + int a, n, cwall_num; Assert(seg->sides[side].wall_num != -1); csegp = &Segments[seg->children[side]]; Connectside = find_connect_side(seg, csegp); Assert(Connectside != -1); - + cwall_num = csegp->sides[Connectside].wall_num; kill_stuck_objects(seg->sides[side].wall_num); - kill_stuck_objects(csegp->sides[Connectside].wall_num); - - a = Walls[seg->sides[side].wall_num].clip_num; - n = WallAnims[a].num_frames; - - if (!(WallAnims[Walls[seg->sides[side].wall_num].clip_num].flags & WCF_EXPLODES)) - wall_set_tmap_num(seg,side,csegp,Connectside,a,n-1); - - Walls[seg->sides[side].wall_num].flags |= WALL_BLASTED; - Walls[csegp->sides[Connectside].wall_num].flags |= WALL_BLASTED; + if (cwall_num > -1) + kill_stuck_objects(cwall_num); //if this is an exploding wall, explode it if (WallAnims[Walls[seg->sides[side].wall_num].clip_num].flags & WCF_EXPLODES) explode_wall(seg-Segments,side); -} + else { + a = Walls[seg->sides[side].wall_num].clip_num; + n = WallAnims[a].num_frames; + wall_set_tmap_num(seg,side,csegp,Connectside,a,n-1); + Walls[seg->sides[side].wall_num].flags |= WALL_BLASTED; + if (cwall_num > -1) + Walls[cwall_num].flags |= WALL_BLASTED; + } +} //----------------------------------------------------------------- // Destroys a blastable wall. From 6eb53cfea26fe26b36bab5306581201c20abb15b Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 22:53:12 +0000 Subject: [PATCH 30/74] Add unused multi_send_door_open parameter 'flag' to match D2X --- main/multi.c | 4 ++-- main/multi.h | 2 +- main/net_udp.c | 4 ++-- main/wall.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main/multi.c b/main/multi.c index 58044b65f..83e2767e7 100644 --- a/main/multi.c +++ b/main/multi.c @@ -2823,9 +2823,9 @@ multi_send_decloak(void) multi_send_data(multibuf, 2, 2); } -void -multi_send_door_open(int segnum, int side) +void multi_send_door_open(int segnum, int side, ubyte flag) { + (void)flag; multibuf[0] = MULTI_DOOR_OPEN; PUT_INTEL_SHORT(multibuf+1, segnum ); multibuf[3] = (sbyte)side; diff --git a/main/multi.h b/main/multi.h index a5fd406c3..141ea3823 100644 --- a/main/multi.h +++ b/main/multi.h @@ -197,7 +197,7 @@ void multi_send_reappear(); void multi_send_kill(int objnum); void multi_send_remobj(int objnum); void multi_send_quit(int why); -void multi_send_door_open(int segnum, int side); +void multi_send_door_open(int segnum, int side,ubyte flag); void multi_send_create_explosion(int player_num); void multi_send_controlcen_fire(vms_vector *to_target, int gun_num, int objnum); void multi_send_cloak(void); diff --git a/main/net_udp.c b/main/net_udp.c index 5d73ecf38..6ad93de6d 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -1434,9 +1434,9 @@ void net_udp_send_door_updates(void) for (i = 0; i < Num_walls; i++) { if ((Walls[i].type == WALL_DOOR) && ((Walls[i].state == WALL_DOOR_OPENING) || (Walls[i].state == WALL_DOOR_WAITING))) - multi_send_door_open(Walls[i].segnum, Walls[i].sidenum); + multi_send_door_open(Walls[i].segnum, Walls[i].sidenum,0); else if ((Walls[i].type == WALL_BLASTABLE) && (Walls[i].flags & WALL_BLASTED)) - multi_send_door_open(Walls[i].segnum, Walls[i].sidenum); + multi_send_door_open(Walls[i].segnum, Walls[i].sidenum,0); else if ((Walls[i].type == WALL_BLASTABLE) && (Walls[i].hps != WALL_HPS)) multi_send_hostage_door_status(i); } diff --git a/main/wall.c b/main/wall.c index 539be067f..0812b0ee0 100644 --- a/main/wall.c +++ b/main/wall.c @@ -321,7 +321,7 @@ void wall_damage(segment *seg, int side, fix damage) blast_blastable_wall( seg, side ); #ifdef NETWORK if (Game_mode & GM_MULTI) - multi_send_door_open(seg-Segments, side); + multi_send_door_open(seg-Segments, side, 0); #endif } else @@ -865,7 +865,7 @@ int wall_hit_process(segment *seg, int side, fix damage, int playernum, object * wall_open_door(seg, side); #ifdef NETWORK if (Game_mode & GM_MULTI) - multi_send_door_open(seg-Segments, side); + multi_send_door_open(seg-Segments, side, 0); #endif } return WHP_DOOR; From 359120025e7ecd3c4dadea93d17bcf9f44da74d4 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 23:08:45 +0000 Subject: [PATCH 31/74] Use helper jointlist_read_n to match D2X --- main/robot.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/main/robot.c b/main/robot.c index 6185cf9bf..18c5590c5 100644 --- a/main/robot.c +++ b/main/robot.c @@ -216,12 +216,26 @@ void robot_set_angles(robot_info *r,polymodel *pm,vms_angvec angs[N_ANIM_STATES] } +/* + * reads n jointlist structs from a PHYSFS_file + */ +static int jointlist_read_n(jointlist *jl, int n, PHYSFS_file *fp) +{ + int i; + + for (i = 0; i < n; i++) { + jl[i].n_joints = PHYSFSX_readShort(fp); + jl[i].offset = PHYSFSX_readShort(fp); + } + return i; +} + /* * reads n robot_info structs from a PHYSFS_file */ int robot_info_read_n(robot_info *ri, int n, PHYSFS_file *fp) { - int i, j, k; + int i, j; for (i = 0; i < n; i++) { ri[i].model_num = PHYSFSX_readInt(fp); @@ -268,13 +282,9 @@ int robot_info_read_n(robot_info *ri, int n, PHYSFS_file *fp) ri[i].see_sound = PHYSFSX_readByte(fp); ri[i].attack_sound = PHYSFSX_readByte(fp); ri[i].claw_sound = PHYSFSX_readByte(fp); - - for (j = 0; j < MAX_GUNS + 1; j++) { - for (k = 0; k < N_ANIM_STATES; k++) { - ri[i].anim_states[j][k].n_joints = PHYSFSX_readShort(fp); - ri[i].anim_states[j][k].offset = PHYSFSX_readShort(fp); - } - } + + for (j = 0; j < MAX_GUNS + 1; j++) + jointlist_read_n(ri[i].anim_states[j], N_ANIM_STATES, fp); ri[i].always_0xabcd = PHYSFSX_readInt(fp); } From 44fa05fdbdc985aeaa73afd97c8ef34eecf31368 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 02:36:00 +0000 Subject: [PATCH 32/74] Reorder differences to match D2X --- main/inferno.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/inferno.c b/main/inferno.c index aa91cfdbb..e43e6222b 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -91,6 +91,7 @@ unsigned int descent_critical_deverror = 0; unsigned int descent_critical_errcode = 0; int HiresGFXAvailable = 0; +int MacHog = 0; // using a Mac hogfile? extern void arch_init(void); @@ -107,9 +108,9 @@ void print_commandline_help() printf( " -lowmem Lowers animation detail for better performance with\n\t\t\t\tlow memory\n"); printf( " -pilot Select pilot automatically\n"); printf( " -autodemo Start in demo mode\n"); - printf( " -notitles Skip title screens\n"); printf( " -window Run the game in a window\n"); printf( " -noborders Do not show borders in window mode\n"); + printf( " -notitles Skip title screens\n"); printf( "\n Controls:\n\n"); printf( " -nocursor Hide mouse cursor\n"); @@ -279,7 +280,6 @@ int standard_handler(d_event *event) return 0; } -int MacHog = 0; // using a Mac hogfile? jmp_buf LeaveEvents; #define PROGNAME argv[0] From cfb50a40defe529f98de1e7f5c30948257d8331a Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 02:45:23 +0000 Subject: [PATCH 33/74] Avoid using #ifdef inside Error string on hog failure --- main/inferno.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/main/inferno.c b/main/inferno.c index e43e6222b..3c5fed5e0 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -319,18 +319,29 @@ int main(int argc, char *argv[]) return(0); if (! PHYSFSX_contfile_init("descent.hog", 1)) - Error("Could not find a valid hog file (descent.hog)\nPossible locations are:\n" +#define DXX_NAME_NUMBER "1" +#define DXX_HOGFILE_NAMES "descent.hog" #if defined(__unix__) && !defined(__APPLE__) - "\t$HOME/.d1x-rebirth\n" +#define DXX_HOGFILE_PROGRAM_DATA_DIRECTORY \ + "\t$HOME/.d" DXX_NAME_NUMBER "x-rebirth\n" \ "\t" SHAREPATH "\n" #else - "\tDirectory containing D1X\n" +#define DXX_HOGFILE_PROGRAM_DATA_DIRECTORY \ + "\tDirectory containing D" DXX_NAME_NUMBER "X\n" #endif - "\tIn a subdirectory called 'Data'\n" #if (defined(__APPLE__) && defined(__MACH__)) || defined(macintosh) +#define DXX_HOGFILE_APPLICATION_BUNDLE \ "\tIn 'Resources' inside the application bundle\n" +#else +#define DXX_HOGFILE_APPLICATION_BUNDLE "" #endif - "Or use the -hogdir option to specify an alternate location."); +#define DXX_MISSING_HOGFILE_ERROR_TEXT \ + "Could not find a valid hog file (" DXX_HOGFILE_NAMES ")\nPossible locations are:\n" \ + DXX_HOGFILE_PROGRAM_DATA_DIRECTORY \ + "\tIn a subdirectory called 'Data'\n" \ + DXX_HOGFILE_APPLICATION_BUNDLE \ + "Or use the -hogdir option to specify an alternate location." + Error(DXX_MISSING_HOGFILE_ERROR_TEXT); switch (PHYSFSX_fsize("descent.hog")) { From 50d8a27541112be12d71cc4296a8becdc8a67d32 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 15:11:42 +0000 Subject: [PATCH 34/74] Combine date,time into Descent version con_printf --- main/inferno.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/inferno.c b/main/inferno.c index 3c5fed5e0..06e147b1c 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -354,8 +354,7 @@ int main(int argc, char *argv[]) load_text(); //print out the banner title - con_printf(CON_NORMAL, "%s", DESCENT_VERSION); // D1X version - con_printf(CON_NORMAL, " %s %s\n", __DATE__,__TIME__); + con_printf(CON_NORMAL, "%s %s %s\n", DESCENT_VERSION, __DATE__,__TIME__); // D1X version con_printf(CON_NORMAL, "This is a MODIFIED version of Descent, based on %s.\n", BASED_VERSION); con_printf(CON_NORMAL, "%s\n%s\n",TXT_COPYRIGHT,TXT_TRADEMARK); con_printf(CON_NORMAL, "Copyright (C) 2005-2011 Christian Beckhaeuser\n\n"); From 929f29dca95799f4079d0bb561968b7a4a191d62 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 9 Jun 2012 15:19:29 +0000 Subject: [PATCH 35/74] Support extra information, such as git describe, in version string --- SConstruct | 8 +++++++- main/inferno.c | 2 +- main/vers_id.c | 8 ++++++++ main/vers_id.h | 5 ++++- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 main/vers_id.c diff --git a/SConstruct b/SConstruct index 84e26fac3..848af49de 100644 --- a/SConstruct +++ b/SConstruct @@ -45,6 +45,7 @@ class DXXProgram: self.opengles = int(ARGUMENTS.get('opengles', 0)) self.asm = int(ARGUMENTS.get('asm', 0)) self.editor = int(ARGUMENTS.get('editor', 0)) + self.extra_version = ARGUMENTS.get('extra_version', None) self.sdlmixer = int(ARGUMENTS.get('sdlmixer', 1)) self.ipv6 = int(ARGUMENTS.get('ipv6', 0)) self.use_udp = int(ARGUMENTS.get('use_udp', 1)) @@ -478,8 +479,13 @@ class D1XProgram(DXXProgram): def register_program(self): env = self.env exe_target = os.path.join(self.srcdir, self.target) + versid_cppdefines=env['CPPDEFINES'][:] + if self.user_settings.extra_version: + versid_cppdefines.append(('DESCENT_VERSION_EXTRA', '\\"%s\\"' % self.user_settings.extra_version)) + env.Object(source = ['main/vers_id.c'], CPPDEFINES=versid_cppdefines) + versid_sources = ['main/vers_id%s' % env['OBJSUFFIX']] # finally building program... - env.Program(target=str(exe_target), source = self.common_sources, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) + env.Program(target=str(exe_target), source = self.common_sources + versid_sources, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) if (sys.platform != 'darwin'): env.Install(self.user_settings.BIN_DIR, str(exe_target)) env.Alias('install', self.user_settings.BIN_DIR) diff --git a/main/inferno.c b/main/inferno.c index 06e147b1c..89d5ce9eb 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -354,7 +354,7 @@ int main(int argc, char *argv[]) load_text(); //print out the banner title - con_printf(CON_NORMAL, "%s %s %s\n", DESCENT_VERSION, __DATE__,__TIME__); // D1X version + con_printf(CON_NORMAL, "%s %s\n", DESCENT_VERSION, g_descent_build_datetime); // D1X version con_printf(CON_NORMAL, "This is a MODIFIED version of Descent, based on %s.\n", BASED_VERSION); con_printf(CON_NORMAL, "%s\n%s\n",TXT_COPYRIGHT,TXT_TRADEMARK); con_printf(CON_NORMAL, "Copyright (C) 2005-2011 Christian Beckhaeuser\n\n"); diff --git a/main/vers_id.c b/main/vers_id.c new file mode 100644 index 000000000..e12042b1d --- /dev/null +++ b/main/vers_id.c @@ -0,0 +1,8 @@ +#include "vers_id.h" + +#ifndef DESCENT_VERSION_EXTRA +#define DESCENT_VERSION_EXTRA "v" VERSION +#endif + +const char g_descent_version[40] = "D1X-Rebirth " DESCENT_VERSION_EXTRA; +const char g_descent_build_datetime[20] = __DATE__ " " __TIME__; diff --git a/main/vers_id.h b/main/vers_id.h index 41358fc76..67250edc4 100644 --- a/main/vers_id.h +++ b/main/vers_id.h @@ -12,6 +12,9 @@ #define BASED_VERSION "Registered v1.5 Jan 5, 1996" #define VERSION DXX_VERSION_MAJOR "." DXX_VERSION_MINOR "." DXX_VERSION_MICRO -#define DESCENT_VERSION "D1X-Rebirth v" VERSION +#define DESCENT_VERSION g_descent_version + +extern const char g_descent_version[40]; +extern const char g_descent_build_datetime[20]; #endif /* _VERS_ID */ From ff1247fe72274412edb9899b858bb7a26b04fb74 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 20:29:16 +0000 Subject: [PATCH 36/74] Add stubs to make physics code more like D2X --- main/physics.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/main/physics.c b/main/physics.c index e64ec60f0..353701f86 100644 --- a/main/physics.c +++ b/main/physics.c @@ -180,11 +180,8 @@ int phys_seglist[MAX_FVI_SEGS],n_phys_segs; object *debug_obj=NULL; #endif -#define XYZ(v) (int)((v)->x),(int)((v)->y),(int)((v)->z) - -int Total_retries=0, Total_sims=0; - #ifndef NDEBUG +int Total_retries=0, Total_sims=0; int Dont_move_ai_objects=0; #endif @@ -233,7 +230,8 @@ void do_physics_sim_rot(object *obj) vm_vec_scale_add2(&obj->mtype.phys_info.rotvel,&accel,k); vm_vec_scale(&obj->mtype.phys_info.rotvel,f1_0-fixmul(k,drag)); } - else { + else + { fix total_drag=f1_0; while (count--) @@ -325,6 +323,7 @@ void do_physics_sim(object *obj) fix moved_time; //how long objected moved before hit something physics_info *pi; int orig_segnum = obj->segnum; + int bounced=0; fix PhysTime = (FrameTimemovement_type == MT_PHYSICS); @@ -357,8 +356,8 @@ void do_physics_sim(object *obj) #ifdef EXTRA_DEBUG //check for correct object segment - if(!get_seg_masks(&obj->pos, obj->segnum, 0, __FILE__, __LINE__).centermask == 0) { - //Int3(); Removed by Rob 10/5/94 + if(!get_seg_masks(&obj->pos, obj->segnum, 0, __FILE__, __LINE__).centermask == 0) + { if (!update_object_seg(obj)) { if (!(Game_mode & GM_MULTI)) Int3(); @@ -492,9 +491,6 @@ void do_physics_sim(object *obj) Assert(!((fate==HIT_WALL) && ((WallHitSeg == -1) || (WallHitSeg > Highest_segment_index)))); - //if(!get_seg_masks(&hit_info.hit_pnt,hit_info.hit_seg,0).centermask==0) - // Int3(); - save_pos = obj->pos; //save the object's position save_seg = obj->segnum; @@ -505,7 +501,8 @@ void do_physics_sim(object *obj) obj_relink(objnum, iseg ); //if start point not in segment, move object to center of segment - if (get_seg_masks(&obj->pos, obj->segnum, 0, __FILE__, __LINE__).centermask !=0 ) { + if (get_seg_masks(&obj->pos, obj->segnum, 0, __FILE__, __LINE__).centermask !=0 ) + { int n; if ((n=find_object_seg(obj))==-1) { @@ -586,11 +583,18 @@ void do_physics_sim(object *obj) Assert( WallHitSide > -1 ); if ( !(obj->flags&OF_SHOULD_BE_DEAD) ) { - + int forcefield_bounce; //bounce off a forcefield Assert(! (obj->mtype.phys_info.flags & PF_STICK && obj->mtype.phys_info.flags & PF_BOUNCE)); //can't be bounce and stick - if (obj->mtype.phys_info.flags & PF_STICK) { //stop moving + /* + * Force fields are not supported in Descent 1. Use + * this as a placeholder to make the code match the + * force field handling in Descent 2. + */ + forcefield_bounce = 0; + + if (!forcefield_bounce && (obj->mtype.phys_info.flags & PF_STICK)) { //stop moving add_stuck_object(obj, WallHitSeg, WallHitSide); @@ -609,8 +613,9 @@ void do_physics_sim(object *obj) if (wall_part < 0 && wall_part > -f1_0) wall_part = -f1_0; if (wall_part > 0 && wall_part < f1_0) wall_part = f1_0; - if (obj->mtype.phys_info.flags & PF_BOUNCE) //bounce off wall + if (forcefield_bounce || (obj->mtype.phys_info.flags & PF_BOUNCE)) { //bounce off wall wall_part *= 2; //Subtract out wall part twice to achieve bounce + } vm_vec_scale_add2(&obj->mtype.phys_info.velocity,&hit_info.hit_wallnorm,-wall_part); @@ -679,8 +684,10 @@ void do_physics_sim(object *obj) if (obj->control_type == CT_AI) { if (count > 0) { Ai_local_info[objnum].retry_count = count-1; +#ifndef NDEBUG Total_retries += count-1; Total_sims++; +#endif } } @@ -704,7 +711,7 @@ void do_physics_sim(object *obj) } // After collision with objects and walls, set velocity from actual movement - if (!obj_stopped + if (!obj_stopped && !bounced && ((obj->type == OBJ_PLAYER) || (obj->type == OBJ_ROBOT) || (obj->type == OBJ_DEBRIS)) && ((fate == HIT_WALL) || (fate == HIT_OBJECT) || (fate == HIT_BAD_P0)) ) @@ -722,7 +729,6 @@ void do_physics_sim(object *obj) if (obj->mtype.phys_info.flags & PF_LEVELLING) do_physics_align_object( obj ); - //hack to keep player from going through closed doors if (obj->type==OBJ_PLAYER && obj->segnum!=orig_segnum && (!cheats.ghostphysics) ) { int sidenum; @@ -768,7 +774,8 @@ void do_physics_sim(object *obj) //--WE ALWYS WANT THIS IN, MATT AND MIKE DECISION ON 12/10/94, TWO MONTHS AFTER FINAL #ifndef NDEBUG //if end point not in segment, move object to last pos, or segment center - if (get_seg_masks(&obj->pos, obj->segnum, 0, __FILE__, __LINE__).centermask != 0) { + if (get_seg_masks(&obj->pos, obj->segnum, 0, __FILE__, __LINE__).centermask != 0) + { if (find_object_seg(obj)==-1) { int n; @@ -875,7 +882,6 @@ void physics_turn_towards_vector(vms_vector *goal_vector, object *obj, fix rate) physics_set_rotvel_and_saturate(&rotvel_ptr->x, delta_p); physics_set_rotvel_and_saturate(&rotvel_ptr->y, delta_h); #endif - rotvel_ptr->z = 0; } From 84fb22aafe5ccd4d6b15d5f97c595b87296e3494 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 04:31:09 +0000 Subject: [PATCH 37/74] Simplify logic for robot to drop proximity bomb --- main/multibot.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/main/multibot.c b/main/multibot.c index a37573b37..f5f279b09 100644 --- a/main/multibot.c +++ b/main/multibot.c @@ -756,17 +756,14 @@ multi_do_robot_fire(char *buf) { // Drop proximity bombs vm_vec_add(&gun_point, &Objects[botnum].pos, &fire); + Laser_create_new_easy( &fire, &gun_point, botnum, PROXIMITY_ID, 1); } else { calc_gun_point(&gun_point, &Objects[botnum], gun_num); - } - robptr = &Robot_info[Objects[botnum].id]; - - if (gun_num == -1) - Laser_create_new_easy( &fire, &gun_point, botnum, PROXIMITY_ID, 1); - else + robptr = &Robot_info[Objects[botnum].id]; Laser_create_new_easy( &fire, &gun_point, botnum, robptr->weapon_type, 1); + } } int From cb537edd82881fc1d41a7790f9344507222289c0 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 19:41:33 +0000 Subject: [PATCH 38/74] Use ubyte/const ubyte consistently in multiplayer messaging --- main/multi.c | 79 +++++++++++++++++++++++++------------------------ main/multi.h | 6 ++-- main/multibot.c | 20 ++++++------- main/multibot.h | 16 +++++----- main/net_udp.c | 6 ++-- main/net_udp.h | 2 +- 6 files changed, 65 insertions(+), 64 deletions(-) diff --git a/main/multi.c b/main/multi.c index 83e2767e7..3c66fc841 100644 --- a/main/multi.c +++ b/main/multi.c @@ -75,21 +75,21 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. void reset_player_object(void); // In object.c but not in object.h void multi_reset_object_texture(object *objp); void drop_player_eggs(object *playerobj); // from collide.c -void multi_do_heartbeat(char *buf); +void multi_do_heartbeat(const ubyte *buf); void multi_send_heartbeat(); -void multi_do_kill_goal_counts(char *buf); +void multi_do_kill_goal_counts(const ubyte *buf); void multi_powcap_cap_objects(); void multi_powcap_adjust_remote_cap(int pnum); void multi_new_bounty_target( int pnum ); -void multi_do_bounty( char *buf ); +void multi_do_bounty( const ubyte *buf ); void multi_save_game(ubyte slot, uint id, char *desc); void multi_restore_game(ubyte slot, uint id); -void multi_do_save_game(char *buf); -void multi_do_restore_game(char *buf); -void multi_do_msgsend_state(char *buf); +void multi_do_save_game(const ubyte *buf); +void multi_do_restore_game(const ubyte *buf); +void multi_do_msgsend_state(const ubyte *buf); void multi_send_msgsend_state(int state); void multi_send_gmode_update(); -void multi_do_gmode_update(char *buf); +void multi_do_gmode_update(const ubyte *buf); // // Global variables @@ -112,7 +112,7 @@ int multi_sending_message[MAX_PLAYERS] = { 0,0,0,0,0,0,0,0 }; int multi_defining_message = 0; int multi_message_index = 0; -unsigned char multibuf[MAX_MULTI_MESSAGE_LEN+4]; // This is where multiplayer message are built +ubyte multibuf[MAX_MULTI_MESSAGE_LEN+4]; // This is where multiplayer message are built unsigned char multibuf2[MAX_MULTI_MESSAGE_LEN+4]; short remote_to_local[MAX_PLAYERS][MAX_OBJECTS]; // Remote object number for each local object @@ -842,7 +842,7 @@ multi_send_data(unsigned char *buf, int len, int priority) } } -void multi_send_data_direct(unsigned char *buf, int len, int pnum, int priority) +void multi_send_data_direct(const ubyte *buf, int len, int pnum, int priority) { if (len != message_length[(int)buf[0]]) Error("multi_send_data_direct: Packet type %i length: %i, expected: %i\n", buf[0], len, message_length[(int)buf[0]]); @@ -855,7 +855,7 @@ void multi_send_data_direct(unsigned char *buf, int len, int pnum, int priority) { #ifdef USE_UDP case MULTI_PROTO_UDP: - net_udp_send_mdata_direct((ubyte *)multibuf, len, pnum, priority); + net_udp_send_mdata_direct(multibuf, len, pnum, priority); break; #endif default: @@ -1410,7 +1410,7 @@ multi_do_death(int objnum) } void -multi_do_fire(char *buf) +multi_do_fire(const ubyte *buf) { ubyte weapon; int pnum; @@ -1449,8 +1449,9 @@ multi_do_fire(char *buf) } void -multi_do_message(char *buf) +multi_do_message(const ubyte *cbuf) { + const char *buf = (const char*)cbuf; char *colon,mesbuf[100]; int t; @@ -1500,7 +1501,7 @@ multi_do_message(char *buf) } void -multi_do_position(char *buf) +multi_do_position(const ubyte *buf) { ubyte pnum = 0; #ifdef WORDS_BIGENDIAN @@ -1522,7 +1523,7 @@ multi_do_position(char *buf) } void -multi_do_reappear(char *buf) +multi_do_reappear(const ubyte *buf) { short objnum; ubyte pnum = buf[1]; @@ -1545,7 +1546,7 @@ multi_do_reappear(char *buf) } void -multi_do_player_explode(char *buf) +multi_do_player_explode(const ubyte *buf) { // Only call this for players, not robots. pnum is player number, not // Object number. @@ -1649,7 +1650,7 @@ multi_do_player_explode(char *buf) * Process can compute a kill. If I am a Client this might be my own one (see multi_send_kill()) but with more specific data so I can compute my kill correctly. */ void -multi_do_kill(char *buf) +multi_do_kill(const ubyte *buf) { int killer, killed; int count = 1; @@ -1698,7 +1699,7 @@ multi_do_kill(char *buf) // Changed by MK on 10/20/94 to send NULL as object to net_destroy_controlcen if it got -1 // which means not a controlcen object, but contained in another object -void multi_do_controlcen_destroy(char *buf) +void multi_do_controlcen_destroy(const ubyte *buf) { sbyte who; short objnum; @@ -1724,7 +1725,7 @@ void multi_do_controlcen_destroy(char *buf) } void -multi_do_escape(char *buf) +multi_do_escape(const ubyte *buf) { int objnum; @@ -1759,7 +1760,7 @@ multi_do_escape(char *buf) void -multi_do_remobj(char *buf) +multi_do_remobj(const ubyte *buf) { short objnum; // which object to remove short local_objnum; @@ -1895,7 +1896,7 @@ void multi_disconnect_player(int pnum) } void -multi_do_quit(char *buf) +multi_do_quit(const ubyte *buf) { if (!(Game_mode & GM_NETWORK)) @@ -1904,7 +1905,7 @@ multi_do_quit(char *buf) } void -multi_do_cloak(char *buf) +multi_do_cloak(const ubyte *buf) { int pnum; @@ -1924,7 +1925,7 @@ multi_do_cloak(char *buf) } void -multi_do_decloak(char *buf) +multi_do_decloak(const ubyte *buf) { int pnum; @@ -1936,7 +1937,7 @@ multi_do_decloak(char *buf) } void -multi_do_door_open(char *buf) +multi_do_door_open(const ubyte *buf) { int segnum; short side; @@ -1976,7 +1977,7 @@ multi_do_door_open(char *buf) } void -multi_do_create_explosion(char *buf) +multi_do_create_explosion(const ubyte *buf) { int pnum; int count = 1; @@ -1987,7 +1988,7 @@ multi_do_create_explosion(char *buf) } void -multi_do_controlcen_fire(char *buf) +multi_do_controlcen_fire(const ubyte *buf) { vms_vector to_target; int gun_num; @@ -2007,7 +2008,7 @@ multi_do_controlcen_fire(char *buf) } void -multi_do_create_powerup(char *buf) +multi_do_create_powerup(const ubyte *buf) { short segnum; short objnum; @@ -2070,7 +2071,7 @@ multi_do_create_powerup(char *buf) } void -multi_do_play_sound(char *buf) +multi_do_play_sound(const ubyte *buf) { int pnum = buf[1]; int sound_num = buf[2]; @@ -2086,7 +2087,7 @@ multi_do_play_sound(char *buf) } void -multi_do_score(char *buf) +multi_do_score(const ubyte *buf) { int pnum = buf[1]; @@ -2108,7 +2109,7 @@ multi_do_score(char *buf) } void -multi_do_trigger(char *buf) +multi_do_trigger(const ubyte *buf) { int pnum = buf[1]; int trigger = buf[2]; @@ -2126,7 +2127,7 @@ multi_do_trigger(char *buf) check_trigger_sub(trigger, pnum); } -void multi_do_hostage_door_status(char *buf) +void multi_do_hostage_door_status(const ubyte *buf) { // Update hit point status of a door @@ -2229,7 +2230,7 @@ void multi_reset_object_texture (object *objp) } void -multi_process_data(char *buf, int len) +multi_process_data(const ubyte *buf, int len) { // Take an entire message (that has already been checked for validity, // if necessary) and act on it. @@ -2334,7 +2335,7 @@ multi_process_data(char *buf, int len) } void -multi_process_bigdata(char *buf, int len) +multi_process_bigdata(const ubyte *buf, int len) { // Takes a bunch of messages, check them for validity, // and pass them to multi_process_data. @@ -3342,7 +3343,7 @@ void multi_send_kill_goal_counts() multi_send_data(multibuf, count, 2); } -void multi_do_kill_goal_counts(char *buf) +void multi_do_kill_goal_counts(const ubyte *buf) { int i,count=1; @@ -3364,7 +3365,7 @@ void multi_send_heartbeat () multi_send_data(multibuf, 5, 0); } -void multi_do_heartbeat (char *buf) +void multi_do_heartbeat (const ubyte *buf) { fix num; @@ -3461,7 +3462,7 @@ void multi_send_bounty( void ) multi_send_data( multibuf, 2, 2 ); } -void multi_do_bounty( char *buf ) +void multi_do_bounty( const ubyte *buf ) { if ( multi_i_am_master() ) return; @@ -3486,7 +3487,7 @@ void multi_new_bounty_target( int pnum ) digi_play_sample( SOUND_CONTROL_CENTER_WARNING_SIREN, F1_0 * 3 ); } -void multi_do_save_game(char *buf) +void multi_do_save_game(const ubyte *buf) { int count = 1; ubyte slot; @@ -3500,7 +3501,7 @@ void multi_do_save_game(char *buf) multi_save_game( slot, id, desc ); } -void multi_do_restore_game(char *buf) +void multi_do_restore_game(const ubyte *buf) { int count = 1; ubyte slot; @@ -3677,7 +3678,7 @@ void multi_restore_game(ubyte slot, uint id) multi_send_score(); // send my restored scores. I sent 0 when I loaded the level anyways... } -void multi_do_msgsend_state(char *buf) +void multi_do_msgsend_state(const ubyte *buf) { multi_sending_message[(int)buf[1]] = (int)buf[2]; } @@ -3705,7 +3706,7 @@ void multi_send_gmode_update() multi_send_data(multibuf, 3, 0); } -void multi_do_gmode_update(char *buf) +void multi_do_gmode_update(const ubyte *buf) { if (multi_i_am_master()) return; diff --git a/main/multi.h b/main/multi.h index 141ea3823..c2c68f7a0 100644 --- a/main/multi.h +++ b/main/multi.h @@ -219,8 +219,8 @@ int multi_endlevel_poll1(newmenu *menu, d_event *event, void *userdata); int multi_endlevel_poll2( newmenu *menu, d_event *event, void *userdata ); void multi_send_endlevel_packet(); void multi_leave_game(void); -void multi_process_data(char *dat, int len); -void multi_process_bigdata(char *buf, int len); +void multi_process_data(const ubyte *dat, int len); +void multi_process_bigdata(const ubyte *buf, int len); void multi_do_death(int objnum); void multi_send_message_dialog(void); int multi_delete_extra_objects(void); @@ -256,7 +256,7 @@ extern int VerifyPlayerJoined; extern int Player_joining_extras; extern int Network_player_added; -extern unsigned char multibuf[MAX_MULTI_MESSAGE_LEN+4]; +extern ubyte multibuf[MAX_MULTI_MESSAGE_LEN+4]; extern int who_killed_controlcen; diff --git a/main/multibot.c b/main/multibot.c index f5f279b09..e171220b1 100644 --- a/main/multibot.c +++ b/main/multibot.c @@ -70,7 +70,7 @@ fix64 robot_last_send_time[MAX_ROBOTS_CONTROLLED]; fix64 robot_last_message_time[MAX_ROBOTS_CONTROLLED]; int robot_send_pending[MAX_ROBOTS_CONTROLLED]; int robot_fired[MAX_ROBOTS_CONTROLLED]; -sbyte robot_fire_buf[MAX_ROBOTS_CONTROLLED][18+3]; +ubyte robot_fire_buf[MAX_ROBOTS_CONTROLLED][18+3]; #define MULTI_ROBOT_PRIORITY(objnum, pnum) (((objnum % 4) + pnum) % N_players) @@ -375,7 +375,7 @@ multi_send_robot_frame(int sent) if (robot_fired[sending]) { robot_fired[sending] = 0; - multi_send_data((unsigned char*)robot_fire_buf[sending], 18, 1); + multi_send_data(robot_fire_buf[sending], 18, 1); } if (!(Game_mode & GM_NETWORK)) @@ -604,7 +604,7 @@ multi_send_create_robot_powerups(object *del_obj) } void -multi_do_claim_robot(char *buf) +multi_do_claim_robot(const ubyte *buf) { short botnum; short remote_botnum; @@ -641,7 +641,7 @@ multi_do_claim_robot(char *buf) } void -multi_do_release_robot(char *buf) +multi_do_release_robot(const ubyte *buf) { short botnum, remote_botnum; char pnum; @@ -671,7 +671,7 @@ multi_do_release_robot(char *buf) } void -multi_do_robot_position(char *buf) +multi_do_robot_position(const ubyte *buf) { // Process robot movement sent by another player @@ -726,7 +726,7 @@ multi_do_robot_position(char *buf) } void -multi_do_robot_fire(char *buf) +multi_do_robot_fire(const ubyte *buf) { // Send robot fire event int loc = 1; @@ -817,7 +817,7 @@ multi_explode_robot_sub(int botnum, int killer) } void -multi_do_robot_explode(char *buf) +multi_do_robot_explode(const ubyte *buf) { // Explode robot controlled by other player @@ -847,7 +847,7 @@ extern fix EnergyToCreateOneRobot; // From fuelcen.c extern object *create_morph_robot(segment *segp, vms_vector *object_pos, int object_id); // from fuelcen.c void -multi_do_create_robot(char *buf) +multi_do_create_robot(const ubyte *buf) { int fuelcen_num = buf[2]; @@ -900,7 +900,7 @@ multi_do_create_robot(char *buf) } void -multi_do_boss_actions(char *buf) +multi_do_boss_actions(const ubyte *buf) { // Code to handle remote-controlled boss actions @@ -1004,7 +1004,7 @@ multi_do_boss_actions(char *buf) } void -multi_do_create_robot_powerups(char *buf) +multi_do_create_robot_powerups(const ubyte *buf) { // Code to drop remote-controlled robot powerups diff --git a/main/multibot.h b/main/multibot.h index cbcdaf7fc..72604d061 100644 --- a/main/multibot.h +++ b/main/multibot.h @@ -41,14 +41,14 @@ void multi_send_create_robot(int robotcen, int objnum, int type); void multi_send_boss_actions(int bossobjnum, int action, int secondary, int objnum); int multi_send_robot_frame(int sent); -void multi_do_robot_explode(char *buf); -void multi_do_robot_position(char *buf); -void multi_do_claim_robot(char *buf); -void multi_do_release_robot(char *buf); -void multi_do_robot_fire(char *buf); -void multi_do_create_robot(char *buf); -void multi_do_boss_actions(char *buf); -void multi_do_create_robot_powerups(char *buf); +void multi_do_robot_explode(const ubyte *buf); +void multi_do_robot_position(const ubyte *buf); +void multi_do_claim_robot(const ubyte *buf); +void multi_do_release_robot(const ubyte *buf); +void multi_do_robot_fire(const ubyte *buf); +void multi_do_create_robot(const ubyte *buf); +void multi_do_boss_actions(const ubyte *buf); +void multi_do_create_robot_powerups(const ubyte *buf); int multi_explode_robot_sub(int botnum, int killer); diff --git a/main/net_udp.c b/main/net_udp.c index 6ad93de6d..8cda9159a 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -3948,7 +3948,7 @@ void net_udp_listen() #endif } -void net_udp_send_data( ubyte * ptr, int len, int priority ) +void net_udp_send_data(const ubyte * ptr, int len, int priority ) { char check; @@ -4506,12 +4506,12 @@ void net_udp_process_mdata (ubyte *data, int data_len, struct _sockaddr sender_a { int old_Endlevel_sequence = Endlevel_sequence; Endlevel_sequence = 1; - multi_process_bigdata( (char*)data+dataoffset, data_len-dataoffset); + multi_process_bigdata(data+dataoffset, data_len-dataoffset); Endlevel_sequence = old_Endlevel_sequence; return; } - multi_process_bigdata( (char*)data+dataoffset, data_len-dataoffset ); + multi_process_bigdata( data+dataoffset, data_len-dataoffset ); } void net_udp_send_pdata() diff --git a/main/net_udp.h b/main/net_udp.h index 3b832b6c2..f94fa6128 100644 --- a/main/net_udp.h +++ b/main/net_udp.h @@ -12,7 +12,7 @@ void net_udp_manual_join_game(); void net_udp_list_join_game(); int net_udp_objnum_is_past(int objnum); void net_udp_do_frame(int force, int listen); -void net_udp_send_data( ubyte * ptr, int len, int priority ); +void net_udp_send_data(const ubyte * ptr, int len, int priority ); void net_udp_leave_game(); int net_udp_endlevel(int *secret); int net_udp_kmatrix_poll1( newmenu *menu, d_event *event, void *userdata ); From 255211e28bebefa26a23ec854a6f8af7735d7bc4 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 31 Mar 2013 15:04:41 +0000 Subject: [PATCH 39/74] Add helper to get pointer to reactor definition --- main/cntrlcen.c | 10 ++++++---- main/cntrlcen.h | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/main/cntrlcen.c b/main/cntrlcen.c index 65514ec47..1eeebf85a 100644 --- a/main/cntrlcen.c +++ b/main/cntrlcen.c @@ -290,10 +290,11 @@ void do_controlcen_frame(object *obj) controlcen_death_silence = 0; if ((Control_center_next_fire_time < 0) && !(controlcen_death_silence > F1_0*2)) { + reactor *reactor = get_reactor_definition(obj->id); if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) - best_gun_num = calc_best_gun(Reactors[0].n_guns, obj, &Believed_player_pos); + best_gun_num = calc_best_gun(reactor->n_guns, obj, &Believed_player_pos); else - best_gun_num = calc_best_gun(Reactors[0].n_guns, obj, &ConsoleObject->pos); + best_gun_num = calc_best_gun(reactor->n_guns, obj, &ConsoleObject->pos); if (best_gun_num != -1) { vms_vector vec_to_goal; @@ -396,8 +397,9 @@ void init_controlcen_for_level(void) } else { // Compute all gun positions. objp = &Objects[cntrlcen_objnum]; - for (i=0; iid); + for (i=0; in_guns; i++) + calc_controlcen_gun_point(reactor, objp, i); Control_center_present = 1; // Boost control center strength at higher levels. diff --git a/main/cntrlcen.h b/main/cntrlcen.h index 9ef223ae6..63ecb50f1 100644 --- a/main/cntrlcen.h +++ b/main/cntrlcen.h @@ -57,6 +57,12 @@ static inline int get_reactor_model_number(int id) return id; } +static inline reactor *get_reactor_definition(int id) +{ + (void)id; + return &Reactors[0]; +} + extern int Control_center_been_hit; extern int Control_center_player_been_seen; extern int Control_center_next_fire_time; From 00e2f806bc63bf37ce74dcc0c25b138965afedca Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 31 Mar 2013 15:37:51 +0000 Subject: [PATCH 40/74] Fix debug=1 build break from fe7cf3bc ("Move segment handling from editor.h") When debug is enabled, gamecntl references symbols that moved to the new header. --- main/gamecntl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/gamecntl.c b/main/gamecntl.c index e14873eb9..7671689a7 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -91,6 +91,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifdef EDITOR #include "editor/editor.h" +#include "editor/esegment.h" #endif #include From 5dab4b56cd6a6d0ebd26341409942bafccc8e266 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 30 Mar 2013 20:46:13 +0000 Subject: [PATCH 41/74] Add proximity bomb ID test helper to match D2X --- main/collide.c | 2 +- main/laser.c | 9 +++------ main/laser.h | 14 +++++++++++++- main/object.c | 4 ++-- main/physics.c | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/main/collide.c b/main/collide.c index 724e756fd..bed791d6f 100644 --- a/main/collide.c +++ b/main/collide.c @@ -744,7 +744,7 @@ void collide_player_and_controlcen( object * controlcen, object * player, vms_ve // If both objects are weapons, weaken the weapon. void maybe_kill_weapon(object *weapon, object *other_obj) { - if (weapon->id == PROXIMITY_ID) { + if (is_proximity_bomb_or_smart_mine(weapon->id)) { weapon->flags |= OF_SHOULD_BE_DEAD; return; } diff --git a/main/laser.c b/main/laser.c index 9bb36da33..b9422e6b5 100644 --- a/main/laser.c +++ b/main/laser.c @@ -161,7 +161,7 @@ int laser_are_related( int o1, int o2 ) // See if they're siblings... if ( Objects[o1].ctype.laser_info.parent_signature==Objects[o2].ctype.laser_info.parent_signature ) { - if (Objects[o1].id == PROXIMITY_ID || Objects[o2].id == PROXIMITY_ID) + if (is_proximity_bomb_or_smart_mine(Objects[o1].id) || is_proximity_bomb_or_smart_mine(Objects[o2].id)) return 0; //if either is proximity, then can blow up, so say not related else return 1; @@ -360,7 +360,7 @@ int Laser_create_new( vms_vector * direction, vms_vector * position, int segnum, // Here's where to fix the problem with objects which are moving backwards imparting higher velocity to their weaponfire. // Find out if moving backwards. - if (weapon_type == PROXIMITY_ID) { + if (is_proximity_bomb_or_smart_mine(weapon_type)) { parent_speed = vm_vec_mag_quick(&Objects[parent].mtype.phys_info.velocity); if (vm_vec_dot(&Objects[parent].mtype.phys_info.velocity, &Objects[parent].orient.fvec) < 0) parent_speed = -parent_speed; @@ -383,9 +383,6 @@ int Laser_create_new( vms_vector * direction, vms_vector * position, int segnum, weapon_speed /= 2; vm_vec_copy_scale( &obj->mtype.phys_info.velocity, direction, weapon_speed + parent_speed ); -////Debug 101594 -//if ((vm_vec_mag(&obj->mtype.phys_info.velocity) == 0) && (obj->id != PROXIMITY_ID)) -// Int3(); // Curious. This weapon starts with a velocity of 0 and it's not a proximity bomb. // Set thrust if (Weapon_info[weapon_type].thrust != 0) { @@ -617,7 +614,7 @@ int find_homing_object_complete(vms_vector *curpos, object *tracker, int track_o if ((curobjp->type != track_obj_type1) && (curobjp->type != track_obj_type2)) { - if ((curobjp->type == OBJ_WEAPON) && (curobjp->id == PROXIMITY_ID)) { + if ((curobjp->type == OBJ_WEAPON) && (is_proximity_bomb_or_smart_mine(curobjp->id))) { if (curobjp->ctype.laser_info.parent_signature != tracker->ctype.laser_info.parent_signature) is_proximity = 1; else diff --git a/main/laser.h b/main/laser.h index d63c2dcb5..974182cae 100644 --- a/main/laser.h +++ b/main/laser.h @@ -105,7 +105,19 @@ typedef struct muzzle_info { extern muzzle_info Muzzle_data[MUZZLE_QUEUE_MAX]; -extern int Laser_drop_vulcan_ammo; +/* + * These two functions look redundant in D1X, but they are useful in + * D2X. + */ +static inline int is_proximity_bomb_or_smart_mine(enum weapon_type_t id) +{ + return id == PROXIMITY_ID; +} + +static inline int is_any_proximity_mine(enum weapon_type_t id) +{ + return id == PROXIMITY_ID; +} #endif diff --git a/main/object.c b/main/object.c index f11b31b3d..9898ed68d 100644 --- a/main/object.c +++ b/main/object.c @@ -617,7 +617,7 @@ void render_object(object *obj) break; case RT_WEAPON_VCLIP: - if ( PlayerCfg.AlphaEffects && obj->id != PROXIMITY_ID ) // set nice transparency/blending for certrain objects + if ( PlayerCfg.AlphaEffects && !is_proximity_bomb_or_smart_mine(obj->id)) // set nice transparency/blending for certain objects gr_settransblend( 7, GR_BLEND_ADDITIVE_A ); draw_weapon_vclip(obj); @@ -1930,7 +1930,7 @@ void clear_transient_objects(int clear_all) object *obj; for (objnum=0,obj=&Objects[0];objnum<=Highest_object_index;objnum++,obj++) - if (((obj->type == OBJ_WEAPON) && (clear_all || obj->id != PROXIMITY_ID)) || + if (((obj->type == OBJ_WEAPON) && (clear_all || !is_proximity_bomb_or_smart_mine(obj->id))) || obj->type == OBJ_FIREBALL || obj->type == OBJ_DEBRIS || obj->type == OBJ_DEBRIS || diff --git a/main/physics.c b/main/physics.c index 353701f86..171fb98fe 100644 --- a/main/physics.c +++ b/main/physics.c @@ -458,7 +458,7 @@ void do_physics_sim(object *obj) if (fate == HIT_OBJECT) { object *objp = &Objects[hit_info.hit_object]; - if (((objp->type == OBJ_WEAPON) && (objp->id == PROXIMITY_ID)) || objp->type == OBJ_POWERUP) // do not increase count for powerups since they *should* not change our movement + if (((objp->type == OBJ_WEAPON) && is_proximity_bomb_or_smart_mine(objp->id)) || objp->type == OBJ_POWERUP) // do not increase count for powerups since they *should* not change our movement count--; } From 264f2aa8db82af1f5c87795621badd5377370762 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 24 Mar 2013 23:29:37 +0000 Subject: [PATCH 42/74] Add multi_send_robot_explode unused parameter isthief to match D2X --- main/collide.c | 4 ++-- main/multibot.c | 10 +++++++--- main/multibot.h | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/main/collide.c b/main/collide.c index bed791d6f..8dccb01c2 100644 --- a/main/collide.c +++ b/main/collide.c @@ -851,9 +851,9 @@ int apply_damage_to_robot(object *robot, fix damage, int killer_objnum) #ifndef SHAREWARE #ifdef NETWORK if (Game_mode & GM_MULTI) { - if (multi_explode_robot_sub(robot-Objects, killer_objnum)) + if (multi_explode_robot_sub(robot-Objects, killer_objnum, 0)) { - multi_send_robot_explode(robot-Objects, killer_objnum); + multi_send_robot_explode(robot-Objects, killer_objnum, 0); return 1; } else diff --git a/main/multibot.c b/main/multibot.c index e171220b1..f56e2dc5e 100644 --- a/main/multibot.c +++ b/main/multibot.c @@ -489,7 +489,7 @@ multi_send_robot_fire(int objnum, int gun_num, vms_vector *fire) } void -multi_send_robot_explode(int objnum, int killer) +multi_send_robot_explode(int objnum, int killer,char isthief) { // Send robot explosion event to the other players @@ -504,6 +504,7 @@ multi_send_robot_explode(int objnum, int killer) s = (short)objnum_local_to_remote(objnum, (sbyte *)&multibuf[loc+2]); PUT_INTEL_SHORT(multibuf+loc, s); loc += 3; + (void)isthief; multi_send_data(multibuf, loc, 2); multi_delete_controlled_robot(objnum); @@ -767,7 +768,7 @@ multi_do_robot_fire(const ubyte *buf) } int -multi_explode_robot_sub(int botnum, int killer) +multi_explode_robot_sub(int botnum, int killer,char isthief) { object *robot; @@ -805,6 +806,7 @@ multi_explode_robot_sub(int botnum, int killer) multi_drop_robot_powerups(robot-Objects); multi_delete_controlled_robot(robot-Objects); } + (void)isthief; if (Robot_info[robot->id].boss_flag) { if (!Boss_dying) @@ -826,18 +828,20 @@ multi_do_robot_explode(const ubyte *buf) int loc = 1; short killer, remote_killer; int rval; + char thief; loc += 1; // pnum remote_killer = GET_INTEL_SHORT(buf + loc); killer = objnum_remote_to_local(remote_killer, (sbyte)buf[loc+2]); loc += 3; remote_botnum = GET_INTEL_SHORT(buf + loc); botnum = objnum_remote_to_local(remote_botnum, (sbyte)buf[loc+2]); loc += 3; + thief = 0; if ((botnum < 0) || (botnum > Highest_object_index)) { return; } - rval = multi_explode_robot_sub(botnum, killer); + rval = multi_explode_robot_sub(botnum, killer,thief); if (rval && (killer == Players[Player_num].objnum)) add_points_to_score(Robot_info[Objects[botnum].id].score_value); diff --git a/main/multibot.h b/main/multibot.h index 72604d061..30ab4120b 100644 --- a/main/multibot.h +++ b/main/multibot.h @@ -36,7 +36,7 @@ int multi_can_move_robot(int objnum, int agitation); void multi_send_robot_position(int objnum, int fired); void multi_send_robot_fire(int objnum, int gun_num, vms_vector *fire); void multi_send_claim_robot(int objnum); -void multi_send_robot_explode(int objnum, int killer); +void multi_send_robot_explode(int objnum, int killer, char unused); void multi_send_create_robot(int robotcen, int objnum, int type); void multi_send_boss_actions(int bossobjnum, int action, int secondary, int objnum); int multi_send_robot_frame(int sent); @@ -50,7 +50,7 @@ void multi_do_create_robot(const ubyte *buf); void multi_do_boss_actions(const ubyte *buf); void multi_do_create_robot_powerups(const ubyte *buf); -int multi_explode_robot_sub(int botnum, int killer); +int multi_explode_robot_sub(int botnum, int killer, char unused); void multi_drop_robot_powerups(int objnum); void multi_dump_robots(void); From b750415db6605fb70fb498a16e3881f2fa93e970 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Fri, 5 Apr 2013 09:12:33 +0800 Subject: [PATCH 43/74] For the assembler build, make sure platform_settings is accessed from self, likely preventing a compiling error --- CHANGELOG.txt | 4 ++++ SConstruct | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 65b5219d5..893b623ca 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20130405 +-------- +SConstruct: For the assembler build, make sure platform_settings is accessed from self, likely preventing a compiling error + 20130117 -------- main/render.c: Fix click-selection in the editor for OpenGL implementations that insist on point blending diff --git a/SConstruct b/SConstruct index 848af49de..f90964505 100644 --- a/SConstruct +++ b/SConstruct @@ -196,7 +196,7 @@ class DXXProgram: if (self.user_settings.asm == 1) and (self.user_settings.opengl == 0): print "%s: including: ASSEMBLER" % self.PROGRAM_NAME env.Replace(AS = 'nasm') - env.Append(ASCOM = ' -f ' + str(platform_settings.osasmdef) + ' -d' + str(platform_settings.osdef) + ' -Itexmap/ ') + env.Append(ASCOM = ' -f ' + str(self.platform_settings.osasmdef) + ' -d' + str(self.platform_settings.osdef) + ' -Itexmap/ ') self.common_sources += asm_sources else: env.Append(CPPDEFINES = ['NO_ASM']) From 3cffacb9b205fe1aad4cb100d8f24cba8ddddb4a Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Fri, 5 Apr 2013 09:25:10 +0800 Subject: [PATCH 44/74] Changes towards building using SCons on Mac OS X --- CHANGELOG.txt | 1 + SConstruct | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 893b623ca..9bed96c9e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20130405 -------- SConstruct: For the assembler build, make sure platform_settings is accessed from self, likely preventing a compiling error +SConstruct: Changes towards building using SCons on Mac OS X 20130117 -------- diff --git a/SConstruct b/SConstruct index f90964505..126a4f127 100644 --- a/SConstruct +++ b/SConstruct @@ -72,25 +72,21 @@ class DXXProgram: env.Append(CPPPATH = [os.path.join(self.srcdir, 'arch/win32/include')]) self.platform_sources = [os.path.join(program.srcdir, 'arch/win32/messagebox.c')] # Settings to apply to Apple builds - # This appears to be unused. The reference to sdl_only fails to - # execute. class DarwinPlatformSettings(_PlatformSettings): def __init__(self,user_settings): DXXProgram._PlatformSettings.__init__(self) self.osdef = '__APPLE__' - if (user_settings.sdlmixer == 1): - print "including SDL_mixer" - platform_settings.lflags += ' -framework SDL_mixer' user_settings.sharepath = '' user_settings.asm = 0 - # Ugly way of linking to frameworks, but kreator has seen uglier - self.lflags = '-framework ApplicationServices -framework Carbon -framework Cocoa -framework SDL' - if (sdl_only == 0): - self.lflags += ' -framework OpenGL' - self.libs = ['../physfs/build/Debug/libphysfs.dylib'] + self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' def adjust_environment(self,program,env): env.Append(CPPDEFINES = ['__unix__']) + env.Append(CPPPATH = [os.path.join(program.srcdir, '../physfs'), os.path.join(os.getenv("HOME"), 'Library/Frameworks/SDL.framework/Headers'), '/Library/Frameworks/SDL.framework/Headers']) self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] + env.Append(FRAMEWORKS = ['ApplicationServices', 'Carbon', 'Cocoa', 'SDL']) + # Look in frameworks for header files + env.Append(CPPFLAGS = ['-F' + os.path.join(os.getenv("HOME"), 'Library/Frameworks')]) + self.libs = ['../physfs/build/Debug/libphysfs.dylib'] # Settings to apply to Linux builds class LinuxPlatformSettings(_PlatformSettings): def __init__(self,user_settings): @@ -160,13 +156,11 @@ class DXXProgram: elif sys.platform == 'darwin': print "%s: compiling on Mac OS X" % self.PROGRAM_NAME platform = self.DarwinPlatformSettings - sys.path += ['./arch/cocoa'] - VERSION = str(VERSION_MAJOR) + '.' + str(VERSION_MINOR) - if (VERSION_MICRO): - VERSION += '.' + str(VERSION_MICRO) + VERSION = str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) + if (self.VERSION_MICRO): + VERSION += '.' + str(self.VERSION_MICRO) env['VERSION_NUM'] = VERSION env['VERSION_NAME'] = self.PROGRAM_NAME + ' v' + VERSION - import tool_bundle else: print "%s: compiling on *NIX" % self.PROGRAM_NAME platform = self.LinuxPlatformSettings @@ -187,7 +181,10 @@ class DXXProgram: print "%s: building with OpenGL" % self.PROGRAM_NAME env.Append(CPPDEFINES = ['OGL']) self.common_sources += self.arch_ogl_sources - self.platform_settings.libs += self.platform_settings.ogllibs + if (sys.platform != 'darwin'): + self.platform_settings.libs += self.platform_settings.ogllibs + else: + env.Append(FRAMEWORKS = ['OpenGL']) else: print "%s: building with Software Renderer" % self.PROGRAM_NAME self.common_sources += self.arch_sdl_sources @@ -208,6 +205,8 @@ class DXXProgram: self.common_sources += self.arch_sdlmixer if (sys.platform != 'darwin'): self.platform_settings.libs += ['SDL_mixer'] + else: + env.Append(FRAMEWORKS = ['SDL_mixer']) # debug? if (self.user_settings.debug == 1): @@ -490,6 +489,8 @@ class D1XProgram(DXXProgram): env.Install(self.user_settings.BIN_DIR, str(exe_target)) env.Alias('install', self.user_settings.BIN_DIR) else: + sys.path += ['./arch/cocoa'] + import tool_bundle tool_bundle.TOOL_BUNDLE(env) env.MakeBundle(self.PROGRAM_NAME + '.app', exe_target, 'free.d1x-rebirth', 'd1xgl-Info.plist', From bb18ba4fbb91333f35b3b9387c4a76723ec37297 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Sat, 6 Apr 2013 09:51:35 +0800 Subject: [PATCH 45/74] Updated Xcode project, changed references to error.h to dxxerror.h, since it was renamed --- CHANGELOG.txt | 4 + d1x-rebirth.xcodeproj/project.pbxproj | 121 +++++--------------------- editor/ehostage.c | 2 +- main/custom.c | 2 +- 4 files changed, 30 insertions(+), 99 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9bed96c9e..8b1dbc68e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20130406 +-------- +d1x-rebirth.xcodeproj/project.pbxproj, editor/ehostage.c, main/custom.c: Updated Xcode project, changed references to error.h to dxxerror.h, since it was renamed + 20130405 -------- SConstruct: For the assembler build, make sure platform_settings is accessed from self, likely preventing a compiling error diff --git a/d1x-rebirth.xcodeproj/project.pbxproj b/d1x-rebirth.xcodeproj/project.pbxproj index 881729466..8ad68896b 100755 --- a/d1x-rebirth.xcodeproj/project.pbxproj +++ b/d1x-rebirth.xcodeproj/project.pbxproj @@ -23,12 +23,10 @@ 676032FB066B39CE008A67A3 /* kmatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 676032F9066B39CE008A67A3 /* kmatrix.c */; }; 6766BAC20668B3A000A6052D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 676AC1C20668A938007173EB /* u_mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B4490F066880A300DF26D8 /* u_mem.h */; }; - 676AC1C30668A938007173EB /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B44913066880C400DF26D8 /* error.h */; }; 676AC1C40668A938007173EB /* gr.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B44914066880C400DF26D8 /* gr.h */; }; 676AC1C50668A938007173EB /* grdef.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B44915066880C400DF26D8 /* grdef.h */; }; 676AC1C70668A938007173EB /* byteswap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CE4F0668852C00056A5A /* byteswap.h */; }; 676AC1C80668A938007173EB /* rle.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CE500668852C00056A5A /* rle.h */; }; - 676AC1CA0668A938007173EB /* u_dpmi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CF090668878F00056A5A /* u_dpmi.h */; }; 676AC1CE0668A938007173EB /* fix.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CF420668881F00056A5A /* fix.h */; }; 676AC1CF0668A938007173EB /* palette.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CF4E0668883900056A5A /* palette.h */; }; 676AC1D00668A938007173EB /* pcx.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CF620668885500056A5A /* pcx.h */; }; @@ -58,7 +56,6 @@ 676AC1FB0668A938007173EB /* rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B4414C066878B300DF26D8 /* rect.c */; }; 676AC1FC0668A938007173EB /* rle.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B4414D066878B300DF26D8 /* rle.c */; }; 676AC1FD0668A938007173EB /* scalec.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B44151066878B300DF26D8 /* scalec.c */; }; - 676AC1FE0668A938007173EB /* tmerge.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B44152066878B300DF26D8 /* tmerge.c */; }; 676AC1FF0668A938007173EB /* clipper.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B441760668792300DF26D8 /* clipper.c */; }; 676AC2000668A938007173EB /* draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B441780668792300DF26D8 /* draw.c */; }; 676AC2010668A938007173EB /* globvars.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B441790668792300DF26D8 /* globvars.c */; }; @@ -146,7 +143,6 @@ 676AC2770668A939007173EB /* 3d.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CF8D066888DD00056A5A /* 3d.h */; }; 676AC2780668A939007173EB /* args.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791D00B066889CD00056A5A /* args.h */; }; 676AC2790668A939007173EB /* byteswap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CE4F0668852C00056A5A /* byteswap.h */; }; - 676AC27E0668A939007173EB /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B44913066880C400DF26D8 /* error.h */; }; 676AC2800668A939007173EB /* fix.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CF420668881F00056A5A /* fix.h */; }; 676AC2810668A939007173EB /* gr.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B44914066880C400DF26D8 /* gr.h */; }; 676AC2820668A939007173EB /* grdef.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B44915066880C400DF26D8 /* grdef.h */; }; @@ -159,7 +155,6 @@ 676AC2920668A939007173EB /* strutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791D0A306688AB900056A5A /* strutil.h */; }; 676AC2930668A939007173EB /* texmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CFB10668891200056A5A /* texmap.h */; }; 676AC2940668A939007173EB /* timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791D04B06688A2E00056A5A /* timer.h */; }; - 676AC2950668A939007173EB /* u_dpmi.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791CF090668878F00056A5A /* u_dpmi.h */; }; 676AC2960668A939007173EB /* u_mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 67B4490F066880A300DF26D8 /* u_mem.h */; }; 676AC2970668A939007173EB /* vecmat.h in Headers */ = {isa = PBXBuildFile; fileRef = 6791D026066889F100056A5A /* vecmat.h */; }; 676AC29C0668A939007173EB /* 2dsline.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B44139066878B300DF26D8 /* 2dsline.c */; }; @@ -179,7 +174,6 @@ 676AC2AB0668A939007173EB /* rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B4414C066878B300DF26D8 /* rect.c */; }; 676AC2AC0668A939007173EB /* rle.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B4414D066878B300DF26D8 /* rle.c */; }; 676AC2AD0668A939007173EB /* scalec.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B44151066878B300DF26D8 /* scalec.c */; }; - 676AC2AE0668A939007173EB /* tmerge.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B44152066878B300DF26D8 /* tmerge.c */; }; 676AC2AF0668A939007173EB /* clipper.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B441760668792300DF26D8 /* clipper.c */; }; 676AC2B00668A939007173EB /* draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B441780668792300DF26D8 /* draw.c */; }; 676AC2B10668A939007173EB /* globvars.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B441790668792300DF26D8 /* globvars.c */; }; @@ -413,6 +407,10 @@ EBAFC290088E67CD006329AD /* digiobj.c in Sources */ = {isa = PBXBuildFile; fileRef = EBAFC28F088E67CD006329AD /* digiobj.c */; }; EBAFC291088E67CD006329AD /* digiobj.c in Sources */ = {isa = PBXBuildFile; fileRef = EBAFC28F088E67CD006329AD /* digiobj.c */; }; EBAFC2C0088E6BC7006329AD /* conf.h in Headers */ = {isa = PBXBuildFile; fileRef = EBAFC269088E508D006329AD /* conf.h */; }; + EBC4BAFA170E64540033D261 /* vers_id.c in Sources */ = {isa = PBXBuildFile; fileRef = EBC4BAF9170E63E90033D261 /* vers_id.c */; }; + EBC4BAFB170E64550033D261 /* vers_id.c in Sources */ = {isa = PBXBuildFile; fileRef = EBC4BAF9170E63E90033D261 /* vers_id.c */; }; + EBC4BB11170E660B0033D261 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = EBC4BAFC170E64760033D261 /* hash.c */; }; + EBC4BB12170E660C0033D261 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = EBC4BAFC170E64760033D261 /* hash.c */; }; EBC58E710D489E19007C8ABF /* args.c in Sources */ = {isa = PBXBuildFile; fileRef = EBC58E700D489E19007C8ABF /* args.c */; }; EBC58E720D489E19007C8ABF /* args.c in Sources */ = {isa = PBXBuildFile; fileRef = EBC58E700D489E19007C8ABF /* args.c */; }; EBC652030890D632004FCAA3 /* bmread.c in Sources */ = {isa = PBXBuildFile; fileRef = EBC652010890D632004FCAA3 /* bmread.c */; }; @@ -499,14 +497,8 @@ EBEEB1EA0D2B317800FF39B4 /* custom.h in Headers */ = {isa = PBXBuildFile; fileRef = EBEEB1E50D2B317700FF39B4 /* custom.h */; }; EBEEB1EE0D2B317800FF39B4 /* custom.c in Sources */ = {isa = PBXBuildFile; fileRef = EBEEB1E40D2B317700FF39B4 /* custom.c */; }; EBEEB1EF0D2B317800FF39B4 /* custom.h in Headers */ = {isa = PBXBuildFile; fileRef = EBEEB1E50D2B317700FF39B4 /* custom.h */; }; - EBEEB1FF0D2B320C00FF39B4 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = EBEEB1F30D2B320B00FF39B4 /* hash.c */; }; EBEEB2000D2B320C00FF39B4 /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = EBEEB1F40D2B320B00FF39B4 /* hash.h */; }; - EBEEB2090D2B320C00FF39B4 /* script.h in Headers */ = {isa = PBXBuildFile; fileRef = EBEEB1FD0D2B320B00FF39B4 /* script.h */; }; - EBEEB20B0D2B320C00FF39B4 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = EBEEB1F30D2B320B00FF39B4 /* hash.c */; }; EBEEB20C0D2B320C00FF39B4 /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = EBEEB1F40D2B320B00FF39B4 /* hash.h */; }; - EBEEB2150D2B320C00FF39B4 /* script.h in Headers */ = {isa = PBXBuildFile; fileRef = EBEEB1FD0D2B320B00FF39B4 /* script.h */; }; - EBEEB29F0D2B378B00FF39B4 /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = EBEEB29B0D2B378B00FF39B4 /* compare.c */; }; - EBEEB2A30D2B378B00FF39B4 /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = EBEEB29B0D2B378B00FF39B4 /* compare.c */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -567,7 +559,7 @@ 670E3796066C50C30085B671 /* CHANGELOG.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CHANGELOG.txt; sourceTree = ""; }; 6710AAFE066B2D6100DB0F68 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; 6710AB68066B2E0400DB0F68 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; - 675ED123066B196700E42AA7 /* d1x-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "d1x-Info.plist"; sourceTree = ""; }; + 675ED123066B196700E42AA7 /* d1x-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = "d1x-Info.plist"; sourceTree = ""; }; 676032DC066B399A008A67A3 /* multi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = multi.c; sourceTree = ""; }; 676032DD066B399A008A67A3 /* multibot.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = multibot.c; sourceTree = ""; }; 676032F9066B39CE008A67A3 /* kmatrix.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kmatrix.c; sourceTree = ""; }; @@ -576,7 +568,6 @@ 676AC31D0668A939007173EB /* d1xgl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = d1xgl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6791CE4F0668852C00056A5A /* byteswap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = byteswap.h; sourceTree = ""; }; 6791CE500668852C00056A5A /* rle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = rle.h; sourceTree = ""; }; - 6791CF090668878F00056A5A /* u_dpmi.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = u_dpmi.h; sourceTree = ""; }; 6791CF420668881F00056A5A /* fix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = fix.h; sourceTree = ""; }; 6791CF4E0668883900056A5A /* palette.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = palette.h; sourceTree = ""; }; 6791CF620668885500056A5A /* pcx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = pcx.h; sourceTree = ""; }; @@ -606,7 +597,6 @@ 67B4414C066878B300DF26D8 /* rect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = rect.c; sourceTree = ""; }; 67B4414D066878B300DF26D8 /* rle.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = rle.c; sourceTree = ""; }; 67B44151066878B300DF26D8 /* scalec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = scalec.c; sourceTree = ""; }; - 67B44152066878B300DF26D8 /* tmerge.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tmerge.c; sourceTree = ""; }; 67B441760668792300DF26D8 /* clipper.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = clipper.c; sourceTree = ""; }; 67B441780668792300DF26D8 /* draw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = draw.c; sourceTree = ""; }; 67B441790668792300DF26D8 /* globvars.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = globvars.c; sourceTree = ""; }; @@ -691,12 +681,11 @@ 67B4488906687E5E00DF26D8 /* scanline.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = scanline.c; sourceTree = ""; }; 67B4489206687E5E00DF26D8 /* tmapflat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = tmapflat.c; sourceTree = ""; }; 67B4490F066880A300DF26D8 /* u_mem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = u_mem.h; sourceTree = ""; }; - 67B44913066880C400DF26D8 /* error.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = ""; }; 67B44914066880C400DF26D8 /* gr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gr.h; sourceTree = ""; }; 67B44915066880C400DF26D8 /* grdef.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = grdef.h; sourceTree = ""; }; 67F6FED0066B13B400443922 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDLMain.h; path = arch/cocoa/SDLMain.h; sourceTree = ""; }; 67F6FED1066B13B400443922 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = arch/cocoa/SDLMain.m; sourceTree = ""; }; - 67F6FEEA066B13D900443922 /* d1xgl-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "d1xgl-Info.plist"; sourceTree = ""; }; + 67F6FEEA066B13D900443922 /* d1xgl-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = "d1xgl-Info.plist"; sourceTree = ""; }; EB01AFA90A65323200EA4C7C /* newdemo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = newdemo.h; sourceTree = ""; }; EB0420B90A341041002CC961 /* multi.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = multi.h; sourceTree = ""; }; EB0420BB0A341042002CC961 /* morph.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = morph.h; sourceTree = ""; }; @@ -734,7 +723,6 @@ EB0420DE0A341042002CC961 /* newmenu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = newmenu.h; sourceTree = ""; }; EB0420E10A341042002CC961 /* digi.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = digi.h; sourceTree = ""; }; EB0420E30A341042002CC961 /* gameseq.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gameseq.h; sourceTree = ""; }; - EB0420E40A341042002CC961 /* desc_id.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = desc_id.h; sourceTree = ""; }; EB0420E50A341042002CC961 /* credits.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = credits.h; sourceTree = ""; }; EB0420E70A341042002CC961 /* multibot.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = multibot.h; sourceTree = ""; }; EB0420E80A341042002CC961 /* gameseg.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gameseg.h; sourceTree = ""; }; @@ -764,7 +752,6 @@ EB0421060A341042002CC961 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; EB0929F712A10889004D9A79 /* messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = messagebox.h; sourceTree = ""; }; EB0929F812A10889004D9A79 /* messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = messagebox.c; sourceTree = ""; }; - EB092A3912A2151A004D9A79 /* messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = messagebox.c; sourceTree = ""; }; EB092A3A12A21527004D9A79 /* messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = messagebox.c; sourceTree = ""; }; EB092A4912A21A14004D9A79 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; EB1283BE0D59D94800A991A3 /* d1x.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = d1x.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -784,7 +771,6 @@ EB35ABDF0FB199B800C36930 /* window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = window.h; sourceTree = ""; }; EB35ABE00FB199B800C36930 /* window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = window.c; sourceTree = ""; }; EB380D7C0E168B1900EBD9AD /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - EB3CA4F90E97740E00FB1E93 /* tracker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = tracker.h; sourceTree = ""; }; EB6142451501EDC9004E2AE8 /* curve.pad */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = curve.pad; sourceTree = ""; }; EB6142461501EDC9004E2AE8 /* dummy.pad */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dummy.pad; sourceTree = ""; }; EB6142471501EDC9004E2AE8 /* group.pad */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = group.pad; sourceTree = ""; }; @@ -820,6 +806,13 @@ EBAFC26A088E508D006329AD /* descent.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = descent.r; sourceTree = ""; }; EBAFC26D088E508D006329AD /* SDL_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_main.c; sourceTree = ""; }; EBAFC28F088E67CD006329AD /* digiobj.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = digiobj.c; sourceTree = ""; }; + EBC4BAF4170E62160033D261 /* dxxerror.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dxxerror.h; sourceTree = ""; }; + EBC4BAF5170E62160033D261 /* makesig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = makesig.h; sourceTree = ""; }; + EBC4BAF6170E62C60033D261 /* tool_bundle.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = tool_bundle.py; path = arch/cocoa/tool_bundle.py; sourceTree = ""; }; + EBC4BAF7170E63380033D261 /* d1x-rebirth.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "d1x-rebirth.rc"; sourceTree = ""; }; + EBC4BAF8170E63890033D261 /* esegment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = esegment.h; sourceTree = ""; }; + EBC4BAF9170E63E90033D261 /* vers_id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vers_id.c; sourceTree = ""; }; + EBC4BAFC170E64760033D261 /* hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hash.c; sourceTree = ""; }; EBC58E700D489E19007C8ABF /* args.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = args.c; sourceTree = ""; }; EBC650800890C882004FCAA3 /* autosave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = autosave.c; sourceTree = ""; }; EBC650970890C882004FCAA3 /* centers.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = centers.c; sourceTree = ""; }; @@ -837,7 +830,6 @@ EBC650A90890C882004FCAA3 /* kcurve.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kcurve.c; sourceTree = ""; }; EBC650AB0890C882004FCAA3 /* kfuncs.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kfuncs.c; sourceTree = ""; }; EBC650AD0890C882004FCAA3 /* kgame.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kgame.c; sourceTree = ""; }; - EBC650AE0890C882004FCAA3 /* kgroup.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kgroup.c; sourceTree = ""; }; EBC650AF0890C882004FCAA3 /* khelp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = khelp.c; sourceTree = ""; }; EBC650B00890C882004FCAA3 /* kmine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kmine.c; sourceTree = ""; }; EBC650B10890C882004FCAA3 /* ksegmove.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ksegmove.c; sourceTree = ""; }; @@ -845,7 +837,6 @@ EBC650B30890C882004FCAA3 /* ksegsize.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ksegsize.c; sourceTree = ""; }; EBC650B40890C882004FCAA3 /* ktmap.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ktmap.c; sourceTree = ""; }; EBC650B50890C882004FCAA3 /* kview.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kview.c; sourceTree = ""; }; - EBC650B60890C882004FCAA3 /* macro.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = macro.c; sourceTree = ""; }; EBC650B90890C882004FCAA3 /* med.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = med.c; sourceTree = ""; }; EBC650BA0890C882004FCAA3 /* meddraw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = meddraw.c; sourceTree = ""; }; EBC650BD0890C882004FCAA3 /* medmisc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = medmisc.c; sourceTree = ""; }; @@ -914,23 +905,12 @@ EBEEB1BD0D2A423E00FF39B4 /* pstypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = pstypes.h; sourceTree = ""; }; EBEEB1E40D2B317700FF39B4 /* custom.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = custom.c; sourceTree = ""; }; EBEEB1E50D2B317700FF39B4 /* custom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = custom.h; sourceTree = ""; }; - EBEEB1F30D2B320B00FF39B4 /* hash.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = hash.c; sourceTree = ""; }; EBEEB1F40D2B320B00FF39B4 /* hash.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hash.h; sourceTree = ""; }; - EBEEB1FD0D2B320B00FF39B4 /* script.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = script.h; sourceTree = ""; }; - EBEEB2190D2B34DE00FF39B4 /* alsadigi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = alsadigi.c; sourceTree = ""; }; - EBEEB21A0D2B34DE00FF39B4 /* hmiplay.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = hmiplay.c; sourceTree = ""; }; - EBEEB2290D2B351400FF39B4 /* music.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = music.h; sourceTree = ""; }; EBEEB2540D2B35B000FF39B4 /* resource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = resource.h; sourceTree = ""; }; - EBEEB25B0D2B364300FF39B4 /* altsound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = altsound.c; sourceTree = ""; }; - EBEEB25C0D2B364300FF39B4 /* altsound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = altsound.h; sourceTree = ""; }; - EBEEB25E0D2B364300FF39B4 /* compbit.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = compbit.h; sourceTree = ""; }; EBEEB2600D2B364300FF39B4 /* digicomp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = digicomp.c; sourceTree = ""; }; EBEEB2610D2B364300FF39B4 /* digicomp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = digicomp.h; sourceTree = ""; }; - EBEEB2660D2B364300FF39B4 /* mute.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mute.c; sourceTree = ""; }; - EBEEB2670D2B364300FF39B4 /* mute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mute.h; sourceTree = ""; }; EBEEB2680D2B364300FF39B4 /* snddecom.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = snddecom.c; sourceTree = ""; }; EBEEB2690D2B364300FF39B4 /* snddecom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = snddecom.h; sourceTree = ""; }; - EBEEB29B0D2B378B00FF39B4 /* compare.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = compare.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -978,6 +958,7 @@ children = ( 67F6FED0066B13B400443922 /* SDLMain.h */, 67F6FED1066B13B400443922 /* SDLMain.m */, + EBC4BAF6170E62C60033D261 /* tool_bundle.py */, ); name = Classes; sourceTree = ""; @@ -1067,14 +1048,6 @@ name = Frameworks; sourceTree = ""; }; - 67603357066B3AE0008A67A3 /* include */ = { - isa = PBXGroup; - children = ( - EBEEB2290D2B351400FF39B4 /* music.h */, - ); - path = include; - sourceTree = ""; - }; 676AC04B0668A814007173EB /* ogl */ = { isa = PBXGroup; children = ( @@ -1107,7 +1080,6 @@ 67B4414C066878B300DF26D8 /* rect.c */, 67B4414D066878B300DF26D8 /* rle.c */, 67B44151066878B300DF26D8 /* scalec.c */, - 67B44152066878B300DF26D8 /* tmerge.c */, ); path = 2d; sourceTree = SOURCE_ROOT; @@ -1130,18 +1102,6 @@ path = 3d; sourceTree = SOURCE_ROOT; }; - 67B44193066879B000DF26D8 /* linux */ = { - isa = PBXGroup; - children = ( - EB092A3912A2151A004D9A79 /* messagebox.c */, - EBEEB2190D2B34DE00FF39B4 /* alsadigi.c */, - EBEEB21A0D2B34DE00FF39B4 /* hmiplay.c */, - 67603357066B3AE0008A67A3 /* include */, - ); - name = linux; - path = arch/linux; - sourceTree = SOURCE_ROOT; - }; 67B441D106687A0200DF26D8 /* sdl */ = { isa = PBXGroup; children = ( @@ -1169,7 +1129,6 @@ children = ( EBAFC268088E508D006329AD /* carbon */, EB3319E60D53341900C799B0 /* include */, - 67B44193066879B000DF26D8 /* linux */, 676AC04B0668A814007173EB /* ogl */, 67B441D106687A0200DF26D8 /* sdl */, EBEEB24A0D2B35B000FF39B4 /* win32 */, @@ -1190,7 +1149,6 @@ children = ( 67B446CF06687CF400DF26D8 /* ai.c */, 67B446D206687CF400DF26D8 /* aipath.c */, - EBEEB25B0D2B364300FF39B4 /* altsound.c */, 67B446D406687CF400DF26D8 /* automap.c */, 67B446D606687CF400DF26D8 /* bm.c */, EBC652010890D632004FCAA3 /* bmread.c */, @@ -1218,7 +1176,6 @@ 67B4471006687CF400DF26D8 /* gameseg.c */, 67B4471206687CF400DF26D8 /* gameseq.c */, 67B4471506687CF400DF26D8 /* gauges.c */, - EBEEB1F30D2B320B00FF39B4 /* hash.c */, 67B4471706687CF400DF26D8 /* hostage.c */, 67B4471906687CF400DF26D8 /* hud.c */, 67B4471B06687CF400DF26D8 /* inferno.c */, @@ -1232,7 +1189,6 @@ 67B4473106687CF400DF26D8 /* morph.c */, 676032DC066B399A008A67A3 /* multi.c */, 676032DD066B399A008A67A3 /* multibot.c */, - EBEEB2660D2B364300FF39B4 /* mute.c */, 17DFA6AF10C1A29500674D11 /* net_udp.c */, 67B4473D06687CF400DF26D8 /* newdemo.c */, 67B4473F06687CF400DF26D8 /* newmenu.c */, @@ -1257,22 +1213,20 @@ 67B4477F06687CF500DF26D8 /* text.c */, 67B4478206687CF500DF26D8 /* titles.c */, 67B4478406687CF500DF26D8 /* vclip.c */, + EBC4BAF9170E63E90033D261 /* vers_id.c */, 67B4478706687CF500DF26D8 /* wall.c */, 67B4478906687CF500DF26D8 /* weapon.c */, EB0421040A341042002CC961 /* ai.h */, EB0421010A341042002CC961 /* aistruct.h */, - EBEEB25C0D2B364300FF39B4 /* altsound.h */, EB0421030A341042002CC961 /* automap.h */, EB0421020A341042002CC961 /* bm.h */, EB0420F10A341042002CC961 /* collide.h */, - EBEEB25E0D2B364300FF39B4 /* compbit.h */, EB0421060A341042002CC961 /* config.h */, EB0421050A341042002CC961 /* controls.h */, EB0420BF0A341042002CC961 /* cntrlcen.h */, EB0420E50A341042002CC961 /* credits.h */, EBEEB2610D2B364300FF39B4 /* digicomp.h */, EBEEB1E50D2B317700FF39B4 /* custom.h */, - EB0420E40A341042002CC961 /* desc_id.h */, EB0420E10A341042002CC961 /* digi.h */, EB0421000A341042002CC961 /* effects.h */, EB0420FF0A341042002CC961 /* endlevel.h */, @@ -1299,7 +1253,6 @@ EB0420BB0A341042002CC961 /* morph.h */, EB0420B90A341041002CC961 /* multi.h */, EB0420E70A341042002CC961 /* multibot.h */, - EBEEB2670D2B364300FF39B4 /* mute.h */, 17DFA6B210C1A2A300674D11 /* net_udp.h */, EB01AFA90A65323200EA4C7C /* newdemo.h */, EB0420DE0A341042002CC961 /* newmenu.h */, @@ -1315,7 +1268,6 @@ EB0420D30A341042002CC961 /* robot.h */, EB0420D20A341042002CC961 /* scores.h */, EB0420D10A341042002CC961 /* screens.h */, - EBEEB1FD0D2B320B00FF39B4 /* script.h */, EB0420D00A341042002CC961 /* segment.h */, EB0420CF0A341042002CC961 /* segpoint.h */, EB0420CE0A341042002CC961 /* slew.h */, @@ -1360,9 +1312,9 @@ isa = PBXGroup; children = ( EBC58E700D489E19007C8ABF /* args.c */, - EBEEB29B0D2B378B00FF39B4 /* compare.c */, EB92BEA40CDD6A570045A32C /* dl_list.c */, 67B4486A06687E1000DF26D8 /* error.c */, + EBC4BAFC170E64760033D261 /* hash.c */, 179E6E9D11F37B3400175C54 /* hmp.c */, EBAC98F90D42497F0017D4BC /* ignorecase.c */, EB1405B912100883002B1CC6 /* physfsx.c */, @@ -1388,13 +1340,12 @@ isa = PBXGroup; children = ( EBEEB1140D2A329900FF39B4 /* editor */, - EB3CA4F80E97740E00FB1E93 /* tracker */, 6791CF8D066888DD00056A5A /* 3d.h */, 6791D00B066889CD00056A5A /* args.h */, 6791CE4F0668852C00056A5A /* byteswap.h */, EB9181090DABA47B0010CB39 /* console.h */, EB92BE680CDD69830045A32C /* dl_list.h */, - 67B44913066880C400DF26D8 /* error.h */, + EBC4BAF4170E62160033D261 /* dxxerror.h */, 6791CF420668881F00056A5A /* fix.h */, EBC652120890D6DF004FCAA3 /* func.h */, 67B44914066880C400DF26D8 /* gr.h */, @@ -1404,6 +1355,7 @@ EBAC994E0D4250320017D4BC /* ignorecase.h */, EB3319F00D5334B600C799B0 /* internal.h */, EB3319F10D53351600C799B0 /* loadgl.h */, + EBC4BAF5170E62160033D261 /* makesig.h */, 6791D08F06688A9C00056A5A /* maths.h */, EB3319F20D53351600C799B0 /* ogl_init.h */, 6791CF4E0668883900056A5A /* palette.h */, @@ -1416,8 +1368,6 @@ 6791D0A306688AB900056A5A /* strutil.h */, 6791CFB10668891200056A5A /* texmap.h */, 6791D04B06688A2E00056A5A /* timer.h */, - EBFD39740E3C1C2300FED206 /* tracker */, - 6791CF090668878F00056A5A /* u_dpmi.h */, EBC6520F0890D6B7004FCAA3 /* ui.h */, 67B4490F066880A300DF26D8 /* u_mem.h */, 6791D026066889F100056A5A /* vecmat.h */, @@ -1443,14 +1393,6 @@ path = arch/include; sourceTree = ""; }; - EB3CA4F80E97740E00FB1E93 /* tracker */ = { - isa = PBXGroup; - children = ( - EB3CA4F90E97740E00FB1E93 /* tracker.h */, - ); - path = tracker; - sourceTree = ""; - }; EB6142441501EDC9004E2AE8 /* data */ = { isa = PBXGroup; children = ( @@ -1512,7 +1454,6 @@ EBC650A90890C882004FCAA3 /* kcurve.c */, EBC650AB0890C882004FCAA3 /* kfuncs.c */, EBC650AD0890C882004FCAA3 /* kgame.c */, - EBC650AE0890C882004FCAA3 /* kgroup.c */, EBC650AF0890C882004FCAA3 /* khelp.c */, EBC650B00890C882004FCAA3 /* kmine.c */, EBC650B10890C882004FCAA3 /* ksegmove.c */, @@ -1520,7 +1461,6 @@ EBC650B30890C882004FCAA3 /* ksegsize.c */, EBC650B40890C882004FCAA3 /* ktmap.c */, EBC650B50890C882004FCAA3 /* kview.c */, - EBC650B60890C882004FCAA3 /* macro.c */, EBC650B90890C882004FCAA3 /* med.c */, EBC650BA0890C882004FCAA3 /* meddraw.c */, EBC650BD0890C882004FCAA3 /* medmisc.c */, @@ -1571,6 +1511,7 @@ EBEEB1160D2A329900FF39B4 /* editor.h */, EBEEB1170D2A329900FF39B4 /* ehostage.h */, EBEEB1180D2A329900FF39B4 /* eobject.h */, + EBC4BAF8170E63890033D261 /* esegment.h */, EBEEB1190D2A329900FF39B4 /* eswitch.h */, EBEEB11A0D2A329900FF39B4 /* info.h */, EBEEB11B0D2A329900FF39B4 /* kdefs.h */, @@ -1592,6 +1533,7 @@ EBEEB24A0D2B35B000FF39B4 /* win32 */ = { isa = PBXGroup; children = ( + EBC4BAF7170E63380033D261 /* d1x-rebirth.rc */, EB092A3A12A21527004D9A79 /* messagebox.c */, EBEEB24F0D2B35B000FF39B4 /* include */, ); @@ -1607,13 +1549,6 @@ path = include; sourceTree = ""; }; - EBFD39740E3C1C2300FED206 /* tracker */ = { - isa = PBXGroup; - children = ( - ); - path = tracker; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1622,12 +1557,10 @@ buildActionMask = 2147483647; files = ( 676AC1C20668A938007173EB /* u_mem.h in Headers */, - 676AC1C30668A938007173EB /* error.h in Headers */, 676AC1C40668A938007173EB /* gr.h in Headers */, 676AC1C50668A938007173EB /* grdef.h in Headers */, 676AC1C70668A938007173EB /* byteswap.h in Headers */, 676AC1C80668A938007173EB /* rle.h in Headers */, - 676AC1CA0668A938007173EB /* u_dpmi.h in Headers */, 676AC1CE0668A938007173EB /* fix.h in Headers */, 676AC1CF0668A938007173EB /* palette.h in Headers */, 676AC1D00668A938007173EB /* pcx.h in Headers */, @@ -1652,7 +1585,6 @@ EBEEB1080D2A307300FF39B4 /* texmapl.h in Headers */, EBEEB1EA0D2B317800FF39B4 /* custom.h in Headers */, EBEEB2000D2B320C00FF39B4 /* hash.h in Headers */, - EBEEB2090D2B320C00FF39B4 /* script.h in Headers */, EB35ABE30FB199B800C36930 /* window.h in Headers */, EB0929FB12A10889004D9A79 /* messagebox.h in Headers */, ); @@ -1665,7 +1597,6 @@ 676AC2770668A939007173EB /* 3d.h in Headers */, 676AC2780668A939007173EB /* args.h in Headers */, 676AC2790668A939007173EB /* byteswap.h in Headers */, - 676AC27E0668A939007173EB /* error.h in Headers */, 676AC2800668A939007173EB /* fix.h in Headers */, 676AC2810668A939007173EB /* gr.h in Headers */, 676AC2820668A939007173EB /* grdef.h in Headers */, @@ -1678,7 +1609,6 @@ 676AC2920668A939007173EB /* strutil.h in Headers */, 676AC2930668A939007173EB /* texmap.h in Headers */, 676AC2940668A939007173EB /* timer.h in Headers */, - 676AC2950668A939007173EB /* u_dpmi.h in Headers */, 676AC2960668A939007173EB /* u_mem.h in Headers */, 676AC2970668A939007173EB /* vecmat.h in Headers */, 67F6FED4066B13B400443922 /* SDLMain.h in Headers */, @@ -1693,7 +1623,6 @@ EBEEB1060D2A307300FF39B4 /* texmapl.h in Headers */, EBEEB1EF0D2B317800FF39B4 /* custom.h in Headers */, EBEEB20C0D2B320C00FF39B4 /* hash.h in Headers */, - EBEEB2150D2B320C00FF39B4 /* script.h in Headers */, EB35ABE10FB199B800C36930 /* window.h in Headers */, EB0929F912A10889004D9A79 /* messagebox.h in Headers */, ); @@ -1836,7 +1765,6 @@ 676AC1FB0668A938007173EB /* rect.c in Sources */, 676AC1FC0668A938007173EB /* rle.c in Sources */, 676AC1FD0668A938007173EB /* scalec.c in Sources */, - 676AC1FE0668A938007173EB /* tmerge.c in Sources */, 676AC1FF0668A938007173EB /* clipper.c in Sources */, 676AC2000668A938007173EB /* draw.c in Sources */, 676AC2010668A938007173EB /* globvars.c in Sources */, @@ -1932,8 +1860,6 @@ EB92BE670CDD693C0045A32C /* jukebox.c in Sources */, EB92BEA80CDD6A570045A32C /* dl_list.c in Sources */, EBEEB1E90D2B317800FF39B4 /* custom.c in Sources */, - EBEEB1FF0D2B320C00FF39B4 /* hash.c in Sources */, - EBEEB29F0D2B378B00FF39B4 /* compare.c in Sources */, EBAC98FD0D42497F0017D4BC /* ignorecase.c in Sources */, EBC58E720D489E19007C8ABF /* args.c in Sources */, EB331A0C0D53578800C799B0 /* snddecom.c in Sources */, @@ -2002,6 +1928,8 @@ EBECB67912C041EA00D660B3 /* userbox.c in Sources */, EBECB67A12C041EB00D660B3 /* dialog.c in Sources */, EB2C86E612C36FFB0073E30E /* file.c in Sources */, + EBC4BAFA170E64540033D261 /* vers_id.c in Sources */, + EBC4BB11170E660B0033D261 /* hash.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2027,7 +1955,6 @@ 676AC2AB0668A939007173EB /* rect.c in Sources */, 676AC2AC0668A939007173EB /* rle.c in Sources */, 676AC2AD0668A939007173EB /* scalec.c in Sources */, - 676AC2AE0668A939007173EB /* tmerge.c in Sources */, 676AC2AF0668A939007173EB /* clipper.c in Sources */, 676AC2B00668A939007173EB /* draw.c in Sources */, 676AC2B10668A939007173EB /* globvars.c in Sources */, @@ -2121,8 +2048,6 @@ EB92BE630CDD693C0045A32C /* jukebox.c in Sources */, EB92BEA60CDD6A570045A32C /* dl_list.c in Sources */, EBEEB1EE0D2B317800FF39B4 /* custom.c in Sources */, - EBEEB20B0D2B320C00FF39B4 /* hash.c in Sources */, - EBEEB2A30D2B378B00FF39B4 /* compare.c in Sources */, EBAC98FB0D42497F0017D4BC /* ignorecase.c in Sources */, EBC58E710D489E19007C8ABF /* args.c in Sources */, EB3319850D50A6B200C799B0 /* bmread.c in Sources */, @@ -2193,6 +2118,8 @@ EBAC9A6D1525C5E800F6C779 /* texpage.c in Sources */, EBAC9A6E1525C5E800F6C779 /* texture.c in Sources */, EBAC9A6F1525C64400F6C779 /* dumpmine.c in Sources */, + EBC4BAFB170E64550033D261 /* vers_id.c in Sources */, + EBC4BB12170E660C0033D261 /* hash.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/editor/ehostage.c b/editor/ehostage.c index 09a11e070..8e2ce6a8e 100644 --- a/editor/ehostage.c +++ b/editor/ehostage.c @@ -32,7 +32,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "timer.h" #include "objpage.h" #include "fix.h" -#include "error.h" +#include "dxxerror.h" #include "kdefs.h" #include "object.h" #include "polyobj.h" diff --git a/main/custom.c b/main/custom.c index f79721116..ef298a449 100644 --- a/main/custom.c +++ b/main/custom.c @@ -12,7 +12,7 @@ #include "digi.h" #include "hash.h" #include "u_mem.h" -#include "error.h" +#include "dxxerror.h" #include "custom.h" //#define D2TMAP_CONV // used for testing From 2bfb13c9e003516e0e351a8a5da17332d68a0cb7 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Sat, 6 Apr 2013 11:48:26 +0800 Subject: [PATCH 46/74] Added .gitignore --- .gitignore | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ CHANGELOG.txt | 1 + 2 files changed, 49 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..f33056d5a --- /dev/null +++ b/.gitignore @@ -0,0 +1,48 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.app +*.o +*.so +*.pyc +build + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite +*.dblite + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +Icon? +ehthumbs.db +Thumbs.db + +# Xcode generated files # +###################### +# Note: committing these is optional +*.mode1v3 +*.pbxuser \ No newline at end of file diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8b1dbc68e..8fa708a5b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20130406 -------- d1x-rebirth.xcodeproj/project.pbxproj, editor/ehostage.c, main/custom.c: Updated Xcode project, changed references to error.h to dxxerror.h, since it was renamed +.gitignore: Added .gitignore 20130405 -------- From f333e34368d41ccaf656d4c5aaefe609b1497bf9 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 6 Apr 2013 16:35:13 +0000 Subject: [PATCH 47/74] Remove unused inclusion of dxxerror.h --- editor/ehostage.c | 1 - main/custom.c | 1 - 2 files changed, 2 deletions(-) diff --git a/editor/ehostage.c b/editor/ehostage.c index 8e2ce6a8e..9e56ccad5 100644 --- a/editor/ehostage.c +++ b/editor/ehostage.c @@ -32,7 +32,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "timer.h" #include "objpage.h" #include "fix.h" -#include "dxxerror.h" #include "kdefs.h" #include "object.h" #include "polyobj.h" diff --git a/main/custom.c b/main/custom.c index ef298a449..517900b97 100644 --- a/main/custom.c +++ b/main/custom.c @@ -12,7 +12,6 @@ #include "digi.h" #include "hash.h" #include "u_mem.h" -#include "dxxerror.h" #include "custom.h" //#define D2TMAP_CONV // used for testing From ea3cea4ce2c8d325c3302c9a05422ee9ff3f4df7 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 6 Apr 2013 21:00:52 +0000 Subject: [PATCH 48/74] Make master drop powerups from uncontrolled robot at death This code is in D2X, and per zico should be enabled in D1X as well. It appears to predate the release of Descent 2 source, so this was likely a fix from Parallax that was never backported. --- main/multibot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/multibot.c b/main/multibot.c index f56e2dc5e..6452a5c38 100644 --- a/main/multibot.c +++ b/main/multibot.c @@ -806,6 +806,10 @@ multi_explode_robot_sub(int botnum, int killer,char isthief) multi_drop_robot_powerups(robot-Objects); multi_delete_controlled_robot(robot-Objects); } + else if (robot->ctype.ai_info.REMOTE_OWNER == -1 && multi_i_am_master()) + { + multi_drop_robot_powerups(robot-Objects); + } (void)isthief; if (Robot_info[robot->id].boss_flag) { From 54e7d17c5813fd6aba287e306b986ab43482bccb Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 7 Apr 2013 17:03:58 +0000 Subject: [PATCH 49/74] Move Darwin version handling into DarwinPlatformSettings --- SConstruct | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index bc339bfe3..ee3de450e 100644 --- a/SConstruct +++ b/SConstruct @@ -100,6 +100,11 @@ class DXXProgram: user_settings.asm = 0 self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' def adjust_environment(self,program,env): + VERSION = str(program.VERSION_MAJOR) + '.' + str(program.VERSION_MINOR) + if (program.VERSION_MICRO): + VERSION += '.' + str(program.VERSION_MICRO) + env['VERSION_NUM'] = VERSION + env['VERSION_NAME'] = program.PROGRAM_NAME + ' v' + VERSION env.Append(CPPDEFINES = ['__unix__']) env.Append(CPPPATH = [os.path.join(program.srcdir, '../physfs'), os.path.join(os.getenv("HOME"), 'Library/Frameworks/SDL.framework/Headers'), '/Library/Frameworks/SDL.framework/Headers']) self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] @@ -178,11 +183,6 @@ class DXXProgram: elif sys.platform == 'darwin': print "%s: compiling on Mac OS X" % self.PROGRAM_NAME platform = self.DarwinPlatformSettings - VERSION = str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) - if (self.VERSION_MICRO): - VERSION += '.' + str(self.VERSION_MICRO) - env['VERSION_NUM'] = VERSION - env['VERSION_NAME'] = self.PROGRAM_NAME + ' v' + VERSION else: print "%s: compiling on *NIX" % self.PROGRAM_NAME platform = self.LinuxPlatformSettings From 5f34dab041870d33c3686de420d7b1ba0561c4a3 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 7 Apr 2013 17:04:16 +0000 Subject: [PATCH 50/74] Set Environment tools= from platform settings This allows Linux and Darwin to pass None instead of ['mingw32']. --- SConstruct | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index ee3de450e..d3695f2b9 100644 --- a/SConstruct +++ b/SConstruct @@ -73,12 +73,14 @@ class DXXProgram: self.builddir += '/' # Base class for platform-specific settings processing class _PlatformSettings: + tools = None def __init__(self): self.ogllibs = '' self.osasmdef = None self.platform_sources = [] # Settings to apply to mingw32 builds class Win32PlatformSettings(_PlatformSettings): + tools = ['mingw'] def __init__(self,user_settings): DXXProgram._PlatformSettings.__init__(self) self.osdef = '_WIN32' @@ -131,16 +133,14 @@ class DXXProgram: def __init__(self): self.user_settings = self.UserSettings(self.ARGUMENTS, self.target) + self.check_platform() self.prepare_environment() self.banner() self.check_endian() - self.check_platform() self.process_user_settings() self.register_program() def prepare_environment(self): - # Acquire environment object... - self.env = Environment(ENV = os.environ, tools = ['mingw']) self.VERSION_STRING = ' v' + str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) + '.' + str(self.VERSION_MICRO) self.env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(self.PROGRAM_NAME) + '\\"'), ('DXX_VERSION_MAJORi', str(self.VERSION_MAJOR)), ('DXX_VERSION_MINORi', str(self.VERSION_MINOR)), ('DXX_VERSION_MICROi', str(self.VERSION_MICRO))]) if self.user_settings.builddir != '': @@ -175,7 +175,6 @@ class DXXProgram: print "%s: LittleEndian machine detected" % self.PROGRAM_NAME def check_platform(self): - env = self.env # windows or *nix? if sys.platform == 'win32': print "%s: compiling on Windows" % self.PROGRAM_NAME @@ -188,7 +187,9 @@ class DXXProgram: platform = self.LinuxPlatformSettings self.user_settings.sharepath += '/' self.platform_settings = platform(self.user_settings) - self.platform_settings.adjust_environment(self, env) + # Acquire environment object... + self.env = Environment(ENV = os.environ, tools = platform.tools) + self.platform_settings.adjust_environment(self, self.env) self.platform_settings.libs += ['physfs', 'm'] self.common_sources += self.platform_settings.platform_sources From e3eabde3ca9433f26cb96402d73f828bbf9490b2 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 8 Apr 2013 13:00:05 +0800 Subject: [PATCH 51/74] Allow SCons to find the HIServices framework for the Mac code in physfsx.c --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 126a4f127..d17ba28fb 100644 --- a/SConstruct +++ b/SConstruct @@ -85,7 +85,7 @@ class DXXProgram: self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] env.Append(FRAMEWORKS = ['ApplicationServices', 'Carbon', 'Cocoa', 'SDL']) # Look in frameworks for header files - env.Append(CPPFLAGS = ['-F' + os.path.join(os.getenv("HOME"), 'Library/Frameworks')]) + env.Append(CPPFLAGS = ['-F' + os.path.join(os.getenv("HOME"), 'Library/Frameworks'), '-F/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks']) self.libs = ['../physfs/build/Debug/libphysfs.dylib'] # Settings to apply to Linux builds class LinuxPlatformSettings(_PlatformSettings): From f3b1294bf05c72af25690ac8cd203a25a348c1f1 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 8 Apr 2013 14:27:36 +0800 Subject: [PATCH 52/74] For Mac, in SCons link against physfs properly --- SConstruct | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index d17ba28fb..95e81849e 100644 --- a/SConstruct +++ b/SConstruct @@ -86,7 +86,8 @@ class DXXProgram: env.Append(FRAMEWORKS = ['ApplicationServices', 'Carbon', 'Cocoa', 'SDL']) # Look in frameworks for header files env.Append(CPPFLAGS = ['-F' + os.path.join(os.getenv("HOME"), 'Library/Frameworks'), '-F/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks']) - self.libs = ['../physfs/build/Debug/libphysfs.dylib'] + self.libs = [''] + env['LIBPATH'] = '../physfs/build/Debug' # Settings to apply to Linux builds class LinuxPlatformSettings(_PlatformSettings): def __init__(self,user_settings): From 7683d7998d0e93c2d96bef844a829594e29689e4 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 8 Apr 2013 14:35:48 +0800 Subject: [PATCH 53/74] For Mac in SCons, find the HIServices framework for physfsx.c --- SConstruct | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/SConstruct b/SConstruct index 95e81849e..d9c348e7d 100644 --- a/SConstruct +++ b/SConstruct @@ -51,14 +51,36 @@ class DXXProgram: self.use_udp = int(ARGUMENTS.get('use_udp', 1)) self.use_tracker = int(ARGUMENTS.get('use_tracker', 1)) self.verbosebuild = int(ARGUMENTS.get('verbosebuild', 0)) + builddir_prefix = ARGUMENTS.get('builddir_prefix', None) + builddir_suffix = ARGUMENTS.get('builddir_suffix', None) + default_builddir = builddir_prefix or '' + if builddir_prefix is not None or builddir_suffix is not None: + if os.environ.has_key('CC'): + default_builddir += '%s-' % os.path.basename(os.environ['CC']) + for a in ( + ('debug', 'dbg'), + ('profiler', 'prf'), + ('editor', 'ed'), + ('opengl', 'ogl'), + ('opengles', 'es'), + ): + if getattr(self, a[0]): + default_builddir += a[1] + if builddir_suffix is not None: + default_builddir += builddir_prefix + self.builddir = ARGUMENTS.get('builddir', default_builddir) + if self.builddir != '' and self.builddir[-1:] != '/': + self.builddir += '/' # Base class for platform-specific settings processing class _PlatformSettings: + tools = None def __init__(self): self.ogllibs = '' self.osasmdef = None self.platform_sources = [] # Settings to apply to mingw32 builds class Win32PlatformSettings(_PlatformSettings): + tools = ['mingw'] def __init__(self,user_settings): DXXProgram._PlatformSettings.__init__(self) self.osdef = '_WIN32' @@ -80,6 +102,11 @@ class DXXProgram: user_settings.asm = 0 self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' def adjust_environment(self,program,env): + VERSION = str(program.VERSION_MAJOR) + '.' + str(program.VERSION_MINOR) + if (program.VERSION_MICRO): + VERSION += '.' + str(program.VERSION_MICRO) + env['VERSION_NUM'] = VERSION + env['VERSION_NAME'] = program.PROGRAM_NAME + ' v' + VERSION env.Append(CPPDEFINES = ['__unix__']) env.Append(CPPPATH = [os.path.join(program.srcdir, '../physfs'), os.path.join(os.getenv("HOME"), 'Library/Frameworks/SDL.framework/Headers'), '/Library/Frameworks/SDL.framework/Headers']) self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] @@ -107,18 +134,18 @@ class DXXProgram: def __init__(self): self.user_settings = self.UserSettings(self.ARGUMENTS, self.target) + self.check_platform() self.prepare_environment() self.banner() self.check_endian() - self.check_platform() self.process_user_settings() self.register_program() def prepare_environment(self): - # Acquire environment object... - self.env = Environment(ENV = os.environ, tools = ['mingw']) self.VERSION_STRING = ' v' + str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) + '.' + str(self.VERSION_MICRO) self.env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(self.PROGRAM_NAME) + '\\"'), ('DXX_VERSION_MAJORi', str(self.VERSION_MAJOR)), ('DXX_VERSION_MINORi', str(self.VERSION_MINOR)), ('DXX_VERSION_MICROi', str(self.VERSION_MICRO))]) + if self.user_settings.builddir != '': + self.env.VariantDir(self.user_settings.builddir, '.', duplicate=0) # Prettier build messages...... if (self.user_settings.verbosebuild == 0): @@ -149,7 +176,6 @@ class DXXProgram: print "%s: LittleEndian machine detected" % self.PROGRAM_NAME def check_platform(self): - env = self.env # windows or *nix? if sys.platform == 'win32': print "%s: compiling on Windows" % self.PROGRAM_NAME @@ -157,17 +183,14 @@ class DXXProgram: elif sys.platform == 'darwin': print "%s: compiling on Mac OS X" % self.PROGRAM_NAME platform = self.DarwinPlatformSettings - VERSION = str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) - if (self.VERSION_MICRO): - VERSION += '.' + str(self.VERSION_MICRO) - env['VERSION_NUM'] = VERSION - env['VERSION_NAME'] = self.PROGRAM_NAME + ' v' + VERSION else: print "%s: compiling on *NIX" % self.PROGRAM_NAME platform = self.LinuxPlatformSettings self.user_settings.sharepath += '/' self.platform_settings = platform(self.user_settings) - self.platform_settings.adjust_environment(self, env) + # Acquire environment object... + self.env = Environment(ENV = os.environ, tools = platform.tools) + self.platform_settings.adjust_environment(self, self.env) self.platform_settings.libs += ['physfs', 'm'] self.common_sources += self.platform_settings.platform_sources @@ -479,13 +502,13 @@ class D1XProgram(DXXProgram): def register_program(self): env = self.env exe_target = os.path.join(self.srcdir, self.target) + objects = [self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, os.path.splitext(s)[0], self.env["OBJSUFFIX"]), source=s) for s in self.common_sources] versid_cppdefines=env['CPPDEFINES'][:] if self.user_settings.extra_version: versid_cppdefines.append(('DESCENT_VERSION_EXTRA', '\\"%s\\"' % self.user_settings.extra_version)) - env.Object(source = ['main/vers_id.c'], CPPDEFINES=versid_cppdefines) - versid_sources = ['main/vers_id%s' % env['OBJSUFFIX']] + objects.append(self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, 'main/vers_id', self.env["OBJSUFFIX"]), source='main/vers_id.c', CPPDEFINES=versid_cppdefines)) # finally building program... - env.Program(target=str(exe_target), source = self.common_sources + versid_sources, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) + env.Program(target='%s%s' % (self.user_settings.builddir, str(exe_target)), source = objects, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) if (sys.platform != 'darwin'): env.Install(self.user_settings.BIN_DIR, str(exe_target)) env.Alias('install', self.user_settings.BIN_DIR) From 175cad804c8419ba9986196e388359e1b933e2f6 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 8 Apr 2013 16:21:53 +0800 Subject: [PATCH 54/74] For SCons in Mac OS X, make sure the frameworks are linked properly --- SConstruct | 3 +-- arch/cocoa/tool_bundle.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index d9c348e7d..205bdc7b1 100644 --- a/SConstruct +++ b/SConstruct @@ -111,8 +111,7 @@ class DXXProgram: env.Append(CPPPATH = [os.path.join(program.srcdir, '../physfs'), os.path.join(os.getenv("HOME"), 'Library/Frameworks/SDL.framework/Headers'), '/Library/Frameworks/SDL.framework/Headers']) self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] env.Append(FRAMEWORKS = ['ApplicationServices', 'Carbon', 'Cocoa', 'SDL']) - # Look in frameworks for header files - env.Append(CPPFLAGS = ['-F' + os.path.join(os.getenv("HOME"), 'Library/Frameworks'), '-F/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks']) + env.Append(FRAMEWORKPATH = [os.path.join(os.getenv("HOME"), 'Library/Frameworks'), '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks']) self.libs = [''] env['LIBPATH'] = '../physfs/build/Debug' # Settings to apply to Linux builds diff --git a/arch/cocoa/tool_bundle.py b/arch/cocoa/tool_bundle.py index a3033b797..46d8e00b7 100644 --- a/arch/cocoa/tool_bundle.py +++ b/arch/cocoa/tool_bundle.py @@ -115,7 +115,7 @@ def TOOL_BUNDLE(env): env['BUNDLEPREFIX'] = '' env['BUNDLESUFFIX'] = '' env['BUNDLEDIRSUFFIX'] = '.bundle' - env['FRAMEWORKS'] = ['-framework Carbon', '-framework System'] + #env['FRAMEWORKS'] = ['-framework Carbon', '-framework System'] env['BUNDLE'] = '$SHLINK' env['BUNDLEFLAGS'] = ' -bundle' env['BUNDLECOM'] = '$BUNDLE $BUNDLEFLAGS -o ${TARGET} $SOURCES $_LIBDIRFLAGS $_LIBFLAGS $FRAMEWORKS' From 77d4cccf56a4bd6fc98cc99d312f207d928915d0 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 8 Apr 2013 16:32:25 +0800 Subject: [PATCH 55/74] Letting the Xcode project figure out its geography regions --- d1x-rebirth.xcodeproj/project.pbxproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/d1x-rebirth.xcodeproj/project.pbxproj b/d1x-rebirth.xcodeproj/project.pbxproj index 8ad68896b..0340c4411 100755 --- a/d1x-rebirth.xcodeproj/project.pbxproj +++ b/d1x-rebirth.xcodeproj/project.pbxproj @@ -1693,7 +1693,14 @@ isa = PBXProject; buildConfigurationList = EBBAD49E0B2D0F7E00080BBF /* Build configuration list for PBXProject "d1x-rebirth" */; compatibilityVersion = "Xcode 2.4"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); mainGroup = 29B97314FDCFA39411CA2CEA /* d1x */; projectDirPath = ""; projectRoot = ""; From 8e6d903ad293d97bf122e7f45fd96901b15154ea Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 8 Apr 2013 16:34:24 +0800 Subject: [PATCH 56/74] Extend #ifdef guards to around StandardAlert for the messagebox, fixing a missing symbol error in SCons for Mac --- arch/carbon/messagebox.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/carbon/messagebox.c b/arch/carbon/messagebox.c index eb2bd1088..a76f9d478 100644 --- a/arch/carbon/messagebox.c +++ b/arch/carbon/messagebox.c @@ -64,13 +64,15 @@ void display_mac_alert(char *message, int error) } else { + // This #if guard removes both compiler warnings + // and complications if we didn't link the (older) Mac OS X SDK that actually supports the following. +#if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4) Str255 error_text = "\pSorry, a critical error has occurred."; Str255 text; - -#if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4) // kill warning + CopyCStringToPascal(message, text); -#endif StandardAlert(error ? kAlertStopAlert : kAlertNoteAlert, error ? error_text : text, error ? text : NULL, 0, &itemHit); +#endif } if ((wind = window_get_front())) From 7d5833007ddeb2fec3e410afca06371a82a26f18 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Mon, 8 Apr 2013 17:08:54 +0800 Subject: [PATCH 57/74] Update SDLmain.m from SDL 1.2.14 source, fixing a missing symbol 'NSAppleMenuController' when building using SCons for Mac. For Mac, using SCons, it finally builds and works again\! --- arch/cocoa/SDLMain.m | 239 +++++++++++++++++++++++++++++++------------ 1 file changed, 171 insertions(+), 68 deletions(-) mode change 100755 => 100644 arch/cocoa/SDLMain.m diff --git a/arch/cocoa/SDLMain.m b/arch/cocoa/SDLMain.m old mode 100755 new mode 100644 index 89f064eee..2434f81aa --- a/arch/cocoa/SDLMain.m +++ b/arch/cocoa/SDLMain.m @@ -5,35 +5,69 @@ Feel free to customize this file to suit your needs */ -#import -#import "SDLMain.h" -#import /* for MAXPATHLEN */ -#import +#include "SDL.h" +#include "SDLMain.h" +#include /* for MAXPATHLEN */ +#include + +/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, + but the method still is there and works. To avoid warnings, we declare + it ourselves here. */ +@interface NSApplication(SDL_Missing_Methods) +- (void)setAppleMenu:(NSMenu *)menu; +@end /* Use this flag to determine whether we use SDLMain.nib or not */ #define SDL_USE_NIB_FILE 0 +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ static int gArgc; static char **gArgv; static BOOL gFinderLaunch; +static BOOL gCalledAppMainline = FALSE; + +static NSString *getApplicationName(void) +{ + const NSDictionary *dict; + NSString *appName = 0; + + /* Determine the application name */ + dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); + if (dict) + appName = [dict objectForKey: @"CFBundleName"]; + + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; + + return appName; +} #if SDL_USE_NIB_FILE /* A helper category for NSString */ @interface NSString (ReplaceSubString) - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; @end -#else -/* An internal Apple class used to setup Apple menus */ -@interface NSAppleMenuController:NSObject {} -- (void)controlMenu:(NSMenu *)aMenu; -@end #endif -@interface SDLApplication : NSApplication +@interface NSApplication (SDLApplication) @end -@implementation SDLApplication +@implementation NSApplication (SDLApplication) /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { @@ -44,31 +78,22 @@ static BOOL gFinderLaunch; } @end - /* The main class of the application, the application's delegate */ @implementation SDLMain /* Set the working directory to the .app's parent directory */ - (void) setupWorkingDirectory:(BOOL)shouldChdir { - char parentdir[MAXPATHLEN]; - char *c; - - strncpy ( parentdir, gArgv[0], sizeof(parentdir) ); - c = (char*) parentdir; - - while (*c != '\0') /* go to end */ - c++; - - while (*c != '/') /* back up to parent */ - c--; - - *c++ = '\0'; /* cut off last part (binary name) */ - if (shouldChdir) { - assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ - assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */ + char parentdir[MAXPATHLEN]; + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); + if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) { + chdir(parentdir); /* chdir to the binary app's parent */ + } + CFRelease(url); + CFRelease(url2); } } @@ -94,43 +119,60 @@ static BOOL gFinderLaunch; if ([menuItem hasSubmenu]) [self fixMenu:[menuItem submenu] withAppName:appName]; } - [ aMenu sizeToFit ]; } #else -void setupAppleMenu(void) +static void setApplicationMenu(void) { /* warning: this code is very odd */ - NSAppleMenuController *appleMenuController; NSMenu *appleMenu; - NSMenuItem *appleMenuItem; - - appleMenuController = [[NSAppleMenuController alloc] init]; - appleMenu = [[NSMenu alloc] initWithTitle:@""]; - appleMenuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + NSMenuItem *menuItem; + NSString *title; + NSString *appName; - [appleMenuItem setSubmenu:appleMenu]; + appName = getApplicationName(); + appleMenu = [[NSMenu alloc] initWithTitle:@""]; + + /* Add menu items */ + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; - /* yes, we do need to add it and then remove it -- - if you don't add it, it doesn't get displayed - if you don't remove it, you have an extra, titleless item in the menubar - when you remove it, it appears to stick around - very, very odd */ - [[NSApp mainMenu] addItem:appleMenuItem]; - [appleMenuController controlMenu:appleMenu]; - [[NSApp mainMenu] removeItem:appleMenuItem]; + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; + + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Quit " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + + + /* Put menu into the menubar */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; + + /* Tell the application object that this is now the application menu */ + [NSApp setAppleMenu:appleMenu]; + + /* Finally give up our references to the objects */ [appleMenu release]; - [appleMenuItem release]; + [menuItem release]; } /* Create a window menu */ -void setupWindowMenu(void) +static void setupWindowMenu(void) { - NSMenu *windowMenu; - NSMenuItem *windowMenuItem; - NSMenuItem *menuItem; - + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; @@ -153,19 +195,30 @@ void setupWindowMenu(void) } /* Replacement for NSApplicationMain */ -void CustomApplicationMain (argc, argv) +static void CustomApplicationMain (int argc, char **argv) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; SDLMain *sdlMain; /* Ensure the application object is initialised */ - [SDLApplication sharedApplication]; + [NSApplication sharedApplication]; +#ifdef SDL_USE_CPS + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [NSApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ + /* Set up the menubar */ [NSApp setMainMenu:[[NSMenu alloc] init]]; - setupAppleMenu(); + setApplicationMenu(); setupWindowMenu(); - + /* Create SDLMain and make it the app delegate */ sdlMain = [[SDLMain alloc] init]; [NSApp setDelegate:sdlMain]; @@ -179,6 +232,56 @@ void CustomApplicationMain (argc, argv) #endif + +/* + * Catch document open requests...this lets us notice files when the app + * was launched by double-clicking a document, or when a document was + * dragged/dropped on the app's icon. You need to have a + * CFBundleDocumentsType section in your Info.plist to get this message, + * apparently. + * + * Files are added to gArgv, so to the app, they'll look like command line + * arguments. Previously, apps launched from the finder had nothing but + * an argv[0]. + * + * This message may be received multiple times to open several docs on launch. + * + * This message is ignored once the app's mainline has been called. + */ +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + const char *temparg; + size_t arglen; + char *arg; + char **newargv; + + if (!gFinderLaunch) /* MacOS is passing command line args. */ + return FALSE; + + if (gCalledAppMainline) /* app has started, ignore this document. */ + return FALSE; + + temparg = [filename UTF8String]; + arglen = SDL_strlen(temparg) + 1; + arg = (char *) SDL_malloc(arglen); + if (arg == NULL) + return FALSE; + + newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2)); + if (newargv == NULL) + { + SDL_free(arg); + return FALSE; + } + gArgv = newargv; + + SDL_strlcpy(arg, temparg, arglen); + gArgv[gArgc++] = arg; + gArgv[gArgc] = NULL; + return TRUE; +} + + /* Called when the internal event loop has just started running */ - (void) applicationDidFinishLaunching: (NSNotification *) note { @@ -189,10 +292,11 @@ void CustomApplicationMain (argc, argv) #if SDL_USE_NIB_FILE /* Set the main menu to contain the real app name instead of "SDL App" */ - [self fixMenu:[NSApp mainMenu] withAppName:[[NSProcessInfo processInfo] processName]]; + [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; #endif /* Hand off to main application code */ + gCalledAppMainline = TRUE; status = SDL_main (gArgc, gArgv); /* We're done, thank you for playing */ @@ -213,7 +317,7 @@ void CustomApplicationMain (argc, argv) NSString *result; bufferSize = selfLen + aStringLen - aRange.length; - buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar)); + buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar)); /* Get first part into buffer */ localRange.location = 0; @@ -250,29 +354,28 @@ void CustomApplicationMain (argc, argv) /* Main entry point to executable - should *not* be SDL_main! */ int main (int argc, char **argv) { - /* Copy the arguments into a global variable */ - int i; - /* This is passed if we are launched by double-clicking */ if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { + gArgv = (char **) SDL_malloc(sizeof (char *) * 2); + gArgv[0] = argv[0]; + gArgv[1] = NULL; gArgc = 1; - gFinderLaunch = YES; + gFinderLaunch = YES; } else { + int i; gArgc = argc; - gFinderLaunch = NO; + gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); + for (i = 0; i <= argc; i++) + gArgv[i] = argv[i]; + gFinderLaunch = NO; } - gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1)); - assert (gArgv != NULL); - for (i = 0; i < gArgc; i++) - gArgv[i] = argv[i]; - gArgv[i] = NULL; #if SDL_USE_NIB_FILE - [SDLApplication poseAsClass:[NSApplication class]]; NSApplicationMain (argc, argv); #else CustomApplicationMain (argc, argv); #endif return 0; } + From 3553ea3cf7f58c6366ea8514114807d118beaf73 Mon Sep 17 00:00:00 2001 From: zico Date: Mon, 8 Apr 2013 12:46:05 +0200 Subject: [PATCH 58/74] Added Rankings functionality like in D2X-Rebirth while still utilizing eff file from original D1X source; Decrease personal score when killing multi buddy and don't increment towards kill goal --- CHANGELOG.txt | 5 + main/gamerend.c | 24 +++- main/menu.c | 16 ++- main/multi.c | 342 ++++++++++++++++++++++++++++++++---------------- main/multi.h | 9 +- main/net_udp.c | 62 +++++++-- main/playsave.c | 4 + main/playsave.h | 1 + 8 files changed, 327 insertions(+), 136 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8fa708a5b..cf722ced8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -10,6 +10,11 @@ d1x-rebirth.xcodeproj/project.pbxproj, editor/ehostage.c, main/custom.c: Updated SConstruct: For the assembler build, make sure platform_settings is accessed from self, likely preventing a compiling error SConstruct: Changes towards building using SCons on Mac OS X +20130119 +-------- +main/gamerend.c, main/menu.c, main/multi.c, main/multi.h, main/net_udp.c, main/playsave.c, main/playsave.h: Added Rankings functionality like in D2X-Rebirth while still utilizing eff file from original D1X source +main/multi.c, main/multi.h: Decrease personal score when killing multi buddy and don't increment towards kill goal + 20130117 -------- main/render.c: Fix click-selection in the editor for OpenGL implementations that insist on point blending diff --git a/main/gamerend.c b/main/gamerend.c index bb93327db..53d96b47c 100644 --- a/main/gamerend.c +++ b/main/gamerend.c @@ -117,7 +117,8 @@ void show_framerate() #ifdef NETWORK void show_netplayerinfo() { - int x=0, y=0, i=0, color=0; + int x=0, y=0, i=0, color=0, eff=0; + char *eff_strings[]={"trashing","really hurting","seriously effecting","hurting","effecting","tarnishing"}; gr_set_current_canvas(NULL); gr_set_curfont(GAME_FONT); @@ -210,6 +211,27 @@ void show_netplayerinfo() gr_printf(x+FSPACX(8)*8,y,"%i",team_kills[1]); y+=LINE_SPACING*2; } + else + y+=LINE_SPACING*4; + + gr_set_fontcolor(255,-1); + + // additional information about game - ranking + eff=(int)((float)((float)PlayerCfg.NetlifeKills/((float)PlayerCfg.NetlifeKilled+(float)PlayerCfg.NetlifeKills))*100.0); + if (eff<0) + eff=0; + + if (!PlayerCfg.NoRankings) + { + gr_printf(0x8000,y,"Your lifetime efficiency of %d%% (%d/%d)",eff,PlayerCfg.NetlifeKills,PlayerCfg.NetlifeKilled); + y+=LINE_SPACING; + if (eff<60) + gr_printf(0x8000,y,"is %s your ranking.",eff_strings[eff/10]); + else + gr_printf(0x8000,y,"is serving you well."); + y+=LINE_SPACING; + gr_printf(0x8000,y,"your rank is: %s",RankStrings[GetMyNetRanking()]); + } } #endif diff --git a/main/menu.c b/main/menu.c index 1b8c3a1b2..7e86bdba4 100644 --- a/main/menu.c +++ b/main/menu.c @@ -1865,7 +1865,7 @@ void do_sound_menu() void do_misc_menu() { - newmenu_item m[8]; + newmenu_item m[9]; int i = 0; do { @@ -1874,9 +1874,10 @@ void do_misc_menu() ADD_CHECK(2, "Screenshots w/o HUD",PlayerCfg.PRShot); ADD_CHECK(3, "No redundant pickup messages",PlayerCfg.NoRedundancy); ADD_CHECK(4, "Show Player chat only (Multi)",PlayerCfg.MultiMessages); - ADD_CHECK(5, "Show D2-style Prox. Bomb Gauge",PlayerCfg.BombGauge); - ADD_CHECK(6, "Free Flight controls in Automap",PlayerCfg.AutomapFreeFlight); - ADD_CHECK(7, "No Weapon Autoselect when firing",PlayerCfg.NoFireAutoselect); + ADD_CHECK(5, "No Rankings (Multi)",PlayerCfg.NoRankings); + ADD_CHECK(6, "Show D2-style Prox. Bomb Gauge",PlayerCfg.BombGauge); + ADD_CHECK(7, "Free Flight controls in Automap",PlayerCfg.AutomapFreeFlight); + ADD_CHECK(8, "No Weapon Autoselect when firing",PlayerCfg.NoFireAutoselect); i = newmenu_do1( NULL, "Misc Options", sizeof(m)/sizeof(*m), m, NULL, NULL, i ); @@ -1885,9 +1886,10 @@ void do_misc_menu() PlayerCfg.PRShot = m[2].value; PlayerCfg.NoRedundancy = m[3].value; PlayerCfg.MultiMessages = m[4].value; - PlayerCfg.BombGauge = m[5].value; - PlayerCfg.AutomapFreeFlight = m[6].value; - PlayerCfg.NoFireAutoselect = m[7].value; + PlayerCfg.NoRankings = m[5].value; + PlayerCfg.BombGauge = m[6].value; + PlayerCfg.AutomapFreeFlight = m[7].value; + PlayerCfg.NoFireAutoselect = m[8].value; } while( i>-1 ); diff --git a/main/multi.c b/main/multi.c index 3c66fc841..80da53cbe 100644 --- a/main/multi.c +++ b/main/multi.c @@ -80,6 +80,7 @@ void multi_send_heartbeat(); void multi_do_kill_goal_counts(const ubyte *buf); void multi_powcap_cap_objects(); void multi_powcap_adjust_remote_cap(int pnum); +void multi_send_ranking(); void multi_new_bounty_target( int pnum ); void multi_do_bounty( const ubyte *buf ); void multi_save_game(ubyte slot, uint id, char *desc); @@ -204,6 +205,7 @@ static const int message_length[MULTI_MAX_TYPE+1] = { 3, // MULTI_GMODE_UPDATE 7, // MULTI_KILL_HOST 5, // MULTI_KILL_CLIENT + 3, // MULTI_RANK }; void multi_reset_player_object(object *objp); @@ -211,6 +213,9 @@ void multi_set_robot_ai(void); void multi_add_lifetime_killed(); void multi_add_lifetime_kills(); +char *RankStrings[]={"(unpatched) ","Cadet ","Ensign ","Lieutenant ","Lt.Commander ", + "Commander ","Captain ","Vice Admiral ","Admiral ","Demigod "}; + int multi_allow_powerup_mask[MAX_POWERUP_TYPES] = { NETFLAG_DOINVUL, 0, 0, NETFLAG_DOLASER, 0, 0, 0, 0, 0, 0, 0, 0, NETFLAG_DOQUAD, NETFLAG_DOVULCAN, NETFLAG_DOSPREAD, NETFLAG_DOPLASMA, NETFLAG_DOFUSION, @@ -222,6 +227,41 @@ char *multi_allow_powerup_text[MULTI_ALLOW_POWERUP_MAX] = "Fusion cannon", "Homing missiles", "Smart missiles", "Mega missiles", "Proximity bombs", "Cloaking", "Invulnerability" }; +int GetMyNetRanking() +{ + int rank, eff; + + if (PlayerCfg.NetlifeKills+PlayerCfg.NetlifeKilled==0) + return (1); + + rank=(int) (((float)PlayerCfg.NetlifeKills/3000.0)*8.0); + + eff=(int)((float)((float)PlayerCfg.NetlifeKills/((float)PlayerCfg.NetlifeKilled+(float)PlayerCfg.NetlifeKills))*100.0); + + if (rank>8) + rank=8; + + if (eff<0) + eff=0; + + if (eff<60) + rank-=((59-eff)/10); + + if (rank<0) + rank=0; + if (rank>8) + rank=8; + + return (rank+1); +} + +void ClipRank (ubyte *rank) +{ + // This function insures no crashes when dealing with D2 1.0 + if (*rank > 9) + *rank = 0; +} + // // Functions that replace what used to be macros // @@ -678,14 +718,21 @@ void multi_compute_kill(int killer, int killed) else { - if (Game_mode & GM_TEAM) + if (Game_mode & GM_TEAM) + { + if (get_team(killed_pnum) == get_team(killer_pnum)) { - if (get_team(killed_pnum) == get_team(killer_pnum)) - team_kills[get_team(killed_pnum)] -= 1; - else - team_kills[get_team(killer_pnum)] += 1; + team_kills[get_team(killed_pnum)] -= 1; + Players[killer_pnum].net_kills_total -= 1; + } + else + { + team_kills[get_team(killer_pnum)] += 1; + Players[killer_pnum].net_kills_total += 1; + Players[killer_pnum].KillGoalCount +=1; + } } - if( Game_mode & GM_BOUNTY ) + else if( Game_mode & GM_BOUNTY ) { /* Did the target die? Did the target get a kill? */ if( killed_pnum == Bounty_target || killer_pnum == Bounty_target ) @@ -2229,111 +2276,6 @@ void multi_reset_object_texture (object *objp) } } -void -multi_process_data(const ubyte *buf, int len) -{ - // Take an entire message (that has already been checked for validity, - // if necessary) and act on it. - - int type; - len = len; - - type = buf[0]; - - if (type > MULTI_MAX_TYPE) - { - Int3(); - return; - } - - switch(type) - { - case MULTI_POSITION: - if (!Endlevel_sequence) multi_do_position(buf); break; - case MULTI_REAPPEAR: - if (!Endlevel_sequence) multi_do_reappear(buf); break; - case MULTI_FIRE: - if (!Endlevel_sequence) multi_do_fire(buf); break; - case MULTI_KILL: - multi_do_kill(buf); break; - case MULTI_REMOVE_OBJECT: - if (!Endlevel_sequence) multi_do_remobj(buf); break; - case MULTI_PLAYER_DROP: - case MULTI_PLAYER_EXPLODE: - if (!Endlevel_sequence) multi_do_player_explode(buf); break; - case MULTI_MESSAGE: - if (!Endlevel_sequence) multi_do_message(buf); break; - case MULTI_QUIT: - if (!Endlevel_sequence) multi_do_quit(buf); break; - case MULTI_BEGIN_SYNC: - break; - case MULTI_CONTROLCEN: - if (!Endlevel_sequence) multi_do_controlcen_destroy(buf); break; - case MULTI_ENDLEVEL_START: - if (!Endlevel_sequence) multi_do_escape(buf); break; - case MULTI_END_SYNC: - break; - case MULTI_CLOAK: - if (!Endlevel_sequence) multi_do_cloak(buf); break; - case MULTI_DECLOAK: - if (!Endlevel_sequence) multi_do_decloak(buf); break; - case MULTI_DOOR_OPEN: - if (!Endlevel_sequence) multi_do_door_open(buf); break; - case MULTI_CREATE_EXPLOSION: - if (!Endlevel_sequence) multi_do_create_explosion(buf); break; - case MULTI_CONTROLCEN_FIRE: - if (!Endlevel_sequence) multi_do_controlcen_fire(buf); break; - case MULTI_CREATE_POWERUP: - if (!Endlevel_sequence) multi_do_create_powerup(buf); break; - case MULTI_PLAY_SOUND: - if (!Endlevel_sequence) multi_do_play_sound(buf); break; - case MULTI_ROBOT_CLAIM: - if (!Endlevel_sequence) multi_do_claim_robot(buf); break; - case MULTI_ROBOT_POSITION: - if (!Endlevel_sequence) multi_do_robot_position(buf); break; - case MULTI_ROBOT_EXPLODE: - if (!Endlevel_sequence) multi_do_robot_explode(buf); break; - case MULTI_ROBOT_RELEASE: - if (!Endlevel_sequence) multi_do_release_robot(buf); break; - case MULTI_ROBOT_FIRE: - if (!Endlevel_sequence) multi_do_robot_fire(buf); break; - case MULTI_SCORE: - if (!Endlevel_sequence) multi_do_score(buf); break; - case MULTI_CREATE_ROBOT: - if (!Endlevel_sequence) multi_do_create_robot(buf); break; - case MULTI_TRIGGER: - if (!Endlevel_sequence) multi_do_trigger(buf); break; - case MULTI_BOSS_ACTIONS: - if (!Endlevel_sequence) multi_do_boss_actions(buf); break; - case MULTI_CREATE_ROBOT_POWERUPS: - if (!Endlevel_sequence) multi_do_create_robot_powerups(buf); break; - case MULTI_HOSTAGE_DOOR: - if (!Endlevel_sequence) multi_do_hostage_door_status(buf); break; - case MULTI_SAVE_GAME: - if (!Endlevel_sequence) multi_do_save_game(buf); break; - case MULTI_RESTORE_GAME: - if (!Endlevel_sequence) multi_do_restore_game(buf); break; - case MULTI_POWCAP_UPDATE: - if (!Endlevel_sequence) multi_do_powcap_update(buf); break; - case MULTI_HEARTBEAT: - if (!Endlevel_sequence) multi_do_heartbeat (buf); break; - case MULTI_KILLGOALS: - if (!Endlevel_sequence) multi_do_kill_goal_counts (buf); break; - case MULTI_DO_BOUNTY: - if( !Endlevel_sequence ) multi_do_bounty( buf ); break; - case MULTI_TYPING_STATE: - multi_do_msgsend_state( buf ); break; - case MULTI_GMODE_UPDATE: - multi_do_gmode_update( buf ); break; - case MULTI_KILL_HOST: - multi_do_kill(buf); break; - case MULTI_KILL_CLIENT: - multi_do_kill(buf); break; - default: - Int3(); - } -} - void multi_process_bigdata(const ubyte *buf, int len) { @@ -3406,20 +3348,85 @@ void multi_check_for_killgoal_winner () net_destroy_controlcen (objp); } +extern char *RankStrings[]; + void multi_add_lifetime_kills () { - // This function adds a kill to lifetime stats of this player - // Trivial, but syncing with D2X + // This function adds a kill to lifetime stats of this player, and possibly + // gives a promotion. If so, it will tell everyone else + + int oldrank; + + if (!(Game_mode & GM_NETWORK)) + return; + + oldrank=GetMyNetRanking(); PlayerCfg.NetlifeKills++; + + if (oldrank!=GetMyNetRanking()) + { + multi_send_ranking(); + if (!PlayerCfg.NoRankings) + { + HUD_init_message(HM_MULTI, "You have been promoted to %s!",RankStrings[GetMyNetRanking()]); + digi_play_sample (SOUND_CONTROL_CENTER_WARNING_SIREN,F1_0*2); + Netgame.players[Player_num].rank=GetMyNetRanking(); + } + } } void multi_add_lifetime_killed () { - // This function adds a "killed" to lifetime stats of this player - // Trivial, but syncing with D2X + // This function adds a "killed" to lifetime stats of this player, and possibly + // gives a demotion. If so, it will tell everyone else + + int oldrank; + + if (!(Game_mode & GM_NETWORK)) + return; + + oldrank=GetMyNetRanking(); PlayerCfg.NetlifeKilled++; + + if (oldrank!=GetMyNetRanking()) + { + multi_send_ranking(); + Netgame.players[Player_num].rank=GetMyNetRanking(); + + if (!PlayerCfg.NoRankings) + HUD_init_message(HM_MULTI, "You have been demoted to %s!",RankStrings[GetMyNetRanking()]); + + } +} + +void multi_send_ranking () +{ + multibuf[0]=(char)MULTI_RANK; + multibuf[1]=(char)Player_num; + multibuf[2]=(char)GetMyNetRanking(); + + multi_send_data (multibuf,3,2); +} + +void multi_do_ranking (char *buf) +{ + char rankstr[20]; + char pnum=buf[1]; + char rank=buf[2]; + + if (Netgame.players[(int)pnum].rankrank) + strcpy (rankstr,"demoted"); + else + return; + + Netgame.players[(int)pnum].rank=rank; + + if (!PlayerCfg.NoRankings) + HUD_init_message(HM_MULTI, "%s has been %s to %s!",Players[(int)pnum].callsign,rankstr,RankStrings[(int)rank]); } // Decide if fire from "killer" is friendly. If yes return 1 (no harm to me) otherwise 0 (damage me) @@ -3728,6 +3735,111 @@ void multi_do_gmode_update(const ubyte *buf) } } +void +multi_process_data(const ubyte *buf, int len) +{ + // Take an entire message (that has already been checked for validity, + // if necessary) and act on it. + + int type; + len = len; + + type = buf[0]; + + if (type > MULTI_MAX_TYPE) + { + Int3(); + return; + } + + switch(type) + { + case MULTI_POSITION: + if (!Endlevel_sequence) multi_do_position(buf); break; + case MULTI_REAPPEAR: + if (!Endlevel_sequence) multi_do_reappear(buf); break; + case MULTI_FIRE: + if (!Endlevel_sequence) multi_do_fire(buf); break; + case MULTI_KILL: + multi_do_kill(buf); break; + case MULTI_REMOVE_OBJECT: + if (!Endlevel_sequence) multi_do_remobj(buf); break; + case MULTI_PLAYER_DROP: + case MULTI_PLAYER_EXPLODE: + if (!Endlevel_sequence) multi_do_player_explode(buf); break; + case MULTI_MESSAGE: + if (!Endlevel_sequence) multi_do_message(buf); break; + case MULTI_QUIT: + if (!Endlevel_sequence) multi_do_quit(buf); break; + case MULTI_BEGIN_SYNC: + break; + case MULTI_CONTROLCEN: + if (!Endlevel_sequence) multi_do_controlcen_destroy(buf); break; + case MULTI_ENDLEVEL_START: + if (!Endlevel_sequence) multi_do_escape(buf); break; + case MULTI_END_SYNC: + break; + case MULTI_CLOAK: + if (!Endlevel_sequence) multi_do_cloak(buf); break; + case MULTI_DECLOAK: + if (!Endlevel_sequence) multi_do_decloak(buf); break; + case MULTI_DOOR_OPEN: + if (!Endlevel_sequence) multi_do_door_open(buf); break; + case MULTI_CREATE_EXPLOSION: + if (!Endlevel_sequence) multi_do_create_explosion(buf); break; + case MULTI_CONTROLCEN_FIRE: + if (!Endlevel_sequence) multi_do_controlcen_fire(buf); break; + case MULTI_CREATE_POWERUP: + if (!Endlevel_sequence) multi_do_create_powerup(buf); break; + case MULTI_PLAY_SOUND: + if (!Endlevel_sequence) multi_do_play_sound(buf); break; + case MULTI_ROBOT_CLAIM: + if (!Endlevel_sequence) multi_do_claim_robot(buf); break; + case MULTI_ROBOT_POSITION: + if (!Endlevel_sequence) multi_do_robot_position(buf); break; + case MULTI_ROBOT_EXPLODE: + if (!Endlevel_sequence) multi_do_robot_explode(buf); break; + case MULTI_ROBOT_RELEASE: + if (!Endlevel_sequence) multi_do_release_robot(buf); break; + case MULTI_ROBOT_FIRE: + if (!Endlevel_sequence) multi_do_robot_fire(buf); break; + case MULTI_SCORE: + if (!Endlevel_sequence) multi_do_score(buf); break; + case MULTI_CREATE_ROBOT: + if (!Endlevel_sequence) multi_do_create_robot(buf); break; + case MULTI_TRIGGER: + if (!Endlevel_sequence) multi_do_trigger(buf); break; + case MULTI_BOSS_ACTIONS: + if (!Endlevel_sequence) multi_do_boss_actions(buf); break; + case MULTI_CREATE_ROBOT_POWERUPS: + if (!Endlevel_sequence) multi_do_create_robot_powerups(buf); break; + case MULTI_HOSTAGE_DOOR: + if (!Endlevel_sequence) multi_do_hostage_door_status(buf); break; + case MULTI_SAVE_GAME: + if (!Endlevel_sequence) multi_do_save_game(buf); break; + case MULTI_RESTORE_GAME: + if (!Endlevel_sequence) multi_do_restore_game(buf); break; + case MULTI_POWCAP_UPDATE: + if (!Endlevel_sequence) multi_do_powcap_update(buf); break; + case MULTI_HEARTBEAT: + if (!Endlevel_sequence) multi_do_heartbeat (buf); break; + case MULTI_KILLGOALS: + if (!Endlevel_sequence) multi_do_kill_goal_counts (buf); break; + case MULTI_DO_BOUNTY: + if( !Endlevel_sequence ) multi_do_bounty( buf ); break; + case MULTI_TYPING_STATE: + multi_do_msgsend_state( buf ); break; + case MULTI_GMODE_UPDATE: + multi_do_gmode_update( buf ); break; + case MULTI_KILL_HOST: + multi_do_kill(buf); break; + case MULTI_KILL_CLIENT: + multi_do_kill(buf); break; + default: + Int3(); + } +} + // Following functions convert object to object_rw and back. // turn object to object_rw for sending void multi_object_to_object_rw(object *obj, object_rw *obj_rw) diff --git a/main/multi.h b/main/multi.h index c2c68f7a0..abcd6fd10 100644 --- a/main/multi.h +++ b/main/multi.h @@ -64,7 +64,7 @@ extern int multi_protocol; // set and determinate used protocol #define MULTI_PROTO_UDP 1 // UDP protocol // What version of the multiplayer protocol is this? Increment each time something drastic changes in Multiplayer without the version number changes. Can be reset to 0 each time the version of the game changes -#define MULTI_PROTO_VERSION 3 +#define MULTI_PROTO_VERSION 5 // PROTOCOL VARIABLES AND DEFINES - END @@ -113,8 +113,9 @@ extern int multi_protocol; // set and determinate used protocol #define MULTI_GMODE_UPDATE 42 #define MULTI_KILL_HOST 43 #define MULTI_KILL_CLIENT 44 +#define MULTI_RANK 45 -#define MULTI_MAX_TYPE 44 +#define MULTI_MAX_TYPE 45 #define MAX_MULTI_MESSAGE_LEN 90 //didn't change it, just moved it up @@ -175,6 +176,8 @@ extern char *multi_allow_powerup_text[MULTI_ALLOW_POWERUP_MAX]; // Exported functions +extern int GetMyNetRanking(); +extern void ClipRank (ubyte *rank); int objnum_remote_to_local(int remote_obj, int owner); int objnum_local_to_remote(int local_obj, sbyte *owner); void map_objnum_local_to_remote(int local, int remote, int owner); @@ -301,6 +304,8 @@ extern int Bounty_target; extern bitmap_index multi_player_textures[MAX_PLAYERS][N_PLAYER_SHIP_TEXTURES]; +extern char *RankStrings[]; + #define NETGAME_FLAG_CLOSED 1 #define NETGAME_FLAG_SHOW_ID 2 #define NETGAME_FLAG_SHOW_MAP 4 diff --git a/main/net_udp.c b/main/net_udp.c index 8cda9159a..9254c9d6b 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -1057,6 +1057,8 @@ void net_udp_init() UDP_Seq.type = UPID_REQUEST; memcpy(UDP_Seq.player.callsign, Players[Player_num].callsign, CALLSIGN_LEN+1); + UDP_Seq.player.rank=GetMyNetRanking(); + multi_new_game(); net_udp_flush(); @@ -1236,6 +1238,9 @@ net_udp_new_player(UDP_sequence_packet *their) memcpy(Netgame.players[pnum].callsign, their->player.callsign, CALLSIGN_LEN+1); memcpy(&Netgame.players[pnum].protocol.udp.addr, &their->player.protocol.udp.addr, sizeof(struct _sockaddr)); + ClipRank (&their->player.rank); + Netgame.players[pnum].rank=their->player.rank; + Players[pnum].connected = CONNECT_PLAYING; Players[pnum].net_kills_total = 0; Players[pnum].net_killed_total = 0; @@ -1252,7 +1257,12 @@ net_udp_new_player(UDP_sequence_packet *their) digi_play_sample(SOUND_HUD_MESSAGE, F1_0); - HUD_init_message(HM_MULTI, "'%s' %s",their->player.callsign, TXT_JOINING); + ClipRank (&their->player.rank); + + if (PlayerCfg.NoRankings) + HUD_init_message(HM_MULTI, "'%s' %s\n",their->player.callsign, TXT_JOINING); + else + HUD_init_message(HM_MULTI, "%s'%s' %s\n",RankStrings[their->player.rank],their->player.callsign, TXT_JOINING); multi_make_ghost_player(pnum); @@ -1384,7 +1394,10 @@ void net_udp_welcome_player(UDP_sequence_packet *their) digi_play_sample(SOUND_HUD_MESSAGE, F1_0); - HUD_init_message(HM_MULTI, "'%s' %s", Players[player_num].callsign, TXT_REJOIN); + if (PlayerCfg.NoRankings) + HUD_init_message(HM_MULTI, "'%s' %s", Players[player_num].callsign, TXT_REJOIN); + else + HUD_init_message(HM_MULTI, "%s'%s' %s", RankStrings[Netgame.players[player_num].rank],Players[player_num].callsign, TXT_REJOIN); multi_send_score(); @@ -1875,6 +1888,7 @@ void net_udp_add_player(UDP_sequence_packet *p) return; // too many of em } + ClipRank (&p->player.rank); memcpy( Netgame.players[N_players].callsign, p->player.callsign, CALLSIGN_LEN+1 ); memcpy( (struct _sockaddr *)&Netgame.players[N_players].protocol.udp.addr, (struct _sockaddr *)&p->player.protocol.udp.addr, sizeof(struct _sockaddr) ); Netgame.players[N_players].rank=p->player.rank; @@ -1912,6 +1926,7 @@ void net_udp_remove_player(UDP_sequence_packet *p) memcpy( Netgame.players[i].callsign, Netgame.players[i+1].callsign, CALLSIGN_LEN+1 ); memcpy( (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, (struct _sockaddr *)&Netgame.players[i+1].protocol.udp.addr, sizeof(struct _sockaddr) ); Netgame.players[i].rank=Netgame.players[i+1].rank; + ClipRank (&Netgame.players[i].rank); } N_players--; @@ -2766,8 +2781,10 @@ int net_udp_start_poll( newmenu *menu, d_event *event, void *userdata ) if (n < Netgame.numplayers ) { - sprintf( menus[N_players-1].text, "%d. %-16s", N_players, Netgame.players[N_players-1].callsign ); - + if (PlayerCfg.NoRankings) + sprintf( menus[N_players-1].text, "%d. %-20s", N_players,Netgame.players[N_players-1].callsign ); + else + sprintf( menus[N_players-1].text, "%d. %s%-20s", N_players, RankStrings[Netgame.players[N_players-1].rank],Netgame.players[N_players-1].callsign ); //Begin addition by GF digi_play_sample(SOUND_HUD_MESSAGE, F1_0); //A noise to alert you when someone joins a starting game... //End addition by GF @@ -2787,7 +2804,10 @@ int net_udp_start_poll( newmenu *menu, d_event *event, void *userdata ) for (i=0; i N_players) { memcpy(Netgame.players[N_players].callsign, Netgame.players[i].callsign, CALLSIGN_LEN+1); + Netgame.players[N_players].rank=Netgame.players[i].rank; + ClipRank (&Netgame.players[N_players].rank); } Players[N_players].connected = CONNECT_PLAYING; N_players++; @@ -3621,6 +3647,7 @@ abort: for (i = N_players; i < MAX_PLAYERS; i++) { memset(Netgame.players[i].callsign, 0, CALLSIGN_LEN+1); + Netgame.players[i].rank=0; } if (Netgame.gamemode == NETGAME_TEAM_ANARCHY) @@ -4670,8 +4697,12 @@ void net_udp_read_pdata_packet(UDP_frame_info *pd) newdemo_record_multi_reconnect(TheirPlayernum); digi_play_sample( SOUND_HUD_MESSAGE, F1_0); - - HUD_init_message(HM_MULTI, "'%s' %s", Players[TheirPlayernum].callsign, TXT_REJOIN ); + ClipRank (&Netgame.players[TheirPlayernum].rank); + + if (PlayerCfg.NoRankings) + HUD_init_message(HM_MULTI, "'%s' %s", Players[TheirPlayernum].callsign, TXT_REJOIN ); + else + HUD_init_message(HM_MULTI, "%s'%s' %s", RankStrings[Netgame.players[TheirPlayernum].rank],Players[TheirPlayernum].callsign, TXT_REJOIN ); multi_send_score(); @@ -4787,6 +4818,8 @@ void net_udp_process_pong(ubyte *data, int data_len, struct _sockaddr sender_add void net_udp_do_refuse_stuff (UDP_sequence_packet *their) { int i,new_player_num; + + ClipRank (&their->player.rank); for (i=0;iplayer.callsign); + if (!PlayerCfg.NoRankings) + { + HUD_init_message(HM_MULTI, "%s %s wants to join",RankStrings[their->player.rank],their->player.callsign); + } + else + { + HUD_init_message(HM_MULTI, "%s wants to join",their->player.callsign); + } HUD_init_message(HM_MULTI, "Alt-1 assigns to team %s. Alt-2 to team %s",Netgame.team_name[0],Netgame.team_name[1]); } else diff --git a/main/playsave.c b/main/playsave.c index cc426725d..b00a95286 100644 --- a/main/playsave.c +++ b/main/playsave.c @@ -94,6 +94,7 @@ int new_player_config() PlayerCfg.PRShot = 0; PlayerCfg.NoRedundancy = 0; PlayerCfg.MultiMessages = 0; + PlayerCfg.NoRankings = 0; PlayerCfg.BombGauge = 1; PlayerCfg.AutomapFreeFlight = 0; PlayerCfg.NoFireAutoselect = 0; @@ -319,6 +320,8 @@ int read_player_d1x(char *filename) PlayerCfg.NoRedundancy = atoi(line); if(!strcmp(word,"MULTIMESSAGES")) PlayerCfg.MultiMessages = atoi(line); + if(!strcmp(word,"NORANKINGS")) + PlayerCfg.NoRankings = atoi(line); if(!strcmp(word,"BOMBGAUGE")) PlayerCfg.BombGauge = atoi(line); if(!strcmp(word,"AUTOMAPFREEFLIGHT")) @@ -653,6 +656,7 @@ int write_player_d1x(char *filename) PHYSFSX_printf(fout,"prshot=%i\n",PlayerCfg.PRShot); PHYSFSX_printf(fout,"noredundancy=%i\n",PlayerCfg.NoRedundancy); PHYSFSX_printf(fout,"multimessages=%i\n",PlayerCfg.MultiMessages); + PHYSFSX_printf(fout,"norankings=%i\n",PlayerCfg.NoRankings); PHYSFSX_printf(fout,"bombgauge=%i\n",PlayerCfg.BombGauge); PHYSFSX_printf(fout,"automapfreeflight=%i\n",PlayerCfg.AutomapFreeFlight); PHYSFSX_printf(fout,"nofireautoselect=%i\n",PlayerCfg.NoFireAutoselect); diff --git a/main/playsave.h b/main/playsave.h index 812242d98..47e1920a7 100644 --- a/main/playsave.h +++ b/main/playsave.h @@ -78,6 +78,7 @@ typedef struct player_config int PRShot; ubyte NoRedundancy; ubyte MultiMessages; + ubyte NoRankings; ubyte BombGauge; ubyte AutomapFreeFlight; ubyte NoFireAutoselect; From 758f2d64f8e21d40dd2062e10a3748a103780656 Mon Sep 17 00:00:00 2001 From: zico Date: Mon, 8 Apr 2013 12:54:02 +0200 Subject: [PATCH 59/74] Support for Raspberry Pi - patch by derhass --- CHANGELOG.txt | 4 + README.RPi | 72 ++++++++++ SConstruct | 17 ++- arch/ogl/gr.c | 378 +++++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 422 insertions(+), 49 deletions(-) create mode 100644 README.RPi diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cf722ced8..76f4ebfe2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -10,6 +10,10 @@ d1x-rebirth.xcodeproj/project.pbxproj, editor/ehostage.c, main/custom.c: Updated SConstruct: For the assembler build, make sure platform_settings is accessed from self, likely preventing a compiling error SConstruct: Changes towards building using SCons on Mac OS X +20130122 +-------- +README.RPi, SConstruct, arch/ogl/gr.c: Support for Raspberry Pi - patch by derhass + 20130119 -------- main/gamerend.c, main/menu.c, main/multi.c, main/multi.h, main/net_udp.c, main/playsave.c, main/playsave.h: Added Rankings functionality like in D2X-Rebirth while still utilizing eff file from original D1X source diff --git a/README.RPi b/README.RPi new file mode 100644 index 000000000..ca159b909 --- /dev/null +++ b/README.RPi @@ -0,0 +1,72 @@ +DXX-Rebirth for the Raspberry Pi + +BUILDING: +========= +Make sure you have installed (the development packages of) all of the required +libraries (libsdl, libphysfs, ...). For building, you will also need scons (and +for that, python). Most linux distributions should contain all the required +packages, debain/raspbian do so for sure. Using a distribution with hardfp ABI +is recommended for optimal performance. I developed/tested this on a raspbian +wheezy. + +To build directly on the device, just run: + +scons raspberrypi=1 [... other options (see scons -h)...] + +This assumes that the development files (libs/headers) for the VideoCore APIs +are located in /opt/vc. You can use rpi_vc_path to specify another location. + +Currently, there is no direct support for crosscompiling. + +RUNNING: +======== +The game should run with X11 or directly on the console (libsdl with fbcon/ +directfb driver). + +NOTE: *** PLEASE USE THE 128/128MB MEMORY SPLIT *** + +The game might completely freeze or diplay messed up graphics in +out-of-(GPU)-memory situations. If you want to run it with the 192/64MB memory +split, you might be able to do so by setting the texture filter to "NONE" in +the graphics options. (This disables mip mapping and reduces the memory +requirements of the textures. Note that the "BILINEAR" filter still uses +mipmapping). + +If the game freezes during the "Prepare for Descent" phase when loading a +level, you probably do not have enough GPU memory. + +RUNNING ON X11: +=============== +Recommendation is to use fullscreen mode. However, you can run in "windowed" +mode, too. The game will open an X11 window in that case, and the actual game +output will be an overlay of the same size, but not at the same position, and +always on top (and completely out of control of the X Server). Game input is +still handled via the X11 window, so make sure it has the focus. + +RUNNING ON THE CONSOLE: +======================= +libsdl supports running directly on the Linux console. While the SDL Video mode +is technically not required on the RPi, we still have to use it to get all the +input events we need. libsdl seems to have problems on the RPi, I always get a +crash in libsdl when trying to change the resolution. To avoid such crashes, +the code will try to detect if it is running on the console and activate a hack +to prevent switching the resolution. Note that the in-game framebuffer +resolution can still be changed, the RPi will just scale the output to the +initial resolution (in "fullscreen" mode). "Windowed" mode will just result in +unscaled output. As libsdl creates a black screen, you will not be able to have +the "Window" on top of the linux console output :( + +NOTE: You might need root privileges to use the libsdl fbcon/directfb drivers. + +BUGS, SUGGESTIONS AND FEEDBACK: +=============================== + +The RPi patch was written by: + Marcel Heinz + +Send bug reports, suggestions and other feedback regarding the operation +on the RPi to me via email, or post to the official dxx-rebirth forum at: + http://www.dxx-rebirth.com/frm/index.php + + -- derhass, 2012-08-09 + diff --git a/SConstruct b/SConstruct index 205bdc7b1..64cc7e6ff 100644 --- a/SConstruct +++ b/SConstruct @@ -37,12 +37,15 @@ class DXXProgram: PREFIX = str(ARGUMENTS.get('prefix', '/usr/local')) self.BIN_DIR = PREFIX + '/bin' self.DATA_DIR = PREFIX + '/share/games/' + target + + # Paths for the Videocore libs/includes on the Raspberry Pi + self.RPI_DEFAULT_VC_PATH='/opt/vc' + # command-line parms self.sharepath = str(ARGUMENTS.get('sharepath', self.DATA_DIR)) self.debug = int(ARGUMENTS.get('debug', 0)) self.profiler = int(ARGUMENTS.get('profiler', 0)) self.opengl = int(ARGUMENTS.get('opengl', 1)) - self.opengles = int(ARGUMENTS.get('opengles', 0)) self.asm = int(ARGUMENTS.get('asm', 0)) self.editor = int(ARGUMENTS.get('editor', 0)) self.extra_version = ARGUMENTS.get('extra_version', None) @@ -51,6 +54,16 @@ class DXXProgram: self.use_udp = int(ARGUMENTS.get('use_udp', 1)) self.use_tracker = int(ARGUMENTS.get('use_tracker', 1)) self.verbosebuild = int(ARGUMENTS.get('verbosebuild', 0)) + self.raspberrypi = int(ARGUMENTS.get('raspberrypi', 0)) + self.rpi_vc_path = str(ARGUMENTS.get('rpi_vc_path', self.RPI_DEFAULT_VC_PATH)) + self.default_opengles = 0 + self.default_OGLES_LIB = 'GLES_CM' + # automatic setup for raspberrypi + if (self.raspberrypi == 1): + self.default_opengles=1 + self.default_OGLES_LIB='GLESv2' + self.opengles = int(ARGUMENTS.get('opengles', self.default_opengles)) + self.opengles_lib = str(ARGUMENTS.get('opengles_lib', self.default_OGLES_LIB)) builddir_prefix = ARGUMENTS.get('builddir_prefix', None) builddir_suffix = ARGUMENTS.get('builddir_suffix', None) default_builddir = builddir_prefix or '' @@ -546,6 +559,8 @@ Help(program.PROGRAM_NAME + ', SConstruct file help:' + 'use_udp=[0/1]' enable UDP support [default: 1] 'use_tracker=[0/1]' enable Tracker support (requires udp) [default :1] 'verbosebuild=[0/1]' print out all compiler/linker messages during building [default: 0] + 'raspberrypi=[0/1]' build for Raspberry Pi (automatically sets opengles and opengles_lib) [default: 0] + 'rpi_vc_path=[DIR]' use [DIR] to look for VideoCore libraries/header files (RPi only) Default values: """ + ' sharepath = ' + program.user_settings.DATA_DIR + """ diff --git a/arch/ogl/gr.c b/arch/ogl/gr.c index 1ce4d56dc..275e8cf5a 100644 --- a/arch/ogl/gr.c +++ b/arch/ogl/gr.c @@ -6,6 +6,11 @@ #define DECLARE_VARS +#ifdef RPI +// extra libraries for the Raspberry Pi +#include "bcm_host.h" +#endif + #include #include #include @@ -51,7 +56,7 @@ #include #else #ifdef OGLES -#include +#include #include #include #include @@ -62,18 +67,26 @@ #ifdef OGLES int sdl_video_flags = 0; + +#ifdef RPI +static EGL_DISPMANX_WINDOW_T nativewindow; +static DISPMANX_ELEMENT_HANDLE_T dispman_element=DISPMANX_NO_HANDLE; +static DISPMANX_DISPLAY_HANDLE_T dispman_display=DISPMANX_NO_HANDLE; +#endif + #else int sdl_video_flags = SDL_OPENGL; #endif int gr_installed = 0; int gl_initialized=0; int linedotscale=1; // scalar of glLinewidth and glPointSize - only calculated once when resolution changes +int sdl_no_modeswitch=0; #ifdef OGLES -EGLDisplay eglDisplay; +EGLDisplay eglDisplay=EGL_NO_DISPLAY; EGLConfig eglConfig; -EGLSurface eglSurface; -EGLContext eglContext; +EGLSurface eglSurface=EGL_NO_SURFACE; +EGLContext eglContext=EGL_NO_CONTEXT; bool TestEGLError(char* pszLocation) { @@ -102,8 +115,176 @@ void ogl_swap_buffers_internal(void) #endif } +#ifdef RPI + +// MH: I got the following constants for vc_dispmanx_element_change_attributes() from: +// http://qt.gitorious.org/qt/qtbase/commit/5933205cfcd73481cb0645fa6183103063fe3e0d +// I do not know where they got them from, but OTOH, they are quite obvious. + +// these constants are not in any headers (yet) +#define ELEMENT_CHANGE_LAYER (1<<0) +#define ELEMENT_CHANGE_OPACITY (1<<1) +#define ELEMENT_CHANGE_DEST_RECT (1<<2) +#define ELEMENT_CHANGE_SRC_RECT (1<<3) +#define ELEMENT_CHANGE_MASK_RESOURCE (1<<4) +#define ELEMENT_CHANGE_TRANSFORM (1<<5) + +void rpi_destroy_element(void) +{ + if (dispman_element != DISPMANX_NO_HANDLE) { + DISPMANX_UPDATE_HANDLE_T dispman_update; + con_printf(CON_DEBUG, "RPi: destroying display manager element\n"); + dispman_update = vc_dispmanx_update_start( 0 ); + if (vc_dispmanx_element_remove( dispman_update, dispman_element)) { + con_printf(CON_URGENT, "RPi: failed to remove dispmanx element!\n"); + } + vc_dispmanx_update_submit_sync( dispman_update ); + dispman_element = DISPMANX_NO_HANDLE; + } +} + +int rpi_setup_element(int x, int y, Uint32 video_flags, int update) +{ + // this code is based on the work of Ben O'Steen + // http://benosteen.wordpress.com/2012/04/27/using-opengl-es-2-0-on-the-raspberry-pi-without-x-windows/ + // https://github.com/benosteen/opengles-book-samples/tree/master/Raspi + DISPMANX_UPDATE_HANDLE_T dispman_update; + VC_RECT_T dst_rect; + VC_RECT_T src_rect; + VC_DISPMANX_ALPHA_T alpha_descriptor; + + uint32_t rpi_display_device=DISPMANX_ID_MAIN_LCD; + uint32_t display_width; + uint32_t display_height; + int success; + + success = graphics_get_display_size(rpi_display_device, &display_width, &display_height); + if ( success < 0 ) { + con_printf(CON_URGENT, "Could not get RPi display size, assuming 640x480\n"); + display_width=640; + display_height=480; + } + + if ((uint32_t)x > display_width) { + con_printf(CON_URGENT, "RPi: Requested width %d exceeds display width %u, scaling down!\n", + x,display_width); + x=(int)display_width; + } + if ((uint32_t)y > display_height) { + con_printf(CON_URGENT, "RPi: Requested height %d exceeds display height %u, scaling down!\n", + y,display_height); + y=(int)display_height; + } + + con_printf(CON_DEBUG, "RPi: display resolution %ux%u, game resolution: %dx%d (%s)\n", display_width, display_height, x, y, (video_flags & SDL_FULLSCREEN)?"fullscreen":"windowed"); + if (video_flags & SDL_FULLSCREEN) { + /* scale to the full display size... */ + dst_rect.x = 0; + dst_rect.y = 0; + dst_rect.width = display_width; + dst_rect.height= display_height; + } else { + /* TODO: we could query the position of the X11 window here + and try to place the ovelray exactly above that..., + we would have to track window movements, though ... */ + dst_rect.x = 0; + dst_rect.y = 0; + dst_rect.width = (uint32_t)x; + dst_rect.height= (uint32_t)y; + } + + src_rect.x = 0; + src_rect.y = 0; + src_rect.width = ((uint32_t)x)<< 16; + src_rect.height =((uint32_t)y)<< 16; + + /* we do not want our overlay to be blended against the background */ + alpha_descriptor.flags=DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS; + alpha_descriptor.opacity=0xffffffff; + alpha_descriptor.mask=0; + + // open display, if we do not already have one ... + if (dispman_display == DISPMANX_NO_HANDLE) { + con_printf(CON_DEBUG, "RPi: opening display: %u\n",rpi_display_device); + dispman_display = vc_dispmanx_display_open(rpi_display_device); + if (dispman_display == DISPMANX_NO_HANDLE) { + con_printf(CON_URGENT,"RPi: failed to open display: %u\n",rpi_display_device); + } + } + + if (dispman_element != DISPMANX_NO_HANDLE) { + if (!update) { + // if the element already exists, and we cannot update it, so recreate it + rpi_destroy_element(); + } + } else { + // if the element does not exist, we cannot do an update + update=0; + } + + dispman_update = vc_dispmanx_update_start( 0 ); + + if (update) { + con_printf(CON_DEBUG, "RPi: updating display manager element\n"); + vc_dispmanx_element_change_attributes ( dispman_update, nativewindow.element, + ELEMENT_CHANGE_DEST_RECT | ELEMENT_CHANGE_SRC_RECT, + 0 /*layer*/, 0 /*opacity*/, + &dst_rect, &src_rect, + 0 /*mask*/, VC_IMAGE_ROT0 /*transform*/); + } else { + // create a new element + con_printf(CON_DEBUG, "RPi: creating display manager element\n"); + dispman_element = vc_dispmanx_element_add ( dispman_update, dispman_display, + 0 /*layer*/, &dst_rect, 0 /*src*/, + &src_rect, DISPMANX_PROTECTION_NONE, + &alpha_descriptor, NULL /*clamp*/, + VC_IMAGE_ROT0 /*transform*/); + if (dispman_element == DISPMANX_NO_HANDLE) { + con_printf(CON_URGENT,"RPi: failed to creat display manager elemenr\n"); + } + nativewindow.element = dispman_element; + } + nativewindow.width = display_width; + nativewindow.height = display_height; + vc_dispmanx_update_submit_sync( dispman_update ); + + return 0; +} + +#endif // RPI + +#ifdef OGLES +void ogles_destroy(void) +{ + if( eglDisplay != EGL_NO_DISPLAY ) { + eglMakeCurrent(eglDisplay, NULL, NULL, EGL_NO_CONTEXT); + } + + if (eglContext != EGL_NO_CONTEXT) { + con_printf(CON_DEBUG, "EGL: destroyig context\n"); + eglDestroyContext(eglDisplay, eglContext); + eglContext = EGL_NO_CONTEXT; + } + + if (eglSurface != EGL_NO_SURFACE) { + con_printf(CON_DEBUG, "EGL: destroyig surface\n"); + eglDestroySurface(eglDisplay, eglSurface); + eglSurface = EGL_NO_SURFACE; + } + + if (eglDisplay != EGL_NO_DISPLAY) { + con_printf(CON_DEBUG, "EGL: terminating\n"); + eglTerminate(eglDisplay); + eglDisplay = EGL_NO_DISPLAY; + } +} +#endif + int ogl_init_window(int x, int y) { + int use_x,use_y,use_bpp; + Uint32 use_flags; + #ifdef OGLES SDL_SysWMinfo info; Window x11Window = 0; @@ -117,10 +298,16 @@ int ogl_init_window(int x, int y) EGL_DEPTH_SIZE, 16, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, - EGL_NONE + EGL_NONE, EGL_NONE }; + + // explicitely request an OpenGL ES 1.x context + EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE, EGL_NONE }; + // explicitely request a doublebuffering window + EGLint winAttribs[] = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER, EGL_NONE, EGL_NONE }; + int iConfigs; -#endif +#endif // OGLES if (gl_initialized) ogl_smash_texture_list_internal();//if we are or were fullscreen, changing vid mode will invalidate current textures @@ -128,18 +315,38 @@ int ogl_init_window(int x, int y) SDL_WM_SetCaption(DESCENT_VERSION, "Descent"); SDL_WM_SetIcon( SDL_LoadBMP( "d1x-rebirth.bmp" ), NULL ); - if (!SDL_SetVideoMode(x, y, GameArg.DbgBpp, sdl_video_flags)) + use_x=x; + use_y=y; + use_bpp=GameArg.DbgBpp; + use_flags=sdl_video_flags; + if (sdl_no_modeswitch) { + const SDL_VideoInfo *vinfo=SDL_GetVideoInfo(); + if (vinfo) { + use_x=vinfo->current_w; + use_y=vinfo->current_h; + use_bpp=vinfo->vfmt->BitsPerPixel; + use_flags=SDL_SWSURFACE | SDL_ANYFORMAT; + } else { + con_printf(CON_URGENT, "Could not query video info\n"); + } + } + + if (!SDL_SetVideoMode(use_x, use_y, use_bpp, use_flags)) { +#ifdef RPI + con_printf(CON_URGENT, "Could not set %dx%dx%d opengl video mode: %s\n (Ignored for RPI)", + x, y, GameArg.DbgBpp, SDL_GetError()); +#else Error("Could not set %dx%dx%d opengl video mode: %s\n", x, y, GameArg.DbgBpp, SDL_GetError()); +#endif } #ifdef OGLES - if( eglSurface || eglContext || eglDisplay ) - { - eglMakeCurrent(eglDisplay, NULL, NULL, EGL_NO_CONTEXT); - eglDestroyContext(eglDisplay, eglContext); - eglDestroySurface(eglDisplay, eglSurface); - } +#ifndef RPI + // NOTE: on the RPi, the EGL stuff is not connected to the X11 window, + // so there is no need to destroy and recreate this + ogles_destroy(); +#endif SDL_VERSION(&info.version); @@ -147,42 +354,67 @@ int ogl_init_window(int x, int y) if (info.subsystem == SDL_SYSWM_X11) { x11Display = info.info.x11.display; x11Window = info.info.x11.window; - printf ("Display: %p, Window: %i ===\n", x11Display, x11Window); + con_printf (CON_DEBUG, "Display: %p, Window: %i ===\n", (void*)x11Display, (int)x11Window); + } + } + + if (eglDisplay == EGL_NO_DISPLAY) { +#ifdef RPI + eglDisplay = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); +#else + eglDisplay = eglGetDisplay((EGLNativeDisplayType)x11Display); +#endif + if (eglDisplay == EGL_NO_DISPLAY) { + con_printf(CON_URGENT, "EGL: Error querying EGL Display\n"); + } + + if (!eglInitialize(eglDisplay, &ver_maj, &ver_min)) { + con_printf(CON_URGENT, "EGL: Error initializing EGL\n"); + } else { + con_printf(CON_DEBUG, "EGL: Initialized, version: major %i minor %i\n", ver_maj, ver_min); + } + } + + +#ifdef RPI + if (rpi_setup_element(x,y,sdl_video_flags,1)) { + Error("RPi: Could not set up a %dx%d element\n", x, y); + } +#endif + + if (eglSurface == EGL_NO_SURFACE) { + if (!eglChooseConfig(eglDisplay, configAttribs, &eglConfig, 1, &iConfigs) || (iConfigs != 1)) { + con_printf(CON_URGENT, "EGL: Error choosing config\n"); + } else { + con_printf(CON_DEBUG, "EGL: config chosen\n"); + } + +#ifdef RPI + eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (EGLNativeWindowType)&nativewindow, winAttribs); +#else + eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (NativeWindowType)x11Window, winAttribs); +#endif + if ((!TestEGLError("eglCreateWindowSurface")) || eglSurface == EGL_NO_SURFACE) { + con_printf(CON_URGENT, "EGL: Error creating window surface\n"); + } else { + con_printf(CON_DEBUG, "EGL: Created window surface\n"); } } - eglDisplay = eglGetDisplay((NativeDisplayType)x11Display); - if (!eglInitialize(eglDisplay, &ver_maj, &ver_min)) { - con_printf(CON_URGENT, "EGL: Error initializing EGL\n"); - } else { - con_printf(CON_URGENT, "EGL: Initialized, version: major %i minor %i\n", ver_maj, ver_min); - } - - if (!eglChooseConfig(eglDisplay, configAttribs, &eglConfig, 1, &iConfigs) || (iConfigs != 1)) { - con_printf(CON_URGENT, "EGL: Error choosing config\n"); - } else { - con_printf(CON_URGENT, "EGL: Choosed config\n", ver_maj, ver_min); - } - - eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (NativeWindowType)x11Window, NULL); - if (!TestEGLError("eglCreateWindowSurface")) { - con_printf(CON_URGENT, "EGL: Error creating window surface\n"); - } else { - con_printf(CON_URGENT, "EGL: Created window surface\n"); - } - - eglContext = eglCreateContext(eglDisplay, eglConfig, NULL, NULL); - if (!TestEGLError("eglCreateContext")) { - con_printf(CON_URGENT, "EGL: Error creating context\n"); - } else { - con_printf(CON_URGENT, "EGL: Created context\n"); + if (eglContext == EGL_NO_CONTEXT) { + eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs); + if ((!TestEGLError("eglCreateContext")) || eglContext == EGL_NO_CONTEXT) { + con_printf(CON_URGENT, "EGL: Error creating context\n"); + } else { + con_printf(CON_DEBUG, "EGL: Created context\n"); + } } eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); if (!TestEGLError("eglMakeCurrent")) { con_printf(CON_URGENT, "EGL: Error making current\n"); } else { - con_printf(CON_URGENT, "EGL: Created current\n"); + con_printf(CON_DEBUG, "EGL: made context current\n"); } #endif @@ -206,15 +438,22 @@ int gr_toggle_fullscreen(void) if (gl_initialized) { - if (!SDL_VideoModeOK(SM_W(Game_screen_mode), SM_H(Game_screen_mode), GameArg.DbgBpp, sdl_video_flags)) - { - con_printf(CON_URGENT,"Cannot set %ix%i. Fallback to 640x480\n",SM_W(Game_screen_mode), SM_H(Game_screen_mode)); - Game_screen_mode=SM(640,480); + if (sdl_no_modeswitch == 0) { + if (!SDL_VideoModeOK(SM_W(Game_screen_mode), SM_H(Game_screen_mode), GameArg.DbgBpp, sdl_video_flags)) + { + con_printf(CON_URGENT,"Cannot set %ix%i. Fallback to 640x480\n",SM_W(Game_screen_mode), SM_H(Game_screen_mode)); + Game_screen_mode=SM(640,480); + } + if (!SDL_SetVideoMode(SM_W(Game_screen_mode), SM_H(Game_screen_mode), GameArg.DbgBpp, sdl_video_flags)) + { + Error("Could not set %dx%dx%d opengl video mode: %s\n", SM_W(Game_screen_mode), SM_H(Game_screen_mode), GameArg.DbgBpp, SDL_GetError()); + } } - if (!SDL_SetVideoMode(SM_W(Game_screen_mode), SM_H(Game_screen_mode), GameArg.DbgBpp, sdl_video_flags)) - { - Error("Could not set %dx%dx%d opengl video mode: %s\n", SM_W(Game_screen_mode), SM_H(Game_screen_mode), GameArg.DbgBpp, SDL_GetError()); +#ifdef RPI + if (rpi_setup_element(SM_W(Game_screen_mode), SM_H(Game_screen_mode), sdl_video_flags, 1)) { + Error("RPi: Could not set up %dx%d element\n", SM_W(Game_screen_mode), SM_H(Game_screen_mode)); } +#endif } if (gl_initialized) // update viewing values for menus @@ -328,6 +567,11 @@ int gr_list_modes( u_int32_t gsmodes[] ) int sdl_check_flags = SDL_OPENGL | SDL_FULLSCREEN; // always use Fullscreen as lead. #endif + if (sdl_no_modeswitch) { + /* TODO: we could use the tvservice to list resolutions on the RPi */ + return 0; + } + modes = SDL_ListModes(NULL, sdl_check_flags); if (modes == (SDL_Rect**)0) // check if we get any modes - if not, return 0 @@ -361,7 +605,12 @@ int gr_check_mode(u_int32_t mode) w=SM_W(mode); h=SM_H(mode); - return SDL_VideoModeOK(w, h, GameArg.DbgBpp, sdl_video_flags); + if (sdl_no_modeswitch == 0) { + return SDL_VideoModeOK(w, h, GameArg.DbgBpp, sdl_video_flags); + } else { + // just tell the caller that any mode is valid... + return 32; + } } int gr_set_mode(u_int32_t mode) @@ -470,12 +719,32 @@ void gr_set_attributes(void) int gr_init(int mode) { +#ifdef RPI + char sdl_driver[32]; + char *sdl_driver_ret; +#endif + int retcode; // Only do this function once! if (gr_installed==1) return -1; +#ifdef RPI + // Initialize the broadcom host library + // we have to call this before we can create an OpenGL ES context + bcm_host_init(); + + // Check if we are running with SDL directfb driver ... + sdl_driver_ret=SDL_VideoDriverName(sdl_driver,32); + if (sdl_driver_ret) { + if (strcmp(sdl_driver_ret,"x11")) { + con_printf(CON_URGENT,"RPi: activating hack for console driver\n"); + sdl_no_modeswitch=1; + } + } +#endif + #ifdef _WIN32 ogl_init_load_library(); #endif @@ -534,6 +803,19 @@ void gr_close() if (ogl_rt_loaded) OpenGL_LoadLibrary(false); #endif + +#ifdef OGLES + ogles_destroy(); +#ifdef RPI + con_printf(CON_DEBUG, "RPi: cleanuing up\n"); + if (dispman_display != DISPMANX_NO_HANDLE) { + rpi_destroy_element(); + con_printf(CON_DEBUG, "RPi: closing display\n"); + vc_dispmanx_display_close(dispman_display); + dispman_display = DISPMANX_NO_HANDLE; + } +#endif +#endif } extern int r_upixelc; From c60b007398943cf2c0b007e88a1af7f82b8a8b56 Mon Sep 17 00:00:00 2001 From: zico Date: Mon, 8 Apr 2013 12:55:27 +0200 Subject: [PATCH 60/74] Increased ship wiggle from 20FPS- to 30FPS-base as I think this more representy the 486 play style - feels way more natural to me, too --- CHANGELOG.txt | 1 + main/controls.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 76f4ebfe2..d0ff6f0d1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -13,6 +13,7 @@ SConstruct: Changes towards building using SCons on Mac OS X 20130122 -------- README.RPi, SConstruct, arch/ogl/gr.c: Support for Raspberry Pi - patch by derhass +main/controls.c: Increased ship wiggle from 20FPS- to 30FPS-base as I think this more representy the 486 play style - feels way more natural to me, too 20130119 -------- diff --git a/main/controls.c b/main/controls.c index 449b6c432..c66bf5037 100644 --- a/main/controls.c +++ b/main/controls.c @@ -58,7 +58,7 @@ void read_flying_controls( object * obj ) fix swiggle; fix_fastsincos(((fix)GameTime64), &swiggle, NULL); if (FrameTime < F1_0) // Only scale wiggle if getting at least 1 FPS, to avoid causing the opposite problem. - swiggle = fixmul(swiggle*20, FrameTime); //make wiggle fps-independant (based on pre-scaled amount of wiggle at 20 FPS) + swiggle = fixmul(swiggle*30, FrameTime); //make wiggle fps-independant (based on pre-scaled amount of wiggle at 30 FPS) vm_vec_scale_add2(&obj->mtype.phys_info.velocity,&obj->orient.uvec,fixmul(swiggle,Player_ship->wiggle)); } From bf52256c8d87837d43325ec0f11cf9481a991ad1 Mon Sep 17 00:00:00 2001 From: zico Date: Mon, 8 Apr 2013 14:28:41 +0200 Subject: [PATCH 61/74] Added 4th alternative HUD mode for no HUD rendering, aka Immersion mode --- CHANGELOG.txt | 4 ++++ main/gamecntl.c | 7 +++++++ main/gamerend.c | 31 ------------------------------- main/gauges.c | 33 +++++++++++++++++++++++++++++++++ main/gauges.h | 2 +- 5 files changed, 45 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d0ff6f0d1..1f0728bdc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20130408 +-------- +main/gamecntl.c, main/gamerend.c, main/gauges.c, main/gauges.h: Added 4th alternative HUD mode for no HUD rendering, aka Immersion mode + 20130406 -------- d1x-rebirth.xcodeproj/project.pbxproj, editor/ehostage.c, main/custom.c: Updated Xcode project, changed references to error.h to dxxerror.h, since it was renamed diff --git a/main/gamecntl.c b/main/gamecntl.c index 7671689a7..162be9cd4 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -679,6 +679,13 @@ int HandleGameKey(int key) KEY_MAC(case KEY_COMMAND+KEY_ALTED+KEY_7:) PlayerCfg.HudMode=(PlayerCfg.HudMode+1)%GAUGE_HUD_NUMMODES; write_player_file(); + switch (PlayerCfg.HudMode) + { + case 0: HUD_init_message(HM_DEFAULT, "Standard HUD"); break; + case 1: HUD_init_message(HM_DEFAULT, "Alternative HUD #1"); break; + case 2: HUD_init_message(HM_DEFAULT, "Alternative HUD #2"); break; + case 3: HUD_init_message(HM_DEFAULT, "No HUD"); break; + } break; #ifdef NETWORK diff --git a/main/gamerend.c b/main/gamerend.c index 53d96b47c..ee81f4f84 100644 --- a/main/gamerend.c +++ b/main/gamerend.c @@ -56,8 +56,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "ogl_init.h" #endif -extern fix Cruise_speed; - int netplayerinfo_on=0; #ifdef NETWORK @@ -329,35 +327,6 @@ void game_draw_hud_stuff() render_countdown_gauge(); - // this should be made part of hud code some day - if ( Player_num > -1 && Viewer->type==OBJ_PLAYER && Viewer->id==Player_num && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) { - int x = FSPACX(1); - int y = grd_curcanv->cv_bitmap.bm_h; - - gr_set_curfont( GAME_FONT ); - gr_set_fontcolor( BM_XRGB(0, 31, 0), -1 ); - if (Cruise_speed > 0) { - if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN) { - if (Game_mode & GM_MULTI) - y -= LINE_SPACING * 10; - else - y -= LINE_SPACING * 6; - } else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) { - if (Game_mode & GM_MULTI) - y -= LINE_SPACING * 6; - else - y -= LINE_SPACING * 1; - } else { - if (Game_mode & GM_MULTI) - y -= LINE_SPACING * 7; - else - y -= LINE_SPACING * 2; - } - - gr_printf( x, y, "%s %2d%%", TXT_CRUISE, f2i(Cruise_speed) ); - } - } - if (GameCfg.FPSIndicator && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) show_framerate(); diff --git a/main/gauges.c b/main/gauges.c index 6e99655f8..bbbe90765 100644 --- a/main/gauges.c +++ b/main/gauges.c @@ -337,6 +337,7 @@ int weapon_box_states[2]; fix weapon_box_fade_values[2]; int Color_0_31_0 = -1; extern fix ThisLevelTime; +extern fix Cruise_speed; typedef struct gauge_box { int left,top; @@ -2387,6 +2388,38 @@ void show_HUD_names() void draw_hud() { + if (PlayerCfg.HudMode==3) // no hud, "immersion mode" + return; + + // Cruise speed + if ( Player_num > -1 && Viewer->type==OBJ_PLAYER && Viewer->id==Player_num && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) { + int x = FSPACX(1); + int y = grd_curcanv->cv_bitmap.bm_h; + + gr_set_curfont( GAME_FONT ); + gr_set_fontcolor( BM_XRGB(0, 31, 0), -1 ); + if (Cruise_speed > 0) { + if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN) { + if (Game_mode & GM_MULTI) + y -= LINE_SPACING * 10; + else + y -= LINE_SPACING * 6; + } else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) { + if (Game_mode & GM_MULTI) + y -= LINE_SPACING * 6; + else + y -= LINE_SPACING * 1; + } else { + if (Game_mode & GM_MULTI) + y -= LINE_SPACING * 7; + else + y -= LINE_SPACING * 2; + } + + gr_printf( x, y, "%s %2d%%", TXT_CRUISE, f2i(Cruise_speed) ); + } + } + // Show score so long as not in rearview if ( !Rear_view && PlayerCfg.CockpitMode[1]!=CM_REAR_VIEW && PlayerCfg.CockpitMode[1]!=CM_STATUS_BAR) { hud_show_score(); diff --git a/main/gauges.h b/main/gauges.h index 9bbf6e6e4..eaf477939 100644 --- a/main/gauges.h +++ b/main/gauges.h @@ -59,7 +59,7 @@ typedef struct { extern rgb player_rgb[]; -#define GAUGE_HUD_NUMMODES 3 +#define GAUGE_HUD_NUMMODES 4 typedef struct span { int l,r; From dab702aba94286fe20b97a6b6ed35e3006df6243 Mon Sep 17 00:00:00 2001 From: zico Date: Mon, 8 Apr 2013 15:04:19 +0200 Subject: [PATCH 62/74] Added option to ignore cycling weapons that are not on autoselect list --- CHANGELOG.txt | 1 + main/menu.c | 4 +++- main/playsave.c | 4 ++++ main/playsave.h | 1 + main/weapon.c | 26 ++++++++++++++++++++++---- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1f0728bdc..e6f2a8e08 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20130408 -------- main/gamecntl.c, main/gamerend.c, main/gauges.c, main/gauges.h: Added 4th alternative HUD mode for no HUD rendering, aka Immersion mode +main/menu.c, main/playsave.c, main/playsave.h, main/weapons.c: Added option to ignore cycling weapons that are not on autoselect list 20130406 -------- diff --git a/main/menu.c b/main/menu.c index 7e86bdba4..c5643a6e7 100644 --- a/main/menu.c +++ b/main/menu.c @@ -1865,7 +1865,7 @@ void do_sound_menu() void do_misc_menu() { - newmenu_item m[9]; + newmenu_item m[10]; int i = 0; do { @@ -1878,6 +1878,7 @@ void do_misc_menu() ADD_CHECK(6, "Show D2-style Prox. Bomb Gauge",PlayerCfg.BombGauge); ADD_CHECK(7, "Free Flight controls in Automap",PlayerCfg.AutomapFreeFlight); ADD_CHECK(8, "No Weapon Autoselect when firing",PlayerCfg.NoFireAutoselect); + ADD_CHECK(9, "Only Cycle Autoselect Weapons",PlayerCfg.CycleAutoselectOnly); i = newmenu_do1( NULL, "Misc Options", sizeof(m)/sizeof(*m), m, NULL, NULL, i ); @@ -1890,6 +1891,7 @@ void do_misc_menu() PlayerCfg.BombGauge = m[6].value; PlayerCfg.AutomapFreeFlight = m[7].value; PlayerCfg.NoFireAutoselect = m[8].value; + PlayerCfg.CycleAutoselectOnly = m[9].value; } while( i>-1 ); diff --git a/main/playsave.c b/main/playsave.c index b00a95286..d72361eb9 100644 --- a/main/playsave.c +++ b/main/playsave.c @@ -98,6 +98,7 @@ int new_player_config() PlayerCfg.BombGauge = 1; PlayerCfg.AutomapFreeFlight = 0; PlayerCfg.NoFireAutoselect = 0; + PlayerCfg.CycleAutoselectOnly = 0; PlayerCfg.AlphaEffects = 0; PlayerCfg.DynLightColor = 0; @@ -328,6 +329,8 @@ int read_player_d1x(char *filename) PlayerCfg.AutomapFreeFlight = atoi(line); if(!strcmp(word,"NOFIREAUTOSELECT")) PlayerCfg.NoFireAutoselect = atoi(line); + if(!strcmp(word,"CYCLEAUTOSELECTONLY")) + PlayerCfg.CycleAutoselectOnly = atoi(line); d_free(word); PHYSFSX_fgets(line,50,f); word=splitword(line,'='); @@ -660,6 +663,7 @@ int write_player_d1x(char *filename) PHYSFSX_printf(fout,"bombgauge=%i\n",PlayerCfg.BombGauge); PHYSFSX_printf(fout,"automapfreeflight=%i\n",PlayerCfg.AutomapFreeFlight); PHYSFSX_printf(fout,"nofireautoselect=%i\n",PlayerCfg.NoFireAutoselect); + PHYSFSX_printf(fout,"cycleautoselectonly=%i\n",PlayerCfg.CycleAutoselectOnly); PHYSFSX_printf(fout,"[end]\n"); PHYSFSX_printf(fout,"[graphics]\n"); PHYSFSX_printf(fout,"alphaeffects=%i\n",PlayerCfg.AlphaEffects); diff --git a/main/playsave.h b/main/playsave.h index 47e1920a7..e3022ddd3 100644 --- a/main/playsave.h +++ b/main/playsave.h @@ -82,6 +82,7 @@ typedef struct player_config ubyte BombGauge; ubyte AutomapFreeFlight; ubyte NoFireAutoselect; + ubyte CycleAutoselectOnly; int AlphaEffects; int DynLightColor; } __pack__ player_config; diff --git a/main/weapon.c b/main/weapon.c index d69dd2403..515672784 100644 --- a/main/weapon.c +++ b/main/weapon.c @@ -154,8 +154,17 @@ void CyclePrimary () cur_order_slot++; // next slot if (cur_order_slot >= MAX_PRIMARY_WEAPONS+1) // loop if necessary cur_order_slot = 0; - if (cur_order_slot == POrderList(255)) // ignore "do not autoselect" - continue; + if (cur_order_slot == POrderList(255)) // what to to with non-autoselect weapons? + { + if (PlayerCfg.CycleAutoselectOnly) + { + cur_order_slot = 0; // loop over or ... + } + else + { + continue; // continue? + } + } desired_weapon = PlayerCfg.PrimaryOrder[cur_order_slot]; // now that is the weapon next to our current one // select the weapon if we have it if (player_has_weapon(desired_weapon, 0) == HAS_ALL) @@ -176,8 +185,17 @@ void CycleSecondary () cur_order_slot++; // next slot if (cur_order_slot >= MAX_SECONDARY_WEAPONS+1) // loop if necessary cur_order_slot = 0; - if (cur_order_slot == SOrderList(255)) // ignore "do not autoselect" - continue; + if (cur_order_slot == SOrderList(255)) // what to to with non-autoselect weapons? + { + if (PlayerCfg.CycleAutoselectOnly) + { + cur_order_slot = 0; // loop over or ... + } + else + { + continue; // continue? + } + } desired_weapon = PlayerCfg.SecondaryOrder[cur_order_slot]; // now that is the weapon next to our current one // select the weapon if we have it if (player_has_weapon(desired_weapon, 1) == HAS_ALL) From 6d3dc4f1b16af68d4cabe52c870e34b400205725 Mon Sep 17 00:00:00 2001 From: zico Date: Thu, 18 Apr 2013 11:56:32 +0200 Subject: [PATCH 63/74] Removed light_frame_count due to being unnecessary since lighting is now time-based and messed up deletion of dynamic light --- CHANGELOG.txt | 4 ++ main/lighting.c | 125 +++++++++++++++++++++++------------------------- main/render.c | 6 +-- 3 files changed, 65 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e6f2a8e08..cc12604ee 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20130418 +-------- +main/lighting.c, main/render.c: Removed light_frame_count due to being unnecessary since lighting is now time-based and messed up deletion of dynamic light + 20130408 -------- main/gamecntl.c, main/gamerend.c, main/gauges.c, main/gauges.h: Added 4th alternative HUD mode for no HUD rendering, aka Immersion mode diff --git a/main/lighting.c b/main/lighting.c index 6cbbb377c..c457cfa89 100644 --- a/main/lighting.c +++ b/main/lighting.c @@ -47,7 +47,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. int Do_dynamic_light=1; int use_fcd_lighting = 0; -static int light_frame_count = 0; g3s_lrgb Dynamic_light[MAX_VERTICES]; #define HEADLIGHT_CONE_DOT (F1_0*9/10) @@ -73,25 +72,22 @@ void apply_light(g3s_lrgb obj_light_emission, int obj_seg, vms_vector *obj_pos, fix dist; vertnum = vp[vv]; - if ((vertnum ^ light_frame_count) & 1) { - vertpos = &Vertices[vertnum]; - dist = vm_vec_dist_quick(obj_pos, vertpos); - dist = fixmul(dist/4, dist/4); - if (dist < abs(obji_64)) { - if (dist < MIN_LIGHT_DIST) - dist = MIN_LIGHT_DIST; - - Dynamic_light[vertnum].r += fixdiv(obj_light_emission.r, dist); - Dynamic_light[vertnum].g += fixdiv(obj_light_emission.g, dist); - Dynamic_light[vertnum].b += fixdiv(obj_light_emission.b, dist); - } + vertpos = &Vertices[vertnum]; + dist = vm_vec_dist_quick(obj_pos, vertpos); + dist = fixmul(dist/4, dist/4); + if (dist < abs(obji_64)) { + if (dist < MIN_LIGHT_DIST) + dist = MIN_LIGHT_DIST; + + Dynamic_light[vertnum].r += fixdiv(obj_light_emission.r, dist); + Dynamic_light[vertnum].g += fixdiv(obj_light_emission.g, dist); + Dynamic_light[vertnum].b += fixdiv(obj_light_emission.b, dist); } } } else { int headlight_shift = 0; fix max_headlight_dist = F1_0*200; - // -- for (vv=light_frame_count&1; vv F1_0*32) - { - dist = find_connected_distance(obj_pos, obj_seg, vertpos, vsegnum, n_render_vertices, WID_RENDPAST_FLAG+WID_FLY_FLAG); - if (dist >= 0) - apply_light = 1; - } - else - { - dist = vm_vec_dist_quick(obj_pos, vertpos); + if (use_fcd_lighting && abs(obji_64) > F1_0*32) + { + dist = find_connected_distance(obj_pos, obj_seg, vertpos, vsegnum, n_render_vertices, WID_RENDPAST_FLAG+WID_FLY_FLAG); + if (dist >= 0) apply_light = 1; - } + } + else + { + dist = vm_vec_dist_quick(obj_pos, vertpos); + apply_light = 1; + } - if (apply_light && ((dist >> headlight_shift) < abs(obji_64))) { + if (apply_light && ((dist >> headlight_shift) < abs(obji_64))) { - if (dist < MIN_LIGHT_DIST) - dist = MIN_LIGHT_DIST; + if (dist < MIN_LIGHT_DIST) + dist = MIN_LIGHT_DIST; - if (headlight_shift && objnum != -1) + if (headlight_shift && objnum != -1) + { + fix dot; + vms_vector vec_to_point; + + vm_vec_sub(&vec_to_point, vertpos, obj_pos); + vm_vec_normalize_quick(&vec_to_point); // MK, Optimization note: You compute distance about 15 lines up, this is partially redundant + dot = vm_vec_dot(&vec_to_point, &Objects[objnum].orient.fvec); + if (dot < F1_0/2) { - fix dot; - vms_vector vec_to_point; - - vm_vec_sub(&vec_to_point, vertpos, obj_pos); - vm_vec_normalize_quick(&vec_to_point); // MK, Optimization note: You compute distance about 15 lines up, this is partially redundant - dot = vm_vec_dot(&vec_to_point, &Objects[objnum].orient.fvec); - if (dot < F1_0/2) + // Do the normal thing, but darken around headlight. + Dynamic_light[vertnum].r += fixdiv(obj_light_emission.r, fixmul(HEADLIGHT_SCALE, dist)); + Dynamic_light[vertnum].g += fixdiv(obj_light_emission.g, fixmul(HEADLIGHT_SCALE, dist)); + Dynamic_light[vertnum].b += fixdiv(obj_light_emission.b, fixmul(HEADLIGHT_SCALE, dist)); + } + else + { + if (Game_mode & GM_MULTI) { - // Do the normal thing, but darken around headlight. - Dynamic_light[vertnum].r += fixdiv(obj_light_emission.r, fixmul(HEADLIGHT_SCALE, dist)); - Dynamic_light[vertnum].g += fixdiv(obj_light_emission.g, fixmul(HEADLIGHT_SCALE, dist)); - Dynamic_light[vertnum].b += fixdiv(obj_light_emission.b, fixmul(HEADLIGHT_SCALE, dist)); - } - else - { - if (Game_mode & GM_MULTI) - { - if (dist < max_headlight_dist) - { - Dynamic_light[vertnum].r += fixmul(fixmul(dot, dot), obj_light_emission.r)/8; - Dynamic_light[vertnum].g += fixmul(fixmul(dot, dot), obj_light_emission.g)/8; - Dynamic_light[vertnum].b += fixmul(fixmul(dot, dot), obj_light_emission.b)/8; - } - } - else + if (dist < max_headlight_dist) { Dynamic_light[vertnum].r += fixmul(fixmul(dot, dot), obj_light_emission.r)/8; Dynamic_light[vertnum].g += fixmul(fixmul(dot, dot), obj_light_emission.g)/8; Dynamic_light[vertnum].b += fixmul(fixmul(dot, dot), obj_light_emission.b)/8; } } + else + { + Dynamic_light[vertnum].r += fixmul(fixmul(dot, dot), obj_light_emission.r)/8; + Dynamic_light[vertnum].g += fixmul(fixmul(dot, dot), obj_light_emission.g)/8; + Dynamic_light[vertnum].b += fixmul(fixmul(dot, dot), obj_light_emission.b)/8; + } } - else - { - Dynamic_light[vertnum].r += fixdiv(obj_light_emission.r, dist); - Dynamic_light[vertnum].g += fixdiv(obj_light_emission.g, dist); - Dynamic_light[vertnum].b += fixdiv(obj_light_emission.b, dist); - } + } + else + { + Dynamic_light[vertnum].r += fixdiv(obj_light_emission.r, dist); + Dynamic_light[vertnum].g += fixdiv(obj_light_emission.g, dist); + Dynamic_light[vertnum].b += fixdiv(obj_light_emission.b, dist); } } } @@ -397,15 +391,17 @@ void set_dynamic_light(void) int vert_segnum_list[MAX_VERTICES]; sbyte render_vertex_flags[MAX_VERTICES]; int render_seg,segnum, v; + static fix light_time; Num_headlights = 0; if (!Do_dynamic_light) return; - light_frame_count++; - if (light_frame_count > F1_0) - light_frame_count = 0; + light_time += FrameTime; + if (light_time < (F1_0/60)) // it's enough to stress the CPU 60 times per second + return; + light_time = light_time - (F1_0/60); memset(render_vertex_flags, 0, Highest_vertex_index+1); @@ -436,8 +432,7 @@ void set_dynamic_light(void) vertnum = render_vertices[vv]; Assert(vertnum >= 0 && vertnum <= Highest_vertex_index); - if ((vertnum ^ light_frame_count) & 1) - Dynamic_light[vertnum].r = Dynamic_light[vertnum].g = Dynamic_light[vertnum].b = 0; + Dynamic_light[vertnum].r = Dynamic_light[vertnum].g = Dynamic_light[vertnum].b = 0; } cast_muzzle_flash_light(n_render_vertices, render_vertices, vert_segnum_list); diff --git a/main/render.c b/main/render.c index 2cc6e52fc..91c147915 100644 --- a/main/render.c +++ b/main/render.c @@ -1679,7 +1679,6 @@ done_list: void render_mine(int start_seg_num,fix eye_offset) { int nn; - static fix64 dynlight_time = 0; //moved 9/2/98 by Victor Rachels to remove warning/unused var #ifndef NDEBUG @@ -1751,11 +1750,8 @@ void render_mine(int start_seg_num,fix eye_offset) if (!(_search_mode)) build_object_lists(N_render_segs); - if (eye_offset<=0 && dynlight_time < timer_query()) // Do for left eye or zero. - { - dynlight_time = timer_query() + (F1_0/60); // It's enough to update dynamic light 60 times per second max. More is just waste of CPU time + if (eye_offset<=0) // Do for left eye or zero. set_dynamic_light(); - } if (!_search_mode && Clear_window == 2) { if (first_terminal_seg < N_render_segs) { From b769485d9ac3fce46c98b6e438ac5c540b58c202 Mon Sep 17 00:00:00 2001 From: zico Date: Thu, 18 Apr 2013 12:08:53 +0200 Subject: [PATCH 64/74] Due to additive blending, transparent sprites will become invivible in font of white surfaces (lamps). Fix that with a little desaturation --- CHANGELOG.txt | 1 + main/render.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cc12604ee..eccf5aca1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20130418 -------- main/lighting.c, main/render.c: Removed light_frame_count due to being unnecessary since lighting is now time-based and messed up deletion of dynamic light +main/render.c: Due to additive blending, transparent sprites will become invivible in font of white surfaces (lamps). Fix that with a little desaturation 20130408 -------- diff --git a/main/render.c b/main/render.c index 91c147915..f37b56a9c 100644 --- a/main/render.c +++ b/main/render.c @@ -269,6 +269,12 @@ void render_face(int segnum, int sidenum, int nv, int *vp, int tmap1, int tmap2, dyn_light[i].g = MAX_LIGHT; if (dyn_light[i].b > MAX_LIGHT) dyn_light[i].b = MAX_LIGHT; + if (PlayerCfg.AlphaEffects) // due to additive blending, transparent sprites will become invivible in font of white surfaces (lamps). Fix that with a little desaturation + { + dyn_light[i].r *= .93; + dyn_light[i].g *= .93; + dyn_light[i].b *= .93; + } } From a060ec45db954908e17084531471eddbeb582288 Mon Sep 17 00:00:00 2001 From: zico Date: Thu, 18 Apr 2013 15:14:16 +0200 Subject: [PATCH 65/74] Made UPID_GAME_INFO_SIZE, UPID_GAME_INFO_LITE_SIZE and UPID_SEQUENCE_SIZE change if NETGAME_NAME_LEN, MISSION_NAME_LEN or CALLSIGN_LEN changes, fixes bug where joining games was not possible anymore due to recent change of MISSION_NAME_LEN --- CHANGELOG.txt | 1 + main/net_udp.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index eccf5aca1..2af9eafc7 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D1X-Rebirth Changelog -------- main/lighting.c, main/render.c: Removed light_frame_count due to being unnecessary since lighting is now time-based and messed up deletion of dynamic light main/render.c: Due to additive blending, transparent sprites will become invivible in font of white surfaces (lamps). Fix that with a little desaturation +main/net_udp.h: Made UPID_GAME_INFO_SIZE, UPID_GAME_INFO_LITE_SIZE and UPID_SEQUENCE_SIZE change if NETGAME_NAME_LEN, MISSION_NAME_LEN or CALLSIGN_LEN changes, fixes bug where joining games was not possible anymore due to recent change of MISSION_NAME_LEN 20130408 -------- diff --git a/main/net_udp.h b/main/net_udp.h index f94fa6128..cfbb64d2b 100644 --- a/main/net_udp.h +++ b/main/net_udp.h @@ -48,16 +48,16 @@ void net_udp_send_mdata_direct(ubyte *data, int data_len, int pnum, int priority #define UPID_GAME_INFO_REQ_SIZE 13 #define UPID_GAME_INFO_LITE_REQ_SIZE 11 #define UPID_GAME_INFO 3 // Packet containing all info about a netgame. -#define UPID_GAME_INFO_SIZE 506 +#define UPID_GAME_INFO_SIZE (360 + (NETGAME_NAME_LEN+1) + (MISSION_NAME_LEN+1) + ((MAX_PLAYERS+4)*(CALLSIGN_LEN+1))) #define UPID_GAME_INFO_LITE_REQ 4 // Requesting lite info about a netgame. Used for discovering games. #define UPID_GAME_INFO_LITE 5 // Packet containing lite netgame info. -#define UPID_GAME_INFO_LITE_SIZE 69 +#define UPID_GAME_INFO_LITE_SIZE (31 + (NETGAME_NAME_LEN+1) + (MISSION_NAME_LEN+1)) #define UPID_DUMP 6 // Packet containing why player cannot join this game. #define UPID_DUMP_SIZE 2 #define UPID_ADDPLAYER 7 // Packet from Host containing info about a new player. #define UPID_REQUEST 8 // New player says: "I want to be inside of you!" (haha, sorry I could not resist) / Packet containing request to join the game actually. #define UPID_QUIT_JOINING 9 // Packet from a player who suddenly quits joining. -#define UPID_SEQUENCE_SIZE 12 +#define UPID_SEQUENCE_SIZE (3 + (CALLSIGN_LEN+1)) #define UPID_SYNC 10 // Packet from host containing full netgame info to sync players up. #define UPID_OBJECT_DATA 11 // Packet from host containing object buffer. #define UPID_PING 12 // Packet from host containing his GameTime and the Ping list. Client returns this time to host as UPID_PONG and adapts the ping list. From 8ae018aa0c7b77915109df51bb9504837d2c91c2 Mon Sep 17 00:00:00 2001 From: zico Date: Thu, 18 Apr 2013 15:45:40 +0200 Subject: [PATCH 66/74] use const ubyte for multi_do_powcap_update() --- CHANGELOG.txt | 1 + main/multi.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2af9eafc7..c1b35b1fb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,7 @@ D1X-Rebirth Changelog main/lighting.c, main/render.c: Removed light_frame_count due to being unnecessary since lighting is now time-based and messed up deletion of dynamic light main/render.c: Due to additive blending, transparent sprites will become invivible in font of white surfaces (lamps). Fix that with a little desaturation main/net_udp.h: Made UPID_GAME_INFO_SIZE, UPID_GAME_INFO_LITE_SIZE and UPID_SEQUENCE_SIZE change if NETGAME_NAME_LEN, MISSION_NAME_LEN or CALLSIGN_LEN changes, fixes bug where joining games was not possible anymore due to recent change of MISSION_NAME_LEN +main/multi.c: use const ubyte for multi_do_powcap_update() 20130408 -------- diff --git a/main/multi.c b/main/multi.c index 80da53cbe..223b56fb4 100644 --- a/main/multi.c +++ b/main/multi.c @@ -3249,7 +3249,7 @@ void multi_send_powcap_update () multi_send_data(multibuf, MAX_POWERUP_TYPES+1, 2); } -void multi_do_powcap_update (char *buf) +void multi_do_powcap_update (const ubyte *buf) { int i; From cb280a8ef4167a47961d423eabcb82b0584f79fc Mon Sep 17 00:00:00 2001 From: zico Date: Thu, 18 Apr 2013 15:46:09 +0200 Subject: [PATCH 67/74] Adjusted SB_PRIMARY_W_BOX_RIGHT_L to fit perfectly --- CHANGELOG.txt | 1 + main/gauges.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c1b35b1fb..8f3f27983 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,6 +6,7 @@ main/lighting.c, main/render.c: Removed light_frame_count due to being unnecessa main/render.c: Due to additive blending, transparent sprites will become invivible in font of white surfaces (lamps). Fix that with a little desaturation main/net_udp.h: Made UPID_GAME_INFO_SIZE, UPID_GAME_INFO_LITE_SIZE and UPID_SEQUENCE_SIZE change if NETGAME_NAME_LEN, MISSION_NAME_LEN or CALLSIGN_LEN changes, fixes bug where joining games was not possible anymore due to recent change of MISSION_NAME_LEN main/multi.c: use const ubyte for multi_do_powcap_update() +main/gauges.c: Adjusted SB_PRIMARY_W_BOX_RIGHT_L to fit perfectly 20130408 -------- diff --git a/main/gauges.c b/main/gauges.c index bbbe90765..2fa4e9ffc 100644 --- a/main/gauges.c +++ b/main/gauges.c @@ -257,7 +257,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define SB_PRIMARY_W_BOX_LEFT_L 34 //50 #define SB_PRIMARY_W_BOX_TOP_L 154 -#define SB_PRIMARY_W_BOX_RIGHT_L (SB_PRIMARY_W_BOX_LEFT_L+53) +#define SB_PRIMARY_W_BOX_RIGHT_L (SB_PRIMARY_W_BOX_LEFT_L+55) #define SB_PRIMARY_W_BOX_BOT_L (195) #define SB_PRIMARY_W_BOX_LEFT_H 68 From e658660d21a6764508e789fb88547452034cac3e Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 7 Apr 2013 22:52:32 +0000 Subject: [PATCH 68/74] Make name of GLES_CM library configurable --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 64cc7e6ff..688eb9727 100644 --- a/SConstruct +++ b/SConstruct @@ -134,7 +134,7 @@ class DXXProgram: self.osdef = '__LINUX__' self.osasmdef = 'elf' if (user_settings.opengles == 1): - self.ogllibs = ['GLES_CM', 'EGL'] + self.ogllibs = [ user_settings.opengles_lib, 'EGL'] else: self.ogllibs = ['GL', 'GLU'] self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' From 47aa7d000dfa5353eb134e77b4873b7d72ca8329 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 7 Apr 2013 22:52:51 +0000 Subject: [PATCH 69/74] Make CPPDEFINES consistent with unification branch --- SConstruct | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 688eb9727..f3a3e8132 100644 --- a/SConstruct +++ b/SConstruct @@ -103,7 +103,7 @@ class DXXProgram: self.libs = ['glu32', 'wsock32', 'ws2_32', 'winmm', 'mingw32', 'SDLmain', 'SDL'] def adjust_environment(self,program,env): env.RES('arch/win32/%s.rc' % program.target) - env.Append(CPPDEFINES = ['_WIN32']) + env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL']) env.Append(CPPPATH = [os.path.join(self.srcdir, 'arch/win32/include')]) self.platform_sources = [os.path.join(program.srcdir, 'arch/win32/messagebox.c')] # Settings to apply to Apple builds @@ -120,7 +120,7 @@ class DXXProgram: VERSION += '.' + str(program.VERSION_MICRO) env['VERSION_NUM'] = VERSION env['VERSION_NAME'] = program.PROGRAM_NAME + ' v' + VERSION - env.Append(CPPDEFINES = ['__unix__']) + env.Append(CPPDEFINES = ['HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL', '__unix__']) env.Append(CPPPATH = [os.path.join(program.srcdir, '../physfs'), os.path.join(os.getenv("HOME"), 'Library/Frameworks/SDL.framework/Headers'), '/Library/Frameworks/SDL.framework/Headers']) self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] env.Append(FRAMEWORKS = ['ApplicationServices', 'Carbon', 'Cocoa', 'SDL']) @@ -139,7 +139,7 @@ class DXXProgram: self.ogllibs = ['GL', 'GLU'] self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' def adjust_environment(self,program,env): - env.Append(CPPDEFINES = ['__LINUX__']) + env.Append(CPPDEFINES = ['__LINUX__', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL']) env.ParseConfig('pkg-config --cflags --libs sdl') self.libs = env['LIBS'] env.Append(CPPPATH = [os.path.join(program.srcdir, 'arch/linux/include')]) From 17ca9f15bd95aadba1c06571087ffcc8fda49e05 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 3 Mar 2013 00:53:35 +0000 Subject: [PATCH 70/74] Move compiler flags/selection into a base class above DXXProgram --- SConstruct | 174 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 110 insertions(+), 64 deletions(-) diff --git a/SConstruct b/SConstruct index f3a3e8132..4e407eb66 100644 --- a/SConstruct +++ b/SConstruct @@ -23,26 +23,13 @@ def checkEndian(): return "big" return "unknown" -class DXXProgram: +class DXXCommon: __endian = checkEndian() - # version number - VERSION_MAJOR = 0 - VERSION_MINOR = 57 - VERSION_MICRO = 3 - common_sources = [] - editor_sources = [] class UserSettings: - def __init__(self,ARGUMENTS,target): - # installation path - PREFIX = str(ARGUMENTS.get('prefix', '/usr/local')) - self.BIN_DIR = PREFIX + '/bin' - self.DATA_DIR = PREFIX + '/share/games/' + target - + def __init__(self,ARGUMENTS): # Paths for the Videocore libs/includes on the Raspberry Pi self.RPI_DEFAULT_VC_PATH='/opt/vc' - # command-line parms - self.sharepath = str(ARGUMENTS.get('sharepath', self.DATA_DIR)) self.debug = int(ARGUMENTS.get('debug', 0)) self.profiler = int(ARGUMENTS.get('profiler', 0)) self.opengl = int(ARGUMENTS.get('opengl', 1)) @@ -95,23 +82,15 @@ class DXXProgram: class Win32PlatformSettings(_PlatformSettings): tools = ['mingw'] def __init__(self,user_settings): - DXXProgram._PlatformSettings.__init__(self) + DXXCommon._PlatformSettings.__init__(self) self.osdef = '_WIN32' self.osasmdef = 'win32' - user_settings.sharepath = '' - self.lflags = '-mwindows' - self.libs = ['glu32', 'wsock32', 'ws2_32', 'winmm', 'mingw32', 'SDLmain', 'SDL'] def adjust_environment(self,program,env): - env.RES('arch/win32/%s.rc' % program.target) env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL']) - env.Append(CPPPATH = [os.path.join(self.srcdir, 'arch/win32/include')]) - self.platform_sources = [os.path.join(program.srcdir, 'arch/win32/messagebox.c')] - # Settings to apply to Apple builds class DarwinPlatformSettings(_PlatformSettings): def __init__(self,user_settings): - DXXProgram._PlatformSettings.__init__(self) + DXXCommon._PlatformSettings.__init__(self) self.osdef = '__APPLE__' - user_settings.sharepath = '' user_settings.asm = 0 self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' def adjust_environment(self,program,env): @@ -122,7 +101,6 @@ class DXXProgram: env['VERSION_NAME'] = program.PROGRAM_NAME + ' v' + VERSION env.Append(CPPDEFINES = ['HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL', '__unix__']) env.Append(CPPPATH = [os.path.join(program.srcdir, '../physfs'), os.path.join(os.getenv("HOME"), 'Library/Frameworks/SDL.framework/Headers'), '/Library/Frameworks/SDL.framework/Headers']) - self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] env.Append(FRAMEWORKS = ['ApplicationServices', 'Carbon', 'Cocoa', 'SDL']) env.Append(FRAMEWORKPATH = [os.path.join(os.getenv("HOME"), 'Library/Frameworks'), '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks']) self.libs = [''] @@ -130,32 +108,21 @@ class DXXProgram: # Settings to apply to Linux builds class LinuxPlatformSettings(_PlatformSettings): def __init__(self,user_settings): - DXXProgram._PlatformSettings.__init__(self) + DXXCommon._PlatformSettings.__init__(self) self.osdef = '__LINUX__' self.osasmdef = 'elf' if (user_settings.opengles == 1): self.ogllibs = [ user_settings.opengles_lib, 'EGL'] else: self.ogllibs = ['GL', 'GLU'] - self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' def adjust_environment(self,program,env): env.Append(CPPDEFINES = ['__LINUX__', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL']) env.ParseConfig('pkg-config --cflags --libs sdl') - self.libs = env['LIBS'] - env.Append(CPPPATH = [os.path.join(program.srcdir, 'arch/linux/include')]) def __init__(self): - self.user_settings = self.UserSettings(self.ARGUMENTS, self.target) - self.check_platform() - self.prepare_environment() - self.banner() - self.check_endian() - self.process_user_settings() - self.register_program() + pass def prepare_environment(self): - self.VERSION_STRING = ' v' + str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) + '.' + str(self.VERSION_MICRO) - self.env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(self.PROGRAM_NAME) + '\\"'), ('DXX_VERSION_MAJORi', str(self.VERSION_MAJOR)), ('DXX_VERSION_MINORi', str(self.VERSION_MINOR)), ('DXX_VERSION_MICROi', str(self.VERSION_MICRO))]) if self.user_settings.builddir != '': self.env.VariantDir(self.user_settings.builddir, '.', duplicate=0) @@ -167,6 +134,9 @@ class DXXProgram: self.env["ARCOMSTR"] = "Archiving $TARGET ..." self.env["RANLIBCOMSTR"] = "Indexing $TARGET ..." + self.env.Append(CCFLAGS = ['-Wall', '-funsigned-char', '-Werror=implicit-int', '-Werror=implicit-function-declaration', '-pthread']) + self.env.Append(CFLAGS = ['-std=gnu99']) + self.env.Append(CPPDEFINES = ['NETWORK']) # Get traditional compiler environment variables for cc in ['CC', 'CXX']: if os.environ.has_key(cc): @@ -175,15 +145,12 @@ class DXXProgram: if os.environ.has_key(flags): self.env[flags] += SCons.Util.CLVar(os.environ[flags]) - def banner(self): - print '\n===== ' + self.PROGRAM_NAME + self.VERSION_STRING + ' =====\n' - def check_endian(self): # set endianess if (self.__endian == "big"): print "%s: BigEndian machine detected" % self.PROGRAM_NAME self.asm = 0 - env.Append(CPPDEFINES = ['WORDS_BIGENDIAN']) + self.env.Append(CPPDEFINES = ['WORDS_BIGENDIAN']) elif (self.__endian == "little"): print "%s: LittleEndian machine detected" % self.PROGRAM_NAME @@ -198,7 +165,6 @@ class DXXProgram: else: print "%s: compiling on *NIX" % self.PROGRAM_NAME platform = self.LinuxPlatformSettings - self.user_settings.sharepath += '/' self.platform_settings = platform(self.user_settings) # Acquire environment object... self.env = Environment(ENV = os.environ, tools = platform.tools) @@ -216,14 +182,6 @@ class DXXProgram: else: print "%s: building with OpenGL" % self.PROGRAM_NAME env.Append(CPPDEFINES = ['OGL']) - self.common_sources += self.arch_ogl_sources - if (sys.platform != 'darwin'): - self.platform_settings.libs += self.platform_settings.ogllibs - else: - env.Append(FRAMEWORKS = ['OpenGL']) - else: - print "%s: building with Software Renderer" % self.PROGRAM_NAME - self.common_sources += self.arch_sdl_sources # assembler code? if (self.user_settings.asm == 1) and (self.user_settings.opengl == 0): @@ -238,11 +196,6 @@ class DXXProgram: if (self.user_settings.sdlmixer == 1): print "%s: including SDL_mixer" % self.PROGRAM_NAME env.Append(CPPDEFINES = ['USE_SDLMIXER']) - self.common_sources += self.arch_sdlmixer - if (sys.platform != 'darwin'): - self.platform_settings.libs += ['SDL_mixer'] - else: - env.Append(FRAMEWORKS = ['SDL_mixer']) # debug? if (self.user_settings.debug == 1): @@ -255,12 +208,10 @@ class DXXProgram: # profiler? if (self.user_settings.profiler == 1): env.Append(CPPFLAGS = ['-pg']) - self.platform_settings.lflags += ' -pg' #editor build? if (self.user_settings.editor == 1): env.Append(CPPDEFINES = ['EDITOR']) - env.Append(CPPPATH = [os.path.join(self.srcdir, 'include/editor')]) self.common_sources += self.editor_sources # IPv6 compability? @@ -270,11 +221,109 @@ class DXXProgram: # UDP support? if (self.user_settings.use_udp == 1): env.Append(CPPDEFINES = ['USE_UDP']) - self.common_sources += self.sources_use_udp # Tracker support? (Relies on UDP) if( self.user_settings.use_tracker == 1 ): env.Append( CPPDEFINES = [ 'USE_TRACKER' ] ) - print '\n' + +class DXXProgram(DXXCommon): + # version number + VERSION_MAJOR = 0 + VERSION_MINOR = 57 + VERSION_MICRO = 3 + class UserSettings(DXXCommon.UserSettings): + def __init__(self,ARGUMENTS,target): + DXXCommon.UserSettings.__init__(self, ARGUMENTS.ARGUMENTS) + # installation path + PREFIX = str(ARGUMENTS.get('prefix', '/usr/local')) + self.BIN_DIR = PREFIX + '/bin' + self.DATA_DIR = PREFIX + '/share/games/' + target + # command-line parms + self.sharepath = str(ARGUMENTS.get('sharepath', self.DATA_DIR)) + # Settings to apply to mingw32 builds + class Win32PlatformSettings(DXXCommon.Win32PlatformSettings): + def __init__(self,user_settings): + DXXCommon.Win32PlatformSettings.__init__(self,user_settings) + user_settings.sharepath = '' + self.lflags = '-mwindows' + self.libs = ['glu32', 'wsock32', 'ws2_32', 'winmm', 'mingw32', 'SDLmain', 'SDL'] + def adjust_environment(self,program,env): + DXXCommon.Win32PlatformSettings.adjust_environment(self, program, env) + env.RES('arch/win32/%s.rc' % program.target) + env.Append(CPPPATH = [os.path.join(self.srcdir, 'arch/win32/include')]) + self.platform_sources = [os.path.join(program.srcdir, 'arch/win32/messagebox.c')] + # Settings to apply to Apple builds + # This appears to be unused. The reference to sdl_only fails to + # execute. + class DarwinPlatformSettings(DXXCommon.DarwinPlatformSettings): + def __init__(self,user_settings): + DXXCommon.DarwinPlatformSettings.__init__(self) + user_settings.sharepath = '' + def adjust_environment(self,program,env): + DXXCommon.DarwinPlatformSettings.adjust_environment(self, program, env) + self.platform_sources = [os.path.join(program.srcdir, f) for f in ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']] + # Settings to apply to Linux builds + class LinuxPlatformSettings(DXXCommon.LinuxPlatformSettings): + def __init__(self,user_settings): + DXXCommon.LinuxPlatformSettings.__init__(self,user_settings) + user_settings.sharepath += '/' + self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' + def adjust_environment(self,program,env): + DXXCommon.LinuxPlatformSettings.adjust_environment(self, program, env) + self.libs = env['LIBS'] + env.Append(CPPPATH = [os.path.join(program.srcdir, 'arch/linux/include')]) + + def __init__(self): + DXXCommon.__init__(self) + self.user_settings = self.UserSettings(self.ARGUMENTS, self.target) + self.check_platform() + self.prepare_environment() + self.banner() + self.check_endian() + self.process_user_settings() + self.register_program() + + def prepare_environment(self): + DXXCommon.prepare_environment(self) + self.VERSION_STRING = ' v' + str(self.VERSION_MAJOR) + '.' + str(self.VERSION_MINOR) + '.' + str(self.VERSION_MICRO) + self.env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(self.PROGRAM_NAME) + '\\"'), ('DXX_VERSION_MAJORi', str(self.VERSION_MAJOR)), ('DXX_VERSION_MINORi', str(self.VERSION_MINOR)), ('DXX_VERSION_MICROi', str(self.VERSION_MICRO))]) + + def banner(self): + print '\n===== ' + self.PROGRAM_NAME + self.VERSION_STRING + ' =====\n' + + def process_user_settings(self): + DXXCommon.process_user_settings(self) + env = self.env + # opengl or software renderer? + if (self.user_settings.opengl == 1) or (self.user_settings.opengles == 1): + self.common_sources += self.arch_ogl_sources + if (sys.platform != 'darwin'): + self.platform_settings.libs += self.platform_settings.ogllibs + else: + env.Append(FRAMEWORKS = ['OpenGL']) + else: + print "%s: building with Software Renderer" % self.PROGRAM_NAME + self.common_sources += self.arch_sdl_sources + + # SDL_mixer support? + if (self.user_settings.sdlmixer == 1): + self.common_sources += self.arch_sdlmixer + if (sys.platform != 'darwin'): + self.platform_settings.libs += ['SDL_mixer'] + else: + env.Append(FRAMEWORKS = ['SDL_mixer']) + + # profiler? + if (self.user_settings.profiler == 1): + self.platform_settings.lflags += ' -pg' + + #editor build? + if (self.user_settings.editor == 1): + env.Append(CPPPATH = [os.path.join(self.srcdir, 'include/editor')]) + + # UDP support? + if (self.user_settings.use_udp == 1): + self.common_sources += self.sources_use_udp + env.Append(CPPDEFINES = [('SHAREPATH', '\\"' + str(self.user_settings.sharepath) + '\\"')]) class D1XProgram(DXXProgram): @@ -285,9 +334,6 @@ class D1XProgram(DXXProgram): def prepare_environment(self): DXXProgram.prepare_environment(self) # Flags and stuff for all platforms... - self.env.Append(CCFLAGS = ['-Wall', '-funsigned-char', '-Werror=implicit-int', '-Werror=implicit-function-declaration', '-pthread']) - self.env.Append(CFLAGS = ['-std=gnu99']) - self.env.Append(CPPDEFINES = ['NETWORK']) self.env.Append(CPPPATH = [os.path.join(self.srcdir, f) for f in ['include', 'main', 'arch/include']]) def __init__(self): From 528ea51ce488fa6b43ee916b47841e49e9080bd8 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 10 Mar 2013 19:33:57 +0000 Subject: [PATCH 71/74] Refactor SConstruct register_program handling --- SConstruct | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/SConstruct b/SConstruct index 4e407eb66..a8228c015 100644 --- a/SConstruct +++ b/SConstruct @@ -326,6 +326,31 @@ class DXXProgram(DXXCommon): env.Append(CPPDEFINES = [('SHAREPATH', '\\"' + str(self.user_settings.sharepath) + '\\"')]) + def _register_program(self,dxxstr,program_specific_objects=[]): + env = self.env + exe_target = os.path.join(self.srcdir, self.target) + objects = [self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, os.path.splitext(s)[0], self.env["OBJSUFFIX"]), source=s) for s in self.common_sources] + objects.extend(program_specific_objects) + versid_cppdefines=env['CPPDEFINES'][:] + if self.user_settings.extra_version: + versid_cppdefines.append(('DESCENT_VERSION_EXTRA', '\\"%s\\"' % self.user_settings.extra_version)) + objects.append(self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, 'main/vers_id', self.env["OBJSUFFIX"]), source='main/vers_id.c', CPPDEFINES=versid_cppdefines)) + # finally building program... + env.Program(target='%s%s' % (self.user_settings.builddir, str(exe_target)), source = objects, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) + if (sys.platform != 'darwin'): + env.Install(self.user_settings.BIN_DIR, str(exe_target)) + env.Alias('install', self.user_settings.BIN_DIR) + else: + sys.path += ['./arch/cocoa'] + import tool_bundle + tool_bundle.TOOL_BUNDLE(env) + env.MakeBundle(self.PROGRAM_NAME + '.app', exe_target, + 'free.%s-rebirth' % dxxstr, '%sgl-Info.plist' % dxxstr, + typecode='APPL', creator='DCNT', + icon_file='arch/cocoa/%s-rebirth.icns' % dxxstr, + subst_dict={'%sgl' % dxxstr : exe_target}, # This is required; manually update version for Xcode compatibility + resources=[['English.lproj/InfoPlist.strings', 'English.lproj/InfoPlist.strings']]) + class D1XProgram(DXXProgram): PROGRAM_NAME = 'D1X-Rebirth' target = 'd1x-rebirth' @@ -558,28 +583,7 @@ class D1XProgram(DXXProgram): ] def register_program(self): - env = self.env - exe_target = os.path.join(self.srcdir, self.target) - objects = [self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, os.path.splitext(s)[0], self.env["OBJSUFFIX"]), source=s) for s in self.common_sources] - versid_cppdefines=env['CPPDEFINES'][:] - if self.user_settings.extra_version: - versid_cppdefines.append(('DESCENT_VERSION_EXTRA', '\\"%s\\"' % self.user_settings.extra_version)) - objects.append(self.env.StaticObject(target='%s%s%s' % (self.user_settings.builddir, 'main/vers_id', self.env["OBJSUFFIX"]), source='main/vers_id.c', CPPDEFINES=versid_cppdefines)) - # finally building program... - env.Program(target='%s%s' % (self.user_settings.builddir, str(exe_target)), source = objects, LIBS = self.platform_settings.libs, LINKFLAGS = str(self.platform_settings.lflags)) - if (sys.platform != 'darwin'): - env.Install(self.user_settings.BIN_DIR, str(exe_target)) - env.Alias('install', self.user_settings.BIN_DIR) - else: - sys.path += ['./arch/cocoa'] - import tool_bundle - tool_bundle.TOOL_BUNDLE(env) - env.MakeBundle(self.PROGRAM_NAME + '.app', exe_target, - 'free.d1x-rebirth', 'd1xgl-Info.plist', - typecode='APPL', creator='DCNT', - icon_file='arch/cocoa/d1x-rebirth.icns', - subst_dict={'d1xgl' : exe_target}, # This is required; manually update version for Xcode compatibility - resources=[['English.lproj/InfoPlist.strings', 'English.lproj/InfoPlist.strings']]) + self._register_program('d1x') program = D1XProgram() From 63b1abc80a6e83d64976e1537cf7f8d4bf009ee3 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 16 Mar 2013 23:15:01 +0000 Subject: [PATCH 72/74] Store fixed values at class scope --- SConstruct | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/SConstruct b/SConstruct index a8228c015..74c4ac54b 100644 --- a/SConstruct +++ b/SConstruct @@ -74,23 +74,19 @@ class DXXCommon: # Base class for platform-specific settings processing class _PlatformSettings: tools = None - def __init__(self): - self.ogllibs = '' - self.osasmdef = None - self.platform_sources = [] + ogllibs = '' + osasmdef = None + platform_sources = [] # Settings to apply to mingw32 builds class Win32PlatformSettings(_PlatformSettings): tools = ['mingw'] - def __init__(self,user_settings): - DXXCommon._PlatformSettings.__init__(self) - self.osdef = '_WIN32' - self.osasmdef = 'win32' + osdef = '_WIN32' + osasmdef = 'win32' def adjust_environment(self,program,env): env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL']) class DarwinPlatformSettings(_PlatformSettings): + osdef = '__APPLE__' def __init__(self,user_settings): - DXXCommon._PlatformSettings.__init__(self) - self.osdef = '__APPLE__' user_settings.asm = 0 self.lflags = os.environ["LDFLAGS"] if os.environ.has_key('LDFLAGS') else '' def adjust_environment(self,program,env): @@ -107,14 +103,14 @@ class DXXCommon: env['LIBPATH'] = '../physfs/build/Debug' # Settings to apply to Linux builds class LinuxPlatformSettings(_PlatformSettings): + osdef = '__LINUX__' + osasmdef = 'elf' + __opengl_libs = ['GL', 'GLU'] def __init__(self,user_settings): - DXXCommon._PlatformSettings.__init__(self) - self.osdef = '__LINUX__' - self.osasmdef = 'elf' if (user_settings.opengles == 1): self.ogllibs = [ user_settings.opengles_lib, 'EGL'] else: - self.ogllibs = ['GL', 'GLU'] + self.ogllibs = self.__opengl_libs def adjust_environment(self,program,env): env.Append(CPPDEFINES = ['__LINUX__', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL']) env.ParseConfig('pkg-config --cflags --libs sdl') From 52a15a6e118412adce4283359245d19d2309a03a Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 31 Mar 2013 21:32:58 +0000 Subject: [PATCH 73/74] Add unused ai_restore_state parameter version to match D2X --- main/ai.c | 3 ++- main/ai.h | 2 +- main/state.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/main/ai.c b/main/ai.c index 49c08caf2..4e8d4413c 100644 --- a/main/ai.c +++ b/main/ai.c @@ -3268,8 +3268,9 @@ void ai_cloak_info_read_n_swap(ai_cloak_info *ci, int n, int swap, PHYSFS_file * } } -int ai_restore_state(PHYSFS_file *fp, int swap) +int ai_restore_state(PHYSFS_file *fp, int version, int swap) { + (void)version; fix tmptime32 = 0; Ai_initialized = PHYSFSX_readSXE32(fp, swap); diff --git a/main/ai.h b/main/ai.h index e1a4e3889..4ef14b07e 100644 --- a/main/ai.h +++ b/main/ai.h @@ -95,6 +95,6 @@ extern int Boss_been_hit; extern fix AI_proc_time; extern int ai_save_state(PHYSFS_file * fp); -extern int ai_restore_state(PHYSFS_file *fp, int swap); +extern int ai_restore_state(PHYSFS_file *fp, int version, int swap); #endif diff --git a/main/state.c b/main/state.c index dc9517b9f..32ca05ceb 100644 --- a/main/state.c +++ b/main/state.c @@ -1355,7 +1355,7 @@ RetryObjectLoading: Total_countdown_time = Countdown_timer/F0_5; // we do not need to know this, but it should not be 0 either... // Restore the AI state - ai_restore_state( fp, swap ); + ai_restore_state( fp, 0, swap ); // Restore the automap visited info if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL ) From ebc971be95a146eef526df6e1ec70e7384265388 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 17 Mar 2013 03:29:48 +0000 Subject: [PATCH 74/74] Support cross-configuring SDL --- SConstruct | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 74c4ac54b..9d6e24003 100644 --- a/SConstruct +++ b/SConstruct @@ -106,6 +106,7 @@ class DXXCommon: osdef = '__LINUX__' osasmdef = 'elf' __opengl_libs = ['GL', 'GLU'] + __pkg_config_sdl = {} def __init__(self,user_settings): if (user_settings.opengles == 1): self.ogllibs = [ user_settings.opengles_lib, 'EGL'] @@ -113,7 +114,22 @@ class DXXCommon: self.ogllibs = self.__opengl_libs def adjust_environment(self,program,env): env.Append(CPPDEFINES = ['__LINUX__', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL']) - env.ParseConfig('pkg-config --cflags --libs sdl') + try: + pkgconfig = os.environ['PKG_CONFIG'] + except KeyError as e: + try: + pkgconfig = '%s-pkg-config' % os.environ['CHOST'] + except KeyError as e: + pkgconfig = 'pkg-config' + cmd = '%s --cflags --libs sdl' % pkgconfig + try: + flags = self.__pkg_config_sdl[cmd] + except KeyError as e: + if (program.user_settings.verbosebuild != 0): + print "%s: reading SDL settings from `%s`" % (program.PROGRAM_NAME, cmd) + self.__pkg_config_sdl[cmd] = env.backtick(cmd) + flags = self.__pkg_config_sdl[cmd] + env.MergeFlags(flags) def __init__(self): pass