Merge branch 'unification/master' into unification/syncgl_v2
Conflicts: similar/arch/ogl/gr.cpp similar/misc/args.cpp
This commit is contained in:
commit
639b569496
15
SConstruct
15
SConstruct
|
@ -179,10 +179,18 @@ class ConfigureTests:
|
|||
if r and forced != self.sconf_assume_success:
|
||||
caller_modified_env_flags.restore(context.env)
|
||||
context.env.Replace(CPPDEFINES=env_flags['CPPDEFINES'])
|
||||
for d in successflags.pop('CPPDEFINES', []):
|
||||
CPPDEFINES = []
|
||||
for v in successflags.pop('CPPDEFINES', []):
|
||||
d = v
|
||||
if isinstance(d, str):
|
||||
d = (d,None)
|
||||
if d[0] in ('_REENTRANT',):
|
||||
# Blacklist defines that must not be moved to the
|
||||
# configuration header.
|
||||
CPPDEFINES.append(v)
|
||||
continue
|
||||
context.sconf.Define(d[0], d[1])
|
||||
successflags['CPPDEFINES'] = CPPDEFINES
|
||||
for (k,v) in successflags.items():
|
||||
self._extend_successflags(k, v)
|
||||
else:
|
||||
|
@ -1204,7 +1212,6 @@ class DXXCommon(LazyObjectConstructor):
|
|||
class _PlatformSettings:
|
||||
tools = None
|
||||
ogllibs = ''
|
||||
osasmdef = None
|
||||
platform_objects = []
|
||||
__pkg_config_path = None
|
||||
__pkg_config_cache = {}
|
||||
|
@ -1277,7 +1284,6 @@ class DXXCommon(LazyObjectConstructor):
|
|||
# Settings to apply to mingw32 builds
|
||||
class Win32PlatformSettings(_PlatformSettings):
|
||||
tools = ['mingw']
|
||||
osasmdef = 'win32'
|
||||
def adjust_environment(self,program,env):
|
||||
env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL', 'WIN32_LEAN_AND_MEAN'])
|
||||
class DarwinPlatformSettings(_PlatformSettings):
|
||||
|
@ -1292,7 +1298,6 @@ class DXXCommon(LazyObjectConstructor):
|
|||
env.Append(FRAMEWORKPATH = [os.path.join(os.getenv("HOME"), 'Library/Frameworks'), '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks'])
|
||||
# Settings to apply to Linux builds
|
||||
class LinuxPlatformSettings(_PlatformSettings):
|
||||
osasmdef = 'elf'
|
||||
__opengl_libs = ['GL', 'GLU']
|
||||
__pkg_config_sdl = {}
|
||||
def __init__(self,program,user_settings):
|
||||
|
@ -1441,7 +1446,7 @@ class DXXCommon(LazyObjectConstructor):
|
|||
# gcc 4.5 silently ignores -Werror=undef. On gcc 4.5, misuse
|
||||
# produces a warning. On gcc 4.7, misuse produces an error.
|
||||
Werror = get_Werror_string(self.user_settings.CXXFLAGS)
|
||||
self.env.Append(CCFLAGS = ['-Wall', Werror + 'missing-declarations', Werror + 'pointer-arith', Werror + 'undef', Werror + 'type-limits', '-funsigned-char', Werror + 'format-security'])
|
||||
self.env.Append(CCFLAGS = ['-Wall', Werror + 'missing-declarations', Werror + 'pointer-arith', Werror + 'undef', Werror + 'type-limits', Werror + 'uninitialized', Werror + 'empty-body', Werror + 'ignored-qualifiers', Werror + 'unused', '-funsigned-char', Werror + 'format-security'])
|
||||
self.env.Append(CPPPATH = ['common/include', 'common/main', '.', self.user_settings.builddir])
|
||||
self.env.Append(CPPFLAGS = SCons.Util.CLVar('-Wno-sign-compare'))
|
||||
if (self.user_settings.editor == 1):
|
||||
|
|
|
@ -505,7 +505,7 @@ void show_fullscr(grs_bitmap &bm)
|
|||
auto &scr = grd_curcanv->cv_bitmap;
|
||||
#ifdef OGL
|
||||
if(bm.bm_type == BM_LINEAR && scr.bm_type == BM_OGL &&
|
||||
bm.bm_w <= grd_curscreen->sc_w && bm.bm_h <= grd_curscreen->sc_h) // only scale with OGL if bitmap is not bigger than screen size
|
||||
bm.bm_w <= grd_curscreen->get_screen_width() && bm.bm_h <= grd_curscreen->get_screen_height()) // only scale with OGL if bitmap is not bigger than screen size
|
||||
{
|
||||
ogl_ubitmapm_cs(0,0,-1,-1,bm,-1,F1_0);//use opengl to scale, faster and saves ram. -MPM
|
||||
return;
|
||||
|
|
|
@ -29,7 +29,6 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include <cstdint>
|
||||
|
||||
bool InitArgs(int argc, char **argv);
|
||||
extern void args_exit();
|
||||
|
||||
#ifdef OGL
|
||||
// GL Sync methods
|
||||
|
@ -58,6 +57,7 @@ typedef enum {
|
|||
// Edi - Editor Options
|
||||
// Dbg - Debugging/Undocumented Options
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||
#include <string>
|
||||
#include "dxxsconf.h"
|
||||
#include "compiler-type_traits.h"
|
||||
|
||||
|
@ -67,11 +67,11 @@ struct Arg
|
|||
int SysNoNiceFPS;
|
||||
int SysMaxFPS;
|
||||
int SysNoHogDir;
|
||||
const char *SysHogDir;
|
||||
int SysUsePlayersDir;
|
||||
int SysLowMem;
|
||||
const char *SysPilot;
|
||||
const char *SysRecordDemoNameTemplate;
|
||||
std::string SysHogDir;
|
||||
std::string SysPilot;
|
||||
std::string SysRecordDemoNameTemplate;
|
||||
bool SysAutoRecordDemo;
|
||||
int SysWindow;
|
||||
int SysNoBorders;
|
||||
|
@ -104,18 +104,18 @@ struct Arg
|
|||
SyncGLMethod OglSyncMethod;
|
||||
int OglSyncWait;
|
||||
#endif
|
||||
const char *MplUdpHostAddr;
|
||||
std::string MplUdpHostAddr;
|
||||
uint16_t MplUdpHostPort;
|
||||
uint16_t MplUdpMyPort;
|
||||
#ifdef USE_TRACKER
|
||||
uint16_t MplTrackerPort;
|
||||
const char *MplTrackerAddr;
|
||||
std::string MplTrackerAddr;
|
||||
#endif
|
||||
#ifdef DXX_BUILD_DESCENT_I
|
||||
int EdiNoBm;
|
||||
#endif
|
||||
#ifdef DXX_BUILD_DESCENT_II
|
||||
const char *EdiAutoLoad;
|
||||
std::string EdiAutoLoad;
|
||||
int EdiSaveHoardData;
|
||||
int EdiMacData; // also used for some read routines in non-editor build
|
||||
#endif
|
||||
|
@ -124,8 +124,8 @@ struct Arg
|
|||
int DbgNoRun;
|
||||
int DbgForbidConsoleGrab;
|
||||
int DbgRenderStats;
|
||||
const char *DbgAltTex;
|
||||
const char *DbgTexMap;
|
||||
std::string DbgAltTex;
|
||||
std::string DbgTexMap;
|
||||
int DbgShowMemInfo;
|
||||
int DbgNoDoubleBuffer;
|
||||
int DbgNoCompressPigBitmap;
|
||||
|
|
|
@ -49,8 +49,8 @@ extern int HiresGFXAvailable;
|
|||
|
||||
#define GWIDTH grd_curcanv->cv_bitmap.bm_w
|
||||
#define GHEIGHT grd_curcanv->cv_bitmap.bm_h
|
||||
#define SWIDTH (grd_curscreen->sc_w)
|
||||
#define SHEIGHT (grd_curscreen->sc_h)
|
||||
#define SWIDTH (grd_curscreen->get_screen_width())
|
||||
#define SHEIGHT (grd_curscreen->get_screen_height())
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
#define HIRESMODE HiresGFXAvailable // descent.pig either contains hires or lowres graphics, not both
|
||||
|
@ -162,14 +162,6 @@ struct grs_canvas : prohibit_void_ptr<grs_canvas>
|
|||
ubyte cv_blend_func; // blending function to use
|
||||
};
|
||||
|
||||
struct grs_screen : prohibit_void_ptr<grs_screen>
|
||||
{ // This is a video screen
|
||||
grs_canvas sc_canvas; // Represents the entire screen
|
||||
u_int32_t sc_mode; // Video mode number
|
||||
unsigned short sc_w, sc_h; // Actual Width and Height
|
||||
fix sc_aspect; //aspect ratio (w/h) for this screen
|
||||
};
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// System functions:
|
||||
|
@ -179,10 +171,34 @@ struct grs_screen : prohibit_void_ptr<grs_screen>
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class grs_screen : prohibit_void_ptr<grs_screen>
|
||||
{ // This is a video screen
|
||||
unsigned short sc_w, sc_h; // Actual Width and Height
|
||||
public:
|
||||
grs_canvas sc_canvas; // Represents the entire screen
|
||||
fix sc_aspect; //aspect ratio (w/h) for this screen
|
||||
uint_fast32_t get_screen_width() const
|
||||
{
|
||||
return sc_w;
|
||||
}
|
||||
uint_fast32_t get_screen_height() const
|
||||
{
|
||||
return sc_h;
|
||||
}
|
||||
uint_fast32_t get_screen_width_height() const
|
||||
{
|
||||
return SM(get_screen_width(), get_screen_height());
|
||||
}
|
||||
void set_screen_width_height(uint16_t w, uint16_t h)
|
||||
{
|
||||
sc_w = w;
|
||||
sc_h = h;
|
||||
}
|
||||
};
|
||||
|
||||
int gr_init(int mode);
|
||||
|
||||
int gr_list_modes( array<uint32_t, 50> &gsmodes );
|
||||
int gr_check_mode(u_int32_t mode);
|
||||
int gr_set_mode(u_int32_t mode);
|
||||
void gr_set_attributes(void);
|
||||
|
||||
|
@ -471,7 +487,6 @@ color_t gr_find_closest_color( int r, int g, int b );
|
|||
int gr_find_closest_color_15bpp( int rgb );
|
||||
|
||||
extern void gr_flip(void);
|
||||
extern void gr_set_draw_buffer(int buf);
|
||||
|
||||
/*
|
||||
* must return 0 if windowed, 1 if fullscreen
|
||||
|
@ -482,7 +497,7 @@ int gr_check_fullscreen(void);
|
|||
* returns state after toggling (ie, same as if you had called
|
||||
* check_fullscreen immediatly after)
|
||||
*/
|
||||
int gr_toggle_fullscreen(void);
|
||||
void gr_toggle_fullscreen();
|
||||
void ogl_do_palfx(void);
|
||||
void ogl_init_pixel_buffers(unsigned w, unsigned h);
|
||||
void ogl_close_pixel_buffers(void);
|
||||
|
|
|
@ -21,8 +21,6 @@ void ogl_smash_texture_list_internal(void);
|
|||
void ogl_vivify_texture_list_internal(void);
|
||||
|
||||
extern int linedotscale;
|
||||
extern int ogl_brightness_ok;
|
||||
extern int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
|
||||
extern int ogl_fullscreen;
|
||||
extern int r_upixelc;
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
* project's Git history. See COPYING.txt at the top level for license
|
||||
* terms and a link to the Git history.
|
||||
*/
|
||||
#ifndef __JUKEBOX_H__
|
||||
#define __JUKEBOX_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "physfsx.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern const array<file_extension_t, 6> jukebox_exts;
|
||||
extern const array<file_extension_t, 5> jukebox_exts;
|
||||
|
||||
void jukebox_unload();
|
||||
void jukebox_load();
|
||||
|
@ -23,5 +23,3 @@ int jukebox_numtracks();
|
|||
void jukebox_list();
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -78,15 +78,11 @@ void ogl_init_texture(ogl_texture &t, int w, int h, int flags);
|
|||
|
||||
void ogl_init_shared_palette(void);
|
||||
|
||||
extern int gl_initialized;
|
||||
|
||||
extern int active_texture_unit;
|
||||
extern GLfloat ogl_maxanisotropy;
|
||||
|
||||
void ogl_setActiveTexture(int t);
|
||||
|
||||
int ogl_init_window(int x, int y);//create a window/switch modes/etc
|
||||
|
||||
#define OGL_FLAG_MIPMAP (1 << 0)
|
||||
#define OGL_FLAG_NOCOLOR (1 << 1)
|
||||
#define OGL_FLAG_ALPHA (1 << 31) // not required for ogl_loadbmtexture, since it uses the BM_FLAG_TRANSPARENT, but is needed for ogl_init_texture.
|
||||
|
|
|
@ -354,8 +354,6 @@ extern void ui_draw_userbox( UI_DIALOG *dlg, UI_GADGET_USERBOX * userbox );
|
|||
|
||||
int MenuX( int x, int y, int NumButtons, const char *const text[] );
|
||||
|
||||
char **file_getdirlist(int *NumFiles, const char *dir);
|
||||
char **file_getfilelist(int *NumDirs, const char *filespec, const char *dir);
|
||||
int ui_get_filename( char * filename, const char * Filespec, const char * message );
|
||||
|
||||
|
||||
|
|
|
@ -217,14 +217,13 @@ struct ai_static : public prohibit_void_ptr<ai_static>
|
|||
short cur_path_index; // Current index in path.
|
||||
segnum_t follow_path_start_seg; // Start segment for robot which follows path.
|
||||
segnum_t follow_path_end_seg; // End segment for robot which follows path.
|
||||
int danger_laser_signature;
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
sbyte cur_path_index; // Current index in path.
|
||||
sbyte dying_sound_playing; // !0 if this robot is playing its dying sound.
|
||||
#endif
|
||||
objnum_t danger_laser_num;
|
||||
object_signature_t danger_laser_signature;
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
int danger_laser_signature;
|
||||
fix64 dying_start_time; // Time at which this robot started dying.
|
||||
#endif
|
||||
ai_local ail;
|
||||
|
|
|
@ -23,9 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
#pragma once
|
||||
|
||||
#include "player.h"
|
||||
#include "mission.h"
|
||||
|
@ -39,8 +37,9 @@ struct Cfg : prohibit_void_ptr<Cfg>
|
|||
{
|
||||
ubyte DigiVolume;
|
||||
ubyte MusicVolume;
|
||||
int ReverseStereo;
|
||||
int OrigTrackOrder;
|
||||
bool ReverseStereo;
|
||||
bool Grabinput;
|
||||
bool OrigTrackOrder;
|
||||
int MusicType;
|
||||
int CMLevelMusicPlayOrder;
|
||||
int CMLevelMusicTrack[2];
|
||||
|
@ -48,20 +47,19 @@ struct Cfg : prohibit_void_ptr<Cfg>
|
|||
array<ntstring<PATH_MAX - 1>, 5> CMMiscMusic;
|
||||
int GammaLevel;
|
||||
callsign_t LastPlayer;
|
||||
char LastMission[MISSION_NAME_LEN+1];
|
||||
ntstring<MISSION_NAME_LEN> LastMission;
|
||||
int ResolutionX;
|
||||
int ResolutionY;
|
||||
int AspectX;
|
||||
int AspectY;
|
||||
int WindowMode;
|
||||
int TexFilt;
|
||||
int VSync;
|
||||
int Multisample;
|
||||
int FPSIndicator;
|
||||
int Grabinput;
|
||||
bool WindowMode;
|
||||
bool VSync;
|
||||
bool Multisample;
|
||||
bool FPSIndicator;
|
||||
#ifdef DXX_BUILD_DESCENT_II
|
||||
bool MovieSubtitles;
|
||||
int MovieTexFilt;
|
||||
int MovieSubtitles;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -77,5 +75,3 @@ extern int ReadConfigFile(void);
|
|||
extern int WriteConfigFile(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -128,7 +128,6 @@ struct polyobj_info_rw;
|
|||
struct obj_position;
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||
extern const array<array<char, 9>, MAX_OBJECT_TYPES> Object_type_names;
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
const unsigned MAX_CONTROLCEN_GUNS = 4;
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
|
@ -266,7 +265,7 @@ void extract_quaternionpos(vobjptridx_t objp, quaternionpos *qpp, int swap_bytes
|
|||
void clear_transient_objects(int clear_all);
|
||||
|
||||
// Returns a new, unique signature for a new object
|
||||
int obj_get_signature();
|
||||
object_signature_t obj_get_signature();
|
||||
|
||||
// returns the number of a free object, updating Highest_object_index.
|
||||
// Generally, obj_create() should be called to get an object, since it
|
||||
|
|
|
@ -61,8 +61,9 @@ extern fix64 Next_flare_fire_time;
|
|||
extern fix Laser_delay_time; // Delay between laser fires.
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
class object_signature_t;
|
||||
extern struct object *Missile_viewer;
|
||||
extern int Missile_viewer_sig;
|
||||
extern object_signature_t Missile_viewer_sig;
|
||||
|
||||
#define CV_NONE 0
|
||||
#define CV_ESCORT 1
|
||||
|
|
|
@ -23,9 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HOSTAGE_H
|
||||
#define _HOSTAGE_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
@ -40,10 +38,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
struct hostage_data
|
||||
{
|
||||
objnum_t objnum;
|
||||
int objsig;
|
||||
object_signature_t objsig;
|
||||
};
|
||||
|
||||
extern hostage_data Hostages[MAX_HOSTAGES];
|
||||
extern array<hostage_data, MAX_HOSTAGES> Hostages;
|
||||
|
||||
//returns true if something drew
|
||||
int do_hostage_effects();
|
||||
|
@ -70,5 +68,3 @@ void draw_hostage(vobjptridx_t obj);
|
|||
void hostage_rescue();
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _HOSTAGE_H */
|
||||
|
|
|
@ -31,7 +31,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
void kmatrix_view(int network);
|
||||
int kmatrix_view(int network); // shows matrix screen. Retruns 0 if aborted (quitting game) and 1 if proceeding to next level if applicable.
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -150,14 +150,17 @@ extern Mission_ptr Current_mission; // current mission
|
|||
#define Secret_level_names Current_mission->secret_level_names
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
#define is_SHAREWARE (Current_mission->builtin_hogsize == SHAREWARE_MISSION_HOGSIZE)
|
||||
#define is_MAC_SHARE (Current_mission->builtin_hogsize == MAC_SHARE_MISSION_HOGSIZE)
|
||||
#define is_D2_OEM (Current_mission->builtin_hogsize == OEM_MISSION_HOGSIZE)
|
||||
/* Wrap in parentheses to avoid precedence problems. Put constant on
|
||||
* the left to silence clang's overzealous -Wparentheses-equality messages.
|
||||
*/
|
||||
#define is_SHAREWARE (SHAREWARE_MISSION_HOGSIZE == Current_mission->builtin_hogsize)
|
||||
#define is_MAC_SHARE (MAC_SHARE_MISSION_HOGSIZE == Current_mission->builtin_hogsize)
|
||||
#define is_D2_OEM (OEM_MISSION_HOGSIZE == Current_mission->builtin_hogsize)
|
||||
|
||||
#define EMULATING_D1 (Current_mission->descent_version == 1)
|
||||
#define EMULATING_D1 (1 == Current_mission->descent_version)
|
||||
#endif
|
||||
#define PLAYING_BUILTIN_MISSION (Current_mission->builtin_hogsize != 0)
|
||||
#define ANARCHY_ONLY_MISSION (Current_mission->anarchy_only_flag == 1)
|
||||
#define ANARCHY_ONLY_MISSION (1 == Current_mission->anarchy_only_flag)
|
||||
|
||||
//values for d1 built-in mission
|
||||
#define BIMD1_LAST_LEVEL 27
|
||||
|
|
|
@ -46,7 +46,7 @@ struct morph_data
|
|||
ubyte morph_save_control_type;
|
||||
ubyte morph_save_movement_type;
|
||||
physics_info morph_save_phys_info;
|
||||
int Morph_sig;
|
||||
object_signature_t Morph_sig;
|
||||
};
|
||||
|
||||
#define MAX_MORPH_OBJECTS 5
|
||||
|
|
|
@ -230,8 +230,8 @@ struct owned_remote_objnum
|
|||
|
||||
extern int GetMyNetRanking();
|
||||
extern void ClipRank (ubyte *rank);
|
||||
objnum_t objnum_remote_to_local(int remote_obj, int owner);
|
||||
short objnum_local_to_remote(objnum_t local_obj, sbyte *owner);
|
||||
objnum_t objnum_remote_to_local(uint16_t remote_obj, int8_t owner);
|
||||
uint16_t objnum_local_to_remote(objnum_t local_obj, int8_t *owner);
|
||||
owned_remote_objnum objnum_local_to_remote(objnum_t local);
|
||||
void map_objnum_local_to_remote(int local, int remote, int owner);
|
||||
void map_objnum_local_to_local(objnum_t objnum);
|
||||
|
@ -278,7 +278,7 @@ void multi_send_effect_blowup(segnum_t segnum, int side, const vms_vector &pnt);
|
|||
void multi_add_lifetime_kills(void);
|
||||
void multi_send_bounty( void );
|
||||
|
||||
void multi_endlevel_score(void);
|
||||
int multi_endlevel_score(void);
|
||||
void multi_consistency_error(int reset);
|
||||
void multi_prep_level(void);
|
||||
int multi_level_sync(void);
|
||||
|
|
|
@ -33,6 +33,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "objnum.h"
|
||||
#include "fwdvalptridx.h"
|
||||
|
||||
struct object_signature_t;
|
||||
|
||||
#define ND_STATE_NORMAL 0
|
||||
#define ND_STATE_RECORDING 1
|
||||
#define ND_STATE_PLAYBACK 2
|
||||
|
@ -140,7 +142,7 @@ extern int newdemo_swap_endian(const char *filename);
|
|||
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 );
|
||||
objnum_t newdemo_find_object(int signature);
|
||||
cobjptridx_t newdemo_find_object(object_signature_t signature);
|
||||
void newdemo_record_kill_sound_linked_to_object(vcobjptridx_t);
|
||||
void newdemo_record_guided_end();
|
||||
void newdemo_record_guided_start();
|
||||
|
|
|
@ -49,17 +49,6 @@ static inline typename tt::enable_if<tt::is_unsigned<T>::value, bool>::type conv
|
|||
return convert_integer(strtoul, t, value, base);
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
static inline void convert_string(char (&out)[N], const char *value, const char *eol)
|
||||
{
|
||||
assert(*eol == 0);
|
||||
const std::size_t i = std::distance(value, ++ eol);
|
||||
if (i > N)
|
||||
/* Only if not truncated */
|
||||
return;
|
||||
std::copy(value, eol, out);
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
static inline void convert_string(ntstring<N> &out, const char *const value, const char *eol)
|
||||
{
|
||||
|
|
|
@ -191,7 +191,7 @@ struct laser_info : prohibit_void_ptr<laser_info>
|
|||
};
|
||||
short parent_type; // The type of the parent of this object
|
||||
objnum_t parent_num; // The object's parent's number
|
||||
int parent_signature; // The object's parent's signature...
|
||||
object_signature_t parent_signature; // The object's parent's signature...
|
||||
fix64 creation_time; // Absolute time of creation.
|
||||
hitobj_list_t hitobj_list; // list of all objects persistent weapon has already damaged (useful in case it's in contact with two objects at the same time)
|
||||
objnum_t last_hitobj; // For persistent weapons (survive object collision), object it most recently hit.
|
||||
|
@ -300,7 +300,7 @@ struct polyobj_info_rw
|
|||
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||
struct object {
|
||||
int signature; // Every object ever has a unique signature...
|
||||
object_signature_t signature;
|
||||
ubyte type; // what type of object this is... robot, weapon, hostage, powerup, fireball
|
||||
ubyte id; // which form of object...which powerup, robot, etc.
|
||||
objnum_t next,prev; // id of next and previous connected object in Objects, -1 = no connection
|
||||
|
|
|
@ -6,3 +6,23 @@ DEFINE_STRICT_INDEX_CONSTANT_TYPE(object_magic_constant_t, objnum_t, int16_t);
|
|||
DEFINE_STRICT_INDEX_CONSTANT_NUMBER(object_magic_constant_t, -2, object_guidebot_cannot_reach);
|
||||
DEFINE_STRICT_INDEX_CONSTANT_NUMBER(object_magic_constant_t, -1, object_none);
|
||||
DEFINE_STRICT_INDEX_CONSTANT_NUMBER(object_magic_constant_t, 0, object_first);
|
||||
|
||||
class object_signature_t
|
||||
{
|
||||
uint16_t signature;
|
||||
public:
|
||||
object_signature_t() = default;
|
||||
constexpr explicit object_signature_t(uint16_t s) :
|
||||
signature(s)
|
||||
{
|
||||
}
|
||||
bool operator==(const object_signature_t &rhs) const
|
||||
{
|
||||
return signature == rhs.signature;
|
||||
}
|
||||
bool operator!=(const object_signature_t &rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
uint16_t get() const { return signature; }
|
||||
};
|
||||
|
|
|
@ -325,7 +325,7 @@ void player_rw_swap(player_rw *p, int swap);
|
|||
#endif
|
||||
|
||||
extern struct object *Guided_missile[MAX_PLAYERS];
|
||||
extern int Guided_missile_sig[MAX_PLAYERS];
|
||||
extern array<object_signature_t, MAX_PLAYERS> Guided_missile_sig;
|
||||
|
||||
/*
|
||||
* reads a player_ship structure from a PHYSFS_file
|
||||
|
|
|
@ -78,8 +78,9 @@ struct WALL_IS_DOORWAY_result_t
|
|||
|
||||
struct stuckobj : public prohibit_void_ptr<stuckobj>
|
||||
{
|
||||
short objnum, wallnum;
|
||||
int signature;
|
||||
objnum_t objnum;
|
||||
short wallnum;
|
||||
object_signature_t signature;
|
||||
};
|
||||
|
||||
//Start old wall structures
|
||||
|
|
|
@ -31,7 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "console.h"
|
||||
#include "dxxerror.h"
|
||||
|
||||
#define MAX_MSG_LEN 256
|
||||
#define MAX_MSG_LEN 2048
|
||||
|
||||
static void (*ErrorPrintFunc)(const char *);
|
||||
|
||||
|
|
|
@ -224,8 +224,8 @@ UI_DIALOG * ui_create_dialog( short x, short y, short w, short h, enum dialog_fl
|
|||
int sw, sh, req_w, req_h;
|
||||
|
||||
auto dlg = make_unique<UI_DIALOG>();
|
||||
sw = grd_curscreen->sc_w;
|
||||
sh = grd_curscreen->sc_h;
|
||||
sw = grd_curscreen->get_screen_width();
|
||||
sh = grd_curscreen->get_screen_height();
|
||||
|
||||
//mouse_set_limits(0, 0, sw - 1, sh - 1);
|
||||
|
||||
|
|
|
@ -39,31 +39,21 @@ static int file_sort_func(char **e0, char **e1)
|
|||
return d_stricmp(*e0, *e1);
|
||||
}
|
||||
|
||||
|
||||
char **file_getdirlist(int *NumDirs, const char *dir)
|
||||
static char **file_getdirlist(int *NumDirs, const char *dir)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
ntstring<PATH_MAX - 1> path;
|
||||
auto dlen = path.copy_if(dir);
|
||||
if (!dlen || !path.copy_if(dlen, "/"))
|
||||
return nullptr;
|
||||
++ dlen;
|
||||
char **list = PHYSFS_enumerateFiles(dir);
|
||||
char **i, **j = list;
|
||||
char *test_filename;
|
||||
unsigned test_max;
|
||||
|
||||
if (!list)
|
||||
return NULL;
|
||||
|
||||
strcpy(path, dir);
|
||||
if (*path)
|
||||
strncat(path, "/", PATH_MAX - strlen(dir));
|
||||
|
||||
test_filename = path + strlen(path);
|
||||
test_max = PATH_MAX - (test_filename - path);
|
||||
|
||||
for (i = list; *i; i++)
|
||||
{
|
||||
if (strlen(*i) >= test_max)
|
||||
if (!path.copy_if(dlen, *i))
|
||||
continue;
|
||||
|
||||
strcpy(test_filename, *i);
|
||||
if (PHYSFS_isDirectory(path))
|
||||
*j++ = *i;
|
||||
else
|
||||
|
@ -88,7 +78,7 @@ char **file_getdirlist(int *NumDirs, const char *dir)
|
|||
return list;
|
||||
}
|
||||
|
||||
char **file_getfilelist(int *NumFiles, const char *filespec, const char *dir)
|
||||
static char **file_getfilelist(int *NumFiles, const char *filespec, const char *dir)
|
||||
{
|
||||
char **list = PHYSFS_enumerateFiles(dir);
|
||||
char **i, **j = list, *ext;
|
||||
|
|
|
@ -92,8 +92,8 @@ int MenuX( int x, int y, int NumButtons, const char *const text[] )
|
|||
height = (button_height*NumButtons) + (MENU_VERT_SPACING*(NumButtons-1)) ;
|
||||
height += (MENU_BORDER+3) * 2;
|
||||
|
||||
w = grd_curscreen->sc_w;
|
||||
h = grd_curscreen->sc_h;
|
||||
w = grd_curscreen->get_screen_width();
|
||||
h = grd_curscreen->get_screen_height();
|
||||
|
||||
{
|
||||
int mx, my, mz;
|
||||
|
|
|
@ -63,7 +63,7 @@ static int messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m
|
|||
gr_set_current_canvas( &grd_curscreen->sc_canvas );
|
||||
temp_font = grd_curscreen->sc_canvas.cv_font;
|
||||
|
||||
if ( grd_curscreen->sc_w < 640 ) {
|
||||
if (grd_curscreen->get_screen_width() < 640) {
|
||||
grd_curscreen->sc_canvas.cv_font = ui_small_font.get();
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,8 @@ int (ui_messagebox)( short xc, short yc, const char * text, const ui_messagebox_
|
|||
button_width = button_height = 0;
|
||||
|
||||
gr_set_current_canvas( &grd_curscreen->sc_canvas );
|
||||
w = grd_curscreen->sc_w;
|
||||
h = grd_curscreen->sc_h;
|
||||
w = grd_curscreen->get_screen_width();
|
||||
h = grd_curscreen->get_screen_height();
|
||||
|
||||
for (uint_fast32_t i=0; i < Button.count(); i++ )
|
||||
{
|
||||
|
|
|
@ -1311,10 +1311,6 @@ void bm_read_player_ship(char *&arg, int skip)
|
|||
|
||||
arg = strtok( NULL, space_tab );
|
||||
}
|
||||
|
||||
Assert(model_name != NULL);
|
||||
|
||||
|
||||
if (First_multi_bitmap_num!=-1 && last_multi_bitmap_num==-1)
|
||||
last_multi_bitmap_num=N_ObjBitmapPtrs;
|
||||
|
||||
|
|
|
@ -39,7 +39,9 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "text.h"
|
||||
#include "piggy.h"
|
||||
|
||||
hostage_data Hostages[MAX_HOSTAGES]; // Data for each hostage in mine
|
||||
#include "compiler-range_for.h"
|
||||
|
||||
array<hostage_data, MAX_HOSTAGES> Hostages; // Data for each hostage in mine
|
||||
|
||||
//------------------- Useful macros and variables ---------------
|
||||
|
||||
|
@ -84,9 +86,9 @@ void hostage_init_info(const vobjptridx_t objnum)
|
|||
void hostage_init_all()
|
||||
{
|
||||
// Initialize all their values...
|
||||
for (int i=0; i<MAX_HOSTAGES; i++ ) {
|
||||
Hostages[i].objnum = object_none;
|
||||
Hostages[i].objsig = -1;
|
||||
range_for (auto &i, Hostages)
|
||||
{
|
||||
i.objnum = object_none;
|
||||
//Hostages[i].type = 0;
|
||||
//Hostages[i].sound_num = -1;
|
||||
}
|
||||
|
@ -108,10 +110,5 @@ void hostage_compress_all() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<MAX_HOSTAGES; i++ ) {
|
||||
if ( hostage_is_valid(i) )
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1614,9 +1614,6 @@ void bm_read_player_ship(void)
|
|||
|
||||
arg = strtok( NULL, space_tab );
|
||||
}
|
||||
|
||||
Assert(model_name != NULL);
|
||||
|
||||
if (First_multi_bitmap_num!=-1 && last_multi_bitmap_num==-1)
|
||||
last_multi_bitmap_num=N_ObjBitmapPtrs;
|
||||
|
||||
|
|
|
@ -345,9 +345,9 @@ void change_guidebot_name()
|
|||
{
|
||||
int item;
|
||||
auto text = PlayerCfg.GuidebotName;
|
||||
array<newmenu_item, 1> m{
|
||||
array<newmenu_item, 1> m{{
|
||||
nm_item_input(text),
|
||||
};
|
||||
}};
|
||||
item = newmenu_do(NULL, "Enter Guide-bot name:", m, unused_newmenu_subfunction, unused_newmenu_userdata );
|
||||
|
||||
if (item != -1) {
|
||||
|
|
|
@ -289,7 +289,7 @@ static window_event_result show_pause_message(window *wind,const d_event &event,
|
|||
|
||||
gr_get_string_size(msg,&w,&h,&aw);
|
||||
|
||||
y = (grd_curscreen->sc_h-h)/2;
|
||||
y = (grd_curscreen->get_screen_height() - h) / 2;
|
||||
|
||||
gr_set_fontcolor( 255, -1 );
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#define MOVIE_ABORTED 2 // movie started by was aborted
|
||||
|
||||
#ifdef OGL
|
||||
#define MOVIE_WIDTH (!GameArg.GfxSkipHiresMovie&&grd_curscreen->sc_w<640?640:grd_curscreen->sc_w)
|
||||
#define MOVIE_HEIGHT (!GameArg.GfxSkipHiresMovie&&grd_curscreen->sc_h<480?480:grd_curscreen->sc_h)
|
||||
#define MOVIE_WIDTH (!GameArg.GfxSkipHiresMovie && grd_curscreen->get_screen_width() < 640 ? 640: grd_curscreen->get_screen_width())
|
||||
#define MOVIE_HEIGHT (!GameArg.GfxSkipHiresMovie && grd_curscreen->get_screen_height() < 480 ? 480: grd_curscreen->get_screen_height())
|
||||
#else
|
||||
#define MOVIE_WIDTH (!GameArg.GfxSkipHiresMovie?640:320)
|
||||
#define MOVIE_HEIGHT (!GameArg.GfxSkipHiresMovie?480:200)
|
||||
|
|
|
@ -39,31 +39,18 @@ static int16_t init_model_sub(uint8_t *p, int16_t);
|
|||
int g3d_interp_outline;
|
||||
#endif
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(WORDS_BIGENDIAN)
|
||||
static inline int16_t *wp(uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<int16_t *>(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline const int16_t *wp(const uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<const int16_t *>(p);
|
||||
}
|
||||
|
||||
static inline fix *fp(uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<fix *>(p);
|
||||
}
|
||||
|
||||
static inline const fix *fp(const uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<const fix *>(p);
|
||||
}
|
||||
|
||||
static inline vms_vector *vp(uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<vms_vector *>(p);
|
||||
}
|
||||
|
||||
static inline const vms_vector *vp(const uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<const vms_vector *>(p);
|
||||
|
@ -563,6 +550,16 @@ static P iterate_polymodel(P p, State &state)
|
|||
}
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
static inline fix *fp(uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<fix *>(p);
|
||||
}
|
||||
|
||||
static inline vms_vector *vp(uint8_t *p)
|
||||
{
|
||||
return reinterpret_cast<vms_vector *>(p);
|
||||
}
|
||||
|
||||
static void short_swap(short *s)
|
||||
{
|
||||
*s = SWAPSHORT(*s);
|
||||
|
|
|
@ -80,8 +80,10 @@
|
|||
|
||||
using std::max;
|
||||
|
||||
static int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
|
||||
|
||||
#ifdef OGLES
|
||||
int sdl_video_flags = 0;
|
||||
static int sdl_video_flags;
|
||||
|
||||
#ifdef RPI
|
||||
static EGL_DISPMANX_WINDOW_T nativewindow;
|
||||
|
@ -90,24 +92,23 @@ static DISPMANX_DISPLAY_HANDLE_T dispman_display=DISPMANX_NO_HANDLE;
|
|||
#endif
|
||||
|
||||
#else
|
||||
ogl_sync sync_helper;
|
||||
int sdl_video_flags = SDL_OPENGL;
|
||||
static ogl_sync sync_helper;
|
||||
static int sdl_video_flags = SDL_OPENGL;
|
||||
#endif
|
||||
|
||||
int gr_installed = 0;
|
||||
int gl_initialized=0;
|
||||
static int gr_installed;
|
||||
static int gl_initialized;
|
||||
int linedotscale=1; // scalar of glLinewidth and glPointSize - only calculated once when resolution changes
|
||||
#ifdef RPI
|
||||
int sdl_no_modeswitch=0;
|
||||
static int sdl_no_modeswitch;
|
||||
#else
|
||||
enum { sdl_no_modeswitch = 0 };
|
||||
#endif
|
||||
|
||||
#ifdef OGLES
|
||||
EGLDisplay eglDisplay=EGL_NO_DISPLAY;
|
||||
EGLConfig eglConfig;
|
||||
EGLSurface eglSurface=EGL_NO_SURFACE;
|
||||
EGLContext eglContext=EGL_NO_CONTEXT;
|
||||
static EGLDisplay eglDisplay=EGL_NO_DISPLAY;
|
||||
static EGLConfig eglConfig;
|
||||
static EGLSurface eglSurface=EGL_NO_SURFACE;
|
||||
static EGLContext eglContext=EGL_NO_CONTEXT;
|
||||
|
||||
static bool TestEGLError(const char* pszLocation)
|
||||
{
|
||||
|
@ -304,7 +305,7 @@ static void ogles_destroy()
|
|||
}
|
||||
#endif
|
||||
|
||||
int ogl_init_window(int x, int y)
|
||||
static int ogl_init_window(int x, int y)
|
||||
{
|
||||
int use_x,use_y,use_bpp;
|
||||
Uint32 use_flags;
|
||||
|
@ -453,13 +454,9 @@ int gr_check_fullscreen(void)
|
|||
return (sdl_video_flags & SDL_FULLSCREEN)?1:0;
|
||||
}
|
||||
|
||||
int gr_toggle_fullscreen(void)
|
||||
void gr_toggle_fullscreen()
|
||||
{
|
||||
if (sdl_video_flags & SDL_FULLSCREEN)
|
||||
sdl_video_flags &= ~SDL_FULLSCREEN;
|
||||
else
|
||||
sdl_video_flags |= SDL_FULLSCREEN;
|
||||
|
||||
const auto sdl_video_flags = (::sdl_video_flags ^= SDL_FULLSCREEN);
|
||||
if (gl_initialized)
|
||||
{
|
||||
if (sdl_no_modeswitch == 0) {
|
||||
|
@ -498,8 +495,7 @@ int gr_toggle_fullscreen(void)
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
ogl_smash_texture_list_internal();//if we are or were fullscreen, changing vid mode will invalidate current textures
|
||||
}
|
||||
GameCfg.WindowMode = (sdl_video_flags & SDL_FULLSCREEN)?0:1;
|
||||
return (sdl_video_flags & SDL_FULLSCREEN)?1:0;
|
||||
GameCfg.WindowMode = !(sdl_video_flags & SDL_FULLSCREEN);
|
||||
}
|
||||
|
||||
static void ogl_init_state(void)
|
||||
|
@ -521,26 +517,15 @@ static void ogl_init_state(void)
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gr_palette_step_up(0,0,0);//in case its left over from in game
|
||||
|
||||
ogl_init_pixel_buffers(grd_curscreen->sc_w, grd_curscreen->sc_h);
|
||||
ogl_init_pixel_buffers(grd_curscreen->get_screen_width(), grd_curscreen->get_screen_height());
|
||||
}
|
||||
|
||||
// Set the buffer to draw to. 0 is front, 1 is back
|
||||
void gr_set_draw_buffer(int buf)
|
||||
{
|
||||
#ifndef OGLES
|
||||
glDrawBuffer((buf == 0) ? GL_FRONT : GL_BACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *gl_vendor, *gl_renderer, *gl_version, *gl_extensions;
|
||||
|
||||
static void ogl_get_verinfo(void)
|
||||
{
|
||||
#ifndef OGLES
|
||||
gl_vendor = (const char *) glGetString (GL_VENDOR);
|
||||
gl_renderer = (const char *) glGetString (GL_RENDERER);
|
||||
gl_version = (const char *) glGetString (GL_VERSION);
|
||||
gl_extensions = (const char *) glGetString (GL_EXTENSIONS);
|
||||
const auto gl_vendor = reinterpret_cast<const char *>(glGetString(GL_VENDOR));
|
||||
const auto gl_renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
|
||||
const auto gl_version = reinterpret_cast<const char *>(glGetString(GL_VERSION));
|
||||
|
||||
con_printf(CON_VERBOSE, "OpenGL: vendor: %s\nOpenGL: renderer: %s\nOpenGL: version: %s",gl_vendor,gl_renderer,gl_version);
|
||||
|
||||
|
@ -573,6 +558,7 @@ static void ogl_get_verinfo(void)
|
|||
#ifndef NDEBUG
|
||||
con_printf(CON_VERBOSE,"gl_intensity4:%i gl_luminance4_alpha4:%i gl_rgba2:%i gl_readpixels:%i gl_gettexlevelparam:%i",GameArg.DbgGlIntensity4Ok,GameArg.DbgGlLuminance4Alpha4Ok,GameArg.DbgGlRGBA2Ok,GameArg.DbgGlReadPixelsOk,GameArg.DbgGlGetTexLevelParamOk);
|
||||
#endif
|
||||
const auto gl_extensions = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
|
||||
if (!d_stricmp(gl_extensions,"GL_EXT_texture_filter_anisotropic")==0)
|
||||
{
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &ogl_maxanisotropy);
|
||||
|
@ -625,13 +611,11 @@ int gr_list_modes( array<uint32_t, 50> &gsmodes )
|
|||
}
|
||||
}
|
||||
|
||||
int gr_check_mode(u_int32_t mode)
|
||||
static int gr_check_mode(uint32_t mode)
|
||||
{
|
||||
unsigned int w, h;
|
||||
|
||||
w=SM_W(mode);
|
||||
h=SM_H(mode);
|
||||
|
||||
if (sdl_no_modeswitch == 0) {
|
||||
return SDL_VideoModeOK(w, h, GameArg.DbgBpp, sdl_video_flags);
|
||||
} else {
|
||||
|
@ -664,10 +648,8 @@ int gr_set_mode(u_int32_t mode)
|
|||
if (!gr_new_bm_data)
|
||||
return 0;
|
||||
*grd_curscreen = {};
|
||||
grd_curscreen->sc_mode = mode;
|
||||
grd_curscreen->sc_w = w;
|
||||
grd_curscreen->sc_h = h;
|
||||
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*GameCfg.AspectX,grd_curscreen->sc_h*GameCfg.AspectY);
|
||||
grd_curscreen->set_screen_width_height(w, h);
|
||||
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->get_screen_width() * GameCfg.AspectX, grd_curscreen->get_screen_height() * GameCfg.AspectY);
|
||||
gr_init_canvas(grd_curscreen->sc_canvas, gr_new_bm_data, BM_OGL, w, h);
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
|
@ -746,11 +728,6 @@ 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!
|
||||
|
@ -763,8 +740,9 @@ int gr_init(int mode)
|
|||
bcm_host_init();
|
||||
|
||||
// Check if we are running with SDL directfb driver ...
|
||||
sdl_driver_ret=SDL_VideoDriverName(sdl_driver,32);
|
||||
if (sdl_driver_ret) {
|
||||
char sdl_driver[32];
|
||||
if (auto sdl_driver_ret = SDL_VideoDriverName(sdl_driver, sizeof(sdl_driver)))
|
||||
{
|
||||
if (strcmp(sdl_driver_ret,"x11")) {
|
||||
con_printf(CON_URGENT,"RPi: activating hack for console driver");
|
||||
sdl_no_modeswitch=1;
|
||||
|
@ -967,8 +945,8 @@ void ogl_ulinec(int left,int top,int right,int bot,int c)
|
|||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
GLfloat last_r=0, last_g=0, last_b=0;
|
||||
int do_pal_step=0;
|
||||
static GLfloat last_r, last_g, last_b;
|
||||
static int do_pal_step;
|
||||
|
||||
void ogl_do_palfx(void)
|
||||
{
|
||||
|
@ -997,9 +975,8 @@ void ogl_do_palfx(void)
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
int ogl_brightness_ok = 0;
|
||||
int ogl_brightness_r = 0, ogl_brightness_g = 0, ogl_brightness_b = 0;
|
||||
static int old_b_r = 0, old_b_g = 0, old_b_b = 0;
|
||||
static int ogl_brightness_ok;
|
||||
static int old_b_r, old_b_g, old_b_b;
|
||||
|
||||
void gr_palette_step_up(int r, int g, int b)
|
||||
{
|
||||
|
@ -1129,7 +1106,7 @@ void save_screen_shot(int automap_flag)
|
|||
glReadBuffer(GL_FRONT);
|
||||
#endif
|
||||
|
||||
write_bmp(savename,grd_curscreen->sc_w,grd_curscreen->sc_h);
|
||||
write_bmp(savename, grd_curscreen->get_screen_width(), grd_curscreen->get_screen_height());
|
||||
|
||||
start_time();
|
||||
}
|
||||
|
|
|
@ -1199,7 +1199,7 @@ void ogl_start_frame(void){
|
|||
}
|
||||
|
||||
void ogl_end_frame(void){
|
||||
OGL_VIEWPORT(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h);
|
||||
OGL_VIEWPORT(0, 0, grd_curscreen->get_screen_width(), grd_curscreen->get_screen_height());
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();//clear matrix
|
||||
#ifdef OGLES
|
||||
|
@ -1251,7 +1251,8 @@ void ogl_close_pixel_buffers(void)
|
|||
|
||||
static void ogl_filltexbuf(const uint8_t *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)
|
||||
{
|
||||
if ((width > max(static_cast<unsigned>(grd_curscreen->sc_w), 1024u)) || (height > max(static_cast<unsigned>(grd_curscreen->sc_h), 256u)))
|
||||
if ((width > max(static_cast<unsigned>(grd_curscreen->get_screen_width()), 1024u)) ||
|
||||
(height > max(static_cast<unsigned>(grd_curscreen->get_screen_height()), 256u)))
|
||||
Error("Texture is too big: %ix%i", width, height);
|
||||
|
||||
for (unsigned y=0;y<theight;y++)
|
||||
|
|
|
@ -179,6 +179,8 @@ int digi_mixer_start_sound(short soundnum, fix volume, int pan, int looping, int
|
|||
if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"digi_start_sound %d, volume %d, pan %d (start=%d, end=%d)", soundnum, mix_vol, mix_pan, loop_start, loop_end);
|
||||
|
||||
channel = digi_mixer_find_channel();
|
||||
if (channel < 0)
|
||||
return -1;
|
||||
|
||||
Mix_PlayChannel(channel, &(SoundChunks[soundnum]), mix_loop);
|
||||
Mix_SetPanning(channel, 255-mix_pan, mix_pan);
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
|
||||
#include "compiler-make_unique.h"
|
||||
|
||||
int sdl_video_flags = SDL_SWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF;
|
||||
static int sdl_video_flags = SDL_SWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF;
|
||||
SDL_Surface *screen,*canvas;
|
||||
int gr_installed = 0;
|
||||
static int gr_installed;
|
||||
|
||||
void gr_flip()
|
||||
{
|
||||
|
@ -44,13 +44,6 @@ void gr_flip()
|
|||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
// Set the buffer to draw to. 0 is front, 1 is back
|
||||
// With SDL, can't use it without resetting the video mode
|
||||
void gr_set_draw_buffer(int buf)
|
||||
{
|
||||
buf = buf;
|
||||
}
|
||||
|
||||
// returns possible (fullscreen) resolutions if any.
|
||||
int gr_list_modes( array<uint32_t, 50> &gsmodes )
|
||||
{
|
||||
|
@ -86,16 +79,6 @@ int gr_list_modes( array<uint32_t, 50> &gsmodes )
|
|||
}
|
||||
}
|
||||
|
||||
int gr_check_mode(u_int32_t mode)
|
||||
{
|
||||
unsigned int w, h;
|
||||
|
||||
w=SM_W(mode);
|
||||
h=SM_H(mode);
|
||||
|
||||
return SDL_VideoModeOK(w,h,GameArg.DbgBpp,sdl_video_flags);
|
||||
}
|
||||
|
||||
int gr_set_mode(u_int32_t mode)
|
||||
{
|
||||
unsigned int w, h;
|
||||
|
@ -110,6 +93,7 @@ int gr_set_mode(u_int32_t mode)
|
|||
SDL_WM_SetCaption(DESCENT_VERSION, DXX_SDL_WINDOW_CAPTION);
|
||||
SDL_WM_SetIcon( SDL_LoadBMP( DXX_SDL_WINDOW_ICON_BITMAP ), NULL );
|
||||
|
||||
const auto sdl_video_flags = ::sdl_video_flags;
|
||||
if(SDL_VideoModeOK(w,h,GameArg.DbgBpp,sdl_video_flags))
|
||||
{
|
||||
screen=SDL_SetVideoMode(w, h, GameArg.DbgBpp, sdl_video_flags);
|
||||
|
@ -137,10 +121,8 @@ int gr_set_mode(u_int32_t mode)
|
|||
}
|
||||
|
||||
*grd_curscreen = {};
|
||||
grd_curscreen->sc_mode = mode;
|
||||
grd_curscreen->sc_w = w;
|
||||
grd_curscreen->sc_h = h;
|
||||
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*GameCfg.AspectX,grd_curscreen->sc_h*GameCfg.AspectY);
|
||||
grd_curscreen->set_screen_width_height(w, h);
|
||||
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->get_screen_width() * GameCfg.AspectX, grd_curscreen->get_screen_height() * GameCfg.AspectY);
|
||||
gr_init_canvas(grd_curscreen->sc_canvas, reinterpret_cast<unsigned char *>(canvas->pixels), BM_LINEAR, w, h);
|
||||
window_update_canvases();
|
||||
gr_set_current_canvas(NULL);
|
||||
|
@ -159,14 +141,14 @@ int gr_check_fullscreen(void)
|
|||
return (sdl_video_flags & SDL_FULLSCREEN)?1:0;
|
||||
}
|
||||
|
||||
int gr_toggle_fullscreen(void)
|
||||
void gr_toggle_fullscreen()
|
||||
{
|
||||
const auto sdl_video_flags = (::sdl_video_flags ^= SDL_FULLSCREEN);
|
||||
const int WindowMode = !(sdl_video_flags & SDL_FULLSCREEN);
|
||||
gr_remap_color_fonts();
|
||||
gr_remap_mono_fonts();
|
||||
sdl_video_flags^=SDL_FULLSCREEN;
|
||||
SDL_WM_ToggleFullScreen(screen);
|
||||
GameCfg.WindowMode = (sdl_video_flags & SDL_FULLSCREEN)?0:1;
|
||||
return (sdl_video_flags & SDL_FULLSCREEN)?1:0;
|
||||
GameCfg.WindowMode = WindowMode;
|
||||
}
|
||||
|
||||
void gr_set_attributes(void)
|
||||
|
|
|
@ -105,7 +105,13 @@ void jukebox_unload()
|
|||
JukeboxSongs.unload();
|
||||
}
|
||||
|
||||
const array<file_extension_t, 6> jukebox_exts{SONG_EXT_HMP, SONG_EXT_MID, SONG_EXT_OGG, SONG_EXT_FLAC, SONG_EXT_MP3};
|
||||
const array<file_extension_t, 5> jukebox_exts{{
|
||||
SONG_EXT_HMP,
|
||||
SONG_EXT_MID,
|
||||
SONG_EXT_OGG,
|
||||
SONG_EXT_FLAC,
|
||||
SONG_EXT_MP3
|
||||
}};
|
||||
|
||||
static int read_m3u(void)
|
||||
{
|
||||
|
|
|
@ -241,6 +241,8 @@ vms_vector Believed_player_pos;
|
|||
#define AIE_MAX 4
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if PARALLAX
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
// Index into this array with ailp->mode
|
||||
static const char mode_text[][16] = {
|
||||
"STILL",
|
||||
|
@ -248,25 +250,9 @@ static const char mode_text[][16] = {
|
|||
"FOL_PATH",
|
||||
"CHASE_OBJ",
|
||||
"RUN_FROM",
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
"HIDE",
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
"BEHIND",
|
||||
#endif
|
||||
"FOL_PATH2",
|
||||
"OPEN_DOOR",
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
"GOTO_PLR",
|
||||
"GOTO_OBJ",
|
||||
"SN_ATT",
|
||||
"SN_FIRE",
|
||||
"SN_RETR",
|
||||
"SN_RTBK",
|
||||
"SN_WAIT",
|
||||
"TH_ATTACK",
|
||||
"TH_RETREAT",
|
||||
"TH_WAIT",
|
||||
#endif
|
||||
};
|
||||
|
||||
// Index into this array with aip->behavior
|
||||
|
@ -278,20 +264,8 @@ static const char behavior_text[6][9] = {
|
|||
"FOLPATH ",
|
||||
"STATION "
|
||||
};
|
||||
|
||||
// Index into this array with aip->GOAL_STATE or aip->CURRENT_STATE
|
||||
static const char state_text[8][5] = {
|
||||
"NONE",
|
||||
"REST",
|
||||
"SRCH",
|
||||
"LOCK",
|
||||
"FLIN",
|
||||
"FIRE",
|
||||
"RECO",
|
||||
"ERR_",
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Current state indicates where the robot current is, or has just done.
|
||||
|
@ -3919,7 +3893,8 @@ _exit_cheat:
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// If new state = fire, then set all gun states to fire.
|
||||
if ((aip->GOAL_STATE == AIS_FIRE) ) {
|
||||
if (aip->GOAL_STATE == AIS_FIRE)
|
||||
{
|
||||
uint_fast32_t num_guns = robptr->n_guns;
|
||||
for (uint_fast32_t i=0; i<num_guns; i++)
|
||||
ailp->goal_state[i] = AIS_FIRE;
|
||||
|
|
|
@ -1128,7 +1128,7 @@ void ai_follow_path(const vobjptridx_t objp, int player_visibility, const vms_ve
|
|||
ailp->mode = AIM_STILL;
|
||||
}
|
||||
return;
|
||||
} else if ((ailp->mode == AIM_FOLLOW_PATH)
|
||||
} else if (ailp->mode == AIM_FOLLOW_PATH
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
&& (aip->behavior != AIB_FOLLOW_PATH)
|
||||
#endif
|
||||
|
@ -1251,9 +1251,9 @@ void ai_path_set_orient_and_vel(const vobjptr_t objp, const vms_vector &goal_poi
|
|||
// If evading player, use highest difficulty level speed, plus something based on diff level
|
||||
max_speed = robptr->max_speed[Difficulty_level];
|
||||
ai_local *ailp = &objp->ctype.ai_info.ail;
|
||||
if ((ailp->mode == AIM_RUN_FROM_OBJECT)
|
||||
if (ailp->mode == AIM_RUN_FROM_OBJECT
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
|| (objp->ctype.ai_info.behavior == AIB_SNIPE)
|
||||
|| objp->ctype.ai_info.behavior == AIB_SNIPE
|
||||
#endif
|
||||
)
|
||||
max_speed = max_speed*3/2;
|
||||
|
@ -1294,9 +1294,9 @@ void ai_path_set_orient_and_vel(const vobjptr_t objp, const vms_vector &goal_poi
|
|||
vm_vec_scale(norm_cur_vel, speed_scale);
|
||||
objp->mtype.phys_info.velocity = norm_cur_vel;
|
||||
|
||||
if ((ailp->mode == AIM_RUN_FROM_OBJECT)
|
||||
if (ailp->mode == AIM_RUN_FROM_OBJECT
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
|| (robot_is_companion(robptr) == 1) || (objp->ctype.ai_info.behavior == AIB_SNIPE)
|
||||
|| robot_is_companion(robptr) == 1 || objp->ctype.ai_info.behavior == AIB_SNIPE
|
||||
#endif
|
||||
) {
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
|
@ -1442,9 +1442,9 @@ void attempt_to_resume_path(const vobjptridx_t objp)
|
|||
ai_static *aip = &objp->ctype.ai_info;
|
||||
int new_path_index;
|
||||
|
||||
if ((aip->behavior == AIB_STATION)
|
||||
if (aip->behavior == AIB_STATION
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
&& (Robot_info[get_robot_id(objp)].companion != 1)
|
||||
&& Robot_info[get_robot_id(objp)].companion != 1
|
||||
#endif
|
||||
)
|
||||
if (d_rand() > 8192) {
|
||||
|
|
|
@ -114,7 +114,7 @@ int ReadConfigFile()
|
|||
#endif
|
||||
GameCfg.GammaLevel = 0;
|
||||
GameCfg.LastPlayer.fill(0);
|
||||
memset(GameCfg.LastMission,0,MISSION_NAME_LEN+1);
|
||||
GameCfg.LastMission = "";
|
||||
GameCfg.ResolutionX = 640;
|
||||
GameCfg.ResolutionY = 480;
|
||||
GameCfg.AspectX = 3;
|
||||
|
@ -247,7 +247,7 @@ int WriteConfigFile()
|
|||
PHYSFSX_printf(infile, "%s=%s\n", CMMiscMusic4Str, GameCfg.CMMiscMusic[SONG_CREDITS].data());
|
||||
PHYSFSX_printf(infile, "%s=%d\n", GammaLevelStr, GameCfg.GammaLevel);
|
||||
PHYSFSX_printf(infile, "%s=%s\n", LastPlayerStr, static_cast<const char *>(Players[Player_num].callsign));
|
||||
PHYSFSX_printf(infile, "%s=%s\n", LastMissionStr, GameCfg.LastMission);
|
||||
PHYSFSX_printf(infile, "%s=%s\n", LastMissionStr, static_cast<const char *>(GameCfg.LastMission));
|
||||
PHYSFSX_printf(infile, "%s=%i\n", ResolutionXStr, SM_W(Game_screen_mode));
|
||||
PHYSFSX_printf(infile, "%s=%i\n", ResolutionYStr, SM_H(Game_screen_mode));
|
||||
PHYSFSX_printf(infile, "%s=%i\n", AspectXStr, GameCfg.AspectX);
|
||||
|
|
|
@ -68,10 +68,15 @@ void read_flying_controls(const vobjptr_t obj)
|
|||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if ((obj->type!=OBJ_PLAYER) || (obj->id!=Player_num)) return; //references to player_ship require that this obj be the player
|
||||
|
||||
if (Guided_missile[Player_num] && Guided_missile[Player_num]->signature==Guided_missile_sig[Player_num]) {
|
||||
const auto control_guided_missile = [&] {
|
||||
const auto m = Guided_missile[Player_num];
|
||||
if (!m)
|
||||
return false;
|
||||
if (m->type != OBJ_WEAPON)
|
||||
return false;
|
||||
if (m->signature != Guided_missile_sig[Player_num])
|
||||
return false;
|
||||
vms_angvec rotangs;
|
||||
fix speed;
|
||||
|
||||
//this is a horrible hack. guided missile stuff should not be
|
||||
//handled in the middle of a routine that is dealing with the player
|
||||
|
||||
|
@ -82,16 +87,16 @@ void read_flying_controls(const vobjptr_t obj)
|
|||
rotangs.h = Controls.heading_time / 2 + Seismic_tremor_magnitude/64;
|
||||
|
||||
const auto &&rotmat = vm_angles_2_matrix(rotangs);
|
||||
Guided_missile[Player_num]->orient = vm_matrix_x_matrix(Guided_missile[Player_num]->orient, rotmat);
|
||||
m->orient = vm_matrix_x_matrix(m->orient, rotmat);
|
||||
|
||||
speed = Weapon_info[Guided_missile[Player_num]->id].speed[Difficulty_level];
|
||||
const auto speed = Weapon_info[get_weapon_id(m)].speed[Difficulty_level];
|
||||
|
||||
vm_vec_copy_scale(Guided_missile[Player_num]->mtype.phys_info.velocity,Guided_missile[Player_num]->orient.fvec,speed);
|
||||
vm_vec_copy_scale(m->mtype.phys_info.velocity, m->orient.fvec, speed);
|
||||
if (Game_mode & GM_MULTI)
|
||||
multi_send_guided_info (Guided_missile[Player_num],0);
|
||||
|
||||
}
|
||||
else
|
||||
multi_send_guided_info(m, 0);
|
||||
return true;
|
||||
};
|
||||
if (!control_guided_missile())
|
||||
#endif
|
||||
{
|
||||
obj->mtype.phys_info.rotthrust.x = Controls.pitch_time;
|
||||
|
|
|
@ -78,7 +78,7 @@ struct sound_object
|
|||
} pos;
|
||||
struct {
|
||||
objnum_t objnum; // Used if SOF_LINK_TO_OBJ field is used
|
||||
short objsignature;
|
||||
object_signature_t objsignature;
|
||||
} obj;
|
||||
} link_type;
|
||||
};
|
||||
|
@ -559,14 +559,12 @@ void digi_sync_sounds()
|
|||
&s.volume, &s.pan, s.max_distance );
|
||||
|
||||
} else if ( s.flags & SOF_LINK_TO_OBJ ) {
|
||||
object * objp;
|
||||
|
||||
|
||||
const object * objp;
|
||||
if ( Newdemo_state == ND_STATE_PLAYBACK ) {
|
||||
int objnum;
|
||||
objnum = newdemo_find_object( s.link_type.obj.objsignature );
|
||||
if ( objnum > -1 ) {
|
||||
objp = &Objects[objnum];
|
||||
auto objnum = newdemo_find_object(s.link_type.obj.objsignature);
|
||||
if (objnum != object_none)
|
||||
{
|
||||
objp = objnum;
|
||||
} else {
|
||||
objp = &Objects[0];
|
||||
}
|
||||
|
|
|
@ -72,6 +72,27 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
static void dump_used_textures_level(PHYSFS_file *my_file, int level_num);
|
||||
static void say_totals(PHYSFS_file *my_file, const char *level_name);
|
||||
|
||||
const array<char[9], MAX_OBJECT_TYPES> Object_type_names{{
|
||||
"WALL ",
|
||||
"FIREBALL",
|
||||
"ROBOT ",
|
||||
"HOSTAGE ",
|
||||
"PLAYER ",
|
||||
"WEAPON ",
|
||||
"CAMERA ",
|
||||
"POWERUP ",
|
||||
"DEBRIS ",
|
||||
"CNTRLCEN",
|
||||
"FLARE ",
|
||||
"CLUTTER ",
|
||||
"GHOST ",
|
||||
"LIGHT ",
|
||||
"COOP ",
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
"MARKER ",
|
||||
#endif
|
||||
}};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static const char *object_types(int objnum)
|
||||
{
|
||||
|
|
|
@ -142,11 +142,6 @@ static const char movie_table[] = { 'a','b','c',
|
|||
'm','o','m','o',
|
||||
'p','q','p','q'
|
||||
};
|
||||
|
||||
#define N_MOVIES (sizeof(movie_table) / sizeof(*movie_table))
|
||||
|
||||
static const char movie_table_secret[] = {'a','d','g','j','m','p'};
|
||||
#define N_MOVIES_SECRET (sizeof(movie_table_secret) / sizeof(*movie_table_secret))
|
||||
static int endlevel_movie_played = MOVIE_NOT_PLAYED;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ void game_init_render_sub_buffers( int x, int y, int w, int h )
|
|||
//mode if cannot init requested mode)
|
||||
int set_screen_mode(int sm)
|
||||
{
|
||||
if ( (Screen_mode == sm) && !((sm==SCREEN_GAME) && (grd_curscreen->sc_mode != Game_screen_mode)) && !(sm==SCREEN_MENU) )
|
||||
if ( (Screen_mode == sm) && !((sm==SCREEN_GAME) && (grd_curscreen->get_screen_width_height() != Game_screen_mode)) && !(sm==SCREEN_MENU) )
|
||||
{
|
||||
gr_set_current_canvas(NULL);
|
||||
return 1;
|
||||
|
@ -287,19 +287,19 @@ int set_screen_mode(int sm)
|
|||
switch( Screen_mode )
|
||||
{
|
||||
case SCREEN_MENU:
|
||||
if (grd_curscreen->sc_mode != Game_screen_mode)
|
||||
if (grd_curscreen->get_screen_width_height() != Game_screen_mode)
|
||||
if (gr_set_mode(Game_screen_mode))
|
||||
Error("Cannot set screen mode.");
|
||||
break;
|
||||
|
||||
case SCREEN_GAME:
|
||||
if (grd_curscreen->sc_mode != Game_screen_mode)
|
||||
if (grd_curscreen->get_screen_width_height() != Game_screen_mode)
|
||||
if (gr_set_mode(Game_screen_mode))
|
||||
Error("Cannot set screen mode.");
|
||||
break;
|
||||
#ifdef EDITOR
|
||||
case SCREEN_EDITOR:
|
||||
if (grd_curscreen->sc_mode != SM(800,600)) {
|
||||
if (grd_curscreen->get_screen_width_height() != SM(800,600)) {
|
||||
int gr_error;
|
||||
if ((gr_error=gr_set_mode(SM(800,600)))!=0) { //force into game scrren
|
||||
Warning("Cannot init editor screen (error=%d)",gr_error);
|
||||
|
@ -310,7 +310,7 @@ int set_screen_mode(int sm)
|
|||
#endif
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
case SCREEN_MOVIE:
|
||||
if (grd_curscreen->sc_mode != SM(MOVIE_WIDTH,MOVIE_HEIGHT)) {
|
||||
if (grd_curscreen->get_screen_width_height() != SM(MOVIE_WIDTH,MOVIE_HEIGHT)) {
|
||||
if (gr_set_mode(SM(MOVIE_WIDTH,MOVIE_HEIGHT))) Error("Cannot set screen mode for game!");
|
||||
gr_palette_load( gr_palette );
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ void close_game()
|
|||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
object *Missile_viewer=NULL;
|
||||
int Missile_viewer_sig=-1;
|
||||
object_signature_t Missile_viewer_sig;
|
||||
|
||||
int Marker_viewer_num[2]={-1,-1};
|
||||
int Coop_view_player[2]={-1,-1};
|
||||
|
|
|
@ -525,20 +525,20 @@ static int HandleDemoKey(int key)
|
|||
case KEY_DEBUGGED + KEY_K: {
|
||||
int how_many, c;
|
||||
char filename[FILENAME_LEN], num[16];
|
||||
array<newmenu_item, 2> m{
|
||||
array<newmenu_item, 2> m{{
|
||||
nm_item_text("output file name"),
|
||||
nm_item_input(filename),
|
||||
};
|
||||
}};
|
||||
filename[0] = '\0';
|
||||
c = newmenu_do( NULL, NULL, m, unused_newmenu_subfunction, unused_newmenu_userdata);
|
||||
if (c == -2)
|
||||
break;
|
||||
strcat(filename, DEMO_EXT);
|
||||
num[0] = '\0';
|
||||
m = {
|
||||
m = {{
|
||||
nm_item_text("strip how many bytes"),
|
||||
nm_item_input(num),
|
||||
};
|
||||
}};
|
||||
c = newmenu_do( NULL, NULL, m, unused_newmenu_subfunction, unused_newmenu_userdata);
|
||||
if (c == -2)
|
||||
break;
|
||||
|
@ -1333,9 +1333,9 @@ static window_event_result HandleTestKey(int key)
|
|||
case KEY_DEBUGGED+KEY_B: {
|
||||
d_fname text{};
|
||||
int item;
|
||||
array<newmenu_item, 1> m{
|
||||
array<newmenu_item, 1> m{{
|
||||
nm_item_input(text),
|
||||
};
|
||||
}};
|
||||
item = newmenu_do( NULL, "Briefing to play?", m, unused_newmenu_subfunction, unused_newmenu_userdata);
|
||||
if (item != -1) {
|
||||
do_briefing_screens(text,1);
|
||||
|
@ -1595,9 +1595,9 @@ static window_event_result FinalCheats()
|
|||
char text[10]="";
|
||||
int new_level_num;
|
||||
int item;
|
||||
array<newmenu_item, 1> m{
|
||||
array<newmenu_item, 1> m{{
|
||||
nm_item_input(text),
|
||||
};
|
||||
}};
|
||||
item = newmenu_do( NULL, TXT_WARP_TO_LEVEL, m, unused_newmenu_subfunction, unused_newmenu_userdata);
|
||||
if (item != -1) {
|
||||
new_level_num = atoi(m[0].text);
|
||||
|
|
|
@ -468,7 +468,7 @@ static void read_object(const vobjptr_t obj,PHYSFS_file *f,int version)
|
|||
|
||||
obj->ctype.laser_info.parent_type = PHYSFSX_readShort(f);
|
||||
obj->ctype.laser_info.parent_num = PHYSFSX_readShort(f);
|
||||
obj->ctype.laser_info.parent_signature = PHYSFSX_readInt(f);
|
||||
obj->ctype.laser_info.parent_signature = object_signature_t{static_cast<uint16_t>(PHYSFSX_readInt(f))};
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
obj->ctype.laser_info.last_afterburner_time = 0;
|
||||
#endif
|
||||
|
@ -710,7 +710,7 @@ static void write_object(const vcobjptr_t obj, short version, PHYSFS_file *f)
|
|||
|
||||
PHYSFS_writeSLE16(f, obj->ctype.laser_info.parent_type);
|
||||
PHYSFS_writeSLE16(f, obj->ctype.laser_info.parent_num);
|
||||
PHYSFS_writeSLE32(f, obj->ctype.laser_info.parent_signature);
|
||||
PHYSFS_writeSLE32(f, obj->ctype.laser_info.parent_signature.get());
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1409,13 +1409,11 @@ int load_level(const char * filename_passed)
|
|||
#ifdef EDITOR
|
||||
int get_level_name()
|
||||
{
|
||||
array<newmenu_item, 2> m{
|
||||
array<newmenu_item, 2> m{{
|
||||
nm_item_text("Please enter a name for this mine:"),
|
||||
nm_item_input(Current_level_name.next()),
|
||||
};
|
||||
|
||||
}};
|
||||
return newmenu_do( NULL, "Enter mine name", m, unused_newmenu_subfunction, unused_newmenu_userdata ) >= 0;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -976,11 +976,12 @@ void create_shortpos(shortpos *spp, const vcobjptr_t objp, int swap_bytes)
|
|||
*sp++ = convert_to_byte(objp->orient.uvec.z);
|
||||
*sp++ = convert_to_byte(objp->orient.fvec.z);
|
||||
|
||||
spp->xo = (objp->pos.x - Vertices[Segments[objp->segnum].verts[0]].x) >> RELPOS_PRECISION;
|
||||
spp->yo = (objp->pos.y - Vertices[Segments[objp->segnum].verts[0]].y) >> RELPOS_PRECISION;
|
||||
spp->zo = (objp->pos.z - Vertices[Segments[objp->segnum].verts[0]].z) >> RELPOS_PRECISION;
|
||||
|
||||
spp->segment = objp->segnum;
|
||||
const auto segp = vsegptr(objp->segnum);
|
||||
const auto &vert = Vertices[segp->verts[0]];
|
||||
spp->xo = (objp->pos.x - vert.x) >> RELPOS_PRECISION;
|
||||
spp->yo = (objp->pos.y - vert.y) >> RELPOS_PRECISION;
|
||||
spp->zo = (objp->pos.z - vert.z) >> RELPOS_PRECISION;
|
||||
|
||||
spp->velx = (objp->mtype.phys_info.velocity.x) >> VEL_PRECISION;
|
||||
spp->vely = (objp->mtype.phys_info.velocity.y) >> VEL_PRECISION;
|
||||
|
|
|
@ -118,7 +118,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "custom.h"
|
||||
#define GLITZ_BACKGROUND Menu_pcx_name
|
||||
|
||||
static int AdvanceLevel(int secret_flag);
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
#include "movie.h"
|
||||
#define GLITZ_BACKGROUND STARS_BACKGROUND
|
||||
|
@ -127,8 +126,8 @@ static void StartNewLevelSecret(int level_num, int page_in_textures);
|
|||
static void InitPlayerPosition(int random_flag);
|
||||
static void DoEndGame(void);
|
||||
static void filter_objects_from_level();
|
||||
static void AdvanceLevel(int secret_flag);
|
||||
#endif
|
||||
static void AdvanceLevel(int secret_flag);
|
||||
static void StartLevel(int random_flag);
|
||||
static void copy_defaults_to_robot_all(void);
|
||||
|
||||
|
@ -393,8 +392,7 @@ void init_player_stats_new_ship(ubyte pnum)
|
|||
Afterburner_charge = 0;
|
||||
Controls.state.afterburner = 0;
|
||||
Last_afterburner_state = 0;
|
||||
Missile_viewer=NULL; //reset missile camera if out there
|
||||
Missile_viewer_sig=-1;
|
||||
Missile_viewer = nullptr; //reset missile camera if out there
|
||||
init_ai_for_ship();
|
||||
#endif
|
||||
}
|
||||
|
@ -958,9 +956,9 @@ static void do_screen_message(const char *msg)
|
|||
return;
|
||||
|
||||
gr_palette_load(gr_palette);
|
||||
array<newmenu_item, 1> nm_message_items{
|
||||
array<newmenu_item, 1> nm_message_items{{
|
||||
nm_item_menu(TXT_OK),
|
||||
};
|
||||
}};
|
||||
newmenu_do( NULL, msg, nm_message_items, draw_endlevel_background, static_cast<grs_bitmap *>(&background));
|
||||
gr_free_bitmap_data(background);
|
||||
}
|
||||
|
@ -1196,232 +1194,31 @@ void PlayerFinishedLevel(int secret_flag)
|
|||
//credit the player for hostages
|
||||
Players[Player_num].hostages_rescued_total += Players[Player_num].hostages_on_board;
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
int rval;
|
||||
int was_multi = 0;
|
||||
|
||||
if (!(Game_mode & GM_MULTI) && (secret_flag)) {
|
||||
array<newmenu_item, 1> m{
|
||||
array<newmenu_item, 1> m{{
|
||||
nm_item_text(" "), //TXT_SECRET_EXIT;
|
||||
};
|
||||
}};
|
||||
newmenu_do2(NULL, TXT_SECRET_EXIT, m.size(), m.data(), unused_newmenu_subfunction, unused_newmenu_userdata, 0, Menu_pcx_name);
|
||||
}
|
||||
|
||||
// -- mk mk mk -- used to be here -- mk mk mk --
|
||||
|
||||
if (Game_mode & GM_NETWORK)
|
||||
{
|
||||
if (secret_flag)
|
||||
Players[Player_num].connected = CONNECT_FOUND_SECRET; // Finished and went to secret level
|
||||
else
|
||||
Players[Player_num].connected = CONNECT_WAITING; // Finished but did not die
|
||||
}
|
||||
last_drawn_cockpit = -1;
|
||||
|
||||
if (Current_level_num == Last_level) {
|
||||
if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP))
|
||||
{
|
||||
was_multi = 1;
|
||||
multi_endlevel_score();
|
||||
rval = AdvanceLevel(secret_flag); //now go on to the next one (if one)
|
||||
}
|
||||
else
|
||||
{ // Note link to above else!
|
||||
rval = AdvanceLevel(secret_flag); //now go on to the next one (if one)
|
||||
DoEndLevelScoreGlitz(0); //give bonuses
|
||||
}
|
||||
} else {
|
||||
if (Game_mode & GM_MULTI)
|
||||
multi_endlevel_score();
|
||||
else
|
||||
DoEndLevelScoreGlitz(0); //give bonuses
|
||||
rval = AdvanceLevel(secret_flag); //now go on to the next one (if one)
|
||||
}
|
||||
|
||||
if (!was_multi && rval) {
|
||||
if (PLAYING_BUILTIN_MISSION)
|
||||
scores_maybe_add_player(0);
|
||||
if (Game_wind)
|
||||
window_close(Game_wind); // Exit out of game loop
|
||||
}
|
||||
else if (rval && Game_wind)
|
||||
window_close(Game_wind);
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
|
||||
Assert(!secret_flag);
|
||||
|
||||
#endif
|
||||
if (Game_mode & GM_NETWORK)
|
||||
Players[Player_num].connected = CONNECT_WAITING; // Finished but did not die
|
||||
|
||||
last_drawn_cockpit = -1;
|
||||
|
||||
AdvanceLevel(secret_flag); //now go on to the next one (if one)
|
||||
#endif
|
||||
if (Game_wind)
|
||||
window_set_visible(Game_wind, 1);
|
||||
reset_time();
|
||||
}
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
static int AdvanceLevel(int secret_flag)
|
||||
{
|
||||
Control_center_destroyed = 0;
|
||||
|
||||
#ifdef EDITOR
|
||||
if (Current_level_num == 0)
|
||||
{
|
||||
return 1; //not a real level
|
||||
}
|
||||
#endif
|
||||
|
||||
key_flush();
|
||||
|
||||
if (Game_mode & GM_MULTI)
|
||||
{
|
||||
int result;
|
||||
result = multi_endlevel(&secret_flag); // Wait for other players to reach this point
|
||||
if (result) // failed to sync
|
||||
{
|
||||
return (Current_level_num == Last_level);
|
||||
}
|
||||
}
|
||||
|
||||
key_flush();
|
||||
|
||||
if (Current_level_num == Last_level) { //player has finished the game!
|
||||
|
||||
if ((Newdemo_state == ND_STATE_RECORDING) || (Newdemo_state == ND_STATE_PAUSED))
|
||||
newdemo_stop_recording();
|
||||
|
||||
do_end_briefing_screens(Ending_text_filename);
|
||||
|
||||
return 1;
|
||||
|
||||
} else {
|
||||
|
||||
Next_level_num = Current_level_num+1; //assume go to next normal level
|
||||
|
||||
if (secret_flag) { //go to secret level instead
|
||||
int i;
|
||||
|
||||
for (i=0;i<-Last_secret_level;i++)
|
||||
if (Secret_level_table[i]==Current_level_num) {
|
||||
Next_level_num = -(i+1);
|
||||
break;
|
||||
}
|
||||
Assert(i<-Last_secret_level); //couldn't find which secret level
|
||||
}
|
||||
|
||||
if (Current_level_num < 0) { //on secret level, where to go?
|
||||
|
||||
Assert(!secret_flag); //shouldn't be going to secret level
|
||||
Assert(Current_level_num<=-1 && Current_level_num>=Last_secret_level);
|
||||
|
||||
Next_level_num = Secret_level_table[(-Current_level_num)-1]+1;
|
||||
}
|
||||
|
||||
StartNewLevel(Next_level_num);
|
||||
|
||||
}
|
||||
|
||||
key_flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//called when the player has died
|
||||
void DoPlayerDead()
|
||||
{
|
||||
if (Game_wind)
|
||||
window_set_visible(Game_wind, 0);
|
||||
|
||||
reset_palette_add();
|
||||
|
||||
gr_palette_load (gr_palette);
|
||||
|
||||
dead_player_end(); //terminate death sequence (if playing)
|
||||
|
||||
#ifdef EDITOR
|
||||
if (Game_mode == GM_EDITOR) { //test mine, not real level
|
||||
object * player = &Objects[Players[Player_num].objnum];
|
||||
//nm_messagebox( "You're Dead!", 1, "Continue", "Not a real game, though." );
|
||||
if (Game_wind)
|
||||
window_set_visible(Game_wind, 1);
|
||||
load_level("gamesave.lvl");
|
||||
init_player_stats_new_ship(Player_num);
|
||||
player->flags &= ~OF_SHOULD_BE_DEAD;
|
||||
StartLevel(0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( Game_mode&GM_MULTI )
|
||||
{
|
||||
multi_do_death(Players[Player_num].objnum);
|
||||
}
|
||||
else
|
||||
{ //Note link to above else!
|
||||
Players[Player_num].lives--;
|
||||
if (Players[Player_num].lives == 0)
|
||||
{
|
||||
DoGameOver();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Control_center_destroyed ) {
|
||||
|
||||
//clear out stuff so no bonus
|
||||
Players[Player_num].hostages_on_board = 0;
|
||||
Players[Player_num].energy = 0;
|
||||
Players[Player_num].shields = 0;
|
||||
Players[Player_num].connected = CONNECT_DIED_IN_MINE;
|
||||
|
||||
do_screen_message(TXT_DIED_IN_MINE); // Give them some indication of what happened
|
||||
|
||||
int rval;
|
||||
if (Current_level_num == Last_level) {
|
||||
if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP))
|
||||
{
|
||||
multi_endlevel_score();
|
||||
rval = AdvanceLevel(0); //if finished, go on to next level
|
||||
}
|
||||
else
|
||||
{ // Note link to above else!
|
||||
rval = AdvanceLevel(0); //if finished, go on to next level
|
||||
DoEndLevelScoreGlitz(0);
|
||||
}
|
||||
init_player_stats_new_ship(Player_num);
|
||||
last_drawn_cockpit = -1;
|
||||
} else {
|
||||
if (Game_mode & GM_MULTI)
|
||||
multi_endlevel_score();
|
||||
else
|
||||
DoEndLevelScoreGlitz(0); // Note above link!
|
||||
|
||||
rval = AdvanceLevel(0); //if finished, go on to next level
|
||||
init_player_stats_new_ship(Player_num);
|
||||
last_drawn_cockpit = -1;
|
||||
}
|
||||
|
||||
if (rval) {
|
||||
if (PLAYING_BUILTIN_MISSION)
|
||||
scores_maybe_add_player(0);
|
||||
if (Game_wind)
|
||||
window_close(Game_wind); // Exit out of game loop
|
||||
}
|
||||
} else {
|
||||
init_player_stats_new_ship(Player_num);
|
||||
StartLevel(1);
|
||||
}
|
||||
|
||||
if (Game_wind)
|
||||
window_set_visible(Game_wind, 1);
|
||||
reset_time();
|
||||
}
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
#define MOVIE_REQUIRED 1
|
||||
|
||||
#define ENDMOVIE "end"
|
||||
#endif
|
||||
|
||||
//called when the player has finished the last level
|
||||
static void DoEndGame(void)
|
||||
|
@ -1437,16 +1234,18 @@ static void DoEndGame(void)
|
|||
|
||||
if (PLAYING_BUILTIN_MISSION && !(Game_mode & GM_MULTI))
|
||||
{ //only built-in mission, & not multi
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
int played=MOVIE_NOT_PLAYED; //default is not played
|
||||
|
||||
played = PlayMovie(ENDMOVIE ".tex", ENDMOVIE,MOVIE_REQUIRED);
|
||||
if (!played)
|
||||
#endif
|
||||
{
|
||||
do_end_briefing_screens(Ending_text_filename);
|
||||
}
|
||||
}
|
||||
else if (!(Game_mode & GM_MULTI)) //not multi
|
||||
{
|
||||
}
|
||||
else if (!(Game_mode & GM_MULTI)) //not multi
|
||||
{
|
||||
char tname[FILENAME_LEN];
|
||||
|
||||
do_end_briefing_screens (Ending_text_filename);
|
||||
|
@ -1467,7 +1266,9 @@ static void DoEndGame(void)
|
|||
if (PLAYING_BUILTIN_MISSION && !((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP))) {
|
||||
gr_set_current_canvas( NULL );
|
||||
gr_clear_canvas(BM_XRGB(0,0,0));
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
load_palette(D2_DEFAULT_PALETTE,0,1);
|
||||
#endif
|
||||
scores_maybe_add_player(0);
|
||||
}
|
||||
|
||||
|
@ -1480,11 +1281,20 @@ static void DoEndGame(void)
|
|||
// Return true if game over.
|
||||
static void AdvanceLevel(int secret_flag)
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
Assert(!secret_flag);
|
||||
|
||||
#endif
|
||||
if (Current_level_num != Last_level) {
|
||||
if (Game_mode & GM_MULTI)
|
||||
multi_endlevel_score();
|
||||
{
|
||||
int result = multi_endlevel_score();
|
||||
if (!result)
|
||||
{
|
||||
if (Game_wind)
|
||||
window_close(Game_wind); // Exit out of game loop
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
// NOTE LINK TO ABOVE!!!
|
||||
DoEndLevelScoreGlitz(0); //give bonuses
|
||||
|
@ -1512,11 +1322,34 @@ static void AdvanceLevel(int secret_flag)
|
|||
}
|
||||
}
|
||||
|
||||
if (Current_level_num == Last_level) { //player has finished the game!
|
||||
if (Current_level_num == Last_level) { //player has finished the game!
|
||||
|
||||
DoEndGame();
|
||||
|
||||
} else {
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
Next_level_num = Current_level_num+1; //assume go to next normal level
|
||||
|
||||
if (secret_flag) { //go to secret level instead
|
||||
int i;
|
||||
|
||||
for (i=0;i<-Last_secret_level;i++)
|
||||
if (Secret_level_table[i]==Current_level_num) {
|
||||
Next_level_num = -(i+1);
|
||||
break;
|
||||
}
|
||||
Assert(i<-Last_secret_level); //couldn't find which secret level
|
||||
}
|
||||
|
||||
if (Current_level_num < 0) { //on secret level, where to go?
|
||||
|
||||
Assert(!secret_flag); //shouldn't be going to secret level
|
||||
Assert(Current_level_num<=-1 && Current_level_num>=Last_secret_level);
|
||||
|
||||
Next_level_num = Secret_level_table[(-Current_level_num)-1]+1;
|
||||
}
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
|
||||
//NMN 04/08/07 If we are in a secret level and playing a D1
|
||||
// level, then use Entered_from_level # instead
|
||||
if (Current_level_num < 0 && EMULATING_D1)
|
||||
|
@ -1526,9 +1359,8 @@ static void AdvanceLevel(int secret_flag)
|
|||
Next_level_num = Current_level_num+1; //assume go to next normal level
|
||||
}
|
||||
// END NMN
|
||||
|
||||
#endif
|
||||
StartNewLevel(Next_level_num);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1580,7 +1412,7 @@ void DoPlayerDead()
|
|||
Players[Player_num].connected = CONNECT_DIED_IN_MINE;
|
||||
|
||||
do_screen_message(TXT_DIED_IN_MINE); // Give them some indication of what happened
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if (Current_level_num < 0) {
|
||||
if (PHYSFSX_exists(SECRETB_FILENAME,0))
|
||||
{
|
||||
|
@ -1597,14 +1429,16 @@ void DoPlayerDead()
|
|||
init_player_stats_new_ship(Player_num); // New, MK, 05/29/96!, fix bug with dying in secret level, advance to next level, keep powerups!
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
AdvanceLevel(0); //if finished, go on to next level
|
||||
|
||||
init_player_stats_new_ship(Player_num);
|
||||
last_drawn_cockpit = -1;
|
||||
}
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
} else if (Current_level_num < 0) {
|
||||
if (PHYSFSX_exists(SECRETB_FILENAME,0))
|
||||
{
|
||||
|
@ -1624,6 +1458,7 @@ void DoPlayerDead()
|
|||
init_player_stats_new_ship(Player_num); // New, MK, 05/29/96!, fix bug with dying in secret level, advance to next level, keep powerups!
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
init_player_stats_new_ship(Player_num);
|
||||
StartLevel(1);
|
||||
|
@ -1635,7 +1470,6 @@ void DoPlayerDead()
|
|||
window_set_visible(Game_wind, 1);
|
||||
reset_time();
|
||||
}
|
||||
#endif
|
||||
|
||||
//called when the player is starting a new level for normal game mode and restore state
|
||||
// secret_flag set if came from a secret level
|
||||
|
@ -1647,7 +1481,7 @@ void StartNewLevelSub(int level_num, int page_in_textures, int secret_flag)
|
|||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
secret_flag = 0;
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
BigWindowSwitch=0;
|
||||
BigWindowSwitch=0;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -328,8 +328,8 @@ using std::min;
|
|||
#define BASE_WIDTH (HIRESMODE? 640 : 320)
|
||||
#define BASE_HEIGHT (HIRESMODE? 480 : 200)
|
||||
#ifdef OGL
|
||||
#define HUD_SCALE_X(x) static_cast<int>(static_cast<double>(x) * (static_cast<double>(grd_curscreen->sc_w)/BASE_WIDTH) + 0.5)
|
||||
#define HUD_SCALE_Y(y) static_cast<int>(static_cast<double>(y) * (static_cast<double>(grd_curscreen->sc_h)/BASE_HEIGHT) + 0.5)
|
||||
#define HUD_SCALE_X(x) static_cast<int>(static_cast<double>(x) * (static_cast<double>(grd_curscreen->get_screen_width()) / BASE_WIDTH) + 0.5)
|
||||
#define HUD_SCALE_Y(y) static_cast<int>(static_cast<double>(y) * (static_cast<double>(grd_curscreen->get_screen_height()) / BASE_HEIGHT) + 0.5)
|
||||
#define HUD_SCALE_X_AR(x) (HUD_SCALE_X(100) > HUD_SCALE_Y(100) ? HUD_SCALE_Y(x) : HUD_SCALE_X(x))
|
||||
#define HUD_SCALE_Y_AR(y) (HUD_SCALE_Y(100) > HUD_SCALE_X(100) ? HUD_SCALE_X(y) : HUD_SCALE_Y(y))
|
||||
#else
|
||||
|
@ -2000,13 +2000,13 @@ static void draw_numerical_display(int shield, int energy)
|
|||
// gr_get_string_size is used so we can get the numbers finally in the correct position with sw and ew
|
||||
gr_set_fontcolor(BM_XRGB(14,14,23),-1 );
|
||||
gr_get_string_size((shield>199)?"200":(shield>99)?"100":(shield>9)?"00":"0",&sw,&sh,&saw);
|
||||
gr_printf( (grd_curscreen->sc_w/1.951)-(sw/2),
|
||||
(grd_curscreen->sc_h/1.365),"%d",shield);
|
||||
gr_printf((grd_curscreen->get_screen_width() / 1.951) - (sw / 2),
|
||||
(grd_curscreen->get_screen_height() / 1.365), "%d", shield);
|
||||
|
||||
gr_set_fontcolor(BM_XRGB(25,18,6),-1 );
|
||||
gr_get_string_size((energy>199)?"200":(energy>99)?"100":(energy>9)?"00":"0",&ew,&eh,&eaw);
|
||||
gr_printf( (grd_curscreen->sc_w/1.951)-(ew/2),
|
||||
(grd_curscreen->sc_h/1.5),"%d",energy);
|
||||
gr_printf((grd_curscreen->get_screen_width() / 1.951) - (ew / 2),
|
||||
(grd_curscreen->get_screen_height() / 1.5), "%d", energy);
|
||||
|
||||
gr_set_current_canvas( NULL );
|
||||
}
|
||||
|
@ -2371,7 +2371,7 @@ static void sb_draw_energy_bar(int energy)
|
|||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
unsigned y = SB_ENERGY_GAUGE_Y + SB_ENERGY_GAUGE_H - GAME_FONT->ft_h - (GAME_FONT->ft_h / 4);
|
||||
#endif
|
||||
gr_printf((grd_curscreen->sc_w/3)-(ew/2),HUD_SCALE_Y(y),"%d",energy);
|
||||
gr_printf((grd_curscreen->get_screen_width() / 3) - (ew / 2), HUD_SCALE_Y(y), "%d", energy);
|
||||
|
||||
gr_set_current_canvas(NULL);
|
||||
}
|
||||
|
@ -2411,7 +2411,7 @@ static void sb_draw_shield_num(int shield)
|
|||
gr_set_fontcolor(BM_XRGB(14,14,23),-1 );
|
||||
|
||||
gr_get_string_size((shield>199)?"200":(shield>99)?"100":(shield>9)?"00":"0",&sw,&sh,&saw);
|
||||
gr_printf((grd_curscreen->sc_w/2.266)-(sw/2),HUD_SCALE_Y(SB_SHIELD_NUM_Y),"%d",shield);
|
||||
gr_printf((grd_curscreen->get_screen_width() / 2.266) - (sw / 2), HUD_SCALE_Y(SB_SHIELD_NUM_Y), "%d", shield);
|
||||
}
|
||||
|
||||
static void sb_draw_shield_bar(int shield)
|
||||
|
@ -3177,8 +3177,8 @@ void do_cockpit_window_view(int win,const vobjptridx_t viewer,int rear_view_flag
|
|||
|
||||
dx = (win==0)?-(w+(w/10)):(w/10);
|
||||
|
||||
window_x = grd_curscreen->sc_w/2+dx;
|
||||
window_y = grd_curscreen->sc_h-h-(SHEIGHT/15);
|
||||
window_x = grd_curscreen->get_screen_width() / 2 + dx;
|
||||
window_y = grd_curscreen->get_screen_height() - h - (SHEIGHT / 15);
|
||||
|
||||
gr_init_sub_canvas(window_canv, grd_curscreen->sc_canvas, window_x, window_y, w, h);
|
||||
}
|
||||
|
|
|
@ -438,7 +438,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
arch_init();
|
||||
|
||||
select_tmap(GameArg.DbgTexMap);
|
||||
select_tmap(GameArg.DbgTexMap.c_str());
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
Lighting_on = 1;
|
||||
|
@ -502,18 +502,18 @@ int main(int argc, char *argv[])
|
|||
// If built with editor, option to auto-load a level and quit game
|
||||
// to write certain data.
|
||||
#ifdef EDITOR
|
||||
if (GameArg.EdiAutoLoad) {
|
||||
if (!GameArg.EdiAutoLoad.empty()) {
|
||||
Players[0].callsign = "dummy";
|
||||
} else
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
if(GameArg.SysPilot)
|
||||
if (!GameArg.SysPilot.empty())
|
||||
{
|
||||
char filename[32] = "";
|
||||
unsigned j;
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s%.12s", PLAYER_DIRECTORY_STRING(""), GameArg.SysPilot);
|
||||
snprintf(filename, sizeof(filename), PLAYER_DIRECTORY_STRING("%.12s"), GameArg.SysPilot.c_str());
|
||||
for (j = GameArg.SysUsePlayersDir? 8 : 0; filename[j] != '\0'; j++) {
|
||||
switch (filename[j]) {
|
||||
case ' ':
|
||||
|
@ -538,9 +538,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
#ifdef EDITOR
|
||||
if (GameArg.EdiAutoLoad) {
|
||||
if (!GameArg.EdiAutoLoad.empty()) {
|
||||
/* Any number >= FILENAME_LEN works */
|
||||
Level_names[0].copy_if(GameArg.EdiAutoLoad, Level_names[0].size());
|
||||
Level_names[0].copy_if(GameArg.EdiAutoLoad.c_str(), GameArg.EdiAutoLoad.size());
|
||||
LoadLevel(1, 1);
|
||||
}
|
||||
else
|
||||
|
@ -573,7 +573,6 @@ int main(int argc, char *argv[])
|
|||
gamedata_close();
|
||||
gamefont_close();
|
||||
free_text();
|
||||
args_exit();
|
||||
newmenu_free_background();
|
||||
Current_mission.reset();
|
||||
PHYSFSX_removeArchiveContent();
|
||||
|
|
|
@ -88,7 +88,11 @@ joyaxis_text_t joyaxis_text;
|
|||
static const char mouseaxis_text[][8] = { "L/R", "F/B", "WHEEL" };
|
||||
static const char mousebutton_text[][8] = { "LEFT", "RIGHT", "MID", "M4", "M5", "M6", "M7", "M8", "M9", "M10","M11","M12","M13","M14","M15","M16" };
|
||||
|
||||
static const ubyte system_keys[19] = { KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_MINUS, KEY_EQUAL, KEY_PRINT_SCREEN, KEY_CAPSLOCK, KEY_SCROLLOCK, KEY_NUMLOCK }; // KEY_*LOCK should always be last since we wanna skip these if -nostickykeys
|
||||
const array<uint8_t, 19> system_keys{{
|
||||
KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, KEY_MINUS, KEY_EQUAL, KEY_PRINT_SCREEN,
|
||||
// KEY_*LOCK should always be last since we wanna skip these if -nostickykeys
|
||||
KEY_CAPSLOCK, KEY_SCROLLOCK, KEY_NUMLOCK
|
||||
}};
|
||||
|
||||
control_info Controls;
|
||||
|
||||
|
@ -1295,13 +1299,13 @@ static void kc_change_key( kc_menu &menu,const d_event &event, kc_mitem &mitem )
|
|||
Assert(event.type == EVENT_KEY_COMMAND);
|
||||
keycode = event_key_get_raw(event);
|
||||
|
||||
if (!(key_properties[keycode].key_text))
|
||||
auto e = end(system_keys);
|
||||
if (unlikely(GameArg.CtlNoStickyKeys))
|
||||
e = std::prev(e, 3);
|
||||
const auto predicate = [keycode](uint8_t k) { return keycode == k; };
|
||||
if (std::any_of(begin(system_keys), e, predicate))
|
||||
return;
|
||||
|
||||
for (unsigned n=0; n<(GameArg.CtlNoStickyKeys?sizeof(system_keys)-3:sizeof(system_keys)); n++ )
|
||||
if ( system_keys[n] == keycode )
|
||||
return;
|
||||
|
||||
kc_set_exclusive_binding(menu, mitem, BT_KEY, keycode);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ struct kmatrix_screen : ignore_window_pointer_t
|
|||
int network;
|
||||
fix64 end_time;
|
||||
int playing;
|
||||
int aborted;
|
||||
};
|
||||
|
||||
static void kmatrix_redraw(kmatrix_screen *km)
|
||||
|
@ -269,10 +270,10 @@ static window_event_result kmatrix_handler(window *wind,const d_event &event, km
|
|||
{
|
||||
case KEY_ESC:
|
||||
{
|
||||
array<newmenu_item, 2> nm_message_items{
|
||||
array<newmenu_item, 2> nm_message_items{{
|
||||
nm_item_menu(TXT_YES),
|
||||
nm_item_menu(TXT_NO),
|
||||
};
|
||||
}};
|
||||
choice = newmenu_do( NULL, TXT_ABORT_GAME, nm_message_items, km->network ? multi_endlevel_poll2 : unused_newmenu_subfunction, unused_newmenu_userdata );
|
||||
}
|
||||
|
||||
|
@ -284,8 +285,8 @@ static window_event_result kmatrix_handler(window *wind,const d_event &event, km
|
|||
multi_send_endlevel_packet();
|
||||
|
||||
multi_leave_game();
|
||||
if (Game_wind)
|
||||
window_close(Game_wind);
|
||||
km->aborted = 1;
|
||||
|
||||
return window_event_result::close;
|
||||
}
|
||||
return window_event_result::handled;
|
||||
|
@ -337,8 +338,8 @@ static window_event_result kmatrix_handler(window *wind,const d_event &event, km
|
|||
multi_send_endlevel_packet();
|
||||
|
||||
multi_leave_game();
|
||||
if (Game_wind)
|
||||
window_close(Game_wind);
|
||||
km->aborted = 1;
|
||||
|
||||
return window_event_result::close;
|
||||
}
|
||||
}
|
||||
|
@ -365,20 +366,21 @@ static window_event_result kmatrix_handler(window *wind,const d_event &event, km
|
|||
return window_event_result::ignored;
|
||||
}
|
||||
|
||||
void kmatrix_view(int network)
|
||||
int kmatrix_view(int network)
|
||||
{
|
||||
window *wind;
|
||||
kmatrix_screen km;
|
||||
gr_init_bitmap_data(km.background);
|
||||
if (pcx_read_bitmap(STARS_BACKGROUND, km.background, BM_LINEAR, gr_palette) != PCX_ERROR_NONE)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
gr_palette_load(gr_palette);
|
||||
|
||||
km.network = network;
|
||||
km.end_time = -1;
|
||||
km.playing = 0;
|
||||
km.aborted = 0;
|
||||
|
||||
set_screen_mode( SCREEN_MENU );
|
||||
game_flush_inputs();
|
||||
|
@ -390,10 +392,11 @@ void kmatrix_view(int network)
|
|||
wind = window_create(&grd_curscreen->sc_canvas, 0, 0, SWIDTH, SHEIGHT, kmatrix_handler, &km);
|
||||
if (!wind)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (window_exists(wind))
|
||||
event_process();
|
||||
gr_free_bitmap_data(km.background);
|
||||
return (km.aborted?0:1);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
object *Guided_missile[MAX_PLAYERS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
|
||||
int Guided_missile_sig[MAX_PLAYERS]={-1,-1,-1,-1,-1,-1,-1,-1};
|
||||
array<object_signature_t, MAX_PLAYERS> Guided_missile_sig;
|
||||
#endif
|
||||
objnum_t Network_laser_track = object_none;
|
||||
|
||||
|
@ -330,11 +330,10 @@ constexpr vm_distance OMEGA_MAX_TRACKABLE_DIST = MAX_OMEGA_DIST; // An object mu
|
|||
// Since last omega blob has VERY high velocity it's impossible to ensure a constant travel distance on varying FPS. So delete if they exceed their maximum distance.
|
||||
static int omega_cleanup(const vobjptridx_t weapon)
|
||||
{
|
||||
int parent_sig = weapon->ctype.laser_info.parent_signature, parent_num = weapon->ctype.laser_info.parent_num;
|
||||
|
||||
if (weapon->type != OBJ_WEAPON || weapon->id != OMEGA_ID)
|
||||
return 0;
|
||||
|
||||
const auto parent_sig = weapon->ctype.laser_info.parent_signature;
|
||||
const auto parent_num = weapon->ctype.laser_info.parent_num;
|
||||
if (Objects[parent_num].signature == parent_sig)
|
||||
if (vm_vec_dist2(weapon->pos, Objects[parent_num].pos) > MAX_OMEGA_DIST_SQUARED)
|
||||
{
|
||||
|
@ -348,13 +347,12 @@ static int omega_cleanup(const vobjptridx_t weapon)
|
|||
// Return true if ok to do Omega damage. For Multiplayer games. See comment for omega_cleanup()
|
||||
int ok_to_do_omega_damage(const vcobjptr_t weapon)
|
||||
{
|
||||
int parent_sig = weapon->ctype.laser_info.parent_signature, parent_num = weapon->ctype.laser_info.parent_num;
|
||||
|
||||
if (weapon->type != OBJ_WEAPON || weapon->id != OMEGA_ID)
|
||||
return 1;
|
||||
if (!(Game_mode & GM_MULTI))
|
||||
return 1;
|
||||
|
||||
const auto parent_sig = weapon->ctype.laser_info.parent_signature;
|
||||
const auto parent_num = weapon->ctype.laser_info.parent_num;
|
||||
if (Objects[parent_num].signature == parent_sig)
|
||||
if (vm_vec_dist2(Objects[parent_num].pos, weapon->pos) > MAX_OMEGA_DIST_SQUARED)
|
||||
return 0;
|
||||
|
@ -1456,7 +1454,7 @@ void Laser_do_weapon_sequence(const vobjptridx_t obj)
|
|||
#endif
|
||||
|
||||
//delete weapons that are not moving
|
||||
if ( !((d_tick_count ^ obj->signature) & 3) &&
|
||||
if ( !((d_tick_count ^ obj->signature.get()) & 3) &&
|
||||
(get_weapon_id(obj) != FLARE_ID) &&
|
||||
(Weapon_info[get_weapon_id(obj)].speed[Difficulty_level] > 0) &&
|
||||
(vm_vec_mag_quick(obj->mtype.phys_info.velocity) < F2_0)) {
|
||||
|
|
|
@ -604,7 +604,7 @@ g3s_lrgb compute_seg_dynamic_light(segnum_t segnum)
|
|||
}
|
||||
|
||||
g3s_lrgb object_light[MAX_OBJECTS];
|
||||
int object_sig[MAX_OBJECTS];
|
||||
static array<object_signature_t, MAX_OBJECTS> object_sig;
|
||||
object *old_viewer;
|
||||
int reset_lighting_hack;
|
||||
#define LIGHT_RATE i2f(4) //how fast the light ramps up
|
||||
|
|
|
@ -204,9 +204,9 @@ static int MakeNewPlayerFile(int allow_abort)
|
|||
|
||||
try_again:
|
||||
{
|
||||
array<newmenu_item, 1> m{
|
||||
array<newmenu_item, 1> m{{
|
||||
nm_item_input(text.buffer()),
|
||||
};
|
||||
}};
|
||||
Newmenu_allowed_chars = playername_allowed_chars;
|
||||
x = newmenu_do( NULL, TXT_ENTER_PILOT_NAME, m, unused_newmenu_subfunction, unused_newmenu_userdata );
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ int RegisterPlayer()
|
|||
{
|
||||
const char **m;
|
||||
char **f;
|
||||
static const array<file_extension_t, 1> types{"plr"};
|
||||
static const array<file_extension_t, 1> types{{"plr"}};
|
||||
int i = 0, NumItems;
|
||||
int citem = 0;
|
||||
int allow_abort_flag = 1;
|
||||
|
@ -776,13 +776,13 @@ int select_demo(void)
|
|||
static int do_difficulty_menu()
|
||||
{
|
||||
int s;
|
||||
array<newmenu_item, NDL> m{
|
||||
array<newmenu_item, NDL> m{{
|
||||
nm_item_menu(MENU_DIFFICULTY_TEXT(0)),
|
||||
nm_item_menu(MENU_DIFFICULTY_TEXT(1)),
|
||||
nm_item_menu(MENU_DIFFICULTY_TEXT(2)),
|
||||
nm_item_menu(MENU_DIFFICULTY_TEXT(3)),
|
||||
nm_item_menu(MENU_DIFFICULTY_TEXT(4)),
|
||||
};
|
||||
}};
|
||||
|
||||
s = newmenu_do1( NULL, TXT_DIFFICULTY_LEVEL, m.size(), &m.front(), unused_newmenu_subfunction, unused_newmenu_userdata, Difficulty_level);
|
||||
|
||||
|
@ -818,10 +818,10 @@ int do_new_game_menu()
|
|||
while (!valid)
|
||||
{
|
||||
array<char, 10> num_text{"1"};
|
||||
array<newmenu_item, 2> m{
|
||||
array<newmenu_item, 2> m{{
|
||||
nm_item_text(info_text),
|
||||
nm_item_input(num_text),
|
||||
};
|
||||
}};
|
||||
choice = newmenu_do( NULL, TXT_SELECT_START_LEV, m, unused_newmenu_subfunction, unused_newmenu_userdata );
|
||||
|
||||
if (choice==-1 || m[1].text[0]==0)
|
||||
|
@ -998,22 +998,34 @@ void change_res()
|
|||
|
||||
if (i == opt_cval) // set custom resolution and aspect
|
||||
{
|
||||
u_int32_t cmode = Game_screen_mode, casp = Game_screen_mode;
|
||||
|
||||
if (!strchr(crestext, 'x'))
|
||||
return;
|
||||
|
||||
cmode = SM(atoi(crestext), atoi(strchr(crestext, 'x')+1));
|
||||
if (SM_W(cmode) < 320 || SM_H(cmode) < 200) // oh oh - the resolution is too small. Revert!
|
||||
char *x;
|
||||
unsigned long w = strtoul(crestext, &x, 10), h;
|
||||
uint32_t cmode;
|
||||
if (*x != 'x' || ((h = strtoul(x + 1, &x, 10)), *x))
|
||||
{
|
||||
nm_messagebox( TXT_WARNING, 1, "OK", "Entered resolution is too small.\nReverting ..." );
|
||||
cmode = new_mode;
|
||||
nm_messagebox(TXT_WARNING, 1, "OK", "Entered resolution is bad.\nReverting ...");
|
||||
cmode = 0;
|
||||
}
|
||||
|
||||
casp = cmode;
|
||||
if (strchr(casptext, 'x')) // we even have a custom aspect set up
|
||||
else if (w < 320 || h < 200)
|
||||
{
|
||||
casp = SM(atoi(casptext), atoi(strchr(casptext, 'x')+1));
|
||||
// oh oh - the resolution is too small. Revert!
|
||||
nm_messagebox( TXT_WARNING, 1, "OK", "Entered resolution is too small.\nReverting ..." );
|
||||
cmode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmode = SM(w, h);
|
||||
}
|
||||
auto casp = cmode;
|
||||
w = strtoul(casptext, &x, 10);
|
||||
if (*x != 'x' || ((h = strtoul(x + 1, &x, 10)), *x))
|
||||
{
|
||||
nm_messagebox(TXT_WARNING, 1, "OK", "Aspect resolution is bad.\nIgnoring ...");
|
||||
}
|
||||
else
|
||||
{
|
||||
// we even have a custom aspect set up
|
||||
casp = SM(w, h);
|
||||
}
|
||||
GameCfg.AspectY = SM_W(casp)/gcd(SM_W(casp),SM_H(casp));
|
||||
GameCfg.AspectX = SM_H(casp)/gcd(SM_W(casp),SM_H(casp));
|
||||
|
@ -1726,7 +1738,7 @@ static int sound_menuset(newmenu *menu,const d_event &event, const unused_newmen
|
|||
#endif
|
||||
if (citem == opt_sm_mtype3_lmpath)
|
||||
{
|
||||
static const array<file_extension_t, 1> ext_list{"m3u"}; // select a directory or M3U playlist
|
||||
static const array<file_extension_t, 1> ext_list{{"m3u"}}; // select a directory or M3U playlist
|
||||
select_file_recursive(
|
||||
"Select directory or\nM3U playlist to\n play level music from" WINDOWS_DRIVE_CHANGE_TEXT,
|
||||
GameCfg.CMLevelMusicPath.data(), ext_list, 1, // look in current music path for ext_list files and allow directory selection
|
||||
|
|
|
@ -60,32 +60,23 @@ const array<char, MAX_SIDES_PER_SEGMENT> Side_opposite{{
|
|||
|
||||
#define TOLOWER(c) ((((c)>='A') && ((c)<='Z'))?((c)+('a'-'A')):(c))
|
||||
|
||||
#ifdef PASSWORD
|
||||
#define encrypt(a,b,c,d) a ^ TOLOWER((((int) PASSWORD)>>24)&255), \
|
||||
b ^ TOLOWER((((int) PASSWORD)>>16)&255), \
|
||||
c ^ TOLOWER((((int) PASSWORD)>>8)&255), \
|
||||
d ^ TOLOWER((((int) PASSWORD))&255)
|
||||
#else
|
||||
#define encrypt(a,b,c,d) a,b,c,d
|
||||
#endif
|
||||
|
||||
const array<array<sbyte, 4>, MAX_SIDES_PER_SEGMENT> Side_to_verts{{
|
||||
{ encrypt(7,6,2,3) }, // left
|
||||
{ encrypt(0,4,7,3) }, // top
|
||||
{ encrypt(0,1,5,4) }, // right
|
||||
{ encrypt(2,6,5,1) }, // bottom
|
||||
{ encrypt(4,5,6,7) }, // back
|
||||
{ encrypt(3,2,1,0) }, // front
|
||||
{{7,6,2,3}}, // left
|
||||
{{0,4,7,3}}, // top
|
||||
{{0,1,5,4}}, // right
|
||||
{{2,6,5,1}}, // bottom
|
||||
{{4,5,6,7}}, // back
|
||||
{{3,2,1,0}}, // front
|
||||
}};
|
||||
|
||||
// Note, this MUST be the same as Side_to_verts, it is an int for speed reasons.
|
||||
const array<array<int, 4>, MAX_SIDES_PER_SEGMENT> Side_to_verts_int{{
|
||||
{ encrypt(7,6,2,3) }, // left
|
||||
{ encrypt(0,4,7,3) }, // top
|
||||
{ encrypt(0,1,5,4) }, // right
|
||||
{ encrypt(2,6,5,1) }, // bottom
|
||||
{ encrypt(4,5,6,7) }, // back
|
||||
{ encrypt(3,2,1,0) }, // front
|
||||
{{7,6,2,3}}, // left
|
||||
{{0,4,7,3}}, // top
|
||||
{{0,1,5,4}}, // right
|
||||
{{2,6,5,1}}, // bottom
|
||||
{{4,5,6,7}}, // back
|
||||
{{3,2,1,0}}, // front
|
||||
}};
|
||||
|
||||
// Texture map stuff
|
||||
|
|
|
@ -968,8 +968,7 @@ static int mission_menu_handler(listbox *lb,const d_event &event, mission_menu *
|
|||
if (citem >= 0)
|
||||
{
|
||||
// Chose a mission
|
||||
strcpy(GameCfg.LastMission, list[citem]);
|
||||
|
||||
GameCfg.LastMission.copy_if(list[citem]);
|
||||
if (!load_mission(&mm->ml[citem]))
|
||||
{
|
||||
nm_messagebox( NULL, 1, TXT_OK, TXT_MISSION_ERROR);
|
||||
|
|
|
@ -83,6 +83,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "partial_range.h"
|
||||
#include "highest_valid.h"
|
||||
|
||||
constexpr tt::integral_constant<int8_t, -1> owner_none{};
|
||||
|
||||
static void multi_reset_object_texture(const vobjptr_t objp);
|
||||
static void multi_add_lifetime_killed();
|
||||
static void multi_send_heartbeat();
|
||||
|
@ -257,9 +259,9 @@ void ClipRank (ubyte *rank)
|
|||
// Functions that replace what used to be macros
|
||||
//
|
||||
|
||||
objnum_t objnum_remote_to_local(int remote_objnum, int owner)
|
||||
objnum_t objnum_remote_to_local(uint16_t remote_objnum, int8_t owner)
|
||||
{
|
||||
if (owner == -1)
|
||||
if (owner == owner_none)
|
||||
return(remote_objnum);
|
||||
// Map a remote object number from owner to a local object number
|
||||
if ((owner >= N_players) || (owner < -1)) {
|
||||
|
@ -267,7 +269,7 @@ objnum_t objnum_remote_to_local(int remote_objnum, int owner)
|
|||
return(remote_objnum);
|
||||
}
|
||||
|
||||
if ((remote_objnum < 0) || (remote_objnum >= MAX_OBJECTS))
|
||||
if (remote_objnum >= MAX_OBJECTS)
|
||||
return(object_none);
|
||||
|
||||
auto result = remote_to_local[owner][remote_objnum];
|
||||
|
@ -278,10 +280,10 @@ owned_remote_objnum objnum_local_to_remote(objnum_t local_objnum)
|
|||
{
|
||||
// Map a local object number to a remote + owner
|
||||
if ((local_objnum < 0) || (local_objnum > Highest_object_index)) {
|
||||
return {-1, -1};
|
||||
return {owner_none, -1};
|
||||
}
|
||||
auto owner = object_owner[local_objnum];
|
||||
if (owner == -1)
|
||||
if (owner == owner_none)
|
||||
return {owner, local_objnum};
|
||||
if (owner >= N_players || owner < -1)
|
||||
throw std::runtime_error("illegal object owner");
|
||||
|
@ -291,7 +293,7 @@ owned_remote_objnum objnum_local_to_remote(objnum_t local_objnum)
|
|||
return {owner, result};
|
||||
}
|
||||
|
||||
short objnum_local_to_remote(objnum_t local_objnum, sbyte *owner)
|
||||
uint16_t objnum_local_to_remote(objnum_t local_objnum, int8_t *owner)
|
||||
{
|
||||
auto r = objnum_local_to_remote(local_objnum);
|
||||
*owner = r.owner;
|
||||
|
@ -362,11 +364,11 @@ int multi_objnum_is_past(objnum_t objnum)
|
|||
//
|
||||
|
||||
// Show a score list to end of net players
|
||||
void multi_endlevel_score(void)
|
||||
int multi_endlevel_score(void)
|
||||
{
|
||||
int old_connect=0, game_wind_visible = 0;
|
||||
int old_connect=0, game_wind_visible = 0, rval = 0;
|
||||
|
||||
// If there still is a Game_wind and it's suspended (usually both shoudl be the case), bring it up again so host can still take actions of the game
|
||||
// If there still is a Game_wind and it's suspended (usually both should be the case), bring it up again so host can still take actions of the game
|
||||
if (Game_wind)
|
||||
{
|
||||
if (!window_is_visible(Game_wind))
|
||||
|
@ -385,7 +387,7 @@ void multi_endlevel_score(void)
|
|||
}
|
||||
|
||||
// Do the actual screen we wish to show
|
||||
kmatrix_view(Game_mode & GM_NETWORK);
|
||||
rval = kmatrix_view(Game_mode & GM_NETWORK);
|
||||
|
||||
// Restore connect state
|
||||
|
||||
|
@ -415,6 +417,8 @@ void multi_endlevel_score(void)
|
|||
// hide Game_wind again if we brought it up
|
||||
if (Game_wind && game_wind_visible)
|
||||
window_set_visible(Game_wind, 0);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
int get_team(const playernum_t pnum)
|
||||
|
@ -1477,8 +1481,8 @@ static void multi_do_fire(const playernum_t pnum, const ubyte *buf)
|
|||
flags = buf[4];
|
||||
if (buf[0] == MULTI_FIRE_TRACK)
|
||||
{
|
||||
Network_laser_track = GET_INTEL_SHORT(buf + 6);
|
||||
Network_laser_track = objnum_remote_to_local(Network_laser_track, buf[8]);
|
||||
Network_laser_track = GET_INTEL_SHORT(buf + 18);
|
||||
Network_laser_track = objnum_remote_to_local(Network_laser_track, buf[20]);
|
||||
}
|
||||
|
||||
shot_orientation.x = (fix) GET_INTEL_INT(buf + 6);
|
||||
|
@ -1509,7 +1513,7 @@ static void multi_do_fire(const playernum_t pnum, const ubyte *buf)
|
|||
auto objnum = Laser_player_fire( obj, weapon_id, weapon_gun, 1, shot_orientation );
|
||||
if (buf[0] == MULTI_FIRE_BOMB)
|
||||
{
|
||||
remote_objnum = GET_INTEL_SHORT(buf + 6);
|
||||
remote_objnum = GET_INTEL_SHORT(buf + 18);
|
||||
map_objnum_local_to_remote(objnum, remote_objnum, pnum);
|
||||
}
|
||||
}
|
||||
|
@ -1733,7 +1737,7 @@ static void multi_do_kill(const playernum_t pnum, const ubyte *buf)
|
|||
count += 1;
|
||||
killer = GET_INTEL_SHORT(buf + count);
|
||||
if (killer > 0)
|
||||
killer = objnum_remote_to_local(killer, (sbyte)buf[count+2]);
|
||||
killer = objnum_remote_to_local(killer, buf[count+2]);
|
||||
if (!multi_i_am_master())
|
||||
{
|
||||
Netgame.team_vector = buf[5];
|
||||
|
@ -1805,10 +1809,10 @@ void
|
|||
static multi_do_remobj(const ubyte *buf)
|
||||
{
|
||||
short objnum; // which object to remove
|
||||
sbyte obj_owner; // which remote list is it entered in
|
||||
|
||||
objnum = GET_INTEL_SHORT(buf + 1);
|
||||
obj_owner = buf[3];
|
||||
// which remote list is it entered in
|
||||
auto obj_owner = buf[3];
|
||||
|
||||
Assert(objnum >= 0);
|
||||
|
||||
|
@ -5153,7 +5157,7 @@ static void multi_process_data(const playernum_t pnum, const ubyte *buf, const u
|
|||
// turn object to object_rw for sending
|
||||
void multi_object_to_object_rw(const vobjptr_t obj, object_rw *obj_rw)
|
||||
{
|
||||
obj_rw->signature = obj->signature;
|
||||
obj_rw->signature = obj->signature.get();
|
||||
obj_rw->type = obj->type;
|
||||
obj_rw->id = obj->id;
|
||||
obj_rw->next = obj->next;
|
||||
|
@ -5220,7 +5224,7 @@ void multi_object_to_object_rw(const vobjptr_t obj, object_rw *obj_rw)
|
|||
case CT_WEAPON:
|
||||
obj_rw->ctype.laser_info.parent_type = obj->ctype.laser_info.parent_type;
|
||||
obj_rw->ctype.laser_info.parent_num = obj->ctype.laser_info.parent_num;
|
||||
obj_rw->ctype.laser_info.parent_signature = obj->ctype.laser_info.parent_signature;
|
||||
obj_rw->ctype.laser_info.parent_signature = obj->ctype.laser_info.parent_signature.get();
|
||||
if (obj->ctype.laser_info.creation_time - GameTime64 < F1_0*(-18000))
|
||||
obj_rw->ctype.laser_info.creation_time = F1_0*(-18000);
|
||||
else
|
||||
|
@ -5250,7 +5254,7 @@ void multi_object_to_object_rw(const vobjptr_t obj, object_rw *obj_rw)
|
|||
obj_rw->ctype.ai_info.path_length = obj->ctype.ai_info.path_length;
|
||||
obj_rw->ctype.ai_info.cur_path_index = obj->ctype.ai_info.cur_path_index;
|
||||
obj_rw->ctype.ai_info.danger_laser_num = obj->ctype.ai_info.danger_laser_num;
|
||||
obj_rw->ctype.ai_info.danger_laser_signature = obj->ctype.ai_info.danger_laser_signature;
|
||||
obj_rw->ctype.ai_info.danger_laser_signature = obj->ctype.ai_info.danger_laser_signature.get();
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
obj_rw->ctype.ai_info.follow_path_start_seg = obj->ctype.ai_info.follow_path_start_seg;
|
||||
obj_rw->ctype.ai_info.follow_path_end_seg = obj->ctype.ai_info.follow_path_end_seg;
|
||||
|
@ -5320,7 +5324,7 @@ void multi_object_to_object_rw(const vobjptr_t obj, object_rw *obj_rw)
|
|||
// turn object_rw to object after receiving
|
||||
void multi_object_rw_to_object(object_rw *obj_rw, const vobjptr_t obj)
|
||||
{
|
||||
obj->signature = obj_rw->signature;
|
||||
obj->signature = object_signature_t{static_cast<uint16_t>(obj_rw->signature)};
|
||||
obj->type = obj_rw->type;
|
||||
obj->id = obj_rw->id;
|
||||
obj->next = obj_rw->next;
|
||||
|
@ -5387,7 +5391,7 @@ void multi_object_rw_to_object(object_rw *obj_rw, const vobjptr_t obj)
|
|||
case CT_WEAPON:
|
||||
obj->ctype.laser_info.parent_type = obj_rw->ctype.laser_info.parent_type;
|
||||
obj->ctype.laser_info.parent_num = obj_rw->ctype.laser_info.parent_num;
|
||||
obj->ctype.laser_info.parent_signature = obj_rw->ctype.laser_info.parent_signature;
|
||||
obj->ctype.laser_info.parent_signature = object_signature_t{static_cast<uint16_t>(obj_rw->ctype.laser_info.parent_signature)};
|
||||
obj->ctype.laser_info.creation_time = obj_rw->ctype.laser_info.creation_time;
|
||||
obj->ctype.laser_info.last_hitobj = obj_rw->ctype.laser_info.last_hitobj;
|
||||
obj->ctype.laser_info.track_goal = obj_rw->ctype.laser_info.track_goal;
|
||||
|
@ -5418,7 +5422,7 @@ void multi_object_rw_to_object(object_rw *obj_rw, const vobjptr_t obj)
|
|||
obj->ctype.ai_info.path_length = obj_rw->ctype.ai_info.path_length;
|
||||
obj->ctype.ai_info.cur_path_index = obj_rw->ctype.ai_info.cur_path_index;
|
||||
obj->ctype.ai_info.danger_laser_num = obj_rw->ctype.ai_info.danger_laser_num;
|
||||
obj->ctype.ai_info.danger_laser_signature = obj_rw->ctype.ai_info.danger_laser_signature;
|
||||
obj->ctype.ai_info.danger_laser_signature = object_signature_t{static_cast<uint16_t>(obj_rw->ctype.ai_info.danger_laser_signature)};
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
obj->ctype.ai_info.follow_path_start_seg = obj_rw->ctype.ai_info.follow_path_start_seg;
|
||||
obj->ctype.ai_info.follow_path_end_seg = obj_rw->ctype.ai_info.follow_path_end_seg;
|
||||
|
|
|
@ -673,7 +673,7 @@ void multi_do_release_robot(const playernum_t pnum, const ubyte *buf)
|
|||
short remote_botnum;
|
||||
|
||||
remote_botnum = GET_INTEL_SHORT(buf + 2);
|
||||
auto botnum = objnum_remote_to_local(remote_botnum, (sbyte)buf[4]);
|
||||
auto botnum = objnum_remote_to_local(remote_botnum, buf[4]);
|
||||
|
||||
if ((botnum < 0) || (botnum > Highest_object_index)) {
|
||||
return;
|
||||
|
@ -707,7 +707,7 @@ void multi_do_robot_position(const playernum_t pnum, const ubyte *buf)
|
|||
; loc += 1;
|
||||
|
||||
remote_botnum = GET_INTEL_SHORT(buf + loc);
|
||||
auto botnum = objnum_remote_to_local(remote_botnum, (sbyte)buf[loc+2]); loc += 3;
|
||||
auto botnum = objnum_remote_to_local(remote_botnum, buf[loc+2]); loc += 3;
|
||||
|
||||
if ((botnum < 0) || (botnum > Highest_object_index)) {
|
||||
return;
|
||||
|
@ -767,7 +767,7 @@ multi_do_robot_fire(const ubyte *buf)
|
|||
|
||||
loc += 1; // pnum
|
||||
remote_botnum = GET_INTEL_SHORT(buf + loc);
|
||||
auto botnum = objnum_remote_to_local(remote_botnum, (sbyte)buf[loc+2]); loc += 3;
|
||||
auto botnum = objnum_remote_to_local(remote_botnum, buf[loc+2]); loc += 3;
|
||||
gun_num = (sbyte)buf[loc]; loc += 1;
|
||||
memcpy(&fire, buf+loc, sizeof(vms_vector));
|
||||
fire.x = (fix)INTEL_INT((int)fire.x);
|
||||
|
|
|
@ -637,9 +637,9 @@ static int udp_receive_packet(RAIIsocket &sock, ubyte *text, int len, struct _so
|
|||
/* Tracker initialization */
|
||||
static int udp_tracker_init()
|
||||
{
|
||||
const char *tracker_addr = GameArg.MplTrackerAddr;
|
||||
if (!tracker_addr)
|
||||
if (GameArg.MplTrackerAddr.empty())
|
||||
return 0;
|
||||
const char *tracker_addr = GameArg.MplTrackerAddr.c_str();
|
||||
int tracker_port = d_rand() % 0xffff;
|
||||
|
||||
while (tracker_port <= 1024)
|
||||
|
@ -940,7 +940,7 @@ void net_udp_manual_join_game()
|
|||
|
||||
net_udp_init();
|
||||
|
||||
snprintf(dj->addrbuf, sizeof(dj->addrbuf), "%s", GameArg.MplUdpHostAddr);
|
||||
snprintf(dj->addrbuf, sizeof(dj->addrbuf), "%s", GameArg.MplUdpHostAddr.c_str());
|
||||
snprintf(dj->hostportbuf, sizeof(dj->hostportbuf), "%hu", GameArg.MplUdpHostPort ? GameArg.MplUdpHostPort : UDP_PORT_DEFAULT);
|
||||
|
||||
reset_UDP_MyPort();
|
||||
|
@ -3191,15 +3191,15 @@ static void net_udp_more_game_options ()
|
|||
snprintf(KillText, sizeof(KillText), "Kill Goal: %d kills", Netgame.KillGoal*5);
|
||||
#ifdef USE_TRACKER
|
||||
char tracker[52];
|
||||
auto tracker_addr = GameArg.MplTrackerAddr;
|
||||
if (tracker_addr)
|
||||
snprintf(tracker, sizeof(tracker), "Track this game on\n%s:%u", tracker_addr, GameArg.MplTrackerPort);
|
||||
const auto &tracker_addr = GameArg.MplTrackerAddr;
|
||||
if (!tracker_addr.empty())
|
||||
snprintf(tracker, sizeof(tracker), "Track this game on\n%s:%u", tracker_addr.c_str(), GameArg.MplTrackerPort);
|
||||
#endif
|
||||
|
||||
DXX_UDP_MENU_OPTIONS(ADD);
|
||||
|
||||
#ifdef USE_TRACKER
|
||||
if (!tracker_addr)
|
||||
if (tracker_addr.empty())
|
||||
nm_set_item_text(m[opt_tracker], "Tracker use disabled by -no-tracker");
|
||||
#endif
|
||||
|
||||
|
@ -3561,7 +3561,7 @@ int net_udp_setup_game()
|
|||
/* Force off _after_ writing profile, so that command line does not
|
||||
* change ngp file.
|
||||
*/
|
||||
if (!GameArg.MplTrackerAddr)
|
||||
if (GameArg.MplTrackerAddr.empty())
|
||||
Netgame.Tracker = 0;
|
||||
#endif
|
||||
|
||||
|
@ -4029,10 +4029,10 @@ static int net_udp_wait_for_sync(void)
|
|||
|
||||
Network_status = NETSTAT_WAITING;
|
||||
|
||||
array<newmenu_item, 2> m{
|
||||
array<newmenu_item, 2> m{{
|
||||
nm_item_text(text),
|
||||
nm_item_text(TXT_NET_LEAVE),
|
||||
};
|
||||
}};
|
||||
auto i = net_udp_send_request();
|
||||
|
||||
if (i >= MAX_PLAYERS)
|
||||
|
@ -4087,9 +4087,9 @@ static int net_udp_wait_for_requests(void)
|
|||
{
|
||||
// Wait for other players to load the level before we send the sync
|
||||
int choice;
|
||||
array<newmenu_item, 1> m{
|
||||
array<newmenu_item, 1> m{{
|
||||
nm_item_text(TXT_NET_LEAVE),
|
||||
};
|
||||
}};
|
||||
Network_status = NETSTAT_WAITING;
|
||||
net_udp_flush();
|
||||
|
||||
|
@ -4441,7 +4441,7 @@ void net_udp_do_frame(int force, int listen)
|
|||
iAttempts = 0;
|
||||
|
||||
// Warn
|
||||
nm_messagebox( TXT_WARNING, 1, TXT_OK, "No response from tracker!\nPossible causes:\nTracker is down\nYour port is likely not open!\n\nTracker: %s:%hu\nGame port: %hu", GameArg.MplTrackerAddr, GameArg.MplTrackerPort, UDP_MyPort );
|
||||
nm_messagebox( TXT_WARNING, 1, TXT_OK, "No response from tracker!\nPossible causes:\nTracker is down\nYour port is likely not open!\n\nTracker: %s:%hu\nGame port: %hu", GameArg.MplTrackerAddr.c_str(), GameArg.MplTrackerPort, UDP_MyPort );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -5561,10 +5561,10 @@ int net_udp_show_game_info()
|
|||
#define EXPAND_ARGUMENT(A,B,...) , B, ## __VA_ARGS__
|
||||
snprintf(rinfo, lengthof(rinfo), GAME_INFO_FORMAT_TEXT(EXPAND_FORMAT) GAME_INFO_FORMAT_TEXT(EXPAND_ARGUMENT));
|
||||
|
||||
array<newmenu_item, 2> nm_message_items{
|
||||
array<newmenu_item, 2> nm_message_items{{
|
||||
nm_item_menu("JOIN GAME"),
|
||||
nm_item_menu("GAME INFO"),
|
||||
};
|
||||
}};
|
||||
c = newmenu_do("WELCOME", rinfo, nm_message_items, show_game_info_handler, netgame);
|
||||
if (c==0)
|
||||
return 1;
|
||||
|
|
|
@ -174,7 +174,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
|
||||
#define DEMO_MAX_LEVELS 29
|
||||
|
||||
const array<file_extension_t, 1> demo_file_extensions{DEMO_EXT};
|
||||
const array<file_extension_t, 1> demo_file_extensions{{DEMO_EXT}};
|
||||
|
||||
// In- and Out-files
|
||||
static RAIIPHYSFS_File infile;
|
||||
|
@ -301,13 +301,13 @@ static typename tt::enable_if<tt::is_integral<T>::value, int>::type newdemo_read
|
|||
return _newdemo_read(buffer, elsize, nelem);
|
||||
}
|
||||
|
||||
objnum_t newdemo_find_object( int signature )
|
||||
cobjptridx_t newdemo_find_object(object_signature_t signature)
|
||||
{
|
||||
range_for (const auto i, highest_valid(Objects))
|
||||
{
|
||||
object * objp = &Objects[i];
|
||||
const auto objp = vcobjptridx(i);
|
||||
if ( (objp->type != OBJ_NONE) && (objp->signature == signature))
|
||||
return i;
|
||||
return objp;
|
||||
}
|
||||
return object_none;
|
||||
}
|
||||
|
@ -550,7 +550,8 @@ static void nd_read_object(const vobjptridx_t obj)
|
|||
nd_read_byte((sbyte *) &(obj->id));
|
||||
nd_read_byte((sbyte *) &(obj->flags));
|
||||
nd_read_short(&shortsig);
|
||||
obj->signature = shortsig; // It's OKAY! We made sure, obj->signature is never has a value which short cannot handle!!! We cannot do this otherwise, without breaking the demo format!
|
||||
// It's OKAY! We made sure, obj->signature is never has a value which short cannot handle!!! We cannot do this otherwise, without breaking the demo format!
|
||||
obj->signature = object_signature_t{static_cast<uint16_t>(shortsig)};
|
||||
nd_read_shortpos(obj);
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
|
@ -786,7 +787,7 @@ static void nd_write_object(const vcobjptr_t obj)
|
|||
|
||||
nd_write_byte(obj->id);
|
||||
nd_write_byte(obj->flags);
|
||||
shortsig = obj->signature; // It's OKAY! We made sure, obj->signature is never has a value which short cannot handle!!! We cannot do this otherwise, without breaking the demo format!
|
||||
shortsig = obj->signature.get(); // It's OKAY! We made sure, obj->signature is never has a value which short cannot handle!!! We cannot do this otherwise, without breaking the demo format!
|
||||
nd_write_short(shortsig);
|
||||
nd_write_shortpos(obj);
|
||||
|
||||
|
@ -1121,7 +1122,7 @@ void newdemo_record_link_sound_to_object3( int soundno, short objnum, fix max_vo
|
|||
stop_time();
|
||||
nd_write_byte( ND_EVENT_LINK_SOUND_TO_OBJ );
|
||||
nd_write_int( soundno );
|
||||
nd_write_int( Objects[objnum].signature );
|
||||
nd_write_int(Objects[objnum].signature.get());
|
||||
nd_write_int( max_volume );
|
||||
nd_write_int( max_distance );
|
||||
nd_write_int( loop_start );
|
||||
|
@ -1133,7 +1134,7 @@ void newdemo_record_kill_sound_linked_to_object(const vcobjptridx_t objp)
|
|||
{
|
||||
stop_time();
|
||||
nd_write_byte( ND_EVENT_KILL_SOUND_TO_OBJ );
|
||||
nd_write_int(objp->signature );
|
||||
nd_write_int(objp->signature.get());
|
||||
start_time();
|
||||
}
|
||||
|
||||
|
@ -2099,9 +2100,9 @@ static int newdemo_read_frame_information(int rewrite)
|
|||
nd_write_int( loop_end );
|
||||
break;
|
||||
}
|
||||
auto objnum = newdemo_find_object( signature );
|
||||
auto objnum = newdemo_find_object(object_signature_t{static_cast<uint16_t>(signature)});
|
||||
if ( objnum != object_none && Newdemo_vcr_state == ND_STATE_PLAYBACK) { // @mk, 2/22/96, John told me to.
|
||||
digi_link_sound_to_object3( soundno, vcobjptridx(objnum), 1, max_volume, vm_distance{max_distance}, loop_start, loop_end );
|
||||
digi_link_sound_to_object3( soundno, objnum, 1, max_volume, vm_distance{max_distance}, loop_start, loop_end );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2115,9 +2116,9 @@ static int newdemo_read_frame_information(int rewrite)
|
|||
nd_write_int( signature );
|
||||
break;
|
||||
}
|
||||
auto objnum = newdemo_find_object( signature );
|
||||
auto objnum = newdemo_find_object(object_signature_t{static_cast<uint16_t>(signature)});
|
||||
if ( objnum != object_none && Newdemo_vcr_state == ND_STATE_PLAYBACK) { // @mk, 2/22/96, John told me to.
|
||||
digi_kill_sound_linked_to_object(vcobjptridx(objnum));
|
||||
digi_kill_sound_linked_to_object(objnum);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -3679,9 +3680,10 @@ static void newdemo_write_end()
|
|||
static bool guess_demo_name(ntstring<PATH_MAX - 1> &filename)
|
||||
{
|
||||
filename[0] = 0;
|
||||
auto p = GameArg.SysRecordDemoNameTemplate;
|
||||
if (!p || !*p)
|
||||
const auto &n = GameArg.SysRecordDemoNameTemplate;
|
||||
if (n.empty())
|
||||
return false;
|
||||
auto p = n.c_str();
|
||||
if (!strcmp(p, "."))
|
||||
p = "%Y%m%d.%H%M%S-$p-$m";
|
||||
std::size_t i = 0;
|
||||
|
@ -3777,15 +3779,15 @@ try_again:
|
|||
{
|
||||
}
|
||||
else if (!nd_record_v_no_space) {
|
||||
array<newmenu_item, 1> m{
|
||||
array<newmenu_item, 1> m{{
|
||||
nm_item_input(filename),
|
||||
};
|
||||
}};
|
||||
exit = newmenu_do( NULL, TXT_SAVE_DEMO_AS, m, unused_newmenu_subfunction, unused_newmenu_userdata );
|
||||
} else if (nd_record_v_no_space == 2) {
|
||||
array<newmenu_item, 2> m{
|
||||
array<newmenu_item, 2> m{{
|
||||
nm_item_text(TXT_DEMO_SAVE_NOSPACE),
|
||||
nm_item_input(filename),
|
||||
};
|
||||
}};
|
||||
exit = newmenu_do( NULL, NULL, m, unused_newmenu_subfunction, unused_newmenu_userdata );
|
||||
}
|
||||
Newmenu_allowed_chars = NULL;
|
||||
|
|
|
@ -513,17 +513,7 @@ static int newmenu_save_selection_handler(newmenu *menu, const d_event &event, c
|
|||
// Basically the same as do2 but sets reorderitems flag for weapon priority menu a bit redundant to get lose of a global variable but oh well...
|
||||
void newmenu_doreorder( const char * title, const char * subtitle, uint_fast32_t nitems, newmenu_item * item)
|
||||
{
|
||||
newmenu *menu;
|
||||
window *wind;
|
||||
menu = newmenu_do3( title, subtitle, nitems, item, newmenu_save_selection_handler, unused_newmenu_userdata, 0, NULL );
|
||||
if (!menu)
|
||||
return;
|
||||
wind = menu->wind; // avoid dereferencing a freed 'menu'
|
||||
|
||||
// newmenu_do2 and simpler get their own event loop
|
||||
// This is so the caller doesn't have to provide a callback that responds to EVENT_NEWMENU_SELECTED
|
||||
while (window_exists(wind))
|
||||
event_process();
|
||||
newmenu_do2(title, subtitle, nitems, item, newmenu_save_selection_handler, unused_newmenu_userdata, 0, nullptr);
|
||||
}
|
||||
|
||||
#ifdef NEWMENU_MOUSE
|
||||
|
|
|
@ -128,29 +128,6 @@ int print_object_info = 0;
|
|||
|
||||
//--unused-- int Player_controller_type = 0;
|
||||
|
||||
#if defined(EDITOR) || !defined(NDEBUG)
|
||||
const array<array<char, 9>, MAX_OBJECT_TYPES> Object_type_names{{
|
||||
"WALL ",
|
||||
"FIREBALL",
|
||||
"ROBOT ",
|
||||
"HOSTAGE ",
|
||||
"PLAYER ",
|
||||
"WEAPON ",
|
||||
"CAMERA ",
|
||||
"POWERUP ",
|
||||
"DEBRIS ",
|
||||
"CNTRLCEN",
|
||||
"FLARE ",
|
||||
"CLUTTER ",
|
||||
"GHOST ",
|
||||
"LIGHT ",
|
||||
"COOP ",
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
"MARKER ",
|
||||
#endif
|
||||
}};
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE
|
||||
//set viewer object to next object in array
|
||||
void object_goto_next_viewer()
|
||||
|
@ -823,7 +800,7 @@ void init_player_object()
|
|||
set_player_id(ConsoleObject, 0); //no sub-types for player
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
ConsoleObject->signature = 0; //player has zero, others start at 1
|
||||
ConsoleObject->signature = object_signature_t{0}; //player has zero, others start at 1
|
||||
#endif
|
||||
ConsoleObject->size = Polygon_models[Player_ship->model_num].rad;
|
||||
|
||||
|
@ -920,7 +897,7 @@ void obj_unlink(const vobjptridx_t obj)
|
|||
}
|
||||
|
||||
// Returns a new, unique signature for a new object
|
||||
int obj_get_signature()
|
||||
object_signature_t obj_get_signature()
|
||||
{
|
||||
static short sig = 0; // Yes! Short! a) We do not need higher values b) the demo system only stores shorts
|
||||
uint_fast32_t lsig = sig;
|
||||
|
@ -930,12 +907,12 @@ int obj_get_signature()
|
|||
lsig = 0;
|
||||
++ lsig;
|
||||
const auto predicate = [lsig](const vcobjptridx_t &o) {
|
||||
return o->type != OBJ_NONE && o->signature == lsig;
|
||||
return o->type != OBJ_NONE && o->signature.get() == lsig;
|
||||
};
|
||||
if (std::find_if(range.begin(), range.end(), predicate) != range.end())
|
||||
continue;
|
||||
sig = static_cast<int16_t>(lsig);
|
||||
return static_cast<int32_t>(lsig);
|
||||
return object_signature_t{static_cast<uint16_t>(lsig)};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1256,8 +1233,6 @@ void obj_delete(const vobjptridx_t obj)
|
|||
Assert(Objects[0].next != 0);
|
||||
DXX_MAKE_MEM_UNDEFINED(&*obj, sizeof(*obj));
|
||||
obj->type = OBJ_NONE; //unused!
|
||||
obj->signature = -1;
|
||||
|
||||
obj_free(obj);
|
||||
}
|
||||
|
||||
|
@ -1698,7 +1673,7 @@ static void object_move_one(const vobjptridx_t obj)
|
|||
|
||||
default:
|
||||
|
||||
Error("Unknown control type %d in object %i, sig/type/id = %i/%i/%i",obj->control_type, (int)(obj), obj->signature, obj->type, obj->id);
|
||||
Error("Unknown control type %d in object %i, sig/type/id = %i/%i/%i",obj->control_type, (int)(obj), obj->signature.get(), obj->type, obj->id);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -1095,12 +1095,16 @@ static bool compare_func(const render_compare_context_t &c, const render_state_t
|
|||
//the afterburner blobs, though.
|
||||
|
||||
if (obj_a->type == OBJ_WEAPON || (obj_a->type == OBJ_FIREBALL && obj_a->id != VCLIP_AFTERBURNER_BLOB))
|
||||
{
|
||||
if (!(obj_b->type == OBJ_WEAPON || obj_b->type == OBJ_FIREBALL))
|
||||
return true; //a is weapon, b is not, so say a is closer
|
||||
else; //both are weapons
|
||||
//both are weapons
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj_b->type == OBJ_WEAPON || (obj_b->type == OBJ_FIREBALL && obj_b->id != VCLIP_AFTERBURNER_BLOB))
|
||||
return false; //b is weapon, a is not, so say a is farther
|
||||
}
|
||||
|
||||
//no special case, fall through to normal return
|
||||
}
|
||||
|
|
|
@ -239,10 +239,10 @@ void scores_maybe_add_player(int abort_flag)
|
|||
} else {
|
||||
if ( position==0 ) {
|
||||
array<char, COOL_MESSAGE_LEN+10> text1{};
|
||||
array<newmenu_item, 2> m{
|
||||
array<newmenu_item, 2> m{{
|
||||
nm_item_text(TXT_COOL_SAYING),
|
||||
nm_item_input(text1),
|
||||
};
|
||||
}};
|
||||
newmenu_do( TXT_HIGH_SCORE, TXT_YOU_PLACED_1ST, m, unused_newmenu_subfunction, unused_newmenu_userdata );
|
||||
strncpy( scores.cool_saying, text1.data(), COOL_MESSAGE_LEN );
|
||||
if (strlen(scores.cool_saying)<1)
|
||||
|
|
|
@ -122,7 +122,7 @@ unsigned state_game_id;
|
|||
// turn object to object_rw to be saved to Savegame.
|
||||
static void state_object_to_object_rw(const vcobjptr_t obj, object_rw *obj_rw)
|
||||
{
|
||||
obj_rw->signature = obj->signature;
|
||||
obj_rw->signature = obj->signature.get();
|
||||
obj_rw->type = obj->type;
|
||||
obj_rw->id = obj->id;
|
||||
obj_rw->next = obj->next;
|
||||
|
@ -189,7 +189,7 @@ static void state_object_to_object_rw(const vcobjptr_t obj, object_rw *obj_rw)
|
|||
case CT_WEAPON:
|
||||
obj_rw->ctype.laser_info.parent_type = obj->ctype.laser_info.parent_type;
|
||||
obj_rw->ctype.laser_info.parent_num = obj->ctype.laser_info.parent_num;
|
||||
obj_rw->ctype.laser_info.parent_signature = obj->ctype.laser_info.parent_signature;
|
||||
obj_rw->ctype.laser_info.parent_signature = obj->ctype.laser_info.parent_signature.get();
|
||||
if (obj->ctype.laser_info.creation_time - GameTime64 < F1_0*(-18000))
|
||||
obj_rw->ctype.laser_info.creation_time = F1_0*(-18000);
|
||||
else
|
||||
|
@ -219,7 +219,7 @@ static void state_object_to_object_rw(const vcobjptr_t obj, object_rw *obj_rw)
|
|||
obj_rw->ctype.ai_info.path_length = obj->ctype.ai_info.path_length;
|
||||
obj_rw->ctype.ai_info.cur_path_index = obj->ctype.ai_info.cur_path_index;
|
||||
obj_rw->ctype.ai_info.danger_laser_num = obj->ctype.ai_info.danger_laser_num;
|
||||
obj_rw->ctype.ai_info.danger_laser_signature = obj->ctype.ai_info.danger_laser_signature;
|
||||
obj_rw->ctype.ai_info.danger_laser_signature = obj->ctype.ai_info.danger_laser_signature.get();
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
obj_rw->ctype.ai_info.follow_path_start_seg = obj->ctype.ai_info.follow_path_start_seg;
|
||||
obj_rw->ctype.ai_info.follow_path_end_seg = obj->ctype.ai_info.follow_path_end_seg;
|
||||
|
@ -289,7 +289,7 @@ static void state_object_to_object_rw(const vcobjptr_t obj, object_rw *obj_rw)
|
|||
// turn object_rw to object after reading from Savegame
|
||||
static void state_object_rw_to_object(object_rw *obj_rw, const vobjptr_t obj)
|
||||
{
|
||||
obj->signature = obj_rw->signature;
|
||||
obj->signature = object_signature_t{static_cast<uint16_t>(obj_rw->signature)};
|
||||
obj->type = obj_rw->type;
|
||||
obj->id = obj_rw->id;
|
||||
obj->next = obj_rw->next;
|
||||
|
@ -356,7 +356,7 @@ static void state_object_rw_to_object(object_rw *obj_rw, const vobjptr_t obj)
|
|||
case CT_WEAPON:
|
||||
obj->ctype.laser_info.parent_type = obj_rw->ctype.laser_info.parent_type;
|
||||
obj->ctype.laser_info.parent_num = obj_rw->ctype.laser_info.parent_num;
|
||||
obj->ctype.laser_info.parent_signature = obj_rw->ctype.laser_info.parent_signature;
|
||||
obj->ctype.laser_info.parent_signature = object_signature_t{static_cast<uint16_t>(obj_rw->ctype.laser_info.parent_signature)};
|
||||
obj->ctype.laser_info.creation_time = obj_rw->ctype.laser_info.creation_time;
|
||||
obj->ctype.laser_info.last_hitobj = obj_rw->ctype.laser_info.last_hitobj;
|
||||
if (obj->ctype.laser_info.last_hitobj != object_none)
|
||||
|
@ -389,7 +389,7 @@ static void state_object_rw_to_object(object_rw *obj_rw, const vobjptr_t obj)
|
|||
obj->ctype.ai_info.path_length = obj_rw->ctype.ai_info.path_length;
|
||||
obj->ctype.ai_info.cur_path_index = obj_rw->ctype.ai_info.cur_path_index;
|
||||
obj->ctype.ai_info.danger_laser_num = obj_rw->ctype.ai_info.danger_laser_num;
|
||||
obj->ctype.ai_info.danger_laser_signature = obj_rw->ctype.ai_info.danger_laser_signature;
|
||||
obj->ctype.ai_info.danger_laser_signature = object_signature_t{static_cast<uint16_t>(obj_rw->ctype.ai_info.danger_laser_signature)};
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
obj->ctype.ai_info.follow_path_start_seg = obj_rw->ctype.ai_info.follow_path_start_seg;
|
||||
obj->ctype.ai_info.follow_path_end_seg = obj_rw->ctype.ai_info.follow_path_end_seg;
|
||||
|
|
|
@ -214,8 +214,8 @@ void load_text()
|
|||
};
|
||||
#endif
|
||||
|
||||
if (GameArg.DbgAltTex)
|
||||
filename = GameArg.DbgAltTex;
|
||||
if (!GameArg.DbgAltTex.empty())
|
||||
filename = GameArg.DbgAltTex.c_str();
|
||||
|
||||
auto tfile = PHYSFSX_openReadBuffered(filename);
|
||||
if (!tfile)
|
||||
|
|
|
@ -297,7 +297,7 @@ void wall_open_door(const vsegptridx_t seg, int side)
|
|||
(w->state == WALL_DOOR_WAITING)) //open, waiting to close
|
||||
return;
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if ((w->state == WALL_DOOR_OPEN)) //open, & staying open
|
||||
if (w->state == WALL_DOOR_OPEN) //open, & staying open
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
#include "net_udp.h"
|
||||
#endif
|
||||
|
||||
#include "compiler-range_for.h"
|
||||
#include "partial_range.h"
|
||||
|
||||
#define MAX_ARGS 1000
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
#define INI_FILENAME "d1x.ini"
|
||||
|
@ -36,39 +39,72 @@
|
|||
#endif
|
||||
|
||||
typedef std::vector<std::string> Arglist;
|
||||
static Arglist Args;
|
||||
|
||||
class ini_entry
|
||||
{
|
||||
std::string m_filename;
|
||||
public:
|
||||
ini_entry(std::string &&f) :
|
||||
m_filename(std::move(f))
|
||||
{
|
||||
}
|
||||
const std::string &filename() const
|
||||
{
|
||||
return m_filename;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<ini_entry> Inilist;
|
||||
|
||||
class argument_exception
|
||||
{
|
||||
public:
|
||||
const char *arg;
|
||||
argument_exception(const char *a) : arg(a) {}
|
||||
const std::string arg;
|
||||
argument_exception(std::string &&a) :
|
||||
arg(std::move(a))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class missing_parameter : public argument_exception
|
||||
{
|
||||
public:
|
||||
missing_parameter(const char *a) : argument_exception(a) {}
|
||||
missing_parameter(std::string &&a) :
|
||||
argument_exception(std::move(a))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class unhandled_argument : public argument_exception
|
||||
{
|
||||
public:
|
||||
unhandled_argument(const char *a) : argument_exception(a) {}
|
||||
unhandled_argument(std::string &&a) :
|
||||
argument_exception(std::move(a))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class conversion_failure : public argument_exception
|
||||
{
|
||||
public:
|
||||
const char *value;
|
||||
conversion_failure(const char *a, const char *v) : argument_exception(a), value(v) {}
|
||||
const std::string value;
|
||||
conversion_failure(std::string &&a, std::string &&v) :
|
||||
argument_exception(std::move(a)), value(std::move(v))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class nesting_depth_exceeded
|
||||
{
|
||||
};
|
||||
|
||||
struct Arg GameArg;
|
||||
|
||||
static void AppendIniArgs(void)
|
||||
static void ReadCmdArgs(Inilist &ini, Arglist &Args);
|
||||
|
||||
static void AppendIniArgs(const char *filename, Arglist &Args)
|
||||
{
|
||||
if (auto f = PHYSFSX_openReadBuffered(INI_FILENAME))
|
||||
if (auto f = PHYSFSX_openReadBuffered(filename))
|
||||
{
|
||||
PHYSFSX_gets_line_t<1024> line;
|
||||
while(!PHYSFS_eof(f) && Args.size() < MAX_ARGS && PHYSFSX_fgets(line, f))
|
||||
|
@ -84,38 +120,38 @@ static void AppendIniArgs(void)
|
|||
}
|
||||
}
|
||||
|
||||
static const char *arg_string(Arglist::const_iterator &pp, Arglist::const_iterator end)
|
||||
static std::string &&arg_string(Arglist::iterator &pp, Arglist::const_iterator end)
|
||||
{
|
||||
Arglist::const_iterator arg = pp;
|
||||
auto arg = pp;
|
||||
if (++pp == end)
|
||||
throw missing_parameter(arg->c_str());
|
||||
return pp->c_str();
|
||||
throw missing_parameter(std::move(*arg));
|
||||
return std::move(*pp);
|
||||
}
|
||||
|
||||
static long arg_integer(Arglist::const_iterator &pp, Arglist::const_iterator end)
|
||||
static long arg_integer(Arglist::iterator &pp, Arglist::const_iterator end)
|
||||
{
|
||||
Arglist::const_iterator arg = pp;
|
||||
const char *value = arg_string(pp, end);
|
||||
auto arg = pp;
|
||||
auto &&value = arg_string(pp, end);
|
||||
char *p;
|
||||
long i = strtol(value, &p, 10);
|
||||
auto i = strtol(value.c_str(), &p, 10);
|
||||
if (*p)
|
||||
throw conversion_failure(arg->c_str(), value);
|
||||
throw conversion_failure(std::move(*arg), std::move(value));
|
||||
return i;
|
||||
}
|
||||
|
||||
template<typename E> E arg_enum(Arglist::const_iterator &pp, Arglist::const_iterator end)
|
||||
template<typename E> E arg_enum(Arglist::iterator &pp, Arglist::const_iterator end)
|
||||
{
|
||||
return static_cast<E>(arg_integer(pp, end));
|
||||
}
|
||||
|
||||
static void arg_port_number(Arglist::const_iterator &pp, Arglist::const_iterator end, uint16_t &out, bool allow_privileged)
|
||||
static void arg_port_number(Arglist::iterator &pp, Arglist::const_iterator end, uint16_t &out, bool allow_privileged)
|
||||
{
|
||||
auto port = arg_integer(pp, end);
|
||||
if (static_cast<uint16_t>(port) == port && (allow_privileged || port >= 1024))
|
||||
out = port;
|
||||
}
|
||||
|
||||
static void ReadCmdArgs(void)
|
||||
static void InitGameArg()
|
||||
{
|
||||
GameArg.SysMaxFPS = MAXIMUM_FPS;
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
|
@ -139,7 +175,18 @@ static void ReadCmdArgs(void)
|
|||
GameArg.DbgGlReadPixelsOk = 1;
|
||||
GameArg.DbgGlGetTexLevelParamOk = 1;
|
||||
#endif
|
||||
for (Arglist::const_iterator pp = Args.begin(), end = Args.end(); pp != end; ++pp)
|
||||
}
|
||||
|
||||
static void ReadIniArgs(Inilist &ini)
|
||||
{
|
||||
Arglist Args;
|
||||
AppendIniArgs(ini.back().filename().c_str(), Args);
|
||||
ReadCmdArgs(ini, Args);
|
||||
}
|
||||
|
||||
static void ReadCmdArgs(Inilist &ini, Arglist &Args)
|
||||
{
|
||||
for (Arglist::iterator pp = Args.begin(), end = Args.end(); pp != end; ++pp)
|
||||
{
|
||||
const char *p = pp->c_str();
|
||||
// System Options
|
||||
|
@ -246,15 +293,13 @@ static void ReadCmdArgs(void)
|
|||
/* Always recognized. No-op if tracker support compiled
|
||||
* out. */
|
||||
#ifdef USE_TRACKER
|
||||
GameArg.MplTrackerAddr = nullptr;
|
||||
GameArg.MplTrackerAddr.clear();
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_TRACKER
|
||||
else if (!d_stricmp(p, "-tracker_hostaddr"))
|
||||
{
|
||||
GameArg.MplTrackerAddr = arg_string(pp, end);
|
||||
if (!*GameArg.MplTrackerAddr)
|
||||
GameArg.MplTrackerAddr = nullptr;
|
||||
}
|
||||
else if (!d_stricmp(p, "-tracker_hostport"))
|
||||
arg_port_number(pp, end, GameArg.MplTrackerPort, true);
|
||||
|
@ -324,10 +369,21 @@ static void ReadCmdArgs(void)
|
|||
else if (!d_stricmp(p, "-asyncblit"))
|
||||
GameArg.DbgSdlASyncBlit = 1;
|
||||
#endif
|
||||
else if (!d_stricmp(p, "-ini"))
|
||||
{
|
||||
ini.emplace_back(arg_string(pp, end));
|
||||
if (ini.size() > 10)
|
||||
throw nesting_depth_exceeded();
|
||||
ReadIniArgs(ini);
|
||||
ini.pop_back();
|
||||
}
|
||||
else
|
||||
throw unhandled_argument(p);
|
||||
throw unhandled_argument(std::move(*pp));
|
||||
}
|
||||
}
|
||||
|
||||
static void PostProcessGameArg()
|
||||
{
|
||||
if (GameArg.SysMaxFPS < MINIMUM_FPS)
|
||||
GameArg.SysMaxFPS = MINIMUM_FPS;
|
||||
else if (GameArg.SysMaxFPS > MAXIMUM_FPS)
|
||||
|
@ -339,26 +395,51 @@ static void ReadCmdArgs(void)
|
|||
SDL_putenv(sdl_disable_lock_keys);
|
||||
}
|
||||
|
||||
void args_exit(void)
|
||||
static std::string ConstructIniStackExplanation(const Inilist &ini)
|
||||
{
|
||||
Args.clear();
|
||||
Inilist::const_reverse_iterator i = ini.rbegin(), e = ini.rend();
|
||||
if (i == e)
|
||||
return " while processing <command line>";
|
||||
std::string result;
|
||||
result.reserve(ini.size() * 128);
|
||||
result += " while processing \"";
|
||||
for (;;)
|
||||
{
|
||||
result += i->filename();
|
||||
if (++ i == e)
|
||||
return result += "\"";
|
||||
result += "\"\n included from \"";
|
||||
}
|
||||
}
|
||||
|
||||
bool InitArgs( int argc,char **argv )
|
||||
{
|
||||
for (int i=1; i < argc; i++ )
|
||||
Args.push_back(argv[i]);
|
||||
InitGameArg();
|
||||
|
||||
AppendIniArgs();
|
||||
Inilist ini;
|
||||
try {
|
||||
ReadCmdArgs();
|
||||
{
|
||||
Arglist Args;
|
||||
Args.reserve(argc);
|
||||
range_for (auto &i, unchecked_partial_range(argv, 1u, static_cast<unsigned>(argc)))
|
||||
Args.push_back(i);
|
||||
ReadCmdArgs(ini, Args);
|
||||
}
|
||||
{
|
||||
assert(ini.empty());
|
||||
ini.emplace_back(INI_FILENAME);
|
||||
ReadIniArgs(ini);
|
||||
}
|
||||
PostProcessGameArg();
|
||||
return true;
|
||||
} catch(const missing_parameter& e) {
|
||||
Warning("Missing parameter for argument \"%s\"", e.arg);
|
||||
Warning("Missing parameter for argument \"%s\"%s", e.arg.c_str(), ConstructIniStackExplanation(ini).c_str());
|
||||
} catch(const unhandled_argument& e) {
|
||||
Warning("Unhandled argument \"%s\"", e.arg);
|
||||
Warning("Unhandled argument \"%s\"%s", e.arg.c_str(), ConstructIniStackExplanation(ini).c_str());
|
||||
} catch(const conversion_failure& e) {
|
||||
Warning("Failed to convert parameter \"%s\" for argument \"%s\"", e.value, e.arg);
|
||||
Warning("Failed to convert argument \"%s\" parameter \"%s\"%s", e.arg.c_str(), e.value.c_str(), ConstructIniStackExplanation(ini).c_str());
|
||||
} catch(const nesting_depth_exceeded &) {
|
||||
Warning("Nesting depth exceeded%s", ConstructIniStackExplanation(ini).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "poison.h"
|
||||
|
||||
const array<file_extension_t, 1> archive_exts{"dxa"};
|
||||
const array<file_extension_t, 1> archive_exts{{"dxa"}};
|
||||
|
||||
char *PHYSFSX_fgets_t::get(char *const buf, std::size_t n, PHYSFS_file *const fp)
|
||||
{
|
||||
|
@ -193,10 +193,10 @@ bool PHYSFSX_init(int argc, char *argv[])
|
|||
}
|
||||
|
||||
//tell PHYSFS where hogdir is
|
||||
if (GameArg.SysHogDir)
|
||||
if (!GameArg.SysHogDir.empty())
|
||||
{
|
||||
con_printf(CON_DEBUG, "PHYSFS: append argument hog directory \"%s\" to search path", GameArg.SysHogDir);
|
||||
PHYSFS_addToSearchPath(GameArg.SysHogDir,1);
|
||||
con_printf(CON_DEBUG, "PHYSFS: append argument hog directory \"%s\" to search path", GameArg.SysHogDir.c_str());
|
||||
PHYSFS_addToSearchPath(GameArg.SysHogDir.c_str(),1);
|
||||
}
|
||||
#if defined(__unix__)
|
||||
else if (!GameArg.SysNoHogDir)
|
||||
|
|
Loading…
Reference in a new issue