From 92b66ec50296bc525fbe7d993a99a8a8bcff5cb0 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Fri, 14 Feb 2014 06:07:43 -0500 Subject: [PATCH] get rid of some platform specific stuff - use some SDL string functions - clean out typedef's for windows specific stuff - swap Assert() for SDL_assert() - have Int3() trigger SDL breakpoint - use cross-platform mul_div() - use SDL sized types for fix/ushort/uint/etc. --- include/2d.h | 2 +- include/gamesnd.h | 2 +- include/line.h | 2 +- include/missioncampaign.h | 2 +- include/multimsgs.h | 18 +- include/object.h | 2 +- include/osapi.h | 11 - include/pstypes.h | 90 +--- include/supernova.h | 2 +- include/unix.h | 67 +-- src/ac/convert.cpp | 48 +- src/anim/animplay.cpp | 56 +- src/anim/packunpack.cpp | 38 +- src/asteroid/asteroid.cpp | 52 +- src/bmpman/bmpman.cpp | 134 ++--- src/cfile/cfile.cpp | 132 ++--- src/cfile/cfilearchive.cpp | 54 +- src/cfile/cfilelist.cpp | 4 +- src/cfile/cfilesystem.cpp | 42 +- src/cfilearchiver/cfilearchiver.cpp | 4 +- src/cmdline/cmdline.cpp | 8 +- src/cmeasure/cmeasure.cpp | 18 +- src/controlconfig/controlsconfig.cpp | 36 +- src/controlconfig/controlsconfigcommon.cpp | 10 +- src/cutscene/cutscenes.cpp | 10 +- src/debris/debris.cpp | 32 +- src/debugconsole/console.cpp | 20 +- src/demo/demo.cpp | 6 +- src/fireball/fireballs.cpp | 26 +- src/fonttool/fontkern.cpp | 4 +- src/fred2/asteroideditordlg.cpp | 2 +- src/fred2/bgbitmapdlg.cpp | 14 +- src/fred2/briefingeditordlg.cpp | 8 +- src/fred2/campaigneditordlg.cpp | 10 +- src/fred2/campaigntreeview.cpp | 30 +- src/fred2/cmdbrief.cpp | 2 +- src/fred2/debriefingeditordlg.cpp | 2 +- src/fred2/eventeditor.cpp | 24 +- src/fred2/fred.cpp | 12 +- src/fred2/freddoc.cpp | 10 +- src/fred2/fredrender.cpp | 16 +- src/fred2/fredview.cpp | 66 +-- src/fred2/ignoreordersdlg.cpp | 2 +- src/fred2/initialstatus.cpp | 18 +- src/fred2/mainfrm.cpp | 4 +- src/fred2/management.cpp | 70 +-- src/fred2/messageeditordlg.cpp | 12 +- src/fred2/missiongoalsdlg.cpp | 18 +- src/fred2/missionsave.cpp | 26 +- src/fred2/modifyvariabledlg.cpp | 2 +- src/fred2/orienteditor.cpp | 6 +- src/fred2/reinforcementeditordlg.cpp | 6 +- src/fred2/sexp_tree.cpp | 288 +++++----- src/fred2/shieldsysdlg.cpp | 4 +- src/fred2/ship_select.cpp | 2 +- src/fred2/shipeditordlg.cpp | 28 +- src/fred2/shipgoalsdlg.cpp | 26 +- src/fred2/shipspecialdamage.cpp | 2 +- src/fred2/textviewdlg.cpp | 2 +- src/fred2/waypointpathdlg.cpp | 4 +- src/fred2/weaponeditordlg.cpp | 2 +- src/fred2/wing.cpp | 34 +- src/fred2/wing_editor.cpp | 4 +- src/freespace2/freespace.cpp | 80 +-- src/gamehelp/contexthelp.cpp | 12 +- src/gamesequence/gamesequence.cpp | 18 +- src/gamesnd/eventmusic.cpp | 48 +- src/gamesnd/gamesnd.cpp | 12 +- src/globalincs/systemvars.cpp | 6 +- src/globalincs/windebug.cpp | 17 +- src/graphics/2d.cpp | 12 +- src/graphics/aaline.cpp | 8 +- src/graphics/bitblt.cpp | 56 +- src/graphics/colors.cpp | 20 +- src/graphics/font.cpp | 18 +- src/graphics/grd3d.cpp | 10 +- src/graphics/grd3drender.cpp | 62 +-- src/graphics/grd3dtexture.cpp | 8 +- src/graphics/grdirectdraw.cpp | 2 +- src/graphics/grglide.cpp | 70 +-- src/graphics/grglidetexture.cpp | 8 +- src/graphics/gropengl.cpp | 50 +- src/graphics/grsoft.cpp | 14 +- src/graphics/scaler.cpp | 2 +- src/graphics/tmapgenericscans.cpp | 32 +- src/graphics/tmapper.cpp | 12 +- src/graphics/tmapscantiled16x16.cpp | 32 +- src/graphics/tmapscantiled32x32.cpp | 32 +- src/graphics/tmapscantiled64x64.cpp | 32 +- src/hud/hud.cpp | 42 +- src/hud/hudartillery.cpp | 6 +- src/hud/hudbrackets.cpp | 16 +- src/hud/hudconfig.cpp | 12 +- src/hud/hudescort.cpp | 18 +- src/hud/hudets.cpp | 12 +- src/hud/hudlock.cpp | 16 +- src/hud/hudmessage.cpp | 16 +- src/hud/hudobserver.cpp | 2 +- src/hud/hudreticle.cpp | 4 +- src/hud/hudshield.cpp | 36 +- src/hud/hudsquadmsg.cpp | 138 ++--- src/hud/hudtarget.cpp | 84 +-- src/hud/hudtargetbox.cpp | 40 +- src/hud/hudwingmanstatus.cpp | 28 +- src/inetfile/cftp.cpp | 2 +- src/inetfile/chttpget.cpp | 6 +- src/io/joy.cpp | 2 +- src/io/key.cpp | 30 +- src/io/keycontrol.cpp | 38 +- src/io/mouse.cpp | 2 +- src/io/timer.cpp | 6 +- src/jumpnode/jumpnode.cpp | 2 +- src/lighting/lighting.cpp | 14 +- src/localization/fhash.cpp | 10 +- src/localization/localize.cpp | 198 +++---- src/math/fix.cpp | 8 +- src/math/fvi.cpp | 24 +- src/math/spline.cpp | 8 +- src/math/vecmat.cpp | 68 +-- src/menuui/barracks.cpp | 58 +- src/menuui/credits.cpp | 2 +- src/menuui/mainhallmenu.cpp | 8 +- src/menuui/mainhalltemp.cpp | 2 +- src/menuui/optionsmenu.cpp | 10 +- src/menuui/optionsmenumulti.cpp | 14 +- src/menuui/playermenu.cpp | 8 +- src/menuui/readyroom.cpp | 26 +- src/menuui/snazzyui.cpp | 8 +- src/menuui/techmenu.cpp | 12 +- src/mission/missionbriefcommon.cpp | 68 +-- src/mission/missioncampaign.cpp | 84 +-- src/mission/missiongoals.cpp | 18 +- src/mission/missiongrid.cpp | 14 +- src/mission/missionhotkey.cpp | 20 +- src/mission/missionload.cpp | 18 +- src/mission/missionlog.cpp | 38 +- src/mission/missionmessage.cpp | 58 +- src/mission/missionparse.cpp | 256 ++++----- src/mission/missiontraining.cpp | 34 +- src/missionui/chatbox.cpp | 8 +- src/missionui/missionbrief.cpp | 28 +- src/missionui/missioncmdbrief.cpp | 10 +- src/missionui/missiondebrief.cpp | 58 +- src/missionui/missionloopbrief.cpp | 2 +- src/missionui/missionpause.cpp | 2 +- src/missionui/missionscreencommon.cpp | 26 +- src/missionui/missionshipchoice.cpp | 80 +-- src/missionui/missionweaponchoice.cpp | 66 +-- src/missionui/redalert.cpp | 16 +- src/model/modelcollide.cpp | 18 +- src/model/modelinterp.cpp | 32 +- src/model/modeloctant.cpp | 12 +- src/model/modelread.cpp | 234 ++++----- src/movie/mvelib.cpp | 4 +- src/movie/mveplayer.cpp | 6 +- src/nebedit/nebedit.cpp | 6 +- src/nebula/neb.cpp | 12 +- src/nebula/neblightning.cpp | 8 +- src/network/multi.cpp | 10 +- src/network/multi_campaign.cpp | 24 +- src/network/multi_data.cpp | 4 +- src/network/multi_dogfight.cpp | 10 +- src/network/multi_ingame.cpp | 44 +- src/network/multi_kick.cpp | 4 +- src/network/multi_obj.cpp | 22 +- src/network/multi_observer.cpp | 6 +- src/network/multi_oo.cpp | 44 +- src/network/multi_options.cpp | 12 +- src/network/multi_pause.cpp | 8 +- src/network/multi_pinfo.cpp | 4 +- src/network/multi_pmsg.cpp | 6 +- src/network/multi_rate.cpp | 2 +- src/network/multi_respawn.cpp | 42 +- src/network/multi_team.cpp | 20 +- src/network/multi_voice.cpp | 36 +- src/network/multi_xfer.cpp | 16 +- src/network/multilag.cpp | 14 +- src/network/multimsgs.cpp | 326 ++++++------ src/network/multiteamselect.cpp | 54 +- src/network/multiui.cpp | 52 +- src/network/multiutil.cpp | 84 +-- src/network/psnet.cpp | 48 +- src/network/psnet2.cpp | 58 +- src/network/stand_gui.cpp | 10 +- src/object/collidedebrisship.cpp | 8 +- src/object/collidedebrisweapon.cpp | 8 +- src/object/collideshipship.cpp | 36 +- src/object/collideshipweapon.cpp | 16 +- src/object/collideweaponweapon.cpp | 4 +- src/object/objcollide.cpp | 18 +- src/object/object.cpp | 40 +- src/object/objectsnd.cpp | 28 +- src/observer/observer.cpp | 2 +- src/osapi/osapi.cpp | 8 +- src/osapi/outwnd.cpp | 16 +- src/palman/palman.cpp | 6 +- src/parse/parselo.cpp | 96 ++-- src/parse/sexp.cpp | 424 +++++++-------- src/particle/particle.cpp | 6 +- src/pcxutils/pcxutils.cpp | 24 +- src/physics/physics.cpp | 18 +- src/platform/unix.cpp | 55 -- src/playerman/managepilot.cpp | 32 +- src/playerman/playercontrol.cpp | 40 +- src/pofview/pofview.cpp | 8 +- src/popup/popup.cpp | 20 +- src/popup/popupdead.cpp | 6 +- src/radar/radar.cpp | 2 +- src/render/3dclipper.cpp | 2 +- src/render/3ddraw.cpp | 36 +- src/render/3dlaser.cpp | 4 +- src/render/3dmath.cpp | 14 +- src/render/3dsetup.cpp | 24 +- src/ship/afterburner.cpp | 24 +- src/ship/ai.cpp | 14 +- src/ship/aibig.cpp | 42 +- src/ship/aicode.cpp | 584 ++++++++++----------- src/ship/aigoals.cpp | 76 +-- src/ship/awacs.cpp | 4 +- src/ship/shield.cpp | 34 +- src/ship/ship.cpp | 394 +++++++------- src/ship/shipcontrails.cpp | 22 +- src/ship/shipfx.cpp | 54 +- src/ship/shiphit.cpp | 56 +- src/sound/audiostr.cpp | 2 +- src/sound/rtvoice.cpp | 18 +- src/sound/sound.cpp | 24 +- src/starfield/nebula.cpp | 8 +- src/starfield/starfield.cpp | 36 +- src/starfield/supernova.cpp | 10 +- src/stats/medals.cpp | 12 +- src/stats/scoring.cpp | 20 +- src/tgautils/tgautils.cpp | 26 +- src/ui/gadget.cpp | 2 +- src/ui/inputbox.cpp | 6 +- src/ui/listbox.cpp | 2 +- src/ui/scroll.cpp | 2 +- src/ui/slider.cpp | 14 +- src/ui/slider2.cpp | 12 +- src/ui/window.cpp | 18 +- src/weapon/beam.cpp | 172 +++--- src/weapon/corkscrew.cpp | 16 +- src/weapon/emp.cpp | 24 +- src/weapon/flak.cpp | 38 +- src/weapon/muzzleflash.cpp | 10 +- src/weapon/shockwave.cpp | 20 +- src/weapon/swarm.cpp | 38 +- src/weapon/trails.cpp | 4 +- src/weapon/weapons.cpp | 174 +++--- 249 files changed, 4203 insertions(+), 4403 deletions(-) diff --git a/include/2d.h b/include/2d.h index 3b94e2d..fcb4900 100644 --- a/include/2d.h +++ b/include/2d.h @@ -609,7 +609,7 @@ int gr_init_font( const char * typeface ); // Does formatted printing. This calls gr_string after formatting, // so if you don't need to format the string, then call gr_string // directly. -extern void _cdecl gr_printf( int x, int y, const char * format, ... ); +extern void __cdecl gr_printf( int x, int y, const char * format, ... ); // Returns the size of the string in pixels in w and h extern void gr_get_string_size( int *w, int *h, const char * text, int len = 9999 ); diff --git a/include/gamesnd.h b/include/gamesnd.h index e5ae578..233b4c6 100644 --- a/include/gamesnd.h +++ b/include/gamesnd.h @@ -27,7 +27,7 @@ * not to get paged out for the current mission. * * 14 9/09/99 11:40p Dave - * Handle an Assert() in beam code. Added supernova sounds. Play the right + * Handle an SDL_assert() in beam code. Added supernova sounds. Play the right * 2 end movies properly, based upon what the player did in the mission. * * 13 8/27/99 11:59a Jefff diff --git a/include/line.h b/include/line.h index 509438a..d1ef07b 100644 --- a/include/line.h +++ b/include/line.h @@ -74,7 +74,7 @@ void gr8_aaline(vertex *v1, vertex *v2); } while(0) //#define INT_SCALE(var,arg,num,den) ((var) = ((arg) * (num)) / (den)) -#define INT_SCALE(var,arg,num,den) ((var) = MulDiv(arg, num, den)) +#define INT_SCALE(var,arg,num,den) ((var) = mul_div(arg, num, den)) #define INT_CLIPLINE(x1,y1,x2,y2,XMIN,YMIN,XMAX,YMAX,WHEN_OUTSIDE,WHEN_CLIPPED,WHEN_SWAPPED) do { \ int temp; \ diff --git a/include/missioncampaign.h b/include/missioncampaign.h index 02b3d62..da6caff 100644 --- a/include/missioncampaign.h +++ b/include/missioncampaign.h @@ -32,7 +32,7 @@ * Changes for OEM * * 15 9/09/99 11:40p Dave - * Handle an Assert() in beam code. Added supernova sounds. Play the right + * Handle an SDL_assert() in beam code. Added supernova sounds. Play the right * 2 end movies properly, based upon what the player did in the mission. * * 14 9/07/99 6:55p Jefff diff --git a/include/multimsgs.h b/include/multimsgs.h index c0c79c7..9c37c0d 100644 --- a/include/multimsgs.h +++ b/include/multimsgs.h @@ -251,21 +251,21 @@ struct ship_subsys; // 16 bits, otherwise 32 bits is the default #define BUILD_HEADER(t) do { data[0]=t; packet_size = HEADER_LENGTH; } while(0) -#define ADD_DATA(d) do { Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); memcpy(data+packet_size, &d, sizeof(d) ); packet_size += sizeof(d); } while (0) -#define ADD_SHORT(d) do { Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); short swap = INTEL_SHORT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) -#define ADD_USHORT(d) do { Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); ushort swap = INTEL_SHORT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) -#define ADD_INT(d) do { Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); int swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) -#define ADD_UINT(d) do { Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); uint swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) -#define ADD_FLOAT(d) do { Assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); float swap = INTEL_FLOAT(&d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) -#define ADD_STRING(s) do { Assert((packet_size + strlen(s) + 4) < MAX_PACKET_SIZE);int len = strlen(s); int len_tmp = INTEL_INT(len); ADD_DATA(len_tmp); memcpy(data+packet_size, s, len ); packet_size += len; } while(0) -#define ADD_ORIENT(d) { Assert((packet_size + 17) < MAX_PACKET_SIZE); ubyte dt[17]; multi_pack_orient_matrix(dt,&d); memcpy(data+packet_size,dt,17); packet_size += 17; } +#define ADD_DATA(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); memcpy(data+packet_size, &d, sizeof(d) ); packet_size += sizeof(d); } while (0) +#define ADD_SHORT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); short swap = INTEL_SHORT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) +#define ADD_USHORT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); ushort swap = INTEL_SHORT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) +#define ADD_INT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); int swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) +#define ADD_UINT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); uint swap = INTEL_INT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) +#define ADD_FLOAT(d) do { SDL_assert((packet_size + sizeof(d)) < MAX_PACKET_SIZE); float swap = INTEL_FLOAT(d); memcpy(data+packet_size, &swap, sizeof(d) ); packet_size += sizeof(d); } while (0) +#define ADD_STRING(s) do { SDL_assert((packet_size + strlen(s) + 4) < MAX_PACKET_SIZE);int len = strlen(s); int len_tmp = INTEL_INT(len); ADD_DATA(len_tmp); memcpy(data+packet_size, s, len ); packet_size += len; } while(0) +#define ADD_ORIENT(d) { SDL_assert((packet_size + 17) < MAX_PACKET_SIZE); ubyte dt[17]; multi_pack_orient_matrix(dt,&d); memcpy(data+packet_size,dt,17); packet_size += 17; } #define GET_DATA(d) do { memcpy(&d, data+offset, sizeof(d) ); offset += sizeof(d); } while(0) #define GET_SHORT(d) do { short swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_SHORT(swap); offset += sizeof(d); } while(0) #define GET_USHORT(d) do { ushort swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_SHORT(swap); offset += sizeof(d); } while(0) #define GET_INT(d) do { int swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_INT(swap); offset += sizeof(d); } while(0) #define GET_UINT(d) do { uint swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_INT(swap); offset += sizeof(d); } while(0) -#define GET_FLOAT(d) do { float swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_FLOAT(&swap); offset += sizeof(d); } while(0) +#define GET_FLOAT(d) do { float swap; memcpy(&swap, data+offset, sizeof(d) ); d = INTEL_FLOAT(swap); offset += sizeof(d); } while(0) #define GET_STRING(s) do { int len; memcpy(&len, data+offset, sizeof(len)); len = INTEL_INT(len); offset += sizeof(len); memcpy(s, data+offset, len); offset += len; s[len] = '\0'; } while(0) #define GET_ORIENT(d) { ubyte dt[17]; memcpy(dt,data+offset,17); offset+=17; multi_unpack_orient_matrix(dt,&d); } diff --git a/include/object.h b/include/object.h index 000037a..492e693 100644 --- a/include/object.h +++ b/include/object.h @@ -392,7 +392,7 @@ extern const char *Object_type_names[MAX_OBJECT_TYPES]; // {Put a call to this in OBJECT.C, function obj_delete_all_that_should_be_dead } // WARNING: To kill an object, set it's OF_SHOULD_BE_DEAD flag. Then, // this function will get called when it's time to clean up the data. -// Assert( obj->flags & OF_SHOULD_BE_DEAD ); +// SDL_assert( obj->flags & OF_SHOULD_BE_DEAD ); // ... // ... Free up all weapon-specfic data // obj_delete(objnum); diff --git a/include/osapi.h b/include/osapi.h index f2c3cd8..4dd0337 100644 --- a/include/osapi.h +++ b/include/osapi.h @@ -20,17 +20,6 @@ // set if running under MsDev - done after os_init(...) has returned extern int Os_debugger_running; -// game-wide -// #define THREADED - -#ifdef THREADED - #define ENTER_CRITICAL_SECTION(csc) do { EnterCriticalSection(csc); } while(0); - #define LEAVE_CRITICAL_SECTION(csc) do { LeaveCriticalSection(csc); } while(0); -#else - #define ENTER_CRITICAL_SECTION(csc) do { } while(0); - #define LEAVE_CRITICAL_SECTION(csc) do { } while(0); -#endif - // -------------------------------------------------------------------------------------------------- // OSAPI FUNCTIONS // diff --git a/include/pstypes.h b/include/pstypes.h index 8731b6a..7544ea0 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -205,7 +205,7 @@ * make Int3's do nothing when InterplayQA is defined * * 65 4/25/98 11:55p Lawrance - * compile out Int3() and Assert() for release demo build + * compile out Int3() and SDL_assert() for release demo build * * * $NoKeywords: $ @@ -253,6 +253,8 @@ #pragma warning(disable: 4127 4100 4514 4201 4410 4611 4725 4710 4711 4702 4201 4390) #endif +#include "SDL.h" + #include // For NULL, etc #include #include @@ -283,21 +285,19 @@ #define LOCAL static // make module local varilable static. -typedef __int64 longlong; -typedef long fix; -typedef unsigned char ubyte; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong; -typedef int fs_time_t; // forced 32-bit version of time_t - **don't use this unless required** +typedef Sint32 fix; +typedef Uint8 ubyte; +typedef Uint16 ushort; +typedef Uint32 uint; +typedef Sint32 fs_time_t; // forced 32-bit version of time_t - **don't use this unless required** // ptr_? is a value matching the size of a pointer on this specific platform #if ( defined(__x86_64__) || defined(_WIN64) ) -typedef __int64 ptr_s; -typedef unsigned __int64 ptr_u; +typedef Sint64 ptr_s; +typedef Uint64 ptr_u; #else -typedef int ptr_s; -typedef unsigned int ptr_u; +typedef Sint32 ptr_s; +typedef Uint32 ptr_u; #endif #define HARDWARE_ONLY @@ -392,9 +392,8 @@ typedef struct bitmap { } bitmap; //This are defined in MainWin.c -extern void _cdecl WinAssert(const char * text, const char *filename, int line); -extern void _cdecl Error( const char * filename, int line, const char * format, ... ); -extern void _cdecl Warning( const char * filename, int line, const char * format, ... ); +extern void __cdecl Error( const char * filename, int line, const char * format, ... ); +extern void __cdecl Warning( const char * filename, int line, const char * format, ... ); #include "outwnd.h" @@ -416,11 +415,9 @@ extern void _cdecl Warning( const char * filename, int line, const char * format // Error( LOCATION, "Error opening %s", filename ); #if defined(NDEBUG) -#define Assert(x) do {} while (0) #define STUB_FUNCTION #else void gr_activate(int); -#define Assert(x) do { if (!(x)){ gr_activate(0); WinAssert(#x,__FILE__,__LINE__); gr_activate(1); } } while (0) #define STUB_FUNCTION mprintf(("STUB: %s at %s, line %d, thread %d\n", __FUNCTION__, LOCATION, getpid())) #endif @@ -568,7 +565,13 @@ void dc_printf( const char *format, ... ); //====================================================================================== //====================================================================================== - +inline int mul_div(int n, int num, int dem) +{ + Sint64 ret = n; + ret *= num; + ret /= dem; + return (int)ret; +} #include "fix.h" #include "floating.h" @@ -579,54 +582,9 @@ void dc_printf( const char *format, ... ); // contants and defined for byteswapping routines (useful for mac) -#define SWAPSHORT(x) ( \ - ((ubyte)x << 8) | \ - (((ushort)x) >> 8) \ - ) - -#define SWAPINT(x) ( \ - (x << 24) | \ - (((ulong)x) >> 24) | \ - ((x & 0x0000ff00) << 8) | \ - ((x & 0x00ff0000) >> 8) \ - ) -#if SDL_BYTEORDER == SDL_BIG_ENDIAN -inline -float SWAPFLOAT( float *x ) -{ - #if ! defined( __MWERKS__ ) - //Usage: void __stwbrx( unsigned int, unsigned int *address, int byteOffsetFromAddress ); - #define __stwbrx( value, base, index ) \ - __asm__ ( "stwbrx %0, %1, %2" : : "r" (value), "b%" (index), "r" (base) : "memory" ) - #endif - - union - { - int i; - float f; - }buf; - - //load the float into the integer unit - //unsigned int a = ((long*) x)[0]; - register int a = ((int*) x )[0]; - - //store it to the transfer union, with byteswapping - __stwbrx( a, 0, &buf.i ); - - //load it into the FPU and return it - return buf.f; -} -#endif - -#if SDL_BYTEORDER != SDL_BIG_ENDIAN -#define INTEL_INT(x) x -#define INTEL_SHORT(x) x -#define INTEL_FLOAT(x) (*x) -#else -#define INTEL_INT(x) SWAPINT(x) -#define INTEL_SHORT(x) SWAPSHORT(x) -#define INTEL_FLOAT(x) SWAPFLOAT(x) -#endif +#define INTEL_INT(x) SDL_SwapLE32(x) +#define INTEL_SHORT(x) SDL_SwapLE16(x) +#define INTEL_FLOAT(x) SDL_SwapFloatLE(x) #define TRUE 1 #define FALSE 0 diff --git a/include/supernova.h b/include/supernova.h index 9157140..5cd6e28 100644 --- a/include/supernova.h +++ b/include/supernova.h @@ -23,7 +23,7 @@ * * * 4 9/09/99 11:40p Dave - * Handle an Assert() in beam code. Added supernova sounds. Play the right + * Handle an SDL_assert() in beam code. Added supernova sounds. Play the right * 2 end movies properly, based upon what the player did in the mission. * * 3 9/03/99 1:32a Dave diff --git a/include/unix.h b/include/unix.h index ce9972b..55931d2 100644 --- a/include/unix.h +++ b/include/unix.h @@ -6,92 +6,27 @@ #include #include #include -#include "SDL.h" -#define TRUE 1 -#define FALSE 0 + #define _MAX_FNAME 255 #define _MAX_PATH 255 #define MAX_PATH 255 -#define _MAX_DIR 256 -#define MAX_FILENAME_LENGTH 64 -#define _cdecl #define __cdecl -#define __int64 long long -#define LARGE_INTEGER long long -#define stricmp strcasecmp -#define strnicmp strncasecmp -#define _strnicmp strncasecmp #define _isnan isnan #define HANDLE int -#define HINSTANCE int #define _getcwd getcwd #define _chdir chdir -#define _strlwr strlwr #define _unlink unlink #define _hypot hypot #define _access access #define byte unsigned char -#define __try try -#define __except catch -#define LPSTR char * -#define PASCAL -#define CALLBACK - -#if ( defined(__x86_64__) || defined(_WIN64) ) -typedef unsigned int DWORD; -#else -typedef unsigned long DWORD; -#endif -typedef unsigned short WORD; -extern void strlwr (char *str); -extern void strupr (char *str); extern int filelength (int fd); -extern int MulDiv (int, int, int); -extern void Sleep (int miliseconds); -extern unsigned long _beginthread (void (*pfuncStart)(void *), unsigned unStackSize, void* pArgList); -extern void OutputDebugString (const char *); extern int WSAGetLastError (); extern int _mkdir(const char *path); extern void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext); -typedef struct FILETIME_s { - DWORD dwLowDateTime; - DWORD dwHighDateTime; -} FILETIME, *PFILETIME; - -#define WAVE_FORMAT_PCM 1 -#define WAVE_FORMAT_ADPCM 2 - -#pragma pack(1) -typedef struct { - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; -} WAVEFORMAT; - -typedef struct { - WAVEFORMAT wf; - WORD wBitsPerSample; -} PCMWAVEFORMAT; - -typedef struct { - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; -} WAVEFORMATEX; -#pragma pack() - -#define CRITICAL_SECTION SDL_mutex* - #define closesocket(A) close(A) #define CopyMemory(A,B,C) memcpy(A,B,C) #define UINT unsigned int diff --git a/src/ac/convert.cpp b/src/ac/convert.cpp index f9be0a5..e7c6465 100644 --- a/src/ac/convert.cpp +++ b/src/ac/convert.cpp @@ -201,7 +201,7 @@ int AVI_stream_open(char* filename) PAVISTREAM pstream; AVISTREAMINFO avi_stream_info; - Assert( !(AVI_stream.flags & AVI_STREAM_F_USED) ); + SDL_assert( !(AVI_stream.flags & AVI_STREAM_F_USED) ); // Open the AVI file hr = AVIFileOpen(&pfile, filename, OF_SHARE_DENY_WRITE, 0); @@ -234,14 +234,14 @@ int AVI_stream_open(char* filename) int buffer_size; int start_sample = AVIStreamStart(pstream); - Assert( start_sample == 0 ); + SDL_assert( start_sample == 0 ); int end_sample = AVIStreamEnd(pstream); - Assert( end_sample >= start_sample ); + SDL_assert( end_sample >= start_sample ); // store the number of frames in the AVI_info[] structure AVI_stream.num_frames = end_sample; // start sample must be 0 - Assert(AVI_stream.num_frames == AVIStreamLength(pstream) ); + SDL_assert(AVI_stream.num_frames == AVIStreamLength(pstream) ); // Get information on the stream @@ -252,7 +252,7 @@ int AVI_stream_open(char* filename) } buffer_size = avi_stream_info.dwSuggestedBufferSize; - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); AVI_stream.min_compressed_buffer_size = buffer_size; // determine the format of the AVI image data @@ -261,10 +261,10 @@ int AVI_stream_open(char* filename) BITMAPINFO* bitmap_info; hr = AVIStreamFormatSize(pstream, 0, &format_buffer_size); - Assert( format_buffer_size > 0 ); + SDL_assert( format_buffer_size > 0 ); format_buffer = (ubyte*) malloc(format_buffer_size); - Assert(format_buffer != NULL); // format_buffer is free'ed when AVI is free'ed, since memory is used by b_info member in AVI_info[] structure + SDL_assert(format_buffer != NULL); // format_buffer is free'ed when AVI is free'ed, since memory is used by b_info member in AVI_info[] structure hr = AVIStreamReadFormat(pstream, 0, format_buffer, &format_buffer_size); bitmap_info = (BITMAPINFO*)format_buffer; @@ -275,7 +275,7 @@ int AVI_stream_open(char* filename) break; default: - Assert(0); + SDL_assert(0); break; } @@ -332,7 +332,7 @@ int AVI_stream_open(char* filename) // void AVI_stream_close() { -// Assert( AVI_stream.flags & AVI_STREAM_F_USED); +// SDL_assert( AVI_stream.flags & AVI_STREAM_F_USED); AVIStreamRelease(AVI_stream.pstream); // closes the video stream AVIFileRelease(AVI_stream.pfile); // closes the file @@ -361,16 +361,16 @@ int AVI_stream_get_frame(ubyte* buffer, int frame_number) return -1; } - Assert( (frame_number - 1) >= 0 ); + SDL_assert( (frame_number - 1) >= 0 ); ubyte* compressed_frame = (ubyte*)malloc(AVI_stream.min_compressed_buffer_size); - Assert( compressed_frame != NULL ); + SDL_assert( compressed_frame != NULL ); long num_bytes_used; long num_samples_used; AVIStreamRead( AVI_stream.pstream, frame_number-1, 1, compressed_frame, AVI_stream.min_compressed_buffer_size, &num_bytes_used, &num_samples_used); - Assert(num_samples_used == 1); + SDL_assert(num_samples_used == 1); AVI_decompress_RLE8(compressed_frame, buffer, AVI_stream.w, AVI_stream.h); @@ -393,10 +393,10 @@ void AVI_decompress_RLE8(ubyte* src, ubyte* dest, int w, int h) int dest_index = 0; int i; - Assert( src != NULL); - Assert( dest != NULL); - Assert( w > 0 ); - Assert( h > 0 ); + SDL_assert( src != NULL); + SDL_assert( dest != NULL); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); ubyte count; ubyte run; @@ -427,7 +427,7 @@ void AVI_decompress_RLE8(ubyte* src, ubyte* dest, int w, int h) //nprintf(("AVI","AVI ==> Reached end of line in compressed image\n")); } else if ( control_code == 2 ) { - Assert(0); + SDL_assert(0); } else { // in absolute mode @@ -459,7 +459,7 @@ int save_anim_header() { int i, new_format_id = 0; - Assert(anim_fp); + SDL_assert(anim_fp); fclose(anim_fp); anim_fp = fopen(anim_save_filename, "r+b"); @@ -542,7 +542,7 @@ int allocate_key_frames(int total_frames) int anim_save_init(char *file, int width, int height, int frames) { - Assert(file); + SDL_assert(file); anim_save_filename = file; anim_fp = fopen(file, "wb"); if (!anim_fp) @@ -588,9 +588,9 @@ int anim_save_frame() int i, size; key_frame *keyp = NULL; - Assert(anim_fp); + SDL_assert(anim_fp); cur_frame_num++; - Assert(cur_frame_num <= Anim.total_frames); + SDL_assert(cur_frame_num <= Anim.total_frames); for (i=0; ianim_info != NULL ); - Assert( aps->start_at >= 0 ); - Assert( aps->stop_at < aps->anim_info->total_frames ); - // Assert( aps->stop_at >= aps->start_at ); - Assert( !(aps->looped && aps->ping_pong) ); // shouldn't have these both set at once + SDL_assert( aps->anim_info != NULL ); + SDL_assert( aps->start_at >= 0 ); + SDL_assert( aps->stop_at < aps->anim_info->total_frames ); + // SDL_assert( aps->stop_at >= aps->start_at ); + SDL_assert( !(aps->looped && aps->ping_pong) ); // shouldn't have these both set at once MONITOR_INC(NumANIPlayed, 1); @@ -361,7 +361,7 @@ anim_instance *anim_play(anim_play_struct *aps) // Find next free anim instance slot on queue instance = GET_FIRST(&anim_free_list); - Assert( instance != &anim_free_list ); // shouldn't have the dummy element + SDL_assert( instance != &anim_free_list ); // shouldn't have the dummy element // remove instance from the free list list_remove( &anim_free_list, instance ); @@ -378,7 +378,7 @@ anim_instance *anim_play(anim_play_struct *aps) instance->file_offset = instance->parent->file_offset; } instance->frame = (ubyte *) malloc(instance->parent->width * instance->parent->height * 2); - Assert( instance->frame != NULL ); + SDL_assert( instance->frame != NULL ); instance->time_elapsed = 0.0f; instance->stop_at = aps->stop_at; instance->x = aps->x; @@ -470,7 +470,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime) int aabitmap = 0; int bpp = 16; - Assert( instance != NULL ); + SDL_assert( instance != NULL ); instance->time_elapsed += frametime; @@ -584,9 +584,9 @@ int anim_show_next_frame(anim_instance *instance, float frametime) frame_diff = 1; } } - Assert(frame_diff >= 0); + SDL_assert(frame_diff >= 0); // nprintf(("Alan","FRAME DIFF: %d\n",frame_diff)); - Assert( instance->frame_num >= 0 && instance->frame_num < instance->parent->total_frames ); + SDL_assert( instance->frame_num >= 0 && instance->frame_num < instance->parent->total_frames ); // if the anim is paused, ignore all the above changes and still display this frame if(instance->paused || Anim_paused){ @@ -706,7 +706,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime) } else { g3_rotate_vertex(&image_vertex,instance->world_pos); - Assert(instance->radius != 0.0f); + SDL_assert(instance->radius != 0.0f); g3_draw_bitmap(&image_vertex, 0, instance->radius*1.5f, TMAP_FLAG_TEXTURED ); } @@ -729,7 +729,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime) // int anim_stop_playing(anim_instance* instance) { - Assert(instance != NULL); + SDL_assert(instance != NULL); if ( anim_playing(instance) ) { anim_release_render_instance(instance); @@ -747,8 +747,8 @@ int anim_stop_playing(anim_instance* instance) // void anim_release_render_instance(anim_instance* instance) { - Assert( instance != NULL ); - Assert(instance->frame); + SDL_assert( instance != NULL ); + SDL_assert(instance->frame); free(instance->frame); instance->frame = NULL; instance->parent->instance_count--; @@ -907,7 +907,7 @@ anim *anim_load(const char *real_filename, int file_mapped) // file_mapped = 0; - Assert ( real_filename != NULL ); + SDL_assert ( real_filename != NULL ); strcpy( name, real_filename ); char *p = strchr( name, '.' ); @@ -918,7 +918,7 @@ anim *anim_load(const char *real_filename, int file_mapped) ptr = first_anim; while (ptr) { - if (!stricmp(name, ptr->name)) + if (!SDL_strcasecmp(name, ptr->name)) break; ptr = ptr->next; @@ -930,12 +930,12 @@ anim *anim_load(const char *real_filename, int file_mapped) return NULL; ptr = (anim *) malloc(sizeof(anim)); - Assert(ptr); + SDL_assert(ptr); ptr->flags = 0; ptr->next = first_anim; first_anim = ptr; - Assert(strlen(name) < _MAX_PATH - 1); + SDL_assert(strlen(name) < _MAX_PATH - 1); strcpy(ptr->name, name); ptr->instance_count = 0; ptr->width = 0; @@ -948,7 +948,7 @@ anim *anim_load(const char *real_filename, int file_mapped) if(ptr->num_keys > 0){ ptr->keys = (key_frame*)malloc(sizeof(key_frame) * ptr->num_keys); - Assert(ptr->keys != NULL); + SDL_assert(ptr->keys != NULL); } // store how long the anim should take on playback (in seconds) @@ -1007,7 +1007,7 @@ anim *anim_load(const char *real_filename, int file_mapped) ptr->data = NULL; ptr->cache_file_offset = ptr->file_offset; ptr->cache = (ubyte*)malloc(ANI_STREAM_CACHE_SIZE+2); - Assert(ptr->cache); + SDL_assert(ptr->cache); cfseek(ptr->cfile_ptr, offset, CF_SEEK_SET); cfread(ptr->cache, ANI_STREAM_CACHE_SIZE, 1, ptr->cfile_ptr); } else { @@ -1042,7 +1042,7 @@ anim *anim_load(const char *real_filename, int file_mapped) // int anim_free(anim *ptr) { - Assert ( ptr != NULL ); + SDL_assert ( ptr != NULL ); anim *list, **prev_anim; list = first_anim; @@ -1076,7 +1076,7 @@ int anim_free(anim *ptr) } } else { - Assert(ptr->data); + SDL_assert(ptr->data); free(ptr->data); } @@ -1093,7 +1093,7 @@ int anim_free(anim *ptr) // int anim_playing(anim_instance *ai) { - Assert(ai != NULL); + SDL_assert(ai != NULL); if ( ai->frame == NULL ) return 0; else @@ -1206,7 +1206,7 @@ void anim_display_info(const char *real_filename) anim_read_header(&A, fp); // read the keyframe frame nums and offsets key_frame_nums = (int*)malloc(sizeof(int)*A.num_keys); - Assert(key_frame_nums != NULL); + SDL_assert(key_frame_nums != NULL); for ( i = 0; i < A.num_keys; i++ ) { key_frame_nums[i] = 0; cfread(&key_frame_nums[i], 2, 1, fp); @@ -1304,7 +1304,7 @@ void anim_ignore_next_frametime() int anim_instance_is_streamed(anim_instance *ai) { - Assert(ai); + SDL_assert(ai); return ( ai->parent->flags & ANF_STREAMED ); } @@ -1313,9 +1313,9 @@ unsigned char anim_instance_get_byte(anim_instance *ai, int offset) int absolute_offset; anim *parent; - Assert(ai); - Assert(ai->parent->cfile_ptr); - Assert(ai->parent->flags & ANF_STREAMED); + SDL_assert(ai); + SDL_assert(ai->parent->cfile_ptr); + SDL_assert(ai->parent->flags & ANF_STREAMED); parent = ai->parent; absolute_offset = ai->file_offset + offset; diff --git a/src/anim/packunpack.cpp b/src/anim/packunpack.cpp index b5f97eb..a5b2eb8 100644 --- a/src/anim/packunpack.cpp +++ b/src/anim/packunpack.cpp @@ -191,7 +191,7 @@ anim_instance *init_anim_instance(anim *ptr, int bpp) ptr->instance_count++; inst = (anim_instance *) malloc(sizeof(anim_instance)); - Assert(inst); + SDL_assert(inst); inst->frame_num = -1; inst->last_frame_num = -1; inst->parent = ptr; @@ -210,7 +210,7 @@ anim_instance *init_anim_instance(anim *ptr, int bpp) void free_anim_instance(anim_instance *inst) { - Assert(inst->frame); + SDL_assert(inst->frame); free(inst->frame); inst->frame = NULL; inst->parent->instance_count--; @@ -549,7 +549,7 @@ int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_ if ( (count == 1) && !(last & STD_RLE_CODE) ) { *save++ = (ubyte)last; packed_size++; - Assert( last != STD_RLE_CODE ); + SDL_assert( last != STD_RLE_CODE ); // printf("Just packed %d 1 times, since pixel change, no count included\n",last); } else { @@ -588,7 +588,7 @@ int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_ *save++ = (ubyte)last; packed_size++; // printf("Just packed %d 1 times, at end since single pixel, no count\n",last); - Assert( last != STD_RLE_CODE ); + SDL_assert( last != STD_RLE_CODE ); } else { count |= STD_RLE_CODE; @@ -599,13 +599,13 @@ int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_ } } - Assert(packed_size == (save-dest_start) ); + SDL_assert(packed_size == (save-dest_start) ); return packed_size; break; } default: - Assert(0); + SDL_assert(0); return -1; break; } // end switch @@ -716,7 +716,7 @@ int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, in if ( (count == 1) && !(last & STD_RLE_CODE) ) { *save++ = (ubyte)last; packed_size++; - Assert( last != STD_RLE_CODE ); + SDL_assert( last != STD_RLE_CODE ); } else { count |= STD_RLE_CODE; @@ -750,7 +750,7 @@ int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, in if ( (count == 1) && !(last & STD_RLE_CODE) ) { *save++ = (ubyte)last; packed_size++; - Assert( last != STD_RLE_CODE ); + SDL_assert( last != STD_RLE_CODE ); } else { count |= STD_RLE_CODE; @@ -760,13 +760,13 @@ int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, in } } - Assert(packed_size == (save-dest_start) ); + SDL_assert(packed_size == (save-dest_start) ); return packed_size; break; } default: - Assert(0); + SDL_assert(0); return -1; break; } // end switch @@ -783,7 +783,7 @@ int unpack_pixel(anim_instance *ai, ubyte *data, ubyte pix, int aabitmap, int bp ubyte al = 0; ubyte r, g, b; anim *a = ai->parent; - Assert(a); + SDL_assert(a); // if this is an aabitmap, don't run through the palette if(aabitmap){ @@ -837,7 +837,7 @@ int unpack_pixel_count(anim_instance *ai, ubyte *data, ubyte pix, int count, int ubyte bit_8 = 0; anim *a = ai->parent; ubyte r, g, b; - Assert(a); + SDL_assert(a); // if this is an aabitmap, don't run through the palette if(aabitmap){ @@ -954,7 +954,7 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte value = *ptr++; size -= count; - Assert(size >= 0); + SDL_assert(size >= 0); if ( xlate_pal ){ stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp); @@ -1001,7 +1001,7 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte } size -= count; - Assert(size >= 0); + SDL_assert(size >= 0); if (value != transparent_code ) { if ( xlate_pal ) { @@ -1040,7 +1040,7 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte value = *ptr++; size -= count; - Assert(size >= 0); + SDL_assert(size >= 0); if (value != transparent_code) { if ( xlate_pal ){ @@ -1057,7 +1057,7 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte } } else { - Assert(0); // unknown packing method + SDL_assert(0); // unknown packing method } return ptr; @@ -1140,7 +1140,7 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal offset++; size -= count; - Assert(size >= 0); + SDL_assert(size >= 0); if ( xlate_pal ){ stuffed = unpack_pixel_count(ai, frame, pal_translate[value], count, aabitmap, bpp); @@ -1189,7 +1189,7 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal } size -= count; - Assert(size >= 0); + SDL_assert(size >= 0); if (value != transparent_code ) { if ( xlate_pal ) { @@ -1230,7 +1230,7 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal offset++; size -= count; - Assert(size >= 0); + SDL_assert(size >= 0); if (value != transparent_code) { if ( xlate_pal ){ diff --git a/src/asteroid/asteroid.cpp b/src/asteroid/asteroid.cpp index c50df46..af5c281 100644 --- a/src/asteroid/asteroid.cpp +++ b/src/asteroid/asteroid.cpp @@ -379,8 +379,8 @@ int asteroid_obj_list_add(int objnum) asteroid *cur_asteroid = &Asteroids[Objects[objnum].instance]; index = cur_asteroid - Asteroids; - Assert(index >= 0 && index < MAX_ASTEROID_OBJS); - Assert(!Asteroid_objs[index].flags & ASTEROID_OBJ_USED); + SDL_assert(index >= 0 && index < MAX_ASTEROID_OBJS); + SDL_assert(!Asteroid_objs[index].flags & ASTEROID_OBJ_USED); Asteroid_objs[index].flags = 0; Asteroid_objs[index].objnum = objnum; @@ -399,8 +399,8 @@ void asteroid_obj_list_remove(object * obj) { int index = obj->instance; - Assert(index >= 0 && index < MAX_ASTEROID_OBJS); - Assert(Asteroid_objs[index].flags & ASTEROID_OBJ_USED); + SDL_assert(index >= 0 && index < MAX_ASTEROID_OBJS); + SDL_assert(Asteroid_objs[index].flags & ASTEROID_OBJ_USED); list_remove(&Asteroid_obj_list, &Asteroid_objs[index]); Asteroid_objs[index].flags = 0; @@ -431,7 +431,7 @@ float asteroid_cap_speed(int asteroid_info_index, float speed) // inside only when sum = 7 int asteroid_in_inner_bound_with_axes(asteroid_field *asfieldp, vector *pos, float delta) { - Assert(asfieldp->has_inner_bound); + SDL_assert(asfieldp->has_inner_bound); int rval = 0; if ( (pos->xyz.x > asfieldp->inner_min_bound.xyz.x - delta) && (pos->xyz.x < asfieldp->inner_max_bound.xyz.x + delta) ) { @@ -474,7 +474,7 @@ void inner_bound_pos_fixup(asteroid_field *asfieldp, vector *pos) for (axis=0; axis<3; axis++) { dist1 = pos->a1d[axis] - asfieldp->inner_min_bound.a1d[axis]; dist2 = asfieldp->inner_max_bound.a1d[axis] - pos->a1d[axis]; - Assert(dist1 >= 0 && dist2 >= 0); + SDL_assert(dist1 >= 0 && dist2 >= 0); if (dist1 < dist2) { pos->a1d[axis] = asfieldp->inner_max_bound.a1d[axis] + dist1; @@ -650,7 +650,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi objp->hull_strength = asip->initial_hull_strength * (0.8f + (float)Game_skill_level/NUM_SKILL_LEVELS)/2.0f; // ensure vel is valid - Assert( !vm_is_vec_nan(&objp->phys_info.vel) ); + SDL_assert( !vm_is_vec_nan(&objp->phys_info.vel) ); // assign a persistant sound to the asteroid // obj_snd_assign(objnum, SND_ASTEROID); @@ -664,7 +664,7 @@ void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec) object *new_objp; float speed; - Assert(parent_objp->type == OBJ_ASTEROID); + SDL_assert(parent_objp->type == OBJ_ASTEROID); int subtype = Asteroids[parent_objp->instance].asteroid_subtype; new_objp = asteroid_create(&Asteroid_field, asteroid_type, subtype); @@ -852,7 +852,7 @@ void asteroid_create_all() asteroid_create(&Asteroid_field, ASTEROID_TYPE_BIG, subtype); } else { - Assert(num_debris_types > 0); + SDL_assert(num_debris_types > 0); int rand_choice = rand() % max_weighted_range; @@ -1056,11 +1056,11 @@ void asteroid_delete( object * obj ) asteroid *asp; num = obj->instance; - Assert( Asteroids[num].objnum == OBJ_INDEX(obj)); + SDL_assert( Asteroids[num].objnum == OBJ_INDEX(obj)); asp = &Asteroids[num]; - Assert( Num_asteroids >= 0 ); + SDL_assert( Num_asteroids >= 0 ); asp->flags = 0; Num_asteroids--; @@ -1162,18 +1162,18 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo mc_info mc; int num, asteroid_subtype; - Assert( pasteroid->type == OBJ_ASTEROID ); + SDL_assert( pasteroid->type == OBJ_ASTEROID ); num = pasteroid->instance; - Assert( num >= 0 ); + SDL_assert( num >= 0 ); - Assert( Asteroids[num].objnum == OBJ_INDEX(pasteroid)); + SDL_assert( Asteroids[num].objnum == OBJ_INDEX(pasteroid)); asteroid_subtype = Asteroids[num].asteroid_subtype; // asteroid_hit_info NULL -- asteroid-weapon collision if ( asteroid_hit_info == NULL ) { // asteroid weapon collision - Assert( other_obj->type == OBJ_WEAPON ); + SDL_assert( other_obj->type == OBJ_WEAPON ); mc.model_num = Asteroid_info[Asteroids[num].type].model_num[asteroid_subtype]; // Fill in the model to check model_clear_instance( mc.model_num ); mc.orient = &pasteroid->orient; // The object's orient @@ -1190,7 +1190,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo // asteroid ship collision -- use asteroid_hit_info to calculate physics object *ship_obj = other_obj; - Assert( ship_obj->type == OBJ_SHIP ); + SDL_assert( ship_obj->type == OBJ_SHIP ); object* heavy = asteroid_hit_info->heavy; object* light = asteroid_hit_info->light; @@ -1422,10 +1422,10 @@ void asteroid_render(object * obj) pm = NULL; num = obj->instance; - Assert((num >= 0) && (num < MAX_ASTEROIDS)); + SDL_assert((num >= 0) && (num < MAX_ASTEROIDS)); asp = &Asteroids[num]; - Assert( asp->flags & AF_USED ); + SDL_assert( asp->flags & AF_USED ); model_clear_instance( Asteroid_info[asp->type].model_num[asp->asteroid_subtype]); model_render(Asteroid_info[asp->type].model_num[asp->asteroid_subtype], &obj->orient, &obj->pos, MR_NORMAL|MR_IS_ASTEROID, OBJ_INDEX(obj) ); // Replace MR_NORMAL with 0x07 for big yellow blobs @@ -1528,7 +1528,7 @@ void asteriod_explode_sound(object *objp, int type, int play_loud) return; } - Assert(sound_index != -1); + SDL_assert(sound_index != -1); if ( !play_loud ) { range_factor = 1.0f; @@ -1643,7 +1643,7 @@ void asteroid_level_close() for (i=0; i=0 && Asteroids[i].objnum < MAX_OBJECTS); + SDL_assert(Asteroids[i].objnum >=0 && Asteroids[i].objnum < MAX_OBJECTS); Objects[Asteroids[i].objnum].flags |= OF_SHOULD_BE_DEAD; } } @@ -1697,7 +1697,7 @@ void hud_target_asteroid() i = 0; if (Asteroids[i].flags & AF_USED) { - Assert(Objects[Asteroids[i].objnum].type == OBJ_ASTEROID); + SDL_assert(Objects[Asteroids[i].objnum].type == OBJ_ASTEROID); set_target_objnum( Player_ai, Asteroids[i].objnum); break; } @@ -1818,7 +1818,7 @@ void asteroid_test_collide(object *asteroid_obj, object *ship_obj, mc_info *mc) vm_vec_scale_add(&terminus, &asteroid_obj->pos, &asteroid_fvec, asteroid_ray_dist); } - Assert(ship_obj->type == OBJ_SHIP); + SDL_assert(ship_obj->type == OBJ_SHIP); ship_model_start(ship_obj); @@ -1924,7 +1924,7 @@ void asteroid_process_post(object * obj, float frame_time) int num; num = obj->instance; - //Assert( Asteroids[num].objnum == objnum ); + //SDL_assert( Asteroids[num].objnum == objnum ); asteroid *asp = &Asteroids[num]; // Only wrap if active field @@ -2041,7 +2041,7 @@ void asteroid_parse_tbl() required_string("#Asteroid Types"); while (required_string_either("#End","$Name:")) { - Assert( Num_asteroid_types < MAX_DEBRIS_TYPES ); + SDL_assert( Num_asteroid_types < MAX_DEBRIS_TYPES ); asteroid_parse_section(); Num_asteroid_types++; } @@ -2049,12 +2049,12 @@ void asteroid_parse_tbl() required_string("#End"); // check all read in - Assert(Num_asteroid_types == MAX_DEBRIS_TYPES); + SDL_assert(Num_asteroid_types == MAX_DEBRIS_TYPES); Asteroid_impact_explosion_ani = -1; required_string("$Impact Explosion:"); stuff_string(impact_ani_file, F_NAME, NULL); - if ( stricmp(impact_ani_file,NOX("none"))) { + if ( SDL_strcasecmp(impact_ani_file,NOX("none"))) { int num_frames; Asteroid_impact_explosion_ani = bm_load_animation( impact_ani_file, &num_frames, NULL, 1); } diff --git a/src/bmpman/bmpman.cpp b/src/bmpman/bmpman.cpp index 0e2a72e..a151677 100644 --- a/src/bmpman/bmpman.cpp +++ b/src/bmpman/bmpman.cpp @@ -455,7 +455,7 @@ * 30 3/11/97 2:49p Allender * * 29 2/18/97 9:43a Lawrance - * added Assert() in bm_release + * added SDL_assert() in bm_release * * 28 1/22/97 4:29p John * maybe fixed bug with code that counts total bytes of texture ram used. @@ -622,7 +622,7 @@ int Bm_pixel_format = BM_PIXEL_FORMAT_ARGB; // 2 = Debug low memory ( only use first frame of each ani ) void bm_set_low_mem( int mode ) { - Assert( (mode >= 0) && (mode<=2 )); + SDL_assert( (mode >= 0) && (mode<=2 )); Bm_low_mem = mode; } @@ -644,7 +644,7 @@ static void bm_free_data(int n) bitmap_entry *be; bitmap *bmp; - Assert( n >= 0 && n < MAX_BITMAPS ); + SDL_assert( n >= 0 && n < MAX_BITMAPS ); be = &bm_bitmaps[n]; bmp = &be->bm; @@ -730,11 +730,11 @@ static void bm_free_some_ram( int n, int size ) static void *bm_malloc( int n, int size ) { - Assert( n >= 0 && n < MAX_BITMAPS ); + SDL_assert( n >= 0 && n < MAX_BITMAPS ); // mprintf(( "Bitmap %d allocated %d bytes\n", n, size )); #ifdef BMPMAN_NDEBUG bm_free_some_ram( n, size ); - Assert( bm_bitmaps[n].data_size == 0 ); + SDL_assert( bm_bitmaps[n].data_size == 0 ); bm_bitmaps[n].data_size += size; bm_texture_ram += size; #endif @@ -852,11 +852,11 @@ int bm_create( int bpp, int w, int h, void *data, int flags ) return -1; } - // Assert((bpp==32)||(bpp==8)); + // SDL_assert((bpp==32)||(bpp==8)); if(bpp != 16){ - Assert(flags & BMP_AABITMAP); + SDL_assert(flags & BMP_AABITMAP); } else { - Assert(bpp == 16); + SDL_assert(bpp == 16); } if ( !bm_inited ) bm_init(); @@ -869,7 +869,7 @@ int bm_create( int bpp, int w, int h, void *data, int flags ) } n = first_slot; - Assert( n > -1 ); + SDL_assert( n > -1 ); // Out of bitmap slots if ( n == -1 ) return -1; @@ -923,7 +923,7 @@ int bm_load_sub(const char *real_filename, const char *ext, int *handle) // try to find given filename to see if it has been loaded before if(!Bm_ignore_duplicates){ for (i = 0; i < MAX_BITMAPS; i++) { - if ( (bm_bitmaps[i].type != BM_TYPE_NONE) && !stricmp(filename, bm_bitmaps[i].filename) ) { + if ( (bm_bitmaps[i].type != BM_TYPE_NONE) && !SDL_strcasecmp(filename, bm_bitmaps[i].filename) ) { nprintf (("BmpMan", "Found bitmap %s -- number %d\n", filename, i)); *handle = bm_bitmaps[i].handle; return 1; @@ -1039,22 +1039,22 @@ int bm_load( const char * real_filename ) } n = first_slot; - Assert( n < MAX_BITMAPS ); + SDL_assert( n < MAX_BITMAPS ); if ( n == MAX_BITMAPS ) return -1; // ensure fields are cleared out from previous bitmap -// Assert(bm_bitmaps[n].bm.data == 0); -// Assert(bm_bitmaps[n].bm.palette == NULL); -// Assert(bm_bitmaps[n].ref_count == 0 ); -// Assert(bm_bitmaps[n].user_data == NULL); +// SDL_assert(bm_bitmaps[n].bm.data == 0); +// SDL_assert(bm_bitmaps[n].bm.palette == NULL); +// SDL_assert(bm_bitmaps[n].ref_count == 0 ); +// SDL_assert(bm_bitmaps[n].user_data == NULL); memset( &bm_bitmaps[n], 0, sizeof(bitmap_entry) ); // Mark the slot as filled, because cf_read might load a new bitmap // into this slot. bm_bitmaps[n].type = tga ? (ubyte)BM_TYPE_TGA : (ubyte)BM_TYPE_PCX; bm_bitmaps[n].signature = Bm_next_signature++; - Assert ( strlen(filename) < MAX_FILENAME_LEN ); + SDL_assert ( strlen(filename) < MAX_FILENAME_LEN ); strncpy(bm_bitmaps[n].filename, filename, MAX_FILENAME_LEN-1 ); bm_bitmaps[n].bm.w = short(w); bm_bitmaps[n].bm.rowsize = short(w); @@ -1211,7 +1211,7 @@ int bm_load_animation( const char *real_filename, int *nframes, int *fps, int ca // first check to see if this ani already has it's frames loaded for (i = 0; i < MAX_BITMAPS; i++) { - if ( (bm_bitmaps[i].type == BM_TYPE_ANI) && !stricmp(filename, bm_bitmaps[i].filename) ) { + if ( (bm_bitmaps[i].type == BM_TYPE_ANI) && !SDL_strcasecmp(filename, bm_bitmaps[i].filename) ) { break; } } @@ -1219,7 +1219,7 @@ int bm_load_animation( const char *real_filename, int *nframes, int *fps, int ca if ( i < MAX_BITMAPS ) { // in low memory modes this can happen if(!Bm_low_mem){ - Assert(bm_bitmaps[i].info.ani.num_frames == *nframes); + SDL_assert(bm_bitmaps[i].info.ani.num_frames == *nframes); } return bm_bitmaps[i].handle; } @@ -1228,11 +1228,11 @@ int bm_load_animation( const char *real_filename, int *nframes, int *fps, int ca if(n < 0){ return -1; } - // Assert( n >= 0 ); + // SDL_assert( n >= 0 ); int first_handle = bm_get_next_handle(); - Assert ( strlen(filename) < MAX_FILENAME_LEN ); + SDL_assert ( strlen(filename) < MAX_FILENAME_LEN ); for ( i = 0; i < *nframes; i++ ) { memset( &bm_bitmaps[n+i], 0, sizeof(bitmap_entry) ); bm_bitmaps[n+i].info.ani.first_frame = n; @@ -1277,7 +1277,7 @@ void bm_get_info( int handle, int *w, int * h, ubyte * flags, int *nframes, int if ( !bm_inited ) return; int bitmapnum = handle % MAX_BITMAPS; - Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE! + SDL_assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE! if ( (bm_bitmaps[bitmapnum].type == BM_TYPE_NONE) || (bm_bitmaps[bitmapnum].handle != handle) ) { if (w) *w = 0; @@ -1319,7 +1319,7 @@ uint bm_get_signature( int handle ) if ( !bm_inited ) bm_init(); int bitmapnum = handle % MAX_BITMAPS; - Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE + SDL_assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE return bm_bitmaps[bitmapnum].signature; } @@ -1331,14 +1331,14 @@ static void bm_convert_format( int bitmapnum, bitmap *bmp, ubyte bpp, ubyte flag int r, g, b, a; if(Fred_running || Pofview_running || Is_standalone){ - Assert(bmp->bpp == 8); + SDL_assert(bmp->bpp == 8); return; } else { if(flags & BMP_AABITMAP){ - Assert(bmp->bpp == 8); + SDL_assert(bmp->bpp == 8); } else { - Assert(bmp->bpp == 16); + SDL_assert(bmp->bpp == 16); } } @@ -1411,10 +1411,10 @@ void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt // allocate bitmap data if(bpp == 8){ - // Assert(Fred_running || Pofview_running || Is_standalone); + // SDL_assert(Fred_running || Pofview_running || Is_standalone); data = (ubyte *)bm_malloc(bitmapnum, bmp->w * bmp->h ); #ifdef BMPMAN_NDEBUG - Assert( be->data_size == bmp->w * bmp->h ); + SDL_assert( be->data_size == bmp->w * bmp->h ); #endif palette = pal; bmp->data = (ptr_u)data; @@ -1429,15 +1429,15 @@ void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt memset( data, 0, bmp->w * bmp->h * 2); } - Assert( &be->bm == bmp ); + SDL_assert( &be->bm == bmp ); #ifdef BMPMAN_NDEBUG - Assert( be->data_size > 0 ); + SDL_assert( be->data_size > 0 ); #endif // some sanity checks on flags - Assert(!((flags & BMP_AABITMAP) && (flags & BMP_TEX_ANY))); // no aabitmap textures - Assert(!((flags & BMP_TEX_XPARENT) && (flags & BMP_TEX_NONDARK))); // can't be a transparent texture and a nondarkening texture - Assert(!((flags & BMP_TEX_NONDARK) && (gr_screen.mode == GR_DIRECT3D))); // D3D should never be trying to get nondarkening textures + SDL_assert(!((flags & BMP_AABITMAP) && (flags & BMP_TEX_ANY))); // no aabitmap textures + SDL_assert(!((flags & BMP_TEX_XPARENT) && (flags & BMP_TEX_NONDARK))); // can't be a transparent texture and a nondarkening texture + SDL_assert(!((flags & BMP_TEX_NONDARK) && (gr_screen.mode == GR_DIRECT3D))); // D3D should never be trying to get nondarkening textures if(bpp == 8){ int pcx_error=pcx_read_bitmap_8bpp( be->filename, data, palette ); @@ -1470,7 +1470,7 @@ void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt } #ifdef BMPMAN_NDEBUG - Assert( be->data_size > 0 ); + SDL_assert( be->data_size > 0 ); #endif bmp->flags = 0; @@ -1624,7 +1624,7 @@ void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, uby case 8: // Going from 8 bpp to something (probably only for aabitmaps) /* - Assert(flags & BMP_AABITMAP); + SDL_assert(flags & BMP_AABITMAP); bmp->bpp = 16; bmp->data = (uint)malloc(bmp->w * bmp->h * 2); bmp->flags = be->info.user.flags; @@ -1633,13 +1633,13 @@ void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, uby // go through and map the pixels for(idx=0; idxw * bmp->h; idx++){ bit_16 = (ushort)((ubyte*)be->info.user.data)[idx]; - Assert(bit_16 <= 255); + SDL_assert(bit_16 <= 255); // stuff the final result memcpy((char*)bmp->data + (idx * 2), &bit_16, sizeof(ushort)); } */ - Assert(flags & BMP_AABITMAP); + SDL_assert(flags & BMP_AABITMAP); bmp->bpp = bpp; bmp->flags = be->info.user.flags; bmp->data = (ptr_u)be->info.user.data; @@ -1660,13 +1660,13 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt bm_free_data( bitmapnum ); if(Fred_running || Is_standalone){ - Assert(bpp == 8); + SDL_assert(bpp == 8); } else { - Assert(bpp == 16); + SDL_assert(bpp == 16); } // should never try to make an aabitmap out of a targa - Assert(!(flags & BMP_AABITMAP)); + SDL_assert(!(flags & BMP_AABITMAP)); // allocate bitmap data if(bpp == 16){ @@ -1683,9 +1683,9 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt memset( data, 0, bmp->w * bmp->h ); } - Assert( &be->bm == bmp ); + SDL_assert( &be->bm == bmp ); #ifdef BMPMAN_NDEBUG - Assert( be->data_size > 0 ); + SDL_assert( be->data_size > 0 ); #endif int tga_error=targa_read_bitmap( be->filename, data, NULL, (bpp == 16) ? 2 : 1); @@ -1696,7 +1696,7 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt } #ifdef BMPMAN_NDEBUG - Assert( be->data_size > 0 ); + SDL_assert( be->data_size > 0 ); #endif bmp->flags = 0; @@ -1719,7 +1719,7 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags ) if ( !bm_inited ) bm_init(); int bitmapnum = handle % MAX_BITMAPS; - Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE + SDL_assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE // flags &= (~BMP_RLE); @@ -1731,13 +1731,13 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags ) // otherwise do it as normal else { if(Fred_running || Pofview_running){ - Assert( bpp == 8 ); - Assert( (bm_bitmaps[bitmapnum].type == BM_TYPE_PCX) || (bm_bitmaps[bitmapnum].type == BM_TYPE_ANI) || (bm_bitmaps[bitmapnum].type == BM_TYPE_TGA)); + SDL_assert( bpp == 8 ); + SDL_assert( (bm_bitmaps[bitmapnum].type == BM_TYPE_PCX) || (bm_bitmaps[bitmapnum].type == BM_TYPE_ANI) || (bm_bitmaps[bitmapnum].type == BM_TYPE_TGA)); } else { if(flags & BMP_AABITMAP){ - Assert( bpp == 8 ); + SDL_assert( bpp == 8 ); } else { - Assert( bpp == 16 ); + SDL_assert( bpp == 16 ); } } } @@ -1748,10 +1748,10 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags ) // If you hit this assert, chances are that someone freed the // wrong bitmap and now someone is trying to use that bitmap. // See John. - Assert( be->type != BM_TYPE_NONE ); + SDL_assert( be->type != BM_TYPE_NONE ); // Increment ref count for bitmap since lock was made on it. - Assert(be->ref_count >= 0); + SDL_assert(be->ref_count >= 0); be->ref_count++; // Lock it before we page in data; this prevents a callback from freeing this // as it gets read in @@ -1768,7 +1768,7 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags ) int rle_changed = 0; int fake_xparent_changed = 0; if ( (bmp->data == 0) || (bpp != bmp->bpp) || pal_changed || rle_changed || fake_xparent_changed ) { - Assert(be->ref_count == 1); + SDL_assert(be->ref_count == 1); if ( be->type != BM_TYPE_USER ) { if ( bmp->data == 0 ) { @@ -1868,16 +1868,16 @@ void bm_unlock( int handle ) bitmap *bmp; int bitmapnum = handle % MAX_BITMAPS; - Assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE + SDL_assert( bm_bitmaps[bitmapnum].handle == handle ); // INVALID BITMAP HANDLE - Assert(bitmapnum >= 0 && bitmapnum < MAX_BITMAPS); + SDL_assert(bitmapnum >= 0 && bitmapnum < MAX_BITMAPS); if ( !bm_inited ) bm_init(); be = &bm_bitmaps[bitmapnum]; bmp = &be->bm; be->ref_count--; - Assert(be->ref_count >= 0); // Trying to unlock data more times than lock was called!!! + SDL_assert(be->ref_count >= 0); // Trying to unlock data more times than lock was called!!! } @@ -1891,7 +1891,7 @@ char *bm_get_filename(int handle) int n; n = handle % MAX_BITMAPS; - Assert(bm_bitmaps[n].handle == handle); // INVALID BITMAP HANDLE + SDL_assert(bm_bitmaps[n].handle == handle); // INVALID BITMAP HANDLE return bm_bitmaps[n].filename; } @@ -1901,7 +1901,7 @@ void bm_get_palette(int handle, ubyte *pal, char *name) int w,h; int n= handle % MAX_BITMAPS; - Assert( bm_bitmaps[n].handle == handle ); // INVALID BITMAP HANDLE + SDL_assert( bm_bitmaps[n].handle == handle ); // INVALID BITMAP HANDLE filename = bm_bitmaps[n].filename; @@ -1930,7 +1930,7 @@ void bm_release(int handle) int n = handle % MAX_BITMAPS; - Assert(n >= 0 && n < MAX_BITMAPS); + SDL_assert(n >= 0 && n < MAX_BITMAPS); be = &bm_bitmaps[n]; if ( bm_bitmaps[n].type == BM_TYPE_NONE ) { @@ -1941,7 +1941,7 @@ void bm_release(int handle) return; } - Assert( be->handle == handle ); // INVALID BITMAP HANDLE + SDL_assert( be->handle == handle ); // INVALID BITMAP HANDLE // If it is locked, cannot free it. if (be->ref_count != 0) { @@ -2007,7 +2007,7 @@ int bm_unload( int handle ) int n = handle % MAX_BITMAPS; - Assert(n >= 0 && n < MAX_BITMAPS); + SDL_assert(n >= 0 && n < MAX_BITMAPS); be = &bm_bitmaps[n]; bmp = &be->bm; @@ -2015,7 +2015,7 @@ int bm_unload( int handle ) return 0; // Already been released } - Assert( be->handle == handle ); // INVALID BITMAP HANDLE! + SDL_assert( be->handle == handle ); // INVALID BITMAP HANDLE! // If it is locked, cannot free it. if (be->ref_count != 0) { @@ -2294,7 +2294,7 @@ int bm_get_cache_slot( int bitmap_id, int separate_ani_frames ) { int n = bitmap_id % MAX_BITMAPS; - Assert( bm_bitmaps[n].handle == bitmap_id ); // INVALID BITMAP HANDLE + SDL_assert( bm_bitmaps[n].handle == bitmap_id ); // INVALID BITMAP HANDLE bitmap_entry *be = &bm_bitmaps[n]; @@ -2508,7 +2508,7 @@ void bm_set_components(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av) switch(Bm_pixel_format){ // glide has an alpha channel so we have to unset ir or set it each time case BM_PIXEL_FORMAT_ARGB: - Assert(!bit_32); + SDL_assert(!bit_32); *((ushort*)pixel) &= ~(0x8000); if(*av){ *((ushort*)pixel) |= 0x8000; @@ -2517,7 +2517,7 @@ void bm_set_components(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av) // this d3d format has no alpha channel, so only make it "transparent", never make it "non-transparent" case BM_PIXEL_FORMAT_D3D: - Assert(!bit_32); + SDL_assert(!bit_32); if(*av == 0){ *((ushort*)pixel) = (ushort)Gr_current_green->mask; } @@ -2527,7 +2527,7 @@ void bm_set_components(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av) case BM_PIXEL_FORMAT_ARGB_D3D: // if we're writing to normal texture format if(Gr_current_red == &Gr_t_red){ - Assert(!bit_32); + SDL_assert(!bit_32); *((ushort*)pixel) &= ~(Gr_current_alpha->mask); if(*av){ *((ushort*)pixel) |= (ushort)(Gr_current_alpha->mask); @@ -2589,7 +2589,7 @@ void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) switch(Bm_pixel_format){ // glide has an alpha channel so we have to unset ir or set it each time case BM_PIXEL_FORMAT_ARGB: - Assert(!bit_32); + SDL_assert(!bit_32); if(!( ((ushort*)pixel)[0] & 0x8000)){ *a = 0; } @@ -2597,7 +2597,7 @@ void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) // this d3d format has no alpha channel, so only make it "transparent", never make it "non-transparent" case BM_PIXEL_FORMAT_D3D: - Assert(!bit_32); + SDL_assert(!bit_32); if( *((ushort*)pixel) == Gr_current_green->mask){ *a = 0; } @@ -2607,7 +2607,7 @@ void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) case BM_PIXEL_FORMAT_ARGB_D3D: // if we're writing to a normal texture, use nice alpha bits if(Gr_current_red == &Gr_t_red){ - Assert(!bit_32); + SDL_assert(!bit_32); if(!(*((ushort*)pixel) & Gr_current_alpha->mask)){ *a = 0; @@ -2645,7 +2645,7 @@ void bm_get_section_size(int bitmapnum, int sx, int sy, int *w, int *h) bitmap_section_info *sections; // bogus input? - Assert((w != NULL) && (h != NULL)); + SDL_assert((w != NULL) && (h != NULL)); if((w == NULL) || (h == NULL)){ return; } diff --git a/src/cfile/cfile.cpp b/src/cfile/cfile.cpp index 9bb07a4..9b9b721 100644 --- a/src/cfile/cfile.cpp +++ b/src/cfile/cfile.cpp @@ -474,11 +474,11 @@ int cfile_push_chdir(int type) char NoDir[] = "\\."; _getcwd(OriginalDirectory, 127); - Assert(Cfile_stack_pos < CFILE_STACK_MAX); + SDL_assert(Cfile_stack_pos < CFILE_STACK_MAX); strcpy(Cfile_stack[Cfile_stack_pos++], OriginalDirectory); cf_create_default_path_string( dir, type, NULL ); - _strlwr(dir); + SDL_strlwr(dir); #ifndef PLAT_UNIX char *Drive = strchr(dir, ':'); @@ -517,7 +517,7 @@ int cfile_chdir(char *dir) char NoDir[] = "\\."; _getcwd(OriginalDirectory, 127); - _strlwr(dir); + SDL_strlwr(dir); #ifndef PLAT_UNIX char *Drive = strchr(dir, ':'); @@ -549,7 +549,7 @@ int cfile_chdir(char *dir) int cfile_pop_dir() { - Assert(Cfile_stack_pos); + SDL_assert(Cfile_stack_pos); Cfile_stack_pos--; return cfile_chdir(Cfile_stack[Cfile_stack_pos]); } @@ -566,7 +566,7 @@ int cfile_flush_dir(int dir_type) int del_count; _finddata_t find; - Assert( CF_TYPE_SPECIFIED(dir_type) ); + SDL_assert( CF_TYPE_SPECIFIED(dir_type) ); // attempt to change the directory to the passed type if(cfile_push_chdir(dir_type)){ @@ -610,10 +610,10 @@ char *cf_add_ext(const char *filename, const char *ext) flen = strlen(filename); elen = strlen(ext); - Assert(flen < MAX_PATH_LEN); + SDL_assert(flen < MAX_PATH_LEN); strcpy(path, filename); - if ((flen < 4) || stricmp(path + flen - elen, ext)) { - Assert(flen + elen < MAX_PATH_LEN); + if ((flen < 4) || SDL_strcasecmp(path + flen - elen, ext)) { + SDL_assert(flen + elen < MAX_PATH_LEN); strcat(path, ext); } @@ -625,7 +625,7 @@ void cf_delete( const char *filename, int dir_type ) { char longname[MAX_PATH_LEN]; - Assert( CF_TYPE_SPECIFIED(dir_type) ); + SDL_assert( CF_TYPE_SPECIFIED(dir_type) ); cf_create_default_path_string( longname, dir_type, filename ); @@ -644,7 +644,7 @@ int cf_access( const char *filename, int dir_type, int mode ) { char longname[MAX_PATH_LEN]; - Assert( CF_TYPE_SPECIFIED(dir_type) ); + SDL_assert( CF_TYPE_SPECIFIED(dir_type) ); cf_create_default_path_string( longname, dir_type, filename ); @@ -657,7 +657,7 @@ int cf_exist( const char *filename, int dir_type ) { char longname[MAX_PATH_LEN]; - Assert( CF_TYPE_SPECIFIED(dir_type) ); + SDL_assert( CF_TYPE_SPECIFIED(dir_type) ); cf_create_default_path_string( longname, dir_type, filename ); @@ -674,7 +674,7 @@ void cf_attrib(const char *filename, int set, int clear, int dir_type) { char longname[MAX_PATH_LEN]; - Assert( CF_TYPE_SPECIFIED(dir_type) ); + SDL_assert( CF_TYPE_SPECIFIED(dir_type) ); cf_create_default_path_string( longname, dir_type, filename ); @@ -694,7 +694,7 @@ void cf_attrib(const char *filename, int set, int clear, int dir_type) int cf_rename(const char *old_name, const char *name, int dir_type) { - Assert( CF_TYPE_SPECIFIED(dir_type) ); + SDL_assert( CF_TYPE_SPECIFIED(dir_type) ); int ret_code; char old_longname[_MAX_PATH]; @@ -727,12 +727,12 @@ void cf_create_directory( int dir_type ) int dir_tree[CF_MAX_PATH_TYPES]; char longname[MAX_PATH_LEN]; - Assert( CF_TYPE_SPECIFIED(dir_type) ); + SDL_assert( CF_TYPE_SPECIFIED(dir_type) ); int current_dir = dir_type; do { - Assert( num_dirs < CF_MAX_PATH_TYPES ); // Invalid Pathtypes data? + SDL_assert( num_dirs < CF_MAX_PATH_TYPES ); // Invalid Pathtypes data? dir_tree[num_dirs++] = current_dir; current_dir = Pathtypes[current_dir].parent_index; @@ -779,8 +779,8 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b //================================================ // Check that all the parameters make sense - Assert(file_path && strlen(file_path)); - Assert( mode != NULL ); + SDL_assert(file_path && strlen(file_path)); + SDL_assert( mode != NULL ); // Can only open read-only binary files in memory mapped mode. if ( (type & CFILE_MEMORY_MAPPED) && strcmp(mode,"rb") ) { @@ -803,14 +803,14 @@ CFILE *cfopen(const char *file_path, const char *mode, int type, int dir_type, b strcpy(longname, file_path ); } else { // Path type given? - Assert( dir_type != CF_TYPE_ANY ); + SDL_assert( dir_type != CF_TYPE_ANY ); // Create the directory if necessary cf_create_directory( dir_type ); cf_create_default_path_string( longname, dir_type, file_path ); } - Assert( !(type & CFILE_MEMORY_MAPPED) ); + SDL_assert( !(type & CFILE_MEMORY_MAPPED) ); // JOHN: TODO, you should create the path if it doesn't exist. @@ -916,7 +916,7 @@ int cfget_cfile_block() // If we've reached this point, a free Cfile_block could not be found nprintf(("Warning","A free Cfile_block could not be found.\n")); - Assert(0); // out of free cfile blocks + SDL_assert(0); // out of free cfile blocks return -1; } @@ -930,9 +930,9 @@ int cfclose( CFILE * cfile ) { int result; - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; result = 0; @@ -942,16 +942,16 @@ int cfclose( CFILE * cfile ) STUB_FUNCTION; #else result = UnmapViewOfFile((void*)cb->data); - Assert(result); + SDL_assert(result); result = CloseHandle(cb->hInFile); - Assert(result); // Ensure file handle is closed properly + SDL_assert(result); // Ensure file handle is closed properly result = CloseHandle(cb->hMapFile); - Assert(result); // Ensure file handle is closed properly + SDL_assert(result); // Ensure file handle is closed properly #endif result = 0; } else if ( cb->fp != NULL ) { - Assert(cb->fp != NULL); + SDL_assert(cb->fp != NULL); result = fclose(cb->fp); } else { // VP do nothing @@ -1066,7 +1066,7 @@ CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type) } cfbp->data = (ubyte*)MapViewOfFile(cfbp->hMapFile, FILE_MAP_READ, 0, 0, 0); - Assert( cfbp->data != NULL ); + SDL_assert( cfbp->data != NULL ); #endif return cfp; } @@ -1084,11 +1084,11 @@ int cf_get_dir_type(CFILE *cfile) void *cf_returndata(CFILE *cfile) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; - Assert(cb->data != NULL); + SDL_assert(cb->data != NULL); return cb->data; } @@ -1098,7 +1098,7 @@ void *cf_returndata(CFILE *cfile) // open a file. Once set, you can use minimum version numbers with the read functions. void cf_set_version( CFILE * cfile, int version ) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); cfile->version = version; } @@ -1119,7 +1119,7 @@ float cfread_float(CFILE *file, int ver, float deflt) if (cfread( &f, sizeof(f), 1, file) != 1) return deflt; - f = INTEL_FLOAT(&f); + f = INTEL_FLOAT(f); return f; } @@ -1254,7 +1254,7 @@ void cfread_string_len(char *buf,int n, CFILE *file) { int len; len = cfread_int(file); - Assert( len < n ); + SDL_assert( len < n ); if (len) cfread(buf, len, 1, file); @@ -1265,7 +1265,7 @@ void cfread_string_len(char *buf,int n, CFILE *file) int cfwrite_float(float f, CFILE *file) { - f = INTEL_FLOAT(&f); + f = INTEL_FLOAT(f); return cfwrite(&f, sizeof(f), 1, file); } @@ -1354,15 +1354,15 @@ int cfwrite_string_len(const char *buf, CFILE *file) // Get the filelength int cfilelength( CFILE * cfile ) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; // TODO: return length of memory mapped file - Assert( !cb->data ); + SDL_assert( !cb->data ); - Assert(cb->fp != NULL); + SDL_assert(cb->fp != NULL); // cb->size gets set at cfopen return cb->size; @@ -1375,22 +1375,22 @@ int cfilelength( CFILE * cfile ) // int cfwrite(const void *buf, int elsize, int nelem, CFILE *cfile) { - Assert(cfile != NULL); - Assert(buf != NULL); - Assert(elsize > 0); - Assert(nelem > 0); + SDL_assert(cfile != NULL); + SDL_assert(buf != NULL); + SDL_assert(elsize > 0); + SDL_assert(nelem > 0); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; int size = elsize * nelem; // cfwrite() not supported for memory-mapped files - Assert( !cb->data ); + SDL_assert( !cb->data ); - Assert(cb->fp != NULL); - Assert(cb->lib_offset == 0 ); + SDL_assert(cb->fp != NULL); + SDL_assert(cb->lib_offset == 0 ); int bytes_written = fwrite( buf, 1, size, cb->fp ); if (bytes_written > 0) { @@ -1399,7 +1399,7 @@ int cfwrite(const void *buf, int elsize, int nelem, CFILE *cfile) #if defined(CHECK_POSITION) && !defined(NDEBUG) int tmp_offset = ftell(cb->fp) - cb->lib_offset; - Assert(tmp_offset == cb->raw_position); + SDL_assert(tmp_offset == cb->raw_position); #endif return bytes_written / elsize; @@ -1415,16 +1415,16 @@ int cfputc(int c, CFILE *cfile) { int result; - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; result = 0; // cfputc() not supported for memory-mapped files - Assert( !cb->data ); + SDL_assert( !cb->data ); - Assert(cb->fp != NULL); + SDL_assert(cb->fp != NULL); result = fputc(c, cb->fp); return result; @@ -1438,7 +1438,7 @@ int cfputc(int c, CFILE *cfile) // int cfgetc(CFILE *cfile) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); char tmp; @@ -1463,9 +1463,9 @@ int cfgetc(CFILE *cfile) // char *cfgets(char *buf, int n, CFILE *cfile) { - Assert(cfile != NULL); - Assert(buf != NULL); - Assert(n > 0 ); + SDL_assert(cfile != NULL); + SDL_assert(buf != NULL); + SDL_assert(n > 0 ); char * t = buf; int i, c; @@ -1500,19 +1500,19 @@ char *cfgets(char *buf, int n, CFILE *cfile) // int cfputs(const char *str, CFILE *cfile) { - Assert(cfile != NULL); - Assert(str != NULL); + SDL_assert(cfile != NULL); + SDL_assert(str != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; int result; result = 0; // cfputs() not supported for memory-mapped files - Assert( !cb->data ); - Assert(cb->fp != NULL); + SDL_assert( !cb->data ); + SDL_assert(cb->fp != NULL); result = fputs(str, cb->fp); return result; @@ -1596,10 +1596,10 @@ int cf_chksum_do(CFILE *cfile, ushort *chk_short, uint *chk_long, int max_size) // determine whether we're doing a short or long checksum is_long = 0; if(chk_short){ - Assert(!chk_long); + SDL_assert(!chk_long); *chk_short = 0; } else { - Assert(chk_long); + SDL_assert(chk_long); is_long = 1; *chk_long = 0; } @@ -1746,15 +1746,15 @@ int cf_chksum_long(CFILE *file, uint *chksum, int max_size) // 1 - failure int cflush(CFILE *cfile) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; // not supported for memory mapped files - Assert( !cb->data ); + SDL_assert( !cb->data ); - Assert(cb->fp != NULL); + SDL_assert(cb->fp != NULL); return fflush(cb->fp); } diff --git a/src/cfile/cfilearchive.cpp b/src/cfile/cfilearchive.cpp index e415afa..23e9335 100644 --- a/src/cfile/cfilearchive.cpp +++ b/src/cfile/cfilearchive.cpp @@ -101,10 +101,10 @@ void cf_init_lowlevel_read_code( CFILE * cfile, int offset, int size ) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; cb->lib_offset = offset; @@ -118,7 +118,7 @@ void cf_init_lowlevel_read_code( CFILE * cfile, int offset, int size ) #if defined(CHECK_POSITION) && !defined(NDEBUG) int raw_position = ftell(cb->fp) - cb->lib_offset; - Assert(raw_position == cb->raw_position); + SDL_assert(raw_position == cb->raw_position); #endif } } @@ -133,10 +133,10 @@ void cf_init_lowlevel_read_code( CFILE * cfile, int offset, int size ) int cfeof(CFILE *cfile) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; int result; @@ -144,13 +144,13 @@ int cfeof(CFILE *cfile) result = 0; // cfeof() not supported for memory-mapped files - Assert( !cb->data ); + SDL_assert( !cb->data ); - Assert(cb->fp != NULL); + SDL_assert(cb->fp != NULL); #if defined(CHECK_POSITION) && !defined(NDEBUG) int raw_position = ftell(cb->fp) - cb->lib_offset; - Assert(raw_position == cb->raw_position); + SDL_assert(raw_position == cb->raw_position); #endif if (cb->raw_position >= cb->size ) { @@ -169,19 +169,19 @@ int cfeof(CFILE *cfile) // int cftell( CFILE * cfile ) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; // Doesn't work for memory mapped files - Assert( !cb->data ); + SDL_assert( !cb->data ); - Assert(cb->fp != NULL); + SDL_assert(cb->fp != NULL); #if defined(CHECK_POSITION) && !defined(NDEBUG) int raw_position = ftell(cb->fp) - cb->lib_offset; - Assert(raw_position == cb->raw_position); + SDL_assert(raw_position == cb->raw_position); #endif return cb->raw_position; @@ -196,15 +196,15 @@ int cftell( CFILE * cfile ) int cfseek( CFILE *cfile, int offset, int where ) { - Assert(cfile != NULL); + SDL_assert(cfile != NULL); Cfile_block *cb; - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); cb = &Cfile_block_list[cfile->id]; // TODO: seek to offset in memory mapped file - Assert( !cb->data ); - Assert( cb->fp != NULL ); + SDL_assert( !cb->data ); + SDL_assert( cb->fp != NULL ); int goal_position; @@ -230,7 +230,7 @@ int cfseek( CFILE *cfile, int offset, int where ) #if defined(CHECK_POSITION) && !defined(NDEBUG) int tmp_offset = ftell(cb->fp) - cb->lib_offset; - Assert(tmp_offset==cb->raw_position); + SDL_assert(tmp_offset==cb->raw_position); #endif return result; @@ -244,22 +244,22 @@ int cfseek( CFILE *cfile, int offset, int where ) // int cfread(void *buf, int elsize, int nelem, CFILE *cfile) { - Assert(cfile != NULL); - Assert(buf != NULL); - Assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); + SDL_assert(cfile != NULL); + SDL_assert(buf != NULL); + SDL_assert(cfile->id >= 0 && cfile->id < MAX_CFILE_BLOCKS); Cfile_block *cb; cb = &Cfile_block_list[cfile->id]; // cfread() not supported for memory-mapped files - Assert( !cb->data ); - Assert(cb->fp != NULL); + SDL_assert( !cb->data ); + SDL_assert(cb->fp != NULL); int size = elsize*nelem; - Assert(nelem > 0); - Assert(elsize > 0); - Assert(size > 0); + SDL_assert(nelem > 0); + SDL_assert(elsize > 0); + SDL_assert(size > 0); if ( (cb->raw_position+size) > cb->size ) { size = cb->size - cb->raw_position; @@ -276,7 +276,7 @@ int cfread(void *buf, int elsize, int nelem, CFILE *cfile) #if defined(CHECK_POSITION) && !defined(NDEBUG) int tmp_offset = ftell(cb->fp) - cb->lib_offset; - Assert(tmp_offset==cb->raw_position); + SDL_assert(tmp_offset==cb->raw_position); #endif return bytes_read / elsize; diff --git a/src/cfile/cfilelist.cpp b/src/cfile/cfilelist.cpp index b5a5f8f..54b71f0 100644 --- a/src/cfile/cfilelist.cpp +++ b/src/cfile/cfilelist.cpp @@ -94,7 +94,7 @@ void cf_sort_filenames( int n, char **list, int sort, file_list_info *info ) for (i=incr; i= 0) { - if (stricmp(list[j], list[j + incr]) > 0) { + if (SDL_strcasecmp(list[j], list[j + incr]) > 0) { t = list[j]; list[j] = list[j + incr]; list[j + incr] = t; @@ -118,7 +118,7 @@ void cf_sort_filenames( int n, char **list, int sort, file_list_info *info ) return; } else if (sort == CF_SORT_TIME) { - Assert(info); + SDL_assert(info); incr = n / 2; while (incr > 0) { for (i=incr; icf_type == r2->cf_type){ - return stricmp(r1->path, r2->path); + return SDL_strcasecmp(r1->path, r2->path); } // otherwise return them in order of CF_TYPE_* precedence @@ -373,7 +373,7 @@ void cf_build_pack_list( cf_root *root ) { if (!fnmatch ("*.vp", dir->d_name, 0)) { - Assert(root_index < temp_root_count); + SDL_assert(root_index < temp_root_count); char fn[MAX_PATH]; snprintf(fn, MAX_PATH-1, "%s/%s", filespec, dir->d_name); @@ -423,7 +423,7 @@ void cf_build_pack_list( cf_root *root ) do { // add the new item if (!(find.attrib & _A_SUBDIR)) { - Assert(root_index < temp_root_count); + SDL_assert(root_index < temp_root_count); // get a temp pointer rptr_sort = &temp_roots_sort[root_index++]; @@ -449,7 +449,7 @@ void cf_build_pack_list( cf_root *root ) } // these should always be the same - Assert(root_index == temp_root_count); + SDL_assert(root_index == temp_root_count); // sort tht roots qsort(temp_roots_sort, temp_root_count, sizeof(cf_root_sort), cf_packfile_sort_func); @@ -529,7 +529,7 @@ int is_ext_in_list( const char *ext_list, char *ext ) char tmp_ext[128]; strncpy( tmp_ext, ext, 127 ); - strlwr(tmp_ext); + SDL_strlwr(tmp_ext); if ( strstr(ext_list, tmp_ext )) { return 1; } @@ -683,7 +683,7 @@ void cf_search_root_pack(int root_index) VP_FILE_HEADER VP_header; - Assert( sizeof(VP_header) == 16 ); + SDL_assert( sizeof(VP_header) == 16 ); fread(&VP_header, 1, sizeof(VP_header), fp); VP_header.version = INTEL_INT( VP_header.version); @@ -708,7 +708,7 @@ void cf_search_root_pack(int root_index) find.write_time = INTEL_INT(find.write_time); if ( find.size == 0 ) { - if ( !stricmp( find.filename, ".." )) { + if ( !SDL_strcasecmp( find.filename, ".." )) { int l = strlen(search_path); char *p = &search_path[l-1]; while( (p > search_path) && (*p != DIR_SEPARATOR_CHAR) ) { @@ -728,7 +728,7 @@ void cf_search_root_pack(int root_index) int j; for (j=CF_TYPE_ROOT; jname_ext) ) { + if ( !SDL_strcasecmp(loc_filespec, f->name_ext) ) { if ( size ) *size = f->size; if ( offset ) *offset = f->pack_offset; if ( pack_filename ) { @@ -943,7 +943,7 @@ int cf_find_file_location( const char *filespec, int pathtype, char *pack_filena } // file either not localized or localized version not found - if ( !stricmp(filespec, f->name_ext) ) { + if ( !SDL_strcasecmp(filespec, f->name_ext) ) { if ( size ) *size = f->size; if ( offset ) *offset = f->pack_offset; if ( pack_filename ) { @@ -983,7 +983,7 @@ int cf_matches_spec(const char *filespec, const char *filename) if (!dst_ext) return 1; - return !stricmp(dst_ext, src_ext); + return !SDL_strcasecmp(dst_ext, src_ext); } int (*Get_file_list_filter)(const char *filename) = NULL; @@ -1000,7 +1000,7 @@ int cf_file_already_in_list( int num_files, char **list, char *filename ) if ( p ) *p = 0; for (i=0; iargs == NULL); +// SDL_assert(parm->args == NULL); if ( parm->args != NULL ) { delete [] parm->args; parm->args = NULL; @@ -619,7 +619,7 @@ int cmdline_parm::found() // returns - the interger representation for the parameter arguement int cmdline_parm::get_int() { - Assert(args); + SDL_assert(args); return atoi(args); } @@ -627,7 +627,7 @@ int cmdline_parm::get_int() // returns - the float representation for the parameter arguement float cmdline_parm::get_float() { - Assert(args); + SDL_assert(args); return (float)atof(args); } @@ -635,7 +635,7 @@ float cmdline_parm::get_float() // returns - the string value for the parameter arguement char *cmdline_parm::str() { - Assert(args); + SDL_assert(args); return args; } diff --git a/src/cmeasure/cmeasure.cpp b/src/cmeasure/cmeasure.cpp index 628792a..2e18ef0 100644 --- a/src/cmeasure/cmeasure.cpp +++ b/src/cmeasure/cmeasure.cpp @@ -326,8 +326,8 @@ void cmeasure_render(object * objp) break; } - Assert(framenum != -1); - Assert(size != -1.0f); + SDL_assert(framenum != -1); + SDL_assert(size != -1.0f); gr_set_bitmap(fd->bitmap_id + framenum); g3_rotate_vertex(&p, &objp->pos ); @@ -341,11 +341,11 @@ void cmeasure_delete( object * objp ) num = objp->instance; -// Assert( Cmeasures[num].objnum == OBJ_INDEX(objp)); +// SDL_assert( Cmeasures[num].objnum == OBJ_INDEX(objp)); Cmeasures[num].subtype = CMEASURE_UNUSED; Num_cmeasures--; - Assert( Num_cmeasures >= 0 ); + SDL_assert( Num_cmeasures >= 0 ); } // broke cmeasure_move into two functions -- process_pre and process_post (as was done with @@ -360,7 +360,7 @@ void cmeasure_process_post(object * objp, float frame_time) int num; num = objp->instance; -// Assert( Cmeasures[num].objnum == objnum ); +// SDL_assert( Cmeasures[num].objnum == objnum ); cmeasure *cmp = &Cmeasures[num]; if ( cmp->lifeleft >= 0.0f) { @@ -395,8 +395,8 @@ int cmeasure_create( object * source_obj, vector * pos, int cm_type, int rand_va parent_objnum = OBJ_INDEX(source_obj); - Assert( source_obj->type == OBJ_SHIP ); - Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS ); + SDL_assert( source_obj->type == OBJ_SHIP ); + SDL_assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS ); shipp = &Ships[source_obj->instance]; @@ -419,7 +419,7 @@ int cmeasure_create( object * source_obj, vector * pos, int cm_type, int rand_va objnum = obj_create( OBJ_CMEASURE, parent_objnum, n, &source_obj->orient, pos, 1.0f, OF_RENDERS | OF_PHYSICS ); - Assert( objnum >= 0 && objnum < MAX_OBJECTS ); + SDL_assert( objnum >= 0 && objnum < MAX_OBJECTS ); // Create Debris piece n! if ( rand_val == -1 ) @@ -479,7 +479,7 @@ void cmeasure_select_next(object *objp) { ship *shipp; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); shipp = &Ships[objp->instance]; shipp->current_cmeasure++; diff --git a/src/controlconfig/controlsconfig.cpp b/src/controlconfig/controlsconfig.cpp index e623c20..11ef28f 100644 --- a/src/controlconfig/controlsconfig.cpp +++ b/src/controlconfig/controlsconfig.cpp @@ -909,16 +909,16 @@ config_item_undo *get_undo_block(int size) config_item_undo *ptr; ptr = (config_item_undo *) malloc( sizeof(config_item_undo) ); - Assert(ptr); + SDL_assert(ptr); ptr->next = Config_item_undo; Config_item_undo = ptr; ptr->size = size; if (size) { ptr->index = (int *) malloc( sizeof(int) * size ); - Assert(ptr->index); + SDL_assert(ptr->index); ptr->list = (config_item *) malloc( sizeof(config_item) * size ); - Assert(ptr->list); + SDL_assert(ptr->list); } else { ptr->index = NULL; @@ -1196,7 +1196,7 @@ int control_config_clear_all() } } - Assert(j == total); + SDL_assert(j == total); for (i=0; i= 0); + SDL_assert(axis >= 0); if ( axis > 1 ) { if (Axis_map_to_defaults[axis] < 0) @@ -1262,7 +1262,7 @@ int control_config_do_reset() j++; } - Assert(j == total); + SDL_assert(j == total); control_config_reset_defaults(); control_config_conflict_check(); control_config_list_prepare(); @@ -1291,7 +1291,7 @@ void control_config_scroll_screen_up() { if (Scroll_offset) { Scroll_offset--; - Assert(Selected_line > Scroll_offset); + SDL_assert(Selected_line > Scroll_offset); while (!cc_line_query_visible(Selected_line)) Selected_line--; @@ -1322,7 +1322,7 @@ void control_config_scroll_screen_down() Scroll_offset++; while (!cc_line_query_visible(Selected_line)) { Selected_line++; - Assert(Selected_line < Num_cc_lines); + SDL_assert(Selected_line < Num_cc_lines); } Selected_item = -1; @@ -1336,7 +1336,7 @@ void control_config_scroll_line_down() { if (Selected_line < Num_cc_lines - 1) { Selected_line++; - Assert(Selected_line > Scroll_offset); + SDL_assert(Selected_line > Scroll_offset); while (!cc_line_query_visible(Selected_line)) Scroll_offset++; @@ -1352,7 +1352,7 @@ void control_config_toggle_modifier(int bit) int k, z; z = Cc_lines[Selected_line].cc_index; - Assert(!(z & JOY_AXIS)); + SDL_assert(!(z & JOY_AXIS)); k = Control_config[z].key_id; if (k < 0) { gamesnd_play_iface(SND_GENERAL_FAIL); @@ -1369,7 +1369,7 @@ void control_config_toggle_invert() int z; z = Cc_lines[Selected_line].cc_index; - Assert(z & JOY_AXIS); + SDL_assert(z & JOY_AXIS); z &= ~JOY_AXIS; control_config_save_axis_undo(z); Invert_axis[z] = !Invert_axis[z]; @@ -1571,7 +1571,7 @@ const char *control_config_tooltip_handler(const char *str) { int i; - if (!stricmp(str, NOX("@conflict"))) { + if (!SDL_strcasecmp(str, NOX("@conflict"))) { for (i=0; i 0) { z = Cc_lines[Selected_line].cc_index; - Assert(!(z & JOY_AXIS)); + SDL_assert(!(z & JOY_AXIS)); control_config_bind_key(z, k); strcpy(bound_string, textify_scancode(k)); @@ -1866,7 +1866,7 @@ void control_config_do_frame(float frametime) for (i=0; i= 0); + SDL_assert(z >= 0); ptr = get_undo_block(1); ptr->index[0] = z; ptr->list[0] = Control_config[z]; diff --git a/src/controlconfig/controlsconfigcommon.cpp b/src/controlconfig/controlsconfigcommon.cpp index 300b58b..5fb6246 100644 --- a/src/controlconfig/controlsconfigcommon.cpp +++ b/src/controlconfig/controlsconfigcommon.cpp @@ -961,7 +961,7 @@ void set_modifier_status() Shift_is_modifier = 1; if (Control_config[i].key_id & KEY_CTRLED) { - Assert(0); // get Alan + SDL_assert(0); // get Alan Ctrl_is_modifier = 1; } } @@ -982,8 +982,8 @@ int translate_key_to_index(const char *key) } // look for modifiers - Assert(key); - if (!strnicmp(key, "Alt", 3)) { + SDL_assert(key); + if (!SDL_strncasecmp(key, "Alt", 3)) { alt = 1; key += 3; if (*key) @@ -1000,7 +1000,7 @@ int translate_key_to_index(const char *key) translated_shift = "Shift"; } - if (!strnicmp(key, translated_shift, 5)) { + if (!SDL_strncasecmp(key, translated_shift, 5)) { shift = 1; key += 5; if (*key) @@ -1017,7 +1017,7 @@ int translate_key_to_index(const char *key) // look up index for default key if (*key) { for (i=0; i= 0) && (Selected_line < Num_files) ); + SDL_assert( (Selected_line >= 0) && (Selected_line < Num_files) ); which_cutscene = Cutscene_list[Selected_line]; strcpy(name, Cutscenes[which_cutscene].filename ); @@ -448,7 +448,7 @@ void cutscenes_screen_scroll_screen_up() if (Scroll_offset) { Scroll_offset--; - Assert(Selected_line > Scroll_offset); + SDL_assert(Selected_line > Scroll_offset); h = Cutscene_list_coords[gr_screen.res][3] / gr_get_font_height(); while (Selected_line >= Scroll_offset + h){ Selected_line--; @@ -695,7 +695,7 @@ void cutscenes_screen_do_frame() src = Cutscenes[Cutscene_list[Description_index]].description; if (src) { Text_size = split_str(src, Cutscene_desc_coords[gr_screen.res][2], Text_line_size, Text_lines, Cutscene_max_text_lines[gr_screen.res]); - Assert(Text_size >= 0 && Text_size < Cutscene_max_text_lines[gr_screen.res]); + SDL_assert(Text_size >= 0 && Text_size < Cutscene_max_text_lines[gr_screen.res]); } } diff --git a/src/debris/debris.cpp b/src/debris/debris.cpp index 804c725..854da6c 100644 --- a/src/debris/debris.cpp +++ b/src/debris/debris.cpp @@ -375,10 +375,10 @@ void debris_render(object * obj) pm = NULL; num = obj->instance; - Assert(num >= 0 && num < MAX_DEBRIS_PIECES ); + SDL_assert(num >= 0 && num < MAX_DEBRIS_PIECES ); db = &Debris[num]; - Assert( db->flags & DEBRIS_USED ); + SDL_assert( db->flags & DEBRIS_USED ); // Swap in a different texture depending on the species if ( (db->species > -1) && (db->species < MAX_SPECIES_NAMES) ) { @@ -423,7 +423,7 @@ void debris_clear_expired_flag(debris *db) if ( db->is_hull ) { Num_hull_pieces--; list_remove(Hull_debris_list, db); - Assert( Num_hull_pieces >= 0 ); + SDL_assert( Num_hull_pieces >= 0 ); } } } @@ -440,11 +440,11 @@ void debris_delete( object * obj ) debris *db; num = obj->instance; - Assert( Debris[num].objnum == OBJ_INDEX(obj)); + SDL_assert( Debris[num].objnum == OBJ_INDEX(obj)); db = &Debris[num]; - Assert( Num_debris_pieces >= 0 ); + SDL_assert( Num_debris_pieces >= 0 ); if ( db->is_hull && (db->flags & DEBRIS_EXPIRE) ) { debris_clear_expired_flag(db); } @@ -504,7 +504,7 @@ void debris_process_post(object * obj, float frame_time) num = obj->instance; int objnum = OBJ_INDEX(obj); - Assert( Debris[num].objnum == objnum ); + SDL_assert( Debris[num].objnum == objnum ); debris *db = &Debris[num]; if ( db->is_hull ) { @@ -680,8 +680,8 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto parent_objnum = OBJ_INDEX(source_obj); - Assert( (source_obj->type == OBJ_SHIP ) || (source_obj->type == OBJ_GHOST)); - Assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS ); + SDL_assert( (source_obj->type == OBJ_SHIP ) || (source_obj->type == OBJ_GHOST)); + SDL_assert( source_obj->instance >= 0 && source_obj->instance < MAX_SHIPS ); shipp = &Ships[source_obj->instance]; vaporize = (shipp->flags &SF_VAPORIZE); @@ -921,7 +921,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto // ensure vel is valid - Assert( !vm_is_vec_nan(&obj->phys_info.vel) ); + SDL_assert( !vm_is_vec_nan(&obj->phys_info.vel) ); // if ( hull_flag ) { // vm_vec_zero(&obj->phys_info.vel); @@ -1006,17 +1006,17 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c mc_info mc; int num; - Assert( pdebris->type == OBJ_DEBRIS ); + SDL_assert( pdebris->type == OBJ_DEBRIS ); num = pdebris->instance; - Assert( num >= 0 ); + SDL_assert( num >= 0 ); - Assert( Debris[num].objnum == OBJ_INDEX(pdebris)); + SDL_assert( Debris[num].objnum == OBJ_INDEX(pdebris)); // debris_hit_info NULL - so debris-weapon collision if ( debris_hit_info == NULL ) { // debris weapon collision - Assert( other_obj->type == OBJ_WEAPON ); + SDL_assert( other_obj->type == OBJ_WEAPON ); mc.model_num = Debris[num].model_num; // Fill in the model to check mc.submodel_num = Debris[num].submodel_num; model_clear_instance( mc.model_num ); @@ -1035,7 +1035,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c // debris ship collision -- use debris_hit_info to calculate physics object *ship_obj = other_obj; - Assert( ship_obj->type == OBJ_SHIP ); + SDL_assert( ship_obj->type == OBJ_SHIP ); object *heavy = debris_hit_info->heavy; object *light = debris_hit_info->light; @@ -1258,8 +1258,8 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c // int debris_get_team(object *objp) { - Assert( objp->type == OBJ_DEBRIS ); - Assert( objp->instance >= 0 && objp->instance < MAX_DEBRIS_PIECES ); + SDL_assert( objp->type == OBJ_DEBRIS ); + SDL_assert( objp->instance >= 0 && objp->instance < MAX_DEBRIS_PIECES ); return Debris[objp->instance].team; } diff --git a/src/debugconsole/console.cpp b/src/debugconsole/console.cpp index 368fcef..7807c27 100644 --- a/src/debugconsole/console.cpp +++ b/src/debugconsole/console.cpp @@ -134,7 +134,7 @@ debug_command::debug_command(const char *_name, const char *_help, void (*_func) } for (i=0; iname, _name ); + int ret = SDL_strcasecmp( Debug_command[i]->name, _name ); if ( ret == 0) { Int3(); // This debug console command already exists!!!! @@ -397,22 +397,22 @@ void dc_get_arg(uint type) dc_printf( "Found hex number! 0x%x\n", Dc_arg_int ); } - if ( !stricmp( Dc_arg, "on" )) + if ( !SDL_strcasecmp( Dc_arg, "on" )) Dc_arg_type |= ARG_TRUE; - if ( !stricmp( Dc_arg, "true" )) + if ( !SDL_strcasecmp( Dc_arg, "true" )) Dc_arg_type |= ARG_TRUE; - if ( !stricmp( Dc_arg, "off" )) + if ( !SDL_strcasecmp( Dc_arg, "off" )) Dc_arg_type |= ARG_FALSE; - if ( !stricmp( Dc_arg, "false" )) + if ( !SDL_strcasecmp( Dc_arg, "false" )) Dc_arg_type |= ARG_FALSE; - if ( !stricmp( Dc_arg, "+" )) + if ( !SDL_strcasecmp( Dc_arg, "+" )) Dc_arg_type |= ARG_PLUS; - if ( !stricmp( Dc_arg, "-" )) + if ( !SDL_strcasecmp( Dc_arg, "-" )) Dc_arg_type |= ARG_MINUS; - if ( !stricmp( Dc_arg, "," )) + if ( !SDL_strcasecmp( Dc_arg, "," )) Dc_arg_type |= ARG_COMMA; } @@ -493,7 +493,7 @@ void debug_do_command(const char * command) } for (i=0; iname, Dc_arg )) { + if ( !SDL_strcasecmp( Debug_command[i]->name, Dc_arg )) { if (mode==0) { if (Dc_debug_on) @@ -722,7 +722,7 @@ void debug_console( void (*_func)() ) int i, found = 0; for (i=0; i<=last_oldcommand; i++ ) { - if (!stricmp( oldcommand_line[i], command_line )) { + if (!SDL_strcasecmp( oldcommand_line[i], command_line )) { found = 1; } } diff --git a/src/demo/demo.cpp b/src/demo/demo.cpp index 7ff42b8..fb2ad9b 100644 --- a/src/demo/demo.cpp +++ b/src/demo/demo.cpp @@ -219,7 +219,7 @@ int demo_do_frame_start() } // make sure we're not trying to record and playback at the same time - Assert( ((Game_mode & GM_DEMO_RECORD) && !(Game_mode & GM_DEMO_PLAYBACK)) || (!(Game_mode & GM_DEMO_RECORD) && (Game_mode & GM_DEMO_PLAYBACK)) ); + SDL_assert( ((Game_mode & GM_DEMO_RECORD) && !(Game_mode & GM_DEMO_PLAYBACK)) || (!(Game_mode & GM_DEMO_RECORD) && (Game_mode & GM_DEMO_PLAYBACK)) ); // recording if(Game_mode & GM_DEMO_RECORD){ @@ -256,7 +256,7 @@ int demo_do_frame_end() } // make sure we're not trying to record and playback at the same time - Assert( ((Game_mode & GM_DEMO_RECORD) && !(Game_mode & GM_DEMO_PLAYBACK)) || (!(Game_mode & GM_DEMO_RECORD) && (Game_mode & GM_DEMO_PLAYBACK)) ); + SDL_assert( ((Game_mode & GM_DEMO_RECORD) && !(Game_mode & GM_DEMO_PLAYBACK)) || (!(Game_mode & GM_DEMO_RECORD) && (Game_mode & GM_DEMO_PLAYBACK)) ); // recording. there's nothing to do here for playback if(Game_mode & GM_DEMO_RECORD){ @@ -835,7 +835,7 @@ int demo_playback_seek_sub(int frame_size) // find our ship object ship_index = ship_get_by_signature(obj_sig); - // Assert(ship_index >= 0); + // SDL_assert(ship_index >= 0); if(ship_index >= 0){ Objects[Ships[ship_index].objnum].pos = obj_pos; Objects[Ships[ship_index].objnum].orient = obj_orient; diff --git a/src/fireball/fireballs.cpp b/src/fireball/fireballs.cpp index 775a23f..63feac0 100644 --- a/src/fireball/fireballs.cpp +++ b/src/fireball/fireballs.cpp @@ -404,7 +404,7 @@ void fireball_play_warphole_open_sound(int ship_class, fireball *fb) float range_multiplier = 1.0f; object *fireball_objp; - Assert((fb != NULL) && (fb->objnum >= 0)); + SDL_assert((fb != NULL) && (fb->objnum >= 0)); if((fb == NULL) || (fb->objnum < 0)){ return; } @@ -465,7 +465,7 @@ void fireball_parse_tbl() int ntypes = 0; required_string("#Start"); while (required_string_either("#End","$Name:")) { - Assert( ntypes < MAX_FIREBALL_TYPES); + SDL_assert( ntypes < MAX_FIREBALL_TYPES); // base filename required_string("$Name:"); @@ -664,11 +664,11 @@ void fireball_delete( object * obj ) num = obj->instance; fb = &Fireballs[num]; - Assert( fb->objnum == OBJ_INDEX(obj)); + SDL_assert( fb->objnum == OBJ_INDEX(obj)); Fireballs[num].objnum = -1; Num_fireballs--; - Assert( Num_fireballs >= 0 ); + SDL_assert( Num_fireballs >= 0 ); } // ----------------------------------------------------------------- @@ -748,7 +748,7 @@ int fireball_is_perishable(object * obj) num = obj->instance; objnum = OBJ_INDEX(obj); - Assert( Fireballs[num].objnum == objnum ); + SDL_assert( Fireballs[num].objnum == objnum ); fb = &Fireballs[num]; @@ -814,7 +814,7 @@ int fireball_is_warp(object * obj) num = obj->instance; objnum = OBJ_INDEX(obj); - Assert( Fireballs[num].objnum == objnum ); + SDL_assert( Fireballs[num].objnum == objnum ); fb = &Fireballs[num]; @@ -858,7 +858,7 @@ void fireball_process_post(object * obj, float frame_time) num = obj->instance; objnum = OBJ_INDEX(obj); - Assert( Fireballs[num].objnum == objnum ); + SDL_assert( Fireballs[num].objnum == objnum ); fb = &Fireballs[num]; @@ -880,7 +880,7 @@ float fireball_lifeleft( object *obj ) num = obj->instance; objnum = OBJ_INDEX(obj); - Assert( Fireballs[num].objnum == objnum ); + SDL_assert( Fireballs[num].objnum == objnum ); fb = &Fireballs[num]; @@ -895,7 +895,7 @@ float fireball_lifeleft_percent( object *obj ) num = obj->instance; objnum = OBJ_INDEX(obj); - Assert( Fireballs[num].objnum == objnum ); + SDL_assert( Fireballs[num].objnum == objnum ); fb = &Fireballs[num]; @@ -993,8 +993,8 @@ int fireball_create( vector * pos, int fireball_type, int parent_obj, float size fireball_info *fd; fireball_lod *fl; - Assert( fireball_type > -1 ); - Assert( fireball_type < MAX_FIREBALL_TYPES ); + SDL_assert( fireball_type > -1 ); + SDL_assert( fireball_type < MAX_FIREBALL_TYPES ); fd = &Fireball_info[fireball_type]; @@ -1028,7 +1028,7 @@ int fireball_create( vector * pos, int fireball_type, int parent_obj, float size break; } } - Assert( n != MAX_FIREBALLS ); + SDL_assert( n != MAX_FIREBALLS ); } fb = &Fireballs[n]; @@ -1115,7 +1115,7 @@ int fireball_create( vector * pos, int fireball_type, int parent_obj, float size } if ( fb->fireball_info_index == FIREBALL_WARP_EFFECT || fb->fireball_info_index == FIREBALL_KNOSSOS_EFFECT ) { - Assert( warp_lifetime > 4.0f ); // Warp lifetime must be at least 4 seconds! + SDL_assert( warp_lifetime > 4.0f ); // Warp lifetime must be at least 4 seconds! fb->total_time = warp_lifetime; // in seconds } else { fb->total_time = i2fl(fl->num_frames) / fl->fps; // in seconds diff --git a/src/fonttool/fontkern.cpp b/src/fonttool/fontkern.cpp index e2d802b..c57c100 100644 --- a/src/fonttool/fontkern.cpp +++ b/src/fonttool/fontkern.cpp @@ -332,9 +332,9 @@ void fonttool_edit_kerning(char *fname1, char *argv[]) // setup the fred exe directory so CFILE can init properly //char *c = GetCommandLine(); - //Assert(c != NULL); + //SDL_assert(c != NULL); //char *tok = strtok(c, " "); - //Assert(tok != NULL); + //SDL_assert(tok != NULL); #ifdef PLAT_UNIX char whee[1024]; getcwd (whee, 1024); diff --git a/src/fred2/asteroideditordlg.cpp b/src/fred2/asteroideditordlg.cpp index a7125ad..30e2962 100644 --- a/src/fred2/asteroideditordlg.cpp +++ b/src/fred2/asteroideditordlg.cpp @@ -401,7 +401,7 @@ void asteroid_editor::update_init() MODIFY(a_field[last_field].inner_max_bound.z, (float) atof(m_box_max_z)); } - Assert(cur_field >= 0); + SDL_assert(cur_field >= 0); // get from temp asteroid field into class m_enable_asteroids = a_field[cur_field].num_initial_asteroids ? TRUE : FALSE; m_enable_inner_bounds = a_field[cur_field].has_inner_bound ? TRUE : FALSE; diff --git a/src/fred2/bgbitmapdlg.cpp b/src/fred2/bgbitmapdlg.cpp index 454e281..2285c37 100644 --- a/src/fred2/bgbitmapdlg.cpp +++ b/src/fred2/bgbitmapdlg.cpp @@ -428,8 +428,8 @@ void bg_bitmap_dlg::OnSelchangeNebcolor() char palette_filename[1024]; - Assert( Mission_palette >= 0 ); - Assert( Mission_palette <= 98 ); + SDL_assert( Mission_palette >= 0 ); + SDL_assert( Mission_palette <= 98 ); sprintf( palette_filename, "gamepalette%d-%02d", 1, Mission_palette+1 ); @@ -547,7 +547,7 @@ void bg_bitmap_dlg::build_nebfile_list() CComboBox *box = (CComboBox *) GetDlgItem(IDC_NEBPATTERN); // wacky - Assert(box != NULL); + SDL_assert(box != NULL); if(box == NULL){ return; } @@ -644,7 +644,7 @@ void bg_bitmap_dlg::OnSunChange() // select the proper item from the dropdown drop_index = ((CComboBox*)GetDlgItem(IDC_SUN1))->FindString( -1, Suns[s_index].filename ); - Assert(drop_index != CB_ERR); + SDL_assert(drop_index != CB_ERR); if(drop_index != CB_ERR){ ((CComboBox*)GetDlgItem(IDC_SUN1))->SetCurSel(drop_index); } @@ -716,7 +716,7 @@ void bg_bitmap_dlg::OnSunDropdownChange() } int new_index = ((CComboBox*)GetDlgItem(IDC_SUN1))->GetCurSel(); - Assert(new_index != CB_ERR); + SDL_assert(new_index != CB_ERR); // get the new string if(new_index != CB_ERR){ @@ -809,7 +809,7 @@ void bg_bitmap_dlg::OnBitmapChange() // select the proper item from the dropdown drop_index = ((CComboBox*)GetDlgItem(IDC_SBITMAP))->FindString( -1, Starfield_bitmap_instance[b_index].filename ); - Assert(drop_index != CB_ERR); + SDL_assert(drop_index != CB_ERR); if(drop_index != CB_ERR){ ((CComboBox*)GetDlgItem(IDC_SBITMAP))->SetCurSel(drop_index); } @@ -881,7 +881,7 @@ void bg_bitmap_dlg::OnBitmapDropdownChange() } int new_index = ((CComboBox*)GetDlgItem(IDC_SBITMAP))->GetCurSel(); - Assert(new_index != CB_ERR); + SDL_assert(new_index != CB_ERR); // get the new string if(new_index != CB_ERR){ diff --git a/src/fred2/briefingeditordlg.cpp b/src/fred2/briefingeditordlg.cpp index 77c084d..7362785 100644 --- a/src/fred2/briefingeditordlg.cpp +++ b/src/fred2/briefingeditordlg.cpp @@ -864,7 +864,7 @@ void briefing_editor_dlg::OnDeleteStage() if (m_cur_stage < 0) return; - Assert(Briefing->num_stages); + SDL_assert(Briefing->num_stages); z = m_cur_stage; m_cur_stage = -1; update_data(1); @@ -1180,7 +1180,7 @@ void briefing_editor_dlg::OnMakeIcon() } icon_obj[m_cur_icon] = obj_create(OBJ_POINT, -1, m_cur_icon, NULL, &pos, 0.0f, OF_RENDERS); - Assert(icon_obj[m_cur_icon] >= 0); + SDL_assert(icon_obj[m_cur_icon] >= 0); obj_merge_created_list(); unmark_all(); set_cur_object_index(icon_obj[m_cur_icon]); @@ -1204,8 +1204,8 @@ void briefing_editor_dlg::delete_icon(int num) if (num < 0) return; - Assert(m_cur_stage >= 0); - Assert(Briefing->stages[m_cur_stage].num_icons); + SDL_assert(m_cur_stage >= 0); + SDL_assert(Briefing->stages[m_cur_stage].num_icons); z = m_cur_icon; if (z == num) z = -1; diff --git a/src/fred2/campaigneditordlg.cpp b/src/fred2/campaigneditordlg.cpp index 3d73f71..8dc8f97 100644 --- a/src/fred2/campaigneditordlg.cpp +++ b/src/fred2/campaigneditordlg.cpp @@ -57,7 +57,7 @@ int campaign_sexp_tree::load_sub_tree(int index) // assumption: first token is an operator. I require this because it would cause problems // with child/parent relations otherwise, and it should be this way anyway, since the // return type of the whole sexp is boolean, and only operators can satisfy this. - Assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); + SDL_assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); cur = get_new_node_position(); load_branch(index, -1); return cur; @@ -474,7 +474,7 @@ void campaign_editor::OnSelchangedSexpTree(NMHDR* pNMHDR, LRESULT* pResult) // get handle of selected item NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; h = pNMTreeView->itemNew.hItem; - Assert(h); + SDL_assert(h); // update help on sexp m_tree.update_help(h); @@ -585,14 +585,14 @@ void campaign_editor::swap_handler(int node1, int node2) } } - Assert(index1 < Total_links); + SDL_assert(index1 < Total_links); for (index2=0; index2GetTextMetrics(&tm); - Assert(r); + SDL_assert(r); Bx = CELL_TEXT_WIDTH + 4; By = tm.tmHeight + 4; r = gray_brush.CreateSolidBrush(RGB(192, 192, 192)); - Assert(r); + SDL_assert(r); pDC->FillRect(CRect(0, 0, total_width * CELL_WIDTH, total_levels * LEVEL_HEIGHT), &gray_brush); // create pens r = black_pen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); - Assert(r); + SDL_assert(r); r = white_pen.CreatePen(PS_SOLID, 1, RGB(255, 255, 255)); - Assert(r); + SDL_assert(r); r = red_pen.CreatePen(PS_SOLID, 1, RGB(192, 0, 0)); - Assert(r); + SDL_assert(r); r = blue_pen.CreatePen(PS_SOLID, 1, RGB(0, 0, 192)); - Assert(r); + SDL_assert(r); r = green_pen.CreatePen(PS_SOLID, 1, RGB(0, 192, 0)); - Assert(r); + SDL_assert(r); pDC->SelectObject(&black_pen); // draw level seperators @@ -367,7 +367,7 @@ void campaign_tree_view::realign_tree() z = Sorted[i]; for (j=0; j= 0) && (level < total_levels)); + SDL_assert((level >= 0) && (level < total_levels)); return level; } @@ -781,7 +781,7 @@ int campaign_tree_view::query_pos(const CPoint& p) return -1; pos = ((p.x * 4 / CELL_WIDTH) + 1) / 2; - Assert((pos >= 0) && (pos <= total_width * 2)); + SDL_assert((pos >= 0) && (pos <= total_width * 2)); return pos; } @@ -799,7 +799,7 @@ int campaign_tree_view::query_alternate_pos(const CPoint& p) else // even number pos++; - Assert((pos >= 0) && (pos <= total_width * 2)); + SDL_assert((pos >= 0) && (pos <= total_width * 2)); return pos; } /* @@ -917,7 +917,7 @@ BOOL campaign_tree_view::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffe level = query_level(point); pos = query_pos(point); - Assert((level >= 0) && (pos >= 0)); // this should be impossible + SDL_assert((level >= 0) && (pos >= 0)); // this should be impossible if (!level && (get_root_mission() >= 0)) { GlobalUnlock(hGlobal); MessageBox("Only 1 mission may be in the top level"); @@ -992,7 +992,7 @@ void campaign_tree_view::drop_mission(int m, CPoint point) level = query_level(point); pos = query_pos(point); - Assert((level >= 0) && (pos >= 0)); // this should be impossible + SDL_assert((level >= 0) && (pos >= 0)); // this should be impossible listbox = (CListBox *) &Campaign_tree_formp->m_filelist; item = listbox->GetCurSel(); @@ -1159,7 +1159,7 @@ void campaign_tree_view::horizontally_align_mission(int num, int dir) void campaign_tree_view::delete_link(int num) { - Assert((num >= 0) && (num < Total_links)); + SDL_assert((num >= 0) && (num < Total_links)); if (Links[num].from != Links[num].to) { Elements[Links[num].from].from_links--; Elements[Links[num].to].to_links--; @@ -1243,7 +1243,7 @@ void campaign_tree_view::remove_mission(int m) int i, z; CEdit *box; - Assert(m >= 0); + SDL_assert(m >= 0); Campaign_tree_formp->m_filelist.AddString(Campaign.missions[m].name); z = --Campaign.num_missions; diff --git a/src/fred2/cmdbrief.cpp b/src/fred2/cmdbrief.cpp index 5a22aac..94ed9ee 100644 --- a/src/fred2/cmdbrief.cpp +++ b/src/fred2/cmdbrief.cpp @@ -267,7 +267,7 @@ void cmd_brief_dlg::OnDeleteStage() if (m_cur_stage < 0) return; - Assert(Cur_cmd_brief->num_stages); + SDL_assert(Cur_cmd_brief->num_stages); z = m_cur_stage; m_cur_stage = -1; update_data(1); diff --git a/src/fred2/debriefingeditordlg.cpp b/src/fred2/debriefingeditordlg.cpp index 8b7bee8..9749187 100644 --- a/src/fred2/debriefingeditordlg.cpp +++ b/src/fred2/debriefingeditordlg.cpp @@ -373,7 +373,7 @@ void debriefing_editor_dlg::OnDeleteStage() if (m_cur_stage < 0) return; - Assert(Debriefing->num_stages); + SDL_assert(Debriefing->num_stages); z = m_cur_stage; m_cur_stage = -1; update_data(1); diff --git a/src/fred2/eventeditor.cpp b/src/fred2/eventeditor.cpp index cd74954..0aeb109 100644 --- a/src/fred2/eventeditor.cpp +++ b/src/fred2/eventeditor.cpp @@ -53,7 +53,7 @@ * Changed input into sexp_tree::insert() to include bitmaps * * 3 11/06/98 11:21a Johnson - * Put in handling code for wacky event editor Assert(). + * Put in handling code for wacky event editor SDL_assert(). * * 2 10/07/98 6:28p Dave * Initial checkin. Renamed all relevant stuff to be Fred2 instead of @@ -194,7 +194,7 @@ int sexp_event_tree::load_sub_tree(int index) // assumption: first token is an operator. I require this because it would cause problems // with child/parent relations otherwise, and it should be this way anyway, since the // return type of the whole sexp is boolean, and only operators can satisfy this. - Assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); + SDL_assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); cur = get_new_node_position(); load_branch(index, -1); return cur; @@ -528,7 +528,7 @@ void event_editor::OnBeginlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult) *pResult = 0; modified = 1; edit = m_event_tree.GetEditControl(); - Assert(edit); + SDL_assert(edit); edit->SetLimitText(NAME_LENGTH - 1); } else @@ -771,7 +771,7 @@ int event_editor::handler(int code, int node, char *str) if (m_events[i].formula == node) break; - Assert(i < m_num_events); + SDL_assert(i < m_num_events); while (i < m_num_events - 1) { m_events[i] = m_events[i + 1]; m_sig[i] = m_sig[i + 1]; @@ -787,8 +787,8 @@ int event_editor::handler(int code, int node, char *str) if (m_events[i].formula == node) break; - Assert(i < m_num_events); - Assert(strlen(str) < NAME_LENGTH); + SDL_assert(i < m_num_events); + SDL_assert(strlen(str) < NAME_LENGTH); strcpy(m_events[i].name, str); return node; @@ -944,7 +944,7 @@ void event_editor::insert_handler(int old, int node) } } - Assert(i < m_num_events); + SDL_assert(i < m_num_events); m_events[i].formula = node; return; } @@ -1056,7 +1056,7 @@ void event_editor::OnSelchangedEventTree(NMHDR* pNMHDR, LRESULT* pResult) } } - Assert(i < m_num_events); + SDL_assert(i < m_num_events); cur_event = i; update_cur_event(); @@ -1158,14 +1158,14 @@ void event_editor::swap_handler(int node1, int node2) } } - Assert(index1 < m_num_events); + SDL_assert(index1 < m_num_events); for (index2=0; index2"); ((CListBox *) GetDlgItem(IDC_MESSAGE_LIST))->AddString(""); @@ -1338,7 +1338,7 @@ void event_editor::OnDeleteMsg() int i; // handle this case somewhat gracefully - Assert((m_cur_msg >= 0) && (m_cur_msg < m_num_messages)); + SDL_assert((m_cur_msg >= 0) && (m_cur_msg < m_num_messages)); if((m_cur_msg < 0) || (m_cur_msg >= m_num_messages)){ return; } diff --git a/src/fred2/fred.cpp b/src/fred2/fred.cpp index b05995d..4f2e6f8 100644 --- a/src/fred2/fred.cpp +++ b/src/fred2/fred.cpp @@ -390,12 +390,12 @@ BOOL CFREDApp::InitInstance() // setup the fred exe directory so CFILE can init properly /* c = GetCommandLine(); - Assert(c != NULL); + SDL_assert(c != NULL); if(c == NULL){ return FALSE; } tok = strtok(c, " \n"); - Assert(tok != NULL); + SDL_assert(tok != NULL); if(tok == NULL){ return FALSE; } @@ -672,8 +672,8 @@ BOOL CFREDApp::OnIdle(LONG lCount) // gr_surface_flip(); - // if you hit the next Assert, find Hoffoss or Allender. If neither here, then comment it out. - Assert( Update_window >= 0 ); + // if you hit the next SDL_assert, find Hoffoss or Allender. If neither here, then comment it out. + SDL_assert( Update_window >= 0 ); if (Update_window) { draw_render_window(pDC); // this actually copies the offscreen buffer to the screen Update_window--; @@ -703,7 +703,7 @@ void update_map_window() render_frame(); // "do the rendering!" CDC* pDC = pFV->GetDC(); - Assert(pDC); + SDL_assert(pDC); draw_render_window(pDC); if ( Update_window > 0 ) @@ -808,7 +808,7 @@ int CFREDApp::init_window(window_data *wndd, CWnd *wnd, int adjust, int pre) if (wndd->processed) return -2; - Assert(wnd->GetSafeHwnd()); + SDL_assert(wnd->GetSafeHwnd()); wnd->GetWindowPlacement(&p); width = p.rcNormalPosition.right - p.rcNormalPosition.left; height = p.rcNormalPosition.bottom - p.rcNormalPosition.top + adjust; diff --git a/src/fred2/freddoc.cpp b/src/fred2/freddoc.cpp index 0ae6f30..7fb33df 100644 --- a/src/fred2/freddoc.cpp +++ b/src/fred2/freddoc.cpp @@ -621,7 +621,7 @@ int CFREDDoc::load_mission(char *pathname) objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { if (objp->flags & OF_PLAYER_SHIP) { - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); objp->type = OBJ_START; // Player_starts++; } @@ -647,7 +647,7 @@ int CFREDDoc::load_mission(char *pathname) ai_update_goal_references(REF_TYPE_SHIP, old_name, name); for (k=0; k= 0); - Assert(Mission_palette <= 98); + SDL_assert(Mission_palette >= 0); + SDL_assert(Mission_palette <= 98); if (The_mission.flags & MISSION_FLAG_SUBSPACE) { strcpy(name, NOX("gamepalette-subspace")); @@ -981,7 +981,7 @@ void cfile_serialize(XFILE *fp, int flag) int i; int highest_object_index = 0, highest_ship_index = 0, highest_ai_index = 0; - Assert((flag == 0) || (flag == 1)); + SDL_assert((flag == 0) || (flag == 1)); // fp = cfopen(filename, flag ? "wb" : "rb"); // if (!fp) diff --git a/src/fred2/fredrender.cpp b/src/fred2/fredrender.cpp index 6fd8b77..4a04c22 100644 --- a/src/fred2/fredrender.cpp +++ b/src/fred2/fredrender.cpp @@ -723,7 +723,7 @@ void render_one_model(object *objp) int j, z; object *o2; - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if ( objp->type == OBJ_JUMP_NODE ) { return; @@ -830,7 +830,7 @@ void render_one_model(object *objp) } else if (objp->type == OBJ_POINT) { if (objp->instance != BRIEFING_LOOKAT_POINT_ID) { - Assert(Briefing_dialog); + SDL_assert(Briefing_dialog); Briefing_dialog->draw_icon(objp); goto skip; } @@ -838,7 +838,7 @@ void render_one_model(object *objp) r = 196; g = 32; b = 196; } else - Assert(0); + SDL_assert(0); if (Fred_outline) draw_orient_sphere2(Fred_outline, objp, r, g, b); @@ -905,7 +905,7 @@ void display_ship_info() objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); Fred_outline = 0; render = 1; if (OBJ_INDEX(objp) == cur_object_index) @@ -967,7 +967,7 @@ void display_ship_info() } else if (objp->type == OBJ_JUMP_NODE) { strcpy(buf, "Jump Node"); } else - Assert(0); + SDL_assert(0); } if (Show_coordinates) @@ -1448,7 +1448,7 @@ void game_do_frame() objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if ((objp->flags & OF_MARKED) && (cur_object_index != OBJ_INDEX(objp))) { if (Group_rotate) { matrix rot_trans; @@ -1506,7 +1506,7 @@ void game_do_frame() break; default: - Assert(0); + SDL_assert(0); } if (Lookat_mode && query_valid_object()) { @@ -1529,7 +1529,7 @@ void game_do_frame() break; default: - Assert(0); + SDL_assert(0); } maybe_create_new_grid(The_grid, &eye_pos, &eye_orient); diff --git a/src/fred2/fredview.cpp b/src/fred2/fredview.cpp index b3ac037..bf36be5 100644 --- a/src/fred2/fredview.cpp +++ b/src/fred2/fredview.cpp @@ -797,8 +797,8 @@ void CFREDView::OnDraw(CDC* pDC) pDC->GetClipBox(&clip); gr_set_clip(clip.left, clip.top, clip.right - clip.left + 1, clip.bottom - clip.top + 1); - Assert(clip.left <= clip.right); - Assert(clip.top <= clip.bottom); + SDL_assert(clip.left <= clip.right); + SDL_assert(clip.top <= clip.bottom); gr_flip_window((uint) pDC->m_hDC, clip.left, clip.top, clip.right - clip.left + 1, clip.bottom - clip.top + 1); } @@ -917,7 +917,7 @@ int drag_objects() flag = 0; objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if (objp->flags & OF_MARKED) { if ((objp->type == OBJ_SHIP) || (objp->type == OBJ_START)) { z = Ships[objp->instance].wingnum; @@ -982,7 +982,7 @@ int drag_objects() } objp = &Objects[cur_object_index]; - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); obj = int_pnt = objp->pos; // Get 3d vector specified by mouse cursor location. @@ -1036,7 +1036,7 @@ int drag_objects() if (distance_moved) { objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if (objp->flags & OF_MARKED) { vm_vec_add(&objp->pos, &objp->pos, &movement_vector); if (objp->type == OBJ_WAYPOINT) { @@ -1075,7 +1075,7 @@ void drag_rotate_save_backup() objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if (objp->flags & OF_MARKED) { rotation_backup[OBJ_INDEX(objp)].pos = objp->pos; rotation_backup[OBJ_INDEX(objp)].orient = objp->orient; @@ -1111,7 +1111,7 @@ int drag_rotate_objects() } objp = &Objects[cur_object_index]; - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); obj = int_pnt = objp->pos; memset(&a, 0, sizeof(angles)); @@ -1146,7 +1146,7 @@ int drag_rotate_objects() objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if ((objp->flags & OF_MARKED) && (cur_object_index != OBJ_INDEX(objp) )) { if (Group_rotate) { matrix rot_trans; @@ -1205,7 +1205,7 @@ void cancel_drag() /* if (Bg_bitmap_dialog) { - Assert(!vm_check_matrix_for_zeros(&bitmap_matrix_backup)); + SDL_assert(!vm_check_matrix_for_zeros(&bitmap_matrix_backup)); Starfield_bitmaps[Cur_bitmap].m = bitmap_matrix_backup; calculate_bitmap_points(&Starfield_bitmaps[Cur_bitmap], 0.0f); button_down = box_marking = 0; @@ -1221,12 +1221,12 @@ void cancel_drag() if (query_valid_object()) { objp = &Objects[cur_object_index]; - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); vm_vec_sub(&movement_vector, &original_pos, &objp->pos); objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if (objp->flags & OF_MARKED) vm_vec_add(&objp->pos, &objp->pos, &movement_vector); @@ -1239,7 +1239,7 @@ void cancel_drag() objp = GET_FIRST(&obj_used_list); while (objp != END_OF_LIST(&obj_used_list)) { - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); if (objp->flags & OF_MARKED) { int obj_index = OBJ_INDEX(objp); @@ -1335,7 +1335,7 @@ void CFREDView::OnLButtonDown(UINT nFlags, CPoint point) } if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) { - Assert(Briefing_dialog); + SDL_assert(Briefing_dialog); Briefing_dialog->icon_select(Objects[cur_object_index].instance); } else { @@ -1449,9 +1449,9 @@ void CFREDView::OnLButtonUp(UINT nFlags, CPoint point) // Can't do player starts, since only player 1 is currently allowed to be in a wing - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); ship = objp->instance; - Assert(Ships[ship].wingnum == -1); + SDL_assert(Ships[ship].wingnum == -1); sprintf(Ships[ship].ship_name, "%s %d", Wings[Duped_wing].name, Wings[Duped_wing].wave_count + 1); @@ -1469,7 +1469,7 @@ void CFREDView::OnLButtonUp(UINT nFlags, CPoint point) } if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) { - Assert(Briefing_dialog); + SDL_assert(Briefing_dialog); Briefing_dialog->icon_select(Objects[cur_object_index].instance); } else { @@ -1495,7 +1495,7 @@ void CFREDView::OnEditorsShips() { int adjust = 0; - Assert(Ship_editor_dialog.GetSafeHwnd()); + SDL_assert(Ship_editor_dialog.GetSafeHwnd()); if (!Show_sexp_help) adjust = -SEXP_HELP_BOX_SIZE; @@ -1639,7 +1639,7 @@ void select_objects() if (ptr->flags & OF_HIDDEN) valid = 0; - Assert(ptr->type != OBJ_NONE); + SDL_assert(ptr->type != OBJ_NONE); switch (ptr->type) { case OBJ_WAYPOINT: if (!Show_waypoints) @@ -2484,7 +2484,7 @@ void view_universe(int just_marked) while (ptr != END_OF_LIST(&obj_used_list)) { if (!just_marked || (ptr->flags & OF_MARKED)) { g3_rotate_vertex(&v, &ptr->pos); - Assert(!(v.codes & CC_BEHIND)); + SDL_assert(!(v.codes & CC_BEHIND)); if (g3_project_vertex(&v) & PF_OVERFLOW) Int3(); @@ -2610,7 +2610,7 @@ int query_single_wing_marked() // if (Ships[Objects[obj].instance].wingnum != cur_wing) // return 0; - Assert(Ships[Objects[obj].instance].wingnum == cur_wing); + SDL_assert(Ships[Objects[obj].instance].wingnum == cur_wing); if (!(Objects[obj].flags & OF_MARKED)) // ensure all ships in wing.are marked return 0; } @@ -2649,7 +2649,7 @@ void CFREDView::OnEditorsWing() { int adjust = 0; - Assert(Wing_editor_dialog.GetSafeHwnd()); + SDL_assert(Wing_editor_dialog.GetSafeHwnd()); if (!Show_sexp_help) adjust = -SEXP_HELP_BOX_SIZE; @@ -3214,7 +3214,7 @@ int CFREDView::global_error_check() return -1; }*/ - Assert((Player_start_shipnum >= 0) && (Player_start_shipnum < MAX_SHIPS) && (Ships[Player_start_shipnum].objnum >= 0)); + SDL_assert((Player_start_shipnum >= 0) && (Player_start_shipnum < MAX_SHIPS) && (Ships[Player_start_shipnum].objnum >= 0)); i = global_error_check_player_wings(multi); if (i){ return i; @@ -3652,7 +3652,7 @@ void CFREDView::OnEditorsWaypoint() { int adjust = 0; - Assert(Waypoint_editor_dialog.GetSafeHwnd()); + SDL_assert(Waypoint_editor_dialog.GetSafeHwnd()); if (!Show_sexp_help) adjust = -SEXP_HELP_BOX_SIZE; @@ -3680,8 +3680,8 @@ char *error_check_initial_orders(ai_goal *goals, int ship, int wing) } } else { - Assert(wing >= 0); - Assert(Wings[wing].wave_count > 0); + SDL_assert(wing >= 0); + SDL_assert(Wings[wing].wave_count > 0); source = Wings[wing].name; team = Ships[Objects[wing_objects[wing][0]].instance].team; for (j=0; j= 0); + SDL_assert(flag == 2 && inst >= 0); if (ship_get_subsys_index(&Ships[inst], goals[i].docker.name, 1) < 0) return "Unknown subsystem type"; @@ -3842,14 +3842,14 @@ char *error_check_initial_orders(ai_goal *goals, int ship, int wing) case AI_GOAL_DOCK: { int dock1 = -1, dock2 = -1, model1, model2; - Assert(flag == 2 && inst >= 0); + SDL_assert(flag == 2 && inst >= 0); if (!ship_docking_valid(ship, inst)) return "Docking illegal between given ship types"; model1 = Ships[ship].modelnum; num = get_docking_list(model1); for (j=0; jSaveModified()) return; - Assert(!Campaign_wnd); + SDL_assert(!Campaign_wnd); Campaign_wnd = new campaign_tree_wnd; if (Campaign_wnd->Create(NULL, "Campaign Editor", WS_OVERLAPPEDWINDOW | WS_MAXIMIZE, CFrameWnd::rectDefault, NULL, "IDR_MENU_CAMPAIGN")) { @@ -4548,7 +4548,7 @@ void CFREDView::OnPrevObj() ptr = GET_NEXT(ptr); } - Assert(n); + SDL_assert(n); if (query_valid_object()) { i--; if (i < 0) @@ -4610,7 +4610,7 @@ void CFREDView::OnMarkWing() for (i=0; i= 0 && Wings[wing].special_ship < Wings[wing].wave_count); + SDL_assert(Wings[wing].special_ship >= 0 && Wings[wing].special_ship < Wings[wing].wave_count); set_cur_object_index(wing_objects[wing][Wings[wing].special_ship]); } } @@ -4712,7 +4712,7 @@ int get_prev_visible_subsys(ship *shipp, ship_subsys **prev_subsys) } // first timer - Assert(*prev_subsys != NULL); + SDL_assert(*prev_subsys != NULL); // look before wrap for (*prev_subsys = GET_PREV(*prev_subsys); *prev_subsys != END_OF_LIST(&shipp->subsys_list); *prev_subsys = GET_PREV(*prev_subsys)) { diff --git a/src/fred2/ignoreordersdlg.cpp b/src/fred2/ignoreordersdlg.cpp index 243736b..7404a6f 100644 --- a/src/fred2/ignoreordersdlg.cpp +++ b/src/fred2/ignoreordersdlg.cpp @@ -133,7 +133,7 @@ BOOL ignore_orders_dlg::OnInitDialog() m_num_checks_active = 0; for (i = 0; i < MAX_SHIP_ORDERS; i++ ) { if ( default_orders & Fred_comm_orders[i].value ) { - Assert( m_num_checks_active < MAX_CHECKBOXES ); + SDL_assert( m_num_checks_active < MAX_CHECKBOXES ); check_boxes[m_num_checks_active].button->SetWindowText( Fred_comm_orders[i].menu_text ); check_boxes[m_num_checks_active].id = Fred_comm_orders[i].value; m_num_checks_active++; diff --git a/src/fred2/initialstatus.cpp b/src/fred2/initialstatus.cpp index dbff6a0..2cc2992 100644 --- a/src/fred2/initialstatus.cpp +++ b/src/fred2/initialstatus.cpp @@ -113,9 +113,9 @@ BOOL initial_status::OnInitDialog() m_ship = cur_ship; if (m_ship == -1) { - Assert((Objects[cur_object_index].type == OBJ_SHIP) || (Objects[cur_object_index].type == OBJ_START)); + SDL_assert((Objects[cur_object_index].type == OBJ_SHIP) || (Objects[cur_object_index].type == OBJ_START)); m_ship = get_ship_from_obj(cur_object_index); - Assert(m_ship >= 0); + SDL_assert(m_ship >= 0); } vflag = sflag = hflag = 0; @@ -151,7 +151,7 @@ BOOL initial_status::OnInitDialog() m_has_shields = 2; } - Assert((objp->type == OBJ_SHIP) || (objp->type == OBJ_START)); + SDL_assert((objp->type == OBJ_SHIP) || (objp->type == OBJ_START)); if (Ships[get_ship_from_obj(objp)].flags & SF_LOCKED) { if (!m_locked) m_locked = 2; @@ -200,7 +200,7 @@ BOOL initial_status::OnInitDialog() m_docked_with = -1; z = Ai_info[Ships[m_ship].ai_index].dock_objnum; if (z >= 0) { - Assert(Objects[z].type == OBJ_SHIP); + SDL_assert(Objects[z].type == OBJ_SHIP); z = m_docked_with = get_ship_from_obj(z); m_docked = box->FindStringExact(-1, Ships[z].ship_name); @@ -263,7 +263,7 @@ void initial_status::initialize_docker_points() type = model_get_dock_types(Ships[m_docked_with].modelnum); set_valid_dock_points(m_ship, type, box); i = box->GetCount(); - Assert(i); // this shouldn't happen. + SDL_assert(i); // this shouldn't happen. while (i--) if ((int) box->GetItemData(i) == m_docker_index) break; @@ -290,7 +290,7 @@ void initial_status::initialize_dockee_points() type = model_get_dock_index_type(Ships[m_ship].modelnum, m_docker_index); set_valid_dock_points(m_docked_with, type, box); i = box->GetCount(); - Assert(i); // this shouldn't happen. + SDL_assert(i); // this shouldn't happen. while (i--) if ((int) box->GetItemData(i) == m_dockee_index) break; @@ -310,7 +310,7 @@ void initial_status::change_subsys() if (cur_subsys != LB_ERR) { ptr = GET_FIRST(&Ships[m_ship].subsys_list); while (cur_subsys--) { - Assert(ptr != END_OF_LIST(&Ships[m_ship].subsys_list)); + SDL_assert(ptr != END_OF_LIST(&Ships[m_ship].subsys_list)); ptr = GET_NEXT(ptr); } @@ -340,7 +340,7 @@ void initial_status::change_subsys() } else { ptr = GET_FIRST(&Ships[m_ship].subsys_list); while (z--) { - Assert(ptr != END_OF_LIST(&Ships[m_ship].subsys_list)); + SDL_assert(ptr != END_OF_LIST(&Ships[m_ship].subsys_list)); ptr = GET_NEXT(ptr); } @@ -476,7 +476,7 @@ void initial_status::OnOK() reset_arrival_to_false( m_ship ); } - Assert ( (Ships[m_ship].flags & SF_INITIALLY_DOCKED) || (Ships[m_docked_with].flags & SF_INITIALLY_DOCKED) ); + SDL_assert ( (Ships[m_ship].flags & SF_INITIALLY_DOCKED) || (Ships[m_docked_with].flags & SF_INITIALLY_DOCKED) ); Update_window = 1; } diff --git a/src/fred2/mainfrm.cpp b/src/fred2/mainfrm.cpp index c1351ac..88d3887 100644 --- a/src/fred2/mainfrm.cpp +++ b/src/fred2/mainfrm.cpp @@ -239,7 +239,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) // Create the combo box z = m_wndToolBar.CommandToIndex(ID_NEW_SHIP_TYPE); - Assert(z != -1); + SDL_assert(z != -1); m_wndToolBar.SetButtonInfo(z, ID_NEW_SHIP_TYPE, TBBS_SEPARATOR, 230); // Design guide advises 12 pixel gap between combos and buttons @@ -472,7 +472,7 @@ void CMainFrame::init_tools() //char ship_name[256]; //int ship_index; - Assert(count < 2); + SDL_assert(count < 2); // add if (count++) { diff --git a/src/fred2/management.cpp b/src/fred2/management.cpp index 8de8c3d..01a1936 100644 --- a/src/fred2/management.cpp +++ b/src/fred2/management.cpp @@ -396,8 +396,8 @@ void deconvert_multiline_string(char *buf, CString &str, int max_len) int i, j; CString str2; - Assert(max_len > 1); - Assert(buf); + SDL_assert(max_len > 1); + SDL_assert(buf); max_len -= 2; while ((i = str.Find("\r\n")) >= 0) { for (j=0; j 0); + SDL_assert(strlen(Fred_exe_dir) > 0); // doh if(cfile_init(Fred_exe_dir)){ @@ -744,7 +744,7 @@ int dup_object(object *objp) subp1 = GET_FIRST(&Ships[n].subsys_list); subp2 = GET_FIRST(&Ships[inst].subsys_list); while (subp1 != END_OF_LIST(&Ships[n].subsys_list)) { - Assert(subp2 != END_OF_LIST(&Ships[inst].subsys_list)); + SDL_assert(subp2 != END_OF_LIST(&Ships[inst].subsys_list)); subp1 -> current_hits = subp2 -> current_hits; subp1 = GET_NEXT(subp1); subp2 = GET_NEXT(subp2); @@ -841,8 +841,8 @@ int create_player(int num, vector *pos, matrix *orient, int type, int init) type = Default_player_model; } - Assert(type >= 0); - Assert(Player_starts < MAX_PLAYERS); + SDL_assert(type >= 0); + SDL_assert(Player_starts < MAX_PLAYERS); Player_starts++; obj = create_ship(orient, pos, type); Objects[obj].type = OBJ_START; @@ -900,7 +900,7 @@ int create_waypoint(vector *pos, int list) return -1; } - Assert((list >= 0) && (list < MAX_WAYPOINT_LISTS)); // illegal index or out of lists. + SDL_assert((list >= 0) && (list < MAX_WAYPOINT_LISTS)); // illegal index or out of lists. if (Waypoint_lists[list].count >= MAX_WAYPOINTS_PER_LIST) { Fred_main_wnd->MessageBox("Unable to create new waypoint. You have\n" "reached the maximum limit on waypoints per list.", NULL, MB_OK | MB_ICONEXCLAMATION); @@ -918,7 +918,7 @@ int create_waypoint(vector *pos, int list) ptr = GET_FIRST(&obj_used_list); while (ptr != END_OF_LIST(&obj_used_list)) { - Assert(ptr->type != OBJ_NONE); + SDL_assert(ptr->type != OBJ_NONE); if (ptr->type == OBJ_WAYPOINT) { i = ptr->instance; if ((i / 65536 == list) && ((i & 0xffff) >= index)){ @@ -1135,14 +1135,14 @@ int query_valid_object(int index) ptr = GET_FIRST(&obj_used_list); while (ptr != END_OF_LIST(&obj_used_list)) { - Assert(ptr->type != OBJ_NONE); + SDL_assert(ptr->type != OBJ_NONE); if (OBJ_INDEX(ptr) == index) obj_found = TRUE; ptr = GET_NEXT(ptr); } - Assert(obj_found); // just to make sure it's in the list like it should be. + SDL_assert(obj_found); // just to make sure it's in the list like it should be. return TRUE; } @@ -1156,14 +1156,14 @@ int query_valid_ship(int index) ptr = GET_FIRST(&obj_used_list); while (ptr != END_OF_LIST(&obj_used_list)) { - Assert(ptr->type != OBJ_NONE); + SDL_assert(ptr->type != OBJ_NONE); if (OBJ_INDEX(ptr) == index) obj_found = TRUE; ptr = GET_NEXT(ptr); } - Assert(obj_found); // just to make sure it's in the list like it should be. + SDL_assert(obj_found); // just to make sure it's in the list like it should be. return TRUE; } @@ -1177,14 +1177,14 @@ int query_valid_waypoint(int index) ptr = GET_FIRST(&obj_used_list); while (ptr != END_OF_LIST(&obj_used_list)) { - Assert(ptr->type != OBJ_NONE); + SDL_assert(ptr->type != OBJ_NONE); if (OBJ_INDEX(ptr) == index) obj_found = TRUE; ptr = GET_NEXT(ptr); } - Assert(obj_found); // just to make sure it's in the list like it should be. + SDL_assert(obj_found); // just to make sure it's in the list like it should be. return TRUE; } @@ -1209,9 +1209,9 @@ void set_cur_wing(int wing) { cur_wing = wing; /* if (cur_ship != -1) - Assert(cur_wing == Ships[cur_ship].wingnum); + SDL_assert(cur_wing == Ships[cur_ship].wingnum); if ((cur_object_index != -1) && (Objects[cur_object_index].type == OBJ_SHIP)) - Assert(cur_wing == Ships[Objects[cur_object_index].instance].wingnum);*/ + SDL_assert(cur_wing == Ships[Objects[cur_object_index].instance].wingnum);*/ Update_wing = 1; Update_window = 1; } @@ -1259,9 +1259,9 @@ void set_cur_indices(int obj) if (ptr == END_OF_LIST(&obj_used_list)) ptr = ptr->next; - Assert(ptr != END_OF_LIST(&obj_used_list)); + SDL_assert(ptr != END_OF_LIST(&obj_used_list)); cur_object_index = OBJ_INDEX(ptr); - Assert(ptr->type != OBJ_NONE); + SDL_assert(ptr->type != OBJ_NONE); cur_ship = cur_wing = cur_waypoint_list = cur_waypoint = -1; if (ptr->type == OBJ_SHIP) { cur_ship = ptr->instance; @@ -1363,7 +1363,7 @@ int common_object_delete(int obj) return 1; } - Assert((i >= 0) && (i < MAX_SHIPS)); + SDL_assert((i >= 0) && (i < MAX_SHIPS)); sprintf(msg, "Player %d", i + 1); name = msg; r = reference_handler(name, REF_TYPE_PLAYER, obj); @@ -1409,9 +1409,9 @@ int common_object_delete(int obj) list = Objects[obj].instance / 65536; i = Objects[obj].instance & 0xffff; - Assert(list >= 0 && list < MAX_WAYPOINT_LISTS); + SDL_assert(list >= 0 && list < MAX_WAYPOINT_LISTS); count = Waypoint_lists[list].count; - Assert(i >= 0 && i < count); + SDL_assert(i >= 0 && i < count); if (Waypoint_lists[list].count == 1) { name = Waypoint_lists[list].name; @@ -1501,7 +1501,7 @@ int common_object_delete(int obj) } } else if (type == OBJ_POINT) { - Assert(Briefing_dialog); + SDL_assert(Briefing_dialog); Briefing_dialog->delete_icon(Objects[obj].instance); Update_window = 1; return 0; @@ -1592,7 +1592,7 @@ int delete_ship_from_wing(int ship) } } - Assert(i != -1); // Error, object should be in wing. + SDL_assert(i != -1); // Error, object should be in wing. if (Wings[wing].special_ship == i){ Wings[wing].special_ship = 0; } else if (Wings[wing].special_ship > i) { @@ -1659,7 +1659,7 @@ int query_object_in_wing(int obj) void mark_object(int obj) { - Assert(query_valid_object(obj)); + SDL_assert(query_valid_object(obj)); if (!(Objects[obj].flags & OF_MARKED)) { Objects[obj].flags |= OF_MARKED; // set as marked Marked++; @@ -1674,7 +1674,7 @@ void mark_object(int obj) void unmark_object(int obj) { - Assert(query_valid_object(obj)); + SDL_assert(query_valid_object(obj)); if (Objects[obj].flags & OF_MARKED) { Objects[obj].flags &= ~OF_MARKED; Marked--; @@ -1802,7 +1802,7 @@ int string_lookup(CString str1, char *strlist[], int max) int i; for (i=0; in_docks <= MAX_DOCKS); + SDL_assert(pm->n_docks <= MAX_DOCKS); for (i=0; in_docks; i++) Docking_bay_list[i] = pm->docking_bays[i].name; @@ -1971,8 +1971,8 @@ int rename_ship(int ship, char *name) { int i; - Assert(ship >= 0); - Assert(strlen(name) < NAME_LENGTH); + SDL_assert(ship >= 0); + SDL_assert(strlen(name) < NAME_LENGTH); update_sexp_references(Ships[ship].ship_name, name); ai_update_goal_references(REF_TYPE_SHIP, Ships[ship].ship_name, name); @@ -2025,7 +2025,7 @@ int internal_integrity_check() verify_sexp_tree(Ships[i].arrival_cue); verify_sexp_tree(Ships[i].departure_cue); if (Ships[i].ai_index < 0) - Assert(0); + SDL_assert(0); if (Ai_info[Ships[i].ai_index].shipnum != i) Int3(); } @@ -2097,7 +2097,7 @@ void set_valid_dock_points(int ship, int type, CComboBox *box) box->SetItemData(z, i); } - Assert(box->GetCount()); + SDL_assert(box->GetCount()); } // Given an object index, find the ship index for that object. @@ -2610,7 +2610,7 @@ void management_add_ships_to_combo( CComboBox *box, int flags ) // determine if this ship has a docking bay pm = model_get( Ships[objp->instance].modelnum ); - Assert( pm ); + SDL_assert( pm ); if ( pm->ship_bay && (pm->ship_bay->num_paths > 0) ) { id = box->AddString(Ships[get_ship_from_obj(objp)].ship_name); box->SetItemData(id, get_ship_from_obj(objp)); diff --git a/src/fred2/messageeditordlg.cpp b/src/fred2/messageeditordlg.cpp index 7ac6ce1..d7b46f6 100644 --- a/src/fred2/messageeditordlg.cpp +++ b/src/fred2/messageeditordlg.cpp @@ -222,7 +222,7 @@ BOOL CMessageEditorDlg::OnInitDialog() list = (CListBox *) GetDlgItem(IDC_MESSAGE_LIST); list->ResetContent(); for (i=0; iFindStringExact(-1, Messages[i].name) == CB_ERR); + //SDL_assert(list->FindStringExact(-1, Messages[i].name) == CB_ERR); // mwa we should probably not include builtin messages into this list! list->AddString(Messages[i].name); } @@ -514,7 +514,7 @@ int CMessageEditorDlg::update(int num) if (m_event_num >= 0) { // need to delete event i = m_event_num; free_sexp2(Mission_events[i].formula); - Assert(i < Num_mission_events); + SDL_assert(i < Num_mission_events); while (i < Num_mission_events - 1) { Mission_events[i] = Mission_events[i + 1]; i++; @@ -536,7 +536,7 @@ int CMessageEditorDlg::update(int num) goto exit; } - Assert(Num_mission_events < MAX_MISSION_EVENTS); + SDL_assert(Num_mission_events < MAX_MISSION_EVENTS); m_event_num = Num_mission_events++; string_copy(Mission_events[m_event_num].name, m_message_name, NAME_LENGTH - 1); Mission_events[m_event_num].repeat_count = 1; @@ -575,7 +575,7 @@ void CMessageEditorDlg::OnDelete() char buf[256]; int i; - Assert((m_cur_msg >= 0) && (m_cur_msg < Num_messages)); + SDL_assert((m_cur_msg >= 0) && (m_cur_msg < Num_messages)); if (Messages[m_cur_msg].avi_info.name) free(Messages[m_cur_msg].avi_info.name); if (Messages[m_cur_msg].wave_info.name) @@ -602,7 +602,7 @@ void CMessageEditorDlg::OnNew() if (update(m_cur_msg)) return; - Assert(Num_messages < MAX_MISSION_MESSAGES); + SDL_assert(Num_messages < MAX_MISSION_MESSAGES); strcpy(Messages[Num_messages].name, ""); ((CListBox *) GetDlgItem(IDC_MESSAGE_LIST))->AddString(""); @@ -686,7 +686,7 @@ void CMessageEditorDlg::OnBeginlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult) *pResult = 0; modified = 1; edit = m_tree.GetEditControl(); - Assert(edit); + SDL_assert(edit); edit->SetLimitText(NAME_LENGTH - 1); } else diff --git a/src/fred2/missiongoalsdlg.cpp b/src/fred2/missiongoalsdlg.cpp index 495b8c7..a586329 100644 --- a/src/fred2/missiongoalsdlg.cpp +++ b/src/fred2/missiongoalsdlg.cpp @@ -207,7 +207,7 @@ int sexp_goal_tree::load_sub_tree(int index) // assumption: first token is an operator. I require this because it would cause problems // with child/parent relations otherwise, and it should be this way anyway, since the // return type of the whole sexp is boolean, and only operators can satisfy this. - Assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); + SDL_assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); cur = get_new_node_position(); load_branch(index, -1); return cur; @@ -377,7 +377,7 @@ void CMissionGoalsDlg::OnSelchangedGoalsTree(NMHDR* pNMHDR, LRESULT* pResult) if (m_goals[i].formula == z) break; - Assert(i < m_num_goals); + SDL_assert(i < m_num_goals); cur_goal = i; update_cur_goal(); *pResult = 0; @@ -542,7 +542,7 @@ void CMissionGoalsDlg::OnOk() Mission_goals[i] = m_goals[i]; Mission_goals[i].formula = m_goals_tree.save_tree(Mission_goals[i].formula); if ( The_mission.game_type & MISSION_TYPE_MULTI_TEAMS ) { - Assert( Mission_goals[i].team != -1 ); + SDL_assert( Mission_goals[i].team != -1 ); } } @@ -559,7 +559,7 @@ void CMissionGoalsDlg::OnButtonNewGoal() int index; HTREEITEM h; - Assert(m_num_goals < MAX_GOALS); + SDL_assert(m_num_goals < MAX_GOALS); m_goals[m_num_goals].type = m_display_goal_types; // this also marks the goal as valid since bit not set m_sig[m_num_goals] = -1; strcpy(m_goals[m_num_goals].name, "Goal name"); @@ -596,7 +596,7 @@ int CMissionGoalsDlg::handler(int code, int node) } } - Assert(goal < m_num_goals); + SDL_assert(goal < m_num_goals); while (goal < m_num_goals - 1) { m_goals[goal] = m_goals[goal + 1]; m_sig[goal] = m_sig[goal + 1]; @@ -652,7 +652,7 @@ void CMissionGoalsDlg::OnSelchangeGoalTypeDrop() } h = m_goals_tree.GetSelectedItem(); - Assert(h); + SDL_assert(h); while ((h2 = m_goals_tree.GetParentItem(h)) != 0){ h = h2; } @@ -718,7 +718,7 @@ void CMissionGoalsDlg::insert_handler(int old, int node) } } - Assert(i < m_num_goals); + SDL_assert(i < m_num_goals); m_goals[i].formula = node; return; } @@ -756,14 +756,14 @@ void CMissionGoalsDlg::swap_handler(int node1, int node2) } } - Assert(index1 < m_num_goals); + SDL_assert(index1 < m_num_goals); for (index2=0; index2 0.0f); + SDL_assert(Neb2_awacs > 0.0f); fout("\n+NebAwacs: %f\n", Neb2_awacs); // storm name @@ -627,7 +627,7 @@ int CFred_mission_save::save_briefing() required_string_fred("$start_briefing"); parse_comments(); - Assert(Briefings[nb].num_stages <= MAX_BRIEF_STAGES); + SDL_assert(Briefings[nb].num_stages <= MAX_BRIEF_STAGES); required_string_fred("$num_stages:"); parse_comments(); fout(" %d", Briefings[nb].num_stages); @@ -685,7 +685,7 @@ int CFred_mission_save::save_briefing() required_string_fred("$num_icons:"); parse_comments(); - Assert(bs->num_icons <= MAX_STAGE_ICONS ); + SDL_assert(bs->num_icons <= MAX_STAGE_ICONS ); fout(" %d", bs->num_icons); required_string_fred("$Flags:"); @@ -896,7 +896,7 @@ int CFred_mission_save::save_players() for (i=0; i= 0); + SDL_assert(Player_start_shipnum >= 0); fout(" %s", Ships[Player_start_shipnum].ship_name); required_string_fred("$Ship Choices:"); @@ -983,7 +983,7 @@ int CFred_mission_save::save_objects() parse_comments(); fout(" %s", Iff_names[0]); - Assert(Ships[i].ai_index >= 0); + SDL_assert(Ships[i].ai_index >= 0); aip = &Ai_info[Ships[i].ai_index]; required_string_fred("$AI Behavior:"); @@ -1182,7 +1182,7 @@ int CFred_mission_save::save_objects() // mwa -- new code to save off information about initially docked ships. if ( Ships[i].flags & SF_INITIALLY_DOCKED ) { - Assert ( aip->dock_objnum != -1 ); // ge allender if you hit this + SDL_assert ( aip->dock_objnum != -1 ); // ge allender if you hit this if (optional_string_fred("+Docked With:", "$Name:")) parse_comments(); @@ -1583,7 +1583,7 @@ int CFred_mission_save::save_wings() } } - Assert(count == num_wings); + SDL_assert(count == num_wings); return err; } @@ -1683,7 +1683,7 @@ int CFred_mission_save::save_waypoints() ptr = GET_NEXT(ptr); } - Assert(ptr != END_OF_LIST(&obj_used_list)); + SDL_assert(ptr != END_OF_LIST(&obj_used_list)); required_string_fred("$Jump Node:", "$Jump Node Name:"); parse_comments(2); @@ -1903,7 +1903,7 @@ int CFred_mission_save::fout(char *format, ...) va_start(args, format); vsprintf(str, format, args); va_end(args); - Assert(strlen(str) < 16384); + SDL_assert(strlen(str) < 16384); cfputs(str, fp); return 0; @@ -1923,7 +1923,7 @@ int CFred_mission_save::fout_ext(char *format, ...) va_start(args, format); vsprintf(str, format, args); va_end(args); - Assert(strlen(str) < 16384); + SDL_assert(strlen(str) < 16384); // lookup the string in the hash table str_id = fhash_string_exists(str); @@ -2069,7 +2069,7 @@ void CFred_mission_save::save_ai_goals(ai_goals *goalp, int ship) break; default: - Assert(0); + SDL_assert(0); } if (valid) @@ -2555,7 +2555,7 @@ int CFred_mission_save::save_campaign_file(char *pathname) parse_comments(0); fout(" %s", Campaign.name); - Assert((Campaign.type >= 0) && (Campaign.type < MAX_CAMPAIGN_TYPES)); + SDL_assert((Campaign.type >= 0) && (Campaign.type < MAX_CAMPAIGN_TYPES)); required_string_fred("$Type:"); parse_comments(); fout(" %s", campaign_types[Campaign.type]); @@ -2733,7 +2733,7 @@ void CFred_mission_save::save_campaign_sexp(int node, int link_num) Sexp_string = out; *out = 0; - Assert(node >= 0); + SDL_assert(node >= 0); // if the link num is -1, then this is a end-of-campaign location if ( link_num != -1 ) { diff --git a/src/fred2/modifyvariabledlg.cpp b/src/fred2/modifyvariabledlg.cpp index da07e21..3726606 100644 --- a/src/fred2/modifyvariabledlg.cpp +++ b/src/fred2/modifyvariabledlg.cpp @@ -466,7 +466,7 @@ void CModifyVariableDlg::validate_var_name(int set_focus) int CModifyVariableDlg::get_sexp_var_index() { int index = m_traslate_combo_to_sexp[m_combo_last_modified_index]; - Assert( (index >= 0) && (index < MAX_SEXP_VARIABLES) ); + SDL_assert( (index >= 0) && (index < MAX_SEXP_VARIABLES) ); return index; } diff --git a/src/fred2/orienteditor.cpp b/src/fred2/orienteditor.cpp index 36b29e9..c1235ca 100644 --- a/src/fred2/orienteditor.cpp +++ b/src/fred2/orienteditor.cpp @@ -121,7 +121,7 @@ orient_editor::orient_editor(CWnd* pParent /*=NULL*/) m_location_y = _T("0.0"); m_location_z = _T("0.0"); //}}AFX_DATA_INIT - Assert(query_valid_object()); + SDL_assert(query_valid_object()); pos = Objects[cur_object_index].pos; m_position_x.Format("%.1f", pos.x); m_position_y.Format("%.1f", pos.y); @@ -188,7 +188,7 @@ BOOL orient_editor::OnInitDialog() } else if ((ptr->type == OBJ_POINT) || (ptr->type == OBJ_JUMP_NODE)) { } else - Assert(0); // unknown object type. + SDL_assert(0); // unknown object type. } ptr = GET_NEXT(ptr); @@ -300,7 +300,7 @@ void orient_editor::update_object(object *ptr) vm_vec_sub(&v, &loc, &ptr->pos); } else { - Assert(0); // neither radio button is checked. + SDL_assert(0); // neither radio button is checked. } if (!v.x && !v.y && !v.z){ diff --git a/src/fred2/reinforcementeditordlg.cpp b/src/fred2/reinforcementeditordlg.cpp index 86ffe46..34ab7ba 100644 --- a/src/fred2/reinforcementeditordlg.cpp +++ b/src/fred2/reinforcementeditordlg.cpp @@ -232,7 +232,7 @@ void reinforcement_editor_dlg::save_data() UpdateData(TRUE); UpdateData(TRUE); if (cur >= 0) { - Assert(cur < m_num_reinforcements); + SDL_assert(cur < m_num_reinforcements); m_reinforcements[cur].uses = m_uses; m_reinforcements[cur].arrival_delay = m_delay; @@ -300,7 +300,7 @@ void reinforcement_editor_dlg::OnOK() break; } - Assert(j < MAX_WINGS); + SDL_assert(j < MAX_WINGS); } } } @@ -393,7 +393,7 @@ void reinforcement_select::OnSelchangeList() void reinforcement_select::OnOK() { cur = ((CListBox *) GetDlgItem(IDC_LIST))->GetCurSel(); - Assert(cur != -1); + SDL_assert(cur != -1); ((CListBox *) GetDlgItem(IDC_LIST)) -> GetText(cur, name); CDialog::OnOK(); } diff --git a/src/fred2/sexp_tree.cpp b/src/fred2/sexp_tree.cpp index b016eb1..cce49ca 100644 --- a/src/fred2/sexp_tree.cpp +++ b/src/fred2/sexp_tree.cpp @@ -1433,7 +1433,7 @@ void sexp_tree::load_tree(int index, char *deflt) // assumption: first token is an operator. I require this because it would cause problems // with child/parent relations otherwise, and it should be this way anyway, since the // return type of the whole sexp is boolean, and only operators can satisfy this. - Assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); + SDL_assert(Sexp_nodes[index].subtype == SEXP_ATOM_OPERATOR); load_branch(index, -1); build_tree(); } @@ -1441,7 +1441,7 @@ void sexp_tree::load_tree(int index, char *deflt) void get_combined_variable_name(char *combined_name, const char *sexp_var_name) { int sexp_var_index = get_index_sexp_variable_name(sexp_var_name); - Assert(sexp_var_index > -1); + SDL_assert(sexp_var_index > -1); sprintf(combined_name, "%s(%s)", Sexp_variables[sexp_var_index].variable_name, Sexp_variables[sexp_var_index].text); } @@ -1455,7 +1455,7 @@ void sexp_tree::load_branch(int index, int parent) char combined_var_name[2*TOKEN_LENGTH + 2]; while (index != -1) { - Assert(Sexp_nodes[index].type != SEXP_NOT_USED); + SDL_assert(Sexp_nodes[index].type != SEXP_NOT_USED); if (Sexp_nodes[index].subtype == SEXP_ATOM_LIST) { load_branch(Sexp_nodes[index].first, parent); // do the sublist and continue @@ -1489,7 +1489,7 @@ void sexp_tree::load_branch(int index, int parent) } } else - Assert(0); // unknown and/or invalid sexp type + SDL_assert(0); // unknown and/or invalid sexp type if ((index == select_sexp_node) && !flag) { // translate sexp node to our node select_sexp_node = cur; @@ -1507,9 +1507,9 @@ int sexp_tree::query_false(int node) if (node < 0) node = root_item; - Assert(node >= 0); - Assert(nodes[node].type == (SEXPT_OPERATOR | SEXPT_VALID)); - Assert(nodes[node].next == -1); // must make this assumption or else it will confuse code! + SDL_assert(node >= 0); + SDL_assert(nodes[node].type == (SEXPT_OPERATOR | SEXPT_VALID)); + SDL_assert(nodes[node].next == -1); // must make this assumption or else it will confuse code! if (find_operator(nodes[node].text) == OP_FALSE){ return TRUE; } @@ -1523,9 +1523,9 @@ int sexp_tree::save_tree(int node) if (node < 0) node = root_item; - Assert(node >= 0); - Assert(nodes[node].type == (SEXPT_OPERATOR | SEXPT_VALID)); - Assert(nodes[node].next == -1); // must make this assumption or else it will confuse code! + SDL_assert(node >= 0); + SDL_assert(nodes[node].type == (SEXPT_OPERATOR | SEXPT_VALID)); + SDL_assert(nodes[node].next == -1); // must make this assumption or else it will confuse code! return save_branch(node); } @@ -1533,7 +1533,7 @@ int sexp_tree::save_tree(int node) void var_name_from_sexp_tree_text(char *var_name, const char *text) { int var_name_length = strcspn(text, "("); - Assert(var_name_length < TOKEN_LENGTH - 1); + SDL_assert(var_name_length < TOKEN_LENGTH - 1); strncpy(var_name, text, var_name_length); var_name[var_name_length] = '\0'; @@ -1571,10 +1571,10 @@ int sexp_tree::save_branch(int cur, int at_root) node = alloc_sexp(nodes[cur].text, SEXP_ATOM, SEXP_ATOM_STRING, -1, -1); } } else if (nodes[cur].type & SEXPT_STRING) { - Assert( !(nodes[cur].type & SEXPT_VARIABLE) ); + SDL_assert( !(nodes[cur].type & SEXPT_VARIABLE) ); Int3(); } else { - Assert(0); // unknown and/or invalid type + SDL_assert(0); // unknown and/or invalid type } if (last == NO_PREVIOUS_NODE){ @@ -1584,7 +1584,7 @@ int sexp_tree::save_branch(int cur, int at_root) } last = node; - Assert(last != NO_PREVIOUS_NODE); // should be impossible + SDL_assert(last != NO_PREVIOUS_NODE); // should be impossible cur = nodes[cur].next; if (at_root){ return start; @@ -1647,7 +1647,7 @@ void sexp_tree::free_node(int node, int cascade) // clear the pointer to node i = nodes[node].parent; - Assert(i != -1); + SDL_assert(i != -1); if (nodes[i].child == node) nodes[i].child = nodes[node].next; @@ -1676,9 +1676,9 @@ void sexp_tree::free_node(int node, int cascade) // void sexp_tree::free_node2(int node) { - Assert(node != -1); - Assert(nodes[node].type != SEXPT_UNUSED); - Assert(total > 0); + SDL_assert(node != -1); + SDL_assert(nodes[node].type != SEXPT_UNUSED); + SDL_assert(total > 0); *modified = 1; nodes[node].type = SEXPT_UNUSED; total--; @@ -1692,8 +1692,8 @@ void sexp_tree::free_node2(int node) // initialize the data for a node. Should be called right after a new node is allocated. void sexp_tree::set_node(int node, int type, char *text) { - Assert(type != SEXPT_UNUSED); - Assert(nodes[node].type != SEXPT_UNUSED); + SDL_assert(type != SEXPT_UNUSED); + SDL_assert(nodes[node].type != SEXPT_UNUSED); nodes[node].type = type; size_t max_length; if (type & SEXPT_VARIABLE) { @@ -1701,7 +1701,7 @@ void sexp_tree::set_node(int node, int type, char *text) } else { max_length = TOKEN_LENGTH; } - Assert(strlen(text) < max_length); + SDL_assert(strlen(text) < max_length); strcpy(nodes[node].text, text); } @@ -1728,7 +1728,7 @@ void sexp_tree::add_sub_tree(int node, HTREEITEM root) // char str[80]; int node2; - Assert(node >= 0 && node < MAX_SEXP_TREE_SIZE); + SDL_assert(node >= 0 && node < MAX_SEXP_TREE_SIZE); node2 = nodes[node].child; // check for single argument operator case (prints as one line) @@ -1760,13 +1760,13 @@ void sexp_tree::add_sub_tree(int node, HTREEITEM root) node = node2; while (node != -1) { - Assert(node >= 0 && node < MAX_SEXP_TREE_SIZE); - Assert(nodes[node].type & SEXPT_VALID); + SDL_assert(node >= 0 && node < MAX_SEXP_TREE_SIZE); + SDL_assert(nodes[node].type & SEXPT_VALID); if (nodes[node].type & SEXPT_OPERATOR) { add_sub_tree(node, root); } else { - Assert(nodes[node].child == -1); + SDL_assert(nodes[node].child == -1); if (nodes[node].type & SEXPT_VARIABLE) { nodes[node].handle = insert(nodes[node].text, BITMAP_VARIABLE, BITMAP_VARIABLE, root); nodes[node].flags = NOT_EDITABLE; @@ -1801,7 +1801,7 @@ int sexp_tree::get_ambiguous_type(int parent) int first_arg_index = get_modify_variable_first_arg_index(); int sexp_var_index = get_tree_name_to_sexp_variable_index(nodes[first_arg_index].text); - Assert(sexp_var_index != -1); + SDL_assert(sexp_var_index != -1); if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_NUMBER) { return OPF_NUMBER; @@ -1815,17 +1815,17 @@ int sexp_tree::get_modify_variable_first_arg_index() { int index; - Assert( item_index >= 0); + SDL_assert( item_index >= 0); // get parent and check "modify-variable" index = nodes[item_index].parent; - Assert( index != -1 ); - Assert( !(stricmp(nodes[index].text, "modify-variable")) ); + SDL_assert( index != -1 ); + SDL_assert( !(stricmp(nodes[index].text, "modify-variable")) ); // get first child and verify type variable index = nodes[index].child; - Assert( index != -1 ); - Assert( nodes[index].type & SEXPT_VARIABLE); + SDL_assert( index != -1 ); + SDL_assert( nodes[index].type & SEXPT_VARIABLE); return index; } @@ -1847,8 +1847,8 @@ void sexp_tree::right_clicked(int mode) m_mode = mode; add_instance = replace_instance = -1; - Assert(Num_operators <= MAX_OPERATORS); - Assert(Num_op_menus < MAX_OP_MENUS); + SDL_assert(Num_operators <= MAX_OPERATORS); + SDL_assert(Num_op_menus < MAX_OP_MENUS); GetCursorPos(&mouse); click_point = mouse; ScreenToClient(&click_point); @@ -1932,7 +1932,7 @@ void sexp_tree::right_clicked(int mode) int parent = nodes[item_index].parent; if (parent >= 0) { op = identify_operator(nodes[parent].text); - Assert(op >= 0); + SDL_assert(op >= 0); int first_arg = nodes[parent].child; // get arg count of item to replace @@ -1957,7 +1957,7 @@ void sexp_tree::right_clicked(int mode) int max_sexp_vars = MAX_SEXP_VARIABLES; // prevent collisions in id numbers: ID_VARIABLE_MENU + 512 = ID_ADD_MENU - Assert(max_sexp_vars < 512); + SDL_assert(max_sexp_vars < 512); for (int idx=0; idx= 0); + SDL_assert(op >= 0); // get listing of valid argument values and add to menus type = query_operator_argument_type(op, Add_count); @@ -2156,7 +2156,7 @@ void sexp_tree::right_clicked(int mode) if (parent >= 0) { replace_type = OPR_STRING; op = identify_operator(nodes[parent].text); - Assert(op >= 0); + SDL_assert(op >= 0); int first_arg = nodes[parent].child; count = count_args(nodes[parent].child); @@ -2277,10 +2277,10 @@ void sexp_tree::right_clicked(int mode) // change enabled status of 'insert' type menu options. z = nodes[item_index].parent; - Assert(z >= -1); + SDL_assert(z >= -1); if (z != -1) { op = identify_operator(nodes[z].text); - Assert(op != -1); + SDL_assert(op != -1); j = nodes[z].child; count = 0; while (j != item_index) { @@ -2334,11 +2334,11 @@ void sexp_tree::right_clicked(int mode) } if ((Sexp_clipboard > -1) && (Sexp_nodes[Sexp_clipboard].type != SEXP_NOT_USED)) { - Assert(Sexp_nodes[Sexp_clipboard].subtype != SEXP_ATOM_LIST); + SDL_assert(Sexp_nodes[Sexp_clipboard].subtype != SEXP_ATOM_LIST); if (Sexp_nodes[Sexp_clipboard].subtype == SEXP_ATOM_OPERATOR) { j = find_operator(CTEXT(Sexp_clipboard)); - Assert(j); + SDL_assert(j); z = query_operator_return_type(j); if ((z == OPR_POSITIVE) && (replace_type == OPR_NUMBER)) @@ -2408,11 +2408,11 @@ int sexp_tree::identify_arg_type(int node) int type = -1; while (node != -1) { - Assert(nodes[node].type & SEXPT_VALID); + SDL_assert(nodes[node].type & SEXPT_VALID); switch (SEXPT_TYPE(nodes[node].type)) { case SEXPT_OPERATOR: type = find_operator(nodes[node].text); - Assert(type); + SDL_assert(type); return query_operator_return_type(type); case SEXPT_NUMBER: @@ -2497,7 +2497,7 @@ int sexp_tree::end_label_edit(HTREEITEM h, char *str) if (node == MAX_SEXP_TREE_SIZE) { if (m_mode == MODE_EVENTS) { item_index = GetItemData(h); - Assert(Event_editor_dlg); + SDL_assert(Event_editor_dlg); node = Event_editor_dlg->handler(ROOT_RENAMED, item_index, str); return 1; @@ -2505,7 +2505,7 @@ int sexp_tree::end_label_edit(HTREEITEM h, char *str) Int3(); // root labels shouldn't have been editable! } - Assert(node < MAX_SEXP_TREE_SIZE); + SDL_assert(node < MAX_SEXP_TREE_SIZE); if (nodes[node].type & SEXPT_OPERATOR) { str = match_closest_operator(str, node); SetItemText(h, str); @@ -2584,7 +2584,7 @@ char *sexp_tree::match_closest_operator(char *str, int node) arg_num = 0; n = nodes[z].child; while (n != node) { - Assert(n >= 0); + SDL_assert(n >= 0); arg_num++; n = nodes[n].next; } @@ -2603,7 +2603,7 @@ char *sexp_tree::match_closest_operator(char *str, int node) if (!best) best = sub_best; // no best found, use our plan #2 best found. - Assert(best); // we better have some valid operator at this point. + SDL_assert(best); // we better have some valid operator at this point. return best; /* char buf[256]; @@ -2675,12 +2675,12 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) dlg.DoModal(); - Assert( !(dlg.m_deleted && dlg.m_do_modify) ); + SDL_assert( !(dlg.m_deleted && dlg.m_do_modify) ); if (dlg.m_deleted) { // find index in sexp_variable list int sexp_var_index = get_index_sexp_variable_name(dlg.m_cur_variable_name); - Assert(sexp_var_index != -1); + SDL_assert(sexp_var_index != -1); // delete from list sexp_variable_delete(sexp_var_index); @@ -2699,7 +2699,7 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) // check sexp_tree -- warn on type // find index and change either (1) name, (2) type, (3) value int sexp_var_index = get_index_sexp_variable_name(dlg.m_old_var_name); - Assert(sexp_var_index != -1); + SDL_assert(sexp_var_index != -1); // save old name, since name may be modified char old_name[TOKEN_LENGTH]; @@ -2735,14 +2735,14 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) // check if REPLACE_VARIABLE_MENU if ( (id >= ID_VARIABLE_MENU) && (id < ID_VARIABLE_MENU + 511)) { - Assert(item_index >= 0); + SDL_assert(item_index >= 0); // get index into list of type valid variables int var_idx = id - ID_VARIABLE_MENU; - Assert( (var_idx >= 0) && (var_idx < MAX_SEXP_VARIABLES) ); + SDL_assert( (var_idx >= 0) && (var_idx < MAX_SEXP_VARIABLES) ); int type = get_type(item_handle); - Assert( (type & SEXPT_NUMBER) || (type & SEXPT_STRING) ); + SDL_assert( (type & SEXPT_NUMBER) || (type & SEXPT_STRING) ); // dont do type check for modify-variable if (Modify_variable) { @@ -2758,11 +2758,11 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) // verify type in tree is same as type in Sexp_variables array if (type & SEXPT_NUMBER) { - Assert(Sexp_variables[var_idx].type & SEXP_VARIABLE_NUMBER); + SDL_assert(Sexp_variables[var_idx].type & SEXP_VARIABLE_NUMBER); } if (type & SEXPT_STRING) { - Assert( (Sexp_variables[var_idx].type & SEXP_VARIABLE_STRING) ); + SDL_assert( (Sexp_variables[var_idx].type & SEXP_VARIABLE_STRING) ); } } @@ -2774,23 +2774,23 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) if ((id >= ID_ADD_MENU) && (id < ID_ADD_MENU + 511)) { - Assert(item_index >= 0); + SDL_assert(item_index >= 0); op = identify_operator(nodes[item_index].text); - Assert(op >= 0); + SDL_assert(op >= 0); type = query_operator_argument_type(op, Add_count); list = get_listing_opf(type, item_index, Add_count); - Assert(list); + SDL_assert(list); id -= ID_ADD_MENU; ptr = list; while (id) { id--; ptr = ptr->next; - Assert(ptr); + SDL_assert(ptr); } - Assert((SEXPT_TYPE(ptr->type) != SEXPT_OPERATOR) && (ptr->op < 0)); + SDL_assert((SEXPT_TYPE(ptr->type) != SEXPT_OPERATOR) && (ptr->op < 0)); expand_operator(item_index); add_data(ptr->text, ptr->type); list->destroy(); @@ -2798,24 +2798,24 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) } if ((id >= ID_REPLACE_MENU) && (id < ID_REPLACE_MENU + 511)) { - Assert(item_index >= 0); - Assert(nodes[item_index].parent >= 0); + SDL_assert(item_index >= 0); + SDL_assert(nodes[item_index].parent >= 0); op = identify_operator(nodes[nodes[item_index].parent].text); - Assert(op >= 0); + SDL_assert(op >= 0); type = query_operator_argument_type(op, Replace_count); // check argument type at this position list = get_listing_opf(type, nodes[item_index].parent, Replace_count); - Assert(list); + SDL_assert(list); id -= ID_REPLACE_MENU; ptr = list; while (id) { id--; ptr = ptr->next; - Assert(ptr); + SDL_assert(ptr); } - Assert((SEXPT_TYPE(ptr->type) != SEXPT_OPERATOR) && (ptr->op < 0)); + SDL_assert((SEXPT_TYPE(ptr->type) != SEXPT_OPERATOR) && (ptr->op < 0)); expand_operator(item_index); replace_data(ptr->text, ptr->type); list->destroy(); @@ -2847,12 +2847,12 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) else { h = GetParentItem(nodes[item_index].handle); if (m_mode == MODE_GOALS) { - Assert(Goal_editor_dlg); + SDL_assert(Goal_editor_dlg); Goal_editor_dlg->insert_handler(item_index, node); SetItemData(h, node); } else if (m_mode == MODE_EVENTS) { - Assert(Event_editor_dlg); + SDL_assert(Event_editor_dlg); Event_editor_dlg->insert_handler(item_index, node); SetItemData(h, node); @@ -2894,8 +2894,8 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) case ID_EDIT_PASTE: // the following assumptions are made.. - Assert((Sexp_clipboard > -1) && (Sexp_nodes[Sexp_clipboard].type != SEXP_NOT_USED)); - Assert(Sexp_nodes[Sexp_clipboard].subtype != SEXP_ATOM_LIST); + SDL_assert((Sexp_clipboard > -1) && (Sexp_nodes[Sexp_clipboard].type != SEXP_NOT_USED)); + SDL_assert(Sexp_nodes[Sexp_clipboard].subtype != SEXP_ATOM_LIST); if (Sexp_nodes[Sexp_clipboard].subtype == SEXP_ATOM_OPERATOR) { expand_operator(item_index); @@ -2910,24 +2910,24 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) } } else if (Sexp_nodes[Sexp_clipboard].subtype == SEXP_ATOM_NUMBER) { - Assert(Sexp_nodes[Sexp_clipboard].rest == -1); + SDL_assert(Sexp_nodes[Sexp_clipboard].rest == -1); expand_operator(item_index); replace_data(CTEXT(Sexp_clipboard), (SEXPT_NUMBER | SEXPT_VALID)); } else if (Sexp_nodes[Sexp_clipboard].subtype == SEXP_ATOM_STRING) { - Assert(Sexp_nodes[Sexp_clipboard].rest == -1); + SDL_assert(Sexp_nodes[Sexp_clipboard].rest == -1); expand_operator(item_index); replace_data(CTEXT(Sexp_clipboard), (SEXPT_STRING | SEXPT_VALID)); } else - Assert(0); // unknown and/or invalid sexp type + SDL_assert(0); // unknown and/or invalid sexp type return 1; case ID_EDIT_PASTE_SPECIAL: // add paste, instead of replace. // the following assumptions are made.. - Assert((Sexp_clipboard > -1) && (Sexp_nodes[Sexp_clipboard].type != SEXP_NOT_USED)); - Assert(Sexp_nodes[Sexp_clipboard].subtype != SEXP_ATOM_LIST); + SDL_assert((Sexp_clipboard > -1) && (Sexp_nodes[Sexp_clipboard].type != SEXP_NOT_USED)); + SDL_assert(Sexp_nodes[Sexp_clipboard].subtype != SEXP_ATOM_LIST); if (Sexp_nodes[Sexp_clipboard].subtype == SEXP_ATOM_OPERATOR) { expand_operator(item_index); @@ -2942,17 +2942,17 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) } } else if (Sexp_nodes[Sexp_clipboard].subtype == SEXP_ATOM_NUMBER) { - Assert(Sexp_nodes[Sexp_clipboard].rest == -1); + SDL_assert(Sexp_nodes[Sexp_clipboard].rest == -1); expand_operator(item_index); add_data(CTEXT(Sexp_clipboard), (SEXPT_NUMBER | SEXPT_VALID)); } else if (Sexp_nodes[Sexp_clipboard].subtype == SEXP_ATOM_STRING) { - Assert(Sexp_nodes[Sexp_clipboard].rest == -1); + SDL_assert(Sexp_nodes[Sexp_clipboard].rest == -1); expand_operator(item_index); add_data(CTEXT(Sexp_clipboard), (SEXPT_STRING | SEXPT_VALID)); } else - Assert(0); // unknown and/or invalid sexp type + SDL_assert(0); // unknown and/or invalid sexp type return 1; @@ -3009,32 +3009,32 @@ BOOL sexp_tree::OnCommand(WPARAM wParam, LPARAM lParam) if ((m_mode & ST_ROOT_DELETABLE) && (item_index == -1)) { item_index = GetItemData(item_handle); if (m_mode == MODE_GOALS) { - Assert(Goal_editor_dlg); + SDL_assert(Goal_editor_dlg); node = Goal_editor_dlg->handler(ROOT_DELETED, item_index); } else if (m_mode == MODE_EVENTS) { - Assert(Event_editor_dlg); + SDL_assert(Event_editor_dlg); node = Event_editor_dlg->handler(ROOT_DELETED, item_index); } else { - Assert(m_mode == MODE_CAMPAIGN); + SDL_assert(m_mode == MODE_CAMPAIGN); node = Campaign_tree_formp->handler(ROOT_DELETED, item_index); } - Assert(node >= 0); + SDL_assert(node >= 0); free_node2(node); DeleteItem(item_handle); *modified = 1; return 1; } - Assert(item_index >= 0); + SDL_assert(item_index >= 0); h = GetParentItem(item_handle); parent = nodes[item_index].parent; if ((parent == -1) && (m_mode == MODE_EVENTS)) Int3(); // no longer used, temporary to check if called still. - Assert(parent != -1 && nodes[parent].handle == h); + SDL_assert(parent != -1 && nodes[parent].handle == h); free_node(item_index); DeleteItem(item_handle); @@ -3064,7 +3064,7 @@ void sexp_tree::add_or_replace_operator(int op, int replace_flag) if (replace_flag) { if (nodes[item_index].flags & OPERAND) { // are both operators? op2 = identify_operator(nodes[item_index].text); - Assert(op2 >= 0); + SDL_assert(op2 >= 0); i = count_args(nodes[item_index].child); if ((i >= Operators[op].min) && (i <= Operators[op].max)) { // are old num args valid? while (i--) @@ -3211,7 +3211,7 @@ int sexp_tree::add_default_operator(int op, int argnum) return -1; if (item.type & SEXPT_OPERATOR) { - Assert((item.op >= 0) && (item.op < Num_operators)); + SDL_assert((item.op >= 0) && (item.op < Num_operators)); add_or_replace_operator(item.op); item_index = index; item_handle = h; @@ -3222,7 +3222,7 @@ int sexp_tree::add_default_operator(int op, int argnum) if (argnum == 0) { int sexp_var_index = get_index_sexp_variable_name(item.text); - Assert(sexp_var_index != -1); + SDL_assert(sexp_var_index != -1); int type = SEXPT_VALID | SEXPT_VARIABLE; if (Sexp_variables[sexp_var_index].type & SEXP_VARIABLE_STRING) { type |= SEXPT_STRING; @@ -3238,12 +3238,12 @@ int sexp_tree::add_default_operator(int op, int argnum) } else { // the the variable name char buf2[256]; - Assert(argnum == 1); + SDL_assert(argnum == 1); sexp_list_item temp_item; temp_item.text = buf2; get_default_value(&temp_item, op, 0); int sexp_var_index = get_index_sexp_variable_name(temp_item.text); - Assert(sexp_var_index != -1); + SDL_assert(sexp_var_index != -1); // from name get type int temp_type = Sexp_variables[sexp_var_index].type; @@ -3395,7 +3395,7 @@ int sexp_tree::query_default_argument_available(int op) { int i; - Assert(op >= 0); + SDL_assert(op >= 0); for (i=0; icurrent_message_name(0)) return 1; @@ -3543,14 +3543,14 @@ void sexp_tree::expand_operator(int node) if (nodes[node].flags & COMBINED) { node = nodes[node].parent; - Assert((nodes[node].flags & OPERAND) && (nodes[node].flags & EDITABLE)); + SDL_assert((nodes[node].flags & OPERAND) && (nodes[node].flags & EDITABLE)); } if ((nodes[node].flags & OPERAND) && (nodes[node].flags & EDITABLE)) { // expandable? - Assert(nodes[node].type & SEXPT_OPERATOR); + SDL_assert(nodes[node].type & SEXPT_OPERATOR); h = nodes[node].handle; data = nodes[node].child; - Assert(data != -1 && nodes[data].next == -1 && nodes[data].child == -1); + SDL_assert(data != -1 && nodes[data].next == -1 && nodes[data].child == -1); SetItem(h, TVIF_TEXT, nodes[node].text, 0, 0, 0, 0, 0); nodes[node].flags = OPERAND; @@ -3612,7 +3612,7 @@ int sexp_tree::add_variable_data(char *data, int type) { int node; - Assert(type & SEXPT_VARIABLE); + SDL_assert(type & SEXPT_VARIABLE); expand_operator(item_index); node = allocate_node(item_index); @@ -3681,8 +3681,8 @@ int sexp_tree::verify_tree(int node, int *bypass) if (!total) return 0; // nothing to check - Assert(node >= 0 && node < MAX_SEXP_TREE_SIZE); - Assert(nodes[node].type == SEXPT_OPERATOR); + SDL_assert(node >= 0 && node < MAX_SEXP_TREE_SIZE); + SDL_assert(nodes[node].type == SEXPT_OPERATOR); op = identify_operator(nodes[node].text); if (op == -1) @@ -3697,7 +3697,7 @@ int sexp_tree::verify_tree(int node, int *bypass) node = nodes[node].child; // get first argument while (node != -1) { type = query_operator_argument_type(op, argnum); - Assert(nodes[node].type & SEXPT_VALID); + SDL_assert(nodes[node].type & SEXPT_VALID); if (nodes[node].type == SEXPT_OPERATOR) { if (verify_tree(node) == -1) return -1; @@ -3718,7 +3718,7 @@ int sexp_tree::verify_tree(int node, int *bypass) type2 = SEXP_ATOM_STRING; } else - Assert(0); // unknown and invalid sexp node type. + SDL_assert(0); // unknown and invalid sexp node type. switch (type) { case OPF_NUMBER: @@ -3856,7 +3856,7 @@ void sexp_tree::hilite_item(int node) // because the MFC function EnsureVisible() doesn't do what it says it does, I wrote this. void sexp_tree::ensure_visible(int node) { - Assert(node != -1); + SDL_assert(node != -1); if (nodes[node].parent != -1) ensure_visible(nodes[node].parent); // expand all parents first @@ -3876,7 +3876,7 @@ void get_variable_default_text_from_variable_text(char *text, char *default_text // find '(' start = strstr(text, "("); - Assert(start); + SDL_assert(start); start++; // get length and copy all but last char ")" @@ -3898,17 +3898,17 @@ void get_variable_name_from_sexp_tree_node_text(const char *text, char *var_name int sexp_tree::get_modify_variable_type() { - Assert(item_index > -1); + SDL_assert(item_index > -1); int sexp_var_index; // get arg int parent = nodes[item_index].parent; - Assert(parent != -1); + SDL_assert(parent != -1); if ( !stricmp(nodes[parent].text, "modify-variable") ) { - Assert(nodes[parent].child != -1); + SDL_assert(nodes[parent].child != -1); sexp_var_index = get_tree_name_to_sexp_variable_index(nodes[nodes[parent].child].text); - Assert(sexp_var_index != -1); + SDL_assert(sexp_var_index != -1); } else { Int3(); // should not be called otherwise } @@ -4066,7 +4066,7 @@ void sexp_tree::replace_variable_data(int var_idx, int type) HTREEITEM h; char buf[128]; - Assert(type & SEXPT_VARIABLE); + SDL_assert(type & SEXPT_VARIABLE); node = nodes[item_index].child; if (node != -1) @@ -4161,7 +4161,7 @@ void sexp_tree::move_branch(int source, int parent) node = nodes[node].child; while (nodes[node].next != source) { node = nodes[node].next; - Assert(node != -1); + SDL_assert(node != -1); } nodes[node].next = nodes[source].next; @@ -4261,8 +4261,8 @@ void sexp_tree::swap_roots(HTREEITEM one, HTREEITEM two) { HTREEITEM h; - Assert(!GetParentItem(one)); - Assert(!GetParentItem(two)); + SDL_assert(!GetParentItem(one)); + SDL_assert(!GetParentItem(two)); // copy_branch(one, TVI_ROOT, two); // move_branch(two, TVI_ROOT, one); // DeleteItem(one); @@ -4336,23 +4336,23 @@ void sexp_tree::OnLButtonUp(UINT nFlags, CPoint point) m_p_image_list = NULL; if (m_h_drop && m_h_drag != m_h_drop) { - Assert(m_h_drag); + SDL_assert(m_h_drag); index1 = GetItemData(m_h_drag); index2 = GetItemData(m_h_drop); swap_roots(m_h_drag, m_h_drop); if (m_mode == MODE_GOALS) { - Assert(Goal_editor_dlg); + SDL_assert(Goal_editor_dlg); Goal_editor_dlg->swap_handler(index1, index2); } else if (m_mode == MODE_EVENTS) { - Assert(Event_editor_dlg); + SDL_assert(Event_editor_dlg); Event_editor_dlg->swap_handler(index1, index2); } else if (m_mode == MODE_CAMPAIGN) { Campaign_tree_formp->swap_handler(index1, index2); } else - Assert(0); + SDL_assert(0); } else MessageBeep(0); @@ -4533,7 +4533,7 @@ void sexp_tree::update_help(HTREEITEM h) c++; } - Assert(j >= 0); + SDL_assert(j >= 0); if (query_operator_argument_type(code, c) == OPF_MESSAGE) { for (j=0; j= 0); - Assert(!stricmp(nodes[z].text, "add-ship-goal") || !stricmp(nodes[z].text, "add-wing-goal") || !stricmp(nodes[z].text, "add-goal")); + SDL_assert(z >= 0); + SDL_assert(!stricmp(nodes[z].text, "add-ship-goal") || !stricmp(nodes[z].text, "add-wing-goal") || !stricmp(nodes[z].text, "add-goal")); z = nodes[z].child; - Assert(z >= 0); + SDL_assert(z >= 0); dock_ship = ship_name_lookup(nodes[z].text, 1); - Assert( dock_ship != -1 ); + SDL_assert( dock_ship != -1 ); } } @@ -4888,14 +4888,14 @@ sexp_list_item *sexp_tree::get_listing_opf_subsystem(int parent_node, int arg_in // determine if the parent is one of the set subsystem strength items. If so, // we want to append the "Hull" name onto the end of the menu - Assert(parent_node >= 0); + SDL_assert(parent_node >= 0); // get the operator type of the node op = find_operator(nodes[parent_node].text); // first child node child = nodes[parent_node].child; - Assert(child >= 0); + SDL_assert(child >= 0); switch(op){ // where we care about hull strength @@ -4924,18 +4924,18 @@ sexp_list_item *sexp_tree::get_listing_opf_subsystem(int parent_node, int arg_in // if this is arg index 3 (targeted ship) if(arg_index == 3){ - Assert(arg_index == 3); + SDL_assert(arg_index == 3); child = nodes[child].next; - Assert(child >= 0); + SDL_assert(child >= 0); child = nodes[child].next; } else { - Assert(arg_index == 1); + SDL_assert(arg_index == 1); } break; } // now find the ship and add all relevant subsystems - Assert(child >= 0); + SDL_assert(child >= 0); sh = ship_name_lookup(nodes[child].text, 1); if (sh >= 0) { subsys = GET_FIRST(&Ships[sh].subsys_list); @@ -5011,9 +5011,9 @@ sexp_list_item *sexp_tree::get_listing_opf_ai_goal(int parent_node) int i, n, w, z, child; sexp_list_item head; - Assert(parent_node >= 0); + SDL_assert(parent_node >= 0); child = nodes[parent_node].child; - Assert(child >= 0); + SDL_assert(child >= 0); n = ship_name_lookup(nodes[child].text, 1); if (n >= 0) { // add operators if it's an ai-goal and ai-goal is allowed for that ship @@ -5046,15 +5046,15 @@ sexp_list_item *sexp_tree::get_listing_opf_docker_point(int parent_node) int i, z, sh; sexp_list_item head; - Assert(parent_node >= 0); - Assert(!stricmp(nodes[parent_node].text, "ai-dock")); + SDL_assert(parent_node >= 0); + SDL_assert(!stricmp(nodes[parent_node].text, "ai-dock")); z = nodes[parent_node].parent; - Assert(z >= 0); - Assert(!stricmp(nodes[z].text, "add-ship-goal") || !stricmp(nodes[z].text, "add-wing-goal") || !stricmp(nodes[z].text, "add-goal")); + SDL_assert(z >= 0); + SDL_assert(!stricmp(nodes[z].text, "add-ship-goal") || !stricmp(nodes[z].text, "add-wing-goal") || !stricmp(nodes[z].text, "add-goal")); z = nodes[z].child; - Assert(z >= 0); + SDL_assert(z >= 0); sh = ship_name_lookup(nodes[z].text, 1); if (sh >= 0) { @@ -5071,11 +5071,11 @@ sexp_list_item *sexp_tree::get_listing_opf_dockee_point(int parent_node) int i, z, sh; sexp_list_item head; - Assert(parent_node >= 0); - Assert(!stricmp(nodes[parent_node].text, "ai-dock")); + SDL_assert(parent_node >= 0); + SDL_assert(!stricmp(nodes[parent_node].text, "ai-dock")); z = nodes[parent_node].child; - Assert(z >= 0); + SDL_assert(z >= 0); sh = ship_name_lookup(nodes[z].text, 1); if (sh >= 0) { @@ -5094,7 +5094,7 @@ sexp_list_item *sexp_tree::get_listing_opf_message() sexp_list_item head; if (m_mode == MODE_EVENTS) { - Assert(Event_editor_dlg); + SDL_assert(Event_editor_dlg); // this for looks a litle strange, but had to do it get rid of a warning. Conditional //uses last statement is sequence, i.e. same as for (i=0, str, i++) for (i=0; str = Event_editor_dlg->current_message_name(i), str; i++) @@ -5197,9 +5197,9 @@ sexp_list_item *sexp_tree::get_listing_opf_goal_name(int parent_node) if (m_mode == MODE_CAMPAIGN) { int child; - Assert(parent_node >= 0); + SDL_assert(parent_node >= 0); child = nodes[parent_node].child; - Assert(child >= 0); + SDL_assert(child >= 0); for (m=0; m= 0); + SDL_assert(parent_node >= 0); child = nodes[parent_node].child; - Assert(child >= 0); + SDL_assert(child >= 0); for (m=0; m= 0); + SDL_assert(m_team >= 0); if (((CButton *) GetDlgItem(IDC_TEAM_YES))->GetCheck()) Shield_sys_teams[m_team] = 0; else if (((CButton *) GetDlgItem(IDC_TEAM_NO))->GetCheck()) @@ -183,7 +183,7 @@ void shield_sys_dlg::set_team() void shield_sys_dlg::OnSelchangeType() { - Assert(m_type >= 0); + SDL_assert(m_type >= 0); if (((CButton *) GetDlgItem(IDC_TYPE_YES))->GetCheck()) Shield_sys_types[m_type] = 0; else if (((CButton *) GetDlgItem(IDC_TYPE_NO))->GetCheck()) diff --git a/src/fred2/ship_select.cpp b/src/fred2/ship_select.cpp index 7708ef3..1f1d17d 100644 --- a/src/fred2/ship_select.cpp +++ b/src/fred2/ship_select.cpp @@ -334,7 +334,7 @@ void ship_select::OnOK() } if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) { - Assert(Briefing_dialog); + SDL_assert(Briefing_dialog); Briefing_dialog->icon_select(Objects[cur_object_index].instance); } else { diff --git a/src/fred2/shipeditordlg.cpp b/src/fred2/shipeditordlg.cpp index c0386c7..869d3b4 100644 --- a/src/fred2/shipeditordlg.cpp +++ b/src/fred2/shipeditordlg.cpp @@ -702,7 +702,7 @@ void CShipEditorDlg::initialize_data(int full_update) } if (!multi_edit) { - Assert((ship_count == 1) && (base_ship >= 0)); + SDL_assert((ship_count == 1) && (base_ship >= 0)); m_ship_name = Ships[base_ship].ship_name; } else { m_ship_name = _T(""); @@ -897,7 +897,7 @@ void CShipEditorDlg::initialize_data(int full_update) } else { // no ships selected, 0 or more player ships selected if (player_count > 1) { // multiple player ships selected - Assert(base_player >= 0); + SDL_assert(base_player >= 0); m_ship_name = _T(""); m_player_ship.SetCheck(TRUE); objp = GET_FIRST(&obj_used_list); @@ -922,7 +922,7 @@ void CShipEditorDlg::initialize_data(int full_update) // only 1 player selected.. } else if (query_valid_object() && (Objects[cur_object_index].type == OBJ_START)) { - Assert((player_count == 1) && !multi_edit); + SDL_assert((player_count == 1) && !multi_edit); player_ship = Objects[cur_object_index].instance; m_ship_name = Ships[player_ship].ship_name; m_ship_class = Ships[player_ship].ship_info_index; @@ -1258,12 +1258,12 @@ int CShipEditorDlg::update_data(int redraw) wing = Ships[single_ship].wingnum; if (wing >= 0) { - Assert((wing < MAX_WINGS) && Wings[wing].wave_count); + SDL_assert((wing < MAX_WINGS) && Wings[wing].wave_count); for (i=0; i= 0); + SDL_assert(ship >= 0); m_ai_class = Ships[ship].weapons.ai_class; } @@ -1823,7 +1823,7 @@ void CShipEditorDlg::OnPrev() } } - Assert(i < n); + SDL_assert(i < n); i--; if (i < 0){ i = n - 1; @@ -1856,7 +1856,7 @@ void CShipEditorDlg::OnNext() if (Ships[cur_ship].objnum == arr[i]) break; - Assert(i < n); + SDL_assert(i < n); i++; if (i == n) i = 0; @@ -2069,7 +2069,7 @@ void CShipEditorDlg::OnIgnoreOrders() // TODO: Add your control notification handler code here ignore_orders_dlg player_order_dlg; - Assert(query_valid_object()); + SDL_assert(query_valid_object()); if (!multi_edit) { if ( single_ship != -1 ){ diff --git a/src/fred2/shipgoalsdlg.cpp b/src/fred2/shipgoalsdlg.cpp index 58d3a91..b2b43ad 100644 --- a/src/fred2/shipgoalsdlg.cpp +++ b/src/fred2/shipgoalsdlg.cpp @@ -674,7 +674,7 @@ void ShipGoalsDlg::initialize(ai_goal *goals, int ship) m_subsys[item] = -1; num = get_docking_list(Ships[ship].modelnum); for (i=0; itype == OBJ_SHIP) || (ptr->type == OBJ_START)) { inst = ptr->instance; if (ptr->type == OBJ_SHIP) { - Assert(inst >= 0 && inst < MAX_SHIPS); + SDL_assert(inst >= 0 && inst < MAX_SHIPS); if (!stricmp(goalp[item].ship_name, Ships[inst].ship_name)) { m_data[item] = inst | TYPE_SHIP; break; } } else { - Assert(inst >= 0 && inst < MAX_SHIPS); + SDL_assert(inst >= 0 && inst < MAX_SHIPS); if (!stricmp(goalp[item].ship_name, Ships[inst].ship_name)) { m_data[item] = inst | TYPE_PLAYER; break; @@ -747,9 +747,9 @@ void ShipGoalsDlg::initialize(ai_goal *goals, int ship) if (m_data[item]) { num = get_docking_list(Ships[m_data[item] & DATA_MASK].modelnum); for (i=0; i= MAX_AI_GOALS) m_behavior_box[item] -> EnableWindow(FALSE); - Assert(item >= 0 && item < ED_MAX_GOALS); + SDL_assert(item >= 0 && item < ED_MAX_GOALS); m_object_box[item] -> ResetContent(); if (m_behavior[item] < 1) { m_object_box[item] -> EnableWindow(FALSE); @@ -851,7 +851,7 @@ void ShipGoalsDlg::set_item(int item, int init) else t = TYPE_PLAYER; - Assert(inst >= 0 && inst < MAX_SHIPS); + SDL_assert(inst >= 0 && inst < MAX_SHIPS); // remove all marked ships from list if (!goalp && (ptr->flags & OF_MARKED)) inst = -1; @@ -904,7 +904,7 @@ void ShipGoalsDlg::set_item(int item, int init) m_subsys_box[item] -> EnableWindow(TRUE); m_subsys_box[item] -> ResetContent(); for (i=0; i AddString(Docking_bay_list[i]); m_subsys_box[item] -> SetItemDataPtr(z, Docking_bay_list[i]); } @@ -1240,7 +1240,7 @@ void ShipGoalsDlg::update_item(int item, int multi) return; default: - Assert(0); + SDL_assert(0); } if (stricmp(save, goalp[item].ship_name)) @@ -1365,7 +1365,7 @@ void ShipGoalsDlg::set_object(int item) m_dock2_box[item] -> EnableWindow(TRUE); m_dock2_box[item] -> ResetContent(); for (i=0; i AddString(Docking_bay_list[i]); str = ai_get_goal_ship_name(Docking_bay_list[i], ¬_used); m_dock2_box[item] -> SetItemDataPtr(z, str); diff --git a/src/fred2/shipspecialdamage.cpp b/src/fred2/shipspecialdamage.cpp index 095c6ca..40bd44d 100644 --- a/src/fred2/shipspecialdamage.cpp +++ b/src/fred2/shipspecialdamage.cpp @@ -120,7 +120,7 @@ BOOL ShipSpecialDamage::OnInitDialog() if (m_shock_speed < 10) m_shock_speed = 10; } else { int index = Ships[m_ship_num].special_exp_index; - Assert( (index > 0) && (index < MAX_SEXP_VARIABLES-5) ); + SDL_assert( (index > 0) && (index < MAX_SEXP_VARIABLES-5) ); m_inner_rad = atoi(Sexp_variables[index++].text); m_outer_rad = atoi(Sexp_variables[index++].text); diff --git a/src/fred2/textviewdlg.cpp b/src/fred2/textviewdlg.cpp index dce56c8..dddc9f1 100644 --- a/src/fred2/textviewdlg.cpp +++ b/src/fred2/textviewdlg.cpp @@ -58,7 +58,7 @@ void text_view_dlg::set(int ship_class) return; fp = cfopen("ships.tbl", "r"); - Assert(fp); + SDL_assert(fp); while (cfgets(line, 255, fp)) { while (line[strlen(line) - 1] == '\n') diff --git a/src/fred2/waypointpathdlg.cpp b/src/fred2/waypointpathdlg.cpp index 4819d79..77a4a28 100644 --- a/src/fred2/waypointpathdlg.cpp +++ b/src/fred2/waypointpathdlg.cpp @@ -186,7 +186,7 @@ void waypoint_path_dlg::initialize_data(int full_update) return; if (query_valid_object() && Objects[cur_object_index].type == OBJ_WAYPOINT) - Assert(cur_waypoint_list == (Objects[cur_object_index].instance / 65536)); + SDL_assert(cur_waypoint_list == (Objects[cur_object_index].instance / 65536)); if (cur_waypoint_list >= 0) { m_name = _T(Waypoint_lists[cur_waypoint_list].name); @@ -218,7 +218,7 @@ int waypoint_path_dlg::update_data(int redraw) UpdateData(TRUE); if (query_valid_object() && Objects[cur_object_index].type == OBJ_WAYPOINT) - Assert(cur_waypoint_list == (Objects[cur_object_index].instance / 65536)); + SDL_assert(cur_waypoint_list == (Objects[cur_object_index].instance / 65536)); if (cur_waypoint_list >= 0) { if (!strnicmp(m_name, "player ", 7)) { diff --git a/src/fred2/weaponeditordlg.cpp b/src/fred2/weaponeditordlg.cpp index cab386c..19aa5c3 100644 --- a/src/fred2/weaponeditordlg.cpp +++ b/src/fred2/weaponeditordlg.cpp @@ -293,7 +293,7 @@ BOOL WeaponEditorDlg::OnInitDialog() flag = 1; } else { - Assert(Ships[inst].ship_info_index == m_ship_class); + SDL_assert(Ships[inst].ship_info_index == m_ship_class); if (pilot.ai_class != Ships[inst].weapons.ai_class) pilot.ai_class = BLANK_FIELD; diff --git a/src/fred2/wing.cpp b/src/fred2/wing.cpp index cc0be25..f4ad44b 100644 --- a/src/fred2/wing.cpp +++ b/src/fred2/wing.cpp @@ -241,7 +241,7 @@ void mark_wing(int wing) int i; unmark_all(); - Assert(Wings[wing].special_ship >= 0 && Wings[wing].special_ship < Wings[wing].wave_count); + SDL_assert(Wings[wing].special_ship >= 0 && Wings[wing].special_ship < Wings[wing].wave_count); set_cur_object_index(wing_objects[wing][Wings[wing].special_ship]); for (i=0; iinstance); } - Assert(!Wings[wing_num].wave_count); + SDL_assert(!Wings[wing_num].wave_count); Ship_editor_dialog.initialize_data(1); Ship_editor_dialog.bypass_errors = Wing_editor_dialog.bypass_errors = 0; @@ -336,7 +336,7 @@ void remove_ship_from_wing(int ship, int min) if (wing_objects[wing][i] == Ships[ship].objnum) break; - Assert(i != -1); // Error, object should be in wing. + SDL_assert(i != -1); // Error, object should be in wing. if (Wings[wing].special_ship == i) Wings[wing].special_ship = 0; @@ -440,7 +440,7 @@ int create_wing() } } - Assert(!Wings[wing].wave_count); + SDL_assert(!Wings[wing].wave_count); num_wings--; } @@ -534,7 +534,7 @@ int create_wing() else i = count++; - Assert((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)); + SDL_assert((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)); ship = ptr->instance; if (Ships[ship].wingnum != -1) { if (ptr->type == OBJ_SHIP) @@ -648,8 +648,8 @@ void create_wings_from_objects(void) if (get_wingnum(i) != -1) { int wingnum = get_wingnum(i); - Assert((wingnum >= 0) && (wingnum < MAX_WINGS)); - Assert(Wings[wingnum].wave_count < MAX_SHIPS_PER_WING); + SDL_assert((wingnum >= 0) && (wingnum < MAX_WINGS)); + SDL_assert(Wings[wingnum].wave_count < MAX_SHIPS_PER_WING); // JEH strcpy(Wings[wingnum].ship_names[Wings[wingnum].count++], i; } @@ -685,12 +685,12 @@ void create_wing(int wing_type, int leader_index, int *wingmen, int max_size, in initialize_wings(); - Assert((wing_type >= 0) && (wing_type < MAX_WING_FORMATIONS)); - Assert(Wing_formations[wing_type].num_vectors > 0); - Assert(Wing_formations[wing_type].num_vectors < MAX_WING_VECTORS); + SDL_assert((wing_type >= 0) && (wing_type < MAX_WING_FORMATIONS)); + SDL_assert(Wing_formations[wing_type].num_vectors > 0); + SDL_assert(Wing_formations[wing_type].num_vectors < MAX_WING_VECTORS); - Assert(Objects[leader_index].type != OBJ_NONE); - Assert(max_size < MAX_SHIPS_PER_WING); + SDL_assert(Objects[leader_index].type != OBJ_NONE); + SDL_assert(max_size < MAX_SHIPS_PER_WING); num_placed = 0; wingp = &Wing_formations[wing_type]; @@ -708,9 +708,9 @@ void create_wing(int wing_type, int leader_index, int *wingmen, int max_size, in break; else { curobj = get_free_objnum(); - Assert(curobj != -1); + SDL_assert(curobj != -1); Objects[curobj].type = lobjp->type; - Assert(Wings[cur_wing].wave_count < MAX_SHIPS_PER_WING); + SDL_assert(Wings[cur_wing].wave_count < MAX_SHIPS_PER_WING); // JEH Wings[cur_wing].ship_list[Wings[cur_wing].count] = curobj; Wings[cur_wing].wave_count++; } @@ -746,9 +746,9 @@ void test_form_wing(int count) j = 0; - Assert(cur_object_index != -1); - Assert(Objects[cur_object_index].type != OBJ_NONE); - Assert(get_wingnum(cur_object_index) != -1); + SDL_assert(cur_object_index != -1); + SDL_assert(Objects[cur_object_index].type != OBJ_NONE); + SDL_assert(get_wingnum(cur_object_index) != -1); get_wingnum(cur_object_index); wingmen[0] = -1; diff --git a/src/fred2/wing_editor.cpp b/src/fred2/wing_editor.cpp index d2da3c2..289fb46 100644 --- a/src/fred2/wing_editor.cpp +++ b/src/fred2/wing_editor.cpp @@ -860,7 +860,7 @@ int wing_editor::update_data(int redraw) ai_update_goal_references(REF_TYPE_WING, old_name, str); for (i=0; i= 0 ); - Assert( HUD_config.main_color <= 2 ); + SDL_assert( HUD_config.main_color >= 0 ); + SDL_assert( HUD_config.main_color <= 2 ); #endif - Assert( Mission_palette >= 0 ); - Assert( Mission_palette <= 98 ); + SDL_assert( Mission_palette >= 0 ); + SDL_assert( Mission_palette <= 98 ); #ifdef MAKE_FS1 if ( The_mission.flags & MISSION_FLAG_SUBSPACE ) { @@ -1933,8 +1933,8 @@ void game_loading_callback(int count) { game_do_networking(); - Assert( Game_loading_callback_inited==1 ); - Assert( Game_loading_ani != NULL ); + SDL_assert( Game_loading_callback_inited==1 ); + SDL_assert( Game_loading_ani != NULL ); int framenum = ((Game_loading_ani->total_frames*count) / COUNT_ESTIMATE)+1; if ( framenum > Game_loading_ani->total_frames-1 ) { @@ -1968,7 +1968,7 @@ void game_loading_callback(int count) void game_loading_callback_init() { - Assert( Game_loading_callback_inited==0 ); + SDL_assert( Game_loading_callback_inited==0 ); Game_loading_background = bm_load(Game_loading_bground_fname[gr_screen.res]); #ifdef MAKE_FS1 @@ -1977,9 +1977,9 @@ void game_loading_callback_init() Game_loading_ani = anim_load( Game_loading_ani_fname[gr_screen.res]); - Assert( Game_loading_ani != NULL ); + SDL_assert( Game_loading_ani != NULL ); Game_loading_ani_instance = init_anim_instance(Game_loading_ani, 16); - Assert( Game_loading_ani_instance != NULL ); + SDL_assert( Game_loading_ani_instance != NULL ); Game_loading_frame = -1; Game_loading_callback_inited = 1; @@ -1991,7 +1991,7 @@ void game_loading_callback_init() void game_loading_callback_close() { - Assert( Game_loading_callback_inited==1 ); + SDL_assert( Game_loading_callback_inited==1 ); // Make sure bar shows all the way over. game_loading_callback(COUNT_ESTIMATE); @@ -2436,9 +2436,9 @@ void game_init() ptr = os_config_read_string(NULL, NOX("Soundcard"), NULL); mprintf(("soundcard = %s\n", ptr ? ptr : "")); if (ptr) { - if (!stricmp(ptr, NOX("no sound"))) { + if (!SDL_strcasecmp(ptr, NOX("no sound"))) { Cmdline_freespace_no_sound = 1; - } else if ( !stricmp(ptr, NOX("EAX")) || !stricmp(ptr, NOX("Aureal A3D")) ) { + } else if ( !SDL_strcasecmp(ptr, NOX("EAX")) || !SDL_strcasecmp(ptr, NOX("Aureal A3D")) ) { use_eax = 1; } } @@ -2485,7 +2485,7 @@ void game_init() } if(!Is_standalone){ - if(!stricmp(ptr, "Aucune acc�l�ration 3D") || !stricmp(ptr, "Keine 3D-Beschleunigerkarte") || !stricmp(ptr, "No 3D acceleration")){ + if(!SDL_strcasecmp(ptr, "Aucune acc�l�ration 3D") || !SDL_strcasecmp(ptr, "Keine 3D-Beschleunigerkarte") || !SDL_strcasecmp(ptr, "No 3D acceleration")){ #ifndef PLAT_UNIX MessageBox((HWND)os_get_window(), XSTR("Warning, Freespace 2 requires Glide or Direct3D hardware accleration. You will not be able to run Freespace 2 without it.", 1448), XSTR("Warning", 1449), MB_OK); #else @@ -3603,9 +3603,9 @@ void apply_hud_shake(matrix *eye_orient) matrix tm, tm2; vm_angles_2_matrix(&tm, &tangles); - Assert(vm_vec_mag(&tm.v.fvec) > 0.0f); - Assert(vm_vec_mag(&tm.v.rvec) > 0.0f); - Assert(vm_vec_mag(&tm.v.uvec) > 0.0f); + SDL_assert(vm_vec_mag(&tm.v.fvec) > 0.0f); + SDL_assert(vm_vec_mag(&tm.v.rvec) > 0.0f); + SDL_assert(vm_vec_mag(&tm.v.uvec) > 0.0f); vm_matrix_x_matrix(&tm2, eye_orient, &tm); *eye_orient = tm2; } @@ -4088,7 +4088,7 @@ void game_flip_page_and_time_it() d = t2 - t1; if (d != 0) { t = (gr_screen.max_w*gr_screen.max_h*gr_screen.bytes_per_pixel)/1024; - sprintf( transfer_text, NOX("%ld MB/s"), fixmuldiv(t,65,d) ); + sprintf( transfer_text, NOX("%d MB/s"), fixmuldiv(t,65,d) ); } #else gr_flip (); @@ -4297,7 +4297,7 @@ void game_maybe_do_dead_popup(float frametime) // this should only happen during a red alert mission case 3: // bogus? - Assert(The_mission.red_alert); + SDL_assert(The_mission.red_alert); if(!The_mission.red_alert){ gameseq_post_event(GS_EVENT_START_GAME); break; @@ -4423,7 +4423,7 @@ void game_frame() if ((!(Game_mode & GM_MULTIPLAYER)) || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER))) { if (!(Game_mode & GM_STANDALONE_SERVER)){ - Assert( OBJ_INDEX(Player_obj) >= 0 ); + SDL_assert( OBJ_INDEX(Player_obj) >= 0 ); } } @@ -4478,7 +4478,7 @@ void game_frame() // if not actually in a game play state, then return. This condition could only be true in // a multiplayer game. if ( !actually_playing ) { - Assert( Game_mode & GM_MULTIPLAYER ); + SDL_assert( Game_mode & GM_MULTIPLAYER ); return; } @@ -4661,7 +4661,7 @@ void game_stop_time() void game_start_time() { timer_paused--; - Assert(timer_paused >= 0); + SDL_assert(timer_paused >= 0); if (timer_paused==0) { fix time; time = timer_get_fixed_seconds(); @@ -4681,7 +4681,7 @@ void game_start_time() // Restore the timer_tick stuff... // Normally, you should never access 'timestamp_ticker', consider this a low-level routine - Assert( saved_timestamp_ticker > -1 ); // Called out of order, get JAS + SDL_assert( saved_timestamp_ticker > -1 ); // Called out of order, get JAS timestamp_ticker = saved_timestamp_ticker; saved_timestamp_ticker = -1; } @@ -4728,7 +4728,7 @@ void game_set_frametime(int state) } #endif - Assert( Framerate_cap > 0 ); + SDL_assert( Framerate_cap > 0 ); // Cap the framerate so it doesn't get too high. { @@ -4738,7 +4738,7 @@ void game_set_frametime(int state) if (Frametime < cap) { thistime = cap - Frametime; //mprintf(("Sleeping for %6.3f seconds.\n", f2fl(thistime))); - Sleep( (DWORD)(f2fl(thistime) * 1000.0f) ); + SDL_Delay( (f2fl(thistime) * 1000.0f) ); Frametime = cap; thistime = timer_get_fixed_seconds(); } @@ -4748,7 +4748,7 @@ void game_set_frametime(int state) (f2fl(Frametime) < ((float)1.0/(float)Multi_options_g.std_framecap))){ frame_cap_diff = ((float)1.0/(float)Multi_options_g.std_framecap) - f2fl(Frametime); - Sleep((DWORD)(frame_cap_diff*1000)); + SDL_Delay((frame_cap_diff*1000)); thistime += fl2f((frame_cap_diff)); @@ -4844,7 +4844,7 @@ void game_flush() // debug console void game_do_dc_networking() { - Assert( Game_mode & GM_MULTIPLAYER ); + SDL_assert( Game_mode & GM_MULTIPLAYER ); game_do_state_common( gameseq_get_state() ); } @@ -5257,9 +5257,9 @@ void game_process_event( int current_state, int event ) case GS_EVENT_DEBRIEF: // did we end the campaign in the main freespace 2 single player campaign? #ifdef MAKE_FS1 - if(Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) && !stricmp(Campaign.filename, "freespace")) { + if(Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) && !SDL_strcasecmp(Campaign.filename, "freespace")) { #else - if(Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) && !stricmp(Campaign.filename, "freespace2")) { + if(Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) && !SDL_strcasecmp(Campaign.filename, "freespace2")) { #endif gameseq_post_event(GS_EVENT_END_CAMPAIGN); } else { @@ -5427,7 +5427,7 @@ void game_process_event( int current_state, int event ) // look for the mission for(idx=0; idxflags &= ~NETINFO_FLAG_DO_NETWORKING; } @@ -6201,7 +6201,7 @@ void game_enter_state( int old_state, int new_state ) // special code that restores player ship selection and weapons loadout when doing a quick start if ( !(Game_mode & GM_MULTIPLAYER) && ((old_state == GS_STATE_MAIN_MENU) || (old_state == GS_STATE_DEATH_BLEW_UP) || (old_state == GS_STATE_GAME_PLAY)) ) { - if ( !stricmp(Player_loadout.filename, Game_current_mission_filename) ) { + if ( !SDL_strcasecmp(Player_loadout.filename, Game_current_mission_filename) ) { wss_direct_restore_loadout(); } } @@ -7358,7 +7358,7 @@ void unload_animating_pointer() am = &Animating_mouse; for ( i = 0; i < am->num_frames; i++ ) { - Assert( (am->first_frame+i) >= 0 ); + SDL_assert( (am->first_frame+i) >= 0 ); bm_release(am->first_frame + i); } @@ -8020,7 +8020,7 @@ void oem_upsell_show_screens() int nframes; // used to pass, not really needed (should be 1) Oem_normal_cursor = gr_get_cursor_bitmap(); Oem_web_cursor = bm_load_animation("cursorweb", &nframes); - Assert(Oem_web_cursor >= 0); + SDL_assert(Oem_web_cursor >= 0); if (Oem_web_cursor < 0) { Oem_web_cursor = Oem_normal_cursor; } @@ -8080,7 +8080,7 @@ void oem_upsell_show_screens() if ( done ) { if (gameseq_get_state() != GS_STATE_END_DEMO) { gr_fade_out(0); - Sleep(300); + SDL_Delay(300); } } @@ -8250,7 +8250,7 @@ void demo_upsell_show_screens() if ( done ) { if (gameseq_get_state() != GS_STATE_END_DEMO) { gr_fade_out(0); - Sleep(300); + SDL_Delay(300); } } diff --git a/src/gamehelp/contexthelp.cpp b/src/gamehelp/contexthelp.cpp index 452dedd..b48e298 100644 --- a/src/gamehelp/contexthelp.cpp +++ b/src/gamehelp/contexthelp.cpp @@ -263,14 +263,14 @@ static int Overlay = -1; // query whether a help overlay is active (ie being displayed) int help_overlay_active(int overlay_id) { - Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS); + SDL_assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS); return Help_overlay_flags & (1<= 0 && overlay_id < MAX_HELP_OVERLAYS); + SDL_assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS); if ( state > 0 ) { Help_overlay_flags |= (1<= 0 && overlay_id < MAX_HELP_OVERLAYS); + SDL_assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS); if ( Help_overlay_flags & (1<= 0 && overlay_id < MAX_HELP_OVERLAYS); + SDL_assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS); // this draws each line of help text with white on black text (use the GR_640 index for the string) for (idx = 0; idx < textcount; idx++) { diff --git a/src/gamesequence/gamesequence.cpp b/src/gamesequence/gamesequence.cpp index 6021ff3..fbff08c 100644 --- a/src/gamesequence/gamesequence.cpp +++ b/src/gamesequence/gamesequence.cpp @@ -437,7 +437,7 @@ void gameseq_post_event( int event ) nprintf(("Warning", "Received post for event %s during state transtition. Find Allender if you are unsure if this is bad.\n", GS_event_text[event] )); } - Assert(gs[gs_current_stack].queue_tail < MAX_GAMESEQ_EVENTS); + SDL_assert(gs[gs_current_stack].queue_tail < MAX_GAMESEQ_EVENTS); gs[gs_current_stack].event_queue[gs[gs_current_stack].queue_tail++] = event; if ( gs[gs_current_stack].queue_tail == MAX_GAMESEQ_EVENTS ) gs[gs_current_stack].queue_tail = 0; @@ -461,7 +461,7 @@ int gameseq_get_event() // returns one of the GS_STATE_ macros int gameseq_get_state(int depth) { - Assert(depth <= gs_current_stack); + SDL_assert(depth <= gs_current_stack); return gs[gs_current_stack - depth].current_state; } @@ -485,8 +485,8 @@ void gameseq_set_state(int new_state, int override) mprintf(( "Throwing out event %d because of state set from %d to %d\n", event, old_state, new_state )); } - Assert( state_reentry == 1 ); // Get John! (Invalid state sequencing!) - Assert( state_in_event_processer == 1 ); // can only call from game_process_event + SDL_assert( state_reentry == 1 ); // Get John! (Invalid state sequencing!) + SDL_assert( state_in_event_processer == 1 ); // can only call from game_process_event state_processing_event_post++; state_reentry++; @@ -513,11 +513,11 @@ void gameseq_push_state( int new_state ) // mprintf(( "Throwing out event %d because of state push from %d to %d\n", event, old_state, new_state )); // } - Assert( state_reentry == 1 ); // Get John! (Invalid state sequencing!) - Assert( state_in_event_processer == 1 ); // can only call from game_process_event + SDL_assert( state_reentry == 1 ); // Get John! (Invalid state sequencing!) + SDL_assert( state_in_event_processer == 1 ); // can only call from game_process_event gs_current_stack++; - Assert(gs_current_stack < GS_STACK_SIZE); + SDL_assert(gs_current_stack < GS_STACK_SIZE); state_processing_event_post++; state_reentry++; @@ -536,7 +536,7 @@ void gameseq_pop_state() { int popped_state = 0; - Assert(state_reentry == 1); // Get John! (Invalid state sequencing!) + SDL_assert(state_reentry == 1); // Get John! (Invalid state sequencing!) if (gs_current_stack >= 1) { int old_state; @@ -602,7 +602,7 @@ int gameseq_process_events() int event, old_state; old_state = gs[gs_current_stack].current_state; - Assert(state_reentry == 0); // Get John! (Invalid state sequencing!) + SDL_assert(state_reentry == 0); // Get John! (Invalid state sequencing!) while ( (event = gameseq_get_event()) != -1 ) { state_reentry++; diff --git a/src/gamesnd/eventmusic.cpp b/src/gamesnd/eventmusic.cpp index 09d87d9..625db48 100644 --- a/src/gamesnd/eventmusic.cpp +++ b/src/gamesnd/eventmusic.cpp @@ -410,8 +410,8 @@ void event_music_force_switch() if (Current_pattern == SONG_BTTL_3 && new_pattern == SONG_BTTL_1) { // AL 06-24-99: maybe switch to battle 2 if hull is less than 70% if (Player_obj != NULL && Player_ship != NULL) { - Assert(Player_ship->ship_info_index >= 0); - Assert(Ship_info[Player_ship->ship_info_index].initial_hull_strength != 0); + SDL_assert(Player_ship->ship_info_index >= 0); + SDL_assert(Ship_info[Player_ship->ship_info_index].initial_hull_strength != 0); float integrity = Player_obj->hull_strength / Ship_info[Player_ship->ship_info_index].initial_hull_strength; if (integrity < HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC) { new_pattern = SONG_BTTL_2; @@ -427,7 +427,7 @@ void event_music_force_switch() if ( Patterns[new_pattern].num_measures == 0 ) return; // invalid pattern - Assert(new_pattern >= 0 && new_pattern < MAX_PATTERNS); + SDL_assert(new_pattern >= 0 && new_pattern < MAX_PATTERNS); audiostream_play(Patterns[new_pattern].handle, Master_event_music_volume, 0); // no looping audiostream_set_byte_cutoff(Patterns[new_pattern].handle, fl2i(Patterns[new_pattern].num_measures * Patterns[new_pattern].bytes_per_measure) ); Patterns[Current_pattern].next_pattern = Patterns[Current_pattern].default_next_pattern; @@ -457,7 +457,7 @@ void event_music_do_frame() Pattern_timer_id = 0; Event_music_begun = TRUE; if ( Current_pattern != -1 ) { - Assert(Patterns[Current_pattern].handle >= 0 ); + SDL_assert(Patterns[Current_pattern].handle >= 0 ); audiostream_play(Patterns[Current_pattern].handle, Master_event_music_volume, 0); // no looping audiostream_set_byte_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].bytes_per_measure) ); } @@ -589,12 +589,12 @@ void event_music_level_init(int force_soundtrack) */ } - Assert(Current_soundtrack_num >= 0 && Current_soundtrack_num < Num_soundtracks); + SDL_assert(Current_soundtrack_num >= 0 && Current_soundtrack_num < Num_soundtracks); strack = &Soundtracks[Current_soundtrack_num]; // open the pattern files, and get ready to play them for ( i = 0; i < strack->num_patterns; i++ ) { - if ( !stricmp(NOX("none.wav"), strack->pattern_fnames[i]) ) { + if ( !SDL_strcasecmp(NOX("none.wav"), strack->pattern_fnames[i]) ) { Patterns[i].handle = -1; continue; } @@ -690,7 +690,7 @@ void event_music_level_close() if ( Current_soundtrack_num >= 0 && Current_soundtrack_num < MAX_SOUNDTRACKS ) { SOUNDTRACK_INFO *strack; - Assert( Current_soundtrack_num >= 0 && Current_soundtrack_num < MAX_SOUNDTRACKS ); + SDL_assert( Current_soundtrack_num >= 0 && Current_soundtrack_num < MAX_SOUNDTRACKS ); strack = &Soundtracks[Current_soundtrack_num]; // close the pattern files @@ -799,8 +799,8 @@ int event_music_enemy_arrival() // AL 7-25-99: If hull is less than 70% then switch to battle 2 or 3, otherwise switch to 1 or 2 bool play_intense_battle_music = false; if (Player_obj != NULL && Player_ship != NULL) { - Assert(Player_ship->ship_info_index >= 0); - Assert(Ship_info[Player_ship->ship_info_index].initial_hull_strength != 0); + SDL_assert(Player_ship->ship_info_index >= 0); + SDL_assert(Ship_info[Player_ship->ship_info_index].initial_hull_strength != 0); float integrity = Player_obj->hull_strength / Ship_info[Player_ship->ship_info_index].initial_hull_strength; if (integrity < HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC) { play_intense_battle_music = true; @@ -895,7 +895,7 @@ int event_music_friendly_arrival() Patterns[Current_pattern].force_pattern = TRUE; } else { */ - Assert(Patterns[SONG_AARV_1].handle >= 0 ); + SDL_assert(Patterns[SONG_AARV_1].handle >= 0 ); audiostream_play(Patterns[SONG_AARV_1].handle, Master_event_music_volume, 0); // no looping audiostream_set_byte_cutoff(Patterns[SONG_AARV_1].handle, fl2i(Patterns[SONG_AARV_1].num_measures * Patterns[SONG_AARV_1].bytes_per_measure) ); //} @@ -1049,7 +1049,7 @@ int event_music_player_respawn() if ( Event_music_level_inited == FALSE ) return -1; -// Assert(Current_pattern == SONG_DEAD_1); +// SDL_assert(Current_pattern == SONG_DEAD_1); Event_Music_battle_started = 0; Patterns[Current_pattern].next_pattern = SONG_NRML_1; @@ -1109,12 +1109,12 @@ void event_music_parse_musictbl() // Loop through all the sound-tracks while (required_string_either("#Menu Music Start","#SoundTrack Start")) { - Assert(Num_soundtracks < MAX_SOUNDTRACKS); + SDL_assert(Num_soundtracks < MAX_SOUNDTRACKS); required_string("#SoundTrack Start"); required_string("$SoundTrack Name:"); stuff_string(Soundtracks[Num_soundtracks].name, F_NAME, NULL); while (required_string_either("#SoundTrack End","$Name:")) { - Assert( num_patterns < MAX_PATTERNS ); + SDL_assert( num_patterns < MAX_PATTERNS ); required_string("$Name:"); stuff_string(line_buf, F_NAME, NULL); @@ -1127,7 +1127,7 @@ void event_music_parse_musictbl() while ( token != NULL ) { token = strtok( NULL, NOX(" ,\t") ); if ( token == NULL ) { - Assert(count == 2 ); + SDL_assert(count == 2 ); break; } @@ -1156,17 +1156,17 @@ void event_music_parse_musictbl() // Parse the menu music section required_string("#Menu Music Start"); while (required_string_either("#Menu Music End","$Name:")) { - Assert( Num_music_files < MAX_SPOOLED_MUSIC ); + SDL_assert( Num_music_files < MAX_SPOOLED_MUSIC ); required_string("$Name:"); stuff_string(fname, F_PATHNAME, NULL); - Assert( strlen(fname) < (NAME_LENGTH-1) ); + SDL_assert( strlen(fname) < (NAME_LENGTH-1) ); strcpy( Spooled_music[Num_music_files].name, fname ); required_string("$Filename:"); stuff_string(fname, F_PATHNAME, NULL); - if ( stricmp(fname, NOX("none.wav")) ) { - Assert( strlen(fname) < (MAX_FILENAME_LEN-1) ); + if ( SDL_strcasecmp(fname, NOX("none.wav")) ) { + SDL_assert( strlen(fname) < (MAX_FILENAME_LEN-1) ); strcpy( Spooled_music[Num_music_files].filename, fname ); } @@ -1234,7 +1234,7 @@ void event_music_disable() if (Current_pattern == -1) return; - Assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS ); + SDL_assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS ); if ( audiostream_is_playing(Patterns[Current_pattern].handle) ) { audiostream_stop(Patterns[Current_pattern].handle); // stop current and rewind } @@ -1327,7 +1327,7 @@ void event_music_pause() if (Current_pattern == -1) return; - Assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS ); + SDL_assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS ); if ( audiostream_is_playing(Patterns[Current_pattern].handle) ) { audiostream_stop(Patterns[Current_pattern].handle, 0); // stop current and don't rewind } @@ -1353,7 +1353,7 @@ void event_music_unpause() if (Current_pattern == -1) return; - Assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS ); + SDL_assert( Current_pattern >= 0 && Current_pattern < MAX_PATTERNS ); if ( audiostream_is_paused(Patterns[Current_pattern].handle) == TRUE ) { audiostream_play(Patterns[Current_pattern].handle, Master_event_music_volume, 0); // no looping audiostream_set_byte_cutoff(Patterns[Current_pattern].handle, fl2i(Patterns[Current_pattern].num_measures * Patterns[Current_pattern].bytes_per_measure) ); @@ -1492,7 +1492,7 @@ void event_music_set_soundtrack(char *name) // find the correct index for the event music for ( i = 0; i < Num_soundtracks; i++ ) { - if ( !stricmp(name, Soundtracks[i].name) ) { + if ( !SDL_strcasecmp(name, Soundtracks[i].name) ) { Current_soundtrack_num = i; break; } @@ -1508,7 +1508,7 @@ int event_music_get_spooled_music_index(const char *name) { // find the correct index for the event music for ( int i = 0; i < Num_music_files; i++ ) { - if ( !stricmp(name, Spooled_music[i].name) ) { + if ( !SDL_strcasecmp(name, Spooled_music[i].name) ) { return i; } } @@ -1519,7 +1519,7 @@ int event_music_get_spooled_music_index(const char *name) // set a score based on name void event_music_set_score(int score_index, const char *name) { - Assert(score_index < NUM_SCORES); + SDL_assert(score_index < NUM_SCORES); // find the correct index for the event music Mission_music[score_index] = event_music_get_spooled_music_index(name); diff --git a/src/gamesnd/gamesnd.cpp b/src/gamesnd/gamesnd.cpp index e9147b1..46297aa 100644 --- a/src/gamesnd/gamesnd.cpp +++ b/src/gamesnd/gamesnd.cpp @@ -212,7 +212,7 @@ void gamesnd_preload_common_sounds() for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) { gs = &Snds[i]; - if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) { + if ( gs->filename[0] != 0 && SDL_strcasecmp(gs->filename, NOX("none.wav")) ) { if ( gs->preload ) { gs->id = snd_load(gs); } @@ -233,7 +233,7 @@ void gamesnd_load_gameplay_sounds() for ( i = 0; i < MAX_GAME_SOUNDS; i++ ) { gs = &Snds[i]; - if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) { + if ( gs->filename[0] != 0 && SDL_strcasecmp(gs->filename, NOX("none.wav")) ) { gs->id = snd_load(gs); } } @@ -270,7 +270,7 @@ void gamesnd_load_interface_sounds() for ( i = 0; i < MAX_INTERFACE_SOUNDS; i++ ) { gs = &Snds_iface[i]; - if ( gs->filename[0] != 0 && stricmp(gs->filename, NOX("none.wav")) ) { + if ( gs->filename[0] != 0 && SDL_strcasecmp(gs->filename, NOX("none.wav")) ) { gs->id = snd_load(gs); } } @@ -308,7 +308,7 @@ void gamesnd_parse_line(game_snd *gs, const char *tag) required_string(tag); stuff_int(&gs->sig); stuff_string(gs->filename, F_NAME, ","); - if ( !stricmp(gs->filename,NOX("empty")) ) { + if ( !SDL_strcasecmp(gs->filename,NOX("empty")) ) { gs->filename[0] = 0; advance_to_eoln(NULL); return; @@ -351,7 +351,7 @@ void gamesnd_parse_soundstbl() // Parse the gameplay sounds section required_string("#Game Sounds Start"); while (required_string_either("#Game Sounds End","$Name:")) { - Assert( num_game_sounds < MAX_GAME_SOUNDS); + SDL_assert( num_game_sounds < MAX_GAME_SOUNDS); gamesnd_parse_line( &Snds[num_game_sounds], "$Name:" ); num_game_sounds++; } @@ -360,7 +360,7 @@ void gamesnd_parse_soundstbl() // Parse the interface sounds section required_string("#Interface Sounds Start"); while (required_string_either("#Interface Sounds End","$Name:")) { - Assert( num_iface_sounds < MAX_INTERFACE_SOUNDS); + SDL_assert( num_iface_sounds < MAX_INTERFACE_SOUNDS); gamesnd_parse_line(&Snds_iface[num_iface_sounds], "$Name:"); num_iface_sounds++; } diff --git a/src/globalincs/systemvars.cpp b/src/globalincs/systemvars.cpp index 8c9d0e7..3517af7 100644 --- a/src/globalincs/systemvars.cpp +++ b/src/globalincs/systemvars.cpp @@ -363,7 +363,7 @@ monitor::monitor( const char *_name ) } for (i=0; iname, _name ); + int ret = SDL_strcasecmp( Monitor[i]->name, _name ); if ( ret == 0) { Int3(); // This monitor variable already exists!!!! @@ -644,8 +644,8 @@ void detail_level_set(int level) Detail.setting = -1; return; } - Assert( level >= 0 ); - Assert( level < NUM_DEFAULT_DETAIL_LEVELS ); + SDL_assert( level >= 0 ); + SDL_assert( level < NUM_DEFAULT_DETAIL_LEVELS ); Detail = Detail_defaults[level]; diff --git a/src/globalincs/windebug.cpp b/src/globalincs/windebug.cpp index 9cffaf1..621d3a4 100644 --- a/src/globalincs/windebug.cpp +++ b/src/globalincs/windebug.cpp @@ -89,7 +89,7 @@ * modules with no debugging info * * 15 3/05/98 3:04p John - * Made Errors, Assert, Warning info paste to clipboard. + * Made Errors, SDL_assert, Warning info paste to clipboard. * * 14 3/05/98 9:17a John * Limited stack dump depth to 16 @@ -98,7 +98,7 @@ * Added in a simple function name unmangler * * 12 3/04/98 7:08p John - * Made Freespace generate COFF files. Made Assert,Error, and Warning + * Made Freespace generate COFF files. Made SDL_assert,Error, and Warning * display the call stack. * * 11 2/22/98 2:48p John @@ -466,7 +466,7 @@ void PE_Debug::DumpSymbolInfo( DumpBuffer& dumpBuffer, DWORD relativeAddress ) // Microsoft uses sections that only _begin_ with .text const char* symName = GetSymbolName( currentSym ) ; - if ( strnicmp( symName, ".text", 5 ) == 0 || strcmpi( symName, "CODE" ) == 0 ) { + if ( SDL_strncasecmp( symName, ".text", 5 ) == 0 || strcmpi( symName, "CODE" ) == 0 ) { if ( currentSym->Value <= relativeAddress ) { PIMAGE_AUX_SYMBOL auxSym = (PIMAGE_AUX_SYMBOL)(currentSym + 1) ; if ( currentSym->Value + auxSym->Section.Length >= relativeAddress ) { @@ -554,7 +554,7 @@ PIMAGE_SECTION_HEADER PE_Debug :: SectionHeaderFromName( const char* name ) PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION( NT_Header ) ; for( unsigned i = 0; i < NT_Header->FileHeader.NumberOfSections; i++ ) { - if( strnicmp( (const char*)section->Name, name, IMAGE_SIZEOF_SHORT_NAME ) == 0 ) + if( SDL_strncasecmp( (const char*)section->Name, name, IMAGE_SIZEOF_SHORT_NAME ) == 0 ) return( section ) ; else section++ ; @@ -831,7 +831,7 @@ void dump_text_to_clipboard(char *text) CloseClipboard(); } - +/* void _cdecl WinAssert(char * text, char * filename, int linenum ) { int val; @@ -839,7 +839,7 @@ void _cdecl WinAssert(char * text, char * filename, int linenum ) gr_force_windowed(); - sprintf( AssertText1, "Assert: %s\r\nFile: %s\r\nLine: %d", text, filename, linenum ); + sprintf( AssertText1, "SDL_assert: %s\r\nFile: %s\r\nLine: %d", text, filename, linenum ); #ifdef SHOW_CALL_STACK dumpBuffer.Clear(); @@ -867,8 +867,9 @@ void _cdecl WinAssert(char * text, char * filename, int linenum ) } +*/ -void _cdecl Error( char * filename, int line, char * format, ... ) +void __cdecl Error( char * filename, int line, char * format, ... ) { int val; va_list args; @@ -907,7 +908,7 @@ void _cdecl Error( char * filename, int line, char * format, ... ) } } -void _cdecl Warning( char * filename, int line, char * format, ... ) +void __cdecl Warning( char * filename, int line, char * format, ... ) { #ifndef NDEBUG diff --git a/src/graphics/2d.cpp b/src/graphics/2d.cpp index 97fee0a..07ac1bd 100644 --- a/src/graphics/2d.cpp +++ b/src/graphics/2d.cpp @@ -818,7 +818,7 @@ done_checking_cpuid: // Check for Amd 3dnow /* - if ( !stricmp( cpu_vender, NOX("AuthenticAMD")) ) { + if ( !SDL_strcasecmp( cpu_vender, NOX("AuthenticAMD")) ) { _asm { mov eax, 0x80000000 // setup CPUID to return extended number of functions @@ -980,7 +980,7 @@ int gr_init(int res, int mode, int depth, int fred_x, int fred_y) switch( gr_screen.mode ) { #ifndef PLAT_UNIX case GR_SOFTWARE: - Assert(Fred_running || Pofview_running || Is_standalone || Nebedit_running); + SDL_assert(Fred_running || Pofview_running || Is_standalone || Nebedit_running); gr_soft_init(); break; case GR_DIRECTDRAW: @@ -1032,7 +1032,7 @@ int gr_init(int res, int mode, int depth, int fred_x, int fred_y) if (Web_cursor_bitmap < 0) { int nframes; // used to pass, not really needed (should be 1) Web_cursor_bitmap = bm_load_animation("cursorweb", &nframes); - Assert(Web_cursor_bitmap >= 0); // if bitmap didnt load, thats not good (this is protected for in release tho) + SDL_assert(Web_cursor_bitmap >= 0); // if bitmap didnt load, thats not good (this is protected for in release tho) } gr_set_color(0,0,0); @@ -1081,7 +1081,7 @@ void gr_force_windowed() } if ( Os_debugger_running ) - Sleep(1000); + SDL_Delay(1000); } void gr_activate(int active) @@ -1147,7 +1147,7 @@ void gr_activate(int active) void gr_set_cursor_bitmap(int n, int lock) { static int locked = 0; - Assert(n >= 0); + SDL_assert(n >= 0); if (!locked || (lock == GR_CURSOR_UNLOCK)) { Gr_cursor = n; @@ -1301,7 +1301,7 @@ void gr_pline_special(vector **pts, int num_pts, int thickness) int saved_zbuffer_mode, idx; int started_frame = 0; - // Assert(0); + // SDL_assert(0); // if we have less than 2 pts, bail if(num_pts < 2){ diff --git a/src/graphics/aaline.cpp b/src/graphics/aaline.cpp index 81ba29a..9e3adb5 100644 --- a/src/graphics/aaline.cpp +++ b/src/graphics/aaline.cpp @@ -322,7 +322,7 @@ void draw_aa_hspan8(fix_xy x, fix_xy y, long int ep_corr, long int slope) index = filter_index; if (index > INV_FILTER) { - Assert( i == 3 ); + SDL_assert( i == 3 ); return; // Not a valid pixel } @@ -352,7 +352,7 @@ void draw_aa_hspan8(fix_xy x, fix_xy y, long int ep_corr, long int slope) index = filter_index; if (index > INV_FILTER) { - Assert( i == 3 ); + SDL_assert( i == 3 ); return; // Not a valid pixel } @@ -417,7 +417,7 @@ void draw_aa_vspan8(fix_xy x, fix_xy y, long int ep_corr, long int slope) index = filter_index; if (index > INV_FILTER) { - Assert( i == 3 ); + SDL_assert( i == 3 ); return; // Not a valid pixel } @@ -445,7 +445,7 @@ void draw_aa_vspan8(fix_xy x, fix_xy y, long int ep_corr, long int slope) index = filter_index; if (index > INV_FILTER) { - Assert( i == 3 ); + SDL_assert( i == 3 ); return; // Not a valid pixel } diff --git a/src/graphics/bitblt.cpp b/src/graphics/bitblt.cpp index e82c77a..407e465 100644 --- a/src/graphics/bitblt.cpp +++ b/src/graphics/bitblt.cpp @@ -295,20 +295,20 @@ void grx_aabitmap_ex(int x,int y,int w,int h,int sx,int sy) // Make sure clipping algorithm works #ifndef NDEBUG - Assert( w > 0 ); - Assert( h > 0 ); - Assert( w == (dx2-dx1+1) ); - Assert( h == (dy2-dy1+1) ); - Assert( sx >= 0 ); - Assert( sy >= 0 ); - Assert( sx+w <= bw ); - Assert( sy+h <= bh ); - Assert( dx2 >= dx1 ); - Assert( dy2 >= dy1 ); - Assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); - Assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); - Assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); - Assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); + SDL_assert( w == (dx2-dx1+1) ); + SDL_assert( h == (dy2-dy1+1) ); + SDL_assert( sx >= 0 ); + SDL_assert( sy >= 0 ); + SDL_assert( sx+w <= bw ); + SDL_assert( sy+h <= bh ); + SDL_assert( dx2 >= dx1 ); + SDL_assert( dy2 >= dy1 ); + SDL_assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); + SDL_assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); + SDL_assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); + SDL_assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); #endif // We now have dx1,dy1 and dx2,dy2 and sx, sy all set validly within clip regions. @@ -432,20 +432,20 @@ void grx_bitmap_ex(int x,int y,int w,int h,int sx,int sy) // Make sure clipping algorithm works #ifndef NDEBUG - Assert( w > 0 ); - Assert( h > 0 ); - Assert( w == (dx2-dx1+1) ); - Assert( h == (dy2-dy1+1) ); - Assert( sx >= 0 ); - Assert( sy >= 0 ); - Assert( sx+w <= bw ); - Assert( sy+h <= bh ); - Assert( dx2 >= dx1 ); - Assert( dy2 >= dy1 ); - Assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); - Assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); - Assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); - Assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); + SDL_assert( w == (dx2-dx1+1) ); + SDL_assert( h == (dy2-dy1+1) ); + SDL_assert( sx >= 0 ); + SDL_assert( sy >= 0 ); + SDL_assert( sx+w <= bw ); + SDL_assert( sy+h <= bh ); + SDL_assert( dx2 >= dx1 ); + SDL_assert( dy2 >= dy1 ); + SDL_assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); + SDL_assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); + SDL_assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); + SDL_assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); #endif // We now have dx1,dy1 and dx2,dy2 and sx, sy all set validly within clip regions. diff --git a/src/graphics/colors.cpp b/src/graphics/colors.cpp index 9bb459f..735ec38 100644 --- a/src/graphics/colors.cpp +++ b/src/graphics/colors.cpp @@ -197,7 +197,7 @@ void calc_alphacolor_hud_type( alphacolor * ac ) int r, g, b, alpha; float falpha; - Assert(Alphacolors_intited); + SDL_assert(Alphacolors_intited); // mprintf(( "Calculating alphacolor for %d,%d,%d,%d\n", ac->r, ac->g, ac->b, ac->alpha )); @@ -302,7 +302,7 @@ void calc_alphacolor_blend_type( alphacolor * ac ) ubyte * pal; int r, g, b, alpha; - Assert(Alphacolors_intited); + SDL_assert(Alphacolors_intited); // mprintf(( "Calculating alphacolor for %d,%d,%d,%d\n", ac->r, ac->g, ac->b, ac->alpha )); @@ -488,9 +488,9 @@ void grx_set_color_fast( color * dst ) gr_screen.current_color = *dst; if ( dst->is_alphacolor ) { - Assert( dst->alphacolor > -1 ); - Assert( dst->alphacolor <= MAX_ALPHACOLORS ); - Assert( Alphacolors[dst->alphacolor].used ); + SDL_assert( dst->alphacolor > -1 ); + SDL_assert( dst->alphacolor <= MAX_ALPHACOLORS ); + SDL_assert( Alphacolors[dst->alphacolor].used ); // Current_alphacolor = &Alphacolors[dst->alphacolor]; Current_alphacolor = NULL; @@ -502,9 +502,9 @@ void grx_set_color_fast( color * dst ) void grx_set_color( int r, int g, int b ) { - Assert((r >= 0) && (r < 256)); - Assert((g >= 0) && (g < 256)); - Assert((b >= 0) && (b < 256)); + SDL_assert((r >= 0) && (r < 256)); + SDL_assert((g >= 0) && (g < 256)); + SDL_assert((b >= 0) && (b < 256)); // if ( r!=0 || g!=0 || b!=0 ) { // mprintf(( "Setcolor: %d,%d,%d\n", r,g,b )); @@ -521,7 +521,7 @@ void calc_alphacolor_hud_type_old( alphacolor_old * ac ) int r, g, b, alpha; float falpha; - // Assert(Alphacolors_intited); + // SDL_assert(Alphacolors_intited); // mprintf(( "Calculating alphacolor for %d,%d,%d,%d\n", ac->r, ac->g, ac->b, ac->alpha )); @@ -615,6 +615,6 @@ void calc_alphacolor_hud_type_old( alphacolor_old * ac ) void calc_alphacolor_old(alphacolor_old *ac) { - Assert(Fred_running); + SDL_assert(Fred_running); calc_alphacolor_hud_type_old(ac); } diff --git a/src/graphics/font.cpp b/src/graphics/font.cpp index 3af51d7..32b166e 100644 --- a/src/graphics/font.cpp +++ b/src/graphics/font.cpp @@ -281,14 +281,14 @@ char *gr_force_fit_string(char *str, int max_str, int max_width) gr_get_string_size(&w, NULL, str); if (w > max_width) { if ((int) strlen(str) > max_str - 3) { - Assert(max_str >= 3); + SDL_assert(max_str >= 3); str[max_str - 3] = 0; } strcpy(str + strlen(str) - 1, "..."); gr_get_string_size(&w, NULL, str); while (w > max_width) { - Assert(strlen(str) >= 4); // if this is hit, a bad max_width was passed in and the calling function needs fixing. + SDL_assert(strlen(str) >= 4); // if this is hit, a bad max_width was passed in and the calling function needs fixing. strcpy(str + strlen(str) - 4, "..."); gr_get_string_size(&w, NULL, str); } @@ -303,7 +303,7 @@ int get_char_width(ubyte c1,ubyte c2,int *width,int *spacing) { int i, letter; - Assert ( Current_font != NULL ); + SDL_assert ( Current_font != NULL ); letter = c1-Current_font->first_ascii; if (letter<0 || letter>=Current_font->num_chars) { //not in font, draw as space @@ -765,7 +765,7 @@ void gr_get_string_size_win(int *w, int *h, const char *text) char grx_printf_text[2048]; -void _cdecl gr_printf( int x, int y, const char * format, ... ) +void __cdecl gr_printf( int x, int y, const char * format, ... ) { va_list args; @@ -833,7 +833,7 @@ int gr_create_font(const char * typeface) n = -1; for (fontnum=0; fontnumid != 0 ) { - if ( !_strnicmp( fnt->filename, typeface, MAX_FILENAME_LEN ) ) { + if ( !SDL_strncasecmp( fnt->filename, typeface, MAX_FILENAME_LEN ) ) { return fontnum; } } else { @@ -882,14 +882,14 @@ int gr_create_font(const char * typeface) if ( fnt->kern_data_size ) { fnt->kern_data = (font_kernpair *)malloc( fnt->kern_data_size ); - Assert(fnt->kern_data!=NULL); + SDL_assert(fnt->kern_data!=NULL); cfread( fnt->kern_data, fnt->kern_data_size, 1, fp ); } else { fnt->kern_data = NULL; } if ( fnt->char_data_size ) { fnt->char_data = (font_char *)malloc( fnt->char_data_size ); - Assert( fnt->char_data != NULL ); + SDL_assert( fnt->char_data != NULL ); cfread( fnt->char_data, fnt->char_data_size, 1, fp ); for ( int i=0; inum_chars; i++){ fnt->char_data[i].spacing = INTEL_INT( fnt->char_data[i].spacing ); @@ -903,7 +903,7 @@ int gr_create_font(const char * typeface) } if ( fnt->pixel_data_size ) { fnt->pixel_data = (ubyte *)malloc( fnt->pixel_data_size ); - Assert(fnt->pixel_data!=NULL); + SDL_assert(fnt->pixel_data!=NULL); cfread( fnt->pixel_data, fnt->pixel_data_size, 1, fp ); } else { fnt->pixel_data = NULL; @@ -992,7 +992,7 @@ int gr_init_font(const char * typeface) Loaded_fontnum = gr_create_font(typeface); - Assert( Loaded_fontnum > -1 ); + SDL_assert( Loaded_fontnum > -1 ); gr_set_font( Loaded_fontnum ); diff --git a/src/graphics/grd3d.cpp b/src/graphics/grd3d.cpp index f0bbee9..1d88792 100644 --- a/src/graphics/grd3d.cpp +++ b/src/graphics/grd3d.cpp @@ -1688,7 +1688,7 @@ void gr_d3d_save_mouse_area(int x, int y, int w, int h ) if ( Gr_d3d_mouse_saved_h < 1 ) return; // Make sure we're not saving too much! - Assert( (Gr_d3d_mouse_saved_w*Gr_d3d_mouse_saved_h) <= MAX_SAVE_SIZE ); + SDL_assert( (Gr_d3d_mouse_saved_w*Gr_d3d_mouse_saved_h) <= MAX_SAVE_SIZE ); HRESULT ddrval; DDSURFACEDESC ddsd; @@ -2215,9 +2215,9 @@ void gr_d3d_fog_set(int fog_mode, int r, int g, int b, float fog_near, float fog { D3DCOLOR color = 0; - Assert((r >= 0) && (r < 256)); - Assert((g >= 0) && (g < 256)); - Assert((b >= 0) && (b < 256)); + SDL_assert((r >= 0) && (r < 256)); + SDL_assert((g >= 0) && (g < 256)); + SDL_assert((b >= 0) && (b < 256)); // turning fog off if(fog_mode == GR_FOGMODE_NONE){ @@ -2640,7 +2640,7 @@ void gr_d3d_init() D3D_enabled = 1; // Tell Freespace code that we're using Direct3D. D3D_running = 0; - Assert( !D3D_inited ); + SDL_assert( !D3D_inited ); // pixel format Bm_pixel_format = BM_PIXEL_FORMAT_D3D; diff --git a/src/graphics/grd3drender.cpp b/src/graphics/grd3drender.cpp index c3a5f40..3250bd1 100644 --- a/src/graphics/grd3drender.cpp +++ b/src/graphics/grd3drender.cpp @@ -1268,9 +1268,9 @@ void gr_d3d_init_alphacolor( color *clr, int r, int g, int b, int alpha, int typ void gr_d3d_set_color( int r, int g, int b ) { - Assert((r >= 0) && (r < 256)); - Assert((g >= 0) && (g < 256)); - Assert((b >= 0) && (b < 256)); + SDL_assert((r >= 0) && (r < 256)); + SDL_assert((g >= 0) && (g < 256)); + SDL_assert((b >= 0) && (b < 256)); gr_d3d_init_color( &gr_screen.current_color, r, g, b ); } @@ -1408,20 +1408,20 @@ void gr_d3d_bitmap_ex(int x,int y,int w,int h,int sx,int sy) // Make sure clipping algorithm works #ifndef NDEBUG - Assert( w > 0 ); - Assert( h > 0 ); - Assert( w == (dx2-dx1+1) ); - Assert( h == (dy2-dy1+1) ); - Assert( sx >= 0 ); - Assert( sy >= 0 ); - Assert( sx+w <= bw ); - Assert( sy+h <= bh ); - Assert( dx2 >= dx1 ); - Assert( dy2 >= dy1 ); - Assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); - Assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); - Assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); - Assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); + SDL_assert( w == (dx2-dx1+1) ); + SDL_assert( h == (dy2-dy1+1) ); + SDL_assert( sx >= 0 ); + SDL_assert( sy >= 0 ); + SDL_assert( sx+w <= bw ); + SDL_assert( sy+h <= bh ); + SDL_assert( dx2 >= dx1 ); + SDL_assert( dy2 >= dy1 ); + SDL_assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); + SDL_assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); + SDL_assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); + SDL_assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); #endif // We now have dx1,dy1 and dx2,dy2 and sx, sy all set validly within clip regions. @@ -1624,20 +1624,20 @@ void gr_d3d_aabitmap_ex(int x,int y,int w,int h,int sx,int sy) // Make sure clipping algorithm works #ifndef NDEBUG - Assert( w > 0 ); - Assert( h > 0 ); - Assert( w == (dx2-dx1+1) ); - Assert( h == (dy2-dy1+1) ); - Assert( sx >= 0 ); - Assert( sy >= 0 ); - Assert( sx+w <= bw ); - Assert( sy+h <= bh ); - Assert( dx2 >= dx1 ); - Assert( dy2 >= dy1 ); - Assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); - Assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); - Assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); - Assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); + SDL_assert( w == (dx2-dx1+1) ); + SDL_assert( h == (dy2-dy1+1) ); + SDL_assert( sx >= 0 ); + SDL_assert( sy >= 0 ); + SDL_assert( sx+w <= bw ); + SDL_assert( sy+h <= bh ); + SDL_assert( dx2 >= dx1 ); + SDL_assert( dy2 >= dy1 ); + SDL_assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); + SDL_assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); + SDL_assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); + SDL_assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); #endif // We now have dx1,dy1 and dx2,dy2 and sx, sy all set validly within clip regions. diff --git a/src/graphics/grd3dtexture.cpp b/src/graphics/grd3dtexture.cpp index 440dc08..585ec88 100644 --- a/src/graphics/grd3dtexture.cpp +++ b/src/graphics/grd3dtexture.cpp @@ -607,7 +607,7 @@ int d3d_create_texture_sub(int bitmap_type, int texture_handle, ushort *data, in return 0; } - Assert( surface_desc->dwRGBBitCount == 16 ); + SDL_assert( surface_desc->dwRGBBitCount == 16 ); // Each RGB bit count requires different pointers ushort *lpSP; @@ -901,7 +901,7 @@ int d3d_create_texture_sectioned(int bitmap_handle, int bitmap_type, tcache_slot int reload = 0; // setup texture/bitmap flags - Assert(bitmap_type == TCACHE_TYPE_BITMAP_SECTION); + SDL_assert(bitmap_type == TCACHE_TYPE_BITMAP_SECTION); if(bitmap_type != TCACHE_TYPE_BITMAP_SECTION){ bitmap_type = TCACHE_TYPE_BITMAP_SECTION; } @@ -988,7 +988,7 @@ int d3d_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scal // if this is a sectioned bitmap if(bitmap_type == TCACHE_TYPE_BITMAP_SECTION){ - Assert((sx >= 0) && (sy >= 0) && (sx < MAX_BMAP_SECTIONS_X) && (sy < MAX_BMAP_SECTIONS_Y)); + SDL_assert((sx >= 0) && (sy >= 0) && (sx < MAX_BMAP_SECTIONS_X) && (sy < MAX_BMAP_SECTIONS_Y)); if(!((sx >= 0) && (sy >= 0) && (sx < MAX_BMAP_SECTIONS_X) && (sy < MAX_BMAP_SECTIONS_Y))){ return 0; } @@ -1323,7 +1323,7 @@ void d3d_tcache_frame() // data sections if(Textures[i].data_sections[0][0] != NULL){ - Assert(D3D_texture_sections); + SDL_assert(D3D_texture_sections); if(D3D_texture_sections){ for(idx=0; idxSetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ); if ( ddrval != DD_OK ) { diff --git a/src/graphics/grglide.cpp b/src/graphics/grglide.cpp index 125cfbc..0f88827 100644 --- a/src/graphics/grglide.cpp +++ b/src/graphics/grglide.cpp @@ -596,7 +596,7 @@ void gr_glide_save_mouse_area(int x, int y, int w, int h ) if ( Gr_glide_mouse_saved_h < 1 ) return; // Make sure we're not saving too much! - Assert( (Gr_glide_mouse_saved_w*Gr_glide_mouse_saved_h) <= MAX_SAVE_SIZE ); + SDL_assert( (Gr_glide_mouse_saved_w*Gr_glide_mouse_saved_h) <= MAX_SAVE_SIZE ); GrLfbInfo_t info; @@ -951,20 +951,20 @@ void gr_glide_bitmap_ex(int x,int y,int w,int h,int sx,int sy) // Make sure clipping algorithm works #ifndef NDEBUG - Assert( w > 0 ); - Assert( h > 0 ); - Assert( w == (dx2-dx1+1) ); - Assert( h == (dy2-dy1+1) ); - Assert( sx >= 0 ); - Assert( sy >= 0 ); - Assert( sx+w <= bw ); - Assert( sy+h <= bh ); - Assert( dx2 >= dx1 ); - Assert( dy2 >= dy1 ); - Assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); - Assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); - Assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); - Assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); + SDL_assert( w == (dx2-dx1+1) ); + SDL_assert( h == (dy2-dy1+1) ); + SDL_assert( sx >= 0 ); + SDL_assert( sy >= 0 ); + SDL_assert( sx+w <= bw ); + SDL_assert( sy+h <= bh ); + SDL_assert( dx2 >= dx1 ); + SDL_assert( dy2 >= dy1 ); + SDL_assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); + SDL_assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); + SDL_assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); + SDL_assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); #endif // We now have dx1,dy1 and dx2,dy2 and sx, sy all set validly within clip regions. @@ -1974,20 +1974,20 @@ void gr_glide_aabitmap_ex(int x,int y,int w,int h,int sx,int sy) // Make sure clipping algorithm works #ifndef NDEBUG - Assert( w > 0 ); - Assert( h > 0 ); - Assert( w == (dx2-dx1+1) ); - Assert( h == (dy2-dy1+1) ); - Assert( sx >= 0 ); - Assert( sy >= 0 ); - Assert( sx+w <= bw ); - Assert( sy+h <= bh ); - Assert( dx2 >= dx1 ); - Assert( dy2 >= dy1 ); - Assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); - Assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); - Assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); - Assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); + SDL_assert( w == (dx2-dx1+1) ); + SDL_assert( h == (dy2-dy1+1) ); + SDL_assert( sx >= 0 ); + SDL_assert( sy >= 0 ); + SDL_assert( sx+w <= bw ); + SDL_assert( sy+h <= bh ); + SDL_assert( dx2 >= dx1 ); + SDL_assert( dy2 >= dy1 ); + SDL_assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); + SDL_assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); + SDL_assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); + SDL_assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); #endif // We now have dx1,dy1 and dx2,dy2 and sx, sy all set validly within clip regions. @@ -2196,9 +2196,9 @@ void gr_glide_init_alphacolor( color *clr, int r, int g, int b, int alpha, int t void gr_glide_set_color( int r, int g, int b ) { - Assert((r >= 0) && (r < 256)); - Assert((g >= 0) && (g < 256)); - Assert((b >= 0) && (b < 256)); + SDL_assert((r >= 0) && (r < 256)); + SDL_assert((g >= 0) && (g < 256)); + SDL_assert((b >= 0) && (b < 256)); gr_glide_init_color( &gr_screen.current_color, r, g, b ); } @@ -3200,9 +3200,9 @@ void gr_glide_fog_set(int fog_mode, int r, int g, int b, float fog_near, float f return; } - Assert((r >= 0) && (r < 256)); - Assert((g >= 0) && (g < 256)); - Assert((b >= 0) && (b < 256)); + SDL_assert((r >= 0) && (r < 256)); + SDL_assert((g >= 0) && (g < 256)); + SDL_assert((b >= 0) && (b < 256)); // store the values gr_glide_init_color( &gr_screen.current_fog_color, r, g, b ); diff --git a/src/graphics/grglidetexture.cpp b/src/graphics/grglidetexture.cpp index e96692f..4bc9496 100644 --- a/src/graphics/grglidetexture.cpp +++ b/src/graphics/grglidetexture.cpp @@ -247,7 +247,7 @@ void InitBlocks(uint min, uint max, int num_blocks) if(Tblocks == NULL){ Tblocks = (tblock *)malloc(Tblock_num_blocks*sizeof(tblock)); - Assert(Tblocks!=NULL); + SDL_assert(Tblocks!=NULL); } FlushBlocks(); @@ -651,8 +651,8 @@ int glide_create_texture_sub(int bitmap_type, int bitmap_handle, ushort *data, i // sanity - make sure we're not going to run off the end of the bitmap #ifndef NDEBUG - Assert(src_w <= (bmap_w - sx)); - Assert(src_h <= (bmap_h - sy)); + SDL_assert(src_w <= (bmap_w - sx)); + SDL_assert(src_h <= (bmap_h - sy)); #endif if ( tex_w <= 16 ) tex_w = 16; @@ -914,7 +914,7 @@ int glide_create_texture_sectioned(int bitmap_handle, int bitmap_type, tcache_sl int section_x, section_y; // setup texture/bitmap flags - Assert(bitmap_type == TCACHE_TYPE_BITMAP_SECTION); + SDL_assert(bitmap_type == TCACHE_TYPE_BITMAP_SECTION); if(bitmap_type != TCACHE_TYPE_BITMAP_SECTION){ bitmap_type = TCACHE_TYPE_BITMAP_SECTION; } diff --git a/src/graphics/gropengl.cpp b/src/graphics/gropengl.cpp index ab4dacd..b42e036 100644 --- a/src/graphics/gropengl.cpp +++ b/src/graphics/gropengl.cpp @@ -966,20 +966,20 @@ void gr_opengl_aabitmap_ex(int x,int y,int w,int h,int sx,int sy) // Make sure clipping algorithm works #ifndef NDEBUG - Assert( w > 0 ); - Assert( h > 0 ); - Assert( w == (dx2-dx1+1) ); - Assert( h == (dy2-dy1+1) ); - Assert( sx >= 0 ); - Assert( sy >= 0 ); - Assert( sx+w <= bw ); - Assert( sy+h <= bh ); - Assert( dx2 >= dx1 ); - Assert( dy2 >= dy1 ); - Assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); - Assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); - Assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); - Assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); + SDL_assert( w > 0 ); + SDL_assert( h > 0 ); + SDL_assert( w == (dx2-dx1+1) ); + SDL_assert( h == (dy2-dy1+1) ); + SDL_assert( sx >= 0 ); + SDL_assert( sy >= 0 ); + SDL_assert( sx+w <= bw ); + SDL_assert( sy+h <= bh ); + SDL_assert( dx2 >= dx1 ); + SDL_assert( dy2 >= dy1 ); + SDL_assert( (dx1 >= gr_screen.clip_left ) && (dx1 <= gr_screen.clip_right) ); + SDL_assert( (dx2 >= gr_screen.clip_left ) && (dx2 <= gr_screen.clip_right) ); + SDL_assert( (dy1 >= gr_screen.clip_top ) && (dy1 <= gr_screen.clip_bottom) ); + SDL_assert( (dy2 >= gr_screen.clip_top ) && (dy2 <= gr_screen.clip_bottom) ); #endif // We now have dx1,dy1 and dx2,dy2 and sx, sy all set validly within clip regions. @@ -1615,9 +1615,9 @@ void gr_opengl_init_alphacolor( color *clr, int r, int g, int b, int alpha, int void gr_opengl_set_color( int r, int g, int b ) { - Assert((r >= 0) && (r < 256)); - Assert((g >= 0) && (g < 256)); - Assert((b >= 0) && (b < 256)); + SDL_assert((r >= 0) && (r < 256)); + SDL_assert((g >= 0) && (g < 256)); + SDL_assert((b >= 0) && (b < 256)); gr_opengl_init_color( &gr_screen.current_color, r, g, b ); } @@ -1710,9 +1710,9 @@ void gr_opengl_cleanup() void gr_opengl_fog_set(int fog_mode, int r, int g, int b, float fog_near, float fog_far) { - Assert((r >= 0) && (r < 256)); - Assert((g >= 0) && (g < 256)); - Assert((b >= 0) && (b < 256)); + SDL_assert((r >= 0) && (r < 256)); + SDL_assert((g >= 0) && (g < 256)); + SDL_assert((b >= 0) && (b < 256)); if (fog_mode == GR_FOGMODE_NONE) { if (gr_screen.current_fog_mode != fog_mode) { @@ -2029,7 +2029,7 @@ static void opengl_tcache_frame () // data sections if(Textures[i].data_sections[0][0] != NULL){ - Assert(GL_texture_sections); + SDL_assert(GL_texture_sections); if(GL_texture_sections){ for(idx=0; idx= 0) && (sy >= 0) && (sx < MAX_BMAP_SECTIONS_X) && (sy < MAX_BMAP_SECTIONS_Y)); + SDL_assert((sx >= 0) && (sy >= 0) && (sx < MAX_BMAP_SECTIONS_X) && (sy < MAX_BMAP_SECTIONS_Y)); if(!((sx >= 0) && (sy >= 0) && (sx < MAX_BMAP_SECTIONS_X) && (sy < MAX_BMAP_SECTIONS_Y))){ return 0; } @@ -3076,7 +3076,7 @@ void gr_opengl_init() if ( SDL_GL_ExtensionSupported("GL_EXT_secondary_color") ) { glSecondaryColor3fEXT = (PFNGLSECONDARYCOLOR3FEXTPROC)SDL_GL_GetProcAddress("glSecondaryColor3fEXT"); - Assert( glSecondaryColor3fEXT != NULL ); + SDL_assert( glSecondaryColor3fEXT != NULL ); D3D_fog_mode = 1; mprintf((" Using extension: GL_EXT_secondary_color\n")); } diff --git a/src/graphics/grsoft.cpp b/src/graphics/grsoft.cpp index a8d9a0c..6e2041e 100644 --- a/src/graphics/grsoft.cpp +++ b/src/graphics/grsoft.cpp @@ -757,12 +757,12 @@ HPALETTE gr_create_palette_236( ubyte * target_palette ) NumSysColors = GetDeviceCaps( ScreenDC, NUMCOLORS ); NumColors = GetDeviceCaps( ScreenDC, SIZEPALETTE ); - Assert( NumColors <= 256 ); + SDL_assert( NumColors <= 256 ); UserLowest = NumSysColors/2; // 10 normally UserHighest = NumColors - NumSysColors/2 - 1; // 245 normally - Assert( (UserHighest - UserLowest + 1) >= 236 ); + SDL_assert( (UserHighest - UserLowest + 1) >= 236 ); GetSystemPaletteEntries(ScreenDC,0,NumSysColors/2,LogicalPalette.palPalEntry); GetSystemPaletteEntries(ScreenDC,UserHighest+1,NumSysColors/2,LogicalPalette.palPalEntry+1+UserHighest); @@ -818,12 +818,12 @@ HPALETTE gr_create_palette_254( ubyte * target_palette ) NumSysColors = 2; NumColors = GetDeviceCaps( ScreenDC, SIZEPALETTE ); - Assert( NumColors <= 256 ); + SDL_assert( NumColors <= 256 ); UserLowest = NumSysColors/2; // 10 normally UserHighest = NumColors - NumSysColors/2 - 1; // 245 normally - Assert( (UserHighest - UserLowest + 1) >= 236 ); + SDL_assert( (UserHighest - UserLowest + 1) >= 236 ); GetSystemPaletteEntries(ScreenDC,0,NumSysColors/2,LogicalPalette.palPalEntry); GetSystemPaletteEntries(ScreenDC,UserHighest+1,NumSysColors/2,LogicalPalette.palPalEntry+1+UserHighest); @@ -1031,7 +1031,7 @@ void grx_save_mouse_area(int x, int y, int w, int h ) if ( Grx_mouse_saved_h < 1 ) return; // Make sure we're not saving too much! - Assert( (Grx_mouse_saved_w*Grx_mouse_saved_h) <= MAX_SAVE_SIZE ); + SDL_assert( (Grx_mouse_saved_w*Grx_mouse_saved_h) <= MAX_SAVE_SIZE ); Grx_mouse_saved = 1; @@ -1601,7 +1601,7 @@ void gr_soft_init() // int i; // software mode only supports 640x480 - Assert(gr_screen.res == GR_640); + SDL_assert(gr_screen.res == GR_640); if(gr_screen.res != GR_640){ gr_screen.res = GR_640; gr_screen.max_w = 640; @@ -1658,7 +1658,7 @@ void gr_soft_init() gr_screen.offscreen_buffer_base = lpDibBits; gr_screen.rowsize = DibInfo.Header.biWidth*((gr_screen.bits_per_pixel+7)/8); - Assert( DibInfo.Header.biWidth == gr_screen.max_w ); + SDL_assert( DibInfo.Header.biWidth == gr_screen.max_w ); if (DibInfo.Header.biHeight > 0) { // top down diff --git a/src/graphics/scaler.cpp b/src/graphics/scaler.cpp index c485e6e..0ad4759 100644 --- a/src/graphics/scaler.cpp +++ b/src/graphics/scaler.cpp @@ -980,7 +980,7 @@ void gr8_aascaler(vertex *va, vertex *vb ) MONITOR_INC( ScalerNumCalls, 1 ); - Assert(Fred_running); + SDL_assert(Fred_running); if(!aiee){ old_alphac.used = 1; old_alphac.r = 93; diff --git a/src/graphics/tmapgenericscans.cpp b/src/graphics/tmapgenericscans.cpp index 5b5b0af..ba9049d 100644 --- a/src/graphics/tmapgenericscans.cpp +++ b/src/graphics/tmapgenericscans.cpp @@ -234,10 +234,10 @@ void tmapscan_pln8( int lx, int rx, int y, vertex *p, vertex *dp, vertex * rp,u Tmap1.fx_l = (67*F1_0)-Tmap1.fx_l; Tmap1.fx_l_right = (67*F1_0)-Tmap1.fx_l_right; // return; -// Assert( Tmap1.fx_l > 31*F1_0 ); -// Assert( Tmap1.fx_l < 66*F1_0 ); -// Assert( Tmap1.fx_dl_dx >= 0 ); -// Assert( Tmap1.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap1.fx_l > 31*F1_0 ); +// SDL_assert( Tmap1.fx_l < 66*F1_0 ); +// SDL_assert( Tmap1.fx_dl_dx >= 0 ); +// SDL_assert( Tmap1.fx_dl_dx < 31*F1_0 ); } // return; @@ -3429,10 +3429,10 @@ void asm_tmap_scanline_lln() Tmap1.fx_l = (67*F1_0)-Tmap1.fx_l; Tmap1.fx_l_right = (67*F1_0)-Tmap1.fx_l_right; // return; -// Assert( Tmap1.fx_l > 31*F1_0 ); -// Assert( Tmap1.fx_l < 66*F1_0 ); -// Assert( Tmap1.fx_dl_dx >= 0 ); -// Assert( Tmap1.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap1.fx_l > 31*F1_0 ); +// SDL_assert( Tmap1.fx_l < 66*F1_0 ); +// SDL_assert( Tmap1.fx_dl_dx >= 0 ); +// SDL_assert( Tmap1.fx_dl_dx < 31*F1_0 ); } @@ -4476,10 +4476,10 @@ void tmapscan_pln16( int lx, int rx, int y, vertex *p, vertex *dp, vertex * rp, Tmap1.fx_l = (67*F1_0)-Tmap1.fx_l; Tmap1.fx_l_right = (67*F1_0)-Tmap1.fx_l_right; // return; -// Assert( Tmap1.fx_l > 31*F1_0 ); -// Assert( Tmap1.fx_l < 66*F1_0 ); -// Assert( Tmap1.fx_dl_dx >= 0 ); -// Assert( Tmap1.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap1.fx_l > 31*F1_0 ); +// SDL_assert( Tmap1.fx_l < 66*F1_0 ); +// SDL_assert( Tmap1.fx_dl_dx >= 0 ); +// SDL_assert( Tmap1.fx_dl_dx < 31*F1_0 ); } // return; @@ -5983,10 +5983,10 @@ void tmapscan_pln32( int lx, int rx, int y, vertex *p, vertex *dp, vertex * rp, Tmap1.fx_l = (67*F1_0)-Tmap1.fx_l; Tmap1.fx_l_right = (67*F1_0)-Tmap1.fx_l_right; // return; -// Assert( Tmap1.fx_l > 31*F1_0 ); -// Assert( Tmap1.fx_l < 66*F1_0 ); -// Assert( Tmap1.fx_dl_dx >= 0 ); -// Assert( Tmap1.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap1.fx_l > 31*F1_0 ); +// SDL_assert( Tmap1.fx_l < 66*F1_0 ); +// SDL_assert( Tmap1.fx_dl_dx >= 0 ); +// SDL_assert( Tmap1.fx_dl_dx < 31*F1_0 ); } // return; diff --git a/src/graphics/tmapper.cpp b/src/graphics/tmapper.cpp index 7e44271..8e59270 100644 --- a/src/graphics/tmapper.cpp +++ b/src/graphics/tmapper.cpp @@ -611,7 +611,7 @@ void grx_tmapper( int nverts, vertex **verts, uint flags ) Tmap_npolys++; Tmap_nverts += nverts; - Assert(nverts <= TMAP_MAX_VERTS ); + SDL_assert(nverts <= TMAP_MAX_VERTS ); #endif @@ -629,7 +629,7 @@ void grx_tmapper( int nverts, vertex **verts, uint flags ) // tmap_scanline = tmap_scan_generic; #ifndef NDEBUG - Assert( tmap_scanline != NULL ); + SDL_assert( tmap_scanline != NULL ); if (Tmap_show_layers) tmap_scanline = tmapper_show_layers; @@ -851,10 +851,10 @@ void grx_tmapper( int nverts, vertex **verts, uint flags ) Tmap.fx_dl_dx = -Tmap.fx_dl_dx; Tmap.fx_l = (67*F1_0)-Tmap.fx_l; Tmap.fx_l_right = (67*F1_0)-Tmap.fx_l_right; - // Assert( Tmap.fx_l > 31*F1_0 ); - // Assert( Tmap.fx_l < 66*F1_0 ); - // Assert( Tmap.fx_dl_dx >= 0 ); - // Assert( Tmap.fx_dl_dx < 31*F1_0 ); + // SDL_assert( Tmap.fx_l > 31*F1_0 ); + // SDL_assert( Tmap.fx_l < 66*F1_0 ); + // SDL_assert( Tmap.fx_dl_dx >= 0 ); + // SDL_assert( Tmap.fx_dl_dx < 31*F1_0 ); } } } diff --git a/src/graphics/tmapscantiled16x16.cpp b/src/graphics/tmapscantiled16x16.cpp index 75a3e0c..5ac2737 100644 --- a/src/graphics/tmapscantiled16x16.cpp +++ b/src/graphics/tmapscantiled16x16.cpp @@ -91,10 +91,10 @@ void tmapscan_pln8_zbuffered_tiled_16x16() Tmap.fx_dl_dx = -Tmap.fx_dl_dx; Tmap.fx_l = (67*F1_0)-Tmap.fx_l; Tmap.fx_l_right = (67*F1_0)-Tmap.fx_l_right; -// Assert( Tmap.fx_l > 31*F1_0 ); -// Assert( Tmap.fx_l < 66*F1_0 ); -// Assert( Tmap.fx_dl_dx >= 0 ); -// Assert( Tmap.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap.fx_l > 31*F1_0 ); +// SDL_assert( Tmap.fx_l < 66*F1_0 ); +// SDL_assert( Tmap.fx_dl_dx >= 0 ); +// SDL_assert( Tmap.fx_dl_dx < 31*F1_0 ); } Tmap.fl_dudx_wide = Tmap.deltas.u*32.0f; @@ -104,10 +104,10 @@ void tmapscan_pln8_zbuffered_tiled_16x16() Tmap.fx_w = fl2i(Tmap.l.sw * GR_Z_RANGE)+gr_zoffset; Tmap.fx_dwdx = fl2i(Tmap.deltas.sw * GR_Z_RANGE); -// Assert(Tmap.fx_w < 65536 ); -// Assert(Tmap.fx_w >= 0 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); +// SDL_assert(Tmap.fx_w < 65536 ); +// SDL_assert(Tmap.fx_w >= 0 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); #ifdef PLAT_UNIX STUB_FUNCTION; @@ -734,10 +734,10 @@ void tmapscan_pln8_tiled_16x16() Tmap.fx_dl_dx = -Tmap.fx_dl_dx; Tmap.fx_l = (67*F1_0)-Tmap.fx_l; Tmap.fx_l_right = (67*F1_0)-Tmap.fx_l_right; -// Assert( Tmap.fx_l > 31*F1_0 ); -// Assert( Tmap.fx_l < 66*F1_0 ); -// Assert( Tmap.fx_dl_dx >= 0 ); -// Assert( Tmap.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap.fx_l > 31*F1_0 ); +// SDL_assert( Tmap.fx_l < 66*F1_0 ); +// SDL_assert( Tmap.fx_dl_dx >= 0 ); +// SDL_assert( Tmap.fx_dl_dx < 31*F1_0 ); } Tmap.fl_dudx_wide = Tmap.deltas.u*32.0f; @@ -747,10 +747,10 @@ void tmapscan_pln8_tiled_16x16() Tmap.fx_w = fl2i(Tmap.l.sw * GR_Z_RANGE)+gr_zoffset; Tmap.fx_dwdx = fl2i(Tmap.deltas.sw * GR_Z_RANGE); -// Assert(Tmap.fx_w < 65536 ); -// Assert(Tmap.fx_w >= 0 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); +// SDL_assert(Tmap.fx_w < 65536 ); +// SDL_assert(Tmap.fx_w >= 0 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); #ifdef PLAT_UNIX STUB_FUNCTION; diff --git a/src/graphics/tmapscantiled32x32.cpp b/src/graphics/tmapscantiled32x32.cpp index be84fdc..0d4ed16 100644 --- a/src/graphics/tmapscantiled32x32.cpp +++ b/src/graphics/tmapscantiled32x32.cpp @@ -91,10 +91,10 @@ void tmapscan_pln8_zbuffered_tiled_32x32() Tmap.fx_dl_dx = -Tmap.fx_dl_dx; Tmap.fx_l = (67*F1_0)-Tmap.fx_l; Tmap.fx_l_right = (67*F1_0)-Tmap.fx_l_right; -// Assert( Tmap.fx_l > 31*F1_0 ); -// Assert( Tmap.fx_l < 66*F1_0 ); -// Assert( Tmap.fx_dl_dx >= 0 ); -// Assert( Tmap.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap.fx_l > 31*F1_0 ); +// SDL_assert( Tmap.fx_l < 66*F1_0 ); +// SDL_assert( Tmap.fx_dl_dx >= 0 ); +// SDL_assert( Tmap.fx_dl_dx < 31*F1_0 ); } Tmap.fl_dudx_wide = Tmap.deltas.u*32.0f; @@ -104,10 +104,10 @@ void tmapscan_pln8_zbuffered_tiled_32x32() Tmap.fx_w = fl2i(Tmap.l.sw * GR_Z_RANGE)+gr_zoffset; Tmap.fx_dwdx = fl2i(Tmap.deltas.sw * GR_Z_RANGE); -// Assert(Tmap.fx_w < 65536 ); -// Assert(Tmap.fx_w >= 0 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); +// SDL_assert(Tmap.fx_w < 65536 ); +// SDL_assert(Tmap.fx_w >= 0 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); #ifdef PLAT_UNIX STUB_FUNCTION; @@ -734,10 +734,10 @@ void tmapscan_pln8_tiled_32x32() Tmap.fx_dl_dx = -Tmap.fx_dl_dx; Tmap.fx_l = (67*F1_0)-Tmap.fx_l; Tmap.fx_l_right = (67*F1_0)-Tmap.fx_l_right; -// Assert( Tmap.fx_l > 31*F1_0 ); -// Assert( Tmap.fx_l < 66*F1_0 ); -// Assert( Tmap.fx_dl_dx >= 0 ); -// Assert( Tmap.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap.fx_l > 31*F1_0 ); +// SDL_assert( Tmap.fx_l < 66*F1_0 ); +// SDL_assert( Tmap.fx_dl_dx >= 0 ); +// SDL_assert( Tmap.fx_dl_dx < 31*F1_0 ); } Tmap.fl_dudx_wide = Tmap.deltas.u*32.0f; @@ -747,10 +747,10 @@ void tmapscan_pln8_tiled_32x32() Tmap.fx_w = fl2i(Tmap.l.sw * GR_Z_RANGE)+gr_zoffset; Tmap.fx_dwdx = fl2i(Tmap.deltas.sw * GR_Z_RANGE); -// Assert(Tmap.fx_w < 65536 ); -// Assert(Tmap.fx_w >= 0 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); +// SDL_assert(Tmap.fx_w < 65536 ); +// SDL_assert(Tmap.fx_w >= 0 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); #ifdef PLAT_UNIX STUB_FUNCTION; diff --git a/src/graphics/tmapscantiled64x64.cpp b/src/graphics/tmapscantiled64x64.cpp index e4fdaff..cbc8ad1 100644 --- a/src/graphics/tmapscantiled64x64.cpp +++ b/src/graphics/tmapscantiled64x64.cpp @@ -95,10 +95,10 @@ void tmapscan_pln8_zbuffered_tiled_64x64() Tmap.fx_dl_dx = -Tmap.fx_dl_dx; Tmap.fx_l = (67*F1_0)-Tmap.fx_l; Tmap.fx_l_right = (67*F1_0)-Tmap.fx_l_right; -// Assert( Tmap.fx_l > 31*F1_0 ); -// Assert( Tmap.fx_l < 66*F1_0 ); -// Assert( Tmap.fx_dl_dx >= 0 ); -// Assert( Tmap.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap.fx_l > 31*F1_0 ); +// SDL_assert( Tmap.fx_l < 66*F1_0 ); +// SDL_assert( Tmap.fx_dl_dx >= 0 ); +// SDL_assert( Tmap.fx_dl_dx < 31*F1_0 ); } Tmap.fl_dudx_wide = Tmap.deltas.u*32.0f; @@ -108,10 +108,10 @@ void tmapscan_pln8_zbuffered_tiled_64x64() Tmap.fx_w = fl2i(Tmap.l.sw * GR_Z_RANGE)+gr_zoffset; Tmap.fx_dwdx = fl2i(Tmap.deltas.sw * GR_Z_RANGE); -// Assert(Tmap.fx_w < 65536 ); -// Assert(Tmap.fx_w >= 0 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); +// SDL_assert(Tmap.fx_w < 65536 ); +// SDL_assert(Tmap.fx_w >= 0 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); #ifdef PLAT_UNIX STUB_FUNCTION; @@ -736,10 +736,10 @@ void tmapscan_pln8_tiled_64x64() Tmap.fx_dl_dx = -Tmap.fx_dl_dx; Tmap.fx_l = (67*F1_0)-Tmap.fx_l; Tmap.fx_l_right = (67*F1_0)-Tmap.fx_l_right; -// Assert( Tmap.fx_l > 31*F1_0 ); -// Assert( Tmap.fx_l < 66*F1_0 ); -// Assert( Tmap.fx_dl_dx >= 0 ); -// Assert( Tmap.fx_dl_dx < 31*F1_0 ); +// SDL_assert( Tmap.fx_l > 31*F1_0 ); +// SDL_assert( Tmap.fx_l < 66*F1_0 ); +// SDL_assert( Tmap.fx_dl_dx >= 0 ); +// SDL_assert( Tmap.fx_dl_dx < 31*F1_0 ); } Tmap.fl_dudx_wide = Tmap.deltas.u*32.0f; @@ -749,10 +749,10 @@ void tmapscan_pln8_tiled_64x64() Tmap.fx_w = fl2i(Tmap.l.sw * GR_Z_RANGE)+gr_zoffset; Tmap.fx_dwdx = fl2i(Tmap.deltas.sw * GR_Z_RANGE); -// Assert(Tmap.fx_w < 65536 ); -// Assert(Tmap.fx_w >= 0 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); -// Assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); +// SDL_assert(Tmap.fx_w < 65536 ); +// SDL_assert(Tmap.fx_w >= 0 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count < 65536 ); +// SDL_assert(Tmap.fx_w+Tmap.fx_dwdx*Tmap.loop_count >= 0 ); #ifdef PLAT_UNIX STUB_FUNCTION; diff --git a/src/hud/hud.cpp b/src/hud/hud.cpp index 8189c06..ebeb58b 100644 --- a/src/hud/hud.cpp +++ b/src/hud/hud.cpp @@ -1078,7 +1078,7 @@ void hud_update_frame() } if (retarget_turret && can_target) { - Assert(!retarget); + SDL_assert(!retarget); // get closest weighted live turret // hud_target_closest(OBJ_INDEX(Player_obj), FALSE, FALSE); void hud_update_closest_turret(); @@ -1108,7 +1108,7 @@ void hud_update_frame() ship *target_shipp = NULL; if ( targetp->type == OBJ_SHIP ) { - Assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS ); + SDL_assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS ); target_shipp = &Ships[targetp->instance]; Player->target_is_dying = target_shipp->flags & SF_DYING; @@ -1140,7 +1140,7 @@ void hud_update_frame() // Switch to battle track when a targeted ship is hostile and within BATTLE_START_MIN_TARGET_DIST if (targetp->type == OBJ_SHIP && Event_Music_battle_started == 0 ) { - Assert( target_shipp != NULL ); + SDL_assert( target_shipp != NULL ); if (opposing_team_mask(Player_ship->team)) { float dist_to_target; @@ -1150,7 +1150,7 @@ void hud_update_frame() // If the target has an AI class of none, it is a Cargo, NavBuoy or other non-aggressive // ship, so don't start the battle music - if (stricmp(Ai_class_names[Ai_info[target_shipp->ai_index].ai_class], NOX("none"))) + if (SDL_strcasecmp(Ai_class_names[Ai_info[target_shipp->ai_index].ai_class], NOX("none"))) event_music_battle_start(); } } @@ -1270,7 +1270,7 @@ void HUD_render_3d(float frametime) } else if ( Viewer_mode & (VM_CHASE | VM_EXTERNAL | VM_WARP_CHASE | VM_PADLOCK_ANY ) ) { // If the player is warping out, don't draw the targeting gauges - Assert(Player != NULL); + SDL_assert(Player != NULL); if ( Player->control_mode != PCM_NORMAL ) { return; } @@ -1878,8 +1878,8 @@ void hud_show_damage_popup() } } - Assert(best_index >= 0); - Assert(best_str >= 0); + SDL_assert(best_index >= 0); + SDL_assert(best_str >= 0); // display strongest subsystem left in list // draw the bitmap @@ -1979,7 +1979,7 @@ int hud_anim_load(hud_anim *ha) Int3(); // couldn't load animation file in return -1; } - Assert(fps != 0); + SDL_assert(fps != 0); ha->total_time = i2fl(ha->num_frames)/fps; return 0; } @@ -2365,7 +2365,7 @@ int hud_support_find_closest( int objnum ) // make sure support ship is not dying if ( !(Ships[Objects[sop->objnum].instance].flags & (SF_DYING|SF_EXPLODED)) ) { - Assert( objp->type == OBJ_SHIP ); + SDL_assert( objp->type == OBJ_SHIP ); aip = &Ai_info[Ships[Objects[sop->objnum].instance].ai_index]; pship_index = objp->instance; @@ -2375,7 +2375,7 @@ int hud_support_find_closest( int objnum ) // we can use == in the next statement (and should) since a ship will only ever be // following one order at a time. if ( aip->goals[i].ai_mode == AI_GOAL_REARM_REPAIR ) { - Assert( aip->goals[i].ship_name ); + SDL_assert( aip->goals[i].ship_name ); sindex = ship_name_lookup( aip->goals[i].ship_name ); if ( sindex == pship_index ) return sop->objnum; @@ -2445,7 +2445,7 @@ void hud_support_view_blit() show_time = 0; if ( Player_ai->ai_flags & AIF_BEING_REPAIRED ) { - Assert(Ship_info[Player_ship->ship_info_index].initial_hull_strength > 0); + SDL_assert(Ship_info[Player_ship->ship_info_index].initial_hull_strength > 0); if ( (ship_get_subsystem_strength(Player_ship, SUBSYSTEM_ENGINE) < 1.0 ) || (ship_get_subsystem_strength(Player_ship, SUBSYSTEM_SENSORS) < 1.0 ) || (ship_get_subsystem_strength(Player_ship, SUBSYSTEM_WEAPONS) < 1.0 ) || @@ -2487,7 +2487,7 @@ void hud_support_view_blit() if ( show_time ) { int seconds, minutes; - Assert( Hud_support_objnum != -1 ); + SDL_assert( Hud_support_objnum != -1 ); // ensure support ship is still alive if ( (Objects[Hud_support_objnum].signature != Hud_support_obj_sig) || (Hud_support_target_sig != Player_obj->signature) ) { @@ -2515,7 +2515,7 @@ void hud_support_view_blit() // Set the current color to the default HUD color (with default alpha) void hud_set_default_color() { - Assert(HUD_color_alpha >= 0 && HUD_color_alpha < HUD_NUM_COLOR_LEVELS); + SDL_assert(HUD_color_alpha >= 0 && HUD_color_alpha < HUD_NUM_COLOR_LEVELS); gr_set_color_fast(&HUD_color_defaults[HUD_color_alpha]); } @@ -2609,7 +2609,7 @@ static int Vm_other_ship_gauges[NUM_VM_OTHER_SHIP_GAUGES] = // determine if the specified HUD gauge should be displayed int hud_gauge_active(int gauge_index) { - Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); + SDL_assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); // AL: Special code: Only show two gauges when not viewing from own ship if ( Viewer_mode & VM_OTHER_SHIP ) { @@ -2627,14 +2627,14 @@ int hud_gauge_active(int gauge_index) // determine if gauge is in pop-up mode or not int hud_gauge_is_popup(int gauge_index) { - Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); + SDL_assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); return hud_config_popup_flag_is_set(gauge_index); } // determine if a popup gauge should be drawn int hud_gauge_popup_active(int gauge_index) { - Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); + SDL_assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); if ( !hud_gauge_is_popup(gauge_index) ) { return 0; } @@ -2649,7 +2649,7 @@ int hud_gauge_popup_active(int gauge_index) // start a gauge to popup void hud_gauge_popup_start(int gauge_index, int time) { - Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); + SDL_assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); if ( !hud_gauge_is_popup(gauge_index) ) { return; } @@ -2661,7 +2661,7 @@ void hud_gauge_popup_start(int gauge_index, int time) // call HUD function to flash gauge void hud_gauge_start_flash(int gauge_index) { - Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); + SDL_assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); HUD_gauge_flash_duration[gauge_index] = timestamp(HUD_GAUGE_FLASH_DURATION); HUD_gauge_flash_next[gauge_index] = 1; } @@ -2694,7 +2694,7 @@ void hud_set_gauge_color(int gauge_index, int bright_index) // intensity default: - Assert((bright_index >= 0) && (bright_index < HUD_NUM_COLOR_LEVELS)); + SDL_assert((bright_index >= 0) && (bright_index < HUD_NUM_COLOR_LEVELS)); if(bright_index < 0){ bright_index = 0; } @@ -2741,7 +2741,7 @@ void hud_set_gauge_color(int gauge_index, int bright_index) // 1 => gauge is flashing, draw bright int hud_gauge_maybe_flash(int gauge_index) { - Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); + SDL_assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES); int flash_status=-1; if ( !timestamp_elapsed(HUD_gauge_flash_duration[gauge_index]) ) { if ( timestamp_elapsed(HUD_gauge_flash_next[gauge_index]) ) { @@ -2966,7 +2966,7 @@ int hud_wing_slot_from_name(const char *name) num[1]=0; rval = num[0] - '1'; - Assert(rval >= 0 && rval < 4); + SDL_assert(rval >= 0 && rval < 4); return rval; } diff --git a/src/hud/hudartillery.cpp b/src/hud/hudartillery.cpp index 27bb150..55bf96e 100644 --- a/src/hud/hudartillery.cpp +++ b/src/hud/hudartillery.cpp @@ -187,11 +187,11 @@ void ssm_create(vector *target, vector *start, int ssm_index, ssm_firing_info *o } // sanity - Assert(target != NULL); + SDL_assert(target != NULL); if(target == NULL){ return; } - Assert(start != NULL); + SDL_assert(start != NULL); if(start == NULL){ return; } @@ -201,7 +201,7 @@ void ssm_create(vector *target, vector *start, int ssm_index, ssm_firing_info *o // Find next available trail ssm = GET_FIRST(&Ssm_free_list); - Assert( ssm != &Ssm_free_list ); // shouldn't have the dummy element + SDL_assert( ssm != &Ssm_free_list ); // shouldn't have the dummy element // remove trailp from the free list list_remove( &Ssm_free_list, ssm ); diff --git a/src/hud/hudbrackets.cpp b/src/hud/hudbrackets.cpp index 919da16..0ca9ddf 100644 --- a/src/hud/hudbrackets.cpp +++ b/src/hud/hudbrackets.cpp @@ -302,9 +302,9 @@ void draw_brackets_square(int x1, int y1, int x2, int y2) int width, height; width = x2 - x1; - Assert( width > 0); + SDL_assert( width > 0); height = y2 - y1; - Assert( height > 0); + SDL_assert( height > 0); // make the brackets extend 25% of the way along the width or height int bracket_width = width/4; @@ -538,7 +538,7 @@ void draw_brackets_diamond_quick(int x1, int y1, int x2, int y2, int thick) int subsys_is_fighterbay(ship_subsys *ss) { - if ( !strnicmp(NOX("fighter"), ss->system_info->name, 7) ) { + if ( !SDL_strncasecmp(NOX("fighter"), ss->system_info->name, 7) ) { return 1; } @@ -559,9 +559,9 @@ void draw_bounding_brackets_subobject() subsys = Player_ai->targeted_subsys; target_objnum = Player_ai->target_objnum; - Assert(target_objnum != -1); + SDL_assert(target_objnum != -1); targetp = &Objects[target_objnum]; - Assert( targetp->type == OBJ_SHIP ); + SDL_assert( targetp->type == OBJ_SHIP ); get_subsystem_world_pos(targetp, subsys, &subobj_pos); @@ -673,7 +673,7 @@ int hud_bracket_num_ships_attacking(int objnum) // don't count instructor int is_training_mission(); - if ( is_training_mission() && stricmp(Ships[objp->instance].ship_name, "Instructor") == 0) { + if ( is_training_mission() && SDL_strcasecmp(Ships[objp->instance].ship_name, "Instructor") == 0) { break; } @@ -702,10 +702,10 @@ void draw_bounding_brackets(int x1, int y1, int x2, int y2, int w_correction, in return; width = x2-x1; - Assert(width>=0); + SDL_assert(width>=0); height = y2-y1; - Assert(height>=0); + SDL_assert(height>=0); if ( (width>(gr_screen.max_w - 1)) && (height>(gr_screen.max_h - 1)) ) { return; diff --git a/src/hud/hudconfig.cpp b/src/hud/hudconfig.cpp index 91f49b9..5c19886 100644 --- a/src/hud/hudconfig.cpp +++ b/src/hud/hudconfig.cpp @@ -1026,7 +1026,7 @@ void hud_config_init_ui() for (i=0; ifilename, NOX("none")) ) { + if ( !SDL_strcasecmp(hg->filename, NOX("none")) ) { continue; } hg->button.create(&HC_ui_window, "", hg->x, hg->y, 60, 30, 0, 1); @@ -1219,7 +1219,7 @@ void hud_config_render_gauges() } if ( HC_gauge_regions[gr_screen.res][i].bitmap >= 0 ) { - Assert(offset < HC_gauge_regions[gr_screen.res][i].nframes); + SDL_assert(offset < HC_gauge_regions[gr_screen.res][i].nframes); gr_set_bitmap(HC_gauge_regions[gr_screen.res][i].bitmap+offset, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); gr_bitmap(HC_gauge_regions[gr_screen.res][i].x, HC_gauge_regions[gr_screen.res][i].y); } @@ -1257,7 +1257,7 @@ void hud_config_render_gauges() } if ( HC_gauge_regions[i].bitmap >= 0 ) { - Assert(offset < HC_gauge_regions[i].nframes); + SDL_assert(offset < HC_gauge_regions[i].nframes); gr_set_bitmap(HC_gauge_regions[i].bitmap+offset); gr_bitmap(HC_gauge_regions[i].x, HC_gauge_regions[i].y); } @@ -1586,7 +1586,7 @@ void hud_config_button_do(int n) if(strlen(name) > 0){ // if the filename in there already exists for(idx=0; idx= HUD_COLOR_ALPHA_USER_MIN); - Assert(HUD_color_alpha <= HUD_COLOR_ALPHA_USER_MAX); + SDL_assert(HUD_color_alpha >= HUD_COLOR_ALPHA_USER_MIN); + SDL_assert(HUD_color_alpha <= HUD_COLOR_ALPHA_USER_MAX); #endif } diff --git a/src/hud/hudescort.cpp b/src/hud/hudescort.cpp index 9073f68..782a9f1 100644 --- a/src/hud/hudescort.cpp +++ b/src/hud/hudescort.cpp @@ -297,7 +297,7 @@ int escort_compare_func(const void *e1, const void *e2) name1 = Ships[Objects[escort1->objnum].instance].ship_name; name2 = Ships[Objects[escort2->objnum].instance].ship_name; - ret = stricmp(name1, name2); + ret = SDL_strcasecmp(name1, name2); } } @@ -340,12 +340,12 @@ void hud_create_complete_escort_list(escort_info *escorts, int *num_escorts) // all others else { for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { - Assert( so->objnum >= 0 && so->objnum < MAX_OBJECTS); + SDL_assert( so->objnum >= 0 && so->objnum < MAX_OBJECTS); if((so->objnum < 0) || (so->objnum >= MAX_OBJECTS)){ continue; } objp = &Objects[so->objnum]; - Assert( objp->type == OBJ_SHIP ); + SDL_assert( objp->type == OBJ_SHIP ); if(objp->type != OBJ_SHIP){ continue; } @@ -467,7 +467,7 @@ void merge_escort_lists(escort_info *complete_escorts, int num_complete_escorts) Escort_ships[i] = complete_escorts[i]; // check all ships are valid int objnum = Escort_ships[i].objnum; - Assert( objnum >=0 && objnum < MAX_OBJECTS ); + SDL_assert( objnum >=0 && objnum < MAX_OBJECTS ); if((objnum < 0) || (objnum >= MAX_OBJECTS)){ continue; } @@ -508,7 +508,7 @@ void hud_remove_ship_from_escort_index(int dead_index, int objnum) } Num_escort_ships--; - Assert(Num_escort_ships >= 0); + SDL_assert(Num_escort_ships >= 0); // get complete escort list hud_create_complete_escort_list(complete_escorts, &num_complete_escorts); @@ -544,7 +544,7 @@ void hud_escort_cull_list() else { for ( i = 0; i < Num_escort_ships; i++ ) { objnum = Escort_ships[i].objnum; - Assert( objnum >=0 && objnum < MAX_OBJECTS ); + SDL_assert( objnum >=0 && objnum < MAX_OBJECTS ); if ( Objects[objnum].flags & OF_SHOULD_BE_DEAD || Ships[Objects[objnum].instance].flags & SF_HIDDEN_FROM_SENSORS ) { hud_remove_ship_from_escort_index(i, objnum); i--; @@ -610,7 +610,7 @@ void hud_escort_show_icon(int index, object *objp) shield_hit_info *shi; // multiplayer dogfight code should never get into here - Assert(!((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT))); + SDL_assert(!((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT))); if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)){ return; } @@ -985,7 +985,7 @@ void hudescort_page_in() void hud_escort_add_player(short id) { - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); if(!(Game_mode & GM_MULTIPLAYER)){ return; } @@ -1005,7 +1005,7 @@ void hud_escort_add_player(short id) void hud_escort_remove_player(short id) { - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); if(!(Game_mode & GM_MULTIPLAYER)){ return; } diff --git a/src/hud/hudets.cpp b/src/hud/hudets.cpp index a50f678..a063903 100644 --- a/src/hud/hudets.cpp +++ b/src/hud/hudets.cpp @@ -283,7 +283,7 @@ void ets_init_ship(object* obj) return; } - Assert(obj->type == OBJ_SHIP); + SDL_assert(obj->type == OBJ_SHIP); sp = &Ships[obj->instance]; sp->weapon_energy = Ship_info[sp->ship_info_index].max_weapon_reserve; @@ -515,7 +515,7 @@ void hud_show_ets() if ( j == 1 && Player_obj->flags & OF_NO_SHIELDS ) { continue; } - Assert(Ets_gauge_info != NULL); + SDL_assert(Ets_gauge_info != NULL); gr_printf(Ets_gauge_info[i].letter_coords[0], Ets_gauge_info[i].letter_coords[1], NOX("%c"), Ets_gauge_info[j].letter); i++; } @@ -550,14 +550,14 @@ void hud_show_ets() // draw the top portion - Assert(Ets_gauge_info != NULL); + SDL_assert(Ets_gauge_info != NULL); x = Ets_gauge_info[i].top_coords[0]; y = Ets_gauge_info[i].top_coords[1]; GR_AABITMAP_EX(Ets_gauge.first_frame,x,y,w,clip_h,0,0); // draw the bottom portion - Assert(Ets_gauge_info != NULL); + SDL_assert(Ets_gauge_info != NULL); x = Ets_gauge_info[i].bottom_coords[0]; y = Ets_gauge_info[i].bottom_coords[1]; @@ -578,7 +578,7 @@ void hud_show_ets() // some portion of recharge needs to be drawn // draw the top portion - Assert(Ets_gauge_info != NULL); + SDL_assert(Ets_gauge_info != NULL); x = Ets_gauge_info[i].top_coords[0]; y = Ets_gauge_info[i].top_coords[1]; @@ -588,7 +588,7 @@ void hud_show_ets() GR_AABITMAP_EX(Ets_gauge.first_frame+1, x, y_start, w, y_end-y_start, 0, clip_h); // draw the bottom portion - Assert(Ets_gauge_info != NULL); + SDL_assert(Ets_gauge_info != NULL); x = Ets_gauge_info[i].bottom_coords[0]; y = Ets_gauge_info[i].bottom_coords[1]; diff --git a/src/hud/hudlock.cpp b/src/hud/hudlock.cpp index 559e8d3..c7d5d5b 100644 --- a/src/hud/hudlock.cpp +++ b/src/hud/hudlock.cpp @@ -413,8 +413,8 @@ void hud_init_missile_lock() void hud_draw_diamond(int x, int y, int width, int height) { - Assert(height>0); - Assert(width>0); + SDL_assert(height>0); + SDL_assert(width>0); int x1,x2,x3,x4,y1,y2,y3,y4; @@ -448,7 +448,7 @@ void hud_show_lock_indicator(float frametime) } target_objnum = Player_ai->target_objnum; - Assert(target_objnum != -1); + SDL_assert(target_objnum != -1); targetp = &Objects[target_objnum]; // check to see if there are any missile to fire.. we don't want to show the @@ -578,7 +578,7 @@ int hud_lock_target_in_range() vm_vec_unrotate(&target_world_pos, &Player->locking_subsys->system_info->pnt, &targetp->orient); vm_vec_add2(&target_world_pos, &targetp->pos); } else { - Assert(Player->locking_on_center); + SDL_assert(Player->locking_on_center); target_world_pos = targetp->pos; } } @@ -625,7 +625,7 @@ int hud_lock_on_subsys_ok() object *target_objp; int in_sight=0; - Assert(Player_ai->target_objnum >= 0); + SDL_assert(Player_ai->target_objnum >= 0); target_objp = &Objects[Player_ai->target_objnum]; subsys = Player_ai->targeted_subsys; @@ -712,7 +712,7 @@ void hud_update_lock_indicator(float frametime) return; } - Assert(Player_ai->target_objnum != -1); + SDL_assert(Player_ai->target_objnum != -1); // be sure to unset this flag, then possibly set later in this function so that // threat indicators work properly. @@ -1172,7 +1172,7 @@ void hud_lock_update_lock_pos(object *target_objp, vector *lock_world_pos) if ( Player->locking_on_center ) { *lock_world_pos = target_objp->pos; } else { - Assert(Player->locking_subsys); + SDL_assert(Player->locking_subsys); get_subsystem_world_pos(target_objp, Player->locking_subsys, lock_world_pos); } } @@ -1245,7 +1245,7 @@ void hud_lock_determine_lock_point(vector *lock_world_pos_out) vertex lock_point; object *target_objp; - Assert(Player_ai->target_objnum >= 0); + SDL_assert(Player_ai->target_objnum >= 0); target_objp = &Objects[Player_ai->target_objnum]; Player->current_target_sx = -1; diff --git a/src/hud/hudmessage.cpp b/src/hud/hudmessage.cpp index 856e599..e3f5940 100644 --- a/src/hud/hudmessage.cpp +++ b/src/hud/hudmessage.cpp @@ -852,7 +852,7 @@ void HUD_fixed_printf(float duration, const char * format, ...) va_end(args); msg_length = strlen(tmp); - Assert(msg_length < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. + SDL_assert(msg_length < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. if ( !msg_length ) { nprintf(("Warning", "HUD_fixed_printf ==> attempt to print a 0 length string in msg window\n")); @@ -887,7 +887,7 @@ void HUD_fixed_printf_reset() // void HUD_printf_line(const char *text, int source, int time = 0, int x = 0) { - Assert(text != NULL); + SDL_assert(text != NULL); // if the pointer exceeds the array size, wrap around to element 1. element 0 is not used. Hud_list_end++; @@ -954,7 +954,7 @@ void HUD_printf(const char *format, ...) va_end(args); len = strlen(tmp); - Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. + SDL_assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. hud_sourced_print(HUD_SOURCE_COMPUTER, tmp); } @@ -966,14 +966,14 @@ void HUD_ship_sent_printf(int sh, const char *format, ...) sprintf(tmp, NOX("%s: "), Ships[sh].ship_name); len = strlen(tmp); - Assert(len < HUD_MSG_LENGTH_MAX); + SDL_assert(len < HUD_MSG_LENGTH_MAX); va_start(args, format); vsprintf(tmp + len, format, args); va_end(args); len = strlen(tmp); - Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. + SDL_assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. hud_sourced_print(HUD_get_team_source(Ships[sh].team), tmp); } @@ -998,7 +998,7 @@ void HUD_sourced_printf(int source, const char *format, ...) va_start(args, format); vsprintf(tmp, format, args); va_end(args); - Assert(strlen(tmp) < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. + SDL_assert(strlen(tmp) < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway. hud_sourced_print(source, tmp); } @@ -1078,7 +1078,7 @@ void hud_add_line_to_scrollback(const char *text, int source, int t, int x, int { line_node *new_line; - Assert(HUD_msg_inited); + SDL_assert(HUD_msg_inited); if (!text || !strlen(text)) return; @@ -1113,7 +1113,7 @@ void hud_add_msg_to_scrollback(const char *text, int source, int t) return; w = 0; - Assert(msg_len < HUD_MSG_LENGTH_MAX); + SDL_assert(msg_len < HUD_MSG_LENGTH_MAX); strcpy(buf, text); ptr = strstr(buf, NOX(": ")); if (ptr) { diff --git a/src/hud/hudobserver.cpp b/src/hud/hudobserver.cpp index 88c7080..2ec29e9 100644 --- a/src/hud/hudobserver.cpp +++ b/src/hud/hudobserver.cpp @@ -74,7 +74,7 @@ void hud_obs_render_players_all() void hud_render_observer() { - Assert((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_OBSERVER)); + SDL_assert((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_OBSERVER)); // render individual player text hud_obs_render_players_all(); diff --git a/src/hud/hudreticle.cpp b/src/hud/hudreticle.cpp index 22d52d2..4672893 100644 --- a/src/hud/hudreticle.cpp +++ b/src/hud/hudreticle.cpp @@ -598,7 +598,7 @@ void hud_show_throttle() desired_y_pos = Hud_throttle_bottom_y[gr_screen.res] - fl2i(Hud_throttle_h[gr_screen.res]*desired_speed/max_speed+0.5f) - 1; - Assert(max_speed != 0); + SDL_assert(max_speed != 0); percent_max = current_speed / max_speed; percent_aburn_max = 0.0f; @@ -806,7 +806,7 @@ void hud_show_dumbfire_threat() // Draw the center of the reticle void hud_show_center_reticle() { - Assert(Reticle_gauges[RETICLE_CENTER].first_frame != -1 ); + SDL_assert(Reticle_gauges[RETICLE_CENTER].first_frame != -1 ); // hud_set_default_color(); // hud_set_bright_color(); diff --git a/src/hud/hudshield.cpp b/src/hud/hudshield.cpp index 0f7e1b4..6018b42 100644 --- a/src/hud/hudshield.cpp +++ b/src/hud/hudshield.cpp @@ -311,7 +311,7 @@ void hud_shield_game_init() stuff_string(name, F_NAME, NULL); // maybe store - Assert(Hud_shield_filename_count < MAX_SHIELD_ICONS); + SDL_assert(Hud_shield_filename_count < MAX_SHIELD_ICONS); if(Hud_shield_filename_count < MAX_SHIELD_ICONS){ strcpy(Hud_shield_filenames[Hud_shield_filename_count++], name); } @@ -325,13 +325,13 @@ void hud_shield_game_init() // for fighters for (i = 1; i < 14; i++) { snprintf(Hud_shield_filenames[Hud_shield_filename_count++], MAX_FILENAME_LEN, "shield-f%02d", i); - Assert(Hud_shield_filename_count < MAX_SHIELD_ICONS); + SDL_assert(Hud_shield_filename_count < MAX_SHIELD_ICONS); } // for bombers for (i = 1; i < 11; i++) { snprintf(Hud_shield_filenames[Hud_shield_filename_count++], MAX_FILENAME_LEN, "shield-b%02d", i); - Assert(Hud_shield_filename_count < MAX_SHIELD_ICONS); + SDL_assert(Hud_shield_filename_count < MAX_SHIELD_ICONS); } #endif } @@ -422,8 +422,8 @@ void hud_shield_show(object *objp) // load in shield frames if not already loaded // DDOI - shield_icon_index is unsigned - // Assert(sip->shield_icon_index >= 0 && sip->shield_icon_index < Hud_shield_filename_count); - Assert(sip->shield_icon_index < Hud_shield_filename_count); + // SDL_assert(sip->shield_icon_index >= 0 && sip->shield_icon_index < Hud_shield_filename_count); + SDL_assert(sip->shield_icon_index < Hud_shield_filename_count); sgp = &Shield_gauges[sip->shield_icon_index]; @@ -472,7 +472,7 @@ void hud_shield_show(object *objp) range = max(HUD_COLOR_ALPHA_MAX, HUD_color_alpha + 4); hud_color_index = fl2i( (objp->shields[Quadrant_xlate[i]] / max_shield) * range + 0.5); - Assert(hud_color_index >= 0 && hud_color_index <= range); + SDL_assert(hud_color_index >= 0 && hud_color_index <= range); if ( hud_color_index < 0 ) { hud_color_index = 0; @@ -515,8 +515,8 @@ void hud_ship_icon_page_in(ship_info *sip) // load in shield frames if not already loaded // DDOI - shield_icon_index is unsigned - // Assert(sip->shield_icon_index >= 0 && sip->shield_icon_index < Hud_shield_filename_count); - Assert(sip->shield_icon_index < Hud_shield_filename_count); + // SDL_assert(sip->shield_icon_index >= 0 && sip->shield_icon_index < Hud_shield_filename_count); + SDL_assert(sip->shield_icon_index < Hud_shield_filename_count); sgp = &Shield_gauges[sip->shield_icon_index]; if ( sgp->first_frame == -1 ) { @@ -545,15 +545,15 @@ void hud_shield_equalize(object *objp, player *pl) int idx; int all_equal = 1; - Assert(objp != NULL); + SDL_assert(objp != NULL); if(objp == NULL){ return; } - Assert(pl != NULL); + SDL_assert(pl != NULL); if(pl == NULL){ return; } - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); if(objp->type != OBJ_SHIP){ return; } @@ -609,8 +609,8 @@ void hud_augment_shield_quadrant(object *objp, int direction) float max_quadrant_val; int i; - Assert(direction >= 0 && direction < 4); - Assert(objp->type == OBJ_SHIP); + SDL_assert(direction >= 0 && direction < 4); + SDL_assert(objp->type == OBJ_SHIP); full_shields = Ship_info[Ships[objp->instance].ship_info_index].shields; xfer_amount = full_shields * SHIELD_TRANSFER_PERCENT; @@ -619,7 +619,7 @@ void hud_augment_shield_quadrant(object *objp, int direction) if ( (objp->shields[direction] + xfer_amount) > max_quadrant_val ) xfer_amount = max_quadrant_val - objp->shields[direction]; - Assert(xfer_amount >= 0); + SDL_assert(xfer_amount >= 0); if ( xfer_amount == 0 ) { // TODO: provide a feedback sound return; @@ -644,7 +644,7 @@ void hud_augment_shield_quadrant(object *objp, int direction) continue; delta = percent_to_take * objp->shields[i]; objp->shields[i] -= delta; - Assert(objp->shields[i] >= 0 ); + SDL_assert(objp->shields[i] >= 0 ); objp->shields[direction] += delta; if ( objp->shields[direction] > max_quadrant_val ) objp->shields[direction] = max_quadrant_val; @@ -659,7 +659,7 @@ void hud_shield_assign_info(ship_info *sip, char *filename) ubyte i; for ( i = 0; i < Hud_shield_filename_count; i++ ) { - if ( !stricmp(filename, Hud_shield_filenames[i]) ) { + if ( !SDL_strcasecmp(filename, Hud_shield_filenames[i]) ) { sip->shield_icon_index = i; } } @@ -687,7 +687,7 @@ void hud_show_mini_ship_integrity(object *objp, int x_force, int y_force) if(numeric_integrity > 100){ numeric_integrity = 100; } - // Assert(numeric_integrity <= 100); + // SDL_assert(numeric_integrity <= 100); // base coords nx = (x_force == -1) ? Hud_mini_base[gr_screen.res][0] : x_force; @@ -776,7 +776,7 @@ void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_off range = HUD_color_alpha; hud_color_index = fl2i( (objp->shields[Quadrant_xlate[i]] / max_shield) * range + 0.5); - Assert(hud_color_index >= 0 && hud_color_index <= range); + SDL_assert(hud_color_index >= 0 && hud_color_index <= range); if ( hud_color_index < 0 ) { hud_color_index = 0; diff --git a/src/hud/hudsquadmsg.cpp b/src/hud/hudsquadmsg.cpp index 01aa996..b8c472e 100644 --- a/src/hud/hudsquadmsg.cpp +++ b/src/hud/hudsquadmsg.cpp @@ -463,7 +463,7 @@ const char *comm_order_menu_text(int index) case 11: return XSTR( "Abort rearm", 310); break; case 12: return XSTR( "Depart", 311); break; default: - Assert(0); + SDL_assert(0); } return NULL; } @@ -640,7 +640,7 @@ int hud_squadmsg_count_ships( int add_to_menu ) for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { shipp = &Ships[Objects[so->objnum].instance]; - Assert ( shipp->objnum != -1 ); + SDL_assert ( shipp->objnum != -1 ); // ships must be able to receive a message if ( !(Ship_info[shipp->ship_info_index].flags & CAN_MESSAGE) ) @@ -678,7 +678,7 @@ int hud_squadmsg_count_ships( int add_to_menu ) count++; if ( add_to_menu ) { - Assert ( Num_menu_items < MAX_MENU_ITEMS ); + SDL_assert ( Num_menu_items < MAX_MENU_ITEMS ); strcpy( MsgItems[Num_menu_items].text, shipp->ship_name ); MsgItems[Num_menu_items].instance = SHIP_INDEX(shipp); MsgItems[Num_menu_items].active = 1; @@ -708,7 +708,7 @@ int hud_squadmsg_wing_valid( wing *wingp, int team ) return 0; // sanity check on ship_index field -- if check is successful, then check the team. - Assert (wingp->ship_index[0] != -1 ); + SDL_assert (wingp->ship_index[0] != -1 ); if ( Ships[wingp->ship_index[0]].team != team ) return 0; @@ -768,7 +768,7 @@ int hud_squadmsg_count_wings( int add_to_menu ) if ( hud_squadmsg_wing_valid(&Wings[wingnum], team) ) { count++; if ( add_to_menu ) { - Assert ( Num_menu_items < MAX_MENU_ITEMS ); + SDL_assert ( Num_menu_items < MAX_MENU_ITEMS ); strcpy( MsgItems[Num_menu_items].text, Wings[wingnum].name ); MsgItems[Num_menu_items].instance = wingnum; MsgItems[Num_menu_items].active = 1; @@ -789,7 +789,7 @@ int hud_squadmsg_count_wings( int add_to_menu ) if ( hud_squadmsg_wing_valid(&Wings[i], team) ) { count++; if ( add_to_menu ) { - Assert ( Num_menu_items < MAX_MENU_ITEMS ); + SDL_assert ( Num_menu_items < MAX_MENU_ITEMS ); strcpy( MsgItems[Num_menu_items].text, Wings[i].name ); MsgItems[Num_menu_items].instance = i; MsgItems[Num_menu_items].active = 1; @@ -814,7 +814,7 @@ void hud_squadmsg_page_down() { if ( (First_menu_item + MAX_MENU_DISPLAY) < Num_menu_items ) { First_menu_item += MAX_MENU_DISPLAY; - Assert ( First_menu_item < Num_menu_items ); + SDL_assert ( First_menu_item < Num_menu_items ); } } @@ -822,7 +822,7 @@ void hud_squadmsg_page_up() { if ( First_menu_item > 0 ) { First_menu_item -= MAX_MENU_DISPLAY; - Assert (First_menu_item >= 0 ); + SDL_assert (First_menu_item >= 0 ); } } @@ -1088,7 +1088,7 @@ void hud_squadmsg_repair_rearm( int toggle_state, object *objp) } else { tobj = objp; multi_player_num = multi_find_player_by_object(objp); - Assert(multi_player_num != -1); + SDL_assert(multi_player_num != -1); } // see if player is already scheduled on arriving support ship. If so, issues appripriate @@ -1193,7 +1193,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip ) if ( Comm_orders[i].value == order ) break; } - Assert( i < MAX_SHIP_ORDERS ); + SDL_assert( i < MAX_SHIP_ORDERS ); order = i; } @@ -1228,7 +1228,7 @@ int hud_squadmsg_is_target_order_valid(int order, int find_order, ai_info *aip ) return 0; } - Assert( objp->type == OBJ_SHIP ); + SDL_assert( objp->type == OBJ_SHIP ); shipp = &Ships[objp->instance]; @@ -1299,7 +1299,7 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num ) if ( player_num != -1 ) aip = &Ai_info[Ships[Objects[Net_players[player_num].player->objnum].instance].ai_index]; - Assert( aip->shipnum != -1 ); + SDL_assert( aip->shipnum != -1 ); ordering_shipp = &Ships[aip->shipnum]; if ( command == IGNORE_TARGET_ITEM ) { @@ -1323,7 +1323,7 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num ) // get the first ship on the wing list and look at it's team and then it's type shipnum = Wings[i].ship_index[0]; - Assert( shipnum != -1 ); + SDL_assert( shipnum != -1 ); shipp = &Ships[shipnum]; // can't message if not on players team @@ -1378,7 +1378,7 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num ) // we ordered directly is a ship -- we want the response to come directly from the // guy we orders if ( do_ship ) { - Assert( Msg_instance != MESSAGE_ALL_FIGHTERS ); + SDL_assert( Msg_instance != MESSAGE_ALL_FIGHTERS ); hud_squadmsg_send_ship_command( Msg_instance, command, 1 ); } } @@ -1436,7 +1436,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, ainfo = &Ai_info[Ships[Objects[Net_players[player_num].player->objnum].instance].ai_index]; } - Assert( ainfo->shipnum != -1 ); + SDL_assert( ainfo->shipnum != -1 ); ordering_shipp = &Ships[ainfo->shipnum]; // a shortcut to save on repetitive coding. If the order is a 'target' order, make the default @@ -1458,14 +1458,14 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, } } - Assert ( ainfo->shipnum != -1 ); + SDL_assert ( ainfo->shipnum != -1 ); ship_team = Ships[ainfo->shipnum].team; // team of the ship issuing the message switch ( command ) { // value of k matches the #defines for ship messages case ATTACK_TARGET_ITEM: if ( Objects[ainfo->target_objnum].type == OBJ_SHIP ) { - Assert( target_shipname ); - Assert( ship_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( ship_team != target_team ); // Orders to override protect if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) { @@ -1483,8 +1483,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, break; case DISABLE_TARGET_ITEM: - Assert( target_shipname ); - Assert( ship_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( ship_team != target_team ); // Orders to override protect if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) { @@ -1497,8 +1497,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, break; case DISARM_TARGET_ITEM: - Assert( target_shipname ); - Assert( ship_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( ship_team != target_team ); // Orders to override protect if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) { @@ -1511,10 +1511,10 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, break; case DISABLE_SUBSYSTEM_ITEM: - Assert( target_shipname ); - Assert( ship_team != target_team ); - Assert( ainfo->targeted_subsys != NULL ); - Assert( ainfo->targeted_subsys->current_hits > 0.0f); + SDL_assert( target_shipname ); + SDL_assert( ship_team != target_team ); + SDL_assert( ainfo->targeted_subsys != NULL ); + SDL_assert( ainfo->targeted_subsys->current_hits > 0.0f); // Orders to override protect if (Ship_info[Ships[Objects[ainfo->target_objnum].instance].ship_info_index].flags & OVERRIDE_PROTECT_SHIP_TYPE) { @@ -1527,10 +1527,10 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, break; case CAPTURE_TARGET_ITEM: - Assert( target_shipname ); - Assert( ship_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( ship_team != target_team ); - Assert(ainfo->target_objnum > -1); + SDL_assert(ainfo->target_objnum > -1); Objects[ainfo->target_objnum].flags |= OF_PROTECTED; @@ -1547,8 +1547,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, return 0; } - Assert( target_shipname ); - Assert( ship_team == target_team ); + SDL_assert( target_shipname ); + SDL_assert( ship_team == target_team ); ai_mode = AI_GOAL_GUARD; ai_submode = AIS_GUARD_PATROL; @@ -1556,8 +1556,8 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, break; case IGNORE_TARGET_ITEM: - Assert( target_shipname ); - Assert( ship_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( ship_team != target_team ); ai_mode = AI_GOAL_IGNORE; ai_submode = 0; @@ -1640,7 +1640,7 @@ int hud_squadmsg_send_ship_command( int shipnum, int command, int send_message, // handle case of messaging one ship. Deal with messaging all fighters next. if ( ai_mode != AI_GOAL_NONE ) { - Assert(ai_submode != -1234567); + SDL_assert(ai_submode != -1234567); ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, ai_mode, ai_submode, target_shipname, &Ai_info[Ships[shipnum].ai_index] ); if( player_num == -1 ) hud_add_issued_order(Ships[shipnum].ship_name, command, target_shipname); @@ -1700,7 +1700,7 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, if ( player_num != -1 ) ainfo = &Ai_info[Ships[Objects[Net_players[player_num].player->objnum].instance].ai_index]; - Assert( ainfo->shipnum != -1 ); + SDL_assert( ainfo->shipnum != -1 ); ordering_shipp = &Ships[ainfo->shipnum]; // get the shipnum of the ship the player has targeted. Used in enough places to do this just @@ -1722,18 +1722,18 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, } } - Assert ( ainfo->shipnum != -1 ); - Assert ( (wingnum >= 0) && (wingnum < num_wings) ); + SDL_assert ( ainfo->shipnum != -1 ); + SDL_assert ( (wingnum >= 0) && (wingnum < num_wings) ); // get the team for the wing - Assert ( Wings[wingnum].ship_index[0] != -1 ); + SDL_assert ( Wings[wingnum].ship_index[0] != -1 ); wing_team = Ships[Wings[wingnum].ship_index[0]].team; switch ( command ) { // value of k matches the #defines for ship messages case ATTACK_TARGET_ITEM: if ( Objects[ainfo->target_objnum].type == OBJ_SHIP ) { - Assert( target_shipname ); - Assert( wing_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( wing_team != target_team ); if ( (Ships[Objects[ainfo->target_objnum].instance].wingnum != -1) && (Ships[Objects[ainfo->target_objnum].instance].wingnum == wingnum) ) { message = MESSAGE_NOSIR; ai_mode = AI_GOAL_NONE; @@ -1752,8 +1752,8 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, break; case DISABLE_TARGET_ITEM: - Assert( target_shipname ); - Assert( wing_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( wing_team != target_team ); ai_mode = AI_GOAL_DISABLE_SHIP; ai_submode = -SUBSYSTEM_ENGINE; @@ -1761,8 +1761,8 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, break; case DISARM_TARGET_ITEM: - Assert( target_shipname ); - Assert( wing_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( wing_team != target_team ); ai_mode = AI_GOAL_DISARM_SHIP; ai_submode = -SUBSYSTEM_TURRET; @@ -1770,10 +1770,10 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, break; case DISABLE_SUBSYSTEM_ITEM: - Assert( target_shipname ); - Assert( wing_team != target_team ); - Assert( ainfo->targeted_subsys != NULL ); - Assert( ainfo->targeted_subsys->current_hits > 0.0f); + SDL_assert( target_shipname ); + SDL_assert( wing_team != target_team ); + SDL_assert( ainfo->targeted_subsys != NULL ); + SDL_assert( ainfo->targeted_subsys->current_hits > 0.0f); ai_mode = AI_GOAL_DESTROY_SUBSYSTEM; ai_submode = ship_get_subsys_index( &Ships[Objects[ainfo->target_objnum].instance], ainfo->targeted_subsys->system_info->subobj_name ); @@ -1782,8 +1782,8 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, case PROTECT_TARGET_ITEM: - Assert( target_shipname ); - Assert( wing_team == target_team ); + SDL_assert( target_shipname ); + SDL_assert( wing_team == target_team ); ai_mode = AI_GOAL_GUARD; ai_submode = AIS_GUARD_PATROL; @@ -1791,8 +1791,8 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, break; case IGNORE_TARGET_ITEM: - Assert( target_shipname ); - Assert( wing_team != target_team ); + SDL_assert( target_shipname ); + SDL_assert( wing_team != target_team ); ai_mode = AI_GOAL_IGNORE; ai_submode = 0; // actually, a don't care. @@ -1844,7 +1844,7 @@ int hud_squadmsg_send_wing_command( int wingnum, int command, int send_message, } if ( ai_mode != AI_GOAL_NONE ) { - Assert(ai_submode != -1234567); + SDL_assert(ai_submode != -1234567); ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, ai_mode, ai_submode, target_shipname, wingnum ); } } @@ -1905,7 +1905,7 @@ int hud_squadmsg_reinforcements_available(int team) // check the arrival cue sexpression of the ship/wing of this reinforcement. If known // false, it doesn't count either if ( (wingnum = wing_name_lookup(Reinforcements[i].name, 1)) != -1 ) { - Assert ( Wings[wingnum].arrival_cue >= 0 ); + SDL_assert ( Wings[wingnum].arrival_cue >= 0 ); if ( Sexp_nodes[Wings[wingnum].arrival_cue].value == SEXP_KNOWN_FALSE ){ continue; } @@ -2022,7 +2022,7 @@ do_main_menu: hud_squadmsg_display_menu( XSTR( "Message What", 316) ); k = hud_squadmsg_get_key(); if ( k != -1 ) { // when k != -1, we have a key that associates with menu item - Assert ( k < Num_menu_items ); + SDL_assert ( k < Num_menu_items ); if ( k == TYPE_SHIP_ITEM ){ hud_squadmsg_do_mode( SM_MODE_SHIP_SELECT ); } else if ( k == TYPE_WING_ITEM ) { @@ -2063,7 +2063,7 @@ void hud_squadmsg_ship_select() } else { // we must convert the Msg_shortcut_command value to a value that the message // system normally uses to select a command. Since the menu - Assert( Msg_shortcut_command != IGNORE_TARGET_ITEM ); + SDL_assert( Msg_shortcut_command != IGNORE_TARGET_ITEM ); hud_squadmsg_send_ship_command( MsgItems[First_menu_item+k].instance, Msg_shortcut_command, 1 ); hud_squadmsg_toggle(); } @@ -2088,7 +2088,7 @@ void hud_squadmsg_wing_select() Msg_instance = MsgItems[First_menu_item + k].instance; // store the instance id in a global hud_squadmsg_do_mode( SM_MODE_WING_COMMAND ); // and move to a new mode } else { - Assert( Msg_shortcut_command != IGNORE_TARGET_ITEM ); + SDL_assert( Msg_shortcut_command != IGNORE_TARGET_ITEM ); hud_squadmsg_send_wing_command( MsgItems[First_menu_item+k].instance, Msg_shortcut_command, 1 ); hud_squadmsg_toggle(); } @@ -2127,7 +2127,7 @@ void hud_squadmsg_call_reinforcement(int reinforcement_num, int player_num) // check to see if the reinforcement called was a wing. for (i = 0; i < num_wings; i++ ) { - if ( !stricmp(rp->name, Wings[i].name) ) { + if ( !SDL_strcasecmp(rp->name, Wings[i].name) ) { // found a wingname. Call the parse function to create all the ships in this wing // we must set the arrival cue of the wing to true, otherwise, this won't work!! Wings[i].flags &= ~WF_REINFORCEMENT; @@ -2203,7 +2203,7 @@ void hud_squadmsg_reinforcement_select() continue; } - Assert ( Num_menu_items < MAX_MENU_ITEMS ); + SDL_assert ( Num_menu_items < MAX_MENU_ITEMS ); strcpy( MsgItems[Num_menu_items].text, rp->name ); MsgItems[Num_menu_items].instance = i; MsgItems[Num_menu_items].active = 0; @@ -2269,7 +2269,7 @@ void hud_squadmsg_ship_command() // check to see if the comm order should even be added to the menu -- if so, then add it // the order will be activated if the bit is set for the ship. if ( default_orders & Comm_orders[i].value ) { - Assert ( Num_menu_items < MAX_MENU_ITEMS ); + SDL_assert ( Num_menu_items < MAX_MENU_ITEMS ); strcpy( MsgItems[Num_menu_items].text, comm_order_menu_text(i) ); MsgItems[Num_menu_items].instance = Comm_orders[i].value; MsgItems[Num_menu_items].active = 0; @@ -2330,7 +2330,7 @@ void hud_squadmsg_ship_command() // when we get a valid goal, we must add the goal to the ai ship's goal list if ( k != -1 ) { - Assert ( k < Num_menu_items ); + SDL_assert ( k < Num_menu_items ); // when messaging all fighters or ignoring target, call the send_to_all_fighters routine if ( (Msg_instance != MESSAGE_ALL_FIGHTERS) && (MsgItems[k].instance != IGNORE_TARGET_ITEM) ) hud_squadmsg_send_ship_command( Msg_instance, MsgItems[k].instance, 1 ); @@ -2366,7 +2366,7 @@ void hud_squadmsg_wing_command() // add the set of default orders to the comm menu. We will currently allow all messages // to be available in the wing. if ( default_orders & Comm_orders[i].value ) { - Assert ( Num_menu_items < MAX_MENU_ITEMS ); + SDL_assert ( Num_menu_items < MAX_MENU_ITEMS ); strcpy( MsgItems[Num_menu_items].text, comm_order_menu_text(i) ); MsgItems[Num_menu_items].instance = Comm_orders[i].value; MsgItems[Num_menu_items].active = 0; @@ -2429,7 +2429,7 @@ void hud_squadmsg_save_keys( int do_scroll ) if ( !do_scroll && ((keys_used[j] == KEY_PAGEDOWN) || (keys_used[j] == KEY_PAGEUP)) ) continue; - Assert( num_keys_saved < MAX_KEYS_USED ); + SDL_assert( num_keys_saved < MAX_KEYS_USED ); key_save[num_keys_saved].option_num = i; key_save[num_keys_saved].key_value = keys_used[j]; num_keys_saved++; @@ -2543,12 +2543,12 @@ int hud_squadmsg_hotkey_select( int k ) int send_message; object *objp; - Assert ( Player->flags & PLAYER_FLAGS_MSG_MODE ); + SDL_assert ( Player->flags & PLAYER_FLAGS_MSG_MODE ); if ( Msg_shortcut_command == -1 ) return 0; - Assert ( (k >= 0) && (k < MAX_KEYED_TARGETS) ); + SDL_assert ( (k >= 0) && (k < MAX_KEYED_TARGETS) ); plist = &(Player->keyed_targets[k]); if ( EMPTY(plist) ) // be sure that we have at least one ship in the list @@ -2560,7 +2560,7 @@ int hud_squadmsg_hotkey_select( int k ) // an enemy ship. for ( hitem = GET_FIRST(plist); hitem != END_OF_LIST(plist); hitem = GET_NEXT(hitem) ) { objp = hitem->objp; - Assert ( objp->type == OBJ_SHIP ); + SDL_assert ( objp->type == OBJ_SHIP ); if ( Ships[objp->instance].team != TEAM_FRIENDLY ) continue; @@ -2589,7 +2589,7 @@ int hud_squadmsg_do_frame( ) { int target_changed; - Assert ( Player->flags & PLAYER_FLAGS_MSG_MODE ); // be sure that messaging mode is set!!! + SDL_assert ( Player->flags & PLAYER_FLAGS_MSG_MODE ); // be sure that messaging mode is set!!! // if the player is now dead, or the timestamp elapsed, then get out of messaging mode. if ( (Game_mode & GM_DEAD) || timestamp_elapsed(Msg_mode_timestamp) ) { @@ -2735,10 +2735,10 @@ int hud_query_order_issued(const char *name, const char *order, const char *targ t = get_parse_name_index(target); for (i=0; itarget_objnum >= 0) && (Player_ai->target_objnum < MAX_OBJECTS)); + SDL_assert((Player_ai->target_objnum >= 0) && (Player_ai->target_objnum < MAX_OBJECTS)); if (!((Player_ai->target_objnum >= 0) && (Player_ai->target_objnum < MAX_OBJECTS))) { return; } - Assert(Objects[Player_ai->target_objnum].type == OBJ_SHIP); + SDL_assert(Objects[Player_ai->target_objnum].type == OBJ_SHIP); if (Objects[Player_ai->target_objnum].type != OBJ_SHIP) { return; } @@ -1066,7 +1066,7 @@ void hud_target_hotkey_select( int k ) // if current target is not in list, then target and next_target will be NULL // so we use the first found target if (target == NULL) { - Assert(first_target != NULL); + SDL_assert(first_target != NULL); if (first_target != NULL) { target = first_target; next_target = first_target; @@ -1093,7 +1093,7 @@ void hud_target_hotkey_select( int k ) } } - Assert( target != END_OF_LIST(plist) ); + SDL_assert( target != END_OF_LIST(plist) ); if ( Player_obj != target->objp ){ set_target_objnum( Player_ai, OBJ_INDEX(target->objp) ); @@ -1182,7 +1182,7 @@ void hud_init_homing_beep() // void hud_init_targeting() { - Assert(Player_ai != NULL); + SDL_assert(Player_ai != NULL); // make sure there is no current target set_target_objnum( Player_ai, -1 ); @@ -1465,7 +1465,7 @@ void hud_target_missile(object *source_obj, int next_flag) if ( source_obj->type != OBJ_SHIP ) return; - Assert( Ships[source_obj->instance].ai_index != -1 ); + SDL_assert( Ships[source_obj->instance].ai_index != -1 ); aip = &Ai_info[Ships[source_obj->instance].ai_index]; end = &Missile_obj_list; @@ -1483,11 +1483,11 @@ void hud_target_missile(object *source_obj, int next_flag) continue; } - Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); + SDL_assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); A = &Objects[mo->objnum]; - Assert(A->type == OBJ_WEAPON); - Assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); + SDL_assert(A->type == OBJ_WEAPON); + SDL_assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); wp = &Weapons[A->instance]; wip = &Weapon_info[wp->weapon_info_index]; @@ -1722,8 +1722,8 @@ int sort_turret_func(const void *e1, const void *e2) eval_next_turret *p1 = (eval_next_turret*)e1; eval_next_turret *p2 = (eval_next_turret*)e2; - Assert(p1->type != TYPE_NONE); - Assert(p2->type != TYPE_NONE); + SDL_assert(p1->type != TYPE_NONE); + SDL_assert(p2->type != TYPE_NONE); if (p1->type != p2->type) { return (p1->type - p2->type); @@ -1933,14 +1933,14 @@ void hud_target_closest_locked_missile(object *locked_obj) nearest_dist = 10000.0f; for ( mo = GET_NEXT(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) { - Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); + SDL_assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); A = &Objects[mo->objnum]; if (A->type != OBJ_WEAPON){ continue; } - Assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); + SDL_assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); wp = &Weapons[A->instance]; wip = &Weapon_info[wp->weapon_info_index]; @@ -1967,7 +1967,7 @@ void hud_target_closest_locked_missile(object *locked_obj) } // end for if (nearest_dist < 10000.0f) { - Assert(nearest_obj); + SDL_assert(nearest_obj); set_target_objnum( Player_ai, OBJ_INDEX(nearest_obj) ); target_found = TRUE; } @@ -2116,7 +2116,7 @@ void evaluate_ship_as_closest_target(esct *esct) object *objp = &Objects[esct->shipp->objnum]; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); if (objp->type != OBJ_SHIP) { return; } @@ -2332,7 +2332,7 @@ void hud_update_closest_turret() closest_subsys = NULL; - Assert(Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)); + SDL_assert(Ship_info[shipp->ship_info_index].flags & (SIF_BIG_SHIP|SIF_HUGE_SHIP)); for (ss=GET_FIRST(&shipp->subsys_list); ss!=END_OF_LIST(&shipp->subsys_list); ss=GET_NEXT(ss)) { if ( (ss->system_info->type == SUBSYSTEM_TURRET) && (ss->current_hits > 0) ) { @@ -2657,7 +2657,7 @@ void hud_target_subsystem_in_reticle() nearest_subsys = subsys; } - Assert(best_dot <= 1.0f); + SDL_assert(best_dot <= 1.0f); } // end for if ( nearest_subsys != NULL ) { @@ -3054,7 +3054,7 @@ void hud_show_homing_missiles() for ( mo = GET_NEXT(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) { A = &Objects[mo->objnum]; - Assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); + SDL_assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); wp = &Weapons[A->instance]; @@ -3131,7 +3131,7 @@ void hud_show_remote_detonate_missile() // check for currently locked missiles (highest precedence) for ( mo = GET_FIRST(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) { - Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); + SDL_assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); mobjp = &Objects[mo->objnum]; if ((Player_obj != NULL) && (mobjp->parent_sig == Player_obj->parent_sig)) { @@ -3189,16 +3189,16 @@ void hud_show_message_sender() return; targetp = &Objects[Ships[Message_shipnum].objnum]; - Assert ( targetp != NULL ); + SDL_assert ( targetp != NULL ); - Assert ( targetp->type == OBJ_SHIP ); + SDL_assert ( targetp->type == OBJ_SHIP ); // Don't do this for the ship you're flying! if ( targetp == Player_obj ) { return; } - Assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS ); + SDL_assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS ); target_shipp = &Ships[Message_shipnum]; // check the object flags to see if this ship is gone. If so, then don't do this stuff anymore @@ -3277,9 +3277,9 @@ void hud_prune_hotkeys() remove_item = 0; objp = hitem->objp; - Assert ( objp != NULL ); + SDL_assert ( objp != NULL ); if ( objp->type == OBJ_SHIP ) { - Assert ( objp->instance >=0 && objp->instance < MAX_SHIPS ); + SDL_assert ( objp->instance >=0 && objp->instance < MAX_SHIPS ); sp = &Ships[objp->instance]; } else { // if the object isn't a ship, it shouldn't be on the list, so remove it without question @@ -3329,7 +3329,7 @@ void hud_show_selection_set() if ( set == -1 ) return; - Assert ( (set >= 0) && (set < MAX_KEYED_TARGETS) ); + SDL_assert ( (set >= 0) && (set < MAX_KEYED_TARGETS) ); plist = &(Players[Player_num].keyed_targets[set]); count = 0; @@ -3343,12 +3343,12 @@ void hud_show_selection_set() for ( hitem = GET_FIRST(plist); hitem != END_OF_LIST(plist); hitem = GET_NEXT(hitem) ) { targetp = hitem->objp; - Assert ( targetp != NULL ); + SDL_assert ( targetp != NULL ); ship *target_shipp = NULL; - Assert ( targetp->type == OBJ_SHIP ); - Assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS ); + SDL_assert ( targetp->type == OBJ_SHIP ); + SDL_assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS ); target_shipp = &Ships[targetp->instance]; if ( (Game_mode & GM_MULTIPLAYER) && (target_shipp == Player_ship) ) { @@ -3436,7 +3436,7 @@ void hud_show_brackets(object *targetp, vertex *projected_v) break; case OBJ_WEAPON: - Assert(Weapon_info[Weapons[targetp->instance].weapon_info_index].subtype == WP_MISSILE); + SDL_assert(Weapon_info[Weapons[targetp->instance].weapon_info_index].subtype == WP_MISSILE); modelnum = Weapon_info[Weapons[targetp->instance].weapon_info_index].model_num; bound_rc = model_find_2d_bound_min( modelnum, &targetp->orient, &targetp->pos,&x1,&y1,&x2,&y2 ); break; @@ -3642,7 +3642,7 @@ void hud_show_targeting_gauges(float frametime, int in_cockpit) if ( hud_gauge_active(HUD_OFFSCREEN_INDICATOR) ) { if (target_point.codes != 0) { // target center is not on screen // draw the offscreen indicator at the edge of the screen where the target is closest to - Assert(Player_ai->target_objnum != -1); + SDL_assert(Player_ai->target_objnum != -1); // AL 11-11-97: don't draw the indicator if the ship is messaging, the indicator is drawn // in the message sending color in hud_show_message_sender() @@ -3807,8 +3807,8 @@ int hud_get_best_primary_bank(float *range) // calculate the range of the weapon, and only display the lead target indicator when // if the weapon can actually hit the target - Assert(bank_to_fire >= 0); - Assert(swp->primary_bank_weapons[bank_to_fire] >= 0); + SDL_assert(bank_to_fire >= 0); + SDL_assert(swp->primary_bank_weapons[bank_to_fire] >= 0); wip = &Weapon_info[swp->primary_bank_weapons[bank_to_fire]]; weapon_range = wip->max_speed * wip->lifetime; @@ -3836,7 +3836,7 @@ void polish_predicted_target_pos(vector *enemy_pos, vector *predicted_enemy_pos, ship *shipp; shipp = &Ships[Player_obj->instance]; - Assert(shipp->weapons.current_primary_bank < shipp->weapons.num_primary_banks); + SDL_assert(shipp->weapons.current_primary_bank < shipp->weapons.num_primary_banks); weapon_info *wip = &Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]]; float weapon_speed = wip->max_speed; @@ -3979,7 +3979,7 @@ void hud_show_lead_indicator(vector *target_world_pos) indicator_frame = Lead_indicator_gauge.first_frame + frame_offset; - Assert(wip->max_speed != 0); + SDL_assert(wip->max_speed != 0); time_to_target = dist_to_target / wip->max_speed; target_moved_dist = targetp->phys_info.speed * time_to_target; @@ -4489,7 +4489,7 @@ void hud_show_afterburner_gauge() return; } - Assert(Player_ship); + SDL_assert(Player_ship); if ( !(Ship_info[Player_ship->ship_info_index].flags & SIF_AFTERBURNER) ) { percent_left = 0.0f; } else { @@ -4628,7 +4628,7 @@ void hud_show_secondary_weapon(int count, ship_weapon *sw, int dual_fire) wip = &Weapon_info[sw->secondary_bank_weapons[i]]; // HACK - make Cluster Bomb fit on the HUD. - if(!stricmp(wip->name,"cluster bomb")){ + if(!SDL_strcasecmp(wip->name,"cluster bomb")){ strcpy(weapon_name, NOX("Cluster")); } else { strcpy(weapon_name, wip->name); @@ -4746,8 +4746,8 @@ void hud_show_weapons() if(Player_obj->type == OBJ_OBSERVER) return; - Assert(Player_obj->type == OBJ_SHIP); - Assert(Player_obj->instance >= 0 && Player_obj->instance < MAX_SHIPS); + SDL_assert(Player_obj->type == OBJ_SHIP); + SDL_assert(Player_obj->instance >= 0 && Player_obj->instance < MAX_SHIPS); sw = &Ships[Player_obj->instance].weapons; @@ -5455,7 +5455,7 @@ void hud_target_last_transmit() int play_fail_sound = 1; int transmit_index = Transmit_target_current_slot; - Assert(transmit_index >= 0); + SDL_assert(transmit_index >= 0); for ( i = 0; i < MAX_TRANSMIT_TARGETS; i++ ) { if ( Transmit_target_list[transmit_index].objnum >= 0 ) { int transmit_objnum = Transmit_target_list[transmit_index].objnum; @@ -5498,7 +5498,7 @@ void hud_target_last_transmit() // Was just bogus code in the call to hud_restore_subsystem_target(). -- MK, 9/15/99, 1:59 pm. int targeted_objnum; targeted_objnum = Transmit_target_list[transmit_index].objnum; - Assert((targeted_objnum >= 0) && (targeted_objnum < MAX_OBJECTS)); + SDL_assert((targeted_objnum >= 0) && (targeted_objnum < MAX_OBJECTS)); if ((targeted_objnum >= 0) && (targeted_objnum < MAX_OBJECTS)) { set_target_objnum( Player_ai, Transmit_target_list[transmit_index].objnum ); @@ -5513,9 +5513,9 @@ void hud_target_last_transmit_add(int ship_num) int ship_objnum; ship_objnum = Ships[ship_num].objnum; - Assert(ship_objnum >= 0 && ship_objnum < MAX_OBJECTS); + SDL_assert(ship_objnum >= 0 && ship_objnum < MAX_OBJECTS); ship_objp = &Objects[ship_objnum]; - Assert(ship_objp->type == OBJ_SHIP); + SDL_assert(ship_objp->type == OBJ_SHIP); Transmit_target_list[Transmit_target_next_slot].objnum = ship_objnum; Transmit_target_list[Transmit_target_next_slot].objsig = ship_objp->signature; diff --git a/src/hud/hudtargetbox.cpp b/src/hud/hudtargetbox.cpp index 0bdab78..63ab6fe 100644 --- a/src/hud/hudtargetbox.cpp +++ b/src/hud/hudtargetbox.cpp @@ -392,11 +392,11 @@ char *hud_targetbox_truncate_subsys_name(char *outstr) if(Lcl_gr){ if ( strstr(outstr, "communication") ) { strcpy(outstr, "Komm"); - } else if ( !stricmp(outstr, "weapons") ) { + } else if ( !SDL_strcasecmp(outstr, "weapons") ) { strcpy(outstr, "Waffen"); } else if ( strstr(outstr, "engine") || strstr(outstr, "Engine")) { strcpy(outstr, "Antrieb"); - } else if ( !stricmp(outstr, "sensors") ) { + } else if ( !SDL_strcasecmp(outstr, "sensors") ) { strcpy(outstr, "Sensoren"); } else if ( strstr(outstr, "navigat") ) { strcpy(outstr, "Nav"); @@ -414,17 +414,17 @@ char *hud_targetbox_truncate_subsys_name(char *outstr) strcpy(outstr, "Reaktor"); } else if ( strstr(outstr, "RadarDish") ) { strcpy(outstr, "Radarantenne"); - } else if (!stricmp(outstr, "Gas Collector")) { + } else if (!SDL_strcasecmp(outstr, "Gas Collector")) { strcpy(outstr, "Sammler"); } } else if(Lcl_fr){ if ( strstr(outstr, "communication") ) { strcpy(outstr, "comm"); - } else if ( !stricmp(outstr, "weapons") ) { + } else if ( !SDL_strcasecmp(outstr, "weapons") ) { strcpy(outstr, "armes"); } else if ( strstr(outstr, "engine") ) { strcpy(outstr, "moteur"); - } else if ( !stricmp(outstr, "sensors") ) { + } else if ( !SDL_strcasecmp(outstr, "sensors") ) { strcpy(outstr, "detecteurs"); } else if ( strstr(outstr, "navi") ) { strcpy(outstr, "nav"); @@ -438,11 +438,11 @@ char *hud_targetbox_truncate_subsys_name(char *outstr) } else if(Lcl_pl){ if ( strstr(outstr, "communication") ) { strcpy(outstr, "komunikacja"); - } else if ( !stricmp(outstr, "weapons") ) { + } else if ( !SDL_strcasecmp(outstr, "weapons") ) { strcpy(outstr, "uzbrojenie"); } else if ( strstr(outstr, "engine") || strstr(outstr, "Engine")) { strcpy(outstr, "silnik"); - } else if ( !stricmp(outstr, "sensors") ) { + } else if ( !SDL_strcasecmp(outstr, "sensors") ) { strcpy(outstr, "sensory"); } else if ( strstr(outstr, "navigat") ) { strcpy(outstr, "nawigacja"); @@ -460,15 +460,15 @@ char *hud_targetbox_truncate_subsys_name(char *outstr) strcpy(outstr, "reaktor"); } else if ( strstr(outstr, "RadarDish") ) { strcpy(outstr, "antena radaru"); - } else if (!stricmp(outstr, "Gas Collector")) { + } else if (!SDL_strcasecmp(outstr, "Gas Collector")) { strcpy(outstr, "zbieracz gazu"); } } else { - if (!strnicmp(outstr, XSTR( "communication", 333), 3)) { + if (!SDL_strncasecmp(outstr, XSTR( "communication", 333), 3)) { strcpy( outstr, XSTR( "comm", 334) ); - } else if (!strnicmp(outstr, XSTR( "navigation", 335), 3)) { + } else if (!SDL_strncasecmp(outstr, XSTR( "navigation", 335), 3)) { strcpy( outstr, XSTR( "nav", 336) ); - } else if (!stricmp(outstr, "Gas Collector")) { + } else if (!SDL_strcasecmp(outstr, "Gas Collector")) { strcpy(outstr, "Collector"); } } @@ -907,7 +907,7 @@ void hud_render_target_asteroid(object *target_objp) void get_turret_subsys_name(model_subsystem *system_info, char *outstr) { - Assert(system_info->type == SUBSYSTEM_TURRET); + SDL_assert(system_info->type == SUBSYSTEM_TURRET); if (system_info->turret_weapon_type >= 0) { // check if beam or flak using weapon flags @@ -947,7 +947,7 @@ void hud_render_target_ship_info(object *target_objp) char outstr[256]; float ship_integrity, shield_strength; - Assert(target_objp->type == OBJ_SHIP); + SDL_assert(target_objp->type == OBJ_SHIP); target_shipp = &Ships[target_objp->instance]; target_sip = &Ship_info[target_shipp->ship_info_index]; target_aip = &Ai_info[target_shipp->ai_index]; @@ -1061,7 +1061,7 @@ void hud_render_target_ship_info(object *target_objp) // AL 23-3-98: Fighter bays are a special case. Player cannot destroy them, so don't // show the subsystem strength - if ( strnicmp(NOX("fighter"), Player_ai->targeted_subsys->system_info->name, 7) ) { + if ( SDL_strncasecmp(NOX("fighter"), Player_ai->targeted_subsys->system_info->name, 7) ) { sprintf(outstr,XSTR( "%d%%", 341),screen_integrity); gr_get_string_size(&w,&h,outstr); gr_printf(Target_window_coords[gr_screen.res][0]+Target_window_coords[gr_screen.res][2]-w-1, Target_window_coords[gr_screen.res][1]+Target_window_coords[gr_screen.res][3] - h, "%s", outstr); @@ -1101,7 +1101,7 @@ void hud_blit_target_integrity(int disabled,int force_obj_num) } if(force_obj_num == -1){ - Assert(Player_ai->target_objnum >= 0 ); + SDL_assert(Player_ai->target_objnum >= 0 ); objp = &Objects[Player_ai->target_objnum]; } else { objp = &Objects[Player_ai->target_objnum]; @@ -1173,7 +1173,7 @@ int hud_targetbox_subsystem_in_view(object *target_objp, int *sx, int *sy) } // get screen coords, adjusting for autocenter - Assert(target_objp->type == OBJ_SHIP); + SDL_assert(target_objp->type == OBJ_SHIP); if (target_objp->type == OBJ_SHIP) { pm = model_get(Ships[target_objp->instance].modelnum); if (pm->flags & PM_FLAG_AUTOCEN) { @@ -1318,7 +1318,7 @@ void hud_render_target_ship(object *target_objp) if ( subsys_in_view != -1 ) { // AL 29-3-98: If subsystem is destroyed, draw gray brackets - if ( (Player_ai->targeted_subsys->current_hits <= 0) && (strnicmp(NOX("fighter"), Player_ai->targeted_subsys->system_info->name, 7)) ) { + if ( (Player_ai->targeted_subsys->current_hits <= 0) && (SDL_strncasecmp(NOX("fighter"), Player_ai->targeted_subsys->system_info->name, 7)) ) { gr_set_color_fast(&IFF_colors[IFF_COLOR_MESSAGE][1]); } else { hud_set_iff_color( target_objp, 1 ); @@ -1673,7 +1673,7 @@ void hud_show_target_data(float frametime) aip = &Ai_info[shipp->ai_index]; if ( aip->ai_flags & AIF_DOCKED ) { - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); other_objp = &Objects[aip->dock_objnum]; spd = other_objp->phys_info.fspeed; if ( spd < 0.1 ) @@ -1708,13 +1708,13 @@ void hud_show_target_data(float frametime) switch (aip->mode) { case AIM_CHASE: - Assert(aip->submode <= SM_BIG_PARALLEL); // Must be <= largest chase submode value. + SDL_assert(aip->submode <= SM_BIG_PARALLEL); // Must be <= largest chase submode value. // sprintf(outstr,"AI: %s",Submode_text[aip->submode]); sprintf(outstr2," / %s",Submode_text[aip->submode]); strcat(outstr,outstr2); break; case AIM_STRAFE: - Assert(aip->submode <= AIS_STRAFE_POSITION); // Must be <= largest chase submode value. + SDL_assert(aip->submode <= AIS_STRAFE_POSITION); // Must be <= largest chase submode value. // sprintf(outstr,"AI: %s",Strafe_submode_text[aip->submode-AIS_STRAFE_ATTACK]); sprintf(outstr2," / %s",Strafe_submode_text[aip->submode-AIS_STRAFE_ATTACK]); strcat(outstr,outstr2); diff --git a/src/hud/hudwingmanstatus.cpp b/src/hud/hudwingmanstatus.cpp index 25c5c6d..7c97b51 100644 --- a/src/hud/hudwingmanstatus.cpp +++ b/src/hud/hudwingmanstatus.cpp @@ -358,17 +358,17 @@ int HUD_wingman_status_coords[GR_NUM_RESOLUTIONS][HUD_WINGMAN_MAX_WINGS][HUD_WIN int hud_wingman_status_wing_index(const char *wing_name) { //XSTR:OFF - if ( !stricmp("alpha", wing_name) ) { + if ( !SDL_strcasecmp("alpha", wing_name) ) { return 0; - } else if ( !stricmp("beta", wing_name) ) { + } else if ( !SDL_strcasecmp("beta", wing_name) ) { return 1; - } else if ( !stricmp("gamma", wing_name) ) { + } else if ( !SDL_strcasecmp("gamma", wing_name) ) { return 2; - } else if ( !stricmp("delta", wing_name) ) { + } else if ( !SDL_strcasecmp("delta", wing_name) ) { return 3; - } else if ( !stricmp("epsilon", wing_name) ) { + } else if ( !SDL_strcasecmp("epsilon", wing_name) ) { return 4; - } else if ( (Game_mode & GM_MULTIPLAYER) && IS_MISSION_MULTI_TEAMS && !stricmp("zeta", wing_name) ) { + } else if ( (Game_mode & GM_MULTIPLAYER) && IS_MISSION_MULTI_TEAMS && !SDL_strcasecmp("zeta", wing_name) ) { return 5; } else { return -1; @@ -379,8 +379,8 @@ int hud_wingman_status_wing_index(const char *wing_name) // flag a player wing ship as destroyed void hud_set_wingman_status_dead(int wing_index, int wing_pos) { - Assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); - Assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); + SDL_assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); + SDL_assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_DEAD; } @@ -388,8 +388,8 @@ void hud_set_wingman_status_dead(int wing_index, int wing_pos) // flags a given player wing ship as departed void hud_set_wingman_status_departed(int wing_index, int wing_pos) { - Assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); - Assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); + SDL_assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); + SDL_assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_NOT_HERE; } @@ -399,8 +399,8 @@ void hud_set_wingman_status_none( int wing_index, int wing_pos) { int i; - Assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); - Assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); + SDL_assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); + SDL_assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_NONE; @@ -418,8 +418,8 @@ void hud_set_wingman_status_none( int wing_index, int wing_pos) // flags a given player wing ship as "alive" (for multiplayer respawns ) void hud_set_wingman_status_alive( int wing_index, int wing_pos) { - Assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); - Assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); + SDL_assert(wing_index >= 0 && wing_index < HUD_WINGMAN_MAX_WINGS); + SDL_assert(wing_pos >= 0 && wing_index < HUD_WINGMAN_MAX_SHIPS_PER_WINGS); HUD_wingman_status[wing_index].status[wing_pos] = HUD_WINGMAN_STATUS_ALIVE; } diff --git a/src/inetfile/cftp.cpp b/src/inetfile/cftp.cpp index 5974b00..3ec7bef 100644 --- a/src/inetfile/cftp.cpp +++ b/src/inetfile/cftp.cpp @@ -179,7 +179,7 @@ CFtpGet::CFtpGet(char *URL,char *localfile,char *Username,char *Password) //Parse the URL //Get rid of any extra ftp:// stuff char *pURL = URL; - if(_strnicmp(URL,"ftp:",4)==0) + if(SDL_strncasecmp(URL,"ftp:",4)==0) { pURL +=4; while(*pURL == '/') diff --git a/src/inetfile/chttpget.cpp b/src/inetfile/chttpget.cpp index 5754fb6..af62269 100644 --- a/src/inetfile/chttpget.cpp +++ b/src/inetfile/chttpget.cpp @@ -248,7 +248,7 @@ void ChttpGet::GetFile(char *URL,char *localfile) #endif char *pURL = URL; - if(strnicmp(URL,"http:",5)==0) + if(SDL_strncasecmp(URL,"http:",5)==0) { pURL +=5; while(*pURL == '/') @@ -367,7 +367,7 @@ void ChttpGet::WorkerThread() sprintf(szCommand,"GET %s%s HTTP/1.1\nAccept: */*\nAccept-Encoding: deflate\nHost: %s\n\n\n",m_ProxyEnabled?"":"/",m_ProxyEnabled?m_URL:m_szDir,m_szHost); send(m_DataSock,szCommand,strlen(szCommand),0); p = GetHTTPLine(); - if(strnicmp("HTTP/",p,5)==0) + if(SDL_strncasecmp("HTTP/",p,5)==0) { char *pcode; pcode = strchr(p,' ')+1; @@ -404,7 +404,7 @@ void ChttpGet::WorkerThread() idataready = 1; break; } - if(strnicmp(p,"Content-Length:",strlen("Content-Length:"))==0) + if(SDL_strncasecmp(p,"Content-Length:",strlen("Content-Length:"))==0) { char *s = strchr(p,' ')+1; p = s; diff --git a/src/io/joy.cpp b/src/io/joy.cpp index c9fd80b..f05304e 100644 --- a/src/io/joy.cpp +++ b/src/io/joy.cpp @@ -295,7 +295,7 @@ int joy_get_scaled_reading(int axn) if (d > rng) d = rng; - Assert(Joy_sensitivity >= 0 && Joy_sensitivity <= 9); + SDL_assert(Joy_sensitivity >= 0 && Joy_sensitivity <= 9); // compute percentages as a range between 0 and 1 sensitivity_percent = (float) Joy_sensitivity / 9.0f; diff --git a/src/io/key.cpp b/src/io/key.cpp index c422c1f..5054f15 100644 --- a/src/io/key.cpp +++ b/src/io/key.cpp @@ -200,8 +200,6 @@ keyboard key_data; int key_inited = 0; -CRITICAL_SECTION key_lock; - //int Backspace_debug=1; // global flag that will enable/disable the backspace key from stopping execution // This flag was created since the backspace key is also used to correct mistakes // when typing in your pilots callsign. This global flag is checked before execution @@ -294,8 +292,6 @@ void key_flush() if ( !key_inited ) return; - ENTER_CRITICAL_SECTION(&key_lock); - key_data.keyhead = key_data.keytail = 0; //Clear the keyboard buffer @@ -319,8 +315,6 @@ void key_flush() } key_text_input.clear(); - - LEAVE_CRITICAL_SECTION(&key_lock); } // A nifty function which performs the function: @@ -340,14 +334,10 @@ int key_checkch() if ( !key_inited ) return 0; - ENTER_CRITICAL_SECTION(&key_lock); - if (key_data.keytail != key_data.keyhead){ is_one_waiting = 1; } - LEAVE_CRITICAL_SECTION(&key_lock); - return is_one_waiting; } @@ -446,8 +436,6 @@ float key_down_timef(int keycode) if (scancode == SDL_SCANCODE_UNKNOWN) return 0.0f; - ENTER_CRITICAL_SECTION(&key_lock); - time = timer_get_milliseconds(); delta_time = time - key_data.TimeKeyDownChecked[scancode]; key_data.TimeKeyDownChecked[scancode] = time; @@ -455,10 +443,8 @@ float key_down_timef(int keycode) if ( delta_time <= 1 ) { key_data.TimeKeyWentDown[scancode] = time; if (keyd_pressed[scancode]) { - LEAVE_CRITICAL_SECTION(&key_lock); return 1.0f; } else { - LEAVE_CRITICAL_SECTION(&key_lock); return 0.0f; } } @@ -471,8 +457,6 @@ float key_down_timef(int keycode) key_data.TimeKeyWentDown[scancode] = time; } - LEAVE_CRITICAL_SECTION(&key_lock); - return i2fl(time_down) / i2fl(delta_time); } @@ -490,13 +474,9 @@ int key_down_count(int keycode) if (scancode == SDL_SCANCODE_UNKNOWN) return 0; - ENTER_CRITICAL_SECTION(&key_lock); - n = key_data.NumDowns[scancode]; key_data.NumDowns[scancode] = 0; - LEAVE_CRITICAL_SECTION(&key_lock); - return n; } @@ -515,13 +495,9 @@ int key_up_count(int keycode) if (scancode == SDL_SCANCODE_UNKNOWN) return 0; - ENTER_CRITICAL_SECTION(&key_lock); - n = key_data.NumUps[scancode]; key_data.NumUps[scancode] = 0; - LEAVE_CRITICAL_SECTION(&key_lock); - return n; } @@ -542,9 +518,7 @@ void key_mark(SDL_Scancode scancode, int state, ushort kmod, uint latency ) if ( !key_inited ) return; - ENTER_CRITICAL_SECTION(&key_lock); - - Assert( scancode < SDL_NUM_SCANCODES ); + SDL_assert( scancode < SDL_NUM_SCANCODES ); // ignore GUI key, we use it for specials commands if ( (scancode == SDL_SCANCODE_LGUI) || (scancode == SDL_SCANCODE_RGUI) ) { @@ -643,8 +617,6 @@ void key_mark(SDL_Scancode scancode, int state, ushort kmod, uint latency ) } } } - - LEAVE_CRITICAL_SECTION(&key_lock); } void key_close() diff --git a/src/io/keycontrol.cpp b/src/io/keycontrol.cpp index e612ad6..a8dd08f 100644 --- a/src/io/keycontrol.cpp +++ b/src/io/keycontrol.cpp @@ -32,7 +32,7 @@ * * * 47 9/09/99 11:40p Dave - * Handle an Assert() in beam code. Added supernova sounds. Play the right + * Handle an SDL_assert() in beam code. Added supernova sounds. Play the right * 2 end movies properly, based upon what the player did in the mission. * * 46 9/07/99 11:26p Andsager @@ -267,7 +267,7 @@ * * 368 4/27/98 9:03a Dave * Fixed a multiplayer sequencing bug where paused players who were in the - * options screen got an Assert when unpausing. Removed an optimiized + * options screen got an SDL_assert when unpausing. Removed an optimiized * build warning in keycontrol. * * 367 4/26/98 4:29p Lawrance @@ -697,7 +697,7 @@ void debug_cycle_targeted_ship(int delta) return; si_index = Ships[objp->instance].ship_info_index; - Assert(si_index != -1 ); + SDL_assert(si_index != -1 ); species = Ship_info[si_index].species; int sanity = 0; @@ -714,7 +714,7 @@ void debug_cycle_targeted_ship(int delta) // if it has test in the name, jump over it strcpy(name, sip->name); - _strlwr(name); + SDL_strlwr(name); if ( strstr(name,NOX("test")) != NULL ) continue; @@ -1726,8 +1726,8 @@ void game_process_cheats(int k) // don't check the new_obj itself!! if(moveup->objnum != objnum){ hit_check = &Objects[moveup->objnum]; - Assert(hit_check->type == OBJ_SHIP); - Assert(hit_check->instance >= 0); + SDL_assert(hit_check->type == OBJ_SHIP); + SDL_assert(hit_check->instance >= 0); if((hit_check->type != OBJ_SHIP) || (hit_check->instance < 0)){ continue; } @@ -1892,7 +1892,7 @@ int button_function_critical(int n, net_player *p = NULL) net_player *npl; int at_self; // flag indicating the object is local (for hud messages, etc) - Assert(n >= 0); + SDL_assert(n >= 0); // multiplayer clients should leave critical button bits alone and pass them to the server instead if ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)) { @@ -1942,7 +1942,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,shipp); } } @@ -1979,7 +1979,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -1992,7 +1992,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -2005,7 +2005,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -2018,7 +2018,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -2031,7 +2031,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -2044,7 +2044,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -2057,7 +2057,7 @@ int button_function_critical(int n, net_player *p = NULL) // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -2072,7 +2072,7 @@ int button_function_critical(int n, net_player *p = NULL) snd_play( &Snds[SND_ENERGY_TRANS] ); // multiplayer server should maintain bank/link status here if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - Assert(npl != NULL); + SDL_assert(npl != NULL); multi_server_update_player_weapons(npl,&Ships[objp->instance]); } break; @@ -2269,7 +2269,7 @@ int button_function_demo_valid(int n) // execute function corresponding to action n (BUTTON_ #define from KeyControl.h) int button_function(int n) { - Assert(n >= 0); + SDL_assert(n >= 0); if ( !button_allowed(n) ) { return 0; @@ -2294,7 +2294,7 @@ int button_function(int n) shipp->weapons.next_primary_fire_stamp[shipp->weapons.current_primary_bank] = timestamp(250); // 1/4 second delay until can fire // multiplayer server should maintain bank/link status here // if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ -// Assert(npl != NULL); +// SDL_assert(npl != NULL); // multi_server_update_player_weapons(npl,shipp); // } } @@ -2314,7 +2314,7 @@ int button_function(int n) // multiplayer server should maintain bank/link status here // if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ - // Assert(npl != NULL); + // SDL_assert(npl != NULL); // multi_server_update_player_weapons(npl,shipp); // } } diff --git a/src/io/mouse.cpp b/src/io/mouse.cpp index 7bf6529..ba55916 100644 --- a/src/io/mouse.cpp +++ b/src/io/mouse.cpp @@ -361,7 +361,7 @@ int mouse_up_count(int n) break; default: - Assert(0); // can't happen + SDL_assert(0); // can't happen break; } // end switch diff --git a/src/io/timer.cpp b/src/io/timer.cpp index ca358c8..c27e7b8 100644 --- a/src/io/timer.cpp +++ b/src/io/timer.cpp @@ -275,7 +275,7 @@ int timing_event_lookup(char *event_name) // look through all events for(idx=0; idxignore_objnum = -1; l->affected_objnum = -1; - Assert( Num_light_levels <= 1 ); + SDL_assert( Num_light_levels <= 1 ); // Relevent_lights[Num_relevent_lights[Num_light_levels-1]++][Num_light_levels-1] = l; if(Static_light_count < MAX_STATIC_LIGHTS){ @@ -428,7 +428,7 @@ void light_add_point( vector * pos, float rad1, float rad2, float intensity, flo l->ignore_objnum = ignore_objnum; l->affected_objnum = -1; - Assert( Num_light_levels <= 1 ); + SDL_assert( Num_light_levels <= 1 ); // Relevent_lights[Num_relevent_lights[Num_light_levels-1]++][Num_light_levels-1] = l; } @@ -462,7 +462,7 @@ void light_add_point_unique( vector * pos, float rad1, float rad2, float intensi l->ignore_objnum = -1; l->affected_objnum = affected_objnum; - Assert( Num_light_levels <= 1 ); + SDL_assert( Num_light_levels <= 1 ); } // for now, tube lights only affect one ship (to keep the filter stuff simple) @@ -497,7 +497,7 @@ void light_add_tube(vector *p0, vector *p1, float r1, float r2, float intensity, l->ignore_objnum = -1; l->affected_objnum = affected_objnum; - Assert( Num_light_levels <= 1 ); + SDL_assert( Num_light_levels <= 1 ); } // Reset the list of lights to point to all lights. @@ -535,7 +535,7 @@ int light_filter_push( int objnum, vector *pos, float rad ) n1 = Num_light_levels-1; n2 = Num_light_levels; Num_light_levels++; - Assert( Num_light_levels < MAX_LIGHT_LEVELS ); + SDL_assert( Num_light_levels < MAX_LIGHT_LEVELS ); Num_relevent_lights[n2] = 0; @@ -635,7 +635,7 @@ int light_filter_push_box( vector *min, vector *max ) // mprintf(( "Max level = %d\n", mll )); // } - Assert( Num_light_levels < MAX_LIGHT_LEVELS ); + SDL_assert( Num_light_levels < MAX_LIGHT_LEVELS ); Num_relevent_lights[n2] = 0; @@ -674,7 +674,7 @@ void light_filter_pop() if ( Lighting_off ) return; Num_light_levels--; - Assert( Num_light_levels > 0 ); + SDL_assert( Num_light_levels > 0 ); } int l_num_points=0, l_num_lights=0; diff --git a/src/localization/fhash.cpp b/src/localization/fhash.cpp index a7de862..bf8c6fa 100644 --- a/src/localization/fhash.cpp +++ b/src/localization/fhash.cpp @@ -131,13 +131,13 @@ void fhash_add_str(char *str, int id) int hash_index; // if the hash table isn't active, don't bother - Assert(Fhash_active); + SDL_assert(Fhash_active); if(!Fhash_active){ return; } // determine where the string goes in the has table - Assert(str != NULL); + SDL_assert(str != NULL); if(str == NULL){ return; } @@ -154,7 +154,7 @@ int fhash_string_exists(char *str) int hash_index; fhash_node *moveup; - Assert(str != NULL); + SDL_assert(str != NULL); if(str == NULL){ return -2; } @@ -171,7 +171,7 @@ int fhash_string_exists(char *str) moveup = Hash_table_fred[hash_index]; while(moveup != NULL){ // do a string compare on this item - Assert(moveup->str != NULL); + SDL_assert(moveup->str != NULL); if(moveup->str != NULL){ if(!strcmp(moveup->str, str)){ return moveup->id; @@ -216,7 +216,7 @@ void fhash_insert(char *str, int id, int n) // allocate the new node new_node = (fhash_node*)malloc(sizeof(fhash_node)); - Assert(new_node); + SDL_assert(new_node); if(new_node == NULL){ return; } diff --git a/src/localization/localize.cpp b/src/localization/localize.cpp index 3ddc942..8ebd205 100644 --- a/src/localization/localize.cpp +++ b/src/localization/localize.cpp @@ -483,7 +483,7 @@ void lcl_init(int lang_init) // look it up lang = -1; for(idx=0; idx= 0) && (lang_init < LCL_NUM_LANGUAGES)); + SDL_assert((lang_init >= 0) && (lang_init < LCL_NUM_LANGUAGES)); lang = lang_init; } @@ -582,7 +582,7 @@ void lcl_xstr_init() // trim unneccesary end of string if (i >= 0) { - // Assert(buf[i] == '"'); + // SDL_assert(buf[i] == '"'); if (buf[i] != '"') { // probably an offset on this entry buf[i+1] = 0; // drop down a null terminator (prolly unnecessary) @@ -658,8 +658,8 @@ void lcl_xstr_init() #else int i; - Assert(XSTR_SIZE == LCL_NUM_STRINGS_FS1); - Assert(Lcl_current_lang < LCL_NUM_LANGUAGES_FS1); + SDL_assert(XSTR_SIZE == LCL_NUM_STRINGS_FS1); + SDL_assert(Lcl_current_lang < LCL_NUM_LANGUAGES_FS1); for (i=0; i max_len){ error_display(0, "Token too long: [%s]. Length = %i. Max is %i.\n", in, str_len, max_len); @@ -916,7 +916,7 @@ void lcl_ext_localize(char *in, char *out, int max_len, int *id) // attempt to find the string if(lcl_ext_lookup(lookup_str, str_id)){ // copy to the outgoing string - Assert(strlen(lookup_str) <= (unsigned int)(max_len - 1)); + SDL_assert(strlen(lookup_str) <= (unsigned int)(max_len - 1)); if (strlen(lookup_str) > (unsigned int)(max_len-1)) { // be safe and truncate string to fit @@ -992,8 +992,8 @@ int lcl_ext_get_text(char *xstr, char *out) int str_len; char *p, *p2; - Assert(xstr != NULL); - Assert(out != NULL); + SDL_assert(xstr != NULL); + SDL_assert(out != NULL); str_len = strlen(xstr); // this is some crazy wack-ass code. @@ -1038,8 +1038,8 @@ int lcl_ext_get_id(char *xstr, int *out) char *p, *pnext; int str_len; - Assert(xstr != NULL); - Assert(out != NULL); + SDL_assert(xstr != NULL); + SDL_assert(out != NULL); str_len = strlen(xstr); @@ -1109,11 +1109,11 @@ int lcl_ext_lookup(char *out, int id) int ret; int pointer; - Assert(Lcl_pointer_count >= 0); - Assert(Lcl_pointers[0] >= 0); - Assert(Lcl_pointers[Lcl_pointer_count - 1] >= 0); - Assert(Lcl_ext_file != NULL); - Assert(id >= 0); + SDL_assert(Lcl_pointer_count >= 0); + SDL_assert(Lcl_pointers[0] >= 0); + SDL_assert(Lcl_pointers[Lcl_pointer_count - 1] >= 0); + SDL_assert(Lcl_ext_file != NULL); + SDL_assert(id >= 0); // seek to the closest pointer <= the id# we're looking for pointer = id / LCL_GRANULARITY; @@ -1186,7 +1186,7 @@ int lcl_ext_lookup_sub(char *text, char *out, int id) // if the first word is #end, we're done with the file altogether strcpy(text_copy, text); tok = strtok(text_copy, " \n"); - if((tok != NULL) && !stricmp(tok, "#end")){ + if((tok != NULL) && !SDL_strcasecmp(tok, "#end")){ return 3; } // if its a commented line, skip it @@ -1306,7 +1306,7 @@ void lcl_ext_setup_pointers() // seek to the currently active language memset(language_string, 0, 128); strcpy(language_string, "#"); - if(!stricmp(DEFAULT_LANGUAGE, Lcl_languages[Lcl_current_lang].lang_name)){ + if(!SDL_strcasecmp(DEFAULT_LANGUAGE, Lcl_languages[Lcl_current_lang].lang_name)){ strcat(language_string, "default"); } else { strcat(language_string, Lcl_languages[Lcl_current_lang].lang_name); @@ -1322,7 +1322,7 @@ void lcl_ext_setup_pointers() } // if the language matches, we're good to start parsing strings - if(!stricmp(language_string, tok)){ + if(!SDL_strcasecmp(language_string, tok)){ found_start = 1; break; } @@ -1380,7 +1380,7 @@ void lcl_ext_setup_pointers() void lcl_get_language_name(char *lang_name) { - Assert(LCL_NUM_LANGUAGES == 3); + SDL_assert(LCL_NUM_LANGUAGES == 3); strcpy(lang_name, Lcl_languages[Lcl_current_lang].lang_name); } @@ -1512,64 +1512,64 @@ void lcl_translate_brief_icon_name(char *name) char *pos; char buf[128]; - if (!stricmp(name, "Subspace Portal")) { + if (!SDL_strcasecmp(name, "Subspace Portal")) { strcpy(name, "Subraum Portal"); - } else if (!stricmp(name, "Alpha Wing")) { + } else if (!SDL_strcasecmp(name, "Alpha Wing")) { strcpy(name, "Alpha"); - } else if (!stricmp(name, "Beta Wing")) { + } else if (!SDL_strcasecmp(name, "Beta Wing")) { strcpy(name, "Beta"); - } else if (!stricmp(name, "Zeta Wing")) { + } else if (!SDL_strcasecmp(name, "Zeta Wing")) { strcpy(name, "Zeta"); - } else if (!stricmp(name, "Capella Node")) { + } else if (!SDL_strcasecmp(name, "Capella Node")) { strcpy(name, "Capella"); - } else if (!stricmp(name, "Hostile")) { + } else if (!SDL_strcasecmp(name, "Hostile")) { strcpy(name, "Gegner"); - } else if (!stricmp(name, "Hostile Craft")) { + } else if (!SDL_strcasecmp(name, "Hostile Craft")) { strcpy(name, "Gegner"); - } else if (!stricmp(name, "Rebel Wing")) { + } else if (!SDL_strcasecmp(name, "Rebel Wing")) { strcpy(name, "Rebellen"); - } else if (!stricmp(name, "Rebel Fleet")) { + } else if (!SDL_strcasecmp(name, "Rebel Fleet")) { strcpy(name, "Rebellenflotte"); - } else if (!stricmp(name, "Sentry Gun")) { + } else if (!SDL_strcasecmp(name, "Sentry Gun")) { strcpy(name, "Gesch\x81tz"); - } else if (!stricmp(name, "Cargo")) { + } else if (!SDL_strcasecmp(name, "Cargo")) { strcpy(name, "Fracht"); - } else if (!stricmp(name, "Knossos Device")) { + } else if (!SDL_strcasecmp(name, "Knossos Device")) { strcpy(name, "Knossosger\x84t"); - } else if (!stricmp(name, "Support")) { + } else if (!SDL_strcasecmp(name, "Support")) { strcpy(name, "Versorger"); - } else if (!stricmp(name, "Unknown")) { + } else if (!SDL_strcasecmp(name, "Unknown")) { strcpy(name, "Unbekannt"); - } else if (!stricmp(name, "Instructor")) { + } else if (!SDL_strcasecmp(name, "Instructor")) { strcpy(name, "Ausbilder"); - } else if (!stricmp(name, "Jump Node")) { + } else if (!SDL_strcasecmp(name, "Jump Node")) { strcpy(name, "Sprungknoten"); - } else if (!stricmp(name, "Escort")) { + } else if (!SDL_strcasecmp(name, "Escort")) { strcpy(name, "Geleitschutz"); - } else if (!stricmp(name, "Asteroid Field")) { + } else if (!SDL_strcasecmp(name, "Asteroid Field")) { strcpy(name, "Asteroidenfeld"); - } else if (!stricmp(name, "Enif Station")) { + } else if (!SDL_strcasecmp(name, "Enif Station")) { strcpy(name, "Station Enif"); - } else if (!stricmp(name, "Rally Point")) { + } else if (!SDL_strcasecmp(name, "Rally Point")) { strcpy(name, "Sammelpunkt"); } else if ((pos = strstr(name, "Transport")) != NULL) { @@ -1584,66 +1584,66 @@ void lcl_translate_brief_icon_name(char *name) strcat(buf, pos); strcpy(name, buf); - } else if (!stricmp(name, "Orion under repair")) { + } else if (!SDL_strcasecmp(name, "Orion under repair")) { strcpy(name, "Orion wird repariert"); // SOTY-specific ones below! - } else if (!stricmp(name, "Wayfarer Station")) { + } else if (!SDL_strcasecmp(name, "Wayfarer Station")) { strcpy(name, "Station Wayfarer"); - } else if (!stricmp(name, "Enemy")) { + } else if (!SDL_strcasecmp(name, "Enemy")) { strcpy(name, "Gegner"); - } else if (!stricmp(name, "Supply Depot")) { + } else if (!SDL_strcasecmp(name, "Supply Depot")) { strcpy(name, "Nachschubdepot"); - } else if (!stricmp(name, "Fighter Escort")) { + } else if (!SDL_strcasecmp(name, "Fighter Escort")) { strcpy(name, "Jagdschutz"); - } else if (!stricmp(name, "Shivans")) { + } else if (!SDL_strcasecmp(name, "Shivans")) { strcpy(name, "Shivaner"); - } else if (!stricmp(name, "NTF Base of Operations")) { + } else if (!SDL_strcasecmp(name, "NTF Base of Operations")) { strcpy(name, "NTF-Operationsbasis"); - } else if (!stricmp(name, "NTF Bombers")) { + } else if (!SDL_strcasecmp(name, "NTF Bombers")) { strcpy(name, "NTF-Bomber"); - } else if (!stricmp(name, "NTF Fighters")) { + } else if (!SDL_strcasecmp(name, "NTF Fighters")) { strcpy(name, "NTF-J\x84ger"); - } else if (!stricmp(name, "Sentry")) { + } else if (!SDL_strcasecmp(name, "Sentry")) { strcpy(name, "Sperrgesch\x81tz"); - } else if (!stricmp(name, "Cargo Containers")) { + } else if (!SDL_strcasecmp(name, "Cargo Containers")) { strcpy(name, "Frachtbeh\x84lter"); - } else if (!stricmp(name, "NTF Reinforcements")) { + } else if (!SDL_strcasecmp(name, "NTF Reinforcements")) { strcpy(name, "NTF-Verst\x84rkungen"); - } else if (!stricmp(name, "NTF Base")) { + } else if (!SDL_strcasecmp(name, "NTF Base")) { strcpy(name, "NTF-St\x81tzpunkt"); - } else if (!stricmp(name, "Refugee Convoy")) { + } else if (!SDL_strcasecmp(name, "Refugee Convoy")) { strcpy(name, "Fl\x81""chtlingskonvoi"); - } else if (!stricmp(name, "Food Convoy")) { + } else if (!SDL_strcasecmp(name, "Food Convoy")) { strcpy(name, "Nachschubkonvoi"); - } else if (!stricmp(name, "Governor's Shuttle")) { + } else if (!SDL_strcasecmp(name, "Governor's Shuttle")) { strcpy(name, "F\x84hre des Gouverneurs"); - } else if (!stricmp(name, "GTVA Patrol")) { + } else if (!SDL_strcasecmp(name, "GTVA Patrol")) { strcpy(name, "GTVA-Patrouille"); - } else if (!stricmp(name, "Escort fighters")) { + } else if (!SDL_strcasecmp(name, "Escort fighters")) { strcpy(name, "Geleitschutz"); - } else if (!stricmp(name, "Nagada Outpost")) { + } else if (!SDL_strcasecmp(name, "Nagada Outpost")) { strcpy(name, "Nagada-Aussenposten"); - } else if (!stricmp(name, "Fighters")) { + } else if (!SDL_strcasecmp(name, "Fighters")) { strcpy(name, "J\x84ger"); - } else if (!stricmp(name, "Bombers")) { + } else if (!SDL_strcasecmp(name, "Bombers")) { strcpy(name, "Bomber"); - } else if (!stricmp(name, "Enemy Destroyers")) { + } else if (!SDL_strcasecmp(name, "Enemy Destroyers")) { strcpy(name, "Feindliche Zerst\x94rer"); - } else if (!stricmp(name, "Ross 128 System")) { + } else if (!SDL_strcasecmp(name, "Ross 128 System")) { strcpy(name, "System Ross 128"); - } else if (!stricmp(name, "Knossos Station")) { + } else if (!SDL_strcasecmp(name, "Knossos Station")) { strcpy(name, "Knossos-Station"); - } else if (!stricmp(name, "Transporters")) { + } else if (!SDL_strcasecmp(name, "Transporters")) { strcpy(name, "Transporter"); - } else if (!stricmp(name, "Pirates?")) { + } else if (!SDL_strcasecmp(name, "Pirates?")) { strcpy(name, "Piraten?"); - } else if (!stricmp(name, "Escorts")) { + } else if (!SDL_strcasecmp(name, "Escorts")) { strcpy(name, "Geleitschutz"); - } else if (!stricmp(name, "Shivan Fighters")) { + } else if (!SDL_strcasecmp(name, "Shivan Fighters")) { strcpy(name, "J\x84ger"); - } else if (!stricmp(name, "Shivan Territory")) { + } else if (!SDL_strcasecmp(name, "Shivan Territory")) { strcpy(name, "Shivaner"); } } @@ -1659,64 +1659,64 @@ void lcl_translate_brief_icon_name_pl(char *name) char *pos; char buf[128]; - if (!stricmp(name, "Subspace Portal")) { + if (!SDL_strcasecmp(name, "Subspace Portal")) { strcpy(name, "Portal podprz."); - } else if (!stricmp(name, "Alpha Wing")) { + } else if (!SDL_strcasecmp(name, "Alpha Wing")) { strcpy(name, "Alfa"); - } else if (!stricmp(name, "Beta Wing")) { + } else if (!SDL_strcasecmp(name, "Beta Wing")) { strcpy(name, "Beta"); - } else if (!stricmp(name, "Zeta Wing")) { + } else if (!SDL_strcasecmp(name, "Zeta Wing")) { strcpy(name, "Zeta"); - } else if (!stricmp(name, "Capella Node")) { + } else if (!SDL_strcasecmp(name, "Capella Node")) { strcpy(name, "Capella"); - } else if (!stricmp(name, "Hostile")) { + } else if (!SDL_strcasecmp(name, "Hostile")) { strcpy(name, "Wr\xF3g"); - } else if (!stricmp(name, "Hostile Craft")) { + } else if (!SDL_strcasecmp(name, "Hostile Craft")) { strcpy(name, "Wr\xF3g"); - } else if (!stricmp(name, "Rebel Wing")) { + } else if (!SDL_strcasecmp(name, "Rebel Wing")) { strcpy(name, "Rebelianci"); - } else if (!stricmp(name, "Rebel Fleet")) { + } else if (!SDL_strcasecmp(name, "Rebel Fleet")) { strcpy(name, "Flota Rebelii"); - } else if (!stricmp(name, "Sentry Gun")) { + } else if (!SDL_strcasecmp(name, "Sentry Gun")) { strcpy(name, "Dzia\xB3o str."); - } else if (!stricmp(name, "Cargo")) { + } else if (!SDL_strcasecmp(name, "Cargo")) { strcpy(name, "\xA3\x61\x64unek"); - } else if (!stricmp(name, "Knossos Device")) { + } else if (!SDL_strcasecmp(name, "Knossos Device")) { strcpy(name, "Urz. Knossos"); - } else if (!stricmp(name, "Support")) { + } else if (!SDL_strcasecmp(name, "Support")) { strcpy(name, "Wsparcie"); - } else if (!stricmp(name, "Unknown")) { + } else if (!SDL_strcasecmp(name, "Unknown")) { strcpy(name, "Nieznany"); - } else if (!stricmp(name, "Instructor")) { + } else if (!SDL_strcasecmp(name, "Instructor")) { strcpy(name, "Instruktor"); - } else if (!stricmp(name, "Jump Node")) { + } else if (!SDL_strcasecmp(name, "Jump Node")) { strcpy(name, "W\xEAze\xB3 skokowy"); - } else if (!stricmp(name, "Escort")) { + } else if (!SDL_strcasecmp(name, "Escort")) { strcpy(name, "Eskorta"); - } else if (!stricmp(name, "Asteroid Field")) { + } else if (!SDL_strcasecmp(name, "Asteroid Field")) { strcpy(name, "Pole asteroid"); - } else if (!stricmp(name, "Enif Station")) { + } else if (!SDL_strcasecmp(name, "Enif Station")) { strcpy(name, "Stacja Enif"); - } else if (!stricmp(name, "Rally Point")) { + } else if (!SDL_strcasecmp(name, "Rally Point")) { strcpy(name, "Pkt zborny"); } else if ((pos = strstr(name, "Transport")) != NULL) { @@ -1731,7 +1731,7 @@ void lcl_translate_brief_icon_name_pl(char *name) strcat(buf, pos); strcpy(name, buf); - } else if (!stricmp(name, "Orion under repair")) { + } else if (!SDL_strcasecmp(name, "Orion under repair")) { strcpy(name, "Naprawiany Orion"); } } @@ -1790,13 +1790,13 @@ void lcl_translate_targetbox_name(char *name) strcat(buf, pos); strcpy(name, buf); - } else if (!stricmp(name, "Instructor")) { + } else if (!SDL_strcasecmp(name, "Instructor")) { strcpy(name, "Ausbilder"); - } else if (!stricmp(name, "NTF Vessel")) { + } else if (!SDL_strcasecmp(name, "NTF Vessel")) { strcpy(name, "NTF-Schiff"); - } else if (!stricmp(name, "Enif Station")) { + } else if (!SDL_strcasecmp(name, "Enif Station")) { strcpy(name, "Station Enif"); } } @@ -1842,13 +1842,13 @@ void lcl_translate_targetbox_name_pl(char *name) strcat(buf, pos); strcpy(name, buf); - } else if (!stricmp(name, "Instructor")) { + } else if (!SDL_strcasecmp(name, "Instructor")) { strcpy(name, "Instruktor"); - } else if (!stricmp(name, "NTF Vessel")) { + } else if (!SDL_strcasecmp(name, "NTF Vessel")) { strcpy(name, "Okr\xEAt NTF"); - } else if (!stricmp(name, "Enif Station")) { + } else if (!SDL_strcasecmp(name, "Enif Station")) { strcpy(name, "Stacja Enif"); } } diff --git a/src/math/fix.cpp b/src/math/fix.cpp index c79b54f..20b0396 100644 --- a/src/math/fix.cpp +++ b/src/math/fix.cpp @@ -47,18 +47,18 @@ fix fixmul(fix a, fix b) { - longlong tmp; - tmp = (longlong)a * (longlong)b; + Sint64 tmp; + tmp = (Sint64)a * (Sint64)b; return (fix)(tmp>>16); } fix fixdiv(fix a, fix b) { - return MulDiv(a,65536,b); + return mul_div(a,65536,b); } fix fixmuldiv(fix a, fix b,fix c) { - return MulDiv(a,b,c); + return mul_div(a,b,c); } diff --git a/src/math/fvi.cpp b/src/math/fvi.cpp index f860809..1df99da 100644 --- a/src/math/fvi.cpp +++ b/src/math/fvi.cpp @@ -359,7 +359,7 @@ int fvi_segment_sphere(vector *intp,vector *p0,vector *p1,vector *sphere_pos,flo // { // fix dd = vm_vec_dist(intp,sphere_pos); -// Assert(dd == sphere_rad); +// SDL_assert(dd == sphere_rad); // mprintf(0,"dd=%x, rad=%x, delta=%x\n",dd,sphere_rad,dd-sphere_rad); // } @@ -432,7 +432,7 @@ int fvi_ray_sphere(vector *intp,vector *p0,vector *p1,vector *sphere_pos,float s // { // fix dd = vm_vec_dist(intp,sphere_pos); -// Assert(dd == sphere_rad); +// SDL_assert(dd == sphere_rad); // mprintf(0,"dd=%x, rad=%x, delta=%x\n",dd,sphere_rad,dd-sphere_rad); // } @@ -601,7 +601,7 @@ int fvi_point_face(vector *checkp, int nv, vector **verts, vector * norm1, float beta = (v0*u1 - u0*v1) / (v2*u1 - u2*v1); if ((beta >=0.0f) && (beta<=1.0f)) { - Assert(beta != UNINITIALIZED_VALUE); + SDL_assert(beta != UNINITIALIZED_VALUE); alpha = (u0 - beta*u2)/u1; inter = ((alpha>=0.0f)&&(alpha+beta<=1.0f)); } @@ -631,7 +631,7 @@ int fvi_point_face(vector *checkp, int nv, vector **verts, vector * norm1, float } while ((!inter) && (++i < nv) ); if ( inter && uvls && u_out && v_out ) { - // Assert(alpha != 1.0f); + // SDL_assert(alpha != 1.0f); gamma = 1.0f - (alpha+beta); *u_out = gamma * uvls[0].u + alpha*uvls[i-1].u + beta*uvls[i].u; *v_out = gamma * uvls[0].v + alpha*uvls[i-1].v + beta*uvls[i].v; @@ -750,13 +750,13 @@ int fvi_sphere_perp_edge(vector *intersect_point, vector *sphere_center_start, v vector temp; // next two temp should be same as starting velocities vm_vec_projection_onto_plane(&temp, sphere_velocity, &z_hat); - Assert ( !vm_vec_cmp(&temp, sphere_velocity) ); + SDL_assert ( !vm_vec_cmp(&temp, sphere_velocity) ); vm_vec_projection_onto_plane(&temp, &edge_velocity, &z_hat); - Assert ( !vm_vec_cmp(&temp, &edge_velocity) ); + SDL_assert ( !vm_vec_cmp(&temp, &edge_velocity) ); // should return V0 vm_project_point_onto_plane(&Xe_proj, &V0, &z_hat, &V0); - Assert ( !vm_vec_cmp(&Xe_proj, &V0) ); + SDL_assert ( !vm_vec_cmp(&Xe_proj, &V0) ); vm_project_point_onto_plane(&Xs_proj, sphere_center_start, &z_hat, &V0); @@ -993,7 +993,7 @@ int fvi_polyedge_sphereline(vector *hit_point, vector *xs0, vector *vs, float Rs first_valid_sphere_time = 0.0f; } else { first_valid_sphere_time = time_sm; - Assert( time_sm <= 1.0f ); + SDL_assert( time_sm <= 1.0f ); } if (ve_dot_vs > 0) { @@ -1293,19 +1293,19 @@ TryVertex: // set hitpoint to closest vetex hit, if any if ( v0_hit ) { - Assert(sphere_v0 != UNINITIALIZED_VALUE); + SDL_assert(sphere_v0 != UNINITIALIZED_VALUE); t_sphere_hit = sphere_v0; temp_edge_hit = v0; if (v1_hit) { - Assert(sphere_v1 != UNINITIALIZED_VALUE); + SDL_assert(sphere_v1 != UNINITIALIZED_VALUE); if (sphere_v1 < sphere_v0) { t_sphere_hit = sphere_v1; temp_edge_hit = v1; } } } else if ( v1_hit ) { - Assert(sphere_v1 != UNINITIALIZED_VALUE); + SDL_assert(sphere_v1 != UNINITIALIZED_VALUE); t_sphere_hit = sphere_v1; temp_edge_hit = v1; } else { @@ -1394,7 +1394,7 @@ int fvi_check_sphere_sphere(vector *x_p0, vector *x_p1, vector *x_s0, vector *x_ float time1, time2; // Check that there are either 0 or 2 pointers to time - Assert( (!(t1) && !(t2)) || (t1 && t2) ); + SDL_assert( (!(t1) && !(t2)) || (t1 && t2) ); vm_vec_sub(&delta_x, x_s0, x_p0); delta_x_sqr = vm_vec_mag_squared(&delta_x); diff --git a/src/math/spline.cpp b/src/math/spline.cpp index 29b7f5d..b71e4e1 100644 --- a/src/math/spline.cpp +++ b/src/math/spline.cpp @@ -94,7 +94,7 @@ void bez_spline::bez_set_points(int _num_pts, vector *_pts[MAX_BEZ_PTS]) // store the points num_pts = _num_pts; for(idx=0; idx<_num_pts; idx++){ - Assert(_pts[idx] != NULL); + SDL_assert(_pts[idx] != NULL); if(_pts[idx] != NULL){ pts[idx] = *_pts[idx]; } @@ -118,7 +118,7 @@ void bez_spline::bez_get_point(vector *out, float u) int idx; float bez_val; - Assert(out != NULL); + SDL_assert(out != NULL); if(out == NULL){ return; } @@ -212,11 +212,11 @@ void herm_spline::herm_set_points(int _num_pts, vector *_pts[MAX_HERM_PTS], vect // store the points num_pts = _num_pts; for(idx=0; idx<_num_pts; idx++){ - Assert(_pts[idx] != NULL); + SDL_assert(_pts[idx] != NULL); if(_pts[idx] != NULL){ pts[idx] = *_pts[idx]; } - Assert(_d_pts[idx] != NULL); + SDL_assert(_d_pts[idx] != NULL); if(_d_pts[idx] != NULL){ d_pts[idx] = *_d_pts[idx]; } diff --git a/src/math/vecmat.cpp b/src/math/vecmat.cpp index 4da2317..ae54e77 100644 --- a/src/math/vecmat.cpp +++ b/src/math/vecmat.cpp @@ -16,7 +16,7 @@ * * $Log$ * Revision 1.7 2005/10/01 21:45:56 taylor - * fix an old Volition math bug, causes various Assert()'s and physics strangeness in some missions + * fix an old Volition math bug, causes various SDL_assert()'s and physics strangeness in some missions * * Revision 1.6 2004/09/20 01:31:44 theoddone33 * GCC 3.4 fixes. @@ -301,7 +301,7 @@ float atan2_safe(float y, float x) float vm_vec_projection_parallel(vector *component, vector *src, vector *unit_vec) { float mag; - Assert( vm_vec_mag(unit_vec) > 0.999f && vm_vec_mag(unit_vec) < 1.001f ); + SDL_assert( vm_vec_mag(unit_vec) > 0.999f && vm_vec_mag(unit_vec) < 1.001f ); mag = vm_vec_dotprod(src, unit_vec); vm_vec_copy_scale(component, unit_vec, mag); @@ -316,7 +316,7 @@ float vm_vec_projection_parallel(vector *component, vector *src, vector *unit_ve void vm_vec_projection_onto_plane(vector *projection, vector *src, vector *unit_normal) { float mag; - Assert( vm_vec_mag(unit_normal) > 0.999f && vm_vec_mag(unit_normal) < 1.001f ); + SDL_assert( vm_vec_mag(unit_normal) > 0.999f && vm_vec_mag(unit_normal) < 1.001f ); mag = vm_vec_dotprod(src, unit_normal); *projection = *src; @@ -333,7 +333,7 @@ void vm_project_point_onto_plane(vector *new_point, vector *point, vector *plane { float D; // plane constant in Ax+By+Cz+D = 0 or dot(X,n) - dot(Xp,n) = 0, so D = -dot(Xp,n) float dist; - Assert( vm_vec_mag(plane_normal) > 0.999f && vm_vec_mag(plane_normal) < 1.001f ); + SDL_assert( vm_vec_mag(plane_normal) > 0.999f && vm_vec_mag(plane_normal) < 1.001f ); D = -vm_vec_dotprod(plane_point, plane_normal); dist = vm_vec_dotprod(point, plane_normal) + D; @@ -692,7 +692,7 @@ float vm_vec_copy_normalize_quick(vector *dest,vector *src) im = vm_vec_imag(src); - Assert(im > 0.0f); + SDL_assert(im > 0.0f); dest->xyz.x = src->xyz.x*im; dest->xyz.y = src->xyz.y*im; @@ -710,7 +710,7 @@ float vm_vec_normalize_quick(vector *src) im = vm_vec_imag(src); - Assert(im > 0.0f); + SDL_assert(im > 0.0f); src->xyz.x = src->xyz.x*im; src->xyz.y = src->xyz.y*im; @@ -729,7 +729,7 @@ float vm_vec_copy_normalize_quick_mag(vector *dest,vector *src) m = vm_vec_mag_quick(src); - Assert(m > 0.0f); + SDL_assert(m > 0.0f); float im = 1.0f / m; @@ -749,7 +749,7 @@ float vm_vec_normalize_quick_mag(vector *v) m = vm_vec_mag_quick(v); - Assert(m > 0.0f); + SDL_assert(m > 0.0f); v->xyz.x = v->xyz.x*m; v->xyz.y = v->xyz.y*m; @@ -985,11 +985,11 @@ matrix *vm_vector_2_matrix(matrix *m,vector *fvec,vector *uvec,vector *rvec) vector *xvec=&m->v.rvec,*yvec=&m->v.uvec,*zvec=&m->v.fvec; - Assert(fvec != NULL); + SDL_assert(fvec != NULL); // This had been commented out, but that's bogus. Code below relies on a valid zvec. if (vm_vec_copy_normalize(zvec,fvec) == 0.0) { - Assert(0); + SDL_assert(0); return m; } @@ -1060,7 +1060,7 @@ matrix *vm_vector_2_matrix_norm(matrix *m,vector *fvec,vector *uvec,vector *rvec vector *xvec=&m->v.rvec,*yvec=&m->v.uvec,*zvec=&m->v.fvec; - Assert(fvec != NULL); + SDL_assert(fvec != NULL); *zvec = *fvec; @@ -1172,7 +1172,7 @@ matrix *vm_transpose_matrix(matrix *m) matrix *vm_copy_transpose_matrix(matrix *dest,matrix *src) { - Assert(dest != src); + SDL_assert(dest != src); dest->v.rvec.xyz.x = src->v.rvec.xyz.x; dest->v.rvec.xyz.y = src->v.uvec.xyz.x; @@ -1195,7 +1195,7 @@ matrix *vm_copy_transpose_matrix(matrix *dest,matrix *src) matrix *vm_matrix_x_matrix(matrix *dest,matrix *src0,matrix *src1) { - Assert(dest!=src0 && dest!=src1); + SDL_assert(dest!=src0 && dest!=src1); dest->v.rvec.xyz.x = vm_vec_dot3(src0->v.rvec.xyz.x,src0->v.uvec.xyz.x,src0->v.fvec.xyz.x, &src1->v.rvec); dest->v.uvec.xyz.x = vm_vec_dot3(src0->v.rvec.xyz.x,src0->v.uvec.xyz.x,src0->v.fvec.xyz.x, &src1->v.uvec); @@ -1752,7 +1752,7 @@ void vm_matrix_to_rot_axis_and_angle(matrix *m, float *theta, vector *rot_axis) (void) vm_vec_make(rot_axis, 1.0f, 0.0f, 0.0f); } else if (cos_theta > -0.999999875f) { // angle is within limits between 0 and PI *theta = float(acos(cos_theta)); - Assert(!_isnan(*theta)); + SDL_assert(!_isnan(*theta)); rot_axis->xyz.x = (m->v.uvec.xyz.z - m->v.fvec.xyz.y); rot_axis->xyz.y = (m->v.fvec.xyz.x - m->v.rvec.xyz.z); @@ -1825,8 +1825,8 @@ float away(float w_in, float w_max, float theta_goal, float aa, float delta_t, f float approach(float w_in, float w_max, float theta_goal, float aa, float delta_t, float *w_out, int no_overshoot) { float delta_theta; // amount rotated during time delta_t - Assert(w_in >= 0); - Assert(theta_goal > 0); + SDL_assert(w_in >= 0); + SDL_assert(theta_goal > 0); float effective_aa; if (aa == 0) { @@ -1846,7 +1846,7 @@ float approach(float w_in, float w_max, float theta_goal, float aa, float delta_ if (delta_theta > theta_goal) { // pass goal during this frame float t_goal = (-w_in + fl_sqrt(w_in*w_in +2.0f*effective_aa*theta_goal)) / effective_aa; // get time to theta_goal and away - Assert(t_goal < delta_t); + SDL_assert(t_goal < delta_t); w_in -= effective_aa*t_goal; delta_theta = w_in*t_goal + 0.5f*effective_aa*t_goal*t_goal; delta_theta -= away(-w_in, w_max, 0.0f, aa, delta_t - t_goal, w_out, no_overshoot); @@ -1866,7 +1866,7 @@ float approach(float w_in, float w_max, float theta_goal, float aa, float delta_ } else if (w_in*w_in < 2.0f*0.95f*aa*theta_goal) { // undershoot condition // find peak angular velocity float wp_sqr = fl_abs(aa*theta_goal + 0.5f*w_in*w_in); - Assert(wp_sqr >= 0); + SDL_assert(wp_sqr >= 0); if (wp_sqr > w_max*w_max) { float time_to_w_max = (w_max - w_in) / aa; @@ -1902,7 +1902,7 @@ float approach(float w_in, float w_max, float theta_goal, float aa, float delta_ // reaches wp this frame float wp = fl_sqrt(wp_sqr); float time_to_wp = (wp - w_in) / aa; - Assert(time_to_wp > 0); + SDL_assert(time_to_wp > 0); // accel *w_out = wp; @@ -1929,7 +1929,7 @@ float approach(float w_in, float w_max, float theta_goal, float aa, float delta_ } else { // move toward goal *w_out = w_in - aa*delta_t; - Assert(*w_out >= 0); + SDL_assert(*w_out >= 0); delta_theta = 0.5f*(w_in + *w_out)*delta_t; return delta_theta; } @@ -1954,8 +1954,8 @@ float away(float w_in, float w_max, float theta_goal, float aa, float delta_t, f float t0; // time to velocity is 0 float t_excess; // time remaining in interval after velocity is 0 - Assert(theta_goal >=0); - Assert(w_in <= 0); + SDL_assert(theta_goal >=0); + SDL_assert(w_in <= 0); if ((-w_in < 1e-5) && (theta_goal < 1e-5)) { *w_out = 0.0f; @@ -2110,8 +2110,8 @@ void vm_matrix_interpolate(matrix *goal_orient, matrix *curr_orient, vector *w_i // functions approach and away. first find the magnitude // of the rotation and then normalize the axis rot_axis = theta_end; - Assert(is_valid_vec(&rot_axis)); - Assert(vm_vec_mag(&rot_axis) > 0); + SDL_assert(is_valid_vec(&rot_axis)); + SDL_assert(vm_vec_mag(&rot_axis) > 0); // normalize rotation axis and determine total rotation angle theta = vm_vec_normalize(&rot_axis); @@ -2122,7 +2122,7 @@ void vm_matrix_interpolate(matrix *goal_orient, matrix *curr_orient, vector *w_i } else { // otherwise rotate to better position vm_quaternion_rotate(&Mtemp1, theta, &rot_axis); - Assert(is_valid_matrix(&Mtemp1)); + SDL_assert(is_valid_matrix(&Mtemp1)); vm_matrix_x_matrix(next_orient, curr_orient, &Mtemp1); vm_orthogonalize_matrix(next_orient); } @@ -2235,7 +2235,7 @@ void vm_fvec_matrix_interpolate(matrix *goal_orient, matrix *orient, vector *w_i // find theta to goal vm_vec_copy_scale(&theta_goal, &local_rot_axis, theta); - Assert ( fl_abs (theta_goal.xyz.z) < 0.001f ); // check for proper rotation + SDL_assert ( fl_abs (theta_goal.xyz.z) < 0.001f ); // check for proper rotation theta_end = vmd_zero_vector; float delta_theta; @@ -2303,7 +2303,7 @@ void vm_fvec_matrix_interpolate(matrix *goal_orient, matrix *orient, vector *w_i // FIND Z ROTATON MATRIX theta_end.xyz.z = 0.0f; rot_axis = theta_end; - Assert(is_valid_vec(&rot_axis)); + SDL_assert(is_valid_vec(&rot_axis)); // normalize rotation axis and determine total rotation angle theta = vm_vec_mag(&rot_axis); @@ -2313,9 +2313,9 @@ void vm_fvec_matrix_interpolate(matrix *goal_orient, matrix *orient, vector *w_i } else { vm_vec_scale ( &rot_axis, 1/theta ); vm_quaternion_rotate ( &Mtemp1, theta, &rot_axis ); - Assert(is_valid_matrix(&Mtemp1)); + SDL_assert(is_valid_matrix(&Mtemp1)); vm_matrix_x_matrix ( &M_intermed, orient, &Mtemp1 ); - Assert(is_valid_matrix(&M_intermed)); + SDL_assert(is_valid_matrix(&M_intermed)); } @@ -2357,7 +2357,7 @@ void vm_fvec_matrix_interpolate(matrix *goal_orient, matrix *orient, vector *w_i // find theta.xyz.z to goal delta_bank = local_rot_axis.xyz.z * theta; - Assert( fl_abs (local_rot_axis.xyz.x) < 0.001f ); // check for proper rotation + SDL_assert( fl_abs (local_rot_axis.xyz.x) < 0.001f ); // check for proper rotation bank = 0.0f; // end calculate delta_bank @@ -2401,7 +2401,7 @@ void vm_fvec_matrix_interpolate(matrix *goal_orient, matrix *orient, vector *w_i vtemp = *w_out; vm_vec_rotate ( w_out, &vtemp, &Mtemp1 ); vm_matrix_x_matrix ( next_orient, &M_intermed, &Mtemp1 ); - Assert(is_valid_matrix(next_orient)); + SDL_assert(is_valid_matrix(next_orient)); vm_orthogonalize_matrix ( next_orient ); } } @@ -2469,7 +2469,7 @@ void vm_forward_interpolate(vector *goal_f, matrix *orient, vector *w_in, float // find theta to goal vm_vec_copy_scale(&theta_goal, &local_rot_axis, theta); - Assert(fl_abs(theta_goal.xyz.z) < 0.001f); // check for proper rotation + SDL_assert(fl_abs(theta_goal.xyz.z) < 0.001f); // check for proper rotation theta_end = vmd_zero_vector; float delta_theta; @@ -2591,7 +2591,7 @@ void vm_forward_interpolate(vector *goal_f, matrix *orient, vector *w_in, float } else { vm_quaternion_rotate( &Mtemp1, theta, &rot_axis ); vm_matrix_x_matrix( next_orient, orient, &Mtemp1 ); - Assert(is_valid_matrix(next_orient)); + SDL_assert(is_valid_matrix(next_orient)); vtemp = *w_out; vm_vec_rotate( w_out, &vtemp, &Mtemp1 ); } @@ -2671,7 +2671,7 @@ void vm_find_bounding_sphere(vector *pnts, int num_pnts, vector *center, float * vm_vec_sub(&diff, &dia2, center); rad_sq = vm_vec_mag_squared(&diff); rad = fl_sqrt(rad_sq); - Assert( !_isnan(rad) ); + SDL_assert( !_isnan(rad) ); // second pass for ( i = 0; i < num_pnts; i++ ) { diff --git a/src/menuui/barracks.cpp b/src/menuui/barracks.cpp index 1425312..c845f3a 100644 --- a/src/menuui/barracks.cpp +++ b/src/menuui/barracks.cpp @@ -449,7 +449,7 @@ void barracks_squad_change_popup(); // #define STRCPY1(a, b) do { \ - Assert(strlen(b) < STAT_COLUMN1_W); \ + SDL_assert(strlen(b) < STAT_COLUMN1_W); \ strcpy(a, b); \ } while (0) @@ -464,27 +464,27 @@ void barracks_init_stats(scoring_struct *stats) Stats[Num_stat_lines][0] = 0; Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); Stat_labels[Num_stat_lines][0] = 0; Stats[Num_stat_lines][0] = 0; Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Primary weapon shots:", 51)); sprintf(Stats[Num_stat_lines], "%d", stats->p_shots_fired); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Primary weapon hits:", 52)); sprintf(Stats[Num_stat_lines], "%d", stats->p_shots_hit); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Primary friendly hits:", 53)); sprintf(Stats[Num_stat_lines], "%d", stats->p_bonehead_hits); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Primary hit %:", 54)); if (stats->p_shots_fired > 0) { f = (float) stats->p_shots_hit * 100.0f / (float) stats->p_shots_fired; @@ -494,7 +494,7 @@ void barracks_init_stats(scoring_struct *stats) sprintf(Stats[Num_stat_lines], XSTR( "%.1f%%", 55), f); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Primary friendly hit %:", 56)); if (stats->p_bonehead_hits > 0) { f = (float) stats->p_bonehead_hits * 100.0f / (float) stats->p_shots_fired; @@ -504,27 +504,27 @@ void barracks_init_stats(scoring_struct *stats) sprintf(Stats[Num_stat_lines], XSTR( "%.1f%%", 55), f); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); Stat_labels[Num_stat_lines][0] = 0; Stats[Num_stat_lines][0] = 0; Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Secondary weapon shots:", 57)); sprintf(Stats[Num_stat_lines], "%d", stats->s_shots_fired); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Secondary weapon hits:", 58)); sprintf(Stats[Num_stat_lines], "%d", stats->s_shots_hit); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Secondary friendly hits:", 59)); sprintf(Stats[Num_stat_lines], "%d", stats->s_bonehead_hits); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Secondary hit %:", 60)); if (stats->s_shots_fired > 0) { f = (float) stats->s_shots_hit * 100.0f / (float) stats->s_shots_fired; @@ -534,7 +534,7 @@ void barracks_init_stats(scoring_struct *stats) sprintf(Stats[Num_stat_lines], XSTR( "%.1f%%", 55), f); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Secondary friendly hit %:", 61)); if (stats->s_bonehead_hits > 0) { f = (float) stats->s_bonehead_hits * 100.0f / (float) stats->s_shots_fired; @@ -544,27 +544,27 @@ void barracks_init_stats(scoring_struct *stats) sprintf(Stats[Num_stat_lines], XSTR( "%.1f%%", 55), f); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); Stat_labels[Num_stat_lines][0] = 0; Stats[Num_stat_lines][0] = 0; Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Total kills:", 62)); sprintf(Stats[Num_stat_lines], "%d", stats->kill_count_ok); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); STRCPY1(Stat_labels[Num_stat_lines], XSTR( "Assists:", 63)); sprintf(Stats[Num_stat_lines], "%d", stats->assists); Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); Stat_labels[Num_stat_lines][0] = 0; Stats[Num_stat_lines][0] = 0; Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); Stat_labels[Num_stat_lines][0] = 0; Stats[Num_stat_lines][0] = 0; Num_stat_lines++; @@ -573,15 +573,15 @@ void barracks_init_stats(scoring_struct *stats) Stats[Num_stat_lines][0] = 0; Num_stat_lines++; - Assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); Stat_labels[Num_stat_lines][0] = 0; Stats[Num_stat_lines][0] = 0; Num_stat_lines++; for (i=0; ikills[i]) { - Assert(Num_stat_lines < NUM_STAT_LINES); - Assert(strlen(Ship_info[i].name) + 1 < STAT_COLUMN1_W); + SDL_assert(Num_stat_lines < NUM_STAT_LINES); + SDL_assert(strlen(Ship_info[i].name) + 1 < STAT_COLUMN1_W); sprintf(Stat_labels[Num_stat_lines], NOX("%s:"), Ship_info[i].name); sprintf(Stats[Num_stat_lines], "%d", stats->kills[i]); Num_stat_lines++; @@ -615,7 +615,7 @@ void barracks_strip_pcx(char *str) { int flen = strlen(str); int elen = 4; - if ((flen > 4) && !stricmp(str + flen - elen, ".pcx")) { + if ((flen > 4) && !SDL_strcasecmp(str + flen - elen, ".pcx")) { str[flen - elen] = '\0'; } } @@ -647,7 +647,7 @@ int barracks_new_pilot_selected() for (i=0; iimage_filename); barracks_strip_pcx(stripped); - if (!stricmp(stripped, Pilot_image_names[i])) { + if (!SDL_strcasecmp(stripped, Pilot_image_names[i])) { break; } } @@ -655,7 +655,7 @@ int barracks_new_pilot_selected() for ( i=0; isquad_filename); barracks_strip_pcx(stripped); - if (!stricmp(stripped, Pilot_squad_image_names[i])) { + if (!SDL_strcasecmp(stripped, Pilot_squad_image_names[i])) { break; } } @@ -708,7 +708,7 @@ void barracks_create_new_pilot() // move other pilot names and ranks down to make room for the new one int idx = Num_pilots; - Assert(Num_pilots >= 0); + SDL_assert(Num_pilots >= 0); while (idx--) { strcpy(Pilots[idx + 1], Pilots[idx]); Pilot_ranks[idx + 1] = Pilot_ranks[idx]; @@ -925,7 +925,7 @@ void barracks_delete_pilot() return; } - if (!stricmp(Pilots[Selected_line], Cur_pilot->callsign)) { + if (!SDL_strcasecmp(Pilots[Selected_line], Cur_pilot->callsign)) { active = 1; } @@ -1022,7 +1022,7 @@ void barracks_init_player_stuff(int mode) break; } } - Assert(j < Num_pilots); // Pilot not found? How is that possible? + SDL_assert(j < Num_pilots); // Pilot not found? How is that possible? } for (int i=0; i= Num_pilots) break; - if (!stricmp(Cur_pilot->callsign, Pilots[cur_pilot_idx]) && (is_pilot_multi(Cur_pilot) == multi)) { + if (!SDL_strcasecmp(Cur_pilot->callsign, Pilots[cur_pilot_idx]) && (is_pilot_multi(Cur_pilot) == multi)) { if ((cur_pilot_idx == Selected_line) || (cur_pilot_idx == prospective_pilot)) { gr_set_color_fast(&Color_text_active_hi); } else { @@ -1317,7 +1317,7 @@ void barracks_accept_new_pilot_callsign() } for (i=1; i= 0 && percent <= 100); + SDL_assert(percent >= 0 && percent <= 100); // get width and height bm_get_info(bm1, &bw1, &bh1, NULL, NULL, NULL); diff --git a/src/menuui/mainhallmenu.cpp b/src/menuui/mainhallmenu.cpp index bc96cb6..23b15fc 100644 --- a/src/menuui/mainhallmenu.cpp +++ b/src/menuui/mainhallmenu.cpp @@ -717,7 +717,7 @@ void main_hall_do_multi_ready() if(Multi_options_g.protocol == NET_TCP){ popup( PF_NO_NETWORKING, 1, POPUP_OK, XSTR( "TCP/IP protocol not found. This protocol is required for multiplayer FreeSpace.", 362)); } else { - Assert(Multi_options_g.protocol == NET_IPX); + SDL_assert(Multi_options_g.protocol == NET_IPX); popup( PF_NO_NETWORKING, 1, POPUP_OK, XSTR( "IPX protocol not found. This protocol is required for multiplayer FreeSpace.", 362)); } break; @@ -825,7 +825,7 @@ void main_hall_init(int main_hall_num) read_menu_tbl(NOX("MAIN HALL"), temp, whee, Main_hall_region, &Main_hall_num_options, 0); // assign the proper main hall data - Assert((main_hall_num >= 0) && (main_hall_num < NUM_MAIN_HALLS)); + SDL_assert((main_hall_num >= 0) && (main_hall_num < NUM_MAIN_HALLS)); Main_hall = &Main_hall_defines[gr_screen.res][main_hall_num]; // tooltip strings @@ -913,7 +913,7 @@ void main_hall_init(int main_hall_num) if(Main_hall == &Main_hall_defines[gr_screen.res][0]) { Main_hall_overlay_id = MH_OVERLAY; } else { - Assert(Main_hall == &Main_hall_defines[gr_screen.res][1]); + SDL_assert(Main_hall == &Main_hall_defines[gr_screen.res][1]); Main_hall_overlay_id = MH2_OVERLAY; } help_overlay_load(Main_hall_overlay_id); @@ -980,7 +980,7 @@ void main_hall_init(int main_hall_num) Main_hall_right_click = mouse_down(MOUSE_RIGHT_BUTTON); // set the game_mode based on the type of player - Assert( Player != NULL ); + SDL_assert( Player != NULL ); if ( Player->flags & PLAYER_FLAGS_IS_MULTI ){ Game_mode = GM_MULTIPLAYER; } else { diff --git a/src/menuui/mainhalltemp.cpp b/src/menuui/mainhalltemp.cpp index 35721d8..55718a2 100644 --- a/src/menuui/mainhalltemp.cpp +++ b/src/menuui/mainhalltemp.cpp @@ -140,7 +140,7 @@ void mht_init() main_hall_start_music(); // set the game_mode based on the type of player - Assert( Player != NULL ); + SDL_assert( Player != NULL ); if ( Player->flags & PLAYER_FLAGS_IS_MULTI ){ Game_mode = GM_MULTIPLAYER; } else { diff --git a/src/menuui/optionsmenu.cpp b/src/menuui/optionsmenu.cpp index 75a4114..4f85089 100644 --- a/src/menuui/optionsmenu.cpp +++ b/src/menuui/optionsmenu.cpp @@ -840,7 +840,7 @@ void options_tab_setup(int set_palette) int flags[256]; if (Tab != MULTIPLAYER_TAB) { - Assert(Backgrounds[gr_screen.res][Tab].mask >= 0); + SDL_assert(Backgrounds[gr_screen.res][Tab].mask >= 0); Ui_window.set_mask_bmap(Backgrounds[gr_screen.res][Tab].mask, Backgrounds[gr_screen.res][Tab].mask_filename); } @@ -1261,7 +1261,7 @@ void options_accept() void options_load_background_and_mask(int tab) { - Assert(tab == OPTIONS_TAB || tab == DETAIL_LEVELS_TAB ); + SDL_assert(tab == OPTIONS_TAB || tab == DETAIL_LEVELS_TAB ); Backgrounds[gr_screen.res][tab].bitmap = bm_load(Backgrounds[gr_screen.res][tab].filename); Backgrounds[gr_screen.res][tab].mask = bm_load(Backgrounds[gr_screen.res][tab].mask_filename); } @@ -1274,7 +1274,7 @@ void options_menu_init() int i, j; options_buttons *b; - Assert(!Options_menu_inited); + SDL_assert(!Options_menu_inited); // pause all sounds, since we could get here through the game beam_pause_sounds(); @@ -1385,7 +1385,7 @@ void options_menu_close() { int i; - Assert(Options_menu_inited); + SDL_assert(Options_menu_inited); for (i=0; i= 0){ @@ -1500,7 +1500,7 @@ void options_menu_do_frame(float frametime) { int i, k, x, y; - Assert(Options_menu_inited); + SDL_assert(Options_menu_inited); k = Ui_window.process() & ~KEY_DEBUGGED; switch (k) { case KEY_SHIFTED | SDLK_TAB: diff --git a/src/menuui/optionsmenumulti.cpp b/src/menuui/optionsmenumulti.cpp index c81653b..51c9b9c 100644 --- a/src/menuui/optionsmenumulti.cpp +++ b/src/menuui/optionsmenumulti.cpp @@ -988,7 +988,7 @@ void options_multi_load_protocol_controls() { int idx; - Assert(Om_window != NULL); + SDL_assert(Om_window != NULL); // instantiate all the buttons for(idx=0; idx= 0); + SDL_assert(Om_mask_0 >= 0); Om_window->set_mask_bmap(Om_mask_0, Om_background_0_mask_fname[gr_screen.res]); } @@ -1453,7 +1453,7 @@ void options_multi_protocol_button_pressed(int n) options_multi_enable_vox_controls(); // set the voice screen mask - Assert(Om_mask_1 >= 0); + SDL_assert(Om_mask_1 >= 0); Om_window->set_mask_bmap(Om_mask_1, Om_background_1_mask_fname[gr_screen.res]); } // play a sound @@ -1549,7 +1549,7 @@ void options_multi_protocol_save_ip_file() // make _absolutely_ sure its a valid address // MWA -- commented out next line because name resolution might fail when // it was added. We'll only grab games that we can actually get to. - //Assert(psnet_is_valid_ip_string(Multi_ip_addrs[idx])); + //SDL_assert(psnet_is_valid_ip_string(Multi_ip_addrs[idx])); cfputs(Om_ip_addrs[idx],file); @@ -1715,7 +1715,7 @@ void options_multi_load_gen_controls() { int idx; - Assert(Om_window != NULL); + SDL_assert(Om_window != NULL); // instantiate all the buttons for(idx=0; idx= 0); + SDL_assert(Om_mask_0 >= 0); Om_window->set_mask_bmap(Om_mask_0, Om_background_0_mask_fname[gr_screen.res]); // set the default screen mode diff --git a/src/menuui/playermenu.cpp b/src/menuui/playermenu.cpp index 22f1e0d..d3da298 100644 --- a/src/menuui/playermenu.cpp +++ b/src/menuui/playermenu.cpp @@ -542,7 +542,7 @@ void player_select_init() // attempt to load in the background bitmap Player_select_background_bitmap = bm_load(Player_select_background_bitmap_name[gr_screen.res]); - Assert(Player_select_background_bitmap >= 0); + SDL_assert(Player_select_background_bitmap >= 0); // load in the palette for the screen // Player_select_palette = bm_load(PLAYER_SELECT_PALETTE); @@ -632,7 +632,7 @@ void player_select_do() #endif //if ( !Player_select_palette_set ) { - // Assert(Player_select_palette >= 0); + // SDL_assert(Player_select_palette >= 0); //#ifndef HARDWARE_ONLY // palette_use_bm_palette(Player_select_palette); //#endif @@ -1295,7 +1295,7 @@ void player_select_process_input(int k) } for (idx=1; idx 0); + SDL_assert(Player_select_num_pilots > 0); gameseq_post_event(GS_EVENT_MAIN_MENU); gamesnd_play_iface(SND_COMMIT_PRESSED); diff --git a/src/menuui/readyroom.cpp b/src/menuui/readyroom.cpp index 2eca53a..5a79ccd 100644 --- a/src/menuui/readyroom.cpp +++ b/src/menuui/readyroom.cpp @@ -391,7 +391,7 @@ void sim_room_blit_icons(int line_index, int y_start, fs_builtin_mission *fb = N // // returns hash value int hash_filename(const char *filename) { - unsigned __int64 hash_val = 0; + Uint64 hash_val = 0; const char *ptr = filename; // Dont hash .fsm extension, convert all to upper case @@ -458,7 +458,7 @@ int campaign_mission_hash_collision(const char *filename) } do { - if (!stricmp(filename, cur_node->filename)) { + if (!SDL_strcasecmp(filename, cur_node->filename)) { return 1; } @@ -816,7 +816,7 @@ void sim_room_scroll_screen_up() if (Scroll_offset) { Scroll_offset--; - Assert(Selected_line > Scroll_offset); + SDL_assert(Selected_line > Scroll_offset); while (!sim_room_line_query_visible(Selected_line)) Selected_line--; @@ -856,7 +856,7 @@ void sim_room_scroll_screen_down() Scroll_offset++; while (!sim_room_line_query_visible(Selected_line)) { Selected_line++; - Assert(Selected_line < Num_lines); + SDL_assert(Selected_line < Num_lines); } gamesnd_play_iface(SND_SCROLL); @@ -870,7 +870,7 @@ void sim_room_scroll_line_down() if (Selected_line < Num_lines - 1) { Selected_line++; - Assert(Selected_line > Scroll_offset); + SDL_assert(Selected_line > Scroll_offset); while (!sim_room_line_query_visible(Selected_line)) Scroll_offset++; @@ -906,7 +906,7 @@ int sim_room_can_resume_savegame(char *savegame_filename) return 0; } - if (stricmp(Game_current_mission_filename, savegame_mission)) { + if (SDL_strcasecmp(Game_current_mission_filename, savegame_mission)) { return 0; } @@ -1297,7 +1297,7 @@ void sim_room_do_frame(float frametime) z = -1; for (i=0; i= 0); + SDL_assert(Num_info_lines >= 0); } Desc_scroll_offset = 0; @@ -1710,7 +1710,7 @@ void campaign_room_commit() return; } - if (stricmp(Campaign_file_names[Selected_campaign_index], Campaign.filename)) { // new campaign selected + if (SDL_strcasecmp(Campaign_file_names[Selected_campaign_index], Campaign.filename)) { // new campaign selected if ((Active_campaign_index >= 0) && campaign_room_reset_campaign(Active_campaign_index)) { gamesnd_play_iface(SND_GENERAL_FAIL); return; @@ -1861,7 +1861,7 @@ void campaign_room_init() } } - Assert(j < Num_campaigns); // Campaign not found? How is that possible? + SDL_assert(j < Num_campaigns); // Campaign not found? How is that possible? } Campaign_names_inited = 0; @@ -1870,7 +1870,7 @@ void campaign_room_init() Selected_campaign_index = Active_campaign_index = -1; if (!load_failed) { for (i=0; i= Num_info_lines) break; - Assert(Info_text_line_size[i] < MAX_INFO_LINE_LEN); + SDL_assert(Info_text_line_size[i] < MAX_INFO_LINE_LEN); strncpy(line_text, Info_text_ptrs[i], Info_text_line_size[i]); line_text[Info_text_line_size[i]] = 0; drop_white_space(line_text); diff --git a/src/menuui/snazzyui.cpp b/src/menuui/snazzyui.cpp index 45ec1d3..1c39b6f 100644 --- a/src/menuui/snazzyui.cpp +++ b/src/menuui/snazzyui.cpp @@ -249,9 +249,9 @@ int snazzy_menu_do(ubyte *data, int mask_w, int mask_h, int num_regions, MENU_RE int choice = -1, mouse_on_choice = -1; ubyte pixel_value; - Assert(data != NULL); - Assert(num_regions > 0); - Assert(regions != NULL); + SDL_assert(data != NULL); + SDL_assert(num_regions > 0); + SDL_assert(regions != NULL); gr_reset_clip(); // don't remove mouse_get_pos( &x, &y ); @@ -412,7 +412,7 @@ void read_menu_tbl(const char* menu_name, char* bkg_filename, char* mask_filenam if (!state) { p2 = strchr( tmp_line, ']' ); if (p2) *p2 = 0; - if (!stricmp( ++p1, menu_name )) state = 1; + if (!SDL_strcasecmp( ++p1, menu_name )) state = 1; } else { cfclose(fp); break; diff --git a/src/menuui/techmenu.cpp b/src/menuui/techmenu.cpp index efc97c0..d0c8c7b 100644 --- a/src/menuui/techmenu.cpp +++ b/src/menuui/techmenu.cpp @@ -196,7 +196,7 @@ * Last minute changes to techroom weapon/ship/species stuff. * * 66 9/07/98 2:49p Dan - * Removed spurious Assert + * Removed spurious SDL_assert * * 65 7/06/98 2:42p Hoffoss * Fixed bug with weapons shown in tech database. @@ -620,12 +620,12 @@ void techroom_init_desc(char *src, int w) } Text_size = split_str(src, w, Text_line_size, Text_lines, MAX_TEXT_LINES); - Assert(Text_size >= 0 && Text_size < MAX_TEXT_LINES); + SDL_assert(Text_size >= 0 && Text_size < MAX_TEXT_LINES); } void techroom_select_new_entry() { - Assert(Current_list != NULL); + SDL_assert(Current_list != NULL); if (Current_list == NULL) return; Cur_entry_index = Current_list[Cur_entry].index; @@ -1128,7 +1128,7 @@ void techroom_change_tab(int num) int i, multi = 0, mask, font_height, max_num_entries_viewable; Tab = num; - // Assert(Current_list_size >= 0); + // SDL_assert(Current_list_size >= 0); List_offset = 0; Cur_entry = 0; multi = Player->flags & PLAYER_FLAGS_IS_MULTI; @@ -1509,7 +1509,7 @@ void techroom_intel_init() #ifndef MAKE_FS1 while (optional_string("$Entry:")) { - Assert(Intel_info_size < MAX_INTEL_ENTRIES); + SDL_assert(Intel_info_size < MAX_INTEL_ENTRIES); if (Intel_info_size >= MAX_INTEL_ENTRIES) break; required_string("$Name:"); @@ -1589,7 +1589,7 @@ void techroom_init() /* Palette_bmp = bm_load("TechDataPalette"); - Assert(Palette_bmp); + SDL_assert(Palette_bmp); bm_get_palette(Palette_bmp, Palette, Palette_name); // get the palette for this bitmap gr_set_palette(Palette_name, Palette, 1); */ diff --git a/src/mission/missionbriefcommon.cpp b/src/mission/missionbriefcommon.cpp index 699b2c9..06ae6ae 100644 --- a/src/mission/missionbriefcommon.cpp +++ b/src/mission/missionbriefcommon.cpp @@ -572,11 +572,11 @@ void mission_brief_common_init() for (i=0; itype][species]; - if ( !stricmp(NOX("none"), ha->name) ) { + if ( !SDL_strcasecmp(NOX("none"), ha->name) ) { return; } // force read of data from disk, so we don't glitch on initial playback if ( ha->first_frame == -1 ) { hud_anim_load(ha); - Assert(ha->first_frame >= 0); + SDL_assert(ha->first_frame >= 0); } bi->highlight_anim = *ha; @@ -991,14 +991,14 @@ void brief_preload_fade_anim(brief_icon *bi) } ha = &Icon_fade_anims[bi->type][species]; - if ( !stricmp(NOX("none"), ha->name) ) { + if ( !SDL_strcasecmp(NOX("none"), ha->name) ) { return; } // force read of data from disk, so we don't glitch on initial playback if ( ha->first_frame == -1 ) { hud_anim_load(ha); - Assert(ha->first_frame >= 0); + SDL_assert(ha->first_frame >= 0); } gr_set_bitmap(ha->first_frame, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); @@ -1034,7 +1034,7 @@ void brief_init_map() vector *pos; matrix *orient; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); pos = &Briefing->stages[0].camera_pos; orient = &Briefing->stages[0].camera_orient; @@ -1183,7 +1183,7 @@ void brief_render_icon(int stage_num, int icon_num, float frametime, int selecte int bx,by,bc,w,h,icon_w,icon_h,icon_bitmap=-1; float bxf, byf, dist=0.0f; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); bi = &Briefing->stages[stage_num].icons[icon_num]; @@ -1402,7 +1402,7 @@ void brief_render_icons(int stage_num, float frametime) { int i, num_icons, num_lines; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); num_icons = Briefing->stages[stage_num].num_icons; num_lines = Briefing->stages[stage_num].num_lines; @@ -1429,7 +1429,7 @@ void brief_start_highlight_anims(int stage_num) brief_icon *bi; int x,y,i,anim_w,anim_h; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); bs = &Briefing->stages[stage_num]; for ( i = 0; i < bs->num_icons; i++ ) { @@ -1473,7 +1473,7 @@ void brief_render_map(int stage_num, float frametime) return; } - Assert(Briefing); + SDL_assert(Briefing); bs = &Briefing->stages[stage_num]; g3_start_frame(0); @@ -1542,7 +1542,7 @@ void brief_blit_stage_num(int stage_num, int stage_max) char buf[64]; // int w; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); #ifdef MAKE_FS1 gr_set_color_fast(&Color_bright_blue); #else @@ -1790,7 +1790,7 @@ void brief_reset_icons(int stage_num) brief_icon *bi; int i; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); bs = &Briefing->stages[stage_num]; for ( i = 0; i < bs->num_icons; i++ ) { @@ -1894,7 +1894,7 @@ ubyte brief_return_color_index(char c) void brief_set_text_color(int color_index) { - Assert(color_index < MAX_BRIEF_TEXT_COLORS); + SDL_assert(color_index < MAX_BRIEF_TEXT_COLORS); gr_set_color_fast(Brief_text_colors[color_index]); } @@ -1958,13 +1958,13 @@ int brief_color_text_init(char *src, int w, int instance) int n_chars[MAX_BRIEF_LINES]; char *p_str[MAX_BRIEF_LINES]; - Assert(src); + SDL_assert(src); n_lines = split_str(src, w, n_chars, p_str, MAX_BRIEF_LINES, BRIEF_META_CHAR); - Assert(n_lines >= 0); + SDL_assert(n_lines >= 0); Max_briefing_line_len = 1; for (i=0; istages[new_stage]; cb = &Briefing->stages[current_stage]; num_movers = 0; @@ -2134,7 +2134,7 @@ void brief_set_new_stage(vector *pos, matrix *orient, int time, int stage_num) char msg[MAX_BRIEF_LEN]; int num_movers, new_time, not_objv = 1; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); new_time = time; if (stage_num >= Briefing->num_stages) { @@ -2411,33 +2411,33 @@ grid *brief_create_grid(grid *gridp, vector *forward, vector *right, vector *cen int i, ncols2, nrows2, d = 1; vector dfvec, drvec, cur, cur2, tvec, uvec, save, save2; - Assert(square_size > 0.0); + SDL_assert(square_size > 0.0); if (double_fine_gridlines) d = 2; if (gridp == NULL) gridp = (grid *) malloc(sizeof(grid)); - Assert(gridp); + SDL_assert(gridp); gridp->center = *center; gridp->square_size = square_size; // Create the plane equation. - Assert(!IS_VEC_NULL(forward)); - Assert(!IS_VEC_NULL(right)); + SDL_assert(!IS_VEC_NULL(forward)); + SDL_assert(!IS_VEC_NULL(right)); vm_vec_copy_normalize(&dfvec, forward); vm_vec_copy_normalize(&drvec, right); vm_vec_cross(&uvec, &dfvec, &drvec); - Assert(!IS_VEC_NULL(&uvec)); + SDL_assert(!IS_VEC_NULL(&uvec)); gridp->gmatrix.v.uvec = uvec; gridp->planeD = -(center->xyz.x * uvec.xyz.x + center->xyz.y * uvec.xyz.y + center->xyz.z * uvec.xyz.z); - Assert(!_isnan(gridp->planeD)); + SDL_assert(!_isnan(gridp->planeD)); gridp->gmatrix.v.fvec = dfvec; gridp->gmatrix.v.rvec = drvec; @@ -2456,7 +2456,7 @@ grid *brief_create_grid(grid *gridp, vector *forward, vector *right, vector *cen gridp->nrows = nrows; ncols2 = ncols / 2; nrows2 = nrows / 2; - Assert(ncols < MAX_GRIDLINE_POINTS && nrows < MAX_GRIDLINE_POINTS); + SDL_assert(ncols < MAX_GRIDLINE_POINTS && nrows < MAX_GRIDLINE_POINTS); // Create the points along the edges of the grid, so we can just draw lines // between them to form the grid. @@ -2645,10 +2645,10 @@ void brief_voice_load_all() // Brief_voice_ask_for_cd = 1; - Assert( Briefing != NULL ); + SDL_assert( Briefing != NULL ); for ( i = 0; i < Briefing->num_stages; i++ ) { bs = &Briefing->stages[i]; - if ( strnicmp(bs->voice, NOX("none"), 4) ) { + if ( SDL_strncasecmp(bs->voice, NOX("none"), 4) ) { brief_load_voice_file(i, bs->voice); // Brief_voices[i] = audiostream_open( bs->voice, ASF_VOICE ); } @@ -2720,7 +2720,7 @@ void brief_reset_last_new_stage() // get the dimensions for a briefing icon void brief_common_get_icon_dimensions(int *w, int *h, int type, int ship_class) { - Assert(type >= 0 && type < MAX_BRIEF_ICONS); + SDL_assert(type >= 0 && type < MAX_BRIEF_ICONS); // in case anything goes wrong *w=0; diff --git a/src/mission/missioncampaign.cpp b/src/mission/missioncampaign.cpp index 866cfab..ac53835 100644 --- a/src/mission/missioncampaign.cpp +++ b/src/mission/missioncampaign.cpp @@ -49,7 +49,7 @@ * code. * * 22 9/09/99 11:40p Dave - * Handle an Assert() in beam code. Added supernova sounds. Play the right + * Handle an SDL_assert() in beam code. Added supernova sounds. Play the right * 2 end movies properly, based upon what the player did in the mission. * * 21 9/09/99 9:34a Jefff @@ -277,18 +277,18 @@ int mission_campaign_get_info(const char *filename, char *name, int *type, int * int rval, i; char campaign_type[NAME_LENGTH], fname[MAX_FILENAME_LEN]; - Assert( name != NULL ); - Assert( type != NULL ); + SDL_assert( name != NULL ); + SDL_assert( type != NULL ); // open localization lcl_ext_open(); strcpy(fname, filename); - if ((strlen(fname) < 4) || stricmp(fname + strlen(fname) - 4, FS_CAMPAIGN_FILE_EXT)){ + if ((strlen(fname) < 4) || SDL_strcasecmp(fname + strlen(fname) - 4, FS_CAMPAIGN_FILE_EXT)){ strcat(fname, FS_CAMPAIGN_FILE_EXT); } - Assert(strlen(fname) < MAX_FILENAME_LEN); + SDL_assert(strlen(fname) < MAX_FILENAME_LEN); if ((rval = setjmp(parse_abort)) != 0) { if (rval == 5){ @@ -321,7 +321,7 @@ int mission_campaign_get_info(const char *filename, char *name, int *type, int * *type = -1; for (i=0; id_name, 0) == 0) { - if (stricmp(dir->d_name, BUILTIN_CAMPAIGN) == 0) + if (SDL_strcasecmp(dir->d_name, BUILTIN_CAMPAIGN) == 0) continue; char fn[MAX_PATH]; @@ -459,12 +459,12 @@ void mission_campaign_build_list( int multiplayer ) strcat(wild_card, FS_CAMPAIGN_FILE_EXT); find_handle = _findfirst( wild_card, &find ); if( find_handle != -1 ) { - if ( !(find.attrib & _A_SUBDIR) && stricmp(find.name, BUILTIN_CAMPAIGN) ){ + if ( !(find.attrib & _A_SUBDIR) && SDL_strcasecmp(find.name, BUILTIN_CAMPAIGN) ){ mission_campaign_maybe_add( find.name, multiplayer); } while( !_findnext( find_handle, &find ) ) { - if ( !(find.attrib & _A_SUBDIR) && stricmp(find.name, BUILTIN_CAMPAIGN) ) { + if ( !(find.attrib & _A_SUBDIR) && SDL_strcasecmp(find.name, BUILTIN_CAMPAIGN) ) { if ( Num_campaigns >= MAX_CAMPAIGNS ){ //MessageBox( -2,-2, 1, "Only the first 300 files will be displayed.", "Ok" ); break; @@ -563,7 +563,7 @@ int mission_campaign_load( const char *filename, int load_savefile ) // copy filename to campaign structure minus the extension len = strlen(filename) - 4; - Assert(len < MAX_FILENAME_LEN); + SDL_assert(len < MAX_FILENAME_LEN); strncpy(Campaign.filename, filename, len); Campaign.filename[len] = 0; @@ -577,7 +577,7 @@ int mission_campaign_load( const char *filename, int load_savefile ) stuff_string( type, F_NAME, NULL ); for (i = 0; i < MAX_CAMPAIGN_TYPES; i++ ) { - if ( !stricmp(type, campaign_types[i]) ) { + if ( !SDL_strcasecmp(type, campaign_types[i]) ) { Campaign.type = i; break; } @@ -628,7 +628,7 @@ int mission_campaign_load( const char *filename, int load_savefile ) if ( optional_string("+Formula:") ) { cm->formula = get_sexp_main(); if ( !Fred_running ) { - Assert ( cm->formula != -1 ); + SDL_assert ( cm->formula != -1 ); sexp_mark_persistent( cm->formula ); } else { @@ -666,7 +666,7 @@ int mission_campaign_load( const char *filename, int load_savefile ) if ( optional_string("+Formula:") ) { cm->mission_loop_formula = get_sexp_main(); if ( !Fred_running ) { - Assert ( cm->mission_loop_formula != -1 ); + SDL_assert ( cm->mission_loop_formula != -1 ); sexp_mark_persistent( cm->mission_loop_formula ); } else { @@ -784,12 +784,12 @@ void mission_campaign_savefile_generate_root(char *filename) { char base[_MAX_FNAME]; - Assert ( strlen(Campaign.filename) != 0 ); + SDL_assert ( strlen(Campaign.filename) != 0 ); // build up the filename for the save file. There could be a problem with filename length, // but this problem can get fixed in several ways -- ignore the problem for now though. _splitpath( Campaign.filename, NULL, NULL, base, NULL ); - Assert ( (strlen(base) + strlen(Player->callsign) + 1) < _MAX_FNAME ); + SDL_assert ( (strlen(base) + strlen(Player->callsign) + 1) < _MAX_FNAME ); sprintf( filename, NOX("%s.%s."), Player->callsign, base ); } @@ -994,15 +994,15 @@ void mission_campaign_savefile_load( const char *cfilename ) uint id, type_sig; CFILE *fp; - Assert ( strlen(cfilename) != 0 ); + SDL_assert ( strlen(cfilename) != 0 ); // probably only called from single player games anymore!!! should be anyway - Assert( Game_mode & GM_NORMAL ); // get allender or DaveB. trying to save campaign in multiplayer + SDL_assert( Game_mode & GM_NORMAL ); // get allender or DaveB. trying to save campaign in multiplayer // build up the filename for the save file. There could be a problem with filename length, // but this problem can get fixed in several ways -- ignore the problem for now though. _splitpath( cfilename, NULL, NULL, base, NULL ); - Assert ( (strlen(base) + strlen(Player->callsign) + 1) < _MAX_FNAME ); + SDL_assert ( (strlen(base) + strlen(Player->callsign) + 1) < _MAX_FNAME ); if(Game_mode & GM_MULTIPLAYER) sprintf( filename, NOX("%s.%s.msg"), Player->callsign, base ); @@ -1034,7 +1034,7 @@ void mission_campaign_savefile_load( const char *cfilename ) else type_sig = CAMPAIGN_SINGLE_PLAYER_SIG; // the actual check - Assert( ((Game_mode & GM_MULTIPLAYER) && (type_sig==CAMPAIGN_MULTI_PLAYER_SIG)) || (!(Game_mode & GM_MULTIPLAYER) && (type_sig==CAMPAIGN_SINGLE_PLAYER_SIG)) ); + SDL_assert( ((Game_mode & GM_MULTIPLAYER) && (type_sig==CAMPAIGN_MULTI_PLAYER_SIG)) || (!(Game_mode & GM_MULTIPLAYER) && (type_sig==CAMPAIGN_SINGLE_PLAYER_SIG)) ); Campaign.type = type_sig == CAMPAIGN_SINGLE_PLAYER_SIG ? CAMPAIGN_TYPE_SINGLE : CAMPAIGN_TYPE_MULTI_COOP; @@ -1042,7 +1042,7 @@ void mission_campaign_savefile_load( const char *cfilename ) // we are reading data that really belongs to this campaign. I think that this check // is redundant. cfread_string_len( filename, _MAX_FNAME, fp ); - /*if ( stricmp( filename, cfilename) ) { // Used to be !stricmp. How did this ever work? --MK, 11/9/97 + /*if ( SDL_strcasecmp( filename, cfilename) ) { // Used to be !SDL_strcasecmp. How did this ever work? --MK, 11/9/97 Warning(LOCATION, "Campaign save file appears corrupt because of mismatching filenames."); cfclose(fp); return; @@ -1087,7 +1087,7 @@ void mission_campaign_savefile_load( const char *cfilename ) Campaign.missions[num].goals = (mgoal *)malloc( Campaign.missions[num].num_goals * sizeof(mgoal) ); if ( Campaign.missions[num].num_goals > 0 ) { memset( Campaign.missions[num].goals, 0, sizeof(mgoal) * Campaign.missions[num].num_goals ); - Assert( Campaign.missions[num].goals != NULL ); + SDL_assert( Campaign.missions[num].goals != NULL ); } // now read in the goal information for this mission @@ -1106,7 +1106,7 @@ void mission_campaign_savefile_load( const char *cfilename ) Campaign.missions[num].events = (mevent *)malloc( Campaign.missions[num].num_events * sizeof(mevent) ); if ( Campaign.missions[num].num_events > 0 ) { memset( Campaign.missions[num].events, 0, sizeof(mevent) * Campaign.missions[num].num_events ); - Assert( Campaign.missions[num].events != NULL ); + SDL_assert( Campaign.missions[num].events != NULL ); } // now read in the event information for this mission @@ -1245,7 +1245,7 @@ int mission_campaign_eval_next_mission( int store_stats ) mission->num_goals = Num_goals; if ( mission->num_goals > 0 ) { mission->goals = (mgoal *)malloc( sizeof(mgoal) * Num_goals ); - Assert( mission->goals != NULL ); + SDL_assert( mission->goals != NULL ); } // copy the needed info from the Mission_goal struct to our internal structure @@ -1258,7 +1258,7 @@ int mission_campaign_eval_next_mission( int store_stats ) strcpy( mission->goals[i].name, name); } else strcpy( mission->goals[i].name, Mission_goals[i].name ); - Assert ( Mission_goals[i].satisfied != GOAL_INCOMPLETE ); // should be true or false at this point!!! + SDL_assert ( Mission_goals[i].satisfied != GOAL_INCOMPLETE ); // should be true or false at this point!!! mission->goals[i].status = (char)Mission_goals[i].satisfied; } @@ -1271,7 +1271,7 @@ int mission_campaign_eval_next_mission( int store_stats ) mission->num_events = Num_mission_events; if ( mission->num_events > 0 ) { mission->events = (mevent *)malloc( sizeof(mevent) * Num_mission_events ); - Assert( mission->events != NULL ); + SDL_assert( mission->events != NULL ); } // copy the needed info from the Mission_goal struct to our internal structure @@ -1402,7 +1402,7 @@ void mission_campaign_store_goals_and_events() mission->num_goals = Num_goals; if ( mission->num_goals > 0 ) { mission->goals = (mgoal *)malloc( sizeof(mgoal) * Num_goals ); - Assert( mission->goals != NULL ); + SDL_assert( mission->goals != NULL ); } // copy the needed info from the Mission_goal struct to our internal structure @@ -1415,7 +1415,7 @@ void mission_campaign_store_goals_and_events() strcpy( mission->goals[i].name, name); } else strcpy( mission->goals[i].name, Mission_goals[i].name ); - Assert ( Mission_goals[i].satisfied != GOAL_INCOMPLETE ); // should be true or false at this point!!! + SDL_assert ( Mission_goals[i].satisfied != GOAL_INCOMPLETE ); // should be true or false at this point!!! mission->goals[i].status = (char)Mission_goals[i].satisfied; } @@ -1428,7 +1428,7 @@ void mission_campaign_store_goals_and_events() mission->num_events = Num_mission_events; if ( mission->num_events > 0 ) { mission->events = (mevent *)malloc( sizeof(mevent) * Num_mission_events ); - Assert( mission->events != NULL ); + SDL_assert( mission->events != NULL ); } // copy the needed info from the Mission_goal struct to our internal structure @@ -1471,7 +1471,7 @@ void mission_campaign_mission_over() } mission_num = Campaign.current_mission; - Assert( mission_num != -1 ); + SDL_assert( mission_num != -1 ); mission = &Campaign.missions[mission_num]; // determine if any ships/weapons were granted this mission @@ -1520,7 +1520,7 @@ void mission_campaign_mission_over() Sexp_nodes[mission->formula].value = SEXP_UNKNOWN; } - Assert(Player); + SDL_assert(Player); if (Campaign.missions[Campaign.next_mission].flags & CMISSION_FLAG_BASTION){ Player->on_bastion = 1; } else { @@ -1614,7 +1614,7 @@ int mission_campaign_get_filenames(const char *filename, char dest[][NAME_LENGTH } else { read_file_text(filename); - Assert(strlen(filename) < MAX_FILENAME_LEN - 1); // make sure no overflow + SDL_assert(strlen(filename) < MAX_FILENAME_LEN - 1); // make sure no overflow reset_parse(); required_string("$Name:"); @@ -1687,7 +1687,7 @@ void read_mission_goal_list(int num) } event_count++; - Assert(event_count < MAX_MISSION_EVENTS); + SDL_assert(event_count < MAX_MISSION_EVENTS); } } @@ -1710,14 +1710,14 @@ void read_mission_goal_list(int num) } count++; - Assert(count < MAX_GOALS); + SDL_assert(count < MAX_GOALS); } } Campaign.missions[num].num_goals = count; if (count) { Campaign.missions[num].goals = (mgoal *) malloc(count * sizeof(mgoal)); - Assert(Campaign.missions[num].goals); // make sure we got the memory + SDL_assert(Campaign.missions[num].goals); // make sure we got the memory memset(Campaign.missions[num].goals, 0, count * sizeof(mgoal)); for (i=0; i= m_num_lines) || (m_line_sizes[n] < 1)) return; // out of range, don't draw anything - Assert(m_line_sizes[n] < MAX_GOAL_TEXT); + SDL_assert(m_line_sizes[n] < MAX_GOAL_TEXT); y += Goal_screen_text_y; if (*m_lines[n] == '*') { // header line gr_set_color_fast(&Color_text_heading); @@ -1061,8 +1061,8 @@ void mission_goal_status_change( int goal_num, int new_status) { int type; - Assert(goal_num < Num_goals); - Assert((new_status == GOAL_FAILED) || (new_status == GOAL_COMPLETE)); + SDL_assert(goal_num < Num_goals); + SDL_assert((new_status == GOAL_FAILED) || (new_status == GOAL_COMPLETE)); // if in a multiplayer game, send a status change to clients if ( MULTIPLAYER_MASTER ){ @@ -1442,7 +1442,7 @@ void mission_goal_mark_invalid( char *name ) int i; for (i=0; i 0.0); + SDL_assert(square_size > 0.0); if (double_fine_gridlines) d = 2; if (gridp == NULL) gridp = (grid *) malloc(sizeof(grid)); - Assert(gridp); + SDL_assert(gridp); gridp->center = *center; gridp->square_size = square_size; // Create the plane equation. - Assert(!IS_VEC_NULL(forward)); - Assert(!IS_VEC_NULL(right)); + SDL_assert(!IS_VEC_NULL(forward)); + SDL_assert(!IS_VEC_NULL(right)); vm_vec_copy_normalize(&dfvec, forward); vm_vec_copy_normalize(&drvec, right); vm_vec_cross(&uvec, &dfvec, &drvec); - Assert(!IS_VEC_NULL(&uvec)); + SDL_assert(!IS_VEC_NULL(&uvec)); gridp->gmatrix.v.uvec = uvec; gridp->planeD = -(center->xyz.x * uvec.xyz.x + center->xyz.y * uvec.xyz.y + center->xyz.z * uvec.xyz.z); - Assert(!_isnan(gridp->planeD)); + SDL_assert(!_isnan(gridp->planeD)); gridp->gmatrix.v.fvec = dfvec; gridp->gmatrix.v.rvec = drvec; @@ -238,7 +238,7 @@ grid *create_grid(grid *gridp, vector *forward, vector *right, vector *center, i gridp->nrows = nrows; ncols2 = ncols / 2; nrows2 = nrows / 2; - Assert(ncols < MAX_GRIDLINE_POINTS && nrows < MAX_GRIDLINE_POINTS); + SDL_assert(ncols < MAX_GRIDLINE_POINTS && nrows < MAX_GRIDLINE_POINTS); // Create the points along the edges of the grid, so we can just draw lines // between them to form the grid. diff --git a/src/mission/missionhotkey.cpp b/src/mission/missionhotkey.cpp index 1d1242f..86c4cf8 100644 --- a/src/mission/missionhotkey.cpp +++ b/src/mission/missionhotkey.cpp @@ -553,7 +553,7 @@ void mission_hotkey_set_defaults() continue; } - Assert(A->instance >= 0 && A->instance < MAX_SHIPS); + SDL_assert(A->instance >= 0 && A->instance < MAX_SHIPS); sp = &Ships[A->instance]; if ( sp->hotkey == -1 ) @@ -565,7 +565,7 @@ void mission_hotkey_set_defaults() if ( sp->hotkey == MAX_KEYED_TARGETS ) continue; - Assert(sp->objnum >= 0); + SDL_assert(sp->objnum >= 0); hud_target_hotkey_add_remove( sp->hotkey, &Objects[sp->objnum], HOTKEY_MISSION_FILE_ADDED ); } @@ -627,7 +627,7 @@ void mission_hotkey_maybe_save_sets() continue; for ( hitem = GET_FIRST(plist); hitem != END_OF_LIST(plist); hitem = GET_NEXT(hitem) ) { - Assert( Num_hotkeys_saved < MAX_HOTKEY_TARGET_ITEMS ); + SDL_assert( Num_hotkeys_saved < MAX_HOTKEY_TARGET_ITEMS ); hkp->setnum = i; strcpy( hkp->name, Ships[hitem->objp->instance].ship_name ); hkp++; @@ -694,7 +694,7 @@ int get_wing_hotkeys(int n) { int i, total = 0xffffffff; - Assert((n >= 0) && (n < num_wings)); + SDL_assert((n >= 0) && (n < num_wings)); for (i=0; i= start) && ((Hotkey_lines[z].type == HOTKEY_LINE_SUBSHIP) || (stricmp(text, Hotkey_lines[z].label) < 0))) + while ((z >= start) && ((Hotkey_lines[z].type == HOTKEY_LINE_SUBSHIP) || (SDL_strcasecmp(text, Hotkey_lines[z].label) < 0))) z--; z++; @@ -916,7 +916,7 @@ void hotkey_scroll_screen_up() { if (Scroll_offset) { Scroll_offset--; - Assert(Selected_line > Scroll_offset); + SDL_assert(Selected_line > Scroll_offset); while (!hotkey_line_query_visible(Selected_line) || (Hotkey_lines[Selected_line].type == HOTKEY_LINE_HEADING)) Selected_line--; @@ -948,7 +948,7 @@ void hotkey_scroll_screen_down() Scroll_offset++; while (!hotkey_line_query_visible(Selected_line) || (Hotkey_lines[Selected_line].type == HOTKEY_LINE_HEADING)) { Selected_line++; - Assert(Selected_line < Num_lines); + SDL_assert(Selected_line < Num_lines); } gamesnd_play_iface(SND_SCROLL); @@ -964,7 +964,7 @@ void hotkey_scroll_line_down() while (Hotkey_lines[Selected_line].type == HOTKEY_LINE_HEADING) Selected_line++; - Assert(Selected_line > Scroll_offset); + SDL_assert(Selected_line > Scroll_offset); while (!hotkey_line_query_visible(Selected_line)) Scroll_offset++; @@ -1004,7 +1004,7 @@ void reset_hotkeys() continue; for ( hitem = GET_FIRST(plist); hitem != END_OF_LIST(plist); hitem = GET_NEXT(hitem) ) { - Assert(hitem->objp->type == OBJ_SHIP); + SDL_assert(hitem->objp->type == OBJ_SHIP); Hotkey_bits[hitem->objp->instance] |= (1 << i); } } @@ -1462,7 +1462,7 @@ void mission_hotkey_do_frame(float frametime) } } - Assert(strlen(buf) > 1); + SDL_assert(strlen(buf) > 1); buf[strlen(buf) - 2] = 0; // lose the ", " on the end gr_force_fit_string(buf, 255, GROUP_LIST_W); diff --git a/src/mission/missionload.cpp b/src/mission/missionload.cpp index 9a54094..cb702df 100644 --- a/src/mission/missionload.cpp +++ b/src/mission/missionload.cpp @@ -109,7 +109,7 @@ * * 85 8/25/97 5:47p Mike * Increase number of missions supported in mission load list (outside - * campaign) to 256 and Assert() if there are more than 256. + * campaign) to 256 and SDL_assert() if there are more than 256. * * 84 8/20/97 5:19p Hoffoss * Fixed bug where creating a new pilot causes the mission load mission @@ -245,12 +245,12 @@ void ml_update_recent_missions(char *filename) p++; } - Assert(strlen(p) < MAX_FILENAME_LEN); + SDL_assert(strlen(p) < MAX_FILENAME_LEN); strcpy( Recent_missions[0], p ); j = 1; for ( i = 0; i < Num_recent_missions; i++ ) { - if ( stricmp(Recent_missions[0], tmp[i]) ) { + if ( SDL_strcasecmp(Recent_missions[0], tmp[i]) ) { strcpy(Recent_missions[j++], tmp[i]); if ( j >= MAX_RECENT_MISSIONS ) { break; @@ -259,7 +259,7 @@ void ml_update_recent_missions(char *filename) } Num_recent_missions = j; - Assert(Num_recent_missions <= MAX_RECENT_MISSIONS); + SDL_assert(Num_recent_missions <= MAX_RECENT_MISSIONS); } // Mission_load takes no parameters. @@ -294,7 +294,7 @@ int mission_load() if (Select_default_ship) { int ret; ret = create_default_player_ship(); - Assert(!ret); + SDL_assert(!ret); } ml_update_recent_missions(Game_current_mission_filename); // update recently played missions list @@ -358,7 +358,7 @@ void mission_load_menu_init() { int i; char wild_card[256]; - Assert( mlm_active == 0 ); + SDL_assert( mlm_active == 0 ); mlm_active = 1; memset(wild_card, 0, 256); @@ -367,7 +367,7 @@ void mission_load_menu_init() mlm_nfiles = cf_get_file_list( MLM_MAX_MISSIONS, mlm_missions, CF_TYPE_MISSIONS, wild_card, CF_SORT_NAME ); jtmp_nfiles = 0; - Assert(mlm_nfiles <= MLM_MAX_MISSIONS); + SDL_assert(mlm_nfiles <= MLM_MAX_MISSIONS); mlm_window.create( 100,100,500,300, 0 ); //WIN_DIALOG @@ -407,7 +407,7 @@ void mission_load_menu_do() int selected, key_in, recent_current, mlm_current, use_recent_flag, i; - Assert( mlm_active == 1 ); + SDL_assert( mlm_active == 1 ); key_in = mlm_window.process(); @@ -545,7 +545,7 @@ void mission_load_menu_close() { int i; - Assert( mlm_active == 1 ); + SDL_assert( mlm_active == 1 ); mlm_active = 0; for (i=0; ipname ) ) { + if ( !SDL_strcasecmp( pname, entry->pname ) ) { if ( (entry->type == LOG_SHIP_SUBSYS_DESTROYED) || (entry->type == LOG_SHIP_DISARMED) || (entry->type == LOG_SHIP_DISABLED) ) entry->flags |= MLF_OBSOLETE; } @@ -408,13 +408,13 @@ void mission_log_add_entry(int type, const char *pname, const char *sname, int i entry->type = type; if ( pname ) { - Assert (strlen(pname) < NAME_LENGTH); + SDL_assert (strlen(pname) < NAME_LENGTH); strcpy(entry->pname, pname); } else strcpy( entry->pname, EMPTY_LOG_NAME ); if ( sname ) { - Assert (strlen(sname) < NAME_LENGTH); + SDL_assert (strlen(sname) < NAME_LENGTH); strcpy(entry->sname, sname); } else strcpy( entry->sname, EMPTY_LOG_NAME ); @@ -444,7 +444,7 @@ void mission_log_add_entry(int type, const char *pname, const char *sname, int i index = ship_name_lookup( pname ); } - Assert ( index != -1 ); + SDL_assert ( index != -1 ); if(index < 0){ mission_log_flag_team( entry, ML_FLAG_PRIMARY, TEAM_FRIENDLY ); } else { @@ -455,7 +455,7 @@ void mission_log_add_entry(int type, const char *pname, const char *sname, int i if ( (type == LOG_SHIP_DOCK) || (type == LOG_SHIP_UNDOCK)) { if ( sname ) { index = ship_name_lookup( sname ); - Assert( index != -1 ); + SDL_assert( index != -1 ); mission_log_flag_team( entry, ML_FLAG_SECONDARY, Ships[index].team ); } } else if ( type == LOG_SHIP_DESTROYED ) { @@ -507,15 +507,15 @@ void mission_log_add_entry(int type, const char *pname, const char *sname, int i case LOG_WING_DEPART: case LOG_WING_ARRIVE: index = wing_name_lookup( pname, 1 ); - Assert( index != -1 ); - Assert( info_index != -1 ); // this is the team value + SDL_assert( index != -1 ); + SDL_assert( info_index != -1 ); // this is the team value // get the team value for this wing. Departed or destroyed wings will pass the team // value in info_index parameter. For arriving wings, get the team value from the // first ship in the list if ( type == LOG_WING_ARRIVE ) { si = Wings[index].ship_index[0]; - Assert( si != -1 ); + SDL_assert( si != -1 ); mission_log_flag_team( entry, ML_FLAG_PRIMARY, Ships[si].team ); } else { mission_log_flag_team( entry, ML_FLAG_PRIMARY, info_index ); @@ -585,8 +585,8 @@ void mission_log_add_entry_multi( int type, const char *pname, const char *sname log_entry *entry; // we'd better be in multiplayer and not the master of the game - Assert ( Game_mode & GM_MULTIPLAYER ); - Assert ( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); + SDL_assert ( Game_mode & GM_MULTIPLAYER ); + SDL_assert ( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); // mark any entries as obsolete. Part of the pruning is done based on the type (and name) passed // for a new entry @@ -602,11 +602,11 @@ void mission_log_add_entry_multi( int type, const char *pname, const char *sname entry->type = type; if ( pname ) { - Assert (strlen(pname) < NAME_LENGTH); + SDL_assert (strlen(pname) < NAME_LENGTH); strcpy(entry->pname, pname); } if ( sname ) { - Assert (strlen(sname) < NAME_LENGTH); + SDL_assert (strlen(sname) < NAME_LENGTH); strcpy(entry->sname, sname); } entry->index = index; @@ -630,14 +630,14 @@ int mission_log_get_time_indexed( int type, const char *pname, const char *sname // were passed into this function. Count the entry as found if either name matches both in the other // set. if ( (type == LOG_SHIP_DOCK) || (type == LOG_SHIP_UNDOCK) ) { - Assert ( sname ); - if ( (!stricmp(entry->pname, pname) && !stricmp(entry->sname, sname)) || (!stricmp(entry->pname, sname) && !stricmp(entry->sname, pname)) ) + SDL_assert ( sname ); + if ( (!SDL_strcasecmp(entry->pname, pname) && !SDL_strcasecmp(entry->sname, sname)) || (!SDL_strcasecmp(entry->pname, sname) && !SDL_strcasecmp(entry->sname, pname)) ) found = 1; } else { // for non dock/undock goals, then the names are important! - if ( stricmp(entry->pname, pname) ) + if ( SDL_strcasecmp(entry->pname, pname) ) goto next_entry; - if ( !sname || !stricmp(sname, entry->sname) ) + if ( !sname || !SDL_strcasecmp(sname, entry->sname) ) found = 1; } @@ -679,7 +679,7 @@ void message_log_add_seg(int n, int x, int color, const char *text, int flags = parent = &((*parent)->next); seg = (log_text_seg *) malloc(sizeof(log_text_seg)); - Assert(seg); + SDL_assert(seg); seg->text = strdup(text); seg->color = color; seg->x = x; @@ -901,13 +901,13 @@ void message_log_init_scrollback(int pw) break; case LOG_CARGO_REVEALED: - Assert( entry->index != -1 ); + SDL_assert( entry->index != -1 ); message_log_add_segs(XSTR( "Cargo revealed: ", 418), LOG_COLOR_NORMAL); message_log_add_segs( Cargo_names[entry->index], LOG_COLOR_BRIGHT ); break; case LOG_CAP_SUBSYS_CARGO_REVEALED: - Assert( entry->index != -1 ); + SDL_assert( entry->index != -1 ); message_log_add_segs(entry->sname, LOG_COLOR_NORMAL); message_log_add_segs(XSTR( " subsystem cargo revealed: ", 1488), LOG_COLOR_NORMAL); message_log_add_segs( Cargo_names[entry->index], LOG_COLOR_BRIGHT ); diff --git a/src/mission/missionmessage.cpp b/src/mission/missionmessage.cpp index 6e090ee..57d3d12 100644 --- a/src/mission/missionmessage.cpp +++ b/src/mission/missionmessage.cpp @@ -169,10 +169,10 @@ * Fix typo for 'Stray Warning Final' * * 119 5/05/98 9:12p Allender - * fix large problem introduced last checkin when changiing Assert to if + * fix large problem introduced last checkin when changiing SDL_assert to if * * 118 5/05/98 4:12p Chad - * changed Assert info if statement when removing messages from queue when + * changed SDL_assert info if statement when removing messages from queue when * too old * * 117 5/01/98 12:34p John @@ -284,7 +284,7 @@ * bitmap id. Made asteroids not rotate when model_caching is on. * * 87 3/02/98 9:34a Allender - * don't allow mission specific messages to timeout. Assert when trying + * don't allow mission specific messages to timeout. SDL_assert when trying * to remove a mission specific messages from the queue. Print out in the * log file if the voice didn't play. * @@ -583,7 +583,7 @@ void persona_parse() int i; char type[NAME_LENGTH]; - Assert ( Num_personas < MAX_PERSONAS ); + SDL_assert ( Num_personas < MAX_PERSONAS ); Personas[Num_personas].flags = 0; required_string("$Persona:"); @@ -593,13 +593,13 @@ void persona_parse() required_string("$Type:"); stuff_string( type, F_NAME, NULL ); for ( i = 0; i < MAX_PERSONA_TYPES; i++ ) { - if ( !stricmp( type, Persona_type_names[i]) ) { + if ( !SDL_strcasecmp( type, Persona_type_names[i]) ) { Personas[Num_personas].flags |= (1<wave_info.index; // sanity check - Assert( index != -1 ); + SDL_assert( index != -1 ); if ( index == -1 ){ return; } @@ -1232,7 +1232,7 @@ void message_play_anim( message_q *q ) // support ships use a wingman head. // terran command uses it's own set of heads. int subhead_selected = FALSE; - if ( (q->message_num < Num_builtin_messages) || !(_strnicmp(HEAD_PREFIX_STRING, ani_name, strlen(HEAD_PREFIX_STRING)-1)) ) { + if ( (q->message_num < Num_builtin_messages) || !(SDL_strncasecmp(HEAD_PREFIX_STRING, ani_name, strlen(HEAD_PREFIX_STRING)-1)) ) { persona_index = m->persona_index; // if this ani should be converted to a terran command, set the persona to the command persona @@ -1356,7 +1356,7 @@ void message_queue_process() // here, since message_kill_playing() seems to always set Playing_messages[i].shipnum to -1 // MWA 3/24/98 -- save shipnum before killing message // - Assert( shipnum >= 0 ); + SDL_assert( shipnum >= 0 ); if ( !(Ships[shipnum].flags & SF_SHIP_HAS_SCREAMED) ) { ship_scream( &Ships[shipnum] ); } @@ -1442,9 +1442,9 @@ void message_queue_process() } q = &MessageQ[0]; - Assert ( q->message_num != -1 ); - Assert ( q->priority != -1 ); - Assert ( q->time_added != -1 ); + SDL_assert ( q->message_num != -1 ); + SDL_assert ( q->priority != -1 ); + SDL_assert ( q->time_added != -1 ); if ( Num_messages_playing ) { // peek at the first message on the queue to see if it should interrupt, or overlap a currently @@ -1636,7 +1636,7 @@ void message_queue_message( int message_num, int priority, int timing, const cha // to this message, then set a bit to tell the wave/anim playing code to play the command version // of the wave and head MessageQ[i].flags = 0; - if ( !stricmp(who_from, TERRAN_COMMAND) && (m_persona != -1) && (Personas[m_persona].flags & PERSONA_FLAG_WINGMAN) ) { + if ( !SDL_strcasecmp(who_from, TERRAN_COMMAND) && (m_persona != -1) && (Personas[m_persona].flags & PERSONA_FLAG_WINGMAN) ) { MessageQ[i].flags |= MQF_CONVERT_TO_COMMAND; MessageQ[i].source = HUD_SOURCE_TERRAN_CMD; } @@ -1814,7 +1814,7 @@ void message_send_unique_to_player( char *id, void *data, int m_source, int prio who_from = NULL; for (i=0; iteam); // be sure that this ship can actually send a message!!! (i.e. not-not-flyable -- get it!) - Assert( !(Ship_info[shipp->ship_info_index].flags & SIF_NOT_FLYABLE) ); // get allender or alan + SDL_assert( !(Ship_info[shipp->ship_info_index].flags & SIF_NOT_FLYABLE) ); // get allender or alan } // not multiplayer or this message is for me, then queue it @@ -1908,7 +1908,7 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti } // be sure that this ship can actually send a message!!! (i.e. not-not-flyable -- get it!) - Assert( !(Ship_info[shipp->ship_info_index].flags & SIF_NOT_FLYABLE) ); // get allender or alan + SDL_assert( !(Ship_info[shipp->ship_info_index].flags & SIF_NOT_FLYABLE) ); // get allender or alan } else { persona_index = Command_persona; // use the terran command persona } @@ -1923,7 +1923,7 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti name = Builtin_message_types[type]; // see if the have the type of message - if ( stricmp(Messages[i].name, name) ){ + if ( SDL_strcasecmp(Messages[i].name, name) ){ continue; } @@ -1944,7 +1944,7 @@ void message_send_builtin_to_player( int type, ship *shipp, int priority, int ti } // maybe change the who from here for special rearm cases (always seems like that is the case :-) ) - if ( !stricmp(who_from, TERRAN_COMMAND) && (type == MESSAGE_REARM_ON_WAY) ){ + if ( !SDL_strcasecmp(who_from, TERRAN_COMMAND) && (type == MESSAGE_REARM_ON_WAY) ){ who_from = SUPPORT_NAME; } @@ -2008,7 +2008,7 @@ int message_persona_name_lookup( const char *name ) int i; for (i = 0; i < Num_personas; i++ ) { - if ( !stricmp(Personas[i].name, name) ) + if ( !SDL_strcasecmp(Personas[i].name, name) ) return i; } @@ -2033,7 +2033,7 @@ void message_maybe_distort() // distort the number of voices currently playing for ( i = 0; i < Num_messages_playing; i++ ) { - Assert(Playing_messages[i].wave >= 0 ); + SDL_assert(Playing_messages[i].wave >= 0 ); was_muted = 0; diff --git a/src/mission/missionparse.cpp b/src/mission/missionparse.cpp index 18ce534..b812d16 100644 --- a/src/mission/missionparse.cpp +++ b/src/mission/missionparse.cpp @@ -704,7 +704,7 @@ void parse_mission_info(mission *pm) ignore_white_space(); stuff_string(game_string, F_NAME, NULL); for ( i = 0; i < OLD_MAX_GAME_TYPES; i++ ) { - if ( !stricmp(game_string, Old_game_types[i]) ) { + if ( !SDL_strcasecmp(game_string, Old_game_types[i]) ) { // this block of code is now old mission compatibility code. We specify game // type in a different manner than before. @@ -794,7 +794,7 @@ void parse_mission_info(mission *pm) float temp; stuff_float(&temp); - Assert(temp >= 0.0f); + SDL_assert(temp >= 0.0f); Entry_delay_time = fl2f(temp); } @@ -843,7 +843,7 @@ void parse_mission_info(mission *pm) void parse_player_info(mission *pm) { char alt[NAME_LENGTH + 2] = ""; - Assert(pm != NULL); + SDL_assert(pm != NULL); // alternate type names begin here mission_parse_reset_alt(); @@ -886,7 +886,7 @@ void parse_player_info2(mission *pm) required_string("$Ship Choices:"); total = stuff_int_list(list, MAX_SHIP_TYPES * 2, SHIP_INFO_TYPE); - Assert(!(total & 0x01)); // make sure we have an even count + SDL_assert(!(total & 0x01)); // make sure we have an even count num_ship_choices = 0; total /= 2; // there are only 1/2 the ships really on the list. @@ -922,7 +922,7 @@ void parse_player_info2(mission *pm) break; } } - Assert( i < MAX_SHIP_TYPES ); + SDL_assert( i < MAX_SHIP_TYPES ); } } } @@ -936,7 +936,7 @@ void parse_player_info2(mission *pm) if (optional_string("+Weaponry Pool:")) { total = stuff_int_list(list2, MAX_WEAPON_TYPES * 2, WEAPON_POOL_TYPE); - Assert(!(total & 0x01)); // make sure we have an even count + SDL_assert(!(total & 0x01)); // make sure we have an even count total /= 2; for (i=0; inum_stages); + SDL_assert(!Cur_cmd_brief->num_stages); stage = 0; required_string("#Command Briefing"); while (optional_string("$Stage Text:")) { - Assert(stage < CMD_BRIEF_STAGES_MAX); + SDL_assert(stage < CMD_BRIEF_STAGES_MAX); Cur_cmd_brief->stage[stage].text = stuff_and_malloc_string(F_MULTITEXT, NULL, CMD_BRIEF_TEXT_MAX); - Assert(Cur_cmd_brief->stage[stage].text); + SDL_assert(Cur_cmd_brief->stage[stage].text); required_string("$Ani Filename:"); stuff_string(Cur_cmd_brief->stage[stage].ani_filename, F_FILESPEC, NULL); @@ -1122,12 +1122,12 @@ void parse_briefing(mission *pm) required_string("$start_briefing"); required_string("$num_stages:"); stuff_int(&bp->num_stages); - Assert(bp->num_stages <= MAX_BRIEF_STAGES); + SDL_assert(bp->num_stages <= MAX_BRIEF_STAGES); stage_num = 0; while (required_string_either("$end_briefing", "$start_stage")) { required_string("$start_stage"); - Assert(stage_num < MAX_BRIEF_STAGES); + SDL_assert(stage_num < MAX_BRIEF_STAGES); bs = &bp->stages[stage_num++]; required_string("$multi_text"); if ( Fred_running ) { @@ -1148,11 +1148,11 @@ void parse_briefing(mission *pm) stuff_int(&bs->num_lines); if ( Fred_running ) { - Assert(bs->lines!=NULL); + SDL_assert(bs->lines!=NULL); } else { if ( bs->num_lines > 0 ) { bs->lines = (brief_line *)malloc(sizeof(brief_line)*bs->num_lines); - Assert(bs->lines!=NULL); + SDL_assert(bs->lines!=NULL); } } @@ -1171,11 +1171,11 @@ void parse_briefing(mission *pm) stuff_int(&bs->num_icons); if ( Fred_running ) { - Assert(bs->lines!=NULL); + SDL_assert(bs->lines!=NULL); } else { if ( bs->num_icons > 0 ) { bs->icons = (brief_icon *)malloc(sizeof(brief_icon)*bs->num_icons); - Assert(bs->icons!=NULL); + SDL_assert(bs->icons!=NULL); } } @@ -1189,18 +1189,18 @@ void parse_briefing(mission *pm) else bs->formula = Locked_sexp_true; - Assert(bs->num_icons <= MAX_STAGE_ICONS ); + SDL_assert(bs->num_icons <= MAX_STAGE_ICONS ); while (required_string_either("$end_stage", "$start_icon")) { required_string("$start_icon"); - Assert(icon_num < MAX_STAGE_ICONS); + SDL_assert(icon_num < MAX_STAGE_ICONS); bi = &bs->icons[icon_num++]; required_string("$type:"); stuff_int(&bi->type); find_and_stuff("$team:", &team_index, F_NAME, Team_names, Num_team_names, "team name"); - Assert((team_index >= 0) && (team_index < MAX_TEAM_NAMES)); + SDL_assert((team_index >= 0) && (team_index < MAX_TEAM_NAMES)); bi->team = 1 << team_index; find_and_stuff("$class:", &bi->ship_class, F_NAME, (const char **)Ship_class_names, Num_ship_types, "ship class"); @@ -1222,7 +1222,7 @@ void parse_briefing(mission *pm) for (i=0; istages[i].num_icons; j++) { - if (!stricmp(bp->stages[i].icons[j].label, bi->label)) + if (!SDL_strcasecmp(bp->stages[i].icons[j].label, bi->label)) bi->id = bp->stages[i].icons[j].id; } @@ -1244,12 +1244,12 @@ void parse_briefing(mission *pm) stuff_string(not_used_text, F_MULTITEXT, NULL, MAX_ICON_TEXT_LEN); required_string("$end_icon"); } // end while - Assert(bs->num_icons == icon_num); + SDL_assert(bs->num_icons == icon_num); icon_num = 0; required_string("$end_stage"); } // end while - Assert(bp->num_stages == stage_num); + SDL_assert(bp->num_stages == stage_num); required_string("$end_briefing"); } @@ -1320,10 +1320,10 @@ void parse_debriefing_new(mission *pm) required_string("$Num stages:"); stuff_int(&db->num_stages); - Assert(db->num_stages <= MAX_DEBRIEF_STAGES); + SDL_assert(db->num_stages <= MAX_DEBRIEF_STAGES); while (required_string_either("#", "$Formula")) { - Assert(stage_num < MAX_DEBRIEF_STAGES); + SDL_assert(stage_num < MAX_DEBRIEF_STAGES); dbs = &db->stages[stage_num++]; required_string("$Formula:"); dbs->formula = get_sexp_main(); @@ -1343,7 +1343,7 @@ void parse_debriefing_new(mission *pm) } } // end while - Assert(db->num_stages == stage_num); + SDL_assert(db->num_stages == stage_num); } if ( nt != Num_teams ) @@ -1402,7 +1402,7 @@ int parse_create_object(p_object *objp) // base level creation objnum = ship_create(&objp->orient, &objp->pos, objp->ship_class); - Assert(objnum != -1); + SDL_assert(objnum != -1); shipnum = Objects[objnum].instance; // if arriving through knossos, adjust objpj->pos to plane of knossos and set flag @@ -1422,7 +1422,7 @@ int parse_create_object(p_object *objp) // if this is a multiplayer dogfight game, and its from a player wing, make it team traitor if((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && (objp->wingnum >= 0)){ for (i = 0; i < MAX_STARTING_WINGS; i++ ) { - if ( !stricmp(Starting_wing_names[i], Wings[objp->wingnum].name) ) { + if ( !SDL_strcasecmp(Starting_wing_names[i], Wings[objp->wingnum].name) ) { Ships[shipnum].team = TEAM_TRAITOR; } } @@ -1571,7 +1571,7 @@ int parse_create_object(p_object *objp) Ships[shipnum].flags |= SF_SCANNABLE; if ( objp->flags & P_SF_RED_ALERT_STORE_STATUS ){ - Assert(!(Game_mode & GM_MULTIPLAYER)); + SDL_assert(!(Game_mode & GM_MULTIPLAYER)); Ships[shipnum].flags |= SF_RED_ALERT_STORE_STATUS; } @@ -1602,7 +1602,7 @@ int parse_create_object(p_object *objp) free_sexp2(objp->ai_goals); // free up sexp nodes for reused, since they aren't needed anymore. } - Assert(Ships[shipnum].modelnum != -1); + SDL_assert(Ships[shipnum].modelnum != -1); // initialize subsystem statii here. The subsystems are given a percentage damaged. So a percent value // of 20% means that the subsystem is 20% damaged (*not* 20% of max hits). This is opposite the way @@ -1610,7 +1610,7 @@ int parse_create_object(p_object *objp) i = objp->subsys_count; while (i--) { sssp = &Subsys_status[objp->subsys_index + i]; - if (!stricmp(sssp->name, NOX("Pilot"))) { + if (!SDL_strcasecmp(sssp->name, NOX("Pilot"))) { wp = &Ships[shipnum].weapons; if (sssp->primary_banks[0] != SUBSYS_STATUS_NO_CHANGE) { for (j=k=0; jsystem_info->subobj_name, sssp->name)) { + if (!SDL_strcasecmp(ptr->system_info->subobj_name, sssp->name)) { if (Fred_running) ptr->current_hits = sssp->percent; else { @@ -1811,7 +1811,7 @@ int parse_object(mission *pm, int flag, p_object *objp) int i, j, count, shipnum, delay, destroy_before_mission_time; char name[NAME_LENGTH], flag_strings[MAX_PARSE_OBJECT_FLAGS][NAME_LENGTH]; - Assert(pm != NULL); + SDL_assert(pm != NULL); // objp = &temp_object; @@ -1847,7 +1847,7 @@ int parse_object(mission *pm, int flag, p_object *objp) // try and find the alternate name objp->alt_type_index = (char)mission_parse_lookup_alt(name); - Assert(objp->alt_type_index >= 0); + SDL_assert(objp->alt_type_index >= 0); if(objp->alt_type_index < 0){ mprintf(("Error looking up alternate ship type name!\n")); } else { @@ -1857,7 +1857,7 @@ int parse_object(mission *pm, int flag, p_object *objp) int team_index; find_and_stuff("$Team:", &team_index, F_NAME, Team_names, Num_team_names, "team name"); - Assert((team_index >= 0) && (team_index < MAX_TEAM_NAMES)); + SDL_assert((team_index >= 0) && (team_index < MAX_TEAM_NAMES)); objp->team = 1 << team_index; required_string("$Location:"); @@ -1872,7 +1872,7 @@ int parse_object(mission *pm, int flag, p_object *objp) if ( optional_string("+AI Class:")) { objp->ai_class = match_and_stuff(F_NAME, (const char **)Ai_class_names, Num_ai_classes, "AI class"); - Assert(objp->ai_class > -1 ); + SDL_assert(objp->ai_class > -1 ); } else { objp->ai_class = Ship_info[objp->ship_class].ai_class; } @@ -1898,7 +1898,7 @@ int parse_object(mission *pm, int flag, p_object *objp) parse_common_object_data(objp); // get initial conditions and subsys status count = 0; while (required_string_either("$Arrival Location:", "$Status Description:")) { - Assert(count < MAX_OBJECT_STATUS); + SDL_assert(count < MAX_OBJECT_STATUS); find_and_stuff("$Status Description:", &objp->status_type[count], F_NAME, Status_desc_names, Num_status_names, "Status Description"); find_and_stuff("$Status:", &objp->status[count], F_NAME, Status_type_names, Num_status_names, "Status Type"); @@ -1936,7 +1936,7 @@ int parse_object(mission *pm, int flag, p_object *objp) objp->arrival_cue = get_sexp_main(); if ( !Fred_running && (objp->arrival_cue >= 0) ) { // eval the arrival cue. if the cue is true, set up the timestamp for the arrival delay - Assert ( objp->arrival_delay <= 0 ); + SDL_assert ( objp->arrival_delay <= 0 ); // don't eval arrival_cues when just looking for player information. if ( eval_sexp(objp->arrival_cue) ){ // evaluate to determine if sexp is always false. @@ -1981,7 +1981,7 @@ int parse_object(mission *pm, int flag, p_object *objp) count = stuff_string_list(flag_strings, MAX_PARSE_OBJECT_FLAGS); for (i=0; iflags |= (1 << j); break; } @@ -2000,7 +2000,7 @@ int parse_object(mission *pm, int flag, p_object *objp) objp->escort_priority = 0; if ( optional_string("+Escort Priority:" ) ) { - Assert(objp->flags & P_SF_ESCORT); + SDL_assert(objp->flags & P_SF_ESCORT); stuff_int(&objp->escort_priority); } @@ -2025,7 +2025,7 @@ int parse_object(mission *pm, int flag, p_object *objp) objp->hotkey = -1; if (optional_string("+Hotkey:")) { stuff_int(&objp->hotkey); - Assert((objp->hotkey >= 0) && (objp->hotkey < 10)); + SDL_assert((objp->hotkey >= 0) && (objp->hotkey < 10)); } objp->docked_with[0] = 0; @@ -2055,7 +2055,7 @@ int parse_object(mission *pm, int flag, p_object *objp) if ( optional_string("+Destroy At:") ) { stuff_int(&destroy_before_mission_time); - Assert ( destroy_before_mission_time >= 0 ); + SDL_assert ( destroy_before_mission_time >= 0 ); objp->arrival_cue = Locked_sexp_true; objp->arrival_delay = timestamp(0); } @@ -2104,7 +2104,7 @@ int parse_object(mission *pm, int flag, p_object *objp) objp->respawn_count = 0; // if this if the starting player ship, then copy if to Starting_player_pobject (used for ingame join) - if ( !stricmp( objp->name, Player_start_shipname) ) { + if ( !SDL_strcasecmp( objp->name, Player_start_shipname) ) { Player_start_pobject = *objp; Player_start_pobject.flags |= P_SF_PLAYER_START_VALID; } @@ -2121,8 +2121,8 @@ int parse_object(mission *pm, int flag, p_object *objp) // don't create the object if it is intially docked for either FreeSpcae or Fred. Fred will // create the object later in post_process_mission if ( (objp->flags & P_SF_INITIALLY_DOCKED) || (!Fred_running && (!eval_sexp(objp->arrival_cue) || !timestamp_elapsed(objp->arrival_delay) || (objp->flags & P_SF_REINFORCEMENT))) ) { - Assert ( destroy_before_mission_time == -1 ); // we can't add ships getting destroyed to the arrival list!!! - Assert ( num_ship_arrivals < MAX_SHIP_ARRIVALS ); + SDL_assert ( destroy_before_mission_time == -1 ); // we can't add ships getting destroyed to the arrival list!!! + SDL_assert ( num_ship_arrivals < MAX_SHIP_ARRIVALS ); memcpy( &ship_arrivals[num_ship_arrivals], objp, sizeof(p_object) ); list_append(&ship_arrival_list, &ship_arrivals[num_ship_arrivals]); num_ship_arrivals++; @@ -2239,7 +2239,7 @@ void parse_objects(mission *pm, int flag) { p_object temp; - Assert(pm != NULL); + SDL_assert(pm != NULL); required_string("#Objects"); @@ -2311,7 +2311,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec // which should always give a number >= 0; if ( wingp->arrival_delay <= 0 ) { wingp->arrival_delay = timestamp( -wingp->arrival_delay * 1000 ); - Assert ( wingp->arrival_delay >= 0 ); + SDL_assert ( wingp->arrival_delay >= 0 ); } if ( !timestamp_elapsed( wingp->arrival_delay ) ) @@ -2323,7 +2323,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec int shipnum; char *name; - Assert( wingp->arrival_anchor >= 0 ); + SDL_assert( wingp->arrival_anchor >= 0 ); name = Parse_names[wingp->arrival_anchor]; // see if ship is yet to arrive. If so, then return -1 so we can evaluate again later. @@ -2353,7 +2353,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec // replaced following three lines of code with mission log call because of bug with // the Ships_exited list. //index = ship_find_exited_ship_by_name( name ); - //Assert( index != -1 ); + //SDL_assert( index != -1 ); //if (Ships_exited[index].flags & SEF_DESTROYED ) { if ( mission_log_get_time(LOG_SHIP_DESTROYED, name, NULL, NULL) ) { wingp->total_destroyed += num_remaining; @@ -2377,7 +2377,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec // if at least one of these is valid, then reset the timestamp. If they are both zero, we will create the // wave if ( (wingp->wave_delay_min > 0) || (wingp->wave_delay_max > 0) ) { - Assert ( wingp->wave_delay_min <= wingp->wave_delay_max ); + SDL_assert ( wingp->wave_delay_min <= wingp->wave_delay_max ); time_to_arrive = wingp->wave_delay_min + (int)(frand() * (wingp->wave_delay_max - wingp->wave_delay_min)); // MWA -- 5/18/98 @@ -2442,7 +2442,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec continue; } - Assert ( !(objp->flags & P_SF_CANNOT_ARRIVE) ); // get allender + SDL_assert ( !(objp->flags & P_SF_CANNOT_ARRIVE) ); // get allender int index; @@ -2509,12 +2509,12 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec // flag ship with SF_FROM_PLAYER_WING if a member of player starting wings if ( (Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_TEAM) ) { // but for team vs. team games, then just check the alpha and zeta wings - if ( !(stricmp(Starting_wing_names[STARTING_WING_ALPHA], wingp->name)) || !(stricmp(Starting_wing_names[STARTING_WING_ZETA], wingp->name)) ) { + if ( !(SDL_strcasecmp(Starting_wing_names[STARTING_WING_ALPHA], wingp->name)) || !(SDL_strcasecmp(Starting_wing_names[STARTING_WING_ZETA], wingp->name)) ) { Ships[Objects[objnum].instance].flags |= SF_FROM_PLAYER_WING; } } else { for (int i = 0; i < MAX_STARTING_WINGS; i++ ) { - if ( !stricmp(Starting_wing_names[i], wingp->name) ) { + if ( !SDL_strcasecmp(Starting_wing_names[i], wingp->name) ) { Ships[Objects[objnum].instance].flags |= SF_FROM_PLAYER_WING; } } @@ -2530,7 +2530,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec objp = temp; } - Assert ( num_to_create == 0 ); // we should always have enough ships in the list!!! + SDL_assert ( num_to_create == 0 ); // we should always have enough ships in the list!!! // possibly play some event driven music here. Send a network packet indicating the wing was // created. Only do this stuff if actually in the mission. @@ -2571,7 +2571,7 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, int force, int spec // test code to check to be sure that all ships in the wing are ignoring the same types // of orders from the player if ( Fred_running ) { - Assert( wingp->ship_index[0] != -1 ); + SDL_assert( wingp->ship_index[0] != -1 ); int orders = Ships[wingp->ship_index[0]].orders_accepted; for (i = 1; i < wingp->current_count; i++ ) { if ( orders != Ships[wingp->ship_index[i]].orders_accepted ) { @@ -2595,7 +2595,7 @@ void parse_wing(mission *pm) char wing_flag_strings[MAX_WING_FLAGS][NAME_LENGTH]; wing *wingp; - Assert(pm != NULL); + SDL_assert(pm != NULL); wingp = &Wings[num_wings]; required_string("$Name:"); @@ -2611,7 +2611,7 @@ void parse_wing(mission *pm) required_string("$Waves:"); stuff_int(&wingp->num_waves); - Assert ( wingp->num_waves >= 1 ); // there must be at least 1 wave + SDL_assert ( wingp->num_waves >= 1 ); // there must be at least 1 wave wingp->current_wave = 0; @@ -2690,7 +2690,7 @@ void parse_wing(mission *pm) wingp->hotkey = -1; if (optional_string("+Hotkey:")) { stuff_int(&wingp->hotkey); - Assert((wingp->hotkey >= 0) && (wingp->hotkey < 10)); + SDL_assert((wingp->hotkey >= 0) && (wingp->hotkey < 10)); } if (optional_string("+Flags:")) { @@ -2698,19 +2698,19 @@ void parse_wing(mission *pm) count = stuff_string_list( wing_flag_strings, MAX_WING_FLAGS ); for (i = 0; i < count; i++ ) { - if ( !stricmp( wing_flag_strings[i], NOX("ignore-count")) ) + if ( !SDL_strcasecmp( wing_flag_strings[i], NOX("ignore-count")) ) wingp->flags |= WF_IGNORE_COUNT; - else if ( !stricmp( wing_flag_strings[i], NOX("reinforcement")) ) + else if ( !SDL_strcasecmp( wing_flag_strings[i], NOX("reinforcement")) ) wingp->flags |= WF_REINFORCEMENT; - else if ( !stricmp( wing_flag_strings[i], NOX("no-arrival-music")) ) + else if ( !SDL_strcasecmp( wing_flag_strings[i], NOX("no-arrival-music")) ) wingp->flags |= WF_NO_ARRIVAL_MUSIC; - else if ( !stricmp( wing_flag_strings[i], NOX("no-arrival-message")) ) + else if ( !SDL_strcasecmp( wing_flag_strings[i], NOX("no-arrival-message")) ) wingp->flags |= WF_NO_ARRIVAL_MESSAGE; - else if ( !stricmp( wing_flag_strings[i], NOX("no-arrival-warp")) ) + else if ( !SDL_strcasecmp( wing_flag_strings[i], NOX("no-arrival-warp")) ) wingp->flags |= WF_NO_ARRIVAL_WARP; - else if ( !stricmp( wing_flag_strings[i], NOX("no-departure-warp")) ) + else if ( !SDL_strcasecmp( wing_flag_strings[i], NOX("no-departure-warp")) ) wingp->flags |= WF_NO_DEPARTURE_WARP; - else if ( !stricmp( wing_flag_strings[i], NOX("no-dynamic")) ) + else if ( !SDL_strcasecmp( wing_flag_strings[i], NOX("no-dynamic")) ) wingp->flags |= WF_NO_DYNAMIC; else Warning(LOCATION, "unknown wing flag\n%s\n\nSkipping.", wing_flag_strings[i]); @@ -2741,7 +2741,7 @@ void parse_wing(mission *pm) // these wings. if ( Game_mode & GM_MULTIPLAYER ) { for (i = 0; i < MAX_STARTING_WINGS+1; i++ ) { - if ( !stricmp(Starting_wing_names[i], wingp->name) ) { + if ( !SDL_strcasecmp(Starting_wing_names[i], wingp->name) ) { if ( wingp->num_waves > 1 ) { // only end the game if we're the server - clients will eventually find out :) if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ @@ -2795,7 +2795,7 @@ void parse_wing(mission *pm) ship_name = ship_names[i]; if (Fred_running) { num = wingp->ship_index[i] = ship_name_lookup(ship_name, 1); - Assert ( num != -1 ); + SDL_assert ( num != -1 ); // hack code -- REMOVE if ( Objects[Ships[num].objnum].flags & OF_PLAYER_SHIP ) @@ -2803,7 +2803,7 @@ void parse_wing(mission *pm) } else { // determine if this ship is a player ship, and deal with it appropriately. - if ( !strnicmp(ship_name, NOX("Player "), 7) ) { + if ( !SDL_strncasecmp(ship_name, NOX("Player "), 7) ) { Error(LOCATION, "Old mission file -- please convert by loading/saving in Fred -- see Allender/Hoffoss for help."); } @@ -2818,7 +2818,7 @@ void parse_wing(mission *pm) objp = GET_FIRST(&ship_arrival_list); while( objp != END_OF_LIST(&ship_arrival_list) ) { if ( !strcmp(ship_name, objp->name) ) { - Assert ( objp->wingnum == -1 ); // get Allender -- ship appears to be in multiple wings + SDL_assert ( objp->wingnum == -1 ); // get Allender -- ship appears to be in multiple wings objp->wingnum = wingnum; assigned++; } @@ -2840,7 +2840,7 @@ void parse_wings(mission *pm) { required_string("#Wings"); while (required_string_either("#Events", "$Name:")) { - Assert(num_wings < MAX_WINGS); + SDL_assert(num_wings < MAX_WINGS); parse_wing(pm); num_wings++; } @@ -2919,7 +2919,7 @@ void parse_events(mission *pm) required_string("#Events"); while (required_string_either( "#Goals", "$Formula:")) { - Assert( Num_mission_events < MAX_MISSION_EVENTS ); + SDL_assert( Num_mission_events < MAX_MISSION_EVENTS ); parse_event(pm); Num_mission_events++; } @@ -2933,8 +2933,8 @@ void parse_goal(mission *pm) goalp = &Mission_goals[Num_goals++]; - Assert(Num_goals < MAX_GOALS); - Assert(pm != NULL); + SDL_assert(Num_goals < MAX_GOALS); + SDL_assert(pm != NULL); find_and_stuff("$Type:", &goalp->type, F_NAME, Goal_type_names, Num_goal_type_names, "goal type"); @@ -2989,8 +2989,8 @@ void parse_waypoint_list(mission *pm) waypoint_list *wpl; - Assert(Num_waypoint_lists < MAX_WAYPOINT_LISTS); - Assert(pm != NULL); + SDL_assert(Num_waypoint_lists < MAX_WAYPOINT_LISTS); + SDL_assert(pm != NULL); wpl = &Waypoint_lists[Num_waypoint_lists]; required_string("$Name:"); @@ -3005,12 +3005,12 @@ void parse_waypoint_list(mission *pm) // into one of the docking bays on the Lucifer. Due to some change in the code the // waypoints and the Lucifer's position don't match up so we have to change the // waypoint position to compensate. - if ( !stricmp(pm->name, "Playing Judas") ) { - if ( !stricmp(wpl->name, "Docking Bay 1") ) { + if ( !SDL_strcasecmp(pm->name, "Playing Judas") ) { + if ( !SDL_strcasecmp(wpl->name, "Docking Bay 1") ) { wpl->waypoints[0].xyz.x = -1262.550903; wpl->waypoints[0].xyz.y = 27.676950; wpl->waypoints[0].xyz.z = 4461.702930; - } else if ( !stricmp(wpl->name, "Docking Bat 2") ) { // it really is spelled "Bat" in the mission + } else if ( !SDL_strcasecmp(wpl->name, "Docking Bat 2") ) { // it really is spelled "Bat" in the mission wpl->waypoints[0].xyz.x = -1105.347976; wpl->waypoints[0].xyz.y = 27.676950; wpl->waypoints[0].xyz.z = 3900.236867; @@ -3030,10 +3030,10 @@ void parse_waypoints(mission *pm) Num_jump_nodes = 0; while (optional_string("$Jump Node:")) { - Assert(Num_jump_nodes < MAX_JUMP_NODES); + SDL_assert(Num_jump_nodes < MAX_JUMP_NODES); stuff_vector(&pos); z = jumpnode_create(&pos); - Assert(z >= 0); + SDL_assert(z >= 0); if (optional_string("$Jump Node Name:")) { stuff_string(Jump_nodes[Num_jump_nodes - 1].name, F_NAME, NULL); @@ -3070,8 +3070,8 @@ void parse_reinforcement(mission *pm) reinforcements *ptr; int instance; - Assert(Num_reinforcements < MAX_REINFORCEMENTS); - Assert(pm != NULL); + SDL_assert(Num_reinforcements < MAX_REINFORCEMENTS); + SDL_assert(pm != NULL); ptr = &Reinforcements[Num_reinforcements]; required_string("$Name:"); @@ -3104,7 +3104,7 @@ void parse_reinforcement(mission *pm) p_object *p_objp; for ( p_objp = GET_FIRST(&ship_arrival_list); p_objp != END_OF_LIST(&ship_arrival_list); p_objp = GET_NEXT(p_objp) ) { - if ( !stricmp(ptr->name, p_objp->name) ){ + if ( !SDL_strcasecmp(ptr->name, p_objp->name) ){ break; } } @@ -3141,7 +3141,7 @@ void parse_bitmap(mission *pm) Num_suns = 0; - Assert(pm != NULL); + SDL_assert(pm != NULL); while(optional_string("$Bitmap:")) { stuff_string(b.filename, F_NAME, NULL); @@ -3173,14 +3173,14 @@ void parse_bitmap(mission *pm) int z; starfield_bitmaps *ptr; - Assert(Num_starfield_bitmaps < MAX_STARFIELD_BITMAPS); - Assert(pm != NULL); + SDL_assert(Num_starfield_bitmaps < MAX_STARFIELD_BITMAPS); + SDL_assert(pm != NULL); ptr = &Starfield_bitmaps[Num_starfield_bitmaps]; required_string("$Bitmap:"); stuff_string(name, F_NAME, NULL); for (z=0; z= 0) { - Assert(Initially_docked[i].docker->type == OBJ_SHIP); + SDL_assert(Initially_docked[i].docker->type == OBJ_SHIP); p1 = model_find_dock_name_index(Ships[Initially_docked[i].docker->instance].modelnum, Initially_docked[i].docker_point); - Assert(Objects[z].type == OBJ_SHIP); + SDL_assert(Objects[z].type == OBJ_SHIP); p2 = model_find_dock_name_index(Ships[Objects[z].instance].modelnum, Initially_docked[i].dockee_point); @@ -3836,7 +3836,7 @@ int parse_main(const char *mission_name, int flags) // fill in Ship_class_names array with the names from the ship_info struct; Num_parse_names = 0; Mission_all_attack = 0; // Might get set in mission load. - Assert(Num_ship_types < MAX_SHIP_TYPES); + SDL_assert(Num_ship_types < MAX_SHIP_TYPES); for (i = 0; i < Num_ship_types; i++) Ship_class_names[i] = Ship_info[i].name; @@ -3997,7 +3997,7 @@ void mission_parse_do_initial_docks() // the ship exists, so create this object, then dock the two. objnum = parse_create_object( pobjp ); - Assert ( objnum != -1 ); + SDL_assert ( objnum != -1 ); list_remove( &ship_arrival_list, pobjp); @@ -4096,7 +4096,7 @@ int mission_parse_get_multi_mission_info( const char *filename ) return -1; } - Assert( The_mission.game_type & MISSION_TYPE_MULTI ); // assume multiplayer only for now? + SDL_assert( The_mission.game_type & MISSION_TYPE_MULTI ); // assume multiplayer only for now? // return the number of parse_players. later, we might want to include (optionally?) the number // of other ships in the main players wing (usually wing 'alpha') for inclusion of number of @@ -4111,7 +4111,7 @@ int mission_parse_ship_arrived( const char *shipname ) p_object *objp; for ( objp = GET_FIRST(&ship_arrival_list); objp !=END_OF_LIST(&ship_arrival_list); objp = GET_NEXT(objp) ) { - if ( !stricmp( objp->name, shipname) ) + if ( !SDL_strcasecmp( objp->name, shipname) ) return 0; // still on the arrival list } return 1; @@ -4123,7 +4123,7 @@ p_object *mission_parse_get_arrival_ship( const char *name ) p_object *objp; for ( objp = GET_FIRST(&ship_arrival_list); objp !=END_OF_LIST(&ship_arrival_list); objp = GET_NEXT(objp) ) { - if ( !stricmp( objp->name, name) ) + if ( !SDL_strcasecmp( objp->name, name) ) return objp; // still on the arrival list } @@ -4154,7 +4154,7 @@ int mission_set_arrival_location(int anchor, int location, int dist, int objnum, if ( location == ARRIVE_AT_LOCATION ) return 0; - Assert(anchor >= 0); + SDL_assert(anchor >= 0); // this ship might possibly arrive at another location. The location is based on the // proximity of some ship (and some other special tokens) @@ -4164,7 +4164,7 @@ int mission_set_arrival_location(int anchor, int location, int dist, int objnum, if (anchor < SPECIAL_ARRIVAL_ANCHORS_OFFSET) { shipnum = ship_name_lookup(Parse_names[anchor]); if ( shipnum == -1 ) { - Assert ( location != ARRIVE_FROM_DOCK_BAY ); // bogus data somewhere!!! get mwa + SDL_assert ( location != ARRIVE_FROM_DOCK_BAY ); // bogus data somewhere!!! get mwa nprintf (("allender", "couldn't find ship for arrival anchor -- using location ship created at")); return 0; } @@ -4194,7 +4194,7 @@ int mission_set_arrival_location(int anchor, int location, int dist, int objnum, // take the shipnum and get the position. once we have positions, we can determine where // to make this ship appear - Assert ( shipnum != -1 ); + SDL_assert ( shipnum != -1 ); anchor_objnum = Ships[shipnum].objnum; anchor_pos = Objects[anchor_objnum].pos; @@ -4293,7 +4293,7 @@ void mission_parse_mark_reinforcement_available(char *name) for (i = 0; i < Num_reinforcements; i++) { rp = &Reinforcements[i]; - if ( !stricmp(rp->name, name) ) { + if ( !SDL_strcasecmp(rp->name, name) ) { if ( !(rp->flags & RF_IS_AVAILABLE) ) { rp->flags |= RF_IS_AVAILABLE; @@ -4306,7 +4306,7 @@ void mission_parse_mark_reinforcement_available(char *name) } } - Assert ( i < Num_reinforcements ); + SDL_assert ( i < Num_reinforcements ); } // mission_did_ship_arrive takes a parse object and checked the arrival cue and delay and @@ -4333,13 +4333,13 @@ int mission_did_ship_arrive(p_object *objp) if ( did_arrive ) { // has the arrival criteria been met? int object_num; - Assert ( !(objp->flags & P_SF_CANNOT_ARRIVE) ); // get allender + SDL_assert ( !(objp->flags & P_SF_CANNOT_ARRIVE) ); // get allender // check to see if the delay field <= 0. if so, then create a timestamp and then maybe // create the object if ( objp->arrival_delay <= 0 ) { objp->arrival_delay = timestamp( -objp->arrival_delay * 1000 ); - Assert( objp->arrival_delay >= 0 ); + SDL_assert( objp->arrival_delay >= 0 ); } // if the timestamp hasn't elapsed, move onto the next ship. @@ -4352,7 +4352,7 @@ int mission_did_ship_arrive(p_object *objp) int shipnum; char *name; - Assert( objp->arrival_anchor >= 0 ); + SDL_assert( objp->arrival_anchor >= 0 ); name = Parse_names[objp->arrival_anchor]; // see if ship is yet to arrive. If so, then return -1 so we can evaluate again later. @@ -4372,7 +4372,7 @@ int mission_did_ship_arrive(p_object *objp) // since this ship is not in a wing, create a SHIP_ARRIVE entry //mission_log_add_entry( LOG_SHIP_ARRIVE, objp->name, NULL ); - Assert(object_num >= 0 && object_num < MAX_OBJECTS); + SDL_assert(object_num >= 0 && object_num < MAX_OBJECTS); // Play the music track for an arrival if ( !(Ships[Objects[object_num].instance].flags & SF_NO_ARRIVAL_MUSIC) ) @@ -4604,12 +4604,12 @@ void mission_eval_arrivals() if ( rship != -1 ) { message_send_builtin_to_player( MESSAGE_GAMMA_ARRIVED, &Ships[rship], MESSAGE_PRIORITY_LOW, MESSAGE_TIME_SOON, 0, 0, -1, -1 ); } - } else if ( !stricmp( wingp->name, "delta") ) { + } else if ( !SDL_strcasecmp( wingp->name, "delta") ) { rship = ship_get_random_ship_in_wing( i, SHIP_GET_NO_PLAYERS ); if ( rship != -1 ) { message_send_builtin_to_player( MESSAGE_DELTA_ARRIVED, &Ships[rship], MESSAGE_PRIORITY_LOW, MESSAGE_TIME_SOON, 0, 0, -1, -1 ); } - } else if ( !stricmp(wingp->name, "epsilon") ) { + } else if ( !SDL_strcasecmp(wingp->name, "epsilon") ) { rship = ship_get_random_ship_in_wing( i, SHIP_GET_NO_PLAYERS ); if ( rship != -1 ) { message_send_builtin_to_player( MESSAGE_EPSILON_ARRIVED, &Ships[rship], MESSAGE_PRIORITY_LOW, MESSAGE_TIME_SOON, 0, 0, -1, -1 ); @@ -4647,7 +4647,7 @@ void mission_do_departure( object *objp ) MONITOR_INC(NumShipDepartures,1); - Assert ( objp->type == OBJ_SHIP ); + SDL_assert ( objp->type == OBJ_SHIP ); shipp = &Ships[objp->instance]; // if departing to a docking bay, try to find the anchor ship to depart to. If not found, then @@ -4656,7 +4656,7 @@ void mission_do_departure( object *objp ) int anchor_shipnum; char *name; - Assert( shipp->departure_anchor >= 0 ); + SDL_assert( shipp->departure_anchor >= 0 ); name = Parse_names[shipp->departure_anchor]; // see if ship is yet to arrive. If so, then return -1 so we can evaluate again later. @@ -4696,7 +4696,7 @@ void mission_eval_departures() if (objp->type == OBJ_SHIP) { ship *shipp; - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; @@ -4760,7 +4760,7 @@ void mission_eval_departures() // shipp->flags |= SF_DEPARTING; // shipp->final_depart_time = timestamp(3*1000); - Assert ( shipp->objnum != -1 ); + SDL_assert ( shipp->objnum != -1 ); objp = &Objects[shipp->objnum]; // copy the wing's depature information to the ship @@ -4803,7 +4803,7 @@ int allocate_subsys_status() { int i; - Assert(Subsys_index < MAX_SUBSYS_STATUS); + SDL_assert(Subsys_index < MAX_SUBSYS_STATUS); Subsys_status[Subsys_index].percent = 0.0f; Subsys_status[Subsys_index].primary_banks[0] = SUBSYS_STATUS_NO_CHANGE; for (i=1; iinstance]; // check for duplicates before adding for (i = 0; i < Num_arriving_repair_targets; i++ ) { - if ( !stricmp(Arriving_repair_targets[i], shipp->ship_name) ){ + if ( !SDL_strcasecmp(Arriving_repair_targets[i], shipp->ship_name) ){ break; } } @@ -4934,7 +4934,7 @@ void mission_warp_in_support_ship( object *requester_objp ) int i, requester_species; ship *requester_shipp; - Assert ( requester_objp->type == OBJ_SHIP ); + SDL_assert ( requester_objp->type == OBJ_SHIP ); requester_shipp = &Ships[requester_objp->instance]; // MK, 10/23/97, used to be ->type, bogus, no? // if the support ship is already arriving, add the requester to the list @@ -4964,7 +4964,7 @@ void mission_warp_in_support_ship( object *requester_objp ) // Choose position to warp in ship. // Temporary, but changed by MK because it used to be exactly behind the player. - // This could cause an Assert if the player immediately targeted it (before moving). + // This could cause an SDL_assert if the player immediately targeted it (before moving). // Tend to put in front of the player to aid him in flying towards the ship. if (!get_warp_in_pos(&warp_in_pos, requester_objp, 1.0f, 0.1f, 1.0f)) @@ -5001,7 +5001,7 @@ void mission_warp_in_support_ship( object *requester_objp ) // 5/6/98 -- MWA Don't need to do anything for multiplayer. I think that we always want to use // the species of the caller ship. - Assert( (requester_species == SPECIES_TERRAN) || (requester_species == SPECIES_VASUDAN) ); + SDL_assert( (requester_species == SPECIES_TERRAN) || (requester_species == SPECIES_VASUDAN) ); // if ( (Game_mode & GM_NORMAL) && (requester_species == SPECIES_VASUDAN) ) { // make vasundan's use the terran support ship // requester_species = SPECIES_TERRAN; // } @@ -5030,7 +5030,7 @@ void mission_warp_in_support_ship( object *requester_objp ) // need to set ship's cargo to nothing. scan the cargo_names array looking for the string nothing. // add it if not found for (i = 0; i < Num_cargo; i++ ) - if ( !stricmp(Cargo_names[i], NOX("nothing")) ) + if ( !SDL_strcasecmp(Cargo_names[i], NOX("nothing")) ) break; if ( i == Num_cargo ) { @@ -5095,7 +5095,7 @@ int mission_is_repair_scheduled( object *objp ) if ( !Arriving_support_ship ) return 0; - Assert ( objp->type == OBJ_SHIP ); + SDL_assert ( objp->type == OBJ_SHIP ); name = Ships[objp->instance].ship_name; for (i = 0; i < Num_arriving_repair_targets; i++ ) { if ( !strcmp( name, Arriving_repair_targets[i]) ) @@ -5117,7 +5117,7 @@ int mission_remove_scheduled_repair( object *objp ) // itereate through the target list looking for this ship name. If not found, we // can simply return. - Assert ( objp->type == OBJ_SHIP ); + SDL_assert ( objp->type == OBJ_SHIP ); name = Ships[objp->instance].ship_name; for (index = 0; index < Num_arriving_repair_targets; index++ ) { if ( !strcmp( name, Arriving_repair_targets[index]) ) diff --git a/src/mission/missiontraining.cpp b/src/mission/missiontraining.cpp index a41c78d..cc1fc19 100644 --- a/src/mission/missiontraining.cpp +++ b/src/mission/missiontraining.cpp @@ -541,7 +541,7 @@ void training_mission_init() { int i; - Assert(!Training_num_lines); + SDL_assert(!Training_num_lines); Training_obj_num_lines = 0; Training_msg_que_count = 0; Training_failure = 0; @@ -580,8 +580,8 @@ int comp_training_lines_by_born_on_date(const void *m1, const void *m2) e1 = (int*) m1; e2 = (int*) m2; - Assert(Mission_events[*e1 & 0xffff].born_on_date != 0); - Assert(Mission_events[*e2 & 0xffff].born_on_date != 0); + SDL_assert(Mission_events[*e1 & 0xffff].born_on_date != 0); + SDL_assert(Mission_events[*e2 & 0xffff].born_on_date != 0); return (Mission_events[*e1 & 0xffff].born_on_date - Mission_events[*e2 & 0xffff].born_on_date); } @@ -702,7 +702,7 @@ void training_check_objectives() for (event_idx=0; event_idx Mission_events[event_idx].born_on_date + 3000) ) { - if (!Training_failure || !strnicmp(Mission_events[event_idx].name, XSTR( "Training failed", 423), 15)) { + if (!Training_failure || !SDL_strncasecmp(Mission_events[event_idx].name, XSTR( "Training failed", 423), 15)) { // check for the actual objective for (i=0; i 0); + SDL_assert(Training_num_lines > 0); for (i=0; i= Num_messages) return; } @@ -1077,7 +1077,7 @@ void message_training_display() message_translate_tokens(Training_buf, Training_text); training_process_msg(Training_text); Training_num_lines = split_str(Training_buf, TRAINING_LINE_WIDTH, Training_line_sizes, Training_lines, MAX_TRAINING_MSG_LINES); - Assert(Training_num_lines > 0); + SDL_assert(Training_num_lines > 0); for (i=0; i"), 3)) { - Assert(count < MAX_TRAINING_MSG_MODS); + if (!SDL_strncasecmp(src, NOX(""), 3)) { + SDL_assert(count < MAX_TRAINING_MSG_MODS); src += 3; Training_msg_mods[count].pos = dest; Training_msg_mods[count].mode = TMMOD_BOLD; count++; } - if (!strnicmp(src, NOX(""), 4)) { - Assert(count < MAX_TRAINING_MSG_MODS); + if (!SDL_strncasecmp(src, NOX(""), 4)) { + SDL_assert(count < MAX_TRAINING_MSG_MODS); src += 4; Training_msg_mods[count].pos = dest; Training_msg_mods[count].mode = TMMOD_NORMAL; diff --git a/src/missionui/chatbox.cpp b/src/missionui/chatbox.cpp index 358ec62..a9afad3 100644 --- a/src/missionui/chatbox.cpp +++ b/src/missionui/chatbox.cpp @@ -748,7 +748,7 @@ int chatbox_create(int mode_flags) } // probably shouldn't be using the chatbox in single player mode - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); // setup all data to correspond to our mode flags chatbox_set_mode(mode_flags); @@ -1036,11 +1036,11 @@ void chatbox_add_line(const char *msg, int pid, int add_id) } else { strcpy(msg_extra,msg); } - Assert(strlen(msg_extra) < (CHATBOX_STRING_LEN - 2)); + SDL_assert(strlen(msg_extra) < (CHATBOX_STRING_LEN - 2)); // split the text up into as many lines as necessary n_lines = split_str(msg_extra, Chatbox_disp_w, n_chars, p_str, 3); - Assert(n_lines != -1); + SDL_assert(n_lines != -1); // setup the first line -- be sure to clear out the line memset( Brief_chat_lines[Brief_current_add_line], 0, CHATBOX_STRING_LEN ); @@ -1073,7 +1073,7 @@ void chatbox_add_line(const char *msg, int pid, int add_id) if(n_lines > 1){ // split up the string after the first break-marker n_lines = split_str(msg_extra + n_chars[0],Chatbox_disp_w - CHAT_LINE_INDENT,n_chars,p_str,3); - Assert(n_lines != -1); + SDL_assert(n_lines != -1); // setup these remaining lines for(idx=0;idx= 0); + SDL_assert(Current_brief_stage >= 0); } // -------------------------------------------------------------------------------------- @@ -748,7 +748,7 @@ void brief_do_prev_pressed() } else { gamesnd_play_iface(SND_BRIEF_STAGE_CHG); } - Assert(Current_brief_stage >= 0); + SDL_assert(Current_brief_stage >= 0); } @@ -766,7 +766,7 @@ void brief_do_start_pressed() } else { gamesnd_play_iface(SND_GENERAL_FAIL); } - Assert(Current_brief_stage >= 0); + SDL_assert(Current_brief_stage >= 0); } // -------------------------------------------------------------------------------------- @@ -784,7 +784,7 @@ void brief_do_end_pressed() } else { gamesnd_play_iface(SND_GENERAL_FAIL); } - Assert(Current_brief_stage >= 0); + SDL_assert(Current_brief_stage >= 0); } @@ -871,7 +871,7 @@ void brief_button_do(int i) break; case BRIEF_BUTTON_MULTI_LOCK: - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); // the "lock" button has been pressed multi_ts_lock_pressed(); @@ -1382,10 +1382,10 @@ void brief_render_closeup_text() gr_set_color_fast(&Color_white); // n_lines = split_str(bi->text, CLOSEUP_W - 2*CLOSEUP_TEXT_OFFSET, n_chars, p_str, MAX_ICON_TEXT_LINES); - Assert(n_lines != -1); + SDL_assert(n_lines != -1); for ( i = 0; i < n_lines; i++ ) { - Assert(n_chars[i] < MAX_ICON_TEXT_LINE_LEN); + SDL_assert(n_chars[i] < MAX_ICON_TEXT_LINE_LEN); strncpy(line, p_str[i], n_chars[i]); line[n_chars[i]] = 0; gr_printf(0,0+i*Closeup_font_height,line); @@ -1479,7 +1479,7 @@ void brief_render(float frametime) if ( Num_brief_stages <= 0 ) { gr_set_color_fast(&Color_white); - Assert( Game_current_mission_filename != NULL ); + SDL_assert( Game_current_mission_filename != NULL ); gr_printf(0x8000,200,XSTR( "No Briefing exists for mission: %s", 430), Game_current_mission_filename); #ifndef NDEBUG @@ -1675,7 +1675,7 @@ int brief_setup_closeup(brief_icon *bi) break; default: brief_get_closeup_ship_modelnum(Closeup_icon); - Assert( Closeup_icon->ship_class != -1 ); + SDL_assert( Closeup_icon->ship_class != -1 ); sip = &Ship_info[Closeup_icon->ship_class]; strcpy(Closeup_icon->closeup_label,sip->name); @@ -2058,7 +2058,7 @@ void brief_do_frame(float frametime) if ( abs(Current_brief_stage - Last_brief_stage) > 1 ) { Quick_transition_stage = Current_brief_stage; Current_brief_stage = Last_brief_stage; - Assert(Current_brief_stage >= 0); + SDL_assert(Current_brief_stage >= 0); Start_fade_up_anim = 1; goto Transition_done; } @@ -2069,7 +2069,7 @@ void brief_do_frame(float frametime) if ( Briefing->stages[Last_brief_stage].flags & BS_FORWARD_CUT ) { Quick_transition_stage = Current_brief_stage; Current_brief_stage = Last_brief_stage; - Assert(Current_brief_stage >= 0); + SDL_assert(Current_brief_stage >= 0); Start_fade_up_anim = 1; goto Transition_done; } else { @@ -2080,7 +2080,7 @@ void brief_do_frame(float frametime) if ( Briefing->stages[Last_brief_stage].flags & BS_BACKWARD_CUT ) { Quick_transition_stage = Current_brief_stage; Current_brief_stage = Last_brief_stage; - Assert(Current_brief_stage >= 0); + SDL_assert(Current_brief_stage >= 0); Start_fade_up_anim = 1; goto Transition_done; } else { @@ -2349,7 +2349,7 @@ void brief_maybe_blit_scene_cut(float frametime) Current_brief_stage = Last_brief_stage; } - Assert(Current_brief_stage >= 0); + SDL_assert(Current_brief_stage >= 0); goto Fade_down_anim_start; } diff --git a/src/missionui/missioncmdbrief.cpp b/src/missionui/missioncmdbrief.cpp index 1cd8591..25ab774 100644 --- a/src/missionui/missioncmdbrief.cpp +++ b/src/missionui/missioncmdbrief.cpp @@ -404,10 +404,10 @@ void cmd_brief_init_voice() { int i; - Assert(Cur_cmd_brief); + SDL_assert(Cur_cmd_brief); for (i=0; inum_stages; i++) { Cur_cmd_brief->stage[i].wave = -1; - if (stricmp(Cur_cmd_brief->stage[i].wave_filename, NOX("none")) && Cur_cmd_brief->stage[i].wave_filename[0]) { + if (SDL_strcasecmp(Cur_cmd_brief->stage[i].wave_filename, NOX("none")) && Cur_cmd_brief->stage[i].wave_filename[0]) { Cur_cmd_brief->stage[i].wave = audiostream_open(Cur_cmd_brief->stage[i].wave_filename, ASF_VOICE); if (Cur_cmd_brief->stage[i].wave < 0) { nprintf(("General", "Failed to load \"%s\"", Cur_cmd_brief->stage[i].wave_filename)); @@ -625,7 +625,7 @@ void cmd_brief_ani_wave_init(int index) // first, search and see if anim is already used in another stage for (i=0; istage[i].ani_filename, Cur_cmd_brief->stage[index].ani_filename)) { + if (!SDL_strcasecmp(Cur_cmd_brief->stage[i].ani_filename, Cur_cmd_brief->stage[index].ani_filename)) { if (Cur_cmd_brief->stage[i].anim_ref >= 0) Cur_cmd_brief->stage[index].anim_ref = Cur_cmd_brief->stage[i].anim_ref; else @@ -638,7 +638,7 @@ void cmd_brief_ani_wave_init(int index) // this is the first instance of the given anim filename Cur_cmd_brief->stage[index].anim_ref = -1; name = Cur_cmd_brief->stage[index].ani_filename; - if (!name[0] || !stricmp(name, NOX("")) || !stricmp(name, NOX("none.ani"))) { + if (!name[0] || !SDL_strcasecmp(name, NOX("")) || !SDL_strcasecmp(name, NOX("none.ani"))) { name = NOX("CB_default"); strcpy(Cur_cmd_brief->stage[index].ani_filename, name); } @@ -698,7 +698,7 @@ void cmd_brief_init(int team) /* Palette_bmp = bm_load("BarracksPalette"); //CommandBriefPalette"); - Assert(Palette_bmp); + SDL_assert(Palette_bmp); bm_get_palette(Palette_bmp, Palette, Palette_name); // get the palette for this bitmap gr_set_palette(Palette_name, Palette, 1); */ diff --git a/src/missionui/missiondebrief.cpp b/src/missionui/missiondebrief.cpp index b034aec..60877b8 100644 --- a/src/missionui/missiondebrief.cpp +++ b/src/missionui/missiondebrief.cpp @@ -282,7 +282,7 @@ * Fix bug where window controls get disabled when F1 pressed twice * * 169 5/24/98 12:55a Mike - * Prevent Assert() when no debriefing text for a stage. + * Prevent SDL_assert() when no debriefing text for a stage. * * 168 5/23/98 10:38p Lawrance * Avoid doing a cfile refresh when running debug @@ -320,7 +320,7 @@ * * 158 5/16/98 9:14p Allender * fix scoring ckise fir training missions to actually count medals, but - * nothing else. Code used to Assert when wings were granted then taken + * nothing else. Code used to SDL_assert when wings were granted then taken * away because they were actually never granted in scoring structure * * 157 5/15/98 5:15p Dave @@ -935,32 +935,32 @@ void debrief_award_text_clear(); // functions const char *debrief_tooltip_handler(const char *str) { - if (!stricmp(str, NOX("@.Medal"))) { + if (!SDL_strcasecmp(str, NOX("@.Medal"))) { if (Award_active){ return XSTR( "Medal", 435); } - } else if (!stricmp(str, NOX("@.Rank"))) { + } else if (!SDL_strcasecmp(str, NOX("@.Rank"))) { if (Award_active){ return XSTR( "Rank", 436); } - } else if (!stricmp(str, NOX("@.Badge"))) { + } else if (!SDL_strcasecmp(str, NOX("@.Badge"))) { if (Award_active){ return XSTR( "Badge", 437); } - } else if (!stricmp(str, NOX("@Medal"))) { + } else if (!SDL_strcasecmp(str, NOX("@Medal"))) { if (Medal_bitmap >= 0){ return Medals[Player->stats.m_medal_earned].name; } - } else if (!stricmp(str, NOX("@Rank"))) { + } else if (!SDL_strcasecmp(str, NOX("@Rank"))) { if (Rank_bitmap >= 0){ return Ranks[Promoted].name; } - } else if (!stricmp(str, NOX("@Badge"))) { + } else if (!SDL_strcasecmp(str, NOX("@Badge"))) { if (Badge_bitmap >= 0){ return Medals[Badge_index[Player->stats.m_badge_earned]].name; } @@ -1020,7 +1020,7 @@ void debrief_voice_load_all() if ( strlen(Debrief_stages[i]->voice) <= 0 ) { continue; } - if ( strnicmp(Debrief_stages[i]->voice, NOX("none"), 4) ) { + if ( SDL_strncasecmp(Debrief_stages[i]->voice, NOX("none"), 4) ) { debrief_load_voice_file(i, Debrief_stages[i]->voice); // Debrief_voices[i] = audiostream_open(Debrief_stages[i]->voice, ASF_VOICE); } @@ -1323,10 +1323,10 @@ void debrief_choose_promotion_voice() // search thru all official campaigns for our current campaign if ((Campaign.missions[Campaign.current_mission].name) && (Campaign.filename)) { for (i=0; istats.m_badge_earned].voice_base); return; @@ -1508,7 +1508,7 @@ void debrief_traitor_init() required_string("$Num stages:"); stuff_int(&debrief->num_stages); - Assert(debrief->num_stages == 1); + SDL_assert(debrief->num_stages == 1); stage_num = 0; stagep = &debrief->stages[stage_num++]; @@ -1720,7 +1720,7 @@ void debrief_multi_list_draw() void debrief_kick_selected_player() { if(Multi_list_select >= 0){ - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); multi_kick_player(Multi_list[Multi_list_select].net_player_index); } } @@ -1728,7 +1728,7 @@ void debrief_kick_selected_player() // get optional mission popup text void debrief_assemble_optional_mission_popup_text(char *buffer, char *mission_loop_desc) { - Assert(buffer != NULL); + SDL_assert(buffer != NULL); // base message if (mission_loop_desc == NULL) { @@ -1795,7 +1795,7 @@ void debrief_accept(int ok_to_post_start_game_event) int cur = Campaign.current_mission; bool require_repeat_mission = (Campaign.current_mission == Campaign.next_mission); if (Campaign.missions[cur].has_mission_loop) { - Assert(Campaign.loop_mission != CAMPAIGN_LOOP_MISSION_UNINITIALIZED); + SDL_assert(Campaign.loop_mission != CAMPAIGN_LOOP_MISSION_UNINITIALIZED); } if ( (Campaign.missions[cur].has_mission_loop && (Campaign.loop_mission != -1)) && !require_repeat_mission ) { @@ -2207,11 +2207,11 @@ void debrief_setup_ship_kill_stats(int stage_num) ushort *kill_arr; debrief_stats_kill_info *kill_info; - Assert(Current_stage < DEBRIEF_NUM_STATS_PAGES); + SDL_assert(Current_stage < DEBRIEF_NUM_STATS_PAGES); if ( Current_stage == DEBRIEF_MISSION_STATS || Current_stage == DEBRIEF_ALLTIME_STATS ) return; - Assert(Debrief_player != NULL); + SDL_assert(Debrief_player != NULL); // kill_ar points to an array of MAX_SHIP_TYPE ints if ( Current_stage == DEBRIEF_MISSION_KILLS ) { @@ -2284,7 +2284,7 @@ void debrief_text_stage_init(const char *src, int type) char *p_str[MAX_DEBRIEF_LINES]; n_lines = split_str(src, Debrief_text_wnd_coords[gr_screen.res][2], n_chars, p_str, MAX_DEBRIEF_LINES); - Assert(n_lines >= 0); + SDL_assert(n_lines >= 0); // if you hit this, you proba if(n_lines >= MAX_DEBRIEF_LINES){ @@ -2292,8 +2292,8 @@ void debrief_text_stage_init(const char *src, int type) } for ( i=0; i AWARD_TEXT_MAX_LINES) { return; } @@ -2752,7 +2752,7 @@ void debrief_do_frame(float frametime) int str_w, str_h; char buf[256]; - Assert(Debrief_inited); + SDL_assert(Debrief_inited); // first thing is to load the files if ( MULTIPLAYER_CLIENT && !Debrief_multi_stages_loaded ) { @@ -2954,7 +2954,7 @@ void debrief_do_frame(float frametime) case DEBRIEF_TAB: if ( Num_debrief_stages <= 0 ) { gr_set_color_fast(&Color_white); - Assert( Game_current_mission_filename != NULL ); + SDL_assert( Game_current_mission_filename != NULL ); gr_printf(Debrief_text_wnd_coords[gr_screen.res][0], Debrief_text_wnd_coords[gr_screen.res][1], XSTR( "No Debriefing for mission: %s", 458), Game_current_mission_filename); } else { @@ -3007,7 +3007,7 @@ void debrief_do_frame(float frametime) // dont let dude skip 3-09. hack. if(Game_mode & GM_CAMPAIGN_MODE){ if((Campaign.current_mission >= 0) && (Campaign.current_mission < MAX_CAMPAIGN_MISSIONS)){ - if ((Campaign.missions[Campaign.current_mission].name != NULL) && !stricmp(Campaign.missions[Campaign.current_mission].name, "sm3-09.fs2")) { + if ((Campaign.missions[Campaign.current_mission].name != NULL) && !SDL_strcasecmp(Campaign.missions[Campaign.current_mission].name, "sm3-09.fs2")) { Debrief_skip_popup_already_shown = 1; } } @@ -3040,7 +3040,7 @@ void debrief_do_frame(float frametime) // check to see if we should be showing a pilot info popup in multiplayer (if a guy was double clicked) if ((Game_mode & GM_MULTIPLAYER) && Debrief_should_show_popup) { - Assert((Multi_list_select >= 0) && (Multi_list_select < Multi_list_size)); + SDL_assert((Multi_list_select >= 0) && (Multi_list_select < Multi_list_size)); multi_pinfo_popup(&Net_players[Multi_list[Multi_list_select].net_player_index]); Debrief_should_show_popup = 0; diff --git a/src/missionui/missionloopbrief.cpp b/src/missionui/missionloopbrief.cpp index 0345852..702f01c 100644 --- a/src/missionui/missionloopbrief.cpp +++ b/src/missionui/missionloopbrief.cpp @@ -155,7 +155,7 @@ void loop_brief_init() // load the background bitmap Loop_brief_bitmap = bm_load(Loop_brief_fname[gr_screen.res]); - Assert(Loop_brief_bitmap != -1); + SDL_assert(Loop_brief_bitmap != -1); // window Loop_brief_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0); diff --git a/src/missionui/missionpause.cpp b/src/missionui/missionpause.cpp index d098bf2..ed29751 100644 --- a/src/missionui/missionpause.cpp +++ b/src/missionui/missionpause.cpp @@ -223,7 +223,7 @@ void pause_do(int multi) gr_flip(); } else { // this should only be happening in a very unique multiplayer case - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); } } } diff --git a/src/missionui/missionscreencommon.cpp b/src/missionui/missionscreencommon.cpp index 285ce9f..c3476a8 100644 --- a/src/missionui/missionscreencommon.cpp +++ b/src/missionui/missionscreencommon.cpp @@ -641,8 +641,8 @@ void common_set_interface_palette(const char *filename) if (!filename) filename = NOX("palette01"); - Assert(strlen(filename) <= MAX_FILENAME_LEN); - if ( (InterfacePaletteBitmap != -1) && !stricmp(filename, buf) ) + SDL_assert(strlen(filename) <= MAX_FILENAME_LEN); + if ( (InterfacePaletteBitmap != -1) && !SDL_strcasecmp(filename, buf) ) return; // already set to this palette strcpy(buf, filename); @@ -733,7 +733,7 @@ void common_select_init() Background_anim = anim_load("BriefTrans", 1); // 1 as last parm means file is mem-mapped } - Assert( Background_anim != NULL ); + SDL_assert( Background_anim != NULL ); anim_play_init(&aps, Background_anim, 0, 0); aps.framerate_independent = 1; aps.skip_frames = 0; @@ -777,7 +777,7 @@ void common_select_init() // restore loadout from Player_loadout if this is the same mission as the one previously played if ( !(Game_mode & GM_MULTIPLAYER) ) { - if ( !stricmp(Player_loadout.filename, Game_current_mission_filename) ) { + if ( !SDL_strcasecmp(Player_loadout.filename, Game_current_mission_filename) ) { wss_restore_loadout(); ss_synch_interface(); wl_synch_interface(); @@ -1314,7 +1314,7 @@ void wss_restore_loadout() wss_unit *slot; // only restore if mission hasn't changed - if ( stricmp(Player_loadout.last_modified, The_mission.modified) ) { + if ( SDL_strcasecmp(Player_loadout.last_modified, The_mission.modified) ) { return; } @@ -1348,7 +1348,7 @@ void wss_direct_restore_loadout() wss_unit *slot; // only restore if mission hasn't changed - if ( stricmp(Player_loadout.last_modified, The_mission.modified) ) { + if ( SDL_strcasecmp(Player_loadout.last_modified, The_mission.modified) ) { return; } @@ -1472,13 +1472,13 @@ int store_wss_data(ubyte *block, int max_size, int sound,int player_index) short ishort; // this is intended for multi only since it byteswaps - Assert( Game_mode & GM_MULTIPLAYER ); + SDL_assert( Game_mode & GM_MULTIPLAYER ); // write the ship pool for ( i = 0; i < MAX_SHIP_TYPES; i++ ) { if ( Ss_pool[i] > 0 ) { block[offset++] = (ubyte)i; - Assert( Ss_pool[i] < UCHAR_MAX ); + SDL_assert( Ss_pool[i] < UCHAR_MAX ); // take care of sign issues if(Ss_pool[i] == -1){ @@ -1506,7 +1506,7 @@ int store_wss_data(ubyte *block, int max_size, int sound,int player_index) block[offset++] = 0xff; // signals start of unit data for ( i=0; iship_class = ship_class; list_append(&SS_active_head, sai); } @@ -1195,15 +1195,15 @@ void maybe_change_selected_ship(int offset) start_ship_animation(Selected_ss_class, 1); } else - Assert( Selected_ss_class == ship_class ); + SDL_assert( Selected_ss_class == ship_class ); } void maybe_change_selected_wing_ship(int wb_num, int ws_num) { ss_slot_info *ss_slot; - Assert(wb_num >= 0 && wb_num < MAX_WING_BLOCKS); - Assert(ws_num >= 0 && ws_num < MAX_WING_SLOTS); + SDL_assert(wb_num >= 0 && wb_num < MAX_WING_BLOCKS); + SDL_assert(ws_num >= 0 && ws_num < MAX_WING_SLOTS); if ( Ss_wings[wb_num].wingnum < 0 ) { return; @@ -1457,7 +1457,7 @@ void ship_select_blit_ship_info() // blit the _short_ text description /* - Assert(Multi_ts_ship_info_line_count < 3); + SDL_assert(Multi_ts_ship_info_line_count < 3); gr_set_color_fast(&Color_normal); for(idx=0;idx= 0) { - Assert(Selected_ss_class >= 0); + SDL_assert(Selected_ss_class >= 0); if ( Ss_icons[Selected_ss_class].anim_instance->frame_num == Ss_icons[Selected_ss_class].anim_instance->stop_at ) { nprintf(("anim", "Frame number = %d, Stop at %d\n", Ss_icons[Selected_ss_class].anim_instance->frame_num, Ss_icons[Selected_ss_class].anim_instance->stop_at)); anim_play_struct aps; @@ -1823,8 +1823,8 @@ void draw_ship_icon_with_number(int screen_offset, int ship_class) ss_icon_info *ss_icon; - Assert( screen_offset >= 0 && screen_offset <= 3 ); - Assert( ship_class >= 0 ); + SDL_assert( screen_offset >= 0 && screen_offset <= 3 ); + SDL_assert( ship_class >= 0 ); ss_icon = &Ss_icons[ship_class]; num_x = Ship_list_coords[gr_screen.res][screen_offset][2]; @@ -1835,7 +1835,7 @@ void draw_ship_icon_with_number(int screen_offset, int ship_class) // next check if ship has mouse over it if ( Hot_ss_icon > -1 ) { - Assert(Hot_ss_icon <= 3); + SDL_assert(Hot_ss_icon <= 3); if ( Hot_ss_icon == screen_offset ) ss_icon->current_icon_bitmap = ss_icon->icon_bmaps[ICON_FRAME_HOT]; } @@ -1894,7 +1894,7 @@ anim* ss_load_individual_animation(int ship_class) // 1024x768 SUPPORT // If we are in 1024x768, we first want to append "2_" in front of the filename if (gr_screen.res == GR_1024) { - Assert(strlen(Ship_info[ship_class].anim_filename) <= 30); + SDL_assert(strlen(Ship_info[ship_class].anim_filename) <= 30); strcpy(animation_filename, "2_"); strcat(animation_filename, Ship_info[ship_class].anim_filename); // now check if file exists @@ -1935,7 +1935,7 @@ anim* ss_load_individual_animation(int ship_class) void start_ship_animation(int ship_class, int play_sound) { ss_icon_info *ss_icon; - Assert( ship_class >= 0 ); + SDL_assert( ship_class >= 0 ); if ( Ship_anim_class == ship_class ) return; @@ -2021,7 +2021,7 @@ void commit_pressed() player_ship_info_index = Team_data[Common_team].default_ship; } else { - Assert(Selected_ss_class >= 0 ); + SDL_assert(Selected_ss_class >= 0 ); player_ship_info_index = Selected_ss_class; } @@ -2072,7 +2072,7 @@ void commit_pressed() int pick_from_ship_list(int screen_offset, int ship_class) { int rval = -1; - Assert(ship_class >= 0); + SDL_assert(ship_class >= 0); if ( Wss_num_wings == 0 ) return rval; @@ -2088,7 +2088,7 @@ int pick_from_ship_list(int screen_offset, int ship_class) mouse_get_pos( &mouse_x, &mouse_y ); Ss_delta_x = Ship_list_coords[gr_screen.res][screen_offset][0] - mouse_x; Ss_delta_y = Ship_list_coords[gr_screen.res][screen_offset][1] - mouse_y; - Assert( Ss_pool[ship_class] >= 0 ); + SDL_assert( Ss_pool[ship_class] >= 0 ); rval = 0; } @@ -2104,8 +2104,8 @@ int pick_from_ship_list(int screen_offset, int ship_class) void pick_from_wing(int wb_num, int ws_num) { int slot_index; - Assert(wb_num >= 0 && wb_num < MAX_WING_BLOCKS); - Assert(ws_num >= 0 && ws_num < MAX_WING_SLOTS); + SDL_assert(wb_num >= 0 && wb_num < MAX_WING_BLOCKS); + SDL_assert(ws_num >= 0 && ws_num < MAX_WING_SLOTS); ss_wing_info *wb; ss_slot_info *ws; @@ -2149,7 +2149,7 @@ void pick_from_wing(int wb_num, int ws_num) case WING_SLOT_FILLED: { int mouse_x, mouse_y; - Assert(Wss_slots[slot_index].ship_class >= 0); + SDL_assert(Wss_slots[slot_index].ship_class >= 0); ss_set_carried_icon(slot_index, Wss_slots[slot_index].ship_class); mouse_get_pos( &mouse_x, &mouse_y ); @@ -2185,7 +2185,7 @@ void draw_wing_block(int wb_num, int hot_slot, int selected_slot, int class_sele wing *wp; int i, bitmap_to_draw, w, h, sx, sy, slot_index; - Assert(wb_num >= 0 && wb_num < MAX_WING_BLOCKS); + SDL_assert(wb_num >= 0 && wb_num < MAX_WING_BLOCKS); wb = &Ss_wings[wb_num]; if ( wb->wingnum == -1 ) @@ -2214,7 +2214,7 @@ void draw_wing_block(int wb_num, int hot_slot, int selected_slot, int class_sele case WING_SLOT_FILLED: case WING_SLOT_FILLED|WING_SLOT_IS_PLAYER: - Assert(icon); + SDL_assert(icon); if ( class_select >= 0 ) { // only ship select if ( Carried_ss_icon.from_slot == slot_index ) { @@ -2330,7 +2330,7 @@ void ss_blit_ship_icon(int x,int y,int ship_class,int bmap_num) gr_set_bitmap(Wing_slot_empty_bitmap, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); } else { ss_icon_info *icon = &Ss_icons[ship_class]; - Assert(icon->icon_bmaps[bmap_num] != -1); + SDL_assert(icon->icon_bmaps[bmap_num] != -1); gr_set_bitmap(icon->icon_bmaps[bmap_num], GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); } gr_bitmap(x,y); @@ -2393,7 +2393,7 @@ int create_wings() case WING_SLOT_FILLED|WING_SLOT_LOCKED: case WING_SLOT_FILLED|WING_SLOT_IS_PLAYER|WING_SLOT_LOCKED: if ( wp->ship_index[j] >= 0 ) { - Assert(Ships[wp->ship_index[j]].objnum >= 0); + SDL_assert(Ships[wp->ship_index[j]].objnum >= 0); } if ( ws->status & WING_SLOT_IS_PLAYER ) { @@ -2419,7 +2419,7 @@ int create_wings() } } } - Assert(found_pobj); + SDL_assert(found_pobj); } else { // AL 10/04/97 @@ -2468,11 +2468,11 @@ int create_wings() if ( wb->is_late ) { list_remove( &ship_arrival_list, &ship_arrivals[ws->sa_index]); wp->wave_count--; - Assert(wp->wave_count >= 0); + SDL_assert(wp->wave_count >= 0); } else { shipnum = wp->ship_index[j]; - Assert( shipnum >= 0 && shipnum < MAX_SHIPS ); + SDL_assert( shipnum >= 0 && shipnum < MAX_SHIPS ); cleanup_ship_index[j] = shipnum; ship_add_exited_ship( &Ships[shipnum], SEF_PLAYER_DELETED ); obj_delete(Ships[shipnum].objnum); @@ -2514,8 +2514,8 @@ void ship_stop_animation() // void update_player_ship(int si_index) { - Assert( si_index >= 0 ); - Assert( Player_obj != NULL); + SDL_assert( si_index >= 0 ); + SDL_assert( Player_obj != NULL); // AL 10/04/97 // Change the ship type of the player ship if different than current. @@ -2548,7 +2548,7 @@ int create_default_player_ship(int use_last_flown) } else { for (i = 0; i < Num_ship_types; i++) { - if ( !stricmp(Ship_info[i].name, default_player_ship) ) { + if ( !SDL_strcasecmp(Ship_info[i].name, default_player_ship) ) { player_ship_class = i; Players[Player_num].last_ship_flown_si_index = player_ship_class; break; @@ -2639,7 +2639,7 @@ int ss_return_ship(int wing_block, int wing_slot, int *ship_index, p_object **pp *ppobjp = &ship_arrivals[ws->sa_index]; } else { *ship_index = Wings[Ss_wings[wing_block].wingnum].ship_index[wing_slot]; - Assert(*ship_index != -1); + SDL_assert(*ship_index != -1); } return ws->original_ship_class; @@ -2748,7 +2748,7 @@ int ss_fixup_team_data(team_data *tdata) ship_in_parse_player = 0; for ( k = 0; k < p_team_data->number_choices; k++ ) { - Assert( p_team_data->ship_count[k] >= 0 ); + SDL_assert( p_team_data->ship_count[k] >= 0 ); if ( p_team_data->ship_list[k] == Ships[wp->ship_index[j]].ship_info_index ) { ship_in_parse_player = 1; break; @@ -2770,7 +2770,7 @@ int ss_fixup_team_data(team_data *tdata) ship_in_parse_player = 0; for ( k = 0; k < p_team_data->number_choices; k++ ) { - Assert( p_team_data->ship_count[k] >= 0 ); + SDL_assert( p_team_data->ship_count[k] >= 0 ); if ( p_team_data->ship_list[k] == p_objp->ship_class ) { ship_in_parse_player = 1; break; @@ -2792,7 +2792,7 @@ int ss_fixup_team_data(team_data *tdata) // ensure that the default player ship is in the ship_list too ship_in_parse_player = 0; for ( k = 0; k < p_team_data->number_choices; k++ ) { - Assert( p_team_data->ship_count[k] >= 0 ); + SDL_assert( p_team_data->ship_count[k] >= 0 ); if ( p_team_data->ship_list[k] == p_team_data->default_ship ) { ship_in_parse_player = 1; break; @@ -2880,7 +2880,7 @@ void ss_load_anim(int ship_class) // load the compressed ship animation into memory // NOTE: if last parm of load_anim is 1, the anim file is mapped to memory - Assert( icon->anim == NULL ); + SDL_assert( icon->anim == NULL ); icon->anim = ss_load_individual_animation(ship_class); if ( icon->anim == NULL ) { Int3(); // couldn't load anim filename.. get Alan @@ -3283,7 +3283,7 @@ int ss_grab_from_list(int from_list, int to_slot, int *sound) return 0; } - Assert(slot->ship_class < 0 ); // slot should be empty + SDL_assert(slot->ship_class < 0 ); // slot should be empty // take ship from list->slot Ss_pool[from_list]--; @@ -3314,7 +3314,7 @@ int ss_swap_list_slot(int from_list, int to_slot, int *sound) } slot = &Wss_slots[to_slot]; - Assert(slot->ship_class >= 0 ); // slot should be filled + SDL_assert(slot->ship_class >= 0 ); // slot should be filled // put ship from slot->list Ss_pool[Wss_slots[to_slot].ship_class]++; diff --git a/src/missionui/missionweaponchoice.cpp b/src/missionui/missionweaponchoice.cpp index 9bbb443..e299243 100644 --- a/src/missionui/missionweaponchoice.cpp +++ b/src/missionui/missionweaponchoice.cpp @@ -940,7 +940,7 @@ int wl_fury_missile_offset_hack(int weapon_class, int num_missiles) return 0 ; } - if ( !strnicmp(Weapon_info[weapon_class].name, NOX("fury"), 4) ) { + if ( !SDL_strncasecmp(Weapon_info[weapon_class].name, NOX("fury"), 4) ) { return 3; } @@ -952,7 +952,7 @@ const char *wl_tooltip_handler(const char *str) if (Selected_wl_class < 0) return NULL; - if (!stricmp(str, "@weapon_desc")) { + if (!SDL_strcasecmp(str, "@weapon_desc")) { char *str; int x, y, w, h; @@ -1029,7 +1029,7 @@ int wl_get_pilot_subsys_index(p_object *pobjp) end_index = start_index + pobjp->subsys_count; pilot_index = -1; for ( i = start_index; i < end_index; i++ ) { - if ( !stricmp(Subsys_status[i].name, NOX("pilot") ) ) { + if ( !SDL_strcasecmp(Subsys_status[i].name, NOX("pilot") ) ) { pilot_index = i; break; } @@ -1102,7 +1102,7 @@ void weapon_button_do(int i) break; case WL_BUTTON_MULTI_LOCK: - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); // the "lock" button has been pressed multi_ts_lock_pressed(); @@ -1301,7 +1301,7 @@ void wl_set_disabled_weapons(int ship_class) if ( ship_class == - 1 ) return; - Assert(ship_class >= 0 && ship_class < MAX_SHIP_TYPES); + SDL_assert(ship_class >= 0 && ship_class < MAX_SHIP_TYPES); sip = &Ship_info[ship_class]; @@ -1441,12 +1441,12 @@ void wl_load_anim(int weapon_class) wl_icon_info *icon; icon = &Wl_icons[weapon_class]; - Assert( icon->anim == NULL ); + SDL_assert( icon->anim == NULL ); // 1024x768 SUPPORT // If we are in 1024x768, we first want to append "2_" in front of the filename if (gr_screen.res == GR_1024) { - Assert(strlen(Weapon_info[weapon_class].anim_filename) <= 30); + SDL_assert(strlen(Weapon_info[weapon_class].anim_filename) <= 30); strcpy(animation_filename, "2_"); strcat(animation_filename, Weapon_info[weapon_class].anim_filename); @@ -1796,7 +1796,7 @@ int wl_calc_missile_fit(int wi_index, int capacity) return 0; } - Assert(Weapon_info[wi_index].subtype == WP_MISSILE); + SDL_assert(Weapon_info[wi_index].subtype == WP_MISSILE); return fl2i( capacity / Weapon_info[wi_index].cargo_size + 0.5f ); } @@ -1806,7 +1806,7 @@ void wl_get_ship_class_weapons(int ship_class, int *wep, int *wep_count) ship_info *sip; int i; - Assert(ship_class >= 0 && ship_class < MAX_SHIP_TYPES); + SDL_assert(ship_class >= 0 && ship_class < MAX_SHIP_TYPES); sip = &Ship_info[ship_class]; // reset weapons arrays @@ -1833,9 +1833,9 @@ void wl_get_ship_weapons(int ship_index, int *wep, int *wep_count) wing *wp; ship_weapon *swp; - Assert(ship_index >= 0); + SDL_assert(ship_index >= 0); - Assert(Ships[ship_index].wingnum >= 0); + SDL_assert(Ships[ship_index].wingnum >= 0); wp = &Wings[Ships[ship_index].wingnum]; swp = &Ships[ship_index].weapons; @@ -1915,7 +1915,7 @@ void wl_get_default_weapons(int ship_class, int slot_num, int *wep, int *wep_cou { int original_ship_class, i; - Assert(slot_num >= 0 && slot_num < MAX_WSS_SLOTS); + SDL_assert(slot_num >= 0 && slot_num < MAX_WSS_SLOTS); // clear out wep and wep_count for ( i = 0; i < MAX_WL_WEAPONS; i++ ) { @@ -1944,7 +1944,7 @@ void wl_get_default_weapons(int ship_class, int slot_num, int *wep, int *wep_cou int ship_index = -1; p_object *pobjp; ss_return_ship(slot_num/4, slot_num%4, &ship_index, &pobjp); - Assert(ship_index != -1); + SDL_assert(ship_index != -1); wl_get_ship_weapons(ship_index, wep, wep_count); } } @@ -2045,7 +2045,7 @@ void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class) } wep_count[i] = min(new_wep_count, Wl_pool[wi_index]); - Assert(wep_count[i] >= 0); + SDL_assert(wep_count[i] >= 0); Wl_pool[wi_index] -= wep_count[i]; if ( wep_count[i] <= 0 ) { wep[i] = -1; @@ -2222,7 +2222,7 @@ void weapon_select_init() // get a pointer to bitmap by using bm_lock() WeaponSelectMaskPtr = bm_lock(WeaponSelectMaskBitmap, 8, BMP_AABITMAP); WeaponSelectMaskData = (ubyte*)WeaponSelectMaskPtr->data; - Assert(WeaponSelectMaskData != NULL); + SDL_assert(WeaponSelectMaskData != NULL); bm_get_info(WeaponSelectMaskBitmap, &Weaponselect_mask_w, &Weaponselect_mask_h); @@ -2419,7 +2419,7 @@ int do_mouse_over_ship_weapon(int index) int dropped_on_slot, is_moved, mx, my; dropped_on_slot = 0; - Assert(Selected_wl_slot >= 0); + SDL_assert(Selected_wl_slot >= 0); if ( ss_disabled_slot( Selected_wl_slot ) ) return 0; @@ -2644,8 +2644,8 @@ void wl_weapon_desc_start_wipe() currchar_src++; - Assert(currline_dest < WEAPON_DESC_MAX_LINES); - Assert(currchar_dest < WEAPON_DESC_MAX_LENGTH); + SDL_assert(currline_dest < WEAPON_DESC_MAX_LINES); + SDL_assert(currchar_dest < WEAPON_DESC_MAX_LENGTH); } // wrap up the line processing @@ -2904,11 +2904,11 @@ void weapon_select_do(float frametime) if ( Weapon_anim_class != -1 && ( Selected_wl_class == Weapon_anim_class ) ) { wl_icon_info *icon; - Assert(Selected_wl_class >= 0 && Selected_wl_class < MAX_WEAPON_TYPES ); + SDL_assert(Selected_wl_class >= 0 && Selected_wl_class < MAX_WEAPON_TYPES ); if ( Weapon_anim_class != Selected_wl_class ) start_weapon_animation(Selected_wl_class); - Assert(Weapon_anim_class == Selected_wl_class); + SDL_assert(Weapon_anim_class == Selected_wl_class); icon = &Wl_icons[Selected_wl_class]; if ( icon->anim_instance ) { if ( icon->anim_instance->frame_num == icon->anim_instance->stop_at ) { @@ -2956,7 +2956,7 @@ void weapon_select_do(float frametime) if ( wl_icon_being_carried() ) { int mx, my, sx, sy; - Assert(Carried_wl_icon.weapon_class < MAX_WEAPON_TYPES); + SDL_assert(Carried_wl_icon.weapon_class < MAX_WEAPON_TYPES); mouse_get_pos( &mx, &my ); sx = mx + Wl_delta_x; sy = my + Wl_delta_y; @@ -3104,7 +3104,7 @@ void wl_render_icon_count(int num, int x, int y) char buf[32]; int num_w, num_h; int number_to_draw = (num > 1000) ? 999 : num; // cap count @ 999 - Assert(number_to_draw >= 0); + SDL_assert(number_to_draw >= 0); sprintf(buf, "%d", number_to_draw); gr_get_string_size(&num_w, &num_h, buf, strlen(buf)); @@ -3208,7 +3208,7 @@ void wl_draw_ship_weapons(int index) if ( index == -1 ) return; - Assert(index >= 0 && index < MAX_WSS_SLOTS); + SDL_assert(index >= 0 && index < MAX_WSS_SLOTS); wep = Wss_slots[index].wep; wep_count = Wss_slots[index].wep_count; @@ -3234,7 +3234,7 @@ void wl_draw_ship_weapons(int index) // void draw_wl_icon_with_number(int list_count, int weapon_class) { - Assert( list_count >= 0 && list_count < 8 ); + SDL_assert( list_count >= 0 && list_count < 8 ); wl_render_icon(weapon_class, Wl_weapon_icon_coords[gr_screen.res][list_count][0], Wl_weapon_icon_coords[gr_screen.res][list_count][1], Wl_pool[weapon_class], 1, list_count, -1, weapon_class); @@ -3328,7 +3328,7 @@ void pick_from_ship_slot(int num) { int mx, my, *wep, *wep_count; - Assert(num < 7); + SDL_assert(num < 7); if ( Selected_wl_slot == -1 ) return; @@ -3347,7 +3347,7 @@ void pick_from_ship_slot(int num) return; } - Assert(Wl_icons[wep[num]].can_use); + SDL_assert(Wl_icons[wep[num]].can_use); wl_set_carried_icon(num, Selected_wl_slot, wep[num]); common_flash_button_init(); @@ -3412,7 +3412,7 @@ void wl_update_parse_object_weapons(p_object *pobjp, wss_unit *slot) subsys_status *ss; ship_info *sip; - Assert(slot->ship_class >= 0); + SDL_assert(slot->ship_class >= 0); sip = &Ship_info[slot->ship_class]; pilot_index = wl_get_pilot_subsys_index(pobjp); @@ -3757,8 +3757,8 @@ int wl_grab_from_list(int from_list, int to_bank, int ship_slot, int *sound) } // bank should be empty: - Assert(slot->wep_count[to_bank] == 0); - Assert(slot->wep[to_bank] < 0); + SDL_assert(slot->wep_count[to_bank] == 0); + SDL_assert(slot->wep[to_bank] < 0); // ensure that pool has weapon if ( Wl_pool[from_list] <= 0 ) { @@ -3808,8 +3808,8 @@ int wl_swap_list_slot(int from_list, int to_bank, int ship_slot, int *sound) } // bank should have something in it - Assert(slot->wep_count[to_bank] > 0); - Assert(slot->wep[to_bank] >= 0); + SDL_assert(slot->wep_count[to_bank] > 0); + SDL_assert(slot->wep[to_bank] >= 0); // ensure that pool has weapon if ( Wl_pool[from_list] <= 0 ) { @@ -3892,12 +3892,12 @@ void wl_apply(int mode,int from_bank,int from_list,int to_bank,int to_list,int s ubyte wss_data[MAX_PACKET_SIZE-20]; size = store_wss_data(wss_data, MAX_PACKET_SIZE-20,sound,player_index); - Assert(pl != NULL); + SDL_assert(pl != NULL); send_wss_update_packet(pl->p_info.team,wss_data, size); } if(Game_mode & GM_MULTIPLAYER){ - Assert(pl != NULL); + SDL_assert(pl != NULL); // if the pool we're using has changed, synch stuff up if(pl->p_info.team == Net_player->p_info.team){ diff --git a/src/missionui/redalert.cpp b/src/missionui/redalert.cpp index 9f21441..5b9d29a 100644 --- a/src/missionui/redalert.cpp +++ b/src/missionui/redalert.cpp @@ -321,8 +321,8 @@ static int Red_alert_voice; // open and pre-load the stream buffers for the different voice streams void red_alert_voice_load() { - Assert( Briefing != NULL ); - if ( strnicmp(Briefing->stages[0].voice, NOX("none"), 4) && (strlen(Briefing->stages[0].voice) > 0) ) { + SDL_assert( Briefing != NULL ); + if ( SDL_strncasecmp(Briefing->stages[0].voice, NOX("none"), 4) && (strlen(Briefing->stages[0].voice) > 0) ) { Red_alert_voice = audiostream_open( Briefing->stages[0].voice, ASF_VOICE ); } } @@ -479,7 +479,7 @@ void red_alert_init() } if ( Briefing->num_stages > 0 ) { - Assert(Briefing->stages[0].new_text); + SDL_assert(Briefing->stages[0].new_text); brief_color_text_init(Briefing->stages[0].new_text, Ra_brief_text_wnd_coords[gr_screen.res][RA_W_COORD], 0); } @@ -718,7 +718,7 @@ void red_alert_store_wingman_status() // store status for all existing ships for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { ship_objp = &Objects[so->objnum]; - Assert(ship_objp->type == OBJ_SHIP); + SDL_assert(ship_objp->type == OBJ_SHIP); shipp = &Ships[ship_objp->instance]; if ( shipp->flags & SF_DYING ) { @@ -764,7 +764,7 @@ void red_alert_store_wingman_status() } } - Assert(Red_alert_num_slots_used > 0); + SDL_assert(Red_alert_num_slots_used > 0); } // Delete a ship in a red alert mission (since it must have died/departed in the previous mission) @@ -805,7 +805,7 @@ void red_alert_bash_wingman_status() for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { ship_objp = &Objects[so->objnum]; - Assert(ship_objp->type == OBJ_SHIP); + SDL_assert(ship_objp->type == OBJ_SHIP); shipp = &Ships[ship_objp->instance]; if ( !(shipp->flags & SF_FROM_PLAYER_WING) && !(shipp->flags & SF_RED_ALERT_STORE_STATUS) ) { @@ -817,7 +817,7 @@ void red_alert_bash_wingman_status() for ( i = 0; i < Red_alert_num_slots_used; i++ ) { ras = &Red_alert_wingman_status[i]; - if ( !stricmp(ras->name, shipp->ship_name) ) { + if ( !SDL_strcasecmp(ras->name, shipp->ship_name) ) { found_match = 1; if ( ras->ship_class == RED_ALERT_EXITED_SHIP_CLASS) { // if exited ship, we can only restore hull strength @@ -859,7 +859,7 @@ void red_alert_write_wingman_status(CFILE *fp) return; } - Assert(strlen(Red_alert_precursor_mission) > 0 ); + SDL_assert(strlen(Red_alert_precursor_mission) > 0 ); cfwrite_string(Red_alert_precursor_mission, fp); for ( i = 0; i < Red_alert_num_slots_used; i++ ) { diff --git a/src/model/modelcollide.cpp b/src/model/modelcollide.cpp index ff16bfb..96feaa7 100644 --- a/src/model/modelcollide.cpp +++ b/src/model/modelcollide.cpp @@ -47,7 +47,7 @@ * name with invisible in it. * * 81 4/02/98 8:16a John - * Fixed Assert in model_collide with large ships + * Fixed SDL_assert in model_collide with large ships * * 80 3/31/98 5:18p John * Removed demo/save/restore. Made NDEBUG defined compile. Removed a @@ -504,7 +504,7 @@ static void mc_check_sphereline_face( int nv, vector ** verts, vector * plane_pn mprintf(("Estimated radius error: Estimate %f, actual %f Mc->radius\n", temp_dist, Mc->radius)); } vm_vec_sub( &temp_dir, &hit_point, &temp_sphere ); - // Assert( vm_vec_dotprod( &temp_dir, &Mc_direction ) > 0 ); + // SDL_assert( vm_vec_dotprod( &temp_dir, &Mc_direction ) > 0 ); } } @@ -529,7 +529,7 @@ static void mc_check_sphereline_face( int nv, vector ** verts, vector * plane_pn float sphere_time; if ( fvi_polyedge_sphereline(&hit_point, &Mc_p0, &Mc_direction, Mc->radius, nv, verts, &sphere_time)) { - Assert( sphere_time >= 0.0f ); + SDL_assert( sphere_time >= 0.0f ); vm_vec_scale_add( &temp_sphere, &Mc_p0, &Mc_direction, sphere_time ); temp_dist = vm_vec_dist( &temp_sphere, &hit_point ); if ( (temp_dist - DIST_TOL > Mc->radius) || (temp_dist + DIST_TOL < Mc->radius) ) { @@ -537,7 +537,7 @@ static void mc_check_sphereline_face( int nv, vector ** verts, vector * plane_pn mprintf(("Estimated radius error: Estimate %f, actual %f Mc->radius\n", temp_dist, Mc->radius)); } vm_vec_sub( &temp_dir, &hit_point, &temp_sphere ); -// Assert( vm_vec_dotprod( &temp_dir, &Mc_direction ) > 0 ); +// SDL_assert( vm_vec_dotprod( &temp_dir, &Mc_direction ) > 0 ); if ( (Mc->num_hits==0) || (sphere_time < Mc->hit_dist) ) { // This is closer than best so far @@ -561,7 +561,7 @@ static void mc_check_sphereline_face( int nv, vector ** verts, vector * plane_pn // Mc->hit_normal.x, Mc->hit_normal.y, Mc->hit_normal.z, // hit_point.x, hit_point.y, hit_point.z)); } else { // Not best so far - Assert(Mc->num_hits>0); + SDL_assert(Mc->num_hits>0); Mc->num_hits++; } } @@ -586,7 +586,7 @@ void model_collide_defpoints(ubyte * p) ubyte * normcount = p+20; vector *src = vp(p+offset); - Assert( nverts < MAX_POLYGON_VECS ); + SDL_assert( nverts < MAX_POLYGON_VECS ); for (n=0; n= 0 ); - Assert( mn < Mc_pm->n_models ); + SDL_assert( mn >= 0 ); + SDL_assert( mn < Mc_pm->n_models ); if ( (mn < 0) || (mn>=Mc_pm->n_models) ) return; @@ -993,7 +993,7 @@ int model_collide(mc_info * mc_info) } if ( Mc->flags & MC_CHECK_SPHERELINE ) { - Assert( Mc->radius > 0.0f ); + SDL_assert( Mc->radius > 0.0f ); // Do a quick check on the Bounding Sphere if (fvi_segment_sphere(&Mc->hit_point_world, Mc->p0, Mc->p1, Mc->pos, model_radius+Mc->radius) ) { diff --git a/src/model/modelinterp.cpp b/src/model/modelinterp.cpp index 7224843..0af9e31 100644 --- a/src/model/modelinterp.cpp +++ b/src/model/modelinterp.cpp @@ -516,8 +516,8 @@ void model_interp_defpoints(ubyte * p, polymodel *pm, bsp_info *sm) // Get pointer to lights Interp_lights = p+20+nverts; - Assert( nverts < MAX_POLYGON_VECS ); - // Assert( nnorms < MAX_POLYGON_NORMS ); + SDL_assert( nverts < MAX_POLYGON_VECS ); + // SDL_assert( nnorms < MAX_POLYGON_NORMS ); Interp_num_verts = nverts; #ifndef NDEBUG @@ -818,11 +818,11 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm) } else { // if ( !(pm->flags & PM_FLAG_ALLOW_TILING) ) { - // Assert(verts[i].u <= 1.0f ); - // Assert(verts[i].v <= 1.0f ); + // SDL_assert(verts[i].u <= 1.0f ); + // SDL_assert(verts[i].v <= 1.0f ); // } - // Assert( verts[i].normnum == verts[i].vertnum ); + // SDL_assert( verts[i].normnum == verts[i].vertnum ); if ( Interp_flags & MR_NO_LIGHTING ) { if ( D3D_enabled ) { @@ -892,8 +892,8 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm) } } -// Assert(verts[i].u >= 0.0f ); -// Assert(verts[i].v >= 0.0f ); +// SDL_assert(verts[i].u >= 0.0f ); +// SDL_assert(verts[i].v >= 0.0f ); } #ifndef NDEBUG @@ -1029,7 +1029,7 @@ void model_interp_sortnorm(ubyte * p,polymodel * pm, bsp_info *sm, int do_box_ch modelstats_num_sortnorms++; #endif -// Assert( w(p+4) == 56 ); +// SDL_assert( w(p+4) == 56 ); int frontlist = w(p+36); int backlist = w(p+40); @@ -1270,7 +1270,7 @@ void model_draw_bay_paths(int model_num) // iterate through the paths that exist in the polymodel, searching for $bayN pathnames for (idx = 0; idxn_paths; idx++) { - if ( !strnicmp(pm->paths[idx].name, NOX("$bay"), 4) ) { + if ( !SDL_strncasecmp(pm->paths[idx].name, NOX("$bay"), 4) ) { for(s_idx=0; s_idxpaths[idx].nverts-1; s_idx++){ v1 = pm->paths[idx].verts[s_idx].pos; v2 = pm->paths[idx].verts[s_idx+1].pos; @@ -1354,7 +1354,7 @@ int AG2 = 128; int AB2 = 10; void interp_render_lightning( polymodel *pm, bsp_info * sm ) { - Assert( sm->num_arcs > 0 ); + SDL_assert( sm->num_arcs > 0 ); int i; @@ -1405,8 +1405,8 @@ void model_interp_subcall(polymodel * pm, int mn, int detail_level) if ( (mn < 0) || (mn>=pm->n_models) ) return; - Assert( mn >= 0 ); - Assert( mn < pm->n_models ); + SDL_assert( mn >= 0 ); + SDL_assert( mn < pm->n_models ); // mprintf(( "Name = '%s'\n", pm->submodel[mn].name )); // char * p = pm->submodel[mn].name; @@ -1785,7 +1785,7 @@ int model_get_rotated_bitmap_points(vertex *pnt,float angle, float rad, vertex * float sa, ca; int i; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); @@ -2081,7 +2081,7 @@ void model_try_cache_render(int model_num, matrix *orient, vector * pos, uint fl return; } - Assert( mc != NULL ); + SDL_assert( mc != NULL ); // Fake the detail level based on framerate. if ( 1.0f / flFrametime < Mc_framerate_lo[Model_object_caching_tmp] ) { @@ -2163,7 +2163,7 @@ void model_try_cache_render(int model_num, matrix *orient, vector * pos, uint fl goto RedrawIt; } - Assert( mc->data != NULL ); + SDL_assert( mc->data != NULL ); if (Framecount - mc->last_frame_rendered > 1 + 2*(MAX_DETAIL_LEVEL - Detail.object_caching - 1)) { goto RedrawIt; @@ -2611,7 +2611,7 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags } } - Assert( pm->n_detail_levels < MAX_MODEL_DETAIL_LEVELS ); + SDL_assert( pm->n_detail_levels < MAX_MODEL_DETAIL_LEVELS ); vector closest_pos; float depth = model_find_closest_point( &closest_pos, model_num, -1, orient, pos, &Eye_position ); diff --git a/src/model/modeloctant.cpp b/src/model/modeloctant.cpp index 5d59f93..b8e9ab2 100644 --- a/src/model/modeloctant.cpp +++ b/src/model/modeloctant.cpp @@ -40,7 +40,7 @@ * Large overhaul in how turrets fire. * * 15 4/02/98 8:16a John - * Fixed Assert in model_collide with large ships + * Fixed SDL_assert in model_collide with large ships * * 14 4/01/98 5:34p John * Made only the used POFs page in for a level. Reduced some interp @@ -150,7 +150,7 @@ void model_octant_find_shields( polymodel * pm, model_octant * oct ) oct->nshield_tris = n; oct->shield_tris = (shield_tri **)malloc( sizeof(shield_tri *) * oct->nshield_tris ); - Assert(oct->shield_tris!=NULL); + SDL_assert(oct->shield_tris!=NULL); n = 0; @@ -167,7 +167,7 @@ void model_octant_find_shields( polymodel * pm, model_octant * oct ) } } - Assert( oct->nshield_tris == n ); + SDL_assert( oct->nshield_tris == n ); } @@ -181,8 +181,8 @@ void moff_defpoints(ubyte * p) ubyte * normcount = p+20; vector *src = vp(p+offset); - Assert( nverts < MAX_POLYGON_VECS ); - // Assert( nnorms < MAX_POLYGON_NORMS ); + SDL_assert( nverts < MAX_POLYGON_VECS ); + // SDL_assert( nnorms < MAX_POLYGON_NORMS ); for (n=0; nverts = (vector **)malloc( sizeof(vector *) * oct->nverts ); - Assert(oct->verts!=NULL); + SDL_assert(oct->verts!=NULL); oct->nverts = 0; model_octant_find_faces_sub(pm, oct, p, 0 ); diff --git a/src/model/modelread.cpp b/src/model/modelread.cpp index 4430e8d..792a4c2 100644 --- a/src/model/modelread.cpp +++ b/src/model/modelread.cpp @@ -929,7 +929,7 @@ void model_copy_subsystems( int n_subsystems, model_subsystem *d_sp, model_subsy source = &s_sp[i]; for ( j = 0; j < n_subsystems; j++ ) { dest = &d_sp[j]; - if ( !stricmp( source->subobj_name, dest->subobj_name) ) { + if ( !SDL_strcasecmp( source->subobj_name, dest->subobj_name) ) { dest->flags = source->flags; dest->subobj_num = source->subobj_num; dest->model_num = source->model_num; @@ -977,7 +977,7 @@ static void set_subsystem_info( model_subsystem *subsystemp, char *props, char * strcpy( subsystemp->name, dname ); strcpy(lcdname, dname); - strlwr(lcdname); + SDL_strlwr(lcdname); // check the name for it's specific type if ( strstr(lcdname, "engine") ) { @@ -1063,7 +1063,7 @@ static void set_subsystem_info( model_subsystem *subsystemp, char *props, char * if ( (p = strstr(props, "$fraction_accel")) != NULL) { get_user_prop_value(p+15, buf); subsystemp->stepped_rotation->fraction = (float)atof(buf); - Assert(subsystemp->stepped_rotation->fraction > 0 && subsystemp->stepped_rotation->fraction < 0.5); + SDL_assert(subsystemp->stepped_rotation->fraction > 0 && subsystemp->stepped_rotation->fraction < 0.5); } else { subsystemp->stepped_rotation->fraction = 0.3f; } @@ -1131,7 +1131,7 @@ void do_new_subsystem( int n_subsystems, model_subsystem *slist, int subobj_num, for (i = 0; i < n_subsystems; i++ ) { subsystemp = &slist[i]; - if ( !stricmp(subobj_name, subsystemp->subobj_name) ) { + if ( !SDL_strcasecmp(subobj_name, subsystemp->subobj_name) ) { subsystemp->flags = 0; subsystemp->subobj_num = subobj_num; subsystemp->turret_gun_sobj = -1; @@ -1296,7 +1296,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode } pm->version = version; - Assert( strlen(filename) < FILENAME_LEN ); + SDL_assert( strlen(filename) < FILENAME_LEN ); strncpy(pm->filename, filename, FILENAME_LEN); memset( &pm->view_positions, 0, sizeof(pm->view_positions) ); @@ -1333,10 +1333,10 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode #endif pm->submodel = (bsp_info *)malloc( sizeof(bsp_info)*pm->n_models ); - Assert(pm->submodel != NULL ); + SDL_assert(pm->submodel != NULL ); memset( pm->submodel, 0, sizeof(bsp_info)*pm->n_models ); - //Assert(pm->n_models <= MAX_SUBMODELS); + //SDL_assert(pm->n_models <= MAX_SUBMODELS); cfread_vector(&pm->mins,fp); cfread_vector(&pm->maxs,fp); @@ -1351,7 +1351,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode } pm->num_debris_objects = cfread_int(fp); - Assert( pm->num_debris_objects <= MAX_DEBRIS_OBJECTS ); + SDL_assert( pm->num_debris_objects <= MAX_DEBRIS_OBJECTS ); // mprintf(( "There are %d debris objects\n", pm->num_debris_objects )); for (i=0; inum_debris_objects;i++ ) { pm->debris_objects[i] = cfread_int(fp); @@ -1390,7 +1390,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode } } else { #ifndef NDEBUG - if (stricmp("fighter04.pof", filename)) { + if (SDL_strcasecmp("fighter04.pof", filename)) { if (Bogus_warning_flag_1903 == 0) { Warning(LOCATION, "Ship %s is old. Cannot compute mass.\nSetting to 50.0f. Talk to John.", filename); Bogus_warning_flag_1903 = 1; @@ -1447,7 +1447,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode n = cfread_int(fp); - Assert(n < pm->n_models ); + SDL_assert(n < pm->n_models ); #if defined( FREESPACE2_FORMAT ) pm->submodel[n].rad = cfread_float(fp); //radius @@ -1504,16 +1504,16 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode char type[32]; get_user_prop_value(p+9, type); - if ( !stricmp(type, "subsystem") ) { // if we have a subsystem, put it into the list! + if ( !SDL_strcasecmp(type, "subsystem") ) { // if we have a subsystem, put it into the list! do_new_subsystem( n_subsystems, subsystems, n, pm->submodel[n].rad, &pm->submodel[n].offset, props, pm->submodel[n].name, pm->id ); rotating_submodel_has_subsystem = true; - } else if ( !stricmp(type, "no_rotate") ) { + } else if ( !SDL_strcasecmp(type, "no_rotate") ) { // mark those submodels which should not rotate - ie, those with no subsystem pm->submodel[n].movement_type = MOVEMENT_TYPE_NONE; pm->submodel[n].movement_axis = MOVEMENT_AXIS_NONE; } else { // if submodel rotates (via bspgen), then there is either a subsys or special=no_rotate - Assert( pm->submodel[n].movement_type != MOVEMENT_TYPE_ROT ); + SDL_assert( pm->submodel[n].movement_type != MOVEMENT_TYPE_ROT ); } } @@ -1576,14 +1576,14 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode nverts = cfread_int( fp ); // get the number of vertices in the list pm->shield.nverts = nverts; pm->shield.verts = (shield_vertex *)malloc(nverts * sizeof(shield_vertex) ); - Assert( pm->shield.verts ); + SDL_assert( pm->shield.verts ); for ( i = 0; i < nverts; i++ ) // read in the vertex list cfread_vector( &(pm->shield.verts[i].pos), fp ); ntris = cfread_int( fp ); // get the number of triangles that compose the shield pm->shield.ntris = ntris; pm->shield.tris = (shield_tri *)malloc(ntris * sizeof(shield_tri) ); - Assert( pm->shield.tris ); + SDL_assert( pm->shield.tris ); for ( i = 0; i < ntris; i++ ) { cfread_vector( &(pm->shield.tris[i].norm), fp ); for ( j = 0; j < 3; j++ ) { @@ -1611,13 +1611,13 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode case ID_GPNT: pm->n_guns = cfread_int(fp); pm->gun_banks = (w_bank *)malloc(sizeof(w_bank) * pm->n_guns); - Assert( pm->gun_banks != NULL ); + SDL_assert( pm->gun_banks != NULL ); for (i = 0; i < pm->n_guns; i++ ) { w_bank *bank = &pm->gun_banks[i]; bank->num_slots = cfread_int(fp); - Assert ( bank->num_slots < MAX_SLOTS ); + SDL_assert ( bank->num_slots < MAX_SLOTS ); for (j = 0; j < bank->num_slots; j++) { cfread_vector( &(bank->pnt[j]), fp ); cfread_vector( &(bank->norm[j]), fp ); @@ -1628,13 +1628,13 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode case ID_MPNT: pm->n_missiles = cfread_int(fp); pm->missile_banks = (w_bank *)malloc(sizeof(w_bank) * pm->n_missiles); - Assert( pm->missile_banks != NULL ); + SDL_assert( pm->missile_banks != NULL ); for (i = 0; i < pm->n_missiles; i++ ) { w_bank *bank = &pm->missile_banks[i]; bank->num_slots = cfread_int(fp); - Assert ( bank->num_slots < MAX_SLOTS ); + SDL_assert ( bank->num_slots < MAX_SLOTS ); for (j = 0; j < bank->num_slots; j++) { cfread_vector( &(bank->pnt[j]), fp ); cfread_vector( &(bank->norm[j]), fp ); @@ -1647,7 +1647,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode pm->n_docks = cfread_int(fp); pm->docking_bays = (dock_bay *)malloc(sizeof(dock_bay) * pm->n_docks); - Assert( pm->docking_bays != NULL ); + SDL_assert( pm->docking_bays != NULL ); for (i = 0; i < pm->n_docks; i++ ) { char *p; @@ -1668,13 +1668,13 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode } // determine what this docking bay can be used for - if ( !strnicmp(bay->name, "cargo", 5) ) + if ( !SDL_strncasecmp(bay->name, "cargo", 5) ) bay->type_flags = DOCK_TYPE_CARGO; else bay->type_flags = (DOCK_TYPE_REARM | DOCK_TYPE_GENERIC); bay->num_slots = cfread_int(fp); - Assert( bay->num_slots == 2 ); // Get Allender if Asserted! + SDL_assert( bay->num_slots == 2 ); // Get Allender if Asserted! for (j = 0; j < bay->num_slots; j++) { cfread_vector( &(bay->pnt[j]), fp ); cfread_vector( &(bay->norm[j]), fp ); @@ -1687,7 +1687,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode char props[MAX_PROP_LEN]; pm->n_thrusters = cfread_int(fp); pm->thrusters = (thruster_bank *)malloc(sizeof(thruster_bank) * pm->n_thrusters); - Assert( pm->thrusters != NULL ); + SDL_assert( pm->thrusters != NULL ); for (i = 0; i < pm->n_thrusters; i++ ) { thruster_bank *bank = &pm->thrusters[i]; @@ -1702,8 +1702,8 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode int length = strlen(props); if (length > 0) { int base_length = strlen("$engine_subsystem="); - Assert( strstr( (const char *)&props, "$engine_subsystem=") != NULL ); - Assert( length > base_length ); + SDL_assert( strstr( (const char *)&props, "$engine_subsystem=") != NULL ); + SDL_assert( length > base_length ); char *engine_subsys_name = props + base_length; if (engine_subsys_name[0] == '$') { engine_subsys_name++; @@ -1715,7 +1715,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode int table_error = 1; bank->wash_info_index = -1; for (int k=0; kwash_info_index = subsystems[k].engine_wash_index; if (bank->wash_info_index >= 0) { table_error = 0; @@ -1776,7 +1776,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode n_slots = cfread_int( fp ); subsystemp->turret_gun_sobj = physical_parent; - Assert(n_slots <= MAX_TFP); // only MAX_TFP firing points per model_subsystem + SDL_assert(n_slots <= MAX_TFP); // only MAX_TFP firing points per model_subsystem for (j = 0; j < n_slots; j++ ) { if ( j < MAX_TFP ) { cfread_vector( &subsystemp->turret_firing_point[j], fp ); @@ -1784,7 +1784,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode cfread_vector( &bogus, fp ); } } - Assert( n_slots > 0 ); + SDL_assert( n_slots > 0 ); subsystemp->turret_num_firing_points = (n_slots > MAX_TFP) ? MAX_TFP : n_slots; @@ -1828,12 +1828,12 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode if (p != NULL) { pm->split_plane[pm->num_split_plane] = pnt.xyz.z; pm->num_split_plane++; - Assert(pm->num_split_plane <= MAX_SPLIT_PLANE); + SDL_assert(pm->num_split_plane <= MAX_SPLIT_PLANE); } else if ( ( p = strstr(props, "$special"))!= NULL ) { char type[32]; get_user_prop_value(p+9, type); - if ( !stricmp(type, "subsystem") ) // if we have a subsystem, put it into the list! + if ( !SDL_strcasecmp(type, "subsystem") ) // if we have a subsystem, put it into the list! do_new_subsystem( n_subsystems, subsystems, -1, radius, &pnt, props, &name[1], pm->id ); // skip the first '$' character of the name } else if ( strstr(name, "$enginelarge") || strstr(name, "$enginehuge") ){ do_new_subsystem( n_subsystems, subsystems, -1, radius, &pnt, props, &name[1], pm->id ); // skip the first '$' character of the name @@ -1853,7 +1853,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode n = cfread_int(fp); pm->n_textures = n; // Dont overwrite memory!! - Assert(n <= MAX_MODEL_TEXTURES); + SDL_assert(n <= MAX_MODEL_TEXTURES); //mprintf(0," num textures = %d\n",n); for (i=0; imodel_data = (ubyte *)malloc(len); pm->model_data_size = len; - Assert(pm->model_data != NULL ); + SDL_assert(pm->model_data != NULL ); cfread(pm->model_data,1,len,fp); @@ -1892,7 +1892,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode #ifndef NDEBUG pm->debug_info_size = len; pm->debug_info = (char *)malloc(pm->debug_info_size+1); - Assert(pm->debug_info!=NULL); + SDL_assert(pm->debug_info!=NULL); memset(pm->debug_info,0,len+1); cfread( pm->debug_info, 1, len, fp ); #endif @@ -1904,7 +1904,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode case ID_PATH: pm->n_paths = cfread_int( fp ); pm->paths = (model_path *)malloc(sizeof(model_path)*pm->n_paths); - Assert( pm->paths != NULL ); + SDL_assert( pm->paths != NULL ); for (i=0; in_paths; i++ ) { cfread_string_len(pm->paths[i].name , MAX_NAME_LEN-1, fp); @@ -1920,7 +1920,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode // store the sub_model index (ie index into pm->submodel) of the parent pm->paths[i].parent_submodel = -1; for ( j = 0; j < pm->n_models; j++ ) { - if ( !stricmp( pm->submodel[j].name, pm->paths[i].parent_name) ) { + if ( !SDL_strcasecmp( pm->submodel[j].name, pm->paths[i].parent_name) ) { pm->paths[i].parent_submodel = j; } } @@ -1933,7 +1933,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode pm->paths[i].goal = pm->paths[i].nverts - 1; pm->paths[i].type = MP_TYPE_UNUSED; pm->paths[i].value = 0; - Assert(pm->paths[i].verts!=NULL); + SDL_assert(pm->paths[i].verts!=NULL); for (j=0; jpaths[i].nverts; j++ ) { cfread_vector(&pm->paths[i].verts[j].pos,fp ); pm->paths[i].verts[j].radius = cfread_float( fp ); @@ -1961,7 +1961,7 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode num_eyes = cfread_int( fp ); pm->n_view_positions = num_eyes; - Assert ( num_eyes < MAX_EYES ); + SDL_assert ( num_eyes < MAX_EYES ); for (i = 0; i < num_eyes; i++ ) { pm->view_positions[i].parent = cfread_int( fp ); cfread_vector( &pm->view_positions[i].pnt, fp ); @@ -1985,11 +1985,11 @@ int read_model_file(polymodel * pm, const char *filename, int n_subsystems, mode // # of faces num_faces = cfread_int(fp); pm->ins[idx].num_faces = num_faces; - Assert(num_faces <= MAX_INS_FACES); + SDL_assert(num_faces <= MAX_INS_FACES); // # of vertices num_verts = cfread_int(fp); - Assert(num_verts <= MAX_INS_VECS); + SDL_assert(num_verts <= MAX_INS_VECS); // read in all the vertices for(idx2=0; idx2filename)) { + if (!SDL_strcasecmp(filename, Polygon_models[i]->filename)) { // Model already loaded; just return. return Polygon_models[i]->id; } @@ -2106,7 +2106,7 @@ int model_load(const char *filename, int n_subsystems, model_subsystem *subsyste if ( Model_signature < org_sig ) { Model_signature = 0; } - Assert( (Model_signature % MAX_POLYGON_MODELS) == 0 ); + SDL_assert( (Model_signature % MAX_POLYGON_MODELS) == 0 ); pm->id = Model_signature + num; if (!read_model_file(pm, filename, n_subsystems, subsystems)) { @@ -2133,7 +2133,7 @@ int model_load(const char *filename, int n_subsystems, model_subsystem *subsyste strcpy( destroyed_name, pm->submodel[i].name ); strcat( destroyed_name, "-destroyed" ); for (j=0; jn_models; j++ ) { - if ( !stricmp( pm->submodel[j].name, destroyed_name )) { + if ( !SDL_strcasecmp( pm->submodel[j].name, destroyed_name )) { // mprintf(( "Found destroyed model for '%s'\n", pm->submodel[i].name )); pm->submodel[i].my_replacement = j; pm->submodel[j].i_replace = i; @@ -2153,7 +2153,7 @@ int model_load(const char *filename, int n_subsystems, model_subsystem *subsyste // check if current model name is substring of destroyed if ( strstr( pm->submodel[j].name, live_debris_name )) { mprintf(( "Found live debris model for '%s'\n", pm->submodel[i].name )); - Assert(pm->submodel[i].num_live_debris < MAX_LIVE_DEBRIS); + SDL_assert(pm->submodel[i].num_live_debris < MAX_LIVE_DEBRIS); pm->submodel[i].live_debris[pm->submodel[i].num_live_debris++] = j; pm->submodel[j].is_live_debris = 1; } @@ -2276,7 +2276,7 @@ int model_get_parent_submodel_for_live_debris( int model_num, int live_debris_mo { polymodel *pm = model_get(model_num); - Assert(pm->submodel[live_debris_model_num].is_live_debris == 1); + SDL_assert(pm->submodel[live_debris_model_num].is_live_debris == 1); int mn; bsp_info *child; @@ -2340,13 +2340,13 @@ float submodel_get_radius( int modelnum, int submodelnum ) polymodel * model_get(int model_num) { - Assert( model_num > -1 ); + SDL_assert( model_num > -1 ); int num = model_num % MAX_POLYGON_MODELS; - Assert( num > -1 ); - Assert( num < MAX_POLYGON_MODELS ); - Assert( Polygon_models[num]->id == model_num ); + SDL_assert( num > -1 ); + SDL_assert( num < MAX_POLYGON_MODELS ); + SDL_assert( Polygon_models[num]->id == model_num ); return Polygon_models[num]; } @@ -2606,7 +2606,7 @@ void model_find_obj_dir(vector *w_vec, vector *m_vec, object *ship_obj, int sub_ matrix m; int mn; - Assert(ship_obj->type == OBJ_SHIP); + SDL_assert(ship_obj->type == OBJ_SHIP); polymodel *pm = model_get(Ships[ship_obj->instance].modelnum); vec = *m_vec; @@ -2662,14 +2662,14 @@ void model_get_rotating_submodel_axis(vector *model_axis, vector *world_axis, in polymodel *pm = model_get(modelnum); bsp_info *sm = &pm->submodel[submodel_num]; - Assert(sm->movement_type == MOVEMENT_TYPE_ROT); + SDL_assert(sm->movement_type == MOVEMENT_TYPE_ROT); if (sm->movement_axis == MOVEMENT_AXIS_X) { (void) vm_vec_make(model_axis, 1.0f, 0.0f, 0.0f); } else if (sm->movement_axis == MOVEMENT_AXIS_Y) { (void) vm_vec_make(model_axis, 0.0f, 1.0f, 0.0f); } else { - Assert(sm->movement_axis == MOVEMENT_AXIS_Z); + SDL_assert(sm->movement_axis == MOVEMENT_AXIS_Z); (void) vm_vec_make(model_axis, 0.0f, 0.0f, 1.0f); } @@ -2684,7 +2684,7 @@ void model_get_rotating_submodel_axis(vector *model_axis, vector *world_axis, in #endif void submodel_stepped_rotate(model_subsystem *psub, submodel_instance_info *sii) { - Assert(psub->flags & MSS_FLAG_STEPPED_ROTATE); + SDL_assert(psub->flags & MSS_FLAG_STEPPED_ROTATE); if ( psub->subobj_num < 0 ) return; @@ -2696,7 +2696,7 @@ void submodel_stepped_rotate(model_subsystem *psub, submodel_instance_info *sii) // get active rotation time this frame int end_stamp = timestamp(); float rotation_time = 0.001f * (end_stamp - sii->step_zero_timestamp); - Assert(rotation_time >= 0); + SDL_assert(rotation_time >= 0); // save last angles sii->prev_angs = sii->angs; @@ -2732,7 +2732,7 @@ void submodel_stepped_rotate(model_subsystem *psub, submodel_instance_info *sii) // subtract off fractional step part, round up (ie, 1.999999 -> 2) int cur_step = int( ((rotation_time - step_offset_time) / step_time) + 0.5f); // mprintf(("cur step %d\n", cur_step)); - // Assert(step_offset_time >= 0); + // SDL_assert(step_offset_time >= 0); if (cur_step >= psub->stepped_rotation->num_steps) { // I don;t know why, but removing this line makes it all good. @@ -2905,7 +2905,7 @@ int model_rotate_gun(int model_num, model_subsystem *turret, matrix *orient, ang bsp_info * sm_parent = &pm->submodel[turret->subobj_num]; // Check for a valid turret - Assert( turret->turret_num_firing_points > 0 ); + SDL_assert( turret->turret_num_firing_points > 0 ); if ( sm_parent == sm ) { @@ -2916,9 +2916,9 @@ int model_rotate_gun(int model_num, model_subsystem *turret, matrix *orient, ang if ( !(turret->flags & MSS_FLAG_TURRET_MATRIX) ) model_make_turrent_matrix(model_num, turret ); - Assert( turret->flags & MSS_FLAG_TURRET_MATRIX); -// Assert( sm->movement_axis == MOVEMENT_AXIS_X ); // Gun must be able to change pitch -// Assert( sm_parent->movement_axis == MOVEMENT_AXIS_Z ); // Parent must be able to change heading + SDL_assert( turret->flags & MSS_FLAG_TURRET_MATRIX); +// SDL_assert( sm->movement_axis == MOVEMENT_AXIS_X ); // Gun must be able to change pitch +// SDL_assert( sm_parent->movement_axis == MOVEMENT_AXIS_Z ); // Parent must be able to change heading //====================================================== // DEBUG code to draw the normal out of this gun and a circle @@ -3053,7 +3053,7 @@ void model_find_world_point(vector * outpnt, vector *mpnt,int model_num,int sub_ // pos - pos vector of ship void world_find_model_point(vector *out, vector *world_pt, polymodel *pm, int submodel_num, matrix *orient, vector *pos) { - Assert( (pm->submodel[submodel_num].parent == pm->detail[0]) || (pm->submodel[submodel_num].parent == -1) ); + SDL_assert( (pm->submodel[submodel_num].parent == pm->detail[0]) || (pm->submodel[submodel_num].parent == -1) ); vector tempv1, tempv2; matrix m; @@ -3096,7 +3096,7 @@ int rotating_submodel_has_ship_subsys(int submodel, ship *shipp) void model_get_rotating_submodel_list(int *submodel_list, int *num_rotating_submodels, object *objp) { - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); // Check if not currently rotating - then treat as part of superstructure. int modelnum = Ships[objp->instance].modelnum; @@ -3121,12 +3121,12 @@ void model_get_rotating_submodel_list(int *submodel_list, int *num_rotating_subm ship_subsys *subsys; for ( subsys = GET_FIRST(&pship->subsys_list); subsys !=END_OF_LIST(&pship->subsys_list); subsys = GET_NEXT(subsys) ) { - Assert(subsys->system_info->model_num == modelnum); + SDL_assert(subsys->system_info->model_num == modelnum); if (i == subsys->system_info->subobj_num) { // found the correct subsystem - now check delta rotation angle not too large float delta_angle = get_submodel_delta_angle(&subsys->submodel_info_1); if (delta_angle < MAX_SUBMODEL_COLLISION_ROT_ANGLE) { - Assert(*num_rotating_submodels < MAX_ROTATING_SUBMODELS-1); + SDL_assert(*num_rotating_submodels < MAX_ROTATING_SUBMODELS-1); submodel_list[(*num_rotating_submodels)++] = i; } break; @@ -3143,7 +3143,7 @@ void model_get_rotating_submodel_list(int *submodel_list, int *num_rotating_subm ship *pship = &Ships[objp->instance]; for (int idx=0; idx<*num_rotating_submodels; idx++) { int valid = rotating_submodel_has_ship_subsys(submodel_list[idx], pship); -// Assert( valid ); +// SDL_assert( valid ); if ( !valid ) { Warning( LOCATION, "Ship %s has rotating submodel [%s] without ship subsystem\n", pship->ship_name, pm->submodel[submodel_list[idx]].name ); @@ -3277,8 +3277,8 @@ void model_set_instance(int model_num, int sub_model_num, submodel_instance_info pm = model_get(model_num); - Assert( sub_model_num >= 0 ); - Assert( sub_model_num < pm->n_models ); + SDL_assert( sub_model_num >= 0 ); + SDL_assert( sub_model_num < pm->n_models ); if ( sub_model_num < 0 ) return; if ( sub_model_num >= pm->n_models ) return; @@ -3318,8 +3318,8 @@ void model_init_submodel_axis_pt(submodel_instance_info *sii, int model_num, int vector p1, v1, p2, v2, int1; polymodel *pm = model_get(model_num); - Assert(pm->submodel[submodel_num].movement_type == MOVEMENT_TYPE_ROT); - Assert(sii); + SDL_assert(pm->submodel[submodel_num].movement_type == MOVEMENT_TYPE_ROT); + SDL_assert(sii); mpoint1 = NULL; mpoint2 = NULL; @@ -3388,8 +3388,8 @@ void model_add_arc(int model_num, int sub_model_num, vector *v1, vector *v2, int sub_model_num = pm->detail[0]; } - Assert( sub_model_num >= 0 ); - Assert( sub_model_num < pm->n_models ); + SDL_assert( sub_model_num >= 0 ); + SDL_assert( sub_model_num < pm->n_models ); if ( sub_model_num < 0 ) return; if ( sub_model_num >= pm->n_models ) return; @@ -3459,15 +3459,15 @@ int model_find_dock_name_index( int modelnum, char *name ) // check the generic names and call previous function to find first dock point of // the specified type - if ( !stricmp(name, "cargo") ) + if ( !SDL_strcasecmp(name, "cargo") ) return model_find_dock_index( modelnum, DOCK_TYPE_CARGO ); - else if (!stricmp( name, "rearm") ) + else if (!SDL_strcasecmp( name, "rearm") ) return model_find_dock_index( modelnum, DOCK_TYPE_REARM ); - else if (!stricmp( name, "generic") ) + else if (!SDL_strcasecmp( name, "generic") ) return model_find_dock_index( modelnum, DOCK_TYPE_GENERIC ); for (i = 0; i < pm->n_docks; i++ ) { - if ( !stricmp(pm->docking_bays[i].name, name) ) + if ( !SDL_strcasecmp(pm->docking_bays[i].name, name) ) return i; } @@ -3481,7 +3481,7 @@ char *model_get_dock_name(int modelnum, int index) polymodel *pm; pm = model_get(modelnum); - Assert((index >= 0) && (index < pm->n_docks)); + SDL_assert((index >= 0) && (index < pm->n_docks)); return pm->docking_bays[index].name; } @@ -3507,20 +3507,20 @@ void swap_bsp_defpoints(ubyte * p) ubyte * normcount = p+20; vector *src = vp(p+offset); - Assert( nverts < MAX_POLYGON_VECS ); - // Assert( nnorms < MAX_POLYGON_NORMS ); + SDL_assert( nverts < MAX_POLYGON_VECS ); + // SDL_assert( nnorms < MAX_POLYGON_NORMS ); for (n=0; nxyz.x = INTEL_FLOAT( &src->xyz.x ); - src->xyz.y = INTEL_FLOAT( &src->xyz.y ); - src->xyz.z = INTEL_FLOAT( &src->xyz.z ); + src->xyz.x = INTEL_FLOAT( src->xyz.x ); + src->xyz.y = INTEL_FLOAT( src->xyz.y ); + src->xyz.z = INTEL_FLOAT( src->xyz.z ); Interp_verts[n] = src; src++; for (i=0;ixyz.x = INTEL_FLOAT( &src->xyz.x ); - src->xyz.y = INTEL_FLOAT( &src->xyz.y ); - src->xyz.z = INTEL_FLOAT( &src->xyz.z ); + src->xyz.x = INTEL_FLOAT( src->xyz.x ); + src->xyz.y = INTEL_FLOAT( src->xyz.y ); + src->xyz.z = INTEL_FLOAT( src->xyz.z ); src++; } @@ -3532,14 +3532,14 @@ void swap_bsp_tmappoly( polymodel * pm, ubyte * p ) model_tmap_vert *verts; vector * normal = vp(p+8); vector * center = vp(p+20); - float radius = INTEL_FLOAT( &fl(p+32) ); + float radius = INTEL_FLOAT( fl(p+32) ); fl(p+32) = radius; - normal->xyz.x = INTEL_FLOAT( &normal->xyz.x ); - normal->xyz.y = INTEL_FLOAT( &normal->xyz.y ); - normal->xyz.z = INTEL_FLOAT( &normal->xyz.z ); - center->xyz.x = INTEL_FLOAT( ¢er->xyz.x ); - center->xyz.y = INTEL_FLOAT( ¢er->xyz.y ); - center->xyz.z = INTEL_FLOAT( ¢er->xyz.z ); + normal->xyz.x = INTEL_FLOAT( normal->xyz.x ); + normal->xyz.y = INTEL_FLOAT( normal->xyz.y ); + normal->xyz.z = INTEL_FLOAT( normal->xyz.z ); + center->xyz.x = INTEL_FLOAT( center->xyz.x ); + center->xyz.y = INTEL_FLOAT( center->xyz.y ); + center->xyz.z = INTEL_FLOAT( center->xyz.z ); nv = INTEL_INT( w(p+36)); w(p+36) = nv; @@ -3552,8 +3552,8 @@ void swap_bsp_tmappoly( polymodel * pm, ubyte * p ) for (i=0;iversion < 2003 ) { @@ -3588,15 +3588,15 @@ void swap_bsp_flatpoly( polymodel * pm, ubyte * p ) short *verts; vector * normal = vp(p+8); vector * center = vp(p+20); - float radius = INTEL_FLOAT( &fl(p+32) ); + float radius = INTEL_FLOAT( fl(p+32) ); fl(p+32) = radius; mprintf(("flatpoly radius = %f\n", radius )); - normal->xyz.x = INTEL_FLOAT( &normal->xyz.x ); - normal->xyz.y = INTEL_FLOAT( &normal->xyz.y ); - normal->xyz.z = INTEL_FLOAT( &normal->xyz.z ); - center->xyz.x = INTEL_FLOAT( ¢er->xyz.x ); - center->xyz.y = INTEL_FLOAT( ¢er->xyz.y ); - center->xyz.z = INTEL_FLOAT( ¢er->xyz.z ); + normal->xyz.x = INTEL_FLOAT( normal->xyz.x ); + normal->xyz.y = INTEL_FLOAT( normal->xyz.y ); + normal->xyz.z = INTEL_FLOAT( normal->xyz.z ); + center->xyz.x = INTEL_FLOAT( center->xyz.x ); + center->xyz.y = INTEL_FLOAT( center->xyz.y ); + center->xyz.z = INTEL_FLOAT( center->xyz.z ); nv = INTEL_INT( w(p+36)); //tigital w(p+36) = nv; @@ -3651,21 +3651,21 @@ void swap_bsp_sortnorms( polymodel * pm, ubyte * p ) vector * center = vp(p+20); int tmp = INTEL_INT( w(p+32) ); w(p+32) = tmp; - normal->xyz.x = INTEL_FLOAT( &normal->xyz.x ); - normal->xyz.y = INTEL_FLOAT( &normal->xyz.y ); - normal->xyz.z = INTEL_FLOAT( &normal->xyz.z ); - center->xyz.x = INTEL_FLOAT( ¢er->xyz.x ); - center->xyz.y = INTEL_FLOAT( ¢er->xyz.y ); - center->xyz.z = INTEL_FLOAT( ¢er->xyz.z ); + normal->xyz.x = INTEL_FLOAT( normal->xyz.x ); + normal->xyz.y = INTEL_FLOAT( normal->xyz.y ); + normal->xyz.z = INTEL_FLOAT( normal->xyz.z ); + center->xyz.x = INTEL_FLOAT( center->xyz.x ); + center->xyz.y = INTEL_FLOAT( center->xyz.y ); + center->xyz.z = INTEL_FLOAT( center->xyz.z ); vector * bmin = vp(p+56); vector * bmax = vp(p+68); - bmin->xyz.x = INTEL_FLOAT( &bmin->xyz.x ); - bmin->xyz.y = INTEL_FLOAT( &bmin->xyz.y ); - bmin->xyz.z = INTEL_FLOAT( &bmin->xyz.z ); - bmax->xyz.x = INTEL_FLOAT( &bmax->xyz.x ); - bmax->xyz.y = INTEL_FLOAT( &bmax->xyz.y ); - bmax->xyz.z = INTEL_FLOAT( &bmax->xyz.z ); + bmin->xyz.x = INTEL_FLOAT( bmin->xyz.x ); + bmin->xyz.y = INTEL_FLOAT( bmin->xyz.y ); + bmin->xyz.z = INTEL_FLOAT( bmin->xyz.z ); + bmax->xyz.x = INTEL_FLOAT( bmax->xyz.x ); + bmax->xyz.y = INTEL_FLOAT( bmax->xyz.y ); + bmax->xyz.z = INTEL_FLOAT( bmax->xyz.z ); if (prelist) swap_bsp_data(pm,p+prelist); if (backlist) swap_bsp_data(pm,p+backlist); @@ -3702,12 +3702,12 @@ void swap_bsp_data( polymodel * pm, void *model_ptr ) case OP_BOUNDBOX: min = vp(p+8); max = vp(p+20); - min->xyz.x = INTEL_FLOAT( &min->xyz.x ); - min->xyz.y = INTEL_FLOAT( &min->xyz.y ); - min->xyz.z = INTEL_FLOAT( &min->xyz.z ); - max->xyz.x = INTEL_FLOAT( &max->xyz.x ); - max->xyz.y = INTEL_FLOAT( &max->xyz.y ); - max->xyz.z = INTEL_FLOAT( &max->xyz.z ); + min->xyz.x = INTEL_FLOAT( min->xyz.x ); + min->xyz.y = INTEL_FLOAT( min->xyz.y ); + min->xyz.z = INTEL_FLOAT( min->xyz.z ); + max->xyz.x = INTEL_FLOAT( max->xyz.x ); + max->xyz.y = INTEL_FLOAT( max->xyz.y ); + max->xyz.z = INTEL_FLOAT( max->xyz.z ); break; default: mprintf(( "Bad chunk type %d, len=%d in modelread:swap_bsp_data\n", chunk_type, chunk_size )); diff --git a/src/movie/mvelib.cpp b/src/movie/mvelib.cpp index 8273b074..9805dbe 100644 --- a/src/movie/mvelib.cpp +++ b/src/movie/mvelib.cpp @@ -77,10 +77,10 @@ MVEFILE *mvefile_open(const char *filename) // lower case filename for checking strncpy(lower_name, filename, strlen(filename)+1); - strlwr(lower_name); + SDL_strlwr(lower_name); // upper case filename for checking strncpy(upper_name, filename, strlen(filename)+1); - strupr(upper_name); + SDL_strupr(upper_name); // NOTE: CF_TYPE *must* be ANY to get movies off of the CDs while (1) { diff --git a/src/movie/mveplayer.cpp b/src/movie/mveplayer.cpp index 8c3014c..2a7aff1 100644 --- a/src/movie/mveplayer.cpp +++ b/src/movie/mveplayer.cpp @@ -171,12 +171,12 @@ static int mve_do_timer_wait(void) ts = timer_expire - tv; - Sleep(ts / 1000); + SDL_Delay(ts / 1000); // try and burn off excess in attempt to keep sync if (ts % 1000) { for (int i = 0; i < 10; i++) { - Sleep(0); + SDL_Delay(0); } } end: @@ -696,7 +696,7 @@ int mve_video_init(ubyte *data) glGenTextures(1, &tex); - Assert(tex != 0); + SDL_assert(tex != 0); if ( tex == 0 ) { mprintf(("MOVIE", "ERROR: Can't create a GL texture")); diff --git a/src/nebedit/nebedit.cpp b/src/nebedit/nebedit.cpp index f0ceaeb..d115e39 100644 --- a/src/nebedit/nebedit.cpp +++ b/src/nebedit/nebedit.cpp @@ -571,7 +571,7 @@ void delete_vert(int i) int add_vert(int mx, int my) { - Assert(num_pts<300); + SDL_assert(num_pts<300); x[num_pts] = mx; y[num_pts] = my; l[num_pts] = 0; @@ -788,9 +788,9 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdSh // setup the fred exe directory so CFILE can init properly /* char *c = GetCommandLine(); - Assert(c != NULL); + SDL_assert(c != NULL); char *tok = strtok(c, " "); - Assert(tok != NULL); + SDL_assert(tok != NULL); */ timer_init(); diff --git a/src/nebula/neb.cpp b/src/nebula/neb.cpp index bae47e8..233a24d 100644 --- a/src/nebula/neb.cpp +++ b/src/nebula/neb.cpp @@ -369,7 +369,7 @@ void neb2_init() } // should always have 6 neb poofs - Assert(Neb2_poof_count == 6); + SDL_assert(Neb2_poof_count == 6); #endif } @@ -448,7 +448,7 @@ void neb2_level_init() Neb_backg_fog_far = NEB_BACKG_FOG_FAR_D3D; break; case GR_SOFTWARE: - Assert(Fred_running); + SDL_assert(Fred_running); break; default : Int3(); @@ -1136,12 +1136,12 @@ void neb2_get_fog_values(float *fnear, float *ffar, object *objp) // determine what fog index to use if(objp->type == OBJ_SHIP){ - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); if((objp->instance < 0) || (objp->instance >= MAX_SHIPS)){ fog_index = SHIP_TYPE_FIGHTER_BOMBER; } else { fog_index = ship_query_general_type(objp->instance); - Assert(fog_index >= 0); + SDL_assert(fog_index >= 0); if(fog_index < 0){ fog_index = SHIP_TYPE_FIGHTER_BOMBER; } @@ -1517,7 +1517,7 @@ DCF(neb2_fog, "") Neb_ship_fog_vals_glide[index][0] = fnear; Neb_ship_fog_vals_glide[index][1] = ffar; } else { - Assert(gr_screen.mode == GR_DIRECT3D || gr_screen.mode == GR_OPENGL); + SDL_assert(gr_screen.mode == GR_DIRECT3D || gr_screen.mode == GR_OPENGL); Neb_ship_fog_vals_d3d[index][0] = fnear; Neb_ship_fog_vals_d3d[index][1] = ffar; } @@ -1645,7 +1645,7 @@ DCF(neb2_fog_vals, "") dc_printf("(11)background polys : %f, %f\n\n", Neb_backg_fog_near, Neb_backg_fog_far); } else { - Assert(gr_screen.mode == GR_DIRECT3D || gr_screen.mode == GR_OPENGL); + SDL_assert(gr_screen.mode == GR_DIRECT3D || gr_screen.mode == GR_OPENGL); dc_printf("(1)cargo containers : %f, %f\n", Neb_ship_fog_vals_d3d[1][0], Neb_ship_fog_vals_d3d[1][1]); dc_printf("(2)fighters/bombers : %f, %f\n", Neb_ship_fog_vals_d3d[2][0], Neb_ship_fog_vals_d3d[2][1]); dc_printf("(3)cruisers : %f, %f\n", Neb_ship_fog_vals_d3d[3][0], Neb_ship_fog_vals_d3d[3][1]); diff --git a/src/nebula/neblightning.cpp b/src/nebula/neblightning.cpp index e563d8c..4a42a89 100644 --- a/src/nebula/neblightning.cpp +++ b/src/nebula/neblightning.cpp @@ -461,7 +461,7 @@ void nebl_init() // fill this guy in if(s->num_bolt_types < MAX_BOLT_TYPES){ s->bolt_types[s->num_bolt_types] = (char)nebl_get_bolt_index(name); - Assert(s->bolt_types[s->num_bolt_types] != -1); + SDL_assert(s->bolt_types[s->num_bolt_types] != -1); s->num_bolt_types++; } @@ -548,7 +548,7 @@ void nebl_render_all() // if this is being used if(b->used){ - Assert(b->head != NULL); + SDL_assert(b->head != NULL); // bogus bolt if(b->head == NULL){ @@ -895,7 +895,7 @@ l_node *nebl_new() // get a new node off the freelist lp = GET_FIRST(&Nebl_free_list); - Assert( lp != &Nebl_free_list ); // shouldn't have the dummy element + SDL_assert( lp != &Nebl_free_list ); // shouldn't have the dummy element // remove trailp from the free list list_remove( &Nebl_free_list, lp ); @@ -1244,7 +1244,7 @@ void nebl_render(bolt_type *bi, l_node *whee, float width, l_section *prev) // if prev is NULL, we're just starting so we need our start point if(prev == NULL){ - Assert(whee->links[LINK_RIGHT] != NULL); + SDL_assert(whee->links[LINK_RIGHT] != NULL); nebl_generate_section(bi, width, whee, whee->links[LINK_RIGHT], &start, NULL, 1, 0); } else { start = *prev; diff --git a/src/network/multi.cpp b/src/network/multi.cpp index aa17cfa..d30128e 100644 --- a/src/network/multi.cpp +++ b/src/network/multi.cpp @@ -372,7 +372,7 @@ void multi_init() // read in config file multi_options_read_config(); - Assert( Net_player == NULL ); + SDL_assert( Net_player == NULL ); Multi_id_num = 0; // clear out all netplayers @@ -645,7 +645,7 @@ void multi_client_check_server() { int rval; - Assert( MULTIPLAYER_CLIENT ); + SDL_assert( MULTIPLAYER_CLIENT ); // this function can get called while in the popup code below. So we include this check as a // reentrancy check. @@ -791,7 +791,7 @@ void process_packet_normal(ubyte* data, header *header_info) break; case XFER_PACKET: - Assert(header_info->id >= 0); + SDL_assert(header_info->id >= 0); int np_index; PSNET_SOCKET_RELIABLE sock; sock = INVALID_SOCKET; @@ -1233,7 +1233,7 @@ void multi_process_incoming() ubyte *data, *savep; net_addr_t from_addr; - Assert( Multi_read_count < NUM_REENTRANT_LEVELS ); + SDL_assert( Multi_read_count < NUM_REENTRANT_LEVELS ); savep = net_buffer[Multi_read_count]; Multi_read_count++; @@ -1761,7 +1761,7 @@ void standalone_main_init() void standalone_main_do() { - Sleep(10); // since nothing will really be going on here, we can afford to give some time + SDL_Delay(10); // since nothing will really be going on here, we can afford to give some time // back to the operating system. // kind of a do-nothing spin state. diff --git a/src/network/multi_campaign.cpp b/src/network/multi_campaign.cpp index 7625311..13aaaab 100644 --- a/src/network/multi_campaign.cpp +++ b/src/network/multi_campaign.cpp @@ -559,7 +559,7 @@ void multi_campaign_send_debrief_info() ADD_DATA(val); // add the filename - Assert(Campaign.missions[Campaign.current_mission].name != NULL); + SDL_assert(Campaign.missions[Campaign.current_mission].name != NULL); ADD_STRING(Campaign.missions[Campaign.current_mission].name); // add the # of goals and events @@ -627,7 +627,7 @@ void multi_campaign_send_pool_status() } // make sure it'll all fit into this packet - Assert((wpool_size + spool_size) < 480); + SDL_assert((wpool_size + spool_size) < 480); // add all ship types val = (ubyte)spool_size; @@ -651,7 +651,7 @@ void multi_campaign_send_pool_status() } // send to all players - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); multi_io_send_to_all_reliable(data, packet_size); // notification message @@ -675,7 +675,7 @@ void multi_campaign_send_start(net_player *pl) // add the # of missions, and their filenames ADD_INT(Campaign.num_missions); for(idx=0;idx 0 ){ Campaign.missions[mission_num].goals = (mgoal *)malloc( sizeof(mgoal) * num_goals ); @@ -902,7 +902,7 @@ void multi_campaign_process_ingame_start( ubyte *data, header *hinfo ) // now the events GET_DATA( num_events ); // need to malloc out the data - Assert( Campaign.missions[mission_num].num_events == 0 ); + SDL_assert( Campaign.missions[mission_num].num_events == 0 ); Campaign.missions[mission_num].num_events = num_events; if ( num_events > 0 ){ Campaign.missions[mission_num].events = (mevent *)malloc( sizeof(mevent) * num_events ); diff --git a/src/network/multi_data.cpp b/src/network/multi_data.cpp index 9cbc1aa..3f66bd7 100644 --- a/src/network/multi_data.cpp +++ b/src/network/multi_data.cpp @@ -77,7 +77,7 @@ * problem in options screen. * * 13 4/16/98 1:55p Dave - * Removed unneeded Assert when processing chat packets. Fixed standalone + * Removed unneeded SDL_assert when processing chat packets. Fixed standalone * sequencing bugs. Laid groundwork for join screen server status * icons/text. * @@ -457,7 +457,7 @@ int multi_data_is_data(char *filename) { int len,idx; - Assert(filename != NULL); + SDL_assert(filename != NULL); // some kind of error if(filename == NULL){ diff --git a/src/network/multi_dogfight.cpp b/src/network/multi_dogfight.cpp index da8f558..e5f41ee 100644 --- a/src/network/multi_dogfight.cpp +++ b/src/network/multi_dogfight.cpp @@ -217,7 +217,7 @@ void multi_df_eval_kill(net_player *killer, object *dead_obj) if(dead_index < 0){ return; } - Assert(dead_index < MAX_PLAYERS); + SDL_assert(dead_index < MAX_PLAYERS); if(dead_index == NET_PLAYER_INDEX(killer)){ return; } @@ -258,7 +258,7 @@ void multi_df_debrief_init() // load background bitmap Multi_df_background_bitmap = bm_load(Multi_df_background_fname[gr_screen.res]); - Assert(Multi_df_background_bitmap); + SDL_assert(Multi_df_background_bitmap); // create the UI window Multi_df_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0); @@ -448,7 +448,7 @@ void multi_df_blit_kill_matrix() gr_get_string_size(&str_len, NULL, squashed_string); // set color and blit the string - Assert(Multi_df_score[idx].np_index >= 0); + SDL_assert(Multi_df_score[idx].np_index >= 0); if(Multi_df_score[idx].np_index >= 0){ gr_set_color_fast(Color_netplayer[Multi_df_score[idx].np_index]); } @@ -476,7 +476,7 @@ void multi_df_blit_kill_matrix() strcpy(squashed_string, Multi_df_score[idx].callsign); gr_force_fit_string(squashed_string, CALLSIGN_LEN, (int)max_text_width); gr_get_string_size(&str_len, NULL, squashed_string); - Assert(Multi_df_score[idx].np_index >= 0); + SDL_assert(Multi_df_score[idx].np_index >= 0); if(Multi_df_score[idx].np_index >= 0){ gr_set_color_fast(Color_netplayer[Multi_df_score[idx].np_index]); } @@ -491,7 +491,7 @@ void multi_df_blit_kill_matrix() gr_set_color_fast(&Color_grey); } else { row_total += multi_df_stuff_kills(squashed_string, idx, s_idx); - Assert(Multi_df_score[idx].np_index >= 0); + SDL_assert(Multi_df_score[idx].np_index >= 0); if(Multi_df_score[idx].np_index >= 0){ gr_set_color_fast(Color_netplayer[Multi_df_score[idx].np_index]); } diff --git a/src/network/multi_ingame.cpp b/src/network/multi_ingame.cpp index 0f14cbd..c9443d7 100644 --- a/src/network/multi_ingame.cpp +++ b/src/network/multi_ingame.cpp @@ -423,7 +423,7 @@ void multi_handle_ingame_joiners() { int idx; - Assert( MULTIPLAYER_MASTER ); + SDL_assert( MULTIPLAYER_MASTER ); // if my ingame joining flag isn't set, then don't do anything. if ( !(Netgame.flags & NG_FLAG_INGAME_JOINING) ){ @@ -1375,7 +1375,7 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo ) objp = &Objects[Ships[idx].objnum]; multi_ts_get_team_and_slot(Ships[idx].ship_name, &team_val, &slot_index); if ( team_val != -1 ) { - Assert( slot_index != -1 ); + SDL_assert( slot_index != -1 ); // change the ship type and the weapons change_ship_type(objp->instance, Wss_slots_teams[team_val][slot_index].ship_class); @@ -1492,7 +1492,7 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo ) GET_DATA( what ); if ( what == INGAME_WING_NOT_ARRIVED ) { - Assert( wingp->total_arrived_count == 0 ); // this had better be true!!! + SDL_assert( wingp->total_arrived_count == 0 ); // this had better be true!!! } else if ( what == INGAME_WING_DEPARTED ) { // mark the wing as gone. if it isn't, it soon will be. Maybe we should send more information // about these wings later (like total_arrived_count, etc), but we will see. @@ -1508,8 +1508,8 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo ) GET_DATA( current_count ); GET_DATA( current_wave ); - Assert( current_wave > 0 ); - Assert( total_arrived_count > 0 ); + SDL_assert( current_wave > 0 ); + SDL_assert( total_arrived_count > 0 ); // for this wing, strip it down to nothing. Let the parse object ocde recreate the // wing from the parse objects, then bash any weapons, etc for player wings. We need @@ -1522,9 +1522,9 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo ) int index, objnum; index = wingp->ship_index[i]; - Assert( index != -1 ); + SDL_assert( index != -1 ); objnum = Ships[index].objnum; - Assert( objnum != -1 ); + SDL_assert( objnum != -1 ); // delete the object since we are filling the wing again anyway. obj_delete( objnum ); @@ -1550,7 +1550,7 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo ) // assign which_one to be the given signature - wing's base signature. This let's us // know which ship to create (i.e. the total_arrivel_count); which_one = signature - wingp->net_signature; - Assert( (which_one >= 0) && (which_one < (wingp->net_signature + (wingp->wave_count*wingp->num_waves))) ); + SDL_assert( (which_one >= 0) && (which_one < (wingp->net_signature + (wingp->wave_count*wingp->num_waves))) ); wingp->total_arrived_count = (ushort)which_one; // determine which ship in the ahip arrival list this guy is. It is a 0 based index @@ -1578,7 +1578,7 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo ) // not -1, then be sure we have a valid slot, then change the ship type, etc. multi_ts_get_team_and_slot(shipp->ship_name, &team, &slot_index); if ( team != -1 ) { - Assert( slot_index != -1 ); + SDL_assert( slot_index != -1 ); // change the ship type and the weapons change_ship_type(objp->instance, Wss_slots_teams[team][slot_index].ship_class); @@ -1592,7 +1592,7 @@ void process_ingame_wings_packet( ubyte *data, header *hinfo ) // if this is a player ship, make sure we find out who's it is and set their objnum accordingly for( j = 0; j < MAX_PLAYERS; j++){ if(MULTI_CONNECTED(Net_players[j]) && (Net_players[j].player->objnum == signature)) { - Assert( team != -1 ); // to help trap errors!!! + SDL_assert( team != -1 ); // to help trap errors!!! nprintf(("Network", "Making %s ship for %s\n", Ships[shipnum].ship_name, Net_players[j].player->callsign)); multi_assign_player_ship( j, objp, Ships[shipnum].ship_info_index ); objp->flags |= OF_PLAYER_SHIP; @@ -1736,7 +1736,7 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl) // add the # of respawns this ship has left pobj = mission_parse_get_arrival_ship( Objects[rdata].net_signature ); - Assert(pobj != NULL); + SDL_assert(pobj != NULL); ADD_UINT(pobj->respawn_count); // add the ships ets settings @@ -1757,7 +1757,7 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl) val = (ubyte)shipp->weapons.num_secondary_banks; // for sanity checking ADD_DATA(val); for ( i = 0; i < shipp->weapons.num_secondary_banks; i++ ) { - Assert( shipp->weapons.secondary_bank_ammo[i] < UCHAR_MAX ); + SDL_assert( shipp->weapons.secondary_bank_ammo[i] < UCHAR_MAX ); val = (ubyte)shipp->weapons.secondary_bank_ammo[i]; ADD_DATA(val); } @@ -1777,7 +1777,7 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl) // send the packet if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ - Assert(pl != NULL); + SDL_assert(pl != NULL); multi_io_send_reliable(pl, data, packet_size); } else { multi_io_send_reliable(Net_player, data, packet_size); @@ -1818,14 +1818,14 @@ void multi_ingame_validate_players() } ship_name = multi_ts_get_shipname( Net_players[i].p_info.team, Net_players[i].p_info.ship_index ); - Assert( ship_name != NULL ); + SDL_assert( ship_name != NULL ); shipnum = ship_name_lookup( ship_name ); if ( shipnum == -1 ) { // ship could be respawning continue; } objnum = Ships[shipnum].objnum; - Assert( objnum != -1 ); + SDL_assert( objnum != -1 ); // if this guy's objnum isn't a ship, then it should proably be a ghost!! if ( Objects[objnum].type == OBJ_SHIP ) { @@ -1834,7 +1834,7 @@ void multi_ingame_validate_players() Net_players[i].player->objnum = objnum; } } else { - Assert( Objects[objnum].type == OBJ_GHOST ); + SDL_assert( Objects[objnum].type == OBJ_GHOST ); } } } @@ -1871,7 +1871,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo) } // make sure this player doesn't already have an object - Assert(MULTI_CONNECTED(Net_players[player_num])); + SDL_assert(MULTI_CONNECTED(Net_players[player_num])); if(Net_players[player_num].player->objnum != -1){ send_ingame_ship_request_packet(INGAME_SR_DENY,0,&Net_players[player_num]); break; @@ -1936,7 +1936,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo) // get the object itself objp = multi_get_network_object(Multi_ingame_join_sig); - Assert(objp != NULL); + SDL_assert(objp != NULL); // get its most recent position and orientation //GET_DATA(objp->pos); @@ -1959,14 +1959,14 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo) // must change the ship type and weapons. An ingame joiner know about the default class // and weapons for a ship, but these could have changed. multi_ts_get_team_and_slot(Player_ship->ship_name, &team, &slot_index); - Assert( team != -1 ); - Assert( slot_index != -1 ); + SDL_assert( team != -1 ); + SDL_assert( slot_index != -1 ); change_ship_type(objp->instance, Wss_slots_teams[team][slot_index].ship_class); wl_bash_ship_weapons(&Player_ship->weapons,&Wss_slots_teams[team][slot_index]); // get the parse object for it and assign the respawn count pobj = mission_parse_get_arrival_ship( objp->net_signature ); - Assert(pobj != NULL); + SDL_assert(pobj != NULL); pobj->respawn_count = respawn_count; // get the ships ets settings @@ -1985,7 +1985,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo) // secondary bank ammo data GET_DATA( num_secondary_banks ); - Assert( num_secondary_banks == Player_ship->weapons.num_secondary_banks ); + SDL_assert( num_secondary_banks == Player_ship->weapons.num_secondary_banks ); for ( i = 0; i < Player_ship->weapons.num_secondary_banks; i++ ) { GET_DATA(val); Player_ship->weapons.secondary_bank_ammo[i] = val; diff --git a/src/network/multi_kick.cpp b/src/network/multi_kick.cpp index 669ef12..4c611d4 100644 --- a/src/network/multi_kick.cpp +++ b/src/network/multi_kick.cpp @@ -257,7 +257,7 @@ void multi_dcf_kick() player_num = -1; for(idx=0;idxcallsign,Dc_arg)==0)){ + if(MULTI_CONNECTED(Net_players[idx]) && (SDL_strcasecmp(Net_players[idx].player->callsign,Dc_arg)==0)){ player_num = idx; break; } @@ -350,7 +350,7 @@ void process_player_kick_packet(ubyte *data, header *hinfo) PACKET_SET_SIZE(); // only the server should ever receive a request to kick a guy - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // determine who sent the packet from_player = find_player_id(hinfo->id); diff --git a/src/network/multi_obj.cpp b/src/network/multi_obj.cpp index 630bdfc..d2aa4cc 100644 --- a/src/network/multi_obj.cpp +++ b/src/network/multi_obj.cpp @@ -352,7 +352,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data int packet_size = 0; // make sure we have a valid ship - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); if((objp->instance >= 0) && (Ships[objp->instance].ship_info_index >= 0)){ shipp = &Ships[objp->instance]; sip = &Ship_info[shipp->ship_info_index]; @@ -373,12 +373,12 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data // if i'm the client, make sure I only send certain things if(!MULTIPLAYER_MASTER){ - Assert(oo_flags & (OO_POS_NEW | OO_ORIENT_NEW)); - Assert(!(oo_flags & (OO_HULL_NEW | OO_SUBSYSTEMS_AND_AI_NEW))); + SDL_assert(oo_flags & (OO_POS_NEW | OO_ORIENT_NEW)); + SDL_assert(!(oo_flags & (OO_HULL_NEW | OO_SUBSYSTEMS_AND_AI_NEW))); } // server else { - // Assert(oo_flags & OO_POS_NEW); + // SDL_assert(oo_flags & OO_POS_NEW); } // header sizes @@ -411,7 +411,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data // orientation if(oo_flags & OO_ORIENT_NEW){ ret = (ubyte)multi_pack_unpack_orient( 1, data + packet_size + header_bytes, &objp->orient ); - // Assert(ret == OO_ORIENT_RET_SIZE); + // SDL_assert(ret == OO_ORIENT_RET_SIZE); packet_size += ret; multi_rate_add(NET_PLAYER_NUM(pl), "ori", ret); @@ -424,7 +424,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data // forward thrust percent = (char)(objp->phys_info.forward_thrust * 100.0f); - Assert( percent <= 100 ); + SDL_assert( percent <= 100 ); memcpy(data + packet_size + header_bytes, &percent, sizeof(char)); packet_size += 1; @@ -548,7 +548,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data } // make sure we have a valid chunk of data - Assert(packet_size < 255); + SDL_assert(packet_size < 255); if(packet_size >= 255){ return 0; } @@ -809,7 +809,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data) // forward thrust percent = (char)(pobjp->phys_info.forward_thrust * 100.0f); - Assert( percent <= 100 ); + SDL_assert( percent <= 100 ); GET_DATA(percent); // now stuff all this new info @@ -890,7 +890,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data) // add the value just generated (it was zero'ed above) into the array of generic system types subsys_type = subsysp->system_info->type; // this is the generic type of subsystem - Assert ( subsys_type < SUBSYSTEM_MAX ); + SDL_assert ( subsys_type < SUBSYSTEM_MAX ); shipp->subsys_info[subsys_type].current_hits += val; subsys_count++; @@ -1798,7 +1798,7 @@ int multi_oo_is_interp_object(object *objp) void multi_oo_interp(object *objp) { // make sure its a valid ship - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); if(objp->type != OBJ_SHIP){ return; } @@ -1810,7 +1810,7 @@ void multi_oo_interp(object *objp) oo_arrive_time_next[objp->instance] += flFrametime; // do stream weapon firing for this ship - Assert(objp != Player_obj); + SDL_assert(objp != Player_obj); if(objp != Player_obj){ ship_fire_primary(objp, 1, 0); } diff --git a/src/network/multi_observer.cpp b/src/network/multi_observer.cpp index 6ddbe08..ad6336a 100644 --- a/src/network/multi_observer.cpp +++ b/src/network/multi_observer.cpp @@ -191,7 +191,7 @@ void multi_obs_create_observer(net_player *pl) // create the basic observer object objnum = observer_create( &vmd_identity_matrix, &vmd_zero_vector); - Assert(objnum != -1); + SDL_assert(objnum != -1); Objects[objnum].flags |= OF_PLAYER_SHIP; Objects[objnum].net_signature = 0; @@ -210,7 +210,7 @@ void multi_obs_create_observer_client() { int pobj_num; - Assert(!(Net_player->flags & NETINFO_FLAG_OBS_PLAYER)); + SDL_assert(!(Net_player->flags & NETINFO_FLAG_OBS_PLAYER)); // make me an observer object multi_obs_create_observer(Net_player); @@ -220,7 +220,7 @@ void multi_obs_create_observer_client() // create the default player ship object and use that as my default virtual "ship", and make it "invisible" pobj_num = parse_create_object(&Player_start_pobject); - Assert(pobj_num != -1); + SDL_assert(pobj_num != -1); obj_set_flags(&Objects[pobj_num],OF_PLAYER_SHIP); Player_ship = &Ships[Objects[pobj_num].instance]; diff --git a/src/network/multi_oo.cpp b/src/network/multi_oo.cpp index 8f8f210..a7da9a4 100644 --- a/src/network/multi_oo.cpp +++ b/src/network/multi_oo.cpp @@ -421,7 +421,7 @@ void multi_oo_interpolate(object *objp, interp_info *current, interp_info *last) objp->phys_info.desired_vel = current->desired_vel; objp->phys_info.desired_rotvel = current->desired_rotvel; -// if ( !stricmp( Ships[objp->instance].ship_name, "alpha 1")) { +// if ( !SDL_strcasecmp( Ships[objp->instance].ship_name, "alpha 1")) { // mprintf(( "Rotvel = %.3f, %.3f, %.3f\n", current->rotvel.x, current->rotvel.y, current->rotvel.z )); // } @@ -654,11 +654,11 @@ int multi_oo_pack_client_data(ubyte *data) // client eye information ret = (ubyte)multi_pack_unpack_position( 1, data + packet_size, &Net_player->s_info.eye_pos ); - Assert(ret == OO_POS_RET_SIZE); + SDL_assert(ret == OO_POS_RET_SIZE); packet_size += ret; ret = (ubyte)multi_pack_unpack_orient( 1, data + packet_size, &Net_player->s_info.eye_orient ); - Assert(ret == OO_ORIENT_RET_SIZE); + SDL_assert(ret == OO_ORIENT_RET_SIZE); packet_size += ret; // client targeting information @@ -716,7 +716,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data header_bytes = 2; } - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); if((objp->instance >= 0) && (Ships[objp->instance].ship_info_index >= 0)){ shipp = &Ships[objp->instance]; } else { @@ -731,7 +731,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data // orientation if(oo_flags & OO_ORIENT_NEW){ ret = (ubyte)multi_pack_unpack_orient( 1, data + packet_size + header_bytes, &objp->orient ); - Assert(ret == OO_ORIENT_RET_SIZE); + SDL_assert(ret == OO_ORIENT_RET_SIZE); packet_size += ret; R_ORIENT_ADD(pl, ret); @@ -784,7 +784,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data // forward thrust percent = (char)(objp->phys_info.forward_thrust * 100.0f); - Assert( percent <= 100 ); + SDL_assert( percent <= 100 ); memcpy(data + packet_size + header_bytes, &percent, sizeof(char)); packet_size += 1; @@ -877,7 +877,7 @@ int multi_oo_pack_data(net_player *pl, object *objp, ubyte oo_flags, ubyte *data R_AI_MODE_ADD(pl, 5); } - Assert(packet_size < 255); + SDL_assert(packet_size < 255); data_size = (ubyte)packet_size; // add the object's net signature, type and oo_flags @@ -956,11 +956,11 @@ int multi_oo_unpack_client_data(net_player *pl, ubyte *data) memset(&pi,0,sizeof(physics_info)); ret = multi_pack_unpack_position( 0, data + offset, &eye_pos ); - Assert(ret == OO_POS_RET_SIZE); + SDL_assert(ret == OO_POS_RET_SIZE); offset += ret; ret = multi_pack_unpack_orient( 0, data + offset, &eye_orient ); - Assert(ret == OO_ORIENT_RET_SIZE); + SDL_assert(ret == OO_ORIENT_RET_SIZE); offset += ret; // if we have a valid player, copy the info in @@ -1076,15 +1076,15 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data, ushort packet_sequence_num // orientation if ( oo_flags & OO_ORIENT_NEW ) { int r2 = multi_pack_unpack_orient( 0, data + offset, &objp->orient ); - Assert(fl_abs(objp->orient.fvec.x) < 10000.0f); - Assert(fl_abs(objp->orient.fvec.y) < 10000.0f); - Assert(fl_abs(objp->orient.fvec.z) < 10000.0f); - Assert(fl_abs(objp->orient.uvec.x) < 10000.0f); - Assert(fl_abs(objp->orient.uvec.y) < 10000.0f); - Assert(fl_abs(objp->orient.uvec.z) < 10000.0f); - Assert(fl_abs(objp->orient.rvec.x) < 10000.0f); - Assert(fl_abs(objp->orient.rvec.y) < 10000.0f); - Assert(fl_abs(objp->orient.rvec.z) < 10000.0f); + SDL_assert(fl_abs(objp->orient.fvec.x) < 10000.0f); + SDL_assert(fl_abs(objp->orient.fvec.y) < 10000.0f); + SDL_assert(fl_abs(objp->orient.fvec.z) < 10000.0f); + SDL_assert(fl_abs(objp->orient.uvec.x) < 10000.0f); + SDL_assert(fl_abs(objp->orient.uvec.y) < 10000.0f); + SDL_assert(fl_abs(objp->orient.uvec.z) < 10000.0f); + SDL_assert(fl_abs(objp->orient.rvec.x) < 10000.0f); + SDL_assert(fl_abs(objp->orient.rvec.y) < 10000.0f); + SDL_assert(fl_abs(objp->orient.rvec.z) < 10000.0f); offset += r2; int r5 = multi_pack_unpack_rotvel( 0, data + offset, &objp->orient, &objp->pos, &objp->phys_info ); @@ -1114,7 +1114,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data, ushort packet_sequence_num // forward thrust percent = (char)(objp->phys_info.forward_thrust * 100.0f); - Assert( percent <= 100 ); + SDL_assert( percent <= 100 ); GET_DATA(percent); // hull info @@ -1176,7 +1176,7 @@ int multi_oo_unpack_data(net_player *pl, ubyte *data, ushort packet_sequence_num // add the value just generated (it was zero'ed above) into the array of generic system types subsys_type = subsysp->system_info->type; // this is the generic type of subsystem - Assert ( subsys_type < SUBSYSTEM_MAX ); + SDL_assert ( subsys_type < SUBSYSTEM_MAX ); shipp->subsys_info[subsys_type].current_hits += val; subsys_count++; @@ -1335,7 +1335,7 @@ int multi_oo_maybe_update(net_player *pl,object *pobj,object *obj,ubyte *data) } /* - if(!stricmp(Ships[obj->instance].ship_name, "alpha 1")){ + if(!SDL_strcasecmp(Ships[obj->instance].ship_name, "alpha 1")){ if(in_cone){ nprintf(("Network","In cone\n")); } else { @@ -1691,7 +1691,7 @@ void multi_oo_send_update_sync(net_player *pl) ubyte data[20]; int packet_size = 0; - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // build the header and add the data BUILD_HEADER(OBJ_UPDATE_SYNC); diff --git a/src/network/multi_options.cpp b/src/network/multi_options.cpp index 84f1cc7..98e853b 100644 --- a/src/network/multi_options.cpp +++ b/src/network/multi_options.cpp @@ -235,7 +235,7 @@ ushort Multi_options_proxy_port = 0; // load in the config file #define NEXT_TOKEN() do { tok = strtok(NULL, "\n"); if(tok != NULL){ drop_leading_white_space(tok); drop_trailing_white_space(tok); } } while(0); -#define SETTING(s) ( !stricmp(tok, s) ) +#define SETTING(s) ( !SDL_strcasecmp(tok, s) ) void multi_options_read_config() { CFILE *in; @@ -525,7 +525,7 @@ void multi_options_update_netgame() ubyte data[MAX_PACKET_SIZE],code; int packet_size = 0; - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); // build the header and add the opcode BUILD_HEADER(OPTIONS_UPDATE); @@ -581,7 +581,7 @@ void multi_options_update_start_game(netgame_info *ng) int packet_size = 0; // should be a host on a standalone - Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); + SDL_assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); // build the header BUILD_HEADER(OPTIONS_UPDATE); @@ -615,7 +615,7 @@ void multi_options_update_mission(netgame_info *ng, int campaign_mode) int packet_size = 0; // should be a host on a standalone - Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); + SDL_assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); // build the header BUILD_HEADER(OPTIONS_UPDATE); @@ -663,7 +663,7 @@ void multi_options_process_packet(unsigned char *data, header *hinfo) switch(code){ // get the start game options case MULTI_OPTION_START_GAME: - Assert(Game_mode & GM_STANDALONE_SERVER); + SDL_assert(Game_mode & GM_STANDALONE_SERVER); // get the netgame name GET_STRING(Netgame.name); @@ -698,7 +698,7 @@ void multi_options_process_packet(unsigned char *data, header *hinfo) memset(&ng,0,sizeof(netgame_info)); - Assert(Game_mode & GM_STANDALONE_SERVER); + SDL_assert(Game_mode & GM_STANDALONE_SERVER); // coop or team vs. team mode GET_INT(ng.type_flags); diff --git a/src/network/multi_pause.cpp b/src/network/multi_pause.cpp index 79c229c..e02f107 100644 --- a/src/network/multi_pause.cpp +++ b/src/network/multi_pause.cpp @@ -102,7 +102,7 @@ * midgame. * * 3 4/16/98 1:55p Dave - * Removed unneeded Assert when processing chat packets. Fixed standalone + * Removed unneeded SDL_assert when processing chat packets. Fixed standalone * sequencing bugs. Laid groundwork for join screen server status * icons/text. * @@ -243,7 +243,7 @@ void multi_pause_pause() } // sanity check - Assert(!Multi_pause_status); + SDL_assert(!Multi_pause_status); // mark the game as being paused Multi_pause_status = 1; @@ -278,7 +278,7 @@ void multi_pause_unpause() } // sanity check - Assert(Multi_pause_status); + SDL_assert(Multi_pause_status); // mark the game as being unpaused Multi_pause_status = 0; @@ -486,7 +486,7 @@ void multi_pause_do() } // standalone pretty much does nothing here else { - Sleep(1); + SDL_Delay(1); } } diff --git a/src/network/multi_pinfo.cpp b/src/network/multi_pinfo.cpp index 606d898..de4415c 100644 --- a/src/network/multi_pinfo.cpp +++ b/src/network/multi_pinfo.cpp @@ -329,7 +329,7 @@ void multi_pinfo_popup(net_player *np) } // set the player for informational purposes - Assert(np != NULL); + SDL_assert(np != NULL); // play the popup appear sound gamesnd_play_iface(SND_POPUP_APPEAR); @@ -500,7 +500,7 @@ void multi_pinfo_popup_do() game_do_state_common(gameseq_get_state()); // draw the background bitmap and the ui window over it - Assert(Multi_pinfo_screen_save != -1); + SDL_assert(Multi_pinfo_screen_save != -1); gr_reset_clip(); gr_restore_screen(Multi_pinfo_screen_save); diff --git a/src/network/multi_pmsg.cpp b/src/network/multi_pmsg.cpp index ac5df6b..6366aa5 100644 --- a/src/network/multi_pmsg.cpp +++ b/src/network/multi_pmsg.cpp @@ -515,7 +515,7 @@ int multi_msg_check_command(char *str) // go through all existing commands and see what we can do for(idx=0;idxs_info.rate_stamp = timestamp( (int)(1000.0f / (float)OO_gran) ); } - Assert( pl != NULL ); - Assert( pobjp ); // we have a player, and we should have a record of it. + SDL_assert( pl != NULL ); + SDL_assert( pobjp ); // we have a player, and we should have a record of it. // mark the player as in the state of respawning if( (pobjp->respawn_count < Netgame.respawn) || (Netgame.type_flags & NG_TYPE_DOGFIGHT) ){ @@ -325,7 +325,7 @@ void multi_respawn_player_leave(net_player *pl) void multi_respawn_normal() { // make sure we should be respawning and _not_ as an observer - Assert((Net_player->flags & NETINFO_FLAG_RESPAWNING) && !(Net_player->flags & NETINFO_FLAG_LIMBO)); + SDL_assert((Net_player->flags & NETINFO_FLAG_RESPAWNING) && !(Net_player->flags & NETINFO_FLAG_LIMBO)); // server respawns immediately if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ @@ -340,7 +340,7 @@ void multi_respawn_normal() void multi_respawn_observer() { // make sure we should be respawning as an observer - Assert(!(Net_player->flags & NETINFO_FLAG_RESPAWNING) && (Net_player->flags & NETINFO_FLAG_LIMBO)); + SDL_assert(!(Net_player->flags & NETINFO_FLAG_RESPAWNING) && (Net_player->flags & NETINFO_FLAG_LIMBO)); // respawn as an observer multi_respawn_as_observer(); @@ -419,7 +419,7 @@ void multi_respawn_wing_stuff(ship *shipp) wing *wingp; // deal with re-adding this ship to it's wing - Assert( shipp->wingnum != -1 ); + SDL_assert( shipp->wingnum != -1 ); wingp = &Wings[shipp->wingnum]; wingp->ship_index[wingp->current_count] = SHIP_INDEX(shipp); wingp->current_count++; @@ -436,14 +436,14 @@ int multi_respawn_common_stuff(p_object *pobjp) // create the object objnum = parse_create_object(pobjp); - Assert(objnum != -1); + SDL_assert(objnum != -1); objp = &Objects[objnum]; // get the team and slot shipp = &Ships[objp->instance]; multi_ts_get_team_and_slot(shipp->ship_name, &team, &slot_index); - Assert( team != -1 ); - Assert( slot_index != -1 ); + SDL_assert( team != -1 ); + SDL_assert( slot_index != -1 ); // reset object update stuff for(idx=0; idxinstance]; @@ -538,7 +538,7 @@ void multi_respawn_player(net_player *pl, char cur_primary_bank, char cur_second shipp->flags &= ~(SF_SECONDARY_DUAL_FIRE); } - Assert( ship_ets != 0 ); // find dave or allender + SDL_assert( ship_ets != 0 ); // find dave or allender // restore the correct ets settings shipp->shield_recharge_index = ((ship_ets & 0x0f00) >> 8); @@ -655,7 +655,7 @@ void multi_respawn_send_ai_respawn( ushort net_signature ) ADD_USHORT( net_signature ); // broadcast the packet to all players - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); multi_io_send_to_all_reliable(data, packet_size); } @@ -687,7 +687,7 @@ void multi_respawn_broadcast(net_player *np) vector pos; // broadcast the packet to all players - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); signature = Objects[np->player->objnum].net_signature; pos = Objects[np->player->objnum].pos; @@ -707,7 +707,7 @@ void multi_respawn_broadcast(net_player *np) ADD_USHORT(np->s_info.ship_ets); ADD_STRING(np->p_info.p_objp->name); - Assert( np->s_info.ship_ets != 0 ); // find dave or allender + SDL_assert( np->s_info.ship_ets != 0 ); // find dave or allender multi_io_send_to_all_reliable(data, packet_size); } @@ -741,7 +741,7 @@ void multi_respawn_process_packet(ubyte *data, header *hinfo) GET_USHORT( net_sig ); pobjp = mission_parse_get_arrival_ship( net_sig ); - Assert( pobjp != NULL ); + SDL_assert( pobjp != NULL ); multi_respawn_ai( pobjp ); break; @@ -803,7 +803,7 @@ void multi_respawn_process_packet(ubyte *data, header *hinfo) // respawn him as normal else { // create his new ship, and change him from respawning to respawned - Assert(Net_players[player_index].p_info.p_objp != NULL); + SDL_assert(Net_players[player_index].p_info.p_objp != NULL); if(Net_players[player_index].p_info.p_objp != NULL){ multi_respawn_player(&Net_players[player_index], Net_players[player_index].s_info.cur_primary_bank, Net_players[player_index].s_info.cur_secondary_bank,Net_players[player_index].s_info.cur_link_status, Net_players[player_index].s_info.ship_ets, 0, Net_players[player_index].p_info.p_objp->name); } @@ -817,7 +817,7 @@ void multi_respawn_process_packet(ubyte *data, header *hinfo) // respawn the server immediately void multi_respawn_server() { - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // respawn me multi_respawn_player(Net_player, Net_player->s_info.cur_primary_bank, Net_player->s_info.cur_secondary_bank, Net_player->s_info.cur_link_status, Net_player->s_info.ship_ets, 0, Net_player->p_info.p_objp->name); @@ -983,7 +983,7 @@ void multi_respawn_place(object *new_obj, int team) } // otherwise, resort to plain respawn points else { - Assert(Multi_respawn_point_count > 0); + SDL_assert(Multi_respawn_point_count > 0); // get the next appropriate respawn point by team lookup = 0; @@ -1017,8 +1017,8 @@ void multi_respawn_place(object *new_obj, int team) // don't check the new_obj itself!! if(Objects[moveup->objnum].net_signature != new_obj->net_signature){ hit_check = &Objects[moveup->objnum]; - Assert(hit_check->type == OBJ_SHIP); - Assert(hit_check->instance >= 0); + SDL_assert(hit_check->type == OBJ_SHIP); + SDL_assert(hit_check->instance >= 0); if((hit_check->type != OBJ_SHIP) || (hit_check->instance < 0)){ continue; } diff --git a/src/network/multi_team.cpp b/src/network/multi_team.cpp index 2de5a7d..f5dfd22 100644 --- a/src/network/multi_team.cpp +++ b/src/network/multi_team.cpp @@ -289,7 +289,7 @@ void multi_team_reset() void multi_team_set_captain(net_player *pl,int set) { // only the host should ever get here! - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // set the player flags as being a captain and notify everyone else of this if(set){ @@ -589,7 +589,7 @@ void multi_team_handle_join(net_player *pl) } // only the host should ever do this - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); if(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)){ return; } @@ -660,7 +660,7 @@ void multi_team_mark_ship(ship *sp) // look through team 0 for(idx=0;idx<4;idx++){ - if(!stricmp(sp->ship_name,Multi_team0_names[idx])){ + if(!SDL_strcasecmp(sp->ship_name,Multi_team0_names[idx])){ team_num = 0; break; } @@ -669,7 +669,7 @@ void multi_team_mark_ship(ship *sp) // look through team 1 if necessary if(team_num < 0){ for(idx=0;idx<4;idx++){ - if(!stricmp(sp->ship_name,Multi_team1_names[idx])){ + if(!SDL_strcasecmp(sp->ship_name,Multi_team1_names[idx])){ team_num = 1; break; } @@ -789,7 +789,7 @@ void multi_team_process_packet(unsigned char *data, header *hinfo) ushort player_id; int req_index,req_team; - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // get the packet data GET_USHORT(player_id); @@ -904,7 +904,7 @@ int multi_team_process_team_update(ubyte *data) int offset = 0; // if I'm the server, bail - Assert(!MULTIPLAYER_MASTER); + SDL_assert(!MULTIPLAYER_MASTER); // process all players GET_DATA(stop); @@ -970,10 +970,10 @@ void multi_team_verify() // if the team has members if(team0_count > 0){ // make sure it also has a captain - Assert(team0_cap > 0); + SDL_assert(team0_cap > 0); // make sure it only has 1 captain - Assert(team0_cap == 1); + SDL_assert(team0_cap == 1); } // determine how many players we have on team 1 and if they have a captain @@ -995,10 +995,10 @@ void multi_team_verify() // if the team has members if(team1_count > 0){ // make sure it also has a captain - Assert(team1_cap > 0); + SDL_assert(team1_cap > 0); // make sure it only has 1 captain - Assert(team1_cap == 1); + SDL_assert(team1_cap == 1); } #endif } diff --git a/src/network/multi_voice.cpp b/src/network/multi_voice.cpp index 0e341e7..a1083f1 100644 --- a/src/network/multi_voice.cpp +++ b/src/network/multi_voice.cpp @@ -625,7 +625,7 @@ void multi_voice_reset() nprintf(("Network","MULTI VOICE : Resetting\n")); #endif - Assert(Multi_voice_inited); + SDL_assert(Multi_voice_inited); // if we're the standalone server, we can't record _or_ playback, but we can still route data and manage tokens if(Game_mode & GM_STANDALONE_SERVER){ @@ -802,7 +802,7 @@ void multi_voice_server_process() default : // if the token timestamp has elapsed, take the token back if((Multi_voice_stream[idx].token_stamp != -1) && timestamp_elapsed(Multi_voice_stream[idx].token_stamp)){ - Assert(Multi_voice_stream[idx].token_status != MULTI_VOICE_TOKEN_INDEX_FREE); + SDL_assert(Multi_voice_stream[idx].token_status != MULTI_VOICE_TOKEN_INDEX_FREE); multi_voice_take_token(idx); } break; @@ -986,7 +986,7 @@ void multi_voice_give_token(int stream_index,int player_index) int packet_size = 0; // only the server should ever be here - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // set this player as having the token Multi_voice_stream[stream_index].token_status = player_index; @@ -1031,7 +1031,7 @@ void multi_voice_take_token(int stream_index) int packet_size = 0; // only the server should ever be here - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // if the index is -1, the token has probably been released to us "officially" already if((Multi_voice_stream[stream_index].token_status == (int)MULTI_VOICE_TOKEN_INDEX_FREE) || (Multi_voice_stream[stream_index].token_status == (int)MULTI_VOICE_TOKEN_INDEX_RELEASED)){ @@ -1070,7 +1070,7 @@ void multi_voice_deny_token(int player_index) int packet_size = 0; // only the server should ever be here - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // if i'm denying myself, set the denied timestamp @@ -1282,7 +1282,7 @@ void multi_voice_player_send_stream() double d_gain; // we'd better not ever get here as we can't record voice - Assert(Multi_voice_can_record); + SDL_assert(Multi_voice_can_record); // get the data rtvoice_get_data((unsigned char**)&Multi_voice_record_buffer,&sound_size,&uncompressed_size,&d_gain); @@ -1329,7 +1329,7 @@ void multi_voice_player_send_stream() // add the current stream id# ADD_DATA(Multi_voice_stream_id); - Assert(uncompressed_size < MULTI_VOICE_MAX_BUFFER_SIZE); + SDL_assert(uncompressed_size < MULTI_VOICE_MAX_BUFFER_SIZE); uc_size = (ushort)uncompressed_size; ADD_USHORT(uc_size); @@ -1452,7 +1452,7 @@ int multi_voice_process_data(ubyte *data, int player_index,int msg_mode,net_play // increment the current stream id# void multi_voice_inc_stream_id() { - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); if(Multi_voice_next_stream_id == 0xff){ Multi_voice_next_stream_id = 0; @@ -1534,7 +1534,7 @@ void multi_voice_route_data(ubyte *data, int packet_size,int player_index,int mo break; case MULTI_MSG_TARGET: - Assert(target != NULL); + SDL_assert(target != NULL); if(!(target->p_info.options.flags & MLO_FLAG_NO_VOICE)){ multi_io_send(target, data, packet_size); } @@ -1696,7 +1696,7 @@ void multi_voice_process_next_chunk() voice_stream *str; // we'd better not ever get here is we can't record voice - Assert(Multi_voice_can_record); + SDL_assert(Multi_voice_can_record); // get the data rtvoice_get_data((unsigned char**)&Multi_voice_record_buffer,&sound_size,&uncompressed_size,&d_gain); @@ -1924,7 +1924,7 @@ void multi_voice_process_packet(ubyte *data, header *hinfo) // a player has set prefs for himself case MV_CODE_PLAYER_PREFS: - Assert(player_index != -1); + SDL_assert(player_index != -1); offset += multi_voice_process_player_prefs(data+offset,player_index); break; @@ -1939,7 +1939,7 @@ void multi_voice_process_packet(ubyte *data, header *hinfo) if(msg_mode == MULTI_MSG_TARGET){ GET_USHORT(target_sig); target_index = multi_find_player_by_net_signature(target_sig); - Assert(target_index != -1); + SDL_assert(target_index != -1); } offset += multi_voice_process_data(data+offset,player_index,msg_mode,(target_index == -1) ? NULL : &Net_players[target_index]); @@ -1961,7 +1961,7 @@ void multi_voice_process_packet(ubyte *data, header *hinfo) if(msg_mode == MULTI_MSG_TARGET){ GET_USHORT(target_sig); target_index = multi_find_player_by_net_signature(target_sig); - Assert(target_index != -1); + SDL_assert(target_index != -1); } offset += multi_voice_process_data_dummy(data+offset); @@ -2044,7 +2044,7 @@ void multi_voice_client_send_pending() // add the routing data and any necessary targeting information ADD_DATA(msg_mode); if(msg_mode == MULTI_MSG_TARGET){ - Assert(Game_mode & GM_IN_MISSION); + SDL_assert(Game_mode & GM_IN_MISSION); ADD_USHORT(Objects[Net_players[target_index].player->objnum].net_signature); } @@ -2054,7 +2054,7 @@ void multi_voice_client_send_pending() // add the current stream id# ADD_DATA(Multi_voice_stream_id); - //Assert(str->accum_buffer_usize[sent] < MULTI_VOICE_MAX_BUFFER_SIZE); // always true + //SDL_assert(str->accum_buffer_usize[sent] < MULTI_VOICE_MAX_BUFFER_SIZE); // always true uc_size = (ushort)str->accum_buffer_usize[sent]; ADD_USHORT(uc_size); @@ -2136,7 +2136,7 @@ void multi_voice_alg_play_window(int stream_index) // mix in the SND_CUE_VOICE and the SND_END_VOICE game sounds buffer_offset = multi_voice_mix(MULTI_VOICE_POST_SOUND,Multi_voice_playback_buffer,buffer_offset,MULTI_VOICE_MAX_BUFFER_SIZE); - Assert(Multi_voice_stream[stream_index].stream_rtvoice_handle != -1); + SDL_assert(Multi_voice_stream[stream_index].stream_rtvoice_handle != -1); // kill any previously playing sounds rtvoice_stop_playback(Multi_voice_stream[stream_index].stream_rtvoice_handle); @@ -2342,8 +2342,8 @@ void multi_voice_test_process() int multi_voice_test_get_playback_buffer() { // return voice stream 0 - Assert(Multi_voice_stream[0].stream_snd_handle == -1); - Assert(Multi_voice_stream[0].stream_rtvoice_handle != -1); + SDL_assert(Multi_voice_stream[0].stream_snd_handle == -1); + SDL_assert(Multi_voice_stream[0].stream_rtvoice_handle != -1); return Multi_voice_stream[0].stream_rtvoice_handle; } diff --git a/src/network/multi_xfer.cpp b/src/network/multi_xfer.cpp index 42670c1..6a443b8 100644 --- a/src/network/multi_xfer.cpp +++ b/src/network/multi_xfer.cpp @@ -592,7 +592,7 @@ void multi_xfer_unlock() void multi_xfer_force_dir(int cf_type) { Multi_xfer_force_dir = cf_type; - Assert(Multi_xfer_force_dir > CF_TYPE_ANY); + SDL_assert(Multi_xfer_force_dir > CF_TYPE_ANY); } // forces the given xfer entry to the specified directory type (only valid when called from the recv_callback function) @@ -605,7 +605,7 @@ void multi_xfer_handle_force_dir(int handle,int cf_type) // force to go to the given directory Multi_xfer_entry[handle].force_dir = cf_type; - Assert(Multi_xfer_entry[handle].force_dir > CF_TYPE_ANY); + SDL_assert(Multi_xfer_entry[handle].force_dir > CF_TYPE_ANY); } // or the flag on a given entry @@ -645,7 +645,7 @@ int multi_xfer_lookup(char *filename) // otherwise, perform a lookup for(idx=0;idxfilename, tmp_filename); #else strcpy(xe->filename, filename); diff --git a/src/network/multilag.cpp b/src/network/multilag.cpp index 15259a2..f983d37 100644 --- a/src/network/multilag.cpp +++ b/src/network/multilag.cpp @@ -280,9 +280,9 @@ int multi_lag_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *except int ret_val; lag_buf *moveup, *item; - Assert(readfds != NULL); - Assert(writefds == NULL); - Assert(except_fds == NULL); + SDL_assert(readfds != NULL); + SDL_assert(writefds == NULL); + SDL_assert(except_fds == NULL); // clear out addresses memset(&ip_addr, 0, sizeof(SOCKADDR_IN)); @@ -313,7 +313,7 @@ int multi_lag_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *except // get a free packet buf and stuff the data item = multi_lag_get_free(); if(item){ - Assert(ret_val < 700); + SDL_assert(ret_val < 700); memcpy(item->data, t_buf, ret_val); item->data_len = ret_val; item->ip_addr = ip_addr; @@ -367,9 +367,9 @@ int multi_lag_recvfrom(uint s, char *buf, int len, int flags, struct sockaddr *f } // if this happens, it means that the multi_lag_select() returned an improper value - Assert(item); + SDL_assert(item); // stuff the data - Assert(item->data_len <= len); + SDL_assert(item->data_len <= len); memcpy(buf, item->data, item->data_len); if(Tcp_active){ memcpy(from, &item->ip_addr, sizeof(SOCKADDR_IN)); @@ -480,7 +480,7 @@ lag_buf *multi_lag_get_free() // get a free item lagp = GET_FIRST(&Lag_free_list); - Assert( lagp != &Lag_free_list ); // shouldn't have the dummy element + SDL_assert( lagp != &Lag_free_list ); // shouldn't have the dummy element // remove trailp from the free list list_remove( &Lag_free_list, lagp ); diff --git a/src/network/multimsgs.cpp b/src/network/multimsgs.cpp index 88fb68b..9a8e22c 100644 --- a/src/network/multimsgs.cpp +++ b/src/network/multimsgs.cpp @@ -744,12 +744,12 @@ void multi_io_send(net_player *pl, ubyte *data, int len) // sanity checks if(MULTIPLAYER_CLIENT){ - // Assert(pl == Net_player); + // SDL_assert(pl == Net_player); if(pl != Net_player){ return; } } else { - // Assert(pl != Net_player); + // SDL_assert(pl != Net_player); if(pl == Net_player){ return; } @@ -761,7 +761,7 @@ void multi_io_send(net_player *pl, ubyte *data, int len) pl->s_info.unreliable_buffer_size = 0; } - Assert((pl->s_info.unreliable_buffer_size + len) <= MAX_PACKET_SIZE); + SDL_assert((pl->s_info.unreliable_buffer_size + len) <= MAX_PACKET_SIZE); memcpy(pl->s_info.unreliable_buffer + pl->s_info.unreliable_buffer_size, data, len); pl->s_info.unreliable_buffer_size += len; @@ -770,7 +770,7 @@ void multi_io_send(net_player *pl, ubyte *data, int len) void multi_io_send_to_all(ubyte *data, int length, net_player *ignore) { int i; - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); // need to check for i > 1, hmmm... and connected. I don't know. for (i = 0; i < MAX_PLAYERS; i++ ) { @@ -832,12 +832,12 @@ void multi_io_send_reliable(net_player *pl, ubyte *data, int len) // sanity checks if(MULTIPLAYER_CLIENT){ - // Assert(pl == Net_player); + // SDL_assert(pl == Net_player); if(pl != Net_player){ return; } } else { - // Assert(pl != Net_player); + // SDL_assert(pl != Net_player); if(pl == Net_player){ return; } @@ -849,7 +849,7 @@ void multi_io_send_reliable(net_player *pl, ubyte *data, int len) pl->s_info.reliable_buffer_size = 0; } - Assert((pl->s_info.reliable_buffer_size + len) <= MAX_PACKET_SIZE); + SDL_assert((pl->s_info.reliable_buffer_size + len) <= MAX_PACKET_SIZE); memcpy(pl->s_info.reliable_buffer + pl->s_info.reliable_buffer_size, data, len); pl->s_info.reliable_buffer_size += len; @@ -858,7 +858,7 @@ void multi_io_send_reliable(net_player *pl, ubyte *data, int len) void multi_io_send_to_all_reliable(ubyte* data, int length, net_player *ignore) { int i; - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); // need to check for i > 1, hmmm... and connected. I don't know. for (i = 0; i < MAX_PLAYERS; i++ ) { @@ -963,11 +963,11 @@ void send_game_chat_packet(net_player *from, const char *msg, int msg_mode, net_ ADD_DATA(mode); switch(mode){ case MULTI_MSG_TARGET: - Assert(to != NULL); + SDL_assert(to != NULL); ADD_SHORT(to->player_id); break; case MULTI_MSG_EXPR: - Assert(expr != NULL); + SDL_assert(expr != NULL); ADD_STRING(expr); break; } @@ -1005,7 +1005,7 @@ void send_game_chat_packet(net_player *from, const char *msg, int msg_mode, net_ // message the player's target case MULTI_MSG_TARGET: - Assert(to != NULL); + SDL_assert(to != NULL); if(MULTI_CONNECTED((*to)) && !MULTI_STANDALONE((*to))){ multi_io_send_reliable(to, data, packet_size); } @@ -1013,7 +1013,7 @@ void send_game_chat_packet(net_player *from, const char *msg, int msg_mode, net_ // message all players who match the expression string case MULTI_MSG_EXPR: - Assert(expr != NULL); + SDL_assert(expr != NULL); for(idx=0;idx= 0); + SDL_assert(new_player_num >= 0); // setup his "reliable" socket Net_players[new_player_num].last_heard_time = timer_get_fixed_seconds(); @@ -1523,15 +1523,15 @@ void send_accept_packet(int new_player_num, int code, int ingame_join_team) } if (code & ACCEPT_OBSERVER) { - Assert(!(code & (ACCEPT_CLIENT | ACCEPT_HOST))); + SDL_assert(!(code & (ACCEPT_CLIENT | ACCEPT_HOST))); } if (code & ACCEPT_HOST) { - Assert(!(code & (ACCEPT_CLIENT | ACCEPT_OBSERVER | ACCEPT_INGAME))); + SDL_assert(!(code & (ACCEPT_CLIENT | ACCEPT_OBSERVER | ACCEPT_INGAME))); } if (code & ACCEPT_CLIENT) { - Assert(!(code & (ACCEPT_HOST | ACCEPT_OBSERVER | ACCEPT_INGAME))); + SDL_assert(!(code & (ACCEPT_HOST | ACCEPT_OBSERVER | ACCEPT_INGAME))); } // add the current skill level setting on the host @@ -1604,7 +1604,7 @@ void process_accept_player_data( ubyte *data, header *hinfo ) GET_DATA(stop); while ( stop == APD_NEXT ) { player_slot_num = multi_find_open_player_slot(); - Assert(player_slot_num != -1); + SDL_assert(player_slot_num != -1); // get the player's number GET_INT(player_num); @@ -1769,15 +1769,15 @@ void process_accept_packet(ubyte* data, header* hinfo) } if (code & ACCEPT_OBSERVER) { - Assert(!(code & (ACCEPT_CLIENT | ACCEPT_HOST))); + SDL_assert(!(code & (ACCEPT_CLIENT | ACCEPT_HOST))); } if (code & ACCEPT_HOST) { - Assert(!(code & (ACCEPT_CLIENT | ACCEPT_OBSERVER | ACCEPT_INGAME))); + SDL_assert(!(code & (ACCEPT_CLIENT | ACCEPT_OBSERVER | ACCEPT_INGAME))); } if (code & ACCEPT_CLIENT) { - Assert(!(code & (ACCEPT_HOST | ACCEPT_OBSERVER | ACCEPT_INGAME))); + SDL_assert(!(code & (ACCEPT_HOST | ACCEPT_OBSERVER | ACCEPT_INGAME))); } // fill in the netgame server address @@ -1883,8 +1883,8 @@ void send_leave_game_packet(short player_id, int kicked_reason, net_player *targ nprintf(("Network","Sending a leave game packet to all players (server)\n")); // a couple of important checks - Assert(player_id != Net_player->player_id); - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(player_id != Net_player->player_id); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // add the id of the guy to be kicked ADD_SHORT(player_id); @@ -2081,7 +2081,7 @@ void send_game_active_packet(net_addr* addr) } // add the data about the connection speed of the host machine - Assert( (Multi_connection_speed >= 0) && (Multi_connection_speed <= 4) ); + SDL_assert( (Multi_connection_speed >= 0) && (Multi_connection_speed <= 4) ); flags |= (Multi_connection_speed << AG_FLAG_CONNECTION_BIT); ADD_USHORT(flags); @@ -2178,7 +2178,7 @@ void send_netgame_update_packet(net_player *pl) send_netgame_descript_packet( &pl->p_info.addr , 1 ); } } else { - Assert( pl == NULL ); // I don't think that a host in a standalone game would get here. + SDL_assert( pl == NULL ); // I don't think that a host in a standalone game would get here. multi_io_send_reliable(Net_player, data, packet_size); } @@ -2194,8 +2194,8 @@ void process_netgame_update_packet( ubyte *data, header *hinfo ) int offset,old_flags; int ng_state; - Assert(!(Game_mode & GM_STANDALONE_SERVER)); - Assert(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)); + SDL_assert(!(Game_mode & GM_STANDALONE_SERVER)); + SDL_assert(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)); // read in the netgame information offset = HEADER_LENGTH; @@ -2307,7 +2307,7 @@ void send_netgame_descript_packet(net_addr *addr, int code) } } - Assert(addr != NULL); + SDL_assert(addr != NULL); if(addr != NULL){ psnet_send(addr, data, packet_size); } @@ -2496,7 +2496,7 @@ void send_netplayer_update_packet( net_player *pl ) ADD_DATA(val); // send the packet to the server - Assert( pl == NULL ); // shouldn't ever be the case that pl is non-null here. + SDL_assert( pl == NULL ); // shouldn't ever be the case that pl is non-null here. if(!(Game_mode & GM_IN_MISSION)){ multi_io_send_reliable(Net_player, data, packet_size); } else { @@ -2592,7 +2592,7 @@ void send_ship_kill_packet( object *objp, object *other_objp, float percent_kill polymodel * pm; // only sendable from the master - Assert ( Net_player->flags & NETINFO_FLAG_AM_MASTER ); + SDL_assert ( Net_player->flags & NETINFO_FLAG_AM_MASTER ); // special deaths vaporized = ( (Ships[objp->instance].flags & SF_VAPORIZE) > 0 ); @@ -2647,15 +2647,15 @@ void send_ship_kill_packet( object *objp, object *other_objp, float percent_kill was_player = 1; ADD_DATA( was_player ); - Assert(Net_players[pnum].player->killer_objtype < CHAR_MAX); + SDL_assert(Net_players[pnum].player->killer_objtype < CHAR_MAX); temp = (char)Net_players[pnum].player->killer_objtype; ADD_DATA( temp ); - Assert(Net_players[pnum].player->killer_species < CHAR_MAX); + SDL_assert(Net_players[pnum].player->killer_species < CHAR_MAX); temp = (char)Net_players[pnum].player->killer_species; ADD_DATA( temp ); - Assert(Net_players[pnum].player->killer_weapon_index < CHAR_MAX); + SDL_assert(Net_players[pnum].player->killer_weapon_index < CHAR_MAX); temp = (char)Net_players[pnum].player->killer_weapon_index; ADD_DATA( temp ); @@ -2788,7 +2788,7 @@ void process_ship_create_packet( ubyte *data, header *hinfo ) p_object *objp; vector pos = ZERO_VECTOR; - Assert ( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); + SDL_assert ( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); offset = HEADER_LENGTH; GET_USHORT(signature); GET_INT( is_support ); @@ -2807,14 +2807,14 @@ void process_ship_create_packet( ubyte *data, header *hinfo ) nprintf(("Network", "Ship with sig %d not found on ship arrival list -- not creating!!\n", signature)); } } else { - Assert( Arriving_support_ship ); + SDL_assert( Arriving_support_ship ); if(Arriving_support_ship == NULL){ return; } Arriving_support_ship->pos = pos; Arriving_support_ship->net_signature = signature; objnum = parse_create_object( Arriving_support_ship ); - Assert( objnum != -1 ); + SDL_assert( objnum != -1 ); if(objnum < 0){ mission_parse_support_arrived( objnum ); } @@ -2963,7 +2963,7 @@ void process_cargo_revealed_packet( ubyte *data, header *hinfo ) return; } - // Assert( objp->type == OBJ_SHIP ); + // SDL_assert( objp->type == OBJ_SHIP ); if((objp->type != OBJ_SHIP) || (objp->instance < 0) || (objp->instance >= MAX_SHIPS)){ return; } @@ -2992,7 +2992,7 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting char t_subsys; ai_info *aip; - // Assert ( starting_count < UCHAR_MAX ); + // SDL_assert ( starting_count < UCHAR_MAX ); // get the object for this ship. If it is an AI object, send all the info to all player. Otherwise, // we might send the info to the other player different than the one who fired @@ -3006,7 +3006,7 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting aip = &Ai_info[shipp->ai_index]; current_bank = (ubyte)shipp->weapons.current_secondary_bank; - //Assert( (current_bank >= 0) && (current_bank < MAX_SECONDARY_BANKS) ); // always true + //SDL_assert( (current_bank >= 0) && (current_bank < MAX_SECONDARY_BANKS) ); // always true // build up the header portion BUILD_HEADER( SECONDARY_FIRED_AI ); @@ -3042,12 +3042,12 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting int s_index; s_index = ship_get_index_from_subsys( aip->targeted_subsys, aip->target_objnum ); - Assert( s_index < CHAR_MAX ); // better be less than this!!!! + SDL_assert( s_index < CHAR_MAX ); // better be less than this!!!! t_subsys = (char)s_index; } if ( Objects[aip->target_objnum].type == OBJ_WEAPON ) { - Assert(Weapon_info[Weapons[Objects[aip->target_objnum].instance].weapon_info_index].wi_flags & WIF_BOMB); + SDL_assert(Weapon_info[Weapons[Objects[aip->target_objnum].instance].weapon_info_index].wi_flags & WIF_BOMB); } } @@ -3154,7 +3154,7 @@ void process_secondary_fired_packet(ubyte* data, header* hinfo, int from_player) } // determine whether current target is locked - Assert( shipp->ai_index != -1 ); + SDL_assert( shipp->ai_index != -1 ); aip = &Ai_info[shipp->ai_index]; if ( sinfo & SFPF_TARGET_LOCKED ) { aip->current_target_is_locked = 1; @@ -3164,7 +3164,7 @@ void process_secondary_fired_packet(ubyte* data, header* hinfo, int from_player) // find out the current bank current_bank = (ubyte)(sinfo & 0x3); - //Assert( (current_bank >= 0) && (current_bank < MAX_SECONDARY_BANKS) ); // always true + //SDL_assert( (current_bank >= 0) && (current_bank < MAX_SECONDARY_BANKS) ); // always true shipp->weapons.current_secondary_bank = current_bank; // make it so we can fire this ship's secondary bank immediately!!! @@ -3211,7 +3211,7 @@ void send_countermeasure_fired_packet( object *objp, int cmeasure_count, int ran Int3(); - Assert ( cmeasure_count < UCHAR_MAX ); + SDL_assert ( cmeasure_count < UCHAR_MAX ); BUILD_HEADER(COUNTERMEASURE_FIRED); ADD_USHORT( objp->net_signature ); ADD_INT( rand_val ); @@ -3242,7 +3242,7 @@ void process_countermeasure_fired_packet( ubyte *data, header *hinfo ) if(objp->type != OBJ_SHIP){ return; } - // Assert ( objp->type == OBJ_SHIP ); + // SDL_assert ( objp->type == OBJ_SHIP ); // make it so ship can fire right away! Ships[objp->instance].cmeasure_fire_stamp = timestamp(0); @@ -3271,14 +3271,14 @@ void send_turret_fired_packet( int ship_objnum, int subsys_index, int weapon_obj // local setup -- be sure we are actually passing a weapon!!!! objp = &Objects[weapon_objnum]; - Assert ( objp->type == OBJ_WEAPON ); + SDL_assert ( objp->type == OBJ_WEAPON ); if(Weapon_info[Weapons[objp->instance].weapon_info_index].subtype == WP_MISSILE){ has_sig = 1; } pnet_signature = Objects[ship_objnum].net_signature; - Assert( subsys_index < UCHAR_MAX ); + SDL_assert( subsys_index < UCHAR_MAX ); cindex = (ubyte)subsys_index; ssp = ship_get_indexed_subsys( &Ships[Objects[ship_objnum].instance], subsys_index, NULL ); @@ -3387,7 +3387,7 @@ void send_mission_log_packet( int num ) ushort sindex; log_entry *entry; - Assert ( (Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) ); + SDL_assert ( (Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) ); // get the data from the log entry = &log_entries[num]; @@ -3415,7 +3415,7 @@ void process_mission_log_packet( ubyte *data, header *hinfo ) char pname[NAME_LENGTH], sname[NAME_LENGTH]; fix timestamp; - Assert ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); + SDL_assert ( (Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); offset = HEADER_LENGTH; GET_DATA(type); @@ -3436,9 +3436,9 @@ void send_mission_message_packet( int id, const char *who_from, int priority, in int packet_size; ubyte data[MAX_PACKET_SIZE], up, us, utime; - Assert ( Net_player->flags & NETINFO_FLAG_AM_MASTER ); - Assert ( (priority >= 0) && (priority < UCHAR_MAX) ); - Assert ( (timing >= 0) && (timing < UCHAR_MAX) ); + SDL_assert ( Net_player->flags & NETINFO_FLAG_AM_MASTER ); + SDL_assert ( (priority >= 0) && (priority < UCHAR_MAX) ); + SDL_assert ( (timing >= 0) && (timing < UCHAR_MAX) ); up = (ubyte) priority; us = (ubyte) source; @@ -3468,7 +3468,7 @@ void process_mission_message_packet( ubyte *data, header *hinfo ) char who_from[NAME_LENGTH]; int multi_team_filter; - Assert( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); + SDL_assert( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); offset = HEADER_LENGTH; GET_INT(id); @@ -3688,7 +3688,7 @@ void process_mission_item_packet(ubyte *data,header *hinfo) ubyte stop, type,max_players; uint respawn; - Assert(gameseq_get_state() == GS_STATE_MULTI_HOST_SETUP); + SDL_assert(gameseq_get_state() == GS_STATE_MULTI_HOST_SETUP); offset = HEADER_LENGTH; GET_DATA( type ); @@ -3745,7 +3745,7 @@ void send_multi_pause_packet(int pause) ubyte val; int packet_size = 0; - Assert(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)); + SDL_assert(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)); // build the header BUILD_HEADER(MULTI_PAUSE_REQUEST); @@ -3845,7 +3845,7 @@ void process_ingame_nak(ubyte *data, header *hinfo) switch(state){ case ACK_FILE_ACCEPTED : - Assert(Net_player->flags & NETINFO_FLAG_INGAME_JOIN); + SDL_assert(Net_player->flags & NETINFO_FLAG_INGAME_JOIN); nprintf(("Network","Mission file rejected by server, aborting...\n")); multi_quit_game(PROMPT_NONE, MULTI_END_NOTIFY_FILE_REJECTED); break; @@ -3863,7 +3863,7 @@ void send_endgame_packet(net_player *pl) // sending to a specific player? if(pl != NULL){ - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); multi_io_send_reliable(pl, data, packet_size); return; } @@ -3904,7 +3904,7 @@ void process_endgame_packet(ubyte *data, header *hinfo) if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ // determine who this came from and make sure he is allowed to end the game player_num = find_player_id(hinfo->id); - Assert(player_num != -1); + SDL_assert(player_num != -1); if(player_num < 0){ return; } @@ -4072,7 +4072,7 @@ void process_netplayer_slot_packet(ubyte *data, header *hinfo) // being careful not to muck with the standalone object if(!((player_num == 0) && (Game_mode & GM_STANDALONE_SERVER))){ objp = multi_get_network_object(net_sig); - Assert(objp != NULL); + SDL_assert(objp != NULL); multi_assign_player_ship( player_num, objp, ship_class ); Net_players[player_num].p_info.ship_index = ship_index; objp->flags &= ~(OF_COULD_BE_PLAYER); @@ -4133,7 +4133,7 @@ void process_ship_weapon_change( ubyte *data, header *hinfo ) nprintf(("network", "Unable to locate ship with signature %d for weapon state change\n", signature)); return; } - // Assert( objp->type == OBJ_SHIP ); + // SDL_assert( objp->type == OBJ_SHIP ); if(objp->type != OBJ_SHIP){ return; } @@ -4228,7 +4228,7 @@ void process_ship_status_packet(ubyte *data, header *hinfo) if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ // SERVER SIDE // find which net-player has sent us butotn information player_num = find_player_id(hinfo->id); - Assert(player_num >= 0); + SDL_assert(player_num >= 0); if(player_num < 0){ return; } @@ -4290,7 +4290,7 @@ void send_player_order_packet(int type, int index, int cmd) int s_index; s_index = ship_get_index_from_subsys( Player_ai->targeted_subsys, Player_ai->target_objnum ); - Assert( s_index < CHAR_MAX ); // better be less than this!!!! + SDL_assert( s_index < CHAR_MAX ); // better be less than this!!!! t_subsys = (char)s_index; } ADD_DATA(t_subsys); @@ -4313,7 +4313,7 @@ void process_player_order_packet(ubyte *data, header *hinfo) ship *shipp; ship_subsys *tsubsys_save, *targeted_subsys; - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); // packet values - its easier to read all of these in first @@ -4362,7 +4362,7 @@ void process_player_order_packet(ubyte *data, header *hinfo) // check to see if the type of order is a reinforcement call. If so, intercept it, and // then call them in. if ( type == SQUAD_MSG_REINFORCEMENT ) { - Assert( (index >= 0) && (index < Num_reinforcements) ); + SDL_assert( (index >= 0) && (index < Num_reinforcements) ); hud_squadmsg_call_reinforcement(index, player_num); return; } @@ -4379,7 +4379,7 @@ void process_player_order_packet(ubyte *data, header *hinfo) targeted_subsys = NULL; if ( t_subsys != -1 ) { - Assert( target_objp != NULL ); + SDL_assert( target_objp != NULL ); targeted_subsys = ship_get_indexed_subsys( &Ships[target_objp->instance], t_subsys); } @@ -4404,7 +4404,7 @@ void process_player_order_packet(ubyte *data, header *hinfo) hud_squadmsg_send_to_all_fighters( command, player_num ); } - Assert(tobjnum_save != Ships[aip->shipnum].objnum); // make sure not targeting self + SDL_assert(tobjnum_save != Ships[aip->shipnum].objnum); // make sure not targeting self aip->target_objnum = tobjnum_save; aip->targeted_subsys = tsubsys_save; } @@ -4436,7 +4436,7 @@ void process_file_sig_packet(ubyte *data, header *hinfo) offset = HEADER_LENGTH; // should only be received on the server-side - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); GET_USHORT(sum_sig); GET_INT(length_sig); @@ -4452,7 +4452,7 @@ void send_file_sig_request(char *file_name) BUILD_HEADER(FILE_SIG_REQUEST); ADD_STRING(file_name); - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); multi_io_send_to_all_reliable(data, packet_size); } @@ -4486,7 +4486,7 @@ void send_subsystem_destroyed_packet( ship *shipp, int index, vector world_hitpo vector tmp, local_hitpos; object *objp; - Assert ( index < UCHAR_MAX ); + SDL_assert ( index < UCHAR_MAX ); uindex = (ubyte)(index); objp = &Objects[shipp->objnum]; @@ -4525,7 +4525,7 @@ void process_subsystem_destroyed_packet( ubyte *data, header *hinfo ) ship_subsys *subsysp; // be sure we have a ship!!! - // Assert ( objp->type == OBJ_SHIP ); + // SDL_assert ( objp->type == OBJ_SHIP ); if(objp->type != OBJ_SHIP){ PACKET_SET_SIZE(); return; @@ -4554,7 +4554,7 @@ void send_subsystem_cargo_revealed_packet( ship *shipp, int index ) ubyte data[MAX_PACKET_SIZE], uindex; int packet_size; - Assert ( index < UCHAR_MAX ); + SDL_assert ( index < UCHAR_MAX ); uindex = (ubyte)(index); // build the header and add the data @@ -4594,7 +4594,7 @@ void process_subsystem_cargo_revealed_packet( ubyte *data, header *hinfo ) return; } - // Assert( objp->type == OBJ_SHIP ); + // SDL_assert( objp->type == OBJ_SHIP ); if((objp->type != OBJ_SHIP) || (objp->instance < 0) || (objp->instance >= MAX_SHIPS)){ return; } @@ -4676,7 +4676,7 @@ void send_jump_into_mission_packet(net_player *pl) ubyte data[MAX_PACKET_SIZE]; int packet_size = 0; - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); BUILD_HEADER(JUMP_INTO_GAME); @@ -4865,7 +4865,7 @@ void send_ai_info_update_packet( object *objp, char what ) ai_info *aip; ubyte dock_index, dockee_index; - // Assert( objp->type == OBJ_SHIP ); + // SDL_assert( objp->type == OBJ_SHIP ); if(objp->type != OBJ_SHIP){ return; } @@ -4885,7 +4885,7 @@ void send_ai_info_update_packet( object *objp, char what ) case AI_UPDATE_DOCK: // for docking ships, add the signature of the ship that we are docking with. - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); other_signature = Objects[aip->dock_objnum].net_signature; dock_index = (ubyte)(aip->dock_index); dockee_index = (ubyte)(aip->dockee_index); @@ -4909,7 +4909,7 @@ void send_ai_info_update_packet( object *objp, char what ) // for orders, we only need to send a little bit of information here. Be sure that the // first order for this ship is active - Assert( (aip->active_goal != AI_GOAL_NONE) && (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC) ); + SDL_assert( (aip->active_goal != AI_GOAL_NONE) && (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC) ); ADD_INT( aip->goals[0].ai_mode ); ADD_INT( aip->goals[0].ai_submode ); shipnum = -1; @@ -4919,7 +4919,7 @@ void send_ai_info_update_packet( object *objp, char what ) // the ship_name member of the goals structure may or may not contain a real shipname. If we don't // have a valid shipnum, then don't sweat it since it may not really be a ship. if ( shipnum != -1 ) { - Assert( Ships[shipnum].objnum != -1 ); + SDL_assert( Ships[shipnum].objnum != -1 ); other_signature = Objects[Ships[shipnum].objnum].net_signature; } else other_signature = 0; @@ -4928,8 +4928,8 @@ void send_ai_info_update_packet( object *objp, char what ) // for docking, add the dock and dockee index if ( aip->goals[0].ai_mode & (AI_GOAL_DOCK|AI_GOAL_REARM_REPAIR) ) { - Assert( (aip->goals[0].docker.index >= 0) && (aip->goals[0].docker.index < UCHAR_MAX) ); - Assert( (aip->goals[0].dockee.index >= 0) && (aip->goals[0].dockee.index < UCHAR_MAX) ); + SDL_assert( (aip->goals[0].docker.index >= 0) && (aip->goals[0].docker.index < UCHAR_MAX) ); + SDL_assert( (aip->goals[0].dockee.index >= 0) && (aip->goals[0].dockee.index < UCHAR_MAX) ); dock_index = (ubyte)aip->goals[0].docker.index; dockee_index = (ubyte)aip->goals[0].dockee.index; ADD_DATA( dock_index ); @@ -4978,7 +4978,7 @@ void process_ai_info_update_packet( ubyte *data, header *hinfo) break; } - Assert( other_objp->type == OBJ_SHIP ); + SDL_assert( other_objp->type == OBJ_SHIP ); Ai_info[Ships[objp->instance].ai_index].dock_index = dock_index; Ai_info[Ships[objp->instance].ai_index].dockee_index = dockee_index; @@ -5060,7 +5060,7 @@ void send_mission_sync_packet(int mode,int start_campaign) ubyte data[MAX_PACKET_SIZE],is_campaign; int packet_size = 0; - Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); + SDL_assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); // build the header and add the sync mode (pre or post briefing) BUILD_HEADER(MISSION_SYNC_DATA); @@ -5101,7 +5101,7 @@ void process_mission_sync_packet(ubyte *data, header *hinfo) ubyte campaign_flag; int offset = HEADER_LENGTH; - Assert(Game_mode & GM_STANDALONE_SERVER); + SDL_assert(Game_mode & GM_STANDALONE_SERVER); // if this is a team vs team situation, lock the players send a final team update if(Netgame.type_flags & NG_TYPE_TEAM){ @@ -5244,7 +5244,7 @@ void process_debris_update_packet(ubyte *data, header *hinfo) // simply remove it (no explosion) case DEBRIS_UPDATE_REMOVE: if(objp != &bogus_object){ - Assert(objp->type == OBJ_DEBRIS); + SDL_assert(objp->type == OBJ_DEBRIS); obj_delete(OBJ_INDEX(objp)); } break; @@ -5283,7 +5283,7 @@ void send_wss_request_packet(short player_id, int from_slot, int from_index, int } // being routed through the standalone to the host of the game else { - Assert(Game_mode & GM_STANDALONE_SERVER); + SDL_assert(Game_mode & GM_STANDALONE_SERVER); multi_io_send_reliable(p, data, packet_size); } } @@ -5312,7 +5312,7 @@ void process_wss_request_packet(ubyte *data, header *hinfo) GET_INT(mode); PACKET_SET_SIZE(); - Assert(player_num != -1); + SDL_assert(player_num != -1); if(player_num == -1){ return; } @@ -5341,7 +5341,7 @@ void send_wss_update_packet(int team_num,ubyte *wss_data,int size) ubyte data[MAX_PACKET_SIZE],team; int packet_size = 0; - Assert(size <= (MAX_PACKET_SIZE - 10)); + SDL_assert(size <= (MAX_PACKET_SIZE - 10)); BUILD_HEADER(WSS_UPDATE_PACKET); @@ -5386,7 +5386,7 @@ void process_wss_update_packet(ubyte *data, header *hinfo) // determine where this came from player_index = find_player_id(hinfo->id); - Assert(player_index != -1); + SDL_assert(player_index != -1); if(player_index < 0){ return; } @@ -5425,7 +5425,7 @@ void send_firing_info_packet() int packet_size; ubyte plinked, sdual; - Assert( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); + SDL_assert( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); BUILD_HEADER(FIRING_INFO); plinked = (ubyte)((Player_ship->flags & SF_PRIMARY_LINKED)?1:0); @@ -5443,7 +5443,7 @@ void process_firing_info_packet( ubyte *data, header *hinfo ) ship *shipp; // only the master of the game should be dealing with these packets - Assert( Net_player->flags & NETINFO_FLAG_AM_MASTER ); + SDL_assert( Net_player->flags & NETINFO_FLAG_AM_MASTER ); offset = HEADER_LENGTH; GET_DATA( plinked ); @@ -5777,14 +5777,14 @@ void send_post_sync_data_packet(net_player *p, int std_request) if(pl != NULL){ pl->s_info.cur_primary_bank = bval; } - // Assert(bval != -1); + // SDL_assert(bval != -1); ADD_DATA(bval); bval = (char)(shipp->weapons.current_secondary_bank); if(pl != NULL){ pl->s_info.cur_secondary_bank = bval; } - // Assert(bval != -1); + // SDL_assert(bval != -1); ADD_DATA(bval); // primary weapon info @@ -5935,7 +5935,7 @@ void process_post_sync_data_packet(ubyte *data, header *hinfo) objp = multi_get_network_object(net_sig); // make sure we found a ship - Assert((objp != NULL) && (objp->type == OBJ_SHIP)); + SDL_assert((objp != NULL) && (objp->type == OBJ_SHIP)); // set the ship to be the right class change_ship_type(objp->instance,(int)sinfo_index); @@ -5953,18 +5953,18 @@ void process_post_sync_data_packet(ubyte *data, header *hinfo) objp = multi_get_network_object(net_sig); // make sure we found a ship - Assert((objp != NULL) && (objp->type == OBJ_SHIP)); + SDL_assert((objp != NULL) && (objp->type == OBJ_SHIP)); // get a pointer to the ship shipp = &Ships[objp->instance]; // get number of primary and secondary banks; GET_DATA(b); - Assert( b != -1 ); + SDL_assert( b != -1 ); shipp->weapons.num_primary_banks = (int)b; GET_DATA(b); - Assert( b != -1 ); + SDL_assert( b != -1 ); shipp->weapons.num_secondary_banks = (int)b; // get bank selection info @@ -6207,9 +6207,9 @@ void send_shield_explosion_packet( int objnum, int tri_num, vector hit_pos ) ubyte data[MAX_PACKET_SIZE], utri_num; Int3(); - // Assert(!(Netgame.debug_flags & NETD_FLAG_CLIENT_NODAMAGE)); + // SDL_assert(!(Netgame.debug_flags & NETD_FLAG_CLIENT_NODAMAGE)); - Assert( tri_num < UCHAR_MAX ); + SDL_assert( tri_num < UCHAR_MAX ); utri_num = (ubyte)tri_num; // for each player, determine if this object is behind the player -- if so, don't @@ -6274,14 +6274,14 @@ void process_shield_explosion_packet( ubyte *data, header *hinfo) // given the tri num, find the local position which is the average of the // three vertices of the triangle affected. Use this average point as the hit // point - // Assert( objp->type == OBJ_SHIP ); + // SDL_assert( objp->type == OBJ_SHIP ); if(objp->type != OBJ_SHIP){ return; } pm = model_get(Ships[objp->instance].modelnum); shieldp = &pm->shield; - Assert( utri_num < shieldp->ntris ); + SDL_assert( utri_num < shieldp->ntris ); stri = shieldp->tris[utri_num]; vm_vec_zero(&hit_pos); for ( i = 0; i < 3; i++ ) { @@ -6386,7 +6386,7 @@ void send_player_stats_block_packet(net_player *pl, int stats_code, net_player * break; } - Assert(packet_size < MAX_PACKET_SIZE); + SDL_assert(packet_size < MAX_PACKET_SIZE); // if we're a client, always send the data to the server if(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)){ @@ -6521,7 +6521,7 @@ void process_player_stats_block_packet(ubyte *data, header *hinfo) // if I'm the server of the game, I should always rebroadcast these stats if ((Net_player->flags & NETINFO_FLAG_AM_MASTER) && (sc != &bogus)) { // make sure these are alltime stats - Assert(val == STATS_ALLTIME); + SDL_assert(val == STATS_ALLTIME); multi_broadcast_stats(STATS_ALLTIME); } @@ -6542,7 +6542,7 @@ void send_asteroid_create( object *new_objp, object *parent_objp, int asteroid_t BUILD_HEADER( ASTEROID_INFO ); packet_type = ASTEROID_CREATE; - Assert( asteroid_type < UCHAR_MAX ); + SDL_assert( asteroid_type < UCHAR_MAX ); atype = (ubyte)asteroid_type; ADD_DATA( packet_type ); @@ -6726,7 +6726,7 @@ void send_host_restr_packet(const char *callsign, int code, int mode) } // otherwise if I'm the host, I should be sending a reply back to the standalone server else { - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); multi_io_send_reliable(Net_player, data, packet_size); } } @@ -6747,7 +6747,7 @@ void process_host_restr_packet(ubyte *data, header *hinfo) switch(code){ // query to the host from standalone case 0: - Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); + SDL_assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER)); // set the join mode Multi_join_restr_mode = mode; @@ -6762,7 +6762,7 @@ void process_host_restr_packet(ubyte *data, header *hinfo) // affirmative reply from the host to the standalone case 1: - Assert(Game_mode & GM_STANDALONE_SERVER); + SDL_assert(Game_mode & GM_STANDALONE_SERVER); // let the player join if the timestamp has not already elapsed on the server if(Multi_restr_query_timestamp != -1){ @@ -6772,7 +6772,7 @@ void process_host_restr_packet(ubyte *data, header *hinfo) // negative reply case 2 : - Assert(Game_mode & GM_STANDALONE_SERVER); + SDL_assert(Game_mode & GM_STANDALONE_SERVER); Netgame.flags &= ~(NG_FLAG_INGAME_JOINING); Multi_restr_query_timestamp = -1; break; @@ -6786,7 +6786,7 @@ void send_netgame_end_error_packet(int notify_code,int err_code) int packet_size = 0; // only the server should ever be here - although this might change if for some reason the host wants to end the game - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); // build the header and add the notification and error codes BUILD_HEADER(NETGAME_END_ERROR); @@ -6859,14 +6859,14 @@ void send_client_update_packet(net_player *pl) val |= UPDATE_IS_PAUSED; } else if ( (Game_mode & GM_IN_MISSION) && !(pl->flags & NETINFO_FLAG_INGAME_JOIN) && !(NETPLAYER_IS_OBSERVER(pl)) && !(NETPLAYER_IS_DEAD(pl)) && (Objects[pl->player->objnum].type == OBJ_SHIP) ) { val |= UPDATE_HULL_INFO; - Assert( Player_ship ); // I"d better have one of these!!!! + SDL_assert( Player_ship ); // I"d better have one of these!!!! } ADD_DATA(val); // if paused, add the net address of the guy who paused if(val & UPDATE_IS_PAUSED){ - Assert(Multi_pause_pauser != NULL); + SDL_assert(Multi_pause_pauser != NULL); ADD_SHORT(Multi_pause_pauser->player_id); } @@ -6880,11 +6880,11 @@ void send_client_update_packet(net_player *pl) int i; // get the object for the player - Assert( pl->player->objnum != -1 ); + SDL_assert( pl->player->objnum != -1 ); objp = &Objects[pl->player->objnum]; - Assert ( objp->type == OBJ_SHIP ); + SDL_assert ( objp->type == OBJ_SHIP ); shipp = &Ships[objp->instance]; sip = &Ship_info[shipp->ship_info_index]; @@ -7035,7 +7035,7 @@ void process_client_update_packet(ubyte *data, header *hinfo) // add the value just generated (it was zero'ed above) into the array of generic system types subsys_type = subsysp->system_info->type; // this is the generic type of subsystem - Assert ( subsys_type < SUBSYSTEM_MAX ); + SDL_assert ( subsys_type < SUBSYSTEM_MAX ); shipp->subsys_info[subsys_type].current_hits += val; n_subsystems++; } @@ -7088,7 +7088,7 @@ void send_countdown_packet(int time) } // otherwise we'de better be a host sending to the standalone else { - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); multi_io_send_reliable(Net_player, data, packet_size); } } @@ -7109,7 +7109,7 @@ void process_countdown_packet(ubyte *data, header *hinfo) // if we're the standalone, this should be a -1 telling us to start the countdown if(Game_mode & GM_STANDALONE_SERVER){ - Assert((int)time == -1); + SDL_assert((int)time == -1); // start the countdown multi_sync_start_countdown(); @@ -7167,7 +7167,7 @@ void process_debrief_info( ubyte *data, header *hinfo ) // now that we have the stage data for the debriefing stages, call debrief function with the // data so that clients can now see the debriefing stuff. Do it only for my team. - Assert( (Net_player->p_info.team >= 0) && (Net_player->p_info.team < Num_teams) ); + SDL_assert( (Net_player->p_info.team >= 0) && (Net_player->p_info.team < Num_teams) ); debrief_set_multi_clients( stage_counts[Net_player->p_info.team], stages[Net_player->p_info.team] ); } @@ -7201,7 +7201,7 @@ void send_homing_weapon_info( int weapon_num ) int s_index; s_index = ship_get_index_from_subsys( wp->homing_subsys, OBJ_INDEX(homing_object), 1 ); - Assert( s_index < CHAR_MAX ); // better be less than this!!!! + SDL_assert( s_index < CHAR_MAX ); // better be less than this!!!! t_subsys = (char)s_index; } } @@ -7238,7 +7238,7 @@ void process_homing_weapon_info( ubyte *data, header *hinfo ) nprintf(("Network", "Couldn't find weapon object for homing update -- skipping update\n")); return; } - Assert( weapon_objp->type == OBJ_WEAPON ); + SDL_assert( weapon_objp->type == OBJ_WEAPON ); wp = &Weapons[weapon_objp->instance]; // be sure that we can find these weapons and @@ -7249,7 +7249,7 @@ void process_homing_weapon_info( ubyte *data, header *hinfo ) } if ( homing_object->type == OBJ_WEAPON ) { - Assert(Weapon_info[Weapons[homing_object->instance].weapon_info_index].wi_flags & WIF_BOMB); + SDL_assert(Weapon_info[Weapons[homing_object->instance].weapon_info_index].wi_flags & WIF_BOMB); } wp->homing_object = homing_object; @@ -7257,7 +7257,7 @@ void process_homing_weapon_info( ubyte *data, header *hinfo ) wp->target_num = OBJ_INDEX(homing_object); wp->target_sig = homing_object->signature; if ( h_subsys != -1 ) { - Assert( homing_object->type == OBJ_SHIP ); + SDL_assert( homing_object->type == OBJ_SHIP ); wp->homing_subsys = ship_get_indexed_subsys( &Ships[homing_object->instance], h_subsys); } @@ -7271,7 +7271,7 @@ void send_emp_effect(ushort net_sig, float intensity, float time) ubyte data[25]; int packet_size; - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); // build the packet and add the opcode BUILD_HEADER(EMP_EFFECT); @@ -7384,7 +7384,7 @@ void send_NEW_primary_fired_packet(ship *shipp, int banks_fired) net_player *ignore = NULL; // sanity checking for now - Assert ( banks_fired <= 3 ); + SDL_assert ( banks_fired <= 3 ); // get an object pointer for this ship. objnum = shipp->objnum; @@ -7402,7 +7402,7 @@ void send_NEW_primary_fired_packet(ship *shipp, int banks_fired) // ubanks_fired = (ubyte)banks_fired; // current_bank = (ubyte)shipp->weapons.current_primary_bank; - // Assert( current_bank <= 3 ); + // SDL_assert( current_bank <= 3 ); // insert the current primary bank into this byte // ubanks_fired |= (current_bank << CURRENT_BANK_BIT); @@ -7481,7 +7481,7 @@ void process_NEW_primary_fired_packet(ubyte *data, header *hinfo) // get the current primary bank // current_bank = (ubyte)(banks_fired >> CURRENT_BANK_BIT); // current_bank &= 0x3; - // Assert( (current_bank >= 0) && (current_bank < MAX_PRIMARY_BANKS) ); + // SDL_assert( (current_bank >= 0) && (current_bank < MAX_PRIMARY_BANKS) ); // shipp->weapons.current_primary_bank = current_bank; // strip off all remaining bits and just keep which banks were actually fired. @@ -7515,7 +7515,7 @@ void send_NEW_countermeasure_fired_packet(object *objp, int cmeasure_count, int return; } - Assert ( cmeasure_count < UCHAR_MAX ); + SDL_assert ( cmeasure_count < UCHAR_MAX ); BUILD_HEADER(COUNTERMEASURE_NEW); ADD_USHORT( objp->net_signature ); ADD_INT( rand_val ); @@ -7585,37 +7585,37 @@ void send_beam_fired_packet(object *shooter, ship_subsys *turret, object *target beam_info b_info; // only the server should ever be doing this - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); // setup outgoing data - Assert(shooter != NULL); - Assert(turret != NULL); - Assert(target != NULL); - Assert(override != NULL); + SDL_assert(shooter != NULL); + SDL_assert(turret != NULL); + SDL_assert(target != NULL); + SDL_assert(override != NULL); if((shooter == NULL) || (turret == NULL) || (target == NULL) || (override == NULL)){ return; } u_beam_info = (ubyte)beam_info_index; subsys_index = (char)ship_get_index_from_subsys(turret, OBJ_INDEX(shooter)); - Assert(subsys_index >= 0); + SDL_assert(subsys_index >= 0); if(subsys_index < 0){ return; } // swap the beam_info override info into little endian byte order - b_info.dir_a.xyz.x = INTEL_FLOAT(&override->dir_a.xyz.x); - b_info.dir_a.xyz.y = INTEL_FLOAT(&override->dir_a.xyz.y); - b_info.dir_a.xyz.z = INTEL_FLOAT(&override->dir_a.xyz.z); + b_info.dir_a.xyz.x = INTEL_FLOAT(override->dir_a.xyz.x); + b_info.dir_a.xyz.y = INTEL_FLOAT(override->dir_a.xyz.y); + b_info.dir_a.xyz.z = INTEL_FLOAT(override->dir_a.xyz.z); - b_info.dir_b.xyz.x = INTEL_FLOAT(&override->dir_b.xyz.x); - b_info.dir_b.xyz.y = INTEL_FLOAT(&override->dir_b.xyz.y); - b_info.dir_b.xyz.z = INTEL_FLOAT(&override->dir_b.xyz.z); + b_info.dir_b.xyz.x = INTEL_FLOAT(override->dir_b.xyz.x); + b_info.dir_b.xyz.y = INTEL_FLOAT(override->dir_b.xyz.y); + b_info.dir_b.xyz.z = INTEL_FLOAT(override->dir_b.xyz.z); - b_info.delta_ang = INTEL_FLOAT(&override->delta_ang); + b_info.delta_ang = INTEL_FLOAT(override->delta_ang); b_info.shot_count = override->shot_count; for (int i = 0; i < b_info.shot_count; i++) { - b_info.shot_aim[i] = INTEL_FLOAT(&override->shot_aim[i]); + b_info.shot_aim[i] = INTEL_FLOAT(override->shot_aim[i]); } // build the header @@ -7640,7 +7640,7 @@ void process_beam_fired_packet(ubyte *data, header *hinfo) beam_fire_info fire_info; // only clients should ever get this - Assert(MULTIPLAYER_CLIENT); + SDL_assert(MULTIPLAYER_CLIENT); // read in packet data offset = HEADER_LENGTH; @@ -7653,16 +7653,16 @@ void process_beam_fired_packet(ubyte *data, header *hinfo) PACKET_SET_SIZE(); // swap the beam_info override info into native byte order - b_info.dir_a.xyz.x = INTEL_FLOAT( &b_info.dir_a.xyz.x ); - b_info.dir_a.xyz.y = INTEL_FLOAT( &b_info.dir_a.xyz.y ); - b_info.dir_a.xyz.z = INTEL_FLOAT( &b_info.dir_a.xyz.z ); - b_info.dir_b.xyz.x = INTEL_FLOAT( &b_info.dir_b.xyz.x ); - b_info.dir_b.xyz.y = INTEL_FLOAT( &b_info.dir_b.xyz.y ); - b_info.dir_b.xyz.z = INTEL_FLOAT( &b_info.dir_b.xyz.z ); - b_info.delta_ang = INTEL_FLOAT( &b_info.delta_ang ); + b_info.dir_a.xyz.x = INTEL_FLOAT( b_info.dir_a.xyz.x ); + b_info.dir_a.xyz.y = INTEL_FLOAT( b_info.dir_a.xyz.y ); + b_info.dir_a.xyz.z = INTEL_FLOAT( b_info.dir_a.xyz.z ); + b_info.dir_b.xyz.x = INTEL_FLOAT( b_info.dir_b.xyz.x ); + b_info.dir_b.xyz.y = INTEL_FLOAT( b_info.dir_b.xyz.y ); + b_info.dir_b.xyz.z = INTEL_FLOAT( b_info.dir_b.xyz.z ); + b_info.delta_ang = INTEL_FLOAT( b_info.delta_ang ); for (i = 0; i < MAX_BEAM_SHOTS; i++) { - b_info.shot_aim[i] = INTEL_FLOAT(&b_info.shot_aim[i]); + b_info.shot_aim[i] = INTEL_FLOAT(b_info.shot_aim[i]); } // lookup all relevant data @@ -7704,15 +7704,15 @@ void send_sw_query_packet(ubyte code, char *txt) // if I'm the host, send to standalone if(MULTIPLAYER_HOST){ - Assert(!MULTIPLAYER_MASTER); - Assert(code == SW_STD_START); + SDL_assert(!MULTIPLAYER_MASTER); + SDL_assert(code == SW_STD_START); multi_io_send_reliable(Net_player, data, packet_size); } // otherwise standalone sends back to host else { - Assert(Game_mode & GM_STANDALONE_SERVER); - Assert(code != SW_STD_START); - Assert(Netgame.host != NULL); + SDL_assert(Game_mode & GM_STANDALONE_SERVER); + SDL_assert(code != SW_STD_START); + SDL_assert(Netgame.host != NULL); if(Netgame.host != NULL){ multi_io_send_reliable(Netgame.host, data, packet_size); } @@ -7773,11 +7773,11 @@ void send_weapon_detonate_packet(object *objp) int packet_size = 0; // sanity checks - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); if(!MULTIPLAYER_MASTER){ return; } - Assert(objp != NULL); + SDL_assert(objp != NULL); if(objp == NULL){ return; } @@ -7824,10 +7824,10 @@ void send_flak_fired_packet(int ship_objnum, int subsys_index, int weapon_objnum // local setup -- be sure we are actually passing a weapon!!!! objp = &Objects[weapon_objnum]; - Assert ( objp->type == OBJ_WEAPON ); + SDL_assert ( objp->type == OBJ_WEAPON ); pnet_signature = Objects[ship_objnum].net_signature; - Assert( subsys_index < UCHAR_MAX ); + SDL_assert( subsys_index < UCHAR_MAX ); cindex = (ubyte)subsys_index; ssp = ship_get_indexed_subsys( &Ships[Objects[ship_objnum].instance], subsys_index, NULL ); @@ -7924,7 +7924,7 @@ void process_flak_fired_packet(ubyte *data, header *hinfo) } } -#define ADD_NORM_VEC(d) do { Assert((packet_size + 3) < MAX_PACKET_SIZE); char vnorm[3] = { (char)(d.x * 127.0f), (char)(d.y * 127.0f), (char)(d.z * 127.0f) }; memcpy(data + packet_size, vnorm, 3); packet_size += 3; } while(0); +#define ADD_NORM_VEC(d) do { SDL_assert((packet_size + 3) < MAX_PACKET_SIZE); char vnorm[3] = { (char)(d.x * 127.0f), (char)(d.y * 127.0f), (char)(d.z * 127.0f) }; memcpy(data + packet_size, vnorm, 3); packet_size += 3; } while(0); #define GET_NORM_VEC(d) do { char vnorm[3]; memcpy(vnorm, data+offset, 3); d.x = (float)vnorm[0] / 127.0f; d.y = (float)vnorm[1] / 127.0f; d.z = (float)vnorm[2] / 127.0f; } while(0); // player pain packet @@ -7935,11 +7935,11 @@ void send_player_pain_packet(net_player *pl, int weapon_info_index, float damage ushort udamage; int packet_size = 0; - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); if(!MULTIPLAYER_MASTER){ return; } - Assert(pl != NULL); + SDL_assert(pl != NULL); if(pl == NULL){ return; } @@ -7983,14 +7983,14 @@ void process_player_pain_packet(ubyte *data, header *hinfo) mprintf(("PAIN!\n")); // get weapon info pointer - //Assert((windex >= 0) && (windex < Num_weapon_types) && (Weapon_info[windex].subtype == WP_LASER)); // always true + //SDL_assert((windex >= 0) && (windex < Num_weapon_types) && (Weapon_info[windex].subtype == WP_LASER)); // always true if(! ((windex != 255) && (windex < Num_weapon_types) && (Weapon_info[windex].subtype == WP_LASER)) ){ return; } wip = &Weapon_info[windex]; // play the weapon hit sound - Assert(Player_obj != NULL); + SDL_assert(Player_obj != NULL); if(Player_obj == NULL){ return; } @@ -8174,7 +8174,7 @@ void send_self_destruct_packet() } // if i'm the server, I shouldn't be here - Assert(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)); + SDL_assert(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)); if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ return; } diff --git a/src/network/multiteamselect.cpp b/src/network/multiteamselect.cpp index e980a37..42239dc 100644 --- a/src/network/multiteamselect.cpp +++ b/src/network/multiteamselect.cpp @@ -1051,7 +1051,7 @@ void multi_ts_assign_players_all() multi_ts_get_team_and_slot(Ships[shipnum].ship_name,&team_index,&slot_index); multi_assign_player_ship(NET_PLAYER_INDEX(Netgame.host),&Objects[Ships[shipnum].objnum],Ships[shipnum].ship_info_index); Netgame.host->p_info.ship_index = slot_index; - Assert(Netgame.host->p_info.ship_index >= 0); + SDL_assert(Netgame.host->p_info.ship_index >= 0); Netgame.host->p_info.ship_class = Ships[shipnum].ship_info_index; Netgame.host->player->objnum = Ships[shipnum].objnum; @@ -1059,10 +1059,10 @@ void multi_ts_assign_players_all() objp = GET_FIRST(&obj_used_list); while(objp != END_OF_LIST(&obj_used_list)){ // find a valid player ship - ignoring the ship which was assigned to the host - if((objp->flags & OF_PLAYER_SHIP) && stricmp(Ships[objp->instance].ship_name,name_lookup)){ + if((objp->flags & OF_PLAYER_SHIP) && SDL_strcasecmp(Ships[objp->instance].ship_name,name_lookup)){ // determine what team and slot this ship is multi_ts_get_team_and_slot(Ships[objp->instance].ship_name,&team_index,&slot_index); - Assert((team_index != -1) && (slot_index != -1)); + SDL_assert((team_index != -1) && (slot_index != -1)); // in a team vs. team situation if(Netgame.type_flags & NG_TYPE_TEAM){ @@ -1091,7 +1091,7 @@ void multi_ts_assign_players_all() if(found){ multi_assign_player_ship(idx,objp,Ships[objp->instance].ship_info_index); Net_players[idx].p_info.ship_index = slot_index; - Assert(Net_players[idx].p_info.ship_index >= 0); + SDL_assert(Net_players[idx].p_info.ship_index >= 0); Net_players[idx].p_info.ship_class = Ships[objp->instance].ship_info_index; Net_players[idx].player->objnum = OBJ_INDEX(objp); @@ -1148,7 +1148,7 @@ void multi_ts_create_wings() // the standalone never went through this screen so he should never call this function! // the standalone and all other clients will have this equivalent function performed whey they receieve // the post_sync_data_packet!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - Assert(!(Game_mode & GM_STANDALONE_SERVER)); + SDL_assert(!(Game_mode & GM_STANDALONE_SERVER)); // check status of all ships and delete or change ship type as necessary Multi_ts_num_deleted = 0; @@ -1159,7 +1159,7 @@ void multi_ts_create_wings() int objnum; // set the ship type appropriately - Assert(Wss_slots_teams[idx][s_idx].ship_class >= 0); + SDL_assert(Wss_slots_teams[idx][s_idx].ship_class >= 0); objnum = Multi_ts_team[idx].multi_ts_objnum[s_idx]; change_ship_type(Objects[objnum].instance,Wss_slots_teams[idx][s_idx].ship_class); @@ -1170,7 +1170,7 @@ void multi_ts_create_wings() // assign ts_index of the ship to point to the proper Wss_slots slot Ships[Objects[objnum].instance].ts_index = s_idx; } else if(Multi_ts_team[idx].multi_ts_flag[s_idx] == MULTI_TS_FLAG_EMPTY){ - Assert(Multi_ts_team[idx].multi_ts_objnum[s_idx] >= 0); + SDL_assert(Multi_ts_team[idx].multi_ts_objnum[s_idx] >= 0); // mark the object as having been deleted Multi_ts_deleted_objnums[Multi_ts_num_deleted] = Multi_ts_team[idx].multi_ts_objnum[s_idx]; @@ -1197,7 +1197,7 @@ void multi_ts_handle_player_drop() for(s_idx=0;s_idxflags & NETINFO_FLAG_TEAM_CAPTAIN); + SDL_assert(Net_player->flags & NETINFO_FLAG_TEAM_CAPTAIN); } else { - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); } gamesnd_play_iface(SND_USER_SELECT); @@ -1328,7 +1328,7 @@ void multi_ts_button_pressed(int n) break; // free ship/weapon select case MULTI_TS_LOCK: - Assert(Game_mode & GM_MULTIPLAYER); + SDL_assert(Game_mode & GM_MULTIPLAYER); // the "lock" button has been pressed multi_ts_lock_pressed(); @@ -1782,7 +1782,7 @@ void multi_ts_blit_ship_info() // blit the _short_ text description /* - Assert(Multi_ts_ship_info_line_count < 3); + SDL_assert(Multi_ts_ship_info_line_count < 3); gr_set_color_fast(&Color_normal); for(idx=0;idx= 0) && (team < MULTI_TS_MAX_TEAMS) ); + SDL_assert( (team >= 0) && (team < MULTI_TS_MAX_TEAMS) ); return Multi_ts_slot_team_names[team][slot_index]; } else { - Assert( team == 0 ); + SDL_assert( team == 0 ); return Multi_ts_slot_names[slot_index]; } } @@ -1994,7 +1994,7 @@ void multi_ts_handle_mouse() ship_class = -1; if(snazzy_region != -1){ region_type = multi_ts_region_type(snazzy_region); - Assert(region_type != -1); + SDL_assert(region_type != -1); // determine what type of region the mouse is over and the appropriate index switch(region_type){ @@ -2691,7 +2691,7 @@ int multi_ts_get_team(char *ship_name) // lookup through all team ship names for(idx=0;idx= 0); + SDL_assert(Multi_ts_select_index >= 0); Multi_ts_select_ship_class = -1; switch(Multi_ts_select_type){ case MULTI_TS_SLOT_LIST: @@ -2786,8 +2786,8 @@ void multi_ts_select_ship() // split the text info up /* - Assert(Multi_ts_select_ship_class >= 0); - Assert((Ship_info[Multi_ts_select_ship_class].desc != NULL) && strlen(Ship_info[Multi_ts_select_ship_class].desc)); + SDL_assert(Multi_ts_select_ship_class >= 0); + SDL_assert((Ship_info[Multi_ts_select_ship_class].desc != NULL) && strlen(Ship_info[Multi_ts_select_ship_class].desc)); // strip out newlines memset(ship_desc,0,1000); @@ -2810,7 +2810,7 @@ void multi_ts_select_ship() // copy the split up lines into the text lines array for (idx=0;idxweapons.current_primary_bank != -1) && (shipp->weapons.current_secondary_bank != -1)); + SDL_assert((shipp->weapons.current_primary_bank != -1) && (shipp->weapons.current_secondary_bank != -1)); } */ } @@ -2989,7 +2989,7 @@ void send_pslot_update_packet(int team,int code,int sound) break; case TS_CODE_PLAYER_UPDATE: // only the host should ever be doing this - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); // add individual slot data for(idx=0;idxflags & NETINFO_FLAG_AM_MASTER){ // fill in the address information of where this came from player_index = find_player_id(hinfo->id); - Assert(player_index != -1); + SDL_assert(player_index != -1); } // get the opcode @@ -3103,11 +3103,11 @@ void process_pslot_update_packet(ubyte *data, header *hinfo) if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ // in team vs team mode, only a team captain should ever be sending this if(Netgame.type_flags & NG_TYPE_TEAM){ - Assert(Net_players[player_index].flags & NETINFO_FLAG_TEAM_CAPTAIN); + SDL_assert(Net_players[player_index].flags & NETINFO_FLAG_TEAM_CAPTAIN); } // in any other mode, it better be coming from the game host else { - Assert(Net_players[player_index].flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_players[player_index].flags & NETINFO_FLAG_GAME_HOST); } // re-route to all other players diff --git a/src/network/multiui.cpp b/src/network/multiui.cpp index b3ec0ea..b701659 100644 --- a/src/network/multiui.cpp +++ b/src/network/multiui.cpp @@ -382,7 +382,7 @@ * 20). * * 330 9/17/98 9:43a Allender - * removed an Assert that Dave called bogus. + * removed an SDL_assert that Dave called bogus. * * 329 9/16/98 6:54p Dave * Upped max sexpression nodes to 1800 (from 1600). Changed FRED to sort @@ -657,10 +657,10 @@ void multi_common_split_text() char *p_str[MAX_BRIEF_LINES]; n_lines = split_str(Multi_common_all_text, Multi_common_text_coords[gr_screen.res][2], n_chars, p_str, MULTI_COMMON_TEXT_MAX_LINES, MULTI_COMMON_TEXT_META_CHAR); - Assert(n_lines != -1); + SDL_assert(n_lines != -1); for ( i = 0; i < n_lines; i++ ) { - Assert(n_chars[i] < MULTI_COMMON_TEXT_MAX_LINE_LENGTH); + SDL_assert(n_chars[i] < MULTI_COMMON_TEXT_MAX_LINE_LENGTH); strncpy(Multi_common_text[i], p_str[i], n_chars[i]); Multi_common_text[i][n_chars[i]] = 0; drop_leading_white_space(Multi_common_text[i]); @@ -1289,8 +1289,8 @@ void multi_join_game_init() // do the multiplayer init stuff - multi_level_init() now does all net_player zeroing. // setup various multiplayer things - Assert( Game_mode & GM_MULTIPLAYER ); - Assert( Net_player != NULL ); + SDL_assert( Game_mode & GM_MULTIPLAYER ); + SDL_assert( Net_player != NULL ); switch (Multi_options_g.protocol) { case NET_IPX: @@ -1682,7 +1682,7 @@ void multi_join_button_pressed(int n) */ // send the join request here - Assert(Multi_join_selected_item != NULL); + SDL_assert(Multi_join_selected_item != NULL); // send a join request packet Multi_join_should_send = 0; @@ -1755,7 +1755,7 @@ void multi_join_button_pressed(int n) gamesnd_play_iface(SND_GENERAL_FAIL); } else { // send the join request here - Assert(Multi_join_selected_item != NULL); + SDL_assert(Multi_join_selected_item != NULL); Multi_join_should_send = 1; @@ -2104,7 +2104,7 @@ void multi_join_process_select() multi_common_set_text(""); // I sure hope this doesn't happen - Assert(Multi_join_selected_item != NULL); + SDL_assert(Multi_join_selected_item != NULL); return; } // otherwise see if he's clicked on an item @@ -2119,7 +2119,7 @@ void multi_join_process_select() Multi_join_selected_item = multi_join_get_game(Multi_join_list_selected); // I sure hope this doesn't happen - Assert(Multi_join_selected_item != NULL); + SDL_assert(Multi_join_selected_item != NULL); // send a mission description request to this guy send_netgame_descript_packet(&Multi_join_selected_item->server_addr,0); @@ -2837,7 +2837,7 @@ int multi_start_game_rank_from_name( char *rank ) { #else for ( i = 0; i <= MAX_FREESPACE2_RANK; i++ ) { #endif - if ( !stricmp(Ranks[i].name, rank) ) { + if ( !SDL_strcasecmp(Ranks[i].name, rank) ) { return i; } } @@ -3505,7 +3505,7 @@ void multi_sg_rank_build_name(char *in,char *out) } // if the first part of the string is lieutenant, then abbreivate it and tack on the rest of the string - if (stricmp(first,XSTR("lieutenant",785)) == 0) { + if (SDL_strcasecmp(first,XSTR("lieutenant",785)) == 0) { first = strtok(NULL, NOX("\n")); // if he's not just a plain lieutenant @@ -5269,7 +5269,7 @@ void multi_create_list_select_item(int n) ship_init(); // mwa -- 10/15/97. Call this function to reset number of ships in mission ng->max_players = mission_parse_get_multi_mission_info( ng->mission_name ); - Assert(ng->max_players > 0); + SDL_assert(ng->max_players > 0); strcpy(ng->title,The_mission.name); // set the information area text @@ -5849,7 +5849,7 @@ int multi_create_lookup_mission(char *fname) int idx; for(idx=0; idxtype_flags = NG_TYPE_COOP; } @@ -5914,7 +5914,7 @@ void multi_create_sw_clicked() } // switch squad war on else { - Assert(file_index != -1); + SDL_assert(file_index != -1); if((file_index == -1) || !(Multi_create_file_list[file_index].flags & MISSION_TYPE_MULTI_TEAMS)){ Multi_create_sw_checkbox.set_state(0); } else { @@ -6590,7 +6590,7 @@ void multi_ho_button_pressed(int n) break; } } - Assert(radio_index != -1); + SDL_assert(radio_index != -1); // check to see if a radio button was pressed if(radio_index < MULTI_HO_NUM_RADIO_BUTTONS){ @@ -6820,15 +6820,15 @@ void multi_ho_get_options() } // get the voice qos options - Assert((Netgame.options.voice_qos >= 1) && (Netgame.options.voice_qos <= 10)); + SDL_assert((Netgame.options.voice_qos >= 1) && (Netgame.options.voice_qos <= 10)); Multi_ho_sliders[gr_screen.res][MULTI_HO_SLIDER_VOICE_QOS].slider.pos = (Netgame.options.voice_qos - 1); // get the voice duration options - Assert((Netgame.options.voice_record_time > 0) && (Netgame.options.voice_record_time <= MULTI_VOICE_MAX_TIME)); + SDL_assert((Netgame.options.voice_record_time > 0) && (Netgame.options.voice_record_time <= MULTI_VOICE_MAX_TIME)); Multi_ho_sliders[gr_screen.res][MULTI_HO_SLIDER_VOICE_DUR].slider.pos = ((int)((float)Netgame.options.voice_record_time / 500.0f)) - 1; // get the current skill level - Assert((Game_skill_level >= 0) && (Game_skill_level < NUM_SKILL_LEVELS)); + SDL_assert((Game_skill_level >= 0) && (Game_skill_level < NUM_SKILL_LEVELS)); Multi_ho_sliders[gr_screen.res][MULTI_HO_SLIDER_SKILL].slider.pos = Game_skill_level; // get the # of observers @@ -7017,7 +7017,7 @@ void multi_ho_display_skill_level() int skill_level = Multi_ho_sliders[gr_screen.res][MULTI_HO_SLIDER_SKILL].slider.pos; // sanity - Assert((skill_level >= 0) && (skill_level < NUM_SKILL_LEVELS)); + SDL_assert((skill_level >= 0) && (skill_level < NUM_SKILL_LEVELS)); if((skill_level < 0) || (skill_level >= NUM_SKILL_LEVELS)){ skill_level = 0; } @@ -8064,7 +8064,7 @@ void multi_sync_close() const char *multi_sync_tooltip_handler(const char *str) { - if (!stricmp(str, NOX("@launch"))) { + if (!SDL_strcasecmp(str, NOX("@launch"))) { if (Multi_launch_button_created){ return XSTR("Launch",801); } @@ -8493,7 +8493,7 @@ void multi_sync_pre_init() } // we aren't necessarily xferring the mission file yet - Assert(Net_player->s_info.xfer_handle == -1); + SDL_assert(Net_player->s_info.xfer_handle == -1); // always call this for good measure multi_campaign_flush_data(); @@ -9065,7 +9065,7 @@ void multi_sync_start_countdown() } // otherwise send the "start countdown" packet to the standalone else { - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); send_countdown_packet(-1); } } @@ -9274,7 +9274,7 @@ void multi_maybe_set_mission_loop() { int cur = Campaign.current_mission; if (Campaign.missions[cur].has_mission_loop) { - Assert(Campaign.loop_mission != CAMPAIGN_LOOP_MISSION_UNINITIALIZED); + SDL_assert(Campaign.loop_mission != CAMPAIGN_LOOP_MISSION_UNINITIALIZED); } bool require_repeat_mission = (Campaign.current_mission == Campaign.next_mission); @@ -9411,7 +9411,7 @@ void multi_debrief_esc_hit() void multi_debrief_replay_hit() { // only the host should ever get here - Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); + SDL_assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); // if the button was already pressed, do nothing if(Multi_debrief_accept_hit){ diff --git a/src/network/multiutil.cpp b/src/network/multiutil.cpp index 6a6b691..78c0794 100644 --- a/src/network/multiutil.cpp +++ b/src/network/multiutil.cpp @@ -403,19 +403,19 @@ ushort multi_get_next_network_signature( int what_kind ) // and is used mainly for firing weapons. what_kind tells us permanent or non-permanent signature void multi_set_network_signature( ushort signature, int what_kind ) { - Assert( signature != 0 ); + SDL_assert( signature != 0 ); if ( what_kind == MULTI_SIG_SHIP ) { - Assert( (signature >= SHIP_SIG_MIN) && (signature <= SHIP_SIG_MAX) ); + SDL_assert( (signature >= SHIP_SIG_MIN) && (signature <= SHIP_SIG_MAX) ); Next_ship_signature = signature; } else if ( what_kind == MULTI_SIG_DEBRIS ) { - Assert( (signature >= DEBRIS_SIG_MIN) && (signature <= DEBRIS_SIG_MAX) ); + SDL_assert( (signature >= DEBRIS_SIG_MIN) && (signature <= DEBRIS_SIG_MAX) ); Next_debris_signature = signature; } else if ( what_kind == MULTI_SIG_ASTEROID ) { - Assert( (signature >= ASTEROID_SIG_MIN) && (signature <= ASTEROID_SIG_MAX) ); + SDL_assert( (signature >= ASTEROID_SIG_MIN) && (signature <= ASTEROID_SIG_MAX) ); Next_asteroid_signature = signature; } else if ( what_kind == MULTI_SIG_NON_PERMANENT ) { - Assert( (signature >= NPERM_SIG_MIN) && (signature <= NPERM_SIG_MAX) ); + SDL_assert( (signature >= NPERM_SIG_MIN) && (signature <= NPERM_SIG_MAX) ); Next_non_perm_signature = signature; } else Int3(); // get Allender @@ -598,7 +598,7 @@ int multi_ship_class_lookup(const char* ship_name) player_ship_class = -1; for (i = 0; i < Num_ship_types; i++) { - if ( !stricmp(Ship_info[i].name, ship_name) ) { + if ( !SDL_strcasecmp(Ship_info[i].name, ship_name) ) { player_ship_class = i; break; } @@ -756,7 +756,7 @@ int multi_find_player_by_ship_name(const char *ship_name) for(idx=0; idxobjnum >= 0) && (Net_players[idx].player->objnum < MAX_OBJECTS) && (Objects[Net_players[idx].player->objnum].type == OBJ_SHIP) && - (Objects[Net_players[idx].player->objnum].instance >= 0) && (Objects[Net_players[idx].player->objnum].instance < MAX_SHIPS) && !stricmp(ship_name, Ships[Objects[Net_players[idx].player->objnum].instance].ship_name) ){ + (Objects[Net_players[idx].player->objnum].instance >= 0) && (Objects[Net_players[idx].player->objnum].instance < MAX_SHIPS) && !SDL_strcasecmp(ship_name, Ships[Objects[Net_players[idx].player->objnum].instance].ship_name) ){ return idx; } } @@ -852,7 +852,7 @@ void multi_assign_player_ship( int net_player, object *objp,int ship_class ) ship *shipp; int idx; - Assert ( MULTI_CONNECTED(Net_players[net_player]) ); + SDL_assert ( MULTI_CONNECTED(Net_players[net_player]) ); shipp = &Ships[objp->instance]; @@ -869,7 +869,7 @@ void multi_assign_player_ship( int net_player, object *objp,int ship_class ) // find the parse object for this ship. Also, set the wingman status stuff so wingman status gauge // works properly. Net_players[net_player].p_info.p_objp = mission_parse_get_arrival_ship( shipp->ship_name ); - Assert( Net_players[net_player].p_info.p_objp != NULL ); // get allender -- ship should be on list + SDL_assert( Net_players[net_player].p_info.p_objp != NULL ); // get allender -- ship should be on list Net_players[net_player].p_info.p_objp->ship_class = ship_class; // be sure this gets set so respawns work // game server and this client need to initialize this information so object updating @@ -900,7 +900,7 @@ int multi_create_player( int net_player_num, player *pl, char* name, net_addr_t* int player_ship_class = ship_class; int i,current_player_count; - Assert ( net_player_num < MAX_PLAYERS ); // probably shoudln't be able to even get into this routine if no room + SDL_assert ( net_player_num < MAX_PLAYERS ); // probably shoudln't be able to even get into this routine if no room // blast _any_ old data memset(&Net_players[net_player_num],0,sizeof(net_player)); @@ -917,14 +917,14 @@ int multi_create_player( int net_player_num, player *pl, char* name, net_addr_t* // find the ship that matches the string stored in default_player_ship for (i = 0; i < Num_ship_types; i++) { - if ( !stricmp(Ship_info[i].name, default_player_ship) ) { + if ( !SDL_strcasecmp(Ship_info[i].name, default_player_ship) ) { player_ship_class = i; break; } } if (i == Num_ship_types) - Assert(0); + SDL_assert(0); } if ( player_ship_class >= Num_ship_types ) { @@ -1001,7 +1001,7 @@ int multi_create_player( int net_player_num, player *pl, char* name, net_addr_t* void multi_make_player_ai( object *pobj ) { - Assert ( pobj != NULL ); + SDL_assert ( pobj != NULL ); if ( pobj->type != OBJ_SHIP ) return; @@ -1228,9 +1228,9 @@ ushort netmisc_calc_checksum( void * vptr, int len ) void fill_net_addr(net_addr_t* addr, ubyte* address, ubyte* net_id, ushort port) { - Assert(addr != NULL); - Assert(address != NULL); - Assert(net_id != NULL); + SDL_assert(addr != NULL); + SDL_assert(address != NULL); + SDL_assert(net_id != NULL); addr->type = Multi_options_g.protocol; memset( addr->addr, 0x00, 6); @@ -1269,7 +1269,7 @@ char* get_text_address( char * text, ubyte * address ) break; default: - Assert(0); + SDL_assert(0); break; } // end switch @@ -1290,10 +1290,10 @@ void multi_pack_orient_matrix(ubyte *data,matrix *m) if(m->v.fvec.xyz.x < 0) data[16] |= (1<<3); // Z if(m->v.fvec.xyz.y < 0) data[16] |= (1<<4); // W - x1 = INTEL_FLOAT(&m->v.rvec.xyz.x); - y1 = INTEL_FLOAT(&m->v.rvec.xyz.y); - x2 = INTEL_FLOAT(&m->v.uvec.xyz.x); - y2 = INTEL_FLOAT(&m->v.uvec.xyz.y); + x1 = INTEL_FLOAT(m->v.rvec.xyz.x); + y1 = INTEL_FLOAT(m->v.rvec.xyz.y); + x2 = INTEL_FLOAT(m->v.uvec.xyz.x); + y2 = INTEL_FLOAT(m->v.uvec.xyz.y); memcpy(&data[0], &x1, 4); // a memcpy(&data[4], &y1, 4); // b @@ -1312,10 +1312,10 @@ void multi_unpack_orient_matrix(ubyte *data,matrix *m) memcpy(&x2, &data[8], 4); memcpy(&y2, &data[12],4); - m->v.rvec.xyz.x = INTEL_FLOAT(&x1); - m->v.rvec.xyz.y = INTEL_FLOAT(&y1); - m->v.uvec.xyz.x = INTEL_FLOAT(&x2); - m->v.uvec.xyz.y = INTEL_FLOAT(&y2); + m->v.rvec.xyz.x = INTEL_FLOAT(x1); + m->v.rvec.xyz.y = INTEL_FLOAT(y1); + m->v.uvec.xyz.x = INTEL_FLOAT(x2); + m->v.uvec.xyz.y = INTEL_FLOAT(y2); m->v.rvec.xyz.z = fl_sqrt(fl_abs(1 - (m->v.rvec.xyz.x * m->v.rvec.xyz.x) - (m->v.rvec.xyz.y * m->v.rvec.xyz.y))); // X m->v.uvec.xyz.z = fl_sqrt(fl_abs(1 - (m->v.uvec.xyz.x * m->v.uvec.xyz.x) - (m->v.uvec.xyz.y * m->v.uvec.xyz.y))); // Y @@ -1473,7 +1473,7 @@ void multi_subsys_update_all() { /* int idx; - Assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); + SDL_assert(Net_player->flags & NETINFO_FLAG_AM_MASTER); for(idx=0;idx= 0); + SDL_assert(player >= 0); if(player < 0){ return; } @@ -1540,7 +1540,7 @@ void server_verify_filesig(short player_id, ushort sum_sig, int length_sig) int is_builtin; player = find_player_id(player_id); - Assert(player >= 0); + SDL_assert(player >= 0); if(player < 0){ return; } @@ -1768,8 +1768,8 @@ void multi_maybe_send_repair_info(object *dest_objp, object *source_objp, int co if ( !MULTIPLAYER_MASTER ) return; - Assert( dest_objp->type == OBJ_SHIP ); - Assert( dest_objp != source_objp ); + SDL_assert( dest_objp->type == OBJ_SHIP ); + SDL_assert( dest_objp != source_objp ); send_repair_info_packet( dest_objp, source_objp, code ); } @@ -1797,7 +1797,7 @@ void multi_create_standalone_object() // create the default player ship object and use that as my default virtual "ship", and make it "invisible" pobj_num = parse_create_object(&Player_start_pobject); - Assert(pobj_num != -1); + SDL_assert(pobj_num != -1); obj_set_flags(&Objects[pobj_num],OF_PLAYER_SHIP); Objects[pobj_num].net_signature = STANDALONE_SHIP_SIG; Player_ship = &Ships[Objects[pobj_num].instance]; @@ -2072,7 +2072,7 @@ int multi_can_message(net_player *p) // check to see if he's a wingleader sp = &Ships[Objects[p->player->objnum].instance]; - if(stricmp(sp->ship_name,NOX("alpha 1")) && stricmp(sp->ship_name,NOX("beta 1")) && stricmp(sp->ship_name,NOX("gamma 1")) && stricmp(sp->ship_name,NOX("zeta 1")) ){ + if(SDL_strcasecmp(sp->ship_name,NOX("alpha 1")) && SDL_strcasecmp(sp->ship_name,NOX("beta 1")) && SDL_strcasecmp(sp->ship_name,NOX("gamma 1")) && SDL_strcasecmp(sp->ship_name,NOX("zeta 1")) ){ return 0; } break; @@ -2120,7 +2120,7 @@ int multi_can_end_mission(net_player *p) // check to see if he's a wingleader sp = &Ships[Objects[p->player->objnum].instance]; - if(stricmp(sp->ship_name,NOX("alpha 1")) && stricmp(sp->ship_name,NOX("beta 1")) && stricmp(sp->ship_name,NOX("gamma 1")) && stricmp(sp->ship_name,NOX("zeta 1")) ){ + if(SDL_strcasecmp(sp->ship_name,NOX("alpha 1")) && SDL_strcasecmp(sp->ship_name,NOX("beta 1")) && SDL_strcasecmp(sp->ship_name,NOX("gamma 1")) && SDL_strcasecmp(sp->ship_name,NOX("zeta 1")) ){ return 0; } break; @@ -2511,7 +2511,7 @@ void multi_file_xfer_notify(int handle) // if the incoming filename is a freespace file, set my netplayer state to be "file xfer" if(is_mission){ // we'd better not be xferring a file right now - Assert(Net_player->s_info.xfer_handle == -1); + SDL_assert(Net_player->s_info.xfer_handle == -1); // force into the multidata directory multi_xfer_handle_force_dir(handle, cf_type); @@ -2563,7 +2563,7 @@ void multi_process_valid_join_request(join_request *jr, net_addr_t *who_from, in net_player_num = multi_find_open_netplayer_slot(); player_num = multi_find_open_player_slot(); id_num = multi_get_new_id(); - Assert((net_player_num != -1) && (player_num != -1)); + SDL_assert((net_player_num != -1) && (player_num != -1)); // if he is requesting to join as an observer if(jr->flags & JOIN_FLAG_AS_OBSERVER){ @@ -2684,7 +2684,7 @@ void multi_process_valid_join_request(join_request *jr, net_addr_t *who_from, in else if(Net_players[net_player_num].flags & NETINFO_FLAG_INGAME_JOIN){ // if we're in team vs. team mode if(Netgame.type_flags & NG_TYPE_TEAM){ - Assert(ingame_join_team != -1); + SDL_assert(ingame_join_team != -1); Net_players[net_player_num].p_info.team = ingame_join_team; } @@ -2894,7 +2894,7 @@ void multi_server_update_player_weapons(net_player *pl,ship *shipp) // engine ets pl->s_info.ship_ets |= ((ushort)shipp->engine_recharge_index); - Assert( pl->s_info.ship_ets != 0 ); + SDL_assert( pl->s_info.ship_ets != 0 ); } // flush the multidata cache directory @@ -3126,15 +3126,15 @@ int multi_get_connection_speed() connection_speed = os_config_read_string(NULL, "ConnectionSpeed", ""); - if ( !stricmp(connection_speed, NOX("Slow")) ) { + if ( !SDL_strcasecmp(connection_speed, NOX("Slow")) ) { cspeed = CONNECTION_SPEED_288; - } else if ( !stricmp(connection_speed, NOX("56K")) ) { + } else if ( !SDL_strcasecmp(connection_speed, NOX("56K")) ) { cspeed = CONNECTION_SPEED_56K; - } else if ( !stricmp(connection_speed, NOX("ISDN")) ) { + } else if ( !SDL_strcasecmp(connection_speed, NOX("ISDN")) ) { cspeed = CONNECTION_SPEED_SISDN; - } else if ( !stricmp(connection_speed, NOX("Cable")) ) { + } else if ( !SDL_strcasecmp(connection_speed, NOX("Cable")) ) { cspeed = CONNECTION_SPEED_CABLE; - } else if ( !stricmp(connection_speed, NOX("Fast")) ) { + } else if ( !SDL_strcasecmp(connection_speed, NOX("Fast")) ) { cspeed = CONNECTION_SPEED_T1; } else { cspeed = CONNECTION_SPEED_NONE; diff --git a/src/network/psnet.cpp b/src/network/psnet.cpp index eacadc1..45f191e 100644 --- a/src/network/psnet.cpp +++ b/src/network/psnet.cpp @@ -518,7 +518,7 @@ ushort psnet_calc_checksum( void * vptr, int len ) uint psnet_set_socket_mode(SOCKET sock_id, int opt, BOOL toggle) { - return (setsockopt(sock_id, SOL_SOCKET, opt, (LPSTR)&toggle, sizeof(toggle))); + return (setsockopt(sock_id, SOL_SOCKET, opt, (char *)&toggle, sizeof(toggle))); } @@ -543,7 +543,7 @@ uint sock_get_ip() nRet = gethostname(LclHost, MAXHOSTNAME ); if (nRet != SOCKET_ERROR ) { // Resolve host name for local address - Hostent = gethostbyname((LPSTR)LclHost); + Hostent = gethostbyname((char *)LclHost); if ( Hostent ) LclAddr.sin_addr.s_addr = *((u_long FAR *)(Hostent->h_addr)); } @@ -725,7 +725,7 @@ void psnet_socket_options( SOCKET sock ) // Set the mode of the socket to allow broadcasting. We need to be able to broadcast // when a game is searched for in IPX mode. broadcast = 1; - if(setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (LPSTR)&broadcast, sizeof(broadcast) )){ + if(setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast) )){ Can_broadcast = 0; } else { Can_broadcast = 1; @@ -736,9 +736,9 @@ void psnet_socket_options( SOCKET sock ) // set the current size of the receive buffer cursizesize = sizeof(int); - getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&cursize, &cursizesize); for ( trysize = bufsize; trysize >= cursize; trysize >>= 1 ) { - ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (LPSTR)&trysize, sizeof(trysize)); + ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&trysize, sizeof(trysize)); if ( ret == SOCKET_ERROR ) { int wserr; @@ -748,14 +748,14 @@ void psnet_socket_options( SOCKET sock ) } else break; } - getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&cursize, &cursizesize); nprintf(("Network", "Receive buffer set to %d\n", cursize)); // set the current size of the send buffer cursizesize = sizeof(int); - getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&cursize, &cursizesize); for ( trysize = bufsize; trysize >= cursize; trysize >>= 1 ) { - ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (LPSTR)&trysize, sizeof(trysize)); + ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&trysize, sizeof(trysize)); if ( ret == SOCKET_ERROR ) { int wserr; @@ -765,7 +765,7 @@ void psnet_socket_options( SOCKET sock ) } else break; } - getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&cursize, &cursizesize); nprintf(("Network", "Send buffer set to %d\n", cursize)); } @@ -792,9 +792,9 @@ void psnet_init( int protocol, int port_num ) return; internet_connection = os_config_read_string(NULL, "NetworkConnection", "none"); - if ( !stricmp(internet_connection, NOX("dialup")) ) { + if ( !SDL_strcasecmp(internet_connection, NOX("dialup")) ) { Psnet_connection = NETWORK_CONNECTION_DIALUP; - } else if ( !stricmp(internet_connection, NOX("lan")) ) { + } else if ( !SDL_strcasecmp(internet_connection, NOX("lan")) ) { Psnet_connection = NETWORK_CONNECTION_LAN; } else { Psnet_connection = NETWORK_CONNECTION_NONE; @@ -1215,7 +1215,7 @@ void psnet_rel_connect_to_server( PSNET_SOCKET *psocket, net_addr *server_addr) } else if (is_set) { // if set, then we have connection, move forward break; } else { - Sleep(10); // sleep for 10 ms and try again + SDL_Delay(10); // sleep for 10 ms and try again num_tries++; } } while ( num_tries < MAX_CONNECT_TRIES ); @@ -1303,7 +1303,7 @@ char* psnet_addr_to_string( char * text, net_addr * address ) break; default: - // Assert(0); + // SDL_assert(0); break; } // end switch @@ -1329,7 +1329,7 @@ void psnet_string_to_addr( net_addr * address, char * text ) } // copy the text string to local storage to look for ports - Assert( strlen(text) < 255 ); + SDL_assert( strlen(text) < 255 ); strcpy(str, text); c = strrchr(str, ':'); port = NULL; @@ -1364,7 +1364,7 @@ void psnet_string_to_addr( net_addr * address, char * text ) break; default: - Assert(0); + SDL_assert(0); break; } // end switch @@ -1477,7 +1477,7 @@ void psnet_get_socket_data(SOCKET socket, int flags = PSNET_FLAG_RAW) break; default: - Assert(0); + SDL_assert(0); break; } @@ -1567,7 +1567,7 @@ void psnet_get_socket_data(SOCKET socket, int flags = PSNET_FLAG_RAW) // put all of the data (length, who from, etc.) into the next available packet buffer // slot. We should be assured of a slot here because of the check at the beginning // of the while loop - Assert ( Num_packet_buffers < MAX_PACKET_BUFFERS ); + SDL_assert ( Num_packet_buffers < MAX_PACKET_BUFFERS ); id = packet_free_list[ Num_packet_buffers++ ]; if (id > Largest_packet_index ) Largest_packet_index = id; packet_buffers[id].len = len; // use the flags field of the packet structure to hold the data length @@ -1646,7 +1646,7 @@ int psnet_send( net_addr * who_to, void * data, int len, int flags, int reliable // determine from the flags whether or not this packet should have a checksum. if ( flags & PSNET_FLAG_CHECKSUM ) { // can't send raw data with a checksum, dumbass! - Assert(!(flags & PSNET_FLAG_RAW)); + SDL_assert(!(flags & PSNET_FLAG_RAW)); Send_network_checksum_packet.sequence_number = Next_packet_id++; Send_network_checksum_packet.flags = PSNET_FLAG_CHECKSUM; @@ -1720,7 +1720,7 @@ int psnet_send( net_addr * who_to, void * data, int len, int flags, int reliable break; default: - Assert(0); // unknown protocol + SDL_assert(0); // unknown protocol break; } // end switch @@ -1771,11 +1771,11 @@ int psnet_rel_send( PSNET_SOCKET psocket, ubyte *data, int length, int flags ) if ( socket == INVALID_SOCKET ) // might happen in race conditions -- should get cleaned up. return 0; - Assert( length < MAX_RSEND_BUFFER ); + SDL_assert( length < MAX_RSEND_BUFFER ); // copy the length of the data into the beginning of the buffer. then put the data into the buffer // after the length value - Assert( length > 0 ); + SDL_assert( length > 0 ); s_length = (ushort)length; memcpy( &rsend_buffer[0], &s_length, sizeof(s_length) ); memcpy( &rsend_buffer[2], data, length ); @@ -1876,7 +1876,7 @@ int psnet_rel_get( PSNET_SOCKET psocket, ubyte *buffer, int max_len, int flags) total_read = 0; memcpy(&read_len, &rread_buffer[0], 2); - Assert( (read_len > 0) && (read_len < max_len) ); + SDL_assert( (read_len > 0) && (read_len < max_len) ); if ( read_len == 0 ) return 0; @@ -2286,7 +2286,7 @@ int psnet_is_valid_ip_string( char *ip_string, int allow_port ) char str[255], *c; // our addresses may have ports, so make local copy and remove port number - Assert( strlen(ip_string) < 255 ); + SDL_assert( strlen(ip_string) < 255 ); strcpy(str, ip_string); c = strrchr(str, ':'); if ( c ){ @@ -2398,7 +2398,7 @@ int psnet_buffer_get_next(ubyte *data, int *length, net_addr *from) } // at this point, we should _always_ have found the buffer - Assert(found_buf); + SDL_assert(found_buf); // copy out the buffer data memcpy(data,Psnet_buffers[idx].data,Psnet_buffers[idx].len); diff --git a/src/network/psnet2.cpp b/src/network/psnet2.cpp index 2d13721..9f65dd8 100644 --- a/src/network/psnet2.cpp +++ b/src/network/psnet2.cpp @@ -425,7 +425,7 @@ int RECVFROM(SOCKET s, char *buf, int len, int flags, sockaddr *from, int *froml int ret_len; // bad type - Assert((psnet_type >= 0) && (psnet_type < PSNET_NUM_TYPES)); + SDL_assert((psnet_type >= 0) && (psnet_type < PSNET_NUM_TYPES)); if((psnet_type < 0) || (psnet_type >= PSNET_NUM_TYPES)){ return -1; } @@ -464,7 +464,7 @@ int RECVFROM(SOCKET s, char *buf, int len, int flags, sockaddr *from, int *froml break; default: - Assert(0); + SDL_assert(0); break; } @@ -486,7 +486,7 @@ int SELECT(int nfds, fd_set FAR * readfds, fd_set FAR * writefds, fd_set FAR * e } // bad type - Assert((psnet_type >= 0) && (psnet_type < PSNET_NUM_TYPES)); + SDL_assert((psnet_type >= 0) && (psnet_type < PSNET_NUM_TYPES)); if((psnet_type < 0) || (psnet_type >= PSNET_NUM_TYPES)){ return -1; } @@ -585,7 +585,7 @@ void PSNET_TOP_LAYER_PROCESS() break; default: - Assert(0); + SDL_assert(0); return; } @@ -612,7 +612,7 @@ void PSNET_TOP_LAYER_PROCESS() break; default: - Assert(0); + SDL_assert(0); return; // break; } @@ -662,11 +662,11 @@ void psnet_init( int protocol, int port_num ) } internet_connection = os_config_read_string(NULL, "NetworkConnection", "none"); - if ( !stricmp(internet_connection, NOX("dialup")) ) { + if ( !SDL_strcasecmp(internet_connection, NOX("dialup")) ) { ml_string("psnet_init() detected dialup connection"); Psnet_connection = NETWORK_CONNECTION_DIALUP; - } else if ( !stricmp(internet_connection, NOX("lan")) ) { + } else if ( !SDL_strcasecmp(internet_connection, NOX("lan")) ) { ml_string("psnet_init() detected lan connection"); Psnet_connection = NETWORK_CONNECTION_LAN; @@ -945,7 +945,7 @@ char* psnet_addr_to_string( char * text, net_addr_t * address ) break; default: - // Assert(0); + // SDL_assert(0); break; } // end switch @@ -966,7 +966,7 @@ void psnet_string_to_addr( net_addr_t * address, char * text ) } // copy the text string to local storage to look for ports - Assert( strlen(text) < 255 ); + SDL_assert( strlen(text) < 255 ); strcpy(str, text); c = strrchr(str, ':'); port = NULL; @@ -1002,7 +1002,7 @@ void psnet_string_to_addr( net_addr_t * address, char * text ) break; default: - Assert(0); + SDL_assert(0); break; } // end switch @@ -1108,7 +1108,7 @@ int psnet_send( net_addr_t * who_to, void * data, int len, int np_index ) break; default: - Assert(0); // unknown protocol + SDL_assert(0); // unknown protocol break; } // end switch @@ -1180,7 +1180,7 @@ int psnet_is_valid_ip_string( char *ip_string, int allow_port ) char str[255], *c; // our addresses may have ports, so make local copy and remove port number - Assert( strlen(ip_string) < 255 ); + SDL_assert( strlen(ip_string) < 255 ); strcpy(str, ip_string); c = strrchr(str, ':'); if ( c ){ @@ -1229,7 +1229,7 @@ void psnet_rel_send_ack(SOCKADDR *raddr, unsigned int sig, ubyte link_type, floa reliable_header ack_header; ack_header.type = RNT_ACK; ack_header.data_len = sizeof(unsigned int); - ack_header.send_time = INTEL_FLOAT( &time_sent ); + ack_header.send_time = INTEL_FLOAT( time_sent ); sig_tmp = INTEL_INT( sig ); memcpy(&ack_header.data,&sig_tmp,sizeof(unsigned int)); switch (link_type) { @@ -1336,7 +1336,7 @@ int psnet_rel_send(PSNET_SOCKET_RELIABLE socketid, ubyte *data, int length, int return -1; } - Assert( length < (int)(sizeof(reliable_header)) ); + SDL_assert( length < (int)(sizeof(reliable_header)) ); psnet_rel_work(); rsocket=&Reliable_sockets[socketid]; @@ -1364,7 +1364,7 @@ int psnet_rel_send(PSNET_SOCKET_RELIABLE socketid, ubyte *data, int length, int send_header.data_len = INTEL_SHORT( (ushort)length ); send_header.type = RNT_DATA; send_header.send_time = psnet_get_time(); - send_header.send_time = INTEL_FLOAT( &send_header.send_time ); + send_header.send_time = INTEL_FLOAT( send_header.send_time ); // SOCKADDR_IN * rsockaddr = (SOCKADDR_IN *)&rsocket->addr; if (send_this_packet){ @@ -1548,7 +1548,7 @@ void psnet_rel_work() bytesin = RECVFROM(Unreliable_socket, (char *)&rcv_buff,sizeof(reliable_header), 0, (SOCKADDR *)&rcv_addr,&addrlen, PSNET_TYPE_RELIABLE); rcv_buff.seq = INTEL_SHORT( rcv_buff.seq ); rcv_buff.data_len = INTEL_SHORT( rcv_buff.data_len ); - rcv_buff.send_time = INTEL_FLOAT( &rcv_buff.send_time ); + rcv_buff.send_time = INTEL_FLOAT( rcv_buff.send_time ); memcpy(d3_rcv_addr.addr, &tcp_addr->sin_addr.s_addr, 4); d3_rcv_addr.port = tcp_addr->sin_port; d3_rcv_addr.type = NET_TCP; @@ -1680,7 +1680,7 @@ void psnet_rel_work() if(rsocket){ if(rsocket->sbuffers[i]){ if(rsocket->ssequence[i] == INTEL_INT(*acksig) ){ - Assert(rsocket->sbuffers[i] != NULL); + SDL_assert(rsocket->sbuffers[i] != NULL); free(rsocket->sbuffers[i]); rsocket->sbuffers[i] = NULL; rsocket->ssequence[i] = 0; @@ -1785,7 +1785,7 @@ void psnet_rel_work() if((rsocket->sbuffers[i]) && (fl_abs((psnet_get_time() - rsocket->timesent[i])) >= retry_packet_time)) { reliable_header send_header; send_header.send_time = psnet_get_time(); - send_header.send_time = INTEL_FLOAT( &send_header.send_time ); + send_header.send_time = INTEL_FLOAT( send_header.send_time ); send_header.seq = INTEL_SHORT( rsocket->ssequence[i] ); memcpy(send_header.data,rsocket->sbuffers[i]->buffer,rsocket->send_len[i]); send_header.data_len = INTEL_SHORT( (ushort)rsocket->send_len[i] ); @@ -1809,7 +1809,7 @@ void psnet_rel_work() if((rsocket->status == RNF_CONNECTED) && (fl_abs((psnet_get_time() - rsocket->last_packet_sent)) > NETHEARTBEATTIME)) { reliable_header send_header; send_header.send_time = psnet_get_time(); - send_header.send_time = INTEL_FLOAT( &send_header.send_time ); + send_header.send_time = INTEL_FLOAT( send_header.send_time ); send_header.seq = 0; send_header.data_len = 0; send_header.type = RNT_HEARTBEAT; @@ -2136,7 +2136,7 @@ int psnet_rel_get_ip() ret = gethostname(local, 255 ); if (ret != SOCKET_ERROR ){ // Resolve host name for local address - hostent = gethostbyname((LPSTR)local); + hostent = gethostbyname((char *)local); if ( hostent ){ local_address.sin_addr.s_addr = *((u_long FAR *)(hostent->h_addr)); } @@ -2346,7 +2346,7 @@ int psnet_buffer_get_next(network_packet_buffer_list *l, ubyte *data, int *lengt } // at this point, we should _always_ have found the buffer - Assert(found_buf); + SDL_assert(found_buf); // copy out the buffer data memcpy(data, l->psnet_buffers[idx].data, l->psnet_buffers[idx].len); @@ -2644,23 +2644,23 @@ void psnet_socket_options( SOCKET sock ) // Set the mode of the socket to allow broadcasting. We need to be able to broadcast // when a game is searched for in IPX mode. broadcast = 1; - if(setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (LPSTR)&broadcast, sizeof(broadcast) )){ + if(setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast) )){ Can_broadcast = 0; } else { Can_broadcast = 1; } // reuseaddr - // setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (LPSTR)&broadcast, sizeof(broadcast) ); + // setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&broadcast, sizeof(broadcast) ); // try and increase the size of my receive buffer bufsize = MAX_RECEIVE_BUFSIZE; // set the current size of the receive buffer cursizesize = sizeof(int); - getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&cursize, &cursizesize); // for ( trysize = bufsize; trysize >= cursize; trysize >>= 1 ) { - ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (LPSTR)&bufsize, sizeof(bufsize)); + ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, sizeof(bufsize)); if ( ret == SOCKET_ERROR ) { int wserr; @@ -2669,14 +2669,14 @@ void psnet_socket_options( SOCKET sock ) // break; } // } - getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&cursize, &cursizesize); ml_printf("Receive buffer set to %d\n", cursize); // set the current size of the send buffer cursizesize = sizeof(int); - getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&cursize, &cursizesize); // for ( trysize = bufsize; trysize >= cursize; trysize >>= 1 ) { - ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (LPSTR)&bufsize, sizeof(bufsize)); + ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&bufsize, sizeof(bufsize)); if ( ret == SOCKET_ERROR ) { int wserr; @@ -2685,7 +2685,7 @@ void psnet_socket_options( SOCKET sock ) // break; // } } - getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (LPSTR)&cursize, &cursizesize); + getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&cursize, &cursizesize); ml_printf("Send buffer set to %d\n", cursize); } diff --git a/src/network/stand_gui.cpp b/src/network/stand_gui.cpp index 2ee1e39..6f43539 100644 --- a/src/network/stand_gui.cpp +++ b/src/network/stand_gui.cpp @@ -2039,22 +2039,22 @@ void std_mutate_sheet() GetWindowText(child,lookup,511); // if its the OK button - if(!stricmp(lookup,XSTR("ok",925))){ + if(!SDL_strcasecmp(lookup,XSTR("ok",925))){ ok_button = child; } // if its the cancel button - if(!stricmp(lookup,XSTR("cancel",926))){ + if(!SDL_strcasecmp(lookup,XSTR("cancel",926))){ cancel_button = child; } // if its the apply button - if(!stricmp(lookup,XSTR("&apply",927))){ + if(!SDL_strcasecmp(lookup,XSTR("&apply",927))){ apply_button = child; } // if its the help button - if(!stricmp(lookup,XSTR("help",928))){ + if(!SDL_strcasecmp(lookup,XSTR("help",928))){ help_button = child; } @@ -2101,7 +2101,7 @@ int std_player_is_banned(char *name) // go through the ban list for(idx=0;idxtype == OBJ_DEBRIS ); - Assert( pship->type == OBJ_SHIP ); + SDL_assert( pdebris->type == OBJ_DEBRIS ); + SDL_assert( pship->type == OBJ_SHIP ); /* Debris_ship_count++; if (Debris_ship_count % 100 == 0) @@ -335,8 +335,8 @@ int collide_asteroid_ship( obj_pair * pair ) if (pasteroid->hull_strength < 0.0f) return 0; - Assert( pasteroid->type == OBJ_ASTEROID ); - Assert( pship->type == OBJ_SHIP ); + SDL_assert( pasteroid->type == OBJ_ASTEROID ); + SDL_assert( pship->type == OBJ_SHIP ); dist = vm_vec_dist( &pasteroid->pos, &pship->pos ); diff --git a/src/object/collidedebrisweapon.cpp b/src/object/collidedebrisweapon.cpp index 3f94604..ad52ecf 100644 --- a/src/object/collidedebrisweapon.cpp +++ b/src/object/collidedebrisweapon.cpp @@ -88,8 +88,8 @@ int collide_debris_weapon( obj_pair * pair ) object *pdebris = pair->a; object *weapon = pair->b; - Assert( pdebris->type == OBJ_DEBRIS ); - Assert( weapon->type == OBJ_WEAPON ); + SDL_assert( pdebris->type == OBJ_DEBRIS ); + SDL_assert( weapon->type == OBJ_WEAPON ); // first check the bounding spheres of the two objects. hit = fvi_segment_sphere(&hitpos, &weapon->last_pos, &weapon->pos, &pdebris->pos, pdebris->radius); @@ -123,8 +123,8 @@ int collide_asteroid_weapon( obj_pair * pair ) object *pasteroid = pair->a; object *weapon = pair->b; - Assert( pasteroid->type == OBJ_ASTEROID); - Assert( weapon->type == OBJ_WEAPON ); + SDL_assert( pasteroid->type == OBJ_ASTEROID); + SDL_assert( weapon->type == OBJ_WEAPON ); // first check the bounding spheres of the two objects. hit = fvi_segment_sphere(&hitpos, &weapon->last_pos, &weapon->pos, &pasteroid->pos, pasteroid->radius); diff --git a/src/object/collideshipship.cpp b/src/object/collideshipship.cpp index 2a4c1ef..33c640c 100644 --- a/src/object/collideshipship.cpp +++ b/src/object/collideshipship.cpp @@ -249,7 +249,7 @@ * relentlessly pursue current goal. * * 75 3/13/98 12:57p Mike - * Remove an Assert that was easy to trip with time compressed 8x. + * Remove an SDL_assert that was easy to trip with time compressed 8x. * * 74 3/09/98 12:58a Andsager * Don't check asteroids very large displacements in collisions, since @@ -417,7 +417,7 @@ * Modify ai_turn_towards_vector() to take a flag parameter. * * 28 11/05/97 10:32p Mike - * Convert Assert() to nprintf when point of collisions is farther apart + * Convert SDL_assert() to nprintf when point of collisions is farther apart * than sum of object radii. * * 27 11/05/97 9:28p Mike @@ -623,13 +623,13 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vector int player_involved; // flag to indicate that A or B is the Player_obj int num; //, player_check=0; - Assert( heavy_obj->type == OBJ_SHIP ); - Assert( light_obj->type == OBJ_SHIP ); + SDL_assert( heavy_obj->type == OBJ_SHIP ); + SDL_assert( light_obj->type == OBJ_SHIP ); num = heavy_obj->instance; - Assert( num >= 0 ); + SDL_assert( num >= 0 ); - Assert( Ships[num].objnum == OBJ_INDEX(heavy_obj)); + SDL_assert( Ships[num].objnum == OBJ_INDEX(heavy_obj)); // AL 12-4-97: we use the player_involved flag to ensure collisions are always // done with the player, regardless of team. @@ -839,7 +839,7 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vector vm_matrix_x_matrix(&rot_matrix, &m_temp, &heavy_obj->orient); // R = goal * Mtemp1 vm_matrix_to_rot_axis_and_angle(&rot_matrix, &theta, &rot_axis); // determines angle and rotation axis from curr to goal vm_quaternion_rotate(&m_temp, theta * mc.hit_dist, &rot_axis); - Assert(is_valid_matrix(&m_temp)); + SDL_assert(is_valid_matrix(&m_temp)); vm_matrix_x_matrix(&int_heavy_orient, &heavy_obj->last_orient, &m_temp); // set submodel angle at time of collision @@ -1071,7 +1071,7 @@ int check_special_cruiser_asteroid_collision(object *heavy, object *light, float int asteroid_type; if (heavy->type == OBJ_ASTEROID) { - Assert(light->type == OBJ_SHIP); + SDL_assert(light->type == OBJ_SHIP); if (Ship_info[Ships[light->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) { asteroid_type = Asteroids[heavy->instance].type; @@ -1089,7 +1089,7 @@ int check_special_cruiser_asteroid_collision(object *heavy, object *light, float } } } else if (light->type == OBJ_ASTEROID) { - Assert(heavy->type == OBJ_SHIP); + SDL_assert(heavy->type == OBJ_SHIP); if (Ship_info[Ships[heavy->instance].ship_info_index].flags & SIF_BIG_SHIP) { asteroid_type = Asteroids[light->instance].type; @@ -1142,11 +1142,11 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_ if (special_cruiser_asteroid_collision) { if (cruiser_light) { - Assert(light->phys_info.mass < cruiser_mass); + SDL_assert(light->phys_info.mass < cruiser_mass); copy_mass = light->phys_info.mass; light->phys_info.mass = cruiser_mass; } else { - Assert(heavy->phys_info.mass < cruiser_mass); + SDL_assert(heavy->phys_info.mass < cruiser_mass); copy_mass = heavy->phys_info.mass; heavy->phys_info.mass = cruiser_mass; } @@ -1323,7 +1323,7 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_ // since we have already calculated delta rotvel for heavy and light in world coords // physics should not have to recalculate this, just change into body coords (done in collide_whack) vm_vec_scale(&impulse, impulse_mag); - //Assert(impulse_mag < 20e6); + //SDL_assert(impulse_mag < 20e6); vm_vec_scale(&delta_rotvel_light, impulse_mag); physics_collide_whack(&impulse, &delta_rotvel_light, &light->phys_info, &light->orient); vm_vec_negate(&impulse); @@ -1342,7 +1342,7 @@ void calculate_ship_ship_collision_physics(collision_info_struct *ship_ship_hit_ vm_vec_sub(&direction_light, &ship_ship_hit_info->light_rel_vel, &local_vel_from_submodel); vm_vec_normalize_safe(&direction_light); - Assert( !vm_is_vec_nan(&direction_light) ); + SDL_assert( !vm_is_vec_nan(&direction_light) ); vm_vec_scale_add2(&heavy->pos, &direction_light, 0.2f * light->phys_info.mass / (heavy->phys_info.mass + light->phys_info.mass)); vm_vec_scale_add2(&light->pos, &direction_light, -0.2f * heavy->phys_info.mass / (heavy->phys_info.mass + light->phys_info.mass)); vm_vec_scale_add2(&heavy->pos, &ship_ship_hit_info->collision_normal, -0.1f * light->phys_info.mass / (heavy->phys_info.mass + light->phys_info.mass)); @@ -1415,7 +1415,7 @@ void mcp_1(object *player_objp, object *planet_objp) // Hack: Just checking first six letters of name. int is_planet(object *objp) { - return (strnicmp(Ships[objp->instance].ship_name, NOX("planet"), 6) == 0); + return (SDL_strncasecmp(Ships[objp->instance].ship_name, NOX("planet"), 6) == 0); } @@ -1587,8 +1587,8 @@ int collide_ship_ship( obj_pair * pair ) if ( A->type == OBJ_WAYPOINT ) return 1; if ( B->type == OBJ_WAYPOINT ) return 1; - Assert( A->type == OBJ_SHIP ); - Assert( B->type == OBJ_SHIP ); + SDL_assert( A->type == OBJ_SHIP ); + SDL_assert( B->type == OBJ_SHIP ); // If the player is one of the two colliding ships, flag this... it is used in // several places this function. @@ -1856,7 +1856,7 @@ void collect_ship_ship_physics_info(object *heavy, object *light, mc_info *mc_in float core_rad = model_get_core_radius( Ships[light->instance].modelnum ); // get info needed for ship_ship_collision_physics - Assert(mc_info->hit_dist > 0); + SDL_assert(mc_info->hit_dist > 0); // get light_collide_cm_pos if ( !ship_ship_hit_info->submodel_rot_hit ) { @@ -1870,7 +1870,7 @@ void collect_ship_ship_physics_info(object *heavy, object *light, mc_info *mc_in // get r_light vm_vec_sub(r_light, &ship_ship_hit_info->hit_pos, light_collide_cm_pos); -// Assert(vm_vec_mag(&r_light) > core_rad - 0.1); +// SDL_assert(vm_vec_mag(&r_light) > core_rad - 0.1); float mag = float(fabs(vm_vec_mag(r_light) - core_rad)); if (mag > 0.1) { nprintf(("Physics", "Framecount: %i |r_light - core_rad| > 0.1)\n", Framecount)); diff --git a/src/object/collideshipweapon.cpp b/src/object/collideshipweapon.cpp index e2058e5..306a60e 100644 --- a/src/object/collideshipweapon.cpp +++ b/src/object/collideshipweapon.cpp @@ -174,7 +174,7 @@ void update_danger_weapon(object *ship_obj, object *weapon_obj) { ai_info *aip; - Assert(ship_obj->type == OBJ_SHIP); + SDL_assert(ship_obj->type == OBJ_SHIP); aip = &Ai_info[Ships[ship_obj->instance].ai_index]; @@ -252,12 +252,12 @@ int ship_weapon_check_collision(object * ship_obj, object * weapon_obj, float ti weapon *wp = &Weapons[weapon_obj->instance]; weapon_info *wip = &Weapon_info[wp->weapon_info_index]; - Assert( ship_obj->type == OBJ_SHIP ); - Assert( weapon_obj->type == OBJ_WEAPON ); + SDL_assert( ship_obj->type == OBJ_SHIP ); + SDL_assert( weapon_obj->type == OBJ_WEAPON ); num = ship_obj->instance; - Assert( num >= 0 ); - Assert( Ships[num].objnum == OBJ_INDEX(ship_obj)); + SDL_assert( num >= 0 ); + SDL_assert( Ships[num].objnum == OBJ_INDEX(ship_obj)); shipp = &Ships[num]; @@ -393,8 +393,8 @@ int collide_ship_weapon( obj_pair * pair ) object *ship = pair->a; object *weapon = pair->b; - Assert( ship->type == OBJ_SHIP ); - Assert( weapon->type == OBJ_WEAPON ); + SDL_assert( ship->type == OBJ_SHIP ); + SDL_assert( weapon->type == OBJ_WEAPON ); // Don't check collisions for player if past first warpout stage. if ( Player->control_mode > PCM_WARPOUT_STAGE1) { @@ -442,7 +442,7 @@ float estimate_ship_speed_upper_limit( object *ship, float time ) return ship->phys_info.speed; } exponent = time / ship->phys_info.forward_accel_time_const; - //Assert( exponent >= 0); + //SDL_assert( exponent >= 0); factor = 1.0f - (float)exp( -exponent ); diff --git a/src/object/collideweaponweapon.cpp b/src/object/collideweaponweapon.cpp index be8c608..e3c3fcf 100644 --- a/src/object/collideweaponweapon.cpp +++ b/src/object/collideweaponweapon.cpp @@ -91,8 +91,8 @@ int collide_weapon_weapon( obj_pair * pair ) object *A = pair->a; object *B = pair->b; - Assert( A->type == OBJ_WEAPON ); - Assert( B->type == OBJ_WEAPON ); + SDL_assert( A->type == OBJ_WEAPON ); + SDL_assert( B->type == OBJ_WEAPON ); // Don't allow ship to shoot down its own missile. if (A->parent_sig == B->parent_sig) diff --git a/src/object/objcollide.cpp b/src/object/objcollide.cpp index ad0a4ce..90f8706 100644 --- a/src/object/objcollide.cpp +++ b/src/object/objcollide.cpp @@ -338,8 +338,8 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end ) return; } - Assert( A->type < 127 ); - Assert( B->type < 127 ); + SDL_assert( A->type < 127 ); + SDL_assert( B->type < 127 ); ctype = COLLISION_OF(A->type,B->type); switch( ctype ) { @@ -569,7 +569,7 @@ void obj_add_pair( object *A, object *B, int check_time, int add_to_end ) last = &pair_used_list; last->next = new_pair; - Assert(new_pair != NULL); + SDL_assert(new_pair != NULL); new_pair->next = NULL; } else { @@ -631,11 +631,11 @@ void obj_check_all_collisions() // Never check it again, so remove the pair removed = 1; tmp->a->num_pairs--; - Assert( tmp->a->num_pairs > -1 ); + SDL_assert( tmp->a->num_pairs > -1 ); tmp->b->num_pairs--; - Assert( tmp->b->num_pairs > -1 ); + SDL_assert( tmp->b->num_pairs > -1 ); Num_pairs--; - // Assert(Num_pairs >= 0); + // SDL_assert(Num_pairs >= 0); parent->next = tmp->next; tmp->a = tmp->b = NULL; tmp->next = pair_free_list.next; @@ -785,7 +785,7 @@ int vector_object_collision(vector *start_pos, vector *end_pos, object *objp, fl int weapon_will_never_hit( object *weapon, object *other, obj_pair * current_pair ) { - Assert( weapon->type == OBJ_WEAPON ); + SDL_assert( weapon->type == OBJ_WEAPON ); // mprintf(( "Frame: %d, Weapon=%d, Other=%d, pair=$%08x\n", G3_frame_count, OBJ_INDEX(weapon), OBJ_INDEX(other), current_pair )); @@ -952,7 +952,7 @@ int pp_collide(vector *curpos, vector *goalpos, object *goalobjp, float radius) { mc_info mc; - Assert(goalobjp->type == OBJ_SHIP); + SDL_assert(goalobjp->type == OBJ_SHIP); ship_model_start(goalobjp); @@ -1105,7 +1105,7 @@ int collide_remove_weapons( ) num_deleted = 0; for ( i = 0; i < MAX_WEAPONS; i++ ) { if ( crw_status[i] == CRW_CAN_DELETE ) { - Assert( Weapons[i].objnum != -1 ); + SDL_assert( Weapons[i].objnum != -1 ); obj_delete( Weapons[i].objnum ); num_deleted++; } diff --git a/src/object/object.cpp b/src/object/object.cpp index 39bcfa1..bde3cdf 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -741,7 +741,7 @@ int obj_allocate(void) // Find next available object objp = GET_FIRST(&obj_free_list); - Assert ( objp != &obj_free_list ); // shouldn't have the dummy element + SDL_assert ( objp != &obj_free_list ); // shouldn't have the dummy element // remove objp from the free list list_remove( &obj_free_list, objp ); @@ -778,7 +778,7 @@ void obj_free(int objnum) if (!Object_inited) obj_init(); - Assert( objnum >= 0 ); // Trying to free bogus object!!! + SDL_assert( objnum >= 0 ); // Trying to free bogus object!!! // get object pointer objp = &Objects[objnum]; @@ -794,7 +794,7 @@ void obj_free(int objnum) Objects[objnum].type = OBJ_NONE; - Assert(num_objects >= 0); + SDL_assert(num_objects >= 0); if (objnum == Highest_object_index) while (Objects[--Highest_object_index].type == OBJ_NONE); @@ -817,7 +817,7 @@ int obj_create(ubyte type,int parent_obj,int instance, matrix * orient, return -1; obj = &Objects[objnum]; - Assert(obj->type == OBJ_NONE); //make sure unused + SDL_assert(obj->type == OBJ_NONE); //make sure unused // Zero out object structure to keep weird bugs from happening // in uninitialized fields. @@ -876,9 +876,9 @@ void obj_delete(int objnum) { object *objp; - Assert(objnum >= 0 && objnum < MAX_OBJECTS); + SDL_assert(objnum >= 0 && objnum < MAX_OBJECTS); objp = &Objects[objnum]; - Assert(objp->type != OBJ_NONE); + SDL_assert(objp->type != OBJ_NONE); // Remove all object pairs obj_remove_pairs( objp ); @@ -919,7 +919,7 @@ void obj_delete(int objnum) case OBJ_WAYPOINT: case OBJ_POINT: case OBJ_JUMP_NODE: - Assert(Fred_running); + SDL_assert(Fred_running); break; // requires no action, handled by the Fred code. case OBJ_DEBRIS: debris_delete( objp ); @@ -1017,7 +1017,7 @@ void move_docked_objects(object *objp) if (objp->type != OBJ_SHIP) return; - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); aip = &Ai_info[Ships[objp->instance].ai_index]; @@ -1025,7 +1025,7 @@ void move_docked_objects(object *objp) ship_info *sip; sip = &Ship_info[Ships[objp->instance].ship_info_index]; if ((sip->flags & SIF_SUPPORT) || (sip->flags & SIF_CARGO)) { - Assert(!((sip->flags & SIF_SUPPORT) && (sip->flags & SIF_CARGO))); // Ship can't be both repair and cargo + SDL_assert(!((sip->flags & SIF_SUPPORT) && (sip->flags & SIF_CARGO))); // Ship can't be both repair and cargo if (aip->dock_objnum != -1) { if (aip->mode == AIM_DOCK) { if (aip->submode < AIS_UNDOCK_1) @@ -1044,7 +1044,7 @@ void move_docked_objects(object *objp) } } else { if (aip->dock_objnum != -1) { - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); other_aip = &Ai_info[Ships[Objects[aip->dock_objnum].instance].ai_index]; // if the other object that I am docked with is undocking, then don't do anything. @@ -1082,7 +1082,7 @@ void obj_player_fire_stuff( object *objp, control_info ci ) { ship *shipp; - Assert( objp->flags & OF_PLAYER_SHIP); + SDL_assert( objp->flags & OF_PLAYER_SHIP); // try and get the ship pointer shipp = NULL; @@ -1998,27 +1998,27 @@ int obj_get_SIF(int obj) // failure => -1 (for objects that don't have teams) int obj_team(object *objp) { - Assert( objp != NULL ); + SDL_assert( objp != NULL ); int team = -1; switch ( objp->type ) { case OBJ_SHIP: - Assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); + SDL_assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); team = Ships[objp->instance].team; break; case OBJ_DEBRIS: team = debris_get_team(objp); - Assert(team != -1); + SDL_assert(team != -1); break; case OBJ_CMEASURE: - Assert( objp->instance >= 0 && objp->instance < MAX_CMEASURES); + SDL_assert( objp->instance >= 0 && objp->instance < MAX_CMEASURES); team = Cmeasures[objp->instance].team; break; case OBJ_WEAPON: - Assert( objp->instance >= 0 && objp->instance < MAX_WEAPONS ); + SDL_assert( objp->instance >= 0 && objp->instance < MAX_WEAPONS ); team = Weapons[objp->instance].team; break; @@ -2046,7 +2046,7 @@ int obj_team(object *objp) break; } // end switch - Assert(team != -1); + SDL_assert(team != -1); return team; } @@ -2061,7 +2061,7 @@ void obj_add_pairs(int objnum) { object *objp; - Assert(objnum != -1); + SDL_assert(objnum != -1); objp = &Objects[objnum]; // don't do anything if its already in the object pair list @@ -2117,9 +2117,9 @@ void obj_remove_pairs( object * a ) // is equal to 'a' and we modify 'num_pairs' in one of these and then use the value // stored in 'a' later one... will the optimizer find that? Hmmm... tmp->a->num_pairs--; - Assert( tmp->a->num_pairs > -1 ); + SDL_assert( tmp->a->num_pairs > -1 ); tmp->b->num_pairs--; - Assert( tmp->b->num_pairs > -1 ); + SDL_assert( tmp->b->num_pairs > -1 ); parent->next = tmp->next; tmp->a = tmp->b = NULL; tmp->next = pair_free_list.next; diff --git a/src/object/objectsnd.cpp b/src/object/objectsnd.cpp index 3854059..d245270 100644 --- a/src/object/objectsnd.cpp +++ b/src/object/objectsnd.cpp @@ -341,9 +341,9 @@ DCF(objsnd, "Persistant sound stuff" ) Obj_snd_enabled = TRUE; } } - if ( !stricmp( Dc_arg, "list" )) { + if ( !SDL_strcasecmp( Dc_arg, "list" )) { for ( osp = GET_FIRST(&obj_snd_list); osp !=END_OF_LIST(&obj_snd_list); osp = GET_NEXT(osp) ) { - Assert(osp != NULL); + SDL_assert(osp != NULL); if ( osp->instance == -1 ) { continue; //strcpy(buf1,"OFF"); @@ -472,7 +472,7 @@ void obj_snd_stop(object *objp, int index) case OBJ_DEBRIS: case OBJ_ASTEROID: Num_obj_sounds_playing--; - Assert(Num_obj_sounds_playing >= 0); + SDL_assert(Num_obj_sounds_playing >= 0); break; default: @@ -497,7 +497,7 @@ void obj_snd_stop(object *objp, int index) case OBJ_DEBRIS: case OBJ_ASTEROID: Num_obj_sounds_playing--; - Assert(Num_obj_sounds_playing >= 0); + SDL_assert(Num_obj_sounds_playing >= 0); break; default: @@ -570,7 +570,7 @@ int obj_snd_stop_lowest_vol(float new_vol) lowest_vol = 1000.0f; for ( osp = GET_FIRST(&obj_snd_list); osp !=END_OF_LIST(&obj_snd_list); osp = GET_NEXT(osp) ) { - Assert(osp->objnum != -1); + SDL_assert(osp->objnum != -1); objp = &Objects[osp->objnum]; if ( (osp->instance != -1) && (osp->vol < lowest_vol) ) { @@ -579,7 +579,7 @@ int obj_snd_stop_lowest_vol(float new_vol) } } - Assert(lowest_vol_osp != NULL); + SDL_assert(lowest_vol_osp != NULL); objp = &Objects[lowest_vol_osp->objnum]; if ( (lowest_vol < new_vol) && (objp != NULL) ) { @@ -638,7 +638,7 @@ void maybe_play_flyby_snd(float closest_dist, object *closest_objp) goto play_no_flyby_sound; } - Assert(closest_objp->type == OBJ_SHIP); + SDL_assert(closest_objp->type == OBJ_SHIP); if(closest_objp->type != OBJ_SHIP){ return; } @@ -706,7 +706,7 @@ void obj_snd_do_frame() closest_objp = NULL; for ( osp = GET_FIRST(&obj_snd_list); osp !=END_OF_LIST(&obj_snd_list); osp = GET_NEXT(osp) ) { - Assert(osp != NULL); + SDL_assert(osp != NULL); objp = &Objects[osp->objnum]; if ( Player_obj == objp ) { continue; @@ -791,7 +791,7 @@ void obj_snd_do_frame() Num_obj_sounds_playing++; } } - Assert(Num_obj_sounds_playing <= MAX_OBJ_SOUNDS_PLAYING); + SDL_assert(Num_obj_sounds_playing <= MAX_OBJ_SOUNDS_PLAYING); } // end if ( distance < Snds[osp->id].max ) } // if ( osp->instance == -1 ) @@ -808,7 +808,7 @@ void obj_snd_do_frame() } } - Assert(sound_index != -1); + SDL_assert(sound_index != -1); obj_snd_stop(objp, sound_index); // currently playing sound has gone past maximum } } @@ -931,7 +931,7 @@ void obj_snd_delete(int objnum, int sndnum) obj_snd *osp; int idx; - Assert(objnum >= 0 && objnum < MAX_OBJECTS); + SDL_assert(objnum >= 0 && objnum < MAX_OBJECTS); objp = &Objects[objnum]; // delete all object sounds for this guy @@ -973,7 +973,7 @@ void obj_snd_delete_all() osp = GET_FIRST(&obj_snd_list); while( (osp != NULL) && (osp !=END_OF_LIST(&obj_snd_list)) ) { temp = GET_NEXT(osp); - Assert( osp->objnum != -1 ); + SDL_assert( osp->objnum != -1 ); obj_snd_delete( osp->objnum ); @@ -1015,7 +1015,7 @@ int obj_snd_is_playing(int index) if ( index == -1 ) return 0; - Assert( index >= 0 && index < MAX_OBJ_SNDS ); + SDL_assert( index >= 0 && index < MAX_OBJ_SNDS ); osp = &Objsnds[index]; if ( osp->instance == -1 ) @@ -1034,7 +1034,7 @@ int obj_snd_return_instance(int index) if ( index == -1 ) return -1; - Assert( index >= 0 && index < MAX_OBJ_SNDS ); + SDL_assert( index >= 0 && index < MAX_OBJ_SNDS ); return Objsnds[index].instance; } diff --git a/src/observer/observer.cpp b/src/observer/observer.cpp index 61939ec..cee7c1e 100644 --- a/src/observer/observer.cpp +++ b/src/observer/observer.cpp @@ -96,7 +96,7 @@ void observer_delete(object *obj) int num; num = obj->instance; - Assert( Observers[num].objnum == OBJ_INDEX(obj)); + SDL_assert( Observers[num].objnum == OBJ_INDEX(obj)); Observers[num].objnum = -1; Observers[num].target_objnum = -1; diff --git a/src/osapi/osapi.cpp b/src/osapi/osapi.cpp index 87aa6df..bfdb1f8 100644 --- a/src/osapi/osapi.cpp +++ b/src/osapi/osapi.cpp @@ -167,7 +167,7 @@ static int fAppActive = 1; //static int WinX, WinY, WinW, WinH; // not used (grsoft.cpp) in UNIX build static int Os_inited = 0; -static CRITICAL_SECTION Os_lock; +static SDL_mutex *Os_lock; int Os_debugger_running = 0; @@ -256,13 +256,13 @@ void os_sleep(int ms) // Used to stop message processing void os_suspend() { - ENTER_CRITICAL_SECTION(&Os_lock); + SDL_LockMutex(Os_lock); } // resume message processing void os_resume() { - LEAVE_CRITICAL_SECTION(&Os_lock); + SDL_UnlockMutex(Os_lock); } @@ -417,5 +417,5 @@ void os_poll() void debug_int3() { - STUB_FUNCTION; + SDL_TriggerBreakpoint(); } diff --git a/src/osapi/outwnd.cpp b/src/osapi/outwnd.cpp index 3dca43e..5ebd97b 100644 --- a/src/osapi/outwnd.cpp +++ b/src/osapi/outwnd.cpp @@ -126,7 +126,7 @@ * * 37 8/22/97 3:42p Hoffoss * Lowered the filter limit to 24, and added support for filter recycling, - * instead of the rather nasty Assert if we should happen to exceed this + * instead of the rather nasty SDL_assert if we should happen to exceed this * limit. * * 36 8/05/97 4:29p Dave @@ -252,14 +252,14 @@ void load_filter_info(void) if (inbuf[z] == '\n') inbuf[z] = 0; - Assert(strlen(inbuf+1) < FILTER_NAME_LENGTH); + SDL_assert(strlen(inbuf+1) < FILTER_NAME_LENGTH); strcpy(outwnd_filter[outwnd_filter_count]->name, inbuf + 1); - if ( !stricmp( outwnd_filter[outwnd_filter_count]->name, "error" ) ) { + if ( !SDL_strcasecmp( outwnd_filter[outwnd_filter_count]->name, "error" ) ) { outwnd_filter[outwnd_filter_count]->state = 1; - } else if ( !stricmp( outwnd_filter[outwnd_filter_count]->name, "general" ) ) { + } else if ( !SDL_strcasecmp( outwnd_filter[outwnd_filter_count]->name, "general" ) ) { outwnd_filter[outwnd_filter_count]->state = 1; - } else if ( !stricmp( outwnd_filter[outwnd_filter_count]->name, "warning" ) ) { + } else if ( !SDL_strcasecmp( outwnd_filter[outwnd_filter_count]->name, "warning" ) ) { outwnd_filter[outwnd_filter_count]->state = 1; } @@ -348,7 +348,7 @@ void outwnd_print(const char *id, const char *tmp) id = "General"; for (i=0; iname)) + if (!SDL_strcasecmp(id, outwnd_filter[i]->name)) break; @@ -360,14 +360,14 @@ void outwnd_print(const char *id, const char *tmp) } if (outwnd_filter_count >= MAX_FILTERS) { - Assert(outwnd_filter_count == MAX_FILTERS); // how did it get over the max? Very bad.. + SDL_assert(outwnd_filter_count == MAX_FILTERS); // how did it get over the max? Very bad.. outwnd_printf("General", "Outwnd filter limit reached. Recycling \"%s\" to add \"%s\"", outwnd_filter[MAX_FILTERS - 1]->name, id); i--; // overwrite the last element (oldest used filter in the list) } - Assert(strlen(id) < FILTER_NAME_LENGTH); + SDL_assert(strlen(id) < FILTER_NAME_LENGTH); outwnd_filter[i] = &real_outwnd_filter[i]; // note: this assumes the list doesn't have gaps (from deleting an element for example) strcpy(outwnd_filter[i]->name, id); outwnd_filter[i]->state = 1; diff --git a/src/palman/palman.cpp b/src/palman/palman.cpp index 372cfe2..600424f 100644 --- a/src/palman/palman.cpp +++ b/src/palman/palman.cpp @@ -367,7 +367,7 @@ void palette_load_table( const char * filename ) Error( LOCATION, "Can't open palette file <%s>",palette_base_filename); fsize = cfilelength( fp ); - Assert( fsize == 9472 ); + SDL_assert( fsize == 9472 ); cfread( palette_org, 256*3, 1, fp ); cfclose(fp); @@ -703,7 +703,7 @@ void palette_flush() { // DB 2/3/99 - I think this was causing some wacky unhandled exceptions at game shutdown. Since we don't use palettes anymore..... /* - if ( stricmp( palette_name, "none" ) ) { + if ( SDL_strcasecmp( palette_name, "none" ) ) { palette_write_cached1( palette_name ); } */ @@ -740,7 +740,7 @@ void palette_update(const char *name_with_extension, int restrict_font_to_128) palette_fade_table_calculated = 0; // For "none" palettes, don't calculate tables - if ( !stricmp( name, "none" ) ) { + if ( !SDL_strcasecmp( name, "none" ) ) { bm_update(); // update the bitmap palette's return; } diff --git a/src/parse/parselo.cpp b/src/parse/parselo.cpp index 8fd0a49..0590a47 100644 --- a/src/parse/parselo.cpp +++ b/src/parse/parselo.cpp @@ -89,7 +89,7 @@ * account for some new foreign chars * * 94 6/12/98 7:37p Hoffoss - * Made ß translate to ss, since we don't have this character in our font. + * Made � translate to ss, since we don't have this character in our font. * * 93 6/12/98 4:52p Hoffoss * Added support for special characters in in forgeign languages. @@ -277,7 +277,7 @@ int get_line_num() while (p < stoploc) { if (*p == EOF_CHAR) - Assert(0); + SDL_assert(0); if ( !incomment && (*p == COMMENT_CHAR) ) incomment = 1; @@ -333,7 +333,7 @@ void error_display(int error_level, const char *format, ...) va_start(args, format); vsprintf(buffer, format, args); va_end(args); - Assert(strlen(buffer) < 1024); + SDL_assert(strlen(buffer) < 1024); nprintf((error_text, "%s", buffer)); Warning(LOCATION, "%s(%i):\n%s: %s", Current_filename, get_line_num(), error_text, buffer); @@ -344,7 +344,7 @@ void advance_to_eoln(const char *more_terminators) { char terminators[128]; - Assert((more_terminators == NULL) || (strlen(more_terminators) < 125)); + SDL_assert((more_terminators == NULL) || (strlen(more_terminators) < 125)); terminators[0] = EOLN; terminators[1] = (char)EOF_CHAR; @@ -384,11 +384,11 @@ int skip_to_string(const char *pstr, const char *end) if (end) len2 = strlen(end); - while ((*Mp != EOF_CHAR) && strnicmp(pstr, Mp, len)) { + while ((*Mp != EOF_CHAR) && SDL_strncasecmp(pstr, Mp, len)) { if (end && *Mp == '#') return 0; - if (end && !strnicmp(pstr, Mp, len2)) + if (end && !SDL_strncasecmp(pstr, Mp, len2)) return -1; advance_to_eoln(NULL); @@ -411,7 +411,7 @@ int skip_to_start_of_strings(const char *pstr1, const char *pstr2) len1 = strlen(pstr1); len2 = strlen(pstr2); - while ( (*Mp != EOF_CHAR) && strnicmp(pstr1, Mp, len1) && strnicmp(pstr2, Mp, len2) ) { + while ( (*Mp != EOF_CHAR) && SDL_strncasecmp(pstr1, Mp, len1) && SDL_strncasecmp(pstr2, Mp, len2) ) { advance_to_eoln(NULL); ignore_white_space(); } @@ -434,7 +434,7 @@ int required_string(const char *pstr) ignore_white_space(); - while (strnicmp(pstr, Mp, strlen(pstr)) && (count < RS_MAX_TRIES)) { + while (SDL_strncasecmp(pstr, Mp, strlen(pstr)) && (count < RS_MAX_TRIES)) { error_display(1, "Required token = [%s], found [%.32s].\n", pstr, next_tokens()); advance_to_eoln(NULL); ignore_white_space(); @@ -459,7 +459,7 @@ int check_for_string(const char *pstr) { ignore_white_space(); - if (!strnicmp(pstr, Mp, strlen(pstr))) + if (!SDL_strncasecmp(pstr, Mp, strlen(pstr))) return 1; return 0; @@ -468,7 +468,7 @@ int check_for_string(const char *pstr) // like check for string, but doesn't skip past any whitespace int check_for_string_raw(const char *pstr) { - if (!strnicmp(pstr, Mp, strlen(pstr))){ + if (!SDL_strncasecmp(pstr, Mp, strlen(pstr))){ return 1; } @@ -482,7 +482,7 @@ int optional_string(const char *pstr) { ignore_white_space(); - if (!strnicmp(pstr, Mp, strlen(pstr))) { + if (!SDL_strncasecmp(pstr, Mp, strlen(pstr))) { Mp += strlen(pstr); return 1; } @@ -499,8 +499,8 @@ int required_string_fred(const char *pstr, const char *end) return 0; ignore_white_space(); - while (*Mp != EOF_CHAR && strnicmp(pstr, Mp, strlen(pstr))) { - if ((*Mp == '#') || (end && !strnicmp(end, Mp, strlen(end)))) { + while (*Mp != EOF_CHAR && SDL_strncasecmp(pstr, Mp, strlen(pstr))) { + if ((*Mp == '#') || (end && !SDL_strncasecmp(end, Mp, strlen(end)))) { Mp = NULL; break; } @@ -536,9 +536,9 @@ int optional_string_fred(const char *pstr, const char *end, const char *end2) return 0; ignore_white_space(); - while ((*Mp != EOF_CHAR) && strnicmp(pstr, Mp, strlen(pstr))) { - if ((*Mp == '#') || (end && !strnicmp(end, Mp, strlen(end))) || - (end2 && !strnicmp(end2, Mp, strlen(end2)))) { + while ((*Mp != EOF_CHAR) && SDL_strncasecmp(pstr, Mp, strlen(pstr))) { + if ((*Mp == '#') || (end && !SDL_strncasecmp(end, Mp, strlen(end))) || + (end2 && !SDL_strncasecmp(end2, Mp, strlen(end2)))) { Mp = NULL; break; } @@ -570,11 +570,11 @@ int required_string_either(const char *str1, const char *str2) ignore_white_space(); while (count < RS_MAX_TRIES) { - if (strnicmp(str1, Mp, strlen(str1)) == 0) { + if (SDL_strncasecmp(str1, Mp, strlen(str1)) == 0) { // Mp += strlen(str1); diag_printf("Found required string [%s]\n", token_found = str1); return 0; - } else if (strnicmp(str2, Mp, strlen(str2)) == 0) { + } else if (SDL_strncasecmp(str2, Mp, strlen(str2)) == 0) { // Mp += strlen(str2); diag_printf("Found required string [%s]\n", token_found = str2); return 1; @@ -607,15 +607,15 @@ int required_string_3(const char *str1, const char *str2, const char *str3) ignore_white_space(); while (count < RS_MAX_TRIES) { - if (strnicmp(str1, Mp, strlen(str1)) == 0) { + if (SDL_strncasecmp(str1, Mp, strlen(str1)) == 0) { // Mp += strlen(str1); diag_printf("Found required string [%s]\n", token_found = str1); return 0; - } else if (strnicmp(str2, Mp, strlen(str2)) == 0) { + } else if (SDL_strncasecmp(str2, Mp, strlen(str2)) == 0) { // Mp += strlen(str2); diag_printf("Found required string [%s]\n", token_found = str2); return 1; - } else if (strnicmp(str3, Mp, strlen(str3)) == 0) { + } else if (SDL_strncasecmp(str3, Mp, strlen(str3)) == 0) { diag_printf("Found required string [%s]\n", token_found = str3); return 2; } @@ -636,12 +636,12 @@ int required_string_either_fred(const char *str1, const char *str2) ignore_white_space(); while (*Mp != EOF_CHAR) { - if (!strnicmp(str1, Mp, strlen(str1))) { + if (!SDL_strncasecmp(str1, Mp, strlen(str1))) { // Mp += strlen(str1); diag_printf("Found required string [%s]\n", token_found = str1); return fred_parse_flag = 0; - } else if (!strnicmp(str2, Mp, strlen(str2))) { + } else if (!SDL_strncasecmp(str2, Mp, strlen(str2))) { // Mp += strlen(str2); diag_printf("Found required string [%s]\n", token_found = str2); return fred_parse_flag = 1; @@ -666,7 +666,7 @@ void copy_to_eoln(char *outstr, const char *more_terminators, const char *instr, char ch; char terminators[128]; - Assert((more_terminators == NULL) || (strlen(more_terminators) < 125)); + SDL_assert((more_terminators == NULL) || (strlen(more_terminators) < 125)); terminators[0] = EOLN; terminators[1] = (char)EOF_CHAR; @@ -831,7 +831,7 @@ void stuff_string(char *pstr, int type, const char *terminators, int len) break; default: - Assert(0); + SDL_assert(0); } // now we want to do any final localization @@ -888,7 +888,7 @@ char *stuff_and_malloc_string( int type, const char *terminators, int len) drop_white_space(tmp_result); l = strlen(tmp_result); - Assert(l < MAX_TMP_STRING_LENGTH); // Get John!! + SDL_assert(l < MAX_TMP_STRING_LENGTH); // Get John!! if (l < 1) return NULL; @@ -1175,7 +1175,7 @@ void read_file_text(const char *filename, int mode) int unscrambled_len; char *scrambled_text; scrambled_text = (char*)malloc(file_len+1); - Assert(scrambled_text); + SDL_assert(scrambled_text); cfread(scrambled_text, file_len, 1, mf); // unscramble text unencrypt(scrambled_text, file_len, Mission_text_raw, &unscrambled_len); @@ -1189,7 +1189,7 @@ void read_file_text(const char *filename, int mode) // If you hit this assert, it is probably telling you the obvious. The file // you are trying to read is truly too large. Look at *filename to see the file name. - Assert(file_len < MISSION_TEXT_SIZE); + SDL_assert(file_len < MISSION_TEXT_SIZE); // strip comments from raw text, reading into Mission_text @@ -1231,7 +1231,7 @@ void read_file_text(const char *filename, int mode) // If you hit this assert, it is probably telling you the obvious. The file // you are trying to read is truly too large. Look at *filename to see the file name. - Assert(mp2 - Mission_text_raw + strlen(outbuf) < MISSION_TEXT_SIZE); + SDL_assert(mp2 - Mission_text_raw + strlen(outbuf) < MISSION_TEXT_SIZE); strcpy(mp2, outbuf); mp2 += strlen(outbuf); @@ -1347,14 +1347,14 @@ void stuff_boolean(int *i) *i = 0; } else { - if ( !stricmp(token, "yes") ) { + if ( !SDL_strcasecmp(token, "yes") ) { *i = 1; } - else if ( !stricmp(token, "no") ) { + else if ( !SDL_strcasecmp(token, "no") ) { *i = 0; } else - Assert(0); // can't happen + SDL_assert(0); // can't happen } } @@ -1397,7 +1397,7 @@ int stuff_string_list(char slp[][NAME_LENGTH], int max_strings) while (*Mp != ')') { assert ( count < max_strings ); - Assert ( *Mp == '\"' ); // should always be enclosed in quotes + SDL_assert ( *Mp == '\"' ); // should always be enclosed in quotes get_string( slp[count++] ); ignore_white_space(); @@ -1426,7 +1426,7 @@ int stuff_int_list(int *ilp, int max_ints, int lookup_type) ignore_white_space(); while (*Mp != ')') { - Assert(count < max_ints); + SDL_assert(count < max_ints); if (*Mp == '"') { int num = 0; char str[128]; @@ -1546,7 +1546,7 @@ void mark_int_list(int *ilp, int max_ints, int lookup_type) int tval; stuff_int(&tval); - Assert((tval >= 0) && (tval < max_ints)); + SDL_assert((tval >= 0) && (tval < max_ints)); ilp[tval] = 1; } @@ -1607,7 +1607,7 @@ int stuff_vector_list(vector *vlp, int max_vecs) ignore_white_space(); while (*Mp != ')') { - Assert(count < max_vecs); + SDL_assert(count < max_vecs); stuff_parenthesized_vector(&vlp[count++]); ignore_white_space(); @@ -1638,9 +1638,9 @@ int string_lookup(const char *str1, const char *strlist[], int max, const char * int i; for (i=0; i 0); + SDL_assert(src); + SDL_assert(max_pixel_w > 0); gr_get_string_size(&w, NULL, src); if ( w <= max_pixel_w ) @@ -1809,11 +1809,11 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, char **p_str, int int ignore_until_whitespace, buf_index; // check our assumptions.. - Assert(src != NULL); - Assert(n_chars != NULL); - Assert(p_str != NULL); - Assert(max_lines > 0); - Assert(max_pixel_w > 0); + SDL_assert(src != NULL); + SDL_assert(n_chars != NULL); + SDL_assert(p_str != NULL); + SDL_assert(max_lines > 0); + SDL_assert(max_pixel_w > 0); memset(buffer, 0, SPLIT_STR_BUFFER_SIZE); buf_index = 0; @@ -1897,7 +1897,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, char **p_str, int } n_chars[line_num] = end - p_str[line_num]; // track length of line - Assert(n_chars[line_num]); + SDL_assert(n_chars[line_num]); line_num++; p_str[line_num] = NULL; new_line = 1; @@ -1910,7 +1910,7 @@ int split_str(const char *src, int max_pixel_w, int *n_chars, char **p_str, int if (p_str[line_num]) { n_chars[line_num] = src - p_str[line_num]; // track length of line - Assert(n_chars[line_num]); + SDL_assert(n_chars[line_num]); line_num++; } diff --git a/src/parse/sexp.cpp b/src/parse/sexp.cpp index 085fa9f..8b60b28 100644 --- a/src/parse/sexp.cpp +++ b/src/parse/sexp.cpp @@ -35,7 +35,7 @@ * Stupid switch for sexp_team_score. Don't forget *break* * * 65 9/09/99 11:40p Dave - * Handle an Assert() in beam code. Added supernova sounds. Play the right + * Handle an SDL_assert() in beam code. Added supernova sounds. Play the right * 2 end movies properly, based upon what the player did in the mission. * * 64 9/07/99 1:05a Andsager @@ -681,10 +681,10 @@ void init_sexp() Locked_sexp_false = Locked_sexp_true = -1; Locked_sexp_false = alloc_sexp("false", SEXP_LIST, SEXP_ATOM_OPERATOR, -1, -1); - Assert(Locked_sexp_false != -1); + SDL_assert(Locked_sexp_false != -1); Sexp_nodes[Locked_sexp_false].type = SEXP_ATOM; // fix bypassing value Locked_sexp_true = alloc_sexp("true", SEXP_LIST, SEXP_ATOM_OPERATOR, -1, -1); - Assert(Locked_sexp_true != -1); + SDL_assert(Locked_sexp_true != -1); Sexp_nodes[Locked_sexp_true].type = SEXP_ATOM; // fix bypassing value } @@ -701,15 +701,15 @@ int alloc_sexp(const char *text, int type, int subtype, int first, int rest) } i = find_free_sexp(); - Assert(i != Locked_sexp_true); - Assert(i != Locked_sexp_false); + SDL_assert(i != Locked_sexp_true); + SDL_assert(i != Locked_sexp_false); if (i == MAX_SEXP_NODES){ return -1; } - Assert(strlen(text) < TOKEN_LENGTH); + SDL_assert(strlen(text) < TOKEN_LENGTH); strcpy(Sexp_nodes[i].text, text); - Assert(type >= 0); + SDL_assert(type >= 0); Sexp_nodes[i].type = type; Sexp_nodes[i].subtype = subtype; Sexp_nodes[i].first = first; @@ -755,7 +755,7 @@ int find_free_sexp() //count_free_sexp_nodes(); #endif - Assert(i != MAX_SEXP_NODES); // time to raise the limit.. + SDL_assert(i != MAX_SEXP_NODES); // time to raise the limit.. if (i == MAX_SEXP_NODES){ return -1; } @@ -776,7 +776,7 @@ void sexp_mark_persistent( int n ) return; } - Assert( !(Sexp_nodes[n].type & SEXP_FLAG_PERSISTENT) ); + SDL_assert( !(Sexp_nodes[n].type & SEXP_FLAG_PERSISTENT) ); Sexp_nodes[n].type |= SEXP_FLAG_PERSISTENT; sexp_mark_persistent(Sexp_nodes[n].first); @@ -795,7 +795,7 @@ void sexp_unmark_persistent( int n ) return; } - Assert( Sexp_nodes[n].type & SEXP_FLAG_PERSISTENT ); + SDL_assert( Sexp_nodes[n].type & SEXP_FLAG_PERSISTENT ); Sexp_nodes[n].type &= ~SEXP_FLAG_PERSISTENT; sexp_unmark_persistent(Sexp_nodes[n].first); @@ -805,8 +805,8 @@ void sexp_unmark_persistent( int n ) // just frees up the specified sexp node, Leaves link chains untouched. int free_one_sexp(int num) { - Assert(Sexp_nodes[num].type != SEXP_NOT_USED); // make sure it is actually used - Assert( !(Sexp_nodes[num].type & SEXP_FLAG_PERSISTENT) ); + SDL_assert(Sexp_nodes[num].type != SEXP_NOT_USED); // make sure it is actually used + SDL_assert( !(Sexp_nodes[num].type & SEXP_FLAG_PERSISTENT) ); if ((num == Locked_sexp_true) || (num == Locked_sexp_false)){ return 0; @@ -823,8 +823,8 @@ int free_sexp(int num) { int i, rest, count = 0; - Assert(Sexp_nodes[num].type != SEXP_NOT_USED); // make sure it is actually used - Assert( !(Sexp_nodes[num].type & SEXP_FLAG_PERSISTENT) ); + SDL_assert(Sexp_nodes[num].type != SEXP_NOT_USED); // make sure it is actually used + SDL_assert( !(Sexp_nodes[num].type & SEXP_FLAG_PERSISTENT) ); if ((num == Locked_sexp_true) || (num == Locked_sexp_false) || (num == -1) ){ return 0; @@ -947,7 +947,7 @@ int cmp_sexp_chains(int node1, int node2) } // DA: 1/7/99 Need to check the actual Sexp_node.text, not possible variable, which can be equal - if (stricmp(Sexp_nodes[node1].text, Sexp_nodes[node2].text)){ + if (SDL_strcasecmp(Sexp_nodes[node1].text, Sexp_nodes[node2].text)){ return 0; } @@ -1049,7 +1049,7 @@ int identify_operator(const char *token) int i; for (i=0; i= 0 && index < MAX_SEXP_NODES); - Assert(Sexp_nodes[index].type != SEXP_NOT_USED); + SDL_assert(index >= 0 && index < MAX_SEXP_NODES); + SDL_assert(Sexp_nodes[index].type != SEXP_NOT_USED); if (Sexp_nodes[index].subtype == SEXP_ATOM_NUMBER && return_type == OPR_BOOL) { // special case Mark seems to want supported - Assert(Sexp_nodes[index].first == -1); // only lists should have a first pointer + SDL_assert(Sexp_nodes[index].first == -1); // only lists should have a first pointer if (Sexp_nodes[index].rest != -1) // anything after the number? return SEXP_CHECK_NONOP_ARGS; // if so, it's a syntax error @@ -1126,7 +1126,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, index = Sexp_nodes[op_index].rest; while (index != -1) { type = query_operator_argument_type(op, argnum); - Assert(Sexp_nodes[index].type != SEXP_NOT_USED); + SDL_assert(Sexp_nodes[index].type != SEXP_NOT_USED); if (bad_index) *bad_index = index; @@ -1217,7 +1217,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, type2 = SEXP_ATOM_STRING; } else { - Assert(0); + SDL_assert(0); } switch (type) { @@ -1359,13 +1359,13 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, // check for the special "hull" value if ( (Operators[op].value == OP_SABOTAGE_SUBSYSTEM) || (Operators[op].value == OP_REPAIR_SUBSYSTEM) || (Operators[op].value == OP_SET_SUBSYSTEM_STRNGTH) ) { - if ( !stricmp( CTEXT(index), SEXP_HULL_STRING) ){ + if ( !SDL_strcasecmp( CTEXT(index), SEXP_HULL_STRING) ){ break; } } for (i=0; i= 0) { if (!query_sexp_ai_goal_valid(z, ship_num)){ @@ -1496,7 +1496,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, } for (i=0; i= Campaign.missions[Sexp_useful_number].level)) return SEXP_CHECK_INVALID_LEVEL; @@ -1580,7 +1580,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, || (Operators[op].value == OP_PREVIOUS_GOAL_TRUE) || (Operators[op].value == OP_PREVIOUS_GOAL_FALSE) || (Operators[op].value == OP_PREVIOUS_GOAL_INCOMPLETE) ) break; - if (!(*Mission_filename) || stricmp(Mission_filename, CTEXT(index))) + if (!(*Mission_filename) || SDL_strcasecmp(Mission_filename, CTEXT(index))) return SEXP_CHECK_INVALID_MISSION_NAME; } } @@ -1595,11 +1595,11 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, // otherwise, check the set of current goals if ( Fred_running && (mode == SEXP_MODE_CAMPAIGN) ) { z = find_parent_operator(index); - Assert(z >= 0); + SDL_assert(z >= 0); z = Sexp_nodes[z].rest; // first argument of operator should be mission name - Assert(z >= 0); + SDL_assert(z >= 0); for (i=0; i= 0); + SDL_assert(z >= 0); z = Sexp_nodes[z].rest; // first argument of operator should be mission name - Assert(z >= 0); + SDL_assert(z >= 0); for (i=0; i") ) + //if ( !SDL_strcasecmp(CTEXT(index), "") ) // return SEXP_CHECK_INVALID_MSG_SOURCE; - if ( stricmp(CTEXT(index), "")) // not a special token? + if ( SDL_strcasecmp(CTEXT(index), "")) // not a special token? if ((ship_name_lookup(CTEXT(index)) < 0) && (wing_name_lookup(CTEXT(index), 1) < 0)) // is it in the mission? if (Fred_running || mission_parse_ship_arrived(CTEXT(index))) // == 0 when still on arrival list return SEXP_CHECK_INVALID_MSG_SOURCE; @@ -1754,7 +1754,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; for (i = 0; i < NUM_SKILL_LEVELS; i++) { - if ( !stricmp(CTEXT(index), Skill_level_names(i, 0)) ) + if ( !SDL_strcasecmp(CTEXT(index), Skill_level_names(i, 0)) ) break; } if ( i == NUM_SKILL_LEVELS ) @@ -1766,7 +1766,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; for (i = 0; i < NUM_MEDALS; i++) { - if ( !stricmp(CTEXT(index), Medals[i].name) ) + if ( !SDL_strcasecmp(CTEXT(index), Medals[i].name) ) break; } @@ -1780,7 +1780,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; for (i = 0; i < Num_weapon_types; i++ ) { - if ( !stricmp(CTEXT(index), Weapon_info[i].name) ) + if ( !SDL_strcasecmp(CTEXT(index), Weapon_info[i].name) ) break; } @@ -1800,7 +1800,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; for (i = 0; i < Num_ship_types; i++ ) { - if ( !stricmp(CTEXT(index), Ship_info[i].name) ) + if ( !SDL_strcasecmp(CTEXT(index), Ship_info[i].name) ) break; } @@ -1813,7 +1813,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; for ( i = 0; i < NUM_HUD_GAUGES; i++ ) { - if ( !stricmp(CTEXT(index), HUD_gauge_text[i]) ) + if ( !SDL_strcasecmp(CTEXT(index), HUD_gauge_text[i]) ) break; } @@ -1828,7 +1828,7 @@ int check_sexp_syntax(int index, int return_type, int recursive, int *bad_index, return SEXP_CHECK_TYPE_MISMATCH; for ( i = 0; i < Num_jump_nodes; i++ ) { - if ( !stricmp(Jump_nodes[i].name, CTEXT(index)) ) + if ( !SDL_strcasecmp(Jump_nodes[i].name, CTEXT(index)) ) break; } @@ -1888,14 +1888,14 @@ void get_sexp_text_for_variable(char *text, char *token) // get variable name (up to '[' end_index = strcspn(token, "["); - Assert( (end_index != 0) && (end_index < TOKEN_LENGTH-1) ); + SDL_assert( (end_index != 0) && (end_index < TOKEN_LENGTH-1) ); strncpy(text, token, end_index); text[end_index] = '\0'; if ( !Fred_running ) { // freespace - get index into Sexp_variables array sexp_var_index = get_index_sexp_variable_name(text); - Assert(sexp_var_index != -1); + SDL_assert(sexp_var_index != -1); sprintf(text, "%d", sexp_var_index); } } @@ -1919,7 +1919,7 @@ int get_sexp(char *token) ignore_white_space(); while (*Mp != ')') { - Assert(*Mp != EOF_CHAR); + SDL_assert(*Mp != EOF_CHAR); if (*Mp == '(') { // Sexp list Mp++; @@ -1929,15 +1929,15 @@ int get_sexp(char *token) // Sexp string len = strcspn(Mp + 1, "\""); - Assert(Mp[len + 1] == '\"'); // hit EOF first (unterminated string) - Assert(len < TOKEN_LENGTH); // token is too long. + SDL_assert(Mp[len + 1] == '\"'); // hit EOF first (unterminated string) + SDL_assert(len < TOKEN_LENGTH); // token is too long. // check if string variable if ( *(Mp + 1) == SEXP_VARIABLE_CHAR ) { // reduce length by 1 for end \" int length = len - 1; - Assert(length < 2*TOKEN_LENGTH+2); + SDL_assert(length < 2*TOKEN_LENGTH+2); // start copying after skipping 1st char strncpy(token, Mp + 2, length); @@ -1964,8 +1964,8 @@ int get_sexp(char *token) Mp++; continue; } - Assert(*Mp != EOF_CHAR); - Assert(len < TOKEN_LENGTH - 1); + SDL_assert(*Mp != EOF_CHAR); + SDL_assert(len < TOKEN_LENGTH - 1); token[len++] = *Mp++; } @@ -1988,13 +1988,13 @@ int get_sexp(char *token) // update links if (count++) { - Assert(last != -1); + SDL_assert(last != -1); Sexp_nodes[last].rest = node; } else { start = node; } - Assert(node != -1); // ran out of nodes. Time to raise the MAX! + SDL_assert(node != -1); // ran out of nodes. Time to raise the MAX! last = node; ignore_white_space(); } @@ -2028,7 +2028,7 @@ int stuff_sexp_variable_list() ignore_white_space(); while (*Mp != ')') { - Assert(count < MAX_SEXP_VARIABLES); + SDL_assert(count < MAX_SEXP_VARIABLES); // get index - for debug stuff_int(&index); @@ -2047,11 +2047,11 @@ int stuff_sexp_variable_list() ignore_white_space(); - if (!stricmp(str_type, "number")) { + if (!SDL_strcasecmp(str_type, "number")) { type = SEXP_VARIABLE_NUMBER; - } else if (!stricmp(str_type, "string")) { + } else if (!SDL_strcasecmp(str_type, "string")) { type = SEXP_VARIABLE_STRING; - } else if (!stricmp(str_type, "block")) { + } else if (!SDL_strcasecmp(str_type, "block")) { type = SEXP_VARIABLE_BLOCK | SEXP_VARIABLE_BLOCK_EXP; } else { type = SEXP_VARIABLE_UNKNOWN; @@ -2062,7 +2062,7 @@ int stuff_sexp_variable_list() // check if variable name already exists if ( (type == SEXP_VARIABLE_NUMBER) || (type == SEXP_VARIABLE_STRING) ) { - Assert(get_index_sexp_variable_name(var_name) == -1); + SDL_assert(get_index_sexp_variable_name(var_name) == -1); } sexp_add_variable(default_value, var_name, type, index); @@ -2079,12 +2079,12 @@ void build_sexp_text_string(char *buffer, int node, int mode) if (Sexp_nodes[node].type & SEXP_FLAG_VARIABLE) { int sexp_variables_index = get_index_sexp_variable_name(Sexp_nodes[node].text); - Assert(sexp_variables_index != -1); - Assert( (Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_NUMBER) || (Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_STRING) ); + SDL_assert(sexp_variables_index != -1); + SDL_assert( (Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_NUMBER) || (Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_STRING) ); // number if (Sexp_nodes[node].subtype == SEXP_ATOM_NUMBER) { - Assert(Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_NUMBER); + SDL_assert(Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_NUMBER); // Error check - can be Fred or Freespace if (mode == SEXP_ERROR_CHECK_MODE) { @@ -2095,13 +2095,13 @@ void build_sexp_text_string(char *buffer, int node, int mode) } } else { // Save as string - only Fred - Assert(mode == SEXP_SAVE_MODE); + SDL_assert(mode == SEXP_SAVE_MODE); sprintf(buffer, "@%s[%s] ", Sexp_nodes[node].text, Sexp_variables[sexp_variables_index].text); } } else { // string - Assert(Sexp_nodes[node].subtype == SEXP_ATOM_STRING); - Assert(Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_STRING); + SDL_assert(Sexp_nodes[node].subtype == SEXP_ATOM_STRING); + SDL_assert(Sexp_variables[sexp_variables_index].type & SEXP_VARIABLE_STRING); // Error check - can be Fred or Freespace if (mode == SEXP_ERROR_CHECK_MODE) { @@ -2112,7 +2112,7 @@ void build_sexp_text_string(char *buffer, int node, int mode) } } else { // Save as string - only Fred - Assert(mode == SEXP_SAVE_MODE); + SDL_assert(mode == SEXP_SAVE_MODE); sprintf(buffer, "\"@%s[%s]\" ", Sexp_nodes[node].text, Sexp_variables[sexp_variables_index].text); } } @@ -2138,7 +2138,7 @@ int build_sexp_string(int cur_node, int level, int mode) strcat(Sexp_string, "( "); node = cur_node; while (node != -1) { - Assert(node >= 0 && node < MAX_SEXP_NODES); + SDL_assert(node >= 0 && node < MAX_SEXP_NODES); if (Sexp_nodes[node].first == -1) { // build text to string build_sexp_text_string(pstr, node, mode); @@ -2175,7 +2175,7 @@ void build_extended_sexp_string(int cur_node, int level, int mode) strcat(Sexp_string, " "); flag = 1; - Assert(node >= 0 && node < MAX_SEXP_NODES); + SDL_assert(node >= 0 && node < MAX_SEXP_NODES); if (Sexp_nodes[node].first == -1) { build_sexp_text_string(pstr,node, mode); strcat(Sexp_string, pstr); @@ -2613,7 +2613,7 @@ int sexp_is_destroyed(int n, fix *latest_time) int count, num_destroyed, wing_index; fix time; - Assert ( n != -1 ); + SDL_assert ( n != -1 ); count = 0; num_destroyed = 0; @@ -2665,7 +2665,7 @@ int sexp_is_subsystem_destroyed(int n) { char *ship_name, *subsys_name; - Assert( n != -1 ); + SDL_assert( n != -1 ); ship_name = CTEXT(n); subsys_name = CTEXT(CDR(n)); @@ -2697,7 +2697,7 @@ int sexp_has_docked(int n) if (sexp_query_has_yet_to_arrive(dockee)) return SEXP_CANT_EVAL; - Assert ( count > 0 ); + SDL_assert ( count > 0 ); if ( mission_log_get_time(LOG_SHIP_DESTROYED, docker, NULL, NULL) || mission_log_get_time(LOG_SHIP_DESTROYED, dockee, NULL, NULL) ) return SEXP_KNOWN_FALSE; @@ -2720,7 +2720,7 @@ int sexp_has_undocked(int n) if (sexp_query_has_yet_to_arrive(dockee)) return SEXP_CANT_EVAL; - Assert ( count > 0 ); + SDL_assert ( count > 0 ); if ( !mission_log_get_time_indexed(LOG_SHIP_UNDOCK, docker, dockee, count, NULL) ) { // if either ship destroyed before they dock, then sexp is known false if ( mission_log_get_time(LOG_SHIP_DESTROYED, docker, NULL, NULL) || mission_log_get_time(LOG_SHIP_DESTROYED, dockee, NULL, NULL) ) @@ -2893,7 +2893,7 @@ int sexp_is_destroyed_delay(int n) fix delay, time; int val; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); time = 0; @@ -2921,7 +2921,7 @@ int sexp_is_subsystem_destroyed_delay( int n ) char *ship_name, *subsys_name; fix delay, time; - Assert( n != -1 ); + SDL_assert( n != -1 ); ship_name = CTEXT(n); subsys_name = CTEXT(CDR(n)); @@ -2947,7 +2947,7 @@ int sexp_is_disabled_delay( int n ) fix delay, time; int val; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); time = 0; delay = i2f(atoi(CTEXT(n))); @@ -2973,7 +2973,7 @@ int sexp_is_disarmed_delay( int n ) fix delay, time; int val; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); time = 0; delay = i2f(atoi(CTEXT(n))); @@ -3002,7 +3002,7 @@ int sexp_has_docked_delay( int n ) fix delay = i2f(atoi(CTEXT(CDR(CDR(CDR(n)))))); fix time; - Assert ( count > 0 ); + SDL_assert ( count > 0 ); if ( mission_log_get_time(LOG_SHIP_DESTROYED, docker, NULL, NULL) || mission_log_get_time(LOG_SHIP_DESTROYED, dockee, NULL, NULL) ) return SEXP_KNOWN_FALSE; @@ -3035,7 +3035,7 @@ int sexp_has_undocked_delay( int n ) if (sexp_query_has_yet_to_arrive(dockee)) return SEXP_CANT_EVAL; - Assert ( count > 0 ); + SDL_assert ( count > 0 ); if ( !mission_log_get_time_indexed(LOG_SHIP_UNDOCK, docker, dockee, count, &time) ) { // if either ship destroyed before they dock, then sexp is known false if ( mission_log_get_time(LOG_SHIP_DESTROYED, docker, NULL, NULL) || mission_log_get_time(LOG_SHIP_DESTROYED, dockee, NULL, NULL) ) @@ -3055,7 +3055,7 @@ int sexp_has_arrived_delay( int n ) fix delay, time; int val; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); time = 0; delay = i2f(atoi(CTEXT(n))); @@ -3081,7 +3081,7 @@ int sexp_has_departed_delay( int n ) fix delay, time; int val; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); time = 0; delay = i2f(atoi(CTEXT(n))); @@ -3146,7 +3146,7 @@ int sexp_ship_type_destroyed( int n ) shiptype = CTEXT(CDR(n)); for ( type = 0; type < MAX_SHIP_TYPE_COUNTS; type++ ) { - if ( !stricmp( Ship_type_names[type], shiptype) ) + if ( !SDL_strcasecmp( Ship_type_names[type], shiptype) ) break; } @@ -3210,7 +3210,7 @@ int sexp_special_warp_dist( int n) return SEXP_NAN; } - Assert( (Ships[shipnum].special_warp_objnum >= 0) && (Ships[shipnum].special_warp_objnum < MAX_OBJECTS)); + SDL_assert( (Ships[shipnum].special_warp_objnum >= 0) && (Ships[shipnum].special_warp_objnum < MAX_OBJECTS)); if ( (Ships[shipnum].special_warp_objnum < 0) && (Ships[shipnum].special_warp_objnum >= MAX_OBJECTS) ) { return SEXP_NAN; } @@ -3275,7 +3275,7 @@ int sexp_time_docked(int n) char *dockee = CTEXT(CDR(n)); int count = atoi(CTEXT(CDR(CDR(n)))); - Assert ( count > 0 ); + SDL_assert ( count > 0 ); if ( !mission_log_get_time_indexed(LOG_SHIP_DOCK, docker, dockee, count, &time) ){ return SEXP_NAN; } @@ -3290,7 +3290,7 @@ int sexp_time_undocked(int n) char *dockee = CTEXT(CDR(n)); int count = atoi(CTEXT(CDR(CDR(n)))); - Assert ( count > 0 ); + SDL_assert ( count > 0 ); if ( !mission_log_get_time_indexed(LOG_SHIP_UNDOCK, docker, dockee, count, &time) ){ return SEXP_NAN; } @@ -3302,7 +3302,7 @@ int sexp_time_ship_arrived(int n) { fix time; - Assert( n != -1 ); + SDL_assert( n != -1 ); if ( !mission_log_get_time( LOG_SHIP_ARRIVE, CTEXT(n), NULL, &time ) ){ return SEXP_NAN; } @@ -3314,7 +3314,7 @@ int sexp_time_wing_arrived(int n) { fix time; - Assert( n != -1 ); + SDL_assert( n != -1 ); if ( !mission_log_get_time( LOG_WING_ARRIVE, CTEXT(n), NULL, &time ) ){ return SEXP_NAN; } @@ -3326,7 +3326,7 @@ int sexp_time_ship_departed(int n) { fix time; - Assert( n != -1 ); + SDL_assert( n != -1 ); if ( !mission_log_get_time( LOG_SHIP_DEPART, CTEXT(n), NULL, &time ) ){ return SEXP_NAN; } @@ -3338,7 +3338,7 @@ int sexp_time_wing_departed(int n) { fix time; - Assert( n != -1 ); + SDL_assert( n != -1 ); if ( !mission_log_get_time( LOG_WING_DEPART, CTEXT(n), NULL, &time ) ){ return SEXP_NAN; } @@ -3501,7 +3501,7 @@ int sexp_hits_left_subsystem(int n) ss = GET_FIRST( &Ships[shipnum].subsys_list ); while ( ss != END_OF_LIST( &Ships[shipnum].subsys_list ) ) { - if ( !stricmp(ss->system_info->subobj_name, subsys_name)) { + if ( !SDL_strcasecmp(ss->system_info->subobj_name, subsys_name)) { percent = (int) (ss->current_hits / ss->system_info->max_hits * 100.0f); return percent; } @@ -3523,15 +3523,15 @@ int sexp_determine_team(char *subj) { int team = 0; - if (!stricmp(subj, "")){ + if (!SDL_strcasecmp(subj, "")){ team = TEAM_FRIENDLY; - } else if (!stricmp(subj, "")){ + } else if (!SDL_strcasecmp(subj, "")){ team = TEAM_HOSTILE; - } else if (!stricmp(subj, "")){ + } else if (!SDL_strcasecmp(subj, "")){ team = TEAM_NEUTRAL; - } else if (!stricmp(subj, "")){ + } else if (!SDL_strcasecmp(subj, "")){ team = TEAM_UNKNOWN; - } else if (!stricmp(subj, "")){ + } else if (!SDL_strcasecmp(subj, "")){ team = TEAM_TRAITOR; } @@ -3709,7 +3709,7 @@ int sexp_last_order_time( int n ) ai_goals *aigp; time = i2f(atoi(CTEXT(n))); - Assert ( time >= 0 ); + SDL_assert ( time >= 0 ); n = CDR(n); while ( n != -1 ) { @@ -3768,7 +3768,7 @@ int sexp_skill_level_at_least( int n ) level_name = CTEXT(n); for (i = 0; i < NUM_SKILL_LEVELS; i++ ) { - if ( !stricmp(level_name, Skill_level_names(i, 0)) ) { + if ( !SDL_strcasecmp(level_name, Skill_level_names(i, 0)) ) { if ( Game_skill_level >= i ){ return 1; } else { @@ -3803,7 +3803,7 @@ int sexp_was_medal_granted(int n) medal_name = CTEXT(n); for (i=0; i= 0 ); + SDL_assert ( n >= 0 ); count = 0; num_known = 0; @@ -4074,7 +4074,7 @@ int sexp_has_been_tagged_delay(int n) int count, shipnum, num_known, delay; char *name; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); count = 0; num_known = 0; @@ -4218,7 +4218,7 @@ int waypoint_lookup(char *name) if (ptr->type == OBJ_WAYPOINT) { i = ptr->instance; sprintf(buf, "%s:%d", Waypoint_lists[i / 65536].name, (i & 0xffff) + 1); - if ( !stricmp(buf, name) ) + if ( !SDL_strcasecmp(buf, name) ) return OBJ_INDEX(ptr); } @@ -4235,7 +4235,7 @@ int eval_when(int n) { int cond, val; - Assert( n >= 0 ); // must have valid sexp index + SDL_assert( n >= 0 ); // must have valid sexp index cond = CAR(n); val = eval_sexp(cond); // get the value of the the conditional @@ -4265,7 +4265,7 @@ int eval_cond( int n ) { int cond = 0, node, val = 0; - Assert (n >= 0); + SDL_assert (n >= 0); while (n >= 0) { node = CAR(n); cond = CAR(node); @@ -4301,20 +4301,20 @@ int sexp_is_iff( int n ) char *ship_name, *iff; int num, team; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); // iff value is the first parameter, second is a list of one or more ships to check to see if the // iff value matches iff = CTEXT(n); - if ( !stricmp(iff, "friendly") ) + if ( !SDL_strcasecmp(iff, "friendly") ) team = TEAM_FRIENDLY; - else if ( !stricmp(iff, "hostile") ) + else if ( !SDL_strcasecmp(iff, "hostile") ) team = TEAM_HOSTILE; - else if ( !stricmp(iff, "neutral") ) + else if ( !SDL_strcasecmp(iff, "neutral") ) team = TEAM_NEUTRAL; - else if ( !stricmp(iff, "unknown") ) + else if ( !SDL_strcasecmp(iff, "unknown") ) team = TEAM_UNKNOWN; - else if ( !stricmp(iff, "traitor") ) + else if ( !SDL_strcasecmp(iff, "traitor") ) team = TEAM_TRAITOR; else { Int3(); @@ -4345,17 +4345,17 @@ void sexp_change_iff( int n ) char *ship_name, *new_iff; int num, new_team; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); new_iff = CTEXT(n); - if ( !stricmp(new_iff, "friendly") ) + if ( !SDL_strcasecmp(new_iff, "friendly") ) new_team = TEAM_FRIENDLY; - else if ( !stricmp(new_iff, "hostile") ) + else if ( !SDL_strcasecmp(new_iff, "hostile") ) new_team = TEAM_HOSTILE; - else if ( !stricmp(new_iff, "neutral") ) + else if ( !SDL_strcasecmp(new_iff, "neutral") ) new_team = TEAM_NEUTRAL; - else if ( !stricmp(new_iff, "unknown") ) + else if ( !SDL_strcasecmp(new_iff, "unknown") ) new_team = TEAM_UNKNOWN; - else if ( !stricmp(new_iff, "traitor") ) + else if ( !SDL_strcasecmp(new_iff, "traitor") ) new_team = TEAM_TRAITOR; else { mprintf(("Warning: Team %s no longer supported. Just Friendly and Hostile.\n", new_iff)); @@ -4392,7 +4392,7 @@ void sexp_add_ship_goal( int n ) int num, sindex; char *ship_name; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); ship_name = CTEXT(n); num = ship_name_lookup(ship_name); if ( num < 0 ) // ship not around anymore???? then forget it! @@ -4408,7 +4408,7 @@ void sexp_add_wing_goal( int n ) int num, sindex; char *wing_name; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); wing_name = CTEXT(n); num = wing_name_lookup(wing_name); if ( num < 0 ) // ship not around anymore???? then forget it! @@ -4425,7 +4425,7 @@ void sexp_add_goal( int n ) int num, sindex; char *name; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); name = CTEXT(n); sindex = CDR(n); @@ -4443,7 +4443,7 @@ void sexp_clear_ship_goals( int n ) int num; char *ship_name; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); ship_name = CTEXT(n); num = ship_name_lookup(ship_name); ai_clear_ship_goals( &(Ai_info[Ships[num].ai_index]) ); @@ -4455,7 +4455,7 @@ void sexp_clear_wing_goals( int n ) int num; char *wing_name; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); wing_name = CTEXT(n); num = wing_name_lookup(wing_name); if ( num < 0 ) @@ -4469,7 +4469,7 @@ void sexp_clear_goals( int n ) int num; char *name; - Assert ( n >= 0 ); + SDL_assert ( n >= 0 ); while ( n != -1 ) { name = CTEXT(n); if ( (num = ship_name_lookup(name)) != -1 ) @@ -4493,11 +4493,11 @@ void sexp_send_one_message( char *name, char *who_from, char *priority, int grou } // determine the priority of the message - if ( !stricmp(priority, "low") ) + if ( !SDL_strcasecmp(priority, "low") ) ipriority = MESSAGE_PRIORITY_LOW; - else if ( !stricmp(priority, "normal") ) + else if ( !SDL_strcasecmp(priority, "normal") ) ipriority = MESSAGE_PRIORITY_NORMAL; - else if ( !stricmp(priority, "high") ) + else if ( !SDL_strcasecmp(priority, "high") ) ipriority = MESSAGE_PRIORITY_HIGH; else { Int3(); @@ -4513,7 +4513,7 @@ void sexp_send_one_message( char *name, char *who_from, char *priority, int grou if ( who_from[0] == '#' ) { message_send_unique_to_player( name, &(who_from[1]), MESSAGE_SOURCE_SPECIAL, ipriority, group, delay ); return; - } else if (!stricmp(who_from, "")) { + } else if (!SDL_strcasecmp(who_from, "")) { //Int3(); // no longer supported return; } else if ( (num = wing_name_lookup(who_from)) != -1 ) { @@ -4536,7 +4536,7 @@ void sexp_send_one_message( char *name, char *who_from, char *priority, int grou source = MESSAGE_SOURCE_COMMAND; - } else if ( !stricmp(who_from, "") || (wing_name_lookup(who_from) != -1) ) { + } else if ( !SDL_strcasecmp(who_from, "") || (wing_name_lookup(who_from) != -1) ) { source = MESSAGE_SOURCE_WINGMAN; } else { // Message from a apecific ship @@ -4567,14 +4567,14 @@ void sexp_send_message( int n ) return; } - Assert ( n != -1 ); + SDL_assert ( n != -1 ); who_from = CTEXT(n); priority = CTEXT(CDR(n)); name = CTEXT(CDR(CDR(n))); // a temporary check to see if the name field matched a priority since I am in the process // of reordering the arguments - if ( !stricmp(name, "low") || !stricmp(name, "normal") || !stricmp(name, "high") ) { + if ( !SDL_strcasecmp(name, "low") || !SDL_strcasecmp(name, "normal") || !SDL_strcasecmp(name, "high") ) { tmp = name; name = priority; priority = tmp; @@ -4634,7 +4634,7 @@ void sexp_send_random_message( int n ) char *name, *who_from, *priority; int temp, num_messages, message_num; - Assert ( n != -1 ); + SDL_assert ( n != -1 ); who_from = CTEXT(n); priority = CTEXT(CDR(n)); @@ -4650,7 +4650,7 @@ void sexp_send_random_message( int n ) n = CDR(n); num_messages++; } - Assert ( num_messages >= 1 ); + SDL_assert ( num_messages >= 1 ); // get a random message, and pass the parameters to send_one_message message_num = myrand() % num_messages; @@ -4661,7 +4661,7 @@ void sexp_send_random_message( int n ) message_num--; n = CDR(n); } - Assert (n != -1); // should have found the message!!! + SDL_assert (n != -1); // should have found the message!!! name = CTEXT(n); sexp_send_one_message( name, who_from, priority, 0, 0 ); @@ -4691,7 +4691,7 @@ void sexp_next_mission( int n ) mission_name = CTEXT(n); for (i = 0; i < Campaign.num_missions; i++) { - if ( !stricmp(Campaign.missions[i].name, mission_name) ) { + if ( !SDL_strcasecmp(Campaign.missions[i].name, mission_name) ) { Campaign.next_mission = i; return; } @@ -4745,7 +4745,7 @@ void sexp_sabotage_subsystem( int n ) shipp = &Ships[shipnum]; // see if we are dealing with the HULL - if ( !stricmp( subsystem, SEXP_HULL_STRING) ) { + if ( !SDL_strcasecmp( subsystem, SEXP_HULL_STRING) ) { float ihs; object *objp; @@ -4807,7 +4807,7 @@ void sexp_repair_subsystem( int n ) } // see if we are dealing with the HULL - if ( !stricmp( subsystem, SEXP_HULL_STRING) ) { + if ( !SDL_strcasecmp( subsystem, SEXP_HULL_STRING) ) { float ihs; object *objp; @@ -4867,7 +4867,7 @@ void sexp_set_subsystem_strength( int n ) } // see if we are dealing with the HULL - if ( !stricmp( subsystem, SEXP_HULL_STRING) ) { + if ( !SDL_strcasecmp( subsystem, SEXP_HULL_STRING) ) { float ihs; object *objp; @@ -4950,7 +4950,7 @@ void sexp_transfer_cargo( int n ) return; } - if ( !stricmp(Cargo_names[Ships[shipnum1].cargo1 & CARGO_INDEX_MASK], "nothing") ) { + if ( !SDL_strcasecmp(Cargo_names[Ships[shipnum1].cargo1 & CARGO_INDEX_MASK], "nothing") ) { Int3(); // you are transfering no cargo!!!! return; } @@ -4959,7 +4959,7 @@ void sexp_transfer_cargo( int n ) #ifndef NDEBUG // Don't give warning for large ships (cruiser on up) if (! (Ship_info[Ships[shipnum2].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) { - if ( stricmp(Cargo_names[Ships[shipnum2].cargo1 & CARGO_INDEX_MASK], "nothing") ) { + if ( SDL_strcasecmp(Cargo_names[Ships[shipnum2].cargo1 & CARGO_INDEX_MASK], "nothing") ) { Warning(LOCATION, "Transfering cargo to %s which already\nhas cargo %s.\nCargo will be replaced", Ships[shipnum2].ship_name, Cargo_names[Ships[shipnum2].cargo1 & CARGO_INDEX_MASK] ); } } @@ -4970,7 +4970,7 @@ void sexp_transfer_cargo( int n ) // need to set ship1's cargo to nothing. scan the cargo_names array looking for the string nothing. // add it if not found for (i = 0; i < Num_cargo; i++ ) { - if ( !stricmp(Cargo_names[i], "nothing") ) { + if ( !SDL_strcasecmp(Cargo_names[i], "nothing") ) { Ships[shipnum1].cargo1 = char(i); return; } @@ -5077,7 +5077,7 @@ void sexp_cargo_no_deplete( int n ) if (CDR(n) != -1) { no_deplete = atoi(CTEXT(CDR(n))); - Assert((no_deplete == 0) || (no_deplete == 1)); + SDL_assert((no_deplete == 0) || (no_deplete == 1)); if ( (no_deplete != 0) && (no_deplete != 1) ) { no_deplete = 1; } @@ -5112,7 +5112,7 @@ void sexp_good_time_to_rearm( int n ) team_name = CTEXT(n); time = atoi(CTEXT(CDR(n))); // this is the time for how long a good rearm is active -- in seconds for ( i = 0; i < Num_team_names; i++ ) { - if ( !stricmp(team_name, Team_names[i]) ) { + if ( !SDL_strcasecmp(team_name, Team_names[i]) ) { int team; team = 1 << i; @@ -5146,10 +5146,10 @@ void sexp_grant_medal( int n ) if ( (Game_mode & GM_NORMAL) && !(Game_mode & GM_CAMPAIGN_MODE) ) return; - Assert(Player->stats.m_medal_earned < 0); // Mission has problems. Tried to grant 2 medals in 1 mission. + SDL_assert(Player->stats.m_medal_earned < 0); // Mission has problems. Tried to grant 2 medals in 1 mission. medal_name = CTEXT(n); for (i = 0; i < NUM_MEDALS; i++ ) { - if ( !stricmp(medal_name, Medals[i].name) ) + if ( !SDL_strcasecmp(medal_name, Medals[i].name) ) break; } @@ -5170,7 +5170,7 @@ void sexp_tech_add_ship(int node) int i; char *name; - Assert(node >= 0); + SDL_assert(node >= 0); // this function doesn't mean anything when not in campaign mode if ( !(Game_mode & GM_CAMPAIGN_MODE) ) return; @@ -5192,7 +5192,7 @@ void sexp_tech_add_weapon(int node) int i; char *name; - Assert(node >= 0); + SDL_assert(node >= 0); // this function doesn't mean anything when not in campaign mode if ( !(Game_mode & GM_CAMPAIGN_MODE) ) return; @@ -5325,7 +5325,7 @@ void sexp_good_secondary_time( int n ) // get the team type from the team_name for ( i = 0; i < Num_team_names; i++ ) { - if ( !stricmp(Team_names[i], team_name) ) + if ( !SDL_strcasecmp(Team_names[i], team_name) ) break; } if ( i == Num_team_names ) { @@ -5380,7 +5380,7 @@ int sexp_previous_goal_status( int n, int status ) // now try and find the goal this mission mission_num = i; for (i = 0; i < Campaign.missions[mission_num].num_goals; i++) { - if ( !stricmp(Campaign.missions[mission_num].goals[i].name, goal_name) ) + if ( !SDL_strcasecmp(Campaign.missions[mission_num].goals[i].name, goal_name) ) break; } @@ -5460,7 +5460,7 @@ int sexp_previous_event_status( int n, int status ) // now try and find the goal this mission mission_num = i; for (i = 0; i < Campaign.missions[mission_num].num_events; i++) { - if ( !stricmp(Campaign.missions[mission_num].events[i].name, name) ) + if ( !SDL_strcasecmp(Campaign.missions[mission_num].events[i].name, name) ) break; } @@ -5510,7 +5510,7 @@ int sexp_event_status( int n, int want_true ) name = CTEXT(n); for (i = 0; i < Num_mission_events; i++ ) { // look for the event name, check it's status. If formula is gone, we know the state won't ever change. - if ( !stricmp(Mission_events[i].name, name) ) { + if ( !SDL_strcasecmp(Mission_events[i].name, name) ) { result = Mission_events[i].result; if (Mission_events[i].formula < 0) { if ( (want_true && result) || (!want_true && !result) ) @@ -5542,7 +5542,7 @@ int sexp_event_delay_status( int n, int want_true ) delay = i2f(num_eval(CDR(n))); for (i = 0; i < Num_mission_events; i++ ) { // look for the event name, check it's status. If formula is gone, we know the state won't ever change. - if ( !stricmp(Mission_events[i].name, name) ) { + if ( !SDL_strcasecmp(Mission_events[i].name, name) ) { if ( (fix) Mission_events[i].timestamp + delay >= Missiontime ) return SEXP_FALSE; @@ -5574,7 +5574,7 @@ int sexp_event_incomplete( int n ) name = CTEXT(n); for (i = 0; i < Num_mission_events; i++ ) { - if ( !stricmp(Mission_events[i].name, name ) ) { + if ( !SDL_strcasecmp(Mission_events[i].name, name ) ) { // if the formula is still >= 0 (meaning it is still getting eval'ed), then // the event is incomplete if ( Mission_events[i].formula != -1 ) @@ -5899,7 +5899,7 @@ int sexp_key_pressed(int node) { int z, t; - Assert(node != -1); + SDL_assert(node != -1); z = translate_key_to_index(CTEXT(node)); if (z < 0){ return 0; @@ -5921,7 +5921,7 @@ void sexp_key_reset(int node) { int z; - Assert(node != -1); + SDL_assert(node != -1); z = translate_key_to_index(CTEXT(node)); if (z >= 0) Control_config[z].used = 0; @@ -5952,7 +5952,7 @@ int sexp_targeted(int node) if (CDR(CDR(node)) >= 0) { ptr = Player_ai->targeted_subsys; - if (!ptr || stricmp(ptr->system_info->subobj_name, CTEXT(CDR(CDR(node))))){ + if (!ptr || SDL_strcasecmp(ptr->system_info->subobj_name, CTEXT(CDR(CDR(node))))){ return 0; } } @@ -6056,7 +6056,7 @@ int sexp_facing2(int node) // get position of first waypoint int wp_index = -1; for (i=0; i= 0); - Assert(Event_index >= 0); + SDL_assert(node >= 0); + SDL_assert(Event_index >= 0); if ((CDR(node) >= 0) && (CDR(CDR(node)) >= 0)) { delay = atoi(CTEXT(CDR(CDR(node)))) * 1000; @@ -6685,7 +6685,7 @@ void sexp_awacs_set_radius(int node) } // make sure this _is_ an awacs subsystem - Assert(awacs->system_info->flags & MSS_FLAG_AWACS); + SDL_assert(awacs->system_info->flags & MSS_FLAG_AWACS); if(awacs->system_info->flags & MSS_FLAG_AWACS){ return; } @@ -7010,7 +7010,7 @@ int process_special_sexps(int index) switch (index) { case 0: // Ship "Freighter 1" is aspect locked by player. if (Player_ai->target_objnum != -1) { - if (!(stricmp(Ships[Objects[Player_ai->target_objnum].instance].ship_name, "Freighter 1"))) { + if (!(SDL_strcasecmp(Ships[Objects[Player_ai->target_objnum].instance].ship_name, "Freighter 1"))) { if (Player_ai->current_target_is_locked) return SEXP_TRUE; } @@ -7021,11 +7021,11 @@ int process_special_sexps(int index) object *objp; for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) { if (objp->type == OBJ_WEAPON) { - if (!stricmp(Weapon_info[Weapons[objp->instance].weapon_info_index].name, "Interceptor#weak")) { + if (!SDL_strcasecmp(Weapon_info[Weapons[objp->instance].weapon_info_index].name, "Interceptor#weak")) { int target = Weapons[objp->instance].target_num; if (target != -1) { if (Objects[target].type == OBJ_SHIP) { - if (!(stricmp(Ships[Objects[target].instance].ship_name, "Freighter 1"))) + if (!(SDL_strcasecmp(Ships[Objects[target].instance].ship_name, "Freighter 1"))) return SEXP_TRUE; } } @@ -7035,8 +7035,8 @@ int process_special_sexps(int index) return SEXP_FALSE; case 2: // Ship "Freighter 1", subsystem "Weapons" is aspect locked by player. if (Player_ai->target_objnum != -1) { - if (!(stricmp(Ships[Objects[Player_ai->target_objnum].instance].ship_name, "Freighter 1"))) { - if (!(stricmp(Player_ai->targeted_subsys->system_info->name, "Weapons"))) { + if (!(SDL_strcasecmp(Ships[Objects[Player_ai->target_objnum].instance].ship_name, "Freighter 1"))) { + if (!(SDL_strcasecmp(Player_ai->targeted_subsys->system_info->name, "Weapons"))) { if (Player_ai->current_target_is_locked){ return SEXP_TRUE; } @@ -7158,7 +7158,7 @@ void sexp_flash_hud_gauge( int node ) name = CTEXT(node); for (i = 0; i < NUM_HUD_GAUGES; i++ ) { - if ( !stricmp(HUD_gauge_text[i], name) ) { + if ( !SDL_strcasecmp(HUD_gauge_text[i], name) ) { hud_gauge_start_flash(i); // call HUD function to flash gauge break; } @@ -7170,7 +7170,7 @@ void sexp_set_training_context_fly_path(int node) int i; for (i=0; i= 0); // we have special sexp nodes <= -1!!! MWA + SDL_assert(cur_node >= 0); // we have special sexp nodes <= -1!!! MWA // which should be intercepted before we get here. HOFFOSS type = SEXP_NODE_TYPE(cur_node); - Assert( (type == SEXP_LIST) || (type == SEXP_ATOM) ); + SDL_assert( (type == SEXP_LIST) || (type == SEXP_ATOM) ); // trap known true and known false sexpressions. We don't trap on SEXP_NAN sexpressions since // they may yet evaluate to true or false. @@ -7982,7 +7982,7 @@ int eval_sexp(int cur_node) break; } - Assert(sexp_val != UNINITIALIZED); + SDL_assert(sexp_val != UNINITIALIZED); // if we haven't returned, check the sexp value of the sexpression evaluation. A special // value of known true or known false means that we should set the sexp.value field for @@ -8046,7 +8046,7 @@ int get_sexp_main() if (!strncmp(Mp, "( )", 3)) savep++; - Assert(*Mp == '('); + SDL_assert(*Mp == '('); Mp++; start_node = get_sexp(token); // only need to check syntax if we have a operator @@ -8081,7 +8081,7 @@ int query_operator_return_type(int op) { if (op < FIRST_OP) { - Assert(op >= 0 && op < Num_operators); + SDL_assert(op >= 0 && op < Num_operators); op = Operators[op].value; } @@ -8306,7 +8306,7 @@ int query_operator_argument_type(int op, int argnum) if (op < FIRST_OP) { - Assert(index >= 0 && index < Num_operators); + SDL_assert(index >= 0 && index < Num_operators); op = Operators[index].value; } else { @@ -8314,7 +8314,7 @@ int query_operator_argument_type(int op, int argnum) if (Operators[index].value == op) break; - Assert(index < Num_operators); + SDL_assert(index < Num_operators); } if (argnum >= Operators[index].max) @@ -8939,7 +8939,7 @@ void update_block_names(const char *old_name, const char *new_name) for (i=0; i= 0) { if (SEXP_NODE_TYPE(n) == SEXP_LIST){ update_sexp_references(old_name, new_name, format, Sexp_nodes[n].first); } else { - Assert((SEXP_NODE_TYPE(n) == SEXP_ATOM) && ((Sexp_nodes[n].subtype == SEXP_ATOM_NUMBER) || (Sexp_nodes[n].subtype == SEXP_ATOM_STRING))); + SDL_assert((SEXP_NODE_TYPE(n) == SEXP_ATOM) && ((Sexp_nodes[n].subtype == SEXP_ATOM_NUMBER) || (Sexp_nodes[n].subtype == SEXP_ATOM_STRING))); if (query_operator_argument_type(op, i) == format) { - if (!stricmp(CTEXT(n), old_name)){ + if (!SDL_strcasecmp(CTEXT(n), old_name)){ strcpy(CTEXT(n), new_name); } } @@ -9035,7 +9035,7 @@ int query_referenced_in_sexp(int mode, char *name, int *node) for (n=0; n 0); + SDL_assert(len > 0); char_index[len] = 0; // append null termination to string variable_index = atoi(char_index); - Assert( (variable_index >= 0) && (variable_index < MAX_SEXP_VARIABLES) ); + SDL_assert( (variable_index >= 0) && (variable_index < MAX_SEXP_VARIABLES) ); return variable_index; } @@ -9392,7 +9392,7 @@ char *CTEXT(int n) int sexp_variable_index; if (Fred_running) { sexp_variable_index = get_index_sexp_variable_name(Sexp_nodes[n].text); - Assert(sexp_variable_index != -1); + SDL_assert(sexp_variable_index != -1); } else { // sexp_variable_index = extract_sexp_variable_index(n); sexp_variable_index = atoi(Sexp_nodes[n].text); @@ -9400,8 +9400,8 @@ char *CTEXT(int n) // Reference a Sexp_variable // string format -- "Sexp_variables[xx]=number" or "Sexp_variables[xx]=string", where xx is the index - Assert( !(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_NOT_USED) ); - Assert(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_SET); + SDL_assert( !(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_NOT_USED) ); + SDL_assert(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_SET); return Sexp_variables[sexp_variable_index].text; } else { @@ -9434,7 +9434,7 @@ int sexp_add_variable(const char *text, const char *var_name, int type, int inde } } } else { - Assert( (index >= 0) && (index < MAX_SEXP_VARIABLES) ); + SDL_assert( (index >= 0) && (index < MAX_SEXP_VARIABLES) ); } if (index >= 0) { @@ -9452,9 +9452,9 @@ int sexp_add_variable(const char *text, const char *var_name, int type, int inde // This should be called in mission when an sexp_variable is to be modified void sexp_modify_variable(char *text, int index) { - Assert(index >= 0 && index < MAX_SEXP_VARIABLES); - Assert(Sexp_variables[index].type & SEXP_VARIABLE_SET); - Assert( !MULTIPLAYER_CLIENT ); + SDL_assert(index >= 0 && index < MAX_SEXP_VARIABLES); + SDL_assert(Sexp_variables[index].type & SEXP_VARIABLE_SET); + SDL_assert( !MULTIPLAYER_CLIENT ); strcpy(Sexp_variables[index].text, text); Sexp_variables[index].type |= SEXP_VARIABLE_MODIFIED; @@ -9477,11 +9477,11 @@ void sexp_modify_variable(int n) if (n != -1) { // get sexp_variable index - Assert(Sexp_nodes[n].first == -1); + SDL_assert(Sexp_nodes[n].first == -1); sexp_variable_index = atoi(Sexp_nodes[n].text); // verify variable set - Assert(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_SET); + SDL_assert(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_SET); if (Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_NUMBER) { // get new numerical value @@ -9491,7 +9491,7 @@ void sexp_modify_variable(int n) sexp_modify_variable(number_as_str, sexp_variable_index); } else { // get new string - Assert(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_STRING); + SDL_assert(Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_STRING); char *new_text = Sexp_nodes[Sexp_nodes[n].rest].text; sexp_modify_variable(new_text, sexp_variable_index); @@ -9504,9 +9504,9 @@ void sexp_modify_variable(int n) // Different type needed for Fred (1) allow modification of type (2) no callback required void sexp_fred_modify_variable(const char *text, const char *var_name, int index, int type) { - Assert(index >= 0 && index < MAX_SEXP_VARIABLES); - Assert(Sexp_variables[index].type & SEXP_VARIABLE_SET); - Assert( (type & SEXP_VARIABLE_NUMBER) || (type & SEXP_VARIABLE_STRING) ); + SDL_assert(index >= 0 && index < MAX_SEXP_VARIABLES); + SDL_assert(Sexp_variables[index].type & SEXP_VARIABLE_SET); + SDL_assert( (type & SEXP_VARIABLE_NUMBER) || (type & SEXP_VARIABLE_STRING) ); strcpy(Sexp_variables[index].text, text); strcpy(Sexp_variables[index].variable_name, var_name); @@ -9548,7 +9548,7 @@ int sexp_variable_count() // deletes sexp_variable from active void sexp_variable_delete(int index) { - Assert(Sexp_variables[index].type & SEXP_VARIABLE_SET); + SDL_assert(Sexp_variables[index].type & SEXP_VARIABLE_SET); Sexp_variables[index].type = SEXP_VARIABLE_NOT_USED; } @@ -9571,7 +9571,7 @@ int sexp_var_compare(const void *var1, const void *var2) } else if (!set1 && set2) { return 1; } else { - return stricmp( sexp_var1->variable_name, sexp_var2->variable_name); + return SDL_strcasecmp( sexp_var1->variable_name, sexp_var2->variable_name); } } @@ -9621,7 +9621,7 @@ int sexp_variable_allocate_block(const char* block_name, int block_type) start = MAX_SEXP_VARIABLES - block_count - num_blocks; for (int idx=start; idx= 0); + SDL_assert(Num_particles >= 0); continue; } @@ -475,7 +475,7 @@ void particle_move_all(float frametime) // decrement counter Num_particles--; - Assert(Num_particles >= 0); + SDL_assert(Num_particles >= 0); continue; } } @@ -496,7 +496,7 @@ void particle_move_all(float frametime) // decrement counter Num_particles--; - Assert(Num_particles >= 0); + SDL_assert(Num_particles >= 0); } } } diff --git a/src/pcxutils/pcxutils.cpp b/src/pcxutils/pcxutils.cpp index cc2c4d6..5ace397 100644 --- a/src/pcxutils/pcxutils.cpp +++ b/src/pcxutils/pcxutils.cpp @@ -246,7 +246,7 @@ int pcx_read_bitmap_8bpp( char * real_filename, ubyte *org_data, ubyte *palette buffer_size = 1024; buffer_pos = 0; -// Assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' +// SDL_assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); count = 0; @@ -258,7 +258,7 @@ int pcx_read_bitmap_8bpp( char * real_filename, ubyte *org_data, ubyte *palette data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } if ((data & 0xC0) == 0xC0) { @@ -266,7 +266,7 @@ int pcx_read_bitmap_8bpp( char * real_filename, ubyte *org_data, ubyte *palette data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } } else { @@ -342,7 +342,7 @@ int pcx_read_bitmap_16bpp( char * real_filename, ubyte *org_data ) buffer_size = 1024; buffer_pos = 0; -// Assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' +// SDL_assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); count = 0; @@ -354,7 +354,7 @@ int pcx_read_bitmap_16bpp( char * real_filename, ubyte *org_data ) data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } if ((data & 0xC0) == 0xC0) { @@ -362,7 +362,7 @@ int pcx_read_bitmap_16bpp( char * real_filename, ubyte *org_data ) data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } } else { @@ -461,7 +461,7 @@ int pcx_read_bitmap_16bpp_aabitmap( char * real_filename, ubyte *org_data ) buffer_size = 1024; buffer_pos = 0; -// Assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' +// SDL_assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); count = 0; @@ -473,7 +473,7 @@ int pcx_read_bitmap_16bpp_aabitmap( char * real_filename, ubyte *org_data ) data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } if ((data & 0xC0) == 0xC0) { @@ -481,7 +481,7 @@ int pcx_read_bitmap_16bpp_aabitmap( char * real_filename, ubyte *org_data ) data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } } else { @@ -562,7 +562,7 @@ int pcx_read_bitmap_16bpp_nondark( char * real_filename, ubyte *org_data ) buffer_size = 1024; buffer_pos = 0; -// Assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' +// SDL_assert( buffer_size == 1024 ); // AL: removed to avoid optimized warning 'unreachable code' buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); count = 0; @@ -574,7 +574,7 @@ int pcx_read_bitmap_16bpp_nondark( char * real_filename, ubyte *org_data ) data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } if ((data & 0xC0) == 0xC0) { @@ -582,7 +582,7 @@ int pcx_read_bitmap_16bpp_nondark( char * real_filename, ubyte *org_data ) data = buffer[buffer_pos++]; if ( buffer_pos == buffer_size ) { buffer_size = cfread( buffer, 1, buffer_size, PCXfile ); - Assert( buffer_size > 0 ); + SDL_assert( buffer_size > 0 ); buffer_pos = 0; } } else { diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index 1032c7f..3161e62 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -182,7 +182,7 @@ * stamp. * * 86 11/24/97 1:54p Dan - * Mike: Comment out Assert() in physics, debug_rotvel(). + * Mike: Comment out SDL_assert() in physics, debug_rotvel(). * * 85 11/24/97 8:46a Andsager * Added rotational velocity caps and debug info. @@ -512,9 +512,9 @@ void physics_sim_rot(matrix * orient, physics_info * pi, float sim_time ) float rotdamp; float shock_fraction_time_left; - Assert(is_valid_matrix(orient)); - Assert(is_valid_vec(&pi->rotvel)); - Assert(is_valid_vec(&pi->desired_rotvel)); + SDL_assert(is_valid_matrix(orient)); + SDL_assert(is_valid_vec(&pi->rotvel)); + SDL_assert(is_valid_vec(&pi->desired_rotvel)); // Handle special case of shockwave shock_amplitude = 0.0f; @@ -543,7 +543,7 @@ void physics_sim_rot(matrix * orient, physics_info * pi, float sim_time ) } #endif */ - Assert(is_valid_vec(&new_vel)); + SDL_assert(is_valid_vec(&new_vel)); pi->rotvel = new_vel; @@ -750,8 +750,8 @@ void physics_sim_vel(vector * position, physics_info * pi, float sim_time, matri // check for excess velocity or translation // GET DaveA. if ( (Game_mode & GM_IN_MISSION) && (Game_mode & GM_NORMAL) ) { - // Assert( (sim_time > 0.5f) || (vm_vec_mag_squared(&pi->vel) < 500*500) ); - // Assert( (sim_time > 0.5f) || (vm_vec_mag_squared(&world_disp) < 350*350) ); + // SDL_assert( (sim_time > 0.5f) || (vm_vec_mag_squared(&pi->vel) < 500*500) ); + // SDL_assert( (sim_time > 0.5f) || (vm_vec_mag_squared(&world_disp) < 350*350) ); } #endif vm_vec_add2 (position, &world_disp); @@ -1337,8 +1337,8 @@ int check_rotvel_limit( physics_info *pi ) int change_made = 0; if ( !(pi->flags & PF_DEAD_DAMP) ) { // case of normal, live ship - // -- Commented out by MK: Assert( vm_vec_mag_squared(&pi->max_rotvel) > ROTVEL_TOL ); - // Assert( (pi->max_rotvel.xyz.x <= ROTVEL_CAP) && (pi->max_rotvel.xyz.y <= ROTVEL_CAP) && (pi->max_rotvel.xyz.z <= ROTVEL_CAP) ); + // -- Commented out by MK: SDL_assert( vm_vec_mag_squared(&pi->max_rotvel) > ROTVEL_TOL ); + // SDL_assert( (pi->max_rotvel.xyz.x <= ROTVEL_CAP) && (pi->max_rotvel.xyz.y <= ROTVEL_CAP) && (pi->max_rotvel.xyz.z <= ROTVEL_CAP) ); // Warning(LOCATION,"Excessive rotvel (wx: %f, wy: %f, wz:%f)\n", pi->rotvel.xyz.x, pi->rotvel.xyz.y, pi->rotvel.xyz.z); if ( fl_abs(pi->rotvel.xyz.x) > pi->max_rotvel.xyz.x ) { pi->rotvel.xyz.x = (pi->rotvel.xyz.x / fl_abs(pi->rotvel.xyz.x)) * (pi->max_rotvel.xyz.x - (float) ROTVEL_TOL); diff --git a/src/platform/unix.cpp b/src/platform/unix.cpp index 940bf61..3da7354 100644 --- a/src/platform/unix.cpp +++ b/src/platform/unix.cpp @@ -18,15 +18,6 @@ #define MAX_LINE_WIDTH 128 -void strlwr (char * str) -{ - while (*str) {*str = tolower (*str); str++; } -} - -void strupr (char * str) -{ - while (*str) {*str = toupper (*str); str++; } -} int filelength (int fd) { @@ -37,31 +28,6 @@ int filelength (int fd) return buf.st_size; } -unsigned long _beginthread (void (*pfuncStart)(void *), unsigned unStackSize, void* pArgList) -{ - STUB_FUNCTION; - - return 0; -} - -void Sleep (int mili) -{ -#ifdef __APPLE__ - // ughh, SDL_Delay causes a slowdown on Tiger for some reason and though I hate - // doing this, even the few Apple examples I've seen do this over what SDL_Delay does. - uint then = SDL_GetTicks() + mili; - - while ( then > SDL_GetTicks() ); -#else - SDL_Delay( long(mili) ); -#endif -} - -void OutputDebugString (const char *str) -{ - fprintf(stderr, "OutputDebugString: %s\n", str); -} - int WSAGetLastError() { return errno; @@ -130,21 +96,6 @@ void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ex } } -int MulDiv(int a, int b, int c) -{ - /* slow long long version */ - __extension__ long long aa = a; - __extension__ long long bb = b; - __extension__ long long cc = c; - - __extension__ long long dd = aa * bb; - __extension__ long long ee = dd / cc; - - int retr = (int) ee; - - return retr; -} - /* mem debug junk */ #ifndef NDEBUG //#define WANT_DEBUG @@ -354,9 +305,3 @@ void Error( const char * filename, int line, const char * format, ... ) exit (1); } - -void WinAssert(const char * text, const char *filename, int line) -{ - fprintf (stderr, "Assertion: (%s:%d) %s\n", filename, line, text); -// exit(1); -} diff --git a/src/playerman/managepilot.cpp b/src/playerman/managepilot.cpp index b84288b..b332107 100644 --- a/src/playerman/managepilot.cpp +++ b/src/playerman/managepilot.cpp @@ -416,8 +416,8 @@ void pilot_read_techroom_data(CFILE *file) // read in ship and weapon counts ship_count = cfread_int(file); weapon_count = cfread_int(file); - Assert(ship_count <= MAX_SHIP_TYPES); - Assert(weapon_count <= MAX_WEAPON_TYPES); + SDL_assert(ship_count <= MAX_SHIP_TYPES); + SDL_assert(weapon_count <= MAX_WEAPON_TYPES); // maintain compatibility w/ demo version if (Player_file_version < 136) { @@ -431,7 +431,7 @@ void pilot_read_techroom_data(CFILE *file) } else { intel_count = cfread_int(file); - Assert(intel_count <= MAX_INTEL_ENTRIES); + SDL_assert(intel_count <= MAX_INTEL_ENTRIES); // read all ships in for (idx=0; idx= 0) && (Player_num < MAX_PLAYERS)); + SDL_assert((Player_num >= 0) && (Player_num < MAX_PLAYERS)); p = &Players[Player_num]; } //sprintf(filename, "%-.8s.plr",Players[Player_num].callsign); - Assert(strlen(callsign) < MAX_FILENAME_LEN - 4); // ensure we won't overrun the buffer + SDL_assert(strlen(callsign) < MAX_FILENAME_LEN - 4); // ensure we won't overrun the buffer strcpy( filename, callsign ); strcat( filename, NOX(".plr") ); @@ -722,7 +722,7 @@ int read_pilot_file(const char *callsign, int single, player *p) // restore list of most recently played missions Num_recent_missions = cfread_int( file ); - Assert(Num_recent_missions <= MAX_RECENT_MISSIONS); + SDL_assert(Num_recent_missions <= MAX_RECENT_MISSIONS); for ( i = 0; i < Num_recent_missions; i++ ) { char *p; @@ -810,7 +810,7 @@ int read_pilot_file(const char *callsign, int single, player *p) if (mission_campaign_load_by_name(campaign_fname)) { strcpy(campaign_fname, BUILTIN_CAMPAIGN); if (mission_campaign_load_by_name(campaign_fname)) - Assert(0); + SDL_assert(0); } } //Campaign.current_mission = mission_num;*/ @@ -921,7 +921,7 @@ int write_pilot_file_core(player *p) } if (!p) { - Assert((Player_num >= 0) && (Player_num < MAX_PLAYERS)); + SDL_assert((Player_num >= 0) && (Player_num < MAX_PLAYERS)); p = &Players[Player_num]; } @@ -929,7 +929,7 @@ int write_pilot_file_core(player *p) if (i == 0) return 0; // This means there is no player, probably meaning he was deleted and game exited from same screen. - Assert((i > 0) && (i <= MAX_FILENAME_LEN - 4)); // ensure we won't overrun the buffer + SDL_assert((i > 0) && (i <= MAX_FILENAME_LEN - 4)); // ensure we won't overrun the buffer strcpy( filename, p->callsign); strcat( filename, NOX(".plr") ); @@ -1359,7 +1359,7 @@ void pilot_set_random_pic(player *p) } else { // pick a random name from the list int random_index = rand() % Num_pilot_images; - Assert((random_index >= 0) && (random_index < Num_pilot_images)); + SDL_assert((random_index >= 0) && (random_index < Num_pilot_images)); strcpy(p->image_filename, Pilot_images_arr[random_index]); } } @@ -1374,7 +1374,7 @@ void pilot_set_random_squad_pic(player *p) } else { // pick a random name from the list int random_index = rand() % Num_pilot_squad_images; - Assert((random_index >= 0) && (random_index < Num_pilot_squad_images)); + SDL_assert((random_index >= 0) && (random_index < Num_pilot_squad_images)); player_set_squad_bitmap(p, Pilot_squad_images_arr[random_index]); // strcpy(p->squad_filename, Pilot_squad_images_arr[random_index]); } @@ -1466,10 +1466,10 @@ void player_set_squad_bitmap(player *p, const char *fname) /* flen = strlen(filename); elen = strlen(ext); - Assert(flen < MAX_PATH_LEN); + SDL_assert(flen < MAX_PATH_LEN); strcpy(path, filename); - if ((flen < 4) || stricmp(path + flen - elen, ext)) { - Assert(flen + elen < MAX_PATH_LEN); + if ((flen < 4) || SDL_strcasecmp(path + flen - elen, ext)) { + SDL_assert(flen + elen < MAX_PATH_LEN); strcat(path, ext); } */ diff --git a/src/playerman/playercontrol.cpp b/src/playerman/playercontrol.cpp index 302102e..b40495b 100644 --- a/src/playerman/playercontrol.cpp +++ b/src/playerman/playercontrol.cpp @@ -925,11 +925,11 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info * if ( tspeed < MATCH_SPEED_THRESHOLD ) { ai_info *aip; - Assert(Objects[Player_ai->target_objnum].type == OBJ_SHIP); + SDL_assert(Objects[Player_ai->target_objnum].type == OBJ_SHIP); aip = &Ai_info[Ships[Objects[Player_ai->target_objnum].instance].ai_index]; if ( aip->ai_flags & AIF_DOCKED ) { - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); tspeed = Objects[aip->dock_objnum].phys_info.fspeed; } } @@ -1076,7 +1076,7 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info * // see if the afterburner has been started (keyboard + joystick) if (check_control(AFTERBURNER)) { if (!afterburner_last) { - Assert(Player_ship); + SDL_assert(Player_ship); if ( !(Ship_info[Player_ship->ship_info_index].flags & SIF_AFTERBURNER) ) { gamesnd_play_error_beep(); } else { @@ -1286,7 +1286,7 @@ void player_match_target_speed(char *no_target_text, char *match_off_text, char ai_info *aip; aip = &Ai_info[Ships[Objects[Player_ai->target_objnum].instance].ai_index]; if ( aip->ai_flags & AIF_DOCKED ) { - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); if ( Objects[aip->dock_objnum].phys_info.fspeed > MATCH_SPEED_THRESHOLD ) { can_match=1; } @@ -1502,7 +1502,7 @@ void player_init() // stop any looping sounds associated with the Player, called from game_stop_looped_sounds(). void player_stop_looped_sounds() { - Assert(Player); + SDL_assert(Player); if ( Player->repair_sound_loop > -1 ) { snd_stop(Player->repair_sound_loop); Player->repair_sound_loop = -1; @@ -1517,7 +1517,7 @@ void player_stop_looped_sounds() // repaired by a support ship void player_maybe_start_repair_sound() { - Assert(Player); + SDL_assert(Player); if ( Player->repair_sound_loop == -1 ) { Player->repair_sound_loop = snd_play_looping( &Snds[SND_SHIP_REPAIR] ); } @@ -1526,7 +1526,7 @@ void player_maybe_start_repair_sound() // stop the player repair sound if it is already playing void player_stop_repair_sound() { - Assert(Player); + SDL_assert(Player); if ( Player->repair_sound_loop != -1 ) { snd_stop(Player->repair_sound_loop); Player->repair_sound_loop = -1; @@ -1536,7 +1536,7 @@ void player_stop_repair_sound() // start the cargo scanning sound if it hasn't already been started void player_maybe_start_cargo_scan_sound() { - Assert(Player); + SDL_assert(Player); if ( Player->cargo_scan_loop == -1 ) { Player->cargo_scan_loop = snd_play_looping( &Snds[SND_CARGO_SCAN] ); } @@ -1545,7 +1545,7 @@ void player_maybe_start_cargo_scan_sound() // stop the player repair sound if it is already playing void player_stop_cargo_scan_sound() { - Assert(Player); + SDL_assert(Player); if ( Player->cargo_scan_loop != -1 ) { snd_stop(Player->cargo_scan_loop); Player->cargo_scan_loop = -1; @@ -1613,7 +1613,7 @@ int player_inspect_cargo(float frametime, char *outstr) } cargo_objp = &Objects[Player_ai->target_objnum]; - Assert(cargo_objp->type == OBJ_SHIP); + SDL_assert(cargo_objp->type == OBJ_SHIP); cargo_sp = &Ships[cargo_objp->instance]; cargo_sip = &Ship_info[cargo_sp->ship_info_index]; @@ -1652,7 +1652,7 @@ int player_inspect_cargo(float frametime, char *outstr) if ( !(cargo_sp->flags & SF_SCANNABLE) ) { char *cargo_name; cargo_name = Cargo_names[cargo_sp->cargo1 & CARGO_INDEX_MASK]; - Assert ( cargo_name ); + SDL_assert ( cargo_name ); if ( cargo_sip->flags & (SIF_CARGO|SIF_TRANSPORT) ) { if ( cargo_name[0] == '#' ) @@ -1662,11 +1662,11 @@ int player_inspect_cargo(float frametime, char *outstr) } else { int pn; - Assert( Game_mode & GM_MULTIPLAYER ); + SDL_assert( Game_mode & GM_MULTIPLAYER ); // get a player num from the object, then get a callsign from the player structure. pn = multi_find_player_by_object( cargo_objp ); - // Assert( pn != -1 ); + // SDL_assert( pn != -1 ); if(pn == -1){ strcpy(outstr, ""); } else { @@ -1744,11 +1744,11 @@ int player_inspect_cap_subsys_cargo(float frametime, char *outstr) } cargo_objp = &Objects[Player_ai->target_objnum]; - Assert(cargo_objp->type == OBJ_SHIP); + SDL_assert(cargo_objp->type == OBJ_SHIP); cargo_sp = &Ships[cargo_objp->instance]; cargo_sip = &Ship_info[cargo_sp->ship_info_index]; - Assert(cargo_sip->flags & SIF_HUGE_SHIP); + SDL_assert(cargo_sip->flags & SIF_HUGE_SHIP); if ( !(cargo_sp->flags & SF_SCANNABLE) ) { return 0; @@ -1767,7 +1767,7 @@ int player_inspect_cap_subsys_cargo(float frametime, char *outstr) } else { cargo_name = Cargo_names[subsys->subsys_cargo_name]; } - Assert ( cargo_name ); + SDL_assert ( cargo_name ); sprintf(outstr,XSTR( "cargo: %s", 84), cargo_name ); @@ -1882,7 +1882,7 @@ char *player_generate_death_text( player *player_p, char *death_text ) } break; case OBJ_WEAPON: - Assert(weapon_name[0]); + SDL_assert(weapon_name[0]); // is this from a friendly ship? int ship_index; @@ -2091,7 +2091,7 @@ void player_set_padlock_state() void player_get_padlock_orient(matrix *eye_orient) { - Assert(Viewer_mode & VM_PADLOCK_ANY); + SDL_assert(Viewer_mode & VM_PADLOCK_ANY); matrix old_eye_orient; old_eye_orient = *eye_orient; @@ -2174,8 +2174,8 @@ void player_get_eye(vector *eye_pos, matrix *eye_orient) return; } - Assert(eye_pos != NULL); - Assert(eye_orient != NULL); + SDL_assert(eye_pos != NULL); + SDL_assert(eye_orient != NULL); if (Game_mode & GM_DEAD) { vector vec_to_deader, view_pos; diff --git a/src/pofview/pofview.cpp b/src/pofview/pofview.cpp index bdea1c0..e1c52b5 100644 --- a/src/pofview/pofview.cpp +++ b/src/pofview/pofview.cpp @@ -111,9 +111,9 @@ BOOL CPofViewApp::InitInstance() // setup the fred exe directory so CFILE can init properly /* char *c = GetCommandLine(); - Assert(c != NULL); + SDL_assert(c != NULL); char *tok = strtok(c, " "); - Assert(tok != NULL); + SDL_assert(tok != NULL); */ outwnd_init(); @@ -274,7 +274,7 @@ void init_thrusters() Error(LOCATION,"Error loading animation file: %s\n",Thrust_anim_names[i]); return; } - Assert(fps != 0); + SDL_assert(fps != 0); ta->time = i2fl(ta->num_frames)/fps; //} else { // ta->first_frame = bm_load(Thrust_anim_names[i] ); @@ -284,7 +284,7 @@ void init_thrusters() // Error(LOCATION,"Error loading bitmap file: %s\n",Thrust_anim_names[i]); // return; // } - // Assert(fps != 0); + // SDL_assert(fps != 0); // ta->time = i2fl(ta->num_frames)/fps; //} } diff --git a/src/popup/popup.cpp b/src/popup/popup.cpp index a05fd4c..041f7c8 100644 --- a/src/popup/popup.cpp +++ b/src/popup/popup.cpp @@ -588,7 +588,7 @@ void popup_split_lines(popup_info *pi, int flags) n_chars[0]=0; nlines = split_str(pi->raw_text, 1000, n_chars, p_str, POPUP_MAX_LINES); - Assert(nlines >= 0 && nlines <= POPUP_MAX_LINES ); + SDL_assert(nlines >= 0 && nlines <= POPUP_MAX_LINES ); if ( flags & (PF_TITLE | PF_TITLE_BIG) ) { // get first line out @@ -602,12 +602,12 @@ void popup_split_lines(popup_info *pi, int flags) } nlines = split_str(pi->raw_text, Popup_text_coords[gr_screen.res][2], n_chars, p_str, POPUP_MAX_LINES); - Assert(nlines >= 0 && nlines <= POPUP_MAX_LINES ); + SDL_assert(nlines >= 0 && nlines <= POPUP_MAX_LINES ); pi->nlines = nlines - body_offset; for ( i = 0; i < pi->nlines; i++ ) { - Assert(n_chars[i+body_offset] < POPUP_MAX_LINE_CHARS); + SDL_assert(n_chars[i+body_offset] < POPUP_MAX_LINE_CHARS); strncpy(pi->msg_lines[i], p_str[i+body_offset], n_chars[i+body_offset]); pi->msg_lines[i][n_chars[i+body_offset]] = 0; } @@ -622,11 +622,11 @@ const char *popup_get_button_filename(popup_info *pi, int i, int flags) int is_tiny=0; // check for special button texts and if found, use specialized buttons for them. - if ((!stricmp(pi->button_text[i], POPUP_OK + 1) || !stricmp(pi->button_text[i], POPUP_YES + 1)) && !(flags & PF_NO_SPECIAL_BUTTONS)){ + if ((!SDL_strcasecmp(pi->button_text[i], POPUP_OK + 1) || !SDL_strcasecmp(pi->button_text[i], POPUP_YES + 1)) && !(flags & PF_NO_SPECIAL_BUTTONS)){ return Popup_button_filenames[gr_screen.res][is_tiny][BUTTON_POSITIVE]; } - if ((!stricmp(pi->button_text[i], POPUP_CANCEL + 1) || !stricmp(pi->button_text[i], POPUP_NO + 1)) && !(flags & PF_NO_SPECIAL_BUTTONS)){ + if ((!SDL_strcasecmp(pi->button_text[i], POPUP_CANCEL + 1) || !SDL_strcasecmp(pi->button_text[i], POPUP_NO + 1)) && !(flags & PF_NO_SPECIAL_BUTTONS)){ return Popup_button_filenames[gr_screen.res][is_tiny][BUTTON_NEGATIVE]; } @@ -1185,7 +1185,7 @@ void popup_maybe_assign_keypress(popup_info *pi, int n, char *str) char first_char_string[2]; first_char_string[0]=str[i]; first_char_string[1]=0; - strlwr(first_char_string); + SDL_strlwr(first_char_string); pi->keypress[n] = first_char_string[0]; } pi->button_text[n][j++]=str[i]; @@ -1219,7 +1219,7 @@ int popup(int flags, int nchoices, ... ) Popup_flags = flags; - Assert( nchoices > 0 && nchoices <= POPUP_MAX_CHOICES ); + SDL_assert( nchoices > 0 && nchoices <= POPUP_MAX_CHOICES ); Popup_info.nchoices = nchoices; va_start(args, nchoices ); @@ -1236,7 +1236,7 @@ int popup(int flags, int nchoices, ... ) Popup_info.raw_text[0] = 0; vsprintf(Popup_info.raw_text, format, args); va_end(args); - Assert(strlen(Popup_info.raw_text) < POPUP_MAX_CHARS ); + SDL_assert(strlen(Popup_info.raw_text) < POPUP_MAX_CHARS ); gamesnd_play_iface(SND_POPUP_APPEAR); // play sound when popup appears @@ -1323,9 +1323,9 @@ char *popup_input(int flags, const char *caption, int max_output_len) // popup_maybe_assign_keypress(&Popup_info, 0, "&Cancel"); // get msg text - Assert(caption != NULL); + SDL_assert(caption != NULL); strcpy(Popup_info.raw_text, caption); - Assert(strlen(Popup_info.raw_text) < POPUP_MAX_CHARS ); + SDL_assert(strlen(Popup_info.raw_text) < POPUP_MAX_CHARS ); // set input text length if((max_output_len > POPUP_INPUT_MAX_CHARS) || (max_output_len == -1)){ diff --git a/src/popup/popupdead.cpp b/src/popup/popupdead.cpp index 70b5481..0be50d8 100644 --- a/src/popup/popupdead.cpp +++ b/src/popup/popupdead.cpp @@ -595,7 +595,7 @@ int popupdead_do_frame(float frametime) // dont let dude skip 3-09. hack. if(Game_mode & GM_CAMPAIGN_MODE){ if((Campaign.current_mission >= 0) && (Campaign.current_mission < MAX_CAMPAIGN_MISSIONS)){ - if ((Campaign.missions[Campaign.current_mission].name != NULL) && !stricmp(Campaign.missions[Campaign.current_mission].name, "sm3-09.fs2")) { + if ((Campaign.missions[Campaign.current_mission].name != NULL) && !SDL_strcasecmp(Campaign.missions[Campaign.current_mission].name, "sm3-09.fs2")) { Popupdead_skip_already_shown = 1; } } @@ -636,7 +636,7 @@ int popupdead_do_frame(float frametime) if ( Game_mode & GM_NORMAL ) { Popupdead_choice=choice; } else { - Assert( Popupdead_multi_type != -1 ); + SDL_assert( Popupdead_multi_type != -1 ); switch ( Popupdead_multi_type ) { case POPUPDEAD_OBS_ONLY: @@ -666,7 +666,7 @@ int popupdead_do_frame(float frametime) if ( Game_mode & GM_NORMAL ) { Popupdead_choice=choice; } else { - Assert( Popupdead_multi_type != -1 ); + SDL_assert( Popupdead_multi_type != -1 ); switch ( Popupdead_multi_type ) { case POPUPDEAD_OBS_ONLY: diff --git a/src/radar/radar.cpp b/src/radar/radar.cpp index 83da992..429824d 100644 --- a/src/radar/radar.cpp +++ b/src/radar/radar.cpp @@ -716,7 +716,7 @@ void draw_radar_blips(int rcol, int is_dim, int distort) for ( b = GET_FIRST(blip_head); b !=END_OF_LIST(blip_head); b = GET_NEXT(b) ) { - Assert((rcol >= 0) && (rcol < MAX_RADAR_COLORS)); + SDL_assert((rcol >= 0) && (rcol < MAX_RADAR_COLORS)); if ( is_dim ) { gr_set_color_fast( &Radar_colors[RADAR_BLIP_DIM][rcol] ); diff --git a/src/render/3dclipper.cpp b/src/render/3dclipper.cpp index f138383..f9b873a 100644 --- a/src/render/3dclipper.cpp +++ b/src/render/3dclipper.cpp @@ -103,7 +103,7 @@ vertex *get_temp_point() void free_temp_point(vertex *p) { - Assert(p->flags & PF_TEMP_POINT); + SDL_assert(p->flags & PF_TEMP_POINT); free_points[--free_point_num] = p; diff --git a/src/render/3ddraw.cpp b/src/render/3ddraw.cpp index c678249..c168926 100644 --- a/src/render/3ddraw.cpp +++ b/src/render/3ddraw.cpp @@ -232,7 +232,7 @@ int g3_draw_line(vertex *p0,vertex *p1) { ubyte codes_or; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if (p0->codes & p1->codes) return 0; @@ -272,7 +272,7 @@ int g3_check_normal_facing(vector *v,vector *norm) { vector tempv; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); vm_vec_sub(&tempv,&View_position,v); @@ -281,11 +281,11 @@ int g3_check_normal_facing(vector *v,vector *norm) int do_facing_check(vector *norm,vertex **vertlist,vector *p) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if (norm) { //have normal - Assert(norm->xyz.x || norm->xyz.y || norm->xyz.z); + SDL_assert(norm->xyz.x || norm->xyz.y || norm->xyz.z); return g3_check_normal_facing(p,norm); } @@ -309,7 +309,7 @@ int do_facing_check(vector *norm,vertex **vertlist,vector *p) //returns -1 if not facing, 1 if off screen, 0 if drew int g3_draw_poly_if_facing(int nv,vertex **pointlist,uint tmap_flags,vector *norm,vector *pnt) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if (do_facing_check(norm,pointlist,pnt)) return g3_draw_poly(nv,pointlist,tmap_flags); @@ -326,7 +326,7 @@ int g3_draw_poly(int nv,vertex **pointlist,uint tmap_flags) vertex **bufptr; ccodes cc; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); cc.vor = 0; cc.vand = 0xff; @@ -345,7 +345,7 @@ int g3_draw_poly(int nv,vertex **pointlist,uint tmap_flags) return 1; //all points off screen if (cc.vor) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); bufptr = clip_polygon(Vbuf0,Vbuf1,&nv,&cc,tmap_flags); @@ -408,7 +408,7 @@ int g3_draw_poly_constant_sw(int nv,vertex **pointlist,uint tmap_flags, float co vertex **bufptr; ccodes cc; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); cc.vor = 0; cc.vand = 0xff; @@ -427,7 +427,7 @@ int g3_draw_poly_constant_sw(int nv,vertex **pointlist,uint tmap_flags, float co return 1; //all points off screen if (cc.vor) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); bufptr = clip_polygon(Vbuf0, Vbuf1, &nv, &cc, tmap_flags); @@ -504,7 +504,7 @@ free_points: //radius, but not to the distance from the eye int g3_draw_sphere(vertex *pnt,float rad) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if (! (pnt->codes & CC_BEHIND)) { @@ -530,7 +530,7 @@ int g3_draw_sphere_ez(vector *pnt,float rad) vertex pt; ubyte flags; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); flags = g3_rotate_vertex(&pt,pnt); @@ -575,7 +575,7 @@ int g3_draw_bitmap(vertex *pnt,int orient, float rad,uint tmap_flags) width = height = rad*2.0f; } - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if ( pnt->codes & (CC_BEHIND|CC_OFF_USER) ) return 1; @@ -652,7 +652,7 @@ int g3_get_bitmap_dims(int bitmap, vertex *pnt, float rad, int *x, int *y, int * width = height = rad*2.0f; } - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if ( pnt->codes & (CC_BEHIND|CC_OFF_USER) ) { return 1; @@ -705,7 +705,7 @@ int g3_draw_rotated_bitmap(vertex *pnt,float angle, float rad,uint tmap_flags) } */ - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); angle+=Physics_viewer_bank; if ( angle < 0.0f ) @@ -815,7 +815,7 @@ float g3_draw_poly_constant_sw_area(int nv, vertex **pointlist, uint tmap_flags, ccodes cc; float p_area = 0.0f; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); cc.vor = 0; cc.vand = 0xff; @@ -835,7 +835,7 @@ float g3_draw_poly_constant_sw_area(int nv, vertex **pointlist, uint tmap_flags, } if (cc.vor) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); bufptr = clip_polygon(Vbuf0, Vbuf1, &nv, &cc, tmap_flags); @@ -912,7 +912,7 @@ float g3_draw_rotated_bitmap_area(vertex *pnt,float angle, float rad,uint tmap_f float sa, ca; int i; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); angle+=Physics_viewer_bank; if ( angle < 0.0f ){ @@ -1036,7 +1036,7 @@ void g3_draw_horizon_line() // bot_color = ground_color; // } - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); //compute horizon_vector diff --git a/src/render/3dlaser.cpp b/src/render/3dlaser.cpp index 8cfeb22..3aa303c 100644 --- a/src/render/3dlaser.cpp +++ b/src/render/3dlaser.cpp @@ -158,7 +158,7 @@ float g3_draw_laser(vector *headp, float head_width, vector *tailp, float tail_w float depth; int head_on = 0; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); g3_rotate_vertex(&pt1,headp); @@ -318,7 +318,7 @@ float g3_draw_laser_rgb(vector *headp, float head_width, vector *tailp, float ta float depth; int head_on = 0; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); g3_rotate_vertex(&pt1,headp); diff --git a/src/render/3dmath.cpp b/src/render/3dmath.cpp index 1f710d3..3fe53e1 100644 --- a/src/render/3dmath.cpp +++ b/src/render/3dmath.cpp @@ -166,7 +166,7 @@ ubyte g3_rotate_vertex(vertex *dest,vector *src) { #if 0 vector tempv; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); vm_vec_sub(&tempv,src,&View_position); vm_vec_rotate( (vector *)&dest->x, &tempv, &View_matrix ); dest->flags = 0; //not projected @@ -223,7 +223,7 @@ ubyte g3_rotate_vertex(vertex *dest,vector *src) ubyte g3_rotate_faraway_vertex(vertex *dest,vector *src) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); MONITOR_INC( NumRotations, 1 ); @@ -238,7 +238,7 @@ ubyte g3_rotate_vector(vector *dest,vector *src) { vector tempv; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); MONITOR_INC( NumRotations, 1 ); @@ -251,7 +251,7 @@ ubyte g3_project_vector(vector *p, float *sx, float *sy ) { float w; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if ( p->xyz.z <= MIN_Z ) return PF_OVERFLOW; @@ -268,7 +268,7 @@ int g3_project_vertex(vertex *p) { float w; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); if ( p->flags & PF_PROJECTED ) return p->flags; @@ -300,7 +300,7 @@ void g3_point_to_vec(vector *v,int sx,int sy) { vector tempv; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); tempv.xyz.x = ((float)sx - Canv_w2) / Canv_w2; tempv.xyz.y = -((float)sy - Canv_h2) / Canv_h2; @@ -333,7 +333,7 @@ void g3_point_to_vec_delayed(vector *v,int sx,int sy) vector *g3_rotate_delta_vec(vector *dest,vector *src) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); return vm_vec_rotate(dest,src,&View_matrix); } diff --git a/src/render/3dsetup.cpp b/src/render/3dsetup.cpp index 9cb7b0d..0d2e5bd 100644 --- a/src/render/3dsetup.cpp +++ b/src/render/3dsetup.cpp @@ -150,7 +150,7 @@ void g3_start_frame_func(int zbuffer_flag, const char * filename, int lineno) //Uncomment this to figure out who called g3_start_frame without calling g3_end_frame. // mprintf(( "g3_start_frame called from %s, line %d\n", filename, lineno )); - Assert( G3_count == 0 ); + SDL_assert( G3_count == 0 ); G3_count++; // Clear any user-defined clip planes @@ -200,10 +200,10 @@ void g3_start_frame_func(int zbuffer_flag, const char * filename, int lineno) void g3_end_frame(void) { G3_count--; - Assert( G3_count == 0 ); + SDL_assert( G3_count == 0 ); free_point_num = 0; -// Assert(free_point_num==0); +// SDL_assert(free_point_num==0); } @@ -212,7 +212,7 @@ void scale_matrix(void); //set view from x,y,z, viewer matrix, and zoom. Must call one of g3_set_view_*() void g3_set_view_matrix(vector *view_pos,matrix *view_matrix,float zoom) { - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); View_zoom = zoom; View_position = *view_pos; @@ -237,7 +237,7 @@ void g3_set_view_angles(vector *view_pos,angles *view_orient,float zoom) { matrix tmp; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); vm_angles_2_matrix(&tmp,view_orient); g3_set_view_matrix(view_pos,&tmp,zoom); @@ -274,9 +274,9 @@ ubyte g3_rotate_vertex_popped(vertex *dest,vector *src) { vector tempv; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); - Assert( instance_depth > 0 ); + SDL_assert( instance_depth > 0 ); vm_vec_sub(&tempv,src,&instance_stack[0].p); vm_vec_rotate( (vector *)&dest->x, &tempv, &instance_stack[0].m ); @@ -293,9 +293,9 @@ void g3_start_instance_matrix(vector *pos,matrix *orient) vector tempv; matrix tempm,tempm2; - Assert( G3_count == 1 ); + SDL_assert( G3_count == 1 ); - Assert(instance_depth= 0); + SDL_assert(instance_depth >= 0); View_position = instance_stack[instance_depth].p; View_matrix = instance_stack[instance_depth].m; diff --git a/src/ship/afterburner.cpp b/src/ship/afterburner.cpp index a2a71df..7306e72 100644 --- a/src/ship/afterburner.cpp +++ b/src/ship/afterburner.cpp @@ -105,7 +105,7 @@ * change call to snd_play_3d() to allow for arbitrary listening position * * 10 9/16/97 2:27p Allender - * Removed unused Assert that will cause problems in the future + * Removed unused SDL_assert that will cause problems in the future * * 9 8/11/97 9:50a Allender * fixed afterburner snafu @@ -210,13 +210,13 @@ void afterburners_start(object *objp) ship *shipp; float percent_left; - Assert( objp != NULL ); + SDL_assert( objp != NULL ); if(objp->type == OBJ_OBSERVER) return; - Assert( objp->type == OBJ_SHIP); - Assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); + SDL_assert( objp->type == OBJ_SHIP); + SDL_assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); if ( (objp->flags & OF_PLAYER_SHIP) && (objp == Player_obj) ) { int now; @@ -237,7 +237,7 @@ void afterburners_start(object *objp) } shipp = &Ships[objp->instance]; - Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES ); + SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES ); sip = &Ship_info[shipp->ship_info_index]; if ( !(sip->flags & SIF_AFTERBURNER) ) { @@ -293,9 +293,9 @@ void afterburners_start(object *objp) // void afterburners_update(object *objp, float fl_frametime) { - Assert( objp != NULL ); - Assert( objp->type == OBJ_SHIP ); - Assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); + SDL_assert( objp != NULL ); + SDL_assert( objp->type == OBJ_SHIP ); + SDL_assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); ship_info *sip; ship *shipp; @@ -303,7 +303,7 @@ void afterburners_update(object *objp, float fl_frametime) shipp = &Ships[objp->instance]; - Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES ); + SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES ); sip = &Ship_info[shipp->ship_info_index]; if ( (objp->flags & OF_PLAYER_SHIP ) && (Game_mode & GM_DEAD) ) { @@ -400,15 +400,15 @@ void afterburners_update(object *objp, float fl_frametime) // void afterburners_stop(object *objp, int key_released) { - Assert( objp != NULL ); - Assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); + SDL_assert( objp != NULL ); + SDL_assert( objp->instance >= 0 && objp->instance < MAX_SHIPS ); ship_info *sip; ship *shipp; shipp = &Ships[objp->instance]; - Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES ); + SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES ); sip = &Ship_info[shipp->ship_info_index]; if ( (objp->flags & OF_PLAYER_SHIP) && key_released ) { diff --git a/src/ship/ai.cpp b/src/ship/ai.cpp index e34544a..90de62c 100644 --- a/src/ship/ai.cpp +++ b/src/ship/ai.cpp @@ -49,7 +49,7 @@ int ai_get_slot(int shipnum) // Only modifies in Ai_info struct. Does not modify hook in ship. void ai_free_slot(int ai_index) { - Assert( (ai_index >= 0) && (ai_index < MAX_AI_INFO) ); + SDL_assert( (ai_index >= 0) && (ai_index < MAX_AI_INFO) ); Ai_info[ai_index].shipnum = -1; } @@ -69,15 +69,15 @@ void set_wingnum(int objnum, int wingnum) { int shipnum, ai_index; - Assert(Objects[objnum].type == OBJ_SHIP); + SDL_assert(Objects[objnum].type == OBJ_SHIP); shipnum = Objects[objnum].instance; - Assert((shipnum >= 0) && (shipnum < MAX_SHIPS)); + SDL_assert((shipnum >= 0) && (shipnum < MAX_SHIPS)); ai_index = Ships[shipnum].ai_index; - Assert( (ai_index >= 0) && (ai_index < MAX_AI_INFO) ); + SDL_assert( (ai_index >= 0) && (ai_index < MAX_AI_INFO) ); Ai_info[ai_index].wing = wingnum; } @@ -87,13 +87,13 @@ char *ai_get_goal_ship_name(const char *name, int *index) int i; for (i=0; i < Total_goal_ship_names; i++) - if (!stricmp(name, Goal_ship_names[i])) { + if (!SDL_strcasecmp(name, Goal_ship_names[i])) { *index = i; return Goal_ship_names[i]; } - Assert(Total_goal_ship_names < MAX_GOAL_SHIP_NAMES); - Assert(strlen(name) < NAME_LENGTH - 1); + SDL_assert(Total_goal_ship_names < MAX_GOAL_SHIP_NAMES); + SDL_assert(strlen(name) < NAME_LENGTH - 1); i = Total_goal_ship_names++; strcpy(Goal_ship_names[i], name); *index = i; diff --git a/src/ship/aibig.cpp b/src/ship/aibig.cpp index 14becc7..87b98b7 100644 --- a/src/ship/aibig.cpp +++ b/src/ship/aibig.cpp @@ -146,10 +146,10 @@ * think) * * 58 3/24/98 10:07p Adam - * AL: Add another Assert() to try and catch bogus wp->big_attack_point + * AL: Add another SDL_assert() to try and catch bogus wp->big_attack_point * * 57 3/24/98 9:56p Adam - * AL: Assert that local_attack_point is valid in ai_bpap + * AL: SDL_assert that local_attack_point is valid in ai_bpap * * 56 3/21/98 3:36p Mike * Fix/optimize attacking of big ships. @@ -299,7 +299,7 @@ * Don't allow ships to attack navbuoys. * Make ships lead big ships with dumbfire. * Make ships smarter about leaving evade weapon mode. - * Fix a couple Assert() bugs. + * Fix a couple SDL_assert() bugs. * * 13 11/06/97 6:27p Lawrance * fix bug that was messing up retreat point in STRAFE mode @@ -485,7 +485,7 @@ void ai_bpap(object *objp, vector *attacker_objp_pos, vector *attacker_objp_fvec nearest_dist = dist; best_point = result_point; *local_attack_point = rel_point; - Assert( !vm_is_vec_nan(local_attack_point) ); + SDL_assert( !vm_is_vec_nan(local_attack_point) ); if (dot > (1.0f + fov)/2.0f) // If this point is quite good, quit searching for a better one. goto done_1; } @@ -564,8 +564,8 @@ void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vector *gpo // Note, attacker_objp can be a ship or a weapon. void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attack_point, float fov) { - Assert(objp->instance > -1); - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance > -1); + SDL_assert(objp->type == OBJ_SHIP); vector local_attack_point; @@ -622,7 +622,7 @@ void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attac case OBJ_WEAPON: { weapon *wp = &Weapons[attacker_objp->instance]; wp->big_attack_point = local_attack_point; - Assert( !vm_is_vec_nan(&wp->big_attack_point) ); + SDL_assert( !vm_is_vec_nan(&wp->big_attack_point) ); break; } } @@ -762,7 +762,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check) if ( (aip->path_start) == -1 || (aip->mp_index != subsys_path_num) ) { // maybe create a new path if ( subsys_path_num >= 0 ) { - Assert(aip->target_objnum >= 0); + SDL_assert(aip->target_objnum >= 0); ai_find_path(Pl_objp, aip->target_objnum, subsys_path_num, 0, 1); if ( aip->path_start >= 0 ) { aip->ai_flags |= AIF_ON_SUBSYS_PATH; @@ -784,7 +784,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check) int path_done=0; int in_view=0; - Assert(aip->path_length >= 2); + SDL_assert(aip->path_length >= 2); dist = vm_vec_dist_quick(&Path_points[aip->path_start+aip->path_length-2].pos, &Pl_objp->pos); if ( aip->path_cur >= (aip->path_start+aip->path_length-1) ) { @@ -1022,7 +1022,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector * ship_weapon *tswp = &temp_shipp->weapons; if ( tswp->num_primary_banks > 0 ) { - Assert(tswp->current_primary_bank < tswp->num_primary_banks); + SDL_assert(tswp->current_primary_bank < tswp->num_primary_banks); weapon_info *wip = &Weapon_info[tswp->primary_bank_weapons[tswp->current_primary_bank]]; if (dist_to_enemy < wip->max_speed * wip->lifetime) @@ -1114,7 +1114,7 @@ void ai_big_chase() int enemy_ship_type; vector predicted_enemy_pos; - Assert(aip->mode == AIM_CHASE); + SDL_assert(aip->mode == AIM_CHASE); maybe_cheat_fire_synaptic(Pl_objp, aip); @@ -1162,7 +1162,7 @@ void ai_big_chase() if ((dot_to_enemy < 0.25f) || (aip->target_time < 1.0f) || (aip->ai_flags & AIF_SEEK_LOCK)) { update_aspect_lock_information(aip, &vec_to_enemy, dist_to_enemy - En_objp->radius, En_objp->radius); } else if (aip->targeted_subsys != NULL) { - Assert(aip->targeted_subsys != NULL); + SDL_assert(aip->targeted_subsys != NULL); get_subsystem_pos(&enemy_pos, En_objp, aip->targeted_subsys); vm_vec_add2(&enemy_pos, &predicted_enemy_pos); vm_vec_sub2(&enemy_pos, &En_objp->pos); @@ -1410,7 +1410,7 @@ void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_ ai_info *aip = &Ai_info[shipp->ai_index]; ship_info *esip = &Ship_info[Ships[En_objp->instance].ship_info_index]; - Assert(aip->mode == AIM_STRAFE); + SDL_assert(aip->mode == AIM_STRAFE); // ensure that Pl_objp is still targeting a big ship if ( !(esip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) { @@ -1423,7 +1423,7 @@ void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_ player_pos = Pl_objp->pos; if (aip->targeted_subsys != NULL) { - Assert(aip->targeted_subsys != NULL); + SDL_assert(aip->targeted_subsys != NULL); get_subsystem_pos(enemy_pos, En_objp, aip->targeted_subsys); } else { // checks valid line to target @@ -1757,7 +1757,7 @@ void ai_big_strafe() aip = &Ai_info[Ships[Pl_objp->instance].ai_index]; - Assert(aip->mode == AIM_STRAFE); + SDL_assert(aip->mode == AIM_STRAFE); /* if ( aip->goal_objnum != aip->target_objnum ) { @@ -1808,7 +1808,7 @@ int ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consi object *weapon_objp, *parent_objp; aip = &Ai_info[Ships[pl_objp->instance].ai_index]; - Assert(aip->mode != AIM_STRAFE); // can't happen + SDL_assert(aip->mode != AIM_STRAFE); // can't happen // if Pl_objp has no target, then we can't enter strafe mode if ( aip->target_objnum < 0 ) { @@ -1833,11 +1833,11 @@ int ai_big_maybe_enter_strafe_mode(object *pl_objp, int weapon_objnum, int consi return 0; } - Assert(weapon_objnum >= 0 && weapon_objnum < MAX_OBJECTS); + SDL_assert(weapon_objnum >= 0 && weapon_objnum < MAX_OBJECTS); weapon_objp = &Objects[weapon_objnum]; - Assert(weapon_objp->type == OBJ_WEAPON); + SDL_assert(weapon_objp->type == OBJ_WEAPON); - Assert(weapon_objp->parent >= 0 && weapon_objp->parent < MAX_OBJECTS); + SDL_assert(weapon_objp->parent >= 0 && weapon_objp->parent < MAX_OBJECTS); parent_objp = &Objects[weapon_objp->parent]; if ( (parent_objp->signature != weapon_objp->parent_sig) || (parent_objp->type != OBJ_SHIP) ) { return 0; @@ -1880,7 +1880,7 @@ void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp) ai_info *aip; object *parent_objp; - Assert(ship_objp->type == OBJ_SHIP); + SDL_assert(ship_objp->type == OBJ_SHIP); aip = &Ai_info[Ships[ship_objp->instance].ai_index]; // Make decision to attack turret based on AI class. The better AI ships will realize that @@ -1899,7 +1899,7 @@ void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp) } // Only attack turret if it sits on current target - Assert(weapon_objp->parent >= 0 && weapon_objp->parent < MAX_OBJECTS); + SDL_assert(weapon_objp->parent >= 0 && weapon_objp->parent < MAX_OBJECTS); parent_objp = &Objects[weapon_objp->parent]; if ( (parent_objp->signature != weapon_objp->parent_sig) || (parent_objp->type != OBJ_SHIP) ) { return; diff --git a/src/ship/aicode.cpp b/src/ship/aicode.cpp index 1291af1..a9ca573 100644 --- a/src/ship/aicode.cpp +++ b/src/ship/aicode.cpp @@ -784,7 +784,7 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou // not safe. Called from sexpression code. void ai_set_rearm_status( int team, int time ) { - Assert( time >= 0 ); + SDL_assert( time >= 0 ); switch (team) { case TEAM_FRIENDLY: @@ -816,7 +816,7 @@ int ai_good_time_to_rearm( object *objp ) { int team, status; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); team = Ships[objp->instance].team; status = 0; @@ -858,7 +858,7 @@ void ai_good_secondary_time( int team, int weapon_index, int max_fire_count, cha break; } - Assert( i < MAX_HUGE_SECONDARY_INFO ); // we've run out of room + SDL_assert( i < MAX_HUGE_SECONDARY_INFO ); // we've run out of room Ai_huge_fire_info[i].weapon_index = weapon_index; Ai_huge_fire_info[i].team = team; @@ -879,7 +879,7 @@ int is_preferred_weapon(int weapon_num, object *firer_objp, object *target_objp) ship *firer_ship; huge_fire_info *hfi = NULL; - Assert( firer_objp->type == OBJ_SHIP ); + SDL_assert( firer_objp->type == OBJ_SHIP ); firer_ship = &Ships[firer_objp->instance]; firer_team = firer_ship->team; @@ -958,7 +958,7 @@ void garbage_collect_path_points() if ((aip->path_length > 0) && (aip->path_start > -1)) { for (int i=aip->path_start; ipath_start + aip->path_length; i++) { - Assert(pp_xlate[i] == 0); // If this is not 0, then two paths use this point! + SDL_assert(pp_xlate[i] == 0); // If this is not 0, then two paths use this point! pp_xlate[i] = 1; } } @@ -987,10 +987,10 @@ void garbage_collect_path_points() ai_info *aip = &Ai_info[shipp->ai_index]; if ((aip->path_length > 0) && (aip->path_start > -1)) { - Assert(aip->path_start < MAX_PATH_POINTS); + SDL_assert(aip->path_start < MAX_PATH_POINTS); aip->path_start = pp_xlate[aip->path_start]; - Assert((aip->path_cur >= 0) && (aip->path_cur < MAX_PATH_POINTS)); + SDL_assert((aip->path_cur >= 0) && (aip->path_cur < MAX_PATH_POINTS)); aip->path_cur = pp_xlate[aip->path_cur]; } } @@ -1088,7 +1088,7 @@ void parse_aitbl() required_string("#AI Classes"); while (required_string_either("#End", "$Name:")) { - Assert( Num_ai_classes < MAX_AI_CLASSES); + SDL_assert( Num_ai_classes < MAX_AI_CLASSES); parse_ai_class(); @@ -1165,7 +1165,7 @@ int is_object_stealth_ship(object* objp) // Init necessary ai info for new stealth target void init_ai_stealth_info(ai_info *aip, object *stealth_objp) { - Assert(is_object_stealth_ship(stealth_objp)); + SDL_assert(is_object_stealth_ship(stealth_objp)); // set necessary ai info for new stealth target aip->stealth_last_pos = stealth_objp->pos; @@ -1237,12 +1237,12 @@ int ai_is_stealth_visible(object *viewer_objp, object *stealth_objp) vector vec_to_stealth; float dot_to_stealth, dist_to_stealth, max_stealth_dist; - Assert(stealth_objp->type == OBJ_SHIP); + SDL_assert(stealth_objp->type == OBJ_SHIP); shipp = &Ships[stealth_objp->instance]; - Assert(viewer_objp->type == OBJ_SHIP); + SDL_assert(viewer_objp->type == OBJ_SHIP); // check if stealth ship - Assert(Ship_info[shipp->ship_info_index].flags & SIF_STEALTH); + SDL_assert(Ship_info[shipp->ship_info_index].flags & SIF_STEALTH); // check if in neb and below awac level for visible if ( !ship_is_visible_by_team(stealth_objp->instance, Ships[viewer_objp->instance].team) ) { @@ -1314,7 +1314,7 @@ void update_ai_stealth_info_with_error(ai_info *aip/*, int no_error*/) */ // make sure I am targeting a stealth ship - Assert( is_object_stealth_ship(&Objects[aip->target_objnum]) ); + SDL_assert( is_object_stealth_ship(&Objects[aip->target_objnum]) ); stealth_objp = &Objects[aip->target_objnum]; // my_ship @@ -1442,7 +1442,7 @@ void ai_update_danger_weapon(int attacked_objnum, int weapon_objnum) } } } else { - Assert(old_weapon_objp != NULL); + SDL_assert(old_weapon_objp != NULL); old_dist = compute_dots(old_weapon_objp, objp, &old_dot, NULL); if (old_dot < 0.5f) { @@ -1486,7 +1486,7 @@ void ai_turn_towards_vector(vector *dest, object *objp, curr_orient = objp->orient; delta_time = flFrametime; - Assert(turn_time > 0.0f); + SDL_assert(turn_time > 0.0f); // Scale turn_time based on skill level and team. if (!(flags & AITTV_FAST)){ @@ -1643,7 +1643,7 @@ int set_target_objnum(ai_info *aip, int objnum) // ignore this assert if a multiplayer observer if((Game_mode & GM_MULTIPLAYER) && (aip == Player_ai) && (Player_obj->type == OBJ_OBSERVER)){ } else { - Assert(objnum != Ships[aip->shipnum].objnum); // make sure not targeting self + SDL_assert(objnum != Ships[aip->shipnum].objnum); // make sure not targeting self } // if stealth target, init ai_info for stealth @@ -1666,7 +1666,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags); // Make new_subsys the targeted subsystem of ship *aip. ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int parent_objnum) { - Assert(aip != NULL); + SDL_assert(aip != NULL); aip->last_subsys_target = aip->targeted_subsys; aip->targeted_subsys = new_subsys; @@ -1703,7 +1703,7 @@ ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int pare void ai_object_init(object * obj, int ai_index) { ai_info *aip; - Assert(ai_index >= 0 && ai_index < MAX_AI_INFO); + SDL_assert(ai_index >= 0 && ai_index < MAX_AI_INFO); aip = &Ai_info[ai_index]; @@ -1941,14 +1941,14 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad vm_vec_sub(&r_vec, &objp->pos, ¢er_vec); // float r_mag = vm_vec_normalize_quick(&r_vec); // mprintf(("cur_r: %.1f, desired_r: %.1f\n", r_mag, radius)); - Assert( (vm_vec_dotprod(&r_vec, ¢er_objp->orient.v.fvec) < 0.0001)); + SDL_assert( (vm_vec_dotprod(&r_vec, ¢er_objp->orient.v.fvec) < 0.0001)); // get theta vec - perp to r_vec and z_vec vm_vec_crossprod(&theta_vec, ¢er_objp->orient.v.fvec, &r_vec); #ifndef NDEBUG float mag = vm_vec_normalize(&theta_vec); - Assert(mag > 0.9999 && mag < 1.0001); + SDL_assert(mag > 0.9999 && mag < 1.0001); #endif vector temp; @@ -1956,7 +1956,7 @@ float turn_toward_tangent_with_axis(object *objp, object *center_objp, float rad #ifndef NDEBUG float dot = vm_vec_dotprod(&temp, ¢er_objp->orient.v.fvec); - Assert( dot >0.9999 && dot < 1.0001); + SDL_assert( dot >0.9999 && dot < 1.0001); #endif // find pt on clylinder with closest z @@ -2044,7 +2044,7 @@ int num_enemies_attacking(int objnum) for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { objp = &Objects[so->objnum]; - Assert(objp->instance != -1); + SDL_assert(objp->instance != -1); sp = &Ships[objp->instance]; if (Ai_info[sp->ai_index].target_objnum == objnum) @@ -2139,10 +2139,10 @@ float get_wing_lowest_max_speed(object *objp) object *o; ship_obj *so; - Assert(objp->type == OBJ_SHIP); - Assert((objp->instance >= 0) && (objp->instance < MAX_OBJECTS)); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_OBJECTS)); shipp = &Ships[objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); aip = &Ai_info[shipp->ai_index]; wingnum = aip->wing; @@ -2152,7 +2152,7 @@ float get_wing_lowest_max_speed(object *objp) if ( wingnum == -1 ) return lowest_max_speed; - Assert(wingnum >= 0); + SDL_assert(wingnum >= 0); for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { o = &Objects[so->objnum]; @@ -2185,7 +2185,7 @@ void set_global_ignore_object(int objnum) { int i; - Assert(Objects[objnum].type == OBJ_SHIP); + SDL_assert(Objects[objnum].type == OBJ_SHIP); nprintf(("AI", "Telling everyone to ignore object %s\n", Ships[Objects[objnum].instance].ship_name)); @@ -2261,8 +2261,8 @@ int is_ignore_object(ai_info *aip, int objnum) return 0; /* int ignore_wingnum = -(aip->ignore_objnum + 1); - Assert(ignore_wingnum < MAX_WINGS); - Assert(aip->shipnum >= 0); + SDL_assert(ignore_wingnum < MAX_WINGS); + SDL_assert(aip->shipnum >= 0); return (Ships[Objects[objnum].instance].wingnum == ignore_wingnum); */ } } @@ -2434,7 +2434,7 @@ int get_nearest_objnum(int objnum, int enemy_team_mask, int enemy_wing, float ra danger_weapon_objp = &Objects[aip->danger_weapon_objnum]; // validate weapon if (danger_weapon_objp->signature == aip->danger_weapon_signature) { - Assert(danger_weapon_objp->type == OBJ_WEAPON); + SDL_assert(danger_weapon_objp->type == OBJ_WEAPON); // check if parent is a ship if (danger_weapon_objp->parent >= 0) { if ( is_object_stealth_ship(&Objects[danger_weapon_objp->parent]) ) { @@ -2597,8 +2597,8 @@ int num_turrets_attacking(object *turret_parent, int target_objnum) int count = 0; shipp = &Ships[turret_parent->instance]; - Assert(turret_parent->type == OBJ_SHIP); - Assert(Objects[target_objnum].type == OBJ_SHIP); + SDL_assert(turret_parent->type == OBJ_SHIP); + SDL_assert(Objects[target_objnum].type == OBJ_SHIP); for (ss=GET_FIRST(&shipp->subsys_list); ss!=END_OF_LIST(&shipp->subsys_list); ss=GET_NEXT(ss)) { // check if subsys is alive @@ -2904,7 +2904,7 @@ int get_nearest_turret_objnum(int turret_parent_objnum, ship_subsys *turret_subs evaluate_obj_as_target(objp, &eeo); } - Assert(eeo.nearest_attacker_objnum < 0 || is_target_beam_valid(turret_subsys, eeo.nearest_attacker_objnum)); + SDL_assert(eeo.nearest_attacker_objnum < 0 || is_target_beam_valid(turret_subsys, eeo.nearest_attacker_objnum)); // next highest priority is attacking ship if ( eeo.nearest_attacker_objnum != -1 ) { // next highest priority is an attacking ship return eeo.nearest_attacker_objnum; @@ -3048,7 +3048,7 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vector *tpos, vect enemy_objnum = get_nearest_turret_objnum(objnum, turret_subsys, enemy_team_mask, tpos, tvec, current_enemy, big_only_flag); if ( enemy_objnum >= 0 ) { - Assert( !((Objects[enemy_objnum].flags & OF_BEAM_PROTECTED) && (Weapon_info[tp->turret_weapon_type].wi_flags & WIF_BEAM)) ); + SDL_assert( !((Objects[enemy_objnum].flags & OF_BEAM_PROTECTED) && (Weapon_info[tp->turret_weapon_type].wi_flags & WIF_BEAM)) ); if ( Objects[enemy_objnum].flags & OF_PROTECTED ) { Int3(); enemy_objnum = aip->target_objnum; @@ -3090,16 +3090,16 @@ void ai_attack_object(object *attacker, object *attacked, int priority, ship_sub { ai_info *aip; - Assert(attacker != NULL); - Assert(attacker->instance != -1); - Assert(Ships[attacker->instance].ai_index != -1); + SDL_assert(attacker != NULL); + SDL_assert(attacker->instance != -1); + SDL_assert(Ships[attacker->instance].ai_index != -1); aip = &Ai_info[Ships[attacker->instance].ai_index]; force_avoid_player_check(attacker, aip); aip->ok_to_target_timestamp = timestamp(0); // Guarantee we can target. -// if (!strnicmp(Ships[attacker->instance].ship_name, NOX("Kami"), 4)) { +// if (!SDL_strncasecmp(Ships[attacker->instance].ship_name, NOX("Kami"), 4)) { // aip->ai_flags |= AIF_KAMIKAZE; // aip->ai_flags |= AIF_NO_DYNAMIC; // } @@ -3157,9 +3157,9 @@ void ai_attack_wing(object *attacker, int wingnum, int priority) { ai_info *aip; - Assert(attacker != NULL); - Assert(attacker->instance != -1); - Assert(Ships[attacker->instance].ai_index != -1); + SDL_assert(attacker != NULL); + SDL_assert(attacker->instance != -1); + SDL_assert(Ships[attacker->instance].ai_index != -1); aip = &Ai_info[Ships[attacker->instance].ai_index]; @@ -3192,10 +3192,10 @@ void ai_evade_object(object *evader, object *evaded, int priority) { ai_info *aip; - Assert(evader != NULL); - Assert(evaded != NULL); - Assert(evader->instance != -1); - Assert(Ships[evader->instance].ai_index != -1); + SDL_assert(evader != NULL); + SDL_assert(evaded != NULL); + SDL_assert(evader->instance != -1); + SDL_assert(Ships[evader->instance].ai_index != -1); if (evaded == evader) { Int3(); // Bogus! Who tried to get me to evade myself! Trace out and fix! @@ -3214,11 +3214,11 @@ void ai_ignore_object(object *ignorer, object *ignored, int priority) { ai_info *aip; - Assert(ignorer != NULL); - Assert(ignored != NULL); - Assert(ignorer->instance != -1); - Assert(Ships[ignorer->instance].ai_index != -1); - Assert(ignorer != ignored); + SDL_assert(ignorer != NULL); + SDL_assert(ignored != NULL); + SDL_assert(ignorer->instance != -1); + SDL_assert(Ships[ignorer->instance].ai_index != -1); + SDL_assert(ignorer != ignored); aip = &Ai_info[Ships[ignorer->instance].ai_index]; @@ -3258,10 +3258,10 @@ void ai_ignore_wing(object *ignorer, int wingnum, int priority) { ai_info *aip; - Assert(ignorer != NULL); - Assert(ignorer->instance != -1); - Assert(Ships[ignorer->instance].ai_index != -1); - Assert((wingnum >= 0) && (wingnum < MAX_WINGS)); + SDL_assert(ignorer != NULL); + SDL_assert(ignorer->instance != -1); + SDL_assert(Ships[ignorer->instance].ai_index != -1); + SDL_assert((wingnum >= 0) && (wingnum < MAX_WINGS)); aip = &Ai_info[Ships[ignorer->instance].ai_index]; @@ -3279,11 +3279,11 @@ void add_path_point(vector *pos, int path_num, int path_index, int modify_index) pnode *pnp; if (modify_index == -1) { - Assert(Ppfp-Path_points < MAX_PATH_POINTS-1); + SDL_assert(Ppfp-Path_points < MAX_PATH_POINTS-1); pnp = Ppfp; Ppfp++; } else { - Assert((modify_index >= 0) && (modify_index < MAX_PATH_POINTS-1)); + SDL_assert((modify_index >= 0) && (modify_index < MAX_PATH_POINTS-1)); pnp = &Path_points[modify_index]; } @@ -3392,7 +3392,7 @@ void copy_xlate_model_path_points(object *objp, model_path *mp, int dir, int cou start_index = 0; finish_index = min(count, mp->nverts); } else { - Assert(dir == -1); // direction must be up by 1 or down by 1 and it's neither! + SDL_assert(dir == -1); // direction must be up by 1 or down by 1 and it's neither! start_index = mp->nverts-1; finish_index = max(-1, mp->nverts-1-count); } @@ -3439,7 +3439,7 @@ void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_ matrix m; vector gp0; - Assert(path_num >= 0); + SDL_assert(path_num >= 0); // Do garbage collection if necessary. if (Ppfp-Path_points + 64 > MAX_PATH_POINTS) { @@ -3448,12 +3448,12 @@ void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_ } aip->path_start = Ppfp - Path_points; - Assert(path_num < pm->n_paths); + SDL_assert(path_num < pm->n_paths); mp = &pm->paths[path_num]; num_points = mp->nverts; - Assert(Ppfp-Path_points + num_points + 4 < MAX_PATH_POINTS); + SDL_assert(Ppfp-Path_points + num_points + 4 < MAX_PATH_POINTS); vm_copy_transpose_matrix(&m, &mobjp->orient); vm_vec_rotate(&gp0, &mp->verts[0].pos, &m); @@ -3521,12 +3521,12 @@ void create_model_exit_path(object *pl_objp, object *mobjp, int path_num, int co pnode *ppfp_start = Ppfp; aip->path_start = Ppfp - Path_points; - Assert(path_num < pm->n_paths); + SDL_assert(path_num < pm->n_paths); mp = &pm->paths[path_num]; num_points = mp->nverts; - Assert(Ppfp-Path_points + num_points + 4 < MAX_PATH_POINTS); + SDL_assert(Ppfp-Path_points + num_points + 4 < MAX_PATH_POINTS); copy_xlate_model_path_points(mobjp, mp, -1, count, path_num, NULL); @@ -3579,7 +3579,7 @@ void ai_find_path(object *pl_objp, int objnum, int path_num, int exit_flag, int { ai_info *aip = &Ai_info[Ships[pl_objp->instance].ai_index]; - Assert(path_num >= 0); + SDL_assert(path_num >= 0); // This is test code, find an object with paths. if (objnum != -1) { @@ -3590,7 +3590,7 @@ void ai_find_path(object *pl_objp, int objnum, int path_num, int exit_flag, int ship *shipp = &Ships[objp->instance]; pm = model_get( shipp->modelnum ); - Assert(pm->n_paths > path_num); + SDL_assert(pm->n_paths > path_num); aip->goal_objnum = objp-Objects; aip->goal_signature = objp->signature; if (exit_flag) @@ -3685,11 +3685,11 @@ void ai_stay_still(object *still_objp, vector *view_pos) ship *shipp; ai_info *aip; - Assert(still_objp->type == OBJ_SHIP); - Assert((still_objp->instance >= 0) && (still_objp->instance < MAX_OBJECTS)); + SDL_assert(still_objp->type == OBJ_SHIP); + SDL_assert((still_objp->instance >= 0) && (still_objp->instance < MAX_OBJECTS)); shipp = &Ships[still_objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); aip = &Ai_info[shipp->ai_index]; @@ -3770,13 +3770,13 @@ void ai_dock_with_object(object *docker, object *dockee, int priority, int dock_ polymodel *pm; ai_info *dockee_aip; - Assert(docker != NULL); - Assert(dockee != NULL); - Assert(docker->instance != -1); - Assert(Ships[docker->instance].ai_index != -1); - Assert(Ships[dockee->instance].ai_index != -1); - Assert( docker_index != -1 ); - Assert( dockee_index != -1 ); + SDL_assert(docker != NULL); + SDL_assert(dockee != NULL); + SDL_assert(docker->instance != -1); + SDL_assert(Ships[docker->instance].ai_index != -1); + SDL_assert(Ships[dockee->instance].ai_index != -1); + SDL_assert( docker_index != -1 ); + SDL_assert( dockee_index != -1 ); aip = &Ai_info[Ships[docker->instance].ai_index]; @@ -3784,7 +3784,7 @@ void ai_dock_with_object(object *docker, object *dockee, int priority, int dock_ object *dockee2; int docker_index2, dockee_index2; - Assert(aip->dock_objnum > -1); + SDL_assert(aip->dock_objnum > -1); dockee2 = &Objects[aip->dock_objnum]; docker_index2 = aip->dock_index; dockee_index2 = aip->dockee_index; @@ -3833,7 +3833,7 @@ void ai_dock_with_object(object *docker, object *dockee, int priority, int dock_ // We only want to do this stuff if we are docking!!! Be sure to set the path index if ((dock_type == AIDO_DOCK) || (dock_type == AIDO_DOCK_NOW)) { pm = model_get( Ships[dockee->instance].modelnum ); - Assert( pm->docking_bays[dockee_index].num_spline_paths > 0 ); + SDL_assert( pm->docking_bays[dockee_index].num_spline_paths > 0 ); // only set the dock path index if we are docking. undocking will assume that dock_path_index // already set from some other docking command @@ -3864,7 +3864,7 @@ void ai_start_waypoints(object *objp, int waypoint_list_index, int wp_flags) { ai_info *aip; - Assert(waypoint_list_index < Num_waypoint_lists); + SDL_assert(waypoint_list_index < Num_waypoint_lists); //nprintf(("AI", "Frame %i: Ship %s instructed to fly waypoint list #%i\n", AI_FrameCount, Ships[objp->instance].ship_name, waypoint_list_index)); aip = &Ai_info[Ships[objp->instance].ai_index]; @@ -3879,7 +3879,7 @@ void ai_start_waypoints(object *objp, int waypoint_list_index, int wp_flags) aip->wp_flags = wp_flags; aip->mode = AIM_WAYPOINTS; - Assert(aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC); + SDL_assert(aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC); } // Make *objp stay within dist units of *other_objp @@ -3887,9 +3887,9 @@ void ai_do_stay_near(object *objp, object *other_objp, float dist) { ai_info *aip; - Assert(objp != other_objp); // Bogus! Told to stay near self. - Assert(objp->type == OBJ_SHIP); - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert(objp != other_objp); // Bogus! Told to stay near self. + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); aip = &Ai_info[Ships[objp->instance].ai_index]; @@ -3916,7 +3916,7 @@ void ai_form_on_wing(object *objp, object *goal_objp) } } - Assert(objp != goal_objp); // Bogus! Told to form on own's wing! + SDL_assert(objp != goal_objp); // Bogus! Told to form on own's wing! shipp = &Ships[objp->instance]; sip = &Ship_info[shipp->ship_info_index]; @@ -3955,7 +3955,7 @@ int ai_formation_object_get_slotnum(int objnum, object *objp) slotnum++; } - Assert(o != END_OF_LIST(&obj_used_list)); // Didn't find objp in list of used ships. Impossible! + SDL_assert(o != END_OF_LIST(&obj_used_list)); // Didn't find objp in list of used ships. Impossible! return slotnum; } @@ -4147,7 +4147,7 @@ int find_nearest_waypoint(object *objp) shipp = &Ships[objp->instance]; wp_listnum = Ai_info[Ships[objp->instance].ai_index].wp_list; - Assert(wp_listnum > 0); + SDL_assert(wp_listnum > 0); wpl = &Waypoint_lists[wp_listnum]; min_dist = 999999.0f; @@ -4163,7 +4163,7 @@ int find_nearest_waypoint(object *objp) } } - Assert(min_ind != -1); + SDL_assert(min_ind != -1); return min_ind; } @@ -4214,16 +4214,16 @@ void modify_model_path_points(object *objp) pnode *pnp; int path_num, dir; - Assert((aip->path_start >= 0) && (aip->path_start < MAX_PATH_POINTS)); + SDL_assert((aip->path_start >= 0) && (aip->path_start < MAX_PATH_POINTS)); pnp = &Path_points[aip->path_start]; while ((pnp->path_index == -1) && (pnp-Path_points - aip->path_start < aip->path_length)) pnp++; path_num = pnp->path_num; - Assert((path_num >= 0) && (path_num < pm->n_paths)); + SDL_assert((path_num >= 0) && (path_num < pm->n_paths)); - Assert(pnp->path_index != -1); // If this is -1, that means we never found the model path points + SDL_assert(pnp->path_index != -1); // If this is -1, that means we never found the model path points dir = 1; if ( aip->ai_flags & AIF_USE_EXIT_PATH ) { @@ -4256,7 +4256,7 @@ float maybe_recreate_path(object *objp, ai_info *aip, int force_recreate_flag) { int hashval; - Assert(&Ai_info[Ships[objp->instance].ai_index] == aip); + SDL_assert(&Ai_info[Ships[objp->instance].ai_index] == aip); if ((aip->mode == AIM_BAY_EMERGE) || (aip->mode == AIM_BAY_DEPART)) if ((OBJ_INDEX(objp) % 4) == (Framecount % 4)) @@ -4405,20 +4405,20 @@ float ai_path() aip = &Ai_info[Ships[Pl_objp->instance].ai_index]; - Assert(aip->goal_objnum != -1); - Assert(Objects[aip->goal_objnum].type == OBJ_SHIP); + SDL_assert(aip->goal_objnum != -1); + SDL_assert(Objects[aip->goal_objnum].type == OBJ_SHIP); gobjp = &Objects[aip->goal_objnum]; gshipp = &Ships[gobjp->instance]; pm = model_get( gshipp->modelnum ); num_paths = pm->n_paths; - Assert(num_paths > 0); + SDL_assert(num_paths > 0); if (aip->path_start == -1) { int path_num; path_num = ai_return_path_num_from_dockbay(&Objects[aip->goal_objnum], aip->dockee_index); - Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS); + SDL_assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS); ai_find_path(Pl_objp, aip->goal_objnum, path_num, 0); } @@ -4434,8 +4434,8 @@ float ai_path() nvp = &Path_points[aip->path_cur + aip->path_dir].pos; else { // If this is 0, then path length must be 1 which means we have no direction! - Assert((aip->path_cur - aip->path_dir >= aip->path_start) && (aip->path_cur - aip->path_dir - aip->path_start < num_points)); - // Cleanup for above Assert() which we hit too near release. -- MK, 5/24/98. + SDL_assert((aip->path_cur - aip->path_dir >= aip->path_start) && (aip->path_cur - aip->path_dir - aip->path_start < num_points)); + // Cleanup for above SDL_assert() which we hit too near release. -- MK, 5/24/98. if (aip->path_cur - aip->path_dir - aip->path_start >= num_points) { if (aip->path_dir == 1) aip->path_cur = aip->path_start; @@ -4538,7 +4538,7 @@ float ai_path() aip->path_cur += aip->path_dir; //nprintf(("AI", " Near: Advancing from point %i to %i of %i points.\n", aip->path_cur-aip->path_dir, aip->path_cur, num_points)); if (((aip->path_cur - aip->path_start) > (num_points+1)) || (aip->path_cur < aip->path_start)) { - Assert(aip->mode != AIM_DOCK); // If docking, should never get this far, getting to last point handled outside ai_path() + SDL_assert(aip->mode != AIM_DOCK); // If docking, should never get this far, getting to last point handled outside ai_path() aip->path_dir = -aip->path_dir; // aip->path_cur += aip->path_dir; } @@ -4717,7 +4717,7 @@ void ai_waypoints() wpl = &Waypoint_lists[Ai_info[Ships[Pl_objp->instance].ai_index].wp_list]; - Assert(wpl->count); // What? Is this zero? Probably wp_index never got initialized! + SDL_assert(wpl->count); // What? Is this zero? Probably wp_index never got initialized! wp_cur = &wpl->waypoints[wp_index]; wp_next = &wpl->waypoints[(wp_index+1) % wpl->count]; @@ -4857,9 +4857,9 @@ void ai_waypoints() int type; // I don't think that you can fly waypoints as dynamic goals!!! - // -- This is legal, just stupid. -- Assert( (aip->active_goal != AI_GOAL_NONE) && (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC) ); + // -- This is legal, just stupid. -- SDL_assert( (aip->active_goal != AI_GOAL_NONE) && (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC) ); - // Clean up from above Assert, just in case we ship without fixing it. (Encountered by JimB on 2/9/98) + // Clean up from above SDL_assert, just in case we ship without fixing it. (Encountered by JimB on 2/9/98) if ( (aip->active_goal == AI_GOAL_NONE) || (aip->active_goal == AI_ACTIVE_GOAL_DYNAMIC) ) { aip->mode = AIM_NONE; Int3(); // Look at the ship, find out of it's supposed to be flying waypoints. -- MK. @@ -4978,7 +4978,7 @@ int maybe_resume_previous_mode(object *objp, ai_info *aip) if (aip->mode == AIM_EVADE_WEAPON) { if (timestamp_elapsed(aip->mode_time) || (((aip->nearest_locked_object == -1) || (Objects[aip->nearest_locked_object].type != OBJ_WEAPON)) && (aip->danger_weapon_objnum == -1))) { - Assert(aip->previous_mode != AIM_EVADE_WEAPON); + SDL_assert(aip->previous_mode != AIM_EVADE_WEAPON); aip->mode = aip->previous_mode; aip->submode = aip->previous_submode; aip->submode_start_time = Missiontime; @@ -4999,7 +4999,7 @@ int maybe_resume_previous_mode(object *objp, ai_info *aip) if (dist > (MAX_GUARD_DIST + guard_objp->radius) * 6) { if ((En_objp != NULL) && (En_objp->type == OBJ_SHIP)) { if (vm_vec_dist_quick(&guard_objp->pos, &En_objp->pos) > (MAX_GUARD_DIST + guard_objp->radius) * 6) { - Assert(aip->previous_mode == AIM_GUARD); + SDL_assert(aip->previous_mode == AIM_GUARD); aip->mode = aip->previous_mode; aip->submode = AIS_GUARD_PATROL; aip->active_goal = AI_GOAL_NONE; @@ -5094,7 +5094,7 @@ void maybe_afterburner_after_ship_hit(object *objp, ai_info *aip, object *en_obj // Is an instructor if name begins INSTRUCTOR_SHIP_NAME else not. int is_instructor(object *objp) { - return !strnicmp(Ships[objp->instance].ship_name, INSTRUCTOR_SHIP_NAME, strlen(INSTRUCTOR_SHIP_NAME)); + return !SDL_strncasecmp(Ships[objp->instance].ship_name, INSTRUCTOR_SHIP_NAME, strlen(INSTRUCTOR_SHIP_NAME)); } // Evade the weapon aip->danger_weapon_objnum @@ -5146,7 +5146,7 @@ void evade_weapon() return; } - Assert(weapon_objp != NULL); + SDL_assert(weapon_objp != NULL); if (weapon_objp->type != OBJ_WEAPON) { if (aip->mode == AIM_EVADE_WEAPON) @@ -5481,8 +5481,8 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags) ship_weapon *swp = &shipp->weapons; ship_info *sip; - //Assert( other_objp != NULL ); - Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); + //SDL_assert( other_objp != NULL ); + SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); sip = &Ship_info[shipp->ship_info_index]; @@ -5536,7 +5536,7 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags) // Wasn't able to find a non-puncture weapon. Stick with what we have. } - Assert( swp->current_primary_bank != -1 ); // get Alan or Allender + SDL_assert( swp->current_primary_bank != -1 ); // get Alan or Allender return swp->current_primary_bank; } @@ -5618,7 +5618,7 @@ void ai_fire_primary_weapon(object *objp) ai_info *aip; object *enemy_objp; - Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); + SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); sip = &Ship_info[shipp->ship_info_index]; aip = &Ai_info[shipp->ai_index]; @@ -5881,7 +5881,7 @@ void ai_maybe_announce_shockwave_weapon(object *firing_objp, int weapon_index) for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { object *A = &Objects[so->objnum]; - Assert(A->type == OBJ_SHIP); + SDL_assert(A->type == OBJ_SHIP); if (Ships[A->instance].team == firing_ship_team) { ai_info *aip = &Ai_info[Ships[A->instance].ai_index]; @@ -5904,7 +5904,7 @@ float compute_incoming_payload(object *target_objp) object *objp; objp = &Objects[mo->objnum]; - Assert(objp->type == OBJ_WEAPON); + SDL_assert(objp->type == OBJ_WEAPON); if (Weapons[objp->instance].homing_object == target_objp) { payload += Weapon_info[Weapons[objp->instance].weapon_info_index].damage; } @@ -5994,12 +5994,12 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2) return rval; #endif - Assert( objp != NULL ); - Assert(objp->type == OBJ_SHIP); + SDL_assert( objp != NULL ); + SDL_assert(objp->type == OBJ_SHIP); shipp = &Ships[objp->instance]; swp = &shipp->weapons; - Assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); + SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); sip = &Ship_info[shipp->ship_info_index]; // Select secondary weapon. @@ -6011,7 +6011,7 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2) return rval; } - Assert(current_bank < shipp->weapons.num_secondary_banks); + SDL_assert(current_bank < shipp->weapons.num_secondary_banks); weapon_info *wip = &Weapon_info[shipp->weapons.secondary_bank_weapons[current_bank]]; @@ -6444,9 +6444,9 @@ void ai_chase_ct() ship_info *sip; ai_info *aip; - Assert(Ships[Pl_objp->instance].ship_info_index >= 0); + SDL_assert(Ships[Pl_objp->instance].ship_info_index >= 0); sip = &Ship_info[Ships[Pl_objp->instance].ship_info_index]; - Assert(Ships[Pl_objp->instance].ai_index >= 0); + SDL_assert(Ships[Pl_objp->instance].ai_index >= 0); aip = &Ai_info[Ships[Pl_objp->instance].ai_index]; // Make a continuous turn towards any combination of possibly negated @@ -6793,7 +6793,7 @@ void mabs_pick_goal_point(object *objp, object *big_objp, vector *collision_poin } } - Assert(i != -1); + SDL_assert(i != -1); if (i != -1) { *avoid_pos = goals[min_index].pos; return; @@ -6869,9 +6869,9 @@ void ai_stealth_find() vector new_pos, vec_to_enemy; float dist_to_enemy, dot_to_enemy, dot_from_enemy; - Assert(Ships[Pl_objp->instance].ship_info_index >= 0); + SDL_assert(Ships[Pl_objp->instance].ship_info_index >= 0); sip = &Ship_info[Ships[Pl_objp->instance].ship_info_index]; - Assert(Ships[Pl_objp->instance].ai_index >= 0); + SDL_assert(Ships[Pl_objp->instance].ai_index >= 0); aip = &Ai_info[Ships[Pl_objp->instance].ai_index]; // get time since last seen @@ -6950,9 +6950,9 @@ void ai_stealth_sweep() ai_info *aip; ship_info *sip; - Assert(Ships[Pl_objp->instance].ship_info_index >= 0); + SDL_assert(Ships[Pl_objp->instance].ship_info_index >= 0); sip = &Ship_info[Ships[Pl_objp->instance].ship_info_index]; - Assert(Ships[Pl_objp->instance].ai_index >= 0); + SDL_assert(Ships[Pl_objp->instance].ai_index >= 0); aip = &Ai_info[Ships[Pl_objp->instance].ai_index]; vector goal_pt; @@ -7214,11 +7214,11 @@ int ai_set_attack_subsystem(object *objp, int subnum) ship_subsys *ssp; object *attacked_objp; - Assert(objp->type == OBJ_SHIP); - Assert(objp->instance >= 0); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance >= 0); attacker_shipp = &Ships[objp->instance]; - Assert(attacker_shipp->ai_index >= 0); + SDL_assert(attacker_shipp->ai_index >= 0); aip = &Ai_info[attacker_shipp->ai_index]; @@ -7255,7 +7255,7 @@ void ai_set_guard_vec(object *objp, object *guard_objp) aip = &Ai_info[Ships[objp->instance].ai_index]; // Handle case of bogus call in which ship is told to guard self. - Assert(objp != guard_objp); + SDL_assert(objp != guard_objp); if (objp == guard_objp) { vm_vec_rand_vec_quick(&aip->guard_vec); vm_vec_scale(&aip->guard_vec, 100.0f); @@ -7292,10 +7292,10 @@ void ai_set_guard_wing(object *objp, int wingnum) ai_info *aip; int leader_objnum, leader_shipnum; - Assert(wingnum >= 0); + SDL_assert(wingnum >= 0); - Assert(objp->type == OBJ_SHIP); - Assert(objp->instance >= 0); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance >= 0); // shouldn't set the ai mode for the player if ( objp == Player_obj ) { @@ -7304,7 +7304,7 @@ void ai_set_guard_wing(object *objp, int wingnum) shipp = &Ships[objp->instance]; - Assert(shipp->ai_index >= 0); + SDL_assert(shipp->ai_index >= 0); aip = &Ai_info[shipp->ai_index]; force_avoid_player_check(objp, aip); @@ -7322,8 +7322,8 @@ void ai_set_guard_wing(object *objp, int wingnum) leader_shipnum = Wings[wingnum].ship_index[0]; leader_objnum = Ships[leader_shipnum].objnum; - Assert((leader_objnum >= 0) && (leader_objnum < MAX_OBJECTS)); - //Assert(leader_objnum != objp-Objects); // Don't allow ships to guard themselves. + SDL_assert((leader_objnum >= 0) && (leader_objnum < MAX_OBJECTS)); + //SDL_assert(leader_objnum != objp-Objects); // Don't allow ships to guard themselves. if (leader_objnum == OBJ_INDEX(objp)) { //Int3(); // Seems illegal, but let's clean up. Get MikeK. return; @@ -7347,19 +7347,19 @@ void ai_set_evade_object(object *objp, object *other_objp) ai_info *aip; int other_objnum; - Assert(objp->type == OBJ_SHIP); - Assert(objp->instance >= 0); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance >= 0); shipp = &Ships[objp->instance]; - Assert(shipp->ai_index >= 0); + SDL_assert(shipp->ai_index >= 0); aip = &Ai_info[shipp->ai_index]; other_objnum = OBJ_INDEX(other_objp); - Assert(other_objnum >= 0); + SDL_assert(other_objnum >= 0); - Assert(other_objnum != Ships[aip->shipnum].objnum); // make sure not targeting self + SDL_assert(other_objnum != Ships[aip->shipnum].objnum); // make sure not targeting self aip->target_objnum = other_objnum; aip->mode = AIM_EVADE; @@ -7374,13 +7374,13 @@ void ai_set_guard_object(object *objp, object *other_objp) ai_info *aip; int other_objnum; - Assert(objp->type == OBJ_SHIP); - Assert(objp->instance >= 0); - Assert(objp != other_objp); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance >= 0); + SDL_assert(objp != other_objp); shipp = &Ships[objp->instance]; - Assert(shipp->ai_index >= 0); + SDL_assert(shipp->ai_index >= 0); aip = &Ai_info[shipp->ai_index]; aip->avoid_check_timestamp = timestamp(1); @@ -7400,7 +7400,7 @@ void ai_set_guard_object(object *objp, object *other_objp) aip->mode = AIM_GUARD; aip->submode = AIS_GUARD_STATIC; - Assert(other_objnum >= 0); // Hmm, bogus object and we need its position for guard_vec. + SDL_assert(other_objnum >= 0); // Hmm, bogus object and we need its position for guard_vec. // vm_vec_sub(&aip->guard_vec, &objp->pos, &Objects[other_objnum].pos); ai_set_guard_vec(objp, &Objects[other_objnum]); @@ -7773,11 +7773,11 @@ int maybe_hack_cruiser_chase_abort() ai_info *aip = &Ai_info[shipp->ai_index]; // mission sm3-08, sathanos chasing collosus - if ( stricmp(Mission_filename, "sm3-08.fs2") == 0 ) { - if (( stricmp(eshipp->ship_name, "colossus") == 0 ) || ( stricmp(shipp->ship_name, "colossus") == 0 )) { + if ( SDL_strcasecmp(Mission_filename, "sm3-08.fs2") == 0 ) { + if (( SDL_strcasecmp(eshipp->ship_name, "colossus") == 0 ) || ( SDL_strcasecmp(shipp->ship_name, "colossus") == 0 )) { // Changed so all big ships attacking the Colossus will not do the chase code. // Did this so Beast wouldn't swerve away from Colossus. -- MK, 9/14/99 - //if ( stricmp(shipp->ship_name, "Sathanas") == 0 ) { + //if ( SDL_strcasecmp(shipp->ship_name, "Sathanas") == 0 ) { // do cool hack stuff here ai_clear_ship_goals( aip ); aip->mode = AIM_NONE; @@ -7837,7 +7837,7 @@ void ai_cruiser_chase() // really track down and chase else { // check valid submode - Assert( (aip->submode == SM_ATTACK) || (aip->submode == SM_BIG_APPROACH) || (aip->submode == SM_BIG_CIRCLE) || (aip->submode == SM_BIG_PARALLEL) ); + SDL_assert( (aip->submode == SM_ATTACK) || (aip->submode == SM_BIG_APPROACH) || (aip->submode == SM_BIG_CIRCLE) || (aip->submode == SM_BIG_PARALLEL) ); // just entering, approach enemy ship if (aip->submode == SM_ATTACK) { @@ -8046,7 +8046,7 @@ void ai_chase() // Set predicted_enemy_pos. // See if attacking a subsystem. if (aip->targeted_subsys != NULL) { - Assert(En_objp->type == OBJ_SHIP); + SDL_assert(En_objp->type == OBJ_SHIP); ship_info *esip = &Ship_info[Ships[En_objp->instance].ship_info_index]; if (get_shield_strength(En_objp)/esip->shields < HULL_DAMAGE_THRESHOLD_PERCENT) { //int rval; @@ -8437,7 +8437,7 @@ void ai_chase() tswp = &temp_shipp->weapons; if ( tswp->num_primary_banks > 0 ) { float scale; - Assert(tswp->current_primary_bank < tswp->num_primary_banks); + SDL_assert(tswp->current_primary_bank < tswp->num_primary_banks); weapon_info *pwip = &Weapon_info[tswp->primary_bank_weapons[tswp->current_primary_bank]]; // Less likely to fire if far away and moving. @@ -8635,11 +8635,11 @@ float dock_orient_and_approach(object *objp, object *dobjp, int dock_mode) docker_index = aip->dock_index; dockee_index = aip->dockee_index; - Assert( docker_index >= 0 ); - Assert( dockee_index >= 0 ); + SDL_assert( docker_index >= 0 ); + SDL_assert( dockee_index >= 0 ); - Assert(pm0->docking_bays[docker_index].num_slots == 2); - Assert(pm1->docking_bays[dockee_index].num_slots == 2); + SDL_assert(pm0->docking_bays[docker_index].num_slots == 2); + SDL_assert(pm1->docking_bays[dockee_index].num_slots == 2); float speed_scale = 1.0f; if (sip0->flags & SIF_SUPPORT) { @@ -8753,7 +8753,7 @@ float dock_orient_and_approach(object *objp, object *dobjp, int dock_mode) dock_move_towards_point(objp, &docker_point, &goal_point, speed_scale, dobjp->phys_info.speed); } else { - Assert(dock_mode == DOA_DOCK_STAY); + SDL_assert(dock_mode == DOA_DOCK_STAY); objp->orient = dom; vector temp; vm_vec_sub(&temp, &goal_point, &docker_point); @@ -8768,7 +8768,7 @@ float dock_orient_and_approach(object *objp, object *dobjp, int dock_mode) // Undocking. // Move to point on dock path nearest to dock station. - Assert(aip->path_length >= 2); + SDL_assert(aip->path_length >= 2); goal_point = Path_points[aip->path_start + aip->path_length-2].pos; vm_vec_zero(&docker_point); @@ -8788,7 +8788,7 @@ float dock_orient_and_approach(object *objp, object *dobjp, int dock_mode) return 9999.9f; } - Assert(aip->path_length >= 2); + SDL_assert(aip->path_length >= 2); // if (aip->path_length >= 3) // desired_index = aip->path_length-3; // else @@ -8845,7 +8845,7 @@ float dock_orient_and_approach(object *objp, object *dobjp, int dock_mode) // vm_vec_dot(&d0, &d1))); #endif - // -- Note, A lot of callers don't care about fdist, so OK to return ERROR value: Assert(fdist != UNINITIALIZED_VALUE); + // -- Note, A lot of callers don't care about fdist, so OK to return ERROR value: SDL_assert(fdist != UNINITIALIZED_VALUE); return fdist; } @@ -8928,9 +8928,9 @@ void remove_farthest_attacker(int objnum) if (farthest_objp != NULL) { ai_info *aip; - Assert(farthest_objp->type == OBJ_SHIP); - Assert((farthest_objp->instance > -1) && (farthest_objp->instance < MAX_SHIPS)); - Assert(Ships[farthest_objp->instance].ai_index > -1); + SDL_assert(farthest_objp->type == OBJ_SHIP); + SDL_assert((farthest_objp->instance > -1) && (farthest_objp->instance < MAX_SHIPS)); + SDL_assert(Ships[farthest_objp->instance].ai_index > -1); aip = &Ai_info[Ships[farthest_objp->instance].ai_index]; @@ -8996,7 +8996,7 @@ void guard_object_was_hit(object *guard_objp, object *hitter_objp) if (aip->ai_flags & AIF_NO_DYNAMIC) // Not allowed to pursue dynamic goals. So, why are we guarding? return; - Assert( (hitter_objp->type == OBJ_SHIP) || (hitter_objp->type == OBJ_ASTEROID) || (hitter_objp->type == OBJ_WEAPON) ); + SDL_assert( (hitter_objp->type == OBJ_SHIP) || (hitter_objp->type == OBJ_ASTEROID) || (hitter_objp->type == OBJ_WEAPON) ); hitter_objnum = OBJ_INDEX(hitter_objp); @@ -9134,7 +9134,7 @@ int ai_guard_find_nearby_bomb(object *guarding_objp, object *guarded_objp) weapon_info *wip; for ( mo = GET_NEXT(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) { - Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); + SDL_assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); bomb_objp = &Objects[mo->objnum]; wp = &Weapons[bomb_objp->instance]; @@ -9268,8 +9268,8 @@ void ai_guard_find_nearby_object() // returns z of axis_point in cyl_objp reference frame float get_cylinder_points(object *other_objp, object *cyl_objp, vector *axis_pt, vector *r_vec, float *radius) { - Assert(other_objp->type == OBJ_SHIP); - Assert(cyl_objp->type == OBJ_SHIP); + SDL_assert(other_objp->type == OBJ_SHIP); + SDL_assert(cyl_objp->type == OBJ_SHIP); // get radius of cylinder polymodel *pm = model_get(Ships[cyl_objp->instance].modelnum); @@ -9476,7 +9476,7 @@ void ai_guard() return; } - Assert(aip->guard_objnum != -1); + SDL_assert(aip->guard_objnum != -1); guard_objp = &Objects[aip->guard_objnum]; @@ -9492,7 +9492,7 @@ void ai_guard() } // Not sure whether this should be impossible, or a reasonable cleanup condition. - // For now (3/31/97), it's getting trapped by an Assert, so clean it up. + // For now (3/31/97), it's getting trapped by an SDL_assert, so clean it up. if (guard_objp->type != OBJ_SHIP) { aip->guard_objnum = -1; return; @@ -9657,7 +9657,7 @@ object *ai_find_docked_object( object *docker ) // are totally relative to what is passed in as a parameter.) // first thing to attempt is to check and see if this object is docked with something. - Assert( docker->type == OBJ_SHIP ); // this had probably better be a ship!!! + SDL_assert( docker->type == OBJ_SHIP ); // this had probably better be a ship!!! aip = &Ai_info[Ships[docker->instance].ai_index]; if ( !(aip->ai_flags & AIF_DOCKED) ) // flag not set if not docked with anything return NULL; @@ -9685,7 +9685,7 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, ai_info *aip, *repair_aip; int stamp = -1; - Assert( repaired_objp->type == OBJ_SHIP); + SDL_assert( repaired_objp->type == OBJ_SHIP); aip = &Ai_info[Ships[repaired_objp->instance].ai_index]; // multiplayer @@ -9788,7 +9788,7 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, case REPAIR_INFO_COMPLETE: // clear the being repaired flag -- and if ( p_index >= 0 ) { - Assert( repair_objp ); + SDL_assert( repair_objp ); hud_support_view_stop(); @@ -9799,7 +9799,7 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, case REPAIR_INFO_ONWAY: // need to set the dock_signature so that clients in multiplayer games rearm correctly - Assert( repair_objp ); + SDL_assert( repair_objp ); aip->dock_signature = repair_objp->signature; aip->dock_objnum = OBJ_INDEX(repair_objp); stamp = timestamp(-1); @@ -9819,7 +9819,7 @@ void ai_do_objects_repairing_stuff( object *repaired_objp, object *repair_objp, aip = &Ai_info[Ships[repair_objp->instance].ai_index]; switch ( how ) { case REPAIR_INFO_ONWAY: - Assert( repaired_objp != NULL ); + SDL_assert( repaired_objp != NULL ); aip->goal_objnum = OBJ_INDEX(repaired_objp); aip->ai_flags |= AIF_REPAIRING; break; @@ -9862,11 +9862,11 @@ void ai_cleanup_dock_mode(ai_info *aip, ship *shipp) aip->mode = AIM_NONE; if (aip->ai_flags & AIF_REPAIRING) { - Assert( aip->goal_objnum != -1 ); + SDL_assert( aip->goal_objnum != -1 ); ai_do_objects_repairing_stuff( &Objects[aip->goal_objnum], &Objects[shipp->objnum], REPAIR_INFO_KILLED ); } else if ( aip->ai_flags & AIF_BEING_REPAIRED ) { // MWA -- note that we have to use dock_objnum here instead of goal_objnum. - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); ai_do_objects_repairing_stuff( &Objects[shipp->objnum], &Objects[aip->dock_objnum], REPAIR_INFO_KILLED ); } else if ( aip->ai_flags & AIF_AWAITING_REPAIR ) { // need to find the support ship that has me as a goal_objnum @@ -9886,7 +9886,7 @@ void ai_cleanup_dock_mode(ai_info *aip, ship *shipp) if ( aip->ai_flags & AIF_DOCKED ) { ai_info *other_aip; - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); // if docked, and the dock_objnum is not undocking, force them to near last stage other_aip = &Ai_info[Ships[Objects[aip->dock_objnum].instance].ai_index]; @@ -9929,11 +9929,11 @@ void ai_still() ship *shipp; ai_info *aip; - Assert(Pl_objp->type == OBJ_SHIP); - Assert((Pl_objp->instance >= 0) && (Pl_objp->instance < MAX_OBJECTS)); + SDL_assert(Pl_objp->type == OBJ_SHIP); + SDL_assert((Pl_objp->instance >= 0) && (Pl_objp->instance < MAX_OBJECTS)); shipp = &Ships[Pl_objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); aip = &Ai_info[shipp->ai_index]; @@ -10082,7 +10082,7 @@ void ai_dock() aip->submode = AIS_DOCK_2; aip->submode_start_time = Missiontime; aip->path_cur--; - Assert(aip->path_cur-aip->path_start >= 0); + SDL_assert(aip->path_cur-aip->path_start >= 0); } else if (aip->path_cur-aip->path_start >= aip->path_length-2) { if (Pl_objp->phys_info.speed > goal_objp->phys_info.speed + 1.5f) { set_accel_for_target_speed(Pl_objp, goal_objp->phys_info.speed); @@ -10107,13 +10107,13 @@ void ai_dock() } else { //nprintf(("AI", "Time = %7.3f, submode = %i\n", f2fl(Missiontime), aip->submode)); dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_APPROACH); - Assert(dist != UNINITIALIZED_VALUE); + SDL_assert(dist != UNINITIALIZED_VALUE); if (dist == DOCK_BACKUP_RETURN_VAL) { int path_num; aip->submode = AIS_DOCK_1; path_num = ai_return_path_num_from_dockbay(&Objects[aip->goal_objnum], aip->dockee_index); - Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS); + SDL_assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS); ai_find_path(Pl_objp, aip->goal_objnum, path_num, 0); break; } @@ -10137,7 +10137,7 @@ void ai_dock() case AIS_DOCK_3: case AIS_DOCK_3A: { - Assert(aip->goal_objnum != -1); + SDL_assert(aip->goal_objnum != -1); int r; if ((r = maybe_dock_obstructed(Pl_objp, goal_objp,0)) != -1) { @@ -10148,7 +10148,7 @@ void ai_dock() //nprintf(("AI", "Time = %7.3f, submode = %i\n", f2fl(Missiontime), aip->submode)); float dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_DOCK); - Assert(dist != UNINITIALIZED_VALUE); + SDL_assert(dist != UNINITIALIZED_VALUE); if (dist == DOCK_BACKUP_RETURN_VAL) { aip->submode = AIS_DOCK_2; @@ -10160,7 +10160,7 @@ void ai_dock() if (dist < 2*flFrametime * (1.0f + fl_sqrt(goal_objp->phys_info.speed))) { // - Removed by MK on 11/7/97, causes errors for ships docked at mission start: maybe_recreate_path(Pl_objp, aip, 1); dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_DOCK); - Assert(dist != UNINITIALIZED_VALUE); + SDL_assert(dist != UNINITIALIZED_VALUE); physics_ship_init(Pl_objp); @@ -10207,14 +10207,14 @@ void ai_dock() case AIS_DOCK_4: { // This mode is only for rearming/repairing. // The ship that is performing the rearm enters this mode after it docks. - Assert((aip->goal_objnum >= -1) && (aip->goal_objnum < MAX_OBJECTS)); + SDL_assert((aip->goal_objnum >= -1) && (aip->goal_objnum < MAX_OBJECTS)); //nprintf(("AI", "Time = %7.3f, submode = %i\n", f2fl(Missiontime), aip->submode)); float dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_DOCK); - Assert(dist != UNINITIALIZED_VALUE); + SDL_assert(dist != UNINITIALIZED_VALUE); object *goal_objp = &Objects[aip->goal_objnum]; - Assert(goal_objp->type == OBJ_SHIP); + SDL_assert(goal_objp->type == OBJ_SHIP); ship *goal_shipp = &Ships[goal_objp->instance]; ai_info *goal_aip = &Ai_info[goal_shipp->ai_index]; @@ -10252,7 +10252,7 @@ void ai_dock() // set up the path points for the undocking procedure. dock_path_index member should // have gotten set in the docking code. - Assert( aip->dock_path_index != -1 ); + SDL_assert( aip->dock_path_index != -1 ); path_num = ai_return_path_num_from_dockbay(goal_objp, aip->dock_path_index); ai_find_path(Pl_objp, goal_objp-Objects, path_num, 0); @@ -10278,7 +10278,7 @@ void ai_dock() } dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_UNDOCK_1); - Assert(dist != UNINITIALIZED_VALUE); + SDL_assert(dist != UNINITIALIZED_VALUE); float dist_to_dock_obj = vm_vec_dist_quick(&Pl_objp->pos, &Objects[aip->goal_objnum].pos); @@ -10295,12 +10295,12 @@ void ai_dock() ai_info *other_aip; // get pointer to docked object's aip to reset flags, etc - Assert( aip->dock_objnum != -1 ); + SDL_assert( aip->dock_objnum != -1 ); other_aip = &Ai_info[Ships[Objects[aip->dock_objnum].instance].ai_index]; // Second stage of undocking. dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_UNDOCK_2); - Assert(dist != UNINITIALIZED_VALUE); + SDL_assert(dist != UNINITIALIZED_VALUE); //nprintf(("AI", "Undock 2: dist = %7.3f\n", dist)); @@ -10331,7 +10331,7 @@ void ai_dock() } case AIS_UNDOCK_3: { float dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_UNDOCK_3); - Assert(dist != UNINITIALIZED_VALUE); + SDL_assert(dist != UNINITIALIZED_VALUE); if (dist < Pl_objp->radius/2 + 5.0f) { aip->submode = AIS_UNDOCK_4; @@ -10352,7 +10352,7 @@ void ai_dock() // that goal_objnum and dock_objnum are the same through this whole docking/undocking process, although // I could be wrong. dock_objnum was reset in undock_2 submode so try to use goal_objnum here to // get other ships ai_info pointer - Assert( aip->goal_objnum != -1 ); + SDL_assert( aip->goal_objnum != -1 ); other_aip = &Ai_info[Ships[Objects[aip->goal_objnum].instance].ai_index]; aip->mode = AIM_NONE; @@ -10362,11 +10362,11 @@ void ai_dock() // Get Allender if you hit one of these!!!!! // removed by allender on 2/16 since a ship may be docked with some other ship, but still be the // goal_objnum of this ship ending it's undocking mode. - //Assert( !(aip->ai_flags & AIF_DOCKED) ); - //Assert( !(other_aip->ai_flags & AIF_DOCKED) ); - //Assert( !(aip->ai_flags & AIF_REPAIRING) ); - //Assert( !(other_aip->ai_flags & AIF_BEING_REPAIRED) ); - //Assert( !(other_aip->ai_flags & AIF_AWAITING_REPAIR) ); + //SDL_assert( !(aip->ai_flags & AIF_DOCKED) ); + //SDL_assert( !(other_aip->ai_flags & AIF_DOCKED) ); + //SDL_assert( !(aip->ai_flags & AIF_REPAIRING) ); + //SDL_assert( !(other_aip->ai_flags & AIF_BEING_REPAIRED) ); + //SDL_assert( !(other_aip->ai_flags & AIF_AWAITING_REPAIR) ); // only call mission goal complete if this was indeed an undock goal if ( aip->active_goal > -1 ) { @@ -10530,7 +10530,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en ship_subsys *best_subsysp = NULL; float dot; - Assert(enemy_objp->type == OBJ_SHIP); + SDL_assert(enemy_objp->type == OBJ_SHIP); eshipp = &Ships[enemy_objp->instance]; esip = &Ship_info[eshipp->ship_info_index]; @@ -10590,7 +10590,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en } // DKA: 6/28/99 all subsystems can be destroyed. - //Assert(aifft_list_size > 0); + //SDL_assert(aifft_list_size > 0); if (aifft_list_size == 0) { return best_subsysp; } @@ -10611,7 +10611,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en } } - Assert(best_subsysp != &eshipp->subsys_list); + SDL_assert(best_subsysp != &eshipp->subsys_list); *dot_out = best_dot; return best_subsysp; @@ -10819,7 +10819,7 @@ void turret_fire_weapon(ship_subsys *turret, int parent_objnum, vector *turret_p int subsys_index; subsys_index = ship_get_index_from_subsys(turret, parent_objnum ); - Assert( subsys_index != -1 ); + SDL_assert( subsys_index != -1 ); if(Weapon_info[turret_weapon_class].wi_flags & WIF_FLAK){ send_flak_fired_packet( parent_objnum, subsys_index, weapon_objnum, flak_range ); } else { @@ -10851,7 +10851,7 @@ void turret_swarm_fire_from_turret(ship_subsys *turret, int parent_objnum, int t // get class [index into Weapon_info array turret_weapon_class = turret->system_info->turret_weapon_type; - Assert(Weapon_info[turret_weapon_class].wi_flags & WIF_SWARM); + SDL_assert(Weapon_info[turret_weapon_class].wi_flags & WIF_SWARM); // make turret_orient from turret_fvec -- turret->turret_last_fire_direction vm_vector_2_matrix(&turret_orient, &turret_fvec, NULL, NULL); @@ -10878,7 +10878,7 @@ void turret_swarm_fire_from_turret(ship_subsys *turret, int parent_objnum, int t int subsys_index; subsys_index = ship_get_index_from_subsys(turret, parent_objnum ); - Assert( subsys_index != -1 ); + SDL_assert( subsys_index != -1 ); send_turret_fired_packet( parent_objnum, subsys_index, weapon_objnum ); } } @@ -10921,7 +10921,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum) return; } - Assert( shipp->objnum == parent_objnum ); + SDL_assert( shipp->objnum == parent_objnum ); if ( tp->turret_weapon_type < 0 ){ return; @@ -10975,9 +10975,9 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum) lep = NULL; } - Assert((parent_objnum >= 0) && (parent_objnum < MAX_OBJECTS)); + SDL_assert((parent_objnum >= 0) && (parent_objnum < MAX_OBJECTS)); objp = &Objects[parent_objnum]; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); aip = &Ai_info[Ships[objp->instance].ai_index]; // Use the turret info for all guns, not one gun in particular. @@ -11028,7 +11028,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum) if ( turret_should_pick_new_target(ss) ) { Num_find_turret_enemy++; int objnum = find_turret_enemy(ss, parent_objnum, &gpos, &gvec, ss->turret_enemy_objnum, tp->turret_fov, Weapon_info[turret_weapon_class].wi_flags & WIF_HUGE); - Assert(objnum < 0 || is_target_beam_valid(ss, objnum)); + SDL_assert(objnum < 0 || is_target_beam_valid(ss, objnum)); if (objnum != -1) { if (ss->turret_enemy_objnum == -1) { @@ -11081,7 +11081,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum) return; } - Assert(ss->turret_enemy_objnum != -1); + SDL_assert(ss->turret_enemy_objnum != -1); float dot = vm_vec_dot(&v2e, &gvec); @@ -11295,7 +11295,7 @@ int get_wing_index(object *objp, int wingnum) wing *wingp; int i; - Assert((wingnum >= 0) && (wingnum < MAX_WINGS)); + SDL_assert((wingnum >= 0) && (wingnum < MAX_WINGS)); wingp = &Wings[wingnum]; @@ -11316,11 +11316,11 @@ object * get_wing_leader(int wingnum) wing *wingp; int ship_num; - Assert((wingnum >= 0) && (wingnum < MAX_WINGS)); + SDL_assert((wingnum >= 0) && (wingnum < MAX_WINGS)); wingp = &Wings[wingnum]; - Assert(wingp->current_count != 0); // Make sure there is a leader + SDL_assert(wingp->current_count != 0); // Make sure there is a leader ship_num = wingp->ship_index[0]; @@ -11356,7 +11356,7 @@ void get_wing_delta(vector *_delta_vec, int wing_index) { int wi0; - Assert(wing_index >= 0); + SDL_assert(wing_index >= 0); int k, row, column; @@ -11386,7 +11386,7 @@ float gwlr_1(object *objp, ai_info *aip) object *o; ship_obj *so; - Assert(wingnum >= 0); + SDL_assert(wingnum >= 0); max_radius = objp->radius; @@ -11425,10 +11425,10 @@ float get_wing_largest_radius(object *objp, int formation_object_flag) ship *shipp; ai_info *aip; - Assert(objp->type == OBJ_SHIP); - Assert((objp->instance >= 0) && (objp->instance < MAX_OBJECTS)); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_OBJECTS)); shipp = &Ships[objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); aip = &Ai_info[shipp->ai_index]; if (formation_object_flag) { @@ -11489,11 +11489,11 @@ void render_wing_phantoms(object *objp) int wing_index; // Index in wing struct, defines 3-space location in wing. vector goal_point; - Assert(objp->type == OBJ_SHIP); - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); aip = &Ai_info[shipp->ai_index]; @@ -11535,9 +11535,9 @@ void render_wing_phantoms_all() objp = &Objects[so->objnum]; - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); aip = &Ai_info[shipp->ai_index]; @@ -11572,10 +11572,10 @@ void ai_fly_in_formation(int wingnum) for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { objp = &Objects[so->objnum]; - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); if (Ai_info[shipp->ai_index].wing == wingnum) { Ai_info[shipp->ai_index].ai_flags |= AIF_FORMATION_WING; @@ -11596,10 +11596,10 @@ void ai_disband_formation(int wingnum) for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { objp = &Objects[so->objnum]; - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); if (Ai_info[shipp->ai_index].wing == wingnum) { Ai_info[shipp->ai_index].ai_flags &= ~AIF_FORMATION_WING; @@ -11662,16 +11662,16 @@ int ai_formation() vector goal_point, future_goal_point_5, future_goal_point_2, future_goal_point_x, future_goal_point_1000x, vec_to_goal, dir_to_goal; float dot_to_goal, dist_to_goal, leader_speed; - Assert(Pl_objp->type == OBJ_SHIP); - Assert((Pl_objp->instance >= 0) && (Pl_objp->instance < MAX_SHIPS)); + SDL_assert(Pl_objp->type == OBJ_SHIP); + SDL_assert((Pl_objp->instance >= 0) && (Pl_objp->instance < MAX_SHIPS)); shipp = &Ships[Pl_objp->instance]; - Assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); + SDL_assert((shipp->ai_index >= 0) && (shipp->ai_index < MAX_AI_INFO)); aip = &Ai_info[shipp->ai_index]; - Assert((aip->ai_flags & AIF_FORMATION) != AIF_FORMATION); // Make sure not both types of formation flying in effect. + SDL_assert((aip->ai_flags & AIF_FORMATION) != AIF_FORMATION); // Make sure not both types of formation flying in effect. // Determine which kind of formation flying. // If tracking an object, not in waypoint mode: @@ -11684,7 +11684,7 @@ int ai_formation() wing_index = ai_formation_object_get_slotnum(aip->goal_objnum, Pl_objp); leader_objp = &Objects[aip->goal_objnum]; } else { // Formation flying in waypoint mode. - Assert(aip->ai_flags & AIF_FORMATION_WING); + SDL_assert(aip->ai_flags & AIF_FORMATION_WING); if (aip->mode != AIM_WAYPOINTS) { aip->ai_flags &= ~AIF_FORMATION_WING; return 1; @@ -11721,7 +11721,7 @@ int ai_formation() } } - Assert(leader_objp != NULL); + SDL_assert(leader_objp != NULL); laip = &Ai_info[Ships[leader_objp->instance].ai_index]; // Make sure we're really in this wing. @@ -11911,7 +11911,7 @@ int find_repairing_objnum(int objnum) for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { objp = &Objects[so->objnum]; - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; sip = &Ship_info[shipp->ship_info_index]; @@ -11943,7 +11943,7 @@ void ai_do_repair_frame(object *objp, ai_info *aip, float frametime) ai_info *repair_aip; dock_objnum = aip->dock_objnum; // find_repairing_objnum(objp-Objects); - //Assert(dock_objnum != -1); + //SDL_assert(dock_objnum != -1); if (dock_objnum == -1) return; if (Objects[dock_objnum].signature != aip->dock_signature) { @@ -11953,10 +11953,10 @@ void ai_do_repair_frame(object *objp, ai_info *aip, float frametime) } repair_aip = &Ai_info[Ships[Objects[dock_objnum].instance].ai_index]; - //Assert(repair_aip->mode == AIM_DOCK); + //SDL_assert(repair_aip->mode == AIM_DOCK); if (aip->ai_flags & AIF_BEING_REPAIRED) { - // Assert(repair_aip->submode == AIS_DOCK_4); + // SDL_assert(repair_aip->submode == AIS_DOCK_4); // Wait awhile into the mode to synchronize with sound effect. if (Missiontime - repair_aip->submode_start_time > REARM_SOUND_DELAY) { @@ -12161,7 +12161,7 @@ void ai_chase_circle(object *objp) target_speed = sip->max_speed/4.0f; aip = &Ai_info[Ships[Pl_objp->instance].ai_index]; - Assert(vm_vec_mag(&aip->goal_point) >= 0.0f); // Supposedly detects bogus vector + SDL_assert(vm_vec_mag(&aip->goal_point) >= 0.0f); // Supposedly detects bogus vector goal_point = aip->goal_point; @@ -12191,7 +12191,7 @@ void ai_chase_circle(object *objp) } } - Assert(vm_vec_mag(&aip->goal_point) >= 0.0f); // Supposedly detects bogus vector + SDL_assert(vm_vec_mag(&aip->goal_point) >= 0.0f); // Supposedly detects bogus vector turn_towards_tangent(Pl_objp, &goal_point, 10*objp->radius + 200.0f); @@ -12536,7 +12536,7 @@ int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, vector *pos, vect parent_sp = &Ships[Objects[parent_objnum].instance]; - Assert(parent_sp != NULL); + SDL_assert(parent_sp != NULL); pm = model_get( parent_sp->modelnum ); sb = pm->ship_bay; @@ -12567,7 +12567,7 @@ int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, vector *pos, vect // aip->ai_flags |= AIF_USE_STATIC_PATH; // now return to the caller what the starting world pos and starting fvec for the ship will be - Assert((aip->path_start >= 0) && (aip->path_start < MAX_PATH_POINTS)); + SDL_assert((aip->path_start >= 0) && (aip->path_start < MAX_PATH_POINTS)); pnp = &Path_points[aip->path_start]; *pos = pnp->pos; @@ -12632,7 +12632,7 @@ void ai_bay_emerge() } if ( !parent_died ) { - Assert(Objects[aip->goal_objnum].type == OBJ_SHIP); + SDL_assert(Objects[aip->goal_objnum].type == OBJ_SHIP); if ( Ships[Objects[aip->goal_objnum].instance].flags & SF_DYING ) { parent_died = 1; } @@ -12680,7 +12680,7 @@ int ai_find_closest_depart_path(ai_info *aip, polymodel *pm) best_free_path = best_path = -1; min_free_dist = min_dist = 1e20f; - Assert(aip->shipnum >= 0); + SDL_assert(aip->shipnum >= 0); source = &Objects[Ships[aip->shipnum].objnum].pos; for ( i = 0; i < sb->num_paths; i++ ) { @@ -12784,7 +12784,7 @@ int ai_acquire_depart_path(object *pl_objp, int parent_objnum) return -1; } - Assert(pm->n_paths > path_index); + SDL_assert(pm->n_paths > path_index); ai_find_path(pl_objp, objnum, path_index, 0); // Set this flag, so we don't bother recreating the path... we won't need to update the path @@ -12872,7 +12872,7 @@ void ai_execute_behavior(ai_info *aip) ship *shipp = &Ships[aip->shipnum]; ship_info *sip = &Ship_info[shipp->ship_info_index]; - if (strnicmp(shipp->ship_name, INSTRUCTOR_SHIP_NAME, strlen(INSTRUCTOR_SHIP_NAME))) { + if (SDL_strncasecmp(shipp->ship_name, INSTRUCTOR_SHIP_NAME, strlen(INSTRUCTOR_SHIP_NAME))) { if (sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) { aip->mode = AIM_NONE; } else { @@ -12927,7 +12927,7 @@ void ai_execute_behavior(ai_info *aip) break; case AIM_STRAFE: if (En_objp) { - Assert(En_objp->type == OBJ_SHIP); + SDL_assert(En_objp->type == OBJ_SHIP); ai_big_strafe(); // strafe a big ship } else { aip->mode = AIM_NONE; @@ -12982,7 +12982,7 @@ int num_allies_rearming(object *objp) for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { object *A; - Assert (so->objnum != -1); + SDL_assert (so->objnum != -1); A = &Objects[so->objnum]; if (Ships[A->instance].team == team) { @@ -13005,7 +13005,7 @@ int maybe_request_support(object *objp) ai_info *aip; int desire; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); shipp = &Ships[objp->instance]; aip = &Ai_info[shipp->ai_index]; sip = &Ship_info[shipp->ship_info_index]; @@ -13102,7 +13102,7 @@ void ai_maybe_warp_out(object *objp) if ( The_mission.game_type & MISSION_TYPE_TRAINING ) return; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); shipp = &Ships[objp->instance]; ai_info *aip = &Ai_info[shipp->ai_index]; @@ -13225,14 +13225,14 @@ int ai_find_shockwave_weapon(object *objp, ai_info *aip) weapon *wp; weapon_info *wip; - Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); + SDL_assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); A = &Objects[mo->objnum]; - Assert(A->type == OBJ_WEAPON); - Assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); + SDL_assert(A->type == OBJ_WEAPON); + SDL_assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); wp = &Weapons[A->instance]; wip = &Weapon_info[wp->weapon_info_index]; - Assert( wip->subtype == WP_MISSILE ); + SDL_assert( wip->subtype == WP_MISSILE ); if (wip->shockwave_speed > 0.0f) { float dist; @@ -13287,11 +13287,11 @@ int ai_find_shockwave_ship(object *objp, ai_info *aip) object *A; ship *shipp; - Assert(so->objnum >= 0 && so->objnum < MAX_OBJECTS); + SDL_assert(so->objnum >= 0 && so->objnum < MAX_OBJECTS); A = &Objects[so->objnum]; - Assert(A->type == OBJ_SHIP); - Assert((A->instance >= 0) && (A->instance < MAX_SHIPS)); + SDL_assert(A->type == OBJ_SHIP); + SDL_assert((A->instance >= 0) && (A->instance < MAX_SHIPS)); shipp = &Ships[A->instance]; // Only look at objects in the process of dying. if (shipp->flags & SF_DYING) { @@ -13330,7 +13330,7 @@ int aas_1(object *objp, ai_info *aip, vector *safe_pos) } // OK, we have reason to believe we should avoid aip->shockwave_object. - Assert(aip->shockwave_object > -1); + SDL_assert(aip->shockwave_object > -1); object *weapon_objp = &Objects[aip->shockwave_object]; if (weapon_objp->type != OBJ_WEAPON) { aip->ai_flags &= ~AIF_AVOID_SHOCKWAVE_WEAPON; @@ -13448,7 +13448,7 @@ int aas_1(object *objp, ai_info *aip, vector *safe_pos) } } - Assert(aip->shockwave_object > -1); + SDL_assert(aip->shockwave_object > -1); object *ship_objp = &Objects[aip->shockwave_object]; if (ship_objp == objp) { aip->shockwave_object = -1; @@ -13764,7 +13764,7 @@ void ai_frame(int objnum) // validate_mode_submode(aip); - Assert((aip->mode != AIM_WAYPOINTS) || (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC)); + SDL_assert((aip->mode != AIM_WAYPOINTS) || (aip->active_goal != AI_ACTIVE_GOAL_DYNAMIC)); // Set globals defining the current object and its enemy object. Pl_objp = &Objects[objnum]; @@ -13780,7 +13780,7 @@ void ai_frame(int objnum) aip->mode = AIM_CHASE; */ -// if (!strnicmp(Ships[Pl_objp->instance].ship_name, "cancer", 6)) +// if (!SDL_strncasecmp(Ships[Pl_objp->instance].ship_name, "cancer", 6)) // nprintf(("AI", "Ship %s: mode = %s, submode = %i\n", Ships[Pl_objp->instance].ship_name, Mode_text[aip->mode], aip->submode)); ai_maybe_self_destruct(Pl_objp, aip); @@ -13823,7 +13823,7 @@ void ai_frame(int objnum) // nprintf(("AI", "Frame %i: Coords = %7.3f %7.3f %7.3f\n", AI_FrameCount, Pl_objp->pos.xyz.x, Pl_objp->pos.xyz.y, Pl_objp->pos.xyz.z)); - Assert(objnum != target_objnum); + SDL_assert(objnum != target_objnum); ai_manage_shield(Pl_objp, aip); @@ -13936,7 +13936,7 @@ void ai_frame(int objnum) // check if targeted subsystem has been destroyed, if so, move onto another subsystem // if trying to disable or disarm the target if ((En_objp != NULL) && ( aip->targeted_subsys != NULL )) { - Assert(En_objp->type == OBJ_SHIP); + SDL_assert(En_objp->type == OBJ_SHIP); if ( aip->targeted_subsys->current_hits <= 0.0f ) { int subsys_type; @@ -14040,8 +14040,8 @@ void ai_process( object * obj, int ai_index, float frametime ) int rfc = 1; // Assume will be Reading Flying Controls. - Assert( obj->type == OBJ_SHIP ); - Assert( ai_index >= 0 ); + SDL_assert( obj->type == OBJ_SHIP ); + SDL_assert( ai_index >= 0 ); init_ship_info(); @@ -14111,7 +14111,7 @@ void init_ai_object(int objnum) objp = &Objects[objnum]; ship_index = objp->instance; ai_index = Ships[ship_index].ai_index; - Assert((ai_index >= 0) && (ai_index < MAX_AI_INFO)); + SDL_assert((ai_index >= 0) && (ai_index < MAX_AI_INFO)); aip = &Ai_info[ai_index]; @@ -14290,9 +14290,9 @@ void ai_set_default_behavior(object *obj, int classnum) { ai_info *aip; - Assert(obj != NULL); - Assert(obj->instance != -1); - Assert(Ships[obj->instance].ai_index != -1); + SDL_assert(obj != NULL); + SDL_assert(obj->instance != -1); + SDL_assert(Ships[obj->instance].ai_index != -1); aip = &Ai_info[Ships[obj->instance].ai_index]; @@ -14305,9 +14305,9 @@ void ai_do_default_behavior(object *obj) ai_info *aip; int ship_flags; - Assert(obj != NULL); - Assert(obj->instance != -1); - Assert(Ships[obj->instance].ai_index != -1); + SDL_assert(obj != NULL); + SDL_assert(obj->instance != -1); + SDL_assert(Ships[obj->instance].ai_index != -1); aip = &Ai_info[Ships[obj->instance].ai_index]; @@ -14389,9 +14389,9 @@ void maybe_process_friendly_hit(object *objp_hitter, object *objp_hit, object *o return; } - Assert(objp_hitter->type == OBJ_SHIP); - Assert(objp_hit->type == OBJ_SHIP); - Assert(objp_weapon->type == OBJ_WEAPON); + SDL_assert(objp_hitter->type == OBJ_SHIP); + SDL_assert(objp_hit->type == OBJ_SHIP); + SDL_assert(objp_weapon->type == OBJ_WEAPON); ship *shipp_hitter = &Ships[objp_hitter->instance]; ship *shipp_hit = &Ships[objp_hit->instance]; @@ -14501,7 +14501,7 @@ void maybe_process_friendly_hit(object *objp_hitter, object *objp_hit, object *o // Maybe make ship with ai_info *aip attack hitter_objnum as a dynamic goal void maybe_set_dynamic_chase(ai_info *aip, int hitter_objnum) { - Assert(Ship_info[Ships[aip->shipnum].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)); + SDL_assert(Ship_info[Ships[aip->shipnum].ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER)); // limit the number of ships attacking hitter_objnum (for now, only if hitter_objnum is player) if ( ai_maybe_limit_attackers(hitter_objnum) == 1 ) { @@ -14560,7 +14560,7 @@ void big_ship_collide_recover_start(object *objp, object *big_objp, vector *coll { ai_info *aip; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); aip = &Ai_info[Ships[objp->instance].ai_index]; @@ -14614,8 +14614,8 @@ float max_lethality = 0.0f; void ai_update_lethality(object *ship_obj, object *other_obj, float damage) { - Assert(ship_obj->type == OBJ_SHIP); - Assert(other_obj->type == OBJ_WEAPON || other_obj->type == OBJ_SHOCKWAVE); + SDL_assert(ship_obj->type == OBJ_SHIP); + SDL_assert(other_obj->type == OBJ_WEAPON || other_obj->type == OBJ_SHOCKWAVE); int dont_count = FALSE; int parent = other_obj->parent; @@ -14694,7 +14694,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vector *hitpos, int shield if (hit_objp->type == OBJ_WEAPON) { // Make sure the object that fired this weapon is still alive. If not, abort. - // Assert(hit_objp->parent >= 0); + // SDL_assert(hit_objp->parent >= 0); if(hit_objp->parent < 0){ return; } @@ -14726,7 +14726,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vector *hitpos, int shield } hitter_objnum = hit_objp->parent; - Assert((hitter_objnum >= 0) && (hitter_objnum < MAX_OBJECTS)); + SDL_assert((hitter_objnum >= 0) && (hitter_objnum < MAX_OBJECTS)); objp_hitter = &Objects[hitter_objnum]; maybe_process_friendly_hit(objp_hitter, objp_ship, hit_objp); // Deal with player's friendly fire. @@ -14747,7 +14747,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vector *hitpos, int shield if (hit_objp->flags & OF_PROTECTED) return; - Assert(objp_hitter != NULL); + SDL_assert(objp_hitter != NULL); hitter_aip = &Ai_info[Ships[objp_hitter->instance].ai_index]; hitter_aip->last_hit_target_time = Missiontime; @@ -14780,7 +14780,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, vector *hitpos, int shield // If in AIM_STRAFE mode and got hit by target, maybe attack turret if appropriate if (aip->mode == AIM_STRAFE) { - Assert(hitter_objnum != -2); + SDL_assert(hitter_objnum != -2); if (aip->target_objnum == hitter_objnum) { if ( hit_objp->type == OBJ_WEAPON ) { ai_big_strafe_maybe_attack_turret(objp_ship, hit_objp); @@ -14950,7 +14950,7 @@ void ai_ship_destroy(int shipnum, int method) ship_obj *so; ai_info *dead_aip; - Assert((shipnum >= 0) && (shipnum < MAX_SHIPS)); + SDL_assert((shipnum >= 0) && (shipnum < MAX_SHIPS)); objnum = Ships[shipnum].objnum; dead_aip = &Ai_info[Ships[shipnum].ai_index]; @@ -14966,10 +14966,10 @@ void ai_ship_destroy(int shipnum, int method) // For all objects that had this ship as a target, wipe it out, forcing find of a new enemy. for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { other_objp = &Objects[so->objnum]; - Assert(other_objp->instance != -1); + SDL_assert(other_objp->instance != -1); shipp = &Ships[other_objp->instance]; - Assert(shipp->ai_index != -1); + SDL_assert(shipp->ai_index != -1); ai_info *aip = &Ai_info[shipp->ai_index]; @@ -15097,16 +15097,16 @@ int ai_abort_rearm_request(object *requester_objp) ship *requester_shipp; ai_info *requester_aip; - Assert(requester_objp->type == OBJ_SHIP); + SDL_assert(requester_objp->type == OBJ_SHIP); if(requester_objp->type != OBJ_SHIP){ return 0; } - Assert((requester_objp->instance >= 0) && (requester_objp->instance < MAX_SHIPS)); + SDL_assert((requester_objp->instance >= 0) && (requester_objp->instance < MAX_SHIPS)); if((requester_objp->instance < 0) || (requester_objp->instance >= MAX_SHIPS)){ return 0; } requester_shipp = &Ships[requester_objp->instance]; - Assert((requester_shipp->ai_index >= 0) && (requester_shipp->ai_index < MAX_AI_INFO)); + SDL_assert((requester_shipp->ai_index >= 0) && (requester_shipp->ai_index < MAX_AI_INFO)); if((requester_shipp->ai_index < 0) || (requester_shipp->ai_index >= MAX_AI_INFO)){ return 0; } @@ -15128,7 +15128,7 @@ int ai_abort_rearm_request(object *requester_objp) // before this code comes around. if (repair_objp->signature == requester_aip->dock_signature) { - Assert( repair_objp->type == OBJ_SHIP ); + SDL_assert( repair_objp->type == OBJ_SHIP ); // if support ship is in the process of undocking, don't do anything. if ( repair_aip->submode < AIS_UNDOCK_0 ) { @@ -15180,7 +15180,7 @@ void ai_add_rearm_goal( object *requester_objp, object *support_objp ) requester_shipp = &Ships[requester_objp->instance]; requester_aip = &Ai_info[requester_shipp->ai_index]; - Assert( support_shipp->ai_index != -1 ); + SDL_assert( support_shipp->ai_index != -1 ); support_aip = &Ai_info[support_shipp->ai_index]; // if the requester is a player object, issue the order as the squadmate messaging code does. Doing so @@ -15202,10 +15202,10 @@ int ai_issue_rearm_request(object *requester_objp) ship *requester_shipp; ai_info *requester_aip; - Assert(requester_objp->type == OBJ_SHIP); - Assert((requester_objp->instance >= 0) && (requester_objp->instance < MAX_SHIPS)); + SDL_assert(requester_objp->type == OBJ_SHIP); + SDL_assert((requester_objp->instance >= 0) && (requester_objp->instance < MAX_SHIPS)); requester_shipp = &Ships[requester_objp->instance]; - Assert((requester_shipp->ai_index >= 0) && (requester_shipp->ai_index < MAX_AI_INFO)); + SDL_assert((requester_shipp->ai_index >= 0) && (requester_shipp->ai_index < MAX_AI_INFO)); requester_aip = &Ai_info[requester_shipp->ai_index]; // Make sure not already awaiting repair. @@ -15281,9 +15281,9 @@ int ai_return_path_num_from_dockbay(object *dockee_objp, int dockbay_index) pm = model_get( Ships[dockee_objp->instance].modelnum ); // sanity checks - Assert(pm->n_docks > dockbay_index); - Assert(pm->docking_bays[dockbay_index].num_spline_paths > 0); - Assert(pm->docking_bays[dockbay_index].splines != NULL); + SDL_assert(pm->n_docks > dockbay_index); + SDL_assert(pm->docking_bays[dockbay_index].num_spline_paths > 0); + SDL_assert(pm->docking_bays[dockbay_index].splines != NULL); if(pm->n_docks <= dockbay_index){ return -1; } @@ -15333,7 +15333,7 @@ void maybe_cheat_fire_synaptic(object *objp, ai_info *aip) shipp = &Ships[objp->instance]; - if (!(strnicmp(shipp->ship_name, NOX("delta"), 5))) { + if (!(SDL_strncasecmp(shipp->ship_name, NOX("delta"), 5))) { num = shipp->ship_name[6] - '1'; if ((num >= 0) && (num <= 3)) { diff --git a/src/ship/aigoals.cpp b/src/ship/aigoals.cpp index 18e2645..395ff73 100644 --- a/src/ship/aigoals.cpp +++ b/src/ship/aigoals.cpp @@ -558,7 +558,7 @@ void ai_maybe_add_form_goal( wing *wingp ) for ( j = 0; j < wingp->current_count; j++ ) { ai_info *aip; - Assert( wingp->ship_index[j] != -1 ); // get Allender + SDL_assert( wingp->ship_index[j] != -1 ); // get Allender aip = &Ai_info[Ships[wingp->ship_index[j]].ai_index]; // don't process Player_ship @@ -715,7 +715,7 @@ void ai_remove_ship_goal( ai_info *aip, int index ) // only need to set the ai_mode for the particular goal to AI_GOAL_NONE // reset ai mode to default behavior. Might get changed next time through // ai goal code look - Assert ( index >= 0 ); // must have a valid goal + SDL_assert ( index >= 0 ); // must have a valid goal aip->goals[index].ai_mode = AI_GOAL_NONE; aip->goals[index].signature = -1; @@ -789,7 +789,7 @@ void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp ) priority = remove_goalp->priority; name = remove_goalp->ship_name; - Assert ( name ); // should not be NULL!!!! + SDL_assert ( name ); // should not be NULL!!!! // remove the goal from all the ships currently in the wing for (i = 0; i < wingp->current_count; i++ ) { @@ -797,7 +797,7 @@ void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp ) ai_info *aip; num = wingp->ship_index[i]; - Assert ( num >= 0 ); + SDL_assert ( num >= 0 ); aip = &Ai_info[Ships[num].ai_index]; for ( j = 0; j < MAX_AI_GOALS; j++ ) { aigp = &(aip->goals[j]); @@ -806,7 +806,7 @@ void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp ) if ( (aigp->ai_mode == AI_GOAL_NONE) || !aigp->ship_name ) continue; - if ( (aigp->ai_mode == mode) && (aigp->ai_submode == submode) && (aigp->priority == priority) && !stricmp(name, aigp->ship_name) ) { + if ( (aigp->ai_mode == mode) && (aigp->ai_submode == submode) && (aigp->priority == priority) && !SDL_strcasecmp(name, aigp->ship_name) ) { ai_remove_ship_goal( aip, j ); ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] ); // do the default behavior break; // we are all done @@ -820,7 +820,7 @@ void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp ) if ( (aigp->ai_mode == AI_GOAL_NONE) || !aigp->ship_name ) continue; - if ( (aigp->ai_mode == mode) && (aigp->ai_submode == submode) && (aigp->priority == priority) && !stricmp(name, aigp->ship_name) ) { + if ( (aigp->ai_mode == mode) && (aigp->ai_submode == submode) && (aigp->priority == priority) && !SDL_strcasecmp(name, aigp->ship_name) ) { wingp->ai_goals[i].ai_mode = AI_GOAL_NONE; wingp->ai_goals[i].signature = -1; wingp->ai_goals[i].priority = -1; @@ -855,17 +855,17 @@ int ai_get_subsystem_type( const char *subsystem ) return SUBSYSTEM_TURRET; } else if ( strstr(subsystem, "navigation") ) { return SUBSYSTEM_NAVIGATION; - } else if ( !strnicmp(subsystem, NOX("communication"), 13) ) { + } else if ( !SDL_strncasecmp(subsystem, NOX("communication"), 13) ) { return SUBSYSTEM_COMMUNICATION; - } else if ( !strnicmp(subsystem, NOX("weapons"), 7) ) { + } else if ( !SDL_strncasecmp(subsystem, NOX("weapons"), 7) ) { return SUBSYSTEM_WEAPONS; - } else if ( !strnicmp(subsystem, NOX("sensors"), 7) ) { + } else if ( !SDL_strncasecmp(subsystem, NOX("sensors"), 7) ) { return SUBSYSTEM_SENSORS; - } else if ( !strnicmp(subsystem, NOX("solar"), 5) ) { + } else if ( !SDL_strncasecmp(subsystem, NOX("solar"), 5) ) { return SUBSYSTEM_SOLAR; - } else if ( !strnicmp(subsystem, NOX("gas"), 3) ) { + } else if ( !SDL_strncasecmp(subsystem, NOX("gas"), 3) ) { return SUBSYSTEM_GAS_COLLECT; - } else if ( !strnicmp(subsystem, NOX("activator"), 9) ) { + } else if ( !SDL_strncasecmp(subsystem, NOX("activator"), 9) ) { return SUBSYSTEM_ACTIVATION; } else { // If unrecognized type, set to engine so artist can continue working... if (!Fred_running) { @@ -922,7 +922,7 @@ void ai_goal_purge_invalid_goals( ai_goal *aigp, ai_goal *goal_list ) // don't match, we can continue; if the wing is valid, don't process if the wing numbers // are different. if ( purge_wing == -1 ) { - if ( stricmp(purge_goal->ship_name, name ) ) + if ( SDL_strcasecmp(purge_goal->ship_name, name ) ) continue; } else if ( purge_wing != wingnum ) continue; @@ -976,7 +976,7 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp) { int shipnum, dockee_index, docker_index; - Assert ( aip->shipnum != -1 ); + SDL_assert ( aip->shipnum != -1 ); shipnum = ship_name_lookup( aigp->ship_name ); docker_index = -1; dockee_index = -1; @@ -1008,7 +1008,7 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp) void ai_add_goal_sub_player(int type, int mode, int submode, const char *shipname, ai_goal *aigp ) { - Assert ( (type == AIG_TYPE_PLAYER_WING) || (type == AIG_TYPE_PLAYER_SHIP) ); + SDL_assert ( (type == AIG_TYPE_PLAYER_WING) || (type == AIG_TYPE_PLAYER_SHIP) ); aigp->time = Missiontime; aigp->type = type; // from player for sure -- could be to ship or to wing @@ -1059,7 +1059,7 @@ int ai_goal_find_empty_slot( ai_goal *goals ) if ( empty_index == -1 ) empty_index = oldest_index; - Assert ( empty_index < MAX_AI_GOALS ); + SDL_assert ( empty_index < MAX_AI_GOALS ); return empty_index; } @@ -1123,7 +1123,7 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp ) int node, dummy, op; char *text; - Assert ( Sexp_nodes[sexp].first != -1 ); + SDL_assert ( Sexp_nodes[sexp].first != -1 ); node = Sexp_nodes[sexp].first; text = CTEXT(node); @@ -1400,7 +1400,7 @@ void ai_add_goal_wing_internal( wing *wingp, int goal_type, const char *name, in int i; // be sure we are not trying to issue dock or undock goals to wings - Assert ( (goal_type != AI_GOAL_DOCK) || (goal_type != AI_GOAL_UNDOCK) ); + SDL_assert ( (goal_type != AI_GOAL_DOCK) || (goal_type != AI_GOAL_UNDOCK) ); for (i = 0; i < wingp->current_count; i++) { int num = wingp->ship_index[i]; @@ -1419,7 +1419,7 @@ void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip ) if ( aip->goals[j].ai_mode == AI_GOAL_NONE ) break; } - Assert ( j < MAX_AI_GOALS ); + SDL_assert ( j < MAX_AI_GOALS ); aip->goals[j] = *aigp; } @@ -1460,7 +1460,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp ) int i; for (i = 0; i < Num_waypoint_lists; i++) { - if (!stricmp(aigp->ship_name, Waypoint_lists[i].name)) { + if (!SDL_strcasecmp(aigp->ship_name, Waypoint_lists[i].name)) { aigp->wp_index = i; break; } @@ -1474,7 +1474,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp ) } objp = &Objects[objnum]; - Assert( objp->instance != -1 ); + SDL_assert( objp->instance != -1 ); ai_shipname = Ships[objp->instance].ship_name; aip = &Ai_info[Ships[objp->instance].ai_index]; @@ -1512,7 +1512,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp ) // if the ship is not in the mission or the subsystem name is still being stored, mark the status // as 0 so we can continue. (The subsystem name must be turned into an index into the ship's subsystems // for this goal to be valid). - Assert ( aigp->ai_submode >= 0 ); + SDL_assert ( aigp->ai_submode >= 0 ); ssp = ship_get_indexed_subsys( &Ships[shipnum], aigp->ai_submode ); status = mission_log_get_time( LOG_SHIP_SUBSYS_DESTROYED, aigp->ship_name, ssp->system_info->name, NULL ); @@ -1658,7 +1658,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp ) // we must also determine if this ship which is supposed to dock with something is currently // docked with something else. If so, then return the ON_HOLD until it is not docked anymore shipnum = ship_name_lookup(aigp->ship_name); - Assert( shipnum != -1 ); + SDL_assert( shipnum != -1 ); // if ship is disabled, dont' know if it can dock or not if ( Ships[objp->instance].flags & SF_DISABLED ) @@ -1716,7 +1716,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp ) // for ignoring a ship, call the ai_ignore object function, then declare the goal satisfied shipnum = ship_name_lookup( aigp->ship_name ); - Assert( shipnum != -1 ); // should be true because of above status + SDL_assert( shipnum != -1 ); // should be true because of above status ignored = &Objects[Ships[shipnum].objnum]; ai_ignore_object(objp, ignored, 100); return AI_GOAL_SATISFIED; @@ -1762,7 +1762,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp ) if ( status == SHIP_STATUS_GONE ) return AI_GOAL_NOT_ACHIEVABLE; - Assert( aigp->ship_name ); + SDL_assert( aigp->ship_name ); shipnum = ship_name_lookup( aigp->ship_name ); // if desitnation currently being repaired, then goal is stil active @@ -1951,7 +1951,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip ) int wingnum, shipnum; int original_signature; -/* if (!stricmp(Ships[objp->instance].ship_name, "gtt comet")) { +/* if (!SDL_strcasecmp(Ships[objp->instance].ship_name, "gtt comet")) { for (int i=0; igoals[i].signature != -1) { nprintf(("AI", "%6.1f: mode=%s, type=%s, ship=%s\n", f2fl(Missiontime), Mode_text[aip->goals[i].ai_mode], Goal_text[aip->goals[i].type], aip->goals[i].ship_name)); @@ -2019,7 +2019,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip ) case AI_GOAL_CHASE: if ( current_goal->ship_name ) { shipnum = ship_name_lookup( current_goal->ship_name ); - Assert (shipnum != -1 ); // shouldn't get here if this is false!!!! + SDL_assert (shipnum != -1 ); // shouldn't get here if this is false!!!! other_obj = &Objects[Ships[shipnum].objnum]; } else other_obj = NULL; // we get this case when we tell ship to engage enemy! @@ -2030,14 +2030,14 @@ void ai_process_mission_orders( int objnum, ai_info *aip ) break; case AI_GOAL_CHASE_WEAPON: - Assert( Weapons[current_goal->wp_index].objnum != -1 ); + SDL_assert( Weapons[current_goal->wp_index].objnum != -1 ); other_obj = &Objects[Weapons[current_goal->wp_index].objnum]; ai_attack_object( objp, other_obj, current_goal->priority, NULL ); break; case AI_GOAL_GUARD: shipnum = ship_name_lookup( current_goal->ship_name ); - Assert (shipnum != -1 ); // shouldn't get here if this is false!!!! + SDL_assert (shipnum != -1 ); // shouldn't get here if this is false!!!! other_obj = &Objects[Ships[shipnum].objnum]; // shipnum and other_obj are the shipnumber and object pointer of the object that you should // guard. @@ -2052,7 +2052,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip ) case AI_GOAL_GUARD_WING: wingnum = wing_name_lookup( current_goal->ship_name ); - Assert (wingnum != -1 ); // shouldn't get here if this is false!!!! + SDL_assert (wingnum != -1 ); // shouldn't get here if this is false!!!! ai_set_guard_wing(objp, wingnum); aip->submode_start_time = Missiontime; break; @@ -2069,13 +2069,13 @@ void ai_process_mission_orders( int objnum, ai_info *aip ) case AI_GOAL_DOCK: { shipnum = ship_name_lookup( current_goal->ship_name ); - Assert (shipnum != -1 ); // shouldn't get here if this is false!!!! + SDL_assert (shipnum != -1 ); // shouldn't get here if this is false!!!! other_obj = &Objects[Ships[shipnum].objnum]; // be sure that we have indices for docking points here! If we ever had names, they should // get fixed up in goal_achievable so that the points can be checked there for validity - Assert ( !(current_goal->flags & AIGF_DOCKER_NAME_VALID) ); - Assert ( !(current_goal->flags & AIGF_DOCKEE_NAME_VALID) ); + SDL_assert ( !(current_goal->flags & AIGF_DOCKER_NAME_VALID) ); + SDL_assert ( !(current_goal->flags & AIGF_DOCKEE_NAME_VALID) ); ai_dock_with_object( objp, other_obj, current_goal->priority, AIDO_DOCK, current_goal->docker.index, current_goal->dockee.index ); aip->submode_start_time = Missiontime; break; @@ -2258,7 +2258,7 @@ void ai_update_goal_references(ai_goal *goals, int type, const char *old_name, c } if (flag) // is this a valid goal to parse for this conversion? - if (!stricmp(goals[i].ship_name, old_name)) { + if (!SDL_strcasecmp(goals[i].ship_name, old_name)) { if (*new_name == '<') // target was just deleted.. goals[i].ai_mode = AI_GOAL_NONE; else @@ -2323,7 +2323,7 @@ int query_referenced_in_ai_goals(ai_goal *goals, int type, const char *name) if (flag) // is this a valid goal to parse for this conversion? { - if (!stricmp(goals[i].ship_name, name)) + if (!SDL_strcasecmp(goals[i].ship_name, name)) return 1; } } @@ -2336,12 +2336,12 @@ char *ai_add_dock_name(const char *str) char *ptr; int i; - Assert(strlen(str) < NAME_LENGTH - 1); + SDL_assert(strlen(str) < NAME_LENGTH - 1); for (i=0; i= 0) && (ship_num < MAX_SHIPS)); + SDL_assert((ship_num >= 0) && (ship_num < MAX_SHIPS)); switch (shipp->team) { case TEAM_FRIENDLY: @@ -525,7 +525,7 @@ void team_visibility_update() // Determine is ship is visible by team int ship_is_visible_by_team(int ship_num, int team) { - Assert((ship_num >= 0) && (ship_num < MAX_SHIPS)); + SDL_assert((ship_num >= 0) && (ship_num < MAX_SHIPS)); switch (team) { case TEAM_FRIENDLY: diff --git a/src/ship/shield.cpp b/src/ship/shield.cpp index d5f3540..5b23025 100644 --- a/src/ship/shield.cpp +++ b/src/ship/shield.cpp @@ -140,7 +140,7 @@ * Optimize a bit by making old ones go away if Poly_count high. * * 46 2/06/98 9:10a Allender - * removed an Assert for multiplayer clients + * removed an SDL_assert for multiplayer clients * * 45 2/05/98 9:21p John * Some new Direct3D code. Added code to monitor a ton of stuff in the @@ -435,7 +435,7 @@ void free_global_tri_records(int shnum) { int i; - Assert((shnum >= 0) && (shnum < MAX_SHIELD_HITS)); + SDL_assert((shnum >= 0) && (shnum < MAX_SHIELD_HITS)); //mprintf(("Freeing up %i global records.\n", Shield_hits[shnum].num_tris)); @@ -523,8 +523,8 @@ void render_shield_triangle(gshield_tri *trip, matrix *orient, vector *pos, ubyt g3_rotate_vertex(&points[j], &pnt); points[j].u = trip->verts[j].u; points[j].v = trip->verts[j].v; - Assert((trip->verts[j].u >= 0.0f) && (trip->verts[j].u <= UV_MAX)); - Assert((trip->verts[j].v >= 0.0f) && (trip->verts[j].v <= UV_MAX)); + SDL_assert((trip->verts[j].u >= 0.0f) && (trip->verts[j].u <= UV_MAX)); + SDL_assert((trip->verts[j].v >= 0.0f) && (trip->verts[j].v <= UV_MAX)); verts[j] = &points[j]; } @@ -568,7 +568,7 @@ void render_shield(int shield_num) //, matrix *orient, vector *centerp) return; } - Assert(Shield_hits[shield_num].objnum >= 0); + SDL_assert(Shield_hits[shield_num].objnum >= 0); objp = &Objects[Shield_hits[shield_num].objnum]; @@ -622,8 +622,8 @@ void render_shield(int shield_num) //, matrix *orient, vector *centerp) n = si->species; // Do some sanity checking - Assert( (n >=0) && (n=0) && (n=0) && (n=0) && (n= Sheild_ani[n].nframes ) { @@ -646,7 +646,7 @@ void render_shield(int shield_num) //, matrix *orient, vector *centerp) } } else { - // AL 06/01/97 don't use Assert() until issue with Missiontime being reset to 0 are worked out + // AL 06/01/97 don't use SDL_assert() until issue with Missiontime being reset to 0 are worked out if ( bitmap_id != - 1 ) { for (i=0; i= 0) && (shnum < MAX_SHIELD_HITS)); + SDL_assert((shnum >= 0) && (shnum < MAX_SHIELD_HITS)); return shnum; } @@ -753,7 +753,7 @@ void create_shield_from_triangle(int trinum, matrix *orient, shield_info *shield rs_compute_uvs( &shieldp->tris[trinum], shieldp->verts, tcp, radius, rvec, uvec); - //Assert(trinum < MAX_SHIELD_HITS); + //SDL_assert(trinum < MAX_SHIELD_HITS); shieldp->tris[trinum].used = 1; //mprintf(("%i ", trinum)); @@ -834,7 +834,7 @@ float apply_damage_to_shield(object *objp, int shield_quadrant, float damage) if ( (shield_quadrant < 0) || (shield_quadrant > 3) ) return damage; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); aip = &Ai_info[Ships[objp->instance].ai_index]; aip->last_hit_quadrant = shield_quadrant; @@ -926,7 +926,7 @@ void create_shield_explosion(int objnum, int model_num, matrix *orient, vector * pm = model_get(model_num); Num_tris = pm->shield.ntris; - //Assert(Num_tris < MAX_SHIELD_HITS); + //SDL_assert(Num_tris < MAX_SHIELD_HITS); shieldp = &pm->shield; if (Num_tris == 0) @@ -967,7 +967,7 @@ MONITOR(NumShieldHits); // Add data for a shield hit. void add_shield_point(int objnum, int tri_num, vector *hit_pos) { - //Assert(Num_shield_points < MAX_SHIELD_POINTS); + //SDL_assert(Num_shield_points < MAX_SHIELD_POINTS); if (Num_shield_points >= MAX_SHIELD_POINTS) return; @@ -994,7 +994,7 @@ void add_shield_point(int objnum, int tri_num, vector *hit_pos) // the normal count at the correct time. void add_shield_point_multi(int objnum, int tri_num, vector *hit_pos) { - //Assert(Num_multi_shield_points < MAX_SHIELD_POINTS); + //SDL_assert(Num_multi_shield_points < MAX_SHIELD_POINTS); if (Num_multi_shield_points >= MAX_SHIELD_POINTS) return; @@ -1011,7 +1011,7 @@ void shield_point_multi_setup() { int i; - Assert( MULTIPLAYER_CLIENT ); + SDL_assert( MULTIPLAYER_CLIENT ); if ( Num_multi_shield_points == 0 ) return; @@ -1059,7 +1059,7 @@ void create_shield_explosion_all(object *objp) // some some reason, clients seem to have a bogus count valud on occation. I"ll chalk it up // to missed packets :-) MWA 2/6/98 if ( !MULTIPLAYER_CLIENT ){ - Assert(count == 0); // Couldn't find all the alleged shield hits. Bogus! + SDL_assert(count == 0); // Couldn't find all the alleged shield hits. Bogus! } } @@ -1083,7 +1083,7 @@ void ship_draw_shield( object *objp) if (objp->flags & OF_NO_SHIELDS) return; - Assert(objp->instance >= 0); + SDL_assert(objp->instance >= 0); model_num = Ships[objp->instance].modelnum; diff --git a/src/ship/ship.cpp b/src/ship/ship.cpp index ee3c742..fbd3f10 100644 --- a/src/ship/ship.cpp +++ b/src/ship/ship.cpp @@ -967,7 +967,7 @@ int ship_obj_list_add(int objnum) // called from ship_delete() void ship_obj_list_remove(int index) { - Assert(index >= 0 && index < MAX_SHIP_OBJS); + SDL_assert(index >= 0 && index < MAX_SHIP_OBJS); list_remove(&Ship_obj_list, &Ship_objs[index]); ship_obj_list_reset_slot(index); } @@ -992,7 +992,7 @@ void ship_obj_list_rebuild() ship_obj *get_ship_obj_ptr_from_index(int index) { - Assert(index >= 0 && index < MAX_SHIP_OBJS); + SDL_assert(index >= 0 && index < MAX_SHIP_OBJS); return &Ship_objs[index]; } @@ -1294,7 +1294,7 @@ int parse_ship() // error checking for ( i = 0; i < sip->num_primary_banks; i++ ) { - Assert(sip->primary_bank_weapons[i] >= 0); + SDL_assert(sip->primary_bank_weapons[i] >= 0); } // Set the weapons filter used in weapons loadout (for secondary weapons) @@ -1330,7 +1330,7 @@ int parse_ship() // error checking for ( i = 0; i < sip->num_secondary_banks; i++ ) { - Assert(sip->secondary_bank_weapons[i] >= 0); + SDL_assert(sip->secondary_bank_weapons[i] >= 0); } // Get the capacity of each secondary bank @@ -1372,63 +1372,63 @@ int parse_ship() int num_strings = stuff_string_list(ship_strings, MAX_SHIP_FLAGS); sip->flags = SIF_DEFAULT_VALUE; for ( i=0; iflags &= ~SIF_DO_COLLISION_CHECK; - else if (!stricmp(NOX("player_ship"), ship_strings[i])) + else if (!SDL_strcasecmp(NOX("player_ship"), ship_strings[i])) sip->flags |= SIF_PLAYER_SHIP; - else if (!stricmp(NOX("default_player_ship"), ship_strings[i])) + else if (!SDL_strcasecmp(NOX("default_player_ship"), ship_strings[i])) sip->flags |= SIF_DEFAULT_PLAYER_SHIP; - else if ( !stricmp(NOX("repair_rearm"), ship_strings[i])) + else if ( !SDL_strcasecmp(NOX("repair_rearm"), ship_strings[i])) sip->flags |= SIF_SUPPORT; - else if ( !stricmp(NOX("cargo"), ship_strings[i])) + else if ( !SDL_strcasecmp(NOX("cargo"), ship_strings[i])) sip->flags |= SIF_CARGO; - else if ( !stricmp( NOX("fighter"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("fighter"), ship_strings[i])) sip->flags |= SIF_FIGHTER; - else if ( !stricmp( NOX("bomber"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("bomber"), ship_strings[i])) sip->flags |= SIF_BOMBER; - else if ( !stricmp( NOX("transport"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("transport"), ship_strings[i])) sip->flags |= SIF_TRANSPORT; - else if ( !stricmp( NOX("freighter"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("freighter"), ship_strings[i])) sip->flags |= SIF_FREIGHTER; - else if ( !stricmp( NOX("capital"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("capital"), ship_strings[i])) sip->flags |= SIF_CAPITAL; - else if (!stricmp( NOX("supercap"), ship_strings[i])) + else if (!SDL_strcasecmp( NOX("supercap"), ship_strings[i])) sip->flags |= SIF_SUPERCAP; - else if (!stricmp( NOX("drydock"), ship_strings[i])) + else if (!SDL_strcasecmp( NOX("drydock"), ship_strings[i])) sip->flags |= SIF_DRYDOCK; - else if ( !stricmp( NOX("cruiser"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("cruiser"), ship_strings[i])) sip->flags |= SIF_CRUISER; - else if ( !stricmp( NOX("navbuoy"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("navbuoy"), ship_strings[i])) sip->flags |= SIF_NAVBUOY; - else if ( !stricmp( NOX("sentrygun"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("sentrygun"), ship_strings[i])) sip->flags |= SIF_SENTRYGUN; - else if ( !stricmp( NOX("escapepod"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("escapepod"), ship_strings[i])) sip->flags |= SIF_ESCAPEPOD; - else if ( !stricmp( NOX("no type"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("no type"), ship_strings[i])) sip->flags |= SIF_NO_SHIP_TYPE; - else if ( !stricmp( NOX("ship copy"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("ship copy"), ship_strings[i])) sip->flags |= SIF_SHIP_COPY; - else if ( !stricmp( NOX("in tech database"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("in tech database"), ship_strings[i])) #ifdef MAKE_FS1 sip->flags |= SIF_IN_TECH_DATABASE; #else sip->flags |= SIF_IN_TECH_DATABASE | SIF_IN_TECH_DATABASE_M; #endif - else if ( !stricmp( NOX("in tech database multi"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("in tech database multi"), ship_strings[i])) sip->flags |= SIF_IN_TECH_DATABASE_M; - else if ( !stricmp( NOX("dont collide invisible"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("dont collide invisible"), ship_strings[i])) sip->flags |= SIF_DONT_COLLIDE_INVIS; - else if ( !stricmp( NOX("big damage"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("big damage"), ship_strings[i])) sip->flags |= SIF_BIG_DAMAGE; - else if ( !stricmp( NOX("corvette"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("corvette"), ship_strings[i])) sip->flags |= SIF_CORVETTE; - else if ( !stricmp( NOX("gas miner"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("gas miner"), ship_strings[i])) sip->flags |= SIF_GAS_MINER; - else if ( !stricmp( NOX("awacs"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("awacs"), ship_strings[i])) sip->flags |= SIF_AWACS; - else if ( !stricmp( NOX("knossos"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("knossos"), ship_strings[i])) sip->flags |= SIF_KNOSSOS_DEVICE; - else if ( !stricmp( NOX("no_fred"), ship_strings[i])) + else if ( !SDL_strcasecmp( NOX("no_fred"), ship_strings[i])) sip->flags |= SIF_NO_FRED; else Warning(LOCATION, "Bogus string in ship flags: %s\n", ship_strings[i]); @@ -1523,7 +1523,7 @@ int parse_ship() sip->ct_count = 0; while(optional_string("$Trail:")){ // this means you've reached the max # of contrails for a ship - Assert(sip->ct_count <= MAX_SHIP_CONTRAILS); + SDL_assert(sip->ct_count <= MAX_SHIP_CONTRAILS); ci = &sip->ct_info[sip->ct_count++]; @@ -1566,7 +1566,7 @@ int parse_ship() float percentage_of_hits; model_subsystem *sp; // to append on the ships list of subsystems - Assert ( n_subsystems < MAX_MODEL_SUBSYSTEMS ); + SDL_assert ( n_subsystems < MAX_MODEL_SUBSYSTEMS ); sp = &subsystems[n_subsystems++]; // subsystems a local -- when done, we will malloc and copy required_string("$Subsystem:"); stuff_string(sp->subobj_name, F_NAME, ","); @@ -1637,13 +1637,13 @@ int parse_ship() Int3(); // Impossible return value from required_string_3. } } - Assert( hull_percentage_of_hits > 0.0f ); // must be > 0 + SDL_assert( hull_percentage_of_hits > 0.0f ); // must be > 0 // when done reading subsystems, malloc and copy the subsystem data to the ship info structure sip->n_subsystems = n_subsystems; if ( n_subsystems > 0 ) { sip->subsystems = (model_subsystem *)malloc(sizeof(model_subsystem) * n_subsystems ); - Assert( sip->subsystems != NULL ); + SDL_assert( sip->subsystems != NULL ); } else { sip->subsystems = NULL; @@ -1677,7 +1677,7 @@ char get_engine_wash_index(char *engine_wash_name) int i; for (i=0; iship_name, "%s %d", Ship_info[ship_type].name, ship_index); // moved to ship_create() - Assert(strlen(shipp->ship_name) < NAME_LENGTH - 1); + SDL_assert(strlen(shipp->ship_name) < NAME_LENGTH - 1); shipp->ship_info_index = ship_type; shipp->objnum = objnum; shipp->group = 0; @@ -2081,7 +2081,7 @@ void ship_set(int ship_index, int objnum, int ship_type) for ( i = 0; i < sip->num_secondary_banks; i++ ) { float weapon_size; weapon_size = Weapon_info[sip->secondary_bank_weapons[i]].cargo_size; - Assert( weapon_size > 0.0f ); + SDL_assert( weapon_size > 0.0f ); if (Fred_running){ swp->secondary_bank_ammo[i] = 100; } else { @@ -2202,7 +2202,7 @@ void ship_recalc_subsys_strength( ship *shipp ) int type; type = ship_system->system_info->type; - Assert ( (type >= 0) && (type < SUBSYSTEM_MAX) ); + SDL_assert ( (type >= 0) && (type < SUBSYSTEM_MAX) ); shipp->subsys_info[type].num++; shipp->subsys_info[type].total_hits += ship_system->system_info->max_hits; shipp->subsys_info[type].current_hits += ship_system->current_hits; @@ -2254,7 +2254,7 @@ void ship_copy_subsystem_fixup(ship_info *sip) // see if this ship has subsystems and a model for the subsystems. We only need check the first // subsystem since previous error checking would have trapped it's loading as an error. - Assert( Ship_info[i].n_subsystems == sip->n_subsystems ); + SDL_assert( Ship_info[i].n_subsystems == sip->n_subsystems ); msp = &Ship_info[i].subsystems[0]; model_copy_subsystems( sip->n_subsystems, &(sip->subsystems[0]), msp ); @@ -2289,7 +2289,7 @@ void subsys_set(int objnum, int ignore_subsys_info) // set up the linked list ship_system = GET_FIRST( &ship_subsys_free_list ); // get a new element from the ship_subsystem array - Assert ( ship_system != &ship_subsys_free_list ); // shouldn't have the dummy element + SDL_assert ( ship_system != &ship_subsys_free_list ); // shouldn't have the dummy element list_remove( &ship_subsys_free_list, ship_system ); // remove the element from the array list_append( &shipp->subsys_list, ship_system ); // link the element into the ship @@ -2449,7 +2449,7 @@ void ship_render(object * obj) num = obj->instance; - Assert( num >= 0); + SDL_assert( num >= 0); #if 0 // show target when attacking big ship @@ -2727,10 +2727,10 @@ void ship_delete( object * obj ) int num, objnum; num = obj->instance; - Assert( num >= 0); + SDL_assert( num >= 0); objnum = OBJ_INDEX(obj); - Assert( Ships[num].objnum == objnum ); + SDL_assert( Ships[num].objnum == objnum ); shipp = &Ships[num]; @@ -2778,7 +2778,7 @@ void ship_wing_cleanup( int shipnum, wing *wingp ) } } - // Assert(index != -1); + // SDL_assert(index != -1); // this can happen in multiplayer (dogfight, ingame join specifically) if(index == -1){ @@ -2790,7 +2790,7 @@ void ship_wing_cleanup( int shipnum, wing *wingp ) } wingp->current_count--; - Assert ( wingp->current_count >= 0 ); + SDL_assert ( wingp->current_count >= 0 ); wingp->ship_index[wingp->current_count] = -1; // if the current count is 0, check to see if the wing departed or was destroyed. @@ -3020,7 +3020,7 @@ int ship_explode_area_calc_damage( vector *pos1, vector *pos2, float inner_rad, void ship_blow_up_area_apply_blast( object *exp_objp) { ship_info *sip; - Assert( exp_objp->type == OBJ_SHIP ); + SDL_assert( exp_objp->type == OBJ_SHIP ); float inner_rad, outer_rad, max_damage, max_blast, shockwave_speed; shockwave_create_info sci; @@ -3124,15 +3124,15 @@ void ship_blow_up_area_apply_blast( object *exp_objp) void do_dying_undock_physics(object* objp, ship* sp) { - Assert(sp->dock_objnum_when_dead >= 0); + SDL_assert(sp->dock_objnum_when_dead >= 0); if(sp->dock_objnum_when_dead < 0){ return; } object* dock_obj = &Objects[sp->dock_objnum_when_dead]; // sanity checks - Assert(objp->type == OBJ_SHIP); - Assert(dock_obj->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(dock_obj->type == OBJ_SHIP); if((objp->type != OBJ_SHIP) || (dock_obj->type != OBJ_SHIP)){ return; } @@ -3186,7 +3186,7 @@ void ship_dying_frame(object *objp, int ship_num) // special case of VAPORIZE if (sp->flags & SF_VAPORIZE) { - // Assert(Ship_info[sp->ship_info_index].flags & SIF_SMALL_SHIP); + // SDL_assert(Ship_info[sp->ship_info_index].flags & SIF_SMALL_SHIP); if (timestamp_elapsed(sp->final_death_time)) { // play death sound @@ -3328,8 +3328,8 @@ void ship_dying_frame(object *objp, int ship_num) if (sp->dock_objnum_when_dead != -1) { // other ship undocks // These asserts should no longer be needed and they cause a problem that is not obvious how to fix. - //Assert( !(Ai_info[Ships[dock_obj->instance].ai_index].ai_flags & AIF_DOCKED) ); - //Assert( Ai_info[Ships[dock_obj->instance].ai_index].dock_objnum == -1 ); + //SDL_assert( !(Ai_info[Ships[dock_obj->instance].ai_index].ai_flags & AIF_DOCKED) ); + //SDL_assert( Ai_info[Ships[dock_obj->instance].ai_index].dock_objnum == -1 ); // MWA Ai_info[Ships[dock_obj->instance].ai_index].ai_flags &= ~AIF_DOCKED; // MWA Ai_info[Ships[dock_obj->instance].ai_index].dock_objnum = -1; // MWA Ai_info[Ships[dock_obj->instance].ai_index].mode = AIM_NONE; @@ -3575,7 +3575,7 @@ void ship_init_thrusters() Error(LOCATION,"Error loading animation file: %s\n",Thrust_anim_names[i]); return; } - Assert(fps != 0); + SDL_assert(fps != 0); ta->time = i2fl(ta->num_frames)/fps; } @@ -3594,7 +3594,7 @@ void ship_init_thrusters() Error(LOCATION,"Error loading bitmap file: %s\n",Thrust_glow_anim_names[i]); return; } - Assert(fps != 0); + SDL_assert(fps != 0); ta->time = i2fl(ta->num_frames)/fps; } @@ -3631,12 +3631,12 @@ void ship_do_thruster_frame( ship *shipp, object *objp, float frametime ) // rate = 0.1f; - Assert( anim_index > -1 ); - Assert( anim_index < NUM_THRUST_ANIMS ); + SDL_assert( anim_index > -1 ); + SDL_assert( anim_index < NUM_THRUST_ANIMS ); the_anim = &Thrust_anims[anim_index]; - Assert( frametime > 0.0f ); + SDL_assert( frametime > 0.0f ); shipp->thruster_frame += frametime * rate; // Sanity checks @@ -3661,7 +3661,7 @@ void ship_do_thruster_frame( ship *shipp, object *objp, float frametime ) // Do it for glow bitmaps the_anim = &Thrust_glow_anims[anim_index]; - Assert( frametime > 0.0f ); + SDL_assert( frametime > 0.0f ); shipp->thruster_glow_frame += frametime * rate; // Sanity checks @@ -3710,12 +3710,12 @@ void ship_do_weapon_thruster_frame( weapon *weaponp, object *objp, float frameti // rate = 0.5f + objp->phys_info.forward_thrust / 2.0f; rate = 0.67f * (1.0f + objp->phys_info.forward_thrust); - Assert( anim_index > -1 ); - Assert( anim_index < NUM_THRUST_ANIMS ); + SDL_assert( anim_index > -1 ); + SDL_assert( anim_index < NUM_THRUST_ANIMS ); the_anim = &Thrust_anims[anim_index]; - Assert( frametime > 0.0f ); + SDL_assert( frametime > 0.0f ); weaponp->thruster_frame += frametime * rate; // Sanity checks @@ -3740,7 +3740,7 @@ void ship_do_weapon_thruster_frame( weapon *weaponp, object *objp, float frameti // Do it for glow bitmaps the_anim = &Thrust_glow_anims[anim_index]; - Assert( frametime > 0.0f ); + SDL_assert( frametime > 0.0f ); weaponp->thruster_glow_frame += frametime * rate; // Sanity checks @@ -3783,7 +3783,7 @@ void ship_auto_repair_frame(int shipnum, float frametime) return; #endif - Assert( shipnum >= 0 && shipnum < MAX_SHIPS); + SDL_assert( shipnum >= 0 && shipnum < MAX_SHIPS); sp = &Ships[shipnum]; sip = &Ship_info[sp->ship_info_index]; @@ -3797,7 +3797,7 @@ void ship_auto_repair_frame(int shipnum, float frametime) // iterate through subsystems, repair as needed based on elapsed frametime for ( ssp = GET_FIRST(&sp->subsys_list); ssp != END_OF_LIST(&sp->subsys_list); ssp = GET_NEXT(ssp) ) { - Assert(ssp->system_info->type >= 0 && ssp->system_info->type < SUBSYSTEM_MAX); + SDL_assert(ssp->system_info->type >= 0 && ssp->system_info->type < SUBSYSTEM_MAX); ssip = &sp->subsys_info[ssp->system_info->type]; if ( ssp->current_hits != ssp->system_info->max_hits ) { @@ -3921,7 +3921,7 @@ void ship_check_player_distance() void observer_process_post(object *objp) { - Assert(objp->type == OBJ_OBSERVER); + SDL_assert(objp->type == OBJ_OBSERVER); if (Game_mode & GM_MULTIPLAYER) { // if I'm just an observer @@ -4093,9 +4093,9 @@ void ship_process_post(object * obj, float frametime) MONITOR_INC( NumShips, 1 ); num = obj->instance; - Assert( num >= 0 && num < MAX_SHIPS); - Assert( obj->type == OBJ_SHIP ); - Assert( Ships[num].objnum == OBJ_INDEX(obj)); + SDL_assert( num >= 0 && num < MAX_SHIPS); + SDL_assert( obj->type == OBJ_SHIP ); + SDL_assert( Ships[num].objnum == OBJ_INDEX(obj)); shipp = &Ships[num]; @@ -4278,12 +4278,12 @@ void ship_set_default_weapons(ship *shipp, ship_info *sip) // Primary banks if ( po->n_guns > sip->num_primary_banks ) { - Assert(po->n_guns <= MAX_PRIMARY_BANKS); + SDL_assert(po->n_guns <= MAX_PRIMARY_BANKS); Warning(LOCATION, "There are %d primary banks in the model file,\nbut only %d primary banks in ships.tbl for %s\n", po->n_guns, sip->num_primary_banks, sip->name); for ( i = sip->num_primary_banks; i < po->n_guns; i++ ) { // Make unspecified weapon for bank be a Light Laser swp->primary_bank_weapons[i] = weapon_info_lookup(NOX("Light Laser")); - Assert(swp->primary_bank_weapons[i] >= 0); + SDL_assert(swp->primary_bank_weapons[i] >= 0); } sip->num_primary_banks = po->n_guns; } @@ -4294,12 +4294,12 @@ void ship_set_default_weapons(ship *shipp, ship_info *sip) // Secondary banks if ( po->n_missiles > sip->num_secondary_banks ) { - Assert(po->n_missiles <= MAX_SECONDARY_BANKS); + SDL_assert(po->n_missiles <= MAX_SECONDARY_BANKS); Warning(LOCATION, "There are %d secondary banks in model,\nbut only %d secondary banks in ships.tbl for %s\n", po->n_missiles, sip->num_secondary_banks, sip->name); for ( i = sip->num_secondary_banks; i < po->n_missiles; i++ ) { // Make unspecified weapon for bank be a Rockeye Missile swp->secondary_bank_weapons[i] = weapon_info_lookup(NOX("Rockeye Missile")); - Assert(swp->secondary_bank_weapons[i] >= 0); + SDL_assert(swp->secondary_bank_weapons[i] >= 0); } sip->num_secondary_banks = po->n_missiles; } @@ -4337,8 +4337,8 @@ int ship_check_collision_fast( object * obj, object * other_obj, vector * hitpos int num; mc_info mc; - Assert( obj->type == OBJ_SHIP ); - Assert( obj->instance >= 0 ); + SDL_assert( obj->type == OBJ_SHIP ); + SDL_assert( obj->instance >= 0 ); num = obj->instance; @@ -4371,8 +4371,8 @@ void ship_maybe_fixup_subsys_path(polymodel *pm, int path_num) model_path *mp; mp = &pm->paths[path_num]; - Assert(mp != NULL); - Assert(mp->nverts > 1); + SDL_assert(mp != NULL); + SDL_assert(mp->nverts > 1); index_1 = 1; index_2 = 0; @@ -4408,7 +4408,7 @@ void ship_set_subsys_path_nums(ship_info *sip, polymodel *pm) for ( j = 0; j < pm->n_paths; j++ ) { if ( (sip->subsystems[i].subobj_num != -1) && (sip->subsystems[i].subobj_num == pm->paths[j].parent_submodel) ) { found_path = 1; - } else if ( !stricmp(sip->subsystems[i].subobj_name, pm->paths[j].parent_name) ) { + } else if ( !SDL_strcasecmp(sip->subsystems[i].subobj_name, pm->paths[j].parent_name) ) { found_path = 1; } @@ -4446,7 +4446,7 @@ void ship_set_bay_path_nums(ship_info *sip, polymodel *pm) // malloc out storage for the path information pm->ship_bay = (ship_bay*)malloc(sizeof(ship_bay)); - Assert(pm->ship_bay != NULL); + SDL_assert(pm->ship_bay != NULL); pm->ship_bay->num_paths = 0; // TODO: determine if zeroing out here is affecting any earlier initializations @@ -4456,11 +4456,11 @@ void ship_set_bay_path_nums(ship_info *sip, polymodel *pm) // iterate through the paths that exist in the polymodel, searching for $bayN pathnames for ( i = 0; i < pm->n_paths; i++ ) { - if ( !strnicmp(pm->paths[i].name, NOX("$bay"), 4) ) { + if ( !SDL_strncasecmp(pm->paths[i].name, NOX("$bay"), 4) ) { strncpy(bay_num_str, pm->paths[i].name+4, 2); bay_num_str[2] = 0; bay_num = atoi(bay_num_str); - Assert(bay_num >= 1 && bay_num <= MAX_SHIP_BAY_PATHS); + SDL_assert(bay_num >= 1 && bay_num <= MAX_SHIP_BAY_PATHS); pm->ship_bay->paths[bay_num-1] = i; pm->ship_bay->num_paths++; } @@ -4565,13 +4565,13 @@ int ship_create(matrix *orient, vector *pos, int ship_type) return -1; } - Assert((ship_type >= 0) && (ship_type < Num_ship_types)); + SDL_assert((ship_type >= 0) && (ship_type < Num_ship_types)); sip = &(Ship_info[ship_type]); shipp = &Ships[n]; // check to be sure that this ship falls into a ship size category!!! - // get Allender or Mike if you hit this Assert - Assert( sip->flags & (SIF_SMALL_SHIP | SIF_BIG_SHIP | SIF_CAPITAL | SIF_NO_SHIP_TYPE | SIF_NOT_FLYABLE | SIF_ESCAPEPOD | SIF_SUPERCAP | SIF_DRYDOCK | SIF_KNOSSOS_DEVICE) ); + // get Allender or Mike if you hit this SDL_assert + SDL_assert( sip->flags & (SIF_SMALL_SHIP | SIF_BIG_SHIP | SIF_CAPITAL | SIF_NO_SHIP_TYPE | SIF_NOT_FLYABLE | SIF_ESCAPEPOD | SIF_SUPERCAP | SIF_DRYDOCK | SIF_KNOSSOS_DEVICE) ); sip->modelnum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]); // use the highest detail level shipp->modelnum = sip->modelnum; @@ -4581,7 +4581,7 @@ int ship_create(matrix *orient, vector *pos, int ship_type) // check to see if a "real" ship uses this model. if so, load it up for him so that subsystems are setup properly int idx; for(idx=0; idxpof_file_hud)){ + if(!SDL_strcasecmp(Ship_info[idx].pof_file, sip->pof_file_hud)){ Ship_info[idx].modelnum = model_load(Ship_info[idx].pof_file, Ship_info[idx].n_subsystems, &Ship_info[idx].subsystems[0]); } } @@ -4615,10 +4615,10 @@ int ship_create(matrix *orient, vector *pos, int ship_type) } else { objnum = obj_create(OBJ_SHIP, -1, n, orient, pos, model_get_radius(shipp->modelnum), OF_RENDERS | OF_COLLIDES | OF_PHYSICS ); } - Assert( objnum >= 0 ); + SDL_assert( objnum >= 0 ); shipp->ai_index = ai_get_slot(n); - Assert( shipp->ai_index >= 0 ); + SDL_assert( shipp->ai_index >= 0 ); sprintf(shipp->ship_name, NOX("%s %d"), Ship_info[ship_type].name, n); ship_set_default_weapons(shipp, sip); // Moved up here because ship_set requires that weapon info be valid. MK, 4/28/98 @@ -4725,7 +4725,7 @@ void ship_model_change(int n, int ship_type) ship *sp; - Assert( n >= 0 && n < MAX_SHIPS ); + SDL_assert( n >= 0 && n < MAX_SHIPS ); sp = &Ships[n]; sip = &(Ship_info[ship_type]); @@ -4774,7 +4774,7 @@ void change_ship_type(int n, int ship_type) object *objp; - Assert( n >= 0 && n < MAX_SHIPS ); + SDL_assert( n >= 0 && n < MAX_SHIPS ); sp = &Ships[n]; sip = &(Ship_info[ship_type]); objp = &Objects[sp->objnum]; @@ -4839,7 +4839,7 @@ int ship_fire_primary_debug(object *objp) // Debug code! Make the single laser fire only one bolt and from the object center! for (i=0; ipos, &(objp->orient.v.fvec) ); @@ -4913,7 +4913,7 @@ int ship_launch_countermeasure(object *objp, int rand_val) fired = cmeasure_create( objp, &pos, shipp->current_cmeasure, rand_val ); // Play sound effect for counter measure launch - Assert(shipp->current_cmeasure < Num_cmeasure_types); + SDL_assert(shipp->current_cmeasure < Num_cmeasure_types); if ( Cmeasure_info[shipp->current_cmeasure].launch_sound != -1 ) { snd_play_3d( &Snds[Cmeasure_info[shipp->current_cmeasure].launch_sound], &pos, &View_position ); } @@ -5086,7 +5086,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) int sound_played; // used to track what sound is played. If the player is firing two banks // of the same laser, we only want to play one sound - Assert( obj != NULL ); + SDL_assert( obj != NULL ); if(obj == NULL){ return 0; @@ -5097,9 +5097,9 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) return 0; } - Assert( obj->type == OBJ_SHIP ); - Assert( n >= 0 ); - Assert( Ships[n].objnum == OBJ_INDEX(obj)); + SDL_assert( obj->type == OBJ_SHIP ); + SDL_assert( n >= 0 ); + SDL_assert( Ships[n].objnum == OBJ_INDEX(obj)); if((obj->type != OBJ_SHIP) || (n < 0) || (n >= MAX_SHIPS) || (Ships[n].objnum != OBJ_INDEX(obj))){ return 0; } @@ -5137,7 +5137,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) num_primary_banks = min(1, swp->num_primary_banks); } - Assert(num_primary_banks > 0); + SDL_assert(num_primary_banks > 0); if (num_primary_banks < 1){ return 0; } @@ -5151,7 +5151,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) bank_to_fire = (swp->current_primary_bank+i)%2; // Max supported banks is 2 weapon = swp->primary_bank_weapons[bank_to_fire]; - Assert( weapon >= 0 && weapon < MAX_WEAPONS ); + SDL_assert( weapon >= 0 && weapon < MAX_WEAPONS ); if ( (weapon < 0) || (weapon >= MAX_WEAPON_TYPES) ) { Int3(); // why would a ship try to fire a weapon that doesn't exist? continue; @@ -5339,7 +5339,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) int player_num; player_num = multi_find_player_by_object ( obj ); - Assert ( player_num != -1 ); + SDL_assert ( player_num != -1 ); Net_players[player_num].player->stats.mp_shots_fired += num_fired; } @@ -5475,7 +5475,7 @@ int maybe_detonate_weapon(ship_weapon *swp, object *src) return 0; } - Assert(Weapons[objp->instance].weapon_info_index != -1); + SDL_assert(Weapons[objp->instance].weapon_info_index != -1); wip = &Weapon_info[Weapons[objp->instance].weapon_info_index]; if (wip->wi_flags & WIF_REMOTE) { @@ -5522,7 +5522,7 @@ int ship_fire_secondary_detonate(object *obj, ship_weapon *swp) // check for currently locked missiles (highest precedence) for ( mo = GET_FIRST(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) { object *mobjp; - Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); + SDL_assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); mobjp = &Objects[mo->objnum]; if ((mobjp != first_objp) && (mobjp->parent_sig == obj->parent_sig)) { if (Weapon_info[Weapons[mobjp->instance].weapon_info_index].wi_flags & WIF_REMOTE) { @@ -5589,7 +5589,7 @@ int ship_fire_secondary( object *obj, int allow_swarm ) polymodel *po; vector missile_point, pnt, firing_pos; - Assert( obj != NULL ); + SDL_assert( obj != NULL ); // in the case where the server is an observer, he can fire (which would be bad) - unless we do this. if( obj->type == OBJ_OBSERVER ){ @@ -5601,16 +5601,16 @@ int ship_fire_secondary( object *obj, int allow_swarm ) return 0; } - Assert( obj->type == OBJ_SHIP ); + SDL_assert( obj->type == OBJ_SHIP ); if(obj->type != OBJ_SHIP){ return 0; } n = obj->instance; - Assert( n >= 0 && n < MAX_SHIPS ); + SDL_assert( n >= 0 && n < MAX_SHIPS ); if((n < 0) || (n >= MAX_SHIPS)){ return 0; } - Assert( Ships[n].objnum == OBJ_INDEX(obj)); + SDL_assert( Ships[n].objnum == OBJ_INDEX(obj)); if(Ships[n].objnum != OBJ_INDEX(obj)){ return 0; } @@ -5638,7 +5638,7 @@ int ship_fire_secondary( object *obj, int allow_swarm ) } weapon = swp->secondary_bank_weapons[bank]; - Assert( (swp->secondary_bank_weapons[bank] >= 0) && (swp->secondary_bank_weapons[bank] < MAX_WEAPON_TYPES) ); + SDL_assert( (swp->secondary_bank_weapons[bank] >= 0) && (swp->secondary_bank_weapons[bank] < MAX_WEAPON_TYPES) ); if((swp->secondary_bank_weapons[bank] < 0) || (swp->secondary_bank_weapons[bank] >= MAX_WEAPON_TYPES)){ return 0; } @@ -5654,8 +5654,8 @@ int ship_fire_secondary( object *obj, int allow_swarm ) // in multiplayer, master sends a secondary fired packet with starting signature of -1 -- indicates // to client code to set the detonate timer to 0. if ( MULTIPLAYER_MASTER ) { - // MWA -- 4/6/98 Assert invalid since the bank count could have gone to 0. - //Assert(starting_bank_count != 0); + // MWA -- 4/6/98 SDL_assert invalid since the bank count could have gone to 0. + //SDL_assert(starting_bank_count != 0); send_secondary_fired_packet( shipp, 0, starting_bank_count, 1, allow_swarm ); } @@ -5712,7 +5712,7 @@ int ship_fire_secondary( object *obj, int allow_swarm ) // if trying to fire a swarm missile, make sure being called from right place if ( (wip->wi_flags & WIF_SWARM) && !allow_swarm ) { - Assert(wip->swarm_count > 0); + SDL_assert(wip->swarm_count > 0); if(wip->swarm_count <= 0){ shipp->num_swarm_missiles_to_fire += SWARM_DEFAULT_NUM_MISSILES_FIRED; } else { @@ -5808,7 +5808,7 @@ int ship_fire_secondary( object *obj, int allow_swarm ) vm_vec_add(&firing_pos, &missile_point, &obj->pos); if ( Game_mode & GM_MULTIPLAYER ) { - Assert( Weapon_info[weapon].subtype == WP_MISSILE ); + SDL_assert( Weapon_info[weapon].subtype == WP_MISSILE ); } // create the weapon -- for multiplayer, the net_signature is assigned inside @@ -5867,7 +5867,7 @@ done_secondary: // first network signatures for the newly created weapons. if nothing got fired, send a failed // packet if if ( MULTIPLAYER_MASTER ) { - Assert(starting_sig != 0); + SDL_assert(starting_sig != 0); send_secondary_fired_packet( shipp, starting_sig, starting_bank_count, num_fired, allow_swarm ); } @@ -5881,7 +5881,7 @@ done_secondary: int player_num; player_num = multi_find_player_by_object ( obj ); - Assert ( player_num != -1 ); + SDL_assert ( player_num != -1 ); Net_players[player_num].player->stats.ms_shots_fired += num_fired; } @@ -5922,14 +5922,14 @@ int ship_select_next_primary(object *objp, int direction) ship *shipp; ship_weapon *swp; - Assert(objp != NULL); - Assert(objp->type == OBJ_SHIP); - Assert(objp->instance >= 0 && objp->instance < MAX_SHIPS); + SDL_assert(objp != NULL); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance >= 0 && objp->instance < MAX_SHIPS); shipp = &Ships[objp->instance]; swp = &shipp->weapons; - Assert(direction == CYCLE_PRIMARY_NEXT || direction == CYCLE_PRIMARY_PREV); + SDL_assert(direction == CYCLE_PRIMARY_NEXT || direction == CYCLE_PRIMARY_PREV); switch ( swp->num_primary_banks ) { @@ -6009,9 +6009,9 @@ int ship_select_next_primary(object *objp, int direction) // for the player ship. int ship_select_next_secondary(object *objp) { - Assert(objp != NULL); - Assert(objp->type == OBJ_SHIP); - Assert(objp->instance >= 0 && objp->instance < MAX_SHIPS); + SDL_assert(objp != NULL); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance >= 0 && objp->instance < MAX_SHIPS); int original_bank, new_bank, i; ship *shipp; @@ -6039,7 +6039,7 @@ int ship_select_next_secondary(object *objp) case 2: case 3: - Assert(swp->current_secondary_bank < swp->num_secondary_banks); + SDL_assert(swp->current_secondary_bank < swp->num_secondary_banks); original_bank = swp->current_secondary_bank; for ( i = 1; i < swp->num_secondary_banks; i++ ) { @@ -6078,8 +6078,8 @@ int get_available_secondary_weapons(object *objp, int *outlist, int *outbanklist int i; ship *shipp; - Assert(objp->type == OBJ_SHIP); - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; for (i=0; iweapons.num_secondary_banks; i++) @@ -6103,12 +6103,12 @@ int wing_name_lookup(const char *name, int ignore_count) if (Fred_running || ignore_count ) { // current_count not used for Fred.. for (i=0; i= 0){ if (Objects[Ships[i].objnum].type == OBJ_SHIP || (Objects[Ships[i].objnum].type == OBJ_START && inc_players)){ - if (!stricmp(name, Ships[i].ship_name)){ + if (!SDL_strcasecmp(name, Ships[i].ship_name)){ return i; } } @@ -6191,7 +6191,7 @@ int ship_type_name_lookup(const char *name) // look through the Ship_type_names array for(idx=0; idx= 0){ if ((Objects[Ships[i].objnum].type == OBJ_SHIP) || (Objects[Ships[i].objnum].type == OBJ_START)){ - if (!stricmp(name, Ships[i].ship_name)){ + if (!SDL_strcasecmp(name, Ships[i].ship_name)){ return 0; } } @@ -6226,7 +6226,7 @@ int ship_query_state(char *name) objp = GET_FIRST(&ship_arrival_list); while (objp != END_OF_LIST(&ship_arrival_list)) { - if (!stricmp(name, objp->name)){ + if (!SDL_strcasecmp(name, objp->name)){ return -1; } @@ -6249,10 +6249,10 @@ int get_subsystem_pos(vector *pos, object *objp, ship_subsys *subsysp) vector pnt; ship *shipp; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); shipp = &Ships[objp->instance]; - Assert ( subsysp != NULL ); + SDL_assert ( subsysp != NULL ); psub = subsysp->system_info; vm_copy_transpose_matrix(&m, &objp->orient); @@ -6308,7 +6308,7 @@ void ship_model_start(object *objp) case SUBSYSTEM_ACTIVATION: break; case SUBSYSTEM_TURRET: - Assert( !(psub->flags & MSS_FLAG_ROTATES) ); // Turrets can't rotate!!! See John! + SDL_assert( !(psub->flags & MSS_FLAG_ROTATES) ); // Turrets can't rotate!!! See John! break; default: Error(LOCATION, "Illegal subsystem type.\n"); @@ -6602,8 +6602,8 @@ int ship_get_index_from_subsys(ship_subsys *ssp, int objnum, int error_bypass) ship *shipp; ship_subsys *ss; - Assert(objnum >= 0); - Assert(Objects[objnum].instance >= 0); + SDL_assert(objnum >= 0); + SDL_assert(Objects[objnum].instance >= 0); shipp = &Ships[Objects[objnum].instance]; @@ -6630,7 +6630,7 @@ int ship_get_subsys_index(ship *sp, char *ss_name, int error_bypass) count = 0; ss = GET_FIRST(&sp->subsys_list); while ( ss != END_OF_LIST( &sp->subsys_list ) ) { - if ( !stricmp(ss->system_info->subobj_name, ss_name) ) + if ( !SDL_strcasecmp(ss->system_info->subobj_name, ss_name) ) return count; count++; ss = GET_NEXT( ss ); @@ -6652,7 +6652,7 @@ float ship_get_subsystem_strength( ship *shipp, int type ) float strength; ship_subsys *ssp; - Assert ( (type >= 0) && (type < SUBSYSTEM_MAX) ); + SDL_assert ( (type >= 0) && (type < SUBSYSTEM_MAX) ); if ( shipp->subsys_info[type].total_hits == 0.0f ) return 1.0f; @@ -6699,7 +6699,7 @@ void ship_set_subsystem_strength( ship *shipp, int type, float strength ) float total_current_hits, diff; ship_subsys *ssp; - Assert ( (type >= 0) && (type < SUBSYSTEM_MAX) ); + SDL_assert ( (type >= 0) && (type < SUBSYSTEM_MAX) ); if ( shipp->subsys_info[type].total_hits == 0.0f ) return; @@ -6816,7 +6816,7 @@ int ship_do_rearm_frame( object *objp, float frametime ) repair_delta = repair_allocated; } repair_allocated -= repair_delta; - Assert(repair_allocated >= 0.0f); + SDL_assert(repair_allocated >= 0.0f); // add repair to current strength of single subsystem ssp->current_hits += repair_delta; @@ -6943,8 +6943,8 @@ object *ship_find_repair_ship( object *requester_obj ) object *nearest_support_ship = NULL; int support_ships[MAX_SUPPORT_SHIPS_PER_TEAM]; - Assert(requester_obj->type == OBJ_SHIP); - Assert((requester_obj->instance >= 0) && (requester_obj->instance < MAX_OBJECTS)); + SDL_assert(requester_obj->type == OBJ_SHIP); + SDL_assert((requester_obj->instance >= 0) && (requester_obj->instance < MAX_OBJECTS)); // if support ships are not allowed, then no support ship can repair! if ( !is_support_allowed(requester_obj) ) @@ -6960,7 +6960,7 @@ object *ship_find_repair_ship( object *requester_obj ) ship_info *sip; float dist; - Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS)); shipp = &Ships[objp->instance]; sip = &Ship_info[shipp->ship_info_index]; @@ -6999,10 +6999,10 @@ object *ship_find_repair_ship( object *requester_obj ) if (nearest_support_ship != NULL) return nearest_support_ship; else if (num_support_ships >= MAX_SUPPORT_SHIPS_PER_TEAM) { - Assert(&Objects[support_ships[0]] != NULL); + SDL_assert(&Objects[support_ships[0]] != NULL); return &Objects[support_ships[0]]; } else { - Assert(num_support_ships < MAX_SUPPORT_SHIPS_PER_TEAM); + SDL_assert(num_support_ships < MAX_SUPPORT_SHIPS_PER_TEAM); return NULL; } } @@ -7090,7 +7090,7 @@ void ship_assign_sound(ship *sp) vector engine_pos; ship_subsys *moveup; - Assert( sp->objnum >= 0 ); + SDL_assert( sp->objnum >= 0 ); if(sp->objnum < 0){ return; } @@ -7230,14 +7230,14 @@ DCF(set_subsys, "Set the strength of a particular subsystem on player ship" ) { if ( Dc_command ) { dc_get_arg(ARG_STRING); - if ( !stricmp( Dc_arg, "weapons" )) { + if ( !SDL_strcasecmp( Dc_arg, "weapons" )) { dc_get_arg(ARG_FLOAT); if ( (Dc_arg_float < 0.0f) || (Dc_arg_float > 1.0f) ) { Dc_help = 1; } else { ship_set_subsystem_strength( Player_ship, SUBSYSTEM_WEAPONS, Dc_arg_float ); } - } else if ( !stricmp( Dc_arg, "engine" )) { + } else if ( !SDL_strcasecmp( Dc_arg, "engine" )) { dc_get_arg(ARG_FLOAT); if ( (Dc_arg_float < 0.0f) || (Dc_arg_float > 1.0f) ) { Dc_help = 1; @@ -7249,28 +7249,28 @@ DCF(set_subsys, "Set the strength of a particular subsystem on player ship" ) Player_ship->flags &= (~SF_DISABLED); // add the disabled flag } } - } else if ( !stricmp( Dc_arg, "sensors" )) { + } else if ( !SDL_strcasecmp( Dc_arg, "sensors" )) { dc_get_arg(ARG_FLOAT); if ( (Dc_arg_float < 0.0f) || (Dc_arg_float > 1.0f) ) { Dc_help = 1; } else { ship_set_subsystem_strength( Player_ship, SUBSYSTEM_SENSORS, Dc_arg_float ); } - } else if ( !stricmp( Dc_arg, "communication" )) { + } else if ( !SDL_strcasecmp( Dc_arg, "communication" )) { dc_get_arg(ARG_FLOAT); if ( (Dc_arg_float < 0.0f) || (Dc_arg_float > 1.0f) ) { Dc_help = 1; } else { ship_set_subsystem_strength( Player_ship, SUBSYSTEM_COMMUNICATION, Dc_arg_float ); } - } else if ( !stricmp( Dc_arg, "navigation" )) { + } else if ( !SDL_strcasecmp( Dc_arg, "navigation" )) { dc_get_arg(ARG_FLOAT); if ( (Dc_arg_float < 0.0f) || (Dc_arg_float > 1.0f) ) { Dc_help = 1; } else { ship_set_subsystem_strength( Player_ship, SUBSYSTEM_NAVIGATION, Dc_arg_float ); } - } else if ( !stricmp( Dc_arg, "radar" )) { + } else if ( !SDL_strcasecmp( Dc_arg, "radar" )) { dc_get_arg(ARG_FLOAT); if ( (Dc_arg_float < 0.0f) || (Dc_arg_float > 1.0f) ) { Dc_help = 1; @@ -7458,8 +7458,8 @@ int ship_docking_valid(int docker, int dockee) { int docker_type, dockee_type; - Assert(docker >= 0 && docker < MAX_SHIPS); - Assert(dockee >= 0 && dockee < MAX_SHIPS); + SDL_assert(docker >= 0 && docker < MAX_SHIPS); + SDL_assert(dockee >= 0 && dockee < MAX_SHIPS); docker_type = ship_query_general_type(docker); dockee_type = ship_query_general_type(dockee); @@ -7521,7 +7521,7 @@ int ship_get_random_player_wing_ship( int flags, float max_dist, int persona_ind // multi-team? if(multi_team >= 0){ - if(!stricmp(Wings[i].name, multi_team == 0 ? "alpha" : "zeta")){ + if(!SDL_strcasecmp(Wings[i].name, multi_team == 0 ? "alpha" : "zeta")){ wingnum = i; } else { continue; @@ -7537,7 +7537,7 @@ int ship_get_random_player_wing_ship( int flags, float max_dist, int persona_ind // if not found, the delta and epsilon count too if ( wingnum == -1 ) { - if ( !stricmp(Wings[i].name, NOX("delta")) || !stricmp(Wings[i].name, NOX("epsilon")) ) { + if ( !SDL_strcasecmp(Wings[i].name, NOX("delta")) || !SDL_strcasecmp(Wings[i].name, NOX("epsilon")) ) { wingnum = i; } } @@ -7549,7 +7549,7 @@ int ship_get_random_player_wing_ship( int flags, float max_dist, int persona_ind for ( j = 0; j < Wings[wingnum].current_count; j++ ) { ship_index = Wings[wingnum].ship_index[j]; - Assert( ship_index != -1 ); + SDL_assert( ship_index != -1 ); if ( Ships[ship_index].flags & SF_DYING ) { continue; @@ -7601,7 +7601,7 @@ int ship_get_random_player_wing_ship( int flags, float max_dist, int persona_ind which_one = (rand() % count); ship_index = slist[which_one]; - Assert ( Ships[ship_index].objnum != -1 ); + SDL_assert ( Ships[ship_index].objnum != -1 ); return ship_index; } @@ -7615,7 +7615,7 @@ int ship_get_random_ship_in_wing(int wingnum, int flags, float max_dist, int get count = 0; for ( i = 0; i < Wings[wingnum].current_count; i++ ) { ship_index = Wings[wingnum].ship_index[i]; - Assert( ship_index != -1 ); + SDL_assert( ship_index != -1 ); if ( Ships[ship_index].flags & SF_DYING ) { continue; @@ -7651,7 +7651,7 @@ int ship_get_random_ship_in_wing(int wingnum, int flags, float max_dist, int get which_one = (rand() % count); ship_index = slist[which_one]; - Assert ( Ships[ship_index].objnum != -1 ); + SDL_assert ( Ships[ship_index].objnum != -1 ); return ship_index; } @@ -7709,7 +7709,7 @@ int ship_get_random_team_ship( int team, int flags, float max_dist ) which_one = (rand() % num); objp = obj_list[which_one]; - Assert ( objp->instance != -1 ); + SDL_assert ( objp->instance != -1 ); return objp->instance; } @@ -7725,13 +7725,13 @@ int ship_secondary_bank_has_ammo(int shipnum) { ship_weapon *swp; - Assert(shipnum >= 0 && shipnum < MAX_SHIPS); + SDL_assert(shipnum >= 0 && shipnum < MAX_SHIPS); swp = &Ships[shipnum].weapons; if ( swp->current_secondary_bank == -1 ) return 0; - Assert(swp->current_secondary_bank >= 0 && swp->current_secondary_bank < MAX_SECONDARY_BANKS ); + SDL_assert(swp->current_secondary_bank >= 0 && swp->current_secondary_bank < MAX_SECONDARY_BANKS ); if ( swp->secondary_bank_ammo[swp->current_secondary_bank] <= 0 ) return 0; @@ -7868,7 +7868,7 @@ ship_subsys *ship_return_next_subsys(ship *shipp, int type, vector *attacker_pos { ship_subsys *ssp; - Assert ( type >= 0 && type < SUBSYSTEM_MAX ); + SDL_assert ( type >= 0 && type < SUBSYSTEM_MAX ); // If aggregate total is 0, that means no subsystem is alive of that type if ( shipp->subsys_info[type].total_hits <= 0.0f ) @@ -7923,7 +7923,7 @@ float ship_quadrant_shield_strength(object *hit_objp, vector *hitpos) return 0.0f; } - Assert(hit_objp->shields[quadrant_num] <= max_quadrant); + SDL_assert(hit_objp->shields[quadrant_num] <= max_quadrant); return hit_objp->shields[quadrant_num]/max_quadrant; } @@ -7956,18 +7956,18 @@ int ship_has_homing_missile_locked(ship *shipp) weapon_info *wip; missile_obj *mo; - Assert(shipp->objnum >= 0 && shipp->objnum < MAX_OBJECTS); + SDL_assert(shipp->objnum >= 0 && shipp->objnum < MAX_OBJECTS); locked_objp = &Objects[shipp->objnum]; // check for currently locked missiles (highest precedence) for ( mo = GET_NEXT(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) { - Assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); + SDL_assert(mo->objnum >= 0 && mo->objnum < MAX_OBJECTS); A = &Objects[mo->objnum]; if (A->type != OBJ_WEAPON) continue; - Assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); + SDL_assert((A->instance >= 0) && (A->instance < MAX_WEAPONS)); wp = &Weapons[A->instance]; wip = &Weapon_info[wp->weapon_info_index]; @@ -8064,7 +8064,7 @@ char *ship_return_orders(char *outbuf, ship *sp) ai_goal *aigp; const char *order_text; - Assert(sp->ai_index >= 0); + SDL_assert(sp->ai_index >= 0); aip = &Ai_info[sp->ai_index]; // The active goal is always in the first element of aip->goals[] @@ -8510,7 +8510,7 @@ void ship_maybe_ask_for_help(ship *sp) return; } - Assert(sp->team & TEAM_FRIENDLY ); + SDL_assert(sp->team & TEAM_FRIENDLY ); objp = &Objects[sp->objnum]; if ( objp->flags & OF_PLAYER_SHIP ) {// don't let the player ask for help! @@ -8553,7 +8553,7 @@ void ship_maybe_ask_for_help(ship *sp) play_ask_help: - Assert(Ship_info[sp->ship_info_index].flags & (SIF_FIGHTER|SIF_BOMBER) ); // get Alan + SDL_assert(Ship_info[sp->ship_info_index].flags & (SIF_FIGHTER|SIF_BOMBER) ); // get Alan message_send_builtin_to_player(MESSAGE_HELP, sp, MESSAGE_PRIORITY_HIGH, MESSAGE_TIME_IMMEDIATE, 0, 0, -1, multi_team_filter); Player->allow_ask_help_timestamp = timestamp(PLAYER_ASK_HELP_INTERVAL); @@ -8710,7 +8710,7 @@ void ship_primary_changed(ship *sp) if ( !(Game_mode & GM_MULTIPLAYER) ) return; - Assert(sp); + SDL_assert(sp); swp = &sp->weapons; @@ -8732,7 +8732,7 @@ void ship_secondary_changed(ship *sp) return; } - Assert(sp); + SDL_assert(sp); swp = &sp->weapons; if ( MULTIPLAYER_MASTER ) @@ -8786,7 +8786,7 @@ void ship_do_cargo_revealed( ship *shipp, int from_network ) shipp->time_cargo_revealed = Missiontime; // if the cargo is something other than "nothing", then make a log entry - if ( stricmp(Cargo_names[shipp->cargo1 & CARGO_INDEX_MASK], NOX("nothing")) ){ + if ( SDL_strcasecmp(Cargo_names[shipp->cargo1 & CARGO_INDEX_MASK], NOX("nothing")) ){ mission_log_add_entry(LOG_CARGO_REVEALED, shipp->ship_name, NULL, (shipp->cargo1 & CARGO_INDEX_MASK) ); } } @@ -8809,7 +8809,7 @@ void ship_do_cap_subsys_cargo_revealed( ship *shipp, ship_subsys *subsys, int fr subsys->subsys_cargo_revealed = 1; // if the cargo is something other than "nothing", then make a log entry - if ( (subsys->subsys_cargo_name > 0) && stricmp(Cargo_names[subsys->subsys_cargo_name], NOX("nothing")) ){ + if ( (subsys->subsys_cargo_name > 0) && SDL_strcasecmp(Cargo_names[subsys->subsys_cargo_name], NOX("nothing")) ){ mission_log_add_entry(LOG_CAP_SUBSYS_CARGO_REVEALED, shipp->ship_name, subsys->system_info->name, subsys->subsys_cargo_name ); } } @@ -8916,7 +8916,7 @@ void ship_page_in() int model_previously_loaded = -1; int ship_previously_loaded = -1; for (j=0; j -1) && !stricmp(si->pof_file, Ship_info[j].pof_file) ) { + if ( (Ship_info[j].modelnum > -1) && !SDL_strcasecmp(si->pof_file, Ship_info[j].pof_file) ) { // Model already loaded model_previously_loaded = Ship_info[j].modelnum; ship_previously_loaded = j; @@ -8941,18 +8941,18 @@ void ship_page_in() #ifndef NDEBUG for ( j = 0; j < si->n_subsystems; j++ ) { - Assert( si->subsystems[j].model_num == si->modelnum ); + SDL_assert( si->subsystems[j].model_num == si->modelnum ); } #endif } else { // Just to be safe (I mean to check that my code works...) - Assert( si->modelnum > -1 ); - Assert( si->modelnum == model_previously_loaded ); + SDL_assert( si->modelnum > -1 ); + SDL_assert( si->modelnum == model_previously_loaded ); #ifndef NDEBUG for ( j = 0; j < si->n_subsystems; j++ ) { - Assert( si->subsystems[j].model_num == si->modelnum ); + SDL_assert( si->subsystems[j].model_num == si->modelnum ); } #endif } @@ -8960,12 +8960,12 @@ void ship_page_in() // Model not loaded... so load it and page in its textures si->modelnum = model_load(si->pof_file, si->n_subsystems, &si->subsystems[0]); - Assert( si->modelnum > -1 ); + SDL_assert( si->modelnum > -1 ); // Verify that all the subsystem model numbers are updated #ifndef NDEBUG for ( j = 0; j < si->n_subsystems; j++ ) { - Assert( si->subsystems[j].model_num == si->modelnum ); // JAS + SDL_assert( si->subsystems[j].model_num == si->modelnum ); // JAS } #endif @@ -9008,7 +9008,7 @@ void ship_page_in() // JAS: If you hit this, then MAX_SHIP_SUBOBJECTS is set too low. // I added this code in to detect an error that wasn't getting detected any other // way. - Assert(num_subsystems_needed < MAX_SHIP_SUBOBJECTS ); + SDL_assert(num_subsystems_needed < MAX_SHIP_SUBOBJECTS ); // Page in the thruster effects // @@ -9158,7 +9158,7 @@ void ship_jettison_cargo(ship *shipp) float ship_get_exp_damage(object* objp) { - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); float damage; ship *shipp = &Ships[objp->instance]; @@ -9180,7 +9180,7 @@ int ship_get_exp_propagates(ship *sp) float ship_get_exp_outer_rad(object *ship_objp) { float outer_rad; - Assert(ship_objp->type == OBJ_SHIP); + SDL_assert(ship_objp->type == OBJ_SHIP); if (Ships[ship_objp->instance].special_exp_index == -1) { outer_rad = Ship_info[Ships[ship_objp->instance].ship_info_index].outer_rad; @@ -9253,20 +9253,20 @@ int wing_has_conflicting_teams(int wing_index) int first_team, idx; // sanity checks - Assert((wing_index >= 0) && (wing_index < num_wings) && (Wings[wing_index].current_count > 0)); + SDL_assert((wing_index >= 0) && (wing_index < num_wings) && (Wings[wing_index].current_count > 0)); if((wing_index < 0) || (wing_index >= num_wings) || (Wings[wing_index].current_count <= 0)){ return -1; } // check teams - Assert(Wings[wing_index].ship_index[0] >= 0); + SDL_assert(Wings[wing_index].ship_index[0] >= 0); if(Wings[wing_index].ship_index[0] < 0){ return -1; } first_team = Ships[Wings[wing_index].ship_index[0]].team; for(idx=1; idx= 0); + SDL_assert(Wings[wing_index].ship_index[idx] >= 0); if(Wings[wing_index].ship_index[idx] < 0){ return -1; } @@ -9288,7 +9288,7 @@ int ship_get_reinforcement_team(int r_index) p_object *objp; // sanity checks - Assert((r_index >= 0) && (r_index < Num_reinforcements)); + SDL_assert((r_index >= 0) && (r_index < Num_reinforcements)); if((r_index < 0) || (r_index >= Num_reinforcements)){ return -1; } @@ -9383,15 +9383,15 @@ void ship_update_artillery_lock() } // get weapon info for the targeting laser he's firing - Assert((shipp->weapons.current_primary_bank >= 0) && (shipp->weapons.current_primary_bank < 2)); + SDL_assert((shipp->weapons.current_primary_bank >= 0) && (shipp->weapons.current_primary_bank < 2)); if((shipp->weapons.current_primary_bank < 0) || (shipp->weapons.current_primary_bank >= 2)){ continue; } - Assert(shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank] >= 0); + SDL_assert(shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank] >= 0); if(shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank] < 0){ continue; } - Assert((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags & WIF_BEAM) && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type == BEAM_TYPE_C)); + SDL_assert((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags & WIF_BEAM) && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type == BEAM_TYPE_C)); if(!(Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags & WIF_BEAM) || (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type != BEAM_TYPE_C)){ continue; } @@ -9451,7 +9451,7 @@ void ship_update_artillery_lock() // may not work if delta box is large and negative (ie, adjusted box crosses over on itself - min > max) int check_world_pt_in_expanded_ship_bbox(vector *world_pt, object *objp, float delta_box) { - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); vector temp, ship_pt; polymodel *pm; @@ -9504,7 +9504,7 @@ float ship_get_max_speed(ship *shipp) // determin warp speed of ship float ship_get_warp_speed(object *objp) { - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); float shipfx_calculate_warp_speed(object *); return shipfx_calculate_warp_speed(objp); } @@ -9512,7 +9512,7 @@ float ship_get_warp_speed(object *objp) // returns true if ship is beginning to speed up in warpout int ship_is_beginning_warpout_speedup(object *objp) { - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); ai_info *aip; diff --git a/src/ship/shipcontrails.cpp b/src/ship/shipcontrails.cpp index e954431..be71ad9 100644 --- a/src/ship/shipcontrails.cpp +++ b/src/ship/shipcontrails.cpp @@ -94,7 +94,7 @@ void ct_level_close() void ct_ship_create(ship *shipp) { int idx; - Assert(shipp != NULL); + SDL_assert(shipp != NULL); // null out the ct indices for this guy for(idx=0; idxtrail_num[idx] >= 0){ @@ -126,8 +126,8 @@ void ct_ship_process(ship *shipp) int idx; object *objp; - Assert(shipp != NULL); - Assert(shipp->objnum >= 0); + SDL_assert(shipp != NULL); + SDL_assert(shipp->objnum >= 0); objp = &Objects[shipp->objnum]; // if not a fullneb mission - do nothing @@ -140,7 +140,7 @@ void ct_ship_process(ship *shipp) return; } - Assert(objp->instance >= 0); + SDL_assert(objp->instance >= 0); shipp = &Ships[objp->instance]; // if the object is below the critical limit @@ -211,9 +211,9 @@ void ct_update_contrails(ship *shipp) } // get object and ship info - Assert(shipp != NULL); - Assert(shipp->objnum >= 0); - Assert(shipp->ship_info_index >= 0); + SDL_assert(shipp != NULL); + SDL_assert(shipp->objnum >= 0); + SDL_assert(shipp->ship_info_index >= 0); objp = &Objects[shipp->objnum]; sip = &Ship_info[shipp->ship_info_index]; @@ -258,9 +258,9 @@ void ct_create_contrails(ship *shipp) } // get object and ship info - Assert(shipp != NULL); - Assert(shipp->objnum >= 0); - Assert(shipp->ship_info_index >= 0); + SDL_assert(shipp != NULL); + SDL_assert(shipp->objnum >= 0); + SDL_assert(shipp->ship_info_index >= 0); objp = &Objects[shipp->objnum]; sip = &Ship_info[shipp->ship_info_index]; diff --git a/src/ship/shipfx.cpp b/src/ship/shipfx.cpp index 2aa0446..4c29210 100644 --- a/src/ship/shipfx.cpp +++ b/src/ship/shipfx.cpp @@ -256,7 +256,7 @@ int Player_engine_wash_loop = -1; void shipfx_remove_submodel_ship_sparks(ship *shipp, int submodel_num) { - Assert(submodel_num != -1); + SDL_assert(submodel_num != -1); // maybe no active sparks on submodel if (shipp->num_hits == 0) { @@ -402,14 +402,14 @@ void set_ship_submodel_as_blown_off(ship *shipp, char *name) // go through list of ship subsystems and find name ship_subsys *pss = NULL; for (pss=GET_FIRST(&shipp->subsys_list); pss!=END_OF_LIST(&shipp->subsys_list); pss=GET_NEXT(pss)) { - if ( stricmp(pss->system_info->name, name) == 0) { + if ( SDL_strcasecmp(pss->system_info->name, name) == 0) { found = TRUE; break; } } // set its blown off flag to TRUE - Assert(found); + SDL_assert(found); if (found) { pss->submodel_info_1.blown_off = 1; } @@ -434,7 +434,7 @@ void shipfx_maybe_create_live_debris_at_ship_death( object *ship_obj ) // get submodel that produces live debris int model_get_parent_submodel_for_live_debris( int model_num, int live_debris_model_num ); int parent = model_get_parent_submodel_for_live_debris( shipp->modelnum, live_debris_submodel); - Assert(parent != -1); + SDL_assert(parent != -1); // set model values only once (esp blown off) ship_model_start(ship_obj); @@ -451,7 +451,7 @@ void shipfx_maybe_create_live_debris_at_ship_death( object *ship_obj ) } } - Assert (pss != NULL); + SDL_assert (pss != NULL); if (pss != NULL) { vector exp_center, tmp = ZERO_VECTOR; model_find_world_point(&exp_center, &tmp, shipp->modelnum, parent, &ship_obj->orient, &ship_obj->pos ); @@ -657,7 +657,7 @@ float shipfx_calculate_warp_speed(object *objp) { float length; - Assert(objp->type == OBJ_SHIP); + SDL_assert(objp->type == OBJ_SHIP); if (objp->type != OBJ_SHIP) { length = 2.0f * objp->radius; } else { @@ -733,7 +733,7 @@ void shipfx_warpin_start( object *objp ) // only move warp effect pos if not special warp in. if (shipp->special_warp_objnum >= 0) { - Assert(!(Game_mode & GM_MULTIPLAYER)); + SDL_assert(!(Game_mode & GM_MULTIPLAYER)); polymodel *pm; pm = model_get(shipp->modelnum); vm_vec_scale_add(&shipp->warp_effect_pos, &objp->pos, &objp->orient.v.fvec, -pm->mins.xyz.z); @@ -1427,7 +1427,7 @@ void shipfx_flash_create(object *objp, ship * shipp, vector *gun_pos, vector *gu int i; int objnum = OBJ_INDEX(objp); - Assert(Ship_flash_inited); + SDL_assert(Ship_flash_inited); polymodel *pm = model_get( shipp->modelnum ); int closest_light = -1; @@ -1487,7 +1487,7 @@ void shipfx_flash_create(object *objp, ship * shipp, vector *gun_pos, vector *gu } } - Assert( Ship_flash[first_slot].objnum == -1 ); + SDL_assert( Ship_flash[first_slot].objnum == -1 ); Ship_flash[first_slot].objnum = objnum; Ship_flash[first_slot].obj_signature = objp->signature; @@ -1956,7 +1956,7 @@ static void split_ship_init( ship* shipp, split_ship* split_ship ) static void half_ship_render_ship_and_debris(clip_ship* half_ship,ship *shipp) { - Assert( Split_ships_inited ); + SDL_assert( Split_ships_inited ); polymodel *pm = model_get(shipp->modelnum); @@ -2272,11 +2272,11 @@ int shipfx_large_blowup_do_frame(ship *shipp, float frametime) // DAVE: I made this not do any movement just to try to get things working... // return 0; - Assert( Split_ships_inited ); - Assert( shipp->large_ship_blowup_index > -1 ); + SDL_assert( Split_ships_inited ); + SDL_assert( shipp->large_ship_blowup_index > -1 ); split_ship *the_split_ship = &Split_ships[shipp->large_ship_blowup_index]; - Assert( the_split_ship->used ); // Get John + SDL_assert( the_split_ship->used ); // Get John // Do fireballs, particles, shockwave here // Note parent ship is still valid, vel and pos updated in obj_move_all @@ -2328,11 +2328,11 @@ void shipfx_large_blowup_render(ship* shipp) // model_render( shipp->modelnum, &objp->orient, &objp->pos, MR_NORMAL ); // return; - Assert( Split_ships_inited ); - Assert( shipp->large_ship_blowup_index > -1 ); + SDL_assert( Split_ships_inited ); + SDL_assert( shipp->large_ship_blowup_index > -1 ); split_ship *the_split_ship = &Split_ships[shipp->large_ship_blowup_index]; - Assert( the_split_ship->used ); // Get John + SDL_assert( the_split_ship->used ); // Get John // vector front_global_pivot, back_global_pivot; @@ -2578,15 +2578,15 @@ void shipfx_do_lightning_frame( ship *shipp ) bolt_info binfo; // sanity checks - Assert(shipp != NULL); + SDL_assert(shipp != NULL); if(shipp == NULL){ return; } - Assert(shipp->ship_info_index >= 0); + SDL_assert(shipp->ship_info_index >= 0); if(shipp->ship_info_index < 0){ return; } - Assert(shipp->objnum >= 0); + SDL_assert(shipp->objnum >= 0); if(shipp->objnum < 0){ return; } @@ -2706,19 +2706,19 @@ void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci) int idx; // sanity checks - Assert(shipp != NULL); + SDL_assert(shipp != NULL); if(shipp == NULL){ return; } - Assert(shipp->ship_info_index >= 0); + SDL_assert(shipp->ship_info_index >= 0); if(shipp->ship_info_index < 0){ return; } - Assert(shipp->objnum >= 0); + SDL_assert(shipp->objnum >= 0); if(shipp->objnum < 0){ return; } - Assert(sci != NULL); + SDL_assert(sci != NULL); if (sci == NULL) { return; } @@ -2727,7 +2727,7 @@ void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci) sip = &Ship_info[shipp->ship_info_index]; objp = &Objects[shipp->objnum]; - Assert(sip->shockwave_count > 0); + SDL_assert(sip->shockwave_count > 0); if(sip->shockwave_count <= 0){ return; } @@ -2799,8 +2799,8 @@ void engine_wash_ship_process(ship *shipp) return; } - Assert(shipp != NULL); - Assert(shipp->objnum >= 0); + SDL_assert(shipp != NULL); + SDL_assert(shipp->objnum >= 0); objp = &Objects[shipp->objnum]; ship_obj *so; ship_objp = NULL; @@ -2945,7 +2945,7 @@ void engine_wash_ship_process(ship *shipp) // apply damage at rate of 1%/sec if (shipp->wash_intensity > 0) { - Assert(max_ship_intensity_objp != NULL); + SDL_assert(max_ship_intensity_objp != NULL); nprintf(("wash", "Wash intensity %.2f\n", shipp->wash_intensity)); diff --git a/src/ship/shiphit.cpp b/src/ship/shiphit.cpp index f35b0fe..b3b2bd4 100644 --- a/src/ship/shiphit.cpp +++ b/src/ship/shiphit.cpp @@ -623,15 +623,15 @@ void do_subobj_destroyed_stuff( ship *ship_p, ship_subsys *subsys, vector* hitpo // engines). So, my solution is to encode the ship_info index, and the subsystem index into one // integer, and pass that as the "index" parameter to add_entry. We'll use that information to // print out the info in the mission log. - Assert( ship_p->ship_info_index < 65535 ); + SDL_assert( ship_p->ship_info_index < 65535 ); // get the "index" of this subsystem in the ship info structure. for ( i = 0; i < sip->n_subsystems; i++ ) { if ( &(sip->subsystems[i]) == psub ) break; } - Assert( i < sip->n_subsystems ); - Assert( i < 65535 ); + SDL_assert( i < sip->n_subsystems ); + SDL_assert( i < 65535 ); log_index = ((ship_p->ship_info_index << 16) & 0xffff0000) | (i & 0xffff); // Don't log or display info about the activation subsytem @@ -864,9 +864,9 @@ float do_subobj_hit_stuff(object *ship_obj, object *other_obj, vector *hitpos, f // Debug option. If damage is negative of subsystem type, then just destroy that subsystem. if (damage < 0.0f) { // single player or multiplayer - Assert(Player_ai->targeted_subsys != NULL); + SDL_assert(Player_ai->targeted_subsys != NULL); if ( (subsys == Player_ai->targeted_subsys) && (subsys->current_hits > 0) ) { - Assert(subsys->system_info->type == (int) -damage); + SDL_assert(subsys->system_info->type == (int) -damage); ship_p->subsys_info[subsys->system_info->type].current_hits -= subsys->current_hits; if (ship_p->subsys_info[subsys->system_info->type].current_hits < 0) { ship_p->subsys_info[subsys->system_info->type].current_hits = 0.0f; @@ -918,7 +918,7 @@ float do_subobj_hit_stuff(object *ship_obj, object *other_obj, vector *hitpos, f min_index = i; } } - Assert(min_index != -1); + SDL_assert(min_index != -1); float damage_to_apply = 0.0f; subsys = subsys_list[min_index].ptr; @@ -1187,14 +1187,14 @@ void ship_hit_music(object *ship_obj, object *other_obj) // // If the ship hit has an AI class of none, it is a Cargo, NavBuoy or other non-aggressive // ship, so don't start the battle music - if (stricmp(Ai_class_names[Ai_info[ship_p->ai_index].ai_class], NOX("none"))) { + if (SDL_strcasecmp(Ai_class_names[Ai_info[ship_p->ai_index].ai_class], NOX("none"))) { int team_1, team_2; // Only start if ship hit and firing ship are from different teams team_1 = Ships[ship_obj->instance].team; switch ( other_obj->type ) { case OBJ_SHIP: team_2 = Ships[other_obj->instance].team; - if ( !stricmp(Ai_class_names[Ai_info[Ships[other_obj->instance].ai_index].ai_class], NOX("none")) ) { + if ( !SDL_strcasecmp(Ai_class_names[Ai_info[Ships[other_obj->instance].ai_index].ai_class], NOX("none")) ) { team_1 = team_2; } break; @@ -1244,8 +1244,8 @@ void ship_hit_sparks_no_rotate(object *ship_obj, vector *hitpos) // limited for fighter by hull % others by radius. int get_max_sparks(object* ship_obj) { - Assert(ship_obj->type == OBJ_SHIP); - Assert((ship_obj->instance >= 0) && (ship_obj->instance < MAX_SHIPS)); + SDL_assert(ship_obj->type == OBJ_SHIP); + SDL_assert((ship_obj->instance >= 0) && (ship_obj->instance < MAX_SHIPS)); if(ship_obj->type != OBJ_SHIP){ return 1; } @@ -1284,8 +1284,8 @@ int spark_compare( const void *elem1, const void *elem2 ) spark_pair *pair1 = (spark_pair *) elem1; spark_pair *pair2 = (spark_pair *) elem2; - Assert(pair1->dist >= 0); - Assert(pair2->dist >= 0); + SDL_assert(pair1->dist >= 0); + SDL_assert(pair2->dist >= 0); if ( pair1->dist < pair2->dist ) { return -1; @@ -1303,11 +1303,11 @@ int choose_next_spark(object *ship_obj, vector *hitpos) ship *shipp = &Ships[ship_obj->instance]; // only choose next spark when all slots are full - Assert(get_max_sparks(ship_obj) == Ships[ship_obj->instance].num_hits); + SDL_assert(get_max_sparks(ship_obj) == Ships[ship_obj->instance].num_hits); // get num_sparks num_sparks = Ships[ship_obj->instance].num_hits; - Assert(num_sparks <= MAX_SHIP_HITS); + SDL_assert(num_sparks <= MAX_SHIP_HITS); // get num_spark_paris -- only sort these num_spark_pairs = (num_sparks * num_sparks - num_sparks) / 2; @@ -1361,7 +1361,7 @@ int choose_next_spark(object *ship_obj, vector *hitpos) spark_pairs[count++].dist = vm_vec_dist_squared(&world_hitpos[i], &world_hitpos[j]); } } - Assert(count == num_spark_pairs); + SDL_assert(count == num_spark_pairs); // sort pairs qsort(spark_pairs, count, sizeof(spark_pair), spark_compare); @@ -1531,7 +1531,7 @@ void player_died_start(object *killer_objp) vector *side_vec; float dist; - Assert(other_objp != NULL); + SDL_assert(other_objp != NULL); if (Player_obj == other_objp) { dist = 50.0f; @@ -1586,8 +1586,8 @@ void ship_generic_kill_stuff( object *objp, float percent_killed ) int delta_time; ship *sp; - Assert(objp->type == OBJ_SHIP); - Assert(objp->instance >= 0 && objp->instance < MAX_SHIPS ); + SDL_assert(objp->type == OBJ_SHIP); + SDL_assert(objp->instance >= 0 && objp->instance < MAX_SHIPS ); if((objp->type != OBJ_SHIP) || (objp->instance < 0) || (objp->instance >= MAX_SHIPS)){ return; } @@ -1645,7 +1645,7 @@ void ship_generic_kill_stuff( object *objp, float percent_killed ) sp->final_death_time = timestamp(delta_time); // Give him 3 secs to explode if (sp->flags & SF_VAPORIZE) { - // Assert(Ship_info[sp->ship_info_index].flags & SIF_SMALL_SHIP); + // SDL_assert(Ship_info[sp->ship_info_index].flags & SIF_SMALL_SHIP); // LIVE FOR 100 MS sp->final_death_time = timestamp(100); @@ -1722,11 +1722,11 @@ void ship_vaporize(ship *shipp) object *ship_obj; // sanity - Assert(shipp != NULL); + SDL_assert(shipp != NULL); if(shipp == NULL){ return; } - Assert((shipp->objnum >= 0) && (shipp->objnum < MAX_OBJECTS)); + SDL_assert((shipp->objnum >= 0) && (shipp->objnum < MAX_OBJECTS)); if((shipp->objnum < 0) || (shipp->objnum >= MAX_OBJECTS)){ return; } @@ -1781,7 +1781,7 @@ void ship_hit_kill(object *ship_obj, object *other_obj, float percent_killed, in } // if the object isn't around, the try to find the object in the list of ships which has exited if ( objp != END_OF_LIST(&obj_used_list) ) { - Assert ( (objp->type == OBJ_SHIP ) || (objp->type == OBJ_GHOST) ); // I suppose that this should be true + SDL_assert ( (objp->type == OBJ_SHIP ) || (objp->type == OBJ_GHOST) ); // I suppose that this should be true killer_ship_name = Ships[objp->instance].ship_name; killer_objp = objp; @@ -1869,7 +1869,7 @@ void ship_hit_kill(object *ship_obj, object *other_obj, float percent_killed, in // function to simply explode a ship where it is currently at void ship_self_destruct( object *objp ) { - Assert ( objp->type == OBJ_SHIP ); + SDL_assert ( objp->type == OBJ_SHIP ); // try and find a player if((Game_mode & GM_MULTIPLAYER) && (multi_find_player_by_object(objp) >= 0)){ @@ -2005,7 +2005,7 @@ int maybe_shockwave_damage_adjust(object *ship_obj, object *other_obj, float *da float max_damage; shockwave *sw; - Assert(ship_obj->type == OBJ_SHIP); + SDL_assert(ship_obj->type == OBJ_SHIP); if (other_obj->type != OBJ_SHOCKWAVE) { return 0; } @@ -2066,8 +2066,8 @@ static void ship_do_damage(object *ship_obj, object *other_obj, vector *hitpos, ship *shipp; float subsystem_damage = damage; // damage to be applied to subsystems - Assert(ship_obj->instance >= 0); - Assert(ship_obj->type == OBJ_SHIP); + SDL_assert(ship_obj->instance >= 0); + SDL_assert(ship_obj->type == OBJ_SHIP); shipp = &Ships[ship_obj->instance]; // maybe adjust damage done by shockwave for BIG|HUGE @@ -2274,11 +2274,11 @@ static void ship_do_damage(object *ship_obj, object *other_obj, vector *hitpos, // if the hitting object is a weapon, maybe do some fun stuff here if(other_obj->type == OBJ_WEAPON){ weapon_info *wip; - Assert(other_obj->instance >= 0); + SDL_assert(other_obj->instance >= 0); if(other_obj->instance < 0){ return; } - Assert(Weapons[other_obj->instance].weapon_info_index >= 0); + SDL_assert(Weapons[other_obj->instance].weapon_info_index >= 0); if(Weapons[other_obj->instance].weapon_info_index < 0){ return; } diff --git a/src/sound/audiostr.cpp b/src/sound/audiostr.cpp index 5e468fb..abfbe8d 100644 --- a/src/sound/audiostr.cpp +++ b/src/sound/audiostr.cpp @@ -97,7 +97,7 @@ static ubyte *Wavedata_load_buffer = NULL; // buffer used for cueing audiostreams static ubyte *Wavedata_service_buffer = NULL; // buffer used for servicing audiostreams -CRITICAL_SECTION Global_service_lock; +SDL_mutex *Global_service_lock; typedef bool (*TIMERCALLBACK)(ptr_u); diff --git a/src/sound/rtvoice.cpp b/src/sound/rtvoice.cpp index 79008f0..64bea97 100644 --- a/src/sound/rtvoice.cpp +++ b/src/sound/rtvoice.cpp @@ -256,14 +256,14 @@ int rtvoice_init_recording(int qos) } Encode_buffer1 = (unsigned char*)malloc(Rtv_capture_raw_buffer_size); - Assert(Encode_buffer1); + SDL_assert(Encode_buffer1); if ( Encode_buffer2 ) { free(Encode_buffer2); Encode_buffer2=NULL; } Encode_buffer2 = (unsigned char*)malloc(Rtv_capture_raw_buffer_size); - Assert(Encode_buffer2); + SDL_assert(Encode_buffer2); // malloc out the voice data buffer for raw (uncompressed) recorded sound if ( Rtv_capture_raw_buffer ) { @@ -345,7 +345,7 @@ int rtvoice_start_recording( void (*user_callback)(), int callback_time ) return -1; } - Assert(Rtv_recording_inited); + SDL_assert(Rtv_recording_inited); if ( Rtv_recording ) { return -1; @@ -401,7 +401,7 @@ int rtvoice_16to8(unsigned char *data, int size) unsigned short sample16; unsigned char sample8, *dest, *src; - Assert(size%2 == 0); + SDL_assert(size%2 == 0); dest = data; src = data; @@ -583,7 +583,7 @@ int rtvoice_init_playback() } Decode_buffer = (unsigned char*)malloc(Decode_buffer_size); - Assert(Decode_buffer); + SDL_assert(Decode_buffer); if ( Rtv_playback_uncompressed_buffer ) { free(Rtv_playback_uncompressed_buffer); @@ -592,7 +592,7 @@ int rtvoice_init_playback() Rtv_playback_uncompressed_buffer_size=Decode_buffer_size; Rtv_playback_uncompressed_buffer = (unsigned char*)malloc(Rtv_playback_uncompressed_buffer_size); - Assert(Rtv_playback_uncompressed_buffer); + SDL_assert(Rtv_playback_uncompressed_buffer); InitDecoder(1, Decode_buffer); @@ -645,7 +645,7 @@ int rtvoice_create_playback_buffer() void rtvoice_stop_playback(int index) { - Assert(index >=0 && index < MAX_RTV_OUT_BUFFERS); + SDL_assert(index >=0 && index < MAX_RTV_OUT_BUFFERS); if ( Rtv_output_buffers[index].flags & RTV_OUT_FLAG_USED ) { if ( Rtv_output_buffers[index].buf_handle != -1 ) { @@ -666,7 +666,7 @@ void rtvoice_stop_playback_all() // Close a stream that was opened for real-time voice output void rtvoice_free_playback_buffer(int index) { - Assert(index >=0 && index < MAX_RTV_OUT_BUFFERS); + SDL_assert(index >=0 && index < MAX_RTV_OUT_BUFFERS); if ( Rtv_output_buffers[index].flags & RTV_OUT_FLAG_USED ) { Rtv_output_buffers[index].flags=0; @@ -690,7 +690,7 @@ int rtvoice_play_compressed(int index, unsigned char *data, int size, int uncomp // Stop any currently playing voice output oal_stop_buffer(buf_handle); - Assert(uncompressed_size <= Rtv_playback_uncompressed_buffer_size); + SDL_assert(uncompressed_size <= Rtv_playback_uncompressed_buffer_size); // uncompress the data into PCM format if ( Rtv_do_compression ) { diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp index ea2e7b3..a8844e7 100644 --- a/src/sound/sound.cpp +++ b/src/sound/sound.cpp @@ -486,7 +486,7 @@ void snd_spew_debug_info() // what kind of sound is this for(s_idx=0; s_idxfilename )) { + else if ( !SDL_strcasecmp( Sounds[n].filename, gs->filename )) { gs->sig = Sounds[n].sig; return n; } @@ -732,7 +732,7 @@ int snd_play( game_snd *gs, float pan, float vol_scale, int priority, bool is_vo if (!Sound_enabled) return -1; - Assert( gs != NULL ); + SDL_assert( gs != NULL ); MONITOR_INC( NumSoundsStarted, 1 ); @@ -807,7 +807,7 @@ int snd_play_3d(game_snd *gs, vector *source_pos, vector *listen_pos, float radi if ( !Sound_enabled ) return -1; - Assert(gs != NULL); + SDL_assert(gs != NULL); MONITOR_INC( Num3DSoundsStarted, 1 ); @@ -929,7 +929,7 @@ int snd_get_3d_vol_and_pan(game_snd *gs, vector *pos, float* vol, float *pan, fl return -1; } - Assert(gs != NULL); + SDL_assert(gs != NULL); if ( gs->id == -1 ) { gs->id = snd_load(gs); @@ -993,7 +993,7 @@ int snd_play_looping( game_snd *gs, float pan, float vol_scale, int priority, in if (!Sound_enabled) return -1; - Assert( gs != NULL ); + SDL_assert( gs != NULL ); if ( gs->id == -1 ) { gs->id = snd_load(gs); @@ -1399,13 +1399,13 @@ void snd_set_pos(int snd_handle, game_snd *gs, float val,int as_pct) // set position as an absolute from 0 to 1 if (as_pct) { - Assert((val >= 0.0) && (val <= 1.0)); + SDL_assert((val >= 0.0) && (val <= 1.0)); oal_set_play_position(channel, fl2i((float)snd->size * val)); } // set the position as an absolute # of seconds from the beginning of the sound else { float bps; - Assert(val <= (float)snd->duration/1000.0f); + SDL_assert(val <= (float)snd->duration/1000.0f); bps = (float)snd->sample_rate * (float)snd->bits; // data rate oal_set_play_position(channel, fl2i(bps * val)); } @@ -1451,7 +1451,7 @@ int snd_get_data(int handle, char *data) return -1; } - Assert(handle >= 0 && handle < MAX_SOUNDS); + SDL_assert(handle >= 0 && handle < MAX_SOUNDS); sound *snd = &Sounds[handle]; uint size; @@ -1478,7 +1478,7 @@ int snd_size(int handle, int *size) return -1; } - Assert(handle >= 0 && handle < MAX_SOUNDS); + SDL_assert(handle >= 0 && handle < MAX_SOUNDS); if ( oal_get_buffer_size(Sounds[handle].sid, size) ) { return -1; @@ -1490,7 +1490,7 @@ int snd_size(int handle, int *size) // retrieve the bits per sample and frequency for a given sound void snd_get_format(int handle, int *bits_per_sample, int *frequency) { - Assert(handle >= 0 && handle < MAX_SOUNDS); + SDL_assert(handle >= 0 && handle < MAX_SOUNDS); *bits_per_sample = Sounds[handle].info.bits; *frequency = Sounds[handle].info.sample_rate; } diff --git a/src/starfield/nebula.cpp b/src/starfield/nebula.cpp index 450d7ae..dec77e2 100644 --- a/src/starfield/nebula.cpp +++ b/src/starfield/nebula.cpp @@ -247,10 +247,10 @@ int load_nebula_sub(const char *filename) cfread( &num_pts, sizeof(int), 1, fp ); num_pts = INTEL_INT(num_pts); - Assert( num_pts < MAX_POINTS ); + SDL_assert( num_pts < MAX_POINTS ); cfread( &num_tris, sizeof(int), 1, fp ); num_tris = INTEL_INT(num_tris); - Assert( num_tris < MAX_TRIS ); + SDL_assert( num_tris < MAX_TRIS ); for (int i=0; ifilename)){ + if(!SDL_strcasecmp(Sun_bitmaps[idx].filename, s->filename)){ return &Sun_bitmaps[idx]; } } @@ -410,7 +410,7 @@ void stars_init() strcpy(bm->filename, filename); bm->xparent = 0; bm->bitmap = bm_load(bm->filename); - Assert(bm->bitmap != -1); + SDL_assert(bm->bitmap != -1); // if fred is running we should lock the bitmap now if(Fred_running && (bm->bitmap >= 0)){ @@ -427,7 +427,7 @@ void stars_init() strcpy(bm->filename, filename); bm->xparent = 1; bm->bitmap = bm_load(bm->filename); - Assert(bm->bitmap != -1); + SDL_assert(bm->bitmap != -1); // if fred is running we should lock as a 0, 255, 0 bitmap now if(Fred_running && (bm->bitmap >= 0)){ @@ -462,8 +462,8 @@ void stars_init() bm->xparent = 1; bm->bitmap = bm_load(bm->filename); bm->glow_bitmap = bm_load(bm->glow_filename); - Assert(bm->bitmap != -1); - Assert(bm->glow_bitmap != -1); + SDL_assert(bm->bitmap != -1); + SDL_assert(bm->glow_bitmap != -1); bm->r = r; bm->g = g; bm->b = b; @@ -494,7 +494,7 @@ void stars_init() strcpy(debris_vclips_normal[count++].name, filename); } } - Assert(count == 4); + SDL_assert(count == 4); // nebula debris pieces count = 0; @@ -507,7 +507,7 @@ void stars_init() } } - Assert(count == 4); + SDL_assert(count == 4); #else // hard-coded for FS1 starfield_bitmap *bm; @@ -535,8 +535,8 @@ void stars_init() bm->xparent = 1; bm->bitmap = bm_load(bm->filename); bm->glow_bitmap = bm_load(bm->glow_filename); - Assert(bm->bitmap != -1); - Assert(bm->glow_bitmap != -1); + SDL_assert(bm->bitmap != -1); + SDL_assert(bm->glow_bitmap != -1); bm->r = 1.0f; bm->g = 1.0f; bm->b = 1.0f; @@ -762,7 +762,7 @@ void stars_get_sun_pos(int sun_n, vector *pos) #endif // sanity - Assert(sun_n < Num_suns); + SDL_assert(sun_n < Num_suns); if((sun_n >= Num_suns) || (sun_n < 0)){ return; } @@ -842,7 +842,7 @@ void stars_draw_sun_glow(int sun_n) float local_scale = 1.0f; // sanity - Assert(sun_n < Num_suns); + SDL_assert(sun_n < Num_suns); if((sun_n >= Num_suns) || (sun_n < 0)){ return; } @@ -1023,17 +1023,17 @@ void subspace_render() { if ( Subspace_model_inner == -1 ) { Subspace_model_inner = model_load( "subspace_small.pof", 0, NULL ); - Assert(Subspace_model_inner>-1); + SDL_assert(Subspace_model_inner>-1); } if ( Subspace_model_outer == -1 ) { Subspace_model_outer = model_load( "subspace_big.pof", 0, NULL ); - Assert(Subspace_model_outer>-1); + SDL_assert(Subspace_model_outer>-1); } if ( Subspace_glow_bitmap == -1 ) { Subspace_glow_bitmap = bm_load( NOX("SunGlow01")); - Assert(Subspace_glow_bitmap>-1); + SDL_assert(Subspace_glow_bitmap>-1); } Subspace_glow_frame += flFrametime * 1.0f; @@ -1377,9 +1377,9 @@ void stars_page_in() if ( Game_subspace_effect ) { Subspace_model_inner = model_load( "subspace_small.pof", 0, NULL ); - Assert(Subspace_model_inner>-1); + SDL_assert(Subspace_model_inner>-1); Subspace_model_outer = model_load( "subspace_big.pof", 0, NULL ); - Assert(Subspace_model_outer>-1); + SDL_assert(Subspace_model_outer>-1); polymodel *pm; @@ -1420,7 +1420,7 @@ void stars_page_in() while((idx < MAX_STARFIELD_BITMAPS) && (Starfield_bitmaps[idx].bitmap != -1)){ // make sure it's used in this mission before loading for (t=0; t= SUPERNOVA_FADE_TO_WHITE_TIME){ if(!Supernova_popup){ // main freespace 2 campaign? if so - end it now - if((Game_mode & GM_CAMPAIGN_MODE) && !stricmp(Campaign.filename, "freespace2") && Campaign_ended_in_mission){ + if((Game_mode & GM_CAMPAIGN_MODE) && !SDL_strcasecmp(Campaign.filename, "freespace2") && Campaign_ended_in_mission){ gameseq_post_event(GS_EVENT_END_CAMPAIGN); } else { popupdead_start(); @@ -344,9 +344,9 @@ void supernova_apply_shake(matrix *eye_orient, float intensity) matrix tm, tm2; vm_angles_2_matrix(&tm, &tangles); - Assert(vm_vec_mag(&tm.v.fvec) > 0.0f); - Assert(vm_vec_mag(&tm.v.rvec) > 0.0f); - Assert(vm_vec_mag(&tm.v.uvec) > 0.0f); + SDL_assert(vm_vec_mag(&tm.v.fvec) > 0.0f); + SDL_assert(vm_vec_mag(&tm.v.rvec) > 0.0f); + SDL_assert(vm_vec_mag(&tm.v.uvec) > 0.0f); vm_matrix_x_matrix(&tm2, eye_orient, &tm); *eye_orient = tm2; } diff --git a/src/stats/medals.cpp b/src/stats/medals.cpp index 4924674..c7f8cf9 100644 --- a/src/stats/medals.cpp +++ b/src/stats/medals.cpp @@ -457,7 +457,7 @@ void parse_medal_tbl() bi = 0; required_string("#Medals"); while ( required_string_either("#End", "$Name:") ) { - Assert ( num_medals < NUM_MEDALS); + SDL_assert ( num_medals < NUM_MEDALS); required_string("$Name:"); stuff_string( Medals[num_medals].name, F_NAME, NULL ); required_string("$Bitmap:"); @@ -471,7 +471,7 @@ void parse_medal_tbl() if ( optional_string("+Num Kills:") ) { char buf[MULTITEXT_LENGTH + 1]; - Assert( bi < MAX_BADGES ); + SDL_assert( bi < MAX_BADGES ); stuff_int( &Medals[num_medals].kills_needed ); Badge_index[bi] = num_medals; #ifdef MAKE_FS1 @@ -502,7 +502,7 @@ void parse_medal_tbl() } required_string("#End"); - Assert( num_medals == NUM_MEDALS ); + SDL_assert( num_medals == NUM_MEDALS ); // be sure that the badges kill numbers show up in order for (i = 0; i < MAX_BADGES-1; i++ ) { @@ -519,7 +519,7 @@ void medal_main_init(player *pl, int mode) { int idx; - Assert(pl != NULL); + SDL_assert(pl != NULL); Medals_player = pl; Player_score = &Medals_player->stats; @@ -972,7 +972,7 @@ void init_medal_palette() void init_medal_bitmaps() { int idx; - Assert(Player_score); + SDL_assert(Player_score); for (idx=0; idxship_name, "alpha 2") && (!stricmp(Game_current_mission_filename, "demo01") || !stricmp(Game_current_mission_filename, "sm1-01")) ) { + if ( !SDL_strcasecmp(shipp->ship_name, "alpha 2") && (!SDL_strcasecmp(Game_current_mission_filename, "demo01") || !SDL_strcasecmp(Game_current_mission_filename, "sm1-01")) ) { int death_count; fp = fopen("i:\\volition\\cww\\harbison.txt", "r+t"); @@ -443,7 +443,7 @@ void scoring_eval_rank( scoring_struct *sc ) // if the ranks do not match, then "grant" the new rank if ( old_rank != new_rank ) { - Assert( new_rank >= 0 ); + SDL_assert( new_rank >= 0 ); sc->m_promotion_earned = new_rank; sc->rank = new_rank; } @@ -569,13 +569,13 @@ void scoring_backout_accept( scoring_struct *score ) // if the player was given a medal, take it back if ( score->m_medal_earned != -1 ) { score->medals[score->m_medal_earned]--; - Assert( score->medals[score->m_medal_earned] >= 0 ); + SDL_assert( score->medals[score->m_medal_earned] >= 0 ); } // if the player was promoted, take it back if ( score->m_promotion_earned != -1) { score->rank--; - Assert( score->rank >= 0 ); + SDL_assert( score->rank >= 0 ); } score->flight_time -= (unsigned int)f2fl(Missiontime); @@ -863,9 +863,9 @@ void scoring_eval_kill(object *ship_obj) si_index = ship_info_base_lookup( si_index ); } - // if you hit this next Assert, find allender. If not here, don't worry about it, you may safely + // if you hit this next SDL_assert, find allender. If not here, don't worry about it, you may safely // continue - Assert( !(Ship_info[si_index].flags & SIF_SHIP_COPY) ); + SDL_assert( !(Ship_info[si_index].flags & SIF_SHIP_COPY) ); // if he killed a guy on his own team increment his bonehead kills if((Ships[Objects[plr->objnum].instance].team == dead_ship->team) && !((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT))){ @@ -1105,7 +1105,7 @@ void scoring_eval_hit(object *hit_obj, object *other_obj,int from_blast) Net_players[player_num].player->stats.mp_shots_hit++; } - // Assert( Net_players[player_num].player->stats.mp_shots_hit <= Net_players[player_num].player->stats.mp_shots_fired ); + // SDL_assert( Net_players[player_num].player->stats.mp_shots_hit <= Net_players[player_num].player->stats.mp_shots_fired ); break; case WP_MISSILE : // friendly hit, once it hits a friendly, its done @@ -1180,7 +1180,7 @@ float scoring_get_scale_factor() } // check for bogus Skill_level values - Assert((Game_skill_level >= 0) && (Game_skill_level < NUM_SKILL_LEVELS)); + SDL_assert((Game_skill_level >= 0) && (Game_skill_level < NUM_SKILL_LEVELS)); if((Game_skill_level < 0) || (Game_skill_level > NUM_SKILL_LEVELS-1)){ return Scoring_scale_factors[0]; } diff --git a/src/tgautils/tgautils.cpp b/src/tgautils/tgautils.cpp index 314d939..393474f 100644 --- a/src/tgautils/tgautils.cpp +++ b/src/tgautils/tgautils.cpp @@ -128,7 +128,7 @@ static int targa_copy_data(char *to, char *from, int pixels, int fromsize, int t } return tosize*pixels; } else { - Assert(fromsize == tosize); + SDL_assert(fromsize == tosize); memcpy(to, from, pixels * fromsize); return tosize*pixels; } @@ -422,7 +422,7 @@ int targa_read_header(char *real_filename, int *w, int *h, int *bpp, ubyte *pale *bpp = header.pixel_depth; // only support 16 bit pixels - Assert(*bpp == 16); + SDL_assert(*bpp == 16); if(*bpp != 16){ return TARGA_ERROR_READING; } @@ -453,7 +453,7 @@ int targa_uncompress( ubyte *dst, ubyte *src, int bitmap_width, int bytes_per_pi int run_count = *src_pixels++; // Make sure writing this next run will not overflow the buffer - Assert(pixel_count + (run_count & 0x7f) + 1 <= bitmap_width ); + SDL_assert(pixel_count + (run_count & 0x7f) + 1 <= bitmap_width ); // If the run is encoded... if ( run_count & 0x80 ) { @@ -481,7 +481,7 @@ int targa_uncompress( ubyte *dst, ubyte *src, int bitmap_width, int bytes_per_pi } } - Assert( pixel_count == bitmap_width ); + SDL_assert( pixel_count == bitmap_width ); return src_pixels - src; } @@ -496,7 +496,7 @@ int targa_uncompress( ubyte *dst, ubyte *src, int bitmap_width, int bytes_per_pi // int targa_read_bitmap(char *real_filename, ubyte *image_data, ubyte *palette, int dest_size) { - Assert(real_filename); + SDL_assert(real_filename); targa_header header; CFILE *targa_file; char filename[MAX_FILENAME_LEN]; @@ -551,7 +551,7 @@ int targa_read_bitmap(char *real_filename, ubyte *image_data, ubyte *palette, in int bytes_per_pixel = (header.pixel_depth>>3); // we're only allowing 2 bytes per pixel (16 bit compressed) - Assert(bytes_per_pixel == 2); + SDL_assert(bytes_per_pixel == 2); if(bytes_per_pixel != 2){ cfclose(targa_file); return TARGA_ERROR_READING; @@ -603,9 +603,9 @@ int targa_read_bitmap(char *real_filename, ubyte *image_data, ubyte *palette, in Int3(); // Determine the size of the color map - Assert(header.cmap_depth==24); - Assert(header.cmap_length<=256); - Assert(palette); + SDL_assert(header.cmap_depth==24); + SDL_assert(header.cmap_length<=256); + SDL_assert(palette); // Read the color map data int i; @@ -632,10 +632,10 @@ int targa_read_bitmap(char *real_filename, ubyte *image_data, ubyte *palette, in int bytes_remaining = cfilelength(targa_file)-cftell(targa_file); - Assert(bytes_remaining>0); + SDL_assert(bytes_remaining>0); ubyte *fileptr = (ubyte*)malloc(bytes_remaining); - Assert(fileptr); + SDL_assert(fileptr); if(fileptr == NULL){ return TARGA_ERROR_READING; } @@ -700,7 +700,7 @@ int targa_read_bitmap(char *real_filename, ubyte *image_data, ubyte *palette, in // int targa_write_bitmap(char *real_filename, ubyte *data, ubyte *palette, int w, int h, int bpp) { - Assert(bpp == 24); + SDL_assert(bpp == 24); char filename[MAX_FILENAME_LEN]; CFILE *f; int bytes_per_pixel = BYTES_PER_PIXEL(bpp); @@ -755,7 +755,7 @@ int targa_write_bitmap(char *real_filename, ubyte *data, ubyte *palette, int w, ubyte *compressed_data; compressed_data = (ubyte*)malloc(w * h * bytes_per_pixel); - Assert(compressed_data); + SDL_assert(compressed_data); if(compressed_data == NULL){ cfclose(f); return -1; diff --git a/src/ui/gadget.cpp b/src/ui/gadget.cpp index 770797c..7582f10 100644 --- a/src/ui/gadget.cpp +++ b/src/ui/gadget.cpp @@ -242,7 +242,7 @@ int UI_GADGET::set_bmaps(const char *ani_fname, int nframes, int start_frame) // load all the bitmaps - Assert(nframes < MAX_BMAPS_PER_GADGET); + SDL_assert(nframes < MAX_BMAPS_PER_GADGET); m_num_frames = nframes; #ifndef MAKE_FS1 // FS1 uses real anis instead of frame based pcxs so this code just slows down diff --git a/src/ui/inputbox.cpp b/src/ui/inputbox.cpp index 9455044..11a8b14 100644 --- a/src/ui/inputbox.cpp +++ b/src/ui/inputbox.cpp @@ -246,8 +246,8 @@ void UI_INPUTBOX::create(UI_WINDOW *wnd, int _x, int _y, int _w, int _text_len, { int tw, th; - Assert(_text_len >= 0); - Assert((int) strlen(_text) <= _text_len); + SDL_assert(_text_len >= 0); + SDL_assert((int) strlen(_text) <= _text_len); gr_set_font(wnd->f_id); gr_get_string_size( &tw, &th, "*" ); @@ -663,7 +663,7 @@ void UI_INPUTBOX::set_text(const char *in) in_length = strlen(in); if (in_length > length) - Assert(0); // tried to force text into an input box that won't fit into allocated memory + SDL_assert(0); // tried to force text into an input box that won't fit into allocated memory strcpy(text, in); diff --git a/src/ui/listbox.cpp b/src/ui/listbox.cpp index a5324d6..38a96f4 100644 --- a/src/ui/listbox.cpp +++ b/src/ui/listbox.cpp @@ -343,7 +343,7 @@ void UI_LISTBOX::process(int focus) if (has_scrollbar) { if (scrollbar.moved) { first_item = scrollbar.position; - Assert(first_item >= 0); + SDL_assert(first_item >= 0); if (current_item= 0 ); + SDL_assert( stop >= 0 ); if (stop != start) bar_size = (window_size * h) / (stop - start + window_size + 1); diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp index 3b17252..aa4ddc7 100644 --- a/src/ui/slider.cpp +++ b/src/ui/slider.cpp @@ -120,7 +120,7 @@ void UI_DOT_SLIDER_NEW::create(UI_WINDOW *wnd, int _x, int _y, int _num_pos, con // if any of the left/right arrow information is specified, make sure its _all_ specified if((bm_left != NULL) || (left_mask != -1) || (bm_right != NULL) || (right_mask != -1)){ - Assert((bm_left != NULL) && (left_mask >= 0) && (bm_right != NULL) && (right_mask >= 0)); + SDL_assert((bm_left != NULL) && (left_mask >= 0) && (bm_right != NULL) && (right_mask >= 0)); if((bm_left == NULL) || (left_mask < 0) || (bm_right == NULL) || (right_mask < 0)){ return; } @@ -181,7 +181,7 @@ void UI_DOT_SLIDER_NEW::draw() } // draw the proper dot - Assert((pos >= 0) && (pos <= num_pos)); + SDL_assert((pos >= 0) && (pos <= num_pos)); // for position -1, we don't draw (no dots) if(pos >= 0){ @@ -340,7 +340,7 @@ void UI_DOT_SLIDER::draw() up_button.draw(); down_button.draw(); } - Assert((pos >= 0) && (pos <= num_pos)); + SDL_assert((pos >= 0) && (pos <= num_pos)); gr_set_bitmap(first_frame + pos, GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1); // draw the dot level gr_bitmap(x, y); } @@ -486,9 +486,9 @@ void UI_SLIDER::create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, float _st stop = _stop; current = _current; - Assert( _current >= _start ); - Assert( _current <= _stop ); - Assert( stop >= 0 ); + SDL_assert( _current >= _start ); + SDL_assert( _current <= _stop ); + SDL_assert( stop >= 0 ); n_positions = _n_positions; @@ -502,7 +502,7 @@ void UI_SLIDER::create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, float _st pixel_range = w-marker_w; marker_x = x + fl2i( ( (current - start)/(stop-start) * pixel_range ) ); increment = pixel_range / n_positions; - Assert(increment >= 1); + SDL_assert(increment >= 1); mouse_locked = 0; }; diff --git a/src/ui/slider2.cpp b/src/ui/slider2.cpp index 0d1b31d..5130edb 100644 --- a/src/ui/slider2.cpp +++ b/src/ui/slider2.cpp @@ -72,15 +72,15 @@ void UI_SLIDER2::create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, int _num base_create( wnd, UI_KIND_SLIDER2, _x, _y, _w, _h ); - Assert(_upCallback != NULL); - Assert(_downCallback != NULL); + SDL_assert(_upCallback != NULL); + SDL_assert(_downCallback != NULL); upCallback = _upCallback; downCallback = _downCallback; captureCallback = _captureCallback; - Assert(_bitmapSliderControl > 0); + SDL_assert(_bitmapSliderControl > 0); last_scrolled = 0; @@ -91,11 +91,11 @@ void UI_SLIDER2::create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, int _num bm_get_info(bmap_ids[S2_NORMAL],&buttonWidth, &buttonHeight, NULL, NULL, NULL); slider_w = buttonWidth; slider_h = buttonHeight; - Assert(buttonHeight > 5); + SDL_assert(buttonHeight > 5); slider_half_h = (int)(buttonHeight / 2); numberPositions = _h - buttonHeight; - Assert(numberPositions >= 0); + SDL_assert(numberPositions >= 0); currentItem = 0; currentPosition = 0; @@ -108,7 +108,7 @@ void UI_SLIDER2::create(UI_WINDOW *wnd, int _x, int _y, int _w, int _h, int _num } void UI_SLIDER2::draw() { - Assert((currentPosition >= 0) && (currentPosition <= numberPositions)); + SDL_assert((currentPosition >= 0) && (currentPosition <= numberPositions)); if (uses_bmaps & !disabled_flag) { gr_reset_clip(); switch (slider_mode) { diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 0f634ec..9b25f7a 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -211,7 +211,7 @@ void UI_WINDOW::set_mask_bmap(int bmap, const char *name) // int i; // init_tooltips(); - Assert(bmap >= 0); + SDL_assert(bmap >= 0); if (bmap != mask_bmap_id) { if (mask_bmap_id >= 0){ @@ -228,7 +228,7 @@ void UI_WINDOW::set_mask_bmap(int bmap, const char *name) tt_group = -1; /* for (i=0; iassoc = _assoc; x->font_id = _font_id; x->clr = _color_type; - Assert((x->clr >= 0) && (x->clr < UI_NUM_XSTR_COLORS)); + SDL_assert((x->clr >= 0) && (x->clr < UI_NUM_XSTR_COLORS)); if((x->clr < 0) || (x->clr >= UI_NUM_XSTR_COLORS)){ x->clr = 0; } @@ -681,7 +681,7 @@ void UI_WINDOW::add_XSTR(UI_XSTR *xstr) x->assoc = xstr->assoc; x->font_id = xstr->font_id; x->clr = xstr->clr; - Assert((x->clr >= 0) && (x->clr < UI_NUM_XSTR_COLORS)); + SDL_assert((x->clr >= 0) && (x->clr < UI_NUM_XSTR_COLORS)); if((x->clr < 0) || (x->clr >= UI_NUM_XSTR_COLORS)){ x->clr = 0; } @@ -705,7 +705,7 @@ void UI_WINDOW::draw_one_xstr(UI_XSTR *x, int frame) // maybe set the font if(x->font_id >= 0){ // backup the current font - Assert(Current_font != NULL); + SDL_assert(Current_font != NULL); f_backup = Current_font; // set the new font @@ -858,7 +858,7 @@ int parse_tooltips_group(int group, int n) { char buf[NAME_LENGTH]; - Assert(group < MAX_TOOLTIP_GROUPS); + SDL_assert(group < MAX_TOOLTIP_GROUPS); required_string("$Mask Filename:"); stuff_string(buf, F_NAME, NULL); Tooltip_groups[group].mask = strdup(buf); @@ -870,7 +870,7 @@ int parse_tooltips_group(int group, int n) return n; } - Assert(n < MAX_TOOLTIPS); + SDL_assert(n < MAX_TOOLTIPS); parse_tooltip(n++); } } diff --git a/src/weapon/beam.cpp b/src/weapon/beam.cpp index e2e5631..55ff520 100644 --- a/src/weapon/beam.cpp +++ b/src/weapon/beam.cpp @@ -38,7 +38,7 @@ * * * 68 9/09/99 11:40p Dave - * Handle an Assert() in beam code. Added supernova sounds. Play the right + * Handle an SDL_assert() in beam code. Added supernova sounds. Play the right * 2 end movies properly, based upon what the player did in the mission. * * 67 9/09/99 2:36p Mikek @@ -635,14 +635,14 @@ int beam_fire(beam_fire_info *fire_info) } // make sure the beam_info_index is valid - Assert((fire_info->beam_info_index >= 0) && (fire_info->beam_info_index < MAX_WEAPON_TYPES) && (Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)); + SDL_assert((fire_info->beam_info_index >= 0) && (fire_info->beam_info_index < MAX_WEAPON_TYPES) && (Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)); if((fire_info->beam_info_index < 0) || (fire_info->beam_info_index >= MAX_WEAPON_TYPES) || !(Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)){ return -1; } wip = &Weapon_info[fire_info->beam_info_index]; // make sure a ship is firing this - Assert((fire_info->shooter->type == OBJ_SHIP) && (fire_info->shooter->instance >= 0) && (fire_info->shooter->instance < MAX_SHIPS)); + SDL_assert((fire_info->shooter->type == OBJ_SHIP) && (fire_info->shooter->instance >= 0) && (fire_info->shooter->instance < MAX_SHIPS)); if((fire_info->shooter->type != OBJ_SHIP) || (fire_info->shooter->instance < 0) || (fire_info->shooter->instance >= MAX_SHIPS)){ return -1; } @@ -650,7 +650,7 @@ int beam_fire(beam_fire_info *fire_info) // get a free beam new_item = GET_FIRST(&Beam_free_list); - Assert( new_item != &Beam_free_list ); // shouldn't have the dummy element + SDL_assert( new_item != &Beam_free_list ); // shouldn't have the dummy element if(new_item == &Beam_free_list){ return -1; } @@ -770,14 +770,14 @@ int beam_fire_targeting(beam_fire_info *fire_info) } // make sure the beam_info_index is valid - Assert((fire_info->beam_info_index >= 0) && (fire_info->beam_info_index < MAX_WEAPON_TYPES) && (Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)); + SDL_assert((fire_info->beam_info_index >= 0) && (fire_info->beam_info_index < MAX_WEAPON_TYPES) && (Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)); if((fire_info->beam_info_index < 0) || (fire_info->beam_info_index >= MAX_WEAPON_TYPES) || !(Weapon_info[fire_info->beam_info_index].wi_flags & WIF_BEAM)){ return -1; } wip = &Weapon_info[fire_info->beam_info_index]; // make sure a ship is firing this - Assert((fire_info->shooter->type == OBJ_SHIP) && (fire_info->shooter->instance >= 0) && (fire_info->shooter->instance < MAX_SHIPS)); + SDL_assert((fire_info->shooter->type == OBJ_SHIP) && (fire_info->shooter->instance >= 0) && (fire_info->shooter->instance < MAX_SHIPS)); if((fire_info->shooter->type != OBJ_SHIP) || (fire_info->shooter->instance < 0) || (fire_info->shooter->instance >= MAX_SHIPS)){ return -1; } @@ -786,7 +786,7 @@ int beam_fire_targeting(beam_fire_info *fire_info) // get a free beam new_item = GET_FIRST(&Beam_free_list); - Assert( new_item != &Beam_free_list ); // shouldn't have the dummy element + SDL_assert( new_item != &Beam_free_list ); // shouldn't have the dummy element // remove from the free list list_remove( &Beam_free_list, new_item ); @@ -798,7 +798,7 @@ int beam_fire_targeting(beam_fire_info *fire_info) Beam_count++; // maybe allocate some extra data based on the beam type - Assert(wip->b_info.beam_type == BEAM_TYPE_C); + SDL_assert(wip->b_info.beam_type == BEAM_TYPE_C); if(wip->b_info.beam_type != BEAM_TYPE_C){ return -1; } @@ -849,8 +849,8 @@ int beam_get_parent(object *bm) beam *b; // get a handle to the beam - Assert(bm->type == OBJ_BEAM); - Assert(bm->instance >= 0); + SDL_assert(bm->type == OBJ_BEAM); + SDL_assert(bm->instance >= 0); if(bm->type != OBJ_BEAM){ return -1; } @@ -859,7 +859,7 @@ int beam_get_parent(object *bm) } b = &Beams[bm->instance]; - Assert(b->objp != NULL); + SDL_assert(b->objp != NULL); if(b->objp == NULL){ return -1; } @@ -876,12 +876,12 @@ int beam_get_parent(object *bm) // return weapon_info_index of beam int beam_get_weapon_info_index(object *bm) { - Assert(bm->type == OBJ_BEAM); + SDL_assert(bm->type == OBJ_BEAM); if (bm->type != OBJ_BEAM) { return -1; } - Assert(bm->instance >= 0 && bm->instance < MAX_BEAMS); + SDL_assert(bm->instance >= 0 && bm->instance < MAX_BEAMS); if (bm->instance < 0) { return -1; } @@ -1003,7 +1003,7 @@ void beam_type_a_move(beam *b) vm_vec_sub(&dir, &b->last_shot, &b->last_start); vm_vec_normalize_quick(&dir); vm_vec_scale_add(&b->last_shot, &b->last_start, &dir, BEAM_FAR_LENGTH); - Assert(is_valid_vec(&b->last_shot)); + SDL_assert(is_valid_vec(&b->last_shot)); } // move a type B beam weapon @@ -1036,7 +1036,7 @@ void beam_type_b_move(beam *b) // now recalculate shot_point to be shooting through our new point vm_vec_scale_add(&b->last_shot, &b->last_start, &actual_dir, BEAM_FAR_LENGTH); int is_valid = is_valid_vec(&b->last_shot); - Assert(is_valid); + SDL_assert(is_valid); if(!is_valid){ actual_dir = b->binfo.dir_a; vm_vec_scale_add(&b->last_shot, &b->last_start, &actual_dir, BEAM_FAR_LENGTH); @@ -1098,7 +1098,7 @@ void beam_type_d_move(beam *b) vm_vec_sub(&dir, &b->last_shot, &b->last_start); vm_vec_normalize_quick(&dir); vm_vec_scale_add(&b->last_shot, &b->last_start, &dir, BEAM_FAR_LENGTH); - Assert(is_valid_vec(&b->last_shot)); + SDL_assert(is_valid_vec(&b->last_shot)); } void beam_type_d_get_status(beam *b, int *shot_index, int *fire_wait) { @@ -1107,7 +1107,7 @@ void beam_type_d_get_status(beam *b, int *shot_index, int *fire_wait) // determine what "shot" we're on *shot_index = (int)(beam_time / shot_time); - Assert(*shot_index < b->binfo.shot_count); + SDL_assert(*shot_index < b->binfo.shot_count); if(*shot_index >= b->binfo.shot_count){ *shot_index = b->binfo.shot_count - 1; } @@ -1135,7 +1135,7 @@ void beam_type_e_move(beam *b) // put the "last_shot" point arbitrarily far away vm_vec_scale_add(&b->last_shot, &b->last_start, &turret_norm, BEAM_FAR_LENGTH); - Assert(is_valid_vec(&b->last_shot)); + SDL_assert(is_valid_vec(&b->last_shot)); } // pre-move (before collision checking - but AFTER ALL OTHER OBJECTS HAVE BEEN MOVED) @@ -1556,7 +1556,7 @@ void beam_render_all() } // render the beam itself - Assert(moveup->weapon_info_index >= 0); + SDL_assert(moveup->weapon_info_index >= 0); if(moveup->weapon_info_index < 0){ moveup = GET_NEXT(moveup); continue; @@ -1617,15 +1617,15 @@ void beam_add_light_small(beam *bm, object *objp, vector *pt_override = NULL) } // sanity - Assert(bm != NULL); + SDL_assert(bm != NULL); if(bm == NULL){ return; } - Assert(objp != NULL); + SDL_assert(objp != NULL); if(objp == NULL){ return; } - Assert(bm->weapon_info_index >= 0); + SDL_assert(bm->weapon_info_index >= 0); wip = &Weapon_info[bm->weapon_info_index]; bwi = &wip->b_info; @@ -1670,15 +1670,15 @@ void beam_add_light_large(beam *bm, object *objp, vector *pt0, vector *pt1) } // sanity - Assert(bm != NULL); + SDL_assert(bm != NULL); if(bm == NULL){ return; } - Assert(objp != NULL); + SDL_assert(objp != NULL); if(objp == NULL){ return; } - Assert(bm->weapon_info_index >= 0); + SDL_assert(bm->weapon_info_index >= 0); wip = &Weapon_info[bm->weapon_info_index]; bwi = &wip->b_info; @@ -1719,7 +1719,7 @@ void beam_add_light(beam *b, int objnum, int source, vector *c_point) if(c_point != NULL){ l->c_point = *c_point; } else { - Assert(source != 2); + SDL_assert(source != 2); if(source == 2){ Beam_light_count--; } @@ -1763,7 +1763,7 @@ void beam_apply_lighting() // object type switch(Objects[l->objnum].type){ case OBJ_SHIP: - Assert(Objects[l->objnum].instance >= 0); + SDL_assert(Objects[l->objnum].instance >= 0); // large ships if(Ship_info[Ships[Objects[l->objnum].instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)){ @@ -1812,7 +1812,7 @@ void beam_delete(beam *b) list_append(&Beam_free_list, b); // delete our associated object - // Assert(b->objnum >= 0); + // SDL_assert(b->objnum >= 0); if(b->objnum >= 0){ obj_delete(b->objnum); } @@ -1826,7 +1826,7 @@ void beam_delete(beam *b) // subtract one Beam_count--; - Assert(Beam_count >= 0); + SDL_assert(Beam_count >= 0); nprintf(("General", "Recycled beam (%d beams remaining)\n", Beam_count)); } @@ -1834,7 +1834,7 @@ void beam_delete(beam *b) int beam_get_model(object *objp) { int subtype; - Assert(objp->instance >= 0); + SDL_assert(objp->instance >= 0); if(objp->instance < 0){ return -1; } @@ -1845,14 +1845,14 @@ int beam_get_model(object *objp) return Ships[objp->instance].modelnum; case OBJ_WEAPON: - Assert(Weapons[objp->instance].weapon_info_index >= 0); + SDL_assert(Weapons[objp->instance].weapon_info_index >= 0); if(Weapons[objp->instance].weapon_info_index < 0){ return -1; } return Weapon_info[Weapons[objp->instance].weapon_info_index].model_num; case OBJ_DEBRIS: - Assert(Debris[objp->instance].is_hull); + SDL_assert(Debris[objp->instance].is_hull); if(!Debris[objp->instance].is_hull){ return -1; } @@ -1861,7 +1861,7 @@ int beam_get_model(object *objp) #if !(defined(FS2_DEMO) || defined(FS1_DEMO)) case OBJ_ASTEROID: subtype = Asteroids[objp->instance].asteroid_subtype; - Assert(Asteroids[objp->instance].type >= 0); + SDL_assert(Asteroids[objp->instance].type >= 0); if(Asteroids[objp->instance].type < 0){ return -1; } @@ -1964,7 +1964,7 @@ void beam_recalc_sounds(beam *b) beam_weapon_info *bwi; vector pos; - Assert(b->weapon_info_index >= 0); + SDL_assert(b->weapon_info_index >= 0); if(b->weapon_info_index < 0){ return; } @@ -2019,7 +2019,7 @@ void beam_get_binfo(beam *b, float accuracy, int num_shots) } // get beam weapon info - Assert(b->weapon_info_index >= 0); + SDL_assert(b->weapon_info_index >= 0); if(b->weapon_info_index < 0){ return; } @@ -2103,7 +2103,7 @@ void beam_aim(beam *b) // type C beam weapons have no target if(b->target == NULL){ - Assert(b->type == BEAM_TYPE_C); + SDL_assert(b->type == BEAM_TYPE_C); if(b->type != BEAM_TYPE_C){ return; } @@ -2156,7 +2156,7 @@ void beam_aim(beam *b) // set the shot point vm_vec_scale_add(&b->last_shot, &b->last_start, &b->binfo.dir_a, BEAM_FAR_LENGTH); - Assert(is_valid_vec(&b->last_shot)); + SDL_assert(is_valid_vec(&b->last_shot)); break; case BEAM_TYPE_C: @@ -2205,12 +2205,12 @@ void beam_get_octant_points(int modelnum, object *objp, int oct_index, int oct_a return; } - Assert((oct_index >= 0) && (oct_index < BEAM_NUM_GOOD_OCTANTS)); + SDL_assert((oct_index >= 0) && (oct_index < BEAM_NUM_GOOD_OCTANTS)); // randomly pick octants t1 = oct_array[oct_index][2] ? m->octants[oct_array[oct_index][0]].max : m->octants[oct_array[oct_index][0]].min; t2 = oct_array[oct_index][3] ? m->octants[oct_array[oct_index][1]].max : m->octants[oct_array[oct_index][1]].min; - Assert(!vm_vec_same(&t1, &t2)); + SDL_assert(!vm_vec_same(&t1, &t2)); // get them in world coords vm_vec_unrotate(&temp, &t1, &objp->orient); @@ -2273,9 +2273,9 @@ int beam_collide_ship(obj_pair *pair) } // get the beam - Assert(pair->a->instance >= 0); - Assert(pair->a->type == OBJ_BEAM); - Assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); + SDL_assert(pair->a->instance >= 0); + SDL_assert(pair->a->type == OBJ_BEAM); + SDL_assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); b = &Beams[pair->a->instance]; // Don't check collisions for warping out player if past stage 1. @@ -2312,8 +2312,8 @@ int beam_collide_ship(obj_pair *pair) #endif // bad - Assert(pair->b->type == OBJ_SHIP); - Assert(pair->b->instance >= 0); + SDL_assert(pair->b->type == OBJ_SHIP); + SDL_assert(pair->b->instance >= 0); if((pair->b->type != OBJ_SHIP) || (pair->b->instance < 0)){ return 1; } @@ -2368,9 +2368,9 @@ int beam_collide_asteroid(obj_pair *pair) } // get the beam - Assert(pair->a->instance >= 0); - Assert(pair->a->type == OBJ_BEAM); - Assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); + SDL_assert(pair->a->instance >= 0); + SDL_assert(pair->a->type == OBJ_BEAM); + SDL_assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); b = &Beams[pair->a->instance]; // if the "warming up" timestamp has not expired @@ -2438,9 +2438,9 @@ int beam_collide_missile(obj_pair *pair) } // get the beam - Assert(pair->a->instance >= 0); - Assert(pair->a->type == OBJ_BEAM); - Assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); + SDL_assert(pair->a->instance >= 0); + SDL_assert(pair->a->type == OBJ_BEAM); + SDL_assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); b = &Beams[pair->a->instance]; // if the "warming up" timestamp has not expired @@ -2504,9 +2504,9 @@ int beam_collide_debris(obj_pair *pair) } // get the beam - Assert(pair->a->instance >= 0); - Assert(pair->a->type == OBJ_BEAM); - Assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); + SDL_assert(pair->a->instance >= 0); + SDL_assert(pair->a->type == OBJ_BEAM); + SDL_assert(Beams[pair->a->instance].objnum == OBJ_INDEX(pair->a)); b = &Beams[pair->a->instance]; // if the "warming up" timestamp has not expired @@ -2569,20 +2569,20 @@ int beam_collide_early_out(object *a, object *b) vector dot_test, dot_test2, dist_test; // get the beam - Assert(a->instance >= 0); + SDL_assert(a->instance >= 0); if(a->instance < 0){ return 1; } - Assert(a->type == OBJ_BEAM); + SDL_assert(a->type == OBJ_BEAM); if(a->type != OBJ_BEAM){ return 1; } - Assert(Beams[a->instance].objnum == OBJ_INDEX(a)); + SDL_assert(Beams[a->instance].objnum == OBJ_INDEX(a)); if(Beams[a->instance].objnum != OBJ_INDEX(a)){ return 1; } bm = &Beams[a->instance]; - Assert(bm->weapon_info_index >= 0); + SDL_assert(bm->weapon_info_index >= 0); if(bm->weapon_info_index < 0){ return 1; } @@ -2669,7 +2669,7 @@ void beam_add_collision(beam *b, object *hit_object, mc_info *cinfo) } // copy in - Assert(bc != NULL); + SDL_assert(bc != NULL); if(bc == NULL){ return; } @@ -2789,7 +2789,7 @@ void beam_handle_collisions(beam *b) case OBJ_WEAPON: // detonate the missile - Assert(Weapon_info[Weapons[Objects[target].instance].weapon_info_index].subtype == WP_MISSILE); + SDL_assert(Weapon_info[Weapons[Objects[target].instance].weapon_info_index].subtype == WP_MISSILE); if(!(Game_mode & GM_MULTIPLAYER) || MULTIPLAYER_MASTER){ weapon_hit(&Objects[target], NULL, &Objects[target].pos); } @@ -2820,7 +2820,7 @@ void beam_handle_collisions(beam *b) if(widest <= (Objects[target].radius * BEAM_AREA_PERCENT) && !beam_will_tool_target(b, &Objects[target])){ // set last_shot so we know where to properly draw the beam b->last_shot = b->f_collisions[idx].cinfo.hit_point_world; - Assert(is_valid_vec(&b->last_shot)); + SDL_assert(is_valid_vec(&b->last_shot)); // done wif the beam break; @@ -2954,7 +2954,7 @@ float beam_get_widest(beam *b) float widest = -1.0f; // sanity - Assert(b->weapon_info_index >= 0); + SDL_assert(b->weapon_info_index >= 0); if(b->weapon_info_index < 0){ return -1.0f; } @@ -2977,13 +2977,13 @@ void beam_apply_whack(beam *b, object *objp, vector *hit_point) ship *shipp; // sanity - Assert((b != NULL) && (objp != NULL) && (hit_point != NULL)); + SDL_assert((b != NULL) && (objp != NULL) && (hit_point != NULL)); if((b == NULL) || (objp == NULL) || (hit_point == NULL)){ return; } - Assert(b->weapon_info_index >= 0); + SDL_assert(b->weapon_info_index >= 0); wip = &Weapon_info[b->weapon_info_index]; - Assert((objp != NULL) && (objp->type == OBJ_SHIP) && (objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp != NULL) && (objp->type == OBJ_SHIP) && (objp->instance >= 0) && (objp->instance < MAX_SHIPS)); if((objp == NULL) || (objp->type != OBJ_SHIP) || (objp->instance < 0) || (objp->instance >= MAX_SHIPS)){ return; } @@ -3022,11 +3022,11 @@ void beam_apply_whack(beam *b, object *objp, vector *hit_point) float beam_get_ship_damage(beam *b, object *objp) { // if the beam is on the same team as the object - Assert((objp != NULL) && (b != NULL)); + SDL_assert((objp != NULL) && (b != NULL)); if((objp == NULL) || (b == NULL)){ return 0.0f; } - Assert((objp->type == OBJ_SHIP) && (objp->instance >= 0) && (objp->instance < MAX_SHIPS)); + SDL_assert((objp->type == OBJ_SHIP) && (objp->instance >= 0) && (objp->instance < MAX_SHIPS)); if((objp->type != OBJ_SHIP) || (objp->instance < 0) || (objp->instance >= MAX_SHIPS)){ return 0.0f; } @@ -3099,10 +3099,10 @@ void beam_test(int whee) // lookup some stuff s1 = ship_name_lookup("GTD Orion 1"); - Assert(s1 >= 0); + SDL_assert(s1 >= 0); orion = &Objects[Ships[s1].objnum]; s2 = ship_name_lookup("GTC Fenris 2"); - Assert(s2 >= 0); + SDL_assert(s2 >= 0); fenris = &Objects[Ships[s2].objnum]; // get beam weapons @@ -3111,7 +3111,7 @@ void beam_test(int whee) orion_radar = NULL; while(lookup != END_OF_LIST(&Ships[s1].subsys_list)){ // turret - if((lookup->system_info->type == SUBSYSTEM_TURRET) && !stricmp(lookup->system_info->subobj_name, "turret07")){ + if((lookup->system_info->type == SUBSYSTEM_TURRET) && !SDL_strcasecmp(lookup->system_info->subobj_name, "turret07")){ orion_turret = lookup; } @@ -3122,14 +3122,14 @@ void beam_test(int whee) lookup = GET_NEXT(lookup); } - Assert(orion_turret != NULL); - Assert(orion_radar != NULL); + SDL_assert(orion_turret != NULL); + SDL_assert(orion_radar != NULL); lookup = GET_FIRST(&Ships[s2].subsys_list); fenris_turret = NULL; fenris_radar = NULL; while(lookup != END_OF_LIST(&Ships[s2].subsys_list)){ // turret - if((lookup->system_info->type == SUBSYSTEM_TURRET) && !stricmp(lookup->system_info->subobj_name, "turret07")){ + if((lookup->system_info->type == SUBSYSTEM_TURRET) && !SDL_strcasecmp(lookup->system_info->subobj_name, "turret07")){ fenris_turret = lookup; } @@ -3140,8 +3140,8 @@ void beam_test(int whee) lookup = GET_NEXT(lookup); } - Assert(fenris_turret != NULL); - Assert(fenris_radar != NULL); + SDL_assert(fenris_turret != NULL); + SDL_assert(fenris_radar != NULL); memset(&f, 0, sizeof(beam_fire_info)); f.accuracy = beam_accuracy; @@ -3189,22 +3189,22 @@ void beam_test_new(int whee) // lookup some stuff s1 = ship_name_lookup("GTD Orion 1"); - Assert(s1 >= 0); + SDL_assert(s1 >= 0); orion = &Objects[Ships[s1].objnum]; s2 = ship_name_lookup("GTC Fenris 2"); - Assert(s2 >= 0); + SDL_assert(s2 >= 0); fenris = &Objects[Ships[s2].objnum]; s3 = ship_name_lookup("GTF Hercules 2"); - Assert(s3 >= 0); + SDL_assert(s3 >= 0); herc2 = &Objects[Ships[s3].objnum]; s3 = ship_name_lookup("GTF Hercules 3"); - Assert(s3 >= 0); + SDL_assert(s3 >= 0); herc3 = &Objects[Ships[s3].objnum]; s3 = ship_name_lookup("GTF Hercules 6"); - Assert(s3 >= 0); + SDL_assert(s3 >= 0); herc6 = &Objects[Ships[s3].objnum]; s3 = ship_name_lookup("Alpha 1"); - Assert(s3 >= 0); + SDL_assert(s3 >= 0); alpha = &Objects[Ships[s3].objnum]; // get beam weapons @@ -3213,7 +3213,7 @@ void beam_test_new(int whee) orion_radar = NULL; while(lookup != END_OF_LIST(&Ships[s1].subsys_list)){ // turret - if((lookup->system_info->type == SUBSYSTEM_TURRET) && !stricmp(lookup->system_info->subobj_name, "turret07")){ + if((lookup->system_info->type == SUBSYSTEM_TURRET) && !SDL_strcasecmp(lookup->system_info->subobj_name, "turret07")){ orion_turret = lookup; } @@ -3224,14 +3224,14 @@ void beam_test_new(int whee) lookup = GET_NEXT(lookup); } - Assert(orion_turret != NULL); - Assert(orion_radar != NULL); + SDL_assert(orion_turret != NULL); + SDL_assert(orion_radar != NULL); lookup = GET_FIRST(&Ships[s2].subsys_list); fenris_turret = NULL; fenris_radar = NULL; while(lookup != END_OF_LIST(&Ships[s2].subsys_list)){ // turret - if((lookup->system_info->type == SUBSYSTEM_TURRET) && !stricmp(lookup->system_info->subobj_name, "turret03")){ + if((lookup->system_info->type == SUBSYSTEM_TURRET) && !SDL_strcasecmp(lookup->system_info->subobj_name, "turret03")){ fenris_turret = lookup; } @@ -3242,8 +3242,8 @@ void beam_test_new(int whee) lookup = GET_NEXT(lookup); } - Assert(fenris_turret != NULL); - Assert(fenris_radar != NULL); + SDL_assert(fenris_turret != NULL); + SDL_assert(fenris_radar != NULL); memset(&f, 0, sizeof(beam_fire_info)); f.accuracy = beam_accuracy; diff --git a/src/weapon/corkscrew.cpp b/src/weapon/corkscrew.cpp index e03c4ca..42ad6c2 100644 --- a/src/weapon/corkscrew.cpp +++ b/src/weapon/corkscrew.cpp @@ -79,7 +79,7 @@ void cscrew_maybe_fire_missile(int shipnum) ship_weapon *swp; int weapon_info_index; - Assert(shipnum >= 0 && shipnum < MAX_SHIPS ); + SDL_assert(shipnum >= 0 && shipnum < MAX_SHIPS ); sp = &Ships[shipnum]; // make sure we're supposed to be firing some missiles @@ -95,7 +95,7 @@ void cscrew_maybe_fire_missile(int shipnum) } weapon_info_index = swp->secondary_bank_weapons[swp->current_secondary_bank]; - Assert( weapon_info_index >= 0 && weapon_info_index < MAX_WEAPON_TYPES ); + SDL_assert( weapon_info_index >= 0 && weapon_info_index < MAX_WEAPON_TYPES ); // if current secondary bank is not a corkscrew missile, return if ( !(Weapon_info[weapon_info_index].wi_flags & WIF_CORKSCREW) ) { @@ -179,9 +179,9 @@ void cscrew_process_pre(object *objp) cscrew_info *ci; // check stuff - Assert(objp->type == OBJ_WEAPON); - Assert(Weapons[objp->instance].cscrew_index >= 0); - Assert(Corkscrew_missiles[Weapons[objp->instance].cscrew_index].flags & CS_FLAG_USED); + SDL_assert(objp->type == OBJ_WEAPON); + SDL_assert(Weapons[objp->instance].cscrew_index >= 0); + SDL_assert(Corkscrew_missiles[Weapons[objp->instance].cscrew_index].flags & CS_FLAG_USED); ci = &Corkscrew_missiles[Weapons[objp->instance].cscrew_index]; @@ -205,9 +205,9 @@ void cscrew_process_post(object *objp) float twist_val; // check stuff - Assert(objp->type == OBJ_WEAPON); - Assert(Weapons[objp->instance].cscrew_index >= 0); - Assert(Corkscrew_missiles[Weapons[objp->instance].cscrew_index].flags & CS_FLAG_USED); + SDL_assert(objp->type == OBJ_WEAPON); + SDL_assert(Weapons[objp->instance].cscrew_index >= 0); + SDL_assert(Corkscrew_missiles[Weapons[objp->instance].cscrew_index].flags & CS_FLAG_USED); // get various useful pointers wp = &Weapons[objp->instance]; diff --git a/src/weapon/emp.cpp b/src/weapon/emp.cpp index 8b1abd2..8c33195 100644 --- a/src/weapon/emp.cpp +++ b/src/weapon/emp.cpp @@ -169,11 +169,11 @@ void emp_apply(vector *pos, float inner_radius, float outer_radius, float emp_in continue; } - Assert(target->instance >= 0); + SDL_assert(target->instance >= 0); if(target->instance < 0){ continue; } - Assert(Weapons[target->instance].weapon_info_index >= 0); + SDL_assert(Weapons[target->instance].weapon_info_index >= 0); if(Weapons[target->instance].weapon_info_index < 0){ continue; } @@ -206,11 +206,11 @@ void emp_apply(vector *pos, float inner_radius, float outer_radius, float emp_in continue; } - Assert(Objects[so->objnum].instance >= 0); + SDL_assert(Objects[so->objnum].instance >= 0); if(Objects[so->objnum].instance < 0){ continue; } - Assert(Ships[Objects[so->objnum].instance].ship_info_index >= 0); + SDL_assert(Ships[Objects[so->objnum].instance].ship_info_index >= 0); if(Ships[Objects[so->objnum].instance].ship_info_index < 0){ continue; } @@ -287,7 +287,7 @@ void emp_apply(vector *pos, float inner_radius, float outer_radius, float emp_in // if this is a multiplayer game, notify other players of the effect if(Game_mode & GM_MULTIPLAYER){ - Assert(MULTIPLAYER_MASTER); + SDL_assert(MULTIPLAYER_MASTER); send_emp_effect(target->net_signature, actual_intensity, actual_time); } @@ -306,8 +306,8 @@ void emp_start_ship(object *ship_obj, float intensity, float time) float start_intensity; // make sure this is a ship - Assert(ship_obj->type == OBJ_SHIP); - Assert(ship_obj->instance >= 0); + SDL_assert(ship_obj->type == OBJ_SHIP); + SDL_assert(ship_obj->instance >= 0); shipp = &Ships[ship_obj->instance]; // determining pre-existing EMP intensity (if any) @@ -333,7 +333,7 @@ void emp_start_ship(object *ship_obj, float intensity, float time) } // do any initial AI effects - Assert(shipp->ai_index >= 0); + SDL_assert(shipp->ai_index >= 0); aip = &Ai_info[shipp->ai_index]; // lose his current target @@ -348,11 +348,11 @@ void emp_process_ship(ship *shipp) object *objp; ai_info *aip; - Assert(shipp != NULL); + SDL_assert(shipp != NULL); if(shipp == NULL){ return; } - Assert(shipp->objnum >= 0); + SDL_assert(shipp->objnum >= 0); if(shipp->objnum < 0){ return; } @@ -379,7 +379,7 @@ void emp_process_ship(ship *shipp) } // lose lock time, etc, etc. - Assert(shipp->ai_index >= 0); + SDL_assert(shipp->ai_index >= 0); aip = &Ai_info[shipp->ai_index]; aip->aspect_locked_time = 0.0f; // hasn't gotten aspect lock at all aip->current_target_is_locked = 0; // isn't locked on his current target @@ -577,7 +577,7 @@ void emp_maybe_reformat_text(char *text, int max_len, int gauge_id) // if this gauge has not been wacked out, or if the timestamp has expired, we // neeed to wack it out again - Assert((gauge_id >= EG_NULL) && (gauge_id < NUM_TEXT_STAMPS)); + SDL_assert((gauge_id >= EG_NULL) && (gauge_id < NUM_TEXT_STAMPS)); wt = &Emp_wacky_text[gauge_id]; if((wt->stamp == -1) || timestamp_elapsed(wt->stamp)){ // reformat specific gauges differently diff --git a/src/weapon/flak.cpp b/src/weapon/flak.cpp index 3f17891..621a127 100644 --- a/src/weapon/flak.cpp +++ b/src/weapon/flak.cpp @@ -117,10 +117,10 @@ void flak_create(weapon *wp) int found; // make sure this is a valid flak weapon object - Assert(wp->objnum >= 0); - Assert(Objects[wp->objnum].type == OBJ_WEAPON); - Assert(wp->weapon_info_index >= 0); - Assert(Weapon_info[wp->weapon_info_index].wi_flags & WIF_FLAK); + SDL_assert(wp->objnum >= 0); + SDL_assert(Objects[wp->objnum].type == OBJ_WEAPON); + SDL_assert(wp->weapon_info_index >= 0); + SDL_assert(Weapon_info[wp->weapon_info_index].wi_flags & WIF_FLAK); // switch off rendering for the object obj_set_flags(&Objects[wp->objnum], Objects[wp->objnum].flags & ~(OF_RENDERS)); @@ -146,7 +146,7 @@ void flak_create(weapon *wp) // free up a flak object void flak_delete(int flak_index) { - Assert((flak_index >= 0) && (flak_index < MAX_FLAK_INFO)); + SDL_assert((flak_index >= 0) && (flak_index < MAX_FLAK_INFO)); memset(&Flak[flak_index], 0, sizeof(flak_info)); Flak[flak_index].range = -1; } @@ -158,10 +158,10 @@ void flak_pick_range(object *objp, vector *predicted_target_pos, float weapon_su vector temp; // make sure this flak object is valid - Assert(objp->type == OBJ_WEAPON); - Assert(objp->instance >= 0); - Assert(Weapons[objp->instance].weapon_info_index >= 0); - Assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_FLAK); + SDL_assert(objp->type == OBJ_WEAPON); + SDL_assert(objp->instance >= 0); + SDL_assert(Weapons[objp->instance].weapon_info_index >= 0); + SDL_assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_FLAK); // if the flak index is invalid, do nothing - if this fails the flak simply becomes a non-rendering bullet if(Weapons[objp->instance].flak_index < 0){ @@ -221,19 +221,19 @@ void flak_jitter_aim(vector *dir, float dist_to_target, float weapon_subsys_stre void flak_muzzle_flash(vector *pos, vector *dir, int turret_weapon_class) { // sanity - Assert((turret_weapon_class >= 0) && (turret_weapon_class < Num_weapon_types)); + SDL_assert((turret_weapon_class >= 0) && (turret_weapon_class < Num_weapon_types)); if((turret_weapon_class < 0) || (turret_weapon_class >= Num_weapon_types)){ return; } - Assert(Weapon_info[turret_weapon_class].wi_flags & WIF_FLAK); + SDL_assert(Weapon_info[turret_weapon_class].wi_flags & WIF_FLAK); if(!(Weapon_info[turret_weapon_class].wi_flags & WIF_FLAK)){ return; } - Assert(Weapon_info[turret_weapon_class].wi_flags & WIF_MFLASH); + SDL_assert(Weapon_info[turret_weapon_class].wi_flags & WIF_MFLASH); if(!(Weapon_info[turret_weapon_class].wi_flags & WIF_MFLASH)){ return; } - Assert(Weapon_info[turret_weapon_class].muzzle_flash >= 0); + SDL_assert(Weapon_info[turret_weapon_class].muzzle_flash >= 0); if(Weapon_info[turret_weapon_class].muzzle_flash < 0){ return; } @@ -270,9 +270,9 @@ void flak_maybe_detonate(object *objp) // given a just fired flak shell, pick a detonating distance for it void flak_set_range(object *objp, vector *start_pos, float range) { - Assert(objp->type == OBJ_WEAPON); - Assert(objp->instance >= 0); - Assert(Weapons[objp->instance].flak_index >= 0); + SDL_assert(objp->type == OBJ_WEAPON); + SDL_assert(objp->instance >= 0); + SDL_assert(Weapons[objp->instance].flak_index >= 0); // setup the flak info Flak[Weapons[objp->instance].flak_index].range = range; @@ -282,9 +282,9 @@ void flak_set_range(object *objp, vector *start_pos, float range) // get the current range for the flak object float flak_get_range(object *objp) { - Assert(objp->type == OBJ_WEAPON); - Assert(objp->instance >= 0); - Assert(Weapons[objp->instance].flak_index >= 0); + SDL_assert(objp->type == OBJ_WEAPON); + SDL_assert(objp->instance >= 0); + SDL_assert(Weapons[objp->instance].flak_index >= 0); return Flak[Weapons[objp->instance].flak_index].range; } diff --git a/src/weapon/muzzleflash.cpp b/src/weapon/muzzleflash.cpp index 675cc5a..f55cf42 100644 --- a/src/weapon/muzzleflash.cpp +++ b/src/weapon/muzzleflash.cpp @@ -180,7 +180,7 @@ void mflash_game_init() strncpy(m->name, "mflash_small", MAX_MFLASH_NAME_LEN); m->num_blobs = 4; - Assert(m->num_blobs <= MAX_MFLASH_BLOBS); + SDL_assert(m->num_blobs <= MAX_MFLASH_BLOBS); idx = 0; strncpy(m->blob_names[idx], "expmissilehit1", MAX_MFLASH_NAME_LEN); @@ -228,7 +228,7 @@ void mflash_level_init() for(idx=0; idx= 0); + SDL_assert(Mflash_info[i].blob_anims[idx] >= 0); } } } @@ -266,7 +266,7 @@ void mflash_create(vector *gun_pos, vector *gun_dir, int mflash_type) // Find next available trail mflashp = GET_FIRST(&Mflash_free_list); - Assert( mflashp != &Mflash_free_list ); // shouldn't have the dummy element + SDL_assert( mflashp != &Mflash_free_list ); // shouldn't have the dummy element // remove trailp from the free list list_remove( &Mflash_free_list, mflashp ); @@ -326,7 +326,7 @@ void mflash_process_all() // decrement counter Num_mflash--; - Assert(Num_mflash >= 0); + SDL_assert(Num_mflash >= 0); mflashp = next_one; } else { @@ -347,7 +347,7 @@ int mflash_lookup(char *name) // look it up for(idx=0; idxtype == OBJ_SHOCKWAVE); - Assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES); + SDL_assert(objp->type == OBJ_SHOCKWAVE); + SDL_assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES); Shockwaves[objp->instance].flags = 0; Shockwaves[objp->instance].objnum = -1; @@ -378,7 +378,7 @@ void shockwave_delete_all() sw = GET_FIRST(&Shockwave_list); while ( sw != &Shockwave_list ) { next = sw->next; - Assert(sw->objnum != -1); + SDL_assert(sw->objnum != -1); Objects[sw->objnum].flags |= OF_SHOULD_BE_DEAD; sw = next; } @@ -425,8 +425,8 @@ void shockwave_move(object *shockwave_objp, float frametime) float blast,damage; int i; - Assert(shockwave_objp->type == OBJ_SHOCKWAVE); - Assert(shockwave_objp->instance >= 0 && shockwave_objp->instance < MAX_SHOCKWAVES); + SDL_assert(shockwave_objp->type == OBJ_SHOCKWAVE); + SDL_assert(shockwave_objp->instance >= 0 && shockwave_objp->instance < MAX_SHOCKWAVES); sw = &Shockwaves[shockwave_objp->instance]; // if the shockwave has a delay on it @@ -482,7 +482,7 @@ void shockwave_move(object *shockwave_objp, float frametime) } // okay, we have damage applied, record the object signature so we don't repeatedly apply damage - Assert(sw->num_objs_hit < SW_MAX_OBJS_HIT); + SDL_assert(sw->num_objs_hit < SW_MAX_OBJS_HIT); if ( sw->num_objs_hit >= SW_MAX_OBJS_HIT) { sw->num_objs_hit--; } @@ -523,8 +523,8 @@ void shockwave_render(object *objp) shockwave_info *si; vertex p; - Assert(objp->type == OBJ_SHOCKWAVE); - Assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES); + SDL_assert(objp->type == OBJ_SHOCKWAVE); + SDL_assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES); sw = &Shockwaves[objp->instance]; si = &Shockwave_info[sw->shockwave_info_index]; @@ -612,7 +612,7 @@ void shockwave_move_all(float frametime) sw = GET_FIRST(&Shockwave_list); while ( sw != &Shockwave_list ) { next = sw->next; - Assert(sw->objnum != -1); + SDL_assert(sw->objnum != -1); shockwave_move(&Objects[sw->objnum], frametime); sw = next; } @@ -629,7 +629,7 @@ void shockwave_render_all() sw = GET_FIRST(&Shockwave_list); while ( sw != &Shockwave_list ) { next = sw->next; - Assert(sw->objnum != -1); + SDL_assert(sw->objnum != -1); shockwave_render(&Objects[sw->objnum]); sw = next; } diff --git a/src/weapon/swarm.cpp b/src/weapon/swarm.cpp index 2af9be2..a5533d4 100644 --- a/src/weapon/swarm.cpp +++ b/src/weapon/swarm.cpp @@ -210,7 +210,7 @@ void swarm_maybe_fire_missile(int shipnum) ship_weapon *swp; int weapon_info_index; - Assert(shipnum >= 0 && shipnum < MAX_SHIPS ); + SDL_assert(shipnum >= 0 && shipnum < MAX_SHIPS ); sp = &Ships[shipnum]; if ( sp->num_swarm_missiles_to_fire <= 0 ) @@ -223,7 +223,7 @@ void swarm_maybe_fire_missile(int shipnum) } weapon_info_index = swp->secondary_bank_weapons[swp->current_secondary_bank]; - Assert( weapon_info_index >= 0 && weapon_info_index < MAX_WEAPON_TYPES ); + SDL_assert( weapon_info_index >= 0 && weapon_info_index < MAX_WEAPON_TYPES ); // if current secondary bank is not a swarm missile, return if ( !(Weapon_info[weapon_info_index].wi_flags & WIF_SWARM) ) { @@ -276,7 +276,7 @@ void swarm_delete(int i) { swarm_info *swarmp; - Assert(i >= 0 && i < MAX_SWARM_MISSILES); + SDL_assert(i >= 0 && i < MAX_SWARM_MISSILES); swarmp = &Swarm_missiles[i]; if ( !(swarmp->flags & SWARM_USED) ) { @@ -301,7 +301,7 @@ void swarm_update_direction(object *objp, float frametime) float vel, target_dist, radius, missile_speed, missile_dist; physics_info *pi; - Assert(objp->instance >= 0 && objp->instance < MAX_WEAPONS); + SDL_assert(objp->instance >= 0 && objp->instance < MAX_WEAPONS); wp = &Weapons[objp->instance]; @@ -356,7 +356,7 @@ void swarm_update_direction(object *objp, float frametime) missile_dist=i2fl(SWARM_DIST_OFFSET); } swarmp->angle_offset = (float)(asin(SWARM_DIST_OFFSET / missile_dist)); - Assert(!_isnan(swarmp->angle_offset) ); + SDL_assert(!_isnan(swarmp->angle_offset) ); } swarmp->change_timestamp = timestamp(swarmp->change_time); @@ -374,7 +374,7 @@ void swarm_update_direction(object *objp, float frametime) missile_speed = pi->speed; missile_dist = missile_speed * swarmp->change_time/1000.0f; swarmp->angle_offset = (float)(asin(SWARM_DIST_OFFSET / missile_dist)); - Assert(!_isnan(swarmp->angle_offset) ); + SDL_assert(!_isnan(swarmp->angle_offset) ); } vm_vec_sub(&obj_to_target, &swarmp->original_target, &objp->pos); @@ -516,7 +516,7 @@ void turret_swarm_delete(int i) { turret_swarm_info *tswarmp; - Assert(i >= 0 && i < MAX_TURRET_SWARM_INFO); + SDL_assert(i >= 0 && i < MAX_TURRET_SWARM_INFO); tswarmp = &Turret_swarm_info[i]; if ( !(tswarmp->flags & SWARM_USED) ) { @@ -536,28 +536,28 @@ void turret_swarm_set_up_info(int parent_objnum, ship_subsys *turret, int turret weapon_info *wip; // weapon info pointer - Assert((turret_weapon_class >= 0) && (turret_weapon_class < Num_weapon_types)); + SDL_assert((turret_weapon_class >= 0) && (turret_weapon_class < Num_weapon_types)); if((turret_weapon_class < 0) || (turret_weapon_class >= Num_weapon_types)){ return; } wip = &Weapon_info[turret_weapon_class]; // get ship pointer - Assert((parent_objnum >= 0) && (parent_objnum < MAX_OBJECTS)); + SDL_assert((parent_objnum >= 0) && (parent_objnum < MAX_OBJECTS)); if((parent_objnum < 0) || (parent_objnum >= MAX_OBJECTS)){ return; } parent_obj = &Objects[parent_objnum]; - Assert(parent_obj->type == OBJ_SHIP); + SDL_assert(parent_obj->type == OBJ_SHIP); shipp = &Ships[parent_obj->instance]; - Assert((turret->turret_enemy_objnum >= 0) && (turret->turret_enemy_objnum < MAX_OBJECTS)); + SDL_assert((turret->turret_enemy_objnum >= 0) && (turret->turret_enemy_objnum < MAX_OBJECTS)); if((turret->turret_enemy_objnum < 0) || (turret->turret_enemy_objnum >= MAX_OBJECTS)){ return; } target_obj = &Objects[turret->turret_enemy_objnum]; // valid swarm weapon - Assert((wip->wi_flags & WIF_SWARM) && (wip->swarm_count > 0)); + SDL_assert((wip->wi_flags & WIF_SWARM) && (wip->swarm_count > 0)); if(!(wip->wi_flags & WIF_SWARM) || (wip->swarm_count <= 0)){ return; } @@ -584,7 +584,7 @@ void turret_swarm_set_up_info(int parent_objnum, ship_subsys *turret, int turret // make sure time is sufficient to launch all the missiles before next volley #ifndef NDEBUG - Assert(wip->swarm_count * SWARM_MISSILE_DELAY < wip->fire_wait * 1000.0f); + SDL_assert(wip->swarm_count * SWARM_MISSILE_DELAY < wip->fire_wait * 1000.0f); #endif // initialize tsi @@ -610,7 +610,7 @@ void turret_swarm_maybe_fire_missile(int shipnum) // check if ship has any turrets ready to fire if (shipp->num_turret_swarm_info <= 0) { - Assert(shipp->num_turret_swarm_info == 0); + SDL_assert(shipp->num_turret_swarm_info == 0); return; } @@ -623,21 +623,21 @@ void turret_swarm_maybe_fire_missile(int shipnum) if (subsys->turret_swarm_info_index != -1) { num_turret_swarm_turrets_left--; - Assert(num_turret_swarm_turrets_left >= 0); + SDL_assert(num_turret_swarm_turrets_left >= 0); // get turret_swarm_info - Assert( (subsys->turret_swarm_info_index >= 0) && (subsys->turret_swarm_info_index < MAX_TURRET_SWARM_INFO) ); + SDL_assert( (subsys->turret_swarm_info_index >= 0) && (subsys->turret_swarm_info_index < MAX_TURRET_SWARM_INFO) ); tsi = &Turret_swarm_info[subsys->turret_swarm_info_index]; // check if parent ship is valid (via signature) if ( (tsi->parent_sig == parent_obj->signature) ) { // make sure we have the right turret. - Assert(tsi->turret == subsys); + SDL_assert(tsi->turret == subsys); // check if time to fire if (timestamp_elapsed(tsi->time_to_fire)) { - Assert(tsi->num_to_launch > 0); + SDL_assert(tsi->num_to_launch > 0); // check target still alive target_objnum = -1; @@ -678,7 +678,7 @@ void turret_swarm_maybe_fire_missile(int shipnum) } } - Assert(num_turret_swarm_turrets_left == 0); + SDL_assert(num_turret_swarm_turrets_left == 0); } // check Turret_swarm_info for info that are invalid - ie, ships died while firing. diff --git a/src/weapon/trails.cpp b/src/weapon/trails.cpp index 62790d1..46c5e3c 100644 --- a/src/weapon/trails.cpp +++ b/src/weapon/trails.cpp @@ -169,7 +169,7 @@ int trail_create(trail_info info) // Find next available trail trailp = GET_FIRST(&Trail_free_list); - Assert( trailp != &Trail_free_list ); // shouldn't have the dummy element + SDL_assert( trailp != &Trail_free_list ); // shouldn't have the dummy element // remove trailp from the free list list_remove( &Trail_free_list, trailp ); @@ -436,7 +436,7 @@ void trail_move_all(float frametime) // decrement counter Num_trails--; - Assert(Num_trails >= 0); + SDL_assert(Num_trails >= 0); trailp = next_one; } else { diff --git a/src/weapon/weapons.cpp b/src/weapon/weapons.cpp index 82e29c1..a3d8490 100644 --- a/src/weapon/weapons.cpp +++ b/src/weapon/weapons.cpp @@ -533,7 +533,7 @@ void parse_weapon_expl_tbl() Num_weapon_expl = 0; required_string("#Start"); while (required_string_either("#End","$Name:")) { - Assert( Num_weapon_expl < MAX_Weapon_expl_info); + SDL_assert( Num_weapon_expl < MAX_Weapon_expl_info); // base filename required_string("$Name:"); @@ -577,7 +577,7 @@ void parse_weapon_expl_tbl() int get_weapon_expl_info_index(char *filename) { for (int i=0; i= 0 && index < MAX_MISSILE_OBJS); + SDL_assert(index >= 0 && index < MAX_MISSILE_OBJS); list_remove(&Missile_obj_list, &Missile_objs[index]); Missile_objs[index].flags = 0; } @@ -678,7 +678,7 @@ void weapon_maybe_alert_cmeasure_success(object *objp) // missile_obj *missile_obj_return_address(int index) { - Assert(index >= 0 && index < MAX_MISSILE_OBJS); + SDL_assert(index >= 0 && index < MAX_MISSILE_OBJS); return &Missile_objs[index]; } @@ -698,7 +698,7 @@ int weapon_info_lookup(const char *name) #endif for (i=0; iwi_flags |= WIF_ELECTRONICS; - else if (!strnicmp(NOX("Spawn"), weapon_strings[i], 5)) { + else if (!SDL_strncasecmp(NOX("Spawn"), weapon_strings[i], 5)) { if (weaponp->spawn_type == -1) { int skip_length, name_length; char *temp_string; @@ -739,54 +739,54 @@ void parse_wi_flags(weapon_info *weaponp) } strncpy(Spawn_names[Num_spawn_types++], &(weapon_strings[i][skip_length]), name_length); - Assert(Num_spawn_types < MAX_SPAWN_WEAPONS); + SDL_assert(Num_spawn_types < MAX_SPAWN_WEAPONS); } else Warning(LOCATION, "Illegal to have two spawn types for one weapon.\n" "Ignoring weapon %s", weapon_strings[i]); - } else if (!stricmp(NOX("Remote Detonate"), weapon_strings[i])) + } else if (!SDL_strcasecmp(NOX("Remote Detonate"), weapon_strings[i])) weaponp->wi_flags |= WIF_REMOTE; - else if (!stricmp(NOX("Puncture"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Puncture"), weapon_strings[i])) weaponp->wi_flags |= WIF_PUNCTURE; - else if (!stricmp(NOX("Big Ship"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Big Ship"), weapon_strings[i])) weaponp->wi_flags |= WIF_BIG_ONLY; - else if (!stricmp(NOX("Huge"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Huge"), weapon_strings[i])) weaponp->wi_flags |= WIF_HUGE; - else if (!stricmp(NOX("Bomber+"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Bomber+"), weapon_strings[i])) weaponp->wi_flags |= WIF_BOMBER_PLUS; - else if (!stricmp(NOX("child"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("child"), weapon_strings[i])) weaponp->wi_flags |= WIF_CHILD; - else if (!stricmp(NOX("Bomb"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Bomb"), weapon_strings[i])) weaponp->wi_flags |= WIF_BOMB; - else if (!stricmp(NOX("No Dumbfire"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("No Dumbfire"), weapon_strings[i])) weaponp->wi_flags |= WIF_NO_DUMBFIRE; - else if (!stricmp(NOX("In tech database"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("In tech database"), weapon_strings[i])) weaponp->wi_flags |= WIF_IN_TECH_DATABASE; - else if (!stricmp(NOX("Player allowed"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Player allowed"), weapon_strings[i])) weaponp->wi_flags |= WIF_PLAYER_ALLOWED; - else if (!stricmp(NOX("Particle Spew"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Particle Spew"), weapon_strings[i])) weaponp->wi_flags |= WIF_PARTICLE_SPEW; - else if (!stricmp(NOX("EMP"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("EMP"), weapon_strings[i])) weaponp->wi_flags |= WIF_EMP; - else if (!stricmp(NOX("Esuck"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Esuck"), weapon_strings[i])) weaponp->wi_flags |= WIF_ENERGY_SUCK; - else if (!stricmp(NOX("Flak"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Flak"), weapon_strings[i])) weaponp->wi_flags |= WIF_FLAK; - else if (!stricmp(NOX("Corkscrew"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Corkscrew"), weapon_strings[i])) weaponp->wi_flags |= WIF_CORKSCREW; - else if (!stricmp(NOX("Shudder"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Shudder"), weapon_strings[i])) weaponp->wi_flags |= WIF_SHUDDER; - else if (!stricmp(NOX("lockarm"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("lockarm"), weapon_strings[i])) weaponp->wi_flags |= WIF_LOCKARM; - else if (!stricmp(NOX("beam"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("beam"), weapon_strings[i])) weaponp->wi_flags |= WIF_BEAM; - else if (!stricmp(NOX("stream"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("stream"), weapon_strings[i])) weaponp->wi_flags |= WIF_STREAM; - else if (!stricmp(NOX("supercap"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("supercap"), weapon_strings[i])) weaponp->wi_flags |= WIF_SUPERCAP; #ifdef MAKE_FS1 - else if (!stricmp(NOX("Swarm"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("Swarm"), weapon_strings[i])) weaponp->wi_flags |= WIF_SWARM; - else if (!stricmp(NOX("No Ship"), weapon_strings[i])) + else if (!SDL_strcasecmp(NOX("No Ship"), weapon_strings[i])) weaponp->wi_flags |= WIF_CHILD; #endif else @@ -795,18 +795,18 @@ void parse_wi_flags(weapon_info *weaponp) // SWARM, CORKSCREW and FLAK should be mutually exclusive if(weaponp->wi_flags & WIF_FLAK){ - Assert(!(weaponp->wi_flags & WIF_CORKSCREW) && !(weaponp->wi_flags & WIF_SWARM)); + SDL_assert(!(weaponp->wi_flags & WIF_CORKSCREW) && !(weaponp->wi_flags & WIF_SWARM)); } if(weaponp->wi_flags & WIF_CORKSCREW){ - Assert(!(weaponp->wi_flags & WIF_FLAK) && !(weaponp->wi_flags & WIF_SWARM)); + SDL_assert(!(weaponp->wi_flags & WIF_FLAK) && !(weaponp->wi_flags & WIF_SWARM)); } if(weaponp->wi_flags & WIF_SWARM){ - Assert(!(weaponp->wi_flags & WIF_CORKSCREW) && !(weaponp->wi_flags & WIF_FLAK)); + SDL_assert(!(weaponp->wi_flags & WIF_CORKSCREW) && !(weaponp->wi_flags & WIF_FLAK)); } // make sure flak guns are only placed on turrets if(weaponp->wi_flags & WIF_FLAK){ - Assert(weaponp->wi_flags & WIF_BIG_ONLY); + SDL_assert(weaponp->wi_flags & WIF_BIG_ONLY); } } @@ -881,7 +881,7 @@ int parse_weapon() required_string("$Model file:"); stuff_string(wip->pofbitmap_name, F_NAME, NULL); diag_printf ("Model pof file -- %s\n", wip->pofbitmap_name ); - if ( stricmp(wip->pofbitmap_name, NOX("none")) ) { + if ( SDL_strcasecmp(wip->pofbitmap_name, NOX("none")) ) { wip->model_num = -1; wip->render_type = WRT_POF; wip->laser_bitmap = -1; @@ -1039,7 +1039,7 @@ int parse_weapon() required_string("+Type:"); stuff_string(temp_type, F_NAME, NULL); - if (!stricmp(temp_type, NOX("HEAT"))) { + if (!SDL_strcasecmp(temp_type, NOX("HEAT"))) { float view_cone_angle; wip->wi_flags |= WIF_HOMING_HEAT | WIF_TURNS; @@ -1052,7 +1052,7 @@ int parse_weapon() wip->fov = (float)cos((float)(ANG_TO_RAD(view_cone_angle/2.0f))); - } else if (!stricmp(temp_type, NOX("ASPECT"))) { + } else if (!SDL_strcasecmp(temp_type, NOX("ASPECT"))) { wip->wi_flags |= WIF_HOMING_ASPECT | WIF_TURNS; required_string("+Turn Time:"); @@ -1189,7 +1189,7 @@ int parse_weapon() if ( optional_string("$Impact Explosion:") ) { char impact_ani_file[FILESPEC_LENGTH]; stuff_string(impact_ani_file, F_NAME, NULL); - if ( stricmp(impact_ani_file,NOX("none"))) { + if ( SDL_strcasecmp(impact_ani_file,NOX("none"))) { wip->impact_weapon_expl_index = get_weapon_expl_info_index(impact_ani_file); //int num_frames, fps; //wip->impact_explosion_ani = bm_load_animation( impact_ani_file, &num_frames, &fps, 1 ); @@ -1444,7 +1444,7 @@ void translate_spawn_types() int spawn_type = Weapon_info[i].spawn_type; for (j=0; jtype == OBJ_WEAPON); + SDL_assert(obj->type == OBJ_WEAPON); num = obj->instance; wp = &Weapons[num]; @@ -1686,10 +1686,10 @@ void weapon_delete(object *obj) num = obj->instance; - Assert( Weapons[num].objnum == OBJ_INDEX(obj)); + SDL_assert( Weapons[num].objnum == OBJ_INDEX(obj)); wp = &Weapons[num]; - Assert(wp->weapon_info_index >= 0); + SDL_assert(wp->weapon_info_index >= 0); wp->weapon_info_index = -1; if (wp->swarm_index >= 0) { swarm_delete(wp->swarm_index); @@ -1717,7 +1717,7 @@ void weapon_delete(object *obj) wp->objnum = -1; Num_weapons--; - Assert(Num_weapons >= 0); + SDL_assert(Num_weapons >= 0); } // Check if missile is newly locked onto the Player, maybe play a launch warning @@ -1729,7 +1729,7 @@ void weapon_maybe_play_warning(weapon *wp) if ( Weapon_info[wp->weapon_info_index].wi_flags & WIF_HOMING_HEAT ) { snd_play(&Snds[SND_HEATLOCK_WARN]); } else { - Assert(Weapon_info[wp->weapon_info_index].wi_flags & WIF_HOMING_ASPECT); + SDL_assert(Weapon_info[wp->weapon_info_index].wi_flags & WIF_HOMING_ASPECT); snd_play(&Snds[SND_ASPECTLOCK_WARN]); } } @@ -1971,8 +1971,8 @@ void weapon_home(object *obj, int num, float frame_time) weapon_info *wip; object *hobjp; - Assert(obj->type == OBJ_WEAPON); - Assert(obj->instance == num); + SDL_assert(obj->type == OBJ_WEAPON); + SDL_assert(obj->instance == num); wp = &Weapons[num]; wip = &Weapon_info[wp->weapon_info_index]; hobjp = Weapons[num].homing_object; @@ -2050,7 +2050,7 @@ void weapon_home(object *obj, int num, float frame_time) break; case OBJ_WEAPON: // only allowed to home on bombs - Assert(Weapon_info[Weapons[hobjp->instance].weapon_info_index].wi_flags & WIF_BOMB); + SDL_assert(Weapon_info[Weapons[hobjp->instance].weapon_info_index].wi_flags & WIF_BOMB); if (wip->wi_flags & WIF_HOMING_ASPECT) find_homing_object_by_sig(obj, wp->target_sig); else @@ -2096,7 +2096,7 @@ void weapon_home(object *obj, int num, float frame_time) if ( wp->homing_subsys != NULL ) { get_subsystem_world_pos(hobjp, Weapons[num].homing_subsys, &target_pos); wp->homing_pos = target_pos; // store the homing position in weapon data - Assert( !vm_is_vec_nan(&wp->homing_pos) ); + SDL_assert( !vm_is_vec_nan(&wp->homing_pos) ); } else { float fov; float dist; @@ -2178,7 +2178,7 @@ void weapon_home(object *obj, int num, float frame_time) } wp->homing_pos = target_pos; - Assert( !vm_is_vec_nan(&wp->homing_pos) ); + SDL_assert( !vm_is_vec_nan(&wp->homing_pos) ); // nprintf(("AI", "Attack point = %7.3f %7.3f %7.3f\n", target_pos.xyz.x, target_pos.xyz.y, target_pos.xyz.z)); } else target_pos = wp->homing_pos; @@ -2246,7 +2246,7 @@ void weapon_home(object *obj, int num, float frame_time) if (wip->fov < 0.95f) wp->lifeleft -= flFrametime * (0.95f - old_dot); } else - Assert(0); // Hmm, a homing missile, but not aspect or heat? + SDL_assert(0); // Hmm, a homing missile, but not aspect or heat? // Control speed based on dot product to goal. If close to straight ahead, move @@ -2266,7 +2266,7 @@ void weapon_home(object *obj, int num, float frame_time) obj->phys_info.speed *= t*t; } - Assert( obj->phys_info.speed > 0.0f ); + SDL_assert( obj->phys_info.speed > 0.0f ); vm_vec_copy_scale( &obj->phys_info.desired_vel, &obj->orient.v.fvec, obj->phys_info.speed); @@ -2374,13 +2374,13 @@ void weapon_process_post(object * obj, float frame_time) MONITOR_INC( NumWeapons, 1 ); - Assert(obj->type == OBJ_WEAPON); + SDL_assert(obj->type == OBJ_WEAPON); num = obj->instance; #ifndef NDEBUG int objnum = OBJ_INDEX(obj); - Assert( Weapons[num].objnum == objnum ); + SDL_assert( Weapons[num].objnum == objnum ); #endif wp = &Weapons[num]; @@ -2537,13 +2537,13 @@ void weapon_set_tracking_info(int weapon_objnum, int parent_objnum, int target_o return; } - Assert(Objects[weapon_objnum].type == OBJ_WEAPON); + SDL_assert(Objects[weapon_objnum].type == OBJ_WEAPON); wp = &Weapons[Objects[weapon_objnum].instance]; wip = &Weapon_info[wp->weapon_info_index]; parent_objp = &Objects[parent_objnum]; - Assert(parent_objp->type == OBJ_SHIP); + SDL_assert(parent_objp->type == OBJ_SHIP); ai_index = Ships[parent_objp->instance].ai_index; if ( ai_index >= 0 ) { @@ -2613,10 +2613,10 @@ int weapon_create( vector * pos, matrix * orient, int weapon_id, int parent_objn weapon *wp; weapon_info *wip; - Assert(weapon_id >= 0 && weapon_id < Num_weapon_types); + SDL_assert(weapon_id >= 0 && weapon_id < Num_weapon_types); // beam weapons should never come through here! - Assert(!(Weapon_info[weapon_id].wi_flags & WIF_BEAM)); + SDL_assert(!(Weapon_info[weapon_id].wi_flags & WIF_BEAM)); num_deleted = 0; if (Num_weapons >= MAX_WEAPONS-5) { @@ -2649,8 +2649,8 @@ int weapon_create( vector * pos, matrix * orient, int weapon_id, int parent_objn Weapons_created++; objnum = obj_create( OBJ_WEAPON, parent_objnum, n, orient, pos, 2.0f, OF_RENDERS | OF_COLLIDES | OF_PHYSICS ); - Assert(objnum >= 0); - Assert(First_secondary_index != -1); + SDL_assert(objnum >= 0); + SDL_assert(First_secondary_index != -1); objp = &Objects[objnum]; parent_objp = NULL; @@ -2680,8 +2680,8 @@ int weapon_create( vector * pos, matrix * orient, int weapon_id, int parent_objn // we don't necessarily need a parent if(parent_objp != NULL){ - Assert(parent_objp->type == OBJ_SHIP); // Get Mike, a non-ship has fired a weapon! - Assert((parent_objp->instance >= 0) && (parent_objp->instance < MAX_SHIPS)); + SDL_assert(parent_objp->type == OBJ_SHIP); // Get Mike, a non-ship has fired a weapon! + SDL_assert((parent_objp->instance >= 0) && (parent_objp->instance < MAX_SHIPS)); wp->team = Ships[parent_objp->instance].team; wp->species = Ship_info[Ships[parent_objp->instance].ship_info_index].species; } else { @@ -2857,11 +2857,11 @@ void spawn_child_weapons(object *objp) weapon *wp; weapon_info *wip; - Assert(objp->type == OBJ_WEAPON); - Assert((objp->instance >= 0) && (objp->instance < MAX_WEAPONS)); + SDL_assert(objp->type == OBJ_WEAPON); + SDL_assert((objp->instance >= 0) && (objp->instance < MAX_WEAPONS)); wp = &Weapons[objp->instance]; - Assert((wp->weapon_info_index >= 0) && (wp->weapon_info_index < MAX_WEAPON_TYPES)); + SDL_assert((wp->weapon_info_index >= 0) && (wp->weapon_info_index < MAX_WEAPON_TYPES)); wip = &Weapon_info[wp->weapon_info_index]; child_id = wip->spawn_type; @@ -3098,11 +3098,11 @@ int weapon_area_calc_damage(object *objp, vector *pos, float inner_rad, float ou } else { float dist_to_outer_rad_squared, total_dist_squared; min_dist = dist - objp->radius; - Assert(min_dist < outer_rad); + SDL_assert(min_dist < outer_rad); dist_to_outer_rad_squared = (outer_rad-min_dist)*(outer_rad-min_dist); total_dist_squared = (inner_rad-outer_rad)*(inner_rad-outer_rad); // AL 2-24-98: drop off damage relative to square of distance - Assert(dist_to_outer_rad_squared <= total_dist_squared); + SDL_assert(dist_to_outer_rad_squared <= total_dist_squared); *damage = max_damage * dist_to_outer_rad_squared/total_dist_squared; @@ -3141,7 +3141,7 @@ void weapon_area_apply_blast(vector *force_apply_pos, object *ship_obj, vector * vm_vec_sub(&vec_ship_to_impact, blast_pos, &ship_obj->pos); pm = model_get(Ships[ship_obj->instance].modelnum); - Assert ( pm != NULL ); + SDL_assert ( pm != NULL ); if (make_shockwave) { physics_apply_shock (&force, blast, &ship_obj->phys_info, &ship_obj->orient, &pm->mins, &pm->maxs, pm->rad); @@ -3171,7 +3171,7 @@ void weapon_do_area_effect(object *wobjp, vector *pos, object *other_obj) wip = &Weapon_info[Weapons[wobjp->instance].weapon_info_index]; wp = &Weapons[wobjp->instance]; - Assert(wip->inner_radius != 0); + SDL_assert(wip->inner_radius != 0); // only blast ships and asteroids for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) { @@ -3225,11 +3225,11 @@ void weapon_do_area_effect(object *wobjp, vector *pos, object *other_obj) // void weapon_hit( object * weapon_obj, object * other_obj, vector * hitpos ) { - Assert(weapon_obj != NULL); + SDL_assert(weapon_obj != NULL); if(weapon_obj == NULL){ return; } - Assert((weapon_obj->type == OBJ_WEAPON) && (weapon_obj->instance >= 0) && (weapon_obj->instance < MAX_WEAPONS)); + SDL_assert((weapon_obj->type == OBJ_WEAPON) && (weapon_obj->instance >= 0) && (weapon_obj->instance < MAX_WEAPONS)); if((weapon_obj->type != OBJ_WEAPON) || (weapon_obj->instance < 0) || (weapon_obj->instance >= MAX_WEAPONS)){ return; } @@ -3240,7 +3240,7 @@ void weapon_hit( object * weapon_obj, object * other_obj, vector * hitpos ) weapon_info *wip; // int np_index; - Assert((weapon_type >= 0) && (weapon_type < MAX_WEAPONS)); + SDL_assert((weapon_type >= 0) && (weapon_type < MAX_WEAPONS)); if((weapon_type < 0) || (weapon_type >= MAX_WEAPONS)){ return; } @@ -3301,11 +3301,11 @@ void weapon_hit( object * weapon_obj, object * other_obj, vector * hitpos ) void weapon_detonate(object *objp) { - Assert(objp != NULL); + SDL_assert(objp != NULL); if(objp == NULL){ return; } - Assert((objp->type == OBJ_WEAPON) && (objp->instance >= 0)); + SDL_assert((objp->type == OBJ_WEAPON) && (objp->instance >= 0)); if((objp->type != OBJ_WEAPON) || (objp->instance < 0)){ return; } @@ -3325,7 +3325,7 @@ int weapon_name_lookup(const char *name) int i; for ( i=0; i < Num_weapon_types; i++) { - if (!stricmp(name, Weapon_info[i].name)) { + if (!SDL_strcasecmp(name, Weapon_info[i].name)) { return i; } } @@ -3473,7 +3473,7 @@ void weapons_page_in() bm_page_in_texture( bitmap_num ); } } - Assert( cmeasurep->model_num > -1 ); + SDL_assert( cmeasurep->model_num > -1 ); } } @@ -3491,9 +3491,9 @@ void weapon_get_laser_color(color *c, object *objp) } // sanity - Assert(objp->type == OBJ_WEAPON); - Assert(objp->instance >= 0); - Assert(Weapons[objp->instance].weapon_info_index >= 0); + SDL_assert(objp->type == OBJ_WEAPON); + SDL_assert(objp->instance >= 0); + SDL_assert(Weapons[objp->instance].weapon_info_index >= 0); if((objp->type != OBJ_WEAPON) || (objp->instance < 0) || (Weapons[objp->instance].weapon_info_index < 0)){ return; } @@ -3539,10 +3539,10 @@ void weapon_maybe_spew_particle(object *obj) float ang; // check some stuff - Assert(obj->type == OBJ_WEAPON); - Assert(obj->instance >= 0); - Assert(Weapons[obj->instance].weapon_info_index >= 0); - Assert(Weapon_info[Weapons[obj->instance].weapon_info_index].wi_flags & WIF_PARTICLE_SPEW); + SDL_assert(obj->type == OBJ_WEAPON); + SDL_assert(obj->instance >= 0); + SDL_assert(Weapons[obj->instance].weapon_info_index >= 0); + SDL_assert(Weapon_info[Weapons[obj->instance].weapon_info_index].wi_flags & WIF_PARTICLE_SPEW); wp = &Weapons[obj->instance]; @@ -3700,7 +3700,7 @@ float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target) ship_info *sip; // get some info on the ship - Assert((target->instance >= 0) && (target->instance < MAX_SHIPS)); + SDL_assert((target->instance >= 0) && (target->instance < MAX_SHIPS)); if((target->instance < 0) || (target->instance >= MAX_SHIPS)){ return total_scale; } -- 2.39.2