From 07a789e9dc4c871464acdfd60afeeca3e8955845 Mon Sep 17 00:00:00 2001 From: bobboau Date: Sat, 6 Mar 2004 23:28:24 +0000 Subject: [PATCH] fixed motion debris animated laser textures and added a new error check called a safepoint, mostly for tracking the 'Y bug' --- code/code.dsp | 2 +- code/exceptionhandler/exceptionhandler.cpp | 16 +++++++-- code/hud/hudtarget.cpp | 16 +++++++-- code/mission/missionmessage.cpp | 34 ++++++++++--------- code/model/modelinterp.cpp | 14 +++++--- code/osapi/outwnd.cpp | 38 ++++++++++++++++++++-- code/osapi/outwnd.h | 7 ++++ code/render/3ddraw.cpp | 15 +++++++-- code/render/3dlaser.cpp | 14 +++++--- code/ship/aicode.cpp | 13 +++++--- code/weapon/weapons.cpp | 12 ++++--- 11 files changed, 135 insertions(+), 46 deletions(-) diff --git a/code/code.dsp b/code/code.dsp index ed972ce009..609a466522 100644 --- a/code/code.dsp +++ b/code/code.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "..\Release\Profile" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /Ot /Ow /Og /Oi /Oy /Ob2 /I "." /I "c:\mssdk\include\\" /I "c:\dxsdk\include" /I "c:\speech_api\include" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "USE_OPENGL" /D "MORE_SPECIES" /D "FS2_SPEECH" /U "_DEBUG" /YX /FD /c +# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /Ot /Ow /Og /Oi /Oy /Ob2 /I "." /I "c:\mssdk\include\\" /I "c:\dxsdk\include" /I "c:\speech_api\include" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "USE_OPENGL" /D "MORE_SPECIES" /D "NO_DSHOW_CODE" /U "_DEBUG" /YX /FD /c # SUBTRACT CPP /X # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" diff --git a/code/exceptionhandler/exceptionhandler.cpp b/code/exceptionhandler/exceptionhandler.cpp index 3cd2cb4277..11319c00a6 100644 --- a/code/exceptionhandler/exceptionhandler.cpp +++ b/code/exceptionhandler/exceptionhandler.cpp @@ -9,13 +9,18 @@ /* * $Logfile: /Freespace2/code/ExceptionHandler/ExceptionHandler.cpp $ - * $Revision: 2.3 $ - * $Date: 2003-11-11 02:15:43 $ - * $Author: Goober5000 $ + * $Revision: 2.4 $ + * $Date: 2004-03-06 23:28:22 $ + * $Author: bobboau $ * * Main file for dealing with exception handling * * $Log: not supported by cvs2svn $ + * Revision 2.3 2003/11/11 02:15:43 Goober5000 + * ubercommit - basically spelling and language fixes with some additional + * warnings disabled + * --Goober5000 + * * Revision 2.2 2003/11/06 20:22:03 Kazan * slight change to .dsp - leave the release target as fs2_open_r.exe already * added myself to credit @@ -343,6 +348,7 @@ static char* GetFilePart(char *source) // // -------------------- +extern char safe_string[512]; // Entry point into the main exception handling routine. This routine is put into an except() // statment at the beginning of a thread and is called anytime that there is a program exception @@ -527,11 +533,15 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message) } #endif + + RecordModuleList(LogFile); CloseHandle(LogFile); // Return the magic value which tells Win32 that this handler didn't // actually handle the exception - so that things will proceed as per // normal. + if(safe_string[0])hprintf(LogFile, "\nlast safe point \n%s\n",safe_string); + return EXCEPTION_CONTINUE_SEARCH; } diff --git a/code/hud/hudtarget.cpp b/code/hud/hudtarget.cpp index 4b2808098b..37babbda45 100644 --- a/code/hud/hudtarget.cpp +++ b/code/hud/hudtarget.cpp @@ -9,13 +9,17 @@ /* * $Logfile: /Freespace2/code/Hud/HUDtarget.cpp $ - * $Revision: 2.25 $ - * $Date: 2004-03-05 09:02:04 $ - * $Author: Goober5000 $ + * $Revision: 2.26 $ + * $Date: 2004-03-06 23:28:23 $ + * $Author: bobboau $ * * C module to provide HUD targeting functions * * $Log: not supported by cvs2svn $ + * Revision 2.25 2004/03/05 09:02:04 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.24 2004/01/30 07:39:07 Goober5000 * whew - I just went through all the code I ever added (or at least, that I could * find that I commented with a Goober5000 tag) and added a bunch of Asserts @@ -998,6 +1002,7 @@ void hud_reticle_list_update(object *objp, float measure, int dot_flag) // object *hud_reticle_pick_target() { + SAFEPOINT("entering hud_reticle_pick_target"); reticle_list *cur_rl, *save_rl, *new_rl; object *return_objp; int in_save_list, i; @@ -1025,6 +1030,7 @@ object *hud_reticle_pick_target() continue; } } + SAFEPOINT("debris looking done"); if ( ship_in_list && debris_in_list ) { // cull debris @@ -1040,6 +1046,7 @@ object *hud_reticle_pick_target() rl = next; } } + SAFEPOINT("debris culled"); for ( cur_rl = GET_FIRST(&Reticle_cur_list); cur_rl != END_OF_LIST(&Reticle_cur_list); cur_rl = GET_NEXT(cur_rl) ) { in_save_list = 0; @@ -1069,6 +1076,7 @@ object *hud_reticle_pick_target() break; } } // end for + SAFEPOINT("list looking"); if ( return_objp == NULL && !EMPTY(&Reticle_cur_list) ) { i = hud_reticle_list_find_free(); @@ -1081,8 +1089,10 @@ object *hud_reticle_pick_target() hud_reticle_clear_list(&Reticle_save_list); list_append(&Reticle_save_list, new_rl); } + SAFEPOINT("empty finding"); return return_objp; + SAFEPOINT("leaveng hud_reticle_pick_target"); } // hud_target_hotkey_add_remove takes as its parameter which hotkey (1-0) to add/remove the current diff --git a/code/mission/missionmessage.cpp b/code/mission/missionmessage.cpp index d947967c84..76284342c2 100644 --- a/code/mission/missionmessage.cpp +++ b/code/mission/missionmessage.cpp @@ -9,13 +9,17 @@ /* * $Logfile: /Freespace2/code/Mission/MissionMessage.cpp $ - * $Revision: 2.11 $ - * $Date: 2004-03-05 09:02:06 $ - * $Author: Goober5000 $ + * $Revision: 2.12 $ + * $Date: 2004-03-06 23:28:23 $ + * $Author: bobboau $ * * Controls messaging to player during the mission * * $Log: not supported by cvs2svn $ + * Revision 2.11 2004/03/05 09:02:06 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.10 2004/02/20 04:29:55 bobboau * pluged memory leaks, * 3D HTL lasers (they work perfictly) @@ -835,7 +839,7 @@ void parse_msgtbl() // this is called at the start of each level void messages_init() { - int rval, i, j; + int rval, i; static int table_read = 0; if ( !table_read ) { @@ -897,22 +901,12 @@ void messages_init() memset(Message_times, 0, sizeof(int)*MAX_MISSION_MESSAGES); - //Taylor from icculus found and fixed this -Bobboau - // free up remaining anim data - for (i=0; iref_count; j++) { - anim_free(Message_avis[i].anim_data); - } - } - Message_avis[i].anim_data = NULL; - } } // called to do cleanup when leaving a mission void message_mission_shutdown() { - int i; + int i, j; mprintf(("Unloading in mission messages\n")); @@ -926,6 +920,16 @@ void message_mission_shutdown() } fsspeech_stop(); + //Taylor from icculus found and fixed this -Bobboau + // free up remaining anim data + for (i=0; iref_count; j++) { + anim_free(Message_avis[i].anim_data); + } + } + Message_avis[i].anim_data = NULL; + } } // functions to deal with queuing messages to the message system. diff --git a/code/model/modelinterp.cpp b/code/model/modelinterp.cpp index f753afe8b0..fa7296dee3 100644 --- a/code/model/modelinterp.cpp +++ b/code/model/modelinterp.cpp @@ -9,13 +9,17 @@ /* * $Logfile: /Freespace2/code/Model/ModelInterp.cpp $ - * $Revision: 2.74 $ - * $Date: 2004-03-05 09:02:07 $ - * $Author: Goober5000 $ + * $Revision: 2.75 $ + * $Date: 2004-03-06 23:28:23 $ + * $Author: bobboau $ * * Rendering models, I think. * * $Log: not supported by cvs2svn $ + * Revision 2.74 2004/03/05 09:02:07 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.73 2004/03/05 04:16:20 phreak * made OpenGl use the matrix api if called by g3_start_**** or g3_done_instance * @@ -3881,7 +3885,7 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags // g3_draw_bitmap(&pt,0,w*0.5f*Interp_thrust_glow_rad_factor, TMAP_FLAG_TEXTURED ); if(Cmdline_nohtl)g3_draw_bitmap(&pt,0,w*0.5f*Interp_thrust_glow_rad_factor, TMAP_FLAG_TEXTURED ); - else g3_draw_bitmap(&pt,0,w*0.5f*Interp_thrust_glow_rad_factor, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT, w ); + else g3_draw_bitmap(&pt,0,w*0.5f*Interp_thrust_glow_rad_factor, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT, w*0.325 ); //g3_draw_rotated_bitmap(&p,0.0f,w,w, TMAP_FLAG_TEXTURED ); } @@ -3889,7 +3893,7 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags if(Interp_tertiary_thrust_glow_bitmap > -1){ //tertiary thruster glows, suposet to be a complement to the secondary thruster glows, it simulates the effect of an ion wake or something, - //thus is imostly for haveing a glow that is visable from the front + //thus is mostly for haveing a glow that is visable from the front gr_set_bitmap( Interp_tertiary_thrust_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, (The_mission.flags & MISSION_FLAG_FULLNEB)?(1.0f - neb2_get_fog_intensity(&npnt)):1.0f ); p.sw -= w; diff --git a/code/osapi/outwnd.cpp b/code/osapi/outwnd.cpp index 82dc8cb576..31b6fa1f13 100644 --- a/code/osapi/outwnd.cpp +++ b/code/osapi/outwnd.cpp @@ -9,13 +9,17 @@ /* * $Logfile: /Freespace2/code/OsApi/OutWnd.cpp $ - * $Revision: 2.8 $ - * $Date: 2004-03-05 09:02:08 $ - * $Author: Goober5000 $ + * $Revision: 2.9 $ + * $Date: 2004-03-06 23:28:23 $ + * $Author: bobboau $ * * Routines for debugging output * * $Log: not supported by cvs2svn $ + * Revision 2.8 2004/03/05 09:02:08 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.7 2004/02/14 00:18:35 randomtiger * Please note that from now on OGL will only run with a registry set by Launcher v4. See forum for details. * OK, these changes effect a lot of file, I suggest everyone updates ASAP: @@ -496,6 +500,7 @@ void mono_print( char * text, int len ) mono_flush(); } + void outwnd_printf(char *id, char *format, ...) { char tmp[MAX_LINE_WIDTH*4]; @@ -1420,3 +1425,30 @@ void outwnd_close() #endif //NDEBUG + + +#include "debugconsole/dbugfile.h" +#include + +#include +#include +#include + +char safe_string[512] = {0}; + +void safe_point_print(char *format, ...){ + char tmp[512]; + va_list args; + + va_start(args, format); + vsprintf(tmp, format, args); + va_end(args); + strcpy(safe_string, tmp); +} + +void safe_point(char *file, int line, char *format, ...) +{ + safe_point_print("last safepoint: %s, %d; [%s]", file, line, format); +} + + diff --git a/code/osapi/outwnd.h b/code/osapi/outwnd.h index 8531f2e158..c4101f7de8 100644 --- a/code/osapi/outwnd.h +++ b/code/osapi/outwnd.h @@ -22,4 +22,11 @@ void outwnd_printf2(char *format, ...); extern int Log_debug_output_to_file; #endif +#define SAFEPOINT(s) safe_point(__FILE__,__LINE__,(s)) + +extern char safe_string[512]; + +void safe_point(char *file, int line, char *format, ...); + + #endif diff --git a/code/render/3ddraw.cpp b/code/render/3ddraw.cpp index 6e17a432cd..08ea1afb95 100644 --- a/code/render/3ddraw.cpp +++ b/code/render/3ddraw.cpp @@ -9,13 +9,17 @@ /* * $Logfile: /Freespace2/code/Render/3ddraw.cpp $ - * $Revision: 2.17 $ - * $Date: 2004-03-05 09:01:51 $ - * $Author: Goober5000 $ + * $Revision: 2.18 $ + * $Date: 2004-03-06 23:28:24 $ + * $Author: bobboau $ * * 3D rendering primitives * * $Log: not supported by cvs2svn $ + * Revision 2.17 2004/03/05 09:01:51 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.16 2004/02/27 04:09:56 bobboau * fixed a Z buffer error in HTL submodel rendering, * and glow points, @@ -408,6 +412,11 @@ int g3_draw_poly(int nv,vertex **pointlist,uint tmap_flags) gr_tmapper( nv, pointlist, tmap_flags ); return 0; } + //don't clip in HT&L mode, the card does it for us + if(!Cmdline_nohtl && (tmap_flags & TMAP_FLAG_TRISTRIP)) { + gr_tmapper( nv, pointlist, tmap_flags ); + return 0; + } if(Cmdline_nohtl && (tmap_flags & TMAP_FLAG_TRISTRIP)){ bool starting = true; int offset = 0; diff --git a/code/render/3dlaser.cpp b/code/render/3dlaser.cpp index 376f5c4e91..e7522e024a 100644 --- a/code/render/3dlaser.cpp +++ b/code/render/3dlaser.cpp @@ -9,13 +9,17 @@ /* * $Logfile: /Freespace2/code/Render/3dLaser.cpp $ - * $Revision: 2.8 $ - * $Date: 2004-03-05 09:01:51 $ - * $Author: Goober5000 $ + * $Revision: 2.9 $ + * $Date: 2004-03-06 23:28:24 $ + * $Author: bobboau $ * * Code to draw 3d looking lasers * * $Log: not supported by cvs2svn $ + * Revision 2.8 2004/03/05 09:01:51 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.7 2004/02/28 14:14:57 randomtiger * Removed a few uneeded if DIRECT3D's. * Set laser function to only render the effect one sided. @@ -330,7 +334,7 @@ float g3_draw_laser(vector *headp, float head_width, vector *tailp, float tail_w if (!Lasers){ return 0.0f; } - if((!Cmdline_nohtl) + if((!Cmdline_nohtl) && tmap_flags & TMAP_HTL_3D_UNLIT ){ //&&(gr_screen.mode == GR_OPENGL)) { return @@ -493,7 +497,7 @@ float g3_draw_laser_rgb(vector *headp, float head_width, vector *tailp, float ta if (!Lasers){ return 0.0f; } - if((!Cmdline_nohtl) + if((!Cmdline_nohtl) && tmap_flags & TMAP_HTL_3D_UNLIT ){ // &&(gr_screen.mode==GR_OPENGL)) { return diff --git a/code/ship/aicode.cpp b/code/ship/aicode.cpp index 64c7a1f6e7..e1b923e27d 100644 --- a/code/ship/aicode.cpp +++ b/code/ship/aicode.cpp @@ -9,13 +9,17 @@ /* * $Logfile: /Freespace2/code/Ship/AiCode.cpp $ - * $Revision: 2.55 $ - * $Date: 2004-03-05 09:01:51 $ - * $Author: Goober5000 $ + * $Revision: 2.56 $ + * $Date: 2004-03-06 23:28:24 $ + * $Author: bobboau $ * * AI code that does interesting stuff * * $Log: not supported by cvs2svn $ + * Revision 2.55 2004/03/05 09:01:51 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.54 2004/02/28 01:36:20 Goober5000 * commented a slide_face_ship that I missed before * --Goober5000 @@ -3826,7 +3830,8 @@ 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); + if(pm->n_paths <= path_num)Error(LOCATION,"ai_find_path tring to find a path (%d) that doesn't exsist, on ship %s", path_num, shipp->ship_name); + // Assert(pm->n_paths > path_num); aip->goal_objnum = objp-Objects; aip->goal_signature = objp->signature; if (exit_flag) diff --git a/code/weapon/weapons.cpp b/code/weapon/weapons.cpp index 832e127eb0..56d4753c46 100644 --- a/code/weapon/weapons.cpp +++ b/code/weapon/weapons.cpp @@ -12,6 +12,10 @@ * * * $Log: not supported by cvs2svn $ + * Revision 2.55 2004/03/05 09:01:54 Goober5000 + * Uber pass at reducing #includes + * --Goober5000 + * * Revision 2.54 2004/02/20 04:29:57 bobboau * pluged memory leaks, * 3D HTL lasers (they work perfictly) @@ -1067,7 +1071,7 @@ int parse_weapon() wip->laser_bitmap = bm_load( wip->pofbitmap_name ); if(wip->laser_bitmap < 0){ //if it couldn't find the pcx look for an ani-Bobboau nprintf(("General","couldn't find pcx for %s \n", wip->name)); - wip->laser_bitmap = bm_load_animation(wip->pofbitmap_name, &wip->laser_bitmap_nframes, &wip->laser_bitmap_fps, 1); + wip->laser_bitmap = bm_load_animation(wip->pofbitmap_name, &wip->laser_bitmap_nframes, &wip->laser_bitmap_fps, 1); if(wip->laser_bitmap < 0){ nprintf(("General","couldn't find ani for %s \n", wip->name)); Warning( LOCATION, "Couldn't open texture '%s'\nreferenced by weapon '%s'\n", wip->pofbitmap_name, wip->name ); @@ -2222,7 +2226,7 @@ void weapon_render(object *obj) vector headp; vm_vec_scale_add(&headp, &obj->pos, &obj->orient.vec.fvec, wip->laser_length); wp->weapon_flags &= ~WF_CONSIDER_FOR_FLYBY_SOUND; - if ( g3_draw_laser(&headp, wip->laser_head_radius, &obj->pos, wip->laser_tail_radius) ) { + if ( g3_draw_laser(&headp, wip->laser_head_radius, &obj->pos, wip->laser_tail_radius, TMAP_FLAG_TEXTURED | TMAP_FLAG_XPARENT | TMAP_HTL_3D_UNLIT) ) { wp->weapon_flags |= WF_CONSIDER_FOR_FLYBY_SOUND; } } @@ -2234,14 +2238,14 @@ void weapon_render(object *obj) vector headp2; vm_vec_scale_add(&headp2, &obj->pos, &obj->orient.vec.fvec, wip->laser_length * weapon_glow_scale_l); - if(wip->laser_bitmap_nframes > 1){//set the proper bitmap + if(wip->laser_glow_bitmap_nframes > 1){//set the proper bitmap // wp->gframe += ((timestamp() / (int)(wip->laser_glow_bitmap_fps)) % wip->laser_glow_bitmap_nframes); wp->gframe = (int)(wp->gframe + ((int)(flFrametime * 1000) / wip->laser_glow_bitmap_fps)) % wip->laser_glow_bitmap_nframes; gr_set_bitmap(wip->laser_glow_bitmap + wp->gframe, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, weapon_glow_alpha); }else{ gr_set_bitmap(wip->laser_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, weapon_glow_alpha); } - g3_draw_laser_rgb(&headp2, wip->laser_head_radius * weapon_glow_scale_f, &obj->pos, wip->laser_tail_radius * weapon_glow_scale_r, c.red, c.green, c.blue); + g3_draw_laser_rgb(&headp2, wip->laser_head_radius * weapon_glow_scale_f, &obj->pos, wip->laser_tail_radius * weapon_glow_scale_r, c.red, c.green, c.blue, TMAP_FLAG_TEXTURED | TMAP_FLAG_XPARENT | TMAP_HTL_3D_UNLIT); } break; }