# LOCA

if settingmode!0: killvar '$cheatmenu'

!{
msg "Changed Location 
	$menu_loc		<<$menu_loc>> 
	$menu_arg		<<$menu_arg>> 
	$loc_arg		<<$loc_arg>> 
	$loc			<<$loc>> 
	$location_type	<<$location_type>> 
	$locM			<<$locM>>
	$locclass		<<$locclass>>"

msg "Changed Location 
	$loc			<<$loc>> 
	$location_type	<<$location_type>> 
	$locclass		<<$locclass>>"
}

if mod_list > 0:
	mod_i=1
	:mod_exec
	if $mod_name[mod_i] ! '':
		gs 'mod_<<$mod_name[mod_i]>>', $ARGS[0], $ARGS[1], $ARGS[2], $ARGS[3], $ARGS[4], $ARGS[5], $ARGS[6], $ARGS[7], $ARGS[8]
	end
	
	if mod_list > mod_i:
		mod_i+=1
		jump 'mod_exec'
	end
end

if call_trace_enabled ! 0 and call_trace_manual = 0:
	$call_trace_line = "'<<$curloc>>'"

	call_trace_index = 0
	:call_trace_loop
	if call_trace_index < arrsize("$ARGS"):
		if $ARGS[call_trace_index] ! '':
			$call_trace_line += ", '<<$ARGS[call_trace_index]>>'"
		else
			$call_trace_line += ", <<ARGS[call_trace_index]>>"
		end
		call_trace_index += 1
		jump 'call_trace_loop'
	end
	killvar 'call_trace_index'

	$call_trace += $call_trace_line + '<br>'
	killvar '$call_trace_line'
	if call_trace_shown ! 0: gs 'stat_display'
end

!!	MANUAL CALL TRACE SNIPPET
!?	Why use manual call trace:
!	- auto mode doesnt catch `gs` calls, manual does
!?	HOWTO use:
!	- put it at the head of the location you want to debug
!	  set location name (if you want it to make sense and look nice)

! {
call_trace_manual = 1
$call_trace_line = "'PUT_LOC_NAME_HERE'"

call_trace_index = 0
:call_trace_loop
if call_trace_index < arrsize("$ARGS"):
    if $ARGS[call_trace_index] ! '':
        $call_trace_line += ", '<<$ARGS[call_trace_index]>>'"
    else
        $call_trace_line += ", <<ARGS[call_trace_index]>>"
    end
    call_trace_index += 1
    jump 'call_trace_loop'
end
killvar 'call_trace_index'

$call_trace += $call_trace_line + '<br>'
killvar '$call_trace_line'
if call_trace_shown ! 0: gs 'stat_display'
}

--- LOCA ---------------------------------

