diff --git a/src/fragglescript/t_script.cpp b/src/fragglescript/t_script.cpp index 48f0c62500..72e1e4ae8a 100644 --- a/src/fragglescript/t_script.cpp +++ b/src/fragglescript/t_script.cpp @@ -170,7 +170,6 @@ DFsScript::DFsScript() void DFsScript::Destroy() { - if (this == global_script) global_script = NULL; ClearVariables(true); ClearSections(); ClearChildren(); @@ -667,29 +666,10 @@ static int LS_FS_Execute (line_t *ln, AActor *it, bool backSide, void FS_Close() { - int i; - DFsVariable *current, *next; - if (global_script != NULL) { - // we have to actually delete the global variables if we don't want - // to get them reported as memory leaks. - for (i = 0; i < VARIABLESLOTS; i++) - { - current = global_script->variables[i]; - - while (current) - { - next = current->next; // save for after freeing - - current->ObjectFlags |= OF_YesReallyDelete; - delete current; - current = next; // go to next in chain - } - } GC::DelSoftRoot(global_script); - global_script->ObjectFlags |= OF_YesReallyDelete; - delete global_script; + global_script->Destroy(); global_script = NULL; } } diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 7e0332963e..25b3c87677 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2892,8 +2892,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget) PARAM_ANGLE_OPT(max_turn) { max_turn = 0; } PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; } PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; } - PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; } - PARAM_INT_OPT(flags) { max_turn = 0; } + PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; } + PARAM_INT_OPT(flags) { flags = 0; } A_FaceTarget(self, max_turn, max_pitch, ang_offset, pitch_offset, flags); return 0; @@ -2905,8 +2905,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster) PARAM_ANGLE_OPT(max_turn) { max_turn = 0; } PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; } PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; } - PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; } - PARAM_INT_OPT(flags) { max_turn = 0; } + PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; } + PARAM_INT_OPT(flags) { flags = 0; } A_FaceMaster(self, max_turn, max_pitch, ang_offset, pitch_offset, flags); return 0; @@ -2918,8 +2918,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer) PARAM_ANGLE_OPT(max_turn) { max_turn = 0; } PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; } PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; } - PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; } - PARAM_INT_OPT(flags) { max_turn = 0; } + PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; } + PARAM_INT_OPT(flags) { flags = 0; } A_FaceTracer(self, max_turn, max_pitch, ang_offset, pitch_offset, flags); return 0;