This file is indexed.

/usr/share/openmsx/scripts/osd_nemesis.tcl is in openmsx-data 0.8.2-2.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
set_help_text toggle_nemesis_1_shield \
{This command (de)activates some Nemesis 1 toys:
 - A shield around the players ship: enemy bullets will bounce off this shield.
 - Allow to move the ship with the mouse (click right mouse button to activate, click again to disable).
}

namespace eval osd_nemesis {

variable move_active false
variable after_frame_id
variable after_mouse_button_id

proc toggle_nemesis_1_shield {} {
	if {[osd exists "nemesis1"]} {
		disable_nemesis_1_shield
	} else {
		enable_nemesis_1_shield
	}
	return ""
}
namespace export toggle_nemesis_1_shield

proc disable_nemesis_1_shield {} {
	variable after_frame_id
	variable after_mouse_button_id

	osd destroy "nemesis1"
	after cancel $after_frame_id
	after cancel $after_mouse_button_id
}

proc enable_nemesis_1_shield {} {
	variable move_active
	variable after_frame_id
	variable after_mouse_button_id

	osd_widgets::msx_init "nemesis1"
	osd create rectangle "nemesis1.shield" \
		-fadeCurrent 0 -fadeTarget 0 -fadePeriod 2 \
		-image [data_file scripts/shield.png]

	set move_active false

	set after_frame_id [after frame osd_nemesis::after_frame]
	set after_mouse_button_id [after "mouse button1 down" osd_nemesis::after_mouse]
}

proc after_mouse {} {
	# click to capture and click again to release
	variable move_active
	variable after_mouse_button_id
	set move_active [expr {!$move_active}]
	set after_mouse_button_id [after "mouse button1 down" osd_nemesis::after_mouse]
}

proc after_frame {} {
	variable move_active
	variable after_frame_id

	osd_widgets::msx_update "nemesis1"

	if {$move_active} {
		# move vic viper to mouse position
		lassign [osd info "nemesis1" -mousecoord] x y
		poke 0xe206 [utils::clip 0 255 [expr {int($x)}]]
		poke 0xe204 [utils::clip 0 212 [expr {int($y)}]]
	}

	# vic viper location
	set x [peek 0xe206]
	set y [peek 0xe204]
	osd configure "nemesis1.shield" -relx [expr {$x - 9}] -rely [expr {$y - 9}]

	for {set i 0} {$i < 32} {incr i} {
		# set base address
		set addr [expr {0xe300 + ($i * 0x20)}]

		# get enemy id
		set id [peek $addr]

		# enegry pod / flash pod / life pod / score pod /
		# endless score pod / explosion / end brain connections
		if {(17 <= $id) && ($id <= 26) && ($id != 20)} continue

		set a [peek [expr {$addr + 6}]]
		set b [peek [expr {$addr + 4}]]

		# Not in contact with shield? Then do nothing.
		if {((($a - $x + 6) ** 2) + (($b - $y + 7) ** 2)) >= 961} continue

		# ground turrets change into razor discs :)
		if {$id == 1 && $i < 16} {poke $addr 2}

		# homing ships and walkers
		if {$id == 4 || $id == 5} {poke $addr 21}

		# change color of sprite when in contact with shield
		# poke [expr {$addr + 13}] 15

		# Shield routine (hit front/back/top/bottom)
		set shieldstrength 2
		set dx [expr {($x > $a) ? -$shieldstrength : $shieldstrength}]
		set dy [expr {($y > $b) ? -$shieldstrength : $shieldstrength}]
		set xn [expr {$a + $dx}]
		set yn [expr {$b + $dy}]
		poke [expr {$addr +  6}] [utils::clip 0 255 $xn]
		poke [expr {$addr +  4}] [utils::clip 0 255 $yn]
		poke [expr {$addr +  8}] [expr {$dy & 255}]
		poke [expr {$addr + 10}] [expr {$dx & 255}]

		# make shield visible
		osd configure "nemesis1.shield" -fadeCurrent 0.5
	}
	set after_frame_id [after frame osd_nemesis::after_frame]
}

} ;# namespace osd_nemesis

namespace import osd_nemesis::*