User File #637964408295913180

Upload All User Files

#637964408295913180 - Duke Nukem 1 Episode 1 position script

dn1e1lua.lua
103 downloads
Uploaded 8/18/2022 5:33 PM by slamo (see all 61)
Shows basic x, y position and position changes.
dofile("textrender.lua");

lagged = 0;
totalframes = 0;
lastxpos = 0;
lastypos = 0;
lastfcnt = 0;
deltaxpos = 0;
deltaypos = 0;
lastcustom = 0;
deltacustom = 0;

while true do
	a, b = jpcrr.wait_event();
	if a == "lock" then
		--xpos = jpcrr.read_byte(0x1D689)+jpcrr.read_byte(0x1D68D);
		--ypos = jpcrr.read_byte(0x1D68B)+jpcrr.read_word(0x1D68F);
		xpos = jpcrr.read_byte(0x1C999)+jpcrr.read_byte(0x1C99D);
		ypos = jpcrr.read_byte(0x1C99B)+jpcrr.read_word(0x1C99F);
		--custom = jpcrr.read_word(0x30CA6);
		fcnt = jpcrr.frame_number();
		jpcrr.hud.top_gap(3, 16);
		text = string.format("Pos: (%3u,%3u)/(%+3d,%+3d)", xpos, ypos, deltaxpos, deltaypos);
		render_text(3, 0, 0, text, false, 0, 255, 0);
		if (xpos ~= lastxpos) or (ypos ~= lastypos) then
			deltaxpos = xpos - lastxpos;
			deltaypos = ypos - lastypos;
			--deltacustom = custom - lastcustom;
			lastxpos = xpos;
			lastypos = ypos;
			--lastcustom = custom;
			lastfcnt = fcnt;
		end
		jpcrr.release_vga();
	end
end