This commit is contained in:
zico 2013-08-30 23:06:19 +02:00
commit 267f560a66
28 changed files with 297 additions and 419 deletions

View file

@ -509,7 +509,7 @@ class DXXCommon(LazyObjectConstructor):
prefix = ' with prefix list %s' % list(self._argument_prefix_list)
else:
prefix = ''
message(self, "compiling on %s for %s%s" % (sys.platform, platform_name, prefix))
message(self, "compiling on %s for %s into %s%s" % (sys.platform, platform_name, self.user_settings.builddir or '.', prefix))
if platform_name == 'win32':
platform = self.Win32PlatformSettings
elif platform_name == 'darwin':
@ -520,7 +520,6 @@ class DXXCommon(LazyObjectConstructor):
# Acquire environment object...
self.env = Environment(ENV = os.environ, tools = platform.tools)
self.platform_settings.adjust_environment(self, self.env)
self.sources += self.platform_settings.platform_sources
def process_user_settings(self):
env = self.env
@ -719,7 +718,7 @@ class DXXProgram(DXXCommon):
objects_similar_arch_ogl = DXXCommon.create_lazy_object_property([{
'source':[os.path.join('similar', f) for f in [
'arch/ogl/gr.cpp',
'arch/ogl/ogl.c',
'arch/ogl/ogl.cpp',
]
],
'transform_target':_apply_target_name,
@ -886,6 +885,8 @@ class DXXProgram(DXXCommon):
@property
def objects_common(self):
objects_common = self.__objects_common
if (self.user_settings.use_udp == 1):
objects_common = objects_common + self.objects_use_udp
return objects_common + self.platform_settings.platform_objects
def __init__(self,prefix):
self.variables = Variables('site-local.py', ARGUMENTS)
@ -959,8 +960,6 @@ class DXXProgram(DXXCommon):
message(self, "building with Software Renderer")
objects.extend(static_archive_construction.objects_arch_sdl)
objects.extend(self.objects_similar_arch_sdl)
if (self.user_settings.use_udp == 1):
objects.extend(self.objects_use_udp)
if (self.user_settings.editor == 1):
objects.extend(self.objects_editor)
objects.extend(static_archive_construction.objects_editor)

View file

@ -146,7 +146,7 @@ typedef struct _grs_canvas {
typedef struct _grs_screen { // This is a video screen
grs_canvas sc_canvas; // Represents the entire screen
u_int32_t sc_mode; // Video mode number
short sc_w, sc_h; // Actual Width and Height
unsigned short sc_w, sc_h; // Actual Width and Height
fix sc_aspect; //aspect ratio (w/h) for this screen
} grs_screen;
@ -400,8 +400,9 @@ int gr_check_fullscreen(void);
*/
int gr_toggle_fullscreen(void);
void ogl_do_palfx(void);
void ogl_init_pixel_buffers(int w, int h);
void ogl_init_pixel_buffers(unsigned w, unsigned h);
void ogl_close_pixel_buffers(void);
void ogl_cache_polymodel_textures(int model_num);;
#ifdef __cplusplus
}

View file

@ -12,8 +12,6 @@ extern "C" {
/* I assume this ought to be >= MAX_BITMAP_FILES in piggy.h? */
#define OGL_TEXTURE_LIST_SIZE 20000
extern ogl_texture ogl_texture_list[OGL_TEXTURE_LIST_SIZE];
void ogl_init_texture_list_internal(void);
void ogl_smash_texture_list_internal(void);
void ogl_vivify_texture_list_internal(void);
@ -21,6 +19,7 @@ void ogl_vivify_texture_list_internal(void);
extern int ogl_brightness_ok;
extern int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
extern int ogl_fullscreen;
extern int r_upixelc;
extern int GL_TEXTURE_2D_enabled;
#define OGL_ENABLE2(a,f) {if (a ## _enabled!=1) {f;a ## _enabled=1;}}
@ -51,8 +50,6 @@ static inline void OGL_VIEWPORT(const unsigned x, const unsigned y, const unsign
//platform specific funcs
extern void ogl_swap_buffers_internal(void);
extern unsigned char *ogl_pal;
//whee
//#define PAL2Tr(c) ((gr_palette[c*3]+gr_palette_gamma)/63.0)
//#define PAL2Tg(c) ((gr_palette[c*3+1]+gr_palette_gamma)/63.0)

View file

@ -71,9 +71,6 @@ typedef struct _ogl_texture {
extern ogl_texture* ogl_get_free_texture();
void ogl_init_texture(ogl_texture* t, int w, int h, int flags);
extern int ogl_rgba_internalformat;
extern int ogl_rgb_internalformat;
void ogl_init_shared_palette(void);
extern int gl_initialized;
@ -111,7 +108,7 @@ bool g3_draw_tmap_2(int nv,g3s_point **pointlist,g3s_uvl *uvl_list,g3s_lrgb *lig
void ogl_draw_vertex_reticle(int cross,int primary,int secondary,int color,int alpha,int size_offs);
void ogl_toggle_depth_test(int enable);
void ogl_set_blending();
int pow2ize(int x);//from ogl.c
unsigned pow2ize(unsigned x);//from ogl.c
#ifdef __cplusplus
}

View file

@ -84,6 +84,9 @@ defined(__LITTLE_ENDIAN__) // from physfs_internal.h
#ifdef __GNUC__
# define __pack__ __attribute__((packed))
#ifdef WIN32
# pragma pack(1)
#endif
#elif defined(_MSC_VER)
# pragma pack(push, packing)
# pragma pack(1)

View file

@ -23,6 +23,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "vclip.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(DXX_BUILD_DESCENT_I)
#define MAX_EFFECTS 60
#elif defined(DXX_BUILD_DESCENT_II)
@ -83,4 +87,8 @@ void restart_effect(int effect_num);
*/
extern int eclip_read_n(eclip *ec, int n, PHYSFS_file *fp);
#ifdef __cplusplus
}
#endif
#endif /* _EFFECTS_H */

View file

@ -49,15 +49,15 @@ typedef struct _control_info {
#define CONTROL_USING_MOUSE 2
#define MOUSEFS_DELTA_RANGE 512
#if defined(DXX_BUILD_DESCENT_I)
#define NUM_D1X_CONTROLS 30
#define MAX_D1X_CONTROLS 30
#define NUM_DXX_REBIRTH_CONTROLS 30
#define MAX_DXX_REBIRTH_CONTROLS 30
#define NUM_KEY_CONTROLS 50
#define NUM_JOYSTICK_CONTROLS 48
#define NUM_MOUSE_CONTROLS 29
#define MAX_CONTROLS 50
#elif defined(DXX_BUILD_DESCENT_II)
#define NUM_D2X_CONTROLS 30
#define MAX_D2X_CONTROLS 30
#define NUM_DXX_REBIRTH_CONTROLS 30
#define MAX_DXX_REBIRTH_CONTROLS 30
#define NUM_KEY_CONTROLS 57
#define NUM_JOYSTICK_CONTROLS 56
#define NUM_MOUSE_CONTROLS 30
@ -68,12 +68,8 @@ extern control_info Controls;
extern void kconfig_read_controls(d_event *event, int automap_flag);
extern void kconfig(int n, const char *title);
#if defined(DXX_BUILD_DESCENT_I)
extern const ubyte DefaultKeySettingsD1X[MAX_D1X_CONTROLS];
#elif defined(DXX_BUILD_DESCENT_II)
extern const ubyte DefaultKeySettingsD2X[MAX_D2X_CONTROLS];
#endif
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
extern const ubyte DefaultKeySettingsRebirth[MAX_DXX_REBIRTH_CONTROLS];
extern const ubyte DefaultKeySettings[3][MAX_CONTROLS];
#endif

View file

@ -122,5 +122,6 @@ extern int newdemo_get_percent_done();
extern void newdemo_record_link_sound_to_object3( int soundno, short objnum, fix max_volume, fix max_distance, int loop_start, int loop_end );
extern int newdemo_find_object( int signature );
extern void newdemo_record_kill_sound_linked_to_object( int objnum );
int newdemo_count_demos();
#endif // _NEWDEMO_H

View file

@ -227,8 +227,6 @@ typedef struct laser_info_rw {
fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added).
} __pack__ laser_info_rw;
extern ubyte hitobj_list[MAX_OBJECTS][MAX_OBJECTS];
typedef struct explosion_info {
fix spawn_time; // when lifeleft is < this, spawn another
fix delete_time; // when to delete object

View file

@ -25,6 +25,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "sounds.h"
#include "inferno.h"
#ifdef __cplusplus
extern "C" {
#endif
#define D1_SHARE_BIG_PIGSIZE 5092871 // v1.0 - 1.4 before RLE compression
#define D1_SHARE_10_PIGSIZE 2529454 // v1.0 - 1.2
#define D1_SHARE_PIGSIZE 2509799 // v1.4
@ -163,4 +167,8 @@ extern digi_sound bogus_sound;
extern const char space[3];
extern const char equal_space[4];
#ifdef __cplusplus
}
#endif
#endif //_PIGGY_H

View file

@ -65,11 +65,7 @@ typedef struct player_config
ubyte PrimaryOrder[MAX_PRIMARY_WEAPONS+1];
ubyte SecondaryOrder[MAX_SECONDARY_WEAPONS+1];
ubyte KeySettings[3][MAX_CONTROLS];
#if defined(DXX_BUILD_DESCENT_I)
ubyte KeySettingsD1X[MAX_D1X_CONTROLS];
#elif defined(DXX_BUILD_DESCENT_II)
ubyte KeySettingsD2X[MAX_D2X_CONTROLS];
#endif
ubyte KeySettingsRebirth[MAX_DXX_REBIRTH_CONTROLS];
int DefaultDifficulty;
int AutoLeveling;
short NHighestLevels;

View file

@ -21,9 +21,17 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifndef _TEXMERGE_H
#define _TEXMERGE_H
#ifdef __cplusplus
extern "C" {
#endif
int texmerge_init(int num_cached_textures);
grs_bitmap *texmerge_get_cached_bitmap(int tmap_bottom, int tmap_top);
void texmerge_close();
void texmerge_flush();
#ifdef __cplusplus
}
#endif
#endif /* _TEXMERGE_H */

View file

@ -400,22 +400,6 @@ void init_ai_objects(void)
Ai_initialized = 1;
}
// ----------------------------------------------------------------
// Do *dest = *delta unless:
// *delta is pretty small
// and they are of different signs.
void set_rotvel_and_saturate(fix *dest, fix delta)
{
if ((delta ^ *dest) < 0) {
if (abs(delta) < F1_0/8) {
*dest = delta/4;
} else
*dest = delta;
} else {
*dest = delta;
}
}
//--debug-- #ifndef NDEBUG
//--debug-- int Total_turns=0;
//--debug-- int Prevented_turns=0;
@ -1325,42 +1309,6 @@ void compute_vis_and_vec(object *objp, vms_vector *pos, ai_local *ailp, vms_vect
}
// --------------------------------------------------------------------------------------------------------------------
// Move the object objp to a spot in which it doesn't intersect a wall.
// It might mean moving it outside its current segment.
void move_object_to_legal_spot(object *objp)
{
vms_vector original_pos = objp->pos;
int i;
segment *segp = &Segments[objp->segnum];
for (i=0; i<MAX_SIDES_PER_SEGMENT; i++) {
if (WALL_IS_DOORWAY(segp, i) & WID_FLY_FLAG) {
vms_vector segment_center, goal_dir;
compute_segment_center(&segment_center, &Segments[segp->children[i]]);
vm_vec_sub(&goal_dir, &segment_center, &objp->pos);
vm_vec_normalize_quick(&goal_dir);
vm_vec_scale(&goal_dir, objp->size);
vm_vec_add2(&objp->pos, &goal_dir);
if (!object_intersects_wall(objp)) {
int new_segnum = find_point_seg(&objp->pos, objp->segnum);
if (new_segnum != -1) {
obj_relink(objp-Objects, new_segnum);
return;
}
} else
objp->pos = original_pos;
}
}
// Int3(); // Darn you John, you done it again! (But contact Mike)
con_printf(CON_DEBUG, "Note: Killing robot #%hu because he's badly stuck outside the mine.\n", (unsigned short)(objp-Objects));
apply_damage_to_robot(objp, objp->shields*2, objp-Objects);
}
// --------------------------------------------------------------------------------------------------------------------
// Move object one object radii from current position towards segment center.
// If segment center is nearer than 2 radii, move it to center.
@ -1370,41 +1318,12 @@ void move_towards_segment_center(object *objp)
Make move to segment center smoother by using move_towards vector.
Bot's should not jump around and maybe even intersect with each other!
In case it breaks something what I do not see, yet, old code is still there. */
#if 1
int segnum = objp->segnum;
vms_vector vec_to_center, segment_center;
compute_segment_center(&segment_center, &Segments[segnum]);
vm_vec_normalized_dir_quick(&vec_to_center, &segment_center, &objp->pos);
move_towards_vector(objp, &vec_to_center);
#else
int segnum = objp->segnum;
fix dist_to_center;
vms_vector segment_center, goal_dir;
compute_segment_center(&segment_center, &Segments[segnum]);
vm_vec_sub(&goal_dir, &segment_center, &objp->pos);
dist_to_center = vm_vec_normalize_quick(&goal_dir);
if (dist_to_center < objp->size) {
// Center is nearer than the distance we want to move, so move to center.
objp->pos = segment_center;
if (object_intersects_wall(objp)) {
move_object_to_legal_spot(objp);
}
} else {
int new_segnum;
// Move one radii towards center.
vm_vec_scale(&goal_dir, objp->size);
vm_vec_add2(&objp->pos, &goal_dir);
new_segnum = find_point_seg(&objp->pos, objp->segnum);
if (new_segnum == -1) {
objp->pos = segment_center;
move_object_to_legal_spot(objp);
}
}
#endif
}
// -----------------------------------------------------------------------------------------------------------
@ -1463,41 +1382,6 @@ int openable_doors_in_segment(object *objp)
}
// --------------------------------------------------------------------------------------------------------------------
// Return true if a special object (player or control center) is in this segment.
int special_object_in_seg(int segnum)
{
int objnum;
objnum = Segments[segnum].objects;
while (objnum != -1) {
if ((Objects[objnum].type == OBJ_PLAYER) || (Objects[objnum].type == OBJ_CNTRLCEN)) {
return 1;
} else
objnum = Objects[objnum].next;
}
return 0;
}
// --------------------------------------------------------------------------------------------------------------------
// Randomly select a segment attached to *segp, reachable by flying.
int get_random_child(int segnum)
{
int sidenum;
segment *segp = &Segments[segnum];
sidenum = (d_rand() * 6) >> 15;
while (!(WALL_IS_DOORWAY(segp, sidenum) & WID_FLY_FLAG))
sidenum = (d_rand() * 6) >> 15;
segnum = segp->children[sidenum];
return segnum;
}
// --------------------------------------------------------------------------------------------------------------------
// Return true if placing an object of size size at pos *pos intersects a (player or robot or control center) in segment *segp.
int check_object_object_intersection(vms_vector *pos, fix size, segment *segp)

View file

@ -572,43 +572,6 @@ void create_n_segment_path_to_door(object *objp, int path_length, int avoid_seg)
extern int Connected_segment_distance;
// ----------------------------------------------------------------------------------------------------
void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg)
{
ai_static *aip = &objp->ctype.ai_info;
int segnum;
Assert(objp->segnum != -1);
aip->cur_path_index += aip->PATH_DIR;
if (aip->cur_path_index <= 0) {
if (aip->behavior == AIB_STATION) {
create_path_to_station(objp, 15);
return;
}
aip->cur_path_index = 0;
aip->PATH_DIR = -aip->PATH_DIR;
} else if (aip->cur_path_index >= aip->path_length) {
if (aip->behavior == AIB_STATION) {
create_path_to_station(objp, 15);
return;
}
aip->cur_path_index = aip->path_length-1;
aip->PATH_DIR = -aip->PATH_DIR;
}
objp->pos = *goal_point;
segnum = find_object_seg(objp);
if (segnum == -1) {
Int3(); // Oops, object is not in any segment.
// Contact Mike: This is impossible.
// Hack, move object to center of segment it used to be in.
compute_segment_center(&objp->pos, &Segments[objp->segnum]);
} else
obj_relink(objp-Objects, segnum);
}
// ----------------------------------------------------------------------------------------------------------
// Optimization: If current velocity will take robot near goal, don't change velocity

View file

@ -125,7 +125,7 @@ const ubyte DefaultKeySettings[3][MAX_CONTROLS] = {
{0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0},
{0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
};
const ubyte DefaultKeySettingsD1X[MAX_D1X_CONTROLS] = { 0x2,0xff,0xff,0x3,0xff,0xff,0x4,0xff,0xff,0x5,0xff,0xff,0x6,0xff,0xff,0x7,0xff,0xff,0x8,0xff,0xff,0x9,0xff,0xff,0xa,0xff,0xff,0xb,0xff,0xff };
const ubyte DefaultKeySettingsRebirth[MAX_DXX_REBIRTH_CONTROLS] = { 0x2,0xff,0xff,0x3,0xff,0xff,0x4,0xff,0xff,0x5,0xff,0xff,0x6,0xff,0xff,0x7,0xff,0xff,0x8,0xff,0xff,0x9,0xff,0xff,0xa,0xff,0xff,0xb,0xff,0xff };
// id, x, y, w1, w2, u, d, l, r, text, type, value
kc_item kc_keyboard[NUM_KEY_CONTROLS] = {
@ -261,37 +261,51 @@ kc_item kc_mouse[NUM_MOUSE_CONTROLS] = {
{ 27, 25,102, 85, 26, 25, 28, 11, 12,"Cycle Primary", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.cycle_primary_count },
{ 28, 25,110, 85, 26, 27, 14, 12, 13,"Cycle Secondary", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.cycle_secondary_count },
};
kc_item kc_d1x[NUM_D1X_CONTROLS] = {
{ 0, 15, 69,142, 26, 29, 3, 29, 1,"LASER CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 1, 15, 69,200, 26, 27, 4, 0, 2,"LASER CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 2, 15, 69,258, 26, 28, 5, 1, 3,"LASER CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 3, 15, 77,142, 26, 0, 6, 2, 4,"VULCAN CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 4, 15, 77,200, 26, 1, 7, 3, 5,"VULCAN CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 5, 15, 77,258, 26, 2, 8, 4, 6,"VULCAN CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 6, 15, 85,142, 26, 3, 9, 5, 7,"SPREADFIRE CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 7, 15, 85,200, 26, 4, 10, 6, 8,"SPREADFIRE CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 8, 15, 85,258, 26, 5, 11, 7, 9,"SPREADFIRE CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 9, 15, 93,142, 26, 6, 12, 8, 10,"PLASMA CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 10, 15, 93,200, 26, 7, 13, 9, 11,"PLASMA CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 11, 15, 93,258, 26, 8, 14, 10, 12,"PLASMA CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 12, 15,101,142, 26, 9, 15, 11, 13,"FUSION CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 13, 15,101,200, 26, 10, 16, 12, 14,"FUSION CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 14, 15,101,258, 26, 11, 17, 13, 15,"FUSION CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 15, 15,109,142, 26, 12, 18, 14, 16,"CONCUSSION MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 16, 15,109,200, 26, 13, 19, 15, 17,"CONCUSSION MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 17, 15,109,258, 26, 14, 20, 16, 18,"CONCUSSION MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 18, 15,117,142, 26, 15, 21, 17, 19,"HOMING MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 19, 15,117,200, 26, 16, 22, 18, 20,"HOMING MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 20, 15,117,258, 26, 17, 23, 19, 21,"HOMING MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 21, 15,125,142, 26, 18, 24, 20, 22,"PROXIMITY BOMB", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 22, 15,125,200, 26, 19, 25, 21, 23,"PROXIMITY BOMB", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 23, 15,125,258, 26, 20, 26, 22, 24,"PROXIMITY BOMB", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 24, 15,133,142, 26, 21, 27, 23, 25,"SMART MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 25, 15,133,200, 26, 22, 28, 24, 26,"SMART MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 26, 15,133,258, 26, 23, 29, 25, 27,"SMART MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 27, 15,141,142, 26, 24, 1, 26, 28,"MEGA MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 28, 15,141,200, 26, 25, 2, 27, 29,"MEGA MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 29, 15,141,258, 26, 26, 0, 28, 0,"MEGA MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
#define D2X_EXTENDED_WEAPON_STRING(X)
#define WEAPON_STRING_LASER D2X_EXTENDED_WEAPON_STRING("(SUPER)") "LASER CANNON"
#define WEAPON_STRING_VULCAN "VULCAN" D2X_EXTENDED_WEAPON_STRING("/GAUSS") " CANNON"
#define WEAPON_STRING_SPREADFIRE "SPREADFIRE" D2X_EXTENDED_WEAPON_STRING("/HELIX") " CANNON"
#define WEAPON_STRING_PLASMA "PLASMA" D2X_EXTENDED_WEAPON_STRING("/PHOENIX") " CANNON"
#define WEAPON_STRING_FUSION "FUSION" D2X_EXTENDED_WEAPON_STRING("/OMEGA") " CANNON"
#define WEAPON_STRING_CONCUSSION "CONCUSSION" D2X_EXTENDED_WEAPON_STRING("/FLASH") " MISSILE"
#define WEAPON_STRING_HOMING "HOMING" D2X_EXTENDED_WEAPON_STRING("/GUIDED") " MISSILE"
#define WEAPON_STRING_PROXIMITY "PROXIMITY BOMB" D2X_EXTENDED_WEAPON_STRING("/SMART MINE")
#define WEAPON_STRING_SMART "SMART" D2X_EXTENDED_WEAPON_STRING("/MERCURY") " MISSILE"
#define WEAPON_STRING_MEGA "MEGA" D2X_EXTENDED_WEAPON_STRING("/EARTHSHAKER") " MISSILE"
kc_item kc_rebirth[NUM_DXX_REBIRTH_CONTROLS] = {
{ 0, 15, 69,142, 26, 29, 3, 29, 1,WEAPON_STRING_LASER, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 1, 15, 69,200, 26, 27, 4, 0, 2,WEAPON_STRING_LASER, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 2, 15, 69,258, 26, 28, 5, 1, 3,WEAPON_STRING_LASER, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 3, 15, 77,142, 26, 0, 6, 2, 4,WEAPON_STRING_VULCAN, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 4, 15, 77,200, 26, 1, 7, 3, 5,WEAPON_STRING_VULCAN, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 5, 15, 77,258, 26, 2, 8, 4, 6,WEAPON_STRING_VULCAN, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 6, 15, 85,142, 26, 3, 9, 5, 7,WEAPON_STRING_SPREADFIRE, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 7, 15, 85,200, 26, 4, 10, 6, 8,WEAPON_STRING_SPREADFIRE, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 8, 15, 85,258, 26, 5, 11, 7, 9,WEAPON_STRING_SPREADFIRE, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 9, 15, 93,142, 26, 6, 12, 8, 10,WEAPON_STRING_PLASMA, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 10, 15, 93,200, 26, 7, 13, 9, 11,WEAPON_STRING_PLASMA, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 11, 15, 93,258, 26, 8, 14, 10, 12,WEAPON_STRING_PLASMA, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 12, 15,101,142, 26, 9, 15, 11, 13,WEAPON_STRING_FUSION, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 13, 15,101,200, 26, 10, 16, 12, 14,WEAPON_STRING_FUSION, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 14, 15,101,258, 26, 11, 17, 13, 15,WEAPON_STRING_FUSION, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 15, 15,109,142, 26, 12, 18, 14, 16,WEAPON_STRING_CONCUSSION, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 16, 15,109,200, 26, 13, 19, 15, 17,WEAPON_STRING_CONCUSSION, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 17, 15,109,258, 26, 14, 20, 16, 18,WEAPON_STRING_CONCUSSION, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 18, 15,117,142, 26, 15, 21, 17, 19,WEAPON_STRING_HOMING, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 19, 15,117,200, 26, 16, 22, 18, 20,WEAPON_STRING_HOMING, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 20, 15,117,258, 26, 17, 23, 19, 21,WEAPON_STRING_HOMING, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 21, 15,125,142, 26, 18, 24, 20, 22,WEAPON_STRING_PROXIMITY, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 22, 15,125,200, 26, 19, 25, 21, 23,WEAPON_STRING_PROXIMITY, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 23, 15,125,258, 26, 20, 26, 22, 24,WEAPON_STRING_PROXIMITY, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 24, 15,133,142, 26, 21, 27, 23, 25,WEAPON_STRING_SMART, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 25, 15,133,200, 26, 22, 28, 24, 26,WEAPON_STRING_SMART, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 26, 15,133,258, 26, 23, 29, 25, 27,WEAPON_STRING_SMART, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 27, 15,141,142, 26, 24, 1, 26, 28,WEAPON_STRING_MEGA, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 28, 15,141,200, 26, 25, 2, 27, 29,WEAPON_STRING_MEGA, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 29, 15,141,258, 26, 26, 0, 28, 0,WEAPON_STRING_MEGA, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
};
void kc_drawitem( kc_item *item, int is_current );
@ -526,7 +540,7 @@ void kconfig_draw(kc_menu *menu)
gr_string( FSPACX(242), FSPACY(145), TXT_AXIS );
gr_string( FSPACX(274), FSPACY(145), TXT_INVERT );
}
else if ( menu->items == kc_d1x )
else if ( menu->items == kc_rebirth )
{
gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
gr_setcolor( BM_XRGB(31,27,6) );
@ -653,9 +667,9 @@ int kconfig_key_command(window *wind, d_event *event, kc_menu *menu)
for (i=0; i<NUM_MOUSE_CONTROLS; i++ )
menu->items[i].value = DefaultKeySettings[2][i];
if ( menu->items==kc_d1x )
for(i=0;i<NUM_D1X_CONTROLS;i++)
menu->items[i].value=DefaultKeySettingsD1X[i];
if ( menu->items==kc_rebirth )
for(unsigned i=0;i<sizeof(menu->items) / sizeof(menu->items[0]);i++)
menu->items[i].value=DefaultKeySettingsRebirth[i];
return 1;
case KEY_DELETE:
menu->items[menu->citem].value=255;
@ -721,11 +735,11 @@ int kconfig_key_command(window *wind, d_event *event, kc_menu *menu)
kc_mouse[i].l = find_next_item_left( kc_mouse,NUM_MOUSE_CONTROLS, i);
kc_mouse[i].r = find_next_item_right( kc_mouse,NUM_MOUSE_CONTROLS, i);
}
for (i=0; i<NUM_D1X_CONTROLS; i++ ) {
kc_d1x[i].u = find_next_item_up( kc_d1x,NUM_D1X_CONTROLS, i);
kc_d1x[i].d = find_next_item_down( kc_d1x,NUM_D1X_CONTROLS, i);
kc_d1x[i].l = find_next_item_left( kc_d1x,NUM_D1X_CONTROLS, i);
kc_d1x[i].r = find_next_item_right( kc_d1x,NUM_D1X_CONTROLS, i);
for (unsigned i=0; i<sizeof(kc_rebirth) / sizeof(kc_rebirth[0]); i++ ) {
kc_rebirth[i].u = find_next_item_up( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
kc_rebirth[i].d = find_next_item_down( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
kc_rebirth[i].l = find_next_item_left( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
kc_rebirth[i].r = find_next_item_right( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
}
fp = PHYSFSX_openWriteBuffered( "kconfig.cod" );
@ -766,12 +780,12 @@ int kconfig_key_command(window *wind, d_event *event, kc_menu *menu)
}
PHYSFSX_printf( fp, "};" );
PHYSFSX_printf( fp, "\nkc_item kc_d1x[NUM_D1X_CONTROLS] = {\n" );
for (i=0; i<NUM_D1X_CONTROLS; i++ ) {
PHYSFSX_printf( fp, "\nkc_item kc_rebirth[NUM_DXX_REBIRTH_CONTROLS] = {\n" );
for (i=0; i<NUM_DXX_REBIRTH_CONTROLS; i++ ) {
PHYSFSX_printf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n",
kc_d1x[i].id, kc_d1x[i].x, kc_d1x[i].y, kc_d1x[i].w1, kc_d1x[i].w2,
kc_d1x[i].u, kc_d1x[i].d, kc_d1x[i].l, kc_d1x[i].r,
34, kc_d1x[i].text, 34, btype_text[kc_d1x[i].type] );
kc_rebirth[i].id, kc_rebirth[i].x, kc_rebirth[i].y, kc_rebirth[i].w1, kc_rebirth[i].w2,
kc_rebirth[i].u, kc_rebirth[i].d, kc_rebirth[i].l, kc_rebirth[i].r,
34, kc_rebirth[i].text, 34, btype_text[kc_rebirth[i].type] );
}
PHYSFSX_printf( fp, "};" );
@ -880,8 +894,8 @@ int kconfig_handler(window *wind, d_event *event, kc_menu *menu)
for (i=0; i<NUM_MOUSE_CONTROLS; i++ )
PlayerCfg.KeySettings[2][i] = kc_mouse[i].value;
for (i=0; i<NUM_D1X_CONTROLS; i++)
PlayerCfg.KeySettingsD1X[i] = kc_d1x[i].value;
for (i=0; i<NUM_DXX_REBIRTH_CONTROLS; i++)
PlayerCfg.KeySettingsRebirth[i] = kc_rebirth[i].value;
return 0; // continue closing
break;
@ -1119,7 +1133,7 @@ void kconfig(int n, const char * title)
case 0:kconfig_sub( kc_keyboard,NUM_KEY_CONTROLS, title); break;
case 1:kconfig_sub( kc_joystick,NUM_JOYSTICK_CONTROLS,title); break;
case 2:kconfig_sub( kc_mouse, NUM_MOUSE_CONTROLS, title); break;
case 3:kconfig_sub( kc_d1x, NUM_D1X_CONTROLS, title ); break;
case 3:kconfig_sub( kc_rebirth, NUM_DXX_REBIRTH_CONTROLS, title ); break;
default:
Int3();
return;
@ -1163,7 +1177,7 @@ void kconfig_read_controls(d_event *event, int automap_flag)
}
if (!automap_flag && event->type == EVENT_KEY_COMMAND)
for (i = 0, j = 0; i < 28; i += 3, j++)
if (kc_d1x[i].value < 255 && kc_d1x[i].value == event_key_get_raw(event))
if (kc_rebirth[i].value < 255 && kc_rebirth[i].value == event_key_get_raw(event))
{
Controls.select_weapon_count = j+1;
break;
@ -1190,7 +1204,7 @@ void kconfig_read_controls(d_event *event, int automap_flag)
}
if (!automap_flag && event->type == EVENT_JOYSTICK_BUTTON_DOWN)
for (i = 1, j = 0; i < 29; i += 3, j++)
if (kc_d1x[i].value < 255 && kc_d1x[i].value == event_joystick_get_button(event))
if (kc_rebirth[i].value < 255 && kc_rebirth[i].value == event_joystick_get_button(event))
{
Controls.select_weapon_count = j+1;
break;
@ -1217,7 +1231,7 @@ void kconfig_read_controls(d_event *event, int automap_flag)
}
if (!automap_flag && event->type == EVENT_MOUSE_BUTTON_DOWN)
for (i = 2, j = 0; i < 30; i += 3, j++)
if (kc_d1x[i].value < 255 && kc_d1x[i].value == event_mouse_get_button(event))
if (kc_rebirth[i].value < 255 && kc_rebirth[i].value == event_mouse_get_button(event))
{
Controls.select_weapon_count = j+1;
break;
@ -1623,6 +1637,6 @@ void kc_set_controls()
}
}
for (i=0; i<NUM_D1X_CONTROLS; i++ )
kc_d1x[i].value = PlayerCfg.KeySettingsD1X[i];
for (i=0; i<NUM_DXX_REBIRTH_CONTROLS; i++ )
kc_rebirth[i].value = PlayerCfg.KeySettingsRebirth[i];
}

View file

@ -70,7 +70,7 @@ int new_player_config()
InitWeaponOrdering (); //setup default weapon priorities
PlayerCfg.ControlType=0; // Assume keyboard
memcpy(PlayerCfg.KeySettings, DefaultKeySettings, sizeof(DefaultKeySettings));
memcpy(PlayerCfg.KeySettingsD1X, DefaultKeySettingsD1X, sizeof(DefaultKeySettingsD1X));
memcpy(PlayerCfg.KeySettingsRebirth, DefaultKeySettingsRebirth, sizeof(DefaultKeySettingsRebirth));
kc_set_controls();
PlayerCfg.DefaultDifficulty = 1;
@ -270,9 +270,9 @@ int read_player_d1x(char *filename)
i=(i-1)*3;
sscanf(line,"0x%x,0x%x,0x%x",&kc1,&kc2,&kc3);
PlayerCfg.KeySettingsD1X[i] = kc1;
PlayerCfg.KeySettingsD1X[i+1] = kc2;
PlayerCfg.KeySettingsD1X[i+2] = kc3;
PlayerCfg.KeySettingsRebirth[i] = kc1;
PlayerCfg.KeySettingsRebirth[i+1] = kc2;
PlayerCfg.KeySettingsRebirth[i+2] = kc3;
d_free(word);
PHYSFSX_fgets(line,50,f);
word=splitword(line,'=');
@ -636,16 +636,16 @@ int write_player_d1x(char *filename)
PHYSFSX_printf(fout,"fsindi=%d\n",PlayerCfg.MouseFSIndicator);
PHYSFSX_printf(fout,"[end]\n");
PHYSFSX_printf(fout,"[weapon keys v2]\n");
PHYSFSX_printf(fout,"1=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[0],PlayerCfg.KeySettingsD1X[1],PlayerCfg.KeySettingsD1X[2]);
PHYSFSX_printf(fout,"2=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[3],PlayerCfg.KeySettingsD1X[4],PlayerCfg.KeySettingsD1X[5]);
PHYSFSX_printf(fout,"3=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[6],PlayerCfg.KeySettingsD1X[7],PlayerCfg.KeySettingsD1X[8]);
PHYSFSX_printf(fout,"4=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[9],PlayerCfg.KeySettingsD1X[10],PlayerCfg.KeySettingsD1X[11]);
PHYSFSX_printf(fout,"5=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[12],PlayerCfg.KeySettingsD1X[13],PlayerCfg.KeySettingsD1X[14]);
PHYSFSX_printf(fout,"6=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[15],PlayerCfg.KeySettingsD1X[16],PlayerCfg.KeySettingsD1X[17]);
PHYSFSX_printf(fout,"7=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[18],PlayerCfg.KeySettingsD1X[19],PlayerCfg.KeySettingsD1X[20]);
PHYSFSX_printf(fout,"8=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[21],PlayerCfg.KeySettingsD1X[22],PlayerCfg.KeySettingsD1X[23]);
PHYSFSX_printf(fout,"9=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[24],PlayerCfg.KeySettingsD1X[25],PlayerCfg.KeySettingsD1X[26]);
PHYSFSX_printf(fout,"0=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD1X[27],PlayerCfg.KeySettingsD1X[28],PlayerCfg.KeySettingsD1X[29]);
PHYSFSX_printf(fout,"1=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[0],PlayerCfg.KeySettingsRebirth[1],PlayerCfg.KeySettingsRebirth[2]);
PHYSFSX_printf(fout,"2=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[3],PlayerCfg.KeySettingsRebirth[4],PlayerCfg.KeySettingsRebirth[5]);
PHYSFSX_printf(fout,"3=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[6],PlayerCfg.KeySettingsRebirth[7],PlayerCfg.KeySettingsRebirth[8]);
PHYSFSX_printf(fout,"4=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[9],PlayerCfg.KeySettingsRebirth[10],PlayerCfg.KeySettingsRebirth[11]);
PHYSFSX_printf(fout,"5=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[12],PlayerCfg.KeySettingsRebirth[13],PlayerCfg.KeySettingsRebirth[14]);
PHYSFSX_printf(fout,"6=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[15],PlayerCfg.KeySettingsRebirth[16],PlayerCfg.KeySettingsRebirth[17]);
PHYSFSX_printf(fout,"7=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[18],PlayerCfg.KeySettingsRebirth[19],PlayerCfg.KeySettingsRebirth[20]);
PHYSFSX_printf(fout,"8=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[21],PlayerCfg.KeySettingsRebirth[22],PlayerCfg.KeySettingsRebirth[23]);
PHYSFSX_printf(fout,"9=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[24],PlayerCfg.KeySettingsRebirth[25],PlayerCfg.KeySettingsRebirth[26]);
PHYSFSX_printf(fout,"0=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[27],PlayerCfg.KeySettingsRebirth[28],PlayerCfg.KeySettingsRebirth[29]);
PHYSFSX_printf(fout,"[end]\n");
PHYSFSX_printf(fout,"[cockpit]\n");
PHYSFSX_printf(fout,"mode=%i\n",PlayerCfg.CockpitMode[0]);

View file

@ -148,7 +148,7 @@ fix flash_scale;
#define FLASH_CYCLE_RATE f1_0
fix flash_rate = FLASH_CYCLE_RATE;
static const fix Flash_rate = FLASH_CYCLE_RATE;
//cycle the flashing light for when mine destroyed
void flash_frame()
@ -165,7 +165,7 @@ void flash_frame()
return;
// flash_ang += fixmul(FLASH_CYCLE_RATE,FrameTime);
flash_ang += fixmul(flash_rate,FrameTime);
flash_ang += fixmul(Flash_rate,FrameTime);
fix_fastsincos(flash_ang,&flash_scale,NULL);
@ -177,6 +177,11 @@ void flash_frame()
extern int Current_level_num;
#endif
static inline int is_alphablend_eclip(int eclip_num)
{
return eclip_num == ECLIP_NUM_FUELCEN;
}
// -----------------------------------------------------------------------------------
// Render a face.
// It would be nice to not have to pass in segnum and sidenum, but they are used for our
@ -280,7 +285,7 @@ void render_face(int segnum, int sidenum, int nv, int *vp, int tmap1, int tmap2,
}
if ( PlayerCfg.AlphaEffects && ( TmapInfo[tmap1].eclip_num == ECLIP_NUM_FUELCEN ) ) // set nice transparency/blending for some special effects (if we do more, we should maybe use switch here)
if ( PlayerCfg.AlphaEffects && is_alphablend_eclip(TmapInfo[tmap1].eclip_num) ) // set nice transparency/blending for some special effects (if we do more, we should maybe use switch here)
gr_settransblend(GR_FADE_OFF, GR_BLEND_ADDITIVE_C);
#ifdef EDITOR
@ -396,16 +401,16 @@ void render_side(segment *segp, int sidenum)
normals[1] = segp->sides[sidenum].normals[1];
#endif
get_side_verts(vertnum_list,segp-Segments,sidenum);
// Regardless of whether this side is comprised of a single quad, or two triangles, we need to know one normal, so
// deal with it, get the dot product.
if (sidep->type == SIDE_IS_TRI_13) {
vm_vec_normalized_dir(&tvec, &Viewer_eye, &Vertices[segp->verts[Side_to_verts[sidenum][1]]]);
vm_vec_normalized_dir(&tvec, &Viewer_eye, &Vertices[vertnum_list[1]]);
} else {
vm_vec_normalized_dir(&tvec, &Viewer_eye, &Vertices[segp->verts[Side_to_verts[sidenum][0]]]);
vm_vec_normalized_dir(&tvec, &Viewer_eye, &Vertices[vertnum_list[0]]);
}
get_side_verts(vertnum_list,segp-Segments,sidenum);
v_dot_n0 = vm_vec_dot(&tvec, &normals[0]);
if (sidep->type == SIDE_IS_QUAD) {

View file

@ -478,10 +478,6 @@ grs_bitmap *bm_load_extra_objbitmap(char *name)
}
}
#ifdef OGL
void ogl_cache_polymodel_textures(int model_num);
#endif
int load_exit_models()
{
PHYSFS_file *exit_hamfile;

View file

@ -57,15 +57,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "ogl_init.h"
#endif
vms_vector ExtForceVec;
vms_matrix ExtApplyForceMatrix;
int ExtJoltInfo[3]={0,0,0};
int ExtXVibrateInfo[2]={0,0};
int ExtYVibrateInfo[2]={0,0};
ubyte ExtXVibrateClear=0;
ubyte ExtYVibrateClear=0;
#define TABLE_CREATION 1
// Array used to 'blink' the cursor while waiting for a keypress.
@ -137,7 +128,7 @@ const ubyte DefaultKeySettings[3][MAX_CONTROLS] = {
{0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0},
{0x0,0x1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0x0},
};
const ubyte DefaultKeySettingsD2X[MAX_D2X_CONTROLS] = { 0x2,0xff,0xff,0x3,0xff,0xff,0x4,0xff,0xff,0x5,0xff,0xff,0x6,0xff,0xff,0x7,0xff,0xff,0x8,0xff,0xff,0x9,0xff,0xff,0xa,0xff,0xff,0xb,0xff,0xff };
const ubyte DefaultKeySettingsRebirth[MAX_DXX_REBIRTH_CONTROLS] = { 0x2,0xff,0xff,0x3,0xff,0xff,0x4,0xff,0xff,0x5,0xff,0xff,0x6,0xff,0xff,0x7,0xff,0xff,0x8,0xff,0xff,0x9,0xff,0xff,0xa,0xff,0xff,0xb,0xff,0xff };
// id, x, y, w1, w2, u, d, l, r, text, type, value
kc_item kc_keyboard[NUM_KEY_CONTROLS] = {
@ -290,37 +281,50 @@ kc_item kc_mouse[NUM_MOUSE_CONTROLS] = {
{ 29, 25,118, 85, 26, 28, 14, 28, 13,"Cycle Secondary", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.cycle_secondary_count },
};
kc_item kc_d2x[NUM_D2X_CONTROLS] = {
{ 0, 15, 69,142, 26, 29, 3, 29, 1,"(SUPER)LASER CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 1, 15, 69,200, 26, 27, 4, 0, 2,"(SUPER)LASER CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 2, 15, 69,258, 26, 28, 5, 1, 3,"(SUPER)LASER CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 3, 15, 77,142, 26, 0, 6, 2, 4,"VULCAN/GAUSS CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 4, 15, 77,200, 26, 1, 7, 3, 5,"VULCAN/GAUSS CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 5, 15, 77,258, 26, 2, 8, 4, 6,"VULCAN/GAUSS CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 6, 15, 85,142, 26, 3, 9, 5, 7,"SPREADFIRE/HELIX CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 7, 15, 85,200, 26, 4, 10, 6, 8,"SPREADFIRE/HELIX CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 8, 15, 85,258, 26, 5, 11, 7, 9,"SPREADFIRE/HELIX CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 9, 15, 93,142, 26, 6, 12, 8, 10,"PLASMA/PHOENIX CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 10, 15, 93,200, 26, 7, 13, 9, 11,"PLASMA/PHOENIX CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 11, 15, 93,258, 26, 8, 14, 10, 12,"PLASMA/PHOENIX CANNON", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 12, 15,101,142, 26, 9, 15, 11, 13,"FUSION/OMEGA CANNON", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 13, 15,101,200, 26, 10, 16, 12, 14,"FUSION/OMEGA CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 14, 15,101,258, 26, 11, 17, 13, 15,"FUSION/OMEGA CANNON", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 15, 15,109,142, 26, 12, 18, 14, 16,"CONCUSSION/FLASH MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 16, 15,109,200, 26, 13, 19, 15, 17,"CONCUSSION/FLASH MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 17, 15,109,258, 26, 14, 20, 16, 18,"CONCUSSION/FLASH MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 18, 15,117,142, 26, 15, 21, 17, 19,"HOMING/GUIDED MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 19, 15,117,200, 26, 16, 22, 18, 20,"HOMING/GUIDED MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 20, 15,117,258, 26, 17, 23, 19, 21,"HOMING/GUIDED MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 21, 15,125,142, 26, 18, 24, 20, 22,"PROXIMITY BOMB/SMART MINE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 22, 15,125,200, 26, 19, 25, 21, 23,"PROXIMITY BOMB/SMART MINE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 23, 15,125,258, 26, 20, 26, 22, 24,"PROXIMITY BOMB/SMART MINE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 24, 15,133,142, 26, 21, 27, 23, 25,"SMART/MERCURY MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 25, 15,133,200, 26, 22, 28, 24, 26,"SMART/MERCURY MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 26, 15,133,258, 26, 23, 29, 25, 27,"SMART/MERCURY MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 27, 15,141,142, 26, 24, 1, 26, 28,"MEGA/EARTHSHAKER MISSILE", BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 28, 15,141,200, 26, 25, 2, 27, 29,"MEGA/EARTHSHAKER MISSILE", BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 29, 15,141,258, 26, 26, 0, 28, 0,"MEGA/EARTHSHAKER MISSILE", BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
#define D2X_EXTENDED_WEAPON_STRING(X) X
#define WEAPON_STRING_LASER D2X_EXTENDED_WEAPON_STRING("(SUPER)") "LASER CANNON"
#define WEAPON_STRING_VULCAN "VULCAN" D2X_EXTENDED_WEAPON_STRING("/GAUSS") " CANNON"
#define WEAPON_STRING_SPREADFIRE "SPREADFIRE" D2X_EXTENDED_WEAPON_STRING("/HELIX") " CANNON"
#define WEAPON_STRING_PLASMA "PLASMA" D2X_EXTENDED_WEAPON_STRING("/PHOENIX") " CANNON"
#define WEAPON_STRING_FUSION "FUSION" D2X_EXTENDED_WEAPON_STRING("/OMEGA") " CANNON"
#define WEAPON_STRING_CONCUSSION "CONCUSSION" D2X_EXTENDED_WEAPON_STRING("/FLASH") " MISSILE"
#define WEAPON_STRING_HOMING "HOMING" D2X_EXTENDED_WEAPON_STRING("/GUIDED") " MISSILE"
#define WEAPON_STRING_PROXIMITY "PROXIMITY BOMB" D2X_EXTENDED_WEAPON_STRING("/SMART MINE")
#define WEAPON_STRING_SMART "SMART" D2X_EXTENDED_WEAPON_STRING("/MERCURY") " MISSILE"
#define WEAPON_STRING_MEGA "MEGA" D2X_EXTENDED_WEAPON_STRING("/EARTHSHAKER") " MISSILE"
kc_item kc_rebirth[NUM_DXX_REBIRTH_CONTROLS] = {
{ 0, 15, 69,142, 26, 29, 3, 29, 1,WEAPON_STRING_LASER, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 1, 15, 69,200, 26, 27, 4, 0, 2,WEAPON_STRING_LASER, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 2, 15, 69,258, 26, 28, 5, 1, 3,WEAPON_STRING_LASER, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 3, 15, 77,142, 26, 0, 6, 2, 4,WEAPON_STRING_VULCAN, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 4, 15, 77,200, 26, 1, 7, 3, 5,WEAPON_STRING_VULCAN, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 5, 15, 77,258, 26, 2, 8, 4, 6,WEAPON_STRING_VULCAN, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 6, 15, 85,142, 26, 3, 9, 5, 7,WEAPON_STRING_SPREADFIRE, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 7, 15, 85,200, 26, 4, 10, 6, 8,WEAPON_STRING_SPREADFIRE, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 8, 15, 85,258, 26, 5, 11, 7, 9,WEAPON_STRING_SPREADFIRE, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 9, 15, 93,142, 26, 6, 12, 8, 10,WEAPON_STRING_PLASMA, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 10, 15, 93,200, 26, 7, 13, 9, 11,WEAPON_STRING_PLASMA, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 11, 15, 93,258, 26, 8, 14, 10, 12,WEAPON_STRING_PLASMA, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 12, 15,101,142, 26, 9, 15, 11, 13,WEAPON_STRING_FUSION, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 13, 15,101,200, 26, 10, 16, 12, 14,WEAPON_STRING_FUSION, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 14, 15,101,258, 26, 11, 17, 13, 15,WEAPON_STRING_FUSION, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 15, 15,109,142, 26, 12, 18, 14, 16,WEAPON_STRING_CONCUSSION, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 16, 15,109,200, 26, 13, 19, 15, 17,WEAPON_STRING_CONCUSSION, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 17, 15,109,258, 26, 14, 20, 16, 18,WEAPON_STRING_CONCUSSION, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 18, 15,117,142, 26, 15, 21, 17, 19,WEAPON_STRING_HOMING, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 19, 15,117,200, 26, 16, 22, 18, 20,WEAPON_STRING_HOMING, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 20, 15,117,258, 26, 17, 23, 19, 21,WEAPON_STRING_HOMING, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 21, 15,125,142, 26, 18, 24, 20, 22,WEAPON_STRING_PROXIMITY, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 22, 15,125,200, 26, 19, 25, 21, 23,WEAPON_STRING_PROXIMITY, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 23, 15,125,258, 26, 20, 26, 22, 24,WEAPON_STRING_PROXIMITY, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 24, 15,133,142, 26, 21, 27, 23, 25,WEAPON_STRING_SMART, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 25, 15,133,200, 26, 22, 28, 24, 26,WEAPON_STRING_SMART, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 26, 15,133,258, 26, 23, 29, 25, 27,WEAPON_STRING_SMART, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 27, 15,141,142, 26, 24, 1, 26, 28,WEAPON_STRING_MEGA, BT_KEY, 255, NULL, 0, &Controls.select_weapon_count },
{ 28, 15,141,200, 26, 25, 2, 27, 29,WEAPON_STRING_MEGA, BT_JOY_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
{ 29, 15,141,258, 26, 26, 0, 28, 0,WEAPON_STRING_MEGA, BT_MOUSE_BUTTON, 255, NULL, 0, &Controls.select_weapon_count },
};
void kc_drawitem( kc_item *item, int is_current );
@ -555,7 +559,7 @@ void kconfig_draw(kc_menu *menu)
gr_string( FSPACX(242), FSPACY(145), TXT_AXIS );
gr_string( FSPACX(274), FSPACY(145), TXT_INVERT );
}
else if ( menu->items == kc_d2x )
else if ( menu->items == kc_rebirth )
{
gr_set_fontcolor( BM_XRGB(31,27,6), -1 );
gr_setcolor( BM_XRGB(31,27,6) );
@ -681,9 +685,9 @@ int kconfig_key_command(window *wind, d_event *event, kc_menu *menu)
if ( menu->items==kc_mouse )
for (i=0; i<NUM_MOUSE_CONTROLS; i++ )
menu->items[i].value = DefaultKeySettings[2][i];
if ( menu->items==kc_d2x )
for(i=0;i<NUM_D2X_CONTROLS;i++)
menu->items[i].value=DefaultKeySettingsD2X[i];
if ( menu->items==kc_rebirth )
for(unsigned i=0;i<sizeof(menu->items) / sizeof(menu->items[0]);i++)
menu->items[i].value=DefaultKeySettingsRebirth[i];
return 1;
case KEY_DELETE:
menu->items[menu->citem].value=255;
@ -749,11 +753,11 @@ int kconfig_key_command(window *wind, d_event *event, kc_menu *menu)
kc_mouse[i].l = find_next_item_left( kc_mouse,NUM_MOUSE_CONTROLS, i);
kc_mouse[i].r = find_next_item_right( kc_mouse,NUM_MOUSE_CONTROLS, i);
}
for (i=0; i<NUM_D2X_CONTROLS; i++ ) {
kc_d2x[i].u = find_next_item_up( kc_d2x,NUM_D2X_CONTROLS, i);
kc_d2x[i].d = find_next_item_down( kc_d2x,NUM_D2X_CONTROLS, i);
kc_d2x[i].l = find_next_item_left( kc_d2x,NUM_D2X_CONTROLS, i);
kc_d2x[i].r = find_next_item_right( kc_d2x,NUM_D2X_CONTROLS, i);
for (unsigned i=0; i<sizeof(kc_rebirth) / sizeof(kc_rebirth[0]); i++ ) {
kc_rebirth[i].u = find_next_item_up( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
kc_rebirth[i].d = find_next_item_down( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
kc_rebirth[i].l = find_next_item_left( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
kc_rebirth[i].r = find_next_item_right( kc_rebirth,NUM_DXX_REBIRTH_CONTROLS, i);
}
fp = PHYSFSX_openWriteBuffered( "kconfig.cod" );
@ -800,12 +804,12 @@ int kconfig_key_command(window *wind, d_event *event, kc_menu *menu)
}
PHYSFSX_printf( fp, "};" );
PHYSFSX_printf( fp, "\nkc_item kc_d2x[NUM_D2X_CONTROLS] = {\n" );
for (i=0; i<NUM_D2X_CONTROLS; i++ ) {
PHYSFSX_printf( fp, "\nkc_item kc_rebirth[NUM_DXX_REBIRTH_CONTROLS] = {\n" );
for (i=0; i<NUM_DXX_REBIRTH_CONTROLS; i++ ) {
PHYSFSX_printf( fp, "\t{ %2d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%c%s%c, %s, 255 },\n",
kc_d2x[i].id, kc_d2x[i].x, kc_d2x[i].y, kc_d2x[i].w1, kc_d2x[i].w2,
kc_d2x[i].u, kc_d2x[i].d, kc_d2x[i].l, kc_d2x[i].r,
34, kc_d2x[i].text, 34, btype_text[kc_d2x[i].type] );
kc_rebirth[i].id, kc_rebirth[i].x, kc_rebirth[i].y, kc_rebirth[i].w1, kc_rebirth[i].w2,
kc_rebirth[i].u, kc_rebirth[i].d, kc_rebirth[i].l, kc_rebirth[i].r,
34, kc_rebirth[i].text, 34, btype_text[kc_rebirth[i].type] );
}
PHYSFSX_printf( fp, "};" );
@ -914,8 +918,8 @@ int kconfig_handler(window *wind, d_event *event, kc_menu *menu)
for (i=0; i<NUM_MOUSE_CONTROLS; i++ )
PlayerCfg.KeySettings[2][i] = kc_mouse[i].value;
for (i=0; i<NUM_D2X_CONTROLS; i++)
PlayerCfg.KeySettingsD2X[i] = kc_d2x[i].value;
for (i=0; i<NUM_DXX_REBIRTH_CONTROLS; i++)
PlayerCfg.KeySettingsRebirth[i] = kc_rebirth[i].value;
return 0; // continue closing
break;
@ -1152,18 +1156,13 @@ void kconfig(int n, const char * title)
case 0:kconfig_sub( kc_keyboard,NUM_KEY_CONTROLS, title); break;
case 1:kconfig_sub( kc_joystick,NUM_JOYSTICK_CONTROLS,title); break;
case 2:kconfig_sub( kc_mouse, NUM_MOUSE_CONTROLS, title); break;
case 3:kconfig_sub( kc_d2x, NUM_D2X_CONTROLS, title ); break;
case 3:kconfig_sub( kc_rebirth, NUM_DXX_REBIRTH_CONTROLS, title ); break;
default:
Int3();
return;
}
}
fix Last_angles_p = 0;
fix Last_angles_b = 0;
fix Last_angles_h = 0;
ubyte Last_angles_read = 0;
void kconfig_read_controls(d_event *event, int automap_flag)
{
int i = 0, j = 0, speed_factor = cheats.turbo?2:1;
@ -1201,7 +1200,7 @@ void kconfig_read_controls(d_event *event, int automap_flag)
}
if (!automap_flag && event->type == EVENT_KEY_COMMAND)
for (i = 0, j = 0; i < 28; i += 3, j++)
if (kc_d2x[i].value < 255 && kc_d2x[i].value == event_key_get_raw(event))
if (kc_rebirth[i].value < 255 && kc_rebirth[i].value == event_key_get_raw(event))
{
Controls.select_weapon_count = j+1;
break;
@ -1228,7 +1227,7 @@ void kconfig_read_controls(d_event *event, int automap_flag)
}
if (!automap_flag && event->type == EVENT_JOYSTICK_BUTTON_DOWN)
for (i = 1, j = 0; i < 29; i += 3, j++)
if (kc_d2x[i].value < 255 && kc_d2x[i].value == event_joystick_get_button(event))
if (kc_rebirth[i].value < 255 && kc_rebirth[i].value == event_joystick_get_button(event))
{
Controls.select_weapon_count = j+1;
break;
@ -1255,7 +1254,7 @@ void kconfig_read_controls(d_event *event, int automap_flag)
}
if (!automap_flag && event->type == EVENT_MOUSE_BUTTON_DOWN)
for (i = 2, j = 0; i < 30; i += 3, j++)
if (kc_d2x[i].value < 255 && kc_d2x[i].value == event_mouse_get_button(event))
if (kc_rebirth[i].value < 255 && kc_rebirth[i].value == event_mouse_get_button(event))
{
Controls.select_weapon_count = j+1;
break;
@ -1662,6 +1661,6 @@ void kc_set_controls()
}
}
for (i=0; i<NUM_D2X_CONTROLS; i++ )
kc_d2x[i].value = PlayerCfg.KeySettingsD2X[i];
for (i=0; i<NUM_DXX_REBIRTH_CONTROLS; i++ )
kc_rebirth[i].value = PlayerCfg.KeySettingsRebirth[i];
}

View file

@ -409,9 +409,6 @@ void draw_copyright()
gr_string(0x8000,SHEIGHT-(LINE_SPACING*2),DESCENT_VERSION);
}
//returns the number of demo files on the disk
int newdemo_count_demos();
// ------------------------------------------------------------------------
int main_menu_handler(newmenu *menu, d_event *event, int *menu_choice )
{

View file

@ -730,7 +730,10 @@ int load_mission(mle *mission)
free_mission();
MALLOC(Current_mission, Mission, 1);
if (!Current_mission) return 0;
*(mle *) Current_mission = *mission;
Current_mission->builtin_hogsize = mission->builtin_hogsize;
strcpy(Current_mission->mission_name, mission->mission_name);
Current_mission->descent_version = mission->descent_version;
Current_mission->anarchy_only_flag = mission->anarchy_only_flag;
Current_mission->path = d_strdup(mission->path);
Current_mission->filename = Current_mission->path + (mission->filename - mission->path);
Current_mission->n_secret_levels = 0;

View file

@ -130,6 +130,7 @@ typedef struct DiskBitmapHeader {
ubyte avg_color;
int offset;
} __pack__ DiskBitmapHeader;
typedef char padding_check[sizeof(DiskBitmapHeader) == 0x12 ? 1 : -1];
#define DISKBITMAPHEADER_D1_SIZE 17 // no wh_extra

View file

@ -85,7 +85,7 @@ int new_player_config()
InitWeaponOrdering (); //setup default weapon priorities
PlayerCfg.ControlType=0; // Assume keyboard
memcpy(PlayerCfg.KeySettings, DefaultKeySettings, sizeof(DefaultKeySettings));
memcpy(PlayerCfg.KeySettingsD2X, DefaultKeySettingsD2X, sizeof(DefaultKeySettingsD2X));
memcpy(PlayerCfg.KeySettingsRebirth, DefaultKeySettingsRebirth, sizeof(DefaultKeySettingsRebirth));
kc_set_controls();
PlayerCfg.DefaultDifficulty = 1;
@ -265,9 +265,9 @@ int read_player_d2x(char *filename)
i=(i-1)*3;
sscanf(line,"0x%x,0x%x,0x%x",&kc1,&kc2,&kc3);
PlayerCfg.KeySettingsD2X[i] = kc1;
PlayerCfg.KeySettingsD2X[i+1] = kc2;
PlayerCfg.KeySettingsD2X[i+2] = kc3;
PlayerCfg.KeySettingsRebirth[i] = kc1;
PlayerCfg.KeySettingsRebirth[i+1] = kc2;
PlayerCfg.KeySettingsRebirth[i+2] = kc3;
d_free(word);
PHYSFSX_fgets(line,50,f);
word=splitword(line,'=');
@ -450,16 +450,16 @@ int write_player_d2x(char *filename)
PHYSFSX_printf(fout,"fsindi=%d\n",PlayerCfg.MouseFSIndicator);
PHYSFSX_printf(fout,"[end]\n");
PHYSFSX_printf(fout,"[weapon keys v2]\n");
PHYSFSX_printf(fout,"1=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[0],PlayerCfg.KeySettingsD2X[1],PlayerCfg.KeySettingsD2X[2]);
PHYSFSX_printf(fout,"2=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[3],PlayerCfg.KeySettingsD2X[4],PlayerCfg.KeySettingsD2X[5]);
PHYSFSX_printf(fout,"3=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[6],PlayerCfg.KeySettingsD2X[7],PlayerCfg.KeySettingsD2X[8]);
PHYSFSX_printf(fout,"4=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[9],PlayerCfg.KeySettingsD2X[10],PlayerCfg.KeySettingsD2X[11]);
PHYSFSX_printf(fout,"5=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[12],PlayerCfg.KeySettingsD2X[13],PlayerCfg.KeySettingsD2X[14]);
PHYSFSX_printf(fout,"6=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[15],PlayerCfg.KeySettingsD2X[16],PlayerCfg.KeySettingsD2X[17]);
PHYSFSX_printf(fout,"7=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[18],PlayerCfg.KeySettingsD2X[19],PlayerCfg.KeySettingsD2X[20]);
PHYSFSX_printf(fout,"8=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[21],PlayerCfg.KeySettingsD2X[22],PlayerCfg.KeySettingsD2X[23]);
PHYSFSX_printf(fout,"9=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[24],PlayerCfg.KeySettingsD2X[25],PlayerCfg.KeySettingsD2X[26]);
PHYSFSX_printf(fout,"0=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsD2X[27],PlayerCfg.KeySettingsD2X[28],PlayerCfg.KeySettingsD2X[29]);
PHYSFSX_printf(fout,"1=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[0],PlayerCfg.KeySettingsRebirth[1],PlayerCfg.KeySettingsRebirth[2]);
PHYSFSX_printf(fout,"2=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[3],PlayerCfg.KeySettingsRebirth[4],PlayerCfg.KeySettingsRebirth[5]);
PHYSFSX_printf(fout,"3=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[6],PlayerCfg.KeySettingsRebirth[7],PlayerCfg.KeySettingsRebirth[8]);
PHYSFSX_printf(fout,"4=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[9],PlayerCfg.KeySettingsRebirth[10],PlayerCfg.KeySettingsRebirth[11]);
PHYSFSX_printf(fout,"5=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[12],PlayerCfg.KeySettingsRebirth[13],PlayerCfg.KeySettingsRebirth[14]);
PHYSFSX_printf(fout,"6=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[15],PlayerCfg.KeySettingsRebirth[16],PlayerCfg.KeySettingsRebirth[17]);
PHYSFSX_printf(fout,"7=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[18],PlayerCfg.KeySettingsRebirth[19],PlayerCfg.KeySettingsRebirth[20]);
PHYSFSX_printf(fout,"8=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[21],PlayerCfg.KeySettingsRebirth[22],PlayerCfg.KeySettingsRebirth[23]);
PHYSFSX_printf(fout,"9=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[24],PlayerCfg.KeySettingsRebirth[25],PlayerCfg.KeySettingsRebirth[26]);
PHYSFSX_printf(fout,"0=0x%x,0x%x,0x%x\n",PlayerCfg.KeySettingsRebirth[27],PlayerCfg.KeySettingsRebirth[28],PlayerCfg.KeySettingsRebirth[29]);
PHYSFSX_printf(fout,"[end]\n");
PHYSFSX_printf(fout,"[cockpit]\n");
PHYSFSX_printf(fout,"hud=%i\n",PlayerCfg.HudMode);

View file

@ -153,7 +153,7 @@ fix flash_scale;
#define FLASH_CYCLE_RATE f1_0
fix Flash_rate = FLASH_CYCLE_RATE;
static const fix Flash_rate = FLASH_CYCLE_RATE;
//cycle the flashing light for when mine destroyed
void flash_frame()
@ -191,6 +191,13 @@ void flash_frame()
}
static inline int is_alphablend_eclip(int eclip_num)
{
if (eclip_num == ECLIP_NUM_FORCE_FIELD)
return 1;
return eclip_num == ECLIP_NUM_FUELCEN;
}
// ----------------------------------------------------------------------------
// Render a face.
// It would be nice to not have to pass in segnum and sidenum, but
@ -313,7 +320,7 @@ void render_face(int segnum, int sidenum, int nv, int *vp, int tmap1, int tmap2,
}
}
if ( PlayerCfg.AlphaEffects && ( TmapInfo[tmap1].eclip_num == ECLIP_NUM_FUELCEN || TmapInfo[tmap1].eclip_num == ECLIP_NUM_FORCE_FIELD ) ) // set nice transparency/blending for some special effects (if we do more, we should maybe use switch here)
if ( PlayerCfg.AlphaEffects && is_alphablend_eclip(TmapInfo[tmap1].eclip_num) ) // set nice transparency/blending for some special effects (if we do more, we should maybe use switch here)
gr_settransblend(GR_FADE_OFF, GR_BLEND_ADDITIVE_C);
#ifdef EDITOR
@ -427,12 +434,13 @@ void render_side(segment *segp, int sidenum)
normals[0] = segp->sides[sidenum].normals[0];
normals[1] = segp->sides[sidenum].normals[1];
#endif
get_side_verts(vertnum_list,segp-Segments,sidenum);
// ========== Mark: Here is the change...beginning here: ==========
if (sidep->type == SIDE_IS_QUAD) {
vm_vec_sub(&tvec, &Viewer_eye, &Vertices[segp->verts[Side_to_verts[sidenum][0]]]);
vm_vec_sub(&tvec, &Viewer_eye, &Vertices[vertnum_list[0]]);
// -- Old, slow way -- // Regardless of whether this side is comprised of a single quad, or two triangles, we need to know one normal, so
// -- Old, slow way -- // deal with it, get the dot product.
@ -441,7 +449,6 @@ void render_side(segment *segp, int sidenum)
// -- Old, slow way -- else
// -- Old, slow way -- vm_vec_normalized_dir(&tvec, &Viewer_eye, &Vertices[segp->verts[Side_to_verts[sidenum][0]]]);
get_side_verts(vertnum_list,segp-Segments,sidenum);
v_dot_n0 = vm_vec_dot(&tvec, &normals[0]);
// -- flare creates point -- {
@ -494,11 +501,9 @@ void render_side(segment *segp, int sidenum)
// Regardless of whether this side is comprised of a single quad, or two triangles, we need to know one normal, so
// deal with it, get the dot product.
if (sidep->type == SIDE_IS_TRI_13)
vm_vec_normalized_dir_quick(&tvec, &Viewer_eye, &Vertices[segp->verts[Side_to_verts[sidenum][1]]]);
vm_vec_normalized_dir_quick(&tvec, &Viewer_eye, &Vertices[vertnum_list[1]]);
else
vm_vec_normalized_dir_quick(&tvec, &Viewer_eye, &Vertices[segp->verts[Side_to_verts[sidenum][0]]]);
get_side_verts(vertnum_list,segp-Segments,sidenum);
vm_vec_normalized_dir_quick(&tvec, &Viewer_eye, &Vertices[vertnum_list[0]]);
v_dot_n0 = vm_vec_dot(&tvec, &normals[0]);

View file

@ -821,7 +821,6 @@ void gr_close()
#endif
}
extern int r_upixelc;
void ogl_upixelc(int x, int y, int c)
{
GLfloat vertex_array[] = { (x+grd_curcanv->cv_bitmap.bm_x)/(float)last_width, 1.0-(y+grd_curcanv->cv_bitmap.bm_y)/(float)last_height };

View file

@ -53,6 +53,9 @@
#include "playsave.h"
#include "args.h"
#include <algorithm>
using std::max;
//change to 1 for lots of spew.
#if 0
#define glmprintf(0,a) con_printf(CON_DEBUG, a)
@ -69,46 +72,50 @@
#define sinf(a) sin(a)
#endif
unsigned char *ogl_pal=gr_palette;
static GLubyte *pixels = NULL;
static GLubyte *texbuf = NULL;
static unsigned char *ogl_pal=gr_palette;
unsigned last_width=~0u,last_height=~0u;
int GL_TEXTURE_2D_enabled=-1;
int GL_texclamp_enabled=-1;
GLfloat ogl_maxanisotropy = 0;
int r_texcount = 0, r_cachedtexcount = 0;
static int r_texcount = 0, r_cachedtexcount = 0;
#ifdef OGLES
int ogl_rgba_internalformat = GL_RGBA;
int ogl_rgb_internalformat = GL_RGB;
static int ogl_rgba_internalformat = GL_RGBA;
static int ogl_rgb_internalformat = GL_RGB;
#else
int ogl_rgba_internalformat = GL_RGBA8;
int ogl_rgb_internalformat = GL_RGB8;
static int ogl_rgba_internalformat = GL_RGBA8;
static int ogl_rgb_internalformat = GL_RGB8;
#endif
GLfloat *sphere_va = NULL, *circle_va = NULL, *disk_va = NULL;
GLfloat *secondary_lva[3]={NULL, NULL, NULL};
int r_polyc,r_tpolyc,r_bitmapc,r_ubitbltc,r_upixelc;
static GLfloat *sphere_va = NULL, *circle_va = NULL, *disk_va = NULL;
static GLfloat *secondary_lva[3]={NULL, NULL, NULL};
static int r_polyc,r_tpolyc,r_bitmapc,r_ubitbltc;
int r_upixelc;
extern int linedotscale;
#define f2glf(x) (f2fl(x))
#define OGL_BINDTEXTURE(a) glBindTexture(GL_TEXTURE_2D, a);
ogl_texture ogl_texture_list[OGL_TEXTURE_LIST_SIZE];
int ogl_texture_list_cur;
static ogl_texture ogl_texture_list[OGL_TEXTURE_LIST_SIZE];
static int ogl_texture_list_cur;
/* some function prototypes */
#define GL_TEXTURE0_ARB 0x84C0
extern GLubyte *pixels;
extern GLubyte *texbuf;
void ogl_filltexbuf(unsigned char *data, GLubyte *texp, int truewidth, int width, int height, int dxo, int dyo, int twidth, int theight, int type, int bm_flags, int data_format);
void ogl_loadbmtexture(grs_bitmap *bm);
int ogl_loadtexture(unsigned char *data, int dxo, int dyo, ogl_texture *tex, int bm_flags, int data_format, int texfilt);
void ogl_freetexture(ogl_texture *gltexture);
static int ogl_loadtexture(unsigned char *data, int dxo, int dyo, ogl_texture *tex, int bm_flags, int data_format, int texfilt);
static void ogl_freetexture(ogl_texture *gltexture);
static void ogl_loadbmtexture(grs_bitmap *bm)
{
ogl_loadbmtexture_f(bm, GameCfg.TexFilt);
}
#ifdef OGLES
// Replacement for gluPerspective
void perspective(double fovy, double aspect, double zNear, double zFar)
static void perspective(double fovy, double aspect, double zNear, double zFar)
{
double xmin, xmax, ymin, ymax;
@ -127,7 +134,7 @@ void perspective(double fovy, double aspect, double zNear, double zFar)
}
#endif
void ogl_init_texture_stats(ogl_texture* t){
static void ogl_init_texture_stats(ogl_texture* t){
t->prio=0.3;//default prio
t->numrend=0;
}
@ -191,12 +198,12 @@ void ogl_init_texture(ogl_texture* t, int w, int h, int flags)
ogl_init_texture_stats(t);
}
void ogl_reset_texture(ogl_texture* t)
static void ogl_reset_texture(ogl_texture* t)
{
ogl_init_texture(t, 0, 0, 0);
}
void ogl_reset_texture_stats_internal(void){
static void ogl_reset_texture_stats_internal(void){
int i;
for (i=0;i<OGL_TEXTURE_LIST_SIZE;i++)
if (ogl_texture_list[i].handle>0){
@ -314,7 +321,7 @@ void ogl_texture_stats(void)
gr_printf(FSPACX(2), FSPACY(1)+(LINE_SPACING*3), "total=%iK", (colorsize + depthsize + truebytes) / 1024);
}
void ogl_bindbmtex(grs_bitmap *bm){
static void ogl_bindbmtex(grs_bitmap *bm){
if (bm->gltexture==NULL || bm->gltexture->handle<=0)
ogl_loadbmtexture(bm);
OGL_BINDTEXTURE(bm->gltexture->handle);
@ -322,7 +329,7 @@ void ogl_bindbmtex(grs_bitmap *bm){
}
//gltexture MUST be bound first
void ogl_texwrap(ogl_texture *gltexture,int state)
static void ogl_texwrap(ogl_texture *gltexture,int state)
{
if (gltexture->wrapstate != state || gltexture->numrend < 1)
{
@ -533,7 +540,7 @@ void ogl_drawcircle(int nsides, int type, GLfloat *vertex_array)
glDisableClientState(GL_VERTEX_ARRAY);
}
GLfloat *circle_array_init(int nsides)
static GLfloat *circle_array_init(int nsides)
{
int i;
float ang;
@ -547,8 +554,8 @@ GLfloat *circle_array_init(int nsides)
return vertex_array;
}
GLfloat *circle_array_init_2(int nsides, float xsc, float xo, float ysc, float yo)
static GLfloat *circle_array_init_2(int nsides, float xsc, float xo, float ysc, float yo)
{
int i;
float ang;
@ -861,11 +868,11 @@ bool g3_draw_poly(int nv,g3s_point **pointlist)
return 0;
}
void gr_upoly_tmap(int nverts, const int *vert ){
void gr_upoly_tmap(int, const int *){
glmprintf((0,"gr_upoly_tmap: unhandled\n"));//should never get called
}
void draw_tmap_flat(grs_bitmap *bm,int nv,g3s_point **vertlist){
void draw_tmap_flat(grs_bitmap *,int,g3s_point **){
glmprintf((0,"draw_tmap_flat: unhandled\n"));//should never get called
}
@ -1193,8 +1200,6 @@ void ogl_set_blending()
}
}
GLubyte *pixels = NULL;
void ogl_start_frame(void){
r_polyc=0;r_tpolyc=0;r_bitmapc=0;r_ubitbltc=0;r_upixelc=0;
@ -1252,27 +1257,30 @@ void gr_flip(void)
}
//little hack to find the nearest bigger power of 2 for a given number
int pow2ize(int x){
int i;
for (i=2; i<x; i*=2) {}; //corrected by MD2211: was previously limited to 4096
return i;
unsigned pow2ize(unsigned f0){
unsigned f1 = (f0 - 1) | 1;
for (unsigned i = 4; i -- > 0;)
f1 |= f1 >> (1 << i);
unsigned f2 = f1 + 1;
assert(f2 >= f0);
assert(!(f2 & f1));
assert((f2 >> 1) < f0);
return f2;
}
GLubyte *texbuf = NULL;
// Allocate the pixel buffers 'pixels' and 'texbuf' based on current screen resolution
void ogl_init_pixel_buffers(int w, int h)
void ogl_init_pixel_buffers(unsigned w, unsigned h)
{
w = pow2ize(w); // convert to OpenGL texture size
h = pow2ize(h);
if (pixels)
d_free(pixels);
pixels = d_malloc(w*h*4);
MALLOC(pixels, GLubyte, w*h*4);
if (texbuf)
d_free(texbuf);
texbuf = d_malloc(max(w, 1024)*max(h, 256)*4); // must also fit big font texture
MALLOC(texbuf, GLubyte, max(w, 1024u)*max(h, 256u)*4); // must also fit big font texture
if ((pixels == NULL) || (texbuf == NULL))
Error("Not enough memory for current resolution");
@ -1284,19 +1292,17 @@ void ogl_close_pixel_buffers(void)
d_free(texbuf);
}
void ogl_filltexbuf(unsigned char *data, GLubyte *texp, int truewidth, int width, int height, int dxo, int dyo, int twidth, int theight, int type, int bm_flags, int data_format)
static void ogl_filltexbuf(unsigned char *data, GLubyte *texp, unsigned truewidth, unsigned width, unsigned height, int dxo, int dyo, unsigned twidth, unsigned theight, int type, int bm_flags, int data_format)
{
int x,y,c,i;
if ((width > max(grd_curscreen->sc_w, 1024)) || (height > max(grd_curscreen->sc_h, 256)))
if ((width > max(static_cast<unsigned>(grd_curscreen->sc_w), 1024u)) || (height > max(static_cast<unsigned>(grd_curscreen->sc_h), 256u)))
Error("Texture is too big: %ix%i", width, height);
i=0;
for (y=0;y<theight;y++)
for (unsigned y=0;y<theight;y++)
{
i=dxo+truewidth*(y+dyo);
for (x=0;x<twidth;x++)
int i=dxo+truewidth*(y+dyo);
for (unsigned x=0;x<twidth;x++)
{
int c;
if (x<width && y<height)
{
if (data_format)
@ -1418,7 +1424,7 @@ void ogl_filltexbuf(unsigned char *data, GLubyte *texp, int truewidth, int width
}
}
void tex_set_size1(ogl_texture *tex,int dbits,int bits,int w, int h){
static void tex_set_size1(ogl_texture *tex,int dbits,int bits,int w, int h){
int u;
if (tex->tw!=w || tex->th!=h){
u=(tex->w/(float)tex->tw*w) * (tex->h/(float)tex->th*h);
@ -1435,7 +1441,7 @@ void tex_set_size1(ogl_texture *tex,int dbits,int bits,int w, int h){
glmprintf((0,"tex_set_size1: %ix%i, %ib(%i) %iB\n",w,h,bits,dbits,tex->bytes));
}
void tex_set_size(ogl_texture *tex){
static void tex_set_size(ogl_texture *tex){
GLint w,h;
int bi=16,a=0;
#ifndef OGLES
@ -1484,7 +1490,7 @@ void tex_set_size(ogl_texture *tex){
//In theory this could be a problem for repeating textures, but all real
//textures (not sprites, etc) in descent are 64x64, so we are ok.
//stores OpenGL textured id in *texid and u/v values required to get only the real data in *u/*v
int ogl_loadtexture (unsigned char *data, int dxo, int dyo, ogl_texture *tex, int bm_flags, int data_format, int texfilt)
static int ogl_loadtexture (unsigned char *data, int dxo, int dyo, ogl_texture *tex, int bm_flags, int data_format, int texfilt)
{
GLubyte *bufP = texbuf;
tex->tw = pow2ize (tex->w);
@ -1655,12 +1661,7 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int texfilt)
ogl_loadtexture(buf, 0, 0, bm->gltexture, bm->bm_flags, 0, texfilt);
}
void ogl_loadbmtexture(grs_bitmap *bm)
{
ogl_loadbmtexture_f(bm, GameCfg.TexFilt);
}
void ogl_freetexture(ogl_texture *gltexture)
static void ogl_freetexture(ogl_texture *gltexture)
{
if (gltexture->handle>0) {
r_texcount--;

View file

@ -661,7 +661,6 @@ void toggle_cockpit()
}
int last_drawn_cockpit = -1;
extern void ogl_loadbmtexture(grs_bitmap *bm);
// This actually renders the new cockpit onto the screen.
void update_cockpits()

View file

@ -124,10 +124,10 @@ static void ReadCmdArgs(void)
GameArg.CtlNoMouse = FindArg("-nomouse");
GameArg.CtlNoJoystick = FindArg("-nojoystick");
GameArg.CtlNoStickyKeys = FindArg("-nostickykeys");
static char sdl_disable_lock_keys[] = "SDL_DISABLE_LOCK_KEYS=0";
if (GameArg.CtlNoStickyKeys) // Must happen before SDL_Init!
SDL_putenv("SDL_DISABLE_LOCK_KEYS=1");
else
SDL_putenv("SDL_DISABLE_LOCK_KEYS=0");
sdl_disable_lock_keys[sizeof(sdl_disable_lock_keys) - 1] = '1';
SDL_putenv(sdl_disable_lock_keys);
// Sound Options